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
|
|---|---|---|---|---|---|
fc0bb1b73efd14434581dfe9d636f78bca74c8bc
|
Lecture 4: ISA Tradeoffs (Continued) and MIPS ISA
Agenda for Today
- Finish off ISA tradeoffs
- A quick tutorial on MIPS ISA
Upcoming schedule:
- **Lab 1.5 & 2** are out today
- Friday (1/23): **Lab 1** due
- Friday (1/23): Recitation
- Wednesday (1/28): **HW 1** due
Upcoming Readings
- Next week (Microarchitecture):
- P&H, Chapter 4, Sections 4.1-4.4
- P&P, revised Appendix C – LC3b datapath and microprogrammed operation
Last Lecture Recap
- Instruction processing style
- 0, 1, 2, 3 address machines
- Elements of an ISA
- Instructions, data types, memory organizations, registers, etc
- Addressing modes
- Complex (CISC) vs. simple (RISC) instructions
- Semantic gap
- ISA translation
ISA-level Tradeoffs: Instruction Length
- **Fixed length**: Length of all instructions the same
- + Easier to decode single instruction in hardware
- + Easier to decode multiple instructions concurrently
- -- Wasted bits in instructions *(Why is this bad?)*
- -- Harder-to-extend ISA (how to add new instructions?)
- **Variable length**: Length of instructions different (determined by opcode and sub-opcode)
- + Compact encoding *(Why is this good?)*
- Intel 432: Huffman encoding (sort of). 6 to 321 bit instructions. *How?*
- -- More logic to decode a single instruction
- -- Harder to decode multiple instructions concurrently
- **Tradeoffs**
- Code size (memory space, bandwidth, latency) vs. hardware complexity
- ISA extensibility and expressiveness vs. hardware complexity
- Performance? Energy? Smaller code vs. ease of decode
**ISA-level Tradeoffs: Uniform Decode**
- **Uniform decode**: Same bits in each instruction correspond to the same meaning
- Opcode is always in the same location
- Ditto operand specifiers, immediate values, ...
- Many “RISC” ISAs: Alpha, MIPS, SPARC
- Easier decode, simpler hardware
- Enables parallelism: generate target address before knowing the instruction is a branch
-- Restricts instruction format (fewer instructions?) or wastes space
- **Non-uniform decode**
- E.g., opcode can be the 1st-7th byte in x86
- More compact and powerful instruction format
-- More complex decode logic
x86 vs. Alpha Instruction Formats
- **x86:**
<table>
<thead>
<tr>
<th>Instruction Prefixes</th>
<th>Opcode</th>
<th>ModR/M</th>
<th>SIB</th>
<th>Displacement</th>
<th>Immediate</th>
</tr>
</thead>
<tbody>
<tr>
<td>Up to four prefixes of 1 byte each (optional)</td>
<td>1-, 2-, or 3-byte opcode</td>
<td>1 byte (if required)</td>
<td>1 byte (if required)</td>
<td>Address displacement of 1, 2, or 4 bytes or none</td>
<td>Immediate data of 1, 2, or 4 bytes or none</td>
</tr>
</tbody>
</table>
- **Alpha:**
![Alpha Instruction Format Diagram]
MIPS Instruction Format
- **R-type, 3 register operands**
<table>
<thead>
<tr>
<th>0</th>
<th>rs</th>
<th>rt</th>
<th>rd</th>
<th>shamt</th>
<th>funct</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>6-bit</td>
</tr>
</tbody>
</table>
- **I-type, 2 register operands and 16-bit immediate operand**
<table>
<thead>
<tr>
<th>opcode</th>
<th>rs</th>
<th>rt</th>
<th>immediate</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>16-bit</td>
</tr>
</tbody>
</table>
- **J-type, 26-bit immediate operand**
<table>
<thead>
<tr>
<th>opcode</th>
<th>immediate</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>26-bit</td>
</tr>
</tbody>
</table>
- **Simple Decoding**
- 4 bytes per instruction, regardless of format
- must be 4-byte aligned (2 lsb of PC must be 2b’00)
- format and fields easy to extract in hardware
**Figure 4-1: ARM instruction set formats**
<table>
<thead>
<tr>
<th>Cond</th>
<th>Opcode</th>
<th>S</th>
<th>Rn</th>
<th>Rd</th>
<th>Operand 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>00</td>
<td>I</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>00000000 A S</td>
<td>Rd</td>
<td>Rn</td>
<td>Rs</td>
<td>1001</td>
<td>Rm</td>
</tr>
<tr>
<td>000001 U A S</td>
<td>RdHi</td>
<td>RdLo</td>
<td>Rn</td>
<td>1001</td>
<td>Rm</td>
</tr>
<tr>
<td>00010 B 00</td>
<td>Rn</td>
<td>Rd</td>
<td>00001001</td>
<td>Rm</td>
<td></td>
</tr>
<tr>
<td>0001001001</td>
<td>1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0</td>
<td>Rn</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>0000 PU0 WL</td>
<td>Rn</td>
<td>Rd</td>
<td>00001 SH 1</td>
<td>Rm</td>
<td></td>
</tr>
<tr>
<td>0000 PU1 WL</td>
<td>Rn</td>
<td>Rd</td>
<td>Offset</td>
<td>1 SH 1 Offset</td>
<td></td>
</tr>
<tr>
<td>011 PU BW L</td>
<td>Rn</td>
<td>Rd</td>
<td>Offset</td>
<td></td>
<td></td>
</tr>
<tr>
<td>011</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>1</td>
</tr>
<tr>
<td>100 PU SW L</td>
<td>Rn</td>
<td></td>
<td>Register List</td>
<td></td>
<td></td>
</tr>
<tr>
<td>101 L</td>
<td>Offset</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>110 PU NW L</td>
<td>Rn</td>
<td>CRd</td>
<td>CP#</td>
<td>Offset</td>
<td></td>
</tr>
<tr>
<td>1110 CP Opc</td>
<td>CRn</td>
<td>CRd</td>
<td>CP#</td>
<td>CP 0 CRm</td>
<td></td>
</tr>
<tr>
<td>1110 CP Opc</td>
<td>CRn</td>
<td>R</td>
<td>CP#</td>
<td>CP 1 CRm</td>
<td></td>
</tr>
</tbody>
</table>
**Data Processing / PSR Transfer**
**Multiply**
**Multiply Long**
**Single Data Swap**
**Branch and Exchange**
**Halfword Data Transfer: register offset**
**Halfword Data Transfer: immediate offset**
**Single Data Transfer**
**Undefined**
**Block Data Transfer**
**Branch**
**Coprocessor Data Transfer**
**Coprocessor Data Operation**
**Coprocessor Register Transfer**
**Software Interrupt**
**Ignored by processor**
A Note on Length and Uniformity
- Uniform decode usually goes with fixed length
- In a variable length ISA, uniform decode can be a property of instructions of the same length
- It is hard to think of it as a property of instructions of different lengths
A Note on RISC vs. CISC
- Usually, ...
- RISC
- Simple instructions
- Fixed length
- Uniform decode
- Few addressing modes
- CISC
- Complex instructions
- Variable length
- Non-uniform decode
- Many addressing modes
ISA-level Tradeoffs: Number of Registers
- **Affects:**
- Number of bits used for encoding register address
- Number of values kept in fast storage (register file)
- (uarch) Size, access time, power consumption of register file
- **Large number of registers:**
+ Enables better register allocation (and optimizations) by compiler → fewer saves/restores
-- Larger instruction size
-- Larger register file size
ISA-level Tradeoffs: Addressing Modes
- Addressing mode specifies how to obtain an operand of an instruction
- Register
- Immediate
- Memory (displacement, register indirect, indexed, absolute, memory indirect, autoincrement, autodecrement, ...)
- More modes:
+ help better support programming constructs (arrays, pointer-based accesses)
- make it harder for the architect to design
- too many choices for the compiler?
- Many ways to do the same thing complicates compiler design
x86 vs. Alpha Instruction Formats
- **x86:**
![x86 Instruction Format Diagram]
- Instruction Prefixes: Up to four prefixes of 1 byte each (optional)
- Opcode: 1-, 2-, or 3-byte opcode
- ModR/M: 1 byte (if required)
- SI B: 1 byte (if required)
- Displacement: Address displacement of 1, 2, or 4 bytes or none
- Immediate: Immediate data of 1, 2, or 4 bytes or none
- **Alpha:**
![Alpha Instruction Format Diagram]
- Opcode: RA | RB | Function | RC
- Number: Disp
- PALcode Format
- Branch Format
- Memory Format
- Operate Format
Table 2.2: 32-Bit Addressing Forms with the ModR/M Byte
<table>
<thead>
<tr>
<th>Effective Address</th>
<th>Mod</th>
<th>R/M</th>
<th>Value of ModR/M Byte (in Hexadecimal)</th>
</tr>
</thead>
<tbody>
<tr>
<td>[EAX] + disp8 2</td>
<td>01</td>
<td>001</td>
<td>04 48 50 58 60 68 70 78</td>
</tr>
<tr>
<td>[ECX] + disp8 2</td>
<td>01</td>
<td>002</td>
<td>04 49 51 59 61 69 71 79</td>
</tr>
<tr>
<td>[EDX] + disp8 2</td>
<td>01</td>
<td>003</td>
<td>04 4A 53 5A 62 6A 72 7A</td>
</tr>
<tr>
<td>[EBX] + disp8 2</td>
<td>01</td>
<td>004</td>
<td>04 4B 54 5B 63 6B 73 7B</td>
</tr>
<tr>
<td>[ESP] + disp8 2</td>
<td>01</td>
<td>005</td>
<td>04 4C 55 5C 64 6C 74 7C</td>
</tr>
<tr>
<td>[EBP] + disp8 2</td>
<td>01</td>
<td>006</td>
<td>04 4D 56 5D 65 6D 75 7D</td>
</tr>
<tr>
<td>[ESI] + disp8</td>
<td>01</td>
<td>007</td>
<td>04 4E 57 5E 66 6E 76 7E</td>
</tr>
<tr>
<td>[EDI] + disp8</td>
<td>01</td>
<td>008</td>
<td>04 4F 58 5F 67 6F 77 7F</td>
</tr>
<tr>
<td>[EAX] + disp32</td>
<td>10</td>
<td>010</td>
<td>08 88 90 98 A0 A8 B0 B8</td>
</tr>
<tr>
<td>[ECX] + disp32</td>
<td>10</td>
<td>011</td>
<td>08 89 91 99 A1 A9 B1 B9</td>
</tr>
<tr>
<td>[EDX] + disp32</td>
<td>10</td>
<td>012</td>
<td>08 8A 92 9A A2 AA B2 BA</td>
</tr>
<tr>
<td>[EBX] + disp32</td>
<td>10</td>
<td>013</td>
<td>08 8B 93 9B A3 AB B3 BB</td>
</tr>
<tr>
<td>[ESP] + disp32</td>
<td>10</td>
<td>014</td>
<td>08 8C 94 9C A4 AC B4 BC</td>
</tr>
<tr>
<td>[EBP] + disp32</td>
<td>10</td>
<td>015</td>
<td>08 8D 95 9D A5 AD B5 BD</td>
</tr>
<tr>
<td>[ESI] + disp32</td>
<td>10</td>
<td>016</td>
<td>08 8E 96 9E A6 AE B6 BE</td>
</tr>
<tr>
<td>[EDI] + disp32</td>
<td>10</td>
<td>017</td>
<td>08 8F 97 9F A7 AF B7 BF</td>
</tr>
</tbody>
</table>
Register
1. The [-][-] nomenclature means a SIB follows the ModR/M byte.
2. The disp32 nomenclature denotes a 32-bit displacement that follows the ModR/M byte (or the SIB byte if one is present) and that is added to the index.
3. The disp8 nomenclature denotes an 8-bit displacement that follows the ModR/M byte (or the SIB byte if one is present) and that is sign-extended and added to the index.
Table 2-3 is organized to give 256 possible values of the SIB byte (in hexadecimal). General purpose registers used as a base are indicated across the top of the table.
## Table 2-3. 32-Bit Addressing Forms with the SIB Byte
<table>
<thead>
<tr>
<th>Scaled Index</th>
<th>SS</th>
<th>Index</th>
<th>Value of SIB Byte (in Hexadecimal)</th>
</tr>
</thead>
<tbody>
<tr>
<td>[EAX]</td>
<td>00</td>
<td>000</td>
<td>0B 01 02 03 04 05 06 07</td>
</tr>
<tr>
<td>[ECX]</td>
<td>001</td>
<td>001</td>
<td>0B 09 0A 0B 0C 0D 0E 0F</td>
</tr>
<tr>
<td>[EDX]</td>
<td>010</td>
<td>010</td>
<td>18 19 1A 1B 1C 1D 1E 1F</td>
</tr>
<tr>
<td>none</td>
<td>100</td>
<td>100</td>
<td>30 29 28 27 26 25 24 23</td>
</tr>
<tr>
<td>[EBP]</td>
<td>101</td>
<td>101</td>
<td>38 39 3A 3B 3C 3D 3E 3F</td>
</tr>
<tr>
<td>[ESI]</td>
<td>110</td>
<td>110</td>
<td>40 41 42 43 44 45 46 47</td>
</tr>
<tr>
<td>[EDI]</td>
<td>111</td>
<td>111</td>
<td>50 51 52 53 54 55 56 57</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Scaled Index</th>
<th>SS</th>
<th>Index</th>
<th>Value of SIB Byte (in Hexadecimal)</th>
</tr>
</thead>
<tbody>
<tr>
<td>[EAX*2]</td>
<td>00</td>
<td>000</td>
<td>4B 49 4A 4B 4C 4D 4E 4F</td>
</tr>
<tr>
<td>[ECX*2]</td>
<td>001</td>
<td>001</td>
<td>58 59 5A 5B 5C 5D 5E 5F</td>
</tr>
<tr>
<td>[EDX*2]</td>
<td>010</td>
<td>010</td>
<td>60 61 62 63 64 65 66 67</td>
</tr>
<tr>
<td>[EBX*2]</td>
<td>011</td>
<td>011</td>
<td>70 71 72 73 74 75 76 77</td>
</tr>
<tr>
<td>none</td>
<td>100</td>
<td>100</td>
<td>80 81 82 83 84 85 86 87</td>
</tr>
<tr>
<td>[EBP*2]</td>
<td>101</td>
<td>101</td>
<td>90 91 92 93 94 95 96 97</td>
</tr>
<tr>
<td>[ESI*2]</td>
<td>110</td>
<td>110</td>
<td>0B 09 0A 0B 0C 0D 0E 0F</td>
</tr>
<tr>
<td>[EDI*2]</td>
<td>111</td>
<td>111</td>
<td>1B 1A 19 18 17 16 15 14</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Scaled Index</th>
<th>SS</th>
<th>Index</th>
<th>Value of SIB Byte (in Hexadecimal)</th>
</tr>
</thead>
<tbody>
<tr>
<td>[EAX*4]</td>
<td>00</td>
<td>000</td>
<td>B0 B1 B2 B3 B4 B5 B6 B7</td>
</tr>
<tr>
<td>[ECX*4]</td>
<td>001</td>
<td>001</td>
<td>B8 B9 BA BB BC BD BE BF</td>
</tr>
<tr>
<td>[EDX*4]</td>
<td>010</td>
<td>010</td>
<td>C0 C1 C2 C3 C4 C5 C6 C7</td>
</tr>
<tr>
<td>[EBX*4]</td>
<td>011</td>
<td>011</td>
<td>C8 C9 CA CB CC CD CE CF</td>
</tr>
<tr>
<td>none</td>
<td>100</td>
<td>100</td>
<td>D0 D1 D2 D3 D4 D5 D6 D7</td>
</tr>
<tr>
<td>[EBP*4]</td>
<td>101</td>
<td>101</td>
<td>E0 E1 E2 E3 E4 E5 E6 E7</td>
</tr>
<tr>
<td>[ESI*4]</td>
<td>110</td>
<td>110</td>
<td>F0 F1 F2 F3 F4 F5 F6 F7</td>
</tr>
<tr>
<td>[EDI*4]</td>
<td>111</td>
<td>111</td>
<td>FA FB FC FD FE FF</td>
</tr>
</tbody>
</table>
### NOTES:
1. The [*] nomenclature means a disp32 with no base if the MOD is 00B. Otherwise, [*] means disp8 or disp32 + [EBP]. This provides the following address modes:
**MOD bits** | **Effective Address**
---|---
00 | [scaled index] + disp32
01 | [scaled index] + disp8 + [EBP]
10 | [scaled index] + disp32 + [EBP]
X86 SIB-D Addressing Mode
Figure 3-11. Offset (or Effective Address) Computation
```
native 0
```
x86 Manual Vol. 1, page 3-22 -- see course resources on website
Also, see Section 3.7.3 and 3.7.5
The following addressing modes suggest uses for common combinations of address components.
- **Displacement** — A displacement alone represents a direct (uncomputed) offset to the operand. Because the displacement is encoded in the instruction, this form of an address is sometimes called an absolute or static address. It is commonly used to access a statically allocated scalar operand.
- **Base** — A base address is used to specify an offset to the operand. Since the value in the base register can change, it can be used to access a series of variables and data structures.
- **Base + Displacement** — A base register and a displacement can be used together for two distinct purposes:
- As an index into an array when the element size is not 2, 4, or 8 bytes—The displacement component encodes the static offset to the beginning of the array. The base register holds the results of a calculation to determine the offset to a specific element within the array.
- To access a field of a record: the base register holds the address of the beginning of the record, while the displacement is a static offset to the field.
An important special case of this combination is access to parameters in a procedure activation record. A procedure activation record is the stack frame created when a procedure is entered. Here, the EBP register is the best choice for the base register, because it automatically selects the stack segment. This is a compact encoding for this common function.
• (Index * Scale) + Displacement — This address mode offers an efficient way to index into a static array when the element size is 2, 4, or 8 bytes. The displacement locates the subscript of the desired array element, and the processor automatically converts the subscript into an index by applying the scaling factor.
• Base + Index + Displacement — Using two registers together supports either a two-dimensional array. Displacement holds the address of the beginning of the array or one of several instances of an array of records (the displacement is an offset to a field within the record).
• Base + (Index * Scale) + Displacement — Using all the addressing components together allows efficient indexing of a two-dimensional array when the elements of the array are 2, 4, or 8 bytes in size.
Other Example ISA-level Tradeoffs
- Condition codes vs. not
- VLIW vs. single instruction
- Precise vs. imprecise exceptions
- Virtual memory vs. not
- Unaligned access vs. not
- Hardware interlocks vs. software-guaranteed interlocking
- Software vs. hardware managed page fault handling
- Cache coherence (hardware vs. software)
- ...
...
Many ISA features designed to aid programmers
But, complicate the hardware designer’s job
Virtual memory
- vs. overlay programming
- Should the programmer be concerned about the size of code blocks fitting physical memory?
Addressing modes
Unaligned memory access
- Compiler/programmer needs to align data
MIPS: Aligned Access
- LW/SW alignment restriction: 4-byte word-alignment
- not designed to fetch memory bytes not within a word boundary
- not designed to rotate unaligned bytes into registers
- Provide separate opcodes for the “infrequent” case
<table>
<thead>
<tr>
<th>MSB</th>
<th>byte-3</th>
<th>byte-2</th>
<th>byte-1</th>
<th>byte-0</th>
<th>LSB</th>
</tr>
</thead>
<tbody>
<tr>
<td>byte-7</td>
<td>byte-6</td>
<td>byte-5</td>
<td>byte-4</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th></th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td>LWL rd 6(r0)</td>
<td>byte-6</td>
<td>byte-5</td>
<td>byte-4</td>
<td>D</td>
</tr>
<tr>
<td>LWR rd 3(r0)</td>
<td>byte-6</td>
<td>byte-5</td>
<td>byte-4</td>
<td>byte-3</td>
</tr>
</tbody>
</table>
- LWL/LWR is slower
- Note LWL and LWR still fetch within word boundary
X86: Unaligned Access
- LD/ST instructions automatically align data that spans a “word” boundary.
- Programmer/compiler does not need to worry about where data is stored (whether or not in a word-aligned location).
4.1.1 Alignment of Words, Doublewords, Quadwords, and Double Quadwords
Words, doublewords, and quadwords do not need to be aligned in memory on natural boundaries. The natural boundaries for words, double words, and quadwords are even-numbered addresses, addresses evenly divisible by four, and addresses evenly divisible by eight, respectively. However, to improve the performance of programs, data structures (especially stacks) should be aligned on natural boundaries whenever possible. The reason for this is that the processor requires two memory accesses to make an unaligned memory access; aligned accesses require only one memory access. A word or doubleword operand that crosses a 4-byte boundary or a quadword operand that crosses an 8-byte boundary is considered unaligned and requires two separate memory bus cycles for access.
X86: Unaligned Access
Figure 4-2. Bytes, Words, Doublewords, Quadwords, and Double Quadwords in Memory
What About ARM?
- https://www.scss.tcd.ie/~waldroj/3d1/arm_arm.pdf
- Section A2.8
Aligned vs. Unaligned Access
- Pros of having no restrictions on alignment
- Cons of having no restrictions on alignment
- Filling in the above: an exercise for you...
18-447 MIPS ISA
James C. Hoe
Dept of ECE, CMU
MIPS R2000 Program Visible State
**Program Counter**
32-bit memory address of the current instruction
|-------|------|------|------|------|--------|
**General Purpose Register File**
32 32-bit words named r0...r31
**Note**
\[ r0=0 \]
**r1**
**r2**
**Memory**
2^{32} by 8-bit locations (4 Giga Bytes)
32-bit address
(there is some magic going on)
Data Format
- Most things are 32 bits
- instruction and data addresses
- signed and unsigned integers
- just bits
- Also 16-bit word and 8-bit word (aka byte)
- Floating-point numbers
- IEEE standard 754
- float: 8-bit exponent, 23-bit significand
- double: 11-bit exponent, 52-bit significand
Big Endian vs. Little Endian
(Part I, Chapter 4, Gulliver’s Travels)
- 32-bit signed or unsigned integer comprises 4 bytes
- On a byte-addressable machine . . . . . . .
<table>
<thead>
<tr>
<th>MSB</th>
<th>LSB</th>
</tr>
</thead>
<tbody>
<tr>
<td>byte 0</td>
<td>byte 1</td>
</tr>
<tr>
<td>byte 4</td>
<td>byte 5</td>
</tr>
<tr>
<td>byte 8</td>
<td>byte 9</td>
</tr>
<tr>
<td>byte 12</td>
<td>byte 13</td>
</tr>
<tr>
<td>byte 16</td>
<td>byte 17</td>
</tr>
</tbody>
</table>
pointer points to the **big end**
<table>
<thead>
<tr>
<th>MSB</th>
<th>LSB</th>
</tr>
</thead>
<tbody>
<tr>
<td>byte 3</td>
<td>byte 2</td>
</tr>
<tr>
<td>byte 7</td>
<td>byte 6</td>
</tr>
<tr>
<td>byte 11</td>
<td>byte 10</td>
</tr>
<tr>
<td>byte 15</td>
<td>byte 14</td>
</tr>
<tr>
<td>byte 19</td>
<td>byte 18</td>
</tr>
</tbody>
</table>
pointer points to the **little end**
- What difference does it make?
check out htonl(), ntohl() in in.h
Instruction Formats
◆ 3 simple formats
- R-type, 3 register operands
| 0 | rs | rt | rd | shamt | funct |
|---|----|----|----|-------|-------|
| 6-bit | 5-bit | 5-bit | 5-bit | 5-bit | 6-bit |
- I-type, 2 register operands and 16-bit immediate operand
| opcode | rs | rt | immediate |
|--------|----|----|-----------|
| 6-bit | 5-bit | 5-bit | 16-bit |
- J-type, 26-bit immediate operand
| opcode | immediate |
|--------|-----------|
| 6-bit | 26-bit |
◆ Simple Decoding
- 4 bytes per instruction, regardless of format
- must be 4-byte aligned (2 lsb of PC must be 2b’ 00)
- format and fields readily extractable
ALU Instructions
- **Assembly** (e.g., register-register signed addition)
$\text{ADD rd}_{\text{reg}} \text{ rs}_{\text{reg}} \text{ rt}_{\text{reg}}$
- **Machine encoding**
<table>
<thead>
<tr>
<th>$0$</th>
<th>$\text{rs}$</th>
<th>$\text{rt}$</th>
<th>$\text{rd}$</th>
<th>$0$</th>
<th>ADD</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>6-bit</td>
</tr>
</tbody>
</table>
- **Semantics**
- $\text{GPR}[\text{rd}] \leftarrow \text{GPR}[\text{rs}] + \text{GPR}[\text{rt}]$
- $\text{PC} \leftarrow \text{PC} + 4$
- **Exception on “overflow”**
- **Variations**
- Arithmetic: \{signed, unsigned\} x \{ADD, SUB\}
- Logical: \{AND, OR, XOR, NOR\}
- Shift: \{Left, Right-Logical, Right-Arithmetic\}
Reg-Reg Instruction Encoding
<table>
<thead>
<tr>
<th>2...0</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>SLL</td>
<td>*</td>
<td>SRL</td>
<td>SRA</td>
<td>SLLV</td>
<td>*</td>
<td>SRLV</td>
</tr>
<tr>
<td>1</td>
<td>JR</td>
<td>JALR</td>
<td>*</td>
<td>*</td>
<td>SYSCALL</td>
<td>BREAK</td>
<td>*</td>
</tr>
<tr>
<td>2</td>
<td>MFHI</td>
<td>MTHI</td>
<td>MFLO</td>
<td>MTLO</td>
<td>DSLLV(____)</td>
<td>*</td>
<td>DSRLV(____)</td>
</tr>
<tr>
<td>3</td>
<td>MULT</td>
<td>MULTU</td>
<td>DIV</td>
<td>DIVU</td>
<td>DMULT(____)</td>
<td>DMULTU(____)</td>
<td>DDIV(____)</td>
</tr>
<tr>
<td>4</td>
<td>ADD</td>
<td>ADDU</td>
<td>SUB</td>
<td>SUBU</td>
<td>AND</td>
<td>OR</td>
<td>XOR</td>
</tr>
<tr>
<td>5</td>
<td>*</td>
<td>*</td>
<td>SLT</td>
<td>SLTU</td>
<td>DADD(____)</td>
<td>DADDU(____)</td>
<td>DSUB(____)</td>
</tr>
<tr>
<td>6</td>
<td>TGE</td>
<td>TGEU</td>
<td>TLT</td>
<td>TLTU</td>
<td>TEQ</td>
<td>*</td>
<td>TNE</td>
</tr>
<tr>
<td>7</td>
<td>DSLL(____)</td>
<td>*</td>
<td>DSRL(____)</td>
<td>DSRA(____)</td>
<td>DSLL32(____)</td>
<td>*</td>
<td>DSRL32(____)</td>
</tr>
</tbody>
</table>
[MIPS R4000 Microprocessor User’s Manual]
What patterns do you see? Why are they there?
ALU Instructions
◆ Assembly (e.g., regi-immediate signed additions)
\[
\text{ADDI } r_t \text{ reg } r_s \text{ reg immediate}_{16}
\]
◆ Machine encoding
<table>
<thead>
<tr>
<th>ADDI</th>
<th>rs</th>
<th>rt</th>
<th>immediate</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>16-bit</td>
</tr>
</tbody>
</table>
◆ Semantics
- GPR\[rt\] \leftarrow GPR\[rs\] + sign-extend (immediate)
- PC \leftarrow PC + 4
◆ Exception on “overflow”
◆ Variations
- Arithmetic: \{signed, unsigned\} x \{ADD, SUB\}
- Logical: \{AND, OR, XOR, LUI\}
# Reg-Immed Instruction Encoding
<table>
<thead>
<tr>
<th>28...26</th>
<th>31...29</th>
<th>Opcode</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0</td>
<td>SPECIAL</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>REGIMM</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>J</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
<td>JAL</td>
</tr>
<tr>
<td>4</td>
<td>4</td>
<td>BEQ</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
<td>BNE</td>
</tr>
<tr>
<td>6</td>
<td>6</td>
<td>BLEZ</td>
</tr>
<tr>
<td>7</td>
<td>7</td>
<td>BGTZ</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>ADDI</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>ADDIU</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>SLTI</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
<td>SLTIU</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>ANDI</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>ORI</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>XORI</td>
</tr>
<tr>
<td>4</td>
<td>1</td>
<td>LUI</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>COP0</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
<td>COP1</td>
</tr>
<tr>
<td>2</td>
<td>0</td>
<td>COP2</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>*</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>BEQ</td>
</tr>
<tr>
<td>3</td>
<td>0</td>
<td>BEQL</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>BNEL</td>
</tr>
<tr>
<td>4</td>
<td>1</td>
<td>BNE</td>
</tr>
<tr>
<td>4</td>
<td>0</td>
<td>BLEZ</td>
</tr>
<tr>
<td>5</td>
<td>2</td>
<td>BLEZL</td>
</tr>
<tr>
<td>5</td>
<td>1</td>
<td>BGTZ</td>
</tr>
<tr>
<td>5</td>
<td>0</td>
<td>BGTZL</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>DADDIe</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>DADDIUe</td>
</tr>
<tr>
<td>3</td>
<td>0</td>
<td>LDLε</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>LDRε</td>
</tr>
<tr>
<td>4</td>
<td>1</td>
<td>*</td>
</tr>
<tr>
<td>4</td>
<td>0</td>
<td>*</td>
</tr>
<tr>
<td>6</td>
<td>2</td>
<td>LB</td>
</tr>
<tr>
<td>6</td>
<td>1</td>
<td>LH</td>
</tr>
<tr>
<td>6</td>
<td>0</td>
<td>LWL</td>
</tr>
<tr>
<td>7</td>
<td>2</td>
<td>LW</td>
</tr>
<tr>
<td>7</td>
<td>1</td>
<td>LBU</td>
</tr>
<tr>
<td>7</td>
<td>0</td>
<td>LHU</td>
</tr>
<tr>
<td>8</td>
<td>2</td>
<td>LWR</td>
</tr>
<tr>
<td>8</td>
<td>1</td>
<td>LWUE</td>
</tr>
<tr>
<td>7</td>
<td>2</td>
<td>SB</td>
</tr>
<tr>
<td>7</td>
<td>1</td>
<td>SH</td>
</tr>
<tr>
<td>7</td>
<td>0</td>
<td>SWL</td>
</tr>
<tr>
<td>9</td>
<td>2</td>
<td>SW</td>
</tr>
<tr>
<td>9</td>
<td>1</td>
<td>SDLε</td>
</tr>
<tr>
<td>9</td>
<td>0</td>
<td>SDRε</td>
</tr>
<tr>
<td>10</td>
<td>2</td>
<td>SWR</td>
</tr>
<tr>
<td>10</td>
<td>1</td>
<td>CACHEδ</td>
</tr>
<tr>
<td>11</td>
<td>2</td>
<td>LL</td>
</tr>
<tr>
<td>11</td>
<td>1</td>
<td>LWC1</td>
</tr>
<tr>
<td>11</td>
<td>0</td>
<td>LWC2</td>
</tr>
<tr>
<td>12</td>
<td>2</td>
<td>*</td>
</tr>
<tr>
<td>12</td>
<td>1</td>
<td>LLDε</td>
</tr>
<tr>
<td>12</td>
<td>0</td>
<td>LDC1</td>
</tr>
<tr>
<td>13</td>
<td>2</td>
<td>LDC2</td>
</tr>
<tr>
<td>13</td>
<td>1</td>
<td>LDε</td>
</tr>
<tr>
<td>13</td>
<td>0</td>
<td>SCDε</td>
</tr>
<tr>
<td>14</td>
<td>2</td>
<td>SC</td>
</tr>
<tr>
<td>14</td>
<td>1</td>
<td>SWC1</td>
</tr>
<tr>
<td>14</td>
<td>0</td>
<td>SWC2</td>
</tr>
<tr>
<td>15</td>
<td>2</td>
<td>*</td>
</tr>
</tbody>
</table>
[MIPS R4000 Microprocessor User's Manual]
Assembly Programming 101
- Break down high-level program constructs into a sequence of elemental operations
- E.g. High-level Code
\[ f = (g + h) - (i + j) \]
- Assembly Code
- suppose \( f, g, h, i, j \) are in \( r_f, r_g, r_h, r_i, r_j \)
- suppose \( r_{\text{temp}} \) is a free register
\[
\begin{align*}
\text{add} & \ r_{\text{temp}} \ r_g \ r_h \quad \# \ r_{\text{temp}} = g+h \\
\text{add} & \ r_f \ r_i \ r_j \quad \# \ r_f = i+j \\
\text{sub} & \ r_f \ r_{\text{temp}} \ r_f \quad \# \ f = r_{\text{temp}} - r_f
\end{align*}
\]
Load Instructions
- Assembly (e.g., load 4-byte word)
\[ \text{LW } \text{rt}_{\text{reg}} \text{ offset}_{16} (\text{base}_{\text{reg}}) \]
- Machine encoding
\[
\begin{array}{cccc}
\text{LW} & \text{base} & \text{rt} & \text{offset} \\
\text{6-bit} & \text{5-bit} & \text{5-bit} & \text{16-bit} \\
\end{array}
\]
- Semantics
- effective_address = sign-extend(offset) + GPR[base]
- GPR[rt] ← MEM[ translate(effective_address) ]
- PC ← PC + 4
- Exceptions
- address must be “word-aligned”
What if you want to load an unaligned word?
- MMU exceptions
Store Instructions
- Assembly (e.g., store 4-byte word)
\[ \text{SW } rt_{\text{reg}} \text{ offset}_{16} (\text{base}_{\text{reg}}) \]
- Machine encoding
<table>
<thead>
<tr>
<th>SW</th>
<th>base</th>
<th>rt</th>
<th>offset</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>5-bit</td>
<td>5-bit</td>
<td>16-bit</td>
</tr>
</tbody>
</table>
- Semantics
- effective_address = sign-extend(offset) + GPR[base]
- MEM[ translate(effective_address) ] ← GPR[rt]
- PC ← PC + 4
- Exceptions
- address must be “word-aligned”
- MMU exceptions
Assembly Programming 201
- E.g. High-level Code
\[ A[8] = h + A[0] \]
where \( A \) is an array of integers (4-byte each)
- Assembly Code
- suppose \&A, \( h \) are in \( r_A, r_h \)
- suppose \( r_{\text{temp}} \) is a free register
```
LW r_{\text{temp}} 0(r_A) # r_{\text{temp}} = A[0]
add r_{\text{temp}} r_h r_{\text{temp}} # r_{\text{temp}} = h + A[0]
SW r_{\text{temp}} 32(r_A) # A[8] = r_{\text{temp}}
# note A[8] is 32 bytes
# from A[0]
```
Load Delay Slots
- R2000 load has an architectural latency of 1 inst*.
- the instruction immediately following a load (in the “delay slot”) still sees the old register value
- the load instruction no longer has an atomic semantics
Why would you do it this way?
- Is this a good idea? (hint: R4000 redefined LW to complete atomically)
*BTW, notice that latency is defined in “instructions” not cyc. or sec.
Control Flow Instructions
- **C-Code**
```
{ code A }
if X==Y then
{ code B }
else
{ code C }
{ code D }
```
These things are called basic blocks.
(Conditional) Branch Instructions
- Assembly (e.g., branch if equal)
\[ \text{BEQ } rs_{\text{reg}} \text{ rt}_{\text{reg}} \text{ immediate}_{16} \]
- Machine encoding
\[
\begin{array}{|c|c|c|c|}
\hline
\text{BEQ} & \text{rs} & \text{rt} & \text{immediate} \\
\hline
\text{6-bit} & \text{5-bit} & \text{5-bit} & \text{16-bit} \\
\hline
\end{array}
\]
- Semantics
- target = PC + sign-extend(immediate) \times 4
- if GPR[rs] == GPR[rt] then \( \text{PC} \leftarrow \text{target} \)
else \( \text{PC} \leftarrow \text{PC} + 4 \)
- How far can you jump?
- Variations
- BEQ, BNE, BLEZ, BGTZ
Why isn’t there a BLE or BGT instruction?
Jump Instructions
- **Assembly**
$J \text{ immediate}_{26}$
- **Machine encoding**
<table>
<thead>
<tr>
<th>J</th>
<th>immediate</th>
</tr>
</thead>
<tbody>
<tr>
<td>6-bit</td>
<td>26-bit</td>
</tr>
</tbody>
</table>
J-type
- **Semantics**
- target = $\text{PC}[31:28] \times 2^{28} | \text{bitwise-or} \text{ zero-extend}(\text{immediate}) \times 4$
- $\text{PC} \leftarrow \text{target}$
- **How far can you jump?**
- **Variations**
- Jump and Link
- Jump Registers
- $\text{PC} + 4 \text{ w/ branch delay slot}$
Assembly Programming 301
◆ E.g. High-level Code
```
if (i == j) then
e = g
else
e = h
f = e
```
◆ Assembly Code
- suppose e, f, g, h, i, j are in r_e, r_f, r_g, r_h, r_i, r_j
```
bne r_i r_j L1 # L1 and L2 are addr labels
add r_e r_g r0 # assembler computes offset
j L2
L1: add r_e r_h r0 # e = h
L2: add r_f r_e r0 # f = e
... ...
```
Branch Delay Slots
- R2000 branch instructions also have an architectural latency of 1 instructions
- the instruction immediately after a branch is always executed (in fact PC-offset is computed from the delay slot instruction)
- branch target takes effect on the 2\textsuperscript{nd} instruction
\begin{verbatim}
L1: add r_e r_h r0
bne r_i r_j L1
add r_e r_g r0
j L2
L2: add r_f r_e r0
. . .
\end{verbatim}
Strangeness in the Semantics
Where do you think you will end up?
<table>
<thead>
<tr>
<th></th>
<th><em>s</em></th>
<th>j</th>
<th>L1</th>
<th>j</th>
<th>L2</th>
<th>j</th>
<th>L3</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>L1</td>
<td>j</td>
<td>L4</td>
<td>j</td>
<td>L5</td>
<td></td>
<td></td>
</tr>
<tr>
<td>L2</td>
<td>j</td>
<td></td>
<td>foo</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>L3</td>
<td></td>
<td>foo</td>
<td></td>
<td>bar</td>
<td>baz</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
| | | | | | | | |
Function Call and Return
- **Jump and Link:**
- JAL offset\_26
- return address = PC + 8
- target = PC[31:28]x2\_28 | bitwise-or zero-extend(immediate)x4
- PC ← target
- GPR[r31] ← return address
On a function call, the callee needs to know where to go back to afterwards.
- **Jump Indirect:**
- JR rs\_reg
- target = GPR [rs]
- PC ← target
PC-offset jumps and branches always jump to the same target every time the same instruction is executed. Jump Indirect allows the same instruction to jump to any location specified by rs (usually r31)
How do you pass argument between caller and callee?
If A set r10 to 1, what is the value of r10 when B returns to C?
What registers can B use?
What happens to r31 if B calls another function?
Caller and Callee Saved Registers
◆ Callee-Saved Registers
- Caller says to callee, “The values of these registers should not change when you return to me.”
- Callee says, “If I need to use these registers, I promise to save the old values to memory first and restore them before I return to you.”
◆ Caller-Saved Registers
- Caller says to callee, “If there is anything I care about in these registers, I already saved it myself.”
- Callee says to caller, “Don’t count on them staying the same values after I am done.”
R2000 Register Usage Convention
- r0: always 0
- r1: reserved for the assembler
- r2, r3: function return values
- r4~r7: function call arguments
- r8~r15: “caller-saved” temporaries
- r16~r23: “callee-saved” temporaries
- r24~r25: “caller-saved” temporaries
- r26, r27: reserved for the operating system
- r28: global pointer
- r29: stack pointer
- r30: callee-saved temporaries
- r31: return address
R2000 Memory Usage Convention
- **Stack Space**: Grow down.
- **Free Space**: Grow up.
- **Dynamic Data**
- **Static Data**
- **Text**
- **Reserved**
High address
Low address
**Stack Pointer**: GPR[r29]
**Binary Executable**
Calling Convention
1. caller saves caller-saved registers
2. caller loads arguments into r4~r7
3. caller jumps to callee using JAL
4. callee allocates space on the stack (dec. stack pointer)
5. callee saves callee-saved registers to stack (also r4~r7, old r29, r31)
6. callee loads results to r2, r3
7. callee restores saved register values
8. JR r31
9. caller continues with return values in r2, r3
To Summarize: MIPS RISC
◆ Simple operations
- 2-input, 1-output arithmetic and logical operations
- few alternatives for accomplishing the same thing
◆ Simple data movements
- ALU ops are register-to-register (need a large register file)
- “Load-store” architecture
◆ Simple branches
- limited varieties of branch conditions and targets
◆ Simple instruction encoding
- all instructions encoded in the same number of bits
- only a few formats
Loosely speaking, an ISA intended for compilers rather than assembly programmers
|
{"Source-Url": "http://www.ece.cmu.edu/~ece447/s15/lib/exe/fetch.php?media=onur-447-spring15-lecture4-isa-tradeoffs-cont.pdf", "len_cl100k_base": 12396, "olmocr-version": "0.1.53", "pdf-total-pages": 53, "total-fallback-pages": 0, "total-input-tokens": 83255, "total-output-tokens": 13032, "length": "2e13", "weborganizer": {"__label__adult": 0.0004453659057617187, "__label__art_design": 0.0005993843078613281, "__label__crime_law": 0.0003223419189453125, "__label__education_jobs": 0.0023517608642578125, "__label__entertainment": 0.0001004338264465332, "__label__fashion_beauty": 0.00022780895233154297, "__label__finance_business": 0.0002560615539550781, "__label__food_dining": 0.0004210472106933594, "__label__games": 0.0010709762573242188, "__label__hardware": 0.0169525146484375, "__label__health": 0.0004277229309082031, "__label__history": 0.00042176246643066406, "__label__home_hobbies": 0.0002689361572265625, "__label__industrial": 0.0022907257080078125, "__label__literature": 0.00024962425231933594, "__label__politics": 0.0003736019134521485, "__label__religion": 0.0009250640869140624, "__label__science_tech": 0.08746337890625, "__label__social_life": 9.381771087646484e-05, "__label__software": 0.00983428955078125, "__label__software_dev": 0.873046875, "__label__sports_fitness": 0.0005364418029785156, "__label__transportation": 0.0010995864868164062, "__label__travel": 0.0002343654632568359}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30276, 0.04891]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30276, 0.13946]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30276, 0.63955]], "google_gemma-3-12b-it_contains_pii": [[0, 50, false], [50, 271, null], [271, 434, null], [434, 705, null], [705, 1568, null], [1568, 2181, null], [2181, 2658, null], [2658, 3317, null], [3317, 4488, null], [4488, 4747, null], [4747, 4982, null], [4982, 5405, null], [5405, 5967, null], [5967, 6530, null], [6530, 8449, null], [8449, 10813, null], [10813, 11013, null], [11013, 12509, null], [12509, 13307, null], [13307, 13649, null], [13649, 13958, null], [13958, 14569, null], [14569, 15627, null], [15627, 15731, null], [15731, 15816, null], [15816, 15987, null], [15987, 16034, null], [16034, 16434, null], [16434, 16741, null], [16741, 17513, null], [17513, 18199, null], [18199, 18886, null], [18886, 19781, null], [19781, 20292, null], [20292, 22447, null], [22447, 23014, null], [23014, 23596, null], [23596, 24055, null], [24055, 24530, null], [24530, 24944, null], [24944, 25098, null], [25098, 25768, null], [25768, 26242, null], [26242, 26599, null], [26599, 27045, null], [27045, 27401, null], [27401, 27977, null], [27977, 28172, null], [28172, 28701, null], [28701, 29104, null], [29104, 29334, null], [29334, 29735, null], [29735, 30276, null]], "google_gemma-3-12b-it_is_public_document": [[0, 50, true], [50, 271, null], [271, 434, null], [434, 705, null], [705, 1568, null], [1568, 2181, null], [2181, 2658, null], [2658, 3317, null], [3317, 4488, null], [4488, 4747, null], [4747, 4982, null], [4982, 5405, null], [5405, 5967, null], [5967, 6530, null], [6530, 8449, null], [8449, 10813, null], [10813, 11013, null], [11013, 12509, null], [12509, 13307, null], [13307, 13649, null], [13649, 13958, null], [13958, 14569, null], [14569, 15627, null], [15627, 15731, null], [15731, 15816, null], [15816, 15987, null], [15987, 16034, null], [16034, 16434, null], [16434, 16741, null], [16741, 17513, null], [17513, 18199, null], [18199, 18886, null], [18886, 19781, null], [19781, 20292, null], [20292, 22447, null], [22447, 23014, null], [23014, 23596, null], [23596, 24055, null], [24055, 24530, null], [24530, 24944, null], [24944, 25098, null], [25098, 25768, null], [25768, 26242, null], [26242, 26599, null], [26599, 27045, null], [27045, 27401, null], [27401, 27977, null], [27977, 28172, null], [28172, 28701, null], [28701, 29104, null], [29104, 29334, null], [29334, 29735, null], [29735, 30276, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30276, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30276, null]], "pdf_page_numbers": [[0, 50, 1], [50, 271, 2], [271, 434, 3], [434, 705, 4], [705, 1568, 5], [1568, 2181, 6], [2181, 2658, 7], [2658, 3317, 8], [3317, 4488, 9], [4488, 4747, 10], [4747, 4982, 11], [4982, 5405, 12], [5405, 5967, 13], [5967, 6530, 14], [6530, 8449, 15], [8449, 10813, 16], [10813, 11013, 17], [11013, 12509, 18], [12509, 13307, 19], [13307, 13649, 20], [13649, 13958, 21], [13958, 14569, 22], [14569, 15627, 23], [15627, 15731, 24], [15731, 15816, 25], [15816, 15987, 26], [15987, 16034, 27], [16034, 16434, 28], [16434, 16741, 29], [16741, 17513, 30], [17513, 18199, 31], [18199, 18886, 32], [18886, 19781, 33], [19781, 20292, 34], [20292, 22447, 35], [22447, 23014, 36], [23014, 23596, 37], [23596, 24055, 38], [24055, 24530, 39], [24530, 24944, 40], [24944, 25098, 41], [25098, 25768, 42], [25768, 26242, 43], [26242, 26599, 44], [26599, 27045, 45], [27045, 27401, 46], [27401, 27977, 47], [27977, 28172, 48], [28172, 28701, 49], [28701, 29104, 50], [29104, 29334, 51], [29334, 29735, 52], [29735, 30276, 53]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30276, 0.29173]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
e40456e1548572d4c205307029c757bd834bcc43
|
Formal Characterization of Illegal Control Flow in Android System
Mariem Graa, Nora Cuppens-Boulahia, Frédéric Cuppens, Ana Cavalli
To cite this version:
HAL Id: hal-00924480
https://hal.archives-ouvertes.fr/hal-00924480
Submitted on 6 Jan 2014
Formal Characterization of Illegal Control Flow in Android System
Mariem Graa†, Nora Cuppens-Boulahia*, Frédéric Cuppens*, and Ana Cavalli†
*Telecom-Bretagne, 2 Rue de la Châtaigneraie, 35576 Cesson Sévigné - France
Emails: {mariem.benabdallah, nora.cuppens, frederic.cuppens}@telecom-bretagne.eu
†Telecom-SudParis, 9 Rue Charles Fourier, 91000 Évry - France
Emails: {mariem.graa, ana.cavalli}@it-sudparis.eu
Abstract—The dynamic taint analysis mechanism is used to protect sensitive data in the Android system. But this technique does not control flows which can cause an under-tainting problem. This means that some values should be marked as tainted, but are not. The under-tainting problem can be the cause of a failure to detect a leak of sensitive information. To solve this problem, we use a set of formally defined rules that describes the taint propagation. We prove the completeness of these rules. Also, we provide a correct and complete algorithm based on these rules to solve the under-tainting problem.
Keywords—dynamic taint analysis; android system; control flows; under-tainting; formal rules; complete algorithm
I. INTRODUCTION
Recent years have witnessed an increase in the use of embedded systems such as smartphones. According to a recent Gartner report [1], 417 million of worldwide mobile phones were sold in the third quarter of 2010, which corresponds to 35 percent increase from the third quarter of 2009. To make mobile phones more fun and useful, users usually download third-party applications. For example, we can show an increase in third-party apps of Android Market from about 15,000 third-party apps in November 2009 to about 150,000 in November 2010. These applications are used to capture, store, manipulate, and access to data of a sensitive nature in mobile phone. An attacker can launch flow control attacks to compromise confidentiality and integrity of the Android system and can leak private information without user authorization. In the study presented in Black Hat conference, Daswani [2] analyzed the live behavior of 10,000 Android applications and show that more than 800 were found to be leaking personal data to an unauthorized server. Therefore, there is a need to provide adequate security mechanisms to control the manipulation of private data by third-party apps. The dynamic taint analysis mechanism is used to protect sensitive data in the Android system against attacks [3]. But this technique does not detect control flows which can cause an under-tainting problem i.e. that some values should be marked as tainted, but are not. Let us consider the attack shown in Figure 1 that presents an under-tainting problem which can cause a failure to detect a leak of sensitive information. The variables $x$ and $y$ are both initialized to false. On Line 4, the attacker tests the user’s input for a specific value. Let us assume that the attacker was lucky and the test was positive. In this case, Line 5 is executed, setting $x$ to true and $y$ is tainted. Variable $y$ keeps its false value, since the assignment on Line 7 is not executed and $y$ is not tainted because dynamic tainting occurs only along the branch that is actually executed. As $y$ is not tainted, it is leaked to the network (Line 8) without being detected. Since $y$ has not been modified, it informs the attacker about the value of the user private contact. Thus, an attacker can circumvent an android system through the control flows.
In a previous work [4], we have proposed an approach that combines static and dynamic taint analysis to propagate taint along control dependencies and to track implicit flows in embedded systems such as the Google Android operating system. In this paper, we formally specify the under-tainting problem and we provide an algorithm to solve it based on a set of formally defined rules describing the taint propagation. We prove the completeness of those rules and the correctness and completeness of the algorithm.
The rest of this paper is organized as follows. Section 2 gives a technical overview of our approach. Section 3 presents some definitions and theorems that are used in other sections. Section 4 describes our formal specification of the under-tainting problem. In section 5, we specify an algorithm based on a set of formally defined rules describing the taint propagation policy that we use to solve the under-tainting problem. Related work about existing solutions to solve the under-tainting problem is analyzed in section 6. Finally, section 7 concludes with an outline of future work.
II. APPROACH OVERVIEW
TaintDroid [3], an extension of the Android mobile-phone platform, implements dynamic taint analysis to track the information flow in real-time and control the handling of private data. It addresses different challenges specific to mobile phones like the resource limitations. TaintDroid is composed of four modules: (1) Explicit flow module that tracks variable at the virtual machine level, (2) IPC Binder module that tracks messages between applications, (3) File module that tracks files at the storage level and (4) Taint propagation module that is implemented in the native methods level. It only tracks explicit flows and does not track control flows. In a previous work [4], we have proposed a technical approach that enhances the TaintDroid approach by tracking control flow in the Android system to solve the under-tainting problem. To track implicit flow, we have added an implicit flow module in the Dalvik VM bytecode verifier which checks instructions of methods at load time. We have defined two additional rules to propagate taint in the control flow. At class load time, we have built an array of variables to which a value is
```plaintext
1. x = false;
2. y = false;
3. char c[256];
4. if ( gets(c) != user_contact )
5. x = true;
6. else
7. y = true;
8. NetworkTransfer (y);
```
Figure 1. Attack using indirect control dependency
assigned to handle the branch that is not executed. Figure 2 presents the modified architecture to handle implicit flow in TaintDroid system.
In this paper, we prove the completeness of the two additional rules and we provide a correct and complete taint algorithm based on these rules. Our algorithm is based on a hybrid approach that combines and benefits from the advantages of static and dynamic analyses. We use static analysis to detect control dependencies. This analysis is based on the control flow graphs [5], [6] which will be analyzed to determine branches in the conditional structure. A basic block is assigned to each control flow branch. Then, we detect the flow of the condition-dependencies from blocks in the graph. Also, we detect variable assignment in a basic block of the control flow graph to handle not executed branches. The dynamic analysis uses information provided by the static analysis and allows tainting variables to which a value is assigned in the conditional instruction. To taint these variables, we create an array of context taints that includes all condition taints. We use the context taints array and the condition-dependencies from block in the graph to set the context taints. Finally, we apply the propagation rules to taint variables to which a value is assigned whether the branch is taken or not.
III. NOTATIONS, DEFINITIONS AND THEOREMS
Definition 1. Direct graph
A directed graph \( G = (V, E) \) consists of a finite set \( V \) of vertices and a set \( E \) of ordered pairs \((v, w)\) of distinct vertices, called edges. If \((v, w)\) is an edge, \( w \) is a successor of \( v \) and \( v \) is a predecessor of \( w \).
Definition 2. Complete directed graph
A complete directed graph is a simple directed graph \( G = (V, E) \) such that every pair of distinct vertices in \( G \) are connected by exactly one edge. So, for each pair of distinct vertices, either \((x, y)\) or \((y, x)\) (but not both) is in \( E \).
Definition 3. Control flow graph
A control flow graph \( G = (V, E, r) \) is a directed graph \((V, E)\) with a distinguished \( \text{Exit} \) vertex and start vertex \( r \), such that for any vertex \( v \in V \) there is a path from \( r \) to \( v \). The nodes of the control flow graph represent basic blocks and the edges represent control flow paths.
The concept of post-dominator and dominator tree are used to determine dependencies of blocks in the control flow graph.
Definition 4. Dominator
A vertex \( v \) dominates another vertex \( w \neq v \) in \( G \) if every path from \( r \) to \( w \) contains \( v \).
Definition 5. Post-Dominator
A node \( v \) is post-dominated by a node \( w \) in \( G \) if every path from \( v \) to \( \text{Exit} \) (not including \( v \)) contains \( w \).
Theorem 1. Every vertex of a flow graph \( G = (V, E, r) \) except \( r \) has a unique immediate dominator. The edges \( \{(\text{idom}(w), w)\} \mid w \in V \setminus \{r\} \) form a directed tree rooted at \( r \), called the dominator tree of \( G \), such that \( v \) dominates \( w \) if and only if \( v \) is a proper ancestor of \( w \) in the dominator tree[7], [8].
Computing post-dominators in the control flow graph is equivalent to computing dominators [5] in the reverse control flow graph. Dominators in the reverse graph can be computed quickly by using the Fast Algorithm [9] or a linear-time dominators algorithm [10] to construct the dominator tree. Using these algorithms, we can determine the post-dominator tree of a graph.
Definition 6. Control Dependency
Let \( G \) be a control flow graph. Let \( X \) and \( Y \) be nodes in \( G \). \( Y \) is control dependent on \( X \) noted \( \text{Dependency}(X, Y) \) if:
1) There exists a directed path \( P \) from \( X \) to \( Y \) with any \( Z \) in \( P \) (excluding \( X \) and \( Y \)) post-dominated by \( Y \) and
2) \( X \) is not post-dominated by \( Y \).
Given the post-dominator tree, Ferrante et al. [11] determine control dependencies by examining certain control flow graph edges and annotating nodes on the corresponding tree paths.
Definition 7. Context Taint
Let \( G \) be a control flow graph. Let \( X \) and \( Y \) be basic blocks in \( G \). If \( Y \) is control dependent on \( X \) that contains \( \text{Condition} \) then we associate to \( Y \) a \( \text{Context Taint} \) with \( \text{Context Taint}(Y) = \text{Taint}(\text{Condition}) \).
We use the completeness theorem to prove the completeness of the taint propagation rules in section V-A. We use the soundness theorem to prove this completeness from left to right and the compactness theorem and theorem 2 to prove from right to left. These theorems [12] are given below.
Completeness Theorem. For any sentence \( G \) and set of sentences \( \mathcal{F}, \mathcal{F} \models G \) if and only if \( \mathcal{F} \vdash G \).
Soundness Theorem. For any formula \( G \) and set of formulas \( \mathcal{F} \), if \( \mathcal{F} \vdash G \), then \( \mathcal{F} \models G \).
Compactness Theorem. Let \( \mathcal{F} \) be a set of formulas. \( \mathcal{F} \) is unsatisfiable if and only if some finite subset of \( \mathcal{F} \) is unsatisfiable.
Definition 8. CNF formula
A formula\( \mathcal{F} \) is in conjunctive normal form (CNF) if it is a conjunction of disjunctions of literals. That is,
We have a situation of under-tainting when \( A \rightarrow B \) are two variables.
**Theorem 2.** Let \( F \) and \( G \) be formulas of the first-order logic. Let \( H \) be the CNF formula obtained by applying the CNF algorithm [12] to the formula \( F \land \neg G \). Let \( \text{Res}^*(H) \) be the set of all clauses that can be derived from \( H \) using resolvents. The following are equivalent:
1. \( F \models G \)
2. \( F \not\models G \)
3. \( \emptyset \in \text{Res}^*(H) \)
IV. THE UNDER-TAINING PROBLEM
In this section we formally specify the under-tainting problem based on Denning’s information flow model. Denning [13] defined an information flow model as:
\[
FM = \langle N, P, SC, \oplus, \rightarrow \rangle.
\]
\( N \) is a set of logical storage objects (files, program variables, ...). \( P \) is a set of processes that are executed by the active agents responsible for all information flow. \( SC \) is a set of security classes that are assigned to the objects in \( N \). \( SC \) is finite and has a lower bound \( L \) attached to objects in \( N \) by default. The class combining operator “\( \oplus \)” specifies the class result of any binary function on values from the operand classes. A flow relation “\( \rightarrow \)” between pairs of security classes \( A \) and \( B \) means that “information in class \( A \) is permitted to flow into class \( B \)”. A flow model \( FM \) is secure if and only if execution of a sequence of operations cannot produce a flow that violates the relation “\( \rightarrow \)”.
We draw our inspiration from the Denning information flow model to formally specify under-tainting. However, we assign taint to the objects instead of assigning security classes. Thus, the class combining operator “\( \oplus \)” is used in our formal specification to combine taints of objects.
**Syntactic definition of connectors \( \{\rightarrow, \oplus, \rightarrow, \oplus\} \):**
We use the following syntax to formally specify under-tainting: \( A \) and \( B \) are two logical formulas and \( x \) and \( y \) are two variables.
- \( A \rightarrow B \): If \( A \) then \( B \)
- \( x \rightarrow y \): Information flow from object \( x \) to object \( y \)
- \( x \leftarrow y \): The value of \( y \) is assigned to \( x \)
- \( \text{Taint}(x) \oplus \text{Taint}(y) \): specifies the taint result of combined taints.
**Semantic definition of connectors \( \{\rightarrow, \leftarrow, \oplus\} \):**
- The \( \rightarrow \) connector is reflexive: If \( x \) is a variable then \( x \rightarrow x \).
- The \( \rightarrow \) connector is transitive: \( x, y \) and \( z \) are three variables, if \( (x \rightarrow y) \land (y \rightarrow z) \) then \( x \rightarrow z \).
- The \( \leftarrow \) connector is reflexive: If \( x \) is a variable then \( x \leftarrow x \).
- The \( \leftarrow \) connector is transitive: \( x, y \) and \( z \) are three variables, if \( (x \leftarrow y) \land (y \leftarrow z) \) then \( x \leftarrow z \).
- The \( \rightarrow \) and \( \leftarrow \) connectors are not symmetric.
- The \( \oplus \) relation is commutative: \( \text{Taint}(x) \oplus \text{Taint}(y) = \text{Taint}(y) \oplus \text{Taint}(x) \)
- The \( \oplus \) relation is associative: \( \text{Taint}(x) \oplus (\text{Taint}(y) \oplus \text{Taint}(z)) = (\text{Taint}(x) \oplus \text{Taint}(y)) \oplus \text{Taint}(z) \)
**Definition 9. Under-Tainting**
We have a situation of under-tainting when \( x \) depends on a condition, the value of \( x \) is assigned in the conditional branch and condition is tainted but \( x \) is not tainted.
Formally, an under-tainting occurs when there is a variable \( x \) and a formula condition such that:
\[
\text{IsAssigned}(x, y) \land \text{Dependency}(x, \text{condition}) \\
\land \text{Tainted}(\text{condition}) \land \neg \text{Tainted}(x)
\]
where:
- \( \text{IsAssigned}(x, y) \) associates with \( x \) the value of \( y \).
- \( \text{Dependency}(x, \text{condition}) \) defines an information flow from condition to \( x \) when \( x \) depends on the condition.
**V. THE UNDER-TAINING SOLUTION**
In this section, we specify a set of formally defined rules that describe the taint propagation. We prove the completeness of these rules. Then, we provide an algorithm to solve the under-tainting problem based on these rules. Afterwards, we analyse some important properties of our algorithm such as Correctness and Completeness.
**A. The taint propagation rules**
Let us consider the following axioms:
\[
(x \rightarrow y) \Rightarrow (\text{Taint}(y) \leftarrow \text{Taint}(x))
\]
\[
(x \leftarrow y) \Rightarrow (y \rightarrow x)
\]
\[
(\text{Taint}(x) \leftarrow \text{Taint}(y)) \land (\text{Taint}(x) \leftarrow \text{Taint}(z)) \Rightarrow (\text{Taint}(x) \leftarrow \text{Taint}(y \oplus \text{Taint}(z)))
\]
**Theorem 3.** We consider that Context_Taint is the taint of the condition. To solve the under-tainting problem, we use the two rules that specify the propagation taint policy:
- Rule 1: if the value of \( x \) is modified and \( x \) depends on the condition and the branch is taken, we will apply the following rule to taint \( x \):
\[
\text{IsModified}(x, \text{explicit flowstatement}) \\
\land (\text{Dependency}(x, \text{condition})) \\
\land (\text{BranchTaken}(\text{br}, \text{conditional statement})) \\
\Rightarrow (\text{Taint}(x) \leftarrow \text{Context_Taint}) \\
\oplus \text{Taint}(\text{explicit flowstatement})
\]
where:
- The predicate \( \text{BranchTaken}(\text{br}, \text{conditional statement}) \) specifies that branch \( \text{br} \) in the conditional statement is executed.
So, an explicit flow which contains \( x \) is executed. \( \text{IsModified}(x, \text{explicit flowstatement}) \) associates with \( x \) the result of an explicit flow statement.
\[
\text{IsModified}(x, \text{explicit flowstatement}) \overset{\text{def}}{=} (x \leftarrow \text{explicit flowstatement})
\]
- Rule 2: if the value of \( y \) is assigned to \( x \) and \( x \) depends on the condition and the branch \( \text{br}' \) in the conditional statement is not taken (\( x \) depends only on implicit flow and does not depend on explicit flow), we will apply the following rule to taint \( x \):
Proof of taint propagation rules
To prove completeness of propagation taint rules, we use the basic rules cited in Table I for derivations.
<table>
<thead>
<tr>
<th>Premise</th>
<th>Conclusion</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>$G$ is in $F$</td>
<td>$F \supset G$</td>
<td>Assumption</td>
</tr>
<tr>
<td>$F \supset G$ and $F \subseteq F'$</td>
<td>$F' \supset G$</td>
<td>Monotonicity</td>
</tr>
<tr>
<td>$F \supset F, F \supset G$</td>
<td>$F \supset (F \land G)$</td>
<td>$\land$-Introduction</td>
</tr>
<tr>
<td>$F \supset (F \land G)$</td>
<td>$F \supset (G \land F)$</td>
<td>$\land$-Symmetry</td>
</tr>
</tbody>
</table>
Table I
Basic rules for derivations
We start by proving completeness of the first rule. We suppose that $F = \{I\text{isModified}(x, \text{explicit}\text{flowstatement}), \text{Dependency}(x, \text{condition}), \text{BranchTaken}(br, \text{conditional\text{statement})}\}$ and $G = Taint(x) \leftarrow \text{Context\text{Taint}} \oplus \text{Taint}(\text{explicit}\text{flowstatement})$.
We prove soundness, left to right, by induction. If $F \vdash G$, then there is a formal proof concluding with $F \vdash G$ (see Table II). Let $M$ be an arbitrary model of $F$, we will demonstrate that $M \models G$. $G$ is deduced by Modus ponens of $G_1, G_j \rightarrow G$ then by induction, $M \models G_1$ and $M \models G_j \rightarrow G$ and it follows $M \models G$.
<table>
<thead>
<tr>
<th>Statement</th>
<th>Justification</th>
</tr>
</thead>
<tbody>
<tr>
<td>1. ($\text{condition} \rightarrow x) \vdash (\text{Taint}(x) \leftarrow \text{Taint(\text{condition}))}$</td>
<td>Axiom (2)</td>
</tr>
<tr>
<td>2. ($\text{condition} \rightarrow x) \vdash (\text{Taint}(x) \leftarrow \text{Context\text{Taint})}$</td>
<td>Taint(\text{condition}) $\rightarrow$ Context\text{Taint}</td>
</tr>
<tr>
<td>3. $F \vdash (\text{Taint}(x) \leftarrow \text{Context\text{Taint})}$</td>
<td>Monotonicity applied to 2</td>
</tr>
<tr>
<td>4. $x \vdash (x \leftarrow x)$</td>
<td>The relation $\leftarrow$ is reflexive</td>
</tr>
<tr>
<td>5. $F \vdash (x \leftarrow x)$</td>
<td>Monotonicity applied to 3</td>
</tr>
<tr>
<td>6. $(x \leftarrow x) \vdash (\text{Taint}(x) \leftarrow \text{Taint}(x))$</td>
<td>Axiom (2)</td>
</tr>
<tr>
<td>7. $F \vdash (\text{Taint}(x) \leftarrow \text{Taint}(x))$</td>
<td>Modus ponens applied to 5 and 6</td>
</tr>
<tr>
<td>8. $F \vdash (\text{Taint}(x) \leftarrow \text{Taint}(x)) \land (\text{Taint}(x) \leftarrow \text{Taint(\text{explicit}\text{flowstatement)}))$</td>
<td>$\land$-Introduction applied to 3 and 7</td>
</tr>
<tr>
<td>9. $F \vdash (\text{Taint}(x) \leftarrow \text{Taint}(x)) \land (\text{Taint}(x) \leftarrow \text{Context\text{Taint}})$</td>
<td>$\land$-Symmetry applied to 8</td>
</tr>
<tr>
<td>10. $F \vdash G$</td>
<td>Modus ponens</td>
</tr>
</tbody>
</table>
Table II
Formal proof of the first rule
Conversely, suppose that $F \vdash G$. Then $F \cup \neg G$ is unsatisfiable. By compactness, some finite subset of $F \cup \neg G$ is unsatisfiable. So there exists finite $F_0 \subseteq F$ such that $F_0 \cup \neg G$ is unsatisfiable and, equivalently, $F_0 \vdash G$. Since $F_0$ is finite, we can apply Theorem 2 to get $F_0 \vdash G$. Finally, $F \vdash G$ by Monotonicity.
B. The algorithm
The tainting algorithm that we propose, $\text{Taint\text{Algorithm}}$, allows solving the under-tainting problem. It takes as input a control flow graph of a binary program. In this graph, nodes represent a set of instructions that represent basic blocks. Firstly, it determines the control dependency of the different blocks in the graph using $\text{Dependency\text{Algorithm}}$ [11]. Afterwards, we parse the $\text{Dependency\text{List}}$ generated by $\text{Dependency\text{Algorithm}}$ and we set the context taint of blocks to include the taint of the condition that depends on whether the branch is taken or not. Finally, using the context taint and the two propagation rules, we taint all variables to which a value is assigned in the conditional branch.
Algorithm 1 Taint\text{Algorithm} (Control flow graph G)
Input: $G = (V, E, r)$ is a control flow graph of a binary program
Output: $\text{Tainted\text{Variables\text{List}}}$ is the list of variables that are tainted.
```
x \in V
y \in V
Dependency\text{List} \leftarrow Dependency\text{Algorithm}(G)
while (x, y) \in \text{Dependency\text{List}} do
Set\text{Context\text{Taint}(y, List\text{Context\text{Taint})}
Tainted\text{Variables\text{List} \leftarrow Taint\text{Assigned\text{Variable}(y)}
end while
```
C. Running example
We analyze the control flow graph $G = (V, E, r)$ (see Figure 5) of the bytecode given in Figure 4 to illustrate the operation of the $\text{Taint\_Algorithm}$. The source code is given in Figure 3. The $\text{Taint\_Algorithm}$ takes as input the control flow graph $G = (V, E, r)$ where:
- $V = \{ BB(1), BB(2), BB(3), BB(4) \}$
- $E = \{(BB(1), BB(2)), (BB(1), BB(3)), (BB(2), BB(4)), (BB(3), BB(4))\}$
- $r = \{BB(1)\}$
The $\text{Dependency\_Algorithm}$ checks the dependency of the blocks in the control flow graph. It generates a $\text{Dependency\_List} = \{(BB(1), BB(2)); (BB(1), BB(3))\}$. As, $BB(2)$ depends on $BB(1)$ and $BB(3)$ depends on $BB(1)$, the $\text{Taint\_Algorithm}$ sets context_taint of $BB(2)$ and context_taint of $BB(3)$ to condition taint in $BB(1)$. If $x = true$, the first branch is executed but the second is not. The first rule is used to taint modified variable $y$ in $BB(2)$ : $\text{Taint}(y) = \text{ContextTaint} \oplus \text{Taint}(\text{explicit}\_\text{flow}\_\text{statement})$. The second rule is used to taint the variable $y$ in $BB(3)$ : $\text{Taint}(y) = \text{ContextTaint} \oplus \text{Taint}(y)$. So, all variables that depend on the condition will be tainted and stored in $\text{Tainted\_Variables\_List}$ whether the branch is taken or not and we do not have an under-tainting problem.
D. Properties of the algorithm
First, we prove the correctness of the $\text{Taint\_Algorithm}$ and then we prove its completeness.
1) Correctness: We want to prove the correctness of the $\text{Taint\_Algorithm}$. Let us assume that the control flow graph is correct [14]. The proof consists of three steps: first prove that $\text{Dependency\_Algorithm}$ is correct, then prove that $\text{Set\_Context\_Taint}$ is correct, and finally prove that $\text{Taint\_Assigned\_Variable}$ is correct. Each step relies on the result from the previous step.
Correctness proof for Dependency\_Algorithm:
The $\text{Dependency\_Algorithm}$ is defined by Ferrante et al. [11] to determine dependency of blocks in the graph. This algorithm takes as input the post-dominator tree for an augmented control flow graph (ACFG). Ferrante et al. add to the control flow graph a special predicate node ENTRY that has one edge labeled ‘T’ going to START node and another edge labeled ‘F’ going to STOP node. ENTRY corresponds to whatever external condition causes the program to begin execution. The post-dominator tree of ACFG can be created using the algorithms defined in [9], [10]. These algorithms are proven to be correct.
Basic steps in the Dependency\_Algorithm:
Given the post-dominator tree, Ferrante et al. [11] determine control dependencies as follows:
- Find $S$, a set of all edges $(A, B)$ in the ACFG such that $B$ is not an ancestor of $A$ in the post-dominator tree (i.e., $B$ does not postdominate $A$).
- For each edge $(A, B)$ in $S$, find $L$, the least common ancestor of $A$ and $B$ in the post-dominator tree.
CLAIM: Either $L$ is $A$ or $L$ is the parent of $A$ in the post-dominator tree.
Ferrante et al. consider these two cases for $L$, and show that one method of marking the post-dominator tree with the appropriate control dependencies accommodates both cases.
- Case 1. $L = parent of A$. All nodes in the post-dominator tree on the path from $L$ to $B$, including $B$ but not $L$, should be made control dependent on $A$.
- Case 2. $L = A$. All nodes in the post-dominator tree on the path from $A$ to $B$, including $A$ and $B$, should be made control dependent on $A$.
Given $(A, B)$ in $S$ and its corresponding $L$, the algorithm given by Ferrante et al. traverses backwards from $B$ in the post-dominator tree until they reach $L$ and mark all nodes visited; mark $L$ only if $L = A$.
- Statements representing all marked nodes are control dependent on $A$ with the label that is on edge $(A, B)$.
They prove that the correctness of the construction follows directly from the definition of control dependency (see section III).
Referring back to this definition, for any node $M$ on the path in the post-dominator tree from (but not including) $L$ to $B$, (1) there is a path from $A$ to $M$ in the control flow graph that consists of nodes post-dominated by $M$, and (2) $A$ is not post-dominated by $M$. Condition (1) is true because the edge $(A, B)$ gives us a path to $B$, and $B$ is post-dominated by $M$. Condition (2) is true because $A$ is either $L$, in which case it post-dominates $M$, or $A$ is a child of $L$ not on the path from $L$ to $B$.
We can therefore conclude that $\text{Dependency\_Algorithm}$ is correct.
Correctness proof for Set_Context Taint
We include the taint of the condition in the context taint of the dependent blocks. As the condition taint is valid thus the inclusion operation is valid. We can conclude that Set_Context Taint is correct.
Correctness proof for Taint_Assigned Variable
We use the two propagation rules to taint variables to which a value is assigned. We proved the completeness of the two propagation rules in section V-A, thus we can conclude that Taint_Assigned Variable is complete. Therefore, we can conclude the completeness of the Taint Algorithm.
2) Completeness: Let us assume that the control flow graph is complete (see Definition 2). To prove the completeness of the Taint Algorithm, we will prove the completeness of Dependency Algorithm and Taint_Assigned Variable.
The Dependency Algorithm takes as input the post-dominator tree of the control flow graph. The post-dominator tree can be constructed using the complete algorithm defined in [10]. The Dependency Algorithm is based on the set of the least common ancestor (L) of A and B in the post-dominator tree for each edge (A, B) in S. According to the value of L, Ferrante et al. define two cases to determine the control dependency. To prove the completeness of the Dependency Algorithm, we show that Ferrante et al. prove that there does not exist another value of L (either A’s parent or A itself) to consider.
Proof: Let us assume that X is the parent of A in the post-dominator tree. So, X is not B because B is not an ancestor of A in the post-dominator tree (by construction of S). Ferrante et al. perform a proof reductio ad absurdum to demonstrate that X post-dominates B, and suppose it does not. Thus, there would be a path from B to STOP that does not contain X. But, by adding edge (A, B) to this path, a path from A to STOP does not pass through X (since, by construction, X is not B). This contradicts the fact that X post-dominates A. Thus, X post-dominates B and it must be an ancestor of B in the post-dominator tree. If X, immediate post-dominator of A, post-dominates B, then the least common ancestor of A and B in the post-dominator tree must be either X or A itself.
As only two values of L exist, there does not exist another case to compute the control dependency. The Case 2 captures loop dependency and all other dependencies are determined according to Case 1. Thus, Dependency Algorithm is complete.
We proved the completeness of the two propagation rules in Section V-A thus we can conclude that Taint_Assigned Variable is complete. Therefore, we can conclude the completeness of the Taint Algorithm.
E. Time complexity of the algorithm
The Dependency Algorithm performs with a time of at most $O(N^2)$ where N is the number of nodes in the control flow graph. Linear time algorithm to calculate control dependencies have been proposed in [15] but no proof of correctness of this algorithm was given. For each (X, Y) examined in the Dependency List, setting context taint and tainted variables can be done in constant time $O(N)$. Thus, the Taint Algorithm requires linear time using algorithm defined in [15] and at most $O(N^2)$ using Ferrante et al. algorithm.
completeness of these rules. We draw our inspiration from the Denning approach, but we define formally a set of taint propagation rules to solve the under-tainting problem and we improve the approach of Graa et al. by proving the correctness and completeness of these rules.
VII. DISCUSSION
Cavallaro et al. [35] describe evasion techniques that can easily defeat dynamic information flow analysis. These evasion attacks can use control dependencies. They demonstrate that a malware writer can propagate an arbitrarily large amount of information through control dependencies. Cavallaro et al. see that it is necessary to reason about assignments that take place on the unexecuted program branches. We implement the same idea in our taint propagation rules. Unfortunately, this will lead to an over-tainting problem (false positives). The problem has been addressed in [28] and [36] but not solved though. Kang et al. [28] used a diagnosis technique to select branches that could be responsible for under-tainting and propagated taint only along these branches in order to reduce over-tainting. However a smaller amount of over tainting occurs even with DTA++, as we can see by comparing the "Optimal" and "DTA++" results in the evaluation. Bao et al. [36] define the concept of strict control dependencies (SCDs) and introduce its semantics. They use a static analysis to identify predicate branches that give rise to SCDs. They do not consider all control dependencies to reduce the number of false positives. Their implementation gives similar results as DTA++ in many cases, but is based on the syntax of a comparison expression. Contrariwise, DTA++ uses a more general and precise semantic-level condition, implemented using symbolic execution.
In our approach, we taint all variables in the conditional branch. This causes an over-tainting. But it provides more security because all confidential data are tainted. So, the sensitive information cannot be leaked. We are interested in solving the under tainting because the false negatives are much more dangerous than the false positives since the false negatives can lead to a false sense of security. We can try to reduce the over-tainting problem by considering expert rules.
VIII. CONCLUSION
Smartphones are extensively used. However, the use of untrusted android applications can provoke the leakage of private data by exploiting the under-tainting problem. In this paper, we propose a formal approach to detect control flow and to solve the under-tainting problem in android system. We formally specify the under-tainting problem. As a solution, we provide an algorithm based on a set of formally defined rules that describe the taint propagation. We prove the completeness of those rules and the correctness and completeness of the algorithm. In the future works, we will evaluate our approach in terms of overhead and false alarms. We will also test our approach and show that it resists to code obfuscation attacks based on control dependencies.
REFERENCES
[23] Peter Hornyack, Seungyeop Han, Jaeyeon Jung, Stuart Schechter, and David Wetherall, “These aren’t the droids you’re looking for; retrofitting android to protect data from imperious applications,” in Proceedings of the 18th ACM conference on Computer and communications security. ACM, 2011, pp. 639–652.
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-00924480/document", "len_cl100k_base": 8801, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 34443, "total-output-tokens": 11677, "length": "2e13", "weborganizer": {"__label__adult": 0.0005550384521484375, "__label__art_design": 0.0004296302795410156, "__label__crime_law": 0.00225830078125, "__label__education_jobs": 0.0005469322204589844, "__label__entertainment": 9.882450103759766e-05, "__label__fashion_beauty": 0.00023651123046875, "__label__finance_business": 0.0003921985626220703, "__label__food_dining": 0.00040984153747558594, "__label__games": 0.0011091232299804688, "__label__hardware": 0.004566192626953125, "__label__health": 0.0008130073547363281, "__label__history": 0.0003097057342529297, "__label__home_hobbies": 0.00014293193817138672, "__label__industrial": 0.0006914138793945312, "__label__literature": 0.00037288665771484375, "__label__politics": 0.00052642822265625, "__label__religion": 0.0004930496215820312, "__label__science_tech": 0.15673828125, "__label__social_life": 9.959936141967772e-05, "__label__software": 0.016448974609375, "__label__software_dev": 0.8115234375, "__label__sports_fitness": 0.0003116130828857422, "__label__transportation": 0.0006613731384277344, "__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, 40290, 0.02145]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 40290, 0.60708]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 40290, 0.84359]], "google_gemma-3-12b-it_contains_pii": [[0, 500, false], [500, 6448, null], [6448, 11810, null], [11810, 18107, null], [18107, 22252, null], [22252, 26886, null], [26886, 30080, null], [30080, 36492, null], [36492, 40290, null]], "google_gemma-3-12b-it_is_public_document": [[0, 500, true], [500, 6448, null], [6448, 11810, null], [11810, 18107, null], [18107, 22252, null], [22252, 26886, null], [26886, 30080, null], [30080, 36492, null], [36492, 40290, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 40290, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 40290, null]], "pdf_page_numbers": [[0, 500, 1], [500, 6448, 2], [6448, 11810, 3], [11810, 18107, 4], [18107, 22252, 5], [22252, 26886, 6], [26886, 30080, 7], [30080, 36492, 8], [36492, 40290, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 40290, 0.07347]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
345afcad42a91dc1776d5808bd2e65850f62826a
|
UMA Release Notes
Abstract
This document contains non-normative release notes produced by the User-Managed Access Work Group explaining how new versions of the UMA specifications differ from previous ones.
Status
This document includes release notes for all versions of UMA.
Editor
- Eve Maler
Intellectual Property Notice
The User-Managed Access Work Group operates under Kantara IPR Policy - Option Patent & Copyright: Reciprocal Royalty Free with Opt-Out to Reasonable And Non discriminatory (RAND) (HTML version) and the publication of this document is governed by the policies outlined in this option.
The content of this document is copyright of Kantara Initiative. © 2018 Kantara Initiative
Table of Contents
- 1 Abstract
- 1.1 Table of Contents
- 2 Introduction
- 3 From UMA1 to UMA V2.0
- 3.1 Version Themes
- 3.2 Specification Reorganization and Conformance Levels
- 3.3 Terminology Changes
- 4 API and Endpoint Changes
- 5 Authorization Server Discovery Document and Metadata Changes
- 5.1 Discovery Document and Metadata Simplification
- 5.2 Definition of OAuth Dynamic Client Registration Metadata Field
- 5.3 permissions Claim and Sub-Claims in Token Introspection Object Not Requested to Be IANA-Registered as JWT Claims
- 6 Changes to AS-Client, RS-Client, and AS-Requesting Party Interfaces (Now UMA Grant Specification)
- 6.1 Authorization Server Rotates Permission Ticket
- 6.2 Token Endpoint Replaces RPT Endpoint; Client-Side Communications Defined as Extension Grant
- 6.3 AAT Removed in Favor of PCT
- 6.4 Deprecated Response-Body Permission Ticket Return Option By RS Removed
- 6.5 Permission Ticket Return By AS With Redirect-User Hint No Longer Deprecated
- 6.6 More Discretionary Permission Requests
- 6.7 need_info Response Structured Flattened
- 6.8 not_authorized Error Renamed to request_denied
- 6.8.1 Added interval parameter to request_submitted Error
- 6.9 New Refresh Token Clarity
- 6.10 Authorization Assessment Gains Precision
- 6.11 Permission Ticket Ecosystem Rationalized
- 7 Changes to AS-RS Interface/Protection API (Now Federated Authorization Specification)
- 7.1 Resource Registration Endpoint
- 7.1.1 Extraneous URL Parts Removed From Resource Registration API
- 7.1.2 Scope Description Documents No Longer Expected to Resolve at Run Time When Scopes Are URLs
- 7.1.3 Resource Descriptions Lose uri Parameter
- 7.1.4 Resource and Scope Description Documents Gain Description Parameters
- 7.1.5 scopes Parameter in Resource Description Document Renamed to resource_scopes
- 7.1.6 New HTTP 400 and invalid_request Error
- 7.2 Permission Endpoint
- 7.2.1 Requesting Multiple Permissions and Permissions With Zero Scopes
- 7.3 Token Introspection Endpoint
- 7.3.1 scopes parameter renamed to resource_scopes in Introspection Response Object
- 7.3.2 Options Not to Use Token Introspection Explicitly Allowed
- 7.3.3 permissions Claim in Token Introspection Object Must Be Used
- 7.3.4 permission Claim exp Sub-Claim's Meaning If Absent Removed
- 4 From V1.0 to V1.0.1
- 4.1 Changes Affecting Authorization Server (+Client) Implementations
- 4.1.1 AS Now Has Unique Redirect URI Endpoint for Claims Gathering (+Client)
- 4.1.2 Permission Ticket Lifecycle Management (+Client)
- 4.1.3 Requested Permission and Permission Ticket Matching
- 4.1.4 Permission Ticket on Redirect Back to Client (+Client)
- 4.1.5 PUT Means Complete Replacement
Introduction
This document contains non-normative release notes produced by the User-Managed Access Work Group explaining how new versions of the UMA specifications differ from previous ones.
NOTE: Reading the release notes is not a substitute for reading the specifications carefully. In each specification release, much work is typically done to improve clarity and applicability for implementers and others. See the UMA Implementer's Guide for additional commentary.
The UMA specifications use Semantic Versioning:
Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API changes,
2. MINOR version when you add functionality in a backwards-compatible manner, and
3. PATCH version when you make backwards-compatible bug fixes.
The following shorthand terms and abbreviations are used in this document (see also the terminology, including abbreviations, defined in the specifications):
- AS: authorization server
- RS: resource server
- Core: UMA Core specification (applies to versions 1.0 and 1.0.1)
- RSR: OAuth Resource Set Registration specification (applies to versions 1.0 and 1.0.1)
- Grant: UMA Grant for OAuth Authorization (applies to version 2.0)
- FedAuthz: Federated Authorization for UMA (applies to version 2.0)
- I-D: IETF Internet-Draft specification
- Sec: section
Where a change relates to a GitHub issue, the linked issue number is provided.
From UMA1 to UMA V2.0
The UMA V2.0 Recommendations are User-Managed Access (UMA) 2.0 Grant for OAuth 2.0 Authorization (known as "Grant") and Federated Authorization for User-Managed Access (UMA) 2.0 (known as "FedAuthz"). The official versions are downloadable from the Kantara Reports & Recommendations page; this document links to specific sections within the HTML versions.
Differences and changes noted are between V2.0 and V1.0.n generally; note that internal revision differences between UMA2 revisions are not tracked here. (You may find it helpful to refer to the Disposition of Comments document, a record of specification changes during the Public Comment periods late in their final review cycle, and the GitHub repository where the specifications are managed.) Where the distinction between V1.0 and V1.0.1 is important, it will be noted; otherwise the label "UMA1" is used.
The following sequence diagrams may be of assistance as brief summaries of changes made:
- Sequence diagram for Grant, highlighting key changes from UMA1
- Sequence diagram for FedAuthz, highlighting key changes from UMA1
Version Themes
The major themes of this version, as determined by the Work Group's 2016 roadmap planning process, were (along with constantly improving security) to:
- Increase OAuth 2.0 alignment
- Improve Internet of Things readiness
- Improve readiness for "wide ecosystems", where the requesting party and the resource owner's AS have no pre-established relationship
Specification Reorganization and Conformance Levels
The two specifications were divided differently until late April 2017. Core and RSR were recombined into Grant and FedAuthz, as follows:
- All communications of the client and requesting party with the AS appear in Grant. This specification formally defines an extension OAuth grant.
- Policy setting (outside the scope of UMA)
- PAT definition and issuance
- Protection API
- Resource registration (previously, RSR specified only this endpoint/API and Core specified everything else)
- The RS's permission requests at the AS
- The RS's token introspection at the AS
- The formal profiles for API extensibility URIs https://docs.kantarainitiative.org/uma/profiles/prot-ext-1.0, https://docs.kantarainitiative.org/uma/profiles/authz-ext-1.0, and https://docs.kantarainitiative.org/uma/profiles/rsrc-ext-1.0 were removed and replaced with recommendations (Grant Sec 4 and FedAuthz Sec 1.3) to define profiles as needed and to use uma_profiles_supported metadata (Grant Sec 2) to declare them.
It is now optional to implement the features appearing in FedAuthz; thus, this specification effectively defines a conformance level. (Note: To receive the full benefits of "user-managed access", it is best to implement and use the features of both specifications.)
Terminology Changes
Note the following terminology changes made throughout the specifications. (256) See also Summary of API and Endpoint Changes below for naming changes made to some of the endpoints.
<table>
<thead>
<tr>
<th>UMA1</th>
<th>UMA2</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>configuration data</td>
<td>metadata, discovery document</td>
<td>For better clarity and OAuth alignment</td>
</tr>
<tr>
<td>policies</td>
<td>authorization grant rules, policy conditions</td>
<td>For better consistency</td>
</tr>
<tr>
<td>protection API token (PAT)</td>
<td>protection API access token (PAT)</td>
<td>For better clarity and OAuth alignment</td>
</tr>
<tr>
<td>resource set, resource set registration</td>
<td>resource, resource registration (protected while registered)</td>
<td>For better clarity and OAuth alignment</td>
</tr>
<tr>
<td>authorization API</td>
<td>UMA grant (an extension OAuth grant)</td>
<td>Result of redesign (see Token Endpoint Replaces RPT Endpoint; Client-Side Communications Defined as Extension Grant)</td>
</tr>
<tr>
<td>authorization API token (AAT)</td>
<td>goes away; a new related token is persisted claims token (PCT)</td>
<td>Result of redesign (see AAT Removed in Favor of PCT)</td>
</tr>
<tr>
<td>register a permission (for permission ticket)</td>
<td>request (one or more) permission(s) (on behalf of a client)</td>
<td>For better clarity</td>
</tr>
<tr>
<td>trust elevation</td>
<td>authorization process and authorization assessment</td>
<td>Result of redesign (see Authorization Assessment Gains Precision)</td>
</tr>
<tr>
<td>claims pushing + claims gathering + (n/a)</td>
<td>claims pushing + claims gathering = claims collection</td>
<td>For better consistency</td>
</tr>
<tr>
<td>step-up authentication</td>
<td>(n/a); just authorization process</td>
<td>Result of redesign (see AAT Removed in Favor of PCT and Authorization Assessment Gains Precision)</td>
</tr>
<tr>
<td>RPT as an UMA access token</td>
<td>RPT as an OAuth access token</td>
<td>Result of redesign (see Token Endpoint Replaces RPT Endpoint; Client-Side Communications Defined as Extension Grant)</td>
</tr>
</tbody>
</table>
API and Endpoint Changes
These design changes include naming changes made to some of the endpoints.
<table>
<thead>
<tr>
<th>UMA1</th>
<th>UMA2</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>OAuth endpoints:</td>
<td>Protection API:</td>
<td>Authorization API:</td>
</tr>
<tr>
<td>----------------</td>
<td>----------------</td>
<td>--------------------</td>
</tr>
<tr>
<td>- authorization endpoint <br> - token endpoint</td>
<td>- resource set registration endpoint/API <br> - permission registration endpoint <br> - token introspection endpoint</td>
<td>- RPT endpoint</td>
</tr>
<tr>
<td>OAuth endpoints:</td>
<td>Protection API (now OPTIONAL):</td>
<td></td>
</tr>
<tr>
<td>- authorization endpoint <br> - token endpoint</td>
<td>- resource registration endpoint/API <br> - permission endpoint <br> - token introspection endpoint</td>
<td>In UMA2, there is no authorization API. The prior function of the RPT endpoint is served by the existing OAuth token endpoint.</td>
</tr>
</tbody>
</table>
Authorization Server Discovery Document and Metadata Changes
Discovery Document and Metadata Simplification
UMA1's endpoint and feature discovery mechanism was defined in total by its Core specification. UMA2 makes use of the OAuth Authorization Server Discovery mechanism instead (still in Internet-Draft form at the time of UMA2 publication), eliminating metadata fields already defined by the OAuth discovery or OpenID Connect specification. The Grant (Sec 2) and FedAuthz (Sec 2) specifications each define only the metadata fields they require. (59, 157, 159, 305)
Definition of OAuth Dynamic Client Registration Metadata Field
The new metadata field `claims_redirect_uris` enables the client to pre-register claims redirection URIs. (Grant Sec 2, Sec 3.3.2, Sec 7.3) (337 sub-issues c and d)
Permissions Claim and Sub-Claims in Token Introspection Object Not Requested to Be IANA-Registered as JWT Claims
Previously, it was intended to make an IANA registration request of the claims inside the introspection object as independent JWT claims. This would enable them to be formally used in RPTs, such that an RS can validate the access token locally with these claims packed inside it. Because of potential security and privacy considerations, it was determined not to define this token format for now. (FedAuthz Sec 9) (334)
Changes to AS-Client, RS-Client, and AS-Requesting Party Interfaces (Now UMA Grant Specification)
Authorization Server Rotates Permission Ticket
After the AS initially generates the permission ticket and the RS conveys it to the client, whenever the client subsequently approaches the AS token endpoint or redirects the requesting party to the AS claims gathering endpoint, the AS is required to rotate the value of the permission ticket every time it hands a permission ticket value back to the client (Grant Sec 3.3.3, Sec 3.3.6). This action obsoletes the need for the UMA Claims-Gathering Extension for Enhanced Security specification (see this explanation of that specification for more information).
Token Endpoint Replaces RPT Endpoint; Client-Side Communications Defined as Extension Grant
The specialized RPT endpoint was removed in favor of using the standard OAuth token endpoint (Grant Sec 3.3.1). A formal extension OAuth grant was defined (same section), working with regular OAuth capabilities and OAuth error codes to the extent possible (Sec 3.3.6). This enabled reuse of large portions of the threat model and the client type model, along with the ability for the client to request scopes and to authenticate using its own client credentials at the token endpoint (see the next section for additional discussion). (153, 165)
**AAT Removed in Favor of PCT**
An end-user requesting party no longer needs to mediate issuance of an AAT at the AS, and the client no longer needs to use an AAT in order to request a token; it simply uses its own client credentials at the OAuth token endpoint as in a normal grant (see *Token Endpoint Replaces RPT Endpoint and Client-Side Communications Defined as Grant*). Thus, the first time the requesting party needs to interact with the AS, if at all, is to provide claims interactively when redirected by the client as part of claims collection. This is in contrast to UMA1, where an end-user requesting party would have been expected to engage in an interactive OAuth flow to log in and then authorize AAT issuance at the AS's authorization endpoint. In UMA1, the (required) AAT could have been used by the AS as a reminder of claims about the current requesting party. In UMA2, the (optional) PCT is available to serve in this capacity instead, without the OAuth mechanism being involved (Grant Sec 3.3.1). Note that UMA2 does not require the AS to involve the requesting party in an interactive flow authorizing PCT issuance (Grant Sec 3.3.3). (154, 264)
**Deprecated Response-Body Permission Ticket Return Option By RS Removed**
In UMA V1.0.1 the RS was able to return the initial permission ticket to the client in the response body for backwards compatibility with UMA V1.0, but this option was deprecated: now this option has been removed. (233)
**Permission Ticket Return By AS With Redirect-User Hint No Longer Deprecated**
In UMA V1.0.1 the AS was able to return the permission ticket to the client along with the redirect_user hint, but the client was not supposed to depend on ticket accuracy, and the supply of this ticket was depreciated. Now all permission tickets directly supplied by the AS are rotated and the value is safe for the client to depend on (Grant Sec 3.3.6). (233)
**More Discretionary Permission Requests**
The instruction for the RS to request permissions on the client's behalf (which can be a private interface or the standardized interface governed by FedAuthz) is now defined as a recommendation ("SHOULD") to be reasonable for the client's resource request, rather than being required to meet it ("minimally suffices"). The UMA Implementer's Guide has a section on *Considerations Regarding Resource Server Permission Requests* that explains how and why this level of discretion is more appropriate.
**need_info Response Structured Flattened**
The JSON nested object structure of the need_info error response from the AS has been flattened. Now it directly contains a permission ticket and either a required_claims or a redirect_user hint (or both) (Grant Sec 3.3.6). (237, 308)
**not_authorized Error Renamed to request_denied**
The UMA1 error not_authorized has been renamed to request_denied. Note that this error was re-added only in a later revision of UMA2. See the UMA Implementer’s Guide section called *Understanding Authorization Server Response Options From the Token Endpoint* to understand AS error semantics. (Grant Sec 3.3.6) (340)
**Added interval parameter to request_submitted Error**
An optional interval parameter was added to the request_submitted error to enable the AS to inform the client about appropriate polling intervals. (Grant Sec 3.3.6) (341)
**New Refresh Token Clarity**
It has been clarified that the AS can issue a refresh token and the client can use the refresh token grant to attempt to get a new RPT with it (Grant Sec 3.3.5, Sec 3.6). (238, 284)
**Authorization Assessment Gains Precision**
Inputs to authorization assessment and results calculation are more normative and precise. It is also now possible for permissions with zero scopes to be granted (Grant Sec 3.3.4), (266, 310, 317)
**Permission Ticket Ecosystem Rationalized**
The permission ticket generation ecosystem has been rationalized. In UMA2, a permission ticket is always generated, and the value rotated, in cases of a redirect back from the claims interaction endpoint and in cases of need_info and request_submitted errors from token endpoint requests, and never in cases of other errors. An authorization process is still ongoing while the authorization server is still generating permission tickets. (275, 279, 298)
**Only One Pushed Claim Token Now Allowed at a Time**
In UMA1, the mechanism for claim token pushing was a JSON-encoded request message sent to the RPT endpoint, optionally including with a claim_tokens array each of whose objects had a format parameter and a token parameter. In UMA2 (Grant Sec 3.3.4), due to increased alignment with OAuth, this structure was flattened and the request message – now sent to the token endpoint as application/x-www-form-urlencoded format – contains each of the inner parameters only once. (If it is desired to send multiple claim tokens in a single request message, a compound claim token format could be defined.)
**RPT Upgrading Logic Improved**
UMA2 includes more comprehensive and normative logic around RPT upgrading (Grant Sec 3.3.5, Sec 3.3.5.1). (281)
**Token Revocation Clarifications**
UMA2 includes more comprehensive and normative text around token revocation, and defines a token type hint for PCTs (Grant Sec 3.7). (295)
**Refresh Token Grant and Downscoping Logic Clarifications**
UMA2 ensures that the logic of downscoping during token refreshing is properly defined given that UMA scopes are bound to resources, and clarifies that the AS does not perform authorization assessment in this context (Grant Sec 3.6). (306)
**Changes to AS-RS Interface/Protection API (Now Federated Authorization Specification)**
**Resource Registration Endpoint**
**Extraneous URL Parts Removed From Resource Registration API**
The API available at the resource registration endpoint required the path to contain the string resource_set. This string has been removed (FedAuthz Sec 3.2). (155)
**Scope Description Documents No Longer Expected to Resolve at Run Time When Scopes Are URLs**
The AS is no longer expected to resolve scope description details at resource registration time or at any other run-time requirement (FedAuthz Sec 3.1.1). (289)
**Resource Descriptions Lose uri Parameter**
The uri parameter in the resource description was removed due to potential security and privacy concerns. (FedAuthz Sec 3.1) (270)
**Resource and Scope Description Documents Gain Description Parameters**
Resource description documents and scope description documents each now have a new parameter, description, for a human-readable string describing the resource or scope (respectively) at length. (271, 272)
**scopes Parameter in Resource Description Document Renamed to resource_scopes**
The scopes parameter in the resource description document has been renamed to resource_scopes (FedAuthz Sec 3.1). (318)
**New HTTP 400 and invalid_request Error**
For a typical variety of malformed-request errors, a response of an HTTP 400 (Bad Request) status code and an optional invalid_request error code is now defined. (FedAuthz Sec 3.2) (354-1)
**Permission Endpoint**
**Requesting Multiple Permissions and Permissions With Zero Scopes**
It is now possible for the RS to request multiple permissions on the client’s behalf, not just one; this enables the RS to request “packages” of multiple resources that are likely to need to be accessed together. It is also possible for the RS to supply zero scopes on a requested permission (FedAuthz Sec 4.1); this is because the client can request its own scopes directly from the AS (for more discussion see Token Endpoint Replaces RPT Endpoint; Client-Side Communications Defined as Extension Grant). (317)
**Token Introspection Endpoint**
**scopes parameter renamed to resource_scopes in Introspection Response Object**
The scopes parameter in the token introspection response object has been renamed to resource_scopes (FedAuthz Sec 5.1.1). (158)
**Options Not to Use Token Introspection Explicitly Allowed**
In UMA2, the RPT is explicitly a type of OAuth access token, and it has been clarified that the token can be self-contained and validated locally by the RS, or introspected at the AS at run time, or its cached value used as appropriate (FedAuthz Sec 5). (261)
permissions Claim in Token Introspection Object Must Be Used
If token introspection is used (see Options Not to Use Token Introspection Explicitly Allowed), the introspection object can no longer be extended to replace the permissions claim with an entirely different structure. (322)
permission Claim exp Sub-Claim’s Meaning If Absent Removed
The statement about the permission claim's exp sub-claim not expiring if it is absent was removed for the multi-part rationale given in the linked issue. (37 sub-issue a)
From V1.0 to V1.0.1
The UMA V1.0 specifications (Core, RSR) were approved in March 2015. The UMA V1.0.1 specifications (Core, RSR) are were approved in an All-Member Ballot to be Kantara Recommendations and were published in December 2015.
The following release notes are catalogued according to their impact on software implementations (where impact on client software in addition to authorization server or resource server software is denoted with (+Client) in the section title). Links to relevant GitHub issues and specific section numbers are provided where possible, enabling old-to-new text comparisons and tracking of discussions and rationales.
The following themes animated the V1.0.1 release process:
- Account for V1.0 lessons learned out of the gate
- Achieve timeline predictability and minimization of disruption for V1.0 implementers
- Achieve efficiency, speed, and accuracy in specification revisions
- Achieve issue solution consistency with OAuth 2.0 and OpenID Connect where possible
- Within the allotted time, prioritize first blocking and critical bug fixes, then low-impact specification and implementation changes
Minor changes, such as changes that don't impact implementations or specification interpretations, are not discussed in this section. To see a full list of issues disposed of and specification commits related to V1.0.1, see the list of GitHub issues with the "V1.0.1" label and the commit histories for Core and RSR.
Changes Affecting Authorization Server (+Client) Implementations
Following are specification changes in V1.0.1 that affect authorization servers, and possibly clients that interact with them as well.
**AS Now Has Unique Redirect URI Endpoint for Claims Gathering (+Client)**
Previously, the client was instructed to present the ordinary OAuth redirect_uri endpoint to which the AS should redirect requesting parties back after claims gathering, but this was ambiguously specified and incorrect. Now the client has a unique endpoint, claims_redirect_uri, that it needs to register. (144)
**Permission Ticket Lifecycle Management (+Client)**
Previously, little guidance was offered on how to manage permission tickets. Now some implications are explored, particularly as they relate to client interaction. (172) (Core Sec 3.2.2)
**Requested Permission and Permission Ticket Matching**
Previously, the matching of the "extents of access" of the requested permission registered by the RS and the permission ticket issued by the AS was implicit. Now it is spelled out. (175) (Core Sec 3.2)
**Permission Ticket on Redirect Back to Client (+Client)**
Previously, the AS was required to repeat the client's permission ticket back to it in a ticket property when offering a redirect_user hint in error_details. Now this is optional and the client is encouraged to ignore the property's value, preparatory to removing the property entirely in a future UMA version. The reason is that the value can't be guaranteed good; repeating the value was in order to save the client work; and having the client check the value would ultimately have caused both sides work for no gain. (205) (Core Sec 3.5.4.2)
**PUT Means Complete Replacement**
Previously, the requirement for an Update method in resource set registration to completely replace the previous resource set description was implicit. Now it is spelled out. (177) (RSR Sec 2.2.3)
**Default-Deny for Authorization Data Issuance**
Previously, a naive implementation could have resulted in accidental default-permit authorization data issuance in some cases. Now a default-deny authorization assessment model has been made explicit, with an example given of how implementations could get into trouble. (194) (Core Sec 3.5.2)
**base64url-Encoded Claims (+Client)**
Previously, the wording about base64url-encoding pushed claims was ambiguous about whether double-encoding was necessary in the case of claim formats that were already base64url-encoded. Now it has been clarified that double-encoding should not be performed. (206) (Core Sec 3.6.2)
**Enhanced Security Considerations**
Previously, the security considerations around accepting policy-setting context information from an incompletely trusted RS only covered “bad icon URIs”. Now they cover all such policy-setting context information, following roughly the OAuth example. (151) (RSR Sec 4)
Previously, the security considerations around client-pushed claims were explored only in a very cursory fashion in the body of the text. Now they are treated at length in a new subsection. (160) (Core Sec 7.4.1)
**Enhanced Privacy Considerations**
Previously, little was said about privacy implications of requesting party claims being transmitted to the AS. Now this section has been greatly expanded. (211) (Core Sec 8.2)
**Changes Affecting Resource Server (+Client) Implementations**
Following are specification changes in V1.0.1 that affect resource servers, and possibly clients that interact with them as well.
**Caveat About Resource Server API Constraint**
Previously, the specification was missing an important caveat: Based on a client’s initial RPT-free resource request, the RS needs to know the correct AS, PAT, and resource set ID to include in its follow-on call to the permission request endpoint at the AS. Thus, the API of the RS needs to be structured so that it can derive this information from the client’s request. Now this caveat appears in several locations. (161, 162, 225)
**Adjustment of Other Resource Server API Constraints (+Client)**
Previously, the specification wording was inconsistent and problematic regarding how the RS responds to a client request accompanied by no RPT or an RPT with insufficient authorization data (assuming permission request success). Now the ability not to respond at all is more fully acknowledged: all responses intended to be interpreted in an UMA fashion are required to be accompanied by a `WWW-Authenticate: UMA` header; the permission ticket is required to be returned in a new `ticket` parameter in that header; complete freedom is given regarding the RS’s choice of HTTP status code; and only in the case of a 403 choice is a ticket in a JSON-encoded body suggested, preparatory to removing the body option in a future UMA version. The rationale for this somewhat dramatic set of changes is that the original prescription to return HTTP status code 403 was incorrect; the specification gave too little guidance about responses other than 403 responses to be useful for client interoperability; and its requirement to return the permission ticket in a JSON-encoded body regardless of expected content type was an issue. (163, 164, 168) (Core Sec 3.3.1)
**Solution for Permission Registration Failure (+Client)**
Previously, the specification gave no guidance on how the RS should respond to the client in case of permission registration failure at the AS. Now, if the RS responds at all, it is required to substitute a `Warning: 199 - "UMA Authorization Server Unreachable"` header for `WWW-Authenticate: UMA`. (176) (Core Sec 3.3.2)
**Authorization Server URI to Return to Client (+Client)**
Previously, the value of the `as_uri` property that the RS returns to the client was described somewhat vaguely as the authorization server’s URI. Now it has been clarified to be the `issuer` URI as it appears in the AS configuration data of the AS. (199) (Core Sec 3.3.1)
**New Security Considerations**
Previously, the security considerations around accepting policy-setting context information from an incompletely trusted AS were not covered. Now they cover the `user_access_policy_uri` property, which is the only policy-setting context information passed from AS to RS. (185) (RSR Sec 4)
**Specification Reorganizations**
The specifications, particularly Core Sec 3, were reorganized in the fashion of OpenID Connect, with the goal of giving a subsection to every request and response message. Other notable changes include:
- Several “commentary” subsections were added, such as Core Sec 3.2.2 discussing permission ticket creation and management, and RSR Sec 2.1.2 discussing scope interpretation.
- A new section, Core Sec 9.2, registers the permissions property in the new OAuth token introspection IANA registry (this is in addition to its registration in the JWT claims registry).
- Core Sec 7.4.1 breaks out the new, more extensive security considerations discussion of pushed claims.
- Core Sec 8 now has subsections to make privacy considerations easier to find and understand.
Core Specification Reorganization
Found in Core V1.0 (go)
Find in Core draft V1.0.1 (go)
1. Introduction (go)
1.1. Notational Conventions
1.2. Terminology
1.3. Achieving Distributed Access Control
1.3.1. Protection API
1.3.2. Authorization API
1.3.3. Protected Resource Interface
1.3.4. Time-to-Live Considerations
1.4. Authorization Server Configuration Data
2. Protecting a Resource (go)
3. Getting Authorization and Accessing a Resource (go)
3.1 Client Attempts Access to Protected Resource
3.1.1. Client Request to Resource Server With No RPT (go)
3.1.2. Client Presents RPT (go)
3.2 Resource Server Registers Requested Permission With Authorization Server (go)
3.2.1 Resource Server Request to Permission Registration Endpoint
3.2.2 Permission Ticket Creation and Management
3.2.3 Authorization Server Response to Resource Server on Permission Registration Success
3.2.4 Authorization Server Response to Resource Server on Permission Registration Failure
3.3 Resource Server Determines RPT's Status (go)
3.3.1. Token Introspection
3.3.2. RPT Profile: Bearer
3.4 Resource Server Determines RPT Status (go)
3.4.1 Token Introspection Process
3.4.2 RPT Profile: Bearer
3.5 Client Seeks Authorization for Access (go)
3.5.1 Client Request to Authorization Server for Authorization Data (go)
3.5.2 Authorization Assessment Process
3.5.3 Authorization Server Response to Client on Authorization Success
3.5.4 Authorization Server Response to Client on Authorization Failure
3.4.1.1. Authentication Context Flows
3.6 Client Responds to Authorization Server's Request for Additional Information
3.6.1 Client Redirects Requesting Party to Authorization Server for Authentication
3.4.1.2. Claims-Gathering Flows
3.6 Client Responds to Authorization Server's Request for Additional Information
3.6.2 Client Pushes Claim Tokens to Authorization Server
3.6.3 Client Redirects Requesting Party to Authorization Server for Claims-Gathering
4. Error Messages
4.1 OAuth Error Responses
4.2 UMA Error Responses
5. Profiles for API Extensibility
5.1 Protection API Extensibility Profile
5.2 Authorization API Extensibility Profile
5.3 Resource Interface Extensibility Profile
5. Profiles for API Extensibility
5.1 Protection API Extensibility Profile
5.2 Authorization API Extensibility Profile
5.3 Resource Interface Extensibility Profile
6. Specifying Additional Profiles
6.1 Specifying Profiles of UMA
6.2 Specifying RPT Profiles
6.3 Specifying Claim Token Format Profiles
6. Specifying Additional Profiles
6.1 Specifying Profiles of UMA
6.2 Specifying RPT Profiles
6.3 Specifying Claim Token Format Profiles
7. Compatibility Notes
n/a
8. Security Considerations
8.1 Redirection and Impersonation Threats
8.1 Requesting Party Redirection and Impersonation Threats
8.2 Client Authentication
8.2 Client Authentication
8.3 JSON Usage
7.3 JSON Usage
8.4 Profiles, Binding Obligations, and Trust Establishment
7.4 Profiles and Trust Establishment
n/a
7.4.1 Requirements for Trust When Clients Push Claim Tokens
9. Privacy Considerations
9. Privacy Considerations
8.1 Resource Set Information at the Authorization Server
8.2 Requesting Party Information at the Authorization Server
8.3 Profiles and Trust Establishment
10. IANA Considerations
9. IANA Considerations
10.1. JSON Web Token Claims Registration
10.1.1. Registry Contents
9.1 JSON Web Token Claims Registration
9.1.1 Registry Contents
n/a
9.2 OAuth Token Introspection Response Registration
9.2.1 Registry Contents
10.2. Well-Known URI Registration
10.2.1. Registry Contents
9.3 Well-Known URI Registration
9.3.1 Registry Contents
Pre-V1.0 Changes
Following is a catalog of notable changes to the specifications in the pre-V1.0 timeframe.
Core Changes
Internet-Draft Rev 11 to Rev 12
From I-D rev 11 to rev 12:
- Notable changes:
- Enhanced the Security Considerations section.
Internet-Draft Rev 10 to Rev 11
From I-D rev 10 to rev 11:
- Breaking changes:
- Section 3.4: not_authorized_permission error code: Changed to notAuthorized.
- RPT handling: Changed extensively to remove the RPT issuance endpoint and enable the authorization data request endpoint to do all RPT issuance duties. Permission ticket issuance is now handled on an "eager" basis, when a client either without an RPT or with an invalid or insufficient-authorization-data RPT approaches the RS seeking access. This affects several sections:
- Section 1.4: configuration data
- Section 3: introduction
- Section 3.1.1 and 3.1.2: client approaching RS
- Section 3.2: RS registering permission
- Section 3.4: RPT issuance and authorization data addition
- Section 5.2: Extensibility profile implications
- Section 1.4:
- Changed the claim_profiles_supported property in the configuration data to claim_token_profiles_supported
- Changed the user_endpoint property in the configuration data to authorization_endpoint, to match the final IETF RFC 6749 name in OAuth 2.0
- Changed the authorization_request_endpoint property in the configuration data to rpt_endpoint, to distinguish it more fully from the OAuth endpoint and to shorten it
- (Also affects Section 5) Changed how uma_profiles_supported works, so that the API extensibility profiles don't have reserved keywords but rather use the regular URI mechanism for indicating profiles
- Section 3.3.2:
- Names of several properties in the permissions structure for the RPT "Bearer" token introspection response have changed to align them with JWT names: expires_at to exp, issued_by to iat
- The JWT "scope" property at the top level is now disallowed in favor of "scopes" at the permissions level.
- PAT and AAT OAuth scopes:
- Renamed from URIs to simple strings: "uma_protection" and "uma_authorization"; the JSON scope description documents provided to enable the old URIs to resolve no longer have any relation to the UMA Core spec
- Other changes of note:
- Section 3.1.1 and Section 3.1.2: Extraneous host_id removed from example of RS's response to client.
- Enabled explicit use of OAuth-based authentication protocols such as OpenID Connect for OAuth protection driving PAT and AAT issuance.
- Identifiers for spec-defined profiles now use https instead of http
- Migrated the claim profiling spec's requesting party claims endpoint configuration data to the core spec, and made it optional to supply.
- Migrated the claim profiling spec's "need_claims" extensions to the core spec, broadened it to "need_info", and gave it "error_details" hints in the core spec.
- Section 3.1.1: Requirement for RS to return 403 to a tokenless client has been softened to a SHOULD.
- Section 3.3.2: The token introspection response has been aligned with the latest token introspection spec. nbf has been added at the permissions level, exp is now optional, and all permissions-level properties that duplicate JWT-level claims in intent now get overridden by any JWT-level claims present in the response. Finally, the "permissions" JWT claim has been registered with IANA.
- Extensive new redirect-pattern claims gathering support added
- Extensive new security and privacy considerations added
- Section 1.4:
- issuer property: Now required to match the actual published location of the config data.
- Dynamic client configuration: When OIDC dynamic client configuration is used, this is now more intelligently handled through a reserved keyword "openid" that indicates that the OIDC configuration data should be consulted for the relevant endpoint.
- pat_grant_types_supported and aat_grant_types_supported: Broadened to allow them to be strings even when not based on the OAuth grant type strings, similarly to token profiles.
- issuer property: Now required to match the actual published location of the config data.
- Dynamic client configuration: When OIDC dynamic client configuration is used, this is now more intelligently handled through a reserved keyword "openid" that indicates that the OIDC configuration data should be consulted for the relevant endpoint.
- pat_grant_types_supported and aat_grant_types_supported: Broadened to allow them to be strings even when not based on the OAuth grant type strings, similarly to token profiles.
Internet-Draft Rev 08 to Rev 09
From I-D rev 08 to 09:
- Breaking changes:
- (Technically breaking but not expected to have huge impact:) TLS/HTTPS is now mandatory for the AS to implement in its protection and authorization APIs.
- Other changes of note:
- It is no longer required for the client to redirect a human requesting party to the AS for the claims-gathering process.
- A new claims profiling framework (now in a separate spec) describes how to leverage one of several common patterns for claims-gathering: client redirects the requesting party to AS, client pushes claims to the AS.
A new framework for API extensibility, and a matching series of extensibility profiles, appears in the core spec. It enables tighter coupling between the AS and RS, AS and client, and RS and client, respectively, but only in a controlled manner to foster greater interoperability in such circumstances.
The SHOULD for the usage of the SAML bearer token profile for PAT issuance is now just a MAY.
In Section 4.2, the example was corrected to remove a wayward “status” : “error” property.
Clarified that no request message body is expected when the client uses the RPT endpoint at the AS.
Added a success example in Section 3.4.2 showing how authorization data is added and the RPT is simultaneously refreshed, a new capability.
### Internet-Draft Rev 07 to Rev 08
From I-D rev 07 to 08:
- **Breaking changes:**
- Section 1.3: TLS as defined and (mostly) required in OAuth (RFC 6749) is now a MUST in UMA for AS endpoints.
From I-D rev 06 to 07:
- **Breaking changes:**
- Section 1.5: Some properties in the the authorization server configuration data have been renamed, and others broken out into multiple properties with different names. The wording around reserved keywords vs. URIs as string values was also cleaned up.
- oauth_token_profiles_supported: broken out into two, pat_profiles_supported and aat_profiles_supported.
- uma_token_profiles_supported: renamed to rpt_profiles_supported.
- oauth_grant_types_supported: broken out into two, pat_grant_types_supported and aat_grant_types_supported.
- Section 3.4.2: Error code names were cleaned up.
- expired_requester_ticket: renamed to expired_ticket.
- invalid_requester_ticket: renamed to invalid_ticket.
- Other changes of note:
- Updated the token introspection spec citation and details.
- Updated the OAuth threat model citation.
- Enhanced the security considerations section.
- Broaden from defining successful access as 200 OK to defining it as 2xx Success.
- Explain that the PAT implicitly gives the "subject" of a requested permission.
- Fix resource_set_registration_endpoint keyword mention. (It was missing the last work.)
### Internet-Draft Rev 05 to Rev 06
From I-D rev 05 to 06:
- **Breaking changes:**
- Section 1.5: The authorization server configuration data now allows for providing a dynamic client registration endpoint (now defined by the official OAuth dynamic client registration spec), rather than just serving as a flag for whether the generic feature is supported. The name changed to dynamic_client_endpoint.
- Sections 3.1.1 and 3.1.2: The am_uri header has been renamed to as_uri due to terminology changes (see below).
- Section 3.1.2: The OAuth error "insufficient_scope" is now a central part of the authorization server's response to a client with a valid RPT and insufficient scope. This aligns UMA more closely with OAuth as a profile thereof (stay tuned for more possible tweaks in this general area, e.g. in WWW-Authenticate).
- Other changes of note:
- Terminology has been changed wholesale from UMA-specific terms to OAuth-generic terms.
- Authorization manager (AM) is now authorization server.
- Host is now resource server.
- Authorizing user is now resource owner.
- Requester is now client.
- Some additional terms and concepts have been tweaked, enhanced and clarified.
- Scope is now scope type (likely to change back due to feedback).
- Authorization data is now defined as a generic category, of which permissions are an instance.
- RPT now stands for requesting party token instead of requester permission token.
- UMA is more explicitly defined as a profile of OAuth.
- References have been added to the OAuth token introspection spec proposal, though it is not fully used yet (stay tuned for breaking changes here).
- The resource set registration process (phase 1) has been moved to a separate modular spec that is designed to be usable by other OAuth-based technologies along with UMA.
### RSR changes
### Internet-Draft Rev 04 to Rev 05
From I-D rev 04 to 05:
- **Breaking changes:**
- Changed the PUT method for the purpose of resource set creation at the authorization server, to POST. This had other rippling changes, such as removing the usage of If-Match, the precondition_failed error, ETag usage, and the privacy considerations warning about mapping real resource set names to obscured names that remove personally identifiable information.
- Changed the name of the policy_uri property to user_access_policy_uri to differentiate it from the OAuth property of (formerly) the same name
- Other changes of note:
Clarified that user_access_policy_uri is allowed on Create, Read, and Update, and also now allow it on Delete and List too.
Enhanced the Security Considerations section.
Internet-Draft Rev 03 to Rev 04
From I-D rev 03 to rev 04:
- Breaking changes:
- Removed the "status: xxx" property from all the AS responses in the RSR API.
- Other changes of note:
- ("04" to "05") Added a new optional resource_uri parameter to the resource set description, to support resource discovery at an authorization server.
- Scopes bound to resource set descriptions can now be strings rather than being required to be URIs that resolve to scope description documents.
- The _rev property has been removed from the resource set registration API. It can be added back as an extension for those who want it.
Claim Profiles changes
Claim Profiles Rev 00
- We decided not to progress this specification in its current form, so we will let it expire and will not reference it from Core.
Change History
<table>
<thead>
<tr>
<th>Version</th>
<th>Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>Current Version (v. 39)</td>
<td>Mar 11, 2018 22:39</td>
<td><strong>Eve Maler:</strong> Added the subsection "Only One Pushed Claim Token Now Allowed at a Time"</td>
</tr>
<tr>
<td>v. 38</td>
<td>Jan 09, 2018 22:16</td>
<td><strong>Eve Maler:</strong> Added change history macro</td>
</tr>
<tr>
<td>v. 37</td>
<td>Jan 09, 2018 22:15</td>
<td><strong>Eve Maler:</strong> Corrected header material; added links into specific Recommendation sections</td>
</tr>
<tr>
<td>v. 36</td>
<td>Nov 16, 2017 19:26</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 35</td>
<td>Nov 16, 2017 03:00</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 34</td>
<td>Nov 01, 2017 00:04</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 33</td>
<td>Oct 10, 2017 16:53</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 32</td>
<td>Oct 10, 2017 15:55</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 31</td>
<td>Sep 06, 2017 15:11</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 30</td>
<td>Aug 08, 2017 17:53</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 29</td>
<td>Aug 08, 2017 17:46</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 28</td>
<td>Aug 08, 2017 17:20</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 27</td>
<td>Jul 18, 2017 14:01</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 26</td>
<td>Jul 18, 2017 13:21</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 25</td>
<td>Jul 18, 2017 13:20</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>v. 24</td>
<td>Jul 12, 2017 10:30</td>
<td><strong>Eve Maler</strong></td>
</tr>
<tr>
<td>Version</td>
<td>Date and Time</td>
<td>Author</td>
</tr>
<tr>
<td>---------</td>
<td>---------------------</td>
<td>------------</td>
</tr>
<tr>
<td>v. 23</td>
<td>Jul 05, 2017 11:07</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 22</td>
<td>Jul 05, 2017 10:42</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 21</td>
<td>Jun 30, 2017 00:21</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 20</td>
<td>Jun 27, 2017 17:51</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 19</td>
<td>Jun 25, 2017 23:14</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 18</td>
<td>May 14, 2017 06:49</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 17</td>
<td>May 14, 2017 06:47</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 16</td>
<td>May 05, 2016 15:10</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 15</td>
<td>May 05, 2016 14:49</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 14</td>
<td>Jan 25, 2016 10:57</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 13</td>
<td>Sep 20, 2015 14:39</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 12</td>
<td>Sep 20, 2015 14:27</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 11</td>
<td>Sep 20, 2015 14:27</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 10</td>
<td>Sep 20, 2015 13:51</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 9</td>
<td>Sep 20, 2015 13:49</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 8</td>
<td>Sep 20, 2015 13:45</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 7</td>
<td>Sep 20, 2015 13:06</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 6</td>
<td>Sep 18, 2015 10:28</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 5</td>
<td>Sep 18, 2015 10:13</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 4</td>
<td>Sep 15, 2015 21:30</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 3</td>
<td>Sep 15, 2015 21:25</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 2</td>
<td>Sep 15, 2015 19:38</td>
<td>Eve Maler</td>
</tr>
<tr>
<td>v. 1</td>
<td>Sep 15, 2015 14:58</td>
<td>Eve Maler</td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://kantarainitiative.org/confluence/download/temp/pdfexport-20200517-170520-1341-11093/uma-UMAReleaseNotes-170520-1341-11094.pdf?contentType=application/pdf", "len_cl100k_base": 12032, "olmocr-version": "0.1.46", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 41705, "total-output-tokens": 12525, "length": "2e13", "weborganizer": {"__label__adult": 0.00030517578125, "__label__art_design": 0.00039315223693847656, "__label__crime_law": 0.00077056884765625, "__label__education_jobs": 0.0007152557373046875, "__label__entertainment": 8.183717727661133e-05, "__label__fashion_beauty": 0.00015306472778320312, "__label__finance_business": 0.0012454986572265625, "__label__food_dining": 0.00024390220642089844, "__label__games": 0.0005950927734375, "__label__hardware": 0.0007376670837402344, "__label__health": 0.0003812313079833984, "__label__history": 0.0003254413604736328, "__label__home_hobbies": 7.718801498413086e-05, "__label__industrial": 0.0003552436828613281, "__label__literature": 0.00028967857360839844, "__label__politics": 0.00038552284240722656, "__label__religion": 0.00036716461181640625, "__label__science_tech": 0.0261688232421875, "__label__social_life": 0.00010663270950317384, "__label__software": 0.055511474609375, "__label__software_dev": 0.91015625, "__label__sports_fitness": 0.0002244710922241211, "__label__transportation": 0.0002390146255493164, "__label__travel": 0.00019276142120361328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 49176, 0.04453]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 49176, 0.07015]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 49176, 0.86927]], "google_gemma-3-12b-it_contains_pii": [[0, 3489, false], [3489, 6024, null], [6024, 10277, null], [10277, 13197, null], [13197, 18091, null], [18091, 21741, null], [21741, 25966, null], [25966, 31064, null], [31064, 32736, null], [32736, 34852, null], [34852, 34975, null], [34975, 40123, null], [40123, 44798, null], [44798, 48002, null], [48002, 49176, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3489, true], [3489, 6024, null], [6024, 10277, null], [10277, 13197, null], [13197, 18091, null], [18091, 21741, null], [21741, 25966, null], [25966, 31064, null], [31064, 32736, null], [32736, 34852, null], [34852, 34975, null], [34975, 40123, null], [40123, 44798, null], [44798, 48002, null], [48002, 49176, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 49176, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 49176, null]], "pdf_page_numbers": [[0, 3489, 1], [3489, 6024, 2], [6024, 10277, 3], [10277, 13197, 4], [13197, 18091, 5], [18091, 21741, 6], [21741, 25966, 7], [25966, 31064, 8], [31064, 32736, 9], [32736, 34852, 10], [34852, 34975, 11], [34975, 40123, 12], [40123, 44798, 13], [44798, 48002, 14], [48002, 49176, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 49176, 0.13115]]}
|
olmocr_science_pdfs
|
2024-11-23
|
2024-11-23
|
12ae3b1435d12539a58a7fa8b8ea7e085482d33e
|
TOWARDS A SELF-ADAPTING
CENTRALIZED
CONCURRENCY CONTROL ALGORITHM
by
H. Boral* and I. Gold
Technical Report #317
May 1984
* Microelectronics and Computer Technology Corporation,
Austin, TX, USA.
TOWARDS A SELF-ADAPTING CENTRALIZED CONCURRENCY CONTROL ALGORITHM
Haran Boral
Israel Gold
Computer Science Department
Technion -- Israel Institute of Technology
Haifa 32000-Israel
*Microelectronics and Computer Technology Corporation, Austin, TX, USA
ABSTRACT
The idea of concurrency control algorithms that consists of several rw synchronization techniques and several rr synchronization techniques is introduced. Some algorithms that utilize both 2PL and Certification based synchronization techniques are presented along with their proofs of correctness.
The algorithms have the capability of using any number of the techniques at their disposal concurrently; as well as allow a transaction to be synchronized by different techniques at different times. Such algorithms can form the basis of a concurrency control mechanism in a database management or transaction processing system that adapts itself to the system workload by selecting the appropriate techniques to be used.
The paper concerns itself with correctness issue of such algorithms. In addition to presenting example algorithms, a general proof method is outlined and applied. Furthermore, it is shown that mixing locking and non-locking methods can be achieved and the level of the mix may be varied dynamically.
1. Introduction
Several centralized concurrency control algorithms have been proposed during the past several years. The majority of the algorithms are based, to one degree or another, on the Two Phased Locking method (2PL) [ESWA76] in which blocking is used to synchronize conflicting transactions; and on methods that allow conflicting transactions to run concurrently but use transaction restart in cases where inconsistent updates to the database could result [KUNG81] (known as Certification methods because they certify a transaction for additional processing or commit, or cause it to abort):
At system design time a concurrency control algorithm is picked for the system (typically a 2PL variant) and incorporated into it. This design decision may be made based on some a priori knowledge of the expected use of the system or simply because the algorithm may appear to be (or actually may be) the best. Due to the complicated structure of software systems such as database management systems, it is unlikely that the original algorithm incorporated into the system will ever be changed or even be improved, despite the fact that the system may be used under a variety of workload conditions in two separate settings or even in the same setting over a long time interval.
Recently researchers have begun to compare several different algorithms in an attempt to reach some conclusion concerning their operational merit. Naturally, if a clear cut conclusion can be reached about one algorithm being "best" at almost or even at all times then that algorithm should be employed by all database management systems. The studies range from the purely abstract [PAPA79] to more "useful" where such measures as transaction throughput and cost of the concurrency control mechanism are evaluated [AGRA83], [CARE83], [GALL82]. Carey [CARE83] reports that when the overhead associated with locking, i.e. context switching, is small, transaction restarts have a more negative
effect on throughput than blocking. He thus concludes that variants of 2PL lead to higher system throughput than certification methods, as long as critical system resources (CPU and I/O in a centralized system) are well utilized. Further, of the various methods he examined (variants of 2PL, certification, and timestamp methods), dynamic 2PL performs best when no a priori knowledge about transaction processing requirements and transaction workload is known. Carey's conclusions are supported, to one degree or another, by Robinson [ROBI82A] [ROBI82B] Agrawal [AGRA83] and others.
However, other researchers (Reinl and Reuter [REIN83] for example) disagree with this final conclusion and the reason for the disagreement appears to be the use of different metrics in comparing the various methods.
Carey's metric was throughput. Although high throughput is desirable in a system, it alone cannot be used in evaluating the system's performance. Just what the "right" metric is, is not clear. In fact, there may not be a single metric to be used in evaluating all systems; the metric should be a function of the user community's needs. However, it seems reasonable to assume that any metric will incorporate into it both system throughput and response time with the emphasis on one or the other varying across installations.
Ignoring for a moment transaction restarts and transaction initiation and termination costs, we can observe that a transaction that is synchronized using a certification policy will have faster response time than a transaction synchronized by a 2PL-variant. As an example consider a database management system that allows "short readers" to run "almost unhindered", all other transactions are synchronized with a 2PL-variant. Response time of the short readers will be faster than in a system that synchronizes all transactions using a 2PL-variant. In fact, system throughput will most likely also be higher.
This suggests a different approach to concurrency control -- one in which the concurrency control mechanism would use several different synchronization techniques concurrently each for a different class of transactions. Certification techniques should be used for those transactions for which fast response time is important whereas 2PL techniques should be used for other techniques. Just what the right mix of techniques or rather number of transactions synchronized by each type of technique is unclear and would have to be determined experimentally. Furthermore, the selection of the appropriate technique to be used in case of conflict between two transactions synchronized by different techniques is an issue to be investigated and to which a satisfactory resolution can be found empirically.
In this paper we show that it is possible to construct correct concurrency control algorithms that employ both blocking and transaction restart, concurrently, to synchronize conflicting transactions. We introduce the notion of an Integrated Concurrency Control Algorithm (ICCA) which is composed of several rw and several ww synchronization techniques all used concurrently. Different techniques use different synchronization strategies. They update common data structures but differ in the interpretation of the contents of the data structures when synchronizing conflicting transactions.
We wish to stress that the purpose of this paper is to show the possibility but not feasibility\(^1\) of such a concurrency control mechanism although towards the end of the paper we will discuss some implementation problems and their solutions as well as the envisioned use of such algorithms.
The remainder of the paper is organized as follows. In Section 2 we give an overview of the database management system model used in the paper. Section 3 discusses the Transaction Manager (TM) model -- both data structures and
---
\(^1\) This is the topic of current work
the operations the TM performs on them on behalf of transactions. In Section 4 we present rw and ww synchronization techniques based on 2PL and Certification. The notion of an Integrated Concurrency Control Algorithm (ICCA) is introduced in Section 5. In Section 6 we present a formalization of the techniques and give the proof method used to show an ICCA correct. Some practical consideration are discussed in Section 7 and we conclude with a summary of present work in Section 8.
2. The Database Management System Model
In this section we discuss the database management system model. The model utilizes private workspaces allocated to active transactions to cache their previously read data items as well as those written by the transaction during its execution. Bernstein and Goodman [BERN81] and Kung and Robinson [KUNG81] used this model previously. The following description closely models that of [BERN81].
A centralized database management system can be seen as composed of two components: a Transaction Manager (TM) and a Data Manager (DM). The TM controls interaction between users and the database management system and is responsible for such functions as concurrency control. The DM is responsible for management of the database itself, i.e., accessing it. Two data manipulation operations are recognized by the DM. DM_READ(X) -- in which data item X is read, and, DM_WRITE(X,NEW_VALUE) -- in which the value NEW_VALUE is assigned to data item X in the database.
Users of the database management system interact with it by running transactions. The TM maintains a private workspace for each active transaction in which copies of records read or written by the transaction are kept. From
the database management system point of view a transaction executes four
types of operations: TRANS, READ, WRITE, and SNART. The actions taken by the
TM upon receipt of these commands are described below.
TRANS: The TM initializes a private workspace for the transaction.
READ(X): If X already exists in the private workspace then its
value is returned to the transaction by the TM. Otherwise the TM
issues a DM_READ(X) operation to the DM. The current value of X is
returned to the TM which writes it in the transaction's private
workspace and returns it to the transaction.
WRITE(X, NEW_VALUE): X is a data item. NEW_VALUE is a value to be assigned to
X. The TM executes a PRE_WRITE(X, NEW_VALUE) operation on the
transaction's private workspace. This has the effect of updating the
previous value of X in the private workspace to NEW_VALUE if a copy of
X existed in the private workspace. Otherwise, X is created in the
workspace with the value NEW_VALUE. Note that a PRE_WRITE opera-
tion does not alter any values in the database itself. From a synchroni-
ization point of view each WRITE causes a PRE_WRITE to be executed.
SNART: The TM checks whether allowing the transaction to commit (by making
its changes permanent in the database) will leave the database in a
consistent state. In the event that it does not, the transaction will be
aborted. Otherwise the TM issues a DM_WRITE command for every pre-
viously executed PRE_WRITE command. This has the effect of making
the last change to X in the private workspace a (temporarily) per-
manent value in the database. After all DM_WRITEs have been issued
the private workspace is discarded -- the transaction has completed.
From a synchronization point of view all the transaction's DM_WRITEs
are executed atomically.
A transaction execution can be seen as composed of two phases. In the
first phase the transaction reads values from the database, performs various
computations and writes results into its private workspace. In the second
phase, which takes place after the transaction finishes all computations, the TM
first goes through (a possibly empty) procedure to ensure that committing the
transaction will not cause inconsistencies, and then (a possibly empty)
sequence of writes to the database (as described above). It is important to real-
ize that this second phase is atomic.
2 The physical implementation of the commit procedure need not be atomic as long as it ap-
ppears atomic to the outside world. Kung and Robinson [KUNG81] discussed several ways of imple-
menting non-atomic commits. In this paper we will refer to atomic commits from a logical point of
view, we ignore issues of physical implementation.
The notion of a (logical) private workspace is basic to our work. All references to data items in the private workspace are made through the TM which gives it the power to control the concurrency level in the system. Thus, the notion of a private workspace presented in this paper differs from that used by Network based database management systems, where the user program "contains" its own private workspace (or user work area) which can be accessed at any time independently of the database management system.
3. The Transaction Manager Model
In this section we examine in more detail the actions taken by the TM upon receipt of a request from a transaction. We describe the data structures involved as well as the operations performed on them. These, in turn, will be used in the next sections to describe the actions taken by the various synchronization techniques.
Two data structures are required by the TM for its operation. One is a graph (known as the Serialization Graph -- SG) that represents precedence relationships among conflicting transactions. Two transaction conflict if they access the same data item and one issues a WRITE request. The second is a table of flags (FT) in which a list of transactions and their modes of access to data items is maintained.
A node in SG represents an active or committed transaction. An edge \((T_i, T_j)\) in the graph indicates that in any execution order transaction \(T_i\) precedes transaction \(T_j\). SG is used to represent all such precedence relationships regardless of whether they originated in the deadlock detection phase of 2PL or in the detection of a conflict in a Certification algorithm.
An entry in FT exists for every data item that has been accessed, and consists of several pairs \(<\text{FLAG, TRANSACTION IDENTIFIER}>\). Each pair identifies the transaction that accessed the data item and the mode of access (Read or
Technion - Computer Science Department - Technical Report CS0317 - 1984
Write). No restriction is placed on the number and/or type of pairs associated with a single data item in an entry. It is up to the concurrency control mechanism to interpret the pairs in a single entry and to decide how to use that information.
Three types of flags are recognized:
1. An r-flag indicates that a DM_READ operation was executed on this item on behalf of the transaction holding the flag.
2. A p-flag indicates that a still active transaction issued a WRITE request on this data item. At commit time of a transaction all its p-flags are converted to c-flags if the transaction is allowed to commit.
3. A c-flag indicates that a DM_WRITE operation was executed on this data item on behalf of the committed transaction holding the flag.
A TRANS operation causes the TM to add a node to SG representing the new transaction. Edges are added to SG by the synchronization techniques as described in the next section.
At execution time a READ or a WRITE request received by the TM undergoes a possibly empty waiting phase then a possibly empty synchronization phase followed by its execution.
In the waiting phase some synchronization techniques may force the requesting transaction to wait until transactions that "hold" conflicting flags on the same data item have completed execution, whereas other techniques always enable continuation of the execution to the synchronization phase. Edges are added to SG to reflect the precedence relation imposed by the waiting.
In the synchronization phase the request is synchronized with conflicting operations from other transactions. The result of this synchronization may be abortion of the issuing transaction or continuation with execution. Edges are added to SG to reflect the precedence relation imposed by the execution of the request.
Execution of the request includes appending the appropriate flag to FT and issuing the appropriate DM_READ, PRE_WRITE, or DM_WRITE operation to the
A SNART operation causes the TM to perform a possibly empty validation phase to ensure that allowing the transaction to commit will not leave the database in an inconsistent state.
The difference between the synchronization techniques presented in the next section is in the manner in which they act in each of the three phases described above. What is common to all the techniques is that they update SG during each phase they undergo. For example, a technique that undergoes the waiting phase and discovers that transaction T_i must wait for transaction T_j will add the edge \((T_j, T_i)\) to SG. Similarly, FT is also updated for every request.
Note that we have specified above various operations that add nodes and edges to SG and pairs to FT. Information about committed transactions remains in these data structures although it can be shown that it need not be kept indefinitely. All traces of aborted transactions, however, are removed from both SG and FT. That is, the node representing an aborted transaction in SG is removed along with all incoming and outgoing edges. All pairs detailing the accesses made by the aborted transaction are also removed from FT.
4. Synchronization Techniques
The Decomposition Theorem of concurrency control [BERN81] enables the designer of a concurrency control mechanism to address himself to two subproblems: synchronization of READ WRITE requests (rw-synchronization) and synchronization of WRITE WRITE requests (ww-synchronization) rather than to a single more complex problem -- that of concurrency control. An rw (ww) synchronization technique is defined to be the procedure that guarantees correct rw (ww) synchronization. The concurrency control mechanism must then ensure that the use of a given rw synchronization technique together with a given ww synchronization technique will yield serializable execution orders.
The decomposition theorem serves as the foundation for the notion of an integrated concurrency control algorithm. Rather than the use of one rw technique together with one ww technique as is the norm in working systems and the plethora of proposed algorithms, we suggest designing an algorithm that would be composed of several rw techniques and several ww techniques. The number of techniques to be used at a given instance is something that would be left up to the system designer. The decision may be made statically or dynamically as indicated in Section 1. In this section we will present three rw techniques and two ww techniques. In sections 5 and 6 we will discuss their use in ICCAs and present the proof method to show their correctness.
4.1. Characterization of Synchronization Techniques
We propose two characterization parameters for synchronization techniques: Synchronization Strategy and Synchronization Time. By synchronization strategy we mean the method used to synchronize conflicting transactions. We differentiate between methods that use locking (in particular 2PL) and methods that use rollbacks (in our case certification methods). Synchronization between two conflicting transactions may be performed at the time the conflicts occurred (i.e., at execution time -- ET) or during the commit procedure (commit time synchronization -- CT) that each transaction must undergo before its updates to the database take effect.
The meaning of ET synchronization is that the order in which READ and WRITE operations arrive is important and that the synchronization algorithm must take that order into account. In a 2PL algorithm this order is determined by the flags transaction hold and by maintaining a queue of waiting transactions for flagged data items.
The meaning of CT synchronization is that the arrival order of READ and WRITE operations is unimportant. Thus, the CT synchronization algorithm need
only collect and maintain information about each transaction's conflicts at execution time to enable it to discover inconsistencies at commit time.
Using these two characterization parameters we can obtain five synchronization techniques for each of the two types of synchronization. For example, we may use certification synchronization at transaction execution time or transaction commit time for either the rw or ww synchronizations.
We use the following notation to represent the possible techniques. Each technique's name will be composed of three components: synchronization strategy (2PL or CERT), synchronization time (ET or CT), and synchronization type (rw or ww). For example, CERT-CT-ww is a technique that uses the certification approach to achieve synchronization at transaction commit time. Figure 3 summarizes all eight possible techniques. In Section 4.3 we give brief descriptions of the actions taken by five of the techniques, where the others are of no interest. Before describing the techniques we introduce, in the next section, the notion of a transaction's WaitFor Set.
4.2. The WaitFor Set of a Transaction
From a correctness point of view a transaction that is waiting for a flag need not wait for all active transactions that hold conflicting flags to terminate. For example, if $T_i$ using 2PL synchronization requests an $r$-flag on $X$ and $T_j$ also using 2PL holds a $p$-flag on $X$ then clearly $T_i$ should wait for $T_j$ and this should be reflected by an edge in SG from $T_j$ to $T_i$. If, however, $T_k$ which uses a certification synchronization strategy holds a $p$-flag on $X$, from a correctness point of view we may choose to have $T_i$ wait for $T_k$ or not do so. Either way would be correct (provided the synchronization phase operates correctly). This decision is a policy decision and for that reason we chose not to make it at this
Rather, we allow the implementor to define a *waitfor set* of transactions in terms of the concurrency level desired.
Definition 1, below, formalizes this notion.
**Definition 1:** The *WaitFor Set* of a transaction \( T_i \) for \( rw \) (ww) synchronization, \( \text{WFS}_{rw}(ww)(T_i) \), is the set of transactions that \( T_i \) must wait for in its \( rw \) (ww) waiting phase.
The *Minimal WaitFor Set* of a transaction \( T_i \) for \( rw \) (ww) synchronization, \( \text{MWFS}_{rw}(ww)(T_i) \), consists of only those transactions for which \( T_i \) must wait to ensure correctness of \( rw \) (ww) synchronization.
We say that transaction \( T_i \) is using *strict 2PL policy* for \( rw(ww) \) synchronization when \( \text{WFS}_{rw}(ww)(T_i) = T \).
We say that transaction \( T_i \) is using *standard 2PL policy* for \( rw(ww) \) synchronization when \( \text{WFS}_{rw}(ww)(T_i) = \{ T_j \mid T_j \text{ is using 2PL for } rw(ww) \text{ synchronization} \} \).
If the same synchronization policy applies to \( rw \) and \( ww \) synchronization type designation of the type will be omitted.
For transaction \( T_i \) using CERT synchronization strategy we define \( \text{MWFS}_{rw}(T_i) = \text{MWFS}_{ww}(T_i) = \emptyset \).
The *waitfor set* of a transaction \( T_i \) is implementation dependent and may be defined by means of synchronization techniques, transaction classes, the concurrency level desired, and even as a function of \( T_i \) waiting time on a given request or all its past requests.
### 4.3. The Synchronization Techniques
To facilitate the description of the various techniques below we utilize a compatibility-action matrix (c-a matrix). An entry in the matrix indicates how a synchronization technique interprets the values of existing flags on a data item when processing a request from a transaction to access that item. In addition, the entry specifies what edges are added to SG. The c-a matrices for all five techniques described below are shown in Figure 4.
#### 4.3.1. RW Synchronization Techniques
RW synchronization techniques synchronize between DM_READ and PRE_WRITE operations as well as DM_READ and DM_WRITE operations. In the
---
3 We were influenced to a great degree in this part of our design by Robinson's notion of separation of correctness and policy in concurrency control [ROB82].
following, if adding an edge to SG causes a cycle in the graph the transaction that caused the cycle is aborted, all its flags released and all information about it removed from SG.
4.3.1.1. 2PL-ET-rw
Assume $T_i$ is using 2PL-ET-rw and let $T_j$ be an active transaction in $\text{WFS}_{rw}(T_i)$. The c-a matrix in Figure 4 for 2PL-ET-rw applies to the waiting phase. During its waiting phase $T_i$'s request can not proceed to the synchronization phase as long as $T_j$ owns a conflicting flag. The c-a matrix for CERT-ET-rw describes the actions taken in the synchronization phase.
4.3.1.2. CERT-ET-rw
Assume $T_i$ is using CERT-ET-rw and let $T_j$ hold a flag on data item $X$. $T_i$'s waiting phase is null. During its synchronization phase, $T_i$ resolves conflicts with $T_j$'s flags using c-a matrix for CERT-ET-rw.
4.3.1.3. CERT-CT-rw
In this technique synchronization is performed at commit time using a procedure similar to that used in [KUNG81]. All requests are granted. No edges are added to SG at execution time. At commit time edges are added to SG as shown in the c-a matrix for this technique. Note that during $T_i$'s commit phase if an edge, from an active reader, $T_j$ to $T_i$ is added to SG it is guaranteed that $T_j$ will be aborted during its commit phase (and as an optimization it may be aborted during $T_i$'s commit phase).
4.3.2. WW Synchronization Techniques
WW synchronization techniques synchronize between conflicting, PRE_WRITE operations of active transactions as well as PRE_WRITE operations of an active transaction and conflicting DM_WRITE operations of committed
transactions.
4.3.2.1. 2PL-ET-ww
The meaning of the c-a matrix entries in 2PL-ET-ww is as in the matrix for 2PL-ET-rw. Conflicts between two active transactions are synchronized in the waiting phase of a request whereas conflicts between an active and a committed transaction are synchronized during the request's synchronization phase.
4.3.2.2. CERT-CT-ww
In this technique synchronization is performed at commit time. All WRITE requests are allowed to run unhindered. The c-a matrix for this technique applies to the commit phase of the transaction. The committing transaction T_i follows all transactions committed earlier and indicates that active writers will follow it (synchronization with active writers is required only when they use the 2PL-ET-ww synchronization technique).
5. Integrated Concurrency Control Algorithms
In this section we give a formal definition of an ICCA. We also outline the proof method used in showing an ICCA to be correct. In the next section we give the theoretical basis and give an example of a proof of correctness.
**Definition 2:** An Integrated Concurrency Control Algorithm (ICCA) is a triple \((S_{rw}, S_{ww}, F)\), where
- \(S_{rw}\) is a non empty set of rw-synchronization techniques
- \(S_{ww}\) is a non empty set of ww-synchronization techniques, and
- \(F\) is a mapping function \(F: T \rightarrow S_{rw} \times S_{ww}\). At any given-instance each \(T_i\) in \(T\) is mapped to exactly one \(S_{rw}\) technique and one \(S_{ww}\) technique.
**Example 1:**
\[
\text{ICCA}_1 = \{ \{2PL-ET-rw, Cert-ET-rw\}, \{Cert-CT-ww\}\},
\]
\(F\) if \(T_i\) is a reader then
\(\text{Cert-ET-rw} \times \text{Cert-CT-ww}\)
else
An ICCA operates correctly if it allows only serializable execution orders and it avoids deadlock situations. How do we prove a given ICCA as correct? We need to show that each constraint placed on the total execution order by an operation is represented in SG regardless of the transactions involved, and more importantly, regardless of the synchronization technique used presently and/or techniques used to synchronize the conflicting transactions in the past. It will be shown subsequently that the five techniques introduced in the previous section indeed satisfy this condition.
6. Formalization
6.1. Serializability
Our model differs from those of others in our use of the PRE_WRITE operation to synchronize conflicting transactions. In particular, we saw that some of the techniques cause transactions to wait in the presence of a conflicting p-flag and others do not. In this section we review the basic serializability theory results, and show that our use of PRE_WRITE as a synchronization primitive does not affect known results. We also introduce several new precedence relations to be used in the proof of correctness of ICCAs.
Definition 3: Let \( T = \{T_1, T_2, ..., T_n\} \) be a set of transactions. E, the execution schedule of \( T \), is modeled by \( L^5 \), the synchronization log of \( T \), which consists of DM_READ, PRE_WRITE, and DM_WRITE operations in the order in which they were scheduled. L, the execution log of \( T \), is derived from \( L^5 \) by removing from it all PRE_WRITE operations.
In subsequent lemma and theorem statements we shall assume that \( T, E, L \), and \( L^5 \) as defined in Definition 3 are given. Furthermore, references to \( T_i \) and \( T_j \) are to any two transactions in \( T \). A DM_READ(X) operation by transaction \( T_i \) will
---
4 For the sake of brevity we eliminate the definitions of the various terms, such as computational equivalence.
be denoted by $r_i[X]$. Similarly, $p_i[X]$ and $w_i[X]$ will denote PRE_WRITE and DM_WRITE operations (respectively) on $X$ made by transaction $T_i$. Finally, $O_i[X] < O_j[X]$ means that $O_i[X]$ precedes $O_j[X]$ in $L^S$. Figure 1 illustrates the notions of the execution schedule, the synchronization log and the execution log.
**Definition 4:** $L^S$ is serializable if it is computationally equivalent to a serial synchronization log.
**Proposition 1:** $L^S$ and $L$ are computationally equivalent.
**Proof:** Both logs contain the same sequence of DM_READ and DM_WRITE operations. PRE_WRITE operations in $L^S$ do not change database state. Figure 2 illustrates the notion of serializable logs.
**Theorem 1:** $L^S$ is serializable iff $L$ is serializable.
**Proof:**
(a) First we show that if $L^S$ is serializable then $L$ is serializable.
(1) Since $L^S$ is serializable it is computationally equivalent to some serial synchronization log $L^F_1$.
(2) Let $L_1$ be the serial execution log derived from $L^F_1$ by deleting all PRE_WRITE operations from it. From proposition 1 it follows that $L^F_1$ is computationally equivalent to $L_1$.
Since $L$ is computationally equivalent to $L^S$ (proposition 1), it follows from (1) and (2) that $L$ is computationally equivalent to some serial execution log $L_1$.
(b) Next we show that if $L$ is serializable then $L^S$ is serializable.
(3) Since $L$ is serializable it is computationally equivalent to some serial execution log $L_1$.
(4) $L_1$ is computationally equivalent to a serial synchronization log $L^F_1$ derived from $L_1$, by augmenting each transaction $T_i$, before its first DM_WRITE operation, with a set of PRE_WRITE operations as follows: for every $w_i[X]$ in $L_1$ add a $p_i[X]$ operation to $L^F_1$.
Since $L^S$ is computationally equivalent to $L$ (proposition 1) it follows from (3) and (4) that $L^S$ is computationally equivalent to some serial synchronization log $L^F_1$.
Theorem 1 establishes that to obtain serializable synchronization logs it is sufficient to maintain serializable execution logs. That is, use of the PRE_WRITE operation as a synchronization primitive while maintaining serializable execution logs does not affect the basic theory.
Definition 5 sets the background for stating the Decomposition Theorem in our extended model.
**Definition 5:** For every pair of transactions \( T_i, T_j \) and a data item \( X \), define the binary relations \( \rightarrow_u \), where values for \( u \) are given below, as follows:
1. \( T_i \rightarrow_{rw} T_j \) if \( r_i[X] < w_j[X] \) in \( L^S \)
2. \( T_i \rightarrow_{wr} T_j \) if \( w_i[X] < r_j[X] \) in \( L^S \)
3. \( T_i \rightarrow_{ww} T_j \) if \( w_i[X] < w_j[X] \) in \( L^S \)
4. \( T_i \rightarrow_{rp} T_j \) if \( r_i[X] < p_j[X] \) in \( L^S \)
5. \( T_i \rightarrow_{pr} T_j \) if \( p_j[X] < r_i[X] < w_j[X] \) in \( L^S \)
6. \( T_i \rightarrow_{wp} T_j \) if \( w_i[X] < p_j[X] \) in \( L^S \)
7. \( T_i \rightarrow_{wp} T_j \) if \( p_j[X] < w_i[X] < w_j[X] \) in \( L^S \)
8. \( T_i \rightarrow_{pp} T_j \) if \( p_i[X] < p_j[X] \) and \( w_i[X] < w_j[X] \) in \( L^S \)
9. \( T_i \rightarrow_{rwr} T_j \) if \( T_i \rightarrow_{rw} T_j \) or \( T_i \rightarrow_{wr} T_j \)
10. \( T_i \rightarrow_{rpr} T_j \) if \( T_i \rightarrow_{rp} T_j \) or \( T_i \rightarrow_{pr} T_j \)
11. \( T_i \rightarrow_{pwp} T_j \) if \( T_i \rightarrow_{pw} T_j \) or \( T_i \rightarrow_{wp} T_j \)
12. \( T_i \rightarrow_{rwr} T_j \) if \( T_i \rightarrow_{rwr} T_j \) or \( T_i \rightarrow_{ww} T_j \)
13. \( T_i \rightarrow_{rwr} T_j \) if \( T_i \rightarrow_{rwr} T_j \) or \( T_i \rightarrow_{rpr} T_j \) and \( T_k \rightarrow_{rpr} T_j \)
The binary relations (1)-(3), (9),(12) and (13) are exactly those defined in [BERN81]. The remaining relations are new relations introduced in this paper based on our use of the PRE_WRITE as a synchronization primitive. Clearly all of these relations can be derived from \( L^S \).
**Theorem 2 (Decomposition):** Let \( \rightarrow_{rwr} \) and \( \rightarrow_{ww} \) be associated with an execution schedule \( E \) modeled by \( L^S \). \( E \) is serializable if
1. \( \rightarrow_{rwr} \) and \( \rightarrow_{ww} \) are acyclic, and
2. There is a total ordering of the transactions consistent with all \( \rightarrow_{rwr} \) and all \( \rightarrow_{ww} \) relationships.
**Proof:** (1) and (2) guarantee the serializability of the execution log [BERN81]. This fact and Theorem 1 guarantee also the serializability of \( L^S \).
Lemmas 1 and 2 will be used subsequently. They formally define an important fact, that by means of the PRE_WRITE operation we are able to foresee future conflicts in \( \rightarrow_{rwr} \) and \( \rightarrow_{ww} \) relations.
**Lemma 1.** \( \rightarrow_{rpr} \geq \rightarrow_{rw} \)
**Proof:** If \( T_i \rightarrow_{rw} T_j \), then by Definition 5 there exists a data item \( X \) such that \( r_i[X] < w_j[X] \) in \( L^S \).
In \( L^S \) each \( w_j[X] \) is preceded by \( p_j[X] \) i.e., \( p_j[X] < w_j[X] \).
Technion - Computer Science Department - Technical Report CS0317 - 1984
(1) if \( r_i[X] < p_j[X] < w_j[X] \) then \( T_i \rightarrow_{rp} T_j \)
(2) if \( p_j[X] < r_i[X] < w_j[X] \) then \( T_i \rightarrow_{pr} T_j \)
from (1) and (2) it follows that if \( T_i \rightarrow_{rw} T_j \) then \( T_i \rightarrow_{rpr} T_j \)
**Corollary 1:** \( \rightarrow_{rpr} \cup \rightarrow_{wr} \supset \rightarrow_{rw} \)
**Lemma 2:** \( \rightarrow_{pwp} \supset \rightarrow_{ww} \)
**Proof:** If \( T_i \rightarrow_{ww} T_j \) then by Definition 5 there exists a data item \( X \) such that \( w_i[X] < w_j[X] \) in \( L^S \).
In \( L^S \) each \( w_j[X] \) is preceded by \( p_j[X] \) i.e., \( p_j[X] < w_j[X] \).
(1) if \( w_i[X] < p_j[X] < w_j[X] \) then \( T_i \rightarrow_{wp} T_j \)
(2) if \( p_j[X] < w_i[X] < w_j[X] \) then \( T_i \rightarrow_{pw} T_j \)
from (1) and (2) it follows that if \( T_i \rightarrow_{ww} T_j \) then \( T_i \rightarrow_{pwp} T_j \)
### 6.3. Formalization of the Techniques
The following lemma characterizes the correspondence between the relations defined above and edges in \( SG \).
**Lemma 3:** The relations \( \rightarrow_{rp}, \rightarrow_{pr}, \rightarrow_{rw}, \rightarrow_{wr}, \rightarrow_{pw}, \rightarrow_{wp}, \rightarrow_{ww} \) and \( \rightarrow_{ww} \) derived from \( L^S \) and \( SG \) maintained by the synchronization techniques satisfy the following conditions:
(1) If \( T_i \) is using 2PL-ET-rw then:
(a) if \( T_j \rightarrow_{wr} T_i \) then \( (T_j, T_i) \) is an edge in \( SG \).
(b) if \( T_j \rightarrow_{rp} T_i \) then \( (T_j, T_i) \) is an edge in \( SG \).
(c) if \( T_j \) in \( WFS_{rw}(T_i) \) then \( T_i \rightarrow_{pr} T_j \) is not in \( \rightarrow_{pr} \).
(d) if \( T_j \) not in \( WFS_{rw}(T_i) \) then \( T_i \rightarrow_{pr} T_j \) then \( (T_j, T_i) \) is an edge in \( SG \).
(2) If \( T_i \) is using CERT-ET-rw then:
(a) if \( T_j \rightarrow_{pr} T_i \) then \( (T_i, T_j) \) is an edge in \( SG \).
(b) if \( T_j \rightarrow_{rp} T_i \) then \( (T_i, T_j) \) is an edge in \( SG \).
(c) if \( T_j \rightarrow_{wr} T_i \) then \( (T_i, T_j) \) is an edge in \( SG \).
(3) If \( T_i \) is using 2PL-ET-ww then:
(a) if \( T_j \rightarrow_{wp} T_i \) then \( (T_i, T_j) \) is an edge in \( SG \).
(b) if \( T_j \) in \( WFS_{ww}(T_i) \) and \( T_j \) in \( WFS_{ww}(T_j) \) then \( T_i \rightarrow_{pw} T_j \) is not in \( \rightarrow_{pw} \).
(4) If \( T_i \) is using CERT-CT-rw then:
(a) if \( T_j \rightarrow_{rw} T_i \) then \( T_i \rightarrow_{rj} T_j \) is an edge in \( SG \).
(b) if \( T_j \rightarrow_{wr} T_i \) then \( T_j \rightarrow_{rj} T_i \) is an edge in \( SG \).
(5) If $T_i$ is using CERT-CT-ww then:
(a) if $T_j \rightarrow_{ww} T_i$ then $(T_j, T_i)$ is an edge in SG.
(b) if $T_i \rightarrow_{pw} T_j$ then $(T_i, T_j)$ is an edge in SG.
Proof: Follows immediately from the definition of the synchronization techniques with their corresponding c-a matrices.
### 6.3. Showing ICCAs Correct
**Definition 6:** An ICCA = $(S_{rw}, S_{ww}, F)$ is correct, if for every mapping of $F$ the following conditions hold.
1. Serializable synchronization logs are attained, and
2. No deadlock results
To illustrate the proof method introduced in the previous section consider the following ICCAs below:
$$ICCA_2 = \{ \{ 2PL-ET-rw, CERT-ET-rw \}, \{ 2PL-ET-ww, CERT-CT-ww \}, F_2 \}$$
$$ICCA_3 = \{ \{ CERT-CT-rw \}, \{ 2PL-ET-ww, CERT-CT-ww \}, F_3 \}$$
The importance of $ICCA_2$ stems from the fact that it can model a transaction system of varying concurrency level, *from strict 2PL policy to full certification.*
$ICCA_3$ with $F_3 \rightarrow CERT-CT-rw \times CERT-CT-ww$ is just another form of Kung & Robinson algorithm [KUNG81]. We next prove the correctness of $ICCA_2$. Since the proof covers all possible combinations of mappings to the synchronization techniques, any ICCA that employs a subset of the techniques used in $ICCA_2$ is also shown to be correct.
**Lemma 4:** Let $L$ be the synchronization log for an execution using $ICCA_2$. If $T_j \rightarrow T_i$ then $(T_j, T_i)$ is an edge in SG.
Proof:
(a) First we show that if $T_j \rightarrow_{rwr} T_i$ then $(T_j, T_i)$ is an edge in SG.
$F_2$ may map $T_i$ and $T_j$ to $2PL-ET-rw$ and $CERT-ET-rw$ in 4 ways:
1. Let $F_2: T_i \rightarrow 2PL-ET-rw, T_j \rightarrow 2PL-ET-rw$
By Lemma 3.1.a if $T_j \rightarrow_{wr} T_i$ then $(T_j, T_i)$ is an edge in SG.
By Lemma 3.1.b if \( T_j \rightarrow_{rp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.1, substituting \( T_j \) for \( T_i \) and \( T_i \) for \( T_j \) we have:
If \( T_i \) in \( WFS_{rw}(T_j) \) then by Lemma 3:1.c \( T_j \rightarrow_{pr} T_i \) is not possible, hence
we can write if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
If \( T_i \) not in \( WFS_{rw}(T_j) \) then by Lemma 3.1.d if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
(2) Let \( F_2: T_i \rightarrow 2PL-ET-rw, T_j \rightarrow CERT-ET-rw \)
By Lemma 3.1.a if \( T_j \rightarrow_{wr} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.1.b if \( T_j \rightarrow_{rp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.2.a substituting \( T_j \) for \( T_i \) and \( T_i \) for \( T_j \) we get if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
(3) Let \( F_2: T_i \rightarrow CERT-ET-rw, T_j \rightarrow 2PL-ET-rw \)
By Lemma 3.2.c if \( T_j \rightarrow_{wr} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.2.b if \( T_j \rightarrow_{rp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.1, substituting \( T_j \) for \( T_i \) and \( T_i \) for \( T_j \) we have:
if \( T_i \) in \( WFS_{rw}(T_j) \) then by Lemma 3.1.c \( T_j \rightarrow_{pr} T_i \) is not possible, hence
we can write if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
If \( T_i \) not in \( WFS_{rw}(T_j) \) then by Lemma 3.1.d if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
(4) Let \( F_2: T_i \rightarrow CERT-ET-rw, T_j \rightarrow CERT-ET-rw \)
By Lemma 3.3.a if \( T_j \rightarrow_{ww} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.3.b if \( T_j \rightarrow_{ww} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.2.a substituting \( T_j \) for \( T_i \) and \( T_i \) for \( T_j \) we get if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
In all possible mappings of \( T_i \) and \( T_j \) by \( F_2 \) we have that if \( T_j \rightarrow_{rpr} T_i \) or \( T_j \rightarrow_{wr} T_i \) then \((T_j, T_i)\) is an edge in SG. By Corollary 1 we conclude (**).
(b) Next we show that if \( T_j \rightarrow_{ww} T_i \) then \((T_j, T_i)\) is an edge in SG (**).
\( F_2 \) may map \( T_i \) and \( T_j \) to \( 2PL-ET-rw \) and \( CERT-CT-ww \) in 4 ways:
(5) Let \( F_2: T_i \rightarrow 2PL-ET-ww, T_j \rightarrow CERT-ET-ww \)
By Lemma 3.4.a if \( T_j \rightarrow_{wp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.4.b if \( T_j \rightarrow_{rp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.5.a if \( T_j \rightarrow_{pw} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.5.b substituting \( T_j \) for \( T_i \) and \( T_i \) for \( T_j \) we get if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
(6) Let \( F_2: T_i \rightarrow CERT-CT-ww, T_j \rightarrow 2PL-ET-ww \)
By Lemma 3.4.a if \( T_j \rightarrow_{wp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.5.b substituting \( T_j \) for \( T_i \) and \( T_i \) for \( T_j \) we get if \( T_j \rightarrow_{pr} T_i \) then \((T_j, T_i)\) is an edge in SG.
(7) Let \( F_2: T_i \rightarrow CERT-CT-ww, T_j \rightarrow CERT-CT-ww \)
By Lemma 3.4.a if \( T_j \rightarrow_{wp} T_i \) then \((T_j, T_i)\) is an edge in SG.
By Lemma 3.5.a if \( T_j \rightarrow_{ww} T_i \) then \((T_j, T_i)\) is an edge in SG.
In all possible mappings of \( T_i \) and \( T_j \) by \( F_2 \) we have that if \( T_j \rightarrow_{pr} T_i \) or \( T_j \rightarrow_{ww} T_i \) then \((T_j, T_i)\) is an edge in SG. By Lemma 2 we conclude (**).
From (a) and (b) we have if \( T_j \rightarrow_{rwr} T_i \) or \( T_j \rightarrow_{ww} T_i \) then \((T_j, T_i)\) is an edge
in SG.
Theorem 3: ICCA₂ is correct.
Proof: Let E be Execution using ICCA₂ and modeled by L₅. Let -> be derived from L₅.
(1) By Lemma 4 if Tᵢ -> Tᵢ then (Tᵢ, Tᵢ) is an edge in SG. Since SG is maintained acyclic at all time it follows that -> is acyclic. By the fact that -> is acyclic and Theorem 1 we conclude that E is serializable.
(2) Whenever Tᵢ waits for Tᵢ upon rw or ww conflict an edge (Tᵢ, Tᵢ) is added to SG. Since SG is maintained acyclic at all time deadlock is prevented. Furthermore, since we know that Tᵢ will follow Tᵢ in any execution schedule, (i) guarantees overall consistency.
Lemma 5: Let L₅ be the synchronization log for an execution using ICCA₃. If Tᵢ -> Tᵢ then (Tᵢ, Tᵢ) is an edge in SG.
Proof:
(a) First we show that if Tᵢ -> Tᵢ then (Tᵢ, Tᵢ) is an edge in SG. (*)
(b) Next by argument (b) of Lemma 4 we have: if Tᵢ -> Tᵢ then (Tᵢ, Tᵢ) is an edge in SG. (**) From (a) and (b) we have if Tᵢ -> Tᵢ or Tᵢ -> Tᵢ then (Tᵢ, Tᵢ) is an edge in SG.
Theorem 4: ICCA₃ is correct.
Proof: Follows by arguments (i) and (2) of Theorem 3 using Lemma 5.
6.4. Minimal WaitFor Set for a transaction using ICCA₂.
Lemma 6: For Tᵢ using 2PL-ET-rw, MWFS_rw(Tᵢ) = ∅.
Proof: When WFS_rw(Tᵢ) = ∅, Tᵢ's waiting phase becomes empty and Tᵢ certifies, in its synchronization phase, all conflicting transaction using the CERT-ET-rw c-a matrix.
This means that Tᵢ is using CERT-ET-rw synchronization technique. The correctness of ICCA₂ establishes the fact that the separate or concurrent use of 2PL-ET-rw and CERT-ET- rw is correct.
Lemma 7: For Tᵢ using 2PL-ET-ww, MWFS_ww(Tᵢ) = { Tⱼ | Tⱼ is using 2PL-ET-ww }.
Proof: Let Tᵢ and Tⱼ use 2PL-ET-ww. Then the minimal wait for set defined above guarantees' condition 3.b of Lemma 3. This condition states that if Tᵢ's PRE.WRITE operation conflicts with Tⱼ's previous PRE.WRITE operation then Tᵢ will not precede Tⱼ in ->_pww
This condition is mandatory for correct computation of ->_ww relation - using Lemma 2. We give a counter example in which, the minimality condition is violated and as a consequence a non serializable synchronization log is created.
Let $T = \{T_i, T_j\}$ be defined as follows:
- $T_i$: TRANS READ(Z); WRITE(Z); WRITE(X); SNART
- $T_j$: TRANS READ(X); WRITE(X); WRITE(Y), SNART
and use ICCA$_2$ with the following mapping:
- $F_2: T_i \rightarrow$ CERT-ET-rw X 2PL-ET-ww with WFS$_{ww} = \emptyset$
- $T_j \rightarrow$ CERT-ET-rw X 2PL-ET-ww with WFS$_{ww} = \{T_1\}$
Round robin execution of $T$ will create the following non serializable log.
7. Practical Considerations
There are several implementation issues that require addressing such as: efficient implementation of atomic commits, implementation of the private workspaces by the TM, management of SG and FT, management of the wait queue associated with a data item, etc. In this section we look at two of these issues which are related to efficient implementation of an ICCA: management of SG & FT and the wait queues. Discussion of the other issues is beyond the scope of this paper.
7.1. Management of SG and FT
Let $T$ be a set of transaction using some correct ICCA. SG and FT can not grow infinitely. An SG node, of a committed transaction $T_i$, may be deleted only when it becomes a root node, i.e., it has no incoming edges. In this case there is no transaction $T_j$ such that $T_j \rightarrow T_i$ since all conflicts in $\rightarrow$ are resolved through SG and $T_i$ cannot participate in a cycle in $\rightarrow$. At that point in time $T_i$'s flags (r-flags and c-flags) may be removed from FT.
**Lemma 8:** If $T_i$ is an SG root node of a committed transaction $T_i$, then $T_i$ may be deleted from SG with its corresponding FT flags without affecting database consistency.
The condition that only root nodes may be removed from SG, may cause that SG will contain, nodes or chain of nodes, of committed transaction which can not yet be removed. The process of removing those nodes is a recursive one, as the following example shows:
Let us look at Figure 5. Suppose that $T_{11}$ is a root node of an active transaction. When $T_{11}$ commits we are able to remove node $T_{11}$. As a result $T_{22}$ becomes a root node, and since $T_{22}$ has already committed it can be also removed. Later, when $T_{10}$ commits and becomes a root node we will be able to remove recursively nodes $T_{21}$ and $T_{31}$.
Algorithm 1 implements the procedure discussed above.
**Algorithm 1:** Removal of a committed transaction node from SG.
**Input:** SG and a committed transaction node $T_i$ to be removed.
**Output:** Possible removal, from SG, of $T_i$ and other root nodes of committed transactions accessible from $T_i$.
**Method:**
1. Define the following sets of nodes in SG:
$\text{FOLLOWING}(T_i) = \{ T_j \mid (T_i, T_j) \text{ is an edge in SG} \}$
$\text{PRECEDING}(T_i) = \{ T_j \mid (T_j, T_i) \text{ is an edge in SG} \}$
2. Execute the following recursive procedure:
```
procedure DeleteTransaction(T_i)
{
if $T_i$ committed and $\text{PRECEDING}(T_i) = \emptyset$
{
for each $T_j$ in $\text{FOLLOWING}(T_i)$
{
Remove edge $(T_i, T_j)$
DeleteTransaction($T_j$)
}
Remove $T_i$ from SG
Remove $T_i$'s FT flags
}
}
```
7.2. Management of WAIT QUEUE for a data item
The management of WAIT QUEUE for a data item is an implementation policy decision which does not affect basic correctness of an ICCA. ICCA correctness is based on synchronization with actual executed requests, thus FIFO, PRIORITY or any other queue management policy are acceptable.
Let $T_i$ be a transaction to be added to the wait queue for some data item $X$. In case FIFO policy we synchronize $T_i$ with the other transactions on the queue immediately upon inserting $T_i$ at the end of the queue (by adding to SG edges $(T_j,T_i)$ for each $T_j$ on the queue). In this policy the order of transaction arrival is maintained. The policy is suitable for a transaction system using strict 2PL policy. However, in general, transactions may have different WFSs and may pass each other in the queue. This can be achieved by reorganizing the queue periodically; possibly upon arrival of a new request or upon removal of a flag held on $X$ from FT. In any case, the order of transactions in the wait queue must be CONSISTENT with the order of $\rightarrow$, or else unnecessary transaction restarts may occur.
For example
Let $T=\{T_1, T_2, T_3\}$ be defined as follows:
$T_1$: TRANS READ(X); WRITE(X); WRITE(Y); SNART
$T_2$: TRANS READ(Y); WRITE(Y); WRITE(W); SNART
$T_3$: TRANS READ(Z); READ(X); WRITE(Y); SNART
and use ICCA with the following mapping and standard 2PL policy:
$F_2:T_1 \rightarrow \text{2PL-ET-rw} \times \text{2PL-ET-ww}$
$T_2 \rightarrow \text{2PL-ET-rw} \times \text{2PL-ET-ww}$
$T_3 \rightarrow \text{CERT-ET-rw} \times \text{2PL-ET-ww}$
Round Robin execution of T, after T₃ executing WRITE(Y) will create the following LS and SG:
$$SG = \{(T₃,T₁),(T₂,T₁),(T₂,T₃)\}$$
where T₁ and T₃ are waiting for T₂.
If the FIFO policy is used for wait queue management then T₃ will follow T₁ in the wait queue for Y, and will be aborted when the edge (T₁,T₃) is added to SG.
However, if T₃ precedes T₁ in the wait queue for Y as dictates, execution of T will complete successfully with no aborts.
**Algorithm 2**: FIFO type QUEUE management consistent with $\rightarrow$.
**Input**: Transaction Tᵢ and a queue of transactions $\cdot Q$.
**Output**: Q augmented by Tᵢ such that for every Tⱼ in Q, if Tᵢ $\rightarrow\rightarrow$ Tⱼ then Tᵢ precedes Tⱼ in Q.
**Method**: Execute procedure AddTransactionToQ.
```plaintext
procedure AddTransactionToQ(Tᵢ)
Tᵢ <- Start transaction on Q
while Tⱼ is defined
if Tᵢ $\rightarrow\rightarrow$ Tⱼ
insert Tᵢ before Tⱼ
stop
else Tⱼ <- Next transaction on Q;
add Tᵢ to end of Q
```
**Lemma 2**: Algorithm 2 guarantees that for every pair of transactions Tᵢ,Tⱼ on Q, if Tᵢ $\rightarrow\rightarrow$ Tⱼ then Tᵢ precedes Tⱼ on Q.
**Proof**: Trivial if we note that $\rightarrow$ is maintained acyclic at all times.
B. Conclusions
B.1. Summary of Contributions
In this paper we introduced the notion of an Integrated Concurrency Control Algorithm. An ICCA consists of several rw and several ww synchronization techniques and has the capability of using any number of them concurrently. We presented some examples of ICCAs that employ 2PL and Certification based synchronization techniques along with proofs of their correctness.
The dynamic nature of the algorithm, which allows both the use of several techniques concurrently, and transition from one technique to another for a given transaction, requires a single representation of each transaction's conflict history sufficient for each technique to make correct decisions. We use PRE_WRITEs in addition to the conventional use of DM_READs and DM_WRITEs to collect this information.
Conflicts involving PRE_WRITEs essentially foresee possible conflicts between DM_READs and DM_WRITEs. The different techniques interpret and use this information in a different manner.
We use a single directed graph to represent all the precedence relations between transactions, including those that arise from the waiting forced by 2PL.
To enable a smooth transition from locking to non-locking methods we introduced the two phases of request processing (waiting and synchronization).
Finally, the notion of a transaction's wait for set was introduced as a means for ensuring correctness and as a means for controlling the concurrency level in the system.
8.2. Related Work
The primary influences on our work have been the concurrency control algorithm of Bayer et. al. [BAYE80] in which 2PL and a certification strategy were combined into a single algorithm; Bernstein and Goodman's work -- in particular their use of the decomposition theorem to derive several distributed algorithms that utilize 2PL and timestamps [BERN81], Wilkinson's centralized algorithm for a local network in which certification and locking were also combined [WILK81], and, Robinson's notion of separating policy from correctness in the design of concurrency control algorithms [ROBI82].
To the best of our knowledge only Robinson [ROBI82] has proposed a mechanism that is similar to ours. However in his proposal the concurrency control mechanism is based on serializability in validation order which simplifies the algorithm at the expense of unnecessary transaction restarts.
8.3. Present Work
Some additional theoretical work remains in characterizing the power of the model. However, at the moment we are engaged in the construction of a simulation model. In the short run we wish to arrive at a comparison of our algorithm with more conventional algorithms using an abstract measure such as effective level of concurrency. In the long run we are interested in deriving more useful measures such as effect of the algorithm on system throughput and transaction response time.
9. References
$T_1$: TRANS READ(X);WRITE(Y);WRITE(Z); SNART
$T_2$: TRANS;READ(Z);WRITE(Y); SNART
\[ T_1 \quad \quad T_2 \]
\[ \text{TRANS } T_1 \quad \quad \text{TRANS } T_2 \]
\[ \text{READ(X)} \quad \quad \text{READ(Z)} \]
\[ \text{WRITE(Y)} \quad \quad \text{WRITE(Y)} \]
\[ \text{WRITE(Z)} \quad \quad \text{SNART} \]
$L = r_1 [X] r_2 [Z] w_2 [Y] w_1 [Y] w_1 [Z]$
Figure 1: The Execution Schedule modeled by its Synchronization and Execution logs.
$L = r_1 [X] r_2 [Z] w_2 [Y] w_1 [Y] w_1 [Z]$
$L_1 = r_2 [Z] w_2 [Y] r_1 [X] w_1 [Y] w_1 [Z]$
1. $L$ is the execution log of $L^S$
2. $L_1$ is a serial execution log computationally equivalent to $L$.
3. $L_f^S$ is a serial synchronization log computationally equivalent to $L_1$
4. From (1)-(3) it follows that $L$ and $L^S$ are serializable.
Figure 2. Serializable Logs
SrW Synchronization Technique
Srw Synchronization Technique
2PL-ET-rw 2PL-ET-ww
2PL-CT-rw 2PL-CT-ww
CERT-ET-rw CERT-ET-ww
CERT-CT-rw CERT-CT-ww
Figure 3: The Synchronization Techniques.
<table>
<thead>
<tr>
<th>2PL-ET-rw</th>
<th>Tj in WFSrw(Ti)</th>
</tr>
</thead>
<tbody>
<tr>
<td>r</td>
<td>p</td>
</tr>
<tr>
<td>Ti</td>
<td>r</td>
</tr>
<tr>
<td>p</td>
<td>Tj --> Ti</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>CERT-ET-rw</th>
<th>Tj</th>
<th>p</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<td>r</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Ti</td>
<td></td>
<td>Ti --> Tj</td>
<td>Tj --> Ti</td>
</tr>
<tr>
<td>p</td>
<td>+</td>
<td>Tj --> Ti</td>
<td>*</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>CERT-CT-rw</th>
<th>Tj</th>
<th>p</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<td>r</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Ti</td>
<td></td>
<td>Tj --> Ti</td>
<td>+</td>
</tr>
<tr>
<td>c</td>
<td>Tj --> Ti</td>
<td>*</td>
<td>*</td>
</tr>
</tbody>
</table>
LEGEND
+ request granted.
- request not granted on conflicts with active transactions
* irrelevant
Ti --> Tj add to SG edge (Ti,Tj)
Tj --> Ti add to SG edge (Tj,Ti)
Figure 4: Compatibility-Action Matrices for the Synchronization Techniques
Figure 5. Typical cut of SG
|
{"Source-Url": "http://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/1984/CS/CS0317.pdf", "len_cl100k_base": 14650, "olmocr-version": "0.1.53", "pdf-total-pages": 33, "total-fallback-pages": 0, "total-input-tokens": 74450, "total-output-tokens": 17086, "length": "2e13", "weborganizer": {"__label__adult": 0.0003247261047363281, "__label__art_design": 0.0002830028533935547, "__label__crime_law": 0.00039315223693847656, "__label__education_jobs": 0.0008268356323242188, "__label__entertainment": 7.212162017822266e-05, "__label__fashion_beauty": 0.00015652179718017578, "__label__finance_business": 0.0006017684936523438, "__label__food_dining": 0.0003368854522705078, "__label__games": 0.0008344650268554688, "__label__hardware": 0.0016956329345703125, "__label__health": 0.0005993843078613281, "__label__history": 0.00033664703369140625, "__label__home_hobbies": 0.0001271963119506836, "__label__industrial": 0.0005817413330078125, "__label__literature": 0.00027942657470703125, "__label__politics": 0.00030994415283203125, "__label__religion": 0.000469207763671875, "__label__science_tech": 0.095458984375, "__label__social_life": 8.368492126464844e-05, "__label__software": 0.01409912109375, "__label__software_dev": 0.880859375, "__label__sports_fitness": 0.00028395652770996094, "__label__transportation": 0.0006575584411621094, "__label__travel": 0.0002015829086303711}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 57431, 0.02079]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 57431, 0.40089]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 57431, 0.86821]], "google_gemma-3-12b-it_contains_pii": [[0, 200, false], [200, 454, null], [454, 1485, null], [1485, 3457, null], [3457, 5393, null], [5393, 7354, null], [7354, 9060, null], [9060, 11749, null], [11749, 13722, null], [13722, 15671, null], [15671, 17546, null], [17546, 19473, null], [19473, 21359, null], [21359, 23719, null], [23719, 25333, null], [25333, 27011, null], [27011, 28936, null], [28936, 31189, null], [31189, 34090, null], [34090, 36730, null], [36730, 38509, null], [38509, 42312, null], [42312, 44420, null], [44420, 46123, null], [46123, 47668, null], [47668, 49280, null], [49280, 50547, null], [50547, 52032, null], [52032, 53437, null], [53437, 55386, null], [55386, 56428, null], [56428, 57404, null], [57404, 57431, null]], "google_gemma-3-12b-it_is_public_document": [[0, 200, true], [200, 454, null], [454, 1485, null], [1485, 3457, null], [3457, 5393, null], [5393, 7354, null], [7354, 9060, null], [9060, 11749, null], [11749, 13722, null], [13722, 15671, null], [15671, 17546, null], [17546, 19473, null], [19473, 21359, null], [21359, 23719, null], [23719, 25333, null], [25333, 27011, null], [27011, 28936, null], [28936, 31189, null], [31189, 34090, null], [34090, 36730, null], [36730, 38509, null], [38509, 42312, null], [42312, 44420, null], [44420, 46123, null], [46123, 47668, null], [47668, 49280, null], [49280, 50547, null], [50547, 52032, null], [52032, 53437, null], [53437, 55386, null], [55386, 56428, null], [56428, 57404, null], [57404, 57431, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 57431, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 57431, null]], "pdf_page_numbers": [[0, 200, 1], [200, 454, 2], [454, 1485, 3], [1485, 3457, 4], [3457, 5393, 5], [5393, 7354, 6], [7354, 9060, 7], [9060, 11749, 8], [11749, 13722, 9], [13722, 15671, 10], [15671, 17546, 11], [17546, 19473, 12], [19473, 21359, 13], [21359, 23719, 14], [23719, 25333, 15], [25333, 27011, 16], [27011, 28936, 17], [28936, 31189, 18], [31189, 34090, 19], [34090, 36730, 20], [36730, 38509, 21], [38509, 42312, 22], [42312, 44420, 23], [44420, 46123, 24], [46123, 47668, 25], [47668, 49280, 26], [49280, 50547, 27], [50547, 52032, 28], [52032, 53437, 29], [53437, 55386, 30], [55386, 56428, 31], [56428, 57404, 32], [57404, 57431, 33]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 57431, 0.03333]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
f56b0ff70dd2ceb7510906304011201ac44a7134
|
12TH COMPUTER SCIENCE
Lesson Wise One Mark
Unit I Problem Solving Techniques
CHAPTER 1 FUNCTION
Choose the best answer:
1. The small sections of code that are used to perform a particular task is called
a. Subroutines b. Files c. Pseudo code d. Modules
2. Which of the following is a unit of code that is often defined within a greater code structure?
a. Subroutines b. Function c. Files d. Modules
3. Which of the following is a distinct syntactic block?
a. Subroutines b. Function c. Definition d. Modules
4. The variables in a function definition are called as
a. Subroutines b. Function c. Definition d. Parameters
5. The values which are passed to a function definition are called
a. Arguments b. Subroutines c. Function d. Definition
6. Which of the following are mandatory to write the type annotations in the function definition?
a. Curly braces b. Parentheses c. Square brackets d. indentations
7. Which of the following defines what an object can do?
a. Operating System b. Compiler c. Interface d. Interpreter
8. Which of the following carries out the instructions defined in the interface?
a. Operating System b. Compiler c. Implementation d. Interpreter
9. The functions which will give exact result when same arguments are passed are called
a. Impure functions b. Partial Functions c. Dynamic Functions d. Pure functions
10. The functions which cause side effects to the arguments passed are called
(A) impure function (B) Partial Functions (C) Dynamic Functions (D) Pure functions
Unit I Problem Solving Techniques
CHAPTER 2 DATA ABSTRACTION
Choose the best answer:
1. Which of the following functions that build the abstract data type?
a. Constructors b. Destructors c. recursive d. Nested
2. Which of the following functions that retrieve information from the data type?
a. Constructors b. Selectors c. recursive d. Nested
3. The data structure which is a mutable ordered sequence of elements is called
a. Built in b. List c. Tuple d. Derived data
4. A sequence of immutable objects is called
a. Built in b. List c. Tuple d. Derived data
5. The data type whose representation is known are called
a. Built in datatype b. Derived datatype c. Concrete datatype d. Abstract datatype
6. The data type whose representation is unknown are called
a. Built in datatype b. Derived datatype c. Concrete datatype d. Abstract datatype
7. Which of the following is a compound structure?
a. Pair b. Triplet c. single d. quadrat
12TH COMPUTER SCIENCE
8. Bundling two values together into one can be considered as
a. Pair b. Triplet c. single d. quadrat
9. Which of the following allow to name the various parts of a multi-item object?
a. Tuples b. Lists c. Classes d. quadrats
10. Which of the following is constructed by placing expressions within square brackets?
a. Tuples b. Lists c. Classes d. quadrats
Unit I Problem Solving Techniques
CHAPTER 3 SCOPING
Choose the best answer:-
1. Which of the following refers to the visibility of variables in one part of a program to
another part of the same program.
(A) Scope (B) Memory (C) Address (D) Accessibility
2. The process of binding a variable name with an object is called
(A) Scope (B) Mapping (C) late binding (D) early binding
3. Which of the following is used in programming languages to map the variable and
object?
(A) :: (B) := (C) = (D) ==
4. Containers for mapping names of variables to objects is called
(A) Scope (B) Mapping (C) Binding (D) Namespaces
5. Which scope refers to variables defined in current function?
(A) Local Scope (B) Global scope (C) Module scope (D) Function Scope
6. The process of subdividing a computer program into separate sub-programs is called
(A) Procedural Programming (B) Modular programming
(C) Event Driven Programming (D) Object oriented Programming
7. Which of the following security technique that regulates who can use resources in a
computing environment?
(A) Password (B) Authentication (C) Access control (D) Certification
8. Which of the following members of a class can be handled only from within the
class?
(A) Public members (B) Protected members
(C) Secured members (D) Private members
9. Which members are accessible from outside the class?
(A) Public members (B) Protected members
(C) Secured members (D) Private members
10. The members that are accessible from within the class and are also available to its
sub-classes is called
(A) Public members (B) Protected members
(C) Secured members (D) Private members
Unit I Problem Solving Techniques
CHAPTER 4 ALGORITHMIC STRATEGIES
Choose the best answer:-
1. The word comes from the name of a Persian mathematician Abu Ja'far Mohammed
ibn-i Musa al Khowarizmi is called?
(A) Flowchart (B) Flow (C) Algorithm (D) Syntax
2. From the following sorting algorithms which algorithm needs the minimum number
of swaps?
(A) Bubble sort (B) Quick sort (C) Merge sort (D) Selection sort
12TH COMPUTER SCIENCE
3. Two main measures for the efficiency of an algorithm are
(A) Processor and memory (B) Complexity and capacity
(C) Time and space (D) Data and space
4. The complexity of linear search algorithm is
(A) O(n) (B) O(log n) (C) O(n2) (D) O(n log n)
5. From the following sorting algorithms which has the lowest worst case complexity?
(A) Bubble sort (B) Quick sort (C) Merge sort (D) Selection sort
6. Which of the following is not a stable sorting algorithm?
(A) Insertion sort (B) Selection sort (C) Bubble sort (D) Merge sort
7. Time complexity of bubble sort in best case is
(A) θ (n) (B) θ (nlogn) (C) θ (n2) (D) θ (n(logn) 2)
8. The Θ notation in asymptotic evaluation represents
(A) Base case (B) Average case (C) Worst case (D) NULL case
9. If a problem can be broken into subproblems which are reused several times, the problem possesses which property?
(A) Overlapping subproblems (B) Optimal substructure
(C) Memoization (D) Greedy
10. In dynamic programming, the technique of storing the previously calculated values
is called ?
(A) Saving value property (B) Storing value property
(C) Memoization (D) Mapping
Unit II Core Python
CHAPTER 5 PYTHON - VARIABLES AND OPERATORS
Choose the best answer:-
1. Who developed Python ?
A) Ritche B) Guido Van Rossum
C) Bill Gates D) Sunder Pitchai
2. The Python prompt indicates that Interpreter is ready to accept instruction.
A) >>> B) <<< C) # D) <<
3. Which of the following shortcut is used to create new Python Program ?
A) Ctrl + C B) Ctrl + F C) Ctrl + B D) Ctrl + N
4. Which of the following character is used to give comments in Python Program ?
A) # B) & C) @ D) $
5. This symbol is used to print more than one item on a single line.
A) Semicolon(;) B) Dollar($) C) comma(,) D) Colon(:)
6. Which of the following is not a token ?
A) Interpreter B) Identifiers C) Keyword D) Operators
7. Which of the following is not a Keyword in Python ?
A) break B) while C) continue D) operators
8. Which operator is also called as Comparative operator?
A) Arithmetic B) Relational C) Logical D) Assignment
9. Which of the following is not Logical operator?
A) and B) or C) not D) Assignment
10. Which operator is also called as Conditional operator?
A) Ternary B) Relational C) Logical D) Assignment
CHAPTER 6 CONTROL STRUCTURES
Choose the best answer:-
1. How many important control structures are there in Python?
A) 3 B) 4 C) 5 D) 6
2. elif can be considered to be abbreviation of
A) nested if B) if..else C) else if D) if..elif
3. What plays a vital role in Python programming?
A) Statements B) Control C) Structure D) Indentation
4. Which statement is generally used as a placeholder?
A) continue B) break C) pass D) goto
5. The condition in the if statement should be in the form of
A) Arithmetic or Relational expression B) Arithmetic or Logical expression
C) Relational or Logical expression D) Arithmetic
6. Which is the most comfortable loop?
A) do..while B) while C) for D) if..elif
7. What is the output of the following snippet?
i=1
while True:
if i%3 == 0:
break
print(i,end="")
i += 1
A) 12 B) 123 C) 1234 D) 124
8. What is the output of the following snippet?
T=1
while T:
print(True)
break
A) False B) True C) 0 D) no output
9. Which amongst this is not a jump statement?
A) for B) goto C) continue D) break
10. Which punctuation should be used in the blank?
if <condition>
statements-block 1
else:
statements-block 2
A) ; B) : C) :: D) !
Unit II Core Python
CHAPTER 7 PYTHON FUNCTIONS
Choose the best answer:-
1. A named blocks of code that are designed to do one specific job is called as
(a) Loop (b) Branching (c) Function (d) Block
2. A Function which calls itself is called as
(a) Built-in (b) Recursion (c) Lambda (d) return
3. Which function is called anonymous un-named function
(a) Lambda (b) Recursion (c) Function (d) define
12TH COMPUTER SCIENCE
4. Which of the following keyword is used to begin the function block?
(a) define (b) for (c) finally (d) def
5. Which of the following keyword is used to exit a function block?
(a) define (b) return (c) finally (d) def
6. While defining a function which of the following symbol is used.
(a) ; (semicolon) (b) . (dot) (c) : (colon) (d) $ (dollar)
7. In which arguments the correct positional order is passed to a function?
(a) Required (b) Keyword (c) Default (d) Variable-length
8. Which of the following formatting character is used to print exponential notation in
(a) %e (b) %E (c) %g (d) %n
9. While defining a function which of the following symbol is used.
(a) ; (semicolon) (b) . (dot) (c) : (colon) (d) $ (dollar)
10. Which of the following keyword is used to define the function testpython():?
(a) define (b) pass (c) def (d) while
Unit II Core Python
CHAPTER 8 STRINGS AND STRING MANIPULATION
Choose the best answer:-
1. Which of the following is the output of the following python code?
str1="TamilNadu"
print(str1[::-1])
(a) Tamilnadu (b) Tmlau (c) udanlimaT (d) udaNlimaT
2. What will be the output of the following code?
str1 = "Chennai Schools"
str1[7] = "."
(a) Chennai-Schools (b) Chenna-School (c) Type error (D) Chennai
3. Which of the following operator is used for concatenation?
(a) + (b) & (c) * (d) =
4. Defining strings within triple quotes allows creating:
(a) Single line Strings (b) Multiline Strings
(c) Double line Strings (d) Multiple Strings
5. Strings in python:
(a) Changeable (b) Mutable (c) Immutable (d) flexible
6. Which of the following is the slicing operator?
(a) { } (b) [ ] (c) < > (d) ( )
7. What is stride?
(a) index value of slide operation (b) first argument of slice operation
(c) second argument of slice operation (d) third argument of slice operation
8. Which of the following formatting character is used to print exponential notation in
upper case? (a) %e (b) %E (c) %g (d) %n
9. Which of the following is used as placeholders or replacement fields which get
replaced along with format( ) function?
(a) { } (b) < > (c) ++ (d) ^^
1. Pick odd one in connection with collection data type
(a) List (b) Tuple (c) Dictionary (d) Loop
2. Let list1=[2,4,6,8,10], then print(list1[-2]) will result in
(a) 10 (b) 8 (c) 4 (d) 6
3. Which of the following function is used to count the number of elements in a list?
(a) count() (b) find() (c) len() (d) index()
4. If list1=[10,20,30,40,50] then list1[2]=35 will result
(a) [35,10,20,30,40,50] (b) [10,20,30,40,50,35]
(c) [10,20,35,40,50] (d) [10,35,30,40,50]
5. If list1=[17,23,41,10] then list1.append(32) will result
(a) [32,17,23,41,10] (b) [17,23,41,10,32]
(c) [10,17,23,32,41] (d) [41,32,23,17,10]
6. Which of the following Python function can be used to add more than one element
within an existing list?
(a) append() (b) append_more() (c) extend() (d) more()
7. What will be the result of the following Python code?
S=[x**2 for x in range(5)]
print(S)
(a) [0,1,2,4,5] (b) [0,1,4,9,16] (c) [0,1,4,9,16,25] (d) [1,4,9,16,25]
8. What is the use of type() function in python?
(a) To create a Tuple (b) To know the type of an element in tuple.
(c) To know the data type of python object. (d) To create a list.
9. Which of the following statement is not correct?
(a) A list is mutable (b) A tuple is immutable.
(c) The append() function is used to add an element.
(d) The extend() function is used in tuple to add elements in a list.
10. Let setA={3,6,9}, setB={1,3,9}. What will be the result of the following snippet?
print(setA | setB)
(a) {3,6,9,1,3,9} (b) {3,9} (c) {1} (d) {1,3,6,9}
11. Which of the following set operation includes all the elements that are in two sets
but not the one that are common to two sets?
(a) Symmetric difference (b) Difference (c) Intersection (d) Union
12. The keys in Python, dictionary is specified by
(a) = (b) ; (c) + (d) :
Choose the best answer:-
Unit III Modularity and Oop's
CHAPTER 10 PYTHON CLASSES AND OBJECTS
Choose the best answer:-
1. Which of the following are the key features of an Object Oriented Programming language?
(a) Constructor and Classes (b) Constructor and Object
(c) Classes and Objects (d) Constructor and Destructor
2. Functions defined inside a class:
(a) Functions (b) Module (c) Methods (d) section
12TH COMPUTER SCIENCE
3. Class members are accessed through which operator?
(a) & (b) . (c) # (d) %
4. Which of the following method is automatically executed when an object is created?
(a) __object__( ) (b) __del__( ) (c) __func__( ) (d) __init__( )
5. A private class variable is prefixed with
(a) _ (b) & (c) # (d) **
6. Which of the following method is used as destructor?
(a) __init__( ) (b) __dest__ (c) __rem__ (d) __del__( )
7. Which of the following class declaration is correct?
(a) class class_name
(b) class class_name<>
(c) class class_name: (d) class class_name[ ]
8. Which of the following is the output of the following program?
```python
class Student:
def __init__(self, name):
self.name=name
S=Student("Tamil")
```
(a) Error (b) Tamil (c) name (d) self
9. Which of the following is the private class variable?
(a) __num (b) #num (c) $num (d) &&num
10. The process of creating an object is called as:
(a) Constructor (b) Destructor (c) Initialize (d) Instantiation
Unit IV Database Concepts and MySql
CHAPTER 11 DATABASE CONCEPTS
Choose the best answer:-
1. What is the acronym of DBMS?
a) DataBase Management Symbol (b) Database Managing System
c) DataBase Management System (d) DataBasic Management System
2. A table is known as
a) tuple (b) attribute (c) relation (d) entity
3. Which database model represents parent-child relationship?
a) Relational (b) Network (c) Hierarchical (d) Object
4. Relational database model was first proposed by
a) E F Codd (b) E E Codd (c) E F Cadd (d) E F Codder
5. What type of relationship does hierarchical model represents?
a) one-to-one (b) one-to-many (c) many-to-one (d) many-to-many
6. Who is called Father of Relational Database from the following?
a) Chris Date (b) Hugh Darween (c) Edgar Frank Codd (d) Edgar Frank Cadd
7. Which of the following is an RDBMS?
a) Dbase (b) Foxpro (c) Microsoft Access (d) SQLite
8. What symbol is used for SELECT statement?
a) σ (b) Π (c) X (d) Ω
9. A tuple is also known as
a) table (b) row (c) attribute (d) field
10. Who developed ER model?
a) Chen (b) EF Codd (c) Chend (d) Chand
12TH COMPUTER SCIENCE
Unit IV Modularity and OOps
CHAPTER 12 STRUCTURED QUERY LANGUAGE
Choose the best answer:-
1. Which commands provide definitions for creating table structure, deleting relations, and modifying relation schemas.
a. DDL b. DML c. DCL d. DQL
2. Which command lets to change the structure of the table?
a. SELECT b. ORDER BY c. MODIFY d. ALTER
3. The command to delete a table is
A) DROP B) DELETE C) DELETE ALL D) ALTER TABLE
4. Queries can be generated using
a. SELECT b. ORDER BY c. MODIFY d. ALTER
5. The clause used to sort data in a database
a. SORT BY b. ORDER BY c. GROUP BY d. SELECT
Unit IV
CHAPTER 13 PYTHON AND CSV FILES
Choose the best answer:-
1. A CSV file is also known as a ....
(A) Flat File (B) 3D File (C) String File (D) Random File
2. The expansion of CRLF is
(A) Control Return and Line Feed (B) Carriage Return and Form Feed
(C) Control Router and Line Feed (D) Carriage Return and Line Feed
3. Which of the following module is provided by Python to do several operations on the CSV files?
(A) py (B) xls (C) csv (D) os
4. Which of the following mode is used when dealing with non-text files like image or exe files?
(A) Text mode (B) Binary mode (C) xls mode (D) csv mode
5. The command used to skip a row in a CSV file is
(A) next() (B) skip() (C) omit() (D) bounce()
6. Which of the following is a string used to terminate lines produced by writer()method of csv module?
(A) Line Terminator (B) Enter key
(C) Form feed (D) Data Terminator
7. What is the output of the following program?
import csv
d=csv.reader(open('c:\PYPRG\ch13\city.csv'))
next(d)
for row in d:
print(row)
if the file called “city.csv” contain the following details chennai,mylapore umbai,andheri
A) chennai,mylapore (B) mumbai,andheri
(C) chennai (D) chennai,mylalore
mumba mumbai,andheri
8. Which of the following creates an object which maps data to a dictionary?
(A) listreader() (B) reader() (C) tuplereader() (D) DicReader()
9. Making some changes in the data of the existing file or adding more data is called
(A) Editing (B) Appending (C) Modification (D) Alteration
10. What will be written inside the file test.csv using the following program
```python
import csv
D = [['Exam'],['Quarterly'],['Halfyearly']]
csv.register_dialect('M',lineterminator = '
')
with open('c:\pyprg\ch13\line2.csv', 'w') as f:
wr = csv.writer(f,dialect='M')
wr.writerows(D)
f.close()
```
(A) Exam Quarterly Halfyearly (B) Exam Quarterly Halfyearly
(C) E (D) Exam, Quarterly, Halfyearly
**Choose the best answer:-**
1. Which of the following is not a scripting language?
(A) JavaScript (B) PHP (C) Perl (D) HTML
2. Importing C++ program in a Python program is called
(A) wrapping (B) Downloading (C) Interconnecting (D) Parsing
3. The expansion of API is
(A) Application Programming Interpreter (B) Application Programming Interface
(C) Application Performing Interface (D) Application Programming Interlink
4. A framework for interfacing Python and C++ is
(A) Ctypes (B) SWIG (C) Cython (D) Boost
5. Which of the following is a software design technique to split your code into separate parts?
(A) Object oriented Programming (B) Modular programming
(C) Low Level Programming (D) Procedure oriented Programming
6. The module which allows you to interface with the Windows operating system is
(A) OS module (B) sys module (C) csv module (D) getopt module
7. getopt() will return an empty array if there is no error in splitting strings to
(A) argv variable (B) opt variable (C) args variable (D) ifile variable
8. Identify the function call statement in the following snippet.
```python
if __name__ == '__main__':
main(sys.argv[1:])
```
(A) main(sys.argv[1:]) (B) __name__ (C) __main__ (D) argv
9. Which of the following can be used for processing text, numbers, images, and scientific data?
(A) HTML (B) C (C) C++ (D) PYTHON
10. What does __name__ contains?
(A) c++ filename (B) main() name (C) python filename (D) os module name
12TH COMPUTER SCIENCE
Unit V
CHAPTER 15 DATA MANIPULATION THROUGH SQL
Choose the best answer:-
1. Which of the following is an organized collection of data?
(A) Database (B) DBMS (C) Information (D) Records
2. SQLite falls under which database system?
(A) Flat file database system (B) Relational Database system
(C) Hierarchical database system (D) Object oriented Database system
3. Which of the following is a control structure used to traverse and fetch the records of
the database?
(A) Pointer (B) Key (C) Cursor (D) Insertion point
4. Any changes made in the values of the record should be saved by the command
(A) Save (B) Save As (C) Commit (D) Oblige
5. Which of the following executes the SQL command to perform some action?
(A) Execute() (B) Key() (C) Cursor() (D) run()
6. Which of the following function retrieves the average of a selected column of rows in
a table?
(A) Add() (B) SUM() (C) AVG() (D) AVERAGE()
7. The function that returns the largest value of the selected column is
(A) MAX() (B) LARGE() (C) HIGH() (D) MAXIMUM()
8. Which of the following is called the master table?
(A) sqlite_master (B) sql_master (C) main_master (D) master_main
9. The most commonly used statement in SQL is
(A) cursor (B) select (C) execute (D) commit
10. Which of the following clause avoid the duplicate?
(A) Distinct (B) Remove (C) Where (D) GroupBy
Unit V
CHAPTER 16 DATA VISUALIZATION USING PYPLOT: LINE CHART, PIE
CHART AND BAR CHART
Choose the best answer:-
1. Which is a python package used for 2D graphics?
a. matplotlib.pyplot b. matplotlib.pip
c. matplotlib.numpy d. matplotlib.plt
2. Identify the package manager for Python packages, or modules.
a. Matplotlib b. PIP c. plt.show() d. python package
3. Read the following code: Identify the purpose of this code and choose the right option
from the following.
C:\Users\YourName\AppData\Local\Programs\Python\Python36-32\Scripts>pip –
version
a. Check if PIP is Installed b. Install PIP
c. Download a Package d. Check PIP version
4. Read the following code: Identify the purpose of this code and choose the right option
from the following.
C:\Users\Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>pip
list
a. List installed packages b. list command
To install matplotlib, the following function will be typed in your command prompt.
5. To install matplotlib, the following function will be typed in your command prompt. What does “-U” represents?
Python –m pip install –U pip
a. downloading pip to the latest version
b. upgrading pip to the latest version
c. removing pip
d. upgrading matplotlib to the latest version
6. Observe the output figure. Identify the coding for obtaining this output.
a. import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()
b. import matplotlib.pyplot as plt
plt.plot([1,2],[4,5])
plt.show()
c. import matplotlib.pyplot as plt
plt.plot([2,3],[5,1])
plt.show()
d. import matplotlib.pyplot as plt
plt.plot([1,3],[4,1])
plt.show()
7. Read the code:
a. import matplotlib.pyplot as plt
b. plt.plot(3,2)
c. plt.show()
8. Which key is used to run the module?
a. F6
b. F4
c. F3
d. F5
9. Identify the right type of chart using the following hints.
Hint 1: This chart is often used to visualize a trend in data over intervals of time.
Hint 2: The line in this type of chart is often drawn chronologically.
a. Line chart
b. Bar chart
c. Pie chart
d. Scatter plot
10. Read the statements given below. Identify the right option from the following for pie chart.
Statement A: To make a pie chart with Matplotlib, we can use the plt.pie() function.
Statement B: The autopct parameter allows us to display the percentage value using the Python string formatting.
a. Statement A is correct
b. Statement B is correct
c. Both the statements are correct
d. Both the statements are wrong
Answer the following questions (2 Marks)
1. What is a subroutine?
2. Define Function with respect to Programming language.
3. Write the inference you get from X:=(78).
4. Differentiate interface and implementation.
5. Which of the following is a normal function definition and which is recursive function definition
i) let rec sum x y:
return x + y
ii) let disp :
print 'welcome'
iii) let rec sum num:
if (num!=0) then return num + sum (num-1)
else
return num
Unit I Problem Solving Techniques
CHAPTER 2 DATA ABSTRACTION
Part - II
Answer the following questions (2 Marks)
1. What is abstract data type?
2. Differentiate constructors and selectors.
3. What is a Pair? Give an example.
4. What is a List? Give an example.
5. What is a Tuple? Give an example.
Unit I Problem Solving Techniques
CHAPTER 3 SCOPING
Part - II
Answer the following questions (2 Marks)
1. What is a scope?
2. Why scope should be used for variable. State the reason.
3. What is Mapping?
4. What do you mean by Namespaces?
5. How Python represents the private and protected Access specifiers?
12TH COMPUTER SCIENCE
Unit I Problem Solving Techniques
CHAPTER 4 ALGORITHMIC STRATEGIES
Part - II
Answer the following questions (2 Marks)
1. What is an Algorithm?
2. Define Pseudo code.
3. Who is an Algorit?
4. What is Sorting?
5. What is searching? Write its types.
Unit II Core Python
CHAPTER 5 PYTHON - VARIABLES AND OPERATORS
Part - II
Answer the following questions : (2 Marks)
1. What are the different modes that can be used to test Python Program?
2. Write short notes on Tokens.
3. What are the different operators that can be used in Python?
4. What is a literal? Explain the types of literals?
5. Write short notes on Exponent data?
Unit II Core Python
CHAPTER 6 CONTROL STRUCTURES
Part - II
Answer the following questions 2 Marks
1. List the control structures in Python.
2. Write note on break statement.
3. Write is the syntax of if..else statement
4. Define control structure.
5. Write note on range () in loop
Unit II Core Python
CHAPTER 7 PYTHON FUNCTIONS
Part - II
Answer the following questions: (2 Marks)
1. What is function?
2. Write the different types of function.
3. What are the main advantages of function?
4. What is meant by scope of variable? Mention its types.
5. Define global scope.
6. What is base condition in recursive function
7. How to set the limit for recursive function? Give an example.
Unit II Core Python
CHAPTER 8 STRINGS AND STRING MANIPULATION
Part - II
Answer the following questions (2 Marks)
1. What is String?
2. Do you modify a string in Python?
3. How will you delete a string in Python?
4. What will be the output of the following python code?
```python
def print_str1(str1):
str1 = “School”
print(str1*3)
return str1
str1 = “A”
print_str1(str1)
```
5. What is slicing?
12TH COMPUTER SCIENCE
Unit III Modularity and Oops
CHAPTER 9 LISTS, TUPLES, SETS AND DICTIONARY
Part - II
Answer the following questions (2 Marks)
1. What is List in Python?
2. How will you access the list elements in reverse order?
3. What will be the value of x in following python code?
```python
List1=[2,4,6,1,3,5]
x=len(List1)
```
4. Differentiate del with remove( ) function of List.
5. Write the syntax of creating a Tuple with n number of elements.
6. What is set in Python?
Unit III Modularity and Oops
CHAPTER 10 PYTHON CLASSES AND OBJECTS
Part - II
Answer the following questions (2 Marks)
1. What is class?
2. What is instantiation?
3. What is the output of the following program?
```python
class Sample:
__num=10
def disp(self):
print(self.__num)
S=Sample()
S.disp()
```
4. How will you create constructor in Python?
5. What is the purpose of Destructor?
Unit IV Database Concepts and MySql
CHAPTER 11 DATABASE CONCEPTS
Part - B
Answer the following questions (2 Marks)
1. Mention few examples of a database.
2. List some examples of RDBMS.
3. What is data consistency?
4. What is the difference between Hierarchical and Network data model?
5. What is normalization?
Unit IV Modularity and Oops
CHAPTER 12 STRUCTURED QUERY LANGUAGE
Part - II
Answer the following questions (2 Marks)
1. Write a query that selects all students whose age is less than 18 in order wise.
2. Differentiate Unique and Primary Key constraint.
3. Write the difference between table constraint and column constraint?
4. Which component of SQL lets insert values in tables and which lets to create a table?
5. What is the difference between SQL and MySQL?
Unit IV
CHAPTER 13 PYTHON AND CSV FILES
Part - II
Answer the following questions (2 Marks)
1. What is CSV File?
2. Mention the two ways to read a CSV file using Python.
3. Mention the default modes of the File.
4. What is use of next() function?
5. How will you sort more than one column from a csv file? Give an example statement.
Unit V Integrating Python with MySQL and C++
CHAPTER 14 IMPORTING C++ PROGRAMS IN PYTHON
Part - II
Answer the following questions (2 Marks)
1. What is the theoretical difference between Scripting language and other programming language?
2. Differentiate compiler and interpreter.
3. Write the expansion of (i) SWIG (ii) MinGW
4. What is the use of modules?
5. What is the use of cd command. Give an example.
Unit V
CHAPTER 15 DATA MANIPULATION THROUGH SQL
Part - II
Answer the following questions (2 Marks)
1. Mention the users who uses the Database.
2. Which method is used to connect a database? Give an example.
3. What is the advantage of declaring a column as “INTEGER PRIMARY KEY”
4. Write the command to populate record in a table. Give an example.
5. Which method is used to fetch all rows from the database table?
Unit V
CHAPTER 16 DATA VISUALIZATION USING PYPLOT: LINE CHART, PIE CHART AND BAR CHART
Part - II
Answer the following questions (2 Marks)
1. Define: Data Visualization.
2. List the general types of data visualization.
3. List the types of Visualizations in Matplotlib.
4. How will you install Matplotlib?
5. Write the difference between the following functions: plt.plot([1,2,3,4]), plt.plot([1,2,3,4], [1,4,9,16]).
12TH COMPUTER SCIENCE
Lesson Wise Three Marks
Unit I Problem Solving Techniques
CHAPTER 1 FUNCTION
Part - III
Answer the following questions (3 Marks)
1. Mention the characteristics of Interface.
2. Why strlen is called pure function?
3. What is the side effect of impure function. Give example.
4. Differentiate pure and impure function.
5. What happens if you modify a variable outside the function? Give an example.
Unit I Problem Solving Techniques
CHAPTER 2 DATA ABSTRACTION
Part - III
Answer the following questions (3 Marks)
1. Differentiate Concrete data type and abstract datatype.
2. Which strategy is used for program designing? Define that Strategy.
3. Identify Which of the following are constructors and selectors?
(a) N1=number()
(b) acceptnum(n1)
(c) displaynum(n1)
(d) eval(a/b)
(e) x,y= makeslope (m), makeslope(n)
(f) display()
4. What are the different ways to access the elements of a list. Give example.
5. Identify Which of the following are List, Tuple and class?
(a) arr [1, 2, 34]
(b) arr (1, 2, 34)
(c) student [rno, name, mark]
(d) day= ('sun', 'mon', 'tue', 'wed')
(e) x= [2, 5, 6.5, [5, 6], 8.2]
(f) employee [eno, ename, esal, eaddress]
Unit I Problem Solving Techniques
CHAPTER 3 SCOPING
Part - III
Answer the following questions (3 Marks)
1. Define Local scope with an example.
2. Define Global scope with an example.
3. Define Enclosed scope with an example.
4. Why access control is required?
5. Identify the scope of the variables in the following pseudo code and write its output
color:= Red
mycolor():
b:=Blue
myfavcolor():
g:=Green
printcolor, b, g
myfavcolor()
printcolor, b
mycolor()
print color
12TH COMPUTER SCIENCE
Unit I Problem Solving Techniques
CHAPTER 4 ALGORITHMIC STRATEGIES
Part - III
Answer the following questions (3 Marks)
1. List the characteristics of an algorithm.
2. Discuss about Algorithmic complexity and its types.
3. What are the factors that influence time and space complexity.
4. Write a note on Asymptotic notation.
5. What do you understand by Dynamic programming?
Unit II Core Python
CHAPTER 5 PYTHON - VARIABLES AND OPERATORS
Part - III
Answer the following questions : (3 Marks)
1. Write short notes on Arithmetic operator with examples.
2. What are the assignment operators that can be used in Python?
3. Explain Ternary operator with examples.
4. Write short notes on Escape sequences with examples.
5. What are string literals? Explain.
Unit II Core Python
CHAPTER 6 CONTROL STRUCTURES
Part - III
Answer the following questions 3 Marks
1. Write a program to display
A
A B
A B C
A B C D
A B C D E
2. Write note on if..else structure.
3. Using if..else..elif statement write a suitable program to display largest of 3 numbers.
4. Write the syntax of while loop.
5. List the differences between break and continue statements.
Unit II Core Python
CHAPTER 7 PYTHON FUNCTIONS
Part - III
Answer the following questions: (3 Marks)
1. Write the rules of local variable.
2. Write the basic rules for global keyword in python.
3. What happens when we modify global variable inside the function?
4. Differentiate ceil() and floor() function?
5. Write a Python code to check whether a given year is leap year or not.
6. What is composition in functions?
7. How recursive function works?
8. What are the points to be noted while defining a function?
12TH COMPUTER SCIENCE
Unit II Core Python
CHAPTER 8 STRINGS AND STRING MANIPULATION
Part - III
Answer the following questions (3 Marks)
1. Write a Python program to display the given pattern
C O M P U T E R
C O M P U T E
C O M P U T
C O M P U
C O M P
C O M
C O
C
2. Write a short about the followings with suitable example:
(a) capitalize() (b) swapcase()
3. What will be the output of the given python program?
str1 = "welcome"
str2 = "to school"
str3=str1[:2]+str2[len(str2)-2:]
print(str3)
4. What is the use of format()? Give an example.
5. Write a note about count() function in python.
Unit III Modularity and Oops
CHAPTER 9 LISTS, TUPLES, SETS AND DICTIONARY
Part - III
Answer the following questions (3 Marks)
1. What are the advantages of Tuples over a list?
2. Write a short note about sort().
3. What will be the output of the following code?
list = [2**x for x in range(5)]
print(list)
4. Explain the difference between del and clear() in dictionary with an example.
5. List out the set operations supported by python.
6. What are the difference between List and Dictionary?
Unit III Modularity and Oops
CHAPTER 10 PYTHON CLASSES AND OBJECTS
Part - III
Answer the following questions (3 Marks)
1. What are class members? How do you define it?
2. Write a class with two private class variables and print the sum using a method.
3. Find the error in the following program to get the given output?
class Fruits:
def __init__(self, f1, f2):
self.f1=f1
self.f2=f2
def display(self):
print("Fruit 1 = %s, Fruit 2 = %s"%(self.f1, self.f2))
F = Fruits('Apple', 'Mango')
D. AGILAN M.Sc., M.Ed., M.Phil.
4. What is the output of the following program?
```python
def __init__(self, name):
self.__name = name
def display(self):
print("Good Morning ", self.__name)
obj=Greeting('Bindu Madhavan')
obj.display()
```
5. How do you define constructor and destructor in Python?
UNIT IV DATABASE CONCEPTS AND MYSQL
CHAPTER 11 DATABASE CONCEPTS Part - C
Answer the following questions (3 Marks)
1. What is the difference between Select and Project command?
2. What is the role of DBA?
3. Explain Cartesian Product with a suitable example.
4. Explain Object Model with example.
5. Write a note on different types of DBMS users.
UNIT IV MODULARITY AND OOPS
CHAPTER 12 STRUCTURED QUERY LANGUAGE Part - III
Answer the following questions (3 Marks)
1. What is a constraint? Write short note on Primary key constraint.
2. Write a SQL statement to modify the student table structure by adding a new field.
3. Write any three DDL commands.
4. Write the use of Save point command with an example.
5. Write a SQL statement using DISTINCT keyword.
UNIT IV PYTHON AND CSV FILES Part - III
Answer the following questions (3 Marks)
1. Write a note on open() function of python. What is the difference between the two methods?
2. Write a Python program to modify an existing file.
3. Write a Python program to read a CSV file with default delimiter comma (,).
4. What is the difference between the write mode and append mode.
5. What is the difference between reader() and DictReader() function?
UNIT V IMPORTING C++ PROGRAMS IN PYTHON Part - III
Answer the following questions (3 Marks)
1. Differentiate PYTHON and C++
2. What are the applications of scripting language?
3. What is MinGW? What is its use?
4. Identify the module ,operator, definition name for the following
```python
welcome.display()
F.display()
```
Output
Fruit 1 = Apple, Fruit 2 = Mango
5. What is sys.argv? What does it contain?
Unit V
CHAPTER 15 DATA MANIPULATION THROUGH SQL
Part - III
Answer the following questions (3 Marks)
1. What is SQLite? What is it advantage?
2. Mention the difference between fetchone() and fetchmany()
3. What is the use of Where Clause. Give a python statement Using the where clause.
4. Read the following details. Based on that write a python script to display department wise records
database name : organization.db
Table name : Employee
Columns in the table : Eno, EmpName, Esal, Dept
5. Read the following details. Based on that write a python script to display records in desending order of Eno
database name : organization.db
Table name : Employee
Columns in the table : Eno, EmpName, Esal, Dept
Unit V
CHAPTER 16 DATA VISUALIZATION USING PYPLOT: LINE CHART, PIE CHART AND BAR CHART
Part - III
Answer the following questions (3 Marks)
1. Draw the output for the following data visualization plot.
import matplotlib.pyplot as plt
plt.bar([1,3,5,7,9],[5,2,7,8,2], label="Example one")
plt.bar([2,4,6,8,10],[8,6,2,5,6], label="Example two", color='g')
plt.legend()
plt.xlabel('bar number')
plt.ylabel('bar height')
plt.title('Epic Graph \nAnother Line! Whoa!')
plt.show()
2. Write any three uses of data visualization.
3. Write the coding for the following:
a. To check if PIP is Installed in your PC.
b. To Check the version of PIP installed in your PC.
c. To list the packages in matplotlib.
4. Write the plot for the following pie chart output.
Lesson Wise Five Marks
Unit I Problem Solving Techniques
CHAPTER 1 FUNCTION
Part - IV
Answer the following questions (5Marks)
1. What are called Parameters and write a note on
(i) Parameter without Type (ii) Parameter with Type
2. Identify in the following program
let rec gcd a b :=
if b <> 0 then gcd b (a mod b) else return a
i) Name of the function
ii) Identify the statement which tells it is a recursive function
iii) Name of the argument variable
iv) Statement which invoke the function recursively
v) Statement which terminates the recursion
3. Explain with example Pure and impure functions.
4. Explain with an example interface and implementation.
Unit I Problem Solving Techniques
CHAPTER 2 DATA ABSTRACTION
Part - IV
Answer the following questions (5Marks)
1. How will you facilitate data abstraction. Explain it with suitable example
2. What is a List? Why List can be called as Pairs. Explain with suitable example
3. How will you access the multi-item. Explain with example.
Unit I Problem Solving Techniques
CHAPTER 3 SCOPING
Part - IV
Answer the following questions (5Marks)
1. Explain the types of scopes for variable or LEGB rule with example.
2. Write any Five Characteristics of Modules.
3. Write any five benefits in using modular programming.
Unit I Problem Solving Techniques
CHAPTER 4 ALGORITHMIC STRATEGIES
Part - IV
Answer the following questions (5 Marks)
1. Explain the characteristics of an algorithm.
2. Discuss about Linear search algorithm.
3. What is Binary search? Discuss with example.
4. Explain the Bubble sort algorithm with example.
5. Explain the concept of Dynamic programming with suitable example.
Unit II Core Python
CHAPTER 5 PYTHON - VARIABLES AND OPERATORS
Part - IV
Answer the following questions : (5 Marks)
1. Describe in detail the procedure Script mode programming.
2. Explain input() and print() functions with examples.
3. Discuss in detail about Tokens in Python
Unit II Core Python
CHAPTER 6 CONTROL STRUCTURES
Part - IV
Answer the following questions 5 Marks
1. Write a detail note on for loop
2. Write a detail note on if..else..elif statement with suitable example.
3. Write a program to display all 3 digit odd numbers.
4. Write a program to display multiplication table for a given number.
Unit II Core Python
CHAPTER 7 PYTHON FUNCTIONS
Part - IV
Answer the following questions: (5 Marks)
1. Explain the different types of function with an example.
2. Explain the scope of variables with an example.
3. Explain the following built-in functions.
(a) id()
(b) chr()
(c) round()
(d) type()
(e) pow()
4. Write a Python code to find the L.C.M. of two numbers.
5. Explain recursive function with an example.
Unit II Core Python
CHAPTER 8 STRINGS AND STRING MANIPULATION
Part - IV
Answer the following questions (5 Marks)
12TH COMPUTER SCIENCE
1. Explain about string operators in python with suitable example.
Unit III Modularity and OOps
CHAPTER 9 LISTS, TUPLES, SETS AND DICTIONARY
Part - IV
Answer the following questions (5 Marks)
1. What are the different ways to insert an element in a list. Explain with suitable example.
2. What is the purpose of range()? Explain with an example.
3. What is nested tuple? Explain with an example.
4. Explain the different set operations supported by python with suitable example.
Unit III Modularity and OOps
CHAPTER 10 PYTHON CLASSES AND OBJECTS
Part - IV
Answer the following questions (5 Marks)
1. Write a menu driven program to add or delete stationary items. You should use dictionary to store items and the brand.
Unit IV Database Concepts and MySql
CHAPTER 11 DATABASE CONCEPTS Part - D
Answer the following questions (5 Marks)
1. Explain the different types of data model.
2. Explain the different types of relationship mapping.
3. Differentiate DBMS and RDBMS.
4. Explain the different operators in Relational algebra with suitable examples.
5. Explain the characteristics of DBMS.
Unit IV Modularity and OOps
CHAPTER 12 STRUCTURED QUERY LANGUAGE
Part - IV
Answer the following questions (5 Marks)
1. Write the different types of constraints and their functions.
2. Consider the following employee table. Write SQL commands for the qtns.(i) to (v).
<table>
<thead>
<tr>
<th>EMP CODE</th>
<th>EMP NAME</th>
<th>DESIGN</th>
<th>PAY</th>
<th>ALLOWANCE</th>
</tr>
</thead>
<tbody>
<tr>
<td>S1001</td>
<td>Hariharan</td>
<td>Supervisor</td>
<td>29000</td>
<td>12000</td>
</tr>
<tr>
<td>P1002</td>
<td>Shaji</td>
<td>Operator</td>
<td>10000</td>
<td>5500</td>
</tr>
<tr>
<td>P1003</td>
<td>Prasad</td>
<td>Operator</td>
<td>12000</td>
<td>6500</td>
</tr>
<tr>
<td>C1004</td>
<td>Manjima</td>
<td>Clerk</td>
<td>8000</td>
<td>4500</td>
</tr>
<tr>
<td>M1005</td>
<td>Ratheesh</td>
<td>Mechanic</td>
<td>20000</td>
<td>7000</td>
</tr>
</tbody>
</table>
(i) To display the details of all employees in descending order of pay.
(ii) To display all employees whose allowance is between 5000 and 7000.
(iii) To remove the employees who are mechanic.
(iv) To add a new row.
(v) To display the details of all employees who are operators.
3. What are the components of SQL? Write the commands in each.
4. Construct the following SQL statements in the student table-
(i) SELECT statement using GROUP BY clause.
(ii) SELECT statement using ORDER BY clause.
5. Write a SQL statement to create a table for employee having any five fields and create a table constraint for the employee table.
Unit IV
CHAPTER 13 PYTHON AND CSV FILES
Part - IV
Answer the following questions (5 Marks)
1. Differentiate Excel file and CSV file.
2. Tabulate the different mode with its meaning.
3. Write the different methods to read a File in Python.
4. Write a Python program to write a CSV File with custom quotes.
5. Write the rules to be followed to format the data in a CSV file.
Unit V Integrating Python with MySql and C++
CHAPTER 14 IMPORTING C++ PROGRAMS IN PYTHON
Part - IV
Answer the following questions (5 Marks)
1 Write any 5 features of Python.
2. Explain each word of the following command.
Python <filename.py> -i <C++ filename without cpp extension>
3. What is the purpose of sys,os,getopt module in Python. Explain
4. Write the syntax for getopt() and explain its arguments and return values
5. Write a Python program to execute the following c++ coding
```cpp
#include <iostream>
using namespace std;
int main()
{
cout<<"WELCOME";
return(0);
}
```
The above C++ program is saved in a file welcome.cpp
Unit V
CHAPTER 15 DATA MANIPULATION THROUGH SQL
Part - IV
Answer the following questions (5 Marks)
1. Write in brief about SQLite and the steps used to use it.
2. Write the Python script to display all the records of the following table using fetchmany()
<table>
<thead>
<tr>
<th>Icode</th>
<th>ItemName</th>
<th>Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td>1003</td>
<td>Scanner</td>
<td>10500</td>
</tr>
<tr>
<td>1004</td>
<td>Speaker</td>
<td>3000</td>
</tr>
<tr>
<td>1005</td>
<td>Printer</td>
<td>8000</td>
</tr>
<tr>
<td>1008</td>
<td>Monitor</td>
<td>15000</td>
</tr>
<tr>
<td>1010</td>
<td>Mouse</td>
<td>700</td>
</tr>
</tbody>
</table>
3. hat is the use of HAVING clause. Give an example python script
4. Write a Python script to create a table called ITEM with following specification.
Add one record to the table.
Name of the database :- ABC
Name of the table: Item
Column name and specification:
- Icode: integer and act as primary key
- Item Name: Character with length 25
- Rate: Integer
Record to be added: 1008, Monitor, 15000
5. Consider the following table Supplier and item. Write a python script for (i) to (ii)
<table>
<thead>
<tr>
<th>Suppno</th>
<th>Name</th>
<th>City</th>
<th>Icode</th>
<th>SuppQty</th>
</tr>
</thead>
<tbody>
<tr>
<td>S001</td>
<td>Prasad</td>
<td>Delhi</td>
<td>1008</td>
<td>100</td>
</tr>
<tr>
<td>S002</td>
<td>Anu</td>
<td>Bangalore</td>
<td>1010</td>
<td>200</td>
</tr>
<tr>
<td>S003</td>
<td>Shahid</td>
<td>Bangalore</td>
<td>1008</td>
<td>175</td>
</tr>
<tr>
<td>S004</td>
<td>Akila</td>
<td>Hydrabad</td>
<td>1005</td>
<td>195</td>
</tr>
<tr>
<td>S005</td>
<td>Girish</td>
<td>Hydrabad</td>
<td>1003</td>
<td>25</td>
</tr>
<tr>
<td>S006</td>
<td>Shylaja</td>
<td>Chennai</td>
<td>1008</td>
<td>180</td>
</tr>
<tr>
<td>S007</td>
<td>Lavanya</td>
<td>Mumbai</td>
<td>1005</td>
<td>325</td>
</tr>
</tbody>
</table>
i) Display Name, City and Itemname of suppliers who do not reside in Delhi.
ii) Increment the SuppQty of Akila by 40
Unit V
CHAPTER 16 DATA VISUALIZATION USING PYPLOT: LINE CHART, PIE CHART AND BAR CHART
Part - IV
Answer the following questions (5 Marks)
1. Explain in detail the types of pyplots using Matplotlib.
2. Explain the various buttons in a matplotlib window.
3. Explain the purpose of the following functions:
a. plt.xlabel
b. plt.ylabel
c. plt.title
d. plt.legend()
e. plt.show()
|
{"Source-Url": "https://12thquestionpapersdownload.files.wordpress.com/2019/08/12th-computer-science-lesson-wise-1235-marks-study-materials-english-medium.pdf", "len_cl100k_base": 13286, "olmocr-version": "0.1.53", "pdf-total-pages": 25, "total-fallback-pages": 0, "total-input-tokens": 109517, "total-output-tokens": 14920, "length": "2e13", "weborganizer": {"__label__adult": 0.0008053779602050781, "__label__art_design": 0.001529693603515625, "__label__crime_law": 0.0012865066528320312, "__label__education_jobs": 0.427001953125, "__label__entertainment": 0.00032448768615722656, "__label__fashion_beauty": 0.0005159378051757812, "__label__finance_business": 0.001430511474609375, "__label__food_dining": 0.0010442733764648438, "__label__games": 0.0024242401123046875, "__label__hardware": 0.0026454925537109375, "__label__health": 0.0011749267578125, "__label__history": 0.0011816024780273438, "__label__home_hobbies": 0.0007066726684570312, "__label__industrial": 0.0013055801391601562, "__label__literature": 0.0013914108276367188, "__label__politics": 0.0012426376342773438, "__label__religion": 0.0012159347534179688, "__label__science_tech": 0.03643798828125, "__label__social_life": 0.0006346702575683594, "__label__software": 0.013885498046875, "__label__software_dev": 0.499267578125, "__label__sports_fitness": 0.0008521080017089844, "__label__transportation": 0.0012121200561523438, "__label__travel": 0.0004525184631347656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 47217, 0.02551]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 47217, 0.97719]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 47217, 0.78217]], "google_gemma-3-12b-it_contains_pii": [[0, 2536, false], [2536, 5089, null], [5089, 7681, null], [7681, 9427, null], [9427, 11621, null], [11621, 13920, null], [13920, 16107, null], [16107, 18295, null], [18295, 20300, null], [20300, 22677, null], [22677, 24287, null], [24287, 25400, null], [25400, 27161, null], [27161, 28815, null], [28815, 30503, null], [30503, 32219, null], [32219, 33924, null], [33924, 35613, null], [35613, 37469, null], [37469, 39026, null], [39026, 40266, null], [40266, 41869, null], [41869, 43999, null], [43999, 45989, null], [45989, 47217, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2536, true], [2536, 5089, null], [5089, 7681, null], [7681, 9427, null], [9427, 11621, null], [11621, 13920, null], [13920, 16107, null], [16107, 18295, null], [18295, 20300, null], [20300, 22677, null], [22677, 24287, null], [24287, 25400, null], [25400, 27161, null], [27161, 28815, null], [28815, 30503, null], [30503, 32219, null], [32219, 33924, null], [33924, 35613, null], [35613, 37469, null], [37469, 39026, null], [39026, 40266, null], [40266, 41869, null], [41869, 43999, null], [43999, 45989, null], [45989, 47217, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, true], [5000, 47217, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 47217, null]], "pdf_page_numbers": [[0, 2536, 1], [2536, 5089, 2], [5089, 7681, 3], [7681, 9427, 4], [9427, 11621, 5], [11621, 13920, 6], [13920, 16107, 7], [16107, 18295, 8], [18295, 20300, 9], [20300, 22677, 10], [22677, 24287, 11], [24287, 25400, 12], [25400, 27161, 13], [27161, 28815, 14], [28815, 30503, 15], [30503, 32219, 16], [32219, 33924, 17], [33924, 35613, 18], [35613, 37469, 19], [37469, 39026, 20], [39026, 40266, 21], [40266, 41869, 22], [41869, 43999, 23], [43999, 45989, 24], [45989, 47217, 25]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 47217, 0.02118]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
83e8c4c3df02467ee39eacb411b3e295a4b4a578
|
User Transparent Parallel Image Processing
Seinstra, F.J.
Citation for published version (APA):
Chapter 3
Parallelizable Patterns in Low Level Image Processing Algorithms*
"One gets to the heart of the matter by a series of experiences in the same pattern, but in different colors."
Robert Graves (1895 - 1985)
As discussed in the previous chapter, a multitude of software libraries for parallel low level image processing has been described in the literature [75, 80, 93, 108, 109, 112, 118, 153, 159]. An important design goal in much of this research is to provide operations that have optimal efficiency on a range of parallel machines. In general, this is achieved by hard-coding a number of different parallel implementations for each operation, one for each platform. Unfortunately, the creation of a parallel library in this manner has several major drawbacks. First, manually creating multiple parallel versions of the many operations commonly applied in image processing research is a laborious task. Second, obeying to requests for library extensions becomes even more troublesome than in the sequential case. Third, as new target platforms are made available at regular intervals, code maintenance becomes hard — if not impossible — on the long term. Finally, with each library expansion it becomes ever more difficult to incorporate a single elegant optimization strategy that can guarantee intra-operation efficiency as well as inter-operation efficiency. For these reasons we take a different approach.
*This chapter combines our papers published in Proceedings of the 15th International Parallel & Distributed Processing Symposium (IPDPS 2001) [141] and Parallel Computing [149].
In the design of our parallel library we strive to minimize the implementation effort, without compromising on the efficiency of execution. The first step in achieving this goal is recognizing that there is a limited number of ways in which the pixels in an image can be processed to produce meaningful results. Important in this respect is the classification of low level image processing operations made in Image Algebra [131]. Originating from this classification, the sequential Horus image processing library [84] (which serves as a basis for the core component of our software architecture, see Section 2.3.2) provides a small set of so-called algorithmic patterns. As will be explained in this chapter, the primary importance of the algorithmic patterns is that each serves as a template operation for a large set of image processing operations with comparable behavior. Also, the algorithmic patterns abstract from the actual datatype each operation is applied upon, to avoid a combinatorial explosion of code that deals with all possible kinds of image datatypes.
The next important step in achieving our goal is recognizing that, for parallel implementation of each algorithmic pattern, much of the related sequential code can be reused. To that end, for each sequential algorithmic pattern present in the Horus library we have defined a so-called parallelizable pattern. Such pattern constitutes the maximum amount of code of an algorithmic pattern that can be performed both sequentially and in parallel — in the latter case without having to communicate to obtain data residing on other processing units.
The final step in reaching our goal is to implement all parallel operations such that they are capable of adapting to the performance characteristics of a parallel machine at hand. As machine-specific performance characteristics should not be incorporated explicitly in any library implementation, an additional automatic code optimization phase is required to be performed at compile time or even at run time.
Hence, apart from giving a detailed overview of the design philosophy of our software library, this chapter primarily focuses on the following research issue: How to implement a parallel image processing library such that code redundancy is avoided as much as possible, and efficiency of execution on all target platforms is guaranteed. We present a solution to the problem in the form of a generic description of parallelizable patterns. Based on the description, we show how parallel versions of many commonly used image processing operations are obtained by concatenating high-level communication routines, basic memory operations, and operations that constitute a specialization of a parallelizable pattern. We demonstrate that, apart from being relatively simple to implement, a parallel library built in this manner is extensible, easily maintainable, and still high in performance.
It is important to stress that this chapter does not touch upon the important topic of inter-operation optimization, that is, optimization across library calls. Parallel operations that are implemented on the basis of parallelizable patterns may still perform many unnecessary communication steps when applied as part of a complete image processing application. As a result, efficiency of execution may not be optimal. As indicated in the previous chapter, our complete software architecture deals with this problem by applying domain-specific performance models in combination with an additional, integrated scheduling tool. These issues are all outside the scope of this chapter, however, and are discussed in extensive detail in Chapters 4, 5, and 6.
3.1 Algorithmic Patterns: The Horus Approach
This chapter is organized as follows. Section 3.1 gives an overview of the design philosophy of the sequential Horus library. Section 3.2 describes the manner in which parallelism is integrated in Horus. Section 3.3 discusses the programming paradigm adopted in all parallel implementations. Section 3.4 gives a generic description of parallelizable patterns, including a default parallelization strategy for image operations. To illustrate the use of parallelizable patterns, the implementation of two example operations is discussed in detail. Finally, conclusions are presented in Section 3.5.
3.1 Algorithmic Patterns: The Horus Approach
Whereas implementation of a single sequential image processing routine is often easy, creating a software library that is to contain an extensive set of such operations is notoriously hard. This is because image library users need operations that can be applied to a large number of (combinations of) different data structures, whose individual data elements in turn can be of many different types. More specifically: although two-dimensional image structures are most commonly used, the bulk of all library functionality also should be applicable to three- (or higher-) dimensional images, image regions, and other types of dense datafields (e.g., histograms). In addition, the type of each individual element in a data structure can be scalar (e.g., int, float, Boolean), complex, compound (e.g., a vector representing RGB color), and so forth.
Providing support for a combinatorial explosion of code that deals with all these data structures and types is by no means an easy task. Consequently, many existing sequential image processing libraries usually restrict support to a small set of datastructures, datatypes, and even operations [9, 45]. It is clear that such limitations have a negative effect on a library's popularity and expected lifespan.
To deal with these problems, the design and implementation of the Horus image processing library [83, 84, 85] is based on a generic programming approach. The Free On-line Dictionary of Computing [71] defines this approach as follows:
Generic programming is a technique that aims to make programs more adaptable by making them more general. Generic programs often embody non-traditional kinds of polymorphism; ordinary programs are obtained from them by suitably instantiating their parameters. In contrast with normal programs, the parameters of a generic program are often quite rich in structure. For example, they may be other programs, types or type constructors or even programming paradigms.
To be more specific: given X datatypes, Y containers (data structures), and Z algorithms as essential software library components, abstraction by way of generic programming reduces the possible $X \times Y \times Z$ implementations to $X + Y + Z$ implementations. Consequently, generic programming greatly enhances library maintainability.
In Horus, generic data structures (i.e., container structures that are made independent of the type of the contained object) are implemented by way of the C++ template mechanism [158] — a programming concept that allows a type to be a parameter in the definition of a class or a function. Using the same mechanism, Horus also provides
generic algorithms that can work on the generic data structures. Because we feel that the importance of the Horus library lies more in its concepts than in its implementation, we refrain from presenting actual template code here. For more information and implementation details we refer to the Horus documentation [84, 85].
Apart from abstracting from the actual datatype each operation is applied upon, the amount of Horus library code is reduced even further by implementing only a small number of algorithmic patterns that covers the bulk of all commonly applied image processing operations. An algorithmic pattern corresponds to one of the operation classes defined in Image Algebra [131], each of which gives a generic description of a large set of operations with comparable behavior. As such, each image operation that maps onto the functionality as provided by an algorithmic pattern is implemented in Horus by instantiating the algorithmic pattern with the proper parameters, including the function to be applied to the individual data elements. As an example, an algorithmic pattern may produce a result image by applying a unary function to each pixel in a given input image. By instantiating the pattern with, for example, the absolute value operation on a single pixel, the produced output will constitute the input image with the absolute value taken for each pixel.
The version of Horus that serves as the basis for all further discussions provides the following set of algorithmic patterns:
- **Unary pixel operation.** Operation in which a unary function is applied to each pixel in the image. Examples: negation, absolute value, square root.
- **Binary pixel operation.** Operation in which a binary function is applied to each pixel in the image. Examples: addition, multiplication, threshold.
- **Reduce operation.** Operation in which all pixels in the image are combined to obtain a single result value. Examples: sum, product, maximum.
- **Neighborhood operation.** Operation in which several pixels in the neighborhood of each pixel in the image are combined. Examples: percentile, median.
- **Generalized convolution.** Special case of neighborhood operation. The combination of pixels in the neighborhood of each pixel is expressed in terms of two binary functions. Examples: convolution, gauss, dilation.
- **Geometric (domain) operation.** Operation in which the image’s domain is transformed. Examples: translation, rotation, scaling.
The presented set of algorithmic patterns is not complete, as it does not cover all functionality required in the early stages of algorithm or application development. The Horus library, however, is subject to continuing research and extensions. Among the most important current and expected future library additions are algorithmic patterns that can be used to instantiate (1) multi pixel operations, (2) iterative and recursive neighborhood operations, and (3) queue based algorithms. Also, apart from the algorithmic pattern for geometric operations, all of the patterns that are currently incorporated in Horus are restricted to instantiating translation invariant operations only. Translation variant versions of the presented algorithmic patterns will be incorporated in the future as well.
3.2 Integration of Parallelism in Horus
As discussed in Section 2.3.2, the parallel library that constitutes the core of our software architecture is an extended version of the sequential Horus library. In the parallel version all additional functionality is implemented such that it does not interfere with the existing sequential code. As such, the parallel library can still be instructed to resort to traditional sequential operation — which generally is preferred over single node parallel operation due to additional overhead costs.
From a design perspective the extended library consists of four logical components, as shown in Figure 3.1. The following discusses each in turn, and identifies the relationships among them:
Component C1: Sequential Algorithmic Patterns
The first component (C1) consists of the set of sequential algorithmic patterns introduced in Section 3.1. As indicated in Figure 3.1, each algorithmic pattern present in this component is implemented as a sequence of sequential routines. All operations in such sequence must be separately available in the library — but not necessarily as user-callable routines. Apart from memory operations that may be required for the creation or destruction of internal data structures, the most important operation
Figure 3.1: Relationships between library components C1-C4 (note: the actual code differs substantially). Sequential code blocks that constitute a specialization of a parallelizable pattern are used in the implementation of sequential algorithmic patterns as well as in the implementation of the related parallel counterparts. All functionality is provided to the user through a sequential application programming interface (API) that contains no references to the library’s parallel processing capabilities.
in such sequence is what we refer to as a parallelizable pattern. Here it is sufficient to indicate that a parallelizable pattern constitutes a code block that incorporates only those instructions in a sequential algorithmic pattern that can be applied in the implementation of the related parallel algorithmic pattern as well — in the latter case without having to communicate to obtain essential data residing at any other processing unit. For a much more formal description of parallelizable patterns we refer to Section 3.4.
Component C2: Parallel Extensions
Next to the sequential algorithmic patterns, an additional set of routines is implemented to introduce parallelism into the library (component C2 in Figure 3.1). The parallel extensions deal with all aspects of parallelization, ranging from the logical partitioning of data structures to the actual exchange of data among processing units. To have full control over all interprocess communication\(^1\), all extensions are implemented using MPI [104]. The implemented set of parallel extensions is divided into three classes:
1. Routines for data structure partitioning. These routines are used to specify the data structure responsibilities for each processing unit, i.e. to indicate which data parts should be processed by each node. In practice, a data structure is mapped onto a logical grid of processing units of up to 3 dimensions, which allows for optimal domain decomposition of the bulk of all image data structures (see also Chapter 5). The mapping is performed in such a way that the number of data elements each node is responsible for is well-balanced.
The most important routines in this class are the 'doPartition()' and 'rePartition()' operations, which define the (new) responsibilities for a given data structure. Responsibilities are based on the logical grid of processing units, and the dimensionality and size of a data structure. All other routines in this class are requests for partitioning information (for example, to obtain the size and dimensionality of partial data structures other processing units are made responsible for).
2. Routines for data distribution and redistribution. These operations are used for the actual spreading (either scattering or broadcasting), gathering, and redistribution of data structures. Although the MPI 1.1 standard provides most of this functionality and the new MPI 2.0 standard defines all, we have made multiple implementations ourselves using the standard blocking MPI send and receive operations. We refer to Chapter 5 for a detailed discussion on the rationale, and the implications for application performance and optimization.
It should be noted that data distribution could have been regarded independent from data partitioning. To avoid any unnecessary communication, however, we have made the distribution of data structures dependent on the assigned data
\(^1\)Note that in our implementations (and also in the remainder of this thesis) we assume a one-to-one relationship between processes and processing units.
3.3 Data Parallel Image Processing
responsibilities. Data partitioning is therefore always applied as part of a data distribution operation.
3. Routines for *overlap communication*. These operations are used to exchange *shadow regions* (e.g., image borders in neighborhood operations) among neighboring nodes in a logical grid of processing units.
All operations in component C2 are kernel routines, and are not made available to the library user.
**Component C3: Parallel Algorithmic Patterns**
To reduce code redundancy and enhance library maintainability as much as possible, much of the source code for the sequential algorithmic patterns is reused in the implementation of their respective parallel counterparts. More specifically, the implementation of each parallel algorithmic pattern is obtained by inserting communication operations from component C2 in the sequence of routines that constitutes the implementation of the related sequential algorithmic pattern. The communication routines are to obtain all non-local data (i.e., data residing on other processing units) required during execution of the parallelizable pattern. The communication routines also gather partial results data from all processing units to a single (root) node as soon as the execution of the parallelizable pattern has finished. As such, during execution all instantiations of the parallel algorithmic patterns run in a Bulk Synchronous Parallel manner [103, 162].
**Component C4: Fully Sequential API**
The extended image processing library is provided with an application programming interface (component C4 in Figure 3.1) identical to that of the original sequential Horus library. Due to the fact that the API contains no references to the library's parallel processing capabilities, no additional effort is required from the application programmer to obtain a parallel program. In other words: any application implemented for a sequential machine — after recompilation — can be executed on a cluster as well. As such, the library fully adheres to the first requirement of user transparency as defined in Section 2.2.
### 3.3 Data Parallel Image Processing
The previous sections implicitly indicated that we have adopted *data parallelism* as the programming model for implementing all parallel algorithmic patterns. In the following we clarify why we have adopted this approach as the sole technique for parallelization, rather than any other approach or even a combination of approaches. Also, to lay the foundations for the generic description of parallelizable patterns presented in Section 3.4, we give a formal description of the manner in which image data structures are represented in our data parallel library.
3.3.1 Data Parallelism versus Task Parallelism
Although many more programming paradigms for parallel computing exist, the models of data parallelism and task parallelism are used most frequently because of their effectiveness and general applicability. As defined in [50], the data parallel model focuses on the exploitation of concurrency that derives from the application of the same operation to multiple elements of a data structure. In other words, it is a programming model in which a single routine is applied to all elements of a data structure simultaneously. In contrast, the task parallel paradigm constitutes a model of parallel computing in which many different operations may be executed concurrently [170].
In the literature, a multitude of papers exists in which each of these paradigms is used effectively for parallelizing (low level) image processing operations (e.g., see [19, 32, 134, 161]). Also, for certain image processing problems it has been shown that application of a combination of the two paradigms in a single program is more effective than using either paradigm exclusively (e.g., see [112, 126]).
Despite the potential benefits of applying task parallelism, we have decided to restrict all parallel implementations in our library to the data parallel model. The reasons for this decision are as follows. First, the application of data parallelism is a natural approach for low level image processing, as many operations require the same function to be applied to each individual data element (or small set of elements around each data element) present in an image data structure. Second, as our parallel library is to serve as an aid in image processing research, the number of independent tasks available in most applications is expected to be small. This is because in the design phase of algorithms or applications, testing and evaluation generally is performed using relatively small problem sizes (e.g., using a single image rather than a database of thousands of images). A third reason is related to the scalability in the number of processing units. As the number of independent tasks in most image processing applications generally is much smaller than the number of elements present in the input (image) data structures, the number of processors that can be applied effectively is generally much larger in the data parallel case. Another important reason is that load balancing (i.e., evenly distributing all work among the available processing units) is generally much more difficult in the task parallel model. Especially in case independent parallel tasks represent highly varying workloads, it is difficult to ensure that each processor has exactly the same amount of work to do.
The decisive factor for not incorporating task parallelism in our software architecture, however, is the difficulty of combining this programming paradigm with the requirements of user transparency. The presence of a fully sequential API implies that we would have to incorporate a separate interpretation and optimization strategy to find all independent tasks available in an application. Effectively, this implies that we would have to develop, at least in part, a parallelizing compiler. For reasons explained in Section 2.2.1 we expect such compiler not to yield a desirable solution.
It would have been possible to incorporate the notion of task parallelism in the library’s API, e.g. by providing aggregated operations that can work on sets of images. However, this approach would dramatically reduce the library’s chances of widespread acceptance, as it would require most existing applications to be rewritten by hand.
3.3. Data Parallel Image Processing
(e.g., by replacing loop constructs by a single call to an aggregated library operation). This is not trivial, as it requires the user to personally identify dependencies among tasks (which is often difficult due to the presence of indirections in the C or C++ code). To shield the user from having to deal with any of these issues, and also to avoid having to implement any optimization strategy that can detect independent tasks automatically, we have refrained from incorporating task parallelism altogether. As will be shown in Chapter 7, despite the fact that all implementations are restricted to the data parallel approach, obtained performance improvements are generally well within the efficiency requirements as put forward in Chapter 2.
3.3.2 Representation of Digital Images
An image data structure in our library consists of a set of pixels. Associated with each pixel is a location (point) and a (pixel) value. Here, we denote an image by a lower case bold character from the beginning of the alphabet (i.e., a, b, or c). Locations are denoted by lower case bold characters from the end of the alphabet (i.e., x, y, or z). The pixel value of an image a at location x is represented by a(x).
The set of all locations is referred to as the domain of the image, denoted by a capital bold character (i.e., X, Y, or Z). Usually, the point set is a discrete n-dimensional lattice \( \mathbb{Z}^n \), with \( n = 1, 2, \) or 3. Also, the point set is bounded in each dimension resulting in a rectangular shape for \( n = 2 \) and a block shape for \( n = 3 \). That is, for an n-dimensional image
\[
X = \{(x_1, x_2, \ldots, x_n) \in \mathbb{Z}^n : o_i \leq x_i \leq o_i + k_i - 1 \}, i \in \{1, 2, \ldots, n \}
\]
where \( o = (o_1, o_2, \ldots, o_n) \) represents the origin of the image, and \( k_i \) represents the extent of the domain in the \( i \)-th dimension.
The set of all pixel values \( a(x) \) is referred to as the range of the image, and is denoted by \( \mathbb{F} \). A pixel value is a vector of \( m \) scalar values, with \( m = 1, 2 \) or 3. A

Scalar value is represented by one of the common datatypes, such as byte, int, or float. The set of all images having range $\mathbb{F}$ and domain $\mathbb{X}$ is denoted by $\mathbb{F}^\mathbb{X}$. In summary, $a \in \mathbb{F}^\mathbb{X}$ (i.e., $a : \mathbb{X} \rightarrow \mathbb{F}$) is a shorthand notation for
$$\{ (x, a(x)) : x \in \mathbb{X} \subseteq \mathbb{Z}^n \ (n = 1, 2, 3), \ a(x) \in \mathbb{F} \subseteq \{\mathbb{Z}^m, \mathbb{R}^m, \mathbb{C}\} \ (m = 1, 2, 3) \}.$$
When image data is spread throughout a parallel system, multiple data structures residing on different locations form a single logical entity. In our library, each image data structure resulting from a scatter or broadcast operation is called a partial image. For each partial image additional partitioning and distribution information is available. The information includes, but is not restricted to, (1) the processor grid used to map the original image data onto, (2) origin and size of the domain of the original image, and (3) the type of data distribution applied (e.g., scatter or broadcast). Partial image $a$ residing on processing unit $i$ is denoted by $a_{p_i}$; its domain is denoted by $X_{p_i}$. As data spreading can not result in a loss of data, for each image $a \in \mathbb{F}^\mathbb{X}$ distributed over $n$ processing units:
$$\bigcup_{i=0}^{n-1} X_{p_i} = X.$$
The $n$ partial images related to $a$ together form one logical structure, referred to as a distributed image. A distributed image is denoted by $a_d$, and differs from a partial image in that it does not reside as a physical structure in the memory of one processing unit (unless it is formed by one partial image only). A distributed image’s domain $X_d$ is given by the union of the domains of its related partial images. The domains of the partial images that constitute a distributed image may be either non-overlapping, partially overlapping, or fully overlapping (see Figure 3.2).
Essentially, it is possible for each processing unit to perform operations on each partial image independently. In the library, however, we make sure that each operation (logically) is performed on distributed image data only. In all cases this results in the processing of all partial images that constitute the distributed image. This strategy is of great importance to avoid inconsistencies in distributed image data.
### 3.4 Parallelizable Patterns
As stated in Section 3.2, we try to enhance library maintainability by reusing as much sequential code as possible in the implementations of the parallel algorithmic patterns. To that end, for each sequential algorithmic pattern we have defined a so-called parallelizable pattern. Each such pattern represents the maximum amount of work in a generic algorithm that - when applied to partial image data - can be performed without the need for communication. In other words, in a parallelizable pattern all internal data accesses must refer to data local to the processing unit executing the operation. In the following we give a generic description of parallelizable patterns, and show their application in parallel implementations.
3.4.1 Generic Description
A parallelizable pattern is a sequential generic operation that takes zero or more source structures as input, and produces one destination structure as output. A pattern consists of $n$ independent tasks, where a task specifies what data in any of the structures involved in the operation must be acquired (read), in order to update (write) the value of a single data point in the destination structure. In a task, read access to the source structures is unrestricted, as long as no accesses are performed outside any of the structures’ domains. In contrast, read access to the destination structure in each task is limited to the single data point to be updated.
All $n$ tasks are tied to a different task location $x_i$, with $i \in \{1, 2, \ldots, n\}$. The set $L$ of all task locations constitutes a subset of the positions inside the domain of one of the data structures involved in the operation (either source or destination). As a simple example, $L$ may refer to all $n$ pixels in an image data structure, all of which are processed in a loop of $n$ iterations.
Each task location $x_i$ has a relation to the positions accessed in all data structures involved in the operation. As such, for the parallelizable patterns relevant in image processing we define four data access pattern types:
- **One-to-one.** For a given data structure, in each task $T_i$ (with $i \in \{1, 2, \ldots, n\}$) no data point is accessed other than $x_i$.
- **One-to-one-unknown.** For a given data structure, in each task $T_i$ (with $i \in \{1, 2, \ldots, n\}$) not more than one data point is accessed. In general, this point is not equal to $x_i$.
- **One-to-M.** For a given data structure, in each task $T_i$ (with $i \in \{1, 2, \ldots, n\}$) no data points are accessed other than those within the neighborhood of $x_i$. As an example, the $5 \times 3$ neighborhood of a point $x = (x_1, x_2) \in X$ is given by
$$N(x) = \{y \in Y : y = (x_1 \pm j, x_2 \pm k), j \in \{0, 1, 2\}, k \in \{0, 1\}\},$$
where $X \subset Y$.
- **Other.** For a given structure, in each task either all elements are accessed, or the accesses are irregular or unknown.
A parallelizable pattern requires that for all data structures the access pattern type is given. Essentially, all four access pattern types are applicable to source structures. In contrast, the single destination structure can only have a 'one-to-one' or a 'one-to-one-unknown' access pattern type. This is because — by definition — in each task only one data point is accessed in the destination structure.
Figure 3.3 shows the two parallelizable pattern types that we discern. In a type 1 parallelizable pattern the set of task locations has a 'one-to-one' relation to the destination structure. In a type 2 parallelizable pattern the access pattern type related to the destination structure is of type 'one-to-one-unknown'. The two parallelizable patterns differ in the type of combination operation that is permitted. In a parallelizable
Chapter 3. Parallelizable Patterns in Low Level Image Processing Algorithms
Figure 3.3: Two parallelizable pattern types. $R$ = read access; $W$ = write access; dap = data access pattern; $(1)$ = exactly one data structure of this type; $(*)$ = zero or more data structures of this type.
pattern of type 1 no restrictions are imposed on the combination operation. In a type 2 pattern the final combination of the intermediate result of all values read from the source structures with the value of the data point to be updated in the destination structure must be performed by a function $f()$ that is associative and commutative. Also, prior to execution of a type 2 pattern, all elements in the destination structure must have a value that is 'neutral' for operation $f()$. For example, the neutral value for addition is 0, while for multiplication it is 1.
The two parallelizable pattern types give a generalization of a large set of sequential image processing routines, e.g. incorporating all algorithmic patterns of Section 3.1. As such, the presented generalization captures a large majority of all operations commonly applied in image processing research (i.e., it comprises an estimated coverage of over 90%). It should be noted, however, that the two types do not present a complete coverage of the typical implementations of all operations in this particular field of research. For example, algorithms in which write access is to multiple data structures is required do not fall in the category of operations currently under consideration. The same holds for operations in which the value of each data point in the destination structure depends on values of other data points in the same destination structure. In how far these limitations pose any unreasonable restrictions on future library adaptations (and thus necessitates extension of the generic description of parallelizable patterns) is as of yet unknown (see also Section 3.4.5).
All algorithmic patterns that do fit into the given generalization are applicable in the process of 'parallelization by concatenation of library operations', described in Section 3.2. As discussed in the remainder of this section, on the basis of the generic description we define a standard parallelization strategy that always results in a correct data parallel implementation for any algorithmic pattern that maps onto at least one of the two parallelizable pattern types.
3.4.2 Default Parallelization Strategy
The number of elements in the set of task locations $L$ determines the number of steps executed by a parallelizable pattern. Hence, by providing each node in a parallel system with a set $X \in L$, the work is distributed (i.e., in a data parallel manner). In addition, the access pattern type associated with each structure involved in the operation prescribes how non-local data accesses are avoided with minimal communication overhead. As such, an optimal\(^\dagger\) default parallelization strategy is obtained for any operation that maps onto one of the presented parallelizable pattern types.
First, before executing a type 1 parallelizable pattern each processing unit is provided with a non-overlapping partial destination structure that matches the elements in $X$. If the destination structure is updated but never read, the partial structure can be created locally. Otherwise, it is obtained by scattering the destination structure such that no overlap in the domains of the local partial structures is introduced. Before executing a type 2 parallelizable pattern, each processing unit creates a fully overlapping destination structure locally. This is always possible, as the value of all data points are given a 'neutral value', as defined by the operation.
Next, source data structures are obtained by executing (1) a non-overlapping scatter operation for each structure having a one-to-one access pattern, (2) a partially overlapping scatter operation for each structure having a one-to-M access pattern type (such that in each dimension the size of each shadow region equals half the size of the neighborhood in that dimension), and (3) a broadcast operation for all other structures. In case the values of a source structure can be calculated locally, and if it is less time-consuming to do so, no communication routines are performed at all.
Finally, when a type 1 pattern has finished, the complete destination structure is obtained by executing a gather operation. For a type 2 pattern this is achieved by executing a reduce operation across all processing units. Here, the elements that have not been updated in each local destination structure have kept a neutral value, assuring the correctness of the final reduction. In both cases, the result structure is returned either to one node, or to all.
On the basis the generic description of parallelizable patterns, the following shortly discusses parallel implementation of two example algorithmic patterns, i.e. global reduction and generalized convolution.
3.4.3 Example 1: Parallel Reduction
A sequential generic reduction operation performed on input image $a$, producing a single scalar or vector value $k$, is defined as follows:
Let $a \in \mathbb{F}^X$, $x \in X$, and $k \in \mathbb{F}$, then
$$k = \Gamma a = \Gamma_x a(x) = \Gamma_i^n a(x_i) = a(x_1) \gamma \ a(x_2) \gamma \cdots \gamma \ a(x_n),$$
with $\gamma$ an associative and commutative binary operation on $\mathbb{F}$.
\(^\dagger\)The default strategy is optimal for operations executing in isolation only. In case multiple operations are executed in sequence, additional inter-operation optimization is required (see Chapter 6).
As shown in Figure 3.4, at least two possible sequential implementations exist for this operation. In the first implementation, the operation is performed in one step. All data points in \( a \) are obtained and combined to a single value, which is written out to \( k \). In the second implementation, the operation is performed in \( n \) steps. In each step, one data point in \( a \) is read and combined with the current value of \( k \).
The first implementation is a specialization of the parallelizable pattern of type 1 as described in Section 3.4; the second implementation is a specialization of the type 2 parallelizable pattern. The first implementation is not useful for our purposes, however, as its execution is limited to a single processing unit. This is because the set of task locations \( L \) consists of one element only, i.e. the location of the single output value \( k \). The second implementation, on the other hand, is easily run in parallel as \( L \) contains all locations in input image \( a \). For this implementation the input image's access pattern type is 'one-to-one'; for the single result value it is 'one-to-one-unknown'. As a result, a parallel implementation of the generic reduction operation follows directly from the generalization of Section 3.4.2. A pictorial view of the operation executed in parallel is given in Figure 3.5.


3.4.4 Example 2: Parallel Generalized Convolution
A generalized convolution performed on input image \( a \), producing output image \( c \), given a kernel \( t \), is defined as follows:
Let \( a, c \in \mathbb{F}^X \), \( t \in \mathbb{F}^Y \), \( x \in X \), \( y \in Y \), with \( X \) having dimensionality \( n \), and \( Y = \{(y_1, y_2, \ldots, y_n) : |y_i| \leq k_i \in \mathbb{Z}\} \), then
\[
c = a \ast t = \{(x, c(x)) : c(x) = \Gamma_y a(x + y) \circ t(y) \},
\]
where \( \circ \) and \( \gamma \) are binary operations on \( \mathbb{F} \), and \( \gamma \) is associative and commutative. The extent of the domain in the \( i \)-th dimension of kernel \( t \) is given by \( 2k_i + 1 \). Several common generalized convolution instantiations are shown in Table 3.1.
<table>
<thead>
<tr>
<th>Kernel Operation</th>
<th>( \circ )</th>
<th>( \gamma )</th>
</tr>
</thead>
<tbody>
<tr>
<td>Convolution</td>
<td>multiplication</td>
<td>addition</td>
</tr>
<tr>
<td>Dilation</td>
<td>addition</td>
<td>maximum</td>
</tr>
<tr>
<td>Erosion</td>
<td>addition</td>
<td>minimum</td>
</tr>
</tbody>
</table>
Table 3.1: Example generalized convolution instantiations.
The definition states that each pixel value in the output image depends on the pixel values in the neighborhood of the pixel at the same position in the input image, as well as on the values in the related kernel structure. A sequential implementation of the operation is presented in Figure 3.6. Again, set \( L \) is implicit, and contains all pixel positions in either the input image or the output image.
When comparing Figure 3.3(a) to Figure 3.6(a) it may seem that the operation directly constitutes a parallelizable pattern. Figure 3.6(b) shows that this is not the case, however, as accesses to pixels outside the input image’s domain are possible. In sequential implementations of this operation it is common practice to redirect such accesses according to a predefined border handling strategy (e.g., mirroring or tiling). A better approach for sequential implementation, however, is to separate the border
: Sequential generalized convolution. Does not represent a parallelizable pattern, as read accesses outside the domain of the input image are possible (see (b)).
handling from the actual convolution operation. This makes implementations more robust and generally also faster, due to the fact that irregular memory accesses are avoided. For parallel implementation this strategy has the additional advantage that the algorithmic pattern for generalized convolution can be implemented such that it constitutes a parallelizable pattern.
Implementation in this manner can be performed in many different ways. In our library a so-called scratch border is placed around the original input image. The border is filled with pixel values according to the required border handling strategy. The newly created scratch image is used as input to the parallelizable pattern. Figure 3.7 depicts the operation executed in parallel. As each local scratch image has a one-to-M access pattern, an overlapping scatter of the global input image is required. In Figure 3.7 this is implemented by a non-overlapping scatter followed by overlap communication. Remaining scratch border data is obtained by local copying. Finally, the parallelizable pattern is executed, producing local result images that are gathered to obtain the complete output image. Note that Figure 3.7 gives a simplified view, as some steps of the operation are not shown. For example, depending on the type of operation, the kernel structure is either broadcast or calculated locally.
3.4.5 Discussion
The generic description of parallelizable patterns is important as it states the requirements for sequential implementations that are to be reused in related parallel counterparts. In addition, for each specialized parallelizable pattern implemented on the basis of the generic description, a parallelization strategy directly follows. As such, code reusability is maximized, and library maintainability and flexibility is enhanced.
It should be noted that if a sequential operation does not map onto the generic description of a parallelizable pattern, we currently take no special action to obtain good performance. In such situations, the operation is always executed using one processing unit only. In the future we will investigate whether parallelization of such operations can be generalized as well. Additional formulations may be integrated in the current generalization, or may exist independently.
3.5 Conclusions and Future Work
In this chapter we have indicated how an extensive parallel image processing library is constructed with minimal implementation effort, whilst ensuring efficiency of (sequential and parallel) execution at the same time. We have focussed on the notion of parallelizable patterns, and discussed how parallel implementations are easily obtained by sequential concatenation of operations that are separately available in the library. More specifically, on the basis of a set of four data access pattern types, we have obtained a default parallelization strategy for any operation that maps onto one of two parallelizable pattern types. For each image processing operation executed in isolation, this default parallelization strategy is optimal. This is because communication overhead is minimized, while — for the given parallelization granularity — the available parallelism is fully exploited. As such, we have shown how a parallel image processing library can be made extensible, and easily maintainable.
It is important to note, however, that in this chapter we have not discussed the important issue of inter-operation optimization, or: optimization across library calls. To obtain high performance for sequences of library routines, or for complete applications, it is not sufficient to consider parallelization and optimization of each library operation in isolation. This is because code consisting of a given sequence of parallel routines, where each routine is parallelized as described in this chapter, often contains many redundant communication steps. Also, it is often possible to further reduce communication overhead by combining multiple messages in a single transfer. Our solution to this fundamental problem, and the integration of this solution in our software architecture, is discussed extensively in Chapters 4, 5, and 6 of this thesis.
In the future the generic description of parallelizable patterns may need to be extended or adapted to capture image library additions and extensions. For example, at the time of writing it is not entirely clear whether the optimal parallel implementation of recursive filter operations as described in [28, 40] can be derived from one of the presented parallelizable pattern types. As a consequence, we may need to investigate for what type of image operations the strategy of 'parallelization by concatenation of library routines' breaks down, i.e., does not provide efficient implementations, or can not be applied at all. Still, the presented description of parallelizable patterns is important, as it prescribes the sequential implementation of a large majority (i.e., over 90%) of all operations commonly applied in image processing research. Any implementation obtained in this manner can be applied without change in efficient parallel implementations as well — thus avoiding unnecessary code redundancy, and minimizing the required implementation effort.
|
{"Source-Url": "https://pure.uva.nl/ws/files/3391350/29018_UBA002001207_06.pdf", "len_cl100k_base": 9563, "olmocr-version": "0.1.49", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 52505, "total-output-tokens": 10413, "length": "2e13", "weborganizer": {"__label__adult": 0.0002777576446533203, "__label__art_design": 0.0004229545593261719, "__label__crime_law": 0.00026416778564453125, "__label__education_jobs": 0.00032067298889160156, "__label__entertainment": 5.8531761169433594e-05, "__label__fashion_beauty": 0.00010788440704345704, "__label__finance_business": 0.00015056133270263672, "__label__food_dining": 0.0003209114074707031, "__label__games": 0.0004322528839111328, "__label__hardware": 0.0011072158813476562, "__label__health": 0.0003211498260498047, "__label__history": 0.0002264976501464844, "__label__home_hobbies": 6.502866744995117e-05, "__label__industrial": 0.00038695335388183594, "__label__literature": 0.00016570091247558594, "__label__politics": 0.00023508071899414065, "__label__religion": 0.00040030479431152344, "__label__science_tech": 0.019927978515625, "__label__social_life": 6.026029586791992e-05, "__label__software": 0.00604248046875, "__label__software_dev": 0.9677734375, "__label__sports_fitness": 0.00023877620697021484, "__label__transportation": 0.00039887428283691406, "__label__travel": 0.00019156932830810547}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46513, 0.01892]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46513, 0.70283]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46513, 0.91486]], "google_gemma-3-12b-it_contains_pii": [[0, 186, false], [186, 1791, null], [1791, 5467, null], [5467, 8790, null], [8790, 12060, null], [12060, 13854, null], [13854, 16920, null], [16920, 19641, null], [19641, 23302, null], [23302, 25680, null], [25680, 28833, null], [28833, 31859, null], [31859, 34289, null], [34289, 37512, null], [37512, 39052, null], [39052, 41256, null], [41256, 43558, null], [43558, 46513, null], [46513, 46513, null]], "google_gemma-3-12b-it_is_public_document": [[0, 186, true], [186, 1791, null], [1791, 5467, null], [5467, 8790, null], [8790, 12060, null], [12060, 13854, null], [13854, 16920, null], [16920, 19641, null], [19641, 23302, null], [23302, 25680, null], [25680, 28833, null], [28833, 31859, null], [31859, 34289, null], [34289, 37512, null], [37512, 39052, null], [39052, 41256, null], [41256, 43558, null], [43558, 46513, null], [46513, 46513, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46513, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46513, null]], "pdf_page_numbers": [[0, 186, 1], [186, 1791, 2], [1791, 5467, 3], [5467, 8790, 4], [8790, 12060, 5], [12060, 13854, 6], [13854, 16920, 7], [16920, 19641, 8], [19641, 23302, 9], [23302, 25680, 10], [25680, 28833, 11], [28833, 31859, 12], [31859, 34289, 13], [34289, 37512, 14], [37512, 39052, 15], [39052, 41256, 16], [41256, 43558, 17], [43558, 46513, 18], [46513, 46513, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46513, 0.03546]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
2203a605e292b884fb341b988716fc83d4c43a5d
|
The growth in cost and importance of software to NASA has caused NASA to address the improvement of software development across the agency. One of the products of this program is a series of guidebooks that define a NASA concept of the assurance processes which are used in software development.
The Software Assurance Guidebook, SMAP-GB-A201, issued in September, 1989, provides an overall picture of the concepts and practices of NASA in software assurance. Lower level guidebooks focus on specific activities that fall within the software assurance discipline, and provide more detailed information for the manager and/or practitioner.
This is the Software Configuration Management Guidebook which describes software configuration management in a way that is compatible with practices in industry and at NASA Centers. Software configuration management is a key software development process, and is essential for doing software assurance.
SOFTWARE CONFIGURATION MANAGEMENT GUIDEBOOK
Approvals
_____________________________
Lawrence E. Hyatt
Manager, Software Assurance Technology Center
_____________________________
Kathryn Kemp
I. GENERAL
This guidebook defines Software Configuration Management (SCM) and describes its constituent functions, processes, and procedures. The guidebook also describes a generic set of organizational elements and responsibilities for operation of SCM. It defines the role of SCM, its interfaces and its functions throughout the software development life cycle. This guidebook also provides a basis for tailoring SCM for different projects with different life cycles and project specific requirements.
Proper application of software configuration management is a key component in the development of quality software. Changes to the software under development are usually a significant cause of changes to a project’s schedule and budget; unmanaged change is very possibly the largest single cause of failure to deliver systems on time and within budget.
SCM is the process that has been developed to control and manage change. Change is inevitable during the software development life cycle. Changes to the software come from both external and internal sources. External changes originate from users, from evolution of operational environments, and from improvements in technology. Internal changes come from improved designs and methods, from incremental development, and from correction of errors. A properly implemented SCM process is the project manager’s best friend and potential salvation in coping with change.
This guidebook is written for software project managers who must plan for SCM for their project, for SCM practitioners who will implement SCM, and for software developers and acquirers who will be affected by it. The style of the guidebook is intended to be tutorial rather than directive. It is hoped that the reader will find the following sections an easily understood introduction to software configuration management and a useful guide to planning and implementing SCM in a software development project.
The guidebook describes SCM in terms of the concepts and definitions, implementation, applicability in relation to the software life cycle phases, organization and interfaces, discussions of tools, examples of forms, and references to applicable documents.
II. CONCEPTS AND DEFINITIONS
Software configuration management is the process whose objective is the identification of the configuration of software at discrete points in time and the systematic control of changes to the identified configuration for the purpose of maintaining software integrity and traceability throughout the software life cycle.
In order to accomplish the objective given in the above definition, there are four identified SCM functions: 1) identification of the components that make up the software system and that define its functional characteristics; 2) control of changes to those components; 3) reporting of status of the processing of change requests and, for approved requests, their implementation status; and 4) authentication that the controlled items meet their requirements and are ready for delivery.
The components of a software system that are controlled by the SCM process include project documentation, product documentation, code, data, and any other items needed to meet a set of requirements or contractual obligations. All of these items can be controlled by the same SCM process.
The term "configuration" is used repeatedly in this guidebook. Configuration means the functional and/or physical characteristics of software as set forth in technical documentation and realized in a product. Thus "configuration" includes all of the characteristics of the software to be controlled - its content, the content of documents that describe it, the versions of software and documents as these contents are changed, data needed for operation of the software, and any other essential elements or characteristics that make the software what it is.
The software under control is usually divided into "configuration items." Configuration item (CI) is the term used for each of the logically related components that make up some discrete element of software. For example, if a system contains several programs, each program and its related documentation and data might be designated a configuration item. The number of CIs in a system is a design decision. Guidelines for division of software systems into CIs are given in Section III, part B1. Note that if the system being developed has both hardware and software components, then in a general sense a CI may have both hardware and software components. A CI that is purely software is often called a Computer Software Configuration Item, or CSCI. Generally in this guidebook we will use the term CSCI, since we are talking about software systems and software configuration management. The concepts for software CM are similar to hardware CM, but the software CM process must be even more rigorous and deeply imbedded in the engineering process since software is much more flexible and changeable than hardware.
As each software CI goes through its development process, more and more of its components are developed until the final CSCI is available for use. Generally, the life cycle process will first result in a set of requirements, then a design, then code for individual elements of the CSCI, then integrated code with test cases and user manuals, etc. The definition of SCM contains the concept of identifying the configuration of each CSCI at discrete points in time during the life cycle process, and then managing changes to those identified configurations. The configuration of software at a discrete point in time is known as a baseline. Thus, a baseline is the documentation and software that make up a CSCI at a given point in its life cycle. Each baseline serves as a point of departure or reference for the next development stage. In the NASA standard life cycle, baselines are established after each life cycle phase at the completion of the formal review that ends the phase.
Each baseline is subject to configuration control and must be formally updated to reflect approved changes to the CSCI as it goes through the next development stage. At the end of a life cycle phase, the previous baseline plus all approved changes to it becomes the new baseline for the next development stage. The term "baseline management" is often used to describe this control process.
Normally, the first baseline consists of an approved software requirements document, and is known as the requirements baseline. Through the process of establishing a baseline, the functional and other requirements described in the requirements document become the explicit point of departure for software development, against which changes can be proposed, evaluated, implemented, and controlled. The requirements document is also the basis against which the
Software is authenticated. Subsequent baselines and their contents are described in Section IV.
SCM requires that processes and procedures be put in place to identify the baselines that are to be established and their contents, to control the CSCIs and their individual elements to prevent unauthorized change, to process requests for changes to those baselines and report on status of changes, and to authenticate that a given configuration contains all of its required components and that it satisfies the functional and performance requirements given in the requirement document. That is, SCM consists of four basic processes:
- Configuration Identification
- Configuration Control
- Configuration Status Accounting
- Configuration Authentication
These processes, their relationships and implementation, are described in detail in Section III.
There are some roles that are key to the SCM process. Someone must operate the SCM process; that is, must establish detailed procedures, must make sure all requests for changes are processed properly, must provide reports on the status of all CSCIs and proposed changes, and must have control of all of the baselined items. This role is named Configuration Management Officer or CMO. The individual designated the CMO is critical to the successful operation of a SCM system.
Actual storage and physical control of the contents of baselines is done by a librarian in a location called a program library. The program library must contain the official copies of all baselined items that make up the various CSCIs. It contains all baselined items, including code and object modules, which are checked out by the librarian for authorized changes to be made, and are checked back in after change is complete. The program library is operated by the librarian and is usually under the control of the CMO. Efficient operation of the library is enhanced if automated tools are available. See section VIII for a discussion of tools.
Decision making authority, which must determine if a proposed change is to be made, is vested in a Configuration Change Board (CCB). A CCB is chaired by a senior manager (often the project manager) who can authorize the expenditure of resources. Other members are chosen based on their ability to provide advice on the costs and benefits of a change. Usually the CCB rules of operation are such that the chair unilaterally decides the disposition of the proposed changes after receiving the advice of the other members. The CCB process is operated by the CMO, who provides to the CCB the requests for changes and the associated analysis of impact and who records the decisions of the CCB and provides them to the change requester and the individuals who will implement the change.
SCM is a key process in managing software development, operation, maintenance, and enhancement. The remainder of this document explain in detail the component processes and steps, and the organizational elements needed for the successful implementation of SCM in a software development project.
III. THE SCM PROCESS
A. Overview
Software configuration management is composed of four functions:
- Configuration Identification
- Configuration Control
- Configuration Status Accounting
- Configuration Authentication
**Configuration identification** is the process of defining each baseline to be established during the software life cycle and describing the software configuration items and their documentation that make up each baseline. First, the software must be grouped into configuration items. Once the CSCIs and their components have been selected, some way of designating the items must be developed. This is done by the development of a numbering and naming scheme that correlates the code and data items with their associated documentation. Finally, the CSCIs must be described by the documentation of their functional, performance, and physical characteristics.
**Configuration control** is the process of evaluating, coordinating, and deciding on the disposition of proposed changes to the configuration items, and for implementing approved changes to baselined software and associated documentation. The change control process ensures that changes which have been initiated are classified and evaluated, approved or disapproved, and that those approved are implemented, documented, and verified.
**Configuration status accounting** is the process used to trace changes to the software. It ensures that status is recorded, monitored, and reported on both pending and completed actions affecting software baselines. This process also defines the current as-built status of the code and associated documentation.
**Configuration authentication** is the process of verifying that a deliverable software baseline contains all of the items which are required for that delivery, and that these items have themselves been verified, i.e., they satisfy their requirements. The authentication function usually consists of two "audits": a functional configuration audit (FCA) and a physical configuration audit (PCA). Functional audits authenticate that the software has been tested to assure that it performs in accordance with requirements in the baseline documentation. Physical audits authenticate that the software to be delivered contains all of the required components, documents, and data.
Each of the above functions is explained in more detail in the following sections.
B. Configuration Identification
Configuration identification is the basis for subsequent control of the software configuration. The configuration identification process involves the selection, designation, and description of the
software configuration items. Selection involves the grouping of software into configuration items that are subject to configuration management. Designation is the development of a numbering and/or naming scheme that correlates the software components and their associated documentation. Description is the documentation of functional, performance, and physical characteristics for each of the software components.
1. CSCI Selection
A software system is generally split into a number of CSCIs which are independently developed and tested, and which are finally put together at the software system integration level. Each CSCI becomes essentially an independent entity as far as the CM system is concerned, and the four processes defined at the beginning of Section III are carried out on each CSCI.
The division of the software into CSCIs may be contractually specified, or may be done during the requirements analysis or preliminary design phase. As a general rule, a CSCI is established for a separable piece of the software system that can be designed, implemented, and tested independently. Other criteria that may go into the decision to separate out a set of software and manage it as a CSCI are:
- The set of software is critical to the overall performance, or there is a high level of risk involved, or system safety related tasks are contained in the item.
- The set of software is highly complex, incorporates new technologies, or has stringent performance requirements.
- The set of software encapsulates interfaces with other software items that currently exist or are provided by other organizations.
- The set of software is expected to have more than usual change or modification after it becomes operational.
- The set of software contains all of a specific domain of functionality such as application, operating system, etc.
- The set of software is installed on a different computer platform from other parts of the system.
- The set of software is planned to be reused.
2. CSCI Designation
Each software component must be uniquely identified. The unique identifier is used in tracking and reporting CSCI status. Normally, each CSCI is assigned a CSCI identifier, and pieces of the CSCI are given the identifier with an attached descriptor. Thus, a CSCI that consists of the flight software for a spacecraft might be given the designator FS. Components of the flight software, such as the flight executive might be designated FS-EX, showing that it is a second level component of the CSCI FS. Parts (subroutines) of the executive might be numbered FS-EX-001, FS-EX-002, etc. This allows the unique identification of system elements, both code and documents, as to the CSCI of which they are parts. It facilitates the tracking of changes to the
component, the status of the changes and the component, and the reporting of all the information relative to the component.
3. CSCI Description
Software components are described in specifications (i.e., software requirements specifications, software architectural design specifications, software detailed design specifications, interface control documents, and software product specifications). The description of the component becomes more detailed as the design and development proceeds through the life cycle. The description forms the basis for configuration control and configuration status accounting. The description is also the basis for the final authentication that the software is complete and verified. The documents, or portions of documents, that describe each CSCI must be identified and made part of the CSCI.
Formats for the documents described above can be found in NASA-STD-2100-91, "NASA Software Documentation Standard".
C. Configuration Control
Configuration control is the systematic process for evaluating, coordinating, and deciding on the disposition of proposed changes and for tracking the implementation of those approved changes to baselined code and associated documentation and data. The change control process ensures that the changes are
initiated, classified, evaluated, approved or disapproved, documented, implemented, tested, and incorporated in a new baseline.
An orderly change process is necessary to ensure that only approved changes are implemented into any baselined document or software. Figure 1 shows a simple overview of the change process. The steps within the overall process can be grouped into the following categories:
- Change Initiation
- Classification
- Change Evaluation
- Change Dispositioning
- Implementation
- Verification
- Baseline Change Control
These seven steps in change control are individually discussed below:
1. Change Initiation
Requests for change to software and documents come from many sources. A Change Request
(CR) may be submitted by a potential user, by the system acquirer, by a reviewer, or by a member of the provider’s staff. Each project should set up a CR form for documenting the proposed change and its disposition. See the NASA Software Standards, DID-R005, for basic information that can be included on a CR form, however, the actual form set up must correspond to the planned SCM process. An example form, based on the DID, is included as Appendix B. Note that electronic forms, containing the same information, are being increasingly used as direct interfaces to SCM support tools (Tools are discussed in Section VIII). Each project should also name an individual (the Configuration Management Officer, or CMO) to receive the change form, assign it a tracking number and classification, and route it for processing.
The CMO receives the CR and reviews it for clarity and completeness. If the CMO determines that the CR is not complete, it is returned to the originator. Once complete, the CMO assigns the CR a unique identifier for tracking purposes and records information about the CR in the change request tracking data base or files.
2. Change Classification
Changes to software and associated documentation are classified according to the impact of the change and the approval authority needed. The top class is assigned to changes that would affect the system level requirements, external interfaces, system cost, and/or delivery schedule. These changes usually can only be approved by the acquirer of the software. A second class of changes may be established for changes that affect the interfaces between CSCIs and the allocation of functions to CSCIs, or which affect component level cost and schedule. These changes generally can only be approved by the project level management of the provider. A third class of changes, those that affect CSCI internal design and division of functionality, may be approved by CSCI level management.
Generally, change classes are identified by numbers. For instance, Level I is often assigned to that class that contains the highest class and has to be routed to the acquirer; Level II to the next; etc. Class names and classification rules should be spelled out in the agreement (contract) between the acquirer and provider and the processes for assignment of classes should be in the provider’s SCM procedures. In addition to defining the scope of changes that are allowed to be made by the provider, the contract often will require that the acquirer be provided copies of at least the next lower class to allow verification of the classification process.
Classification of changes may be suggested by the individual who proposes the change. The CMO reviews suggested classes and assigns a working classification. After assessment of the impact of the CR, the CCB will assign the final class.
3. Change Evaluation
One important aspect of the Configuration Control process is that it provides adequate analysis of changes in terms of impact to system functionality, interfaces, utility, cost, schedule, and contractual requirements. Each change should also be analyzed for impact on software safety, reliability, maintainability, transportability, and efficiency. The project CMO routes the CR to the software engineering staff for evaluation. In some cases, project procedures require that the CR be screened by some board before it is analyzed. This approach saves the cost of analysis for changes that do not have any chance of approval.
The analysis produces documentation which describes the changes that will have to be made to implement the CR, the CSCIs and documents that will have to be changed, and the resources needed to do the change. The documentation becomes part of the change package, along with the CR. After completion of the analysis, the change package is sent back to the CMO.
4. Change Dispositioning
Dispositions for changes to baselined items are done by a Configuration Control Board (CCB). The CCB evaluates the desirability of a change verses the cost of the change, as described in the documentation of the analysis. The CCB may approve, disapprove, or defer a change request. It may have to request more information and additional analysis.
Dispositioned items are sent to the CMO for action. Rejected items are sent to the originator along with the CCB’s rationale for rejection. CRs needing further analysis are sent back to the analysis group with the CCB’s questions attached. Deferred CRs are filed, to be sent back to the board at the proper time.
The CMO sends approved items to the development organization, unless it is of a level that needs to be processed through higher level CCBs. If additional levels of approval are needed, the CMO submits the CR package to the next level CCB.
The CMO, acting as the secretariat of the CCB, prepares and distributes the meeting minutes, and records the current status of the CR. This information is added to the tracking data base or recorded in files.
5. Change Implementation
Approved CRs are either directly used as a change authorization form or result in a change directive being prepared by the CMO. In either case, approval results in the issuance of instructions which authorize and direct the implementation of the change in the software and associated documentation.
The development organization schedules the resources to make the change. It must get official copies of the baselined component to be changed from the program library. For code changes, design has to be developed, code has to be written, and testing has to be done and the correctness of the change verified. Moreover, the associated documentation has to be revised to reflect the change. Once the change has been made and local testing completed, the revised component and documents are returned to the control of the program library. Upon verification, the new version takes its place in the sequence of baselines.
6. Change Verification
The implemented changes, which have been tested at the unit level, must be verified at the CSCI level. This may require the rerun of tests specified in the test plan or the development of an addition to the test plan. Regression testing will usually have to be included in the test to assure that errors have not been introduced in existing functions by the change. Once the verification is complete, the development organization submits evidence of it to the program library, which will then accept the changed items for inclusion in the SCM controlled files that make up the new version of the baseline. This CSCI or system level of verification may not occur until the next
release of the system is being tested.
After the successful implementation and testing of the change described in the CR, the CMO will record the occurrence of this process into the change request tracking data base or files.
7. Baseline Change Control
Changes to software are not complete until the code and data changes have been implemented and tested and the changes to associated documentation have been made and all of the changes verified. In order to minimize the number of versions and the frequency of delivery of software components, changes to software are usually grouped into releases. Each release contains software and documentation that has been tested and controlled as a total software system.
D. Configuration Status Accounting
The objective of software configuration status accounting is to record and report the status of the evolving software throughout the life cycle. It provides traceability of changes to the baselined requirements, code and data components, and associated documentation. It documents what is in each version of software and the changes that lead up to the version. It accounts for all changes to the baselined items whether they are incorporated in accordance with the change control process or in accordance with the nonconformance reporting and corrective action process. This function keeps track of the changes and the contents of versions and releases.
Status accounting begins when the first specification (i.e., software requirements specification) is baselined and continues throughout the life cycle. The accounting information is a key element used during the functional configuration audits and physical configuration audits that are done in the authentication process. Status accounting provides a list of the contents of each delivery of the software and associated documents.
Software configuration status accounting is a record keeping and reporting activity. The records contain the identification of the initial software and associated documents and their current status, status of evolving baselines, status of proposed and approved changes, and the implementation status of approved changes. Reports document the information contained in the records and are the means for disseminating the information. Examples of routine reports furnished by the status accounting function are: status of change requests (CRs), specification change notices (SCNs), and version description documents (VDDs).
E. Configuration Authentication
Configuration authentication is the process of assuring that the baselined configuration has been tested to demonstrate that it meets its functional requirements and that it contains all deliverable entities. As the principal means of configuration authentication, audits are scheduled before each delivery of the software system. Configuration audits ensure that the CSCIs conform to the specifications that are part of the baseline. A functional configuration audit (FCA) authenticates that the software performs in accordance with the requirements and as stated in the baselined documentation. A physical configuration audit (PCA) authenticates that the components to be delivered actually exist and that they contain all of the required items, such as the proper versions of source and object code, documentation, installation instructions, etc.
1. Functional Configuration Audit
The functional configuration audit authenticates that the actual performance of the CSCI complies with the requirements stated in the baselined design documentation. This is accomplished by evaluating the test methods, procedures, reports, and other engineering and design documentation. It may not be possible to completely authenticate a CSCI until higher level integration is accomplished. Audit reports are prepared to document the results of the FCA. These audit reports are generally used as part of the documentation provided to the acquirer of the software as part of a phase ending review, such as the Acceptance Test Readiness Review.
2. Physical Configuration Audit
The physical configuration audit is the formal examination of the as-built version of the component against the baselined technical documentation defining the component. The PCA assures that changes to be included in the version of software to be delivered are really included, that all required items of software, data, procedures, and documentation are included. Audit reports are prepared to document the results of the PCA and are used in the same reviews as the reports of the FCA.
3. External Audits of the SCM Process
Other types of audits of SCM are also conducted during the development process. These audits are done by the Quality Assurance (QA) organization to assure that the SCM process is being conducted according to approved procedures. The role of the CMO and the program librarian during these audits is to make their records available to QA and to respond to any problems noted in the audit reports. These types of QA audits are described in the Guidebook "Software Quality Assurance Audits", SMAP-GB-A301.
IV. SCM DURING THE SOFTWARE LIFE CYCLE
There are phase-specific SCM activities that should be conducted during the software acquisition life cycle and specific baselines that are established at the end of each phase. In a complete waterfall model life cycle, the recommended baselines are (see Figure 2):
- Software Requirements Baseline
- Software Allocated Baseline
- Software Design Baseline
- Software Code Baseline
- Software Product Baseline
- Software Accepted (As-Built) Baseline
Figure 2 is an adaptation of the NASA Software Acquisition Life Cycle chart, version 4.0, dated 1988. The figure focuses on the relationships between the baselines and life-cycle phases. If the life cycle to be used is modified by either the acquirer or the provider, some of the baselines may be eliminated. In other situations, such as where development by builds is done, some baselines may be struck repeatedly as parts of the life cycle are repeated. The important point is that baselines need to be established and changes thereto be documented and authorized.
In the remainder of this section the development activities of each phase of the life cycle are briefly described, along with the SCM activities during the phase and the contents of the baseline that is established at the end of the phase.
A. Software Concept and Initiation Phase
During the software concept and initiation phase, the software concept is developed and the feasibility of building the software system is evaluated. The acquirer’s software management plan is then written and approved and an acquisition strategy is developed. If a contract is to be used to acquire the software, procurement is initiated and a contract is awarded.
The acquirer CMO is responsible for developing the SCM portion of the project software management plan, and is responsible for developing a compatible set of provider SCM requirements that are included in the Request for Proposal (RFP).
During the proposal reviews, the CMO provides expertise in the evaluation of the proposed SCM activities by each potential provider. The provider’s SCM activities may be presented in the SCM portion of their proposal or as an initial draft of the SCM plan or section of a software management plan provided as part of the proposal. The acquirer CMO assesses whether or not the potential provider has proposed an adequate plan that meets all of the SCM requirements in the RFP.
During the Concept and Initiation Phase, the acquirer should place under SCM the project software management plan, procedures developed to carry out sections of the plan, and the system level requirements passed to the provider.
B. Software Requirements Phase
During the software requirements phase, the software concept and allocated system requirements are analyzed and documented as software requirements. Test planning begins, with a method for verifying each requirement identified and included in a preliminary test plan. Risks are identified and risk management control mechanisms are established. The size and scope of the remainder of the project is reevaluated, and changes in resources and schedules are made. Methods, standards, and procedures are detailed and put in place.
During this phase, the provider CMO should complete the final SCM Plan and submit it to the acquirer for review. The acquirer CMO will evaluate the provider’s SCM Plan to ascertain that all of the SCM requirements are satisfied, and that the plan is complete and the procedures to be used are clearly stated. As part of the SCM planning, the staff required to perform SCM will have been determined and the assignment of the SCM staff will begin in this phase. Upon agreement between the acquirer and the provider, the Provider SCM Plan is placed under
provider configuration management.
The software requirements baseline is struck after the completion of this phase and the satisfactory resolution of issues raised at the phase ending Software Requirements Review (SRR). The major component of the requirements baseline is the approved software requirements specification and interface requirements documents. However, it should also contain other relevant provider management documentation such as development plans, assurance and SCM plans, test plans, etc. These management and development documents detail the approach to managing, developing, testing, assuring, and controlling the software. They include or refer to applicable standards and procedures that will be adhered to during the development of the software.
The contents of the software requirements baseline become a permanent part of all succeeding baselines and are the basis against which the remaining development effort is authenticated. Any proposed change to this baseline will follow the change control process described in the Software Configuration Control within the SCM Process, Section III.
C. Software Architectural Design Phase
The objective of the software architectural design phase is to develop an overall design for the software, allocating all of the requirements to software components. The software requirements are controlled and managed, and the contents of the requirements baseline are changed only by a formal process. The phase ends with the preliminary design review, during which the acquirer and provider agree on the architecture of the system that is to be produced. Rework and action items resulting from the review are tracked and completed.
The software allocated baseline contains the architectural design of the system and documents showing how the requirements are allocated to the design. This baseline is struck after the completion of this phase and the resolution of any problems raised at the Software Preliminary (Architectural) Design Review (PDR). The baseline contains all the updated documents from the Requirements baseline, along with the architectural design specification. The baseline may also contain a software build (or release) plan and test plans. If present, these plans are usually still at a high level, with general functions assigned to the proposed builds or releases.
The contents of the software allocated baseline become a permanent part of all later baselines and a part of the basis against which the remaining development effort is authenticated. Any proposed change to this baseline will follow the change control process described in the Software Configuration Control within the SSCM Process, Section III.
D. Software Detailed Design Phase
During the software detailed design phase, the architectural design is expanded to the unit level. Interface control documents are completed and test plans revised. Constraints and object system resource limits are re-estimated and analyzed, and staffing and test resources are validated. The phase ends with the Critical Design Review. During this phase, both the requirements and the architectural design are under configuration management control of the provider CMO as part of the allocated baseline, and can only be changed by a formal process.
The software design baseline is struck after the completion of this phase and the resolution of problems raised at the phase ending Software Critical Design Review (CDR). The software design baseline contains the detailed (code to) design for the software. The major new addition in this baseline is the software detailed design specification. It details the design of the CSCI's that will provide all the capabilities and meet the design constraints specified in the software allocated baseline. Software specifications include designs at a level and in a form such that unit design, coding, and testing can be performed. This specification identifies the modules that make up the CSCI's, the architecture of each module to the unit level, the module and unit interfaces, the data files to be used during the execution of the software, and the user interface. The updated contents of the allocated baseline are part of this baseline, in addition to more complete test and build plans.
The content of the software detailed design specification becomes a permanent part of following baselines. Many of the components of this baseline will be deliverable products. Any proposed change to this baseline will follow the change control process described in the Software Configuration Control within the SCM Process, Section III.
E. Software Implementation Phase
During the software implementation phase, the software is coded and unit tested. All documentation is produced in quasi-final form, including internal code documentation. At the end of the phase, all required products should be ready for delivery, subject to modification during integration and testing.
After the software components (units) have been coded and successfully passed unit test, they are transferred from the developers control to the provider CMO control and placed under configuration management in a program library.
At the end of this phase, the Code Baseline is struck. This is the first time that the code itself becomes part of a baseline. This baseline is normally an internal baseline, without delivery and review of products by the acquirer. This baseline is not created at a single event, but rather the code baselining occurs repeatedly throughout the coding process as each unit of code is inspected and unit tested. As each unit successfully passes its unit tests, it is placed under configuration control. When implementation of all units is complete, the baselined unit code is the basis for CSCI and system integration testing in the next phase.
F. Software Integration and Test Phase
The objectives of the software integration and test phase are to integrate the software units into a completed system, discover and correct any nonconformances, and prepare for the formal acceptance of the system. The phase ending review is the test readiness review, during which the developer provides to the acquirer evidence that the software system is ready for acceptance testing. During this phase, the test plan is executed, the documentation is updated and completed, and the products are finalized for delivery. The provider CMO will begin to prepare the Version Description Document (VDD).
The provider’s testing organization uses the code baseline, which should include baselined test plans, to test and integrate the CSCI’s and then to integrate them into a deliverable system.
After the controlled software components have been integrated and tested, the integrated software is placed under configuration management control in the program library. Once under control, the tested software can only be changed by an approved CR or as the result of a nonconformance (discrepancy) report that requires corrective action.
After the system testing has been completed and put under formal control, an FCA is performed to authenticate that the actual performance of the CSCIs complies with the requirements stated in the baselined software requirements document. This is accomplished by evaluating the test methods, procedures, reports, and other engineering and design documentation.
After the FCA has been successfully completed, a PCA is conducted to examine the as-built CSCIs against required deliverables, usually as defined in a contract deliverables requirements list (CDRL). The provider performs the PCA to ensure that all deliverable items are present and complete, and the system is ready to be turned over for acceptance testing by the acquirer or designated representative.
The phase ends with the Test Readiness Review (TRR). After resolution of any problems found during the TRR, the software product (or integrated) baseline is struck. This baseline contains the deliverable software and documents, updated to show as-built design. Along with the software, all other deliverable items, such as populated data bases and tables, computer installation procedures, and test beds are part of this baseline. The software is ready for system level integration testing and acceptance testing.
G. Software Acceptance and Delivery Phase
During the software acceptance and delivery phase, the formal acceptance procedures are carried out. As a minimum, there is a requirements-driven demonstration of the software to show that it meets those requirements. The process also may include acquirer tests, field usage, or other arrangements that are intended to assure that the software will function correctly in its intended environment. At the end of the phase, an FCA and PCA are completed and a software acceptance review is conducted. Their successful completion results in the establishment of the accepted or as-built baseline. Now the software is ready to be used for the purpose for which it was acquired.
During this phase, the software is still under configuration management control of the provider. The software and all documents that have been placed under configuration management can only be changed by the change request process and an approved CR.
At the successful completion of the acceptance process, the software and all associated data and documentation are turned over to the acquirer and are placed under acquirer’s CM control.
The software that is delivered is known as the accepted or as-built baseline.
H. Software Sustaining Engineering and Operations Phase
During this phase of the software life cycle, the software is used to achieve the intended objectives for which it was acquired. Corrections and modifications are made to the software to sustain its operational capabilities and to upgrade its capacity to support its users. Software changes may range in scope from simple corrective action up to major modifications that require
During this phase, the baselined operational software and all baselined documents are under strict configuration management control of the acquirer CMO. No baselined software and applicable documents can be changed without following the change request process, including CCB approval.
In the event that a major modification using the full life cycle process is necessary to implement an approved change, the same configuration management control processes as are applicable to a new development are applied by the acquirer and provider CMOs throughout the life cycle of the modification.
V. SCM IN OTHER LIFE CYCLES
In the previous parts of this guidebook, we have defined Software Configuration Management, defined the processes that make up SCM, and defined the baselines that are produced in the standard waterfall life cycle. In the real world, few software systems are produced by going once through the waterfall. Most systems are large enough that they have to be done piece by piece, with each piece being integrated and tested and then used as a basis for the next development phase. This is called phased development. There are a number of phased development variations on the basic waterfall life cycle. For example, development by builds usually involves completing the requirements analysis and the architectural design phases of the waterfall and the completing the PDR. The software is then divided into sections that contain groups of functions or sections of the architecture (usually the former). The detailed design, implementation, and integration and test of each functional section is then built sequentially. Development by builds allows each tested build to be used as a basis and test bed for the next set of builds. Development by builds is probably the most frequently used development life cycle. Please note that builds may be delivered to the acquirer for acceptance and use. If so, the process is termed "phased delivery", but differs in no fundamental way from the process where the builds are retained by the provider until the system is complete.
If less is known about the real world requirements for the delivered system, other phased development life cycles may be used. For example, an evolutionary model can be used when only a portion of the requirements can be defined well enough to justify developing software to meet them. In this case, it is known that other requirements exist, and work in gathering and understanding them may be ongoing, for example by development of prototypes. The inability to define the total set of requirements means that the total development life cycle must be repeated several times, with each pass through involving an additional set of requirements that have been defined sufficiently well that development can take place. In each requirements analysis phase and review, the new and changed requirements must be addressed and baselined. The subsequent phases of the development process must accommodate both the development of new designs and code and the modification of (potentially) significant parts of the existing code. The spiral model is an example of an evolutionary development process.
Once a software system enters operation, the SCM problem becomes much like the one described above. That is, there will be in existence a current version of the software that is being used for operations, previous versions that were used to produce products that may have been
distributed, and versions under development that fix problems and/or incorporate new
capabilities.
From the SCM point of view, the use of these multiple pass development life cycles does not
change the fundamental SCM processes as discussed in this guidebook. The four functions of
configuration identification, configuration control, configuration status accounting, and
configuration authentication still must be done. However, the actual application of SCM
becomes both more important and more difficult. Many versions of design and code, for
example, may exist at the same time and be used in different builds or versions of the software
system. Each version of the system and the changes incorporated in it will have to be controlled
and its configuration clearly known.
At each delivery of the system it is especially important to do a PCA, to ensure that the contents
of the delivered code, data, and documentation is the correct set that includes all of the items that
are intended. It is likely that revision of the contents of a version of the software system will be
made late in the development cycle, as lower priority functions (or those that have been difficult
to add) are postponed to later releases or builds, and changes or fixes that have risen in priority
are rushed into the release.
SCM on a large project with multiple releases does not change in nature, but becomes more
difficult to do correctly and consumes more resources. The rush to deliver a version must not
cause Configuration Management Control to be lost, or the confusion that will result will cost a
lot more to rectify that it would have cost to do it right.
VI. SCM ORGANIZATION AND
RELATIONSHIPS
A. SCM Structure
A software project’s configuration management structure has three major components.
First, there is a Configuration Management Officer (CMO), who is responsible for the operation
of the configuration management process and the maintenance of configuration control over the
evolving products. Second, there is a program library and librarian, who has control and custody
of all of the software products, both electronic and hard copy. Third, there is a Configuration
Control Board (CCB), which decides which suggested changes will actually be made.
The roles and responsibilities of each of these components of the CM system are discussed
below.
B. The Role and Responsibilities of the CMO
The Configuration Management Officer is the key individual in a project’s SCM system. The
CMO’s role begins with the development of a SCM plan for the project and the establishment of
a procedure that details each step in the SCM process. The CMO has to set up the program
library in a manner compatible with the project’s size and resources and establish the project’s
Change Request (CR) tracking data base. After these procedures and resources are in place, the CMO manages and operates the CM system.
Each CR initiated is sent to the CMO as the first step in the SCM process. The CMO receives the CR and reviews it for clarity and completeness. If the CMO determines that the CR is not complete, it is returned to the originator. The CMO reviews the suggested class of the change and assigns a working classification. The CMO then assigns the CR a unique identifier for tracking purposes and records information about the CR into the change request database.
At this point, an official, complete CR exists and begins its process through the SCM system according to the procedures established by the CMO. After each step in the process, the CR is returned to the CMO, who ensures that the actions have been completed and records its new status in the database. For example, the CR has to be routed to the proper individuals for assessment of its impact. After the assessment is complete, the CR is routed back to the CMO with the assessment report attached. The CMO will then change the status in the database to assessment complete, and add the CR to the agenda for a CCB meeting.
The CMO is the secretary for the project’s CCB, and is responsible for preparing and distributing its agendas and minutes and recording status of CRs that have been dispositioned by the CCB. The dispositioned items are acted upon by the CMO. The CMO sends rejected items back to the originator along with the CCB rationale for rejection. If the CCB feels that a CR needs further analysis, then the CMO sends it back to the analysts with the CCB’s questions attached. If the CCB deferred a CR, it must be filed, to be sent back to the board at the proper time. If an approved CR needs to be processed through higher level CCBs, the CMO is responsible for submitting the CR package to the next level CCB. Each of these actions requires the CMO to update the tracking database.
The CMO sends approved CRs to the development organization for action. After the change has been implemented (and tested, if the change was to code), the CMO updates the tracking database to show the status of the CR as closed.
The CMO is responsible for producing and distributing periodic CR database and individual product CR status reports. These reports keep everyone concerned informed as to the status of the proposed changes. The CMO is also responsible for management of the SCM library and for conducting functional and physical configuration audits.
C. The Role of the Program Librarian
The program librarian operates the program library to manage the baseline software, data, and documents. The librarian accepts documents, code, data files, and other components of baselines and puts them in secure storage. The librarian issues working copies to developers for authorized changes, and keeps records and historical copies of all versions of the components of baselines. He or she makes copies of baselined software for testing and distribution, and prepares version description documents.
The role of the program library and librarian includes the storage and control of both software and associated documentation. The program library must control hard copy documents, computer files, and the physical media on which the latter is stored. It will have to have a procedure for...
archiving old versions of the system, of controlling the current version, and of accepting from developers potential new versions which have to be verified. In addition, the program librarian often supports the CMO in the maintenance of records and the production of reports.
**D. Role of the Configuration Control Board**
The CCB provides a forum for the review and disposition of the proposed changes to baselined requirements, documentation, and software. The CCB is responsible for discussion of proposed changes and for voting or otherwise recommending to the CCB chair the disposition of those changes.
The CCB is a working group consisting of representatives from the various disciplines and organizations of the developing project. The exact number, skills, and level of management of the CCB participants will vary, depending upon the change request to be reviewed. The project manager or the senior manager of the organization is usually the CCB chairperson. The CMO prepares a review package for each CR, containing the change proposal, relevant documents, and the analysis by the developers, and sends it to the CCB members. The CMO, who is normally the CCB Secretary, prepares the meeting agendas and records the meeting minutes.
At a CCB meeting, each CR on the agenda is covered in turn. Each member discusses the pros and cons of accepting the CR from her/his point of view and within his/her area of expertise. However, the CCB chairperson is responsible for making the final decision. CCB members do not have "voting rights" and CCB decisions are not made by majority rule. CCB decisions are management decisions that include the expenditure of resources, and the decisions must be made by the responsible manager. However, the CCB chairperson should carefully weigh the advice of each member before making the decision.
**E. SCM Relationships**
The SCM structure has to interface with all of the other entities that make up the development project and with potential users of the system under development.
The SCM organization interfaces with project management to provide information and reports on the number and status of changes proposed to the software. The CMO will provide both routine reports and answer special requests for data. The CMO acts as the secretary for the CCB, which is made up of senior project managers. Most importantly, the CMO and the program librarian develop the Version Description Document (VDD) and the deliverable system, and certify to management, via the results of FCAs and PCAs, that the system is ready for delivery to the customer.
The SCM organization interfaces with the development organization both to accept CSCI components to become part of a new baseline or version and to provide to the developers authorized copies of existing products for updating in accordance with approved changes.
The testing organization is dependent on the SCM organization to provide copies of the proper version of all code and documents for the development of test plans and procedures and to use in executing tests.
The SCM organization interacts with QA both as an entity that is audited by QA, and as a participant with QA in the conduct of FCAs and PCAs. In many organizations, QA must be the final signoff before a product can be accepted from the development organization and included in the program library.
VII. GUIDANCE IN ADAPTING SCM TO A PROJECT
Plans for software configuration management and the structure and size of the organization needed to implement it should be influenced by the complexity of the software to be developed, the size of the project, and on the specific responsibilities assigned to the SCM organization. Resource needs will be influenced by the tools and computer resources available.
A. Project Size
A small project with a reasonable tool environment may well be able to assign all of the duties of the CMO and the program library to one individual. It may be able to use less formal procedures than a large project. The program library may be a series of files - a set of individual developer controlled files for writing and documenting software, a set of files that contains developed code that has been unit tested but is not yet integrated or baselined, the current baseline, and archive versions. The last three sets should not be able to be written to by anyone other than the program librarian.
Larger projects must have more formal procedures, especially for the CCB. There will be many changes suggested, and the burden of tracking all of them can be quite heavy. Large projects may set up a screening board, which recommends to the CCB the disposition of certain types of proposed changes. For example, a screening board might be set up to handle all user interface changes. For the type of changes delegated to the screening board, the procedure could be that the CCB will automatically accept the disposition of the screening board unless some CCB member wants a full discussion.
Another approach used by large projects is to set up sub-boards for a subset of the total project, for example, for one or more CSCIs. The CSCI board may have authority to accept changes, within certain resource limits, that do not affect the interfaces between CSCIs controlled by other sub-boards. The full CCB should review the dispositions of the sub-boards only if a CCB member feels the review is warranted.
B. Informal Controls
As the CM system is set up and operated, care needs to be taken not to impede development and testing while changes to the software system are being proposed, processed, and implemented. It is especially important that managers have an informal adaptation of the CM process to control changes to interim products while they are in development and use, but before they are part of a formal baseline. During this period, software developers can use the same types of baseline management to manage the new or changed products. For example, as the design at each level is documented, each informally proposed expansion, enhancement, or other change should be
examined for its impact. Working documents are modified to reflect all approved changes and the current status of approved design is made available to all participants. Informal records are kept to provide an audit trail as the design evolves. This sequence is likely to occur on an active and continuing basis as the design of the software is developed incrementally through more detailed levels. No formal paperwork is used, but adequate management control is exerted.
As another example, as units of code are unit tested, the development manager may need to control the changes made to those units that have completed unit testing so that related modules can use the tested modules in their own testing. No formal paperwork is needed at this stage, but lack of control will yield confusion and duplication of effort. Many managers put in place a multi-file program library system like that described above, with units progressing through the sets of files as testing progresses.
Use of the term "configuration management" to describe techniques for this type of informal control during development is common. This is often a source of confusion to software managers involved in a system development effort, since they may not distinguish between their need to control the changes made to products they are developing and the formal SCM that responds only to the official CCB. However, this type of informal control cannot substitute for the formal process needed to manage approved or completed products. It is a recommended augmentation to the more formal process.
C. SCM Resources
The level of SCM resource support required by the development project will vary dependent upon the life cycle phase. The Software Concept and Initiation Phase is usually the function of the acquirer, and begins with minimal SCM resources whose role is to develop an acquirer SCM plan and to develop provider SCM requirements. After selection of a provider, the provider’s resource needs will increase in successive life cycle phases as the requirement for SCM activities increases with the greatest needs occurring during system integration and test. The acquirer’s needs will also grow in order to process level one changes and to review level two changes, but will be much less than that of the provider. The acquirer’s greatest SCM resource needs will occur after acceptance of the software system.
The maximum need for provider and acquirer SCM resources will occur in a project that is using a phased delivery process (See section V). During delivery, there will be some versions of the software delivered and being maintained, some being tested, and others in development. These resource needs are critical - lack of adequate resources will result in an unacceptable situation. Either the project will relax its rules and allow changes to be made with no change control, or progress will be slowed by an inability to process changes in a timely manner. Adequacy of the SCM resources commensurate with the size and phasing of the development process is essential to the development of quality software and its delivery.
VIII. TOOLS AND TECHNIQUES
Many of the processes in SCM are labor intensive and involve considerable paperwork. Tools can be used to help alleviate some of the paperwork and to reduce the cost of SCM. Many tools are available from commercial and shareware developers, and some tools can be easily
developed using software normally available on personal computers or as part of the
development environment.
A set of tools that is simple to implement are those the program library uses as part of the
configuration management function to stage the sets of products. Baselined products can be kept
in a library (set of disk files) that only the librarian can write into. This allows the developers and
testers to get a copy of baselined documents, data, and code for modification and testing, but
does not allow them to change the baselined products. Often the library will be set up with
several stages of each product under control. There will be the current delivered version, the
version under test for the next delivery, a development version that includes tested units of the
version two steps away from delivery, and developer libraries of components not yet unit tested.
The version staging diagram, Figure 3, shows these libraries and the flow among them.
Another set of tools that are readily available or easily developed support the configuration status
accounting function. A simple data base will allow the entry of change requests (or at least
change request summary data), and the updating of the status of the change request as it flows
through the system. Informational reports can be generated from the data base to allow
submitters and project staff to know the status of a report at any time. The data base can be used
to record the version of the system to which a change is assigned and this information will
support the PCA/FCA activity.
High end tools are available that will record each version of each product, using a transaction
based scheme to note exactly what part of each product was changed by a CR. These tools record
the reason for each change, and may automatically generate CM reports and other such features.
It is important to provide a set of tools to support the SCM function on a project. Because SCM
must keep track of very detailed information, it is easy to make errors that can cause the project
rework and time lost due to confusion. The tool set chosen should be appropriate to the size and
structure of the development project. The same CM tools that are used by the provider should be
considered for use by the acquirer for the purpose of continuity and consistency throughout the
sustaining engineering and operations phase.
APPENDIX A
SUMMARY OF BASELINE CONTENTS
This appendix briefly lists the contents of each baseline established during the standard waterfall
life cycle. It summarizes information found in Section IV. In using this section it must be
remembered that the development of baselines is cumulative, that is, all of the contents of each
baseline are part of the next baseline, with updates as needed. Generally this appendix only lists
the additions to the baseline at the end of each phase.
**Initial Acquirer Baseline**
At the end of the software Concept and Initiation Phase, the Acquirer should establish an Initial
Acquirer's Baseline that contains:
- The project Software Management Plan (SMP)
• Procedures developed to carry out the SMP
• System level requirements passed to the provider
After a software provider is selected, selected provider plans may be added to this baseline (provider SCM plan, for example). Alternately, these plans may be under provider control.
**Software Requirements Baseline**
This baseline is established after the completion of the requirements analysis phase and the satisfactory resolution of issues raised at the phase ending Software Requirements Review (SRR). It should contain:
• The software requirements specification
• Interface requirements documents
In addition the following should be baselined at this time if not done at the time of agreement between the acquirer and provider:
• Software development plan
• Software assurance plan
• Software SCM plan
**Software Allocated Baseline**
This baseline is struck after the completion of this phase and the resolution of any problems raised at the Software Preliminary (Architectural) Design Review (PDR). The baseline contains all the updated documents from the Requirements baseline, along with the following:
• The architectural design specification
• Documents showing how the requirements are allocated to the design
• Also baselined at this time should be:
• Software build (or release) plan
• Software test plan (high level)
**Software Design Baseline**
This baseline is established at the completion of the CDR. It must contain all updated documents from the previous baselines and the software detailed design specification. In addition, the build and test plans begun during the requirements phase and included (at a high level) in the previous baseline should be completed and baselined at this time.
**Software Code Baseline**
This baseline is established at the end of the software implementation phase. It should include, in addition to the updated contents of the previous baseline, the following:
- The code itself
- Code level documentation
- Users Manuals
- Test Procedures for the I&T Phase
- Data needed for operation of the software
**Software Product Baseline**
This baseline is established at the completion of the Integration and Test Phase. The software is to be ready for acquirer acceptance testing and delivery. It should include, in addition to the updated contents of the previous baseline, the following:
- The tested code
- Final versions of all products and documents
**Software Accepted (As-Built) Baseline**
This baseline is established after the software has been accepted by the acquirer. It should contain updated versions of the items in the product baseline, with corrections for nonconformances found during the acceptance process.
**APPENDIX B**
**EXAMPLE CHANGE REQUEST FORM**
**APPENDIX C**
**ACRONYM AND ABBREVIATIONS**
CCB Configuration Control Board
CDR Critical Design Review
CDRL Contract Documentation Requirements List
CI Configuration Item
CM Configuration Management
CMO Configuration Management Officer
CR Change Request
CSCI Computer Software Configuration item
DID Data Item Description
FCA Functional Configuration Audit
NASA National Aeronautics and Space Administration
PCA Physical Configuration Audit
PDR Preliminary Design Review
QA Quality Assurance
RFP Request For Proposal
SCM Software Configuration Management
SCN Software Change Notice
SRR Software Requirements Review
TRR Test Readiness Review
VDD Version Description Document
Last revised: July 16, 1997
|
{"Source-Url": "https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19980228473.pdf", "len_cl100k_base": 13037, "olmocr-version": "0.1.48", "pdf-total-pages": 25, "total-fallback-pages": 0, "total-input-tokens": 50618, "total-output-tokens": 14108, "length": "2e13", "weborganizer": {"__label__adult": 0.00030541419982910156, "__label__art_design": 0.0002994537353515625, "__label__crime_law": 0.00030517578125, "__label__education_jobs": 0.0017261505126953125, "__label__entertainment": 5.316734313964844e-05, "__label__fashion_beauty": 0.00014984607696533203, "__label__finance_business": 0.0010042190551757812, "__label__food_dining": 0.0002105236053466797, "__label__games": 0.0006704330444335938, "__label__hardware": 0.0006680488586425781, "__label__health": 0.0002713203430175781, "__label__history": 0.00019550323486328125, "__label__home_hobbies": 8.690357208251953e-05, "__label__industrial": 0.0002739429473876953, "__label__literature": 0.0002598762512207031, "__label__politics": 0.00016629695892333984, "__label__religion": 0.0002446174621582031, "__label__science_tech": 0.005863189697265625, "__label__social_life": 6.461143493652344e-05, "__label__software": 0.00988006591796875, "__label__software_dev": 0.9765625, "__label__sports_fitness": 0.00021016597747802737, "__label__transportation": 0.0003628730773925781, "__label__travel": 0.00018227100372314453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 69498, 0.00272]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 69498, 0.50585]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 69498, 0.93434]], "google_gemma-3-12b-it_contains_pii": [[0, 1138, false], [1138, 4168, null], [4168, 7961, null], [7961, 11013, null], [11013, 13637, null], [13637, 16405, null], [16405, 18405, null], [18405, 21903, null], [21903, 25046, null], [25046, 28393, null], [28393, 30627, null], [30627, 33902, null], [33902, 37189, null], [37189, 40561, null], [40561, 43854, null], [43854, 47308, null], [47308, 50080, null], [50080, 53470, null], [53470, 56539, null], [56539, 59550, null], [59550, 62965, null], [62965, 66043, null], [66043, 67795, null], [67795, 69118, null], [69118, 69498, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1138, true], [1138, 4168, null], [4168, 7961, null], [7961, 11013, null], [11013, 13637, null], [13637, 16405, null], [16405, 18405, null], [18405, 21903, null], [21903, 25046, null], [25046, 28393, null], [28393, 30627, null], [30627, 33902, null], [33902, 37189, null], [37189, 40561, null], [40561, 43854, null], [43854, 47308, null], [47308, 50080, null], [50080, 53470, null], [53470, 56539, null], [56539, 59550, null], [59550, 62965, null], [62965, 66043, null], [66043, 67795, null], [67795, 69118, null], [69118, 69498, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 69498, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 69498, null]], "pdf_page_numbers": [[0, 1138, 1], [1138, 4168, 2], [4168, 7961, 3], [7961, 11013, 4], [11013, 13637, 5], [13637, 16405, 6], [16405, 18405, 7], [18405, 21903, 8], [21903, 25046, 9], [25046, 28393, 10], [28393, 30627, 11], [30627, 33902, 12], [33902, 37189, 13], [37189, 40561, 14], [40561, 43854, 15], [43854, 47308, 16], [47308, 50080, 17], [50080, 53470, 18], [53470, 56539, 19], [56539, 59550, 20], [59550, 62965, 21], [62965, 66043, 22], [66043, 67795, 23], [67795, 69118, 24], [69118, 69498, 25]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 69498, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
50f59a634d00b838358a4a1fd9fa5f8f7e0d761f
|
A computer-implemented system and method is disclosed for retrieving documents using context-dependant probabilistic modeling of words and documents. The present invention uses multiple overlapping vectors to represent each document. Each vector is centered on each of the words in the document and includes the local environment. The vectors are used to build probability models that are used for predictions of related documents and related keywords. The results of the statistical analysis are used for retrieving an indexed document, for extracting features from a document, or for finding a word within a document. The statistical evaluation is also used to evaluate the probability of relation between the key words appearing in the document and building a vocabulary of key words that are generally found together. The results of the analysis are stored in a repository. Searches of the data repository produce a list of related documents and a list of related terms. The user may select from the list of documents and/or from the list of related terms to refine the search and retrieve those documents which meet the search goal of the user with a minimum of extraneous data.
205 INPUT DOCUMENT/TEXT
210 GENERATE WINDOWS AROUND EACH WORD
215 PERFORM STATISTICAL EVALUATION OF ALL WINDOWS
220 COMBINE RESULTS
225 APPLY RESULTS TO MODEL
230 FIND PROBABILITIES
245 STORE IN INDEX
FIG. 3
405 INPUT QUERY
410 SEARCH INDEX FOR RELATED DOCUMENTS
415 SEARCH INDEX FOR RELATED TERMS
420 SORT BY RELEVANCE
425 PRESENT RESULTS TO USER
430 ADD TERMS TO SEARCH?
435 FIND RELATED DOCUMENTS?
440 RETRIEVE RELATED DOCUMENTS
445 DISPLAY DOCUMENTS
FIG. 5
SYSTEM AND METHOD OF FINDING DOCUMENTS RELATED TO OTHER DOCUMENTS AND OF FINDING RELATED WORDS IN RESPONSE TO A QUERY TO REFINE A SEARCH
PRIORITY CLAIM
This application claims the priority of co-pending U.S. patent application Ser. No. 09/851,675, filed on May 9, 2001, which is assigned to the same assignee as the present invention, and which is incorporated herein by reference.
FIELD OF THE INVENTION
This invention generally relates to the field of data and natural language processing, and particularly to a system and associated method for use with a search engine to search data maintained in databases that are linked together over an associated network such as the Internet. More specifically, this invention pertains to a computer software product for processing and retrieving natural language text using probabilistic modeling of words and documents to retrieve resources pertaining to the keywords and words related to the keywords within the context of a current information sphere.
BACKGROUND OF THE INVENTION
The World Wide Web (WWW) is comprised of an expansive network of interconnected computers upon which businesses, governments, groups, and individuals throughout the world maintain inter-linked computer files known as web pages. Users navigate these pages by means of computer software programs commonly known as Internet browsers. Due to the vast number of WWW sites, many web pages have a redundancy of information or share a strong likeness in either function or title. This has increased the need for data analysis systems that assist in the retrieval of information from large databases. The sheer size of such databases makes it difficult to avoid retrieving extraneous information.
In many conventional search and retrieval systems, the user formulates a search request but does not have access to the actual textual data so the user must guess at the proper request to obtain the desired data. One such conventional system for retrieving textual data is a keyword search system. A keyword search system requires the user to enter one or more keywords, and the system conducts a search of the database using these keywords.
If the user knows the exact keywords that will retrieve the desired data, then the keyword search may provide useful results. However, users do not necessarily know the exact keyword or combination of keywords that will produce the desired data. Even when the search and retrieval system retrieves the desired data, the system may also retrieve a large amount of extraneous data that happens to contain the keywords. The user must then sift through all of the extraneous data to find the desired information, typically a time-consuming process.
Another difficulty with conventional keyword based searches relates to the inherent properties of the human language. A keyword selected by the user may not match the words within the text, or may retrieve extraneous information because a user can choose different keywords to describe the same object. For example, one person may call a particular object a "bank" while another person may call the same object a "savings and loan institution."
In addition, the same word may have more than one distinct meaning depending on its context. Because the keyword does not convey information about the desired context of the word, the keyword "bank" may retrieve text about a riverbank and a savings bank when only articles about a savings bank are desirable.
To overcome these and other problems in searching large databases, considerable research has been done in the areas of statistical natural language processing, also referred to as "text Mining." This research has focused on the generation of simplified representations of documents to facilitate the ability to find desired information among a large number of documents.
One common simplification called a "bag of words" representation ignores the order of words within documents. Each document is represented as a vector consisting of the words in the document regardless of the order of their occurrence. However, this approach loses any information relating to the word context or word order. Therefore, the ability to discriminate desired information based on context and thus respond appropriately to keyword searches is also lost.
Other models have been developed for modeling language that account for sequences of words. However, such models are quite specialized and their implementation can become complicated. Consequently, these models are not very useful for general text mining of large databases or the Internet.
Thus, there is need for improved techniques to assist in searching large databases. To this end, there is also a need for improvements in statistical natural language processing that overcomes the disadvantages of search models used for general text modeling. Currently, models that account for word sequence to keep contextual information lose both search flexibility and the ability to quickly search large databases while the models that can easily and quickly search large databases lose contextual information. The need for such a system has heretofore remained unsatisfied.
SUMMARY OF THE INVENTION
The system and method of the present invention, for context-dependent probabilistic modeling of words and documents for information retrieval and text mining satisfy this need. The present system and method allow the retrieval of documents using context-dependent probabilistic modeling of words and documents. They provide a keyword search engine that is flexible, efficient, and return a minimum of duplicate or extraneous results to the search query.
By using context-dependent probabilistic modeling of words and documents, the system presents to the user a list of high-probability document matches based on the keyword entered by the user. In addition, the system presents a list of context words that can be selected to enhance the keyword search, providing a more efficient search for the user.
The system and method of the present invention use multiple overlapping vectors to represent each document. Each vector is centered on each of the words in the document and includes the word's local environment, i.e., the words that occur close to this word. The vectors are used to build probability models. Several such probability models are used to predict different output variables depending on the intended use of the system.
Context windows are created around each word in each document. The system and method then generate a statistical evaluation of the characteristics of each window. The results of the statistical evaluation are independent of the order of appearance of the words in the window. The statistical
evaluation includes the counting of the occurrences of particular words and particular documents and the tabulation of the totals of the counts. These values are used to create the vectors representing the document. Vectors are also created for related words within the document. By using the window to predict document occurrences, NEAR and ADJACENT operators often used to find relevant search results can be accommodated. For example, NEAR and ADJACENT operators are used in search engines by enclosing a phrase within quotes or connecting words with a dash. The window also is useful when trying to predict the center word from the surrounding words. Many words have multiple meanings, but in one particular context they are often used in one single way. The vectors are overlapping and each of them contributes their predictions of what their local environment indicates about the entire document and about related terms or keywords. The results of the statistical evaluation are combined such that one answer is provided for various document characterizations, such as text classification, feature extraction, finding related words, query expansion and more.
These results create a fast and efficient method for retrieving a document, extracting features from a document, or for finding a word within a document based on its resulting statistics. The model coefficients are stored together with the index terms. Document and keyword term ranking and lookup are performed concurrently.
The system and method of the present invention reduce the occurrence of non-content words found in the context of search words. The system multiplies the probability of a context word given with the search word with the probability of the search word given with the context word. This "two-way" probability provides a more robust search. For example, the word "value" is important to the word "of", but the word "of" is not important to the word "value", so the system eliminates the word "of" from the search results.
The probabilistic model used by the system of the present invention can be, for example, the Simple Bayes model, though other probabilistic models can alternatively be used. By compressing and storing the coefficients in a novel way resembling inverted indices, the system achieves high efficiency in responding to search queries. The model coefficients are stored together with the index terms such that ranking and lookup are performed concurrently. The system of the invention automatically removes or "prunes" less relevant terms to yield a scalable model.
BRIEF DESCRIPTION OF THE DRAWINGS
The various features of the present invention and the manner of attaining them will be described in greater detail with reference to the following description, claims, and drawings, wherein reference numerals are reused, where appropriate, to indicate a correspondence between the referenced items, and wherein:
FIG. 1 is a schematic illustration of an exemplary operating environment in which a context-dependent probabilistic modeling system of the present invention may be used;
FIG. 2 is a block diagram illustrating the main components of the context-dependent probabilistic modeling system of FIG. 1, shown including a probabilistic modeling module and a user interface;
FIG. 3 is a flow chart illustrating a process used by the context-dependent probabilistic modeling system of FIG. 2;
FIG. 4 illustrates an exemplary user interface of the context-dependent probabilistic modeling system of FIG. 2; and
FIG. 5 is a flow chart illustrating a process used by the context-dependent probabilistic modeling system of FIG. 2 in retrieving documents and related keywords according to the present invention.
DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS
The following definitions and explanations provide background information pertaining to the technical field of the present invention, and are intended to facilitate the understanding of the present invention without limiting its scope:
Crawler: A program that automatically explores the World Wide Web by retrieving a document and recursively retrieving some or all of the documents that are linked to it.
Internet: A collection of interconnected public and private computer networks that are linked together with routers by a set of standards protocols to form a global, distributed network.
Search engine: A remotely accessible World Wide Web tool that allows users to conduct keyword searches for information on the Internet.
Server: A software program or a computer that responds to requests from a web browser by returning ("serving") web documents.
URL (Uniform Resource Locator): A unique address that fully specifies the location of a content object on the Internet. The general format of a URL is protocol://server-address/path/file-name.
Web browser: A software program that allows users to request and read hypertext documents. The browser gives some means of viewing the contents of web documents and of navigating from one document to another.
Web document or page: A collection of data available on the World Wide Web and identified by a URL. In the simplest, most common case, a web page is a file written in HTML and stored on a web server.
FIG. 1 portrays the overall environment in which a context-dependent probabilistic modeling system according to the present invention may be used. The system includes a software or computer program product that is typically embedded within or installed on a host server. Alternatively, the system can be saved on a suitable storage medium such as a diskette, a CD, a hard drive, or like devices. While the system will be described in connection with the World Wide Web (WWW), the system may be used with a stand-alone database of documents or other text sources that may have been derived from the WWW and/or other sources.
The cloud-like communication network is comprised of communication lines and switches connecting servers such as servers to gateways such as gateway. The servers and the gateway provide the communication access to the Internet. Users, such as remote Internet users are represented by a variety of computers such as computers, and can query the host server for the desired information.
The host server is connected to the network via a communications link such as a telephone, cable, or satellite link. The servers can be connected via high speed Internet network lines to other computers and gateways. The servers provide access to stored information such as hypertext or web documents indicated generally at and. The hypertext documents most likely include embedded hypertext links to other locally stored pages, and hypertext links to other webs.
sites or documents 55, 60 that are stored by various web servers such as the server 27.
In operation, the system 10 generates multiple overlapping vectors for each document of interest. This document analysis may be performed in conjunction with a web crawler used by an Internet search engine, by the system 10 installed on a user’s computer as the user examines or reads documents, or for a database of documents or other text information.
Each vector is centered on each of the words in the document. Therefore, each window includes words that occur close to the particular word, its local environment. These vectors are referred to herein as context windows. The size of the environment is determined when the model is constructed. The order of the words within a local vector is ignored to allow for variations in grammatical styles.
Each document is represented by the system 10 as a collection of vectors. The system 10 uses these vectors to build probability models that are used for prediction. Several models may be used to predict different output variables depending on the intended use of the system. In a preferred embodiment, the occurrence, word, and category membership are modeled for the text. A preferred probabilistic model is Simple Bayes, with the understanding that other probabilistic models may also be used.
Since probabilistic models can be used in many different ways, various attributes can be predicted from the vectors. The resulting representation can be used for information retrieval, finding related words, feature extraction, categorization, category description, etc. The vectors overlap and each of them will contribute what their local environment says about the entire document. The predictions are pooled so that one answer is provided for, e.g., text classification, feature extraction, finding related words, query expansion, text classification, and others. In addition, vectors are created for each keyword in the document, building a relationship between keywords that link-like-terms together in the vocabulary of the system 10.
The probabilistic models used by the system 10 are conditional probabilities where the condition is given by words, or context windows. The context windows are constructed by taking the words around each word in a document. This is referred to herein as the environment.
A left parameter and a right parameter are used to control the size of the window. The order of the words within the window is ignored to allow for bad grammar (e.g., telephone transcripts) and varying writing styles. Duplicates are not removed. The word that the window is placed around is not included in the window in the preferred embodiment, but may be included for document and category models.
The Bayes’ Rule is described by the following equations:
\[
p(d | O) = \frac{P(O | d) p(d)}{p(O)} \tag{1}
\]
or
\[
p(d | O_1, \ldots, O_M) = \frac{P(O_1, \ldots , O_M | d) p(d)}{p(O_1, \ldots , O_M)} \tag{2}
\]
where \(d\) is the variable to be modeled, \(O = O_1, \ldots, O_M\) is the context window, and \(p(d)\) is the prior probability for variable \(d\). The users’ preferences can be encoded in this distribution such that documents or terms deemed more interesting will be favored as determined from prior usage of a retrieval system.
If a text (e.g., a document itself or a sentence) is used for search input, the system 10 creates context windows for the text. Each window is evaluated and the results may be combined as follows:
\[
p(d | T) = \frac{1}{|T|} \sum_{o \in T} p(d | o) \tag{3}
\]
where \(T\) is the set of windows created by the overlapping windows positioned over each word in the text. Averaging the probability assessments is preferred, but other combinations are also possible. Since the result is normalized, input length is taken into account. If the input context is smaller than the window size the models can be used directly since the result is equivalent.
The models used by the system 10 can predict the following three models:
- Document Model using model \(p(d | O)\) where the predicted variable \(d\) may or may not be appended with the specific context window number.
- Document Category Model using model \(p(c | O)\). The specific context window may also be included in this model.
- Word Model in the center of the environment using model \(p(O)\), where \(O\) is the context window.
These models will be now be examined individually. The Document Model uses a document identifier that is modeled from the context window, \(p(d | O)\). There are two uses for this model:
- To retrieve documents by evaluating \(p(d | O)\) with any context and finding the document I.D., \(d\), for which this quantity is maximized, and
- To extract document features when the formula is reversed so that the conditional probability of a word in a given document is evaluated. The words that have the largest \(p(O)\) values are features relevant to a particular document, \(d\).
The system 10 builds a word list where all of these words are collected forming a list of content words for each document in the document collection. This list is also used by the system 10 to “prune” the model, as described below.
In the Document Category Model the system 10 models categories similarly to documents, except there can be several categories per document. There are also two uses for this model:
- Categorization is performed by evaluating \(\arg \max p(c | O)\), and
- Description of a category is performed by evaluating the opposite, \(p(O | c)\), and finding words that are strongly associated with it.
The Word Model finds related words by evaluation of \(p(c | O)\), where \(c\) is the predicted center word of the context window. The top ranked related words describe the context in which a word occurs, creating a definition of a word. The system 10 performs query expansion by adding words to the keyword query that are related but not mentioned. This expanded query can be used in a regular search engine.
Due to the nature of language, many non-content words will be predicted when such a model is used, consequently it is better to use a list of features extracted for each document by the Document Model as described above. Use of the features list ensures that the system 10 only evaluates content words.
The system 10 uses these models in two additional ways. Documents can be summarized by first calculating the probability of each word in a document given the other words, finding the most informative words. Locating the most informative words leads to the most informative sentences and paragraphs, etc. These sentences and paragraphs are used to create summaries. The system 10 then combines queries and query results to form summaries that answer a specific question.
To implement the probability models of the system 10 there are several possibilities to model a joint or conditional probability distribution. The system 10 uses Simple Bayes and Mixture Models for two reasons. First, it is important to have a model that can be evaluated correctly even when input variables are missing. Second, models must be efficient in the high dimensionalities that arise from the use of words as variables.
A model is primarily used since the number of possible combinations of O’s members are 2^O-1; there is no way to sample them all in any type of text collection. The simplest model to use is Simple Bayes. There are several ways of defining Simple Bayes, two of which are defined herein. These definitions give rise to different formulations and it is useful to consider both. The first one is the “standard” formulation, and the second one is defined in terms of “mutual information”.
Simple Bayes standard formulation makes the assumption that words are independent given the class variable:
\[ p(o_1, \ldots, o_M | d) = \prod_{i=1}^{M} p(o_i | d). \]
This Simple Bayes assumption is unrealistic since words in an environment are in general not independent. Although this is the case, these types of models work well in practice and are a useful approximation. Combining equations (2) and (4) yields:
\[ p(d | o_1, \ldots, o_M) = \frac{\prod_{i=1}^{M} p(o_i | d)}{\prod_{i=1}^{M} p(o_i)}. \]
It is usually the case that \( P(o_1, \ldots, o_M) \) is fixed when evaluating \( p(d|o_1, \ldots, o_M) \) over all \( d \). It then becomes a normalizing factor since
\[ \sum_{d=1}^{D} p(d|o_1, \ldots, o_M) = 1. \]
Therefore,
\[ p(d | o_1, \ldots, o_M) \propto p(d) \prod_{i=1}^{M} p(o_i | d). \]
These probabilities are estimated by counters as described below. For computational reasons it is often useful to write this in logarithmic form:
\[ \log p(d | o_1, \ldots, o_M) \propto \log p(d) + \sum_{i=1}^{M} \log p(o_i | d). \]
This equation shows that a term for each document is added to a term for the conditional probability. These terms have a limited range since they are logarithms. The system 10 stores the rounded integer value of these terms together with the terms in an inverted index-like file. Each entry in the database for a particular term is a list of documents where the term occurs together with the log-term above.
The system 10 also uses an alternate representation of Simple Bayes involving “mutual information”. Further assuming, in addition to Equation (4), that the following equation is also valid:
\[ p(o_1, \ldots, o_M) = \prod_{i=1}^{M} p(o_i). \]
The conditional probability can then be written as:
\[ p(o_1, \ldots, o_M | d) = \prod_{i=1}^{M} \frac{p(o_i | d)}{p(o_i)}. \]
\[ p(\omega_1, \ldots, o_M) = p(\omega_1) \cdots p(\omega_M). \]
such that \( p(\omega_1, d)/p(\omega_1) \) is the same as \( p(\omega_1, d)/(p(\omega_1)p(d)) \). Mutual Information, \( M_{x,y} \), sometimes called Point-wise Mutual Information, is found by taking the logarithm of the conditional probability calculated in Equation 9. Mutual Information is defined between variables x and y as:
\[ M_{x,y} = \log \frac{p(x,y)}{p(x)p(y)} = \log \frac{p(x)p(y)}{p(x,y)} = \log \frac{p(x|y)p(y)}{p(x)p(y)}. \]
Defining \( B_d = \log p(d), \) it is possible to rewrite the logarithm of Equation (2) as:
\[ \log p(d | o_1, \ldots, o_M) = B_d + \sum_{i=1}^{M} M_{o_i,d}. \]
The conditional probability can thus be modeled as a sum of the pair-wise mutual information values. The \( B \) terms are bias values that are modified by the pair-wise correlation, as measured by Mutual Information. Mutual Information is also useful for correlation such as word sense disambiguation.
The B-term is a “bias” value that indicates how common a word is in the entire collection, the prior probability. The most common combinations include unimportant words such as “the”, etc. Consequently, “uninteresting” combina-
tions have values close to one. The system 10 uses this fact to reduce or “prune” the number of combinations that need to be stored.
The two Simple Bayes models both add values to the B-term, or bias. Some of the added values are small and can be removed or pruned from the model. A maximum threshold for the B-term is selected for the system 10 and all values below that threshold are removed for the standard case. In other cases, all pairs with an absolute value of the mutual information or logarithm of the conditional probability below a threshold are removed.
In general, it should be necessary to prune only the word prediction model since the other models do not grow to the same sizes. The pruning is performed periodically as the pair-wise counters increase. The system 10 can determine when pruning is necessary by monitoring how much memory is used for storage. Since the system 10 periodically performs the pruning task, the number of pairs will fluctuate. Some pairs that have disappeared can reappear at a later stage if they become more prevalent in subsequent documents.
The Simple Bayes probability estimates are determined through counts in accordance with the system 10. Let $c_i$ be the number of times word $i$ occurs and $c_{ij}$ be the number of times the pair of $i$ and $j$ occur. There are $N$ words in total. The relevant probabilities are:
\[
p(y) = \frac{c_y}{N} \tag{12}
\]
\[
p(x, y) = \frac{c_{xy}}{N} \tag{13}
\]
\[
p(y | x) = \frac{c_{xy}}{c_x} \tag{14}
\]
\[
p(y | x) = \frac{c_{xy}N}{c_x y} \tag{15}
\]
Mutual Information is determined as:
\[
\log p(y) = \log p(c_y + 1) - \log(N + U) \tag{24}
\]
\[
\log p(x, y) = \log p(c_{xy} + 1) - \log(N + U) \tag{25}
\]
\[
\log p(y | x) = \log p(c_{xy} + 1) - \log(c_x + 1) \tag{26}
\]
\[
\log \frac{p(y | x)}{p(y)} = \log(c_{xy} + 1) + \log(N + U) - \log(c_x + 1) \tag{27}
\]
These adaptations yield a very robust estimate.
The number of counts, $c_i$, and $c_{xy}$ that need to be stored can be calculated. The number of singular counters, $c_i$, needed is the same as the number of unique output variables, i.e., the number of documents, categories or words. The number of pairs $c_{xy}$ are determined by considering two factors. First, as for the singular counter, the number of pairs needed is the same as the number of unique output variables. The second factor is the number of unique pair combinations in a window and with an output variable. This will be less than the number of unique words.
A similar probability model is built for a word being predicted by its surrounding words. The same context windows as described previously are used but instead of predicting the document, the system 10 predicts the word in the center of the context window. This allows the system 10 to store and retrieve words relevant to the keyword entered in the search query.
FIG. 2 illustrates a high level architecture showing the system 10 used in the context of an Internet search. The system 10 includes a probabilistic modeling module 100 and a search and retrieval module 105. The probabilistic modeling module 100 analyzes word content and context for text documents. This document analysis may be performed in conjunction with a web crawler used by an Internet search engine. It may also be performed as the user examines or reads documents by the system 10 which may be installed on a server 15 (FIG. 1), or on a user’s computer.
The document characteristics, features, keywords and other specifics are stored in a file-like database, the model coefficient and index repository 110. In one embodiment of the invention, the user accesses the system 10 through a browser interface 115. Keyword search queries are submitted to the search service provider 120. The search and retrieval module 105 retrieves the documents and keywords with the highest probability of matching the user’s inquiry.
FIG. 3 is a flow chart illustrating the performance of the probabilistic modeling module 100. A text is first input into the probabilistic modeling module 100 at step 205. A set of windows is generated around each word in the document, as indicated at step 210. A statistical evaluation of all the windows and documents is then performed, at step 215. This will include collecting statistical counts of each element in the windows as well as the each pair-wise counts, in the example described below. The order of the words within each window is not considered, only the words themselves...
and the counts of the numbers of each word present. The center word within each window is not contained in the window and the window may be symmetric or asymmetric in size around the center word.
The probabilistic modeling module 100 then combines the results at step 220. An appropriate statistical model, such as Simple Bayes, is generated and applied to the combined results in steps 225 and 230. The probabilistic modeling module 100 then calculates the coefficients Bd, Moi, d, of equation (11) based on the counts, using equations (10) and (10A), either (12) or (20), and either (15) or (23). The coefficients B,Mo, for the document and keyword analysis are stored in the model coefficient and index repository 110 at step 245.
A specific example of the use of the context-dependent probabilistic modeling techniques of step 210 and 215 of FIG. 3 is illustrated as follows. Table 1 below shows an example of two documents, Document 1 and Document 2, each of which containing five words. The task of the model is to associate the windows with the documents. This model is useful for document retrieval and feature extraction. In this case the specific context window membership is not modeled to simplify the presentation.
### Table 1
<table>
<thead>
<tr>
<th>Two example documents, each containing five words.</th>
</tr>
</thead>
<tbody>
<tr>
<td>Document 1</td>
</tr>
<tr>
<td>Document 2</td>
</tr>
</tbody>
</table>
Overlapping windows are created around each word in the documents (step 210). In this example, the window size is minus 2 words to plus 2 words around each word. All possible windows for documents 1 and 2 are shown in Table 2. Statistics about singular word occurrences and pairs are then collected (step 215). In particular, for each window and variable where the variable is the document number:
1. statistics are collected for each variable; and
2. pair-wise statistics are collected for variables and each element in the window.
### Table 2
<table>
<thead>
<tr>
<th>Possible windows for the words in documents 1 and 2 of Table 1.</th>
</tr>
</thead>
<tbody>
<tr>
<td>Document</td>
</tr>
<tr>
<td>----------</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>2</td>
</tr>
</tbody>
</table>
### Table 3
<table>
<thead>
<tr>
<th>Statistics collected for words in documents 1 and 2 of Table 1.</th>
</tr>
</thead>
<tbody>
<tr>
<td>Window</td>
</tr>
<tr>
<td>--------</td>
</tr>
<tr>
<td>Document 1</td>
</tr>
<tr>
<td>Document 2</td>
</tr>
</tbody>
</table>
### Table 4
<table>
<thead>
<tr>
<th>Pair-wise counts for words related to document number for document 1 and 2 of Table 1.</th>
</tr>
</thead>
<tbody>
<tr>
<td>Pair</td>
</tr>
<tr>
<td>------</td>
</tr>
<tr>
<td>1-the</td>
</tr>
<tr>
<td>1quick</td>
</tr>
<tr>
<td>1brown</td>
</tr>
<tr>
<td>1fox</td>
</tr>
<tr>
<td>1slyly</td>
</tr>
<tr>
<td>2jumped</td>
</tr>
<tr>
<td>2over</td>
</tr>
<tr>
<td>2the</td>
</tr>
<tr>
<td>2lazy</td>
</tr>
<tr>
<td>2dog</td>
</tr>
</tbody>
</table>
Using the results from the counters shown in Tables 3 and 4, the probabilities can be determined as in step 230 of FIG. 3. The probabilities for any document can be estimated given a number of words, i.e. \( p(w_1, \ldots, w_n) \). In particular, probabilities are estimated by dividing by N such that \( p(x) = C(x)/N \), where \( C(x) \) is the number of times \( x \) occurs. For example, \( p(fox) = 3/28 = 0.1071 \). Better estimates for probability are possible using EQU 20-23 such that \( p(fox) \) is estimated as \((3+1)/(28+11) = 0.1026\).
The system 10 estimates conditional probabilities \( p(xy) \) as \( C(x,y)/C(x) \). Therefore, \( p(brown) \) is \( C(1,brown)/C(1) \). For example, \( p(1brown) \) is the probability of finding document "1" if the search word is "brown". Thus \( p(1)+p(brown) \)/p(brown)\( =5/28+3/5\) = 0.38. Similarly, for document 2: \( p(2brown) = 5/28+0/3 \) = 0.18. Since this model is an approximation, the values don’t sum to 1. Normalization is done so that \( p(1brown)+p(2brown) = 1 \). Consequently, it is more likely that the document is "1" than "2" if the word is brown. These are the probability characteristics used to categorize the document and determine relative terms in step 230 of FIG. 3.
In order to speed up retrieval of documents and related words in the system a specific database format can be used. To find the conditional probabilities of a word that is related to other words, e.g., a query, the words that are related to the query words must be known using the probability model. A list of the words that are related to each other word are stored in the same record. When a word is retrieved from the database then all relative words are retrieved.
These are the pairs that arise from Equations 9 and 11. Since system 10 requires the B and M values of EQUATION 11, these values are stored next to a reference to each word in the database record. For a document retrieval model, the system 10 stores the document identifiers that are related to each word. Using the documents in Table 1 as an example, system 10 in step 245 of FIG. 3 creates the database records shown in Table 5.
### TABLE 5
<table>
<thead>
<tr>
<th>Key</th>
<th>Record</th>
</tr>
</thead>
<tbody>
<tr>
<td>the</td>
<td>B(the), D1, M(the, D1), D2, M(the, D2)</td>
</tr>
<tr>
<td>quick</td>
<td>B(quick), D1, M(quick, D1)</td>
</tr>
</tbody>
</table>
B(the) is the bias value for the word “the” and M(the, D1) is the mutual information value for “the” and document D1. The system 10 uses the same storage method for the model for related words.
In operation, and with further reference to FIGS. 2 and 5, a user interface 305 for system 10 is shown in FIG. 4. The user enters in step 405 a search query into the search entry field 310. The user then clicks the search button 315 with the mouse or other entry device of the computer to initiate a search of the model coefficient and index repository 110.
The search and retrieval module 105 searches the model coefficient and index repository 110 at step 410 for documents related to the query in character, feature, or keyword. The search and retrieval module 105 also searches the model coefficient and index repository 110 at step 415 for words that appear in conjunction with the keyword entered in the search entry field 310. The related documents and keywords are sorted by relevance in step 420 and displayed to the user at step 425.
Titles for related documents are displayed in the document list 320 while related keywords are displayed in the related terms list 325. The actual probability of a match is shown to the left of the document title in the document list 320 where * is a value between 0-0.2, ** is a value between 0.2-0.4, etc. To the right of the document title is a normalized probability where all values are divided by the probability of the highest ranked document. The checkbox 330 to the right of the document title is used to find related documents.
The boxes to the left of the words in the related keyword list allow the user to select additional keywords for search in step 430. Selecting the field or box to the far left of each related term would include that word for the next search; the field or box immediately left of the related term would exclude that word for the search. If additional keywords are selected, the user can press the search button 315 and perform a more refined search by returning to step 410 with the additional keywords added to the original query. The keywords in the related terms list 325 are listed in decreasing order as follows:
\[
p_w(w) = \prod_p p_q(w_i | w) = \prod_p p(w | q).
\]
3. The method of claim 2, wherein searching for related terms comprises search an index of terms that appear in conjunction with the one or more known terms in the query.
4. The method of claim 2, wherein searching for related terms comprises searching the first set of related documents for related terms that are relevant to the one or more terms in the query.
5. The method of claim 1, further comprising selecting the search terms.
6. The method of claim 5, wherein selecting the search terms comprises checking selection boxes corresponding to the search terms.
7. The method of claim 1, wherein searching for the related terms comprises using a predetermined probability model.
8. The method of claim 7, wherein using the probability model comprises calculating Mutual Information and bias coefficients.
9. The method of claim 8, wherein calculating Mutual Information and bias coefficients comprises modeling conditional probability as a sum of the pair-wise mutual information values.
10. The method of claim 1, further comprising retrieving the first set of related documents.
11. The method of claim 1, further comprising retrieving the second set of related documents.
12. A computer program having program codes stored on a computer-readable medium for finding related documents within a set of documents in response to a query containing search terms, comprising:
a program code for generating overlapping vectors to represent a document in the set of documents, wherein each vector is centered on each word in the document and represents a local environment for said each word; wherein said each word around which a vector is generated is excluded from the local environment for said each word;
a program code for using vectors generated for the set of documents to build context-dependent probability models based on a statistical analysis for predicting related documents and related terms;
based on the query, a program code searches for related documents that are relevant to the search terms in the query;
a program code for automatically searching for related terms that are relevant to the search terms in the query; and
a program code for using the related terms to automatically search for additional documents that are relevant to the related terms.
13. The computer program of claim 12, wherein the program code for searching for the related documents that are relevant to the search terms in the query, searches within an index of documents.
14. The computer program of claim 13, wherein the program code for searching for the related terms that are relevant to the search terms in the query, searches an index of terms that appear in conjunction with the search terms in the query.
15. The computer program of claim 12, wherein the program code for searching for the related terms that are relevant to the search terms in the query, searches for the related terms by using a predetermined probability model.
16. The computer program of claim 15, wherein the probability model calculates Mutual Information and bias coefficients.
17. The computer program of claim 16, wherein the Mutual Information and bias coefficients are modeled as a sum of the pair-wise mutual information values.
18. A processor-implemented system for finding related documents within a set of documents in response to a query containing search terms, comprising:
a probabilistic modeling module for generating overlapping vectors to represent a document in the set of documents, wherein each vector is centered on each word in the document and represents a local environment for said each word; wherein said each word around which a vector is generated is excluded from the local environment for said each word;
the probabilistic modeling module further using vectors generated for the set of documents to build context-dependent probability models based on a statistical analysis for predicting related documents and related terms;
based on the query and using the probability models, a search module automatically searching for related documents that are relevant to the search terms in the query;
using the probability models, the search module further automatically searching for related terms that are relevant to the search terms in the query; and
the search module uses the related terms for automatically searching for additional documents that are relevant to the related terms.
* * * * *
It is certified that error appears in the above-identified patent and that said Letters Patent is hereby corrected as shown below:
On the front page, please insert:
--Related U.S. Application Data
(63) Continuation-in-part of Application Serial No. 09/851,675, filed on May 9, 2001, now U.S. Patent 6,925,433.--.
In column 1, line 9, under PRIORITY CLAIM, “claims the priority of co-pending U.S.” should read --claims priority as a continuation-in-part under 35 U.S.C. § 120 of co-pending U.S.--.
Signed and Sealed this Twelfth Day of July, 2011
[Signature]
David J. Kappos
Director of the United States Patent and Trademark Office
|
{"Source-Url": "https://patentimages.storage.googleapis.com/5f/80/19/9a23e205ec68bf/US7269546.pdf", "len_cl100k_base": 9551, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 21277, "total-output-tokens": 10426, "length": "2e13", "weborganizer": {"__label__adult": 0.0003647804260253906, "__label__art_design": 0.0005841255187988281, "__label__crime_law": 0.0016527175903320312, "__label__education_jobs": 0.0022716522216796875, "__label__entertainment": 0.0002117156982421875, "__label__fashion_beauty": 0.00020205974578857425, "__label__finance_business": 0.002780914306640625, "__label__food_dining": 0.0003871917724609375, "__label__games": 0.0011157989501953125, "__label__hardware": 0.003215789794921875, "__label__health": 0.0005345344543457031, "__label__history": 0.00039315223693847656, "__label__home_hobbies": 0.00014495849609375, "__label__industrial": 0.0006303787231445312, "__label__literature": 0.0009388923645019532, "__label__politics": 0.00040030479431152344, "__label__religion": 0.00035309791564941406, "__label__science_tech": 0.1966552734375, "__label__social_life": 0.00010520219802856444, "__label__software": 0.212646484375, "__label__software_dev": 0.57373046875, "__label__sports_fitness": 0.00016748905181884766, "__label__transportation": 0.0004901885986328125, "__label__travel": 0.000202178955078125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 43196, 0.02918]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 43196, 0.73245]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 43196, 0.89882]], "google_gemma-3-12b-it_contains_pii": [[0, 1184, false], [1184, 1184, null], [1184, 1184, null], [1184, 1399, null], [1399, 1399, null], [1399, 1661, null], [1661, 8396, null], [8396, 15107, null], [15107, 21418, null], [21418, 25854, null], [25854, 30333, null], [30333, 34831, null], [34831, 38158, null], [38158, 42558, null], [42558, 43196, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1184, true], [1184, 1184, null], [1184, 1184, null], [1184, 1399, null], [1399, 1399, null], [1399, 1661, null], [1661, 8396, null], [8396, 15107, null], [15107, 21418, null], [21418, 25854, null], [25854, 30333, null], [30333, 34831, null], [34831, 38158, null], [38158, 42558, null], [42558, 43196, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 43196, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 43196, null]], "pdf_page_numbers": [[0, 1184, 1], [1184, 1184, 2], [1184, 1184, 3], [1184, 1399, 4], [1399, 1399, 5], [1399, 1661, 6], [1661, 8396, 7], [8396, 15107, 8], [15107, 21418, 9], [21418, 25854, 10], [25854, 30333, 11], [30333, 34831, 12], [34831, 38158, 13], [38158, 42558, 14], [42558, 43196, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 43196, 0.16342]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
0fa3b7d4565172af5a6e7b36e09bb9f5fb15848f
|
Generic Attribute Grammars
João Saraiva\(^1\)\(^2\) and Doaitse Swierstra\(^2\)
\(^1\) Department of Computer Science, University of Minho, Campus de Gualtar, 4700 Braga, Portugal
\(\text{jas@di.uminho.pt}\)
\(^2\) Department of Computer Science, University of Utrecht, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
\(\text{swierstra@cs.uu.nl}\)
Abstract
This paper introduces generic attribute grammars which provide support for genericity, reusability and modularity in attribute grammars. A generic attribute grammar is a component that is easily reused, composed and understood. Attribute grammar based systems may be constructed out of a set of generic components, that can be analysed and compiled separately. We show how to generate deforested attribute evaluators for those components. As a result, redundant intermediate data structures used to glue different components are eliminated.
1. Motivation
Recent developments in modern programming languages are providing powerful mechanisms like modularity and polymorphic type systems for abstracting from computations and for structuring programs. Modern applications are nowadays designed and implemented as combinations of several generic components, all physically and conceptually separated from each other. The benefits of such an organization are ease of specification, clearness of description, interchangeability between different “plug-compatible” components, reuse of components across applications and separate analysis/compilation of components.
Consider for example the construction of a compiler for a particular language. Such a compiler may be constructed out of a set of generic components, each of which describes a particular subproblem such as name analysis, type checking, register allocation, etc. Furthermore, each component may describe the properties of a subproblem for a large number of languages and not just for the language at hand: a single component may describe the name analysis task for block structured languages. Thus, this “off the shelf” component can be re-used across applications.
Generally, those components are combined by introducing intermediate data structures that act as the glue, binding the components of the application together: a component constructs (produces) an intermediate data structure which is used (consumed) by other components. In a compiler setting the intermediate structure is the abstract syntax tree which glue the compiler task components. Increasing the number of components means simpler and more modular and maintainable code, whereas decreasing the number of components leads to greater runtime efficiency since fewer intermediate data structures have to be used. The long-sought solution to this tension between modularity and reuse on the one hand, and efficiency on the other, is to increase the amount of analysis and program transformation the compiler is performing so that the programmer may write programs as a set of components, confident that the compiler can fuse the components together, removing redundant intermediate data structures.
Attribute Grammars (Ag) can be split into components in several ways: (a) The components are the non-terminal symbols of the grammar with the associated productions and semantic rules, (b) The components are formed by the different productions associated with specific non-terminal symbols, (c) The components are the semantic domains which are used in the overall computation. For realistic Ags, however, the first two syntactic approaches lead to huge monolithic Ags that are difficult to write and understand since related properties are described in different components, but can only be understood together. A more general and efficient form of modularity is achieved when each semantic domain is encapsulated in a single component [Kas91, Hen93, FMY92, LJPR93, KW94, SA98]. Traditional Ag systems based on such modular descriptions first construct the equivalent monolithic Ag and only then produce an implementation for such Ag. We call this syntactic compositionality. A major disadvantage of this approach is that a single change in one component can render the entire evaluator invalid. Thus the support for separate analysis and compilation of components, as provided by modern programming languages, is sought. In this way we aim at semantic compositionality.
This paper introduces Generic Attribute Grammars (GENAg), which provide a support for genericity, reusability and modularity in the context of attribute grammar based systems. A generic attribute grammar is a component which is designed to be easily reused, composed and understood. A generic attribute grammar describes a generic property of an abstract language and has the following properties:
- In a generic attribute grammar some (non-)terminal symbols, from now on called generic symbols, may not be defined within the grammar component, and thus are considered as a parameter of the grammar. In other words, generic attribute grammars have “gaps” which are filled later.
- From a generic attribute grammar a generic attribute evaluator is derived. In our implementation model a generic evaluator is a purely functional, data type free attribute evaluator as defined in [SS99]. As we will see it is this absence of any explicit data type definitions that makes the evaluators (and the grammars) highly modular and reusable.
- In a generic attribute grammar the productions of a non-terminal symbol may be distributed by different GENAg components. Such components can be analysed and compiled separately, thus giving the sought semantic compositionality.
- A generic attribute grammar can be parameterized with the semantic functions used to compute attribute values.
- Furthermore, deforested evaluators are used in order to remove redundant intermediate data structures which glue the different components of a GENAg system.
In section 2 we introduce generic attribute grammars and we define a formalism to denote them. We also discuss the circularity of GENAgs and introduce flow types. In section 3 generic attribute evaluators are presented. Section 4 discusses the semantic compositionality of GENAgs. Section 5 briefly compares our approach to related work and describes the current implementation. Section 6 contains the conclusions.
2. Generic Attribute Grammars
This section introduces generic attribute grammars.
Definition 1 (Generic Context Free Grammar) A generic context free grammar (GCFG) is a triple \( gg = (V, P, S) \). \( V = (\Sigma \cup N \cup \mathcal{G}) \) is the vocabulary, a finite non-empty set of grammar symbols.
\( \Sigma \) is the alphabet, i.e. the set of terminal symbols and \( N \) is the non-empty set of non-terminal symbols. \( G \) is a finite set of generic symbols. \( P \subseteq N \times V^* \) is a finite set of productions. \( S \in (N \cup G) \) is the start symbol.
A generic symbol is a grammar symbol for which there are no productions. As we will explain later, a generic symbol can be the root symbol. We denote a generic symbol \( G \in G \) by \( \mathcal{G} \). A production \( p \in P \) is represented as \( X_0 \rightarrow P (X_1 X_2 \cdots X_n) \). Non-terminal \( X_0 \) is called the left-hand side non-terminal or father of \( p \) and \( X_1 X_2 \cdots X_n \) are the right-hand side symbols or children of \( p \).
A generic context free grammar is complete if every non-terminal symbol is accessible from the start symbol and can derive a sequence of grammar symbols which contains terminal and generic symbols only. That is, it does not contain any non-terminal symbol.
**Definition 2 (Complete Generic Context Free Grammar)** A generic context free grammar \( gg = (V, P, S) \) is complete iff:
\[
\forall X \in N \exists \mu, \nu, \delta \in (\Sigma \cup G) : S \Rightarrow^* \mu X \nu \Rightarrow^* \delta
\]
A complete \( \mathcal{G}_{CFL} \) defines a generic abstract syntax tree. A generic abstract syntax tree contains normal leaves and generic leaves, the latter being labelled with a generic symbol.
**Definition 3 (Generic Abstract Syntax Tree)** For every production of the form \( X \rightarrow C Y_1 \cdots Y_n \) of a complete generic context free grammar there is a Generic Abstract Syntax Tree (GAST) labelled \( X \) with subtrees \( T_1, \ldots, T_n \) (in that order), where:
- \( T_i \) is a normal leaf labelled \( Y_i \in \Sigma \).
- \( T_i \) is a generic leaf labelled \( Y_i \in G \).
- \( T_i \) is a generic abstract syntax tree \( Y_i \in N \).
A Generic Attribute Grammar is based on a generic context free grammar that is augmented with attributes, attribute equations and semantic functions.
**Definition 4 (Generic Attribute Grammar)** A generic attribute grammar is a quadruple \( g = (gg, A, E, F) \) where:
- \( gg = (V, P, S) \) is a generic context free grammar.
- \( A \) is a finite set of attributes, partitioned into sets \( A_{non}(n), A_{gen}(g) \text{ and } A_{oc}(p) \) for each \( n \in N \), \( g \in G \) and \( p \in P \). \( A_{non}(n) \text{ and } A_{gen}(g) \) are further partitioned into sets \( A_{inh}(n), A_{syn}(n) \text{ and } A_{inh}(g), A_{syn}(g) \), respectively.
- \( E = \bigcup_{p \in P} E(p) \) is a finite set of attribute equations.
- \( F \subseteq E \) is a finite set of generic semantic functions.
\( \mathcal{P} = \mathcal{G} \cup \mathcal{F} \) is the set of static parameters of the generic attribute grammar.
We say that a generic attribute grammar is complete if its underlying context-free grammar is complete and if every local and every output attribute occurrence of a production has at least one defining equation and no two equations have the same target. The set of output attribute occurrences of a production \( p \) contains the synthesized attribute occurrences of the father and the inherited attribute occurrences of the children.
Completeness alone does not guarantee that all the attributes of a generic abstract syntax tree are effectively computable: circular dependencies may occur. Circularities will be discussed in section 2.2. However, if circularities do not occur for any derivable tree, the generic attribute grammar is called well-defined. That is, for each generic abstract syntax tree of a GEN\( \text{AG} \) all the attribute instances are effectively computable.
The traditional definition of well-defined attribute grammars assumes that the synthesized attributes of terminal symbols are defined by an external module: the lexical analyser [Pan95]. In our definition of well-defined generic attribute grammar we make a similar assumption, that is, the synthesized attributes of the generic symbols are defined by an external module: an external generic attribute grammar. Thus, the attribute equations defining the synthesized attributes of a generic symbol are not included in the GEN\( \text{AG} \) which uses such generic symbol.
### 2.1. Generic Attribute Grammar Specifications
This section describes our notation for generic attribute grammars. We use a standard attribute grammar notation: Productions are labelled with a name for future references. Within the attribution rules of a production, different occurrences of the same symbol are denoted by distinct subscripts. Inherited (synthesized) attributes are denoted with the down (up) arrow \( \downarrow (\uparrow) \). The attribution rules are written as HASKELL-like expressions.
We extend this \( \text{AG} \) notation with two new constructs: Symbols and Functions. The former defines the set of generic symbols used by the GEN\( \text{AG} \). The latter defines the set of generic semantic functions used by the GEN\( \text{AG} \). For each generic symbol we define also its set of inherited and synthesized attributes.
Consider a generic attribute grammar \( \text{AG}_1 \) rooted \( R \). Suppose that this grammar has a generic symbol \( X \in \mathcal{G} \), with \( A_{en}(X) = \{ \text{inh}1, \text{syn}1, \text{syn}2 \} \) that is partitioned into the set of inherited attributes \( A_{inh}(X) = \{ \text{inh}1 \} \) and the set of synthesized attributes \( A_{syn}(X) = \{ \text{syn}1, \text{syn}2 \} \). We use the following notation to denote this set:
\[
\text{Symbols} = \{ X < \downarrow \text{inh}1, \uparrow \text{syn}1, \uparrow \text{syn}2 \} \]
Consider also that \( \text{AG}_1 \) has a generic function \( f \in \mathcal{F} \) that is used to define an occurrence of attribute \( \text{syn}1 \). This function has to be defined in the Functions constructor. The (polymorphic) type of every generic semantic function is also defined. The set of generic semantic functions is denoted as follows:
\[
\text{Functions} = \{ \ \text{syn}1 : \{ f : a \rightarrow b \rightarrow c \} \}
\]
Next we present the attribution rules of this generic attribute grammar. The generic symbol \( X \) occurs in the productions and in the semantic equations of the GEN\( \text{AG} \) as a “normal” grammar symbol. The same holds for the generic function \( f \) which is used as a “normal” semantic function too.
\[
R \quad \text{<} \downarrow \text{syn1} \text{>}
\]
\[
R \rightarrow \text{PRODR} \left( X : S \right) \quad S \quad \text{<} \downarrow \text{inh1,} \uparrow \text{syn1} \text{>}
\]
\[
\begin{align*}
X_{\text{inh1}} &= S_{\text{syn1}} \\
S_{\text{inh1}} &= X_{\text{syn2}} \\
S_{\text{syn1}} &= f \; n \; S_{\text{inh1}}
\end{align*}
\]
Observe that the inherited and synthesized attributes of a generic symbol can be derived from the attribute equations, exactly as for normal non-terminal symbols. We define the set of inherited and synthesized attributes in the GENAg specifications to increase their readability.
For presenting generic attribute grammar specifications we introduce a simple desk calculator language Desk. Desk was presented in a recent survey on attribute grammars [Paa95] where it is analysed in great detail. A program in Desk as the following form:
```
PRINT <Expression> WHERE <Definitions>
```
where \(<Expression>\) is an arithmetic expression over numbers and defined constants, and \(<Definitions>\) is a sequence of constant definitions of the form:
```
<Constant Name> = <Number> : <Type>
```
each named constant used in \(<Expression>\) must be defined in \(<Definitions>\), and \(<Definitions>\) may not give multiple values for a constant. We extend the original language with types, that is, a constant has a type int or real. The dynamic meaning of a Desk program is defined implicitly as a mapping into a lower-level code. A concrete sentence in Desk and the respective code generated looks as follows:
```
PRINT 1 + x - y LOADi 1
WHERE x = 2 : int, ADDi 2 (x)
y = 3 : real SUBr 3 (y)
PRINT 0
MALT 0
```
This language introduces several typical tasks which are common in real programming languages: \textit{name analysis, type checking, code generation}. Observe also that it is a one pass right-to-left language because named entities can be used before declaration.
The Desk compiler will be defined as a set of GENAg components. We start by defining a component which performs the static semantics of Desk. The code generation component is defined in section 4.2.
Let us assume that the \(<Expression>\) part of Desk has one inherited attribute, the environment (\(env\)), and synthesizes three attributes: the list of identifiers used and not contained in the inherited environment (attribute \(errs\)), a typed tree for the expression (\(tt\)) and the inferred type (\(type\)). Suppose that in a library of GENAg components we have a generic component describing the processing of such expression trees. Therefore we refer to the \(<Expression>\) part as a generic symbol as follows:
\[
\text{Symbols} = \{ \text{Exp} < \downarrow \text{env,} \uparrow \text{errs,} \uparrow \text{type,} \uparrow \text{tt} > \}
\]
and we concentrate on defining the rest of the GENAg. This grammar is presented next. The start symbol is Desk.
```
Desk <\downarrow \text{errs} >
Desk \rightarrow \text{RootPROD} ( \begin{array}{l} \text{\textsc{PRINT}} \end{array} \text{\textsc{Exp}} \quad \text{\textsc{WHERE}} \text{\textsc{Defs}} )
\begin{align*}
\text{Exp.env} &= \text{Defs.env} \\
\text{Desk.errs} &= \text{concat} \; \text{Exp.errs} \; \text{Defs.errs}
\end{align*}
```
189
The generic symbol and its attribute occurrences are used in the semantic equations of the GenAG as normal symbols and attributes. The semantic functions used to define the attribute env are part of this GenAG component, although they are not presented in the above grammar. These functions are the (built-in) list constructor functions, denoted by : and [], respectively, and the function isin that is the list membership predicate.
The meaning of this GenAG component is the attribute err: the only synthesized attribute of the root symbol. This attribute represents the list of errors which occur in a DESK program. This attribute can be a list data structure, that contains the errors, and that might be used by another GenAG component for further processing, or it can be a string representing a pretty printed list of errors that is shown to the user. In order to make possible to (re)use this GenAG component in all these cases we define the semantic functions used to compute attribute err as generic functions.
As we will see later these generic semantic functions can be instantiated with the (built-in) list constructor functions and the meaning of this component is a list of errors. However, those functions can also be instantiated with pretty printing functions and the meaning of the GenAG is a string. Those functions must follow the polymorphic type of the generic semantic functions. This generic functions are declared as follows:
\[
\text{Functions} = \{ \text{err} : \{ \text{concat} : a \rightarrow a \rightarrow a, \text{cons} : b \rightarrow a \rightarrow a, \text{nil} : \rightarrow a \} \}
\]
### 2.2. Circularities
Generic attribute grammars are executable, that is, efficient and generic implementations can be automatically derived from generic attribute grammars. In order to derive such implementations, the generic attribute grammars have to guarantee that all the attribute instances of a generic abstract syntax tree are effectively computable. That is, an order to compute such attribute instances must exist. Several methods exist that find such an order for “normal” attribute grammars [Kas80, Alb91, Pen94].
Most of the algorithms that analyse attribute grammars for attribute dependencies can be used to handle generic attribute grammars as well. The key idea is to provide those algorithms with the dependencies between the inherited and the synthesized attributes of the generic symbols. Such dependencies cannot be inferred from the GenAG since the attribute equations defining the synthesized attributes of the generic symbols are not included in the GenAG.
In this paper we will present a strict and purely functional implementation for generic attribute grammars. This implementation is based on the visit-sequence paradigm [Kas80] and is restricted to the class of partitionable attribute grammars [Alb91].
A straightforward strategy to approximate the dependencies of the generic symbols is to look at
the evaluators of these symbols as functions from inherited to synthesized attributes. That is, every synthesized attribute of a generic symbol depends on all the inherited attributes of that same symbol. Consequently, every generic symbol \( \mathbf{G} \in \mathcal{G} \) has one single partition:
\[
\pi_1(\mathbf{G}) = ([A_{\text{inh}}(\mathbf{G})], [A_{\text{syn}}(\mathbf{G})])
\]
Such an approach, however, may easily introduce fake cyclic dependencies. Suppose that in a production of a GENAg, where a generic symbol \( \mathbf{G} \) occurs, one inherited attribute \( a \) of \( \mathbf{G} \) (transitively) depends on one synthesized attribute \( b \) of \( \mathbf{G} \). That type of dependencies induces a cyclic dependency since attribute \( b \) directly depends on attribute \( a \) (recall that in a generic symbol, every synthesized attribute depends on all the inherited ones). In other words, multiple traversal generic symbols are not guaranteed to pass this simplistic approximation.
Consider the GENAg \( \mathbf{AG}_1 \) defined in section 2.1. Figure 1 shows the dependency graph of the production \( \text{PROD} \) pasted with the functional dependencies induced by the generic symbol \( \mathbf{X} \) and the non-terminal symbol \( S \).

**Figure 1:** Cyclic dependency graph induced by the functional dependencies of \( \mathbf{X} \).
### 2.2.1. Flow Types
A better strategy to provide the circularity test algorithm with the dependencies between inherited and synthesized attributes of the generic symbols is to explicitly specify such dependencies in the generic attribute grammar. That is, the GENAg defines the computational pattern of the generic symbols, the so-called flow types. These types define how the information flows from the inherited to the synthesized attributes of every generic symbol.
A flow type of a generic symbol \( \mathbf{G} \) is a finite list of pairs, each of which defining a computation pattern for \( \mathbf{G} \). A computation pattern consists of a finite list of inherited attributes of \( \mathbf{G} \) (the first element of the pair) and a non-empty finite list of synthesized attributes of \( \mathbf{G} \) (the second element of the pair). Thus, every computation pattern defines a function from the inherited to the synthesized attributes of a generic symbol.
Consider the generic symbol \( \mathbf{G} \in \mathcal{G} \). A flow type for \( \mathbf{G} \) is defined as follows:
\[
[ ([arg_1],[res_1]), \ldots, ([arg_n],[res_n]) ]
\]
with \( arg_1 \cup \cdots \cup arg_n = A_{\text{inh}}(\mathbf{G}) \) and \( res_1 \cup \cdots \cup res_n = A_{\text{syn}}(\mathbf{G}) \) and \( res_1 \cap \cdots \cap res_n = \emptyset \). That is, inherited attributes may be used in different computation patterns, but a synthesized attribute is defined in exactly one. We annotate the generic symbols with the flow types as follows:
\[
\mathbf{G} :: \begin{array}{c}
\quad (arg_1) \rightarrow (res_1) \\
\quad \ldots \\
\quad (arg_n) \rightarrow (res_n)
\end{array}
\]
191
\[ \text{arg}_j = \text{inh}_1, \ldots, \text{inh}_k \in \text{Ainh}(G), \text{with} \ 1 \leq j \leq n. \]
Let us return to the generic attribute grammar $AG_1$. Observe that according to the attribution rules of production $\text{RootR}$, the generic symbol $G$ is a two traversal symbol: The two traversals are due to the dependency from a synthesized $(\text{syn}_2)$ to an inherited attribute $(\text{inh}_1)$ of $G$. So, let us define a flow type which specifies a two traversal computation pattern. The first traversal synthesizes attribute $\text{syn}_2$ and the second one uses attribute $\text{inh}_1$. A possible flow type looks as follows:
\[ \text{Symbols} = \{ \ X \ : \ (\rightarrow \text{syn}_2, \text{inh}_1 \rightarrow \text{syn}_1) \} \]
This flow type defines the following partitions: $\pi_1(X) = ([\text{syn}_2])$ and $\pi_2(X) = ([\text{inh}_1], [\text{syn}_1])$. Figure 2 shows the induced dependency graph for production $\text{RootR}$.

In section 4.4 we will introduce modular and generic attribute grammars and flow types are automatically inferred and do not have to be explicitly specified.
Let us return to the Desk calculator example. The flow type defined for the generic symbol $\text{Exp}$ is:
\[ \text{Symbols} = \{ \ \text{Exp} \ : \ (\text{env} \rightarrow (\text{ errs, type, ti })) \} \]
Observe that this flow type does not introduce any circularity in the $\text{GENAg}$.
3. Generic Attribute Evaluators
This section presents Generic Attribute Evaluators ($\text{GENAE}$), an efficient implementation for generic attribute grammars. The generic attribute evaluators are based on purely functional attribute evaluation techniques [KS87, Joo87, Aug93, SS99]. The generic attribute evaluators, however, have to provide a mechanism to handle the generic symbols and semantic functions of the $\text{GENAg}$s.
Next we present strict $\lambda$-attribute evaluators that are an efficient functional implementation for partitionable attribute grammars.
3.1. $\lambda$-Attribute Evaluators
The strict $\lambda$-attribute evaluators consist of a set of partial parameterized functions, each performing the computations of one traversal of the evaluator. These functions, the so-called deforested visit-functions, return as one of their results the visit-functions for the next traversal. Performing the visit corresponds to totally parameterizing the deforested visit-functions and, once again returning the function for the next traversal. The main idea is that for each visit-sub-sequence we construct a function that, besides mapping inherited to synthesized attributes, also returns the function
representing the next visit. Any state information needed in future visits is preserved by partially parameterizing a more general function. The only exception is the final deforested visit-function that returns synthesized attributes only.
Consider the following simplified visit-(sub-)sequences for production \( X \rightarrow \text{PROD} \ (X, Y, Z) \):
```
plan \text{PROD}
begin 1 \text{inh}(X, \text{inh}_1)
visit \ (Y, 1)
\text{eval} \\
\ldots
uses(X, \text{inh}_1, \ldots),
\text{visit} \ (Y, 2)
\text{eval} \\
\ (X, \text{sym}_1)
uses(\ldots),
end 1 \text{syn}(X, \text{sym}_1)
\text{begin 2} \text{inh}(X, \text{inh}_2)
\text{visit} \ (Z, 1)
\text{eval} \\
\ (X, \text{sym}_2)
uses(X, \text{inh}_1, \ldots)
\text{end 2} \text{syn}(X, \text{sym}_2)
```
Observe that the inherited attribute \( X, \text{inh}_1 \) must be explicitly passed from the first visit of \( X \) (where it is defined) to the second one (where it is used). The non-terminal \( Y \) is visited twice, both visits are performed in the first visit to \( X \). These two visit-sequences are implemented by the following two deforested visit-functions:
\[
\lambda_{\text{Prod}^1} \lambda_{Y1} \lambda_{Z1} \text{inh}_1 = ((\lambda_{\text{Prod}^2} \text{inh}_1 \lambda_{Z1}), \text{sym}_1)
\]
where \( (\ldots) = \lambda_{Y2} \ldots \)
\[ s\text{yn}_1 = \ldots \]
\[
\lambda_{\text{Prod}^2} \text{inh}_1 \lambda_{Z1} \text{inh}_2 = (\text{sym}_2)
\]
where \( (\ldots) = \lambda_{Z2} \ldots \)
\[ \text{sym}_2 = f(\text{inh}_1 \ldots) \]
\( \text{inh}_1 \) defined in \( \lambda_{\text{Prod}^1} \)
\[ \text{used in } \lambda_{\text{Prod}^2} \]
\( \lambda_{Y2} \) partial parameterized in the first traversal and totally parameterized in the second one.
The functions \( \lambda_{Y1} \) and \( \lambda_{Z1} \) define the computations for the first traversal of non-terminal symbols \( Y \) and \( Z \). The attribute occurrence \( X, \text{inh}_1 \) is passed from the first to the second traversal as a hidden result of \( \lambda_{\text{Prod}^1} \) in the form of an extra argument to \( \lambda_{\text{Prod}^2} \). Note also that no reference to visits for non-terminal symbol \( Y \) is included in \( \lambda_{\text{Prod}^2} \) since all the visits to \( Y \) occur during the first visit to \( P \) only.
The \( \lambda \)-attribute evaluators are more generic than conventional attribute evaluators since their interface specification does not contain any explicit references to data types representing the abstract syntax trees. Attribute instances needed in different traversals of the evaluator are passed between traversals as results/arguments of partially parameterized visit-functions. No additional data structures are required to handle them, like trees [Kas91b, PSV92, SKS97] or stacks and queues [AS91]. The visit-functions find all the values they need in their arguments. Furthermore, the resulting evaluators are higher-order attribute evaluators. The arguments of the evaluators visit-functions are other visit-functions. Finally, the evaluators have an efficient memory usage: data not needed anymore is no longer referenced. References to grammar symbols and attribute instances can efficiently be reclaimed as soon as they have played their semantic role.
Parse-time attribute evaluation is achieved as a by-product of our techniques: the deforested visit-functions are directly called during parsing. No syntax tree is explicitly constructed. A typical parser fragment (derived from \( \text{AG}_1 \), in this case) looks as follows\(^1\):
---
\(^1\) We use \( \text{Happy} \) [Mar97], an \( \text{Yacc} \) equivalent for \( \text{Haskell} \).
193
\[ R : X \rightarrow \tau \rightarrow S \]
\[ S : n \]
where \( \lambda_{\text{Prod}R} \) and \( \lambda_{\text{Prod}S} \) are calls to the deforested visit-function derived from \( \text{AG}_1 \). These functions are presented in section 3.2.1.
3.2. Deriving Generic Attribute Evaluators
We define a mapping from generic attribute grammars into generic attribute evaluators. This mapping handles the generic symbols and semantic functions in the “standard” way: they are extra parameters of the \( \lambda \)-attribute evaluators. That is, for every generic symbol the attribute evaluator receives an extra argument corresponding to the evaluator of that symbol. The generic semantic functions are also handled as extra arguments to the generic evaluator. In other words, the \( \lambda \)-attribute evaluator derived for a generic attribute grammar \( \text{gag} \) is parameterized with the static parameters \( \mathcal{P} \) of \( \text{gag} \).
This technique is orthogonal to the strict and lazy implementation of attribute grammars presented in [Sar]. Thus, strict and lazy implementations can be derived for generic attribute grammars. The examples of generic attribute evaluators presented in this section are based on the strict implementation only.
3.2.1. Generic Symbols
The generic symbols are handled as normal non-terminal symbols: the visit-functions derived for the productions, where a generic symbol occurs, receive as an extra argument the generic evaluator which decorates the generic symbol. This is just as normal grammar symbols are handled. The generic attribute evaluators, however, refer to the visit-functions which decorate the generic symbols as parameters of the \( \text{GenAE} \).
In order to derive strict \( \lambda \)-attribute evaluators for generic attribute grammars the attribute evaluation order must first be statically computed. Traditional attribute grammar scheduling algorithms can be used to compute such an evaluation order, provided that the dependencies between the inherited and synthesized attributes of the generic symbols are known. That is, the \( \text{AG} \) scheduling algorithms have to know the partitions of the generic symbols, like for the circularity test of generic attribute grammars. Thus, the flow types are used to provide the scheduling algorithm with the evaluation order of the generic symbols.
Consider the generic attribute grammar \( \text{AG}_1 \) and the flow type of \( X \) as defined in section 2.2.1. According to the partitions induced by the flow type and the dependencies defined in both productions of \( \text{AG}_1 \) (see figure 2) the visit-sequences produced by the the scheduling algorithm are:
```plan
plan PRODR
begin 1 inh()
visit (X, 1)
eval (S.inh1)
visit (S, 1)
eval (X.inh1)
visit (X, 2)
eval (R.syn1)
end 1 syn(R.syn1)
```
```plan
plan PRODS
begin 1 inh(S.inh1)
eval (S.syn1)
end 1 syn(S.syn1)
```
The visit-sequences can be directly implemented as \( \lambda \)-attribute evaluators using the techniques
described in [SS99]. For the sake of completeness the resulting deforestated visit-functions are shown next. The generic semantic function \( f \) is considered in this example as a normal semantic function. Generic functionals are discussed in next section.
\[
\lambda_{\text{Prod}^1} \mid \lambda_{\text{S}^1} = (\text{syn1})
\]
where \((\lambda_{\text{X}^1}, \text{syn2}) = \lambda_{\text{X}^1}\)
\((\text{syn1}) = \lambda_{\text{X}^2} \text{syn1}_2\)
\[
\lambda_{\text{Prod}^1} \mid n \text{ inh1} = (\text{syn1})
\]
where \((\text{syn1}) = f n \text{ inh1}\)
As expected the evaluator of the generic symbol \( X \) is one argument of the visit-function \( \lambda_{\text{Prod}^1} \). Observe that that evaluator represents the first visit to the generic symbol only. When such a function is applied to the inherited attributes of the first visit (an empty set, in this case), it returns the visit-function to the next visit: Exactly as “normal” deforestated visit-functions of \( \lambda \)-attribute evaluators.
Consider the productions \texttt{ROOTPROD} and \texttt{ASSIGN} of the DESK calculator. The deforestated visit-functions derived for these productions are:
\[
\lambda_{\text{RootProd}^1} \mid \lambda_{\text{Exp}^1} = (\text{errs})
\]
where \((\text{env3, errs3}) = \lambda_{\text{Exp}^1}\)
\((\text{errs2, type2, tt2}) = \lambda_{\text{Exp}^1} \text{env3}\)
\((\text{errs}) = \text{concat} \text{ errs2 errs3}\)
\[
\lambda_{\text{Assign}^1} \mid \lambda_{\text{name}^1} \lambda_{\text{num}^1} \lambda_{\text{type}^1} = (\text{name, entry})
\]
where \((\text{name}) = \lambda_{\text{name}^1}\)
\((\text{entry}) = (\lambda_{\text{num}^1}, \lambda_{\text{type}^1})\)
where \(\lambda_{\text{Exp}^1}\) is the reference to the partial parameterized visit-function that is obtained when parsing the expression part of a DESK program. In the body of visit-function \(\lambda_{\text{RootProd}^1}\) we can see the right to left pass of the attribute evaluator: first the function that represents the evaluation of the \texttt{<Definitions>} part of DESK is called (and it returns the environment). After that, the function which represents the evaluation of the \texttt{<Expression>} part is computed (and it uses the computed environment). Note also that the deforestated visit-function \(\lambda_{\text{Def}^1}\) has all the parameters it needs at parse-time (no parameters in this case). Thus, the calls to that function are totally parameterized at parse-time. Consequently, the \texttt{<Definitions>} part of DESK is decorated during parsing.
The arguments of the visit-function \(\lambda_{\text{Assign}^1}\) are the tokens produced by the “external” lexical analyser. The deforestated visit-functions are completely generic as shown by their type definitions:
\[
\lambda_{\text{RootProd}^1} :: (a \rightarrow (b, c, d)) \rightarrow (a, b) \rightarrow b
\]
\[
\lambda_{\text{Assign}^1} :: a \rightarrow b \rightarrow c \rightarrow (a, (b, c))
\]
In this evaluator and in the GENAG, for example, nothing is defined about the type of the identifiers of the language. They can be a sequence of characters, a single one or even a numeral. The GENAG and the evaluator can be reused in all those cases.
### 3.2.2. Generic Semantic Functions
The generic semantic functions are handled as extra arguments of the evaluators. We consider two possibilities: the generic semantic functions are normal inherited attributes, or the generic functions are syntactic referenced symbols. In the next sections we describe both approaches.
3.2.3. Generic Semantic Functions as Inherited Attributes
They are *inherited attributes* of the root symbols and they are passed down in the tree to the nodes where they are used as normal attributes. Furthermore, the attribute grammar scheduling algorithms are used in the standard way to schedule their “computation”, because the generic semantic functions have become normal attributes. In this section we show how to transform a GENAG which contains generic functions into an equivalent one without generic functions. As a result of this transformation, we can use the techniques described thus far to derive generic attribute evaluators.
A generic attribute grammar with generic functions can be transformed into an equivalent grammar with no generic functions as follows: Let \( gag = (gg, A, E, \mathcal{F}) \) be a generic attribute grammar and \( R \) be the root of the generic context free grammar \( gg \).
1. For every generic semantic function \( f \in \mathcal{F} \) we add an inherited attribute \( \downarrow f \) to \( A_{\text{inh}}(R) \).
2. Every occurrence of \( f \) in \( E \) is replaced by \( \uparrow R.f \),
, where \( \uparrow X.f \) denotes the access to a remote attribute of an ascendent non-terminal symbol\(^2\).
Consider the GENAG \( \mathbf{AG}_1 \). This grammar is transformed into the following one:
\[
R \quad < \downarrow f \uparrow \text{syn1} > \\
R \rightarrow \text{Prodn}(X, \uparrow \text{syn1}) \\
S.\text{inh1} = S.\text{syn1} \\
S.\text{syn1} = X.\text{syn1} \\
R.\text{syn1} = X.\text{syn1}
\]
\[
S \quad < \downarrow \text{inh1}, \uparrow \text{syn1} > \\
S \rightarrow \text{Prodn}(n) \\
S.\text{syn1} = \uparrow R.f \ n \ S.\text{inh1}
\]
, and the derived \( \lambda \)-attribute evaluator looks as follows:
\[
\lambda_{\text{Prodn}} \ |
\begin{align*}
\lambda_X^1 X^1 &= \text{syn1} \\
\lambda_X^2 X^2 &= \text{syn2} \\
\lambda_{\text{Prodn}}^1 n &= \text{inh1}
\end{align*}
\]
where \( \lambda_X^1 X^1 = \text{syn1} \) \( \lambda_X^2 X^2 = \text{syn2} \) \( \lambda_{\text{Prodn}}^1 n = \text{inh1} \)
This technique, however, introduces type conflicts in the GENAE when the productions of a GENAG are extended. This type conflict will be explained in section 4.1.
3.2.4. Generic Semantic Functions as Syntactic Symbols
This section introduces a second approach to handle generic semantic functions: they are *syntactically referenced symbols*. That is, each visit-function defining the first visit to a particular constructor receives an extra argument for every generic function used in the respective production. The generic semantic functions are passed to the visits where they are applied, as arguments/results of the visit-functions which perform the different visits to that particular constructor. This is exactly as *syntactically referenced symbols* (i.e. grammar symbols which are used as normal values in the semantic equations of a Higher-order Attribute Grammar [VSK89]) are handled by the \( \lambda \)-attribute evaluators. Thus, the techniques used to handle syntactic references can be used to handle generic symbols too. In this paper we present the evaluators obtained with this technique only. For a formal derivation of such evaluators the reader is referred to [Sar].
Consider the GENAG \( \mathbf{AG}_1 \) again. The generic attribute evaluator obtained with this technique is:
\[\lambda_{\text{Prodn}} \ |
\begin{align*}
\lambda_X^1 X^1 &= \text{syn1} \\
\lambda_X^2 X^2 &= \text{syn2} \\
\lambda_{\text{Prodn}}^1 n &= \text{inh1}
\end{align*}\]
\(\text{We use the notation of the Ssu language [RT89].}\)
Generic Attribute Grammars
\[
\lambda_{\text{ProdR}^1} \quad \lambda_{\text{X}_1} \lambda_{\text{S}_1} = (syn1)
\]
where \((\lambda_{\text{X}_1}, syn2) = \lambda_{\text{X}_2}\)
\[
\lambda_{\text{ProdS}^1} \quad [f \ n \ \text{inh}1 = (syn1)
\]
where \((syn1) = [f \ n \ \text{inh}1
\]
Observe that the visit-function call \(\lambda_{\text{S}_1}\) in the body of \(\lambda_{\text{ProdR}^1}\) is partial parameterized with the generic function \(f\) at parse-time. That function call corresponds to the total parameterization of the visit-function.
\[
R : X \to S
\]
\[
\{ \ \lambda_{\text{ProdR}^1} \ $1 \ $3 \ }
\]
\[
S : n
\]
\[
\{ \ \lambda_{\text{ProdS}^1} \ f \ $1 \ }
\]
The generic functions are now the first arguments of the visit-functions. This approach has an important advantage when compared to the previous one: the visit-functions can be partially evaluated [JGS93] with respect to generic semantic functions. Note that they are the partial parameters of the GENAG. That is, when we parameterize the generic function of the GENAG with a particular function (that is a static parameter of the GENAG) we also partially evaluate the respective evaluator with respect to that function. As a result of partial evaluation the evaluator is a “standard” \(\lambda\)-attribute evaluator: all the semantic functions are part of the evaluator and they are not arguments of the visit-functions.
Let us consider the DESK calculator again and present a GENAG component which defines the processing of expression trees. The root symbol is \(\text{Exp}\).
**Functions**
\[
\begin{align*}
\text{tt} : & \quad \{ \ \text{add} : a \to b \to c \to c \\
& \quad , \ \text{fac} : a \to b \to c \} \\
\text{errs} : & \quad \{ \ \text{concat} : d \to d \to d \\
& \quad , \ \text{cons} : e \to d \to d \\
& \quad , \ \text{nil} : \to d \}
\end{align*}
\]
\[
\begin{align*}
\text{Exp} & \quad <\downarrow \text{env}, \uparrow \text{errs}, \uparrow \text{type}, \uparrow \text{tt}> \\
\text{Exp} & \to \text{ADD} (\text{Exp} \uparrow \text{tt} \searrow \text{Fac}) \\
\text{Fac} & \to \text{VAL} (\text{name}) \\
\text{Fac.env} & = \text{Exp.env} \\
\text{Fac.env} & = \text{Exp.env} \\
\text{Exp.errs} & = \text{concat} \text{Exp.env} \text{Fac.errs} \\
\text{Exp.type} & = \text{inftype} \text{Exp.env} \text{Fac.type} \\
\text{Exp.tt} & = \text{add} \text{Fac.env} \text{Exp.type} \text{Exp.tt} \\
\text{FACTOR} (\text{Fac}) & \quad | \quad \text{NUMBER (num)} \\
\text{Fac.env} & = \text{Exp.env} \\
\text{Exp.errs} & = \text{Fac.errs} \\
\text{Exp.type} & = \text{Fac.type} \\
\text{Exp.tt} & = \text{fac} \text{Fac.env} \text{Exp.type}
\end{align*}
\]
The semantic functions used to compute the value of synthesized attributes \(\text{errs}\) and the typed tree \(\text{tt}\) are defined as generic functions. The other semantic functions (e.g., \(\text{getval}, \text{gettype}\), etc) are normal (static) semantic functions that are part of this GENAG. The single deforested visit-function derived for the production \(\text{ADD}\) is presented next:
197
\[
\lambda_{\text{Add}^1} \cdot \begin{array}{c}
\text{concat} \\
\text{add}
\end{array}
\lambda_{\text{Exp}^1} \quad \lambda_{\text{Fac}^1} \quad \text{env} = (\text{errs}, \text{type}, tt)
\]
where
\[
(\text{errs}_3, \text{type}_3, \text{val}_3) = \lambda_{\text{Fac}^1} \quad \text{env}
\]
\[
(\text{errs}_2, \text{type}_2, \text{tt}_2) = \lambda_{\text{Exp}^1} \quad \text{env}
\]
\[
(\text{errs}) = \text{concat} \quad \text{errs}_2 \quad \text{errs}_3
\]
\[
(\text{type}) = \text{mftype} \quad \text{type}_2 \quad \text{type}_3
\]
\[
(\text{tt}) = \text{add} \quad \text{val}_3 \quad \text{type} \quad \text{tt}_2
\]
We show next the (complicated) type definition for this deforested visit-function. This function and its type will be used in the next section to explain the composition of GENAG components.
\[
\lambda_{\text{Add}^1} : (a \rightarrow b \rightarrow c) \rightarrow (d \rightarrow \text{Type} \rightarrow e \rightarrow f) \rightarrow (g \rightarrow (a, \text{Type}, e)) \rightarrow (g \rightarrow (b, \text{Type}, d)) \rightarrow g \rightarrow (c, \text{Type}, f)
\]
As we can see in this type definition, the first four type sub-expressions represent the polymorphic types of four functions: the two generic functions and the two visit-functions (derived for the right-hand side non-terminal symbols). The type variable \( g \) represents the type of the environment. The visit-function returns one triple, where \( c \) represents the type of the list of errors, \( \text{Type} \) is the derived type for the expression (inferred from the static semantic functions) and \( f \) is the type variable that represents the type of the typed tree.
4. Semantic Compositionality
This section discusses the semantic compositionality of generic attribute grammars.
4.1. Extending the Productions of a Non-terminal
The generic attribute evaluators are independent of the abstract tree data type. This data type freeness allows the GENAG and the GENAE to be easily extended with new productions. Suppose we want to extend a generic attribute grammar with new productions. In a traditional AG implementation, the existing attribute evaluator will have to be modified, since the type of the abstract syntax tree changes. As a result the attribute evaluator for the complete AG will have to be produced again.
In our implementation, however, we can define a new GENAG component where the new production and its semantic equations are specified. This component can be analysed separately and the deforested visit-function(s) for the production can be produced. No “global” tree data type has to be modified. In order to compute the order of the attribute evaluation we have to provide the scheduling algorithm with the flow type of the non-terminal symbol on the left-hand side of the production.
Let us return to the DESK example. Suppose that we want to extend the productions of the expression GENAG in order to allow the operation \( \Diamond \), which is not supported by the reused component. Using generic attribute grammars we define this extension in one new component. The non-terminal symbol in the left-hand side of the grammar is defined as a generic symbol and its flow type is specified. The new production and its attribute equations are defined as follows:
Symbols = { Exp :: ( env → (errs, type, tt) ) }
Functions = { tt: { dia :: a → b → c → c } , errs { concat :: d → d → d } }
Exp = <\ env, \ errs, \ type, \ tt >
Exp = \( \text{dia} ( \text{Exp} \cdot \text{Fac} \)
Exp.errs = \text{concat} \text{Exp.errs Fac.errs}
Exp.type = \text{inftype} \text{Exp.type Fac.type}
Exp.tt = \text{dia} \text{Fac.val Exp.type Exp.tt}
Observe that the start symbol \( S \) of this \text{GENAG} is the generic symbol \text{Exp}. This grammar component is used to extend its production only. From this \text{GENAG} component a deforestated visit-function is generated. The header of the function derived for this component is:
\[ \lambda_{\text{Dia}} \text{concat} \text{dia} \lambda_{\text{Exp}} \lambda_{\text{Fac}} \text{env} = (\text{errs, type, tt}) \]
Suppose now that the generic function \text{dia} is handled as one inherited attribute, as proposed in the first technique to handle generic semantic functions. In this case, a new inherited attribute \text{dia} is added to non-terminal symbol \text{Exp}. As a result all the visit-functions derived for the productions applied on \text{Exp} have to be extended with an extra argument too. If we consider the separate compilation of the modules, however, we get a type error during evaluation since the visit-functions derived for those productions have different types!
### 4.2. Composing \text{GENAG} Components
The generic attribute grammars are efficiently and easily composed. The generic functions of one \text{GENAG} can be instantiated with the visit-functions of the evaluator derived from another \text{GENAG}. Because this evaluator is totally deforestated no intermediate data structure is constructed nor traversed. Furthermore, we can give different semantics to a \text{GENAG} by instantiating its static parameters (i.e., the generic functions and the generic symbols) with different arguments.
Consider the code generation task of the \text{DESK} calculator. The code generation is performed according to the typed tree computed by the type checker. The typed tree attribute is one of the synthesized attributes of the expression part of \text{DESK}, as defined in section 2.1. In the \text{GENAG} for expressions that attribute is defined using generic functions. As a result we can, for example, parameterize the expression \text{GENAG} with a tree algebra and explicitly construct the typed tree. This tree can be defined by the following algebraic data type:
\[
\text{data ETree} = \text{CONSTREE} \quad \text{NumeTy} \quad \text{ETree} \\
\quad \text{FACTREE} \quad \text{NumeTy}
\]
, where \text{NumeTy} and \text{Type} are the types of the correspondent terminal symbols of the \text{GENAG}. The constructs of the \text{tree} data type follow the types defined for the generic functions. Thus, we can instantiate the generic functions with these constructor functions as follows:
\[
\text{add} = \text{CONSTREE} \\
\text{fac} = \text{FACTREE}
\]
In this case the evaluation of attribute \text{tt} actually constructs the typed tree as we can see in the type definition of the resulting deforestated visit-function:
\[
\lambda_{\text{add}} :: (a → b → c → (d → \text{Type} → \text{ETree} → \text{ETree}) → (g → (a, \text{Type}, \text{ETree}))) \\
→ (g → (b, \text{Type}, d)) → g → (c, \text{Type}, \text{ETree})
\]
In a traditional AG implementation this tree is traversed later on in order to generate the assembly code. Thus, this tree is the intermediate structure which glues the GENAG components.
Let us now present one GENAG component that describes the code generation task.
\[
\begin{align*}
\text{Exp} & \rightarrow <\uparrow\text{code}> \\
\text{Exp} & \rightarrow \text{CODEADD}(\text{num type } \text{Exp}) \\
& \quad \text{Exp.code} = \begin{cases} \\
& \text{if isintype type then Exp2.code ++ ["ADDx " ++ num]}\\
& \text{else Exp2.code ++ ["ADDx " ++ num]}\\
\end{cases} \\
| \quad \text{CODEFAC}(\text{num type}) \\
& \quad \text{Exp.code} = \begin{cases} \\
& \text{if isintype type then ["LOADx" ++ num]}\\
& \text{else ["LOADx" ++ num]}\\
\end{cases}
\end{align*}
\]
, and derive the deforestated generic attribute evaluator. We show next the deforestated visit-function derived for the CODEADD production only:
\[
\lambda_{\text{CodeAdd}} = \lambda_{\text{num}}(\lambda_{\text{type}}) = (\text{code}) \\
\text{where} \quad (\text{code}) = \lambda_{\text{Exp}}(\text{code}) \\
& \quad \text{if isintype } \lambda_{\text{type}} \text{ then code2 ++ ["ADDx " ++ } \lambda_{\text{num}}\text{]}\\
& \quad \text{else code2 ++ ["ADDx " ++ } \lambda_{\text{num}}\text{]}
\]
Using the deforestated generic attribute evaluators we can instantiate the generic functions with the deforestated visit-functions derived for the code generation GENAG. We compose the GENAG components as follows:
\[
\begin{align*}
\text{add} &= \lambda_{\text{CodeAdd}} \\
\text{fac} &= \lambda_{\text{CodeFac}}
\end{align*}
\]
Observe that these visit-functions have all the arguments they need during the decoration of the expressions trees. As result, the code generation is actually computed during the evaluation of the expression trees. Furthermore, no intermediate data structure (e.g. the typed tree) is constructed. The type definition of the visit-function is:
\[
\lambda_{\text{Add}} : (a \rightarrow b \rightarrow c) \rightarrow (d \rightarrow \text{Type} \rightarrow [\text{String}] \rightarrow [\text{String}]) \rightarrow (g \rightarrow (a, \text{Type}, [\text{String}]]) \\
\rightarrow (g \rightarrow (b, \text{Type}, d)) \rightarrow g \rightarrow (c, \text{Type}, [\text{String}])
\]
As a result the single visit-function which decorates the expression part of the DESK language returns, as one of its results, a list with the assembly code. The intermediate typed tree is not constructed not traversed. Observe also that the list (with the generated code) can also be eliminated if we define the pretty printing of the assembly code in an attribute grammar setting and derive the correspondent deforestated visit-functions. In this case, the list is eliminated and the previous function returns a string: the assembly code (see [Sar] for details).
### 4.3. Inter-Module Attribute Dependencies
The main problem in a purely functional implementation of attribute grammars is to handle attribute instances that are computed during one traversal of the evaluator and used in a future one, the so-called inter-traversal attribute dependencies [Pen94]. A traditional imperative approach stores such values in the nodes of the tree. The \(\lambda\)-attribute evaluators explicitly pass those values between visits, as normal arguments/results of the visit-functions.
A similar problem occurs with the separate compilation of GENAG components: How do we pass attribute values computed in one GENAG component and used in a different component? We use the approach of the deforestated evaluators: Those values are arguments/results of the visit-functions derived for the GENAG components. No additional data structures are required.
Consider the expression \textsc{GenAg} presented in section 3.2.4. The value of the attribute \textit{type} is defined in this \textsc{GenAg} and it is used in the code generation component. The attribute is passed between components in the “standard” way: The generic function which defines the typed tree is partially parameterized with the attribute \textit{type}. When such generic function is instantiated and totally parameterized the value of the attribute \textit{type} is available.
4.4. Modularity Constructs
This section briefly presents a modular notation for generic attribute grammars. A generic attribute grammar component is extended with a \textit{name} and a set of \textit{imported modules}, the so-called \textit{modular and generic attribute grammar}. The presentation in this paper is necessarily short relying entirely on the \textsc{Desk} example. A more detailed and formal presentation appears in [Sar].
A modular and generic attribute grammar extends a \textsc{GenAg} with a module’s name $\mathcal{N}$ and a set of imported modules $\mathcal{M}$. Every generic symbol $X \in \mathcal{G}$ of a modular component has to be defined as a (normal) grammar symbol $\overline{X}$ in one of the imported modules $m \in \mathcal{M}$. We say that a modular and generic \textsc{Ag} is complete if the underlying \textsc{GenAg} is complete and each generic symbol $X$ is also one grammar symbol $\overline{X}$ of the imported \textsc{GenAg}s. Furthermore, the set of attributes of symbols $\overline{X}$ and $\overline{X}$ must be equal. Moreover, the flow type of a generic symbol $\overline{X}$ is the set of partitions of symbol $\overline{X}$. The partitions of the grammar symbol $\overline{X}$ are computed (using standard \textsc{Ag} techniques) when deriving the evaluator for the \textsc{GenAg} component where $\overline{X}$ is defined. As a result it is not needed to specify the flow type for the generic symbols: the flow types are the partitions of the grammar symbols which instantiates the generic symbols. We consider that the partitions (\ie the flow types) of the grammar symbols of a modular and generic attribute grammar $m$ are available to the modular grammar which imports $m$.
In order to write modular and generic attribute grammars we add two new constructs to our specification language: \textbf{Module} and \textbf{Import}, which define the name of the module and the set of modules imported, respectively. Furthermore, the occurrences of generic symbols in the attribution rules are annotated with the module where the symbol is defined as follows:
\begin{verbatim}
<module name>_<generic symbol>_<attribute>
\end{verbatim}
Let us define a modular and \textsc{GenAg} component, called \textsc{Semantics}, which describes the static semantics for the \textsc{Desk} language. This component imports two \textsc{GenAg}s: the Expression \textsc{GenAg} and a \textsc{GenAg} which defines the unparsing of the list of errors. Furthermore, a set of generic semantic functions is defined in order to glue the \textsc{Semantics} and the CodeGen components.
\begin{verbatim}
Module SEMANTICS
Root Desk
Import = { Errors, Expression }
Symbols = { Exp } -- no flow type needed
Functions = { code : { codadd :: a → b → c → c ,
codadd :: a → b → c → c ,
codadd :: a → b → c → c ,
codadd :: a → b → c → c }
Desk → <\| errs, \| code >
Desk → RootProd ('PRINT' Exp 'WHERE' Defs)
Expression_Exp.add = codadd
Expression_Exp.fac = codfac
Expression_Exp.env = Defs.env
Desk.errs = Errors_Err.concat Expression_Exp.errs Defs.errs
Desk.code = coddesk Expression_Exp.tt
\end{verbatim}
Observe that the flow type of the generic symbol \texttt{Exp} is not defined in the AG. The partitions of \texttt{Exp} inferred when producing the attribute evaluator for the Expression \texttt{GENAG} are the flow types. Such partitions are available when analysing the Semantics \texttt{AG} since it imports the Expression \texttt{GENAG}.
Let us show the fragment of the \texttt{SEMANTICS} grammar which defines the processing of the expression tree. When writing a \texttt{GENAG} component the syntax underlying the attribute grammar is reduced to the entities which have a role in the attribute evaluation algorithm. Thus, let us assume that the reused expression \texttt{GENAG} is defined over the abstract syntax of the expression trees instead of over the concrete one (as defined previously). Furthermore, we also extend the expression component with an additional production. This fragment is shown next.
\begin{verbatim}
\begin{verbatim}
\textbf{Exp} \rightarrow \textbf{ADDExp} (\texttt{Exp}_2 \texttt{?} \texttt{Fac})
\textbf{Expression}_\textbf{ADD} (\texttt{Exp}_2 \texttt{Fac})
\textbf{FACTOR} (\texttt{Fac})
\textbf{Expression}_\textbf{FACTOR} (\texttt{Fac})
\textbf{DIEXP} (\texttt{Exp}_2 \texttt{\&} \texttt{Fac})
\texttt{Exp}_2.env = \texttt{Exp}.env
\texttt{Fac}.env = \texttt{Exp}.env
\texttt{Exp}.errs = \texttt{Errors}.\texttt{Err.concat} \texttt{Exp}_2.errs \texttt{Fac}.errs
\texttt{Exp}.type = \texttt{checktype} \texttt{Exp}_2.type \texttt{Fac}.type
\texttt{Exp}.res = \texttt{odda} \texttt{Fac}.val \texttt{Exp}.type \texttt{Exp}_2.res
\end{verbatim}
\end{verbatim}
The semantic equations of the productions \texttt{ADDExp} and \texttt{FACTOR} specify which visit-functions are used to decorate the instances of those productions (i.e. the respective subtrees). The new production and its semantic equations are defined as usually.
5. Related Work and Implementation
Several attribute grammar extensions allowing modularity and reusability of attribute grammar components have been developed. Most existing attribute grammar systems, however, use syntactic compositionality: a monolithic \texttt{AG} is first constructed out of modular descriptions. This type of modularity allows the semantic rules in one module to use attributes defined in another module. This allows a separate description of the phases without the need for defining and constructing any glue. This approach has one important drawback: the separate analysis of modules is not supported.
Our work, however, aims at semantic compositionality: the separate analysis and compilation of attribute grammar components. When writing \texttt{AGs} in a component style the interface between two components has to be defined. There are two approaches that can be taken: Define a \textit{special purpose data type} or a \textit{glue} grammar for this specific task. This is, for example, the approach taken in \textit{composable attribute grammars} \cite{FMY92}. In this approach, however, when the interface changes the components have to be recompiled. Furthermore, the “glue” is actually constructed.
The second approach is to define a \textit{generic data type} in which the information may be encoded. Examples of such representations are S-expressions or rose-trees. We have taken this second approach, in which functions are used as the uniform representation: in this way we get the genericity of the second approach. Furthermore, since the functions are totally deforestated no glue is actually constructed.
The generic attribute grammars have been implemented in a very experimental version of the \texttt{LRC} system \cite{KS98}: A purely functional attribute grammar system developed in our department\footnote{\texttt{LRC} is available at the address: \url{http://www.cs.uu.nl/people/matthys/lrc_html/}}. The \texttt{LRC} processes higher-order attribute grammars, written in a super-set of \texttt{SsI} \cite{RT89}, and produces purely
functional attribute evaluators. Incremental attribute evaluation is achieved via function memoization.
The LRC generates C based attribute evaluators and more recently we have incorporated a new back-end in order to generate HASKELL based evaluators. The \( \lambda \)-attribute evaluators and the generic attribute evaluators are produced in HASKELL only.
The modular constructs for generic attribute grammars are currently being incorporated to LRC. We are also planning to incorporate a type inference system into LRC. In the current implementation of LRC the generic and deforestated attribute evaluators rely on the HASKELL type system to perform the type checking.
6. Conclusions
This paper introduced generic attribute grammars. Generic attribute grammars provide the support for genericity, reusability and modularity in the context of attribute grammars. A generic attribute grammar is an executable component; efficient attribute evaluators are derived for a GENAG. The \( \lambda \)-attribute evaluators are particularly suitable to implement generic attribute grammars since they are completely generic: no data type has to be defined.
The generic attribute evaluators are deforestated and no intermediate data structure is constructed/used to “glue” the components of a GENAG system or to pass attribute values between different components. Furthermore, these techniques are orthogonal with the function memoization techniques used to achieve incremental attribute evaluation [PSV92].
Bibliography
203
|
{"Source-Url": "http://www-sop.inria.fr/members/Didier.Parigot/WAGA99/proceedings/joao_saraiva/joao_saraiva.pdf", "len_cl100k_base": 15467, "olmocr-version": "0.1.50", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 119670, "total-output-tokens": 18495, "length": "2e13", "weborganizer": {"__label__adult": 0.00029277801513671875, "__label__art_design": 0.0003514289855957031, "__label__crime_law": 0.00021159648895263672, "__label__education_jobs": 0.0007305145263671875, "__label__entertainment": 5.4717063903808594e-05, "__label__fashion_beauty": 0.0001304149627685547, "__label__finance_business": 0.00016605854034423828, "__label__food_dining": 0.0002779960632324219, "__label__games": 0.00048732757568359375, "__label__hardware": 0.0005903244018554688, "__label__health": 0.0003104209899902344, "__label__history": 0.00021755695343017575, "__label__home_hobbies": 7.665157318115234e-05, "__label__industrial": 0.0003147125244140625, "__label__literature": 0.0002951622009277344, "__label__politics": 0.00021064281463623047, "__label__religion": 0.00043845176696777344, "__label__science_tech": 0.01094818115234375, "__label__social_life": 6.67572021484375e-05, "__label__software": 0.004993438720703125, "__label__software_dev": 0.97802734375, "__label__sports_fitness": 0.00022542476654052737, "__label__transportation": 0.00041031837463378906, "__label__travel": 0.0001747608184814453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 66332, 0.025]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 66332, 0.73674]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 66332, 0.78848]], "google_gemma-3-12b-it_contains_pii": [[0, 3094, false], [3094, 6628, null], [6628, 9335, null], [9335, 13063, null], [13063, 16293, null], [16293, 19251, null], [19251, 22325, null], [22325, 25035, null], [25035, 28703, null], [28703, 31723, null], [31723, 35276, null], [35276, 38881, null], [38881, 41942, null], [41942, 45238, null], [45238, 48591, null], [48591, 52316, null], [52316, 55994, null], [55994, 59938, null], [59938, 63032, null], [63032, 66332, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3094, true], [3094, 6628, null], [6628, 9335, null], [9335, 13063, null], [13063, 16293, null], [16293, 19251, null], [19251, 22325, null], [22325, 25035, null], [25035, 28703, null], [28703, 31723, null], [31723, 35276, null], [35276, 38881, null], [38881, 41942, null], [41942, 45238, null], [45238, 48591, null], [48591, 52316, null], [52316, 55994, null], [55994, 59938, null], [59938, 63032, null], [63032, 66332, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 66332, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 66332, null]], "pdf_page_numbers": [[0, 3094, 1], [3094, 6628, 2], [6628, 9335, 3], [9335, 13063, 4], [13063, 16293, 5], [16293, 19251, 6], [19251, 22325, 7], [22325, 25035, 8], [25035, 28703, 9], [28703, 31723, 10], [31723, 35276, 11], [35276, 38881, 12], [38881, 41942, 13], [41942, 45238, 14], [45238, 48591, 15], [48591, 52316, 16], [52316, 55994, 17], [55994, 59938, 18], [59938, 63032, 19], [63032, 66332, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 66332, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
18da63689ea935a22c9366bb516e37b19fb0677f
|
TrustZone for Armv8-A
Version 1.0
TrustZone for Armv8-A
Copyright © 2019 Arm Limited (or its affiliates). All rights reserved.
Release Information
Document History
<table>
<thead>
<tr>
<th>Version</th>
<th>Date</th>
<th>Confidentiality</th>
<th>Change</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.0</td>
<td>08 January 2020</td>
<td>Non-Confidential</td>
<td>1</td>
</tr>
</tbody>
</table>
Non-Confidential Proprietary Notice
This document is protected by copyright and other related rights and the practice or implementation of the information contained in this document may be protected by one or more patents or pending patent applications. No part of this document may be reproduced in any form by any means without the express prior written permission of Arm. **No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.**
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use the information for the purposes of determining whether implementations infringe any third party patents.
**THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT.** For the avoidance of doubt, Arm makes no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of, patents, copyrights, trade secrets, or other rights.
This document may include technical inaccuracies or typographical errors.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to Arm’s customers is not intended to create or refer to any partnership relationship with any other company. Arm may make changes to this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any click through or signed written agreement covering this document with Arm, then the click through or signed written agreement prevails over and supersedes the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that if there is any conflict between the English version of this document and any translation, the terms of the English version of the Agreement shall prevail.
The Arm corporate logo and words marked with * or ™ are registered trademarks or trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of their respective owners. Please follow Arm’s trademark usage guidelines at [http://www.arm.com/company/policies/trademarks](http://www.arm.com/company/policies/trademarks).
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to.
Unrestricted Access is an Arm internal classification.
Product Status
The information in this document is Final, that is for a developed product.
Web Address
http://www.arm.com
# Contents
1 Overview........................................................................................................................................... 6
1.1 Before you begin ............................................................................................................................ 6
2 What is TrustZone? ........................................................................................................................... 7
2.1 TrustZone for Armv8-M ................................................................................................................ 7
3 TrustZone in the processor ............................................................................................................... 8
3.1 Security states ............................................................................................................................... 8
3.2 Switching between Security states .............................................................................................. 8
3.3 Virtual address spaces .................................................................................................................. 10
3.4 Physical address spaces .............................................................................................................. 11
3.5 Data, instruction, and unified caches ............................................................................................. 13
3.6 Translation Lookaside Buffer ....................................................................................................... 14
3.7 SMC exceptions ............................................................................................................................ 14
3.8 Secure virtualization ...................................................................................................................... 15
4 System architecture .......................................................................................................................... 18
4.1 Slave devices: peripherals, and memories .................................................................................... 18
4.2 Enforcing isolation ....................................................................................................................... 19
4.4 Bus masters ................................................................................................................................. 20
4.5 M and R profile Arm processors .................................................................................................. 22
4.6 Interrupts ...................................................................................................................................... 22
4.7 Handling interrupts ...................................................................................................................... 23
4.8 Debug, trace, and profiling .......................................................................................................... 24
4.9 Other devices ............................................................................................................................... 26
4.10 Trusted Base System Architecture ............................................................................................. 27
5 Software architecture ....................................................................................................................... 28
5.1 Top-level software architecture .................................................................................................... 28
5.1.1 Trusting the message? ............................................................................................................... 29
5.1.2 Scheduling .............................................................................................................................. 29
5.1.3 OP-TEE ................................................................................................................................... 29
5.2 Interacting with Non-secure virtualization .................................................................................. 30
5.3 Boot and the chain of trust .......................................................................................................... 31
5.4 Boot failures ............................................................................................................................... 33
5.5 Trusted Board Boot Requirements ............................................................................................ 33
5.6 Trusted Firmware ....................................................................................................................... 34
<table>
<thead>
<tr>
<th>Section</th>
<th>Description</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>6</td>
<td>Example use cases</td>
<td>35</td>
</tr>
<tr>
<td>6.1</td>
<td>Encrypted filesystem</td>
<td>35</td>
</tr>
<tr>
<td>6.2</td>
<td>Over the air firmware update</td>
<td>36</td>
</tr>
<tr>
<td>7</td>
<td>Check your knowledge</td>
<td>38</td>
</tr>
<tr>
<td>8</td>
<td>Related information</td>
<td>39</td>
</tr>
<tr>
<td>9</td>
<td>Next steps</td>
<td>40</td>
</tr>
</tbody>
</table>
1 Overview
In this guide, we introduce TrustZone. TrustZone offers an efficient, system-wide approach to security with hardware-enforced isolation built into the CPU.
We cover the features that TrustZone adds to the processor architecture, the memory system support for TrustZone, and typical software architectures. We also introduce the resources that are available from Arm to aid system and software developers who are working with TrustZone.
At the end of this guide, you will be able to:
- Give an example use case for TrustZone, describing how TrustZone is used to fulfill a security need
- List the number of Security states and physical address spaces in a TrustZone system
- State the purpose of a Secure Monitor and give examples of the state that it is required to save or restore
- Name the components in a typical TrustZone enabled memory system and describe their purpose
- Explain the purpose of the Trusted Base System Architecture and Trusted Board Boot Requirements specifications from Arm
- Explain how a chain of trust is used to secure the boot of a device
1.1. Before you begin
This guide assumes that you are familiar with the Arm Exception model and memory management. If you are not familiar with these subjects, read our Exception model and Memory management guides.
If you are not familiar with security concepts, we also recommend that you read our Introduction to security guide before reading this guide.
What is TrustZone?
TrustZone is the name of the Security architecture in the Arm A-profile architecture. First introduced in Armv6K, TrustZone is also supported in Armv7-A and Armv8-A. TrustZone provides two execution environments with system-wide hardware enforced isolation between them, as shown in this diagram:
The Normal world runs a rich software stack. This software stack typically includes a large application set, a complex operating system like Linux, and possibly a hypervisor. Such software stacks are large and complex. While efforts can be made to secure them, the size of the attack surface means that they are more vulnerable to attack.
The Trusted world runs a smaller and simpler software stack, which is referred to as a Trusted Execution Environment (TEE). Typically, a TEE includes several Trusted services that are hosted by a lightweight kernel. The Trusted services provide functionality like key management. This software stack has a considerably smaller attack surface, which helps reduce vulnerability to attack.
Note: You might sometimes see the term Rich Execution Environment (REE) used to describe the software that is running in the Normal world.
TrustZone aims to square a circle. As users and developers, we want the rich feature set and flexibility of the Normal world. At the same time, we want the higher degrees of trust that it is possible to achieve with a smaller and more restricted software stack in the Trusted world. TrustZone gives us both, providing two environments with hardware-enforced isolation between them.
2.1. TrustZone for Armv8-M
TrustZone is also used to refer the Security Extensions in the Armv8-M architecture. While there are similarities between TrustZone in the A profile architecture and the M profile architecture, there are also important differences. This guide covers the A profile only.
3 TrustZone in the processor
In this topic, we discuss support for TrustZone within the processor. Other sections cover support in the memory system and the software story that is built on the processor and memory system support.
3.1. Security states
In the Arm architecture, there are two Security states: Secure and Non-secure. These Security states map onto the Trusted and Normal worlds that we referred to in What is TrustZone?
At EL0, EL1, and EL2 the processor can be in either Secure state or Non-secure state, which is controlled by the SCR_EL3.NS bit. You often see this written as:
- NS.EL1: Non-secure state, Exception level 1
- S.EL1: Secure state, Exception level 1
EL3 is always in Secure state, regardless of the value of the SCR_EL3.NS bit. The arrangement of Security states and Exception levels is shown here:
![Security States Diagram]
**Note:** Support for Secure EL2 was first introduced in Armv8.4-A and support remains optional in Armv8-A.
3.2. Switching between Security states
If the processor is in NS.EL1 and software wants to move into S.EL1, how does it do this?
To change Security state, in either direction, execution must pass through EL3, as shown in the following diagram:
The preceding diagram shows an example sequence of the steps that are involved in moving between Security states. Taking these one step at a time:
1. Entering a higher Exception level requires an exception. Typically, this exception would be an FIQ or an SMC (Secure Monitor Call) exception. We look at interrupt handling and SMCs in more detail later.
2. EL3 is entered at the appropriate exception vector. Software that is running in EL3 toggles the \texttt{SCR\_EL3\_NS} bit.
3. An exception return then takes the processor from EL3 to SEL1.
There is more to changing Security state than just moving between the Exception levels and changing the \texttt{SCR\_EL3\_NS} bit. We also must consider processor state.
There is only one copy of the vector registers, the general-purpose registers, and most System registers. When moving between Security states it is the responsibility of software, not hardware, to save and restore register state. By convention, the piece of software that does this is called the Secure Monitor. This makes our earlier example look more like what you can see in the following diagram:
Trusted Firmware, an open-source project that Arm sponsors, provides a reference implementation of a Secure Monitor. We will discuss Trusted Firmware later in the guide.
A small number of registers are banked by Security state. This means that there are two copies of the register, and the core automatically uses the copy that belongs to the current Security state. These registers are limited to the ones for which the processor needs to know both settings at all times. An example is ICC_BPR1_EL1, a GIC register that is used to control interrupt preemption. Banking is the exception, not the rule, and will be explicitly called out in the Architecture Reference Manual for your processor.
When a System register is banked, we use (S) and (NS) to identify which copy we are referring to. For example, ICC_BPR1_EL1(S) and ICC_BPR1_EL1(NS).
Note: In Armv6 and Armv7-A most System registers are banked by Security state, but general-purpose registers and vector registers are still common.
3.3. Virtual address spaces
The memory management guide in this series introduced the idea of multiple virtual address spaces, or translation regimes. For example, there is a translation regime for EL0/1 and a separate translation regime for EL2, shown here:
There are also separate translation regimes for the Secure and Non-secure states. For example, there is a Secure EL0/1 translation regime and Non-secure EL0/1 translation regime, which is shown here:
When writing addresses, it is convention to use prefixes to identify which translation regime is being referred to:
- **NS.EL1:0x8000** - Virtual address 0x8000 in the Non-secure EL0/1 translation regime
- **S.EL1:0x8000** - Virtual address 0x8000 in the Secure EL0/1 translation regime
It is important to note that **S.EL1:0x8000** and **NS.EL1:0x8000** are two different and independent virtual addresses. The processor does not use a NS.EL1 translation while in Secure state, or a S.EL1 translation while in Non-secure state.
### 3.4. Physical address spaces
In addition to two Security states, the architecture provides two physical address spaces: Secure and Non-secure.
While in Non-secure state, virtual addresses always translate to Non-secure physical addresses. This means that software in Non-secure state can only see Non-secure resources, but can never see Secure resources. This is illustrated here:
While in Secure state, software can access both the Secure and Non-secure physical address spaces. The NS bit in the translation table entries controls which physical address space a block or page of virtual memory translates to, as shown in the following diagram:
**Note:** In Secure state, when the Stage 1 MMU is disabled all addresses are treated as Secure.
Like with virtual addresses, typically prefixes are used to identify which address space is being referred to. For physical addresses, these prefixes are NP: and SP:. For example:
- **NP:**0x8000 — Address 0x8000 in the Non-secure physical address space
- **SP:**0x8000 — Address 0x8000 in the Secure physical address space
It is important to remember that Secure and Non-secure are different address spaces, not just an attribute like readable, or writable. This means that NP:0x8000 and SP:0x8000 in the preceding example are different memory locations and are treated as different memory locations by the processor.
**Note:** It can be helpful to think of the address space as an extra address bit on the bus.
### 3.5. Data, instruction, and unified caches
In the Arm architecture, data caches are physically tagged. The physical address includes which address space the line is from, shown here:

A cache lookup on NP:0x800000 never hits on a cache line that is tagged with SP:0x800000. This is because NP:0x800000 and SP:0x800000 are different addresses.
This also affects cache maintenance operations. Consider the example data cache in the preceding diagram. If the virtual address `va1` maps to physical address 0x800000, what happens when software issues DC IVAC, `va1` (Data or unified Cache line Invalidate by Virtual Address) from Non-secure state?
The answer is that in Non-secure state, all virtual addresses translate to Non-secure physical addresses. Therefore, `va1` maps to NP:0x800000. The cache only operates on the line containing the specified address, in this case NP:0x800000. The line containing SP:0x800000 is unaffected.
**Check your knowledge**
1) If we performed the same operation from Secure state, with `va1` still mapping to NP:0x800000, which caches lines are affected?
2) Is it possible to perform a cache operation by virtual address from Non-secure targeting a Secure line?
**Answer:**
1) Like in the earlier example, the cache invalidates the line containing the specified physical address, NP:0x800000. The fact that the operation came from Secure state does not matter.
2) No. In Non-secure state, virtual addresses can only ever map to Non-secure physical addresses. By definition, a cache operation by VA from Non-secure state can only ever target Non-secure lines.
For set/way operations, for example DC ISW or Xt, operations that are issued in Non-secure state will only affect lines containing Non-secure addresses. From Secure state set/way operations affect lines containing both Secure and Non-secure addresses.
This means that software can completely invalidate or clean the entire cache only in Secure state. From Non-secure state, software can only clean or invalidate Non-secure data.
### 3.6. Translation Lookaside Buffer
Translation Lookaside Buffer (TLBs) cache recently used translations. The processor has multiple independent translation regimes. The TLB records which translation regime, including the Security state, an entry represents. While the structure of TLBs is implementation defined, the following diagram shows an example:

When software issues a TLB invalidate operation (TLBI instruction) at EL1 or EL2, the software targets the current Security state. Therefore, TLBI ALLE1 from Secure state invalidates all cached entries for the S.EL0/1 translation regime.
EL3 is a special case. As covered earlier in Security states, when in EL0/1/2 the SCR_EL3.NS bit controls which Security state the processor is in. However, EL3 is always in Secure state, regardless of the SCR_EL3.NS bit. When in EL3, SCR_EL3.NS lets software control which Security state TLBI operations target.
For example, executing TBLI ALLE1 at EL3 with:
- SCR_EL3.NS==0: Affects Secure EL0/1 translation regime
- SCR_EL3.NS==1: Affects Non-secure EL0/1 translation regime
### 3.7. SMC exceptions
As part of the support for two Security states, the architecture includes the Secure Monitor Call (SMC) instruction. Executing SMC causes a Secure Monitor Call exception, which targets EL3.
SMCs are normally used to request services, either from firmware resident in EL3 or from a service that is hosted by the Trusted Execution Environment. The SMC is initially taken to EL3, where an SMC dispatcher determines which entity the call will be handled by. This is shown in the following diagram:
In a bid to standardize interfaces, Arm provides the SMC Calling Convention (DEN0028) and Power State Coordination Interface specification (DEN0022). These specifications lay out how SMCs are used to request services.
Execution of an SMC at EL1 can be trapped to EL2. This is useful for hypervisors, because hypervisors might want to emulate the firmware interface that is seen by a virtual machine.
Note: The SMC instruction is not available at EL0 in either Security state.
We discuss exceptions later in Interrupts when we look at the interrupt controller.
3.8. Secure virtualization
When virtualization was first introduced in Armv7-A, it was only added in the Non-secure state. Until Armv8.3, the same was true for Armv8 as illustrated in the following diagram:
As previously described in **Switching between Security States**, EL3 is used to host firmware and the Secure Monitor. Secure EL0/1 host the Trusted Execution Environment (TEE), which is made up of the Trusted services and kernel.
There was no perceived need for multiple virtual machines in Secure state. This means that support for virtualization was not necessary. As TrustZone adoption increased, several requirements became apparent:
- Some Trusted services were tied to specific Trusted kernels. For a device to support multiple services, it might need to run multiple Trusted kernels.
- Following the principle of running with least privilege, moving some of the firmware functionality out of EL3 was required.
The solution was to introduce support for EL2 in Secure state, which came with Armv8.4-A, as you can see in this diagram:
Rather than a full hypervisor, S.EL2 typically hosts a Secure Partition Manager (SPM). An SPM allows the creation of the isolated partitions, which are unable to see the resources of other partitions. A system could have multiple partitions containing Trusted kernels and their Trusted services.
A partition can also be created to house platform firmware, removing the need to have that code that is run at EL3.
- **Enabling Secure EL2**
When S.EL2 is supported, it can be enabled or disabled. Whether S.EL2 is enabled is controlled by the `SCR_EL3.EEL2` bit:
- 0: S.EL2 disabled, behavior is as on a processor not supporting S.EL2
- 1: S.EL2 enabled
- Stage 2 translation in Secure state
Unlike the Stage 1 tables, there is no NS bit in the Stage 2 table entries. For a given IPA space, all the translations either result in a Secure or Non-secure physical address, which is controlled by a register bit. Typically, the Non-secure IPAs translate to Non-secure PAs and the Secure IPAs translate to Secure PAs.
4 System architecture
So far in this guide, we have concentrated on the processor, but TrustZone is much more than just a set of processor features. To take advantage of the TrustZone features, we need support in the rest of the system as well.
Here is an example of a TrustZone-enabled system:
This section explores the key components in this system and their role in TrustZone.
4.1. Slave devices: peripherals, and memories
Earlier in the Physical address spaces section we introduced the idea of two physical address spaces, Secure and Non-secure. The processor exports the address space that is being accessed to the memory system. The memory system uses this information to enforce the isolation.
In this topic, we refer to bus Secure and bus Non-secure. Bus Secure means a bus access to the Secure physical address space. Bus Non-secure means a bus access to the Non-secure physical address space. Remember that in Secure state software can access both physical address spaces. This means that the security of the bus access is not necessarily the same as the Security state of the processor that generated that access.
Note: In AMBA AXI and ACE, the AxPROT[1] signal is used to specify which address space is being accessed. Like with the NS bit in the translation tables, 0 indicates Secure and 1 indicates Non-secure.
In theory, a system could have two entirely separate memory systems, using the accessed physical address space (AxPROT) to select between them. In practice this is unlikely. Instead, systems use the physical address space like an attribute, controlling access to different devices in the memory system.
In general, we can talk about two types of slave devices:
4.3 Enforcing isolation
TrustZone is sometimes referred to as a slave-enforced protection system. The master signals the security of its access and the memory system decides whether to allow the access. How is the memory system-based checking done?
In most modern systems, the memory system-based checking is done by the interconnect. For example, the Arm NIC-400 allows system designers to specify for each connected slave:
**Secure**
Only Secure accesses are passed to device. Interconnect generates a fault for all Non-secure accesses, without the access being presented to the device.
**Non-secure**
Only Non-secure accesses are passed to device. Interconnect generates a fault for all Secure accesses, without the access being presented to the device.
**Boot time configurable**
At boot time, system initialization software can program the device as Secure or Non-secure. The default is Secure.
**TrustZone aware**
The interconnect allows all accesses through. The connected device must implement isolation.
For example:
This approach works well for either TrustZone-aware devices or those devices that live entirely within one address space. For larger memories, like off-chip DDR, we might want to partition the memory into Secure and Non-secure regions. A TrustZone Address Space Controller (TZASC) allows us to do this, as you can see in the following diagram:
The TZASC is similar to a Memory Protection Unit (MPU), and allows the address space of a device to split into several regions. With each region specified as Secure or Non-secure. The registers to control the TZASC are Secure access only, permitting only Secure software to partition memory.
An example of a TZASC is the Arm TZC-400, which supports up to nine regions.
Note: Off-chip memory is less Secure than on-chip memory, because it is easier for an attacker to read or modify its contents. On-chip memories are more secure but are much more expensive and of limited size. As always, we must balance cost, usability, and security. Be careful when deciding which assets you want in off-chip memories and which assets need to be kept on-chip.
### 4.4 Bus masters
Next, we will look at the bus masters in the system, as you can see in the following diagram:
The A-profile processors in the system are TrustZone aware and send the correct security status with each bus access. However, most modern SoCs also contain non-processor bus masters, for example, GPUs and DMA controllers.
Like with slave devices, we can roughly divide the master devices in the system into groups:
**TrustZone aware**
Some masters are TrustZone aware, and like the processor, provide the appropriate security information with each bus access. Examples of this include System MMUs (SMMUs) that are built to the Arm SMMUv3 specification.
**Non-TrustZone aware**
Not all masters are built with TrustZone awareness, particularly when reusing legacy IP. Such masters typically provide no security information with its bus accesses, or always send the same value.
What system resources do non-TrustZone-aware masters need to access? Based on the answer to this question, we could pick one of several approaches:
**Design time tie-off**
Where the master only needs to access a single physical address space, a system designer can fix the address spaces to which it has access, by tying off the appropriate signal. This solution is simple, but is not flexible.
**Configurable logic**
Logic is provided to add the security information to the master’s bus accesses. Some interconnects, like the Arm NIC-400, provide registers that Secure software can use at boot time to set the security of an attached master accesses. This overrides whatever value the master provided itself. This approach still only allows the master to access a single physical address space but is more flexible than a tie-off.
**SMMU**
A more flexible option is an SMMU. For a trusted master, the SMMU behaves like the MMU in Secure state. This includes the NS bit in the translation table entries, controlling which physical address space is accessed.
4.5 **M and R profile Arm processors**
Many modern designs include a mixture of A-profile, R-profile, and M-profile processors. For example, a mobile device might have an A-profile processor to run the mobile OS, an R-profile processor for the cellular modem, and an M-profile processor for low-level system control. The following diagram shows an example mobile device and the different processors that you might find:
The R profile does not support the two Security states in the way that the A profile does. This means that software running on those processors cannot control the outputted physical address space. In this way, they behave much like other non-TrustZone aware bus masters. The same is true for M profile processors that do not implement TrustZone for Armv8-M.
Often these processors only need to access a single physical address space. Using our example of a mobile device, the processors typically include an M-profile processor for low-level system control. This is sometimes called a System Control Processor (SCP). In many systems, the SCP would be a Secure-only device. This means that it only needs the ability to generate bus secure accesses.
4.6 **Interrupts**
Next, we will look at the interrupts in the system, as you can see in the following diagram:
The Generic Interrupt Controller (GIC), supports TrustZone. Each interrupt source, called an INTID in the GIC specification, is assigned to one of three Groups:
- **Group 0**: Secure interrupt, signaled as FIQ
- **Secure Group 1**: Secure interrupt, signaled as IRQ or FIQ
- **Non-secure Group 1**: Non-secure interrupt, signaled as IRQ or FIQ
This is controlled by software writing to the `GIC[D|R]_IGROUP<n>` and `GIC[D|R]_IGRMODR<n>` registers, which can only be done from Secure state. The allocation is not static. Software can update the allocations at run-time.
For INTIDs that are configured as Secure, only bus secure accesses can modify state and configuration. Register fields corresponding to Secure interrupts are read as 0s to Non-secure bus accesses.
For INTIDs that are configured as Non-secure, both Secure and Non-secure bus accesses can modify state and configuration.
Why are there two Secure Groups? Typically, Group 0 is used for interrupts that are handled by the EL3 firmware. These relate to low-level system management functions. Secure Group 1 is used for all the other Secure interrupt sources and is typically handled by the S.EL1 or S.EL2 software.
### 4.7 Handling interrupts
The processor has two interrupt exceptions, IRQ and FIQ. When an interrupt becomes pending, the GIC uses different interrupt signals depending on the group of the interrupt and the current Security state of the processor:
- **Group 0 interrupt**
- Always signaled as FIQ exception
- **Secure Group 1**
- Processor currently in Secure state – IRQ exception
- Processor currently in Non-secure state – FIQ exception
- **Non-secure Group 1**
- Processor currently in Secure state – FIQ exception
- Processor currently in Non-secure state – IRQ exception
Remember that Group 0 interrupts are typically used for the EL3 firmware. This means that:
The following example shows how the exception routing controls could be configured:
The preceding diagram shows one possible configuration. Another option that is commonly seen is for FIQs to be routed to EL1 while in Secure state. The Trusted OS treats the FIQ as a request to yield to either the firmware or to Non-secure state. This approach to routing interrupts gives the Trusted OS the opportunity to be exited in a controlled manor.
4.8 Debug, trace, and profiling
Next, we will look at the debug and trace components in the system, as you can see in the following diagram:
Modern Arm systems include extensive features to supporting debugging and profiling. With TrustZone, we must ensure that these features cannot be used to compromise the security of the system.
Regarding debug features, consider the development of a new SoC. Different developers are trusted to debug different parts of the system. The chip company engineers need, and are trusted to, debug all parts, including the Secure state code. Therefore, all the debug features should be enabled.
When the chip ships to an OEM, they still need to debug the Non-secure state software stack. However, the OEM might be prevented from debugging the Secure state code.
In the shipping product containing the chip, we might want some debug features for application developers. But we also want to limit the ability to debug the code of the silicon provider and the OEM.
Signals to enable the different debug, trace, and profiling features help us deal with this situation. This includes separate signals to control use of the features in Secure state and Non-secure state.
Continuing with the debug example, these signals include:
- **DBGEN** – Top-level invasive debug enable, controls external debug in both Security states
- **SPIDEN** – Secure Invasive Debug Enable, controls external ability to debug in Secure state
**Note:** These two signals are examples. There are other debug authentication signals. Refer to the Technical Reference Manual of your processor for a complete list.
Here is an example of how we might use these signals:
- **Early development by chip designer**
- **DBGEN==1 and SPIDEN==1**, enabling full external debug
- **Product development by OEM**
- **DBGEN==1**, enabling external debug in Non-secure state
- **SPIDEN==0**, disabling debug in Secure state
• Shipping product
o \texttt{DBGEN==0} and \texttt{SPIDEN==0}, disabling external debug in both Security states
o Debug of applications still possible
Because we want different signal values at different stages of development, it is common to connect the signals using e-fuses or authentication blocks. Here is an example:
By blowing fuses during manufacture, external debug can be permanently disabled. Using fuses does make in-field debug more difficult. When the fuses are blown, they cannot be unblown. An authentication module is more flexible.
4.9 Other devices
Finally, we will look at the other devices in the system, as you can see in the following diagram:
Our example TrustZone-enabled system includes several devices which we have not yet covered, but which we need to build a practical system.
• One-time programmable memory (OTP) or fuses
These are memories that cannot be changed once they are written. Unlike a boot ROM which contains the same image on each chip, the OTP can be programmed with device unique values and possibly OEM unique values.
One of the things that is stored in OTP is a device unique private key. When each chip is manufactured, a randomly generated unique key is written to the OTP. This device unique private key is used to tie data to the chip.
The advantage of a device unique private key is that it prevents class attacks. If each chip had the same key, if one device is compromised then all similar devices would also be vulnerable.
OTP is also often used to store hashes of OEM public keys. OTP is relatively expensive compared to other memories. For public keys, only storing the hash and not storing the full key saves cost.
- **Non-volatile counter**
Non-volatile (NV) counter, which might be implemented like more fuses. This is a counter that can only increase and can never be reset.
NV counters are used to protect against rollback attacks. Imagine that there is a known vulnerability in version 3 of the firmware on a device. The device is currently running version 4, on which the vulnerability is fixed. An attacker might try to downgrade the firmware back to version 3, to exploit the known vulnerability. To protect against this, each time the firmware is updated the count is increased. At boot, the version of the firmware is checked against the NV counter. If there is mismatch, the device knows that it is being attacked.
- **Trusted RAM and Trusted ROM**
These are on-chip Secure access only memories.
The Trusted ROM is where the first boot code is fetched from. Being on-chip means that an attacker cannot replace it. Being a ROM means that an attacker cannot reprogram it. This means that we have a known, trusted, starting point of execution, which will be discussed in the Software architecture section of this guide.
The Trusted RAM is typically an SRAM of a couple of hundred kilobytes. This is the working memory of the software that is running in Secure state. Again, being on-chip makes it difficult for an attacker to gain access to its content.
### 4.10 Trusted Base System Architecture
The Trusted Base System Architecture (TBSA) is a set of guidelines from Arm for system designers. TBSA provides recommendations on what resources different use cases require, for example, how many bits of OTP are required.
5 Software architecture
In TrustZone in the processor and System architecture, we explored TrustZone support in hardware, both the Arm processor and wider memory system. This topic looks at the software architecture that is found in TrustZone systems.
5.1 Top-level software architecture
The following diagram shows a typical software stack for a TrustZone enabled system:
---
Note: For simplicity, the diagram does not include a hypervisor, although they might be present.
The Trusted kernel in Secure state hosts services, like key management or DRM. Software running in Non-secure state needs to have controlled accesses to those services.
A user-space application is unlikely to be directly aware of TrustZone. Instead it would use a high-level API that is provided by a user-space library. That library handles communication with the Trusted service. This is similar to how, for example, a graphics API provides abstraction from the underlying GPU.
Communication between the service library and the Trusted service is typically handled using message queues or mailboxes in memory. The term World Shared Memory (WSM) is sometimes used to describe memory that is used for this communication. These queues must be in memory that both sets of software can see, which means Non-secure memory. This is because Non-secure state can only see Non-secure memory.
The service library places a request, or requests, in the mailbox and then invokes a driver in kernel space. The driver is responsible for low-level interactions with the Trusted Execution Environment (TEE), which could include allocating the memory for the message queues and registering them with the TEE. Remember that the two worlds are operating in different virtual address spaces, therefore they cannot use virtual addresses for communication.
The driver would call Secure state, typically using an SMC. Control would pass through the EL3 Secure Monitor to the Trusted Kernel in the TEE. The kernel invokes the requested service, which can then read the request from the queue.
5.1.1 Trusting the message?
In the flow that we have just described, the requests sit in a queue that is located in Non-secure memory. What if:
- The application that made the initial request is malicious?
- Other malicious software substituted the messages in the queue?
The TEE must assume that any request or data that is provided from Non-secure state might be malicious or in some other way invalid. This means that authenticating the request, or requestor, needs to be done in Secure state.
What this looks like will depend on the Trusted service being provided and its security requirements. There is no one single answer.
5.1.2 Scheduling
In a TrustZone system there are two software stacks, one for Non-secure state and another for Secure state. A processor core can only be in one state at a time. Who decides when each world is allowed to run?
Explicit calls to the EL3 firmware, like power management requests using Power State Coordination Interface (PSCI), are typically blocking. This means that control will only be returned to Non-secure state when the requested operation is complete. However, these calls tend to be short and infrequent.
The TEE typically runs under the control of the Non-secure state OS scheduler. A possible design is to have a daemon running under the OS as a place holder for the TEE. When the daemon is scheduled by the OS, the daemon hands control to the TEE through an SMC. The TEE then runs, processing outstanding requests, until the next scheduler tick or interrupt. Then control returns to the Non-secure state OS.
This might seem odd, because this approach gives the untrusted software control over when Trusted software can execute, which could enable denial of service attacks. However, because the TEE provides services to Non-secure state, preventing it from running only prevents those services from being available. For example, an attacker could prevent a user from playing a DRM-protected video. Such an attack does not cause any information to be leaked. This type of design can ensure confidentiality but not availability.
We could design the software stack to also give availability. The GIC allows Secure interrupts to be made higher priority than Non-secure interrupts, preventing Non-secure state from being able to block the taking of a Secure interrupt.
5.1.3 OP-TEE
There are many Trusted kernels, both commercial and open source. One example is OP-TEE, originally developed by ST-Ericsson, but now an open-source project hosted by Linaro. OP-TEE provides a fully featured Trusted Execution Environment, and you can find a detailed description on the OP-TEE project website.
The structure of OP-TEE is shown in the following diagram:
The OP-TEE kernel runs in S.EL1, hosting Trusted applications in S.EL0. The Trusted applications communicate with the OP-TEE kernel through the TEE Internal API. The TEE Internal API is a standard API developed by the GlobalPlatform group. GlobalPlatform work to develop standard APIs, which are supported by many different TEEs, not just OP-TEE.
**Note:** In the preceding diagram, the Trusted applications are not shown as OP-TEE components. This is because they are not part of the core OP-TEE OS. The OP-TEE project does provide some example Trusted Applications for people to experiment with.
In Non-secure state, there is a low-level OP-TEE driver in kernel space. This is responsible for handling the low-level communication with the OP-TEE kernel.
In the Non-secure user space (EL0), there is a user-space library implementing another GlobalPlatform API. The TEE Client API is what applications use to access a Trusted application or service. In most cases, we would not expect an application to use the TEE Client API directly. Rather there would be another service-specific library providing a higher-level interface.
OP-TEE also includes a component that is called the tee-supplicant. The tee-supplicant handles services that are supported by OP-TEE and require some level of rich OS interaction. An example is secure storage.
### 5.2 Interacting with Non-secure virtualization
In the examples that we have covered so far, we have ignored the possible presence of a hypervisor in Non-secure state. When a hypervisor is present, much of the communication between a VM and Secure state will be through the hypervisor.
For example, in a virtualized environment **SMCs** are used to access both firmware functions and Trusted services. The firmware functions include things like power management, which a hypervisor would typically not wish to allow a VM to have direct access to.
The hypervisor can trap **SMCs** from EL1, which allows the hypervisor to check whether the request is for a firmware service or a Trusted service. If the request is for a firmware service, the hypervisor can emulate the interfaces rather than passing on call. The hypervisor can forward Trusted service requests to EL3. You can see this in the following diagram:
5.3 Boot and the chain of trust
Boot is a critical part of any TrustZone system. A software component can only be trusted if we trust all the software components that ran before it in the boot flow. This is often referred to as the chain of trust. A simplified chain of trust is shown in the following diagram:
In our example, the first code that runs is the boot ROM. We must implicitly trust the boot ROM, because there are no earlier stages of boot to verify its contents. Being in ROM protects the initial boot code from being rewritten. Keeping the initial boot code on-chip prevents it from being replaced, so we can implicitly trust it. The boot ROM code is typically small and simple. Its main function is to load and verify the second stage boot code from flash.
The second stage boot code performs system initialization of the platform, like setting up the memory controller for off-chip DRAM. This code is also responsible for loading and verifying the images that will run in Secure and Non-secure state. Examples include loading a TEE in Secure state and higher-level firmware like UEFI in Non-secure state.
Earlier we introduced the System Control Processor (SCP). An SCP is a microcontroller that performs low-level system control in many modern SoCs. Where an SCP, or similar, is present it also forms part of the chain of trust. The following diagram shows this:
![Diagram of boot flow]
### 5.4 Boot failures
In a Trusted boot system, each component verifies the next component before it loads, forming a chain of trust. Let us look now at what happens when verification fails.
There is no one answer for this situation. It depends on the security needs of the system and which stage of the boot processor the failure occurs at. Consider the example of an SoC in a mobile device. If the verification failed at:
- **Second stage boot image**
The second stage boot image is required for initialization of the SoC and processor. If verification fails at this stage, we might not be sure that the device can boot safely and function correctly. Therefore, if verification fails at this stage it is usually fatal and the device cannot boot.
- **TEE**
The TEE provides services, like key management. The device can still function, perhaps at a limited level, without the TEE being present. Therefore, we could choose to not load the TEE, but still allow the Non-secure state software to load.
- **Non-secure state firmware or Rich OS image**
The Non-secure state software is already at a lower level of trust. We might choose to allow it to boot, but block accesses to advanced features provided via the TEE. For example, a TrustZone-enabled DRM might not be available with an untrusted OS image.
These are just examples. Each system needs to make its own decisions based on its security requirements.
### 5.5 Trusted Board Boot Requirements
Earlier we introduced the Trusted Base System Architecture (TBSA), which is guidance for system designers. The Trusted Board Boot Requirements (TBBR) are a similar set of guidelines for software developers. TBBR gives guidance on how to construct a Trusted boot flow in a TrustZone-enabled system.
5.6 Trusted Firmware
Trusted Firmware is an open-source reference implementation of Secure world software for Armv8-A devices. Trusted Firmware provides SoC developers and OEMs with a reference Trusted code base that complies with the relevant Arm specifications, including TBBR and SMCC.
The following diagram shows the structure of the Trusted Firmware:
The SMC dispatcher handles incoming SMCs. The SMC dispatcher identifies which SMCs should be dealt with at EL3, by Trusted Firmware, and which SMCs should be forwarded the Trusted Execution Environment.
The Trusted Firmware provides code for dealing with Arm system IP, like interconnects. Silicon providers need to provide code for handling custom or third-party IP. This includes SoC-specific power management.
6 Example use cases
In TrustZone in the processor and System Architecture, we introduced the TrustZone features in hardware and discussed the typical software stack that uses those features. In this topic, let’s pull together this knowledge and look at some example use cases.
6.1 Encrypted filesystem
Mobile devices like smartphones contain a lot of personal data. Users care about the confidentiality of that data if the device is lost or stolen. This is why most recent devices support file system encryption. TrustZone can be used part of the solution for protecting this data.
Data stored in the external flash is encrypted. On boot, the device authenticates the user and then provisions the key to decrypt the filesystem. Decryption might be handled by an accelerator or might be integrated into the flash controller.
The key for the file system also needs to have its confidentiality protected. If the key is compromised, an attacker could decrypt the filesystem.
The processes after authentication are illustrated in the following diagram:
In Secure state:
- After authentication, the encrypted filesystem key is read into on-chip secure memory. The key is decrypted and checked, using the master device unique key, which is stored on-chip.
- The filesystem key is provisioned into a secure access only register in a crypto engine or memory controller.
- Subsequent bus accesses to the filesystem in flash will be encrypted or decrypted using the provisioned key.
By performing these operations in Secure state, TrustZone allows us to never expose the filesystem keys to Non-secure state software. This means that malicious code in Non-secure cannot extract those keys for later attacks. Using what we have discussed so far, think about the following questions:
Q: Why is the filesystem key stored off-chip?
A: On-chip memory tends to be limited in size and expensive, compared to off-chip flash. Keeping the filesystem key off-chip can reduce cost. Having it encrypted means that we ensure confidentiality. There is a risk that malicious software could corrupt the key, which would be a breach of integrity, but that does not expose data.
Q: Why do we use a separate filesystem key in this example, and not the master device unique private key?
A: In theory, we could use the device unique key. But that means that we can never change the key, because the master device unique private key is stored in OTP. That might be a problem if, for example, we sell the phone. Instead we generate a new random filesystem key. If you want to format or reset the device, we can delete the filesystem key and generate a new one. Any data that is encrypted with the old key is now irretrievable.
### 6.2 Over the air firmware update
This second example relates to updating the boot firmware. The requirements for our system are:
- New firmware image is provided over a network.
- Only authentic images can be installed.
- Firmware version cannot be rolled back.
To achieve these aims, the OEM signs the image with its private key. The downloading device is provisioned with the public key, which it can use to verify the signature. A non-volatile counter is incremented when the firmware is updated, allowing detection of roll-back.
Our system is shown in the following diagram:

The downloading of the image is carried out in Non-secure state. The image itself is a not a secret, so we do not protect its confidentiality. The downloaded image is placed in memory and a request is issued to Secure state to install it.
The Secure state software is responsible for authentication. It does this using the public key of the OEM, typically stored in off-chip flash. This key is not a secret, so we do not need to ensure confidentiality. We do need to ensure authenticity of the key and detect attempts to substitute the key.
We achieve this by keeping a hash of the key on-chip, which can be used to check the key when needed. A hash requires fewer bits and on-chip memory is expensive.
When the public key is loaded and checked, the new firmware image can be checked. We want to ensure that it is authentic (the signature matches) and that it is a newer version of the firmware than what is installed.
Assuming that these checks pass, the image is installed, and the NV counter incremented. Incrementing the NV counter means that, if an attacker tries to install an older firmware, the device will detect that attempt.
In this example, TrustZone allows us to ensure that the keys that are used to authenticate firmware images are protected and that firmware images cannot be rolled back.
7 Check your knowledge
1. What are the Security states and physical address spaces in the Arm architecture?
a. The Security states in the Arm architecture are Secure state and Non-secure state. The physical address spaces in the Arm architecture are the Secure physical address space and the Non-secure physical address space.
2. For each Exception level, what determines whether the processor is in Secure state or Non-secure state?
a. For EL0/1/2, the SCR_EL3.NS bit. EL3 is always in Secure state.
3. While in Non-secure state, can software access the Secure physical address space?
a. No. While in Non-secure state, virtual addresses always map to Non-secure physical addresses.
4. Can an access to SP:0x80000 hit on a cache line containing NP:0x80000?
a. No. SP:0x80000 are NP:0x80000 are different locations, so there is no cache hit.
5. What do Trusted Base System Architecture (TBSA) and Trusted Board Boot Requirements (TBBR) provide guidance on?
a. TBBR gives guidance on booting, and TBSA gives guidance on system architecture.
6. What is the purpose of a TrustZone Address Space Controller (TZASC)?
a. A TZASC allows a memory to be partitioned into Secure and Non-secure regions.
8 Related information
Here are some resources related to material in this guide:
- **Arm architecture and reference manuals**: Find technical manuals and documentation relating to this guide and other similar topics.
- **Arm Community**: Ask development questions, and find articles and blogs on specific topics from Arm experts.
- **Isolation using virtualization in the Secure world**: Learn more about Secure virtualization in this white paper.
- **Arm CoreLink Generic Interrupt Controller v3 and v4 Guide**
- **Silicon IP Security**: Find more information on Trusted Base System Architecture.
- **TrustZone for Cortex-A**
- **TrustZone for Cortex-M**
Here are some resources related to topics in this guide:
**OP-TEE**
- **OP-TEE** is an example of a trusted execution environment. OP-TEE is an open-source project.
- OP-TEE implements industry standard APIs that are developed and maintained by the Global Platform group. For information on these APIs, see the [Global Platform Specification Library](#).
- You can experiment with the Trusted Firmware and OP-TEE on the free Arm Foundation model, or on the FVP models that are provided with Arm Development Studio. Here is more information about building and running [Arm Reference Platforms](#).
**SMC Exceptions**
The following specifications describe how SMCs are used to request services:
- **SMC Calling Convention (DEN0028)**
- **Power State Coordination Interface specification (DEN002)**
**Trusted Board Boot Requirements**
- **Trusted Firmware**: Find some example code for dealing with different types of Arm System IP, for example interconnects.
**Trusted Firmware**
- **Trusted Firmware**: Find some example code for dealing with different types of Arm System IP, for example interconnects.
9 Next steps
This guide has introduced the TrustZone security architecture, which provides isolation between two worlds or execution environments. The Arm architecture also has features for providing robust security within a given environment. To learn more, read our guide on Security – Providing robust protection for complex software.
In this guide we have mentioned the topics of virtualization and GICs without fully exploring them. To learn more about these topics, read these guides in our series:
- Arm CoreLink Generic Interrupt Controller v3 and v4 Guide
- Armv8-A Virtualization
|
{"Source-Url": "https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Learn%20the%20Architecture/TrustZone%20for%20Armv8-A.pdf?revision=c3134c8e-f1d0-42ff-869e-0e6a6bab824f", "len_cl100k_base": 11978, "olmocr-version": "0.1.53", "pdf-total-pages": 40, "total-fallback-pages": 0, "total-input-tokens": 88793, "total-output-tokens": 13699, "length": "2e13", "weborganizer": {"__label__adult": 0.0005803108215332031, "__label__art_design": 0.0006895065307617188, "__label__crime_law": 0.0007390975952148438, "__label__education_jobs": 0.0006251335144042969, "__label__entertainment": 9.393692016601562e-05, "__label__fashion_beauty": 0.00023615360260009768, "__label__finance_business": 0.0007038116455078125, "__label__food_dining": 0.0004010200500488281, "__label__games": 0.0015325546264648438, "__label__hardware": 0.040985107421875, "__label__health": 0.0004744529724121094, "__label__history": 0.00042510032653808594, "__label__home_hobbies": 0.00021779537200927737, "__label__industrial": 0.0017194747924804688, "__label__literature": 0.0002613067626953125, "__label__politics": 0.0003407001495361328, "__label__religion": 0.0007205009460449219, "__label__science_tech": 0.1427001953125, "__label__social_life": 7.516145706176758e-05, "__label__software": 0.024139404296875, "__label__software_dev": 0.78076171875, "__label__sports_fitness": 0.0004153251647949219, "__label__transportation": 0.0008921623229980469, "__label__travel": 0.00022983551025390625}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 58410, 0.02019]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 58410, 0.71171]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 58410, 0.90077]], "google_gemma-3-12b-it_contains_pii": [[0, 35, false], [35, 3559, null], [3559, 4006, null], [4006, 8827, null], [8827, 9139, null], [9139, 10582, null], [10582, 12449, null], [12449, 13668, null], [13668, 14787, null], [14787, 16242, null], [16242, 17161, null], [17161, 17524, null], [17524, 19494, null], [19494, 21651, null], [21651, 22728, null], [22728, 24136, null], [24136, 24587, null], [24587, 26284, null], [26284, 27662, null], [27662, 28526, null], [28526, 30372, null], [30372, 31657, null], [31657, 33527, null], [33527, 34111, null], [34111, 35896, null], [35896, 36972, null], [36972, 39212, null], [39212, 41265, null], [41265, 43978, null], [43978, 46238, null], [46238, 46550, null], [46550, 47361, null], [47361, 49406, null], [49406, 50179, null], [50179, 51958, null], [51958, 54064, null], [54064, 54831, null], [54831, 56047, null], [56047, 57818, null], [57818, 58410, null]], "google_gemma-3-12b-it_is_public_document": [[0, 35, true], [35, 3559, null], [3559, 4006, null], [4006, 8827, null], [8827, 9139, null], [9139, 10582, null], [10582, 12449, null], [12449, 13668, null], [13668, 14787, null], [14787, 16242, null], [16242, 17161, null], [17161, 17524, null], [17524, 19494, null], [19494, 21651, null], [21651, 22728, null], [22728, 24136, null], [24136, 24587, null], [24587, 26284, null], [26284, 27662, null], [27662, 28526, null], [28526, 30372, null], [30372, 31657, null], [31657, 33527, null], [33527, 34111, null], [34111, 35896, null], [35896, 36972, null], [36972, 39212, null], [39212, 41265, null], [41265, 43978, null], [43978, 46238, null], [46238, 46550, null], [46550, 47361, null], [47361, 49406, null], [49406, 50179, null], [50179, 51958, null], [51958, 54064, null], [54064, 54831, null], [54831, 56047, null], [56047, 57818, null], [57818, 58410, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 58410, null]], "pdf_page_numbers": [[0, 35, 1], [35, 3559, 2], [3559, 4006, 3], [4006, 8827, 4], [8827, 9139, 5], [9139, 10582, 6], [10582, 12449, 7], [12449, 13668, 8], [13668, 14787, 9], [14787, 16242, 10], [16242, 17161, 11], [17161, 17524, 12], [17524, 19494, 13], [19494, 21651, 14], [21651, 22728, 15], [22728, 24136, 16], [24136, 24587, 17], [24587, 26284, 18], [26284, 27662, 19], [27662, 28526, 20], [28526, 30372, 21], [30372, 31657, 22], [31657, 33527, 23], [33527, 34111, 24], [34111, 35896, 25], [35896, 36972, 26], [36972, 39212, 27], [39212, 41265, 28], [41265, 43978, 29], [43978, 46238, 30], [46238, 46550, 31], [46550, 47361, 32], [47361, 49406, 33], [49406, 50179, 34], [50179, 51958, 35], [51958, 54064, 36], [54064, 54831, 37], [54831, 56047, 38], [56047, 57818, 39], [57818, 58410, 40]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 58410, 0.02703]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
511aa83db0a42b79663bfbea7079cdb943531ea2
|
SCOPE: Scalable Composite Optimization for Learning on Spark
Shen-Yi Zhao, Ru Xiang, Ying-Hao Shi, Peng Gao and Wu-Jun Li
National Key Laboratory for Novel Software Technology
Department of Computer Science and Technology, Nanjing University, China
{zhaosy,xiangr,shiyh,gaop}@lamda.nju.edu.cn, liwujun@nju.edu.cn
Abstract
Many machine learning models, such as logistic regression (LR) and support vector machine (SVM), can be formulated as composite optimization problems. Recently, many distributed stochastic optimization (DSO) methods have been proposed to solve the large-scale composite optimization problems, which have shown better performance than traditional batch methods. However, most of these DSO methods might not be scalable enough. In this paper, we propose a novel DSO method, called scalable composite optimization for learning (SCOPE), and implement it on the fault-tolerant distributed platform Spark. SCOPE is both computation-efficient and communication-efficient. Theoretical analysis shows that SCOPE is convergent with linear convergence rate when the objective function is strongly convex. Furthermore, empirical results on real datasets show that SCOPE can outperform other state-of-the-art distributed learning methods on Spark, including both batch learning methods and DSO methods.
Introduction
Many machine learning models can be formulated as composite optimization problems which have the following form with finite sum of some functions: $\min_{w \in \mathbb{R}^d} P(w) = \frac{1}{n} \sum_{i=1}^{n} f_i(w)$, where $w$ is the parameter to learn (optimize), $n$ is the number of training instances, and $f_i(w)$ is the loss function on the training instance $i$. For example, $f_i(w) = \log(1 + e^{y_i x_i^T w}) + \frac{1}{2} \|w\|^2$ in logistic regression (LR), and $f_i(w) = \max\{0, 1 - y_i x_i^T w\} + \frac{1}{2} \|w\|^2$ in support vector machine (SVM), where $\lambda$ is the regularization hyperparameter and $(x_i, y_i)$ is the training instance $i$ with $x_i \in \mathbb{R}^d$ being the feature vector and $y_i \in \{+1, -1\}$ being the class label. Other cases like matrix factorization and deep neural networks can also be written as similar forms of composite optimization.
Due to its efficiency and effectiveness, stochastic optimization (SO) has recently attracted much attention to solve the composite optimization problems in machine learning (Xiao 2009; Bottou 2010; Duchi, Hazan, and Singer 2011; Schmidt, Roux, and Bach 2013; Johnson and Zhang 2013; Zhang, Mahdavi, and Jin 2013; Shalev-Shwartz and Zhang 2013; 2014; Lin, Lu, and Xiao 2014; Nitanda 2014). Existing SO methods can be divided into two categories. The first category is stochastic gradient descent (SGD) and its variants, such as stochastic average gradient (SAG) (Schmidt, Roux, and Bach 2013) and stochastic variance reduced gradient (SVRG) (Johnson and Zhang 2013), which try to perform optimization on the primal problem. The second category, such as stochastic dual coordinate ascent (SDCA) (Shalev-Shwartz and Zhang 2013), tries to perform optimization with the dual formulation. Many advanced SO methods, such as SVRG and SDCA, are more efficient than traditional batch learning methods in both theory and practice for large-scale learning problems.
Most traditional SO methods are sequential which means that the optimization procedure is not parallelly performed. However, with the increase of data scale, traditional sequential SO methods may not be efficient enough to handle large-scale datasets. Furthermore, in this big data era, many large-scale datasets are distributively stored on a cluster of multiple machines. Traditional sequential SO methods cannot be directly used for these kinds of distributed datasets. To handle large-scale composite optimization problems, researchers have recently proposed several parallel SO (PSO) methods for multi-core systems and distributed SO (DSO) methods for clusters of multiple machines.
PSO methods perform SO on a single machine with multi-cores (multi-threads) and a shared memory. Typically, synchronous strategies with locks will be much slower than asynchronous ones. Hence, recent progress of PSO mainly focuses on designing asynchronous or lock-free optimization strategies (Recht et al. 2011; Liu et al. 2014; Hsieh, Yu, and Dhillon 2015; J. Reddi et al. 2015; Zhao and Li 2016).
DSO methods perform SO on clusters of multiple machines. DSO can be used to handle extremely large problems which are beyond the processing capability of one single machine. In many real applications especially industrial applications, the datasets are typically distributively stored on clusters. Hence, DSO has recently become a hot research topic. Many DSO methods have been proposed, including distributed SGD methods from primal formulation and distributed dual formulation. Representative distributed SGD methods include PSGD (Zinkevich et al. 2010), BAVGM (Zhang, Wainwright, and Duchi 2012)
and Splash (Zhang and Jordan 2015). Representative distributed dual formulations include DisDCA (Yang 2013), CoCoA (Jaggi et al. 2014) and CoCoA+ (Ma et al. 2015). Many of these methods provide nice theoretical proof about convergence and promising empirical evaluations. However, most of these DSO methods might not be scalable enough.
In this paper, we propose a novel DSO method, called scalable composite optimization for learning (SCOPE), and implement it on the fault-tolerant distributed platform Spark (Zaharia et al. 2010). SCOPE is both computation-efficient and communication-efficient. Empirical results on real datasets show that SCOPE can outperform other state-of-the-art distributed learning methods on Spark, including both batch learning methods and DSO methods, in terms of scalability.
Please note that some asynchronous methods or systems, such as Parameter Server (Li et al. 2014), Petuum (Xing et al. 2015) and the methods in (Zhang and Kwok 2014; Zhang, Zheng, and Kwok 2016), have also been proposed for distributed learning with promising performance. But these methods or systems cannot be easily implemented on Spark with the MapReduce programming model which is actually a bulk synchronous parallel (BSP) model. Hence, asynchronous methods are not the focus of this paper. We will leave the design of asynchronous version of SCOPE and the corresponding empirical comparison for future study.
**SCOPE**
**Framework of SCOPE**
SCOPE is based on a master-slave distributed framework, which is illustrated in Figure 1. More specifically, there is a master machine (called Master) and \( p \) (\( p \geq 1 \)) slave machines (called Workers) in the cluster. These Workers are called Worker_1, Worker_2, \ldots, and Worker_\( p \), respectively.

**Algorithm 1 Task of Master in SCOPE**
```java
Initialization: \( p \) Workers, \( w_0 \);
for \( t = 0, 1, 2, \ldots, T \) do;
Send \( w_t \) to the Workers;
Wait until it receives \( z_1, z_2, \ldots, z_p \) from the \( p \) Workers;
Compute the full gradient \( z = \frac{1}{p} \sum_{k=1}^{p} z_k \), and then send \( z \) to each Worker;
Wait until it receives \( \tilde{u}_1, \tilde{u}_2, \ldots, \tilde{u}_p \) from the \( p \) Workers;
Compute \( w_{t+1} = \frac{1}{p} \sum_{k=1}^{p} \tilde{u}_k \);
end for
```
Different Workers cannot communicate with each other. This is similar to most existing distributed learning frameworks like MLlib (Meng et al. 2016), Splash, Parameter Server, and CoCoA and so on.
**Optimization Algorithm** The whole optimization (learning) algorithm is completed cooperatively by the Master and Workers:
- **Task of Master:** The operations completed by the Master are outlined in Algorithm 1. We can find that the Master has two main tasks. The first task is to compute the full gradient after all the local gradient sum \( \{z_k\} \) have been received from all Workers, and then send the full gradient to all Workers. The second task is to update the parameter \( w \) after all the locally updated parameters \( \{\tilde{u}_k\} \) have been received, and then send the updated parameter to all Workers. It is easy to see that the computation load of the Master is lightweight.
- **Task of Workers:** The operations completed by the Workers are outlined in Algorithm 2. We can find that each Worker has two main tasks. The first task is to compute the sum of the gradients on its local data (called local gradient sum), i.e., \( z_k = \sum_{i \in D_k} \nabla f_i(w) \) for Worker_\( k \), and then send the local gradient sum to the Master. The second task is to train \( w \) by only using the local data, after which the Worker will send the locally updated parameters, denoted as \( \tilde{u}_k \) for Worker_\( k \), to the Master and wait for the newest \( w \) from Master.
Here, \( w_t \) denotes the global parameter at the \( t \)-th iteration and is stored on the Master. \( u_{k,m} \) denotes the local parameter at the \( m \)-th iteration on Worker_\( k \).
SCOPE is inspired by SVRG (Johnson and Zhang 2013) which tries to utilize full gradient to speed up the convergence of stochastic optimization. However, the original SVRG in (Johnson and Zhang 2013) is sequential. To design a distributed SVRG method, one natural strategy is to adapt the mini-batch SVRG (Zhao et al. 2014) to distributed settings, which is a typical strategy in most distributed SGD frameworks like Parameter Server (Li et al. 2014) and Petuum (Xing et al. 2015). In appendix\(^1\), we briefly outline the sequential SVRG and the mini-batch based distributed SVRG (called DisSVRG). We can find that there
---
\(^1\)All the appendices and proofs of this paper can be found in the arXiv version of this paper (Zhao et al. 2016).
exist three major differences between SCOPE and SVRG (or DisSVRG).
The first difference is that in SCOPE each Worker locally performs stochastic optimization by only using its native data (refer to the update on ut+1,k for each Worker, k in Algorithm 2). On the contrary, SVRG or DisSVRG perform stochastic optimization on the Master (refer to the update on ut+1) based on the whole dataset, which means that we need to randomly pick up an instance or a mini-batch from the whole dataset D in each iteration of stochastic optimization. The locally stochastic optimization in SCOPE can dramatically reduce the communication cost, compared with DisSVRG with mini-batch strategy.
The second difference is the update rule of wt+1 in the Master. There are no locally updated parameters in DisSVRG with mini-batch strategy, and hence the update rule of wt+1 in the Master for DisSVRG cannot be written in the form of Algorithm 1, i.e., wt+1 = 1/p M i=1 ut,i. The third difference is the update rule for ut+1,k in SCOPE and ut+1 in SVRG or DisSVRG. Compared to SVRG, SCOPE has an extra term c(uk,k − wt) in Algorithm 2 to guarantee convergence, where c > 0 is a parameter related to the objective function. The strictly theoretical proof will be provided in the following section about convergence. Here, we just give some intuition about the extra term c(uk,k − wt). Since SCOPE puts no constraints about how to partition training data on different Workers, the data distributions on different Workers may be totally different from each other. That means the local gradient in each Worker can not necessarily approximate the full gradient. Hence, the term ∇fi,k,m(uk,m) − ∇fi,k,m(wt) + z is a bias estimation of the full gradient. This is different from SVRG whose stochastic gradient is an unbiased estimation of the full gradient. The bias estimation ∇fi,k,m(uk,m) − ∇fi,k,m(wt) + z in SCOPE may lead uk,m+1 to be far away from the optimal value w∗. To avoid this, we use the technique in the proximal stochastic gradient that adds an extra term c(uk,m − wt) to make uk,m+1 not be far away from wt. If wt is close to w∗, uk,m+1 will also be close to w∗. So the extra term in SCOPE is reasonable for convergence guarantee. At the same time, it does not bring extra computation since the update rule in SCOPE can be rewritten as
\[u_{k,m+1} = (1 - c\eta)u_{k,m} - c(\nabla f_{i,k,m}(u_{k,m}) - \nabla f_{i,k,m}(w_t) + z),\]
where \(z = z - c\mathbf{w}_t\) can be pre-computed and fixed as a constant for different m.
Besides the above mini-batch based strategy (DisSVRG) for distributed SVRG, there also exist some other distributed SVRG methods, including DSVRG (Lee et al. 2016), KroMagnon (Mania et al. 2015), SVRGfRoR (Konecný, McMahan, and Ramage 2015) and the distributed SVRG in (De and Goldstein 2016). DSVRG needs communication between Workers, and hence it cannot be directly implemented on Spark. KroMagnon focuses on asynchronous strategy, which cannot be implemented on Spark either. SVRGfRoR can be implemented on Spark, but it provides no theoretical results about the convergence. Furthermore, SVRGfRoR is proposed for cases with unbalanced data partitions and sparse features. On the contrary, our SCOPE can outperform SVRGfRoR. The distributed SVRG in (De and Goldstein 2016) cannot be guaranteed to converge because it is similar to the version of SCOPE with c = 0.
EASGD (Zhang, Choromanska, and LeCun 2015) also adopts a parameter like c to control the difference between the local update and global update. However, EASGD assumes that each worker has access to the entire dataset while SCOPE only requires that each worker has access to a subset. Local learning strategy is also adopted in other problems like probabilistic logic programs (Riguzzi et al. 2016).
**Communication Cost**
Traditional mini-batch based distributed SGD methods, such as DisSVRG in the appendix, need to transfer parameter w and stochastic gradients frequently between Workers and Master. For example, the number of communication times is \(O(TM)\) for DisSVRG. Other traditional mini-batch based distributed SGD methods have the same number of communication times. Typically, \(M = \Theta(n)\). Hence, traditional mini-batch based methods have \(O(Tn)\) number of communication times, which may lead to high communication cost.
Most training (computation) load of SCOPE comes from the inner loop of Algorithm 2, which is done at local Worker without any communication. It is easy to find that the number of communication times in SCOPE is \(O(T),\) which is dramatically less than \(O(Tn)\) of traditional mini-batch based distributed SGD or distributed SVRG methods. In the following section, we will prove that SCOPE has a linear convergence rate in terms of the iteration number T. It means that to achieve an \(\epsilon\)-optimal solution\(^2\), \(T = O(\log \frac{1}{\epsilon})\).
---
\(^2\) \(w\) is called an \(\epsilon\)-optimal solution if \(\mathbb{E}[w - w^*]^2 \leq \epsilon\) where \(w^*\) is the optimal solution.
Hence, $T$ is typically not large for many problems. For example, in most of our experiments, we can achieve convergence results with $T \leq 10$. Hence, SCOPE is communication-efficient. SCOPE is a synchronous framework, which means that some waiting time is also needed for synchronization. Because the number of synchronization is also $O(T)$, and $T$ is typically a small number. Hence, the waiting time is also small.
**SCOPE on Spark**
One interesting thing is that the computing framework of SCOPE is quite suitable for the popular distributed platform Spark. The programming model underlying Spark is MapReduce, which is actually a BSP model. In SCOPE, the task of Workers that computes local gradient sum $z_k$ and the training procedure in the inner loop of Algorithm 2 can be seen as the Map process since both of them only use local data. The task of Master that computes the average for both full gradient $z$ and $w_{t+1}$ can be seen as the Reduce process.
The MapReduce programming model is essentially a synchronous model, which need some synchronization cost. Fortunately, the number of synchronization times is very small as stated above. Hence, both communication cost and waiting time are very small for SCOPE. In this paper, we implement our SCOPE on Spark since Spark has been widely adopted in industry for big data applications, and our SCOPE can be easily integrated into the data processing pipeline of those organizations using Spark.
**Convergence of SCOPE**
In this section, we will prove the convergence of SCOPE when the objective functions are strongly convex. We only list some Lemmas and Theorems, the detailed proof of which can be found in the appendices (Zha et al. 2016).
For convenience, we use $\mathbf{w}^*$ to denote the optimal solution. $\|\cdot\|$ denotes the $L_2$ norm $\|\cdot\|_2$. We assume that $n = pq$, which means that each Worker has the same number of training instances and $|D_1| = |D_2| = \cdots = |D_p| = q$. In practice, we can not necessarily guarantee that these $|D_k|$s are the same. However, it is easy to guarantee that $\forall i, j, |(|D_i| - |D_j|)| \leq 1$, which will not affect the performance.
We define $p$ local functions as $F_k(\mathbf{w}) = \frac{1}{p} \sum_{i \in D_k} f_i(\mathbf{w})$, where $k = 1, 2, \ldots, p$. Then we have $P(\mathbf{w}) = \frac{1}{p} \sum_{k=1}^{p} F_k(\mathbf{w})$.
To prove the convergence of SCOPE, we first give two assumptions which have also been widely adopted by most existing stochastic optimization algorithms for convergence proof.
**Assumption 1** (Smooth Gradient). There exists a constant $L > 0$ such that for all $\mathbf{a}, \mathbf{b} \in \mathbb{R}^d$ and $i = 1, 2, \ldots, n$, we have $\|\nabla f_i(\mathbf{a}) - \nabla f_i(\mathbf{b})\| \leq L \|\mathbf{a} - \mathbf{b}\|$.
**Assumption 2** (Strongly Convex). For each local function $F_k(\cdot)$, there exists a constant $\mu > 0$ such that for all $\mathbf{a}, \mathbf{b} \in \mathbb{R}^d$, we have $F_k(\mathbf{a}) \geq F_k(\mathbf{b}) + \nabla F_k(\mathbf{b})^T (\mathbf{a} - \mathbf{b}) + \frac{\mu}{2} \|\mathbf{a} - \mathbf{b}\|^2$.
Please note that these assumptions are weaker than those in (Zhang and Jordan 2015; Ma et al. 2015; Jaggi et al. 2014), since we do not need each $f_i(\mathbf{w})$ to be convex and we do not make any assumption about the Hessian matrices either.
**Lemma 1.** Let $\gamma_m = \frac{1}{p} \sum_{i=1}^{p} E\|u_{k,m} - \mathbf{w}\|^2$. If $c > L - \mu$, then we have $\gamma_{m+1} \leq (1 - \eta(2\mu + c))\gamma_m + (c + 3L\eta^2)\gamma_0$.
Let $\alpha = 1 - \eta(2\mu + c)$, $\beta = c + 3L\eta^2$. Given $L$ and $\mu$ which are determined by the objective function, we can always guarantee $0 < \alpha < 1$, $0 < \beta < 1$, and $\alpha + \beta < 1$ by setting $\eta < \min\{\frac{2\mu}{M^2}, \frac{1}{2\mu + c}\}$. We have the following theorems:
**Theorem 1.** If we take $w_{t+1} = \frac{1}{p} \sum_{k=1}^{p} u_{k,M}$, then we can get the following convergence result:
$$E\|w_{t+1} - \mathbf{w}^*\|^2 \leq (\alpha M + \frac{\beta}{1 - \alpha})E\|w_t - \mathbf{w}^*\|^2.$$
When $M > \log \frac{1 - \alpha - \beta}{\alpha - \beta}$, $\alpha M + \frac{\beta}{1 - \alpha} < 1$, which means we can get a linear convergence rate if we take $w_{t+1} = \frac{1}{p} \sum_{k=1}^{p} u_{k,M}$.
**Theorem 2.** If we take $w_{t+1} = \frac{1}{p} \sum_{k=1}^{p} \mathbf{u}_k$ with $\mathbf{u}_k = \frac{1}{M} \sum_{m=1}^{M} u_{k,m}$, then we can get the following convergence result:
$$E\|w_{t+1} - \mathbf{w}^*\|^2 \leq \left(\frac{1}{M(1 - \alpha)} + \frac{\beta}{1 - \alpha}\right)E\|w_t - \mathbf{w}^*\|^2.$$
When $M > \frac{1}{1 - \alpha - \beta} + \frac{1}{1 - \alpha - \beta}$, $\frac{1}{M(1 - \alpha)} + \frac{\beta}{1 - \alpha} < 1$, which means we can also get a linear convergence rate if we take $w_{t+1} = \frac{1}{p} \sum_{k=1}^{p} \mathbf{u}_k$ with $\mathbf{u}_k = \frac{1}{M} \sum_{m=1}^{M} u_{k,m}$.
According to Theorem 1 and Theorem 2, we can find that SCOPE gets a linear convergence rate when $M$ is larger than some threshold. To achieve an $\epsilon$-optimal solution, the computation complexity of each worker is $O((\frac{n}{p} + M) \log \frac{1}{\epsilon})$. In our experiment, we find that good performance can be achieved with $M = \frac{p}{\epsilon}$. Hence, SCOPE is computation-efficient.
**Impact of Parameter $c$**
In Algorithm 2, we need the parameter $c$ to guarantee the convergence of SCOPE. Specifically, we need $c > L - \mu$ according to Lemma 1. Here, we discuss the necessity of $c$.
We first assume $c = 0$, and try to find whether Algorithm 2 will converge or not. It means that in the following derivation, we always assume $c = 0$.
Let us define another local function:
$$F_k(\mathbf{w}) = F_k(\mathbf{w}) + (\mathbf{z} - \nabla F_k(\mathbf{w}))^T(\mathbf{w} - \mathbf{w}^*)$$
and denote $w_{k,t} = \arg \min F_k(\mathbf{w})$.
Let $\mathbf{v}_{k,m} = \nabla f_{i_{k,m}}(u_{k,m}) - \nabla f_{i_{k,m}}(\mathbf{w}_t) + \frac{\mathbf{z}}{c}$. When $c = 0$, $\mathbf{v}_{k,m} = \nabla f_{i_{k,m}}(u_{k,m}) - \nabla f_{i_{k,m}}(\mathbf{w}_t) + \mathbf{z}$. Then, we have $E\|\mathbf{v}_{k,m}\| \leq \nabla f_k(\mathbf{u}_{k,m})$ and $\nabla F_k(\mathbf{w}_t) = \mathbf{z}$. Hence, we can find that each local Worker actually tries to optimize the local function $F_k(\mathbf{w})$ with SVRG based on the local data $D_k$. It means that if we set
a relatively small $\eta$ and a relatively large $M$, the $u_{k,m}$ will converge to $w_{k,t}^*$.
Since $F_k^{(t)}(w)$ is strongly convex, we have $\nabla F_k^{(t)}(w_{k,t}^*) = 0$. Then, we can get
$$\nabla F_k(w_{k,t}) - \nabla F_k(w^*) = \nabla F_k(w_t) - \nabla F_k(w^*) - z.$$
For the left-hand side, we have
$$\nabla F_k(w_{k,t}^*) - \nabla F_k(w^*) \approx \nabla^2 F_k(w^*)(w_{k,t}^* - w^*).$$
For the right-hand side, we have
$$\nabla F_k(w_t) - \nabla F_k(w^*) - z - \nabla P(w^*)$$
$$\approx \nabla^2 F_k(w^*)(w_t - w^*) - \nabla^2 P(w^*)(w_t - w^*).$$
Combining the two approximations, we can get
$$w_{k,t}^* - w^* \approx (I - A_k^{-1}A)(w_t - w^*),$$
where $A_k = \nabla^2 F_k(w^*)$ and $A = \nabla^2 P(w^*)$ are two Hessian matrices for the local function $F_k(w^*)$ and the global function $P(w^*)$, respectively. Assuming in each iteration we can always get the local optimal values for all local functions, we have
$$w_{t+1} - w^* \approx (I - \frac{1}{p} \sum_{k=1}^p A_k^{-1}A)(w_t - w^*). \quad (1)$$
Please note that all the above derivations assume that $c = 0$. From (1), we can find that Algorithm 2 will not necessarily converge if $c = 0$, and the convergence property is dependent on the Hessian matrices of the local functions.
Here, we give a simple example for illustration. We set $n = p = 2$ and $F_1(w) = (w - 1)^2$, $F_2(w) = 100(w - 10)^2$. We set a small step-size $\eta = 10^{-5}$ and a large $M = 4000$. The convergence results of SCOPE with different $c$ are presented in Table 1.
<table>
<thead>
<tr>
<th>$c$</th>
<th>0</th>
<th>1</th>
<th>5</th>
<th>10</th>
<th>Converge?</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
<td></td>
</tr>
</tbody>
</table>
### Separating Data Uniformly
If we separate data uniformly, which means that the local data distribution on each Worker is similar to the global data distribution, then we have $A_k \approx A$ and $\|I - \frac{1}{p} \sum_{i=1}^p A_i^{-1}A\| \approx 0$. From (1), we can find that $c = 0$ can make SCOPE converge for this special case.
### Experimental Setting and Baseline
#### Distributed Platform
We have a Spark cluster of 33 machines (nodes) connected by 10GB Ethernet. Each machine has 12 Intel Xeon E5-2620 cores with 64GB memory. We construct two clusters, a small one and a large one, from the original 33 machines for our experiments. The small cluster contains 9 machines, one master and eight slaves. We use 2 cores for each slave. The large cluster contains 33 machines, 1 master and 32 slaves. We use 4 cores for each slave.
In both clusters, each machine has access to 64GB memory on the corresponding machine and one core corresponds to one Worker. Hence, the small cluster has one Master and 16 Workers, and the large cluster has one Master and 128 Workers. The small cluster is for experiments on the three relatively small datasets including MNIST-8M, epsilon and KDD12. The large cluster is for experiments on the largest dataset Data-A. We use Spark1.5.2 for our experiment, and implement our SCOPE in Scala.
#### Baseline
Because the focus of this paper is to design distributed learning methods for Spark, we compare SCOPE with distributed learning baselines which can be implemented on Spark. More specifically, we adopt the following baselines for comparison:
- MLlib\(^3\) (Meng et al. 2016): MLlib is an open source library for distributed machine learning on Spark. It is mainly based on two optimization methods: mini-batch based distributed SGD and distributed lbfgs. We find that
---
3\(\)http://spark.apache.org/mllib/
5\(\)http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/
6\(\)http://www.kddcup2012.org/
the distributed SGD method is much slower than distributed lbfgs on Spark in our experiments. Hence, we only compare our method with distributed lbfgs for MLlib, which is a batch learning method.
- **LibLinear**\(^7\) (Lin et al. 2014): LibLinear is a distributed Newton method, which is also a batch learning method.
- **Splash**\(^8\) (Zhang and Jordan 2015): Splash is a distributed SGD method by using the local learning strategy to reduce communication cost (Zhang, Wainwright, and Duchi 2012), which is different from the mini-batch based distributed SGD method.
- **CoCoA**\(^9\) (Jaggi et al. 2014): CoCoA is a distributed dual coordinate ascent method by using local learning strategy to reduce communication cost, which is formulated from the dual problem.
- **CoCoA+**\(^10\) (Ma et al. 2015): CoCoA+ is an improved version of CoCoA. Different from CoCoA which adopts average to combine local updates for global parameters, CoCoA+ adopts adding to combine local updates.
We can find that the above baselines include state-of-the-art distributed learning methods with different characteristics. All the authors of these methods have shared the source code of their methods to the public. We use the source code provided by the authors for our experiment. For all baselines, we try several parameter values to choose the best performance.
### Efficiency Comparison with Baselines
We compare SCOPE with other baselines on the four datasets. The result is shown in Figure 2. Each marked point on the curves denotes one update for \( w \) by the Master, which typically corresponds to an iteration in the outer-loop. For SCOPE, good convergence results can be got with number of updates (i.e., the \( T \) in Algorithm 1) less than five. We can find that Splash vibrates on some datasets since it introduces variance in the training process. On the contrary, SCOPE are stable, which means that SCOPE is a variance reduction method like SVRG. It is easy to see that SCOPE has a linear convergence rate, which also conforms to our theoretical analysis. Furthermore, SCOPE is much faster than all the other baselines.
SCOPE can also outperform SVRGfoR (Konecný, McMahan, and Ramage 2015) and DisSVRG. Experimental comparison can be found in appendix (Zhao et al. 2016).
### Speedup
We use dataset MNIST-8M for speedup evaluation of SCOPE. Two cores are used for each machine. We evaluate speedup by increasing the number of machines. The training process will stop when the gap between the objective function value and the optimal value is less than \( 10^{-10} \). The speedup is defined as follows: \( \text{speedup} = \frac{\text{time with 16 cores by SCOPE}}{\text{time with 2\( \pi \) cores}} \)
\(^7\)https://www.csie.ntu.edu.tw/~cjlin/liblinear/
\(^8\)http://zhangyuc.github.io/splash
\(^9\)https://github.com/gingsmith/cocoa
\(^10\)https://github.com/gingsmith/cocoa


The speedup result is shown in Figure 3, where we can find that SCOPE has a super-linear speedup. This might be reasonable due to the higher cache hit ratio with more machines (Yu et al. 2014). This speedup result is quite promising on our multi-machine settings since the communication cost is much larger than that of multi-thread setting. The good speedup of SCOPE can be explained by the fact that most training work can be locally completed by each Worker and SCOPE does not need much communication cost.
SCOPE is based on the synchronous MapReduce framework of Spark. One shortcoming of synchronous framework is the synchronization cost, which includes both communication time and waiting time. We also do experiments to show the low synchronization cost of SCOPE, which can be found in the appendix (Zhao et al. 2016).
### Conclusion
In this paper, we propose a novel DSO method, called SCOPE, for distributed machine learning on Spark. Theoretical analysis shows that SCOPE is convergent with linear convergence rate for strongly convex cases. Empirical results show that SCOPE can outperform other state-of-the-art distributed methods on Spark.
Acknowledgements
This work is partially supported by the “DengFeng” project of Nanjing University.
References
Appendix
SVRG and Mini-Batch based Distributed SVRG
The sequential SVRG is outlined in Algorithm 3, which is the same as the original SVRG in (Johnson and Zhang 2013).
Algorithm 3 Sequential SVRG
Initialization: initialize \( w_0, \eta \);
for \( t = 0, 1, 2, \ldots, T \) do
\( u_0 = w_t \);
Compute the full gradient \( z = \frac{1}{n} \sum_{i=1}^{n} \nabla f_i(u_0) \);
for \( m = 0 \) to \( M - 1 \) do
Randomly pick up an \( i_m \) from \( \{1, \ldots, n\} \);
\( u_{m+1} = u_m - \eta(\nabla f_{i_m}(u_m) - \nabla f_{i_m}(u_0) + z) \);
end for
Take \( w_{t+1} \) to be \( u_M \) or the average of \( \{u_m\} \);
end for
The mini-batch based distributed SVRG (called DisSVRG) is outlined in Algorithm 4 and Algorithm 5, with Algorithm 4 for the operations completed by the Master and Algorithm 5 for the operations completed by the Workers.
Algorithm 4 Task of Master in DisSVRG
Initialization: \( p \) Workers, \( w_0, \eta \);
for \( t = 0, 1, 2, \ldots, T \) do
\( u_0 = w_t \);
Send \( w_t \) to the Workers;
Wait until it receives \( z_1, z_2, \ldots, z_p \) from the \( p \) Workers;
Compute the full gradient \( z = \frac{1}{p} \sum_{k=1}^{p} z_k \);
for \( m = 0 \) to \( M - 1 \) do
Send \( u_m \) to all Workers;
Wait until it receives \( |S_{m,k}|, \{\nabla f_{s_{m,k}}(u_m)\} \) from all the Workers, compute \( |S_m| = \sum_k |S_{m,k}| \);
Compute \( \nabla f_{S_m}(u_m) = \frac{1}{|S_m|} \sum_{k=1}^{p} \nabla f_{s_{m,k}}(u_m) \);
Compute \( \nabla f_{S_m}(u_0) = \frac{1}{|S_m|} \sum_{k=1}^{p} \nabla f_{s_{m,k}}(w_t) \);
Update the parameter: \( u_{m+1} = u_m - \eta(\nabla f_{S_m}(u_m) - \nabla f_{S_m}(u_0) + z) \);
end for
Take \( w_{t+1} \) to be \( u_M \) or the average of \( \{u_m\} \);
end for
Proof of Lemma 1
We define the local stochastic gradient in Algorithm 2 as follows:
\[ v_{k,m} = \nabla f_{i_{k,m}}(u_{k,m}) - \nabla f_{i_{k,m}}(w_t) + z + c(u_{k,m} - w_t) \]
Then the update rule at local Workers can be rewritten as follows:
\[ u_{k,m+1} = u_{k,m} - \eta v_{k,m} \]. (2)
First, we give the expectation and variance property of \( v_{k,m} \) in Lemma 2 and Lemma 3.
Lemma 2. The conditional expectation of local stochastic gradient \( v_{k,m} \) on \( u_{k,m} \) is
\[ \mathbb{E}[v_{k,m} | u_{k,m}] = \nabla f_k(u_{k,m}) - \nabla f_k(w_t) + z + c(u_{k,m} - w_t) \].
Algorithm 5 Task of Workers in DisSVRG
For the Worker \( k \):
for \( t = 0, 1, 2, \ldots, T \) do
Wait until it gets the newest parameter \( w_t \) from the Master;
Compute the local gradient sum \( z_k = \sum_{i \in D_k} \nabla f_i(w_t) \), and then send \( z_k \) to the Master;
for \( m = 0 \) to \( M - 1 \) do
Wait until it gets the newest parameter \( u_m \) from the Master;
Randomly pick up a mini-batch indices \( S_{m,k} \) from \( D_k \);
Compute \( \nabla f_{S_{m,k}}(u_m) = \sum_{i \in S_{m,k}} \nabla f_i(u_m) \);
Compute \( \nabla f_{S_{m,k}}(w_t) = \sum_{i \in S_{m,k}} \nabla f_i(w_t) \);
Send \( |S_{m,k}|, \nabla f_{S_{m,k}}(u_m) \) and \( \nabla f_{S_{m,k}}(w_t) \) to the Master;
end for
end for
Proof.
\[ \mathbb{E}[v_{k,m} | u_{k,m}] = \frac{1}{q} \sum_{i \in D_k} [\nabla f_i(u_{k,m}) - \nabla f_i(w_t) + z + c(u_{k,m} - w_t)] \]
\[ = \nabla f_k(u_{k,m}) - \nabla f_k(w_t) + z + c(u_{k,m} - w_t) \]
\[ \square \]
Lemma 3. The variance of \( v_{k,m} \) has the following property:
\[ \mathbb{E}[v_{k,m}^2 | u_{k,m}] \leq 3(L^2 + c^2)\|u_{k,m} - w_t\|^2 + 3L^2\|w_t - w^*\|^2. \]
Proof.
\[ \mathbb{E}[v_{k,m}^2 | u_{k,m}] = \frac{1}{q} \sum_{i \in D_k} [\|\nabla f_i(u_{k,m}) - \nabla f_i(w_t) + z + c(u_{k,m} - w_t)\|^2] \]
\[ \leq \frac{3}{q} \sum_{i \in D_k} [\|\nabla f_i(u_{k,m}) - \nabla f_i(w_t)\|^2 + \|z\|^2 + c^2\|u_{k,m} - w_t\|^2] \]
\[ \leq \frac{3}{q} \sum_{i \in D_k} [L^2\|u_{k,m} - w_t\|^2 + \|z\|^2 + c^2\|u_{k,m} - w_t\|^2] \]
\[ \leq \frac{3}{q} \sum_{i \in D_k} [(L^2 + c^2)\|u_{k,m} - w_t\|^2 + L^2\|w_t - w^*\|^2] \]
\[ = 3(L^2 + c^2)\|u_{k,m} - w_t\|^2 + 3L^2\|w_t - w^*\|^2 \]
The second inequality uses Assumption 1. The third inequality uses the fact that \( \nabla P(w^*) = 0 \).
\[ \square \]
Based on Lemma 2 and Lemma 3, we prove Lemma 1 as follows:
Proof. According to (2), we have
\[ \|u_{k,m+1} - w^*\|^2 \]
\[ = \|u_{k,m} - w^* - \eta v_{k,m}\|^2 \]
\[ = \|u_{k,m} - w^*\|^2 - 2\eta v_{k,m}^T(u_{k,m} - w^*) + \eta^2 \|v_{k,m}\|^2 \]
We take expectation on both sides of the above equality, and obtain
\[
\begin{align*}
\mathbb{E}[\|u_{k,m+1} - w^*\|^2 | u_{k,m}] &= \|u_{k,m} - w^*\|^2 \\
&- 2\eta(\nabla F_k(u_{k,m}) - \nabla F_k(w_t) + z) \\
&+ c(u_{k,m} - w_t)^T (u_{k,m} - w^*) \\
&+ \gamma^2 \mathbb{E}[\|v_{k,m}\|^2 | u_{k,m}] \\
\end{align*}
\]
(3)
For the second line of the right side of the above equality, we have
\[
\begin{align*}
\mathbb{E}[v_{k,m} | u_{k,m}]^T (u_{k,m} - w^*) \\
&= \nabla F_k(u_{k,m})^T (u_{k,m} - w^*) \\
&+ (z - \nabla F_k(w_t))^T (u_{k,m} - w^*) \\
&+ c(u_{k,m} - w_t)^T (u_{k,m} - w^*) \\
&\geq F_k(u_{k,m}) - F_k(w^*) + \frac{\mu}{2} \|u_{k,m} - w^*\|^2 \\
&+ \mu \mathbb{E}[\|v_{k,m}\|^2 | u_{k,m}] \\
&+ \frac{\mu}{2} \|u_{k,m} - w_t\|^2 \\
&+ c(u_{k,m} - w_t)^T (u_{k,m} - w^*) \\
&\geq F_k(w_t) - F_k(w^*) \\
&+ \frac{\mu}{2} \|u_{k,m} - w^*\|^2 + \frac{\mu}{2} \|u_{k,m} - w_t\|^2 \\
&+ z^T (u_{k,m} - w_t) + (z - \nabla F_k(w_t))^T (w_t - w^*) \\
&+ c(u_{k,m} - w_t)^T (u_{k,m} - w^*) \\
&\geq F_k(w_t) - F_k(w^*) \\
&+ \frac{\mu}{2} \|u_{k,m} - w^*\|^2 + \frac{\mu}{2} \|u_{k,m} - w_t\|^2 \\
&+ c(u_{k,m} - w_t)^T (u_{k,m} - w^*) \\
&\geq F_k(w_t) - F_k(w^*) \\
&+ \frac{\mu}{2} \|u_{k,m} - w^*\|^2 + \frac{\mu}{2} \|u_{k,m} - w_t\|^2 \\
&+ c(u_{k,m} - w_t)^T (u_{k,m} - w^*) \\
\end{align*}
\]
Both the first and second inequalities for the above derivation use Assumption 2.
We use \(\sigma_m = \sigma(u_{1,m}, u_{2,m}, \ldots, u_{p,m})\) to denote the \(\sigma\)-algebra. Then we can take a summation for (3) with \(k = 1\) to \(p\), and obtain
\[
\begin{align*}
\sum_{k=1}^{p} \mathbb{E}[\|u_{k,m+1} - w^*\|^2 | \sigma_m] \\
&\leq \sum_{k=1}^{p} \|u_{k,m} - w^*\|^2 \\
&- 2\eta \sum_{k=1}^{p} \{F_k(w_t) - F_k(w^*) + \frac{\mu + c}{2} \|u_{k,m} - w^*\|^2 \\
&+ \frac{\mu + c}{2} \|u_{k,m} - w_t\|^2 + z^T (u_{k,m} - w_t) \\
&- \frac{c}{2} \|w_t - w^*\|^2 + (z - \nabla F_k(w_t))^T (w_t - w^*)\} \\
&+ \gamma^2 \sum_{k=1}^{p} \mathbb{E}[\|v_{k,m}\|^2 | \sigma_m] \\
\end{align*}
\]
(4)
In the first inequality, we use the definition of local function \(F_k(\cdot)\) that \(P(w) = \frac{1}{p} \sum_{k=1}^{p} F_k(w_t)\) which leads to \(\sum_{k=1}^{p} F_k (w_t) = \sum_{k=1}^{p} P(w_t)\) and \(\sum_{k=1}^{p} (z - \nabla F_k(w_t))^T (w_t - w^*) = 0\). In the first inequality, we use Assumption 1 which leads to \(P(u_{k,m}) \leq
\[ P(w_t) + z^T(u_{k,m} - w_t) + \frac{\gamma}{2} \|u_{k,m} - w_t\|^2. \]
If we use \( \gamma_m = \frac{1}{p} \sum_{k=1}^{p} \mathbb{E}\|u_{k,m} - w_t\|^2 \), then according to Algorithm 2, it is easy to get that \( \gamma_0 = \mathbb{E}\|w_t - w^*\|^2 \). Moreover, according to (4) and Lemma 3, we can obtain
\[ \gamma_{m+1} \leq \gamma_m - \eta(2\mu + c)\gamma_m + (c\eta + 3L^2\eta^2)x_0 + a_m \]
where
\[ a_m = \frac{3\eta^2(L^2 + c^2) - \eta(\mu + c - L)}{p} \sum_{k=1}^{p} \mathbb{E}\|u_{k,M} - w_t\|^2 \]
If \( c > L - \mu \), we can choose a small \( \eta \) such that \( a_m < 0 \). Then we get the result
\[ \gamma_{m+1} \leq [1 - \eta(2\mu + c)]\gamma_m + (c\eta + 3L^2\eta^2)\gamma_0 \]
Proof of Theorem 1
Proof. According to Lemma 1, we have
\[ \gamma_m \leq \alpha\gamma_{m-1} + \beta\gamma_0 \]
\[ \leq (\alpha^m + \beta \frac{\alpha}{1 - \alpha})\gamma_0 \]
Since we take \( w_{t+1} = \frac{1}{p} \sum_{k=1}^{p} u_{k,M} \), then we have
\[ \mathbb{E}\|w_{t+1} - w^*\|^2 = \mathbb{E}\\|\frac{1}{p} \sum_{k=1}^{p} u_{k,M} - w^*\|^2 \]
\[ \leq \frac{1}{p} \sum_{k=1}^{p} \mathbb{E}\|u_{k,M} - w^*\|^2 \]
\[ = \gamma_M \]
\[ \leq (\alpha^M + \beta \frac{\alpha}{1 - \alpha})\mathbb{E}\|w_t - w^*\|^2 \]
Proof of Theorem 2
Proof. According to Lemma 1, we have
\[ \gamma_{m+1} + (1 - \alpha)\gamma_m \leq \gamma_m + \beta\gamma_0 \]
Summing \( m \) from 1 to \( M \), we have
\[ \gamma_{m+1} + (1 - \alpha) \sum_{m=1}^{M} \gamma_m \leq (1 + M\beta)\gamma_0 \]
Since we take \( w_{t+1} = \frac{1}{pM} \sum_{m=1}^{M} \sum_{k=1}^{p} u_{k,m} \), then we have
\[ \mathbb{E}\|w_{t+1} - w^*\|^2 = \mathbb{E}\\|\frac{1}{pM} \sum_{m=1}^{M} \sum_{k=1}^{p} u_{k,M} - w^*\|^2 \]
\[ \leq \frac{1}{pM} \sum_{m=1}^{M} \sum_{k=1}^{p} \mathbb{E}\|u_{k,M} - w^*\|^2 \]
\[ \leq (\frac{1}{M(1 - \alpha)} + \beta \frac{1}{1 - \alpha})\mathbb{E}\|w_t - w^*\|^2 \]
Efficiency Comparison with DisSVRG
In this section, we compare SCOPE with the mini-batch based distributed SVRG (called DisSVRG) in Algorithm 4 and Algorithm 5 using the dataset MNIST-8M. The result is shown in Figure 4. The x-axis is the CPU time, containing both computation and synchronization time, with the unit millisecond. The y-axis is the objective function value minus the optimal value in a log scale. In this paper, the optimal value is the minimal value got by running all the base-lines and SCOPE for a large number of iterations. It is easy to see that DisSVRG is much slower than our SCOPE, which means that the traditional mini-batch based DSO strategy is not scalable due to huge communication cost.
Efficiency Comparison with SVRGfoR
SVRGfoR (Konečný, McMahan, and Ramage 2015) is proposed for cases when the number of Workers is relatively large, and with unbalanced data partitions and sparse features. We use the KDD12 dataset with sparse features for evaluation. We construct a large cluster with 1600 Workers. Furthermore, we partition the data in an unbalanced way. The largest number of data points on one Worker is 43954, and the smallest number of data points on one Worker is 28. We tune several stepsizes for SVRGfoR to get the best performance. The experimental results are shown in Figure 5. We can find that SCOPE is much faster than SVRGfoR.
Synchronization Cost
SCOPE is based on the synchronous MapReduce framework of Spark. One shortcoming of synchronous framework is that there exists synchronization cost besides the computation cost. The synchronization cost includes both communication time and waiting time. Fortunately, the synchronization cost of SCOPE is low because most computation is completed locally and only a small number of synchronization times is needed. Here, we use experiment to verify this.
We use the dataset MNIST-8M for evaluation. The result is shown in Figure 6. The x-axis is the number of cores, the y-axis is the CPU time (in millisecond) per iteration, which is computed as dividing the total time by the number of iterations $T$. Please note that the CPU time includes both computation time and synchronization time (cost). During the training process, if the Workers or Master are computing, we consider the time as computation time. In each synchronization step, we consider the time gap between the completion of the fastest Worker and the slowest Worker as waiting time. If there is communication between Workers and Master, we consider the time as communication time. From Figure 6, we can find that SCOPE does not take too much waiting time and communication time compared to the computation time. We can also find that with the increase of the number of Workers (cores), the synchronization time per iteration does not increase too much, which is promising for distributed learning on clusters with multiple machines.
The speedup in Figure 6 seems to be smaller than that in Figure 3. Both Figure 6 and Figure 3 are correct. Some Workers still perform computation during the waiting time. So there is a repeating part in the waiting time and computation time in Figure 6. Furthermore, the total number of iterations to achieve the same objective value may not be the same for different number of cores.

|
{"Source-Url": "http://export.arxiv.org/pdf/1602.00133", "len_cl100k_base": 12763, "olmocr-version": "0.1.50", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 46284, "total-output-tokens": 15682, "length": "2e13", "weborganizer": {"__label__adult": 0.0004096031188964844, "__label__art_design": 0.0005512237548828125, "__label__crime_law": 0.0005793571472167969, "__label__education_jobs": 0.002521514892578125, "__label__entertainment": 0.00016438961029052734, "__label__fashion_beauty": 0.00025725364685058594, "__label__finance_business": 0.0008840560913085938, "__label__food_dining": 0.0004475116729736328, "__label__games": 0.0011529922485351562, "__label__hardware": 0.0016393661499023438, "__label__health": 0.0011606216430664062, "__label__history": 0.0005025863647460938, "__label__home_hobbies": 0.0001932382583618164, "__label__industrial": 0.0009398460388183594, "__label__literature": 0.00034999847412109375, "__label__politics": 0.0004727840423583984, "__label__religion": 0.0006198883056640625, "__label__science_tech": 0.391357421875, "__label__social_life": 0.00018012523651123047, "__label__software": 0.01812744140625, "__label__software_dev": 0.576171875, "__label__sports_fitness": 0.0004076957702636719, "__label__transportation": 0.0006265640258789062, "__label__travel": 0.0003008842468261719}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 47096, 0.02469]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 47096, 0.49754]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 47096, 0.83904]], "google_gemma-3-12b-it_contains_pii": [[0, 4971, false], [4971, 9768, null], [9768, 14800, null], [14800, 21220, null], [21220, 24888, null], [24888, 29023, null], [29023, 35056, null], [35056, 39424, null], [39424, 41887, null], [41887, 45144, null], [45144, 47096, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4971, true], [4971, 9768, null], [9768, 14800, null], [14800, 21220, null], [21220, 24888, null], [24888, 29023, null], [29023, 35056, null], [35056, 39424, null], [39424, 41887, null], [41887, 45144, null], [45144, 47096, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 47096, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 47096, null]], "pdf_page_numbers": [[0, 4971, 1], [4971, 9768, 2], [9768, 14800, 3], [14800, 21220, 4], [21220, 24888, 5], [24888, 29023, 6], [29023, 35056, 7], [35056, 39424, 8], [39424, 41887, 9], [41887, 45144, 10], [45144, 47096, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 47096, 0.00935]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
7401c0b7b3a41017709ac3b14217188ff14a4dfe
|
Package ‘hbsae’
October 13, 2022
Version 1.2
License GPL-3
Title Hierarchical Bayesian Small Area Estimation
Type Package
LazyLoad yes
Encoding UTF-8
Description Functions to compute small area estimates based on a basic area or
unit-level model. The model is fit using restricted maximum likelihood, or
in a hierarchical Bayesian way. In the latter case numerical integration is
used to average over the posterior density for the between-area variance.
The output includes the model fit, small area estimates and corresponding
mean squared errors, as well as some model selection measures. Additional functions
provide means to compute aggregate estimates and mean squared errors, to minimally
adjust the small area estimates to benchmarks at a higher aggregation
level, and to graphically compare different sets of small area estimates.
Date 2022-03-03
Depends R (>= 2.15.2)
Imports Matrix, methods
Suggests mcmcsae, survey, knitr, hypergeo, testthat
RoxygenNote 7.1.2
NeedsCompilation no
Author Harm Jan Boonstra [aut, cre]
Maintainer Harm Jan Boonstra <hjboonstra@gmail.com>
Repository CRAN
Date/Publication 2022-03-05 15:40:13 UTC
R topics documented:
hbsae-package ................................................... 2
aggr .......................................................... 2
A package for hierarchical Bayesian small area estimation.
Description
Package hbsae provides functions to compute small area estimates based on the basic unit-level and area-level models. The models are fit and small area estimates are computed in a hierarchical Bayesian way, using numerical integration.
Details
The main function that does most of the computational work is `fSAE.Unit`. Function `fSAE` is provided as a more convenient interface to `fSurvReg`, `fSAE.Area` and `fSAE.Unit`.
aggr
Compute aggregates of small area estimates and MSEs.
Description
Compute aggregates of small area estimates and MSEs.
Usage
`aggr(x, R)`
Arguments
- `x`: sae object.
- `R`: aggregation matrix, M x r matrix where M is the number of areas and r the number of aggregate areas; default is aggregation over all areas.
Value
Object of class sae with aggregated small area estimates and MSEs.
See Also
sae-class
Examples
d <- generateFakeData()
# compute small area estimates
sae <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop)
# by default aggregate over all areas
global <- aggr(sae)
EST(global); RMSE(global)
# aggregation to broad area
# first build aggregation matrix
M <- d$Xpop[, c("area22", "area23", "area24")] / d$Xpop[, "(Intercept)"
M <- cbind(1 - rowSums(M), M); colnames(M)[1] <- "area21"
est.area2 <- aggr(sae, M)
EST(est.area2); RMSE(est.area2)
COV(est.area2) # covariance matrix
bench
Benchmark small area estimates.
Description
Benchmark small area estimates to conform to given totals at aggregate levels.
Usage
bench(x, R, rhs, mseMethod = "no", Omega, Lambda)
Arguments
x sae object to be benchmarked. As an alternative, a list can be supplied with at least components Narea with area population sizes and est with small area estimates. In the latter case argument Omega cannot be left unspecified.
R restriction matrix, M x r matrix where r is the number of restrictions and M the number of areas; default is a single constraint on the population total. Note that R acts on the vector of area totals, not the vector of means.
rhs r-vector of benchmark totals corresponding to the restrictions represented by (the columns of) R.
mseMethod
if "no", MSEs are not updated, if "exact", constraints are treated as independent information (exact identities by default), and if "model", the squared differences between original and benchmarked estimates are added to the MSEs.
Omega
M x M matrix Ω in objective function, see details. By default this is the covariance matrix of the small area estimates.
Lambda
r x r matrix Λ in objective function, see details. By specifying Lambda it is possible to impose ‘soft’ constraints, i.e. constraints that need to hold only approximately.
Details
This function adjusts the small area estimates EST(x), denoted by \( x_0 \), to
\[
x_1 = x_0 + \Omega R_N (R_N' \Omega R_N + \Lambda)^{-1} (t - R_N' x_0),
\]
where
- \( \Omega \) is a symmetric M x M matrix. By default, \( \Omega \) is taken to be the covariance matrix \( V_0 \) of the input sae-object \( x \).
- \( R_N = \text{diag}(N_1, \ldots, N_M) R \) where \( R \) is the matrix passed to bench and \( N_i \) denotes the population size of the \( i \)th area, is a M x r matrix describing the aggregate level relative to the area level. Note that the matrix \( R \) acts on the vector of area totals whereas \( R_N \) acts on the area means to produce the aggregate totals. The default for \( R \) is a column vector of 1s representing an additivity constraint to the overall population total.
- \( t \) is an r-vector of aggregate-level totals, specified as rhs, that the small area estimates should add up to.
- \( \Lambda \) is a symmetric r x r matrix controlling the penalty associated with deviations from the constraints \( R_N' x_1 = t \). The default is \( \Lambda = 0 \), implying that the constraints must hold exactly.
The adjusted or benchmarked small area estimates minimize the expectation of the loss function
\[
L(x_1, \theta) = (x_1 - \theta)' \Omega^{-1} (x_1 - \theta) + (R_N' x_1 - t)' \Lambda^{-1} (R_N' x_1 - t)
\]
with respect to the posterior for the unknown small area means \( \theta \).
Optionally, MSE(\( x \)) is updated as well. If mseMethod="exact" the covariance matrix is adjusted from \( V_0 \) to
\[
V_1 = V_0 - V_0 R_N (R_N' \Omega R_N + \Lambda)^{-1} R_N' V_0 ,
\]
and if mseMethod is "model" the adjusted covariance matrix is
\[
V_1 = V_0 + (x_1 - x_0)' (x_1 - x_0)'.
\]
The latter method treats the benchmark adjustments as incurring a bias relative to the best predictor under the model.
Value
An object of class sae with adjusted estimates.
CVarea
References
See Also
sae-class
Examples
```r
d <- generateFakeData()
# compute small area estimates
sae <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop)
# calibrate to overall population total
sae.c <- bench(sae, rhs=sum(d$mY0*sae$Narea))
plot(sae, sae.c)
```
CVarea
Compute area-level cross-validation measure for sae objects.
Description
This function computes a cross-validation measure defined at the area level. It can be used, for example, to compare the predictive ability of area and unit-level models. The code is based in part on that of cv.glm from package boot.
Usage
```r
CVarea(
sae,
weight = TRUE,
cost = function(y, yhat, w) sum(w * (y - yhat)^2)/sum(w),
K = 10L,
method = "hybrid",
seed
)
```
Arguments
- `sae`: object of class sae, resulting from a call to fSAE, fSAE.Area, or fSAE.Unit.
- `weight`: if TRUE, use weights inversely proportional to the MSEs of y - yhat in the cost function.
- `cost`: cost function to be used. Defaults to a quadratic cost function.
K in K-fold cross-validation. Specifies in how many parts the dataset should be divided.
method method used to refit the model. One of "HB", "hybrid" (default) or "REML", in the order of slow to fast.
seed random seed used in selecting groups of areas to leave out in K-fold cross-validation.
Value
The computed area-level cross-validation measure.
Examples
d <- generateFakeData()
# compute small area estimates based on area-level and unit-level models
saeArea <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop,
type="area", silent=TRUE, keep.data=TRUE)
saeUnit <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop,
type="unit", silent=TRUE, keep.data=TRUE)
# compare area and unit-level models based on area-level cross-validation
CVarea(saeArea, K=10, seed=1) # 10-fold CV for area-level model
CVarea(saeUnit, K=10, seed=1) # 10-fold CV for unit-level model
---
fSAE
Fit a linear model with random area effects and compute small area estimates.
Description
This function prepares the (unit-level) input data and calls one of the lower level functions *fSurvReg*, *fSAE.Area* or *fSAE.Unit* to compute survey regression, area-level model or unit-level model small area estimates. Area-level model estimates are computed by first computing survey regression estimates and using these as input for *fSAE.Area*.
Usage
fSAE(
formula,
data,
area = NULL,
popdata = NULL,
type = "unit",
model.direct = NULL,
formula.area = NULL,
method = "hybrid",
K = 10,
seed = 1,
keep.data = FALSE,
silent = FALSE)
contrasts.arg = NULL,
remove.redundant = TRUE,
redundancy.tol = 1e-07,
sparse = FALSE,
...)
Arguments
- **formula**: model formula, indicating response variable and covariates.
- **data**: unit-level data frame containing all variables used in formula, area and formula.area arguments. These variables should not contain missing values.
- **area**: name of area indicator variable in data; if NULL, no random effects are used in the model.
- **popdata**: data frame or matrix containing area population totals for all covariates. The rows should correspond to areas for which estimates are required. Column names should include those produced by `model.matrix(formula, data, contrasts.arg)`, up to permutations of the names in interactions. A column named '(Intercept)' is required and should contain the area population sizes. If popdata is NULL, only the model fit is returned.
- **type**: type of small area estimates: "direct" for survey regression, "area" for area-level model, "unit" for unit-level model estimates. If type is "data" then only the data including the model matrix and population means are returned.
- **model.direct**: if type="area", this argument can be used to specify by means of a formula the covariates to use for the computation of the initial survey regression estimates. If unspecified, the covariates specified by formula are used both at the unit level (for the initial estimates) and at the area level (for the area-level model estimates).
- **formula.area**: if type="unit", this is an optional formula specifying covariates that should be used at the area level. These covariates should be available in popdata.
- **contrasts.arg**: list for specification of contrasts for factor variables. Passed to `model.matrix`.
- **remove.redundant**: if TRUE redundant columns in the design matrix are removed. A warning is issued if the same redundancy does not show also in the corresponding population totals. In the case of the area-level model there may still be redundancy at the area level.
- **redundancy.tol**: tolerance for detecting linear dependencies among the columns of the design matrix. Also used as tolerance in the check whether the design matrix redundancy is shared by the population totals.
- **sparse**: if TRUE sparse.model.matrix (package Matrix) is used to compute the covariate design matrix. This can be efficient for large datasets and a model containing categorical variables with many categories.
- **...**: additional arguments passed to `fSAE.Unit` or `fSurvReg`.
Value
An object of class sae containing the small area estimates, their MSEs, and the model fit. If type is "data" a list containing the model matrix, response vector, area indicator, area population sizes and matrix of population means is returned.
See Also
sae-class
Examples
d <- generateFakeData()
# model fitting only
(fit <- fSAE(y0 ~ x + area2, data=d$sam, area="area"))
# model fitting and small area estimation, unit-level model
saeHB <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop, silent=TRUE)
saeHB # print a summary
EST(saeHB) # small area estimates
RMSE(saeHB) # error estimates
str(saeHB)
plot(saeHB, list(est=d$mY0), CI=2) # compare to true population means
# unit-level model with REML model-fit instead of Bayesian approach
saeREML <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop, method="REML", silent=TRUE)
plot(saeHB, saeREML) # compare
# basic area-level model
saeA <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop, type="area")
plot(saeHB, saeA)
# SAE estimates based on a linear unit-level model without area effects
saeL <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop, method="synthetic")
plot(saeHB, saeL)
# model-based estimation of overall population mean without area effects
est.global <- fSAE(y0 ~ x + area2, data=d$sam, area=NULL, popdata=colSums(d$Xpop), method="synthetic")
EST(est.global); RMSE(est.global)
# no model fitting or estimation, but return design matrix, variable of interest, area indicator, area population sizes and matrix of population means
dat <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop, type="data")
str(dat)
**fSAE.Area**
Compute small area estimates based on the basic area-level model.
**Description**
This function returns small area estimates based on the basic area-level model, also known as the Fay-Herriot model. It calls `fSAE.Unit` to carry out the computations.
**Usage**
`fSAE.Area(est.init, var.init, X, x, ...)`
**Arguments**
- `est.init`: m-vector of initial estimates, where m is the number of in-sample areas.
- `var.init`: m-vector of corresponding variance estimates.
- `X`: M x p matrix of area-level covariates (typically population means), where M is the number of areas for which estimates are computed. If missing, a column vector of ones of the same length as `est.init` is used, corresponding to a model with an intercept only. The M areas may or may not equal the m areas for which initial estimates are provided. For example, estimates for out-of-sample areas, for which no initial estimates are available, are computed as long as the corresponding rows of auxiliary means are in `X`. It is also possible to compute estimates only for a subset of sample areas, see the help for argument `x`.
- `x`: an optional m x p matrix with auxiliary area-level covariates to be used for fitting the model, where the rows correspond to the components of `est.init`. If the M areas corresponding to the rows of `X` do not contain all m areas corresponding to `est.init`, `x` must be provided separately in order to be able to fit the model.
- `...`: additional arguments passed to `fSAE.Unit`. For example, passing an M-vector `Narea` with area population sizes (along with the matrix `X` of population means) allows to compute aggregates of the small area estimates. See the documentation of function `fSAE.Unit` for a description of other possible arguments.
**Value**
An object of class `sae` containing the small area estimates and MSEs, the model fit, and model selection measures.
**References**
**See Also**
`sae-class`
Examples
```r
d <- generateFakeData()
# first compute input estimates without "borrowing strength" over areas
sae0 <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop,
type="direct", keep.data=TRUE)
# compute small area estimates based on the basic area-level model
# using the above survey regression estimates as input
sae <- fSAE.Area(EST(sae0), MSE(sae0), X=sae0$Xp)
EST(sae) # estimates
RMSE(sae) # standard errors
```
`fSAE.Unit`
*Compute small area estimates based on the basic unit-level model.*
Description
This is the function that carries out most of the computational work. It computes small area estimates based on the basic unit-level model, also known as the Battese-Harter-Fuller model, although it is also called by `fSurvReg` and `fSAE.Area` to compute survey regression or area-level model small area estimates. By default, Hierarchical Bayes estimates are computed, using fast one-dimensional numerical integration to average over the posterior density for the ratio of between and within area variance. This way, the small area estimates and MSEs account for the uncertainty about this parameter. Besides hierarchical Bayes, REML and hybrid methods are supported. These methods use the REML estimate or posterior mean of the variance ratio, respectively, as a plug-in estimate. Both methods do not account for uncertainty about this parameter. Synthetic estimates are computed by setting the variance ratio to zero.
Usage
```r
fSAE.Unit(
y,
X,
area,
Narea = NULL,
Xpop = NULL,
fpc = TRUE,
v = NULL,
vpop = NULL,
w = NULL,
wpop = NULL,
method = "HB",
beta0 = rep(0, ncol(X)),
Omega0 = Diagonal(n = ncol(X), x = 0),
nu0 = 0,
s20 = 0,
)```
prior = function(x) rep.int(1L, length(x)),
CV = prod(dim(X)) < 1e+06,
CVweights = NULL,
silent = FALSE,
keep.data = FALSE,
full.cov = nrow(Xpop) < 1000L,
lambda0 = NULL,
rel.int.tol = 0.01,
...)
Arguments
y response vector of length n.
X n x p model matrix.
area n-vector of area codes, typically a factor variable with m levels, where m is the number of in-sample areas.
Narea M-vector of area population sizes, where M is the number of areas for which estimates are required. There should be a one-to-one correspondence with the rows of Xpop. This argument is required unless Xpop=NULL or fpc=FALSE.
Xpop M x p matrix of population means. If Xpop is not provided, only the model fit is returned.
fpc whether a finite population correction should be used. Default is TRUE.
v unit-level variance structure, n-vector. Defaults to a vector of 1s. In some cases it might be useful to take v proportional to the sampling probabilities.
vpop population area means of v, M-vector. Defaults to a vector of 1s. Not used when fpc is FALSE.
w area-level variance structure, m-vector. Defaults to a vector of 1s.
wpop area-level variance structure, M-vector. Defaults to a vector of 1s. Only components of wpop corresponding to out-of-sample areas are actually used.
method one of "HB", "hybrid", "REML", "synthetic", "survreg", "BLUP" where "HB" (default) does the full hierarchical Bayes computation, i.e. numerical integration over the posterior density for the between area variance parameter, "hybrid" computes the Best Linear Unbiased Predictor (BLUP) with the posterior mean for the variance parameter plugged in, "REML" computes the BLUP with the restricted maximum likelihood estimate of the variance parameter plugged in, "synthetic" computes synthetic estimates where the between area variance is set to 0, and "survreg" computes survey regression estimates where the between area variance approaches infinity. "BLUP" computes BLUP estimates with the value provided for lambda0 as a fixed plug-in value for the ratio of between and within area variance. Only method "HB" takes uncertainty about the between-area variance into account.
beta0 mean vector of normal prior for coefficient vector.
Omega0 inverse covariance matrix of normal prior for coefficient vector. Default prior corresponds to the (improper) uniform distribution.
nu0 degrees of freedom parameter for inverse gamma prior for residual (within-area) variance. Default is 0.
s20 scale parameter for inverse gamma prior for residual (within-area) variance. Default is 0.
prior prior density for the ratio \( \lambda = \text{between-area-variance} / \text{within-area variance} \). This should be a (vectorized) function that takes a vector lambda and returns a vector of prior density values at lambda. The density does not have to be normalized. The default is the (improper) uniform prior. The within-area variance and lambda are assumed independent a priori.
CV whether (an approximation to the) leave-one-out cross-validation measure should be computed. As this requires the computation of a dense matrix the size of \( X \), the default is to set CV to FALSE if the size of \( X \) is larger than a certain lower bound.
CVweights n-vector of weights to use for CV computation.
silent if FALSE, plot the posterior density for the variance ratio.
keep.data if TRUE return the input data \((y,X,\text{area},X\text{pop})\). This is required input for the cross-validation function CVArea.
full.cov if TRUE compute the full covariance matrix for the small area estimates. The computed correlations do not account for uncertainty about the variance ratio.
lambda0 optional starting value for the ratio of between and within-area variance used in the numerical routines. If method="BLUP" then this value will instead be used as a fixed plug-in value.
rel.int.tol tolerance for the estimated relative integration error (default is 1 percent). A warning is issued if the estimated relative error exceeds this value.
... additional control parameters passed to function integrate.
Details
The default Hierarchical Bayes method uses numerical integration (as provided by function integrate) to compute small area estimates and MSEs. The model parameters returned, such as fixed and random effects, are currently not averaged over the posterior distribution for the variance ratio. They are evaluated at the posterior mean of the variance ratio.
Value
An object of class sae containing the small area estimates and MSEs, the model fit, and model selection measures.
References
See Also
sae-class
Examples
```r
d <- generateFakeData()
# generate design matrix, variable of interest, area indicator and population data
dat <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop,
type="data")
# compute small area estimates based on the basic unit-level model
sae <- fSAE.Unit(dat$y, dat$x, dat$area, dat$Narea, dat$PopMeans)
EST(sae) # estimates
RMSE(sae) # standard errors
```
Description
This function computes survey regression estimates as a special case of unit-level model small area estimates with a (relatively) very large value for the between-area variance but without including area effects in the model fit. The model assumes a single overall variance parameter, so that the resulting estimated variances are not area-specific but smoothed. Varying inclusion probabilities may be taken into account by including them in the model, e.g. as an additional covariate, and/or as model variance structure by specifying arguments v and vpop, see fSAE.Unit. The resulting estimates may be used as input estimates for area-level model small area estimation.
Usage
```r
fSurvReg(y, X, area, Narea, Xpop, removeEmpty = TRUE, ...)
```
Arguments
- **y**: response vector of length n.
- **X**: n x p model matrix.
- **area**: n-vector of area codes, typically a factor variable with m levels, where m is the number of in-sample areas.
- **Narea**: M-vector of area population sizes.
- **Xpop**: M x p matrix of population means.
- **removeEmpty**: whether out-of-sample areas should be removed from the results. If FALSE these areas are retained in the vectors of estimates, but they will have (relatively) very large standard errors.
- **...**: optional arguments v and vpop passed to fSAE.Unit.
generateFakeData
Value
An object of class `sae` containing the survey regression small area estimates and their estimated variances.
References
See Also
`sae-class`
Examples
d <- generateFakeData()
# generate design matrix, variable of interest, area indicator and population data
dat <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop,
type="data")
sae <- fSurvReg(dat$y, dat$X, dat$area, dat$Narea, dat$PopMeans)
EST(sae) # estimates
RMSE(sae) # standard errors
---
generateFakeData Generate artificial dataset for demonstration and testing purposes.
Description
Generate artificial dataset for demonstration and testing purposes.
Usage
generateFakeData(
M = 50,
meanNarea = 1000,
sW = 100,
sB = 50,
sBx = 0.5,
samplingFraction = 0.1
)
Arguments
- **M**: number of areas.
- **meanNarea**: mean number of population units per area.
- **sW**: within area standard deviation.
- **sB**: between area standard deviation.
- **sBx**: random slope standard deviation.
- **samplingFraction**: sampling fraction used to draw a random sample from the population units.
Value
List containing sample (sam), population totals (Xpop), and true population means for four target variables (mY0, mY1, mY2, mY3).
Description
This function plots small area estimates with error bars. Multiple sets of estimates can be compared. The default ordering of the estimates is by their area population sizes. This method uses a plot function that is adapted from function `coefplot.default` of package `arm`.
Usage
```r
## S3 method for class 'sae'
plot(sae, ...,
n.se = 1,
est.names,
sort.by = NULL,
decreasing = FALSE,
index = NULL,
maxrows = 50L,
maxcols = 6L,
type = "sae",
offset = 0.1,
cex.var = 0.8,
mar = c(0.1, 2.1, 5.1, 0.1))
```
plot.sae
*Plot method for objects of class sae.*
Arguments
... sae objects, dc_summary objects (output by the summary method for simulation objects of package mcmcsae), or lists. The first object must be a sae object. In case of a list the components used are those with name `est` for point estimates, `se` for standard error based intervals or `lower` and `upper` for custom intervals. Instead of dc_summary objects matrix objects are also supported as long as they contain columns named "Mean" and "SD" as do dc_summary objects. Named parameters of other types that do not match any other argument names are passed to lower-level plot functions.
`n.se` number of standard errors below and above the point estimates to use for error bars. By default equal to 1. This only refers to the objects of class dc_summary and sae.
`est.names` labels to use in the legend for the components of the `...` argument
`sort.by` vector by which to sort the coefficients, referring to the first object passed.
`decreasing` if `TRUE`, sort in decreasing order (default).
`index` vector of names or indices of the selected areas to be plotted.
`maxrows` maximum number of rows in a column.
`maxcols` maximum number of columns of estimates on a page.
`type` "sae" for small area estimates (default), "coef" for coefficients, "ranef" for random effects.
`offset` space used between plots of multiple estimates for the same area.
`cex.var` the fontsize of the variable names, default=0.8.
`mar` a numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot.
Description
Plot method for objects of class weights.
Usage
```r
## S3 method for class 'weights'
plot(
x,
log = FALSE,
breaks = "Scott",
main = "Distribution of weights",
xlab = if (log) "log(weight)" else "weight",
ylab = "frequency",
col = "cyan",
...
)
```
print.sae
Arguments
x object of class weights as returned by function uweights.
log whether to log-transform the weights.
breaks breaks argument of function hist. Default is "Scott".
main main title of plot.
xlab x-axis label.
ylab y-axis label.
col colour.
... additional arguments passed to hist.
See Also
uweights, summary.weights
print.sae
Print method for objects of class sae.
Description
Print method for objects of class sae.
Usage
## S3 method for class 'sae'
print(x, digits = max(3L,getOption("digits") - 3L), ...)
Arguments
x object of class sae.
digits number of digits to display.
... additional arguments passed to print.default.
Description
Functions \texttt{fSAE}, \texttt{fSurvReg}, \texttt{fSAE.Area} and \texttt{fSAE.Unit} return an object of class \texttt{sae}. It contains information on the model fit as well as the small area estimates, error estimates and a few model selection measures. The functions listed below extract the main components from an object of class \texttt{sae}.
\texttt{EST(x, type="sae", tot=FALSE)} return the vector of small area estimates of \texttt{sae} object \texttt{x}. Alternatively, with type "coef" or "raneff" fixed or random effect estimates are returned. If 'tot=TRUE' and 'type="sae"' estimates for area population totals instead of means are returned.
\texttt{MSE(x, type="sae", tot=FALSE)} return the vector of mean squared errors of \texttt{sae} object \texttt{x}. Alternatively, with type "coef" or "raneff" \texttt{MSEs} of fixed or random effects are returned. If 'tot=TRUE' and 'type="sae"' \texttt{MSEs} for area population totals instead of means are returned.
\texttt{SE(x, type="sae", tot=FALSE)} extract standard errors, i.e. square roots of \texttt{MSEs}.
\texttt{RMSE(x, type="sae", tot=FALSE)} alias for \texttt{SE(x, type="sae", tot=FALSE)}
\texttt{relSE(x, type="sae")} extract relative standard errors.
\texttt{COV(x)} extract the covariance matrix for the small area estimates.
\texttt{COR(x)} extract the correlation matrix for the small area estimates.
\texttt{coef(x)} \texttt{coef} method for \texttt{sae} objects; returns vector of fixed effects.
\texttt{vcov(x)} \texttt{vcov} method for \texttt{sae} objects; returns covariance matrix for fixed effects.
\texttt{raneff(x, pop)} return vector of random effects. If \texttt{pop=TRUE} returns a vector for predicted areas (zero for out-of-sample areas), otherwise a vector for in-sample areas.
\texttt{raneff.se(x, pop)} return vector of standard errors for random effects.
\texttt{residuals(x)} \texttt{residuals} method for \texttt{sae} objects; returns a vector of residuals.
\texttt{fitted(x)} \texttt{fitted} method for \texttt{sae} objects; returns a vector of fitted values.
\texttt{se2(x)} extracts within-area variance estimate.
\texttt{sv2(x)} extracts between-area variance estimate.
\texttt{wDirect(x, pop)} extract vector of weights of the survey regression components in the small area estimates. If \texttt{pop=TRUE} returns a vector for predicted areas (zero for out-of-sample areas), otherwise a vector for in-sample areas.
\texttt{synthetic(x)} extract vector of synthetic estimates.
\texttt{CV(x)} extract leave-one-out cross-validation measure.
\texttt{cAIC(x)} extract conditional AIC measure.
\texttt{R2(x)} extract unit-level R-squared goodness-of-fit measure.
Other components include
\texttt{relErrM, relErrV} relative numerical integration errors in estimates and \texttt{MSEs}, for method "HB".
Examples
d <- generateFakeData()
# compute small area estimates
sae <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop)
coef(sae) # fixed effects
ranef(sae) # random effects
sv2(sae) # between-area variance
se2(sae) # within-area variance
cAIC(sae) # conditional AIC
summary.weights Summary method for objects of class weights.
Description
Summary method for objects of class weights.
Usage
## S3 method for class 'weights'
summary(object, ...)
Arguments
object object of class weights as returned by function uweights.
...
not used.
See Also
uweights, plot.weights
uweights
Compute unit weights underlying the small area estimates or their aggregate.
Description
The small area estimates can be interpreted as weighted sums of the response variable. This function computes the weights corresponding to the aggregated small area estimates or the weights corresponding to a specific small area estimate. The weights applied to the response variable need not exactly reproduce the Hierarchical Bayes estimate since the latter is averaged over the posterior distribution for the variance ratio whereas the weights are evaluated at the posterior mean. Under the default prior for the fixed effects, the weights applied to the design matrix reproduce the corresponding population numbers.
Usage
\texttt{uweights(x, areaID = NULL, forTotal = FALSE)}
Arguments
- \texttt{x} \hspace{1cm} sae object.
- \texttt{areaID} \hspace{1cm} if left unspecified (\texttt{NULL}), weights corresponding to the overall (aggregated) estimate are returned. Otherwise weights that reproduce the estimate for a specific area are returned.
- \texttt{forTotal} \hspace{1cm} if \texttt{FALSE} weights will be divided by the corresponding population size.
Value
An object of class \texttt{weights}.
See Also
\texttt{summary.weights}, \texttt{plot.weights}
Examples
\begin{verbatim}
d <- generateFakeData()
# compute small area estimates
sae <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop,
method="hybrid", keep.data=TRUE)
# compute unit weights
w <- uweights(sae, forTotal=TRUE)
summary(w) # summary statistics
plot(w) # histogram of weights
# checks
all.equal(sum(w * sae$y), sum(EST(sae) * sae$Narea))
all.equal(colSums(w * as.matrix(sae$X)), colSums(sae$Xp * sae$Narea))
\end{verbatim}
Index
aggr, 2
bench, 3
cAIC (sae-class), 18
cov.sae (sae-class), 18
COR (sae-class), 18
COV (sae-class), 18
CV (sae-class), 18
CVArea, 5
EST (sae-class), 18
fitted.sae (sae-class), 18
fSae, 2, 5, 6, 18
fSae.Area, 2, 5, 6, 9, 10, 18
fSae.Unit, 2, 5–7, 9, 10, 13, 18
fSurvReg, 2, 6, 7, 10, 13, 18
generateFakeData, 14
hbsae (hbsae-package), 2
hbsae-package, 2
hist, 17
integrate, 12
MSE (sae-class), 18
plot.sae, 15
plot.weights, 16, 19, 20
print.sae, 17
R2 (sae-class), 18
ranef (sae-class), 18
relSE (sae-class), 18
residuals.sae (sae-class), 18
RMSE (sae-class), 18
summary.weights, 17, 19, 20
sv2 (sae-class), 18
synthetic (sae-class), 18
uweights, 17, 19, 19
vcov.sae (sae-class), 18
wDirect (sae-class), 18
se2 (sae-class), 18
se (sae-class), 18
sae-class, 18
|
{"Source-Url": "https://cran.r-project.org/web/packages/hbsae/hbsae.pdf", "len_cl100k_base": 8589, "olmocr-version": "0.1.51", "pdf-total-pages": 21, "total-fallback-pages": 0, "total-input-tokens": 46854, "total-output-tokens": 10292, "length": "2e13", "weborganizer": {"__label__adult": 0.00035262107849121094, "__label__art_design": 0.0009741783142089844, "__label__crime_law": 0.0005536079406738281, "__label__education_jobs": 0.003963470458984375, "__label__entertainment": 0.0002465248107910156, "__label__fashion_beauty": 0.00022125244140625, "__label__finance_business": 0.001163482666015625, "__label__food_dining": 0.0004906654357910156, "__label__games": 0.0015459060668945312, "__label__hardware": 0.000973224639892578, "__label__health": 0.0005674362182617188, "__label__history": 0.0010461807250976562, "__label__home_hobbies": 0.00027060508728027344, "__label__industrial": 0.0012865066528320312, "__label__literature": 0.0004727840423583984, "__label__politics": 0.0007252693176269531, "__label__religion": 0.0005016326904296875, "__label__science_tech": 0.421630859375, "__label__social_life": 0.000274658203125, "__label__software": 0.060394287109375, "__label__software_dev": 0.5009765625, "__label__sports_fitness": 0.0004642009735107422, "__label__transportation": 0.0006189346313476562, "__label__travel": 0.00036263465881347656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34438, 0.02406]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34438, 0.63714]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34438, 0.74786]], "google_gemma-3-12b-it_contains_pii": [[0, 1302, false], [1302, 2125, null], [2125, 3490, null], [3490, 5956, null], [5956, 7314, null], [7314, 8934, null], [8934, 11460, null], [11460, 13121, null], [13121, 15327, null], [15327, 17050, null], [17050, 19385, null], [19385, 22041, null], [22041, 23781, null], [23781, 24834, null], [24834, 25924, null], [25924, 27792, null], [27792, 28488, null], [28488, 31320, null], [31320, 32636, null], [32636, 33673, null], [33673, 34438, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1302, true], [1302, 2125, null], [2125, 3490, null], [3490, 5956, null], [5956, 7314, null], [7314, 8934, null], [8934, 11460, null], [11460, 13121, null], [13121, 15327, null], [15327, 17050, null], [17050, 19385, null], [19385, 22041, null], [22041, 23781, null], [23781, 24834, null], [24834, 25924, null], [25924, 27792, null], [27792, 28488, null], [28488, 31320, null], [31320, 32636, null], [32636, 33673, null], [33673, 34438, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34438, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34438, null]], "pdf_page_numbers": [[0, 1302, 1], [1302, 2125, 2], [2125, 3490, 3], [3490, 5956, 4], [5956, 7314, 5], [7314, 8934, 6], [8934, 11460, 7], [11460, 13121, 8], [13121, 15327, 9], [15327, 17050, 10], [17050, 19385, 11], [19385, 22041, 12], [22041, 23781, 13], [23781, 24834, 14], [24834, 25924, 15], [25924, 27792, 16], [27792, 28488, 17], [28488, 31320, 18], [31320, 32636, 19], [32636, 33673, 20], [33673, 34438, 21]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34438, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-04
|
2024-12-04
|
d665b9cd05d945a24f1834993a4fd4c30ec7d85e
|
COMPUTER PROGRAM VERSION MANAGEMENT SYSTEM WITH REDUCED STORAGE SPACE AND ENABLING MULTIPLE PROGRAM VERSIONS TO HAVE THE SAME NAME
Inventor: Takahide Ohkami, Newton, Mass.
Assignee: Mitsubishi Electric Information Technology Center America, Inc., Cambridge, Mass.
Filed: Nov. 21, 1995
Related U.S. Application Data
Continuation of Ser. No. 315,286, Sep. 29, 1994, abandoned.
Int. Cl. .......................... G06F 9/00
U.S. Cl. .......................... 395/619; 395/616; 364/DIG. 1; 364/286; 364/282.3; 364/231.6
Field of Search .......................... 395/619, 616; 364/DIG. 1
References Cited
U.S. PATENT DOCUMENTS
4,558,413 12/1985 Schmidt et al. .......................... 364/300
4,809,170 2/1989 Leblang et al. .......................... 364/200
4,912,637 3/1990 Sheedy et al. .......................... 364/300
OTHER PUBLICATIONS
"The Unix operating system". Kaare Christian, 1983 The Rockefeller University of Ny. pp. 141–149.
Primary Examiner—Thomas G. Black
Assistant Examiner—Jean R. Homere
Attorney, Agent, or Firm—Robert K. Tendler, Esq.
ABSTRACT
A computer program version update system reduces storage space usage and enables calling programs to invoke any version of a program using the same name by storing only modified modules of a program for different program versions. Multiple versions of a program can thus have the same name. Any version of the program may be constructed from the modules upon command with a user issuing such a command and including a version number corresponding to the requested version as a parameter to invoke a program construction procedure.
2 Claims, 11 Drawing Sheets
Fig. 1D
(Prior Art)
Fig. 3
Fig. 4
START
GET THE VERSION NUMBER OF THE PROGRAM
ACCESS THE CONFIGURATION TABLE CTBL
ACTIVATE RTBLn AND SEND THE APPROPRIATE REVISION NUMBER
DONE?
NO
YES
LINK THE MODULE REVISIONS IN THE BUILD AREA TO GENERATE THE VERSION OF THE PROGRAM
END
Fig. 6
START
GET REVISION NUMBER OF THE MODULE 200
COPY MODULE REVISION TO BUILD AREA 210
END
Fig. 7
START
GET REVISION NUMBER OF THE MODULE 200
COMPILE THE MODULE REVISION SOURCE FILE TO GENERATE A MODULE REVISION OBJECT FILE 250
MOVE THE MODULE REVISION OBJECT FILE TO THE BUILD AREA 260
END
Fig. 8
START
GET THE VERSION NUMBER AND THE PROGRAM NAME
CREATE A BUILD AREA IF THE BUILD AREA DOES NOT ALREADY EXIST
ACCESS THE CONFIGURATION TABLE CORRESPONDING TO THE PROGRAM NAME
ACTIVATE RTBLn CORRESPONDING TO THE PROGRAM NAME AND SEND THE APPROPRIATE REVISION NUMBER
DONE?
NO
YES
LINK THE MODULE REVISIONS IN THE BUILD AREA TO GENERATE THE VERSION OF THE PROGRAM
EXECUTE THE PROGRAM
END
Fig. 9
Fig. 10
Fig. 11
START
GET THE REVISION NUMBER OF THE MODULE
400
IS THIS A LEAF DIRECTORY?
410
NO
ACTIVATE RTBL \( n_1/.../n_y \)
AND SEND THE APPROPRIATE REVISION NUMBER
420
YES
COPY THE MODULE REVISION TO THE BUILD AREA
430
END
1
COMPUTER PROGRAM VERSION
MANAGEMENT SYSTEM WITH REDUCED
STORAGE SPACE AND ENABLING
MULTIPLE PROGRAM VERSIONS TO HAVE
THE SAME NAME
This is a continuation of application Ser. No. 08/315,286
filed on Sep. 29, 1994, and now abandoned.
FIELD OF THE INVENTION
This invention generally relates to computer systems for
managing version updates of a computer program and for
constructing a computer program from structured modules.
BACKGROUND OF THE INVENTION
Most current systems have difficulties handling multiple
versions of a computer program. One problem is that storing
multiple versions of a program requires a large amount of
storage space. Another problem is that different versions of
the program have to have different names which requires
administrative coordination in a multi-user system in which
different versions of the programs are being used by different
individuals.
Software users also typically prefer to have access to
more than one version of a program. However, before
discussing some conventional methods for providing more
than one version and their associated drawbacks, the reasons
behind why there are typically multiple versions of a pro-
gram will be briefly discussed.
In order to manage development of a computer program,
a software developer often modularizes the computer pro-
gram into several interrelated modules. For example, the
developer of a large data processing program might divide
a program into separate main, read, compute and print
modules. Accordingly, the main, read, compute and print
modules contain the portions of the program pertaining to
controlling the program, reading data, processing data, and
printing results, respectively.
When the program reaches the commercial environment,
it becomes a product and has a product life cycle. During the
product life cycle of a program, software developers may
modify an initial revision of a module, i.e., the original
version of the module. This is accomplished by creating a
copy of the initial revision, changing the copy and storing
the copy as a new revision. For instance, part of the program
may not operate correctly and the developer may need to
change a section of source code to fix the error. The
developer may also wish to add an enhancement to the
program. Modification of an initial module revision results
in a module having two revisions and the program having
two versions, the first version being generated from the
initial revision and the second version being generated from
the new revision.
Typically, software developers store all the module revi-
sions for a program in one directory, i.e., a conventional
system of structuring modules. For example, the module
revisions needed to generate a program named "my_prog"
may include modules named "main", "read", "comp" and
"print". Software developers typically rename the second
revision of a module, since most computer platforms, i.e.,
the combination of computer hardware and software, do not
permit multiple files such as module revisions to exist in the
same subdirectory with the same name. For instance, if the
modules are written in the C programming language, the
initial revision of the "read" module might be called "read.c"
and stored in a directory, and the new revision might be
called "read2.c" and stored in the same directory.
Additionally, software developers usually use a conven-
tional program construction procedure, which is commonly
referred to as a build procedure, to construct a version of a
program from the module revisions stored in a single
directory. The software developer must modify the program
construction procedure to accommodate each new revision of
a module. Thus, the program construction procedure, for
the example above, must be modified to use "read2.c" for
constructing the second version of the "my_prog" program.
Software users often prefer to have both an old version
and a new version of a program available. For example, the
user may wish to keep the original version of the "my_
prog" program since the new version of the "my_prog"
program may no longer support reading an old database, and
may wish to use the new version of the "my_prog" program
in order to utilize a new enhancement that is not available
with the original version. A conventional solution to pro-
viding access to both the new version and the old version is
to store both versions of the program on the computer
system.
However, storing two or more versions of a program on
the same computer system has several drawbacks. One
drawback is that storing multiple versions of a program
wastes disk space. This drawback is particularly pronounced
when each version is very large. For instance, four versions
of an original 80 MB program might require 320 MB of disk
space if all versions are to be stored.
Another drawback is that many computer platforms pro-
hibit two versions of a program from existing together in the
same subdirectory with the same name, as described earlier
with respect to storing multiple module revisions on the
same computer platform. One solution to overcome this
drawback is for the user to rename the second version of the
program so that both versions can be stored in the same
subdirectory. However, this solution creates other draw-
backs if the version is invoked or "called" by another
program referred to as a "calling" program.
A user typically modifies a calling program each time the
user wishes to have the calling program use different
version of the called program. In the example above, where
the first version of the "my_prog" program is named
"my_prog" and the second version is named "my_prog2",
the user would typically change a variable of the calling
program from "my_prog" to "my_prog2". However, this
cannot be done if the version name is "hardcoded" into the
calling program, i.e., if the calling program is in executable
form and cannot be modified.
Another solution is to store each version of the called
program in a different directory. In this case, the user must
swap the versions between directories so that the calling
program uses the correct version of the called program.
Alternatively, different paths may be specified or the direc-
tory must be specified. Additionally, the user must remember
where each version of the called program is located and
which version is presently being used. It should be apparent
that this solution requires a considerable amount of time
and effort from the user. An additional problem is that sometimes
a program expects that data used by it is located in a
directory relative to the directory in which the program is
found. That is, generally speaking, a program assumes that
it operates and exists in a particular environment. This
assumption is hard-coded in the program.
In view of the above-described drawbacks to the conven-
tional system, it would be very useful to provide a system
that enables a user to access multiple versions of a program while saving disk space. Furthermore, it would also be very useful to provide a system that reduces the amount of time and effort that a user expends when making a calling program use a new version of a called program.
**SUMMARY OF THE INVENTION**
To overcome these problems and limitations, a version update management system improves storage space usage and enables calling programs to invoke any version of a program using the same name by storing only modified modules of different versions of the computer program and by constructing a version of the program from these modules upon command. A user may easily construct a particular version of the program by invoking a program construction procedure and passing a version number corresponding to the requested version as a parameter. Alternatively, the program construction procedure may be invoked by a calling program. Optionally, the program construction procedure automatically invokes the version of the program after completing construction thereby either saving the user time and effort normally needed to invoke the program manually or saving the calling program from having to issue two instructions, one to invoke the program construction procedure and the other to invoke the constructed version of the program.
This invention improves storage space usage since each version of the program does not need to be permanently stored in memory. Thus, only modified modules need to be stored. Furthermore, if a calling program invokes the program construction procedure, the calling program may invoke any constructed version of the program by the same name since only the version to be invoked needs to exist at any time. Accordingly, problems related to storing multiple versions of a program in the same directory using the same name are avoided. Thus, in the above example, only 70-85 MB of storage is required as compared to 320 MB.
Accordingly, in one aspect of the invention, the system comprises a configuration unit that stores a plurality of version entries, each version entry corresponding to a constructable version of the program. The system further comprises a plurality of revision units, each revision unit selecting a module revision from a plurality of module revisions of a module. The system also includes a program generator that receives a version number indicating the version of the program to be constructed, reads a version entry from the configuration unit according to the version number, activates each revision unit of the plurality of revision units to select module revisions from the modules according to the version entry, and generates the version of the program from the selected module revisions. The program is constructed when the version is generated.
In another aspect of the invention, the system comprises a memory device that stores logic signals, and a processor that reads the logic signals from the memory device. The processor receives the version number of the program to be constructed, accesses a version entry from a configuration table having a plurality of version entries according to the version number, selects a set of module revisions from a module repository having a plurality of module revisions according to the version entry, and generates the version of the program from the selected set of module revisions to construct version of the program.
In yet another aspect of the invention, an apparatus comprises a module repository having a plurality of subdirectories, each subdirectory including at least one module revision. The apparatus further includes means for selecting a set of module revisions from the module repository according to a set of revision numbers; and means for receiving the version number, activating the means for selecting, providing the set of revision numbers to the means for selecting according to the version number; and generating the version of the program from the selected set of module revisions to construct the version of the program.
In another aspect of the invention relates to a computerized system for automatically executing a version of a program. This aspect involves the system comprising means for receiving a version number of the program to be executed; means for selecting a set of module revisions from a module repository according to the version number; means for generating a program from the selected set of module revisions; and means for executing the generated program.
Another aspect of the invention is directed to an apparatus for constructing a version of a program having a plurality of versions, each version being defined by a set of modules, each module having at least one module revision. The apparatus comprises a module repository having a plurality of subdirectories, each subdirectory corresponding to a module of the set of modules, each subdirectory having at least one file corresponding to a module revision. The apparatus also includes a program generator that selects the set of modules, retrieves the module revisions, and generates the version of the program from the retrieved module revisions. The version is constructed when the program is generated.
**BRIEF DESCRIPTION OF THE DRAWING**
The present invention will be more completely understood through the following detailed description which should be read in conjunction with the attached drawing.
FIG. 1A is a diagram illustrating memory use in the prior art for storing multiple versions of a computer program;
FIG. 1B is a block diagram illustrating one embodiment of the present invention for storing multiple versions of a computer program;
FIG. 1C is a more detailed diagram of FIG. 1B;
FIG. 1D is a block diagram of a conventional computer system using a conventional program structure;
FIG. 2 is a diagram illustrating a relationship between components of the invention and four versions of a program, by way of example, in accordance with an embodiment of the invention;
FIG. 3 is a diagram of an example of a module repository in accordance with an embodiment of the invention;
FIG. 4 is a diagram of a module repository in accordance with an embodiment of the invention;
FIG. 5 is a block diagram of a system in accordance with an embodiment of the present invention;
FIG. 6 is a flow chart of the operation of a program generator in accordance with an embodiment of the invention;
FIG. 7 is a flow chart of the operation of a revision unit in accordance with an embodiment of the invention;
FIG. 8 is a flow chart of the operation of an alternative revision unit in accordance with an embodiment of the invention;
FIG. 9 is a flow chart of the operation of an alternative program generator in accordance with an embodiment of the invention;
FIG. 10 is a diagram of a module repository in accordance with an embodiment of the invention; and
FIG. 11 is a flow chart of the operation of a revision unit in accordance with an embodiment of the invention.
DETAILED DESCRIPTION
Referring now to FIG. 1A, if a computer 1 includes a 500 MB disk 2 in which 300 MB are free and 200 MB are already used, and a user wants to add two versions of a program “ABC” as indicated at 3, 4, 5 and 6, and requiring a total of 320 MB, there will be insufficient disk space. Also, the user will have to be concerned about the naming of the versions that can be stored within the free disk space.
In contrast, with the present invention there is a module repository 7 in which the non-redundant modules of the different versions of programs are stored, as indicated at M1, M2, M3, M4, and M4'. A program generator 8, in response to a request for a version of program “ABC”, accesses the appropriate modules in the module repository to generate an executable version of the program named “ABC”. This process reduces the amount of disk space used and eliminates the need to rename different versions of the same program. The program generator may access the appropriate modules from the module repository according to a table indicating the correspondence between modules and versions of the program, as will be described in more detail in FIG. 1C.
In FIG. 1C, a number of programs, referenced to as “program 1” through “program 6”, provide execution requests indicating a name of a program, e.g., “ABC”, and a version number to the program generator 8. A program generator includes a fetch module 8A which retrieves a list of modules from a conversion table 8B according to the version of the program indicated in the execution request being processed. Upon receipt of the version list, the program generator gives the version list to a compiler and link module 8C which selects modules from the module repository 7, compiles them (if necessary) and then links the compiled modules to create the executable version. The executable version of the program is named, for example, “ABC”, as indicated at 9. This name is independent of the version number.
More particularly, referring now to FIG. 1D, this figure shows a conventional computer system 17 storing multiple versions of a program. Input device 10 enables a user to enter data and commands into the system 17. Input device 10 may take the form of a keyboard, mouse, scanner, modem, network interface or any other device that provides data and commands to the system. Processing unit 11 receives data and commands from the input device 10 through system bus 15. The processing unit 11 performs a number of operations including running an operating system to manage system resources, executing commands received from the input device and running programs stored in memory 16. Memory 16 comprises primary memory 12 and secondary memory 13. Primary memory 12 typically refers to electronic circuit memory that very quickly receives and provides information in the form of logic signals. Secondary memory 13 refers to non-volatile storage media such as magnetic, magneto-optical and optical disk, magnetic tape and the like, which store information for longer periods of time but respond more slowly than the primary memory 12. Also coupled to processing unit 11 via bus 15 is output device 14 that displays output from the processing unit. Output device 14 includes any conventional output device such as a video display or printer that conveys information back to a user.
By way of example, FIG. 1D shows secondary memory 13 as storing multiple versions of a program ABC. In particular, the four versions of program ABC are V1.0, V2.0, V2.5, and V3.0, as shown in FIG. 1D with their respective memory storage sizes in megabytes (MB), shown by way of example. Each of the four versions of a program ABC V1.0, V2.0, V2.5 and V3.0 are shown in FIG. 1D as being stored in secondary memory 13. Storing these versions in this example requires a total of 320 MB of storage space. Each program version is stored using a different name.
Having described a conventional system for structuring modules and for constructing a program, and the associated drawbacks, the present invention will be discussed hereinbelow.
It should be noted that the invention applies not only to a conventional computer system 17, as shown in FIG. 1D, but also to many other types of computer configurations including mainframes, workstations, personal computers, distributed environments, computers using multiple portions on a disk and network file systems, and the like.
FIG. 2 is a diagram illustrating a relationship between some components of the invention according to an embodiment. In the invention, the computer stores module revisions in a module repository 20 having a subdirectory for each module. The module repository 20 is located on secondary memory 13. By way of example, the secondary memory 13 stores module repository 20 having module revisions M1', M2', M3', M3'', M4' and M4'' and using 130 MB of storage space as shown in FIG. 2. By way of example, the module revisions which would have been used when constructing versions of the program ABC in the above-described conventional example are shown stored in subdirectories 30, 31, 32 and 33. M1' is stored in the M1 subdirectory 30; M2' and M2'' are stored in the M2 subdirectory 31; M3', M3'' and M3''' are stored in the M3 subdirectory 32; and M4' and M4'' are stored in the M4 subdirectory 33. The total storage space required for these modules is 130 MB which is significantly less than the amount for the conventional example.
Thus, in this example, none of the versions of the program ABC are constructed or stored until execution time. Accordingly, the invention saves the 190 MB of storage space (320 MB-130 MB), i.e., the difference between the amount of storage space required to store the multiple versions of the program and the storage space required to store the module repository 20 used to construct the different versions. Memory usage is reduced by eliminating storage of duplicated program code and modules.
FIG. 2 further shows a configuration table 50 that contains information on how each version of the program is to be constructed. A plurality of version entries store this information wherein each version entry corresponds to a version of the program and has a set of the module revisions to be used when constructing the particular version of the program. For example, the second entry of the configuration table 50 in FIG. 2 shows that version V2.0 of program ABC uses module revisions M1', M2', M3'' and M4'.
Also shown by way of example in FIG. 2, are symbolic representations of the versions of the program 60, 61, 62 and 63. According to the invention, any of the four versions shown may be generated from the module repository 20 and the configuration table 50. Any version of the program and the configuration table may be stored either in the module repository 20 or elsewhere in the secondary memory. The preferred location to store the configuration table 50 is in a parent directory, i.e., the top level directory, of the module
repository 20. The parent directory is also the preferred location for temporarily storing the constructed version of the program although the invention has the flexibility to store the version in other locations such as a utilities directory after construction is completed.
Additionally, the invention has the flexibility of enabling the module repository 20 to be located anywhere in memory. For example, using a UNIX operating system and file system, the module repository may be located in the root directory, a separate portion, a lower subdirectory, a remotely mounted network file system of another computer system, several network file systems spread across a distributed computer network, and the like.
Furthermore, the invention has the flexibility of storing the configuration table 50 either in a directory outside the module repository 20 or within the module repository 20. The preferred location for the configuration table 50 is the parent directory of the module repository 20.
FIG. 3 shows a diagram of the directory structure of the module repository 20 for the invention using the example described above. Here, the parent directory 80 uses the same name as the program, i.e., ABC for convenience only. The configuration table 85, named CTBL in this example, is located in parent directory 80. The module subdirectories 30, 31, 32 and 33 shown in FIG. 2 are also shown in FIG. 3 located under the parent directory 80.
According to an embodiment of the invention, a number of revision tables are also provided. By way of example, the revision tables are named RTBL 90, 91, 92 and 93 and located in the modules subdirectories. Each revision table has at least one revision entry that matches a revision number to an actual filename in memory.
FIG. 4 is a general diagram of the directory structure in accordance with an embodiment of the invention. As shown in FIG. 4, the parent directory 180 may take any name but preferably the name of the program for convenience purposes, e.g., PRG. The configuration table 150 contains version entries indicating which module revisions are used for each version of the program. Module subdirectories 130, 131 and 132 depict a plurality of subdirectories storing module revisions for each module of program PRG. Each module subdirectory includes a revision table 190, 191 or 192 which indicates the actual filename for a particular module revision. In the general case, there are x modules for program PRG. Module n has r number of revisions; module n has s number of revisions; and module x has t module revisions, wherein x, r, s and t are all positive integers.
FIG. 5, similar to FIGS. 1B and 1C above, shows a block diagram of the system in accordance with an embodiment of the invention. Program generator 100 receives a version number. The version number may be received from a user through the input device 10 or received as an argument from a calling program. As an option, if the computer system has more than one program construction procedure for constructing more than one program, the user may also pass a program name to the program generator 100 using the input device 10 to identify which program is to be constructed.
Program generator 100 interfaces with configuration table 50 by issuing a read request and receiving a version entry. Program generator 100 also interfaces with a plurality of revision routines 290, 291, etc. Each revision routine refers to the module repository 20 and more particularly to a module subdirectory by receiving a module revision number and selecting a particular filename from the module subdirectory. Additionally, the program generator interfaces with the module repository directly by issuing a program generation request, accessing a set of selected module revisions and generating a version of the program 65.
The invention according to the above described embodiments applies to constructing an executable version of the program from object modules. Each module revision may refer to an object module generated by a compiler from a source code module. For example, if the computer platform were a UNIX platform, and if the program was written using the C programming language, the module revisions would be object files having filenames ending with a "o" extension.
Nevertheless, the invention is also applicable to constructing a version of a program when the module revisions are source code modules rather than object modules.
Having thus described the structure of an embodiment of the present invention, the operation of the embodiment will now be discussed hereinbelow.
FIG. 6 is a flow chart describing the operation of the program generator 100 for the structure shown in FIG. 5 in accordance with an embodiment of the invention. The program generator 100 receives a version number from either a user or a calling program in step 110. The version number indicates which version of the program to construct. The program generator 100 then accesses the configuration table CTBL as shown in step 120. When accessing the configuration table, the program generator finds a version entry corresponding to the version number received in step 110. The version entry indicates which module revisions are to be used to construct the version of the program. The program generator 100 then activates a revision routine for a module and passes to the revision routine the appropriate module revision number according to the version entry as shown in step 130. The revision routine will select the appropriate module revision filename to be used when constructing the program according to the passed module revision number. This step may include copying or moving the module revision to another directory. The program generator may repeat the above step by activating another revision routine and passing to the other revision routine an appropriate module revision number for the module revision that is to be used for constructing the version of the program as shown by step 140. Once all of the module revisions have been selected, the program generator 100 links the module revisions and generates the version of the program as shown in step 150. The version of the program is deemed to be constructed when the generation phase of step 150 is complete.
The operation of the revision routines will now be discussed in more detail. FIG. 7 shows a flow chart of the operation of a revision routine for a module when the module revisions are object modules. The revision routine receives a revision number from the program generator 100. The revision number indicates which revision of the module to be used. The revision routine then accesses a revision table corresponding to the module and finds the filename for the module revision to be used. The revision routine copies the file to a build area as shown in step 210 before returning control to the program generator. The build area is a subdirectory in memory that stores the module revisions to be used when constructing the program.
FIG. 8 shows the operation of the revision routines when the module revisions are source modules. The revision routine receives the revision number as shown in step 200. Then, the revision routine compiles the appropriate source module according to the revision number to generate an object module as shown in step 250. The revision routine
then moves the object module to the build area as shown in step 260, and returns control to the program generator 100.
When the version of the program is constructed, the program generator will name the program with a general name independent of the version number. This naming convention is achievable without any drawbacks because the user or calling program requesting the version plans to use the requested version and no other version simultaneously. Therefore, there can be no conflict arising from trying to store different versions in the same subdirectory with the same name. As an option, the version may be deleted immediately after execution to recover disk space.
FIG. 9 shows a flow chart of the operation of the program generator 100 including a few options. Specifically, this operation creates the build area if it does not already exist as shown in step 115. Additionally, this embodiment automatically executes the version of the program once it is generated as shown in step 160. These options are independent and, therefore, may be included one at a time or together in an embodiment.
Other options also may be included such as automatically deleting any existing versions of the program before generating the version, moving the version of the program to a new subdirectory after it is generated, and receiving additional arguments and passing them to the version of the program when the program is automatically executed. Furthermore, the program generator may wish to delete all the module revisions stored in the build area after constructing the version of the program.
FIG. 10 shows a diagram of a directory structure in accordance with another embodiment of the invention. In this embodiment, the module repository has multi-layered subdirectories 310, 311, etc. branching from the parent directory. The intermediate subdirectories such as 312 are considered branches and contain entries pointing to lower level subdirectories. Thus, this structure is recursive. The lowest subdirectory of each branch, such as subdirectory 313, contains the program modules. Both the intermediate subdirectories and the lowest subdirectories contain revision routines.
The second embodiment may use the same program generator 100 to activate revision routines in the subdirectories located within the first level as shown in FIG. 5 and described above. However, each revision routine is recursive and operates as shown in FIG. 11. The revision routine receives the revision number of the module as shown in step 400. Then, the revision routine tests to see whether the current subdirectory is a branch or a leaf directory as shown in step 410. If implementing this embodiment on a UNIX system using a shell script, a simple “if” statement using the “test” command accomplishes this test step. If the subdirectory is a branch directory, the operation shifts to step 420 and the revision routine recursively activates another revision routine located in a lower subdirectory. If the subdirectory is a lowest directory, the operation shifts to step 430 and the module revision is either copied or moved to the build area. Finally, control returns to the program generator.
Numerous other variations of the above-described embodiments can be implemented according to the type of computer platform using the invention. For example, the program generator 100 and revision routines 190, 191, etc. may be implemented in the form of a shell scripts on UNIX platforms. Also, the configuration table 50 may be stored within the same shell script in the form of a matrix or series of variables to reduce the number of file accesses. Similarly, the revision tables may be combined and stored within the revision routines. Furthermore, rather than construct executable programs, the invention may be applied towards constructing command files, data files, object libraries, text libraries and similarly constructed collections of data and/or code.
In another variation, the module repository may be stored in a compressed format, decompressed during the module creation process, and recompressed after the module creation process has completed. This variation may be implemented using conventional compression and decompression tools such as pkzip.exe and pkunzip.exe, respectively, which are available on many personal computers.
With this invention large amounts of disk space may be saved since versions of programs no longer need to be permanently stored in memory. Furthermore, the amount of effort required by a user when switching between called versions is reduced since situations of trying to store different versions with the same name in the same directory are now avoided and version construction and execution is automated.
The Appendix shows an example of several components of an embodiment of the present invention implemented with shell scripts on a UNIX platform. The UNIX platform consists of an HP720 computer available from Hewlett-Packard of Palo Alto, Calif., using the HP-UX operating system, version 9.03. Example 1 shows, by way of example, an output generated by the shell scripts. Example 2 is a shell script that invokes the program generator. Example 3 is the program generator that contains the configuration table within a “switch” statement. Optionally, the configuration statement may be stored in a separate file which is accessed by the program generator. Examples 4–7 show revision routines which are invoked by the program generator. Additionally, the shell script shown in Example 2 shows, as an option, a command that automatically invokes the program with arguments once the program generator has completed constructing the program.
This invention applies to multi-user environments such as large mainframe computer systems which service many users simultaneously. Multiple users wishing to access different versions of the same program may construct the program using any embodiment discussed above, and optionally moving the constructed version to a private directory for personal access. In this case, each user may access a different version of the program without any inconvenience, particularly if the private directory belongs to the user’s search path.
Having now described a few embodiments of the invention, and some modifications and variations thereto it should be apparent to those skilled in the art that the foregoing is merely illustrative and not limiting, having been presented by way of example only. Numerous modifications and other embodiments are within the scope of one of ordinary skill in the art and are contemplated as falling within the scope of the invention as limited only by the appended claims and equivalents thereto.
APPENDIX
Example 1: Output
*** Current Directory
nausica:ohkami[1] pwd
/tmp_mnt/homes/ohkami/doc/patent/prog2
*** Directory Structure
Execute* prog/ typescript
./prog:
comp/ ctbl* main/ print/ prog* read/
./prog/comp:
Makefile comp.o comp_0.c comp_1.c ctbl*
./prog/main:
Makefile main.o main_1.c prog_0.h prog_2.h
ctbl* main_0.c main_2.c prog_1.h
./prog/print:
Makefile ctbl* print.o print_0.c print_1.c print_2.c
./prog/read:
Makefile ctbl* read.o read_0.c read_1.c read_2.c
*** Make prog(version 0)
nausica:ohkami[3] Execute prog v0
-- Modules: main read comp print
-- main v0
cc -Aa -c main_0.c
-- read v0
cc -Aa -c read_0.c
-- comp v0
cc -Aa -c comp_0.c
-- print v0
cc -Aa -c print_0.c
... main:v0
... read:v0
... comp:v0
... print:v0
-25-
*** Make prog(version 1)
nausica@ohkami[4] Execute prog v0
-- Modules: main read comp print
-- main v0
cc -Aa -c main_0.c
-- read v1
cc -Aa -c read_1.c
-- comp v1
cc -Aa -c comp_1.c
-- print v0
cc -Aa -c print_0.c
... main(v0)
... read(v0)
... comp(v0)
... print(v0)
<<< Usage: comp n
*** Make prog(version 2)
nausica@ohkami[5] Execute prog v1
-- Modules: main read comp print
-- main v1
cc -Aa -c main_1.c
-- read v1
cc -Aa -c read_1.c
-- comp v1
cc -Aa -c comp_1.c
-- print v1
cc -Aa -c print_1.c
... main(v1)
... read(v1)
... comp(v1)
... print(v1)
<<< Usage: comp n
*** Make prog(version 3)
nausica@ohkami[6] Execute prog v2
-- Modules: main read comp print
-- main v2
cc -Aa -c main_2.c
-- read v2
cc -Aa -c read_2.c
-- comp v1
cc -Aa -c comp_1.c
-- print v2
cc -Aa -c print_2.c
... main(v2)
... read(v2)
... comp(v1)
... print(v2)
<<< Usage: comp [-p] n
*** Done - exit
nausica@ohkami[7] exit
exit
-26-
Example 2: A Shell Script
==================================================================================================
=== File: Execute
#!/bin/csh
# $1: program name
# $2: program version
# $3-$9: program arguments
cd $1
cdbl $1
if (-e $1 ) $1 $3 $4 $5 $6 $7 $8 $9
defif
cd .
$ end of file
Example 3: A Program Generator
==================================================================================================
=== File: prog/cdbl
#!/bin/csh
# cdbl for prog
set MODULES = (main read comp print)
echo "-- Modules: $MODULES"
switch ($1)
case v0:
set VRSH = (v0 v0 v0 v0)
breaksw
case v1:
set VRSH = (v0 v1 v1 v0)
breaksw
case v2:
set VRSH = (v1 v1 v1 v1)
breaksw
case v3:
set VRSH = (v2 v2 v2 v1)
breaksw
endsw
set VRSH = (dummy $VRSH)
set OJBS = ()
rm -f prog
doresch mod ($MODULES)
shift VRSH
echo "-- $mod $VRSH[1]"
cd $mod
crm -f *.o
cdbl $VRSH[1]
cd ..
set OBJJS = ($OBJJS $mod/$mod.o)
end
cc -o prog $OBJ
Example 4: A Revision Routine
""""File: prog/main/ctbl
#!/bin/csh
# ctbl for main
switch ($1)
case v0:
set OBJ = main_0.o
breaksw
case v1:
set OBJ = main_1.o
breaksv
case v2:
set OBJ = main_2.o
breaksv
endsw
make $OBJ
mv $OBJ main.o
Example 5: A Revision Routine
""""File: prog/read/ctbl
#!/bin/csh
# ctbl for read
switch ($1)
case v0:
set OBJ = read_0.o
breaksw
case v1:
set OBJ = read_1.o
breaksv
case v2:
set OBJ = read_2.o
breaksv
endsw
make $OBJ
mv $OBJ read.o
# ctbl - end of file
Example 6: A Revision Routine
===============================================
*** File: prog/comp/ctbl
#!/bin/csh
# ctbl for comp
switch ($1)
case v0:
set OBJ = comp_0.o
breaksw
case v1:
set OBJ = comp_1.o
breaksw
case v2:
set OBJ = comp_2.o
breaksw
endsw
make $OBJ
mv $OBJ comp.o
# ctbl - end of file
Example 7: A Revision Routine
===============================================
*** File: prog/print/ctbl
#!/bin/csh
# ctbl for print
switch ($1)
case v0:
set OBJ = print_0.o
breaksw
case v1:
set OBJ = print_1.o
breaksw
case v2:
set OBJ = print_2.o
breaksw
endsw
make $OBJ
mv $OBJ print.o
# ctbl - end of file
I claim:
1. A system for constructing an executable version of a program having a plurality of versions, each of said versions being made up of compiled modular program portions constituting replaceable parts, with said parts including a set of data and procedures, comprising:
a configuration unit for storing a plurality of executable version entries, each entry representing an executable version of said program and specifying the ones of said replaceable parts required to construct the executable version of said program;
means for storing a plurality of said modular program portions in compiled form as module revisions;
a plurality of module revision units, each revision unit selecting a module revision from said plurality of module revisions;
a version identifier indicating the executable version of the program to be constructed; and,
a program generator for receiving said version identifier, for reading a version entry from said configuration unit corresponding to said version identifier, for activating each of said revision units to select module revisions corresponding to said version identifier, and for generating the complete executable form of said program from selected module revisions.
2. An apparatus for constructing an executable version of a program having a plurality of versions, each executable version being constructable from a set of modular revisions comprising:
a repository having a plurality of subdirectories, each subdirectory including at least one previously compiled executable previously compiled modular revision;
means including means for generating a set of revision numbers corresponding to a desired previously compiled executable version of said program for selecting a set of executable revisions from said repository according to said set of revision numbers; and,
means for receiving said version number, activating said means for selecting, providing the set of revision numbers to the means for selecting according to said version number, and generating the executable version of the program from the selected set of revisions to construct the executable version of the program.
* * * * *
|
{"Source-Url": "https://image-ppubs.uspto.gov/dirsearch-public/print/downloadPdf/5603027", "len_cl100k_base": 9541, "olmocr-version": "0.1.53", "pdf-total-pages": 23, "total-fallback-pages": 0, "total-input-tokens": 23828, "total-output-tokens": 11057, "length": "2e13", "weborganizer": {"__label__adult": 0.000274658203125, "__label__art_design": 0.0002682209014892578, "__label__crime_law": 0.0004227161407470703, "__label__education_jobs": 0.0003969669342041016, "__label__entertainment": 4.869699478149414e-05, "__label__fashion_beauty": 9.608268737792967e-05, "__label__finance_business": 0.0005884170532226562, "__label__food_dining": 0.00015747547149658203, "__label__games": 0.0005626678466796875, "__label__hardware": 0.0022296905517578125, "__label__health": 0.00014448165893554688, "__label__history": 0.00012171268463134766, "__label__home_hobbies": 6.42538070678711e-05, "__label__industrial": 0.00030517578125, "__label__literature": 0.00014507770538330078, "__label__politics": 0.00011867284774780272, "__label__religion": 0.0001928806304931641, "__label__science_tech": 0.00707244873046875, "__label__social_life": 2.7179718017578125e-05, "__label__software": 0.032379150390625, "__label__software_dev": 0.9541015625, "__label__sports_fitness": 0.0001004934310913086, "__label__transportation": 0.00021469593048095703, "__label__travel": 9.351968765258788e-05}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 44234, 0.04325]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 44234, 0.56584]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 44234, 0.86707]], "google_gemma-3-12b-it_contains_pii": [[0, 1954, false], [1954, 1954, null], [1954, 1954, null], [1954, 1974, null], [1974, 1974, null], [1974, 1989, null], [1989, 1989, null], [1989, 2241, null], [2241, 2545, null], [2545, 2949, null], [2949, 2957, null], [2957, 3190, null], [3190, 10076, null], [10076, 16874, null], [16874, 24082, null], [24082, 31435, null], [31435, 38138, null], [38138, 38927, null], [38927, 39868, null], [39868, 40832, null], [40832, 41374, null], [41374, 42059, null], [42059, 44234, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1954, true], [1954, 1954, null], [1954, 1954, null], [1954, 1974, null], [1974, 1974, null], [1974, 1989, null], [1989, 1989, null], [1989, 2241, null], [2241, 2545, null], [2545, 2949, null], [2949, 2957, null], [2957, 3190, null], [3190, 10076, null], [10076, 16874, null], [16874, 24082, null], [24082, 31435, null], [31435, 38138, null], [38138, 38927, null], [38927, 39868, null], [39868, 40832, null], [40832, 41374, null], [41374, 42059, null], [42059, 44234, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 44234, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 44234, null]], "pdf_page_numbers": [[0, 1954, 1], [1954, 1954, 2], [1954, 1954, 3], [1954, 1974, 4], [1974, 1974, 5], [1974, 1989, 6], [1989, 1989, 7], [1989, 2241, 8], [2241, 2545, 9], [2545, 2949, 10], [2949, 2957, 11], [2957, 3190, 12], [3190, 10076, 13], [10076, 16874, 14], [16874, 24082, 15], [24082, 31435, 16], [31435, 38138, 17], [38138, 38927, 18], [38927, 39868, 19], [39868, 40832, 20], [40832, 41374, 21], [41374, 42059, 22], [42059, 44234, 23]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 44234, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
8f22681a8699ef5dad64dbdc68a72efd5aa86dd5
|
[REMOVED]
|
{"Source-Url": "https://www.irif.fr/~cenea/papers/cav2018-weak.pdf", "len_cl100k_base": 11193, "olmocr-version": "0.1.50", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 66915, "total-output-tokens": 17175, "length": "2e13", "weborganizer": {"__label__adult": 0.00035691261291503906, "__label__art_design": 0.00028228759765625, "__label__crime_law": 0.0003361701965332031, "__label__education_jobs": 0.0005507469177246094, "__label__entertainment": 6.085634231567383e-05, "__label__fashion_beauty": 0.00016760826110839844, "__label__finance_business": 0.00021278858184814453, "__label__food_dining": 0.0003612041473388672, "__label__games": 0.0006761550903320312, "__label__hardware": 0.0008711814880371094, "__label__health": 0.0006093978881835938, "__label__history": 0.0002796649932861328, "__label__home_hobbies": 8.487701416015625e-05, "__label__industrial": 0.0003466606140136719, "__label__literature": 0.00031685829162597656, "__label__politics": 0.0003368854522705078, "__label__religion": 0.0005388259887695312, "__label__science_tech": 0.0198974609375, "__label__social_life": 7.826089859008789e-05, "__label__software": 0.004680633544921875, "__label__software_dev": 0.9677734375, "__label__sports_fitness": 0.00031113624572753906, "__label__transportation": 0.0005831718444824219, "__label__travel": 0.0002287626266479492}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 59206, 0.03702]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 59206, 0.22691]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 59206, 0.82646]], "google_gemma-3-12b-it_contains_pii": [[0, 2559, false], [2559, 6043, null], [6043, 9238, null], [9238, 11565, null], [11565, 15391, null], [15391, 18059, null], [18059, 21578, null], [21578, 25720, null], [25720, 29644, null], [29644, 32148, null], [32148, 34159, null], [34159, 37635, null], [37635, 40674, null], [40674, 42878, null], [42878, 44869, null], [44869, 47735, null], [47735, 50741, null], [50741, 53386, null], [53386, 56364, null], [56364, 59206, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2559, true], [2559, 6043, null], [6043, 9238, null], [9238, 11565, null], [11565, 15391, null], [15391, 18059, null], [18059, 21578, null], [21578, 25720, null], [25720, 29644, null], [29644, 32148, null], [32148, 34159, null], [34159, 37635, null], [37635, 40674, null], [40674, 42878, null], [42878, 44869, null], [44869, 47735, null], [47735, 50741, null], [50741, 53386, null], [53386, 56364, null], [56364, 59206, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 59206, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 59206, null]], "pdf_page_numbers": [[0, 2559, 1], [2559, 6043, 2], [6043, 9238, 3], [9238, 11565, 4], [11565, 15391, 5], [15391, 18059, 6], [18059, 21578, 7], [21578, 25720, 8], [25720, 29644, 9], [29644, 32148, 10], [32148, 34159, 11], [34159, 37635, 12], [37635, 40674, 13], [40674, 42878, 14], [42878, 44869, 15], [44869, 47735, 16], [47735, 50741, 17], [50741, 53386, 18], [53386, 56364, 19], [56364, 59206, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 59206, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
19220f2f8159a71ccad1967df77569bc65b72b1e
|
Exploring the Limits of Domain Model Recovery
Paul Klint, Davy Landman, Jurgen Vinju
Centrum Wiskunde & Informatica, Amsterdam, The Netherlands
{Paul.Klint, Davy.Landman, Jurgen.Vinju}@cwi.nl
Abstract—We are interested in re-engineering families of legacy applications towards using Domain-Specific Languages (DSLs). Is it worth to invest in harvesting domain knowledge from the source code of legacy applications?
Reverse engineering domain knowledge from source code is sometimes considered very hard or even impossible. Is it also difficult for “modern legacy systems”? In this paper we select two open-source applications and answer the following research questions: which parts of the domain are implemented by the application, and how much can we manually recover from the source code? To explore these questions, we compare manually recovered domain models to a reference model extracted from domain literature, and measured precision and recall.
The recovered models are accurate: they cover a significant part of the reference model and they do not contain much junk. We conclude that domain knowledge is recoverable from “modern legacy” code and therefore domain model recovery can be a valuable component of a domain re-engineering process.
I. INTRODUCTION
There is ample anecdotal evidence \[1\] that the use of Domain-Specific Languages (DSLs) can significantly improve productivity of software development, especially the maintenance part. DSLs model expected variations in both time (versions) and space (product families) such that some types of maintenance can be done on a higher level of abstraction and with higher levels of reuse. However, the initial investment in designing a DSL can be prohibitively high because a complete understanding of a domain is required. Moreover, when unexpected changes need to be made that were not catered for in the design of the DSL, the maintenance costs can be relatively high. Both issues indicate how both the quality of domain knowledge and the efficiency of acquiring it are pivotal for the success of a DSL based software maintenance strategy.
In this paper we investigate the source code of existing applications as valuable sources of domain knowledge. DSLs are practically never developed in green field situations. We know from experience that rather the opposite is the case: several comparable applications by the same or different authors are often developed before we start considering a DSL. So, when re-engineering a family of systems towards a DSL, there is opportunity to reuse knowledge directly from people, from the documentation, from the user interface (UI) and from the source code. For the current paper we assume the people are no longer available, the documentation is possibly wrong or incomplete and the UI may hide important aspects, so we scope the question to recovering domain knowledge from source code. Is valuable domain knowledge present that can be included in the domain engineering process?
From the field of reverse engineering we know that recovering this kind of design information can be hard \[2\]. Especially for legacy applications written in low level languages, where code is not self-documenting, it may be easier to recover the information by other means. On the other hand, if a legacy application was written in a younger object-oriented language, should we not expect to be able to retrieve valuable information about a domain? This sounds good, but we would like to observe precisely how well domain model recovery from source code could work in reality. Note that both the quality of the recovered information and the position of the observed applications in the domain are important factors.
A. Positioning domain model recovery
One of the main goals of reverse engineering is design recovery \[2\] which aims to recover design abstractions from any available information source. A part of the recovered design is the domain model.
Design recovery is a very broad area, therefore, most research has focused on sub-areas. The concept assignment problem \[3\] tries to both discover human-oriented concepts and connect them to the location in the source code. Often this is further split into concept recovery \[4\]–\[6\], and concept location \[7\]. Concept location, and to a lesser extent concept recovery, has been a very active field of research in the reverse engineering community.
However, the notion of a concept is still very broad and features are an example of narrowed-down concepts and one can identify the sub-areas of feature location \[8\] and feature recovery. Domain model recovery as we will use in this paper is a closely related sub-area. We are interested in a pure domain model, without the additional artifacts introduced by software design and implementation. The location of these artifacts is not interesting either. For the purpose of this paper, a domain model (or model for short) consists of entities and relations between these entities.
Abebe et al.’s \[9, 10\] domain concept extraction is similar to our sub-area. As is Ratiu et al.’s \[11\] domain ontology recovery. In Section \[12\] we will further discuss these relations.
B. Research questions
To learn about the possibilities of domain model recovery we pose this question: how much of a domain model can be recovered under ideal circumstances? By ideal we mean that the applications under investigation should have well-structured and self-documenting object-oriented source code.
\[1\] Also known as concept mining, topic identification, or concept discovery.
This leads to the following research questions:
Q1. Which parts of the domain are implemented by the application?
Q2. Can we manually recover those implemented parts from the object-oriented source code of an application?
Note that we avoid automated recovery here because any inaccuracies introduced by tool support could affect the validity or accuracy of our results.
Figure 1 illustrates the various domains that are involved: The Reference Model (REF) represents all the knowledge about a specific domain and acts as oracle and upper limit for the domain knowledge that can be recovered from any application in that domain. The Recovered Model (REC) is the domain knowledge obtained by inspecting the source code of the application. The Observed Model (OBS) represents the part of the reference domain that an application covers, i.e. all the knowledge about a specific application in the domain that a user may obtain by observing its external behavior and its documentation but not its internal structure.
Ideally, both domain models should completely overlap, however, there could be entities in OBS not present in REC and vice versa. Therefore, figure 2 illustrates the final mapping we have to make, between SRC and USR. The Intra-Application Model (INT) represents the knowledge recovered from the source code, also present in the user view, without limiting it to the knowledge found in REF.
In Section II we describe our research method, explaining how we will analyze the mappings between USR and REF (OBS), SRC and REF (REC), and SRC and USR (INT) in order to answer Q1 and Q2. The results of each step are described in detail in Sections III to VIII. Related work is discussed in Section IX and Section X (Conclusions) completes the paper.
II. RESEARCH METHOD
In order to investigate the limits of domain model recovery we study manually extracted domain models. The following questions guide this investigation:
A) Which domain is suitable for this study?
B) What is the upper limit of domain knowledge, or what is our reference model (REF)?
C) How to select two representative applications?
D) How do we recover domain knowledge that can be observed by the user of the application (Q1 & OBS)?
E) How do we recover domain knowledge from the source code (Q2 & REC)?
F) How do we compare models that use different vocabularies (terms) for the same concepts? (Q1, Q2)?
G) How do we compare the various domain models to measure the success of domain model recovery? (Q1, Q2)?
We will now answer the above questions in turn. Although we are exploring manual domain model recovery, we want to make this manual process as traceable as possible since this enables independent review of our results. Where possible we automate the analysis (calculation of metrics, precision and recall), and further processing (visualization, table generation) of manually extracted information. Both data and automation scripts are available online.
A. Selecting a target domain
We have selected the domain of project planning for this study since it is a well-known, well-described, domain of manageable size for which many open source software applications exist. We use the Project Management Body of Knowledge (PMBOK) published by Project Management Institute (PMI) for standard terminology in the project management domain. Note that as such the PMBOK covers a lot more than just project planning.
B. Obtaining the Reference Model (REF)
Validating the results of a reverse engineering process is difficult and requires an oracle, i.e., an actionable domain model suitable for comparison and measurement. We have transformed the descriptive knowledge in PMBOK into such a reference model using the following, traceable, process:
1) Read the PMBOK book.
2) Extract project planning facts.
3) Assign a number to each fact and store its source page.
4) Construct a domain model, where each entity, attribute, and relation are linked to one or more of the facts.
5) Assess the resulting model and repeat the previous steps when necessary.
The resulting domain model will act as our Reference Model.
and Section III gives the details.
C. Application selection
In order to avoid bias towards a single application, we need at least two project planning applications to extract domain models from. Section IV describes the selection criteria and the selected applications.
2See http://homepages.cwi.nl/~landman/icsm2013/
D. Observing the application
A user can observe an application in several ways, ranging from its UI, command-line interface, configuration files, documentation, scripting facilities and other functionality or information exposed to the user of the application. In this study we use the UI and documentation as proxies for what the user can observe.
We have followed these steps to obtain the User Model (USR) of the application:
1) Read the documentation.
2) Determine use cases.
3) Run the application.
4) Traverse the UI depth-first for all the use cases.
5) Collect information about the model exposed in the UI.
6) Construct a domain model, where each entity and relation are linked to a UI element of the application.
7) Assess the resulting model and repeat the previous steps when necessary.
We report about the outcome in Section V.
E. Inspecting the source code
We have designed the following traceable process to extract a domain model from each application’s source code, the Source Model (SRC):
1) Read the source code as if it is plain text.
2) Extract project planning facts.
3) Store its filename, and line number (source location).
4) Construct a model, where each entity, attribute, and relation is linked to a source location in the application’s source code.
5) Assess the model and repeat the previous steps when necessary.
The results appear in Section VI.
F. Mapping models
After performing the above steps we have obtained five domain models for the same domain, derived from different sources:
- The Reference Model (REF) derived from PMBOK.
- For each of the two applications:
- User Model (USR).
- Source Model (SRC).
While all these model are in the project planning domain, they all use different vocabularies. Therefore, we have to manually map the models to the same vocabulary. Mapping the USR and SRC models onto the REF model, gives the Observed (OBS) and Recovered Model (REC).
The final mapping we have to make, is between the SRC and USR models. We want to understand how much of the User Model (USR) is present in the Source Model (SRC). Therefore, we also map the SRC onto the USR model, giving the Intra-Application Model (INT). The results of all these mappings are given in Section VII.
G. Comparing models
To be able to answer Q1 and Q2, we will compare the 11 produced models. Following other research in the field of concept assignment, we use the most common information retrieval (IR) approach, recall and precision, for measuring quality of the recovered data. Recall measures how much of the expected model is present in the found model, and precision measures how much of the found model is part of the expected.
We have designed the following traceable process to extract a domain model from each application’s source code, the Source Model (SRC):
1) Read the source code as if it is plain text.
2) Extract project planning facts.
3) Store its filename, and line number (source location).
4) Construct a model, where each entity, attribute, and relation is linked to a source location in the application’s source code.
5) Assess the model and repeat the previous steps when necessary.
The results appear in Section VI.
The final mapping we have to make, is between the SRC and USR models. We want to understand how much of the User Model (USR) is present in the Source Model (SRC). Therefore, we also map the SRC onto the USR model, giving the Intra-Application Model (INT). The results of all these mappings are given in Section VII.
III. PROJECT PLANNING REFERENCE MODEL
Since there is no known domain model or ontology for project planning that we are aware of, we need to construct one ourselves. The aforementioned PMBOK [12] is our point of departure. PMBOK avoids project management style specific terminology, making it well-suited for our information needs.
A. Gathering facts
We have analyzed the whole PMBOK book. This analysis has been focused on the concept of a project and everything related to project planning therefore we exclude other concepts and processes in the project management domain.
After analyzing 467 pages we have extracted 151 distinct facts related to project planning. A fact is either an explicitly defined concept, an implicitly defined concept based on a summarized paragraph, or a relations between concepts. These facts were located on 67 different pages. This illustrates that project planning is a subdomain and that project management as a whole covers many topics that fall outside the scope of the current paper. Each fact was assigned a unique number and the source page number where it was found in the current paper. Each fact was assigned a unique number and the source page number where it was found in the current paper. Each fact was assigned a unique number and the source page number where it was found in the current paper.
Two example facts are: “A milestone is a significant point or event in the project.” (id:108, page: 136) and “A milestone may be mandatory or optional.” (id:109, page: 136).
B. Creating the Reference Model REF
In order to turn these extracted facts into a model for project planning, we have translated the facts to entities, attributes
Implementation details or concepts from other domains.
TABLE I
NUMBER OF ENTITIES AND RELATIONS IN THE CREATED MODELS, AND THE AMOUNT OF LOCATIONS IN THE PMBOK BOOK, SOURCE CODE, OR UI SCREENS USED TO CONSTRUCT THE MODEL.
<table>
<thead>
<tr>
<th>Source</th>
<th># entities</th>
<th># relations</th>
<th>unique observations</th>
</tr>
</thead>
<tbody>
<tr>
<td>PMBOK REF</td>
<td>74</td>
<td>75</td>
<td>32</td>
</tr>
<tr>
<td>Endeavour USR</td>
<td>23</td>
<td>30</td>
<td>8</td>
</tr>
<tr>
<td>SRC</td>
<td>26</td>
<td>51</td>
<td>8</td>
</tr>
<tr>
<td>OpenPM USR</td>
<td>22</td>
<td>24</td>
<td>3</td>
</tr>
<tr>
<td>SRC</td>
<td>28</td>
<td>44</td>
<td>6</td>
</tr>
</tbody>
</table>
Fig. 3. Fragment of reference model REF visualized as class diagram. Boxes represent entities, arrows relations, and dashed lines link entities to relations.
of entities, and relations between entities. The two example facts (108 and 109), are translated into a relation between the classes Project and Milestone, and the mandatory attribute for the Milestone class. The meta-model of our domain model is a class diagram. We use a textual representation in the meta-programming language Rascal [13] which is also used to perform calculations on these models (precision, recall).
Table II characterizes the size of the project planning reference domain model REF by number of entities, relations and attributes; it contains of 74 entities and 107 relations. There is also a set of 49 attributes, but this seems incomplete, because in general we expect any entity to have more than one property. The lack of details in PMBOK could be an explanation for this. Therefore, we did not use the attributes of the reference model to calculate similarity.
The model is too large to include in this paper, however for demonstration purposes, a small subset is shown in Figure 3.
Not all the facts extracted from PMBOK are used in the Reference Model. Some facts carry only explanations. For example “costs are the monetary resources needed to complete the project”. Some facts explain dynamic relations that are not relevant for an entity/relationship model. These two categories explain 55 of the 68 unused facts. The remaining 13 facts were not clear enough to be used or categorized. In total 83 of the 151 observed facts are represented in the Reference Model.
C. Discussion
We have created a Reference Model that can be used as oracle for domain model recovery and other related reverse engineering tasks in the project planning domain. The model was created by hand by the second author, and care was taken to make the whole process traceable. We believe this model can be used for other purposes in this domain as well, such as application comparison and checking feature completeness.
Threats to validity: We use PMBOK as main source of information for project planning. There are different approaches to project planning and a potential threat is that some are not covered in this book. Since PMBOK is an industry standard (ANSI and IEEE), we consider this to be a low-risk threat and have not mitigated it.
Another threat is that model recovery by another person could lead to a different model. The traceable extraction of the reference model makes it possible to understand the decisions on which the differences are based. Due to the availability of our analysis scripts, the impact of differences can be easily computed.
IV. APPLICATION SELECTION
We are interested in finding “ideal” project planning systems to manually read and extract domain models from. The following requirements have guided our search:
- Source code is available: to enable analysis at all.
- No more than 30 KSLOC: to keep manual analysis feasible.
- Uses an explicit data model, for example Model View Controller (MVC), or an Object-relational mapping (ORM): to ensure that domain elements can be identified in the source code.
We have made a shortlist of 10 open source project planning systems [14]. The list contains applications implemented in different languages (Java, Ruby, and C++) and sizes ranging from 18 KSLOC to 473 KSLOC.
From this Endeavour and OpenPM satisfy the aforementioned requirements. Endeavour is a Java application that uses a custom MVC design with ThinWire as front-end framework, and Hibernate as ORM. OpenPM uses Java servlets in combination with custom JavaScript. It also uses Hibernate as ORM. Table II and III describe the structure and size of the two applications. Note that OpenPM’s view package contained MVC controller logic, and the servlets the MVC views.
Both systems aim at supporting the process of planning by storing the process state but they hardly support process enforcement, except recording dependence between activities.
A. Discussion
A threat to external validity is that both systems are implemented in Java. Looking at systems in multiple modern languages is considered future work.
V. OBTAINING THE USER MODEL
We have used the UI and documentation of the applications to construct the User Model (USR). Use cases were extracted from the documentation when possible [15]. Following these use cases, a depth-first exploration of the UI is performed. For
4 ChilliProject, Endeavour, GanttProject, LibrePlan, OpenPM, OpenProj, PLANdora, project.net, taskjuggler, Xplanner+
5 Number of files and SLOC are calculated using the cloc tool [14].
6 Unfortunately, OpenPM does not provide documentation.
We have chosen the Eclipse Integrated Development Environment (IDE) to read the source code of the selected applications. Our goal was to maximize the amount of information we could recover. Therefore, we have first read the source code and then used Rascal to analyze relations in the source code. Rascal uses Eclipse’s JDT to analyze Java code, and provides a visualization library that can be used to quickly verify hypothesis formed during the first read-through.
For the actual creation of the model, we have designed and followed these rules:
- Read only the source code, not the database scheme/data.
- Do not run the application.
- Use the terms of the applications, do not translate them to terms used in the Reference Model.
- Include the whole model as seen by the application, do not filter out obvious implementation entities.
- Do read comments and string literals.
We have used the same meta-model as used for describing the Reference Model. We replaced the fact’s identifiers with source locations (filename and character range), which are a native construct in Rascal. To support the process of collecting facts from the source code we added a menu-item to the context-menu of the Java editor to write the cursor’s source location to the clipboard.
The domain model for each application was created in a similar fashion as we did when creating the reference model. All the elements in the domain model are based on one or more specific observations in the source code (see table I).
For example the relation between Task and Dependency in Endeavour’s SRC model is based on the List<Dependency> dependencies field found on line 35 in file Endeavour-Mgmt/model/org/endeavour/mgmt/model/Task.java.
### B. Results
Table II shows the sizes of the extracted models for both applications expressed in number of entities, relations and attributes and the number of unique source code locations where they were found.
1) **Endeavour**: In Endeavour 26 files contributed to the domain model. 22 of those files were in the model package, the other 4 were from the controller package. The controller classes each contributed one fact. 155 of the source locations were from the model package.
2) **OpenPM**: In OpenPM 22 files contributed to the domain model. These files were all located in the model package.
### C. Discussion
We have performed domain model recovery on two open source software applications for project planning.
Both applications use the same ORM system, but a different version of the API. Endeavour also contains a separate view model, which is used in the MVC user interface. However, it has been implemented as a pass-through layer for the real model.
**Threats to validity**: A first threat (to internal validity) is that manual analysis is always subject to bias from the performer and that this was performed by the same author who created the other models. We have mitigated this by maximizing the traceability of our analysis: we have followed a fixed analysis...
process and have performed multiple analysis passes over the source code and published the data.
A second threat (to external validity) is the limited size of the analyzed applications, both contain less than 20 KSLOC Java. Larger applications would make our conclusions more interesting and general, but they would also make the manual analysis less feasible.
VII. MAPPING MODELS
We now have five domain models of project planning: one reference model (REF) to be used as oracle, and four domain models (SRC, USR) obtained from the two selected project planning applications. These models use different vocabulary, we have to map them onto the same vocabulary to be able to compare them.
A. Lightweight domain model mapping
We manually map the entities between different comparable models. The question is how to decide whether to entities are the same. Strict string equality is too limited and should be relaxed to some extent.
Table [IV] and [V] show the mapping categories we have identified for the (un)successful mapping of model entities.
B. Mapping results
We have manually mapped all the entities in the User Model (USR) and the Source Model (SRC) to the Reference Model (REF), and SRC to USR. For each mapping we have explicitly documented the reason for choosing this mapping. For example, in Endeavour’s SRC model the entity Iteration is mapped to Milestone in the Reference Model using specialization, with documented reason: “Iterations split the project into chunks of work, Milestones do the same but are not necessarily iterative.”
Table [VI] and [VII] contain the number of mapping categories used for both applications, per mapping. For some mapping categories, it is possible for one entity to map to multiple, or multiple entities to one. For example the Task and WorkProduct entities in Endeavour’s SRC model are mapped on the Activity entity in the Reference Model. Therefore, we report the numbers of the entities in both the models, the source and the target.
The relatively large number of identically named entities (7/15) between Endeavour and the reference model is due to the presence of a similar structure of five entities, describing all the possible activity dependencies.
An example of a failed mapping is the ObjectVersion entity in the Source Model of OpenPM. This entity is an implementation detail. It is a variant of the Temporal Object pattern\footnote{See \url{http://martinfowler.com/eaaDev/TemporalObject.html}} where
\begin{table}[h]
\centering
\caption{Categories for successfully mapped entities}
\begin{tabular}{ll}
\hline
Mapping name & Description \\
\hline
Equal Name & Entity has the same name as an entity in the other model. Note that this is the only category which can also be a failure when the same name is used for semantically different entities. \\
Synonym & Entity is a direct synonym for an entity in the other model, and is it not a homonym. \\
Extension & Entity captures a wider concept than the same entity in the other model. \\
Specialization & Entity is a specific or concrete instance of the same entity in the other model. \\
Implementation specialization & Comparable to specialization but the specialization is related to an implementation choice. \\
\hline
\end{tabular}
\end{table}
\begin{table}[h]
\centering
\caption{Categories for unsuccessfully mapped entities}
\begin{tabular}{ll}
\hline
Mapping name & Description \\
\hline
Missing & The domain entity is missing in the other model, i.e. a false positive. This is the default mapping failure when an entity cannot be mapped via any of the other categories. \\
Implementation & The entity is an implementation detail and is not a real domain model entity. \\
Too detailed & An entity is a domain entity but is too detailed in comparison with the other model. \\
Domain detail & The entity is a detail of a sub domain, this category is a subclass of "too detailed". \\
\hline
\end{tabular}
\end{table}
\begin{table}[h]
\centering
\caption{Endeavour: Entities in the mapped models, per mapping category}
\begin{tabular}{lllllllllll}
\hline
Category & USR & REF & SRC & REF & SRC & USR \\
\hline
Equal Name & 7 & 7 & 7 & 7 & 21 & 21 \\
Synonym & 2 & 3 & 2 & 3 & 3 & 2 \\
Extension & 0 & 0 & 0 & 0 & 0 & 0 \\
Specialization & 5 & 3 & 5 & 3 & 0 & 0 \\
Implementation specialization & 1 & 1 & 1 & 1 & 0 & 0 \\
Total & 15 & 14 & 15 & 14 & 24 & 23 \\
\hline
Equal Name & 1 & - & 1 & - & 0 & - \\
Missing & 1 & - & 2 & - & 0 & - \\
Implementation & 1 & - & 2 & - & 2 & 0 \\
Domain Detail & 5 & - & 6 & - & 0 & - \\
Too Detailed & 0 & - & 0 & - & 0 & - \\
Total & 8 & - & 11 & - & 2 & - \\
\hline
\end{tabular}
\end{table}
\begin{table}[h]
\centering
\caption{OpenPM: Entities in mapped models, per mapping category}
\begin{tabular}{lllllllllll}
\hline
Category & USR & REF & SRC & REF & SRC & USR \\
\hline
Equal Name & 1 & 1 & 1 & 1 & 18 & 18 \\
Synonym & 3 & 3 & 4 & 4 & 4 & 4 \\
Extension & 1 & 1 & 1 & 1 & 0 & 0 \\
Specialization & 0 & 0 & 0 & 0 & 0 & 0 \\
Implementation specialization & 1 & 1 & 1 & 1 & 0 & 0 \\
Total & 6 & 6 & 7 & 7 & 22 & 22 \\
\hline
Missing & 2 & - & 2 & - & 1 & - \\
Implementation & 12 & - & 17 & - & 5 & - \\
Domain Detail & 0 & - & 0 & - & 0 & - \\
Too Detailed & 2 & - & 2 & - & 0 & - \\
Total & 16 & - & 21 & - & 6 & - \\
\hline
\end{tabular}
\end{table}
We have used a lightweight approach for mapping domain modified all previous classifications have been reconsidered. During the process and each time a category was added or two applications, however we have no guarantees for other categories presented above, turned out to be sufficient for these categories. The categories have evolved during the process and each time a category was added or modified all previous classifications have been reconsidered.
We now have five manually constructed and six derived domain models for project planning:
- One reference model (REF) to be used as oracle.
- Four domain models (SRC, USR) obtained from each of the two selected project planning applications.
- Six derived domain models (OBS, REC, INT) resulting from the mapping of the previous four (SRC, USR).
How can we compare these models in a meaningful way?
A. Recall and Precision
The most common measures to compare the results of an IR technique are recall and precision. Often it is not possible to get the 100% in both, and we have to discuss which measure is more important in the case of our model comparisons.
We have more than two datasets, and depending on the combination of datasets, recall or precision is more important. Table IX explains in detail how recall and precision will be used and explains for the relevant model combinations which measure is useful and what will be measured.
Given two models $M_1$ and $M_2$, we use the following notation. The comparison of two models is denoted by $M_1 \circ M_2$ and results in recall and precision for the two models. If needed, $M_1$ is first mapped to $M_2$ as described in Tables VII and VII.
B. Results
Tables X and XI shows the results for, respectively, Endeavour and OpenPM. Which measures are calculated is based on the analysis in Table IX.
C. Relation Similarity
Since recall and precision for sets of entities provides no insight into similarity of the relations between entities, we need an additional measure. Our domain models contain entities and their relations. Entities represent the concepts of the domain, and relations their structure. If we consider the relations as a set of edges, we can directly calculate recall and precision in a similar fashion as described above.
We also considered some more fine grained metrics for structural similarity. Our domain model is equivalent to a subset of Unified Modeling Language (UML) class diagrams and several approaches exist for calculating the minimal difference between such diagrams [15, 16]. Such “edit distance” methods give precise indications of how big the difference is. Similarly we might use general graph distance metrics [17]. We tried this latter method and found that the results, however more sophisticated, were harder to interpret. For example, USR and REF were 11% similar for Endeavor. This seems to be in line with the recall numbers, 6% for relations and 19% for entities, but the interesting precision results (64% and 15%) are lost in this metric. So we decided not to report these results and stay with the standard accuracy analysis.
<table>
<thead>
<tr>
<th>Source</th>
<th>Model Entities†</th>
</tr>
</thead>
<tbody>
<tr>
<td>PMBOK</td>
<td>Reference Model</td>
</tr>
<tr>
<td>END</td>
<td></td>
</tr>
<tr>
<td>USR</td>
<td></td>
</tr>
<tr>
<td>SRC</td>
<td></td>
</tr>
<tr>
<td>OpenPM</td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Source</th>
<th>Model Entities†</th>
</tr>
</thead>
<tbody>
<tr>
<td>PMBOK</td>
<td>Reference Model</td>
</tr>
<tr>
<td>END</td>
<td></td>
</tr>
<tr>
<td>USR</td>
<td></td>
</tr>
<tr>
<td>SRC</td>
<td></td>
</tr>
<tr>
<td>OpenPM</td>
<td></td>
</tr>
</tbody>
</table>
Bold entity in Reference Model is used in application models. Bold entity in application model could be mapped to entity in Reference Model.
### TABLE VIII
<table>
<thead>
<tr>
<th>Entities found in the various domain models.</th>
</tr>
</thead>
<tbody>
<tr>
<td>Source</td>
</tr>
<tr>
<td>--------</td>
</tr>
<tr>
<td>PMBOK</td>
</tr>
<tr>
<td>END</td>
</tr>
<tr>
<td>USR</td>
</tr>
<tr>
<td>SRC</td>
</tr>
<tr>
<td>OpenPM</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Source</th>
<th>Model Entities†</th>
</tr>
</thead>
<tbody>
<tr>
<td>PMBOK</td>
<td>Reference Model</td>
</tr>
<tr>
<td>END</td>
<td></td>
</tr>
<tr>
<td>USR</td>
<td></td>
</tr>
<tr>
<td>SRC</td>
<td></td>
</tr>
<tr>
<td>OpenPM</td>
<td></td>
</tr>
</tbody>
</table>
Bold entity in Reference Model is used in application models. Bold entity in application model could be mapped to entity in Reference Model.
### VIII. Comparing the models
We now have five manually constructed and six derived domain models for project planning:
- One reference model (REF) to be used as oracle.
- Four domain models (SRC, USR) obtained from each of the two selected project planning applications.
- Six derived domain models (OBS, REC, INT) resulting from the mapping of the previous four (SRC, USR).
How can we compare these models in a meaningful way?
A. Recall and Precision
The most common measures to compare the results of an IR technique are recall and precision. Often it is not possible to get the 100% in both, and we have to discuss which measure is more important in the case of our model comparisons.
We have more than two datasets, and depending on the combination of datasets, recall or precision is more important. Table IX explains in detail how recall and precision will be used and explains for the relevant model combinations which measure is useful and what will be measured.
Given two models $M_1$ and $M_2$, we use the following notation. The comparison of two models is denoted by $M_1 \circ M_2$ and results in recall and precision for the two models. If needed, $M_1$ is first mapped to $M_2$ as described in Tables VII and VII.
B. Results
Tables X and XI shows the results for, respectively, Endeavour and OpenPM. Which measures are calculated is based on the analysis in Table IX.
C. Relation Similarity
Since recall and precision for sets of entities provides no insight into similarity of the relations between entities, we need an additional measure. Our domain models contain entities and their relations. Entities represent the concepts of the domain, and relations their structure. If we consider the relations as a set of edges, we can directly calculate recall and precision in a similar fashion as described above.
We also considered some more fine grained metrics for structural similarity. Our domain model is equivalent to a subset of Unified Modeling Language (UML) class diagrams and several approaches exist for calculating the minimal difference between such diagrams [15, 16]. Such “edit distance” methods give precise indications of how big the difference is. Similarly we might use general graph distance metrics [17]. We tried this latter method and found that the results, however more sophisticated, were harder to interpret. For example, USR and REF were 11% similar for Endeavor. This seems to be in line with the recall numbers, 6% for relations and 19% for entities, but the interesting precision results (64% and 15%) are lost in this metric. So we decided not to report these results and stay with the standard accuracy analysis.
D. Discussion
1) Low precision and recall for relations: On the whole the results for the precision and recall of the relation part of the models are lower than the quality of the entity mappings. We investigated this by taking a number of samples. The reason is that the Reference model is more detailed, introducing intermediate entities with associated relations. For every intermediate entity, two or more relations are introduced which can not be found in the recovered models.
These results indicate that the recall and precision metrics for sets of relations underestimate the structural similarity of the models.
2) Precision of OBS: USR $\triangleright$ REF: We found the precision of OBS to be 64% (Endeavour) and 23% (OpenPM), indicating that both applications contain a significant amount of entities that are unrelated to project planning as delimited by the Reference Model. For Endeavour, out of the 8 unmappable entities (see Table VII in section VII), only 2 were actual implementation details. The other 6 are sub-domain details not globally shared within the domain. If we recalculate to correct for this, Endeavour’s Observed Model even has a precision of 91%. For OpenPM there are only 2 out of the 16 for which this correction can be applied, leaving the precision at 36%. For the best scenario, in this case represented by Endeavour, 90% of the User Model (USR) is part of the Reference Model (REF).
OpenPM’s relatively low precision (36%) can be explained by Table VII which show the USR model has a lot of implementation detail (related to version control operations).
3) Recall of OBS: USR $\triangleright$ REF: The recall for the Observed Model (OBS) is for Endeavour 19% and for OpenPM 7%. Which means both applications cover less than 20% of the project planning domain.
4) Precision of REC: SRC $\triangleright$ REF: The precision of the Recovered Model (REC) is for Endeavour 56% (corrected 88%), and for OpenPM 25% (corrected 39%). This shows that for the best scenario, represented again by Endeavour, the Source Model only contains 12% implementation details.
5) Recall of REC: SRC $\triangleright$ REF: The recall for the Recovered Model (REC) is for Endeavour 19% and for OpenPM 9%. The higher recall for OpenPM, compared to OBS, for both entities and relations is an example where the Source Model contained more information then the User Model, which we will discuss in the next paragraph.
6) Precision and recall for INT: SRC $\triangleright$ USR: How much of the User Model can be recovered by analyzing only the Source Model? For both Endeavour and OpenPM, recall is 100%. This means that every entity in the USR model was found in the source code. Endeavour’s precision was 92% and OpenPM’s 79%. OpenPM contains an example where information in the Source Model is not observable in the User Model: comments in the source code explain the Milestones and their relation to Iterations.
The 100% recall and high precision mean that these applications were indeed amenable for reverse engineering (as we hypothesized when selecting these applications). We could extract most of the information from the source code. For this comparison, even the relations score quite high. This indicates that User Model and Source Model are structurally similar. Manual inspection of the models confirm this.
7) Recall for Endeavour and OpenPM combined: Endeavour’s and OpenPM’s recall of USR $\triangleright$ REF and SRC $\triangleright$ REF measure the coverage of the domain a re-engineer can achieve. How much will the recall improve if we combine the recovered models of the two systems?
We only have two small systems, however, Table XII contains the recall and precision for Endeavour and OpenPM combined. A small increase in recall, from 19% to 23%, indicates that there is a possibility for increasing the recall by observing more systems. However, as expected, at the cost of precision.
8) Interpretation: Since our models are relatively small, our results cannot be statistically significant but are only indicative. Therefore we should not report exact percentages, but characterizing our recall and precision as high seems valid. Further research based on more applications is needed to confirm our results.
IX. RELATED WORK
There are many connections between ontologies and domain models. The model mappings that we need are more specific than the ones provided by general ontology mapping [18].
Abebe and Tonella [9] introduced a natural language parsing (NLP) method for extracting an ontology from source code. They came to the same conclusion as we do: this extracted ontology contains a lot of implementation details. Therefore, they introduced an IR filtering method [10] but it was not as effective as the authors expected. Manual filtering of the IR keyword database was shown to improve effectiveness. Their work is in the same line as ours, but we have a larger reference domain model, and we focus on finding the limits of domain model recovery, not on an automatic approach. It would be interesting to apply their IR filtering to our extracted models.
Rauti et al. [11] proposed an approach for domain ontology extraction. Using a set of translation rules they extract domain knowledge from the API of a set of related software libraries. Again, our focus is on finding the limits of model recovery, not on automating the extraction.
Hsi et al. [19] introduced ontology excavation. Their methodology consists of a manual depth-first modeling of all UI interactions, and then manually creating an ontology, filtering out non-domain concepts. They use five graph metrics to identify interesting concepts and clusters in this domain ontology. We are interested in finding the domain model inside the user-interface model, Hsi et al. perform this filtering manually, and then look at the remaining model. Automatic feature extraction of user interfaces is described in [20].
Carey and Gannod [6] introduced a method for concept identification. Classes are considered the lowest level of information of an object-oriented system and Machine Learning is used in combination with a set of class metrics. This determines interesting classes, which should relate to domain concepts. Our work is similar, but we focus on all the information in the source code, and are interested in the maximum that can be recovered from the source. It could be interesting to use our reference model to measure how accurately their approach removes implementation concerns.
UML class diagram recovery [21], [22] is also related to our work but has a different focus. Research focuses on the precision of the recovered class diagrams, for example the difference between a composition and aggregation relation. We are interested in less precise UML class diagrams.
Work on recovering the concepts, or topics, of a software system [4], [5] has a similar goal as ours. IR techniques are used to analyze all the terms in the source code of a software system, and find relations or clusters. Kuhn et al. [5] use identifiers in source code to extract semantic meaning and report on the difficulty of evaluating their results. Our work focuses less on structure and grouping of concepts and we evaluate our results using a constructed reference model.
Reverse engineering the relation between concepts or features [8], [23], assumes that there is a set of known features or concepts and tries to recover the relations between them. These approaches are related to our work since the second half of our problem is similar: after we have recovered domain entities, we need to understand their relations.
DeBaud et al. [24] report on a domain model recovery case study on a COBOL program. By manual inspection of the source code, a developer reconstructed the data constructs of the program. They also report that implementation details make extraction difficult, and remark that systems often implement multiple domains, and that the implementation language plays an important role in the discovery of meaning in source code.
We do not further discuss other related work on knowledge recovery that aims at extracting facts about architecture or implementation. One general observation in all the cited work is that it is hard to separate domain knowledge from implementation knowledge.
X. CONCLUSIONS
We have explored the limits of domain model recovery via a case study in the project planning domain. Here are our results and conclusions.
A. Reference model
Starting with PMBOK as authoritative domain reference we have manually constructed an actionable domain model for project planning. This model is openly available and may be used for other reverse engineering research projects.
B. Lightweight model mapping
Before we can understand the differences between models, we have to make them comparable by mapping them to a common model. We have created a manual mapping method that determines for each entity if and how it maps onto the target model. The mapping categories evolved while creating the mappings. We have used this approach to describe six useful mappings, four to the Reference Model and two to the User Model.
C. What are the limits of domain model recovery?
We have formulated two research questions to get insight in the limits of domain model recovery. Here are the answers we have found (also see Table IX and remember our earlier comments on the interpretation of the percentages given below).
Q1: Which parts of the domain are implemented by the application? Using the user view (USR) as a representation of the part of the domain that is implemented by an application, we have created two domain models for each of the two selected
applications. These domain models represent the domain as exposed by the application. Using our Reference Model (REF) we were able to determine which part of USR was related to project planning. For our two cases 91% and 36% of the User Model (USR) can be mapped to the Reference Model (REF). This means 9% and 64% of the UI is about topics not related to the domain. From the user perspective we could determine that the applications implement 19% and 7% of the domain.
The tight relation between the USR and the SRC model (100% recall) shows us that this information is indeed explicit and recoverable from the source code. Interestingly, some domain concepts were found in the source code that were hidden by the UI and the documentation, since for OpenPM the recall between USR and REF was 7% where it was 9% between SRC and REF.
So, the answer for Q1 is: the recovered models from source code are useful, and only a small part of the domain is implemented by these tools (only 7-19%).
Q2: Can we recover those implemented parts from the source of the application? Yes, see the answer to Q1. The high recall between USR and SRC shows that the source code of these two applications explicitly models parts of the domain. The high precisions (92% and 79%) also show that it was feasible to filter implementation junk manually from these applications from the domain model.
D. Perspective
For this research we manually recovered domain models from source code to understand how much valuable domain knowledge is present in source code. We have identified several follow-up questions:
- How does the quality of extracted models grow with the size and number of applications studied? (Table XII)
- How can differences and commonalities between applications in the same domain be mined to understand the domain better?
- How does the quality of extracted models differ between different domains, different architecture/designs, different domain engineers?
- How can the extraction of a User Model help domain model recovery in general. Although we have not formally measured the effort for model extraction, we have noticed that extracting a User Model requires much less effort than extracting a Source Model.
- How do our manually extracted models compare with automatically inferred models?
- What tool support is possible for (semi-)automatic model extraction?
- How can domain models guide the design of a DSL?
Our results of manually extracting domain models are encouraging. They suggest that when re-engineering a family of object-oriented applications to a DSL their source code is a valuable and trustworthy source of domain knowledge, even if they only implement a small part of the domain.
REFERENCES
|
{"Source-Url": "https://ir.cwi.nl/pub/21815/21815B.pdf", "len_cl100k_base": 10632, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 36628, "total-output-tokens": 12729, "length": "2e13", "weborganizer": {"__label__adult": 0.0003094673156738281, "__label__art_design": 0.00032639503479003906, "__label__crime_law": 0.00033855438232421875, "__label__education_jobs": 0.0010824203491210938, "__label__entertainment": 4.380941390991211e-05, "__label__fashion_beauty": 0.0001385211944580078, "__label__finance_business": 0.0002040863037109375, "__label__food_dining": 0.00023043155670166016, "__label__games": 0.0004758834838867187, "__label__hardware": 0.0005307197570800781, "__label__health": 0.0003342628479003906, "__label__history": 0.0001959800720214844, "__label__home_hobbies": 7.82012939453125e-05, "__label__industrial": 0.0002682209014892578, "__label__literature": 0.0002238750457763672, "__label__politics": 0.00015175342559814453, "__label__religion": 0.0003082752227783203, "__label__science_tech": 0.01094818115234375, "__label__social_life": 8.553266525268555e-05, "__label__software": 0.0072479248046875, "__label__software_dev": 0.9755859375, "__label__sports_fitness": 0.0002079010009765625, "__label__transportation": 0.0003218650817871094, "__label__travel": 0.00014901161193847656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 52582, 0.01959]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 52582, 0.28745]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 52582, 0.92147]], "google_gemma-3-12b-it_contains_pii": [[0, 5581, false], [5581, 10012, null], [10012, 15264, null], [15264, 20868, null], [20868, 23878, null], [23878, 29204, null], [29204, 35932, null], [35932, 39557, null], [39557, 45635, null], [45635, 52582, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5581, true], [5581, 10012, null], [10012, 15264, null], [15264, 20868, null], [20868, 23878, null], [23878, 29204, null], [29204, 35932, null], [35932, 39557, null], [39557, 45635, null], [45635, 52582, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 52582, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 52582, null]], "pdf_page_numbers": [[0, 5581, 1], [5581, 10012, 2], [10012, 15264, 3], [15264, 20868, 4], [20868, 23878, 5], [23878, 29204, 6], [29204, 35932, 7], [35932, 39557, 8], [39557, 45635, 9], [45635, 52582, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 52582, 0.10054]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
49ad5539ace688d590239ab1ca6cfafddb0f3fff
|
Research Article
Assigning Priorities for Fixed Priority Preemption Threshold Scheduling
Saehwa Kim
Department of Information Communications Engineering, Hankuk University of Foreign Studies, Yongin-si, Gyeonggi-do 449-791, Republic of Korea
Correspondence should be addressed to Saehwa Kim; ksaehwa@hufs.ac.kr
Received 1 September 2015; Accepted 15 October 2015
Academic Editor: Marko Bertogna
Copyright © 2015 Saehwa Kim. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Preemption threshold scheduling (PTS) enhances real-time schedulability by controlling preemptiveness of tasks. This benefit of PTS highly depends on a proper algorithm that assigns each task feasible scheduling attributes, which are priority and preemption threshold. Due to the existence of an efficient optimal preemption threshold assignment algorithm that works with fully assigned priority orderings, we need an optimal priority assignment algorithm for PTS. This paper analyzes the inefficiency or nonoptimality of the previously proposed optimal priority assignment algorithms for PTS. We develop theorems for exhaustively but safely pruning infeasible priority orderings while assigning priorities to tasks for PTS. Based on the developed theorems, we correct the previously proposed optimal priority assignment algorithm for PTS. We also propose a performance improved optimal priority assignment algorithm for PTS proving its optimality. The empirical evaluation results clearly show the effectiveness of the proposed algorithm.
1. Introduction
Preemption threshold scheduling (PTS) is an extension of preemptive fixed priority scheduling where each task has an extra scheduling attribute, called a preemption threshold, in addition to a priority. The preemption threshold of a task is its run-time priority, which is maintained after the task is dispatched and until it terminates its execution, so it regulates the degree of “preemptiveness” in fixed priority scheduling [1]. If the threshold of each task is the same as its original priority, then PTS is equivalent to fully preemptive fixed priority scheduling (FPS), and if each task has the highest threshold value in a system, it is equivalent to nonpreemptive scheduling (NPS). The use of PTS is very effective in system tuning processes since it enhances real-time schedulability, eliminates unnecessary preemptions, reduces memory stack usage [2] via the notion of nonpreemption groups [3], and allows for scalable real-time system design [4–6]. Preemption thresholds and nonpreemption groups are also parts of OSEK [7] and AUTOSAR [8] standards of automotive operating systems. As remarked in [9], PTS represents an example of a great success of transferring academic research results to industrial applications [10–12].
The benefit of enhanced real-time schedulability of PTS highly depends on a proper algorithm that assigns each task feasible scheduling attributes, which are priority and preemption threshold. The work of this paper has been highly motivated by our previous work of SISAtime [13], which adopts PTS to schedule active (concurrent) objects of real-time object-oriented models [14–19]. While SISAtime contains an optimal scheduling attributes assignment algorithm for PTS, it is not so much efficient. A scheduling attributes assignment algorithm is optimal if it is guaranteed to output a feasible (schedulable) scheduling attributes assignment if one exists [1, 20–22].
There are two previously proposed optimal scheduling attributes assignment algorithms for PTS: TRAVERSE() of SISAtime [13] and SEARCH() of [1], which is the first academic article that presented PTS. Both algorithms work in two stages. At the first stage, priorities are assigned to all tasks. At the second stage, preemption thresholds are assigned using the optimal preemption threshold assignment algorithm, OPT-ASSIGN-THRESHOLD() of [1], which has the complexity of $O(n^2)$. Recently, [23] extends OPT-ASSIGN-THRESHOLD() by considering the cache-related preemption delay (CRPD), and it also assigns optimal preemption
thresholds for tasks with preassigned priorities. Since preemption thresholds are wholly assigned at the second stage, both algorithms focus on how to assign priorities to tasks. With this, we call these optimal "scheduling attributes" assignment algorithms for PTS as optimal "priority" assignment algorithms for PTS.
In this paper, we analytically show that TRAVERSE() is inefficient and SEARCH() is not optimal. We develop theorems for exhaustively pruning infeasible priority orderings without harming the optimality of priority assignment algorithms for PTS. Specifically, we develop following lemmas and theorems under PTS:
(i) Under PTS, if the priority of a task is fixed, its worst-case response time does not decrease when its preemption threshold is lowered (Lemma 3).
(ii) Under PTS, if the preemption threshold of a task is fixed, its worst-case response time does not decrease when its priority is lowered (Theorem 6).
(iii) Under PTS, if a task with the highest preemption threshold in a priority ordering is infeasible, the task set with the priority ordering is also infeasible (Theorem 4).
(iv) Under PTS, if a task with the highest preemption threshold in a priority ordering is infeasible, the task set with another priority ordering that assigns the task the lowered priority is also infeasible (Theorem 7).
By applying these theorems, we correct SEARCH() and propose CORRECTED-SEARCH() which is more efficient than TRAVERSE(). We also propose PRUNED-TRAVERSE() that improves the performance of CORRECTED-SEARCH() and proves its optimality.
We also empirically evaluate the performances of the discussed optimal priority assignment algorithms. We first empirically show the usefulness of the proposed optimal priority assignment algorithm by showing that they always achieve the better schedulability than any other existing nonoptimal priority assignment algorithms. We also compare the actual runtimes for executing each optimal priority assignment algorithm as well as PA-DMMPT() by [24], which is the most effective heuristic priority assignment algorithm for PTS if it is combined with the policy of deadline monotonic priority ordering (DMPO). The empirical results clearly show that the actual runtimes of TRAVERSE() are reduced by CORRECTED-SEARCH(), whose actual runtimes are also more reduced by PRUNED-TRAVERSE() while such performance improvements become drastically large as the number of tasks increases. It is also shown that the actual runtimes of PRUNED-TRAVERSE() are even smaller than those of PA-DMMPT().
The remainder of the paper is composed as follows. Section 2 gives the task model with notations and presents a walk-through example that motivates our work. Section 3 analyzes previously proposed optimal priority assignment algorithms for PTS. Section 4 corrects previously proposed SEARCH() algorithm making it an optimal priority assignment algorithm for PTS. Section 5 describes our proposed optimal priority assignment algorithm for PTS and proves its optimality. Section 6 considers the complexity of the discussed optimal priority assignment algorithms. Section 7 shows our empirical evaluation results. Finally, Section 8 concludes the paper.
2. Task Model
We use the same task model as the one used in the traditional preemption threshold scheduling [1, 3, 25, 26]. Specifically, a system has a fixed set of tasks $\Gamma = \{\tau_1, \tau_2, \ldots, \tau_n\}$. Each task $\tau_i$ has a fixed period $T_i$, a fixed relative deadline $D_i$, and a known worst-case execution time $C_i$. There is no restriction such that each task's deadline should be shorter than its period. We also adopt the "integer time model" of [9], where all timing parameters are assumed to be nonnegative integer values.
Each task $\tau_i$ also has a fixed priority $p_i$ and a preemption threshold $pt_i$ where $p_i$ is assigned by a specific priority assignment algorithm and $pt_i$ is assigned by OPT-ASSIGN-THRESHOLD() of [1]. Each task has a distinct priority value: each task has a different priority value. Each task set $\Gamma$ has $|\Gamma|$ distinct priority orderings for its tasks. Accordingly, the set of distinct priority orderings has cardinality $|\Gamma|!$, which we denote $PO^\Gamma = \{PO_1, PO_2, \ldots, PO_{|\Gamma|!}\}$. We denote the resultant priority ordering generated by a specific priority assignment algorithm ALGORITHM() as $PO_A$. With this, a specific priority ordering $PO_n$ is a sequence of priorities for tasks in $\Gamma$, which we denote as $PO_n = \langle p_1^n, p_2^n, \ldots, p_n^n \rangle$. The inverse mapping of each priority ordering $PO_n$ is a task ordering from the lowest priority to the highest priority, which we denote as $PO_n^{-1} = TO_n = \langle i, j, \ldots, k \rangle$ where each number represents a task index. We also denote the inverse mapping of task ordering $TO_n$ as $TO_n^{-1} = PO_n$.
We denote a higher priority with a larger value: 1 is the lowest priority value and $|\Gamma|$ is the highest priority value. Note that it is meaningful to assign a task a preemption threshold that is no less than its regular priority since a preemption threshold is used as an effective run-time priority to control unnecessary preemptions [1]: which means that $\forall \tau_i, pt_i \geq p_i$. Notation section summarizes the notations and associated descriptions used in this paper.
2.1. Feasibility Analysis. As the feasibility test under PTS, we adopt the worst-case response time analysis equations of [9]. The original equations were introduced by [1] and their errors were fixed by [27]. These results were refined by [26], whose results in turn were concisely arranged by [9]. We rewrite the relevant equations of [9] for calculating the worst-case response time $R_i$ of task $\tau_i$ as follows:
$$R_i = \max_{q \in \{1, \ldots, Q_i\}} \left\{ F_{i,q} - (q - 1) \cdot T_i \right\}, \quad (1)$$
$$Q_i = \left\lfloor \frac{L_i}{T_i} \right\rfloor, \quad (2)$$
$$L_i = B_i + \sum_{\forall j, j \neq i, p_j \geq p_i} \left( \left\lfloor \frac{L_j}{T_j} \right\rfloor \cdot C_j \right). \quad (3)$$
Table 1: A walk-through example task set. Bold and italic R's represent infeasible response times.
<table>
<thead>
<tr>
<th>Tasks</th>
<th>( C_i )</th>
<th>( T_i )</th>
<th>( D_i )</th>
<th>( p_i )</th>
<th>( p_t )</th>
<th>( R_i )</th>
<th>( p_i )</th>
<th>( p_t )</th>
<th>( R_i )</th>
<th>( p_i )</th>
<th>( p_t )</th>
<th>( R_i )</th>
<th>( p_i )</th>
<th>( p_t )</th>
<th>( R_i )</th>
</tr>
</thead>
<tbody>
<tr>
<td>( \tau_1 )</td>
<td>8 43</td>
<td>36</td>
<td>1</td>
<td>4 31</td>
<td>4</td>
<td>4</td>
<td>14</td>
<td>1</td>
<td>4</td>
<td>31</td>
<td>2</td>
<td>4</td>
<td>30</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>( \tau_2 )</td>
<td>4 33</td>
<td>33</td>
<td>2</td>
<td>4 30</td>
<td>2</td>
<td>2</td>
<td>23</td>
<td>3</td>
<td>3</td>
<td>25</td>
<td>3</td>
<td>3</td>
<td>25</td>
<td>2</td>
<td>4</td>
</tr>
<tr>
<td>( \tau_3 )</td>
<td>5 48</td>
<td>31</td>
<td>3</td>
<td>3 26</td>
<td>3</td>
<td>3</td>
<td>19</td>
<td>2</td>
<td>4</td>
<td>30</td>
<td>1</td>
<td>4</td>
<td>31</td>
<td>1</td>
<td>4</td>
</tr>
<tr>
<td>( \tau_4 )</td>
<td>7 14</td>
<td>11</td>
<td>4</td>
<td>4</td>
<td>14</td>
<td>1</td>
<td>5</td>
<td>24</td>
<td>4</td>
<td>4</td>
<td>14</td>
<td>4</td>
<td>4</td>
<td>14</td>
<td>4</td>
</tr>
</tbody>
</table>
(i) DMPO: deadline monotonic priority ordering + OPT-ASSIGN-THRESHOLD() employed in [9].
(ii) GREEDY-SA(): Greedy() + SimulatedAnnealing() proposed in [3].
\[ F_{i,j} = S_{i,j} + C_i \]
\[ + \sum_{j,j',p_r} \left( \left[ \frac{F_{i,j}}{T_j} \right] - \left(1 + \left[ \frac{S_{i,j}}{T_j} \right] \right) \right) \cdot C_{j'} \]
(4)
\[ S_{i,j} = B_i + (q - 1) \cdot C_i + \sum_{j,j',p_r} \left(1 + \left[ \frac{S_{i,j}}{T_j} \right] \right) \cdot C_{j'} \]
B_i = max \{C_j - 1 | \forall j, pt_j \geq p_i > p_j\},
where \( L_i \) is the longest level-\( p_i \) busy period [28], \( q \) is the index of instances of task \( \tau_i \) within \( L_i \), \( Q_i \) is the last index of instances of task \( \tau_i \) within \( L_i \), \( F_{i,j} \) is the finish time of the \( q \)th instance of task \( \tau_i \), \( S_{i,j} \) is the start time of the \( q \)th instance of task \( \tau_i \), and \( B_i \) is the worst-case blocking time of task \( \tau_i \). Whenever a variable appears on both sides of an equation (i.e., \( L_i \) in (3) and \( F_{i,j} \) in (4)), its value can be found by iterating until the value converges [27]. Refer to [9] for the appropriate initial values for the iterations. With this, we define formally the feasibility of a task or a task set as follows.
**Definition 1** (task feasibility). Task \( \tau_i \) with the assignment of \( p_i \) and \( pt_i \) is feasible \( \iff R_i \leq D_i \).
**Definition 2** (task set feasibility). Task set \( \Gamma \) with priority ordering \( PO_{\Gamma} = (p_{i,1}^\Gamma, p_{i,2}^\Gamma, \ldots, p_{i,n}^\Gamma) \) or task ordering \( TO_{\Gamma} = PO_{\Gamma}^{-1} \) is feasible \( \iff \) every \( \tau_i \) in \( \Gamma \) is feasible such that \( \tau_i \) with \( p_{i,i}^\Gamma \) in \( PO_{\Gamma} \) and \( pt_i \) determined by OPT-ASSIGN-THRESHOLD() is feasible.
2.2. A Walk-Through Example Task Set. As a walk-through example, we use the task set in Table 1 that is composed of four tasks. The deadline monotonic priority ordering (DMPO) is optimal in the fully preemptive fixed priority scheduling [22] and is so even though there are blockings if there is no jitter [21]. Therefore, the approach of assigning priorities using DMPO and then assigning preemption thresholds using OPT-ASSIGN-THRESHOLD() of [1] is widely used in practice, which was also employed in [9] when comparing PTS with other limited preemptive scheduling policies. Since the task indexes of the example task set happen to be in the deadline monotonic decreasing order, the resultant priority ordering of DMPO is \( PO_{\Gamma_D} = (1, 2, 3, 4) \). However, as shown in Table 1, this priority ordering makes task \( \tau_4 \) miss its deadline since \( (R_4 = 14) > (D_4 = 11) \). Figure 1(a) demonstrates such a deadline miss: the fifth instance of task \( \tau_4 \) completes at time point 69 while its absolute deadline is \( (5 - 1) \cdot T_4 + D_4 = 67 \). Note that the worst-case response time cannot be obtained at the critical instant [29] when there is a nonpreemptiveness of tasks [9].
On the other hand, [3, 24] proposed heuristic priority assignment algorithms for PTS. Reference [3] proposed an algorithm that combines Greedy() and SimulatedAnnealing(), which we refer to GREEDY-SA() in this paper. Reference [24] proposed PA-DMMPT(), which means priority assignment algorithm assuming Deadline Monotonic and Maximum Preemption Threshold for the remaining tasks in the unassigned task set. The resultant priority ordering of GREEDY-SA() and PA-DMMPT() is, respectively, \( PO_{\Gamma_G} = (4, 2, 3, 1) \) and \( PO_{\Gamma_D} = (1, 3, 2, 4) \) as shown in Table 1. These priority orderings also make task \( \tau_4 \) miss its deadline as shown in Table 1.
Figures 1(b) and 1(c) demonstrate such deadline misses of task \( \tau_4 \). In Figure 1(b), the first, the second, and the fifth instances of task \( \tau_4 \) complete at time points 24, 31, and 69, respectively, while their absolute deadlines are \( D_4 = 11 \), \( (2 - 1) \cdot T_4 + D_4 = 25 \), and \( (5 - 1) \cdot T_4 + D_4 = 67 \), respectively. In Figure 1(c), the fifth instance of task \( \tau_4 \) completes at time point 69 while its absolute deadline is \( (5 - 1) \cdot T_4 + D_4 = 67 \). As such, widely used DMPO or heuristic priority assignment algorithms may not produce a feasible priority assignment while there is actually one, as will be shown in Section 3.1. This motivated our work.
3. Previously Proposed Optimal Priority Assignment Algorithms for PTS
This section analyzes previously proposed optimal priority assignment algorithms for PTS: TRAVERSE() [13] and SEARCH() [1].
3.1. TRAVERSE() Algorithm. Algorithm I(a) shows the pseudo code for TRAVERSE(). As shown in Algorithm I(a), TRAVERSE() depends on its recursive subroutine, TRAVERSE(), which has three parameters: (1) \( prio \), the next priority to assign, (2) \( UnAssigned \), the set of tasks that are waiting for priority assignment, and (3) \( \Gamma \), the set of total tasks (line (3)). TRAVERSE() assigns preemption thresholds by calling OPT-ASSIGN-THRESHOLD() of [1] when a complete priority ordering is generated (line (4)). When any preemption threshold assignment is not feasible, OPT-ASSIGN-THRESHOLD() returns fail. With
Figure 1: Schedule produced for the walk-through example task set of Table 1 by various priority assignment algorithms. Note that some instances of task $\tau_4$ in (a)–(d) miss their deadlines while every task in (e) does not miss its deadline.
The remaining part is composed of a loop that recursively invokes _TRAVERSE(): each task in \textit{UnAssigned} at line (5) is assigned the priority \textit{prio} at line (6) and remaining unassigned tasks (\textit{UnAssigned} - \{\tau\}) are recursively assigned \textit{prio} + 1 at line (7). Note that the recursive invocation of _TRAVERSE() returns only when the return value of the recursive invocation is \textit{success} (line (7)). We call this priority assignment the tentative priority assignment since if the return value of the recursion is \textit{fail}, the next task in \textit{UnAssigned} is tried for assigning priority \textit{prio}.
With such tentative priority assignments, _TRAVERSE() recursively generates a priority assignment tree for the set of tasks with task orderings from the lowest priority to the highest priority, which is similar to the priority permutation tree of [21]. Figure 2(a) shows the priority assignment tree of _TRAVERSE() for the walk-through example task set of Table 1. In Figure 2, each solid-lined circle node represents a tentative priority assignment to a task and its depth corresponds to its assigned priority. Each triangle node represents an invocation of OPT-ASSIGN-THRESHOLD(): white one for infeasible (failed) assignment return and black one for feasible (successful) assignment return. Each path from the root to a leaf node corresponds to a possible priority ordering. Task ordering \langle 3, 2, 1, 4 \rangle has a dangled black triangle node, which indicates a feasible preemption threshold assignment. Task ordering TO\_\tau \_\gamma = \langle 2, 3, 1, 4 \rangle has a dangled black triangle node, which indicates a feasible preemption threshold assignment. Task ordering TO\_\tau \_\gamma corresponds to the priority ordering PO\_\tau \_\gamma = \langle 2, 3, 1, 4 \rangle for _TRAVERSE() of Table 1. As shown in Table 1, _TRAVERSE() makes no tasks miss their deadlines, which is also demonstrated in Figure 1(e). While [13] did not formally prove the optimality of _TRAVERSE(), we can easily see that _TRAVERSE() is optimal since it traverses all possible priority orderings in PO\_\gamma until it finds a feasible priority ordering.
**Algorithm 1:** Pseudo code for (a) _TRAVERSE() [13] and (b) _SEARCH() [1].
```
(1) TRAVERSE (Γ: set of tasks)
(2) return _TRAVERSE(1, Γ, Γ);
(3) _TRAVERSE (prio: priority, UnAssigned: set of tasks, Γ: set of tasks)
(4) if (UnAssigned = {}) return OPT-ASSIGN-THRESHOLD(Γ);
(5) foreach (τ ∈ UnAssigned) {
(6) pᵢ ← prio;
(7) if (_TRAVERSE(prio + 1, UnAssigned - {τ}, Γ) = success) return success;
(8) // end-foreach
(9) return fail;
(a) TRAVERSE() [13]
(1) SEARCH (Γ: set of tasks)
(2) return _SEARCH(1, Γ, Γ);
(3) _SEARCH (prio: priority, UnAssigned: set of tasks, Γ: set of tasks)
(4) if (UnAssigned = {}) return OPT-ASSIGN-THRESHOLD(Γ);
(5) foreach (τ ∈ UnAssigned) {
// WCRT(τ, prio): Rᵢ with (pᵢ ← prio) under fully preemptive fixed priority scheduling
// assuming all tasks in UnAssigned have the highest priority.
(6) Delayᵢ ← WCRT(τ, prio) - Dᵢ;
(7) if (Delayᵢ ≤ 0) {
(8) pᵢ ← prio;
(9) return _SEARCH(prio + 1, UnAssigned - {τ}, Γ);
}
(10) // end-if
(11) // end-foreach
(12) SortedList ← ascendingSort(UnAssigned, Delayᵢ);
(13) RefinedList ← Refine(SortedList); // eliminating infeasible tasks even with the highest preemption threshold
(14) foreach (τ ∈ RefinedList) {
(15) pᵢ ← prio;
(16) if (_SEARCH(prio + 1, UnAssigned - {τ}, Γ) = success) return success;
}
(17) // end-foreach
(18) return fail;
(b) SEARCH() [1]
```
this, returning at the last lines (line (9)) happens when a specific priority ordering is not feasible.
Besides, it is a simple application of traverse_orderings() [21], which is for fully preemptive fixed priority scheduling and its optimality was proved.
However, TRAVERSE() is very inefficient since it generates $|Γ|!$ tentative priority orderings in the worst-case, each of which requires maximally $|Γ|^2$ feasibility tests [3] via OPT-ASSIGN-THRESHOLD(). For example, the priority assignment tree of Algorithm 3(a) requires 91 feasibility tests as the numbers besides triangle nodes indicate. Such a large number of feasibility tests can be significantly reduced in our proposed algorithm in Section 5.
3.2. SEARCH() Algorithm. Algorithm 1(b) shows the pseudo code for SEARCH(), which becomes exactly the same as
TRAVERSE() if we remove lines (5)∼(13) and replacing RefineList with UnAssigned at line (14). The additional part of SEARCH() is composed of one loop (lines (5)∼(II)) and refining UnAssigned to prepare RefineList (lines (12) and (13)). In contrast to the priority assignment loop of TRAVERSE(), this additional first loop in SEARCH() assigns priority prio to task \( \tau_i \) only when Delay\( _i \) (calculated at line (6)) is not larger than zero (line (7)) and unconditionally returns from the recursion (line (9)). We call this priority assignment in the first loop as the **assertive priority assignment** since once priority prio is assigned to \( \tau_i \), the other unassigned tasks are not tested for assigning priority prio.
The second loop of SEARCH() (lines (14)∼(18)) performs the tentative priority assignment as TRAVERSE() but it works for RefineList instead of UnAssigned. The RefineList is generated by sorting tasks in UnAssigned in the ascending order of Delay\( _i \) (line (12)) and eliminating infeasible tasks even with the highest preemption threshold assignment (line (13)).
With the assertive and tentative priority assignments, SEARCH() generates a priority assignment tree like Figure 2(b), which is for the walk-through example task set of Table 1. In the tree, each solid-lined square node represents an assertive priority assignment to a task while each dashed-lined node represents pruning a priority assignment to a task. In Figure 2(b), two complete task orderings were generated: \( \{2,1,3,4\} \) and \( \{3,1,2,4\} \). Both orderings failed to assign feasible preemption thresholds to tasks as the dangled white triangle nodes indicate. The last task ordering TO\( _S = \{3,1,2,4\} \) corresponds to the priority ordering PO\( _S = \{2,3,1,4\} \) for SEARCH() of Table 1. As shown in Table 1, SEARCH() makes task \( \tau_4 \) miss its deadline since \( R_4 = 14 \) > \( D_4 = 11 \). Figure 1(d) demonstrates such a deadline miss of task \( \tau_4 \) where the second instance of task \( \tau_4 \) completes at time point 26 while its absolute deadline is \( T_4 + D_4 = 25 \). However, the walk-through example task set has a feasible priority ordering PO\( _T = \{3,2,1,4\} \) from TRAVERSE() algorithm as we have shown in Section 3.1. This clearly shows SEARCH() is not an optimal priority assignment algorithm for PTS.
If we compare the priority assignment trees of TRAVERSE() and SEARCH() in Figures 2(a) and 2(b), we can see that TO\( _S = \{3,1,2,4\} \) is the 13th task ordering generated by TRAVERSE(). The reason why SEARCH() failed is due to the assertive priority assignment of \( p_{t_1}^1 \leftarrow 2 \) with the 21st feasibility test, which we marked with a red dashed-line circle in Figure 2(b). We correct SEARCH() in the next section.
### 4. Corrected SEARCH() Algorithm
In this section, we propose CORRECTED-SEARCH() algorithm that corrects SEARCH() algorithm. We first develop a theorem that is required in correcting SEARCH().
**Lemma 3.** Under PTS, if priority \( p_t \) of task \( \tau_i \) is fixed, its worst-case response time \( R_i \) does not decrease when its preemption threshold \( p_t \) is lowered.
**Proof.** While \( R_i \) is calculated from (1)∼(6), \( p_t \) is only included in (4) for calculating \( F_{i,t} \), specifically in the last term of the right side of (4): \( \sum_{i, p > p_t} [(F_{i,t}/T_{i,t}) - (1 + [S_{i,t}/T_{i,t}])] \cdot C_i \). We refer to this term as \( I \) for the convenience of proving. \( I \) is the summation of the interference time by task \( \tau_i \) that it works for RefineList instead of UnAssigned.
From Theorem 4, pruning at line (5) makes RefineList instead of UnAssigned. Theorem 4.
Theorem 4. Under PTS, if task \( \tau_i \) with priority \( p_t^i \) in priority ordering \( \Gamma \) is infeasible, task set \( \Gamma \) with \( p_t^i \) is also infeasible.
**Proof.** From Definition 1, task \( \tau_i \) is feasible if and only if \( R_i \leq D_i \). From Lemma 3, if \( p_t \) is fixed (as \( p_t^i \)), \( p_t = |\Gamma| \) guarantees the minimal \( R_i \) for \( \tau_i \). Accordingly, if task \( \tau_i \) with fixed \( p_t \) and \( p_t = |\Gamma| \) is infeasible, no other preemption threshold assignment can make \( R_i \) reduced, that is, \( \tau_i \) feasible. From Definition 2, \( \Gamma \) with \( p_t^i \) is feasible if and only if all tasks with \( p_t^i \) in \( \Gamma \) are feasible. This proves the theorem.
Algorithm 2(a) shows the pseudo code of CORRECTED-SEARCH(), which corrects SEARCH() in Algorithm 1(b) as follows:
1. (i) deletion of the first loop of the assertive priority assignment and sorting tasks (lines (5)∼(12) of Algorithm 1(b)),
2. (ii) replacement of SortedList with UnAssigned (line (13) of Algorithm 1(b)),
3. (iii) adding \( p_t \leftarrow \text{prior} \) after \( p_t \leftarrow \text{prior} \) (line (15) of Algorithm 1(b)),
4. (iv) replacement of OPT-ASSIGN-THRESHOLD(\( \Gamma \)) at line (4) with RESTORING-OPT-ASSIGN-THRESHOLD(\( \Gamma \)) of Algorithm 2(b).
First, CORRECTED-SEARCH() does not employ the first loop of SEARCH(), the assertive priority assignment, which is the main cause of the nonoptimality of SEARCH() as shown in the previous section. If we change the assertive priority assignment to a tentative priority assignment by replacing line (9) with line (16) in Algorithm 1(b), it just induces additional feasibility tests (due to invocation of operation WCRT()) when a given task set is indeed infeasible. In other words, the first loop just becomes a performance bottleneck even though it is corrected and thus we remove it.
Second, without the first loop of SEARCH(), Delay\( _i \) is not calculated and thus the task sorting of line (12) of Algorithm 1(b) is not also employed. Note that the second loop of SEARCH() is exactly the same as TRAVERSE() except that it works for RefineList instead of UnAssigned. From Theorem 4, pruning at line (5) that makes RefineList
is valid. With this, we can easily see that CORRECTED-SEARCH() is optimal since TRAVERSE() is optimal.
Third, we assign task $\tau_i$ preemption threshold $pt_i$ as the same value of its priority at line (8) whenever its priority $p_i$ is assigned (line (7)). This is to make sure that any priority assigned task is preemptable by higher priority tasks. For the feasibility test for refining $UnAssigned$ by subroutine Refine() at line (5) to work correctly, it should be guaranteed
that any task in UnAssigned can preempt the preassigned lower priority tasks in Γ − UnAssigned. SEARCH() does not need this preemption threshold assignment due to WCRT() invocation at line (6) of Algorithm 1(b) where every task’s preemption threshold is set as its priority.
Finally, RESTORING-OPT-ASSIGN-THRESHOLD() in Algorithm 2(b) restores the preemption threshold of each task to its priority in the case of the failed (infeasible) preemption threshold assignment return. Without this correction, after OPT-ASSIGN-THRESHOLD() has assigned preemption thresholds to tasks, preemption threshold values of tasks are contaminated and thus subroutine Refine() at line (5) cannot work correctly.
Figure 2(c) shows the priority assignment tree of CORRECTED-SEARCH() for the walk-through example task set of Table 1. In the figure, six complete task orderings were generated. The last task ordering TOC = (3, 2, 1, 4) is the same as TOR, and the resultant feasible task ordering of TRAVERSE(). CORRECTED-SEARCH() requires 74 feasibility tests while TRAVERSE() requires 91 feasibility tests as the numbers beside triangle nodes indicate in Figures 2(a) and 2(c). As such, it is obvious that the overall performance of CORRECTED-SEARCH() is much better than that of TRAVERSE() since CORRECTED-SEARCH() prunes infeasible paths while TRAVERSE() does not. We develop the more performance enhanced algorithm in the next section.
5. PRUNED-TRAVERSE() Algorithm
SEARCH() is not optimal since it prunes even feasible priority orderings. As such, pruning exhaustively without harming the optimality is important. In this section, we propose our optimal priority assignment algorithm for PTS, which we named PRUNED-TRAVERSE(). We first develop required theorems for our proposed algorithm.
Lemma 5. Under any priority assignment algorithm that assigns distinctive priorities to tasks for PTS, if the priority pₖ of a task τₖ is lowered to pₖ’ (pₖ’ < pₖ), there exists at least one lower priority task τⱼ (pⱼ < pₖ’) that heightens its priority pⱼ to pⱼ’ with pⱼ’ > pⱼ.
Proof. The lemma can be easily proved by observing task orderings in priority assignment trees like Figure 2(a). If task τ₁ is moved to a lower priority level (the higher place), at least one of the lower priority tasks should be moved to a higher priority level (the lower place) since the total priority levels are fixed.
Theorem 6. Under PTS, if preemption threshold pt of task τᵢ is fixed, its worst-case response time Rᵢ does not decrease when its priority pᵢ is lowered.
Proof. For the convenience of proving, we refer to the last terms of the right sides of (4) and (5) as Iᵢ^F and Iᵢ^S, respectively. We prove the theorem by contradiction. Suppose that Rᵢ of task τᵢ decreases to Rᵢ’ when its priority pᵢ is lowered to pᵢ’; Rᵢ’ < Rᵢ and pᵢ’ < pᵢ. For Rᵢ to decrease, Sᵢ<j should decrease from (1). For Sᵢ<j to decrease, Sᵢ,j or Iᵢ<j^S should decrease from (4). Since the condition for calculating Iᵢ^F is pⱼ > pt, the change of priority pⱼ does not affect Iᵢ<j^F. Therefore, Sᵢ,j should decrease to Sᵢ,j’ such that Sᵢ,j − Sᵢ,j’ > 0. Then, from (5), (Iᵢ<j^S − Iᵢ<j^F) > 0 follows where Bᵢ’ and Iᵢ<j^S’ are changed values of Bᵢ and Iᵢ<j^S due to the lower priority. Then, (Bᵢ − Bᵢ’) > 0 follows.
From Lemma 5, if pᵢ is lowered to pᵢ’, there exists at least one lower priority task τⱼ (pⱼ < pᵢ) that heightens its priority pⱼ to pⱼ’ such that pⱼ’ > pⱼ. Let the set of such additionally introduced higher priority tasks after the priority of task τᵢ is lowered be AddedHPⱼ = {τⱼ | pⱼ < pᵢ and pⱼ’ > pⱼ}. The maximum possible value of (Bᵢ − Bᵢ’) is achieved when Bᵢ’ = 0, which infers that at least one task in AddedHPⱼ contributes in making Bᵢ. Let such a task in AddedHPⱼ be task τⱼ; that is Bⱼ = Cⱼ. Then, max(Bᵢ − Bᵢ’) = Cⱼ follows. On the other hand, from (5), it follows that Iᵢ<j^S = Iᵢ<j^F = \sum_{j,p∈AddedHP,j \neq i} [Sⱼ/p(Tⱼ) \cdot Cⱼ ≤ Cⱼ. Then, (Bᵢ − Bᵢ’) ≤ (Iᵢ<j^S − Iᵢ<j^F) follows.
This is a contradiction, which proves the theorem.
Theorem 7. Under PTS, if task τᵢ with priority pᵢᵢ in priority ordering POᵢ and the highest preemption threshold ptᵢ = |Γ| is infeasible, task set Γ with another priority ordering POᵢ that assigns task τᵢ the lower priority pᵢᵢ’ (such that pᵢᵢ’ < pᵢᵢ) is also infeasible.
Proof. Let the worst-case response time of task τᵢ with ptᵢ = |Γ| and pᵢᵢ’ be Rᵢ’ and Rᵢ. Let the worst-case response time of task τᵢ with ptᵢ = |Γ| and pᵢᵢ’ be Rᵢ’. From Lemma 3, both Rᵢ and Rᵢ’ are the minimal possible worst-case response time with each given priority. From Theorem 6, Rᵢ’ ≥ Rᵢ follows. Since task τᵢ with pᵢᵢ’ and ptᵢ = |Γ| is infeasible, Rᵢ’ > Dᵢ follows from Definition 1. Therefore, Rᵢ’ > Dᵢ follows. Accordingly, task τᵢ with pᵢᵢ’ and ptᵢ = |Γ| is infeasible. Consequently, from Theorem 4, task set Γ with POᵢ is also infeasible.
Now we propose PRUNED-TRAVERSE() that extends TRAVERSE() by exhaustively pruning infeasible paths. PRUNED-TRAVERSE() prunes such priority ordering POᵢ that assigns task τᵢ priority pᵢᵢ when the following condition is true:
C₁ ∨ C₂, (7)
where C₁ is ptᵢ = |Γ| ∧ Rᵢ > Dᵢ, and C₂ is pᵢᵢ < max{pⱼ | C₁}. Apparently, Condition C₁ is from Theorem 4 and Condition C₂ is from Theorem 7.
Algorithm 3 shows the pseudo code for PRUNED-TRAVERSE(). Like TRAVERSE(), TRAVERSE() depends on its subroutine,, PRUNED-TRAVERSE(), which has the same parameters as _TRAVERSE(): _pri, UnAssigned, and Γ (line (9)). Like _TRAVERSE(), _PRUNED-TRAVERSE() assigns priorities to tasks from the lowest priority 1 to the highest priority |Γ|; it assigns each task τᵢ in UnAssigned (line (10)) priority _pri (line (12)) and the
remaining unassigned tasks \((\text{UnAssigned} - \{\tau_i\})\) are recursively assigned priority \(\text{prio} + 1\) at line (21).
Unlike \(\text{TRAVERSE}\), \(\text{PRUNED-TRAVERSE}\) first sorts tasks in a deadline monotonic decreasing order since DMPO also works well in many cases (line (2)). \(\text{PRUNED-TRAVERSE}\) introduces for task \(\tau\) new attribute \(\text{infeasiblePrioMax}_\tau = \max\{p, | C1\}\), which is the right side of the Condition \(C2\). It initializes \(\text{infeasiblePrioMax}_\tau\) as zero at line (4).
Unlike \(\text{TRAVERSE}\), \(\text{PRUNED-TRAVERSE}\) needs to perform a feasibility test for task \(\tau_i\) (getting \(R_i\)) while assigning each priority in order to prune infeasible paths. For this, we need to make sure that all tasks in \(\text{UnAssigned}\) have higher priorities than the priorities of the previously priority assigned tasks. For this, \(\text{PRUNED-TRAVERSE}\) assigns the highest priority \(|\Gamma|\) to all unassigned tasks initially at line (5). \(\text{PRUNED-TRAVERSE}\) also does so conditionally at line (26) whenever the next priority \((\text{prio} + 1)\) assignment fails at line (25). Preemption thresholds of all tasks are also initialized as the same value of their priorities at line (6).
Before assigning task \(\tau_i\) priority \(\text{prio}\) (line (12)), \(\text{PRUNED-TRAVERSE}\) first prunes any infeasible priority ordering at line (11) if \(\text{prio}\) is smaller than \(\text{infeasiblePrioMax}_\tau\), which is Condition \(C2\). Condition \(C1\) is applied at lines (13) and (19) and the priority ordering with Condition \(C1\) is pruned at line (22). Line (20) is for restoring the priority of the pruned task. Line (21) is for updating \(\text{infeasiblePrioMax}_\tau\). If task \(\tau_i\) is assigned priority \(\text{prio}\) without being pruned, its preemption threshold is assigned the same as its priority at line (24), without which PTS becomes the fully nonpreemptive scheduling (NPS) due to the highest preemption threshold assignment at line (13).
Once \(\text{prio}\) of the maximum priority \(|\Gamma|\) is assigned (line (14)), which means that a complete priority ordering is generated, \(\text{PRUNED-TRAVERSE}\) assigns preemption thresholds by invoking \(\text{RESTORING-OPT-ASSIGN-THRESHOLD}\) in Algorithm 2(b). Note that there are two differences with \(\text{TRAVERSE}\) in assigning preemption thresholds: (1) invoking \(\text{RESTORING-OPT-ASSIGN-THRESHOLD}\) instead of \(\text{OPT-ASSIGN-THRESHOLD}\) and (2) assigning preemption thresholds to tasks once the maximum priority is assigned instead once \(\text{UnAssigned}\) is \(\emptyset\). (1) is for the proper pruning operation as we explained in proposing \(\text{CORRECTED-SEARCH}\) in Section 4. (2) is for reducing one recursive function call for a performance benefit: one recursive function call is reduced for each complete priority ordering in \(\text{PRUNED-TRAVERSE}\) compared to \(\text{TRAVERSE}\) or \(\text{CORRECTED-SEARCH}\).
When any preemption threshold assignment is not feasible, \(\text{RESTORING-OPT-ASSIGN-THRESHOLD}\) returns fail. In that case, \(\text{infeasiblePrioMax}_\tau\) is set to \(|\Gamma|\) at line (16). This is because the fail return of \(\text{RESTORING-OPT-ASSIGN-THRESHOLD}\) infers that the highest priority assigned task \(\tau_i\) is not feasible due to some blocking task whose preemption threshold should be raised for it to be feasible. The recursive invocation of \(\text{PRUNED-TRAVERSE}\) returns only when the return value of the recursive invocation is \(\text{success}\) (line (25)). With this, returning at the last lines (line (28)) happens when a specific ordering is not feasible.
\(\text{PRUNED-TRAVERSE}\) requires careful restorations of priorities and preemption thresholds of tasks, which are repetitively and tentatively assigned. Since \(\text{SEARCH}\) and \(\text{CORRECTED-SEARCH}\) prune infeasible paths within subroutine \(\text{Refine}\), such restoration is easier and less prone. However, \(\text{PRUNED-TRAVERSE}\) prunes infeasible paths as earlier as possible for the better efficiency and thus requires careful restoring operations. Priorities are restored before pruning at line (20) and after the failed priority assignment at line (26). Preemption thresholds are restored in \(\text{RESTORING-OPT-ASSIGN-THRESHOLD}\) at line (15). Assigning the preemption threshold as same as the priority of the priority assigned task at line (24) is also important for the proper pruning.
Now we prove the optimality of \(\text{PRUNED-TRAVERSE}\).
**Theorem 8.** \(\text{PRUNED-TRAVERSE}\) is optimal for PTS: it finds a feasible scheduling attributes assignment if there exists one.
**Proof.** \(\text{PRUNED-TRAVERSE}\) extends \(\text{TRAVERSE}\) by pruning infeasible priority orderings with Condition \(C1\) or \(C2\). Condition \(C1\) is valid from Theorem 4 and condition \(C2\) is valid from Theorem 7. Consequently, since \(\text{TRAVERSE}\) is optimal, \(\text{PRUNED-TRAVERSE}\) is optimal.
Figure 2(d) shows the priority assignment tree of \(\text{PRUNED-TRAVERSE}\) for the walk-through example task set of Table 1. In the figure, a gray dashed-lined circle represents pruning a priority ordering without any feasibility test, which is achieved by application of Condition \(C2\) from Theorem 7. By comparing Figures 2(c) and 2(d), we can easily see this additional pruning helps much in reducing the number of feasibility tests: the feasibility tests of (7), (21)–(39), (55)–(62) in Figure 2(c) do not happen in Figure 2(d). We can also see that the earlier pruning with condition \(C1\) of \(\text{PRUNED-TRAVERSE}\) instead of using subroutine \(\text{Refine}\) of \(\text{CORRECTED-SEARCH}\) reduces the number of feasibility tests: the feasibility tests of (4), (42), (64) in Figure 2(c) do not happen in Figure 2(d).
The resultant last task ordering \(\text{T}_{\tau\tau} = \{3, 2, 1, 4\}\) is the same as \(\text{T}_{\tau\tau}\) and \(\text{T}_{\tau\tau}\), which are the resultant feasible task ordering of \(\text{CORRECTED-SEARCH}\) and \(\text{TRAVERSE}\), respectively. \(\text{PRUNED-TRAVERSE}\) produces four complete priority orderings and requires 47 feasibility tests while \(\text{CORRECTED-SEARCH}\) produces six complete priority orderings and requires 74 feasibility tests. As such, it is obvious that the overall performance of \(\text{PRUNED-TRAVERSE}\) is much better than that of \(\text{CORRECTED-SEARCH}\) since \(\text{PRUNED-TRAVERSE}\) prunes more infeasible paths than \(\text{CORRECTED-SEARCH}\) exploiting Theorem 7 and the earlier pruning. We show the empirical performance comparison results in Section 7.
### 6. Complexity
Let \(n = |\Gamma|\) and \(E\) the nonpolynomial [20] complexity of the feasibility test (calculating \(R_i\) from (1)–(6)). Since the pruning operation is conditional, all these algorithms
in the worst-case produce \( n! \) priority orderings of \( \text{PO}^\Gamma \), each of which requires \( O(n^r) \) feasibility tests [3] via OPT-ASSIGN-THRESHOLD(). With this, TRAVERSE() has the complexity of \( O(E \cdot n! \cdot n^r) \).
On the other hand, each pruning operation of CORRECTED-SEARCH() and PRUNED-TRAVERSE() requires one feasibility test for each tentative priority assignment or pruning (circle) node. The number of circle nodes in a priority assignment tree in the worst-case is \( n + n \cdot (n - 1) + n \cdot (n - 1) \cdot (n - 2) + \cdots + n! \), which is \( O(n!) \). Therefore, the worst-case complexity of CORRECTED-SEARCH() and PRUNED-TRAVERSE() is \( O(E \cdot n! \cdot n^r) + O(E \cdot n!) = O(E \cdot n! \cdot n^r) \), which is the same as that of TRAVERSE(). However, the pruning operation obviously works as a branch and bound mechanism and derives much better performances in most cases as the following empirical comparison shows.
### 7. Empirical Performance Evaluations
We set the performance metrics of priority assignment algorithms for PTS as (1) schedulability as the ratio of feasible task sets and (2) actual runtimes for executing algorithms. The experiments for getting the actual runtimes of the algorithms were done on Intel Core i7-4770, 3.40 GHz with 8 GB RAM. We set the total utilization of each task set as \( U = 0.9 \). This utilization represents high-demanding workloads, which makes the feasibility of a given task set greatly dependent on a proper priority assignment algorithm. Note that the utilization bound \( U_B \) under the rate monotonic scheduling (RMS) [29] when \( |\Gamma| = n \) is \( U_B = n \cdot (\sqrt{2} - 1) \). For example, if \( |\Gamma| = 10 \) and \( U \leq 0.72 \) (\( \approx 10 \cdot (\sqrt{2} - 1) = U_B \)), we even do not need PTS if task deadlines are the same as periods since the fully preemptive fixed priority scheduling with DMPO always makes the task set feasible.
We generated each task set in the same manner as [9]. Specifically, for a given total utilization \( U = 0.9 \), we generated each task's utilization \( u_i \) using UUniFast [30] algorithm. For each task \( t_i \), we generated \( C_i \) as a random integer uniformly distributed in the interval \([100, 500]\), \( T_i = C_i/u_i \), and \( D_i \) as a random integer uniformly distributed in the interval \([C_i + 0.5 \cdot (T_i - C_i), T_i] \). For each experiment with a specific parameter setting, we generated 2,000 task sets. To focus on the effectiveness of pruning operations of PRUNED-TRAVERSE(), each task set was ordered in the deadline monotonic decreasing order. Since TRAVERSE() took too much time when the number of tasks is large, we applied timeout for executing TRAVERSE() when \( |\Gamma| \geq 10 \). The actual runtimes of TRAVERSE() with timeout were set as the real actual runtime of TRAVERSE() when a task set was not feasible.
#### 7.1. Schedulability
Figure 3 shows the schedulability results with \( U = 0.9 \) and \( |\Gamma| = 10 \). Figure 3(a) shows the percentage ratio of feasible task sets and Figure 3(b) shows the Venn diagram for the number of feasible task sets. The ratio of feasible task sets was calculated as the number of feasible task sets divided by the total number of generated task sets. The resultant feasible task set ratios of TRAVERSE(), CORRECTED-SEARCH(), and PRUNED-TRAVERSE() were exactly the same and thus we omitted the results of TRAVERSE() and CORRECTED-SEARCH() in Figure 3.
Figure 3(a) clearly shows that the schedulability performance results of PA-DMMPT() [24], SEARCH() [1], GREEDY-SA() [3], DMPO [9], and PRUNED-TRAVERSE() are uniformly improved in order. Specifically, PA-DMMPT(), SEARCH(), GREEDY-SA(), DMPO, and PRUNED-TRAVERSE() could, respectively, schedule 50.6\%, 53.45\%, 59.9\%, 64.65\%, and 67.65\%. Note that PRUNED-TRAVERSE() outperforms than any other priority assignment algorithms, which clearly shows that the other algorithms are nonoptimal.
Figure 3(b) shows the Venn diagram for the number of feasible task sets in 2,000 task sets. As shown, PRUNED-TRAVERSE() could schedule 27 task sets that could not be scheduled by any other existing heuristic priority assignment algorithms. It is notable that each heuristic algorithm could schedule some task sets that could not be scheduled by the other heuristic algorithms. For example, SEARCH() could schedule two task sets that could not be scheduled by the other heuristic algorithms.
DMPO is a very efficient algorithm that requires almost no implementation efforts as well as computation time burden. Accordingly, it is practical to combine DMPO with another heuristic algorithm. Figure 3(b) shows that SEARCH(), GREEDY-SA(), and PA-DMMPT(), respectively, could schedule 5 (2 + 0 + 2 + 1), 19 (9 + 8 + 2 + 0), and 22 (11 + 1 + 2 + 8) task sets that could not be schedule by DMPO. On the other hand, DMPO + SEARCH(), DMPO + GREEDY-SA(), and DMPO + PA-DMMPT(), respectively, could schedule 64.9\%, 65.6\%, and 65.75\%. With this, we conclude that PA-DMMPT() is the most effective heuristic priority assignment algorithm as the best candidate to be combined with DMPO. Therefore, we compare its actual runtimes with our proposed algorithms in the next subsection. Note that any DMPO combined heuristic algorithm cannot become optimal due to the existence of task sets that can be scheduled only by PRUNED-TRAVERSE() as shown in Figure 3(b).
#### 7.2. Actual Runtimes
We compare the actual runtimes for executing optimal priority assignment algorithms and PA-DMMPT(), which is the most effective heuristic algorithm to be combined with DMPO as shown in the previous section. Figures 4(a) and 4(b) show the actual runtime results in seconds as box plots when \( U = 0.9 \) for \( |\Gamma| = 5 \) and \( |\Gamma| = 10 \), respectively. \( Y \) axis is in a log scale to better show the distributions of result values. Each box in a box plot shows data results between 25\% and 75\% of performance distribution. The middle line within each box shows the median value of the results while the filled circle mark shows the average value of the results.
Figures 4(a) and 4(b) clearly show that the actual runtime performance distribution results of TRAVERSE(), CORRECTED-SEARCH(), and PRUNED-TRAVERSE() are
uniformly improved in order. In Figure 4(a) with $|\Gamma| = 5$, the maximum and average runtimes were decreased by 72.6% and 87.0%, respectively, in CORRECTED-SEARCH() compared to the TRAVERSE() (from 0.84 sec to 0.23 sec and from 0.23 sec to 0.03 sec). PRUNED-TRAVERSE() further decreased the maximum and average actual runtime values of CORRECTED-SEARCH() by 8.7% and 33.3%, respectively (to 0.21 sec and to 0.02 sec).
Such performance differences become drastically large as the number of tasks $|\Gamma|$ increases. In Figure 4(b) with $|\Gamma| = 10$, the maximum and average actual runtimes of CORRECTED-SEARCH() compared to TRAVERSE() were decreased by 98.0% and 99.95%, respectively (from 67809 sec to 1331 sec and from 21947 sec to 10.73 sec). Moreover, PRUNED-TRAVERSE() decreased the maximum and average values of CORRECTED-SEARCH() by 61.2% and 58.3%, respectively (to 517 sec and to 4.47 sec).
On the other hand, we can see the median values of actual runtimes of TRAVERSE() were always smaller than any other algorithms. This is because TRAVERSE() does not perform
Figure 3: Schedulability with $U = 0.9$ and $|\Gamma| = 10$.
Figure 4: Actual runtimes in seconds when $U = 0.9$.
any feasibility test for priority assignments that are required by the other algorithms. When a task set is feasible with DMPO, the actual runtimes of TRAVERSE() are the same as DMPO.
Figures 4(a) and 4(b) also show that the actual runtimes of PA-DMMPT() are much larger than PRUNED-TRAVERSE() and even larger than CORRECTED-SEARCH(). Specifically in Figure 4(b) with |Γ| = 10, the maximum and average actual runtimes of PA-DMMPT() compared to PRUNED-TRAVERSE() were increased by 1167% and 150% (from 517 sec to 6551 sec and from 4.47 sec to 11.18 sec). This is because PA-DMMPT() calculates task blocking limits by generating candidate pairs of start and finish times of tasks. As well investigated in [31], the execution requirements of such an approach that generates scheduling points grow exponentially with an increasing range of task periods. Our experimental task sets were generated in the same manner as [9], where the range of task periods increases as the number of tasks increases.
However, PRUNED-TRAVERSE() still cannot be used as an online feasibility test algorithm since its performance is also degraded much as the number of tasks increases. For example, for a task set Γ with U = 0.9 and |Γ| = 20, PRUNED-TRAVERSE() took 7 hours to determine that the task set was after all infeasible. Nevertheless, the above experimental results clearly show that PRUNED-TRAVERSE() outperforms any other optimal priority assignment algorithms as well as the best effective heuristic priority assignment algorithm for PTS.
8. Conclusion
Preemption threshold scheduling (PTS) has been widely accepted in the industrial domain for its effectiveness of scalable real-time embedded system design with the increased real-time schedulability (feasibility). However, without an available optimal scheduling attributes assignment algorithm (optimal in the sense that it is guaranteed to find a feasible scheduling attributes assignment if one exists), we cannot achieve the full benefits of PTS.
Since there exists an optimal and efficient O(n^3) preemption threshold assignment algorithm [1] that operates with fully assigned priority orderings, we need an optimal priority assignment algorithm for PTS. In this paper, we analyzed previously proposed optimal priority assignment algorithms for PTS: TRAVERSE() [13] and SEARCH() [1]. Using priority assignment trees, we showed the inefficiency of TRAVERSE() due to its lack of any pruning operation. We also showed the nonoptimality of SEARCH() due to its pruning of even feasible priority orderings.
We developed some theorems for safely and exhaustively pruning infeasible priority ordering paths while assigning priorities to tasks before assigning feasible preemption thresholds for PTS. Using these theorems, we corrected SEARCH() and presented CORRECTED-SEARCH() algorithm. We also proposed PRUNED-TRAVERSE() that enhances the performance of CORRECTED-SEARCH() while proving its optimality. Our empirical evaluation results clearly showed the effectiveness of PRUNED-TRAVERSE() both in schedulability and actual runtimes compared to any other existing priority assignment algorithms for PTS.
Notations
τ_i: A task
Γ: The set of tasks {τ_1, τ_2, ..., τ_n}
|Γ|: The number of tasks in task set Γ, the highest priority value
C_i: The worst-case execution time of task τ_i
T_i: The period of task τ_i
D_i: The relative deadline of task τ_i
p_i: The priority of task τ_i
pt_i: The preemption threshold of task τ_i
PO^Γ: The set of all distinct priority orderings {PO_1, PO_2, ..., PO_|Γ|} in task set Γ
PO_n: A priority ordering, a sequence of task priorities ⟨p_i^n, p_2^n, ..., p_2^n⟩
P_n^i: The priority of task τ_i in priority ordering PO_n
PO_A: The resultant priority ordering generated by priority assignment algorithm ALGORITHM()
TO_n: A task ordering from the lowest priority to the highest priority, a sequence of task indexes (i, j, ..., k)
PO_n^{-1}: The inverse mapping of priority ordering PO_n, the task ordering TO_n
TO_n^{-1}: The inverse mapping of task ordering TO_n, the priority ordering PO_n
R_i: The worst-case response time of task τ_i
L_i: The longest level-p_i busy period
B_i: The worst-case blocking time of task τ_i
S_{ij,q}: The start time of the qth instance of task τ_i in L_i
F_{ij,q}: The finish time of the qth instance of task τ_i
Conflict of Interests
The author declares that there is no conflict of interests regarding the publication of this paper.
Acknowledgment
This work was supported by Hankuk University of Foreign Studies Research Fund of 2015.
References
|
{"Source-Url": "http://downloads.hindawi.com/journals/tswj/2015/837472.pdf", "len_cl100k_base": 14339, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 62573, "total-output-tokens": 16379, "length": "2e13", "weborganizer": {"__label__adult": 0.00033664703369140625, "__label__art_design": 0.0005207061767578125, "__label__crime_law": 0.0004394054412841797, "__label__education_jobs": 0.00218963623046875, "__label__entertainment": 0.00010120868682861328, "__label__fashion_beauty": 0.00019812583923339844, "__label__finance_business": 0.000774383544921875, "__label__food_dining": 0.00032711029052734375, "__label__games": 0.0009212493896484376, "__label__hardware": 0.003582000732421875, "__label__health": 0.0004851818084716797, "__label__history": 0.0004427433013916016, "__label__home_hobbies": 0.00015079975128173828, "__label__industrial": 0.0012416839599609375, "__label__literature": 0.0002772808074951172, "__label__politics": 0.0004045963287353515, "__label__religion": 0.0004863739013671875, "__label__science_tech": 0.2110595703125, "__label__social_life": 8.422136306762695e-05, "__label__software": 0.0175323486328125, "__label__software_dev": 0.7568359375, "__label__sports_fitness": 0.00022590160369873047, "__label__transportation": 0.000980377197265625, "__label__travel": 0.00020503997802734375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 55847, 0.03313]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 55847, 0.37788]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 55847, 0.88634]], "google_gemma-3-12b-it_contains_pii": [[0, 4235, false], [4235, 10340, null], [10340, 16377, null], [16377, 16623, null], [16623, 20390, null], [20390, 21108, null], [21108, 27086, null], [27086, 27570, null], [27570, 33215, null], [33215, 40135, null], [40135, 46438, null], [46438, 47637, null], [47637, 52710, null], [52710, 55847, null], [55847, 55847, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4235, true], [4235, 10340, null], [10340, 16377, null], [16377, 16623, null], [16623, 20390, null], [20390, 21108, null], [21108, 27086, null], [27086, 27570, null], [27570, 33215, null], [33215, 40135, null], [40135, 46438, null], [46438, 47637, null], [47637, 52710, null], [52710, 55847, null], [55847, 55847, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 55847, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 55847, null]], "pdf_page_numbers": [[0, 4235, 1], [4235, 10340, 2], [10340, 16377, 3], [16377, 16623, 4], [16623, 20390, 5], [20390, 21108, 6], [21108, 27086, 7], [27086, 27570, 8], [27570, 33215, 9], [33215, 40135, 10], [40135, 46438, 11], [46438, 47637, 12], [47637, 52710, 13], [52710, 55847, 14], [55847, 55847, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 55847, 0.02727]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
6037db5cbb763f50ca4f37a9f7dffe7451056042
|
Collaboration behavior enhancement in co-development networks
Shadi, M.
Citation for published version (APA):
General rights
It is not permitted to download or to forward/distribute the text or part of it without the consent of the author(s) and/or copyright holder(s), other than for strictly personal, individual use, unless the work is under an open content license (like Creative Commons).
Disclaimer/Complaints regulations
If you believe that digital publication of certain material infringes any of your rights or (privacy) interests, please let the Library know, stating your reasons. In case of a legitimate complaint, the Library will make the material inaccessible and/or remove it from the website. Please Ask the Library: http://uba.uva.nl/en/contact, or a letter to: Library of the University of Amsterdam, Secretariat, Singel 425, 1012 WP Amsterdam, The Netherlands. You will be contacted as soon as possible.
UvA-DARE is a service provided by the library of the University of Amsterdam (http://dare.uva.nl)
Chapter 4
Normative Virtual Organizations
Supervisory Assistant Tool - VOSAT
This chapter contains some material from the following paper:
4.1 Introduction
To increase the success rate of VOs, it is needed to design and develop a supervisory framework aiming at monitoring the partners’ behavior, and diagnosing the behavior-related risks. In an open multi-agent system that allows agents to enter and exit the system at runtime, an exogenous normative artifact can be defined to organize and control the behavior of agents [10]. This normative artifact consists of norms and sanctions in which activities of participating agents are monitored, violations of obedience to norms are specified, and finally the consequences for the observed violations/obedience are realized. The VBE is an open border environment, and thus represents an open society of agents, in which an exogenous normative organization can be defined. In Chapter 3 a normative multi-agent framework is proposed for VOs, based on which our VO supervisory artifact, called VOSAT (VO Supervisory Assistant Tool), is designed and developed. VOSAT aims to monitor and control agents’ interactions, through checking their compliance with some norms, and imposing related sanctions against the norms’ violations. It includes five components, as shown in Figure 4.1.
Chapter 4. Normative Virtual Organizations Supervisory Assistant Tool - VOSAT
Figure 4.1: VO Supervisory Assisting Tool (VOSAT)
VOSAT, Norm Monitoring Component (NMC) is responsible for monitoring and controlling the agents' behavior against their defined norms, and imposing related sanctions against the norms' violations. To monitor the trust-related norm, it is necessary to continuously measure the trust level of an agent, which is measured by the Trust Evaluating Component (TEC), and set as input to NMC. Norm Abidance Component (NAC) is responsible for measuring the committing norms obedience degree (CNOD) and socio-regulatory norms obedience degree (SNOD) for each agent, using the information related to the norms specified by NMC. If an agent's trust-related norm is violated then the Risk Predicting Component (RPC) is triggered to find the risky tasks based on the PRIT information, as well as the information related to the risk factors. These information are finally used to assist the VO coordinator to potentially intervene through reassignment of risky tasks and therefore to remove the risk condition at the VO. Moreover, Partner Selecting Component (PSC) provides a mechanism to select the suitable partner for task reassignment or reward distribution among partners. TEC is addressed in Chapter 5, RPC and PSC are further addressed in Chapter 6, while details of NMC, and NAC are discussed in this chapter.
To develop NMC aiming at monitoring the VO partners' behavior against the defined norms in Chapter 3, it is needed to formalize the norm related concepts, such as promises, joint-promises, obligations and prohibitions. The proposed formalization for joint-promises and promises are to the best of our knowledge novel. In fact, all defined norms are formalized by a set of norm manipulating rules which are triggered by external events and partners' actions. Then, some new
propositions are derived from the fired norm manipulating rules. It means that it is possible to automatically specify the states of promises, and joint-promises, violation or obedience of socio-regulatory norms and controlling norms, based on which, different reactions can be planned.
This chapter also addresses how to measure CNOD and SNOD, which are internal measures to be used as criteria in partners’ trust evaluation (addressed in Chapter 5), partner selection for task reassignment, and indirect reward distribution (both addressed in Chapter 6).
The rest of this chapter is structured as follows. The details of norm monitoring mechanism are addressed in Section 2. Section 3 discusses how we can measure the norm obedience degrees (CNOD and SNOD) for each VO partner. Section 4 addresses some conclusive remarks.
4.2 Norm Monitoring
In order to operationalize norms, a norm enforcement mechanism is required to be developed and provided. This mechanism is responsible for detecting the norms’ violation and imposing sanctions in case of violations. AMELI platform [43], the normative framework of Cardoso [26], and the norm enforcement mechanism of Fornara et al. [45] are some developments in this area. The implementations addressed in [43] and [45] are all aimed at ”procedural” norms, determining which actions should or should not be performed by agents, while the ”declarative” norms (e.g. in [26]) specify a desired state that should be fulfilled within the environment in which the agents interact. In [33], the norms expressed as counts-as rules are declarative. We also define our norms as declarative counts-as rules.
The Norm Monitoring Component (NMC) does the monitoring of the agents’ behavior through checking the state of their norms. The inputs of NMC component includes some predefined data related to the norms, such as the thresholds or agents’ trust levels (see Figure 4.1). If agents’ promises or socio-regulatory norms are violated then the Trust Evaluating Component is triggered to calculate the agent’s trust level, while if one of the controlling norms is violated then Risk Predicting Component is triggered to identify the risky tasks. To implement the NMC, it is needed to first formalize norm-related concepts, and specify the configuration of NMC, as provided in the following sections.
4.2.1 Concepts Formalization
Promise Formalization. A promise with a specific state is formalized as a proposition, e.g. \( Pr^C(x, y, p, d, q, d') \) is used to represent the specific state of the promise \( < x, y, p, d, q, d' > \), as defined in Section 3.4.1 of Chapter 3. Label \( C \) in this expression refers to the conditional state (see Table 3.1). The agents’ actions, and the external events manipulate the states of promises, and this manipulation
Chapter 4. Normative Virtual Organizations Supervisory Assistant Tool - VOSAT
should respect a specific set of rules (see Table 4.1). In other words, these rules can be used to express how agents’ actions and external events influence the state of promises. The rules have the general form of \( \rho, \phi, \alpha \Rightarrow \rho' \) where \( \rho, \phi, \alpha \) represent respectively a promise with a specific state, such as \( Pr^C(x, y, p, d, q, d') \), an environment-related fact describing the environment, such as deadline \( d \), an action, such as \( \text{Fulfill}(x, p) \), and \( \rho' \) represents the promise with a new state.
In these rules, shown in Table 4.1, the notations \( T \) and \( \text{nop} \) are used for True and for no-operation action, respectively. The agents’ actions are as follows:
- **Agree**\( (x, y, p, d, q, d') \): \( x \) agrees with \( y \) to make the proposition \( p \) true, before the deadline \( d \), if the proposition \( q \) is true before deadline \( d' \).
- **Withdraw**\( (x, y, p) \): \( x \) tells \( y \) that he withdraws his promise to make proposition \( p \) true.
- **Release**\( (x, y, p) \): \( x \) tells \( y \) that it is no longer needed to keep his promise to make proposition \( p \) true.
- **Fulfill**\( (x, p) \): \( x \) makes proposition \( p \) true.
In these rules, \( \text{Fail}(p) \) is considered as an external event showing that proposition \( p \) can no longer be made true, because of an external failure.
<table>
<thead>
<tr>
<th>Rule Name</th>
<th>Promise Manipulating Rules</th>
</tr>
</thead>
<tbody>
<tr>
<td>Making conditional promise</td>
<td>( T, T, \text{Agree}(x, y, p, d, q, d') \Rightarrow Pr^C(x, y, p, d, q, d') )</td>
</tr>
<tr>
<td>Keeping</td>
<td>( Pr^UC(x, y, p, d, q, d'), \neg d', \text{Fulfill}(x, p) \Rightarrow Pr^K(x, y, p, d, q, d') )</td>
</tr>
<tr>
<td>Withdraw</td>
<td>( Pr^UC(x, y, p, d, q, d'), \neg d, \text{Withdraw}(x, y, p) \Rightarrow Pr^W(x, y, p, d, q, d') )</td>
</tr>
<tr>
<td>Not Keeping</td>
<td>( Pr^UC(x, y, p, d, q, d'), \neg p, \text{nop} \Rightarrow Pr^NK(x, y, p, d, q, d') )</td>
</tr>
<tr>
<td>Dissolving</td>
<td>( Pr^C(x, y, p, d, q, d'), \neg q, \text{nop} \Rightarrow Pr^{Dis}(x, y, p, d, q, d') )</td>
</tr>
<tr>
<td>Releasing</td>
<td>( Pr^UC(x, y, p, d, q, d'), T, \text{Release}(x, y, p) \Rightarrow Pr^R(x, y, p, d, q, d') )</td>
</tr>
<tr>
<td>Invalidating</td>
<td>( Pr^UC(x, y, p, d, q, d'), \text{Fail}(p), \text{nop} \Rightarrow Pr^{In}(x, y, p, d, q, d') )</td>
</tr>
</tbody>
</table>
Table 4.1: Rules manipulating the promise states
The explanations below describe the above rules:
- Making conditional promise rule: performing the action \( \text{Agree}(x, y, p, d, q, d') \) implies the creation of a conditional promise. When this rule is applied, \( Pr^C(x, y, p, d, q, d') \) is created.
• Freeing preconditions rule: performing the action $\text{Fulfill}(z, q)$ before passing time $d'$ implies the creation of an unconditional promise. When this rule is applied, the conditional promise transforms to an unconditional promise.
• Keeping rule: performing the action $\text{Fulfill}(x, p)$ before passing $d$ implies the creation of a kept promise. When this rule is applied, the unconditional promise transforms to a kept promise.
• Withdrawing rule: performing the action $\text{Withdraw}(x, y, p)$ before passing $d$ implies the creation of a withdrawn promise. By applying this rule, the conditional/unconditional promise transforms to a withdrawn promise.
• Not keeping rule: not realizing $p$ by the deadline $d$, implies the creation of a not kept promise. When this rule is applied an unconditional promise transforms to a not kept promise.
• Dissolving rule: not realizing $q$ by passing $d'$ implies the creation of a dissolved promise. When this rule is applied, the conditional promise transforms to a dissolved promise.
• Releasing rule: when $x$ tells $y$ it is no longer needed to fulfill his promise to realize $p$, it implies the creation of a released promise. When this rule is applied, the conditional/unconditional promise transforms to a released promise.
• Invalidating rule: when $p$ cannot be realized because of an external failure, it implies the invalidation of an unconditional promise. When this rule is applied, the unconditional promise transforms to an invalidated promise.
**Joint-promise Formalization.** In Section 3.4.1 of Chapter 3 we defined a joint-promise as a tuple $<G, y, p, d, q, d'>$, where $G$ is a set of agents. It means that each member of $G$ make a promise for $y$ to bring about $p$ before $d$ and also each member of $G$ makes a promise to other members to perform its part of the joint-action bringing about $p$. In VOSAT, it is formalized as follows:
$$ Joint - Pr^C(G, y, p, d, q, d') \equiv $$
$$ \bigwedge_{A_i \in G, (A_i, p_i, d_i) \in PL} \left( Pr^C(A_i, y, p, d, q, d') \land \left( \bigwedge_{A_j \in G - \{A_i\}} Pr^C(A_i, A_j, p_i, d_i, q, d') \right) \right) $$
(4.1)
where,
• $G$ is the promiser group
• $y$ is the promisee agent in the joint-promise
• \( p \) is a proposition which a group of promisers \( G \) should bring about before deadline \( d \).
• \( q \) is the condition for realizing \( p \) by group \( G \) that should be fulfilled before \( d' \).
• \( PL \) is the plan negotiated for distributing tasks among agents, during the VO operation phase. This plan includes a number of pairs such as \((A_i, p_i, d_i)\) in which \( A_i \) is an agent who should bring about \( p_i \) before deadline \( d_i \), as a part of the joint-action leading to realize \( p \) before \( d \).
• \( \bigwedge_{i=1}^{n} p_i \Rightarrow p, d_i \leq d \) and \( n \) is the number of agents in \( G \).
This formalization means that each member of \( G \) makes a conditional promise for \( y \) to bring about \( p \) before \( d \) and also each member of \( G \) makes a conditional promise to other members to perform its part of the joint-action bringing about \( p \).
**Obligation Formalization.** In VOSAT, obligations are formalized by two simple rules, because they have only two states, i.e. violation and obedience:
1. Obligation Obeying Rule: \( Obliged(x, p, d), Fulfill(x, p), \neg d \Rightarrow Obeyed(x, p) \)
2. Obligation Violating Rule: \( Obliged(x, p, d), \neg p, d \Rightarrow Violated(x, p) \)
These formalizations are not shown in a specific logic. The proposition \( p \) can be crisp or fuzzy, for example when an obligation is defined for the agent’s trustworthiness, \( p \) is a fuzzy proposition (e.g. agent’s trust level should be more than Low Trust).
**Prohibition Formalization.** It should be noticed that for prohibitions, two rules similar to obligation rules are considered, as follows:
1. Prohibition Obeying Rule: \( Prohibited(x, p, d), \neg p, d \Rightarrow Obeyed(x, p) \)
2. Prohibition Violating Rule: \( Prohibited(x, p, d), Fulfill(x, p), \neg d \Rightarrow Violated(x, p) \)
**4.2.2 The Configuration of Norm Monitoring Component**
Operational semantics is the means of defining the semantics of the Norm Monitoring Component. It is defined in terms of the configurations of the norm monitoring component and the transition between them. The configuration or state of norm monitoring component is specified based on:
1. a set of propositions denoting environment-related facts
2. a set of Norm Manipulating Rules (NMRs)
4.2. Norm Monitoring
3. a set of norms
4. a set of Reaction Rules (RRs)
Environment-related facts describe the environment in which agents interact. NMRs represent the rules introduced in Section 4.2.1 for formalization of promises, obligations and prohibitions. Socio-regulatory and controlling norms have two states, i.e. violated and obeyed, while promises have more than two states, as shown in Table 3.1. Plans that the VO coordinator wants to execute in case of the violation or obedience of norms correspond to the RRs.
**Definition 5.** Configuration of Norm Monitoring Component is defined by the tuple \(<\delta_e, \delta_n, R_{nm}, R_r>\), where \(\delta_e\) is a consistent set of propositions denoting the environment-related facts, \(\delta_n\) is a consistent set of norms, \(R_{nm}\) is a set of norm manipulating rules, and \(R_r\) is a set of reaction rules.
In operational semantics, the transition rules, determine the transitions allowed between configurations. The state of our system can make a transition either when the actions (mentioned in Section 4.2.1) are performed by the agents, or when some external events have occurred.
Algorithm 1 shows that how the state of NMC makes a transition when an action is performed or an event is occurred. In this algorithm, \(p\) is a proposition representing an external event or the effect of an agent’s action. In Algorithm 1, the set of norms and propositions denoting the environment-related facts is called \(KB\). The proposition \(p\) is added to \(KB\). In outer if statement in Algorithm 1, it is checked whether NM-rule \(r_1\) is applicable based on the updated \(KB\). The applicability of \(r_1\) means that the condition of \(r_1\) is satisfied in \(KB\). If \(r_1\) is applicable, its consequent, i.e. \(q_1\), is derived, which shows a violated or obedient norm, or a promise in a certain state, and it is added to \(KB\). For example, if the precondition of a promise is not fulfilled before its specified deadlines, then the dissolving rule shown in Table 4.1 is applicable, whose consequent \((q_1)\) is a dissolved promise. Furthermore, the inner if statement in Algorithm 1, is related to applicability of the trust-related norms. It means that the trust-related norm has a different level in contrast to other norms, because it is triggered by the violation of the socio-regulatory norms or promises. In a normative environment like a VO, norms can have different levels; norms at level zero are triggered by external events, whereas norms at other levels are triggered in case of a violation of some norm(s) defined at lower levels [94]. If \(q_1\) is a violated promise (not kept or withdrawn) or a violated socio-regulatory norm, and also the condition of NM-rule \(r_2\) specifying the trust-related norm, is satisfied in \(KB\), then \(r_2\)’s consequent, i.e. \(q_2\), is derived. It should be noticed that \(q_2\) shows the violation or obedience of the trust-related norm, and added to \(KB\). Finally, some Reaction Rules may be applicable, which means that their conditions are satisfied in updated \(KB\). The consequent of the applicable R-rule \(r_3\), shows the plan that is considered for different states of promises, or for violation, or obedience of other norms.
For example, if trust-related norms, communication-related norms or workload-related norms are violated then it is necessary to find the weak points in VO’s activities fulfillment. The reaction rule, in this case a risk prediction rule gets triggered, which results in invoking the risk prediction function and sending an alarming message to the VO coordinator.
**Algorithm 1:** Norm Monitoring Algorithm
**Input:**
- $KB$, a set of propositions denoting norms & environment-related facts
- NM-rules, a set of Norm Manipulating rules
- R-rules, a set of Reaction rules
- $p$, a proposition denoting an environment-related fact
Add $p$ to $KB$
if the condition of the NM-rule $r_1$, is satisfied in $KB$ then
$q_1 := \text{Consequent}(r_1)$
Add $q_1$ to $KB$
if $q_1$ is a violated promise or a violated socio-regulatory norm and the condition of the NM-rule $r_2$, is satisfied in $KB$ then
$q_2 := \text{Consequent}(r_2)$
Add $q_2$ to $KB$
end
foreach $r_3$ as a member of R-rules, whose condition is satisfied in $KB$
do
$b := \text{Consequent}(r_3)$
Add $b$ to $KB$
don
end
We use Organization Oriented Programming Language (2OPL) [1] to implement our Norm Monitoring Component. The use of 2OPL is justified when there is an environment within which agents interact to achieve some common goals, and where they need to be organized for it. This language is introduced to specify norms, violations and sanctions within a multi-agent system. The 2OPL has been implemented as a JAVA software project within which a Prolog is used to implement the inference engine to keep and reason about the brute facts and institutional facts. In 2OPL, brute facts describe the states of the environment in which agents perform their actions and institutional facts describe the violation state of norms. The artifact defined by 2OPL is responsible to monitor the violation of norms and impose the related sanctions. All fundamental concepts of the 2OPL including brute facts, effect rules, counts-as rules and sanction rules should be written in a .2opl file, which is then interpreted by the 2OPL [1]. Definitions of the main 2OPL concepts are as follows:
4.2. Norm Monitoring
- Brute facts are represented as Prolog facts and are initialized before the execution of 2OPL organization.
- Counts-as rule are represented by $\rho \Rightarrow \phi$ in which $\rho$ is brute fact and $\phi$ is an institutional fact. This rule should be read as "$\rho$ counts as $\phi$". It should be mentioned that in 2OPL, institutional facts are not manually programmed, because they are obtained by applying Counts-as rules.
- Sanction rules relate institutional facts to brute facts expressed by rules like $\phi \Rightarrow \rho$ where $\phi$ consists of institutional facts and brute facts and $\rho$ is a brute fact.
- Effect rules consist of pre-condition, action name, and post-condition parts. When an action is performed, the post-conditions of its related effect rule is realized which in turn changes the brute facts base.
The base for 2OPL is sufficiently similar to what we need to implement our supervisory artifact, and specifically the NMC of the VO Supervisory Assisting Tool (VOSAT). Although there are a number of differences in features of a 2OPL organization and our setting, this language can be easily extended in order to properly implement the norm monitoring component. We have implemented our environment-related facts, $\delta_e$, as Brute Facts in 2OPL. For example, $\text{curTime}(0)$ is a brute fact which sets the current time before starting of the VO operation phase. The actions (Fulfill, Withdraw, etc.) are programmed as Effect Rules with pre- and post-conditions. For example, the effect rule below specifies that the action $\text{fulfill}(X,P)$ can be performed if $P$ is not yet realized, and then the fact $P$ will be realized after the performance of the action.
\[
\{\text{not realized}(P)\} \\
\text{fulfill}(X,P) \\
\{\text{realized}(P)\}
\]
Our norm manipulating rules, $R_{nm}$, are implemented as Counts-as rules. For example, Figure 4.2 illustrates the implementation of the promise manipulating rules, as shown in Table 4.1. The first rule shown in Table 4.1 in which there is only one action, is implemented by an effect rule, while other rules are implemented as counts-as rules. It should be noticed that for each promise, at most one of the mentioned states in Table 3.1 is true at any point in time. The norm manipulating rules determine which state should remain true forever and which state should be removed. The termination states, i.e. kept, not kept, withdrawn, invalidated, released and dissolved will in principle remain true in the VOSAT framework, once they are true. Not kept and withdrawn states are considered as violation states. The VO coordinator may however decide to remove them once the sanctions (e.g. charging some damage costs to an agent or adding the agent to some blacklists) are applied.
Chapter 4. Normative Virtual Organizations Supervisory Assistant Tool - VOSAT
Figure 4.2: Implementation of Manipulating Promise Rules in 2OPL
Ultimately, we implement our reaction rules, $R_r$, as sanction rules in 2OPL. For example, the sanction rule below adds the promiser of a not kept promise $X$, to a specific black list:
$\text{viol(\textit{nkept}, X, Y), blakList1(V), add (X, V, V2)} \Rightarrow \text{not viol (nkept, X, Y), not blakList1(V), blakList1 (V2)}.$
This list can be used for some future decisions about agents, such as the selection of suitable VO partners for creation of a new VO. Imposing related sanctions against the norms’ violations is very important in Virtual Organizations. For instance, if a promiser notifies the VO coordinator, before reaching the deadline, that it cannot fulfill its promise on time, that agent should then be punished less than if it were in the situation in which the deadline has passed and the promise is not fulfilled. But clearly, the sanction policies are usually not the same in different VOs. Typically, two kinds of sanctions are applied to incentivize the norm compliance by agents and to discourage deviation from norms: one affects agents resources (e.g. financial punishment), and the other one affects agents reputation (e.g. black listing). Sanction rules are either mentioned in the consortium agreement or specified by the VO coordinator.
4.2.3 An Example Case
To provide more details on how NMC works for promise monitoring in virtual organizations, consider a VO established to produce canned tomato paste. Jobs
4.2. Norm Monitoring
to be performed in this VO are divided into a set of tasks. Let us consider one such task in this VO responsible for producing and sending 72500 tons of chopped tomato to the main factory, that in turn can produce 50000 tons of canned tomato paste.
Further assume that, in this task, three tomato producer companies ($Tp_1$, $Tp_2$, $Tp_3$) and two delivery enterprises ($De_1$, $De_2$) are involved, which jointly prepare and deliver 72500 tons of chopped tomato to the main factory to be processed into canned tomato. After negotiations, a number of sub-tasks are determined, as addressed below. It should be noticed that to simplify the model we assume that the results of the negotiation between the partners and the task leader constitutes a set of non-conflicting sub-tasks. The Task Leader requires agreements from the involved companies. The following agreements are thus made:
• Agreement 1: $Tp_1$ agrees with the Task Leader that: it fulfils $q_1$ (25000 Tn chopped tomato is ready) before January 10.
• Agreement 2: $De_1$ agrees with the Task Leader that: if $q_1$ is fulfilled before January 10 then it fulfils $q_2$ (25000 Tn chopped tomato is delivered to the main factory) within 2 days.
• Agreement 3: $Tp_2$ agrees with the Task Leader that: it fulfils $q_3$ (21000 Tn chopped tomato is ready) before January 20.
• Agreement 4: $De_2$ agrees with the Task Leader that: if $q_3$ is fulfilled before January 20 then it fulfils $q_4$ (21000 Tn chopped tomato is delivered to the main factory) within 1 day.
• Agreement 5: $Tp_3$ agrees with the Task Leader that: it fulfils $q_5$ (26500 Tn chopped tomato is ready) before January 21.
• Agreement 6: $De_1$ agrees with the Task Leader that: if $q_5$ is fulfilled before January 21 then it fulfils $q_6$ (26500 Tn chopped tomato is delivered to the main factory) within 1 day.
The formalization of the above mentioned actions in our VO supervisory approach are shown below.
• Act 1: agree($Tp_1$, TaskLeader, $q_1$, 10, $T$, 0).
• Act 2: agree ($De_1$, TaskLeader, $q_2$, 12, $q_1$, 10).
• Act 3: agree ($Tp_2$, TaskLeader, $q_3$, 20, $T$, 0).
• Act 4: agree ($De_2$, TaskLeader, $q_4$, 21, $q_3$, 20).
• Act 5: agree ($Tp_3$, TaskLeader, $q_5$, 21, $T$, 0).
Chapter 4. Normative Virtual Organizations Supervisory Assistant Tool - VOSAT
- Act 6: agree \((De_1, TaskLeader, q_6, 22, q_5, 21)\).
Please note that we use 0 to show the absence of a deadline and T as true when there is no condition for a promise. Also assume that all the above agreement actions are performed on the first day of January, i.e. \(newTime(1)\) is January 1, and \(newTime(n)\) represents date January \(n\). Based on the effect rule implemented in our .2opl file for VOSAT, each action "agree" leads to creation of a promise. For example, performing an action Act2: \(agree(De_1, TaskLeader, q_2, 12, q_1, 10)\) results in \(prCon(De_1, TaskLeader, q_2, 12, q_1, 10)\), which is shown as \(Pr^C_2\) in Table 4.2.
The trace in Table 4.2 begins with the six actions mentioned above. According to the first and second rules shown in Table 4.1, three conditional and three unconditional promises are derived, as shown in the third column of Table 4.2. The promiser of an unconditional promise does not need to wait for fulfillment of any other promise. However, after fulfilling a promise or generally realizing a fact, a related conditional promise is converted to unconditional which will be further monitored. Consider that in this scenario, on January 5, when \(Tp_1\) informs the TaskLeader that it is impossible to prepare 25000 \(Tn\) till January 10 (because of an external failure which is out of the promiser’s control), and it can just prepare 15000 chopped tomato \((q_7)\) instead at that time. Consequently, its first promise to prepare 25000 \(Tn\) tomato gets invalidated (last rule in Table 4.1). To assist with handling of this case, \(Tp_3\) agrees with the TaskLeader to prepare 10000 \(Tn\) (labeled as \(q_8\)) till January 20, while \(De_1\) also promises to deliver these two amount of chopped tomato prepared by \(Tp_1\) and \(Tp_3\) to the main factory \((q_9, \text{and } q_{10}, \text{respectively})\). Now we have new agreements:
- Act 7: \(agree(Tp_1, TaskLeader, q_7, 10, T, 0)\).
- Act 8: \(agree(Tp_3, TaskLeader, q_8, 20, T, 0)\).
- Act 9: \(agree(De_1, TaskLeader, q_9, 12, q_7, 10)\).
- Act 10: \(agree(De_1, TaskLeader, q_{10}, 22, q_8, 20)\).
Furthermore, consider if in this scenario \(De_1\) does not deliver 10000 \(Tn\) prepared by \(Tp_3\) on January 22. Therefore, \(newTime(22)\) triggers the fifth rule in Table 4.1 resulting in \(pr^{NK}(De_1, TaskLeader, q_{10}, 22, q_8, 20)\), which is a violation state, triggering the sanction rule. In this current scenario, everything except the two above mentioned situations goes well, i.e. all other promises except for \(Pr1, Pr2\) and \(Pr10\) are kept, as indicated in Table 4.2. The task therefore gets successfully completed on January 22.
4.3 Norm Abidance
As Figure 4.1 illustrates, the Norm Abidance Component receives the promises’ states, and the violation or obedience of socio-regulatory norms from NMC as inputs, and then measures two degrees: Committing Norm Obedience Degree (CNOD), and Socio-regulatory Norm Obedience Degree (SNOD), which are explained in the following sections.
The obedience degrees, (CNOD and SNOD) are used to determine the agent’s trust level, task reassignment, and reward distribution. As mentioned before, joint-promises are decomposed into several individual promises, so the violation and obedience of co-working norms are considered in evaluation of the committing norms. There is also no obedience degree for controlling norms, because the violation of these norms are directly considered in risk prediction, while the violation and obedience of socio-regulatory norms, co-working norms and committing norms are needed for evaluation of trust.
### 4.3.1 CNOD - Committing Norm Obedience Degree
CNOD indicates how much the behavior of each agent is compliant with its committing norms (promises). In a VO, typically, based on the type of promised sub-task, some Quality Specification Criterion (QSC) are defined at the time of agreement between promiser and the VO coordinator or task leaders. For example, if a partner is the farmer who delivers tomato in the tomato paste production-example, then for instance the tomato’s quality grades (e.g. \( G_1 \), \( G_2 \) or \( G_3 \)) or color (e.g. red, orange, or green) are the QSCs for its delivered product, which is usually agreed between this partner and the promisee, e.g. the VO coordinator. Therefore, QSCs should also be evaluated when measuring the CNOD.
The design of our approach to evaluate QSCs for an agent is partially rooted in [88]. In our approach two rating factors for QSC are defined as follows:
1. **Fulfillment of QSC (FQ)** shows the degree of fulfillment of each QSC. The maximum value of FQ for a QSC is the value stated in the contract, which is mutually agreed between each agent and the task leader or the VO coordinator.
2. **Influence of QSC (IQ)** is defined in [0,1] by the task leader or the VO coordinator, to determine the importance and influence of each QSC in quality evaluation of results produced by the agent.
We use these two factors to calculate the quality of the results produced by the agent after performing its sub-task against the ideal quality, which are mutually agreed in the contract. In other words, this is defined as a measure of how good the agent delivers his agreed promise with the task leader or the VO coordinator.
At first, we define function $C$, $C : S \rightarrow P(V)$, where $S$ is the set of all sub-tasks defined in a VO, the set of all quality specification criteria defined for results of sub-tasks in a VO, is denoted by $V$, and $P(V)$ is the power set of $V$. The quality of delivered sub-task $st$, if at least one criterion is specified for it (i.e. $|C(st)| > 0$), is calculated as follows:
$$ Quality(st) = \sum_{i=1}^{|C(st)|} FQ(c_i, st) * IQ(c_i, st) $$ \hfill (4.2)
where, $st$ shows a sub-task, $FQ : V \times S \rightarrow [0,1]$ and $IQ : V \times S \rightarrow [0,1]$, $V$ is the set of all quality specification criteria, $|C(st)|$ is the number of quality criteria for the sub-task $st$, and $c_i$ shows the $i^{th}$ criterion of the $C(st)$.
The $Max\_Quality$ value for a sub-task shows the maximum possible quality occurrence to perform the sub-task. It is calculated as follows:
$$ Max\_Quality(st) = \sum_{i=1}^{|C(st)|} \max(FQ(c_i, st)) * IQ(c_i, st) = \sum_{i=1}^{|C(st)|} IQ(c_i, st) $$ \hfill (4.3)
where, $\max(FQ(c_i, st))$ indicates the ideal and maximum value of the fulfillment of the $c_i$, which is here equal to 1, because in our approach, FQ values are normalized into $[0,1]$.
The relative quality between what the agent actually delivered and maximum possible quality value (expected value) is calculated as follows:
$$ Relative\_Quality(st) = \frac{Quality(st)}{Max\_Quality(st)} $$ \hfill (4.4)
4.3. Norm Abidance
It should be noticed that relative quality for each sub-task is measured after it is performed, i.e. when the state of the promise made to perform the sub-task is kept. It means that relative quality is ignored for promises, which are not kept, invalidated and withdrawn.
Since different criteria have different FQ values, we normalize all received values into [0,1]. Assume that the promisee (service client) for which the sub-task is performed, sends a fulfilment value for a criterion, called $x$, in [a,b], then the formulas below show how it is normalized into an interval [0,1], and named $x'$.
For those criteria that have positive connotations (e.g. the Availability, Throughput, and Reliability for a developed software service), their values will be scaled as follows [28]:
$$x' = \begin{cases} \frac{x-a}{b-a} & \text{if } a \neq b \\ 1 & \text{otherwise} \end{cases}$$
(4.5)
For criteria with negative connotation (e.g. the Response time for a software service) the formula below is used [28]:
$$x' = \begin{cases} \frac{b-x}{b-a} & \text{if } a \neq b \\ 1 & \text{otherwise} \end{cases}$$
(4.6)
Promise Evaluation Considering the Quality Specification Criteria
To measure the committing norms obedience degree (CNOD), three measures are considered and explained in the following paragraphs.
Promise Fulfillment (PF). The evaluation of a promise in its termination state (i.e. kept, not kept, withdrawn, invalidated, released or dissolved) can be different based on the VO in which the promise is made. An example of values assigned by the VO coordinator to different states of a promise is shown in Table 4.3. These values show the fulfillment degree of an agent’s promise. In fact, the promise fulfillment values are determined for a promiser who made a promise to perform a sub-task. The value should be positive, or negative, e.g. promise fulfillment degrees in Table 4.3 are defined in {-2,-1,-0.3,2}. Withdrawn and Not Kept states of a promise have negative effects on the performance evaluation of promiser, so their values are also negative, while kept promise has positive effect on the performance evaluation of the promiser. Invalidated promise can negatively influence the promiser performance, however the reason is out of the control of the promiser, so we consider a very little negative value for it (e.g. -0.3 as shown in Table 4.3). Realised promise shows that promisee cancels the promise, so it is not negative or positive for promiser’s performance. Moreover, when preconditions of a promise are not fulfilled, the state of a promise is dissolved, which is not
negative or positive for the promiser. Therefore, released and dissolved promises are not considered in CNOD measurement.
<table>
<thead>
<tr>
<th>Promise State</th>
<th>Promise Fulfillment Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Not Kept</td>
<td>-2</td>
</tr>
<tr>
<td>Withdrawn</td>
<td>-1</td>
</tr>
<tr>
<td>Invalidated</td>
<td>-0.3</td>
</tr>
<tr>
<td>Kept</td>
<td>2</td>
</tr>
</tbody>
</table>
Table 4.3: An example of Promise Fulfillment (PF) values
**Promise Importance (PI).** Next to the Promise Fulfillment (PF) value addressed above, it is also needed to consider Promise Importance (PI) in the measuring of CNOD, because some promises are related to the sub-tasks that have more important roles in the collaboration success of the VO. The values of PIs are considered in [0,1].
**Q-Factor (QF).** To show the role of Relative-Quality in evaluation of CNOD, we define the Q-Factor (QF) for promise $p_j$ made for performing sub-task $s_{tp_j}$, as follows:
$$QF(p_j) = \begin{cases}
\text{Relative\_Quality}(s_{tp_j}) & \text{if } s_{tp_j} \text{ is performed} \\
1 & \text{otherwise}
\end{cases} \quad (4.7)$$
where, $s_{tp_j}$ shows the sub-task for performing which promise $p_j$ is made. The value of $QF(p_j)$ is in [0,1], because the value of $\text{Relative\_Quality}(s_{tp_j})$ is [0,1]. If the $s_{tp_j}$ is performed then its related $PF(p_j)$ in Formula 4.8 has the maximum value (i.e. 2, considering Table 4.3). Moreover, if all quality criteria agreed for this sub-task, are ideally fulfilled, $\text{Relative\_Quality}(s_{tp_j})$ is 1, and consequently $QF(p_j)$ is 1. When promise $p_j$ is withdrawn, not kept or invalidated, its $PF(p_j)$ is negative. In this situation, $QF(p_j)$ is 1, because 1 is the identity element under multiplication, which shows that $\text{Relative\_Quality}$ is ignored for withdrawn, not kept and invalidated states.
We define the function $f_1$, $f_1 : \delta_A \rightarrow P(\delta_p)$, where $\delta_A$ is the set of agents involved in a VO, $\delta_p$ is the set of promises made so far in the VO, and $P(\delta_p)$ is the power set of $\delta_p$. Similar to the formula for $\text{Relative\_Quality}$, the CNOD for agent A is calculated as follows:
$$CNOD(A) = \frac{\sum_{j=1}^{[f_1(A)]} PF(p_j) \times PI(p_j) \times QF(p_j)}{\sum_{j=1}^{[f_1(A)]} \max(PF(p_j)) \times PI(p_j)} \quad (4.8)$$
where, $[f_1(A)]$ shows the number of promises that agent A has made so far in the VO (for each sub-task only one promise is made), $PI : \delta_p \rightarrow [0,1]$, $QF : \delta_p \rightarrow [0,1]$ and $\max(PF(p_j))$ indicates the ideal and maximum value of the fulfillment.
of the promise \( p_j \). It should be noticed that considering the example values for promise fulfilment in Table 4.3, \( PF : \delta_p \to \{-2, -1, -0.3, 2\} \).
This formula returns a value for each agent, which shows the ratio of agent’s success in fulfilling its promises and their QSCs in relation to the ideal state.
Below, it is shown that CNOD is a value in \([-1, 1]\). Since \( PI(p_j) \) and \( QF(p_j) \) are values in \([0, 1]\), and \( PF \) is defined in \([-2, -1, -0.3, 2]\), we have:
\[
|PF(p_j) \times PI(p_j) \times QF(p_j)| \leq \text{max}(PF(p_j)) \times PI(p_j), \; \forall j = 1 \ldots |f_1(A)|
\]
and then:
\[
\sum_{j=1}^{[f_1(A)]} |PF(p_j) \times PI(p_j) \times QF(p_j)| \leq \sum_{j=1}^{[f_1(A)]} \text{max}(PF(p_j)) \times PI(p_j)
\]
Based on the rule (\(|a + b| \leq |a| + |b|\)), we have:
\[
|\sum_{j=1}^{[f_1(A)]} PF(p_j) \times PI(p_j) \times QF(p_j)| \leq \sum_{j=1}^{[f_1(A)]} |PF(p_j) \times PI(p_j) \times QF(p_j)|
\]
and consequently,
\[
|\sum_{j=1}^{[f_1(A)]} PF(p_j) \times PI(p_j) \times QF(p_j)| \leq \sum_{j=1}^{[f_1(A)]} \text{max}(PF(p_j)) \times PI(p_j)
\]
It is also clear that:
\[
\frac{|\sum_{j=1}^{[f_1(A)]} PF(p_j) \times PI(p_j) \times QF(p_j)|}{\sum_{j=1}^{[f_1(A)]} \text{max}(PF(p_j)) \times PI(p_j)} \leq 1
\]
This means that \( |CNOD| \leq 1 \) (see Formula 4.8).
If PI for all promises of an agent \( A \) is 1, PF is defined in \([-2, -1, -0.3, 2]\), and all its promises are not kept then \( CNOD(A) = \frac{\sum_{j=1}^{[f_1(A)]}(-2)^{1+1}}{\sum_{j=1}^{[f_1(A)]} 2^{1+1}} = -1 \), if all its promises and their related QSCs are kept, \( CNOD(A) = 1 \) and if half of its promises and their related QSCs are kept and half of its promises are not kept, \( CNOD(A) = 0 \). According to the definition of joint-promise (see Formula 4.1), the creation of a joint-promise generates several individual promises. These individual promises will be counted in the CNOD measurement. It should be noticed that the promises of an agent for performing a specific sub-task are counted only once. CNOD is an internal measure, which is invisible for stakeholders, and only used as a criterion for trust evaluation and other future decisions.
Example
Considering the case of partners in an R&D project introduced earlier in the thesis, assume that agent $A$ agrees to perform the following two sub-tasks for agent $C$ that represents a task leader or the VO coordinator:
- $st_1$: providing a manual report document within 3 weeks from now.
- $st_2$: developing a software service within 6 weeks from now.
Consequently, two promises are made by agent $A$ to agent $C$ as follows:
1. $Pr_1$: $Pr_{UC}(A, C, st_1, 3\text{weeks}, T, 0)$.
2. $Pr_2$: $Pr_{UC}(A, C, st_2, 6\text{weeks}, T, 0)$.
For the report document, assume that, based on their agreement, the content of the manual document should be fully compliant with agreed TOC (Table Of Content) with the attachment of 25 screen shots, i.e. $C(st_1) = \{\text{content, attachment}\}$. For the software service, assume that it is agreed that response time of the service should not be greater than one minute, availability of the service should be 24h, and reliability should be greater than 90%, $C(st_2) = \{\text{ResponseTime, Availability, Reliability}\}$. Obviously, QSCs for these sub-tasks would be relevant and measured if they are performed, as explained before. Assume also that, the first promise is kept, with 70% compliant with agreed TOC, and accompanied with 12 screen shots, while the second promise is invalidated, since the development of software could not go on due to reasons beyond the control of the agent. Therefore, two QSCs for the first promise, i.e. content, and attachment need to be measured. For example, if the content is 70% compliant with agreed TOC, then $FQ(content, st_1)$ is $0.7 - 0.1 = 0.6$ and if 12 screen shots are delivered then the normalized $FQ(attachment, st_1)$ is $\frac{12}{25} - 0 = \frac{12}{25}$ (considering the Formula [4.5]). Furthermore, if the IQ of the content is 0.9, and the IQ of the attachment is 0.5, then we can compute the quality of delivered sub-task, $st_1$, as follows:
$$\text{Quality}(st_1) = FQ(content, st_1) \ast IQ(content, st_1) + FQ(attachment, st_1) \ast IQ(attachment, st_1) = 0.87$$
$\max(FQ(content, st_1))$ is 1, because the ideal result for content is 100% compliant with agreed TOC. The ideal result for attachment is 25 screen shots, so $\max(FQ(attachment, st_1))$ is $\frac{25}{25} = 1$; therefore, we have: $\max(\text{Quality}(st_1)) = 1.4$ and finally $\text{Relative\_Quality}(st_1) = 0.621$. Assuming that the Promise Importance (PI) of the first promise (which is fulfilled) is 1 and the PI of the second promise (which is invalidated) is 0.5, we then have $CNOD(A) = 0.247$, considering the Formula [4.8] and Table 4.3.
4.3.2 SNOD - Socio-regulatory Norm Obedience Degree
Socio-regulatory Norm Obedience Degree shows to which extent an agent has complied with the socio-regulatory norms, as specified in the consortium agreement. We define function $f_2$, $f_2 : \delta_A \rightarrow P(\delta_s)$, where $\delta_A$ is the set of agents involved in a VO, $\delta_s$ is the set of all socio-regulatory norms defined for agents in the VO, and $P(\delta_s)$ is the power set of $\delta_s$. SNOD is calculated as follows:
$$SNOD(A) = \sum_{i=1}^{\left|f_2(A)\right|} \frac{NF(n_i)}{\left|f_2(A)\right|}$$
where, $NF(n_i)$ shows the Norm Fulfilment (NF) degree of socio-regulatory norm $n_i$ ( $NF : \delta_s \rightarrow \{-1, 1\}$). $NF(n_i)$ is 1 if norm $n_i$ is kept (obeyed), while $NF(n_i)$ is -1 if $n_i$ is violated. It is clear that SNOD is a value in [-1,1]. These norms have two states, i.e. violated and obeyed (kept), so in this formula only the number of violated norms and obeyed norms are taken into account.
4.4 Conclusion
This chapter addresses the VO Supervisory Assisting Tool (VOSAT). It includes norm monitoring component, norm abidance component, trust evaluating component, risk predicting component and partner selecting component. The first two component are discussed in this chapter. Norm Monitoring Component is responsible for monitoring and controlling the agents’ behavior against their defined norms, and imposing related sanctions against the norms’ violations. This component is implemented using Organization Oriented Programming Language (2OPL). Norm abidance component is responsible for measuring the committing norms obedience degrees (CNOD) and socio-regulatory norms obedience degrees (SNOD) for each agent based on the information calculated in norm monitoring component. CNOD and SNOD are used to evaluate trust level of VO partners during the VO operation phase, to select best-fit partner for reassignment of risky tasks, and reward distribution, which are discussed in Chapters 5 and 6.
|
{"Source-Url": "https://pure.uva.nl/ws/files/9847324/04.pdf", "len_cl100k_base": 12010, "olmocr-version": "0.1.53", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 59320, "total-output-tokens": 13252, "length": "2e13", "weborganizer": {"__label__adult": 0.0002765655517578125, "__label__art_design": 0.00045943260192871094, "__label__crime_law": 0.0005230903625488281, "__label__education_jobs": 0.004199981689453125, "__label__entertainment": 0.00010204315185546876, "__label__fashion_beauty": 0.00015795230865478516, "__label__finance_business": 0.0025119781494140625, "__label__food_dining": 0.0003495216369628906, "__label__games": 0.0006961822509765625, "__label__hardware": 0.0008440017700195312, "__label__health": 0.0004093647003173828, "__label__history": 0.00031828880310058594, "__label__home_hobbies": 0.00017452239990234375, "__label__industrial": 0.0006885528564453125, "__label__literature": 0.00034928321838378906, "__label__politics": 0.00033402442932128906, "__label__religion": 0.00036072731018066406, "__label__science_tech": 0.08380126953125, "__label__social_life": 0.0002391338348388672, "__label__software": 0.038818359375, "__label__software_dev": 0.86328125, "__label__sports_fitness": 0.00024890899658203125, "__label__transportation": 0.00047707557678222656, "__label__travel": 0.00025200843811035156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46106, 0.02911]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46106, 0.76876]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46106, 0.88794]], "google_gemma-3-12b-it_contains_pii": [[0, 1106, false], [1106, 2874, null], [2874, 4781, null], [4781, 7581, null], [7581, 10473, null], [10473, 12718, null], [12718, 15050, null], [15050, 18326, null], [18326, 20485, null], [20485, 23290, null], [23290, 24883, null], [24883, 27141, null], [27141, 29896, null], [29896, 31612, null], [31612, 33970, null], [33970, 36595, null], [36595, 39262, null], [39262, 41461, null], [41461, 44094, null], [44094, 46106, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1106, true], [1106, 2874, null], [2874, 4781, null], [4781, 7581, null], [7581, 10473, null], [10473, 12718, null], [12718, 15050, null], [15050, 18326, null], [18326, 20485, null], [20485, 23290, null], [23290, 24883, null], [24883, 27141, null], [27141, 29896, null], [29896, 31612, null], [31612, 33970, null], [33970, 36595, null], [36595, 39262, null], [39262, 41461, null], [41461, 44094, null], [44094, 46106, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46106, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46106, null]], "pdf_page_numbers": [[0, 1106, 1], [1106, 2874, 2], [2874, 4781, 3], [4781, 7581, 4], [7581, 10473, 5], [10473, 12718, 6], [12718, 15050, 7], [15050, 18326, 8], [18326, 20485, 9], [20485, 23290, 10], [23290, 24883, 11], [24883, 27141, 12], [27141, 29896, 13], [29896, 31612, 14], [31612, 33970, 15], [33970, 36595, 16], [36595, 39262, 17], [39262, 41461, 18], [41461, 44094, 19], [44094, 46106, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46106, 0.07143]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
c2b34926f75fbbb3be9793cf5cb9f2f5ce563cfb
|
Enterprise Interoperability with SOA: a Survey of Service Composition Approaches
Rodrigo Mantovaneli Pessoa¹, Eduardo Silva¹, Marten van Sinderen¹, Dick A. C. Quartel², Luís Ferreira Pires¹
¹ University of Twente, Enschede, The Netherlands
² Telematica Instituut, Enschede, The Netherlands
{mantovanelir, e.m.g.silva, m.j.vansinderen, l.ferreirapires}@ewi.utwente.nl
{Dick.Quartel}@telin.nl
Abstract
Service-Oriented Architecture (SOA) claims to facilitate the construction of flexible and loosely coupled business applications, and therefore is seen as an enabling factor for enterprise interoperability. The concept of service, which is central to SOA, is very convenient to address the matching of needs and capabilities in enterprise collaborations. In order to satisfy more demanding needs or to rapidly adapt to changing needs it is possible to perform service composition in order to combine the capabilities provided through several available services. This paper presents a survey on recent approaches for service composition. To perform this study a conceptual framework for service composition is proposed. This framework allows studying how different approaches deal with the service composition life-cycle and provides basic guidelines for their analysis, evaluation and comparison. The proposed framework is used to analyse five representative service composition approaches.
1. Introduction
One promising benefit of Service-Oriented Architecture (SOA) is to facilitate the construction of flexible and loosely coupled business applications. SOA-based businesses applications can span several networked enterprises, with services that encapsulate and externalize various corporate applications and data collections. Service composition is an essential ingredient of SOA, as it is concerned with aggregating interoperable services such that the goals of (enterprises in) a collaboration endeavour can be satisfied. Many individual service composition approaches and solutions have been proposed and developed in recent years. However, more effort has to be spent on their evaluation and comparison. In this paper we investigate recent approaches and technologies to support service composition.
Traditionally, research surveys on service composition tend to either focus on one particular emerging technology (such as workflow-based, AI planning-based, ontology-based, etc) [1, 2, 3, 4] or be domain-specific [5, 6]. In this paper, we adopt a different approach to this classification and organize our study around the concept of service composition life-cycle. We define the different phases of the service composition life-cycle, and based on this we create a comparison framework. The proposed framework establishes a set of evaluation criteria that provides basic guidelines for analysis, evaluation and comparison. We argue that our framework enables a more comprehensive understanding of existing service composition approaches, and allows us to recognize opportunities for combining approaches and identifying open issues and research challenges.
The remaining of this paper is structured as follows: Section 2 discusses enterprise interoperability issues related to service composition. Section 3 describes the service composition life-cycle. Section 4 introduces our comparison framework. Section 5 describes five different service composition approaches. Section 6 compares the studied approaches. Finally, Section 7 presents our conclusions and defines some future research directions.
2. Enterprise Interoperability and Service Composition
Enterprise interoperability denotes the ability of organizational entities (businesses, government, companies and parts thereof), hereafter called enterprises, to interoperate in order to achieve certain business goals [7]. Since enterprises are subject to constant internal changes and must continuously react to ongoing or imminent changes in markets and trading partners, interoperability solutions cannot be static. In addition, since enterprises increasingly use ICT to support their business activities, interoperability solutions cannot be restricted to the organizational level alone. Therefore, in order to develop practical solutions for modern enterprises, interoperability should be addressed both from organizational and technical points of view, and flexibility (next to other "ilities") should be a major concern.
The following aspects of interoperability have been distinguished [8]: (i) businesses; (ii) processes; (iii) services; and (iv) data interoperability. Businesses and processes interoperability are considered mainly at the organizational level, whereas services and data interoperability require focus on (information) technology issues. The term service can be used to denote a business function as well as a function of a computer-based application. In the context of this paper, we limit ourselves to the latter denotation, however, being aware that a comprehensive treatment of enterprise interoperability would require consideration of both denotations within a single framework.
It has now been widely recognized that SOA can bring significant benefits for enterprise interoperability [9]. A perceived value of SOA is that the concept of service, which is central to SOA, allows one to address the matching of needs and capabilities in enterprise collaborations at the proper level of abstraction. SOA is based on the assumption that enterprise systems may be under the control of different ownership domains. Therefore, the focus is on services that these systems can provide (capabilities) or that these systems want to use (needs), and ownership issues are not visible except for restrictions imposed on the use of these services. Services are self-contained units of functionality, which are described, published and discovered [10]. These properties form the basis for fulfilling the desirable flexibility mentioned above: service providers can make themselves and their services instantly known. Moreover, user needs can also be matched to a combination of multiple provider capabilities, corresponding to multiple services, through a mechanism where discovered services are composed with the aim of fully satisfying the user needs.
This brings us to the focus of this paper, namely service composition. We perform a survey of different service composition approaches, analysing them according to the phases of the service composition life-cycle.
3. Composite Service Life-cycle
A composite service consists of a composition of existing services to achieve some functionality that typically is not provided by a single available service. The composite service life-cycle provides an integrated view of the phases and artefacts produced for service development and execution. The phases cover design-time and runtime aspects of the composite service lifecycle and allow services to be created, operated and maintained. The life-cycle phases may vary according to the granularity chosen for the description of the different activities involved in the service composition process. Figure 1 shows the life-cycle we propose for the development and execution of composite services.

We have aimed at specifying the common phases and artefacts of a service composition process in a single and comprehensive model. The circles in Figure 1 represent phases of the composite service life-cycle, and the round rectangles represent the artefacts produced in each phase.
**Requirements analysis.** The first phase of the lifecycle identifies and prioritizes business and customers requirements. In this phase the scope is set, resources are planned, and the business context in which the new services will operate is determined. Possible needs for new services are identified based on an analysis of
business and customers requirements. The artefact produced in the requirements analysis phase is a software requirements document, which typically details the system’s functional and non-functional requirements in a structured form.
**Design and specification.** In this phase, the composite service is designed to fulfill the business and customers requirements identified in the previous phase. In this phase the services needed to realize the requested service composition are selected and a process model specifying how the services are coordinated is built and validated. This involves the following sub-phases:
- **Service selection:** performs the selection and ranking of suitable services to fulfill the composition requirements. The output of the selection and ranking algorithm is the list of services that fulfil all functional and quality requirements of the user, ordered by some criteria.
- **Process model creation:** relates to the creation of a service composition. We should be able to determine what component services are executed and by whom, at what moment in time, what are the components dependencies and what are the expected results. The process model can be specified in terms of a single party view or a multi-party view. The first is usually defined as a service orchestration, while the second is defined as a service choreography. The resulting artefact is a specification of how to coordinate the discovered and selected services to meet the user needs. This specification can be produced at design-time or runtime, using manual, semi-automated or automated composition methods.
- **Process model validation:** services may have the same or similar functionality. Therefore, it is possible that more than one composite service is generated to fulfill the service requirements. In this case, the composite services should be evaluated and ranked on their overall utility. This evaluation is usually performed based on the composite service functional and non-functional properties. The most commonly used evaluation method is by using utility functions that rank the created composite services according to weights specified by the service requester for each non-functional property. The validation of the composite service correctness is another aspect of the service composition. It consists of verifying if the requested requirements are achieved by the composite service, if there are no deadlocks, etc.
**Realization.** This phase focuses on the service technical implementation details. In this phase the service identified and designed in the previous phase is built and tested. The service implementation can be coded in different computer languages and the source code can be obtained through actual programming, wrapping existing legacy applications or by model-to-code transformations. The materialization of a service is completed when some executable (code) specification is produced as artefact.
**Deployment.** The service deployment phase addresses the problem of installing, configuring and managing services and service instances in the service execution environment.
**Publishing.** In this phase the service description information is published. Usually this information is specified in a service description document. The published information allows one to advertise the service, and so that the service can be discovered by potential consumers. The service description document describes what the service does, where it can be found, and how it can be invoked.
**Discovery.** The discovery phase concerns the service consumers’ ability to find (either at design-time or at runtime) the service descriptions published in service registries in the Publishing phase. Once the services are published in the registry, users can search and find the services that meet their requirements.
**Service binding.** A service may have different implementations, and each implementation may have multiple deployments in different service end-points. The service binding phase focuses on how service endpoints are discovered and instantiated. The binding phase may be performed either at design-time or at runtime, and can be static or dynamic. Static service bindings are defined at design-time and define a tightly coupled interaction between service user and service provider. Dynamic service bindings allow a dynamic binding of service user and service provider’s service at runtime, given a selection and discovery mechanism, usually defined at design-time.
**Execution.** The execution phase involves the invocation of all participating services, possibly hosted in different provider domains. The execution of a composite service must be consistent with the specified process model and for this, a coordination mechanism is required. During composite service execution, this coordination mechanism is responsible for invoking the participating services, receiving notifications of completion from each participating service, transferring and transforming (when required) the input/output parameters among the participating services, and evaluating pre-conditions that must be satisfied prior to the invocation of a participating service and post-processing actions that must be
performed after the execution of a participating service.
Monitoring. In this phase, the service provider constantly monitors the composite service execution, evaluating its performance and verifying if the agreed performance levels are met. The goal of the service monitoring phase is to rapidly respond to indications of service degradation or failure, and to ensure that the service level agreements are fulfilled. To achieve these objectives, in general, service monitoring requires a set of QoS metrics to be gathered and interpreted.
4. Comparison Framework
In this section, we present our framework for analysis and comparison of service composition approaches. The proposed framework is derived from our service life-cycle. We specially focus on the service discovery and composition phases, or Process model creation, but also include other phases, such as process model verification and service execution. For each considered life-cycle phase we developed a set of evaluation criteria. Based on the framework, one may evaluate different service composition approaches, having a common ground to compare them. The characterization of service composition approaches is generally based on literature review. Table 1 presents our framework.
<table>
<thead>
<tr>
<th>Life-cycle Phase</th>
<th>Evaluation Criterion</th>
</tr>
</thead>
<tbody>
<tr>
<td>Service Discovery</td>
<td>Service description</td>
</tr>
<tr>
<td></td>
<td>Service matching and selection</td>
</tr>
<tr>
<td>Process model creation</td>
<td>Behaviour specification</td>
</tr>
<tr>
<td></td>
<td>Information specification</td>
</tr>
<tr>
<td></td>
<td>Level of automation</td>
</tr>
<tr>
<td></td>
<td>Composition time</td>
</tr>
<tr>
<td></td>
<td>Coordination distribution</td>
</tr>
<tr>
<td>Process model verification</td>
<td>Composition correctness</td>
</tr>
<tr>
<td>Execution</td>
<td>Service binding</td>
</tr>
</tbody>
</table>
Table 1. Comparison framework
In the following, we present in more detail each of the considered evaluation criterion of our framework:
Service description: aims at evaluating how a service is described. Different aspects can be considered, but we may reduce them to two groups: functional and non-functional aspects. The service functional description focus on the functionality supported by the service, which is usually expressed in terms of inputs, outputs, preconditions and effects (IOPEs). The non-functional service description aspects describe other properties the service such as: performance, availability, cost, etc.
Service matching and selection: refers to the task of discovering and selecting services that can be used in the composition. Services are discovered based on a set of requirements specified in a service request. The discovery and matching may be based on different information, such as service goals, or IOPEs. At the end of the service discovery process a list of services are retrieved. This set can be further filtered based on selection criteria. Different approaches may be taken to perform service selection. For example, non-functional properties, such as service cost, may be used to rank candidate services.
Behaviour specification: deals with the design of composite service behaviour. Here we focus on describing the languages and formalisms used by approaches for modelling the behaviour of a service composition (combined behaviour of the component services) and for defining constraints between the service operations that determine allowed invocation orders.
Information specification: since services handle data in the form of input and output parameters, it is necessary to model the data (types) that a service can handle, the data flow of the composite service and possible data transformation between the component services of a composite service.
Level of automation: given a set of available services and a user service request description, the problem of service composition synthesis is concerned with the creation of a new composite service, thus producing a specification of how to coordinate the available services to realize the client request. Such a specification can be obtained either automatically, i.e., using a tool that implements a composition algorithm, semi-automatically, i.e., in case the user makes choices during the composition phase aided by an interactive tool, or manually by the user. Depending on the intended purpose of a given approach, different (and specific) requirements may arise and be imposed.
Composition time: refers to the moment at which the approaches perform the service composition synthesis. Two distinct moments may exist, namely design-time and runtime. However, an initial composition plan can be defined at design-time, which can be adapted dynamically at runtime.
Coordination distribution: the coordination of a composite service requires that the service is completely specified, in terms of both the specification of how various services are linked, and the internal process model of the composite. Two main kinds of coordination have been identified in [11]:
5. Service Composition Approaches
Recently, several techniques and methodologies for modelling and specifying different aspects of service composition have been proposed. In this section, we discuss some representative approaches with respect to the evaluation criteria defined in our framework, in order to compare them.
5.1. METEOR-S
The METEOR (Managing End-To-End OpeRations) project at the Large Scale Distributed Information Systems (LSDIS) Lab at the University of Georgia focused on workflow management techniques for large-scale transactional workflows. Its follow-up project, which incorporates workflow management for semantic web services, is called METEOR-S (METEOR for Semantic web services) [13]. A key feature in this project is the usage of semantics for the complete life-cycle of semantic web services. Its annotation framework is an approach to add semantics to current industry standards such as WSDL. Finding an appropriate service for the composition is realized by a discovery engine that queries an enhanced UDDI registry.
Service description. The service descriptions are semantically augmented, which resulted on the SAWSDL (Semantic Annotations for WSDL) language. SAWSDL is based on WSDL-S, which was a joint specification developed by IBM and LSDIS Lab for adding semantic annotation to WSDL. SAWSDL is a simple extension of WSDL using the extensibility elements. It provides a mechanism to annotate the capabilities and requirements of web services (described using WSDL) with semantic concepts defined in an external domain model (e.g., ontology). Externalizing the domain models allows SAWSDL to take an agnostic view towards semantic representation languages. This allows developers to build domain models in their preferred language or reuse existing domain models. It has two basic types of annotations: the model reference and the schema mapping. Additionally, the METEOR-S framework extends the SAWSDL annotations with preconditions and effects, used to describe the conditions that must be met before an operation can be invoked and the result that the invocation of the operation will have.
The approach uses QoS ontologies to represent the semantics of service non-functional properties and has described generic QoS metrics based on four dimensions: time, cost, reliability, and fidelity. Each metric specification consists of a quadruple. \( QoSq(s,o) = <name, comparisonOp, val, unit> \), where ‘name’ is the parameter name, ‘comparisonOp’ is a comparison operator, ‘val’ is a numerical value, and ‘unit’ is the metric unit. The approach also presents a mathematical model that formally describes the formulae to compute QoS metrics among workflow tasks and an algorithm to automatically compute the overall QoS of a workflow.
Service matching and selection. METEOR-S has developed a three-phase algorithm for service selection that requires the users to enter service requirements as
templates constructed using ontological concepts. In the first phase, the algorithm matches services (operations in different WSDL files) based on the functionality they provide. In the second phase, the result set from the first phase is ranked based on semantic similarity between the input and output concepts of the selected operations and the input and output concepts of the template, respectively. The optional third phase involves ranking based on the semantic similarity between the precondition and effect concepts of the selected operations and preconditions and effect concepts of the template. The semantic matching on the semantic template of the activity is done against the operations, inputs, outputs, preconditions and effects of the services available. The ranking on semantic matching is based on the weights assigned by the process creator to the individual semantic parts of the activity, namely operations, inputs, outputs, preconditions and effects of the services available. The assigned weights are normalized before calculation.
**Information specification.** The information specification is based on manual specification of the data semantics. The model reference annotation is used to specify the association between a WSDL element and a concept in some semantic model (ontology). The schema mapping annotations are used by the METEOR-S framework to deal with further mismatches in the structure of the inputs and outputs of the web services, particularly transforming one data representation into another, such that it can be used in another web service. Mappings are created between the web service message element and the ontology concept with which the message element is semantically associated. In addition to a mapping from the web service message element to the ontology concept, also called the liftingSchemaMapping, an additional mapping from the ontology concept to the message element, called the loweringSchemaMapping, is specified. Once the mappings are defined, two web services can interoperate by reusing these mappings and the ontologies now become a vehicle through which web services resolve their message level heterogeneity.
**Behaviour specification.** METEOR-S specifies the process model describing the behaviour of services by capturing semantics of the activities in the process template during the design phase. The activities are not bound to web service implementations, but defined using semantic descriptions. Such templates are independent of the service description and process definition standards. The process template is a collection of activities, which can be linked using control flow constructs. The process templates in METEOR-S have a BPEL-like syntax. For representing control flow, the template uses the BPEL constructs. The template has also some additional constructs, like invoke activity, criteria, semantic-spec, discovery-spec, etc. which are prescribed in the BPEL specification, i.e., they are METEOR-S specific constructs independent of any process specification standard that can be used to generate executable processes.
**Level of automation.** The development module provides a GUI-based tool for creating semantic web services using SAWSDL. The tool provides support for semi-automatic and manual annotation of existing web services or source code with concepts from domain ontologies.
**Composition time.** METEOR-S offers support for two types of service composition, namely Static Composition (services to be composed are decided at design-time, static binding) and Dynamic Composition (services to be composed are decided at runtime, dynamic binding).
**Coordination distribution.** The coordination of the composite service is based on a BPEL-like centralised process engine, or an orchestration.
**Service binding.** The current prototype supports three kinds of service binding: static binding, deployment-time binding and dynamic binding. In static binding, a set of services is permanently bound to the composition. Deployment-time and runtime binding are achieved by using a proxy-based approach to bind a set of services that realise the service composition. In deployment-time binding, configuration is performed before the process starts executing. In runtime binding, configuration is performed after the process starts executing. Both deployment-time and runtime binding support reconfiguration. The configuration module has the ability to change the service bound to the proxies by simply changing a field in a shared data structure. This data structure is synchronised and accessed by each proxy before each service invocation. During reconfiguration, the process manager locks the data structure, thus making all proxies wait while the process is being reconfigured.
### 5.2. SODIUM
SODIUM (Service-Oriented Development In a Unified fraMework) was an international project, involving research, technological and industrial partners, dedicated to tackling interoperability
challenges that companies face at the data, services and business levels [14]. The project has developed a Generic Service Model, containing the common concepts of heterogeneous services from multiple points of view. The special characteristics of individual service technologies (such as Web services, Grid services or P2P services) are then dealt with as extensions to the core.
The SODIUM methodology adopts a model-driven and iterative approach for service composition and evolves in four phases: the user starts by defining the details of the complex task at a high abstraction level (phase 1); the user uses this abstract description to generate queries used for service discovery (phase 2); the discovered services are used to populate each of the abstract process tasks, hence transforming it to a concrete process description, and both the abstract and concrete descriptions are stored in the service composition (phase 3); and the concrete process description is transformed into executable descriptions and publishable documents about the composite service which has been built (phase 4).
**Service description.** The service is represented in a UML model, according to an UML profile that can be used to model semantic aspects of web services. Activities are stereotyped in order to represent web service operations. Parameters of this activity element represent its inputs and outputs. A web service activity has a set of tagged values. The web service provider is defined by the tagged value provider. The URL to the WSDL file is registered in the tagged value wsdl. The exact service operation to invoke is given by the three tagged values service, portType and operation. To represent a p2p service operation, activities are stereotyped as P2PServiceOperation. The five tagged values type defined for a peer-to-peer service operation are PSDL, Operation, Service and Pipe. To represent a grid service operation, activities are stereotyped as a GridServiceOperation. The six tagged values type defined for a grid service operation are gwsdl, ServiceLocation, Service, Operation, PortType and ResourceInstance. The service may optionally have semantic references for the data types used and QoS offered, which are described depending on what kind of information we can retrieve about the service.
The approach makes use of OMG’s QoS profile to represent collections of QoS properties with precise semantic meaning in the UML service model. Each QoS property contains a set of QoS dimensions with a name, its allowed value domain, an ordering function (whether higher or lower values are considered better) and its relationship to other QoS properties. The ordering direction of a property is defined as either increasing or decreasing, where increasing means that higher values are preferred. All the QoS properties to be used elsewhere shall be defined as a QoS property either within the model itself or as in imported model. Since SODIUM adopts the OMG profile, it already has generic capabilities to define QoS ontologies. In this sense, SODIUM does not suggest any specific QoS dimensions as part of the language, but is capable of defining any needed QoS dimension.
**Service matching and selection.** The Behavioural Service Discovery Framework (BSDF) presented a novel approach in service discovery, which enables modelling queries with behavioural constraints in a visual manner. It comprises three main components: (i) a visual query modeller that models behavioural service queries by means of UML behavioural diagrams; (ii) a translator that transforms the raw XMI output of the modeller to a generic XML-based query language, namely USQL; and (iii) a query engine capable of processing and executing USQL queries in various types of target registries, repositories, networks, etc.
The framework is able to match the query against various types of service choreography advertisements, independently of their format and protocols. The basic idea of the USQL engine lies in the logical grouping of heterogeneous registries, depending on the domain their advertised services belong to. Having the registries organized in this way, the engine sets the service requestor one step closer to his/her specific requirements and narrows the range of the returning results, making them more relevant to the initial request.
**Information specification.** Data objects are used to represent the data content that is created in the composition and that may be passed along to different activities. A data object has a specific ObjectType (optional) and may also represent the input and output parameters of the whole composition.
If the outputs of one service do not perfectly match the required input of the next service, there is a need to introduce intermediate data transformation steps between the services. This requires manual adjustments by the developer when specifying transformation nodes for defining data transformations as expressions in QVT (Queries/Views/Transformations). The transformation node is used for one-to-many, many-to-one and many-to-many data transformations. In a many-to-one transformation, the information from many source data objects is used to produce the content of a single target data object.
**Behaviour specification.** The Visual Service Composition Language (VSCL) is a graphical composition language for defining service
compositions containing heterogeneous (web, grid, p2p) services. The main concepts of the languages are the tasks and the flow of data and control between tasks. The task-graph node consists of a task part and an entire sub-graph. Thus, the language has a construct that can be repeated at arbitrary levels to create a recursive decomposition structure. A task may be executed by different kinds of services, namely P2P, Web or Grid services. A service composition consists of Nodes and Flows/Edges. The Nodes are TaskNodes, which represent the invocation of a remote service, ControlNodes, which represent specific crossings for control flow, ObjectNodes, which are used for data transfer between the tasks, EventNodes, which represent an expression node that passes control through its outgoing arcs upon the occurrence of a predetermined event or TransformationNodes, which are used for defining data transformations. Two different kinds of Flow are used to specify flow of control and data between nodes. A Flow indicates a directed flow of either flow of control (ControlFlow or EventFlow) or flow of data objects (ObjectFlow). A Flow has one source node and one target node.
Level of automation. The aim of the SODIUM approach is semi-automated tool support for service composition. In order to do so, the approach has automated large parts of the steps needed in the process of developing composite services. Many of the proposed steps for automation are model-driven transformations that transform between models and lexical descriptions about the services, both forward and reverse engineering.
Composition time. Though runtime service selection is discussed, the primary focus has been design-time service discovery and composition.
Coordination distribution. The coordination distribution runs on a central execution engine. This component deals with the execution of compositions by invoking services and orchestrating the control and data flow across the different steps of the composition.
Composition correctness. The analyser is a component used for validating a composition against a set of rules. This allows one to check the model for syntactical errors. A dialog box allows the user to select which rules to validate, to execute and present the analysis result. Rules can be defined for each of the main classes in the model. Some constraints should be checked during editing, while others should be checked before the generation of lexical executable representation of the composition. However, no formal proof of correctness is given.
Service binding. SODIUM refines the concept of binding beyond the basic distinction of static and dynamic binding. Service binding can be defined at the design, the compilation, the deployment, the beginning of the execution of a composition, or just before the actual service invocation takes place.
5.3. MoSCoE
MoSCoE (Modeling Web Service Composition and Execution) [15] is a project coordinated by Iowa State University. MoSCoE aims at the creation of a framework for modelling service composition and execution. The composition process in MoSCoE is divided in three-steps: abstraction, composition and refinement. Abstraction is provided to the framework users, allowing them to request a service using a high-level specification. The service providers advertise their services using common standard service description languages, namely OWL-S and WSDL descriptions. Given a service request, the framework’s composition engine creates a suitable composition, from the existing services, if possible; otherwise it starts the refinement phase, guiding the user through a service request refinement procedure to create a service composition. The refinement process is iterative, stopping when a suitable service composition is found, or when the user decides to end the composition process. If a service composition is obtained, it is translated into a concrete BPEL workflow, which can be executed. The service composition defines rules for non-functional properties. At the execution time these rules are monitored, and in case of some specified event takes place, the appropriate actions are taken. Furthermore, while executing the service composition, various data and control flow transformations are carried out by referring to the pre-defined ontologies used in the service descriptions, and to specified inter-ontology mappings.
Service description. Existing services are represented in OWL-S and WSDL specifications. OWL-S is used to semantically describe existing services, and specifying functional and non-functional aspects of the services, mainly for discovery. The MoSCoE project claims that other languages for service description can be supported. In fact, the framework translates all the service request and service descriptions to State Machine representations. This means that the service composition process is independent of the service description languages.
Service matching and selection. MoSCoE performs service discovery based on semantic descriptions. It assumes that existing services are semantically described in OWL-S. Services are discovered based on the specified user request functional aspects, the so called IOPEs (Inputs, Outputs, Preconditions and Effects). The service request is specified in a visual
form, using a UML State Machines representation of the desired service. This information is interpreted to perform service discovery. The discovered services are organised in terms of degree of semantic match, which can be Exact, Plug-in, Subsumption, Intersection or Disjoint. The degree of match is computed through semantic reasoning on the requested properties and the existing services’ semantic descriptions. Services that have intersection and disjoint matches are not considered as valid matches.
From the set of valid matches, a selection based on non-functional properties is performed. Non-functional properties are also described in an ontology. MoSCoE defines a quality vector which allows the user to specify which non-functional properties are of interest. Based on the quality vector, a quality matrix can be constructed, where lines represent the quality vector and columns the candidate services values for the considered non-functional properties. Furthermore, it is possible to define weight values for the different considered non-functional properties, which allows computing an additive value function, and consequently selecting the best suited service.
**Information specification.** MoSCoE allows one to semantically describe services, in terms of both functional and non-functional properties. However, the necessary supporting ontologies may be defined by different parties. This may cause problems of semantic interoperability of the services used in a composition.
**Behaviour specification.** In MoSCoE, service requests are specified using a UML State Machine representation. The discovered services are also translated to a State Machine representation. However, the MoSCoE service composition is described using a Transition System representation, more specifically, a Symbolic Transition System (STS). Therefore, transformations have to be performed on the service request and candidate services, to obtain Symbolic Transition Systems from state machine representations.
Once the candidate services are translated to STS, they are combined to reach the service goal specified by the user. This composition is obtained automatically, consisting on sequential and/or parallel compositions of STS service representations to meet the service goal specified by the user. If a composition is possible, the framework proceeds with the translation of the resulting STS representation to executable code, namely BPEL executable code. In case no composition is possible, the Refinement phase is triggered.
The Refinement phase consists of performing a new iteration with the user, asking for a service request refinement (using the UML State Machine representation). At the moment a refinement request is issued, concrete information about the problems/issues encountered during the service composition creation is provided. Given this, the user is guided on the refinement process, being asked to give more detailed information on concrete problems found on the service composition. After delivering the more detailed information, the UML State Machine is interpreted again, a new service discovery is performed, and a new set of services is retrieved. The service request and the set of discovered services are translated to State Machines and to STSs. Based on the STSs, the framework performs a new attempt to create a service composition that matches the refined user service request. If this is possible, the framework stops the service composition process, generating the executable code; otherwise it asks the user for a new refinement. This cycle may happen indefinitely if no service composition is constructed, unless the user decides to stop the process.
**Level of automation.** The MoSCoE approach to service composition can be classified as semi-automatic. The process of composing the existing services is automatic, but the user is asked for refinements in case a service composition matching the user initial service request cannot be found. Furthermore, the user is expected to specify a UML State Machine representing the service request. This process may be extremely complex for non-technical users.
**Composition time.** MoSCoE is mainly targeted to design-time service composition. The runtime service composition is not emphasized in the framework documentation.
**Coordination topology.** MoSCoE creates a service composition strategy, or orchestration, which defines the behaviour of a mediator, consisting of a plan that allows the management of interactions with the different service composition components.
**Composition correctness.** MoSCoE uses Symbolic Transitions System (STS) to represent services and service compositions. By using this formal representation, the framework has mechanisms to formally verify the created service compositions. MoSCoE checks soundness and completeness of the composition against the provided set of restrictions on the service composition. The service composition is also checked at the moment a new refinement is issued. This checking is used to provide specific information concerning the problems found at the composition time to meet the specified service user goals.
**Addressing and binding.** MoSCoE defines static service bindings at design-time. However, constraints and rules are also defined for non-functional properties
of the service composition. These properties are monitored at runtime. If some specified event takes place, the engine stops the service composition execution and an alternative service composition is selected, if available.
5.4. SeCSE
SeCSE (Service-Centric Systems Engineering) [16] was a European project from the 6th Framework Programme for Research and Development. The SeCSE project focused on the creation of new methods, tools and techniques for requirements analysis, system integrators and service providers to support cost-effective development and use of dependable services and service-centric applications.
The four main research areas of the project were Service engineering; Service discovery; Service-centric systems engineering; and Service delivery. To address these areas, SeCSE has defined a methodology consisting of the following phases: i) Business requirements definition and service discovery; ii) Composition creation; iii) Instrumentation and monitoring rule definition; iv) Service regression testing; v) Deployment of service composition; vi) Service-centric system description; vii) Service-centric system publication.
**Service description.** Faceted Service Specification [17] is used to perform service description. The proposed Facet Specification structure includes a stable element and variable elements. The principal stable element is that the XML file structure used to represent a Service Specification and associated Facets will not change, since these are independent of Facet types. Instances of any new Facet type can be listed in a Service Specification provided a type name has been defined and made public. Any new Facet Specification language can be used simply by embedding specifications written in the language within a Facet Specification file. The variable elements that the SeCSE runtime architecture needs to accommodate are: i) new Facet types, as service consumers' requirements evolve; ii) service specification languages, since new service specification languages are emerging and existing ones are still evolving. However, service consumers wishing to evaluate a service specification need to be able to establish whether their tool (if any) is capable of interpreting the specification. Hence, an indicator of the language used is needed, but the mechanism used to interpret it needs to accommodate potentially arbitrary choices of language and their versions.
**Service matching and selection.** The service discovery phase is performed based on a user (or Service Integrator as used in SeCSE) service request. A service request is defined using UML Use Case specifications. Additionally the service request specifies also functional requirements, using VOLERE. Use cases and requirements are expressed in structured natural language, using a SeCSE tool called UCaRE.
Once the use cases and requirements are specified, they can be used to construct a service request in UCaRE, allowing the user to select the information to be used in the service discovery query. The service request query is then passed to EDDiE, the SeSCE service discovery engine. After some manipulation on the natural language service request query, a two steps matching is performed: i) XQuery text-searching functions to discover an initial set of services descriptions that satisfy global search constraints; ii) traditional vector-space model information retrieval, enhanced with WordNet to further refine and assess the quality of candidate services set. The resulting matches are then presented to the user.
**Information specification.** SeCSE uses Faceted Service Specification to deal with information specification, and service description.
**Behaviour specification.** The process model specification is based on the activities identified in the requirements analysis phase. The user identifies the different required activities, and based on the set of discovered services he realises how the service composition can be made. This is done through a workflow definition. Given this workflow, the user proceeds with the actual service composition, using the Composition Designer (CD) tool provided by the SeSCE project. CD allows manipulating the WSDL descriptions of the discovered services and creating the necessary BPEL service description. From the resulting data, CD can generate a UML model that is recognized by the SeSCE Architecture-time Service Discovery (ASD) tool, which allows the publication and discovery of the composed service.
The CD tool also allows the user to further enrich the service composition description with binding and monitoring rules. These rules enable runtime dynamic adaptation of the service composition in case specific events take place. The definitions of the rules consist of Event-Condition-Action (ECA) expressions.
**Level of automation.** The service composition process can be considered as semi-automatic. The definition of the service composition is obtained based on a workflow specified by the user of the system. However, the user is supported in this task by the high level specification of the requirements provided in the requirements analysis phase. Furthermore, the actual service composition, or instantiation of the defined workflow, is performed based on the list of services
discovered automatically from the user’s service request. The user also specifies binding rules, which allow a dynamic adaptation of the service composition according the defined constraints.
**Composition time.** The composition process proposed by SeSCE can be considered as hybrid. The service composition is specified at design-time, as the dynamic binding rules. However, dynamic adaptations of the service composition take place at runtime, in case some pre-defined event takes place, such as the unavailability of a given service.
**Coordination topology.** The coordination topology consists on a centralised topology or orchestration, where a single party manages the service composition execution, monitoring and reconfiguration.
**Composition correctness.** SeCSE focuses mainly on QoS requirements verification, to perform runtime adaptation of the service composition. A technique based on a genetic algorithm is used for this purpose.
**Addressing and binding.** Binding is defined at design-time. However, the SeCSE approach also defines binding rules at design-time, which allow one to specify ECA rules to be interpreted at runtime and guide possible dynamic binding changes at runtime, as some events are observed, leading to reconfiguration actions on the service composition.
5.5. WSMF
The Web Service Modelling Framework (WSMF) [18] is a framework for describing the various aspects related to web services composition. The framework provides a Web Services Execution Environment (WSMX), which is a reference implementation of the Web Services Modelling Ontology (WSMO) and operates using the Web Services Modelling Language (WSML).
The WSMF conceptual model incorporates four core elements that are essential to represent semantic web services and related issues, namely ontologies, which provide the common terminology used by other WSMO elements, services, which are requested, provided, and agreed upon by requesters and providers, goals, which provide means to characterize user requests in terms of functional and non-functional requirements, and mediators, which deal with interoperability problems between different WSMO elements. In addition to these core elements, WSMO introduces a set of core non-functional properties that are globally defined and may be used by all its modelling elements.
**Service description.** In WSMO, requestors of a service express their objectives as goals, which are high level descriptions of concrete tasks. A WSMO goal description consists of a requested capability and requested interfaces. The former specifies the objective to be achieved in terms of a capability from the user perspective, while the latter specifies the communication behaviour for automated web service usage supported and required by the client. Analogously, a WSMO service description consists of a capability, which is a functional description of a web service describing constraints on the input and output of a service through the notions of preconditions, assumptions, post-conditions, and effects, and choreography interfaces that specify how the service behaves in order to achieve its functionality, i.e., the interaction behaviour supported by a service.
**Service matching and selection.** In the context of WSMF, service discovery is based on matching abstract request goal descriptions with semantic annotations of services. Hence, in order to precisely express user goals with respect to discovery, WSMO goals carry an additional non-functional property typeOfMatch, which denotes the matchmaking notion to be applied. The simplest approach uses an algorithm that matches keywords from the goal description with keywords from the service descriptions. For the lightweight semantic discovery, the capabilities of goals and candidate services are transformed into a variant of WSML and expressed as taxon concepts. Once this transformation has taken place, an appropriate reasoning engine is used to determine if there is an overlap in the set of concepts resulting from the transformation of the goal and service capabilities, respectively. The QoS-based discovery mechanism can be used to filter services from a large set of candidates or to order services that match a goal according to some specific QoS characteristic.
**Information specification.** In WSMF, ontologies are used to define a common agreed terminology, by providing concepts and relationships between these concepts. Only WSML is used as WSMX internal data representation. By reusing standard terminologies, different elements can be either linked directly or indirectly via predefined mapping and alignments, in order to achieve interoperability between services. The concept of mediation in WSMO has been introduced to handle heterogeneities that may exist between elements that should interoperate, by resolving data and behavioural mismatches. A WSMO mediator connects the WSMO elements in a loosely coupled manner, and provides mediation facilities for resolving mismatches that might arise in the process of connecting different elements defined by WSMO. More specifically, WSMO defines four types of mediators: OOMediators, which mediate heterogeneous ontologies, GGMediators, which connect Goals, WGMediators, which link web services to Goals, and WWMediators.
which connect interoperating web services, resolving their mismatches.
**Behaviour specification.** The behaviour specification is based on Abstract State Machines (ASM), consisting of states and guarded transitions. A state is described by the WSMO ontology and the guarded transitions are used to express changes of states by means of transition rules. The domain ontology constitutes the underlying knowledge representation for the ASM, and transition rules specified in terms of logic formulas describe how state changes when a transition is executed. WSML defines a syntax and semantics for ontology descriptions and comprises different formalisms, most notably Description Logics and Logic Programming. The underlying formalisms are used to give a formal meaning to ontology descriptions in WSML, resulting in variants of the language that differ in logical expressiveness and in the underlying language paradigms.
**Level of automation.** The framework aims at an automated, goal-driven service composition that builds on pre- and post-conditions associated to service descriptions.
**Composition time.** During design-time, the design and implementation of adapters, creation of ontologies and service descriptions, rules for lifting/lowering, and mapping rules between ontologies are carried out. The runtime phase involves discovery, selection and execution of the appropriate services to accomplish a given goal.
**Coordination distribution.** Information interchange for consumption and cooperation of services happens in a peer-to-peer manner, without the need of a central coordination entity.
**Composition correctness.** Apparently there is no explicit support for correctness in this framework.
**Service binding.** WSMO defines a proxy infrastructure for dynamic service binding and invocation. For each invoked service, a proxy has to be declared. The proxy allows referencing a service without knowing at design-time which concrete service is bound to it. This reference may consist of a goal definition or of a name, pre-conditions, post-conditions, input ports, output ports as well as error ports. The binding process happens at runtime and is based on binding rules defined in the proxy. The binding can be fixed to exactly one service, be defined in a registry (e.g., UDDI) or depend on input data coming from an input port. The last case means that the requester has full control over which service to select at runtime, because he can specify the binding criteria through the input ports. The only condition is that the data required to execute the composite service can be provided by the service bound at runtime.
## 6. Discussion
Table 2 summarizes the profiles of the composition approaches described in the previous section, according to multiple evaluation criteria defined within our comparison framework. By contrasting their profiles, it may be concluded that each approach focus on a specific set of phases involved in a composite service lifecycle, while disregarding others.
**Table 2. Comparison of the approaches**
<table>
<thead>
<tr>
<th>Service description</th>
<th>MatchML</th>
<th>SAWSDL</th>
<th>OWL-S</th>
<th>WSMO</th>
</tr>
</thead>
<tbody>
<tr>
<td>Description models</td>
<td>Semantically augmented with SAWSDL</td>
<td>UML models enriched with constraints and OMG’s QoS profile</td>
<td>Services are described in OWL-S and WSML</td>
<td>Services are represented in Factored service description</td>
</tr>
<tr>
<td>Service matching and selection</td>
<td>Three-phase matching algorithm based on semantic similarity</td>
<td>Based on UML models, enriched with constraints and functional properties</td>
<td>Semantic reasoning optimized with non-functional properties</td>
<td>Two-phase matching algorithm based on text searching functions</td>
</tr>
<tr>
<td>Behaviour specification</td>
<td>Based on process templates with BPEL-like syntax</td>
<td>A graphical composition language is used to define data and control flow</td>
<td>Based on UML state machine diagram and Symbolic Transition Systems</td>
<td>BPEL-like service composition based on abstract workflow definition</td>
</tr>
<tr>
<td>Information service description</td>
<td>Model reference annotations and schema mapping</td>
<td>Data objects as internal data represented in format and data transformation is expressed in QVT</td>
<td>Inter-ontology mappings</td>
<td>Faceted service description</td>
</tr>
<tr>
<td>Level of automation</td>
<td>Support for manual and automatic binding</td>
<td>Semantic support</td>
<td>Semi-automtic support</td>
<td>Semi-automatic support</td>
</tr>
<tr>
<td>Composition time</td>
<td>Design-time and runtime</td>
<td>Design-time</td>
<td>Design-time</td>
<td>Design-time with binding rules for dynamic adaptation</td>
</tr>
<tr>
<td>coordination distribution</td>
<td>Centralized</td>
<td>Centralized</td>
<td>Centralized</td>
<td>Centralized</td>
</tr>
<tr>
<td>Composition correctness</td>
<td>State machine based on BPEL</td>
<td>No support for formal proof of correctness</td>
<td>Symbolic transitions system based</td>
<td>No explicit support</td>
</tr>
<tr>
<td>Service binding</td>
<td>Static binding, deployment-time binding and dynamic binding</td>
<td>Design-time, compilation-time, deployment-time and runtime</td>
<td>Static binding</td>
<td>Static and dynamic binding</td>
</tr>
</tbody>
</table>
When comparing the described approaches, it is possible to notice that services can be described in different ways. They are described according to different existing standards (e.g. WSDL, SAWSDL, OWL-S, WSML), and can be characterized by a set of input and output parameters, QoS parameters,
keywords, pre- and post- conditions, effects, etc. Nevertheless, it has been done, at varying levels of abstraction and each of these levels implies a different description of services, ranging from simple unstructured keywords to detailed characterizations of possible state transitions.
The service discovery phase is directly dependent on the way services are described. Consequently, the achievable accuracy of a result in the discovery phase may vary significantly from one approach to another, since different sorts and amounts of information are available during the discovery phase and since more or less structure and semantic are embedded in the service descriptions, which are used by the matching algorithms. There is, however, an inherent trade off between expressiveness of the service descriptions and computational performance.
The way in which behaviour is specified also varies across the compared approaches. The behaviour of a composite service can be described explicitly, using some language that directly specifies the composition flow control (allowed order of invocations). This principle is currently taken by SODIUM and SeCSE approaches and reflects its primary focus on design-time service composition. Alternatively, such behaviour can also be described indirectly, by specifying the conditions under which the involved services in a composition can be invoked, its inputs and outputs parameters and the effects of such invocations. METEOR-S and MoSCoE allow IOPEs (inputs, outputs, preconditions and effects) to be specified at the level of WSDL operations. It allows AI planning techniques to be used to fully or partially automate the service composition process. The planning algorithms can be executed at design-time or runtime to find a suitable ordering of the operations, based on the initial conditions and the goal of a particular client. However, planning algorithms usually have high computational complexity and require substantial resources. WSMO specifies the conditions and effects using abstract state machines, consisting of states and guarded transitions. A state is described within an ontology and the guarded transitions are used to express changes of states by means of transition rules. However, this implicit behaviour specification may be neither intuitive nor trivial to make sure that the expectations implied by the designed transition rules match the expected operation message exchange patterns in the context of a service composition.
Concerning information specification, there are several converging ideas focusing on schema mappings and data transformations to cope with heterogeneity issues that can exist between the formats of the data exchanged between services. Similar to various existing approaches, developers may specify mappings between each element of an input/output parameter of a service and concepts from different data schemes. Ontologies are used as the information model throughout both WSMO and MoSCoE. Because WSMO heavily emphasizes mediation, mediators are a first class component of the WSMO service model. An example of a WSMO mediator for resolving data mismatches is the ooMediator, which links two ontologies, resolving possible mismatch issues between them. In METEOR-S, the data mediator module uses the data semantics of the proxies and the services, to perform XSLT transformations data mediation between the on-the-wire XML data. With this approach, the grounding needs to link the inputs and outputs of the service with the appropriate XSLT transformations. Therefore, mapping and merging of schemas becomes a core question and some (semi)automatic support has to be developed to reduce the exhaustive work needed for manual creation and maintenance of these mappings.
Regarding the coordination distribution, more traditional approaches assume a centralized coordination, where a central entity coordinates the invocation of services involved in a composition. In the other hand, WSMF goes beyond this traditional form of central coordination, where a peer-to-peer interaction takes place among equal partners, in terms of their level of control over other entities.
7. Conclusions
In this paper, we have presented an analytical framework for analysis and comparison of service composition approaches. The framework was developed following the phases of the composite service life-cycle. Additionally a set of criteria was identified to evaluate each of the considered life-cycle phases.
We claim that service composition plays a major role in enterprise interoperability, and so here we present some state of the art on service composition approaches. According to our framework, an ideal approach would efficiently cover all of the requirements that we have identified across the key phases of the composite service life-cycle. However, for practical reasons, the compared approaches focus on specific phases of the life-cycle, while neglecting others. Not surprisingly, the described approaches widely differ in how they address the above mentioned requirements.
Based on our study we conclude that none of the service composition approaches we investigated covers
all the life-cycle phases and is commonly accepted by the research community. For this reason, we believe there are opportunities to be exploited by combining the benefits of the different approaches. However, there are still some issues that have not been explicitly addressed in our study. An example is the way ontologies are used, since ontologies are currently a major technology for supporting service description and composition. Different organisations define ontologies in different ways, which may generate major problems of interoperability. Some approaches define manual mappings to deal with the ontologies interoperability problem; however these mappings or mediation techniques may be error prone and difficult to apply in realistic applications.
An issue that apparently is not being widely addressed is the support to end-users’ service composition at runtime. This is a major research challenge and business opportunity, since the idea of delivering services at runtime on demand to end-users is a natural opportunity and benefit of service-oriented systems. However, as it can be observed from our study, the majority of the approaches mainly focus on design-time service composition, providing support to service developers. On this specific topic we foresee many research challenges as well as many business opportunities in the upcoming years.
References
|
{"Source-Url": "http://doc.utwente.nl/65047/1/Rodrigo-IWEI_2008-CameraReady.pdf", "len_cl100k_base": 12043, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 44377, "total-output-tokens": 13449, "length": "2e13", "weborganizer": {"__label__adult": 0.00029349327087402344, "__label__art_design": 0.0006422996520996094, "__label__crime_law": 0.0003619194030761719, "__label__education_jobs": 0.0010118484497070312, "__label__entertainment": 0.0001285076141357422, "__label__fashion_beauty": 0.00016963481903076172, "__label__finance_business": 0.0010404586791992188, "__label__food_dining": 0.00031948089599609375, "__label__games": 0.0005383491516113281, "__label__hardware": 0.0008029937744140625, "__label__health": 0.00038814544677734375, "__label__history": 0.0004279613494873047, "__label__home_hobbies": 7.283687591552734e-05, "__label__industrial": 0.000484466552734375, "__label__literature": 0.0004532337188720703, "__label__politics": 0.00037741661071777344, "__label__religion": 0.0004329681396484375, "__label__science_tech": 0.07867431640625, "__label__social_life": 0.00010609626770019533, "__label__software": 0.0260467529296875, "__label__software_dev": 0.88623046875, "__label__sports_fitness": 0.00019729137420654297, "__label__transportation": 0.0005044937133789062, "__label__travel": 0.0002160072326660156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 68009, 0.0149]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 68009, 0.30908]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 68009, 0.91421]], "google_gemma-3-12b-it_contains_pii": [[0, 3573, false], [3573, 7856, null], [7856, 13091, null], [13091, 18197, null], [18197, 21132, null], [21132, 26119, null], [26119, 31504, null], [31504, 36815, null], [36815, 42152, null], [42152, 47442, null], [47442, 52739, null], [52739, 58404, null], [58404, 63578, null], [63578, 68009, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3573, true], [3573, 7856, null], [7856, 13091, null], [13091, 18197, null], [18197, 21132, null], [21132, 26119, null], [26119, 31504, null], [31504, 36815, null], [36815, 42152, null], [42152, 47442, null], [47442, 52739, null], [52739, 58404, null], [58404, 63578, null], [63578, 68009, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 68009, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 68009, null]], "pdf_page_numbers": [[0, 3573, 1], [3573, 7856, 2], [7856, 13091, 3], [13091, 18197, 4], [18197, 21132, 5], [21132, 26119, 6], [26119, 31504, 7], [31504, 36815, 8], [36815, 42152, 9], [42152, 47442, 10], [47442, 52739, 11], [52739, 58404, 12], [58404, 63578, 13], [63578, 68009, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 68009, 0.12429]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
75837ec7b9bf9ce68b8fc32bdefcd9ffcb063a07
|
TCG Runtime Integrity Preservation in Mobile Devices
Family “2.0”
Level 00 Revision 106
November 11, 2019
Contact: admin@trustedcomputinggroup.org
PUBLISHED
DISCLAIMERS, NOTICES, AND LICENSE TERMS
THIS DOCUMENT IS PROVIDED “AS IS” WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, DOCUMENT OR SAMPLE.
Without limitation, TCG disclaims all liability, including liability for infringement of any proprietary rights, relating to use of information in this document and to the implementation of this document, and TCG disclaims all liability for cost of procurement of substitute goods or services, lost profits, loss of use, loss of data or any incidental, consequential, direct, indirect, or special damages, whether under contract, tort, warranty or otherwise, arising in any way out of use or reliance upon this document or any information herein.
This document is copyrighted by Trusted Computing Group (TCG), and no license, express or implied, is granted herein other than as follows: You may not copy or reproduce the document or distribute it to others without written permission from TCG, except that you may freely do so for the purposes of (a) examining or implementing TCG documents or (b) developing, testing, or promoting information technology standards and best practices, so long as you distribute the document with these disclaimers, notices, and license terms.
Contact the Trusted Computing Group at www.trustedcomputinggroup.org for information on document licensing through membership agreements.
Any marks and brands contained herein are the property of their respective owners.
ACKNOWLEDGEMENTS
The TCG wishes to thank all those who contributed to this reference document. This document builds on work done in other TCG work groups, including Infrastructure, Storage, Trusted Mobility Solutions, and Trusted Platform Module. Special thanks to the following current and former members of the Mobile Platform WG who contributed to this document:
<table>
<thead>
<tr>
<th>Name</th>
<th>Affiliation</th>
</tr>
</thead>
<tbody>
<tr>
<td>Wael Ibrahim (MPWG co-chair)</td>
<td>American Express</td>
</tr>
<tr>
<td>Andre Rein</td>
<td>Andre Rein</td>
</tr>
<tr>
<td>Bo Bjerrum</td>
<td>Bo Bjerrum</td>
</tr>
<tr>
<td>Carlin Covey (editor)</td>
<td>Carlin Covey</td>
</tr>
<tr>
<td>Amy Nelson</td>
<td>Dell, Inc</td>
</tr>
<tr>
<td>Michael Eckel</td>
<td>Fraunhofer Institute for Secure Information Technology (SIT)</td>
</tr>
<tr>
<td>Graeme Proudler</td>
<td>Graeme Proudler</td>
</tr>
<tr>
<td>Tom Laffey</td>
<td>Hewlett Packard Enterprise</td>
</tr>
<tr>
<td>Steve Hanna</td>
<td>Infineon Technologies</td>
</tr>
<tr>
<td>Mitul Shah</td>
<td>Intel Corporation</td>
</tr>
<tr>
<td>Alec Brusilovsky</td>
<td>InterDigital Communications, LLC</td>
</tr>
<tr>
<td>Ira McDonald (co-editor)</td>
<td>Ira McDonald</td>
</tr>
<tr>
<td>Kathleen McGill (MPWG co-chair)</td>
<td>Johns Hopkins University, Applied Physics Lab</td>
</tr>
<tr>
<td>Guy Fedorkow</td>
<td>Juniper Networks, Inc</td>
</tr>
<tr>
<td>Charles Schmidt</td>
<td>The MITRE Corporation</td>
</tr>
<tr>
<td>Jessica Fitzgerald-McKay</td>
<td>United States Government</td>
</tr>
</tbody>
</table>
TABLE OF CONTENTS
TABLE OF CONTENTS ................................................................................................................. 3
1 INTRODUCTION ......................................................................................................................... 4
1.1 Scope and Audience .............................................................................................................. 4
1.2 Informative References ....................................................................................................... 4
1.3 Definitions .......................................................................................................................... 6
2 RUNTIME INTEGRITY PRESERVATION CONCEPTS ............................................................... 7
2.1 Mobile Device Integrity Goals ........................................................................................... 7
2.1.1 Integrity of Reference Measurements ...................................................................... 7
2.1.2 Identity of Protected Objects .................................................................................. 7
2.1.3 Freshness of Integrity Assessment ......................................................................... 7
2.2 Mobile Device Integrity Preservation ................................................................................ 8
2.2.1 Pre-boot Integrity ...................................................................................................... 8
2.2.2 Boot-time Integrity .................................................................................................. 8
2.2.3 Load-time Integrity ................................................................................................. 8
2.2.4 Run-time Integrity ................................................................................................... 8
3 RUNTIME INTEGRITY PRESERVATION (RIP) MECHANISMS .................................................... 9
3.1 Static Integrity Mechanisms ............................................................................................. 9
3.1.1 Static Integrity Enforcement ................................................................................... 9
3.1.2 Integrity Assessment ............................................................................................... 10
3.1.3 Integrity Remediation ............................................................................................ 11
3.2 Dynamic Integrity Mechanisms ........................................................................................ 12
3.2.1 Control Flow Integrity ............................................................................................ 12
3.2.2 Data Flow Integrity ................................................................................................. 13
3.2.3 Memory Corruption Prevention ............................................................................. 13
4 RUNTIME INTEGRITY PRESERVATION RECOMMENDATIONS ................................................... 14
4.1 Recommendations for RIP Security Policy ....................................................................... 14
4.2 Recommendations for Pre-boot Integrity ......................................................................... 14
4.3 Recommendations for Runtime Integrity Enforcement .................................................... 14
4.4 Recommendations for Runtime Integrity Assessment ....................................................... 15
4.5 Recommendations for Runtime Integrity Remediation ..................................................... 16
4.6 Recommendations for Control Flow Integrity Preservation ............................................. 16
4.7 Recommendations for Data Flow Integrity Preservation .................................................. 16
5 PERFORMANCE OF RIP MECHANISMS .................................................................................. 17
5.1 Dedicated RIP Hardware ................................................................................................. 17
1 INTRODUCTION
1.1 Scope and Audience
NIST Special Publication 800-164 (Draft) Guidelines on Hardware-Rooted Security in Mobile Devices (Draft) states: “Mobile devices should implement the following three mobile security capabilities to address the challenges with mobile device security: device integrity, isolation, and protected storage.” This TCG Runtime Integrity for Mobile Devices (RIP) document addresses the first of these security capabilities by recommending practices and mechanisms that are intended to preserve the integrity of the critical portions of the runtime state of mobile devices. This entire document addresses security considerations for mobile devices including many of the security topics discussed in [2].
Mobile device manufacturers and enterprise administrators can establish security policies for runtime mobile device integrity that identify the portions of the runtime state that are considered critical and which actors are authorized to modify the mobile device runtime state. RIP mechanisms within the mobile device can prevent or detect and remediate runtime state modifications made by unauthorized actors.
This document provides recommendations for improvements in the security of mobile devices and mechanisms to allow mobile devices to maintain enhanced security during operation. The recommendations in this document are targeted at designers, developers, and implementers of trusted computing technologies in mobile devices.
TCG Mobile Reference Architecture [1] defines secure boot for mobile devices (which ensures that the mobile device starts in a known state) and includes diagrams of a variety of common mobile device architectures. Naturally, some aspects of the mobile device state are expected to change as software executes or writes to data areas. However, portions of the mobile device state can still be checked for authorization to execute and for integrity.
1.2 Informative References
17. IANA, TLS Parameters Registry. (Standard cryptographic algorithms), https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
1.3 Definitions
<table>
<thead>
<tr>
<th>Term</th>
<th>Definition</th>
<th>Source</th>
</tr>
</thead>
<tbody>
<tr>
<td>Integrity Preservation</td>
<td>The process and techniques for ensuring that the integrity of the device is preserved while the device is running. Includes enforcement, assessment and remediation of integrity.</td>
<td>FIPS 199 Standards for Security Categorization of Federal Information and Information Systems [21]</td>
</tr>
<tr>
<td>Service Processor</td>
<td>A processor with isolated resources that configures resources used by the main application processor(s). The service processor does not execute user-supplied software. The service processor may provide other management services in additional to configuration.</td>
<td>NIST Computer Research Security Center [26]</td>
</tr>
<tr>
<td>Trust</td>
<td>Trust is the expectation that a device will behave in a particular manner for a specific purpose.</td>
<td>TCG Glossary [22]</td>
</tr>
</tbody>
</table>
2 RUNTIME INTEGRITY PRESERVATION CONCEPTS
2.1 Mobile Device Integrity Goals
The goal of runtime integrity preservation is to ensure that the device continues to behave in an expected manner following a successful secure boot. Since it is difficult to characterize the expected behavior of the device and compare expected behavior to actual behavior, this document relies on the following assumptions:
- The device executes a secure boot process, which is defined in [1].
- If critical portions of the device state are preserved at runtime, the device will behave in a manner expected by the device manufacturer.
2.1.1 Integrity of Reference Measurements
Integrity assessment mechanisms compute a measurement (e.g., a secure hash) over software and/or static data objects in memory, and compare the result of these measurements against secure reference metrics to determine whether the software or data objects have been corrupted.
In order for integrity assessment mechanisms to detect corruption of data objects it is essential that the authenticity of the reference metrics be verified, and that their integrity be protected thereafter. One method to authenticate reference metrics is to verify a cryptographic signature over the reference metrics. If reference metrics are embedded within a software distribution package, then the stored reference metrics will be authenticated at boot time along with the software itself.
Reference metrics must match the software image as it exists at runtime, but the software could have been transformed when it was loaded into memory. A solution to this challenge is to have the RIP mechanism calculate fresh metrics after the software has been transformed, but before any other software is allowed to execute.
If reference metrics are stored in RAM, then the reference metrics themselves could be altered. This alteration could be prevented by appropriate countermeasures. For example, the reference metrics could be stored instead in protected storage, such as flash, kernel address space, or a TPM. Reference metrics could also be protected by cryptographic integrity checking via digital signatures or HMAC/CMAC computations.
2.1.2 Identity of Protected Objects
Cryptographic integrity protection (e.g., via digital signature or HMAC/CMAC) can be used to verify that an object has not been altered since the reference metric was calculated. However, this protection cannot guarantee that the software is in fact referencing the correct object. For example, cryptographically protected return address pointers could have been maliciously modified between function calls. A possible solution to this challenge is to embed a function identifier in the protected return address and then verify the function identifier before the return address is dereferenced.
The cryptographic integrity protection assurance of data objects depends upon proper access control for the protection keys. Only those entities that can be trusted to provide authentic data should be allowed to apply the cryptographic protection. Only trusted entities should be allowed to perform the action that is authorized when the protected data is authenticated.
2.1.3 Freshness of Integrity Assessment
The probability of a successful integrity attack increases over time. Therefore, the highest assurance of mobile device integrity immediately follows an integrity assessment. Calculating integrity metrics consumes mobile device resources, including power, bus bandwidth, and possibly processor cycles. This mobile device resource consumption can be mitigated by reducing the frequency of integrity assessment. The freshness of the integrity assessment is a matter of system policy. The need for integrity assessment freshness could be more critical for certain mobile devices or certain sensitive operations.
2.2 Mobile Device Integrity Preservation
A device transitions through several phases to reach an operational state. Operational state is defined as the condition in which the device is ready for its intended purpose. The pre-boot phase begins with initial firmware execution on the device, which might perform various hardware health checks and hardware configuration actions. The boot phase can invoke device support firmware and the bootloader. The bootloader loads runtime system software such as a hypervisor or Operating System (OS) kernel. From this point onward, the runtime system software controls the state of the device and further software execution.
2.2.1 Pre-boot Integrity
Pre-boot integrity refers to the integrity of the mobile device prior to the boot of one or more of the main runtime processors. This phase includes the period when the SoC is completely powered down (except perhaps a coin cell battery to run a small amount of logic, such as the real time clock and monotonic counters), the period when the SoC is in an offline mode (network interfaces are not active and service processor is not running), and the period when a service processor is running but the main processor is not.
The integrity of the runtime system might be dependent on the pre-boot integrity of certain elements of the system, such as the configuration of non-volatile storage in ROM, flash, fuses, or state-retention registers. Unauthorized modification of these elements prior to boot can subvert the security of the boot process.
2.2.2 Boot-time Integrity
At power-on-reset, the mobile device begins executing firmware from a Boot ROM or secure flash memory. The firmware is integrity protected by the immutability of the ROM or secure flash memory. Using an integrity-protected signature verification key, the firmware verifies the signature over the boot image that will be executed next. If the signature is correct, the boot ROM firmware initiates execution of that boot image. That boot image then verifies the signature over one or more additional blocks of software using the same public key or other integrity-protected public keys. If any of these checks fail, the mobile device enters a remediation mode, or returns to the reset state [1]
2.2.3 Load-time Integrity
Before software is executed on a mobile device, it must be loaded properly. Usually, the software is available in persistent storage, such as a hard-drive or flash-chip. The loading of the system software is initiated by boot software. In the Secure Boot process, the integrity and authenticity of loaded software is verified before it is allowed to execute. Once the OS has been loaded, it typically manages the loading of application software. The OS verifies the integrity of the application software and transforms it into a ready-to-run state (e.g., resolving dynamic library links).
2.2.4 Run-time Integrity
Runtime integrity preservation protects security-critical portions of the mobile device state during execution. Runtime integrity preservation requires appropriate integrity measurement and assessment of security-critical components. Identifying the relevant security-critical portions of the mobile device is an important aspect of runtime integrity preservation. In addition to software, data, such as policies, credentials and configuration files, can affect the security of the mobile device at runtime.
Due to the large number of potential attacks, no one solution by itself can ensure system integrity. Multiple technologies are necessary to ensure resilience despite the spectrum of runtime integrity attacks. These technologies can enable the assessment of integrity violations, allow integrity recovery following a detected integrity violation, or increase resistance to integrity violations. The TCG Cyber Resilient Technologies workgroup focuses on supporting system resilience.
3 RUNTIME INTEGRITY PRESERVATION (RIP) MECHANISMS
The following subsections describe a variety of runtime integrity preservation mechanisms. These mechanisms are examples of existing techniques, but they are not exhaustive. Any runtime integrity preservation techniques that follow the recommendations in Section 5 are considered valid implementation choices.
Some mobile devices incorporate a service processor that provides management services to the main processor cores, such as initialization, integrity checking, mobile device management, and system update. The service processor operates in an isolated environment and manages the configuration of the other processor(s). As a result, the service processor is a natural candidate for performing runtime integrity checks on the other main processors' software images. Some runtime integrity preservation mechanisms can leverage a service processor if available. However, since the service processor often can read and modify most of the mobile device resources, the integrity of the service processor itself is critical.
Static integrity mechanisms preserve the integrity of the mobile device's static state, e.g. the configuration files, software and other static data. Dynamic integrity mechanisms verify that the dynamic state of the mobile device falls within expected parameters. Static and dynamic runtime integrity protection mechanisms are complementary. Static integrity assessment and remediation ensure the integrity of software and additional information embedded in the software image that can be used for dynamic integrity mechanisms. Dynamic integrity is necessary to assess and remediate attempts to modify data or control state.
3.1 Static Integrity Mechanisms
Static integrity mechanisms contribute to the preservation of the integrity of critical portions of the mobile device state.
3.1.1 Static Integrity Enforcement
Some RIP techniques provide static integrity protection of data. In other words, the techniques explicitly prevent the compromise of protected components.
3.1.1.1 Immutable Mobile Device Resources
One technique for enforcing integrity at runtime is to employ immutable mobile device resources, e.g., hardware or Read-Only Memory. Strict immutability is the safest way to preserve the integrity of mobile device resources. One approach to prevent modifications is to store software in ROM, however this mechanism is only practical for certain specialized software, such as boot software or integrity assessment software. A more flexible, but more complex approach, is to constrain the modifications that are made to software storage areas. For instance, software can be loaded into RAM at boot time under the control of integrity-protected software, and then, the ability to write to RAM would be disabled until the next power cycle.
However, often even nominally “immutable” resources are actually mutable under certain conditions. For one example, ROM can have patch hardware that allows certain subsets of ROM memory locations to be modified to correct firmware bugs. For a second example, the state of a fuse bank can be buffered in flipflops, and the state of these flipflops can be alterable, even if the fuse bank is not. In each of these cases, it is the responsibility of access control mechanisms to prevent unauthorized modifications of these resources and thereby preserve the inherent integrity. The nature of these access control mechanisms is out of scope for this document.
3.1.1.2 Bulk Storage Integrity
Another technique for enforcing integrity at runtime is through the use of an integrity-protected bulk storage device. The TCG Storage Work Group focuses on specifications for security services on dedicated storage systems. One objective of the TCG Storage Work Group is to develop specifications and practices for defining the same security services across dedicated storage controller interfaces, including but not limited to ATA, Serial ATA, SCSI, FibreChannel, USB Storage, IEEE 1394, Network Attached Storage (TCP/IP), NVM Express, and iSCSI. Storage systems include disk drives, removable media drives, flash storage, and multiple storage device systems. The TCG Storage Security Subsystem Class: Opal Specification [3] provides detail on the use of a Storage Device in a trusted platform (including mobile devices), including storage integrity use cases and capabilities.
3.1.1.3 Stored Data Protection
A common technique for ensuring the integrity of data and software in memory is to implement a hardware lock that, when set, prevents any write operations to a specific area of RAM. This technique can be used to ensure that data or software loaded by the boot software remains immutable during mobile device execution until the next power cycle.
A similar hardware lock could be used to prevent read operations. This technique can be used to allow boot software to read secret data from ROM, but prevent software that runs after boot time from obtaining the secret data. A use case for this read-lock mechanism is protection of a private or symmetric cryptographic key used during mobile device provisioning.
Another hardware lock could be used to protect data encrypted with the mobile device storage key. This technique allows boot software to encrypt data that cannot be later decrypted once the boot software has set the hardware lock. Further, if the data is encrypted with an algorithm that appends a cryptographic signature, then later software cannot encrypt data that spoofs the boot software.
3.1.1.4 Data Execution Prevention
Data Execution Prevention (DEP) is a hardware mechanism for enforcing an execution permission policy for memory pages. When the OS kernel loads software into a memory page the kernel sets a hardware flag that identifies the page as executable. If a processor tries to fetch instructions from a memory page that is not flagged as executable, an exception is generated and the program is terminated. This mechanism prevents integrity compromise by misusing valid portions of an image.
3.1.1.5 Canary Values
The use of canary values is a software-based bounds-checking mechanism for preventing the exploitation of buffer overflows. Typically, this mechanism is implemented within the compiler. The compiler places a canary value in-between buffers and control data, and adds check routines that are invoked before accessing the control-data. If an inserted canary value changed from the expected value, the program is terminated.
3.1.2 Integrity Assessment
Runtime integrity assessment is the process of determining whether the security-critical portions of the system state are consistent with their expected values. In many cases, this is the state that was established at boot time. This boot-time state includes the system configuration and the software and data that are loaded during the boot process. In order to detect changes from the expected security-critical boot-time state, the RIP mechanism must have reliable measurements of this security-critical boot-time state.
Note that certain variations of the boot-time state are expected and permissible:
- Data areas will change state during the execution of the system software and application software
- The operating system can load additional applications after boot-time.
- Changes to the hardware configuration can occur as flash cards are inserted or removed during runtime.
In most cases integrity assessment will be limited to those portions of the state that are expected to remain constant following boot. In some cases, the mobile device can operate in different modes, and portions of the mobile device state can be dependent on the mode. The integrity assessment mechanism would need to be aware of the mobile device’s current mode and use the appropriate integrity reference metrics.
If the integrity assessment detects a deviation from the expected state, one or more remediation actions should be initiated.
The following subsections describe examples of integrity assessment metrics. Any of these techniques can be applied in combination. That is, one mechanism might be used for integrity checking software that performs integrity checking of other software and data, resulting in a hierarchy of integrity checking mechanisms.
3.1.2.1 Protected Copy of Image
If there is a copy of the software/data image in protected storage (e.g. ROM, access-controlled flash memory), the image in RAM can be periodically compared byte-by-byte with the protected copy during runtime. Similarly, subsets of the image can be compared this way.
3.1.2.2 Protected Hash of Image
A hash can be computed over a trusted image or critical portions and stored as an integrity-protected reference metric in protected storage. During runtime, the RIP mechanism can compute the hash over the integrity-protected portions of the runtime image and compare the newly-calculated hash with a protected reference hash.
3.1.2.3 HMAC/CMAC Portions of Image
Critical software and data can have HMAC/CMACs embedded in the image. These HMAC/CMACs could be generated at compile time or at link time. Periodically, the RIP mechanism could randomly select a portion of the image, compute the HMAC/CMAC over that portion, and compare the computed HMAC/CMAC with the embedded HMAC/CMAC.
3.1.2.4 Watchdog Timers
Watchdog timers can be used to support integrity assessment (and also remediation). Once started, a watchdog timer increments or decrements at regular intervals until the count reaches a predefined value, at which point the timer expires. When the timer expires, some action is initiated to assess integrity. In this way, a watchdog timer can detect and limit the impact of integrity compromise. However, it cannot prevent compromise.
There are several cases in which a watchdog timer is particular useful:
1. A procedure with a known execution time: The timer would start at the initiation of the procedure and expire at the predicted time when execution is expected to terminate. This would detect “hung” or “runaway” conditions.
2. Software response to a hardware event: The watchdog timer would start when the hardware event was detected, and the software that responds to the event would turn off the timer before it expires. The hardware event could be an interrupt request initiated by a security sensor (e.g. voltage out of range, temperature out of range), or it could be a software-initiated action such as a request to a hardware security module. If the expected response did not occur before the timer expired, software would be notified.
When the watchdog timer expires, the remediation action is a matter of mobile device security policy. If the mobile device has a service processor or other isolated processing element, it might be possible to perform remediation actions on a subset of the mobile device state.
3.1.3 Integrity Remediation
After an integrity compromise has been detected, it is generally unsafe to continue normal mobile device operation until the compromise has been remedied. The appropriate remediation actions for a given scenario are a matter for the mobile device security policy. Possible remediation actions include rebooting the mobile device or attempting to restore the expected state of the mobile device while it continues to operate. The RIP remediation mechanisms ensure that the remediation actions specified by the mobile device security policy are initiated, and that any failures in remediation actions are handled appropriately. This policy can be very simple (e.g. one remediation action in all cases) or it can be complex (e.g. different remediation actions for different cases). The following are examples of remediation mechanisms.
3.1.3.1 Reboot
A simple remediation technique is a full reboot of the mobile device without any attempt to preserve the context of the mobile device. The integrity of the mobile device is restored via the normal secure boot process. In mobile devices that incorporate two or more processors it might be possible to reboot the processor that experienced an
integrity failure without rebooting the mobile device. For example, a discrete TPM [27] could be left running to preserve data objects in secure storage.
3.1.3.2 Reload a Subset of Software
If it is possible to identify the particular software or data object whose integrity has been compromised, then that data object could be restored without rebooting the mobile device. For example, if integrity is assessed in a hierarchical fashion, an integrity failure can be detected at higher levels of the hierarchy while lower foundational levels are uncorrupted. In these cases, the remediation action can address higher-level objects.
3.1.3.3 Special Case: Inter-device Transaction Remediation
More complex remediation actions might try to preserve the context of certain operations that were active at the time that the integrity compromise was detected. For instance, if two devices have entered into a transaction (e.g. a sales transaction), both devices should be notified if the integrity state of either device is compromised during the transaction. In that event, application-specific software on both devices can take actions to back out of the transaction.
3.2 Dynamic Integrity Mechanisms
Many of the concepts that apply to static integrity enforcement also apply to dynamic integrity enforcement. However, dynamic integrity mechanisms can only address the integrity of the dynamic state of the mobile device during runtime.
3.2.1 Control Flow Integrity
Control Flow Integrity (CFI) mechanisms protect running software from unintended or malicious modifications that would subvert its control flow [4]. These modifications are known as control-data attacks – often called Code Reuse Attacks. The control flow is subverted by exploiting vulnerabilities inside the software (e.g. stack or heap-based buffer overflow [12] or underflow) that allow the manipulation of control-data such as a branch target (i.e. a function pointer). This manipulation enables the adversary to execute/reuse code or portions of code in unintended ways [23, 24]. Consequently, the goal of CFI is to prevent the execution of unintended/maliciously-altered execution flows and, thus, prevent control-data attacks [13]. This goal can be achieved by preventing the initial modification itself [7] or by preventing the execution of the malicious modification. Typically, the types of CFI mechanisms include hardware-enforced (e.g. shadow-stacks, pointer-authentication), software enforced by applying self-checking code (e.g. branch-target tracking), or a combination of both.
Conceptually, CFI is divided into forward-edge [5] and backward-edge [6] protection policies. Both involve an analysis of the software’s Control Flow Graph (CFG) to distinguish between valid and invalid branch-targets. Typically, forward-edge protection is implemented via compiler-generated checks inserted into the code. If a control flow transition is found that deviates from the intended CFG, the program is terminated. Forward-edge protection is currently implemented in some products.
Backward-edge transitions follow specified call conventions and processor behavior and are thus usually suitable for hardware enforcement techniques. One mechanism for backward-edge protection is Pointer Authentication [8]. When the processor executes a function call, a cryptographic signature, called a PAC (Pointer Authentication Code), is appended to the return address pointer. The PAC is then verified whenever a protected pointer is dereferenced. If the verification is successful, then program execution continues, else the processor traps to an integrity error handler.
Control-data attacks are almost always only the initial attack to a system, enabling further compromise. One major use-case for these attacks is to disable memory protection technologies such as Data Execution Prevention (DEP). This can facilitate easier exploitation and more persistent modification of the system. Once DEP is disabled, the code can be corrupted and remain active on a system until the afflicted system component is terminated. In particular, in cases where the OS kernel is attacked, the system is compromised until rebooted. For this reason, additional measures should be applied to prevent the execution of maliciously modified code or to detect that a system or component was compromised, in order to trigger additional remediation actions. There already are advanced integrity
assessment solutions that detect integrity compromises of OS code and even OS configuration when the code itself is not corrupted [25].
### 3.2.2 Data Flow Integrity
Similar to CFI, Data Flow Integrity (DFI) protects software execution flows and enforces a runtime-policy that prevents malicious attacks leveraging of the program's CFG. These attacks are called non-control data attacks, and their major distinction from control-data attacks is that they limit themselves to the modification of data only. No code pointers are modified. In general, different security-critical data structures are subject to non-control data attacks, such as configuration data, user input data, user identity data, and decision-making data. Passwords and private keys, randomized values or system call parameters are also potential targets for non-control-data attacks.
Systematic manipulation of the non-control data can lead to confidentiality leaks, privilege escalation attacks, or arbitrary code execution. These outcomes are made possible by intelligent manipulation of data used in different control-structures such as if-statements, loops or assignments. In contrast to control-data attacks, only legitimate execution flows are used.
There have been different non-control-data attacks in the past. Root-kits that target the OS kernel often rely on systematic manipulation of data-structures. One prominent example in this regard is process-hiding, which refers to making a malicious user-space process invisible or seemingly benign to the user and administrator of a system to avoid its detection [18, 19].
DFI protects against non-control data attack exploitation techniques during runtime. Two countermeasures are available for use in implementing a DFI policy: Data Flow Graph DFG [9] and Dynamic Taint Analysis (DTA) [10, 11]. These two approaches are similar to CFI methods, but in this case the data flow is monitored instead of the control flow. In principle, both approaches model legitimate data transitions and detect deviation from these models. Both solutions induce high overhead. At time of writing, these approaches are active areas of research.
### 3.2.3 Memory Corruption Prevention
Control-data and non-control-data attacks always rely on an initial exploitation to subvert or leverage the control-flow of software. CFI or DFI policies do not prevent the initial exploitation of a vulnerability, e.g. overflow a buffer to write arbitrary values to memory; instead they employ mechanisms to detect or prevent execution after the initial attack. Memory Corruption Prevention establishes policies that prevent the initial attack, i.e., corruption of relevant control or non-control-data structures. Consequently, without the initial memory corruption, the actual attack does not occur.
Unmanaged programming languages, such as C or C++, that do not enforce strict bounds-checking on memory operations and pointer-dereferencing policies, are particularly susceptible to memory corruption. There are various software or hardware countermeasures that can reduce these vulnerabilities in unmanaged programming languages. Typically, hardware implementations provide significantly higher performance and security guarantees. Software-based techniques originate from concepts for type-safe C [14]. For instance, several existing products implement fat-pointers that, in addition to a normal address pointer, contain meta-data used for enforcing bounds-checking that provides full or partial spatial memory safety. Hardware-based countermeasures are also available, for instance Hardbound [15] and, most recently, CHERI [16]. CHERI implements strict bounds-checking on the basis of introduced capabilities and further enhances the protection of arbitrary data-structures in memory.
4 RUNTIME INTEGRITY PRESERVATION RECOMMENDATIONS
This section lists recommendations for RIP. The tags (e.g., “def_auth_state”) used below are for convenience of the reader and allow backward references from a given recommendation/rationale to a previous one. This list of recommendations is designed to consider all of the runtime integrity mechanisms described above in section 3.
4.1 Recommendations for RIP Security Policy
- Recommendation [def_auth_state]: The manufacturer of a mobile device should provide an unambiguous definition of valid mobile device runtime states and the entities authorized to update these state definitions.
- Rationale [def_auth_state]: The secure boot process ensures that the mobile device is initially in an authorized runtime state. However, following secure boot, the mobile device will modify data areas as software executes. Some mobile devices might allow firmware over-the-air updates that modify the system software. Most mobile devices allow application software to be loaded and executed at runtime. The RIP mechanisms must take into account which of these state modifications are permissible, so the mechanisms can determine when the mobile device’s runtime integrity has been compromised.
- Recommendation [resp_policy]: The manufacturer of a secure mobile device should specify the appropriate responses to detection of each runtime integrity compromise in a RIP Security Policy.
- Rationale [resp_policy]: If an RIP mechanism detects a compromise of the mobile device’s runtime integrity, then the RIP mechanism can initiate remediation actions. For example, in some cases, these actions might involve requesting that the operating system terminate a process. In other cases, the mobile device can be reset.
4.2 Recommendations for Pre-boot Integrity
- Recommendation [rip_preboot]: The mobile device architecture and implementation should protect RIP mechanisms both prior to and during boot either by:
- Inherent integrity protection (e.g. implemented in ROM or other immutable hardware); or
- Explicit integrity protection (e.g. measured boot with RoT-based validation).
- Rationale [rip_preboot]: If the RIP mechanisms are not integrity protected prior to and during boot, then there cannot be any assurance that the mobile device state is integrity protected. The RIP mechanisms can be implemented hierarchically, with each RIP mechanism layer protected by the layer below. This hierarchy is protected by an inherently integrity protected layer.
4.3 Recommendations for Runtime Integrity Enforcement
- Recommendation [preserve_policy]: The mobile device should incorporate mechanisms that preserve the integrity of the mobile device firmware and software in accordance with mobile device security policy.
- Rationale [preserve_policy]: Although the initial state of the mobile device is ensured via Secure Boot, various malicious attacks or software or hardware flaws could later compromise the mobile device’s runtime state. Runtime integrity preservation mechanisms provide countermeasures that protect mobile device integrity following Secure Boot.
- Recommendation [preserve_rots]: The mobile device should protect the runtime integrity of RoTs.
- Rationale [preserve_rots]: See Rationale [preserve_policy].
- Recommendation [protect_pe]: RIP mechanisms outside the Protected Environment (PE) should protect the integrity of the entire PE firmware as well as code, runtime data, and trusted applications in the PE.
- Rationale [protect_pe]: The mobile device can include RIP mechanisms outside the PE (for example hardware or microcode) to enforce the integrity of the PE.
Committee Recommendation [protect_rip]: The mobile device architecture and implementation should protect the integrity of the RIP mechanisms from untrusted software or hardware.
- Rationale [protect_rip]: See Rationale [protect_pe].
### 4.4 Recommendations for Runtime Integrity Assessment
- **Recommendation [rip_assessment]**: The mobile device architecture and implementation should use RIP mechanisms to assess the mobile device firmware, software, and configuration state.
- Rationale [rip_assessment]: See Rationale [preserve_policy]
- **Recommendation [std_crypto]**: Runtime integrity measurement mechanisms should use international standard cryptographic algorithms [17] and should avoid the use of proprietary cryptographic algorithms when collecting integrity measurements.
- Rationale [std_crypto]: Proprietary cryptographic algorithms often have unrecognized flaws that can allow an attacker to circumvent the integrity assessment. International cryptographic standards have been widely analyzed, and are far less likely to have such flaws.
- **Recommendation [ref_metric_authenticity]**: The RIP mechanisms should verify the authenticity of all reference metrics.
- Rationale [ref_metric_authenticity]: The RIP detection mechanisms can be compromised if an attacker could substitute reference metrics that match altered software.
- **Recommendation [ref_metric_protect]**: The RIP mechanisms should protect the integrity of all runtime integrity reference metrics at all times.
- Rationale [ref_metric_protect]: See Rationale [ref_metric_authenticity].
- **Recommendation [rip_audit_log]**: The RIP mechanisms should record the time and date of any modification to RIP-protected code, data, or keys in an audit log.
- Rationale [rip_audit_log]: The RIP Security Policy can allow portions of the integrity-protected mobile device state to be updated at runtime, but the update process could be subverted to install malicious software/firmware or configuration data. Recording all updates in an audit log allows for forensic analysis.
- **Recommendation [fresh_ref_metrics]**: The RIP mechanisms should calculate fresh reference metrics (except where precomputed hashes apply to unchanged protected regions) during Secure Boot or as soon as possible thereafter.
- Rationale [fresh_ref_metrics]: See Rationale [ref_metric_authenticity]
- **Recommendation [protect_confidentiality]**: All RIP mechanisms implemented by the mobile device should prevent the exposure of confidential data during the execution of RIP mechanisms.
- Rationale [protect_confidentiality]: The RIP assessment mechanisms could access confidential data (e.g. keys) that would normally be inaccessible. This recommendation prevents the vulnerabilities caused by RIP mechanisms themselves.
- **Recommendation [protect_measurements]**: RIP assessment measurements should be integrity-protected until verified against reference metrics.
- Rationale [protect_measurements]: See Rationale [ref_metric_authenticity]
- **Recommendation [policy_compromise_log]**: If the RIP mechanisms detect an integrity failure in hardware or software used for Security Policy enforcement, then the RIP mechanisms should log this failure in access-protected nonvolatile storage.
- Rationale [policy_enforcement_log]: An integrity failure in the support hardware or software for Security Policy enforcement could be an indication that the Security Policy is no longer being enforced, and the mobile device is compromised.
- Recommendation [on_demand_int_assessment]: The RIP mechanisms should support triggering of an on-demand integrity assessment.
- Rationale [on_demand_int_assessment]: A fresh integrity assessment could be necessary to increase security assurance for security-critical operations such as financial transactions or to respond to an externally requested attestation.
4.5 Recommendations for Runtime Integrity Remediation
- Recommendation [initiate_remediation]: If the RIP remediation mechanism receives an alert from the RIP assessment mechanism, then the RIP remediation mechanism should initiate the remediation action specified by the RIP Security Policy.
- Rationale [initiate_remediation]: The RIP remediation mechanism is the ideal entity to receive RIP assessment mechanism alerts and directly initiate remediation actions.
- Recommendation [alert_system]: If the RIP remediation mechanism receives an alert from the RIP assessment mechanism, then the RIP remediation mechanism should send an alert to the affected system software.
- Rationale [alert_system]: In some cases the RIP mechanism cannot initiate the remediation action by itself, so the RIP mechanism needs to forward the alert to accomplish remediation.
4.6 Recommendations for Control Flow Integrity Preservation
- Recommendation [forward_edge]: The mobile device architecture and implementation should enforce a forward-edge protection policy that checks all control flow transfers during execution.
- Rationale [forward_edge]: The execution control flow can be altered by manipulating function address pointers during runtime, so it is insufficient to enforce integrity of the static code image.
- Recommendation [backward_edge]: The mobile device architecture and implementation should enforce a backward-edge protection policy that checks all control flow transfers implicitly during execution.
- Rationale [backward_edge]: The execution control flow can be altered by manipulating return addresses during runtime, so it is insufficient to enforce integrity of the static code image.
4.7 Recommendations for Data Flow Integrity Preservation
- Recommendation [data_flow_integrity]: The mobile device architecture and implementation should host software that enforces a data flow integrity policy [20] by checking data flow transfers during execution.
- Rationale [data_flow_integrity]: The data flow can be altered by manipulating data and data pointers during runtime. Compile-time analysis can insert runtime integrity protection code inline in software images.
5 PERFORMANCE OF RIP MECHANISMS
Assessing the integrity of data objects in mutable storage (e.g. RAM) at runtime is an active process that consumes resources, e.g. energy (battery power), processor cycles, and memory bus cycles. If these resources are shared with other software processes, then an integrity assessment slows down other software processes. There is an inherent tradeoff between latency and resource consumption. If more frequent integrity assessments are performed, then this slows down other software processes. If less frequent integrity assessments are performed, then there will be greater latency in detecting an integrity failure. Naturally the impact of this tradeoff is situation dependent. For instance, when a mobile device is engaged in a high-value activity such as a financial transaction reduced detection latency is more desirable than reduced resource consumption. If the mobile device is simply streaming a movie, then the opposite tradeoff might be favored.
5.1 Dedicated RIP Hardware
RIP mechanisms can rely on hardware that is dedicated to their functions. Such hardware can offer advantages in terms of performance and integrity of the RIP implementation. Performance could be improved because integrity assessment does not require processing within main processors, leaving more cycles available for other activities. Integrity could be improved because the RIP hardware is immutable and hence impervious to malicious modification.
For example, a dedicated RIP hardware mechanism can read selected portions of memory, compute a hash over that data, and compare the newly computed hash result to a stored reference metric. If there is a mismatch, the RIP hardware mechanism can invoke the remediation actions dictated by RIP Security Policy.
|
{"Source-Url": "https://trustedcomputinggroup.org/wp-content/uploads/TCG_MPWG_RIP_r106_published.pdf", "len_cl100k_base": 9255, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 57184, "total-output-tokens": 11562, "length": "2e13", "weborganizer": {"__label__adult": 0.000766754150390625, "__label__art_design": 0.0005331039428710938, "__label__crime_law": 0.002223968505859375, "__label__education_jobs": 0.000728607177734375, "__label__entertainment": 0.00012731552124023438, "__label__fashion_beauty": 0.0003325939178466797, "__label__finance_business": 0.0006089210510253906, "__label__food_dining": 0.0004127025604248047, "__label__games": 0.0019168853759765625, "__label__hardware": 0.03558349609375, "__label__health": 0.0007586479187011719, "__label__history": 0.0003554821014404297, "__label__home_hobbies": 0.00022852420806884768, "__label__industrial": 0.001140594482421875, "__label__literature": 0.0003402233123779297, "__label__politics": 0.0004069805145263672, "__label__religion": 0.0006456375122070312, "__label__science_tech": 0.209228515625, "__label__social_life": 0.00010830163955688477, "__label__software": 0.031585693359375, "__label__software_dev": 0.71044921875, "__label__sports_fitness": 0.0004351139068603515, "__label__transportation": 0.0007700920104980469, "__label__travel": 0.000194549560546875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 56379, 0.02961]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 56379, 0.61893]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 56379, 0.85484]], "google_gemma-3-12b-it_contains_pii": [[0, 160, false], [160, 1738, null], [1738, 4132, null], [4132, 8423, null], [8423, 11719, null], [11719, 15001, null], [15001, 16841, null], [16841, 20672, null], [20672, 24565, null], [24565, 28970, null], [28970, 32850, null], [32850, 36643, null], [36643, 41076, null], [41076, 44865, null], [44865, 48521, null], [48521, 51797, null], [51797, 54597, null], [54597, 56379, null]], "google_gemma-3-12b-it_is_public_document": [[0, 160, true], [160, 1738, null], [1738, 4132, null], [4132, 8423, null], [8423, 11719, null], [11719, 15001, null], [15001, 16841, null], [16841, 20672, null], [20672, 24565, null], [24565, 28970, null], [28970, 32850, null], [32850, 36643, null], [36643, 41076, null], [41076, 44865, null], [44865, 48521, null], [48521, 51797, null], [51797, 54597, null], [54597, 56379, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 56379, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 56379, null]], "pdf_page_numbers": [[0, 160, 1], [160, 1738, 2], [1738, 4132, 3], [4132, 8423, 4], [8423, 11719, 5], [11719, 15001, 6], [15001, 16841, 7], [16841, 20672, 8], [20672, 24565, 9], [24565, 28970, 10], [28970, 32850, 11], [32850, 36643, 12], [36643, 41076, 13], [41076, 44865, 14], [44865, 48521, 15], [48521, 51797, 16], [51797, 54597, 17], [54597, 56379, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 56379, 0.08812]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
8ecf34a00ed5f057d343d5d78d06f75d95684a05
|
(51) International Patent Classification: G06F 17/30
(21) International Application Number: PCT/EP99/04703
(22) International Filing Date: 2 July 1999 (02.07.99)
(71) Applicant: KONINKLIJKE PHILIPS ELECTRONICS N.V. [NL/NL]; Groenewoudseweg 1, NL-5621 BA Eindhoven (NL).
(72) Inventor: DASGUPTA, Aninda; Prof. Holstlaan 6, NL-5656 AA Eindhoven (NL).
(54) Title: MODIFIABLE UNIVERSAL RESOURCE LOCATORS (MURLS)
(57) Abstract
This invention facilitates the relocation of a hypertext document and objects referenced by hypertext items. The Universal Resource Locators (URLs) in a hypertext document are identified and assessed. A modifiable URL is a URL that is associated with an object that has been relocated, or with an object that will be relocated when the hypertext document is relocated. Each modifiable URL in the document is modified to reflect the relocation of each object, and each object that has not yet been relocated is relocated. If any relocated object is another hypertext document, this other document is similarly processed to identify and update each modifiable URL, each object requiring relocation is relocated, and each relocated hypertext document is subsequently similarly processed.
FOR THE PURPOSES OF INFORMATION ONLY
Codes used to identify States party to the PCT on the front pages of pamphlets publishing international applications under the PCT.
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>AL</td>
<td>Albania</td>
<td>ES</td>
<td>Spain</td>
<td>LS</td>
<td>Lesotho</td>
</tr>
<tr>
<td>AM</td>
<td>Armenia</td>
<td>FI</td>
<td>Finland</td>
<td>LT</td>
<td>Lithuania</td>
</tr>
<tr>
<td>AT</td>
<td>Austria</td>
<td>FR</td>
<td>France</td>
<td>LU</td>
<td>Luxembourg</td>
</tr>
<tr>
<td>AU</td>
<td>Australia</td>
<td>GA</td>
<td>Gabon</td>
<td>LV</td>
<td>Latvia</td>
</tr>
<tr>
<td>AZ</td>
<td>Azerbaijan</td>
<td>GB</td>
<td>United Kingdom</td>
<td>MC</td>
<td>Monaco</td>
</tr>
<tr>
<td>BA</td>
<td>Bosnia and Herzegovina</td>
<td>GE</td>
<td>Georgia</td>
<td>MD</td>
<td>Republic of Moldova</td>
</tr>
<tr>
<td>BB</td>
<td>Barbados</td>
<td>GH</td>
<td>Ghana</td>
<td>MG</td>
<td>Madagascar</td>
</tr>
<tr>
<td>BE</td>
<td>Belgium</td>
<td>GN</td>
<td>Guinea</td>
<td>MK</td>
<td>The former Yugoslav</td>
</tr>
<tr>
<td>BF</td>
<td>Burkina Faso</td>
<td>GR</td>
<td>Greece</td>
<td>ML</td>
<td>Mali</td>
</tr>
<tr>
<td>BG</td>
<td>Bulgaria</td>
<td>HU</td>
<td>Hungary</td>
<td>MN</td>
<td>Mongolia</td>
</tr>
<tr>
<td>BJ</td>
<td>Benin</td>
<td>IE</td>
<td>Ireland</td>
<td>MR</td>
<td>Mauritania</td>
</tr>
<tr>
<td>BR</td>
<td>Brazil</td>
<td>IL</td>
<td>Israel</td>
<td>MW</td>
<td>Malawi</td>
</tr>
<tr>
<td>BY</td>
<td>Belarus</td>
<td>IT</td>
<td>Italy</td>
<td>MX</td>
<td>Mexico</td>
</tr>
<tr>
<td>CA</td>
<td>Canada</td>
<td>JP</td>
<td>Japan</td>
<td>NE</td>
<td>Niger</td>
</tr>
<tr>
<td>CF</td>
<td>Central African Republic</td>
<td>KE</td>
<td>Kenya</td>
<td>NL</td>
<td>Netherlands</td>
</tr>
<tr>
<td>CG</td>
<td>Congo</td>
<td>KG</td>
<td>Kyrgyzstan</td>
<td>NO</td>
<td>Norway</td>
</tr>
<tr>
<td>CH</td>
<td>Switzerland</td>
<td>KP</td>
<td>Democratic People’s Republic of Korea</td>
<td></td>
<td></td>
</tr>
<tr>
<td>CI</td>
<td>Côte d’Ivoire</td>
<td>KR</td>
<td>Republic of Korea</td>
<td></td>
<td></td>
</tr>
<tr>
<td>CM</td>
<td>Cameroon</td>
<td>LC</td>
<td>Saint Lucia</td>
<td></td>
<td></td>
</tr>
<tr>
<td>CN</td>
<td>China</td>
<td>LI</td>
<td>Liechtenstein</td>
<td></td>
<td></td>
</tr>
<tr>
<td>CU</td>
<td>Cuba</td>
<td>LK</td>
<td>Sri Lanka</td>
<td></td>
<td></td>
</tr>
<tr>
<td>CZ</td>
<td>Czech Republic</td>
<td>LR</td>
<td>Liberia</td>
<td></td>
<td></td>
</tr>
<tr>
<td>DE</td>
<td>Germany</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>DK</td>
<td>Denmark</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>EE</td>
<td>Estonia</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>SI</td>
<td>Slovenia</td>
<td>SK</td>
<td>Slovakia</td>
<td></td>
<td></td>
</tr>
<tr>
<td>SN</td>
<td>Senegal</td>
<td>SZ</td>
<td>Swaziland</td>
<td></td>
<td></td>
</tr>
<tr>
<td>TD</td>
<td>Chad</td>
<td>TG</td>
<td>Togo</td>
<td></td>
<td></td>
</tr>
<tr>
<td>TJ</td>
<td>Tadjikistan</td>
<td>TM</td>
<td>Turkmenistan</td>
<td></td>
<td></td>
</tr>
<tr>
<td>TR</td>
<td>Turkey</td>
<td>TT</td>
<td>Trinidad and Tobago</td>
<td></td>
<td></td>
</tr>
<tr>
<td>UA</td>
<td>Ukraine</td>
<td>UG</td>
<td>Uganda</td>
<td></td>
<td></td>
</tr>
<tr>
<td>US</td>
<td>United States of America</td>
<td>VN</td>
<td>Viet Nam</td>
<td></td>
<td></td>
</tr>
<tr>
<td>UZ</td>
<td>Uzbekistan</td>
<td>YU</td>
<td>Yugoslavia</td>
<td></td>
<td></td>
</tr>
<tr>
<td>ZW</td>
<td>Zimbabwe</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Modifiable universal resource locators (MURLs).
Field of the Invention
This invention relates generally to the field of computers and communication, and in particular to the transfer of documents and objects that contain references to other documents and objects.
Background of the Invention
Hypertext and its equivalents have become commonplace in computer documents. A hypertext item is an item that can be used to access additional documents or other computer objects. For example, in a document that addresses radio communications, Marconi's name may appear highlighted on the computer display, the highlighting indicating that Marconi's name is a hypertext item. If the reader of the document selects the highlighted text, Marconi's biography may appear on the display. Similarly, hyperlinks may display Marconi's image, or perhaps a video or audio clip.
Hypertext is implemented by associating a reference locator to the hypertext item. When the hypertext item is selected, the object that is located at the location indicated by the reference locator is displayed or executed. That is, in general, the reference locator may point to another document, an image file, etc. or it may point to a program that plays the video clip. The reference locator is commonly termed a "Universal Resource Locator" ("URL"), and the programming language used to embed hypertext and the associated URLs into a document is termed the "HyperText Markup Language" ("HTML"). A typical example of a hypertext entry is:
The invention of <A HREF= "gifs/radio.gif"> radio </A> is credited to <A HREF= "http://www.encyclopedia.com/inventors/marconi.html"> Marconi </A>.
The "<A>" and "</A>" entries define the beginning and end of the hypertext entry. This example shows two hypertext entries, one for "radio" and one for "Marconi". The "HREF=" entries define the URL associated with each of the hypertext entries. Because the words radio and Marconi are contained within the hypertext bounds, they will be displayed by an HTML
processing program as highlighted text. The URLs are not displayed. When a user selects the text "Marconi", the program will open the file that is named "marconi.htm" that is located in the file directory "inventors" on the machine named "www.encyclopedia.com" on the world wide web ("http://"). When the user selects "radio" the program will open the file named "radio.gif" in the file directory "gifs" within the current file directory of the current machine. That is, because the URL associated with "radio" does not specify a particular machine name, the specified file name is relative to the location of the document being processed. Conversely, the address associated with "Marconi" is absolute, and independent of the location of the document that contains this reference.
The use of absolute references allows the document containing the references to be located anywhere and still provide access to the referenced URL. It requires, however, that the absolute reference be known and specified at the time the document is created. Relative addressing, on the other hand, allows the reference locators to be dynamically determined, based upon the location of the document. If the document is a part of a large suite of documents and objects, relative addressing is typically preferred, because it allows the suite of documents and objects to be located on different machines without modification of the reference locators. That is, for example, if the above example document is always located in a file directory that includes a file sub-directory named "gifs" that contains the object "radio.gif", the above HTML example for the "radio" hypertext will operate properly regardless of where the file directory that contains the document and "gifs" is located, and does not require an a priori absolute reference to "radio.gif". That is, "radio.gif" can be relocated as required, without requiring a modification to the HTML reference, provided that it maintains the same file directory relationship with the document. Conversely, if the file "marconi.htm" is relocated, all documents that contain an absolute reference to this file must be modified.
Further compounding the problems associated with reference locators is that the author of an HTML document typically authors the document on one computer system, while the viewing, or browsing, of the document is intended for a different computer system. Relative reference locators, for example, require that the file structure of the destination computer system be the same as that of the authoring computer system. That is, in the "radio" example, both the authoring system and the destination system must be configured such that the file "radio.gif" is within a directory called "gifs" that is in the same directory as the document. Often, however, a file structure suitable for authoring a document is an inefficient file structure for reading or browsing documents. A general purpose authoring system, for
example, may be structured to have a directory called "pictures" that contains directories "gifs", "avi" and "mpg", corresponding to different forms of images that may be included in an authored document. The "gifs" directory may contain directories "people", "places", and "things", corresponding to the different types of "gifs" available, in terms of content. The file "radio.gif" may be located, for example, within the directory "pictures/gifs/things". Such a structure allows an author to pick and choose from a variety of objects for inclusion in a particular hypertext document. The destination system, on the other hand, may be a commercial web service machine, and a storage fee may be charged that is dependent upon the number of objects stored on the machine, or the number of file directories utilized. In this case, it would be inefficient and costly to copy the entire directory structure of the authoring system onto the commercial web service machine. To ease the migration of the authored system to a destination system, the author may structure a file system that conforms to the intended destination system and transfer each object that is referenced into this file structure. This approach, however, virtually eliminates the ease of use provided by the general purpose authoring file structure. To ease the authoring task, on the other hand, the author may use the general purpose authoring file structure, but thereafter be required to modify each hypertext documents to conform to the destination file structure and also transfer each of the referenced objects and files from the authoring system to the destination file structure. In either case, the movement of hypertext documents is problematic, due to the use of URLs in the conventional manner.
The MIME format has been developed to facilitate the transfer of hypertext documents. In accordance with the MIME format, when a reference locator is found in a document, the object that corresponds to the reference locator is encoded and embedded directly into the document. The resultant document can become significantly large, and requires a subsequent MIME decoding upon receipt into a format compatible for viewing. Although the MIME format is robust, the encoding and decoding process introduces additional overhead processing costs and time, and may not necessarily be compatible with all current and future forms of information transfer.
Therefore, a need exists for a method and apparatus for relocating hypertext documents that efficiently and effectively makes the adjustments required for both relative and absolute reference locators in the hypertext document. A need also exists for a method and apparatus for relocating the objects that are referenced in a relocated hypertext document, so as to correspond to the adjusted relative and absolute reference locators in the relocated hypertext document. A need also exists for a method and apparatus that provides for the
transfer of hypertext documents and referenced objects with minimal intermediate processing or encoding.
In general, the invention facilitates the relocation of a hypertext document and objects referenced by hypertext items through the use of Modifiable Uniform Reference Locators (MURLs). The URLs in a hypertext document are identified and assessed. A modifiable URL is a URL that is associated with an object that has been relocated, or with an object that will be relocated when the hypertext document is relocated. Each modifiable URL in the document is modified to reflect the relocation of each object, and each object that has not yet been relocated is relocated. If any relocated object is another hypertext document, this other document is similarly processed to identify and update each modifiable URL, each object requiring relocation is relocated, and each relocated hypertext document is subsequently similarly processed.
Brief Description of the Drawings
FIG. 1 illustrates a flow-diagram for processing a hypertext document in accordance with this invention.
FIG. 2 illustrates a flowchart for processing a hypertext document in accordance with this invention.
FIG. 3 illustrates an example block diagram of a system for transferring hypertext documents in accordance with this invention.
FIGs. 4A-4C illustrate a modification of reference locators within a hypertext document in accordance with this invention.
Detailed Description of the Preferred Embodiment
FIG. 1 illustrates a flow diagram of an embodiment of this invention. A parser 110 analyzes a document 100 to identify modifiable reference locators 115. An example modifiable reference locator 115 is shown as REF 1 in the document 100. An address determinator 130 determines a new reference locator 135, for each modifiable reference locator 115. In FIG. 1, REF 2 is the new reference locator 135 corresponding to the object referenced by REF 1. A reference replacer 120 replaces the modifiable reference locator REF 1 in document 100 with the new reference locator REF 2, forming a modified document 100'. If the object 150 that is referenced by REF 1 is not yet moved to REF 2, a data transferrer 140 transfers the object 150, or a copy of the object 150, to REF 2, shown in FIG. 1 as object 150'.
Each modifiable reference locator that is contained in the document 100 is similarly identified and replaced, and each referenced object is relocated as required.
In accordance with another aspect of this invention, the parser 110 also identifies which of the objects 150 are documents, which may contain references to other objects. The parser 110 maintains a list of such documents and sequentially processes each of the documents. In this manner all hypertext items related to the original document are automatically processed, all referenced objects are relocated as required, and all modifiable URLs are updated accordingly. To resolve relative references, the aforementioned list of documents contains the file directory location of the parent document that references each document.
The parser 110 determines which reference locators are modifiable. This can be effected in a variety of means. The most direct means is for the author of the document to explicitly identify each modifiable reference locator, for example, by using a unique identifier, such as "MREF=" in lieu of the conventional "HREF=". Alternatively, the parser 110 can prompt the user of this invention for a determination, each time a new reference locator is found in the document. The parser 110 may also use default rules, such as to consider all reference locators as modifiable, except those that contain an absolute reference to a World Wide Web (www) location.
The address determinator 130 determines a new reference locator for each modifiable reference locator 115 identified by the parser 110. This can be effected in a variety of means. The most direct is to prompt the user of this invention for each new reference locator. Alternatively, the address determinator 130 may use default rules, such as to append the object file name on the source system to a current parent file directory on the destination system. That is, for example, if the object 150 is a file "object1.gif", having a reference locator of "path1/object1.gif", the object 150 will be assigned a new reference locator of "path2/object1.gif". In this example, "path1" is the file directory at which the object file is located, and "path2" is the file directory at which the object file, or copy of the object file, is to be located. In this manner, the user need only identify the reference locator for "path2" and default names for all subsequent new reference locators will be automatically generated. If a conflict arises using the default names, for example because two different objects produce the same default name, or because the default name is invalid on the destination system, the user is prompted to resolve the conflict. To avoid such conflicts, the address determinator 130 can be configured to create unique and valid names for each new reference locator, such as "path2/obj$001", "path2/obj$002", etc. Alternatively, the destination system may provide a
utility function that generates unique locator names, and the address determinator 130 need only call this utility function. The address determinator 130 maintains a list of corresponding source and destination reference locators, so that if the document 100 contains multiple occurrences of the same modifiable reference locator 115, the same new reference locator 135 will be provided for each occurrence.
The data transferrer 140 transfers the object 150 at the source location corresponding to the modifiable reference locator 115 to the destination location corresponding to the new reference locator 135. The transfer may be effected in a variety of means. In a "client-push" implementation, the data transferrer 140 is located at the source system and initiates a transfer of the object to the destination system. In a "client-pull" implementation, the data transferrer 140 is located at the destination system, and initiates a request for transfer of the object from the source system. In a preferred embodiment, the transfer of each object is effected automatically, upon receipt of the modifiable reference locator 115 from the parser 110, and the new reference locator 135 from the address determinator 130. Alternatively, the user may be provided a list of objects that require transfer, or may be prompted for each object transfer. In a preferred embodiment, the data transferrer 140 maintains a list of transferred objects, to minimize redundant transfers for multiple occurrences of the same modifiable reference locator 115.
Note that in accordance with this invention, the hypertext document and each of the objects referenced by reference locators are transferred to a destination system in substantially the same form as they exist on the source system, obviating the need for special purpose encoders or decoders in this transfer process. Note also that, because the document and objects are transferred in the same form as on the source system, the same programs and processes used to view the document and objects on the source system can be used on the destination system with a minimal risk of an incompatibility being introduced by the transfer process.
FIG. 2 illustrates a flowchart for processing hypertext documents in accordance with this invention. The document is received at 210, and is processed via the loop 220-280. At 220-230, the document is parsed until a modifiable reference locator is found in the document. A new reference locator corresponding to the modifiable reference locator is determined at 240. As discussed above, if a new reference locator has already been determined corresponding to the current modifiable reference locator, this same new reference locator is determined at 240. The current modifiable reference locator is replaced by the new reference locator at 250. At 260-270, if the object that is referenced by the modifiable reference locator
is not located at the new reference locator, the object, or a copy of the object, is placed there. If
the referenced object is a document, or any data set which may contain reference locators, the
object is placed on a document list for subsequent processing at 280. Each document in the
document list is similarly processed, starting at 210, and ending when the entire document is
parsed and processed via loop 220-280. As would be evident to one of ordinary skill in the art,
the flowchart of FIG. 2 may be implemented as a recursive function. When an object is
identified as a document, at 280, the recursive processing function can be initiated for this
object document, thereby obviating the need to maintain a document list.
FIG. 3 illustrates an example block diagram of a system for transferring
hypertext documents in accordance with this invention, comprising two computer systems
380, 390 and a web server 300. In this example, computer system 380 is the authoring system,
whereat the hypertext document 382 and objects 384 referenced by modifiable reference
locators are created and/or stored. For this example, the terms Universal Resource Locator
(URL) and Modifiable URL (MURL) are used as particular examples of reference locators.
After completing the authoring task, the author transfers the document 382 and objects 384 to
the web server 300, for access by others, termed recipients. The Web server 300 receives the
document 382 from the computer system 380, via the receiver 310, and communicates the
document 382 to the reference replacer 320. The reference replacer 320 parses the document
382 to identify MURLs within the document. To replace an MURL, the reference replacer 320
replaces the MURL in the document 382 with a new reference locator (URL) 334 that is
provided by the reference locator determinator 330. The modified document 382 is stored in a
memory 350 at the web server 300.
The reference replacer 320 communicates the MURL 324 and the URL 334 to
the data transfferrer 340. If the object that is referenced by the MURL 324 has not yet been
placed at the URL 334, the data transferrer 340 receives the object 384 from the computer
system 380, via the receiver 310. For clarity, the received object is identified as object 314 in
FIG. 3. As shown, the memory 350 of the web server 300 has memory blocks 354, 356, 358
for storing objects, each block being addressed by a URL (URL1, URL2, URL3, etc.). The
reference locator determinator 330 allocates one of the available URLs of the web server 300
as the new reference locator URL 334, and the data transferrer 340 transfers the object 314 to
the memory 350 for storage at the corresponding URL1, URL2, URL3, etc.
Also shown in FIG. 3 is a communication with a computer system 390. In this
example, computer system 390 is termed the destination system, to illustrate the transfer of a
hypertext document from a computer system 380 to a computer system 390 via a web server
300. A user of the invention may specify a destination path for the reference locator
determinator that is not contained within the memory 350 of the web server 300. When the
data transferrer 340 receives a URL 334 that is not local to the web server 300, it establishes a
communication link with the destination system and transmits each object 314 to the
destination system via the transmitter 360. The transmitter 360 also transmits the document
322 to the destination system, after the reference replacer replaces each of the MURLs 324
with a corresponding URL 334. The destination system, in this example computer system 390
receives the document 322, which for clarity is shown in FIG. 3 as received document 392; it
also receives the object 314 and stores it at the address corresponding to the URL 334, shown
as stored object 394 in FIG. 3. If a communications path cannot be established immediately
with the destination system, computer system 390, the document 322 and each object 314 may
be stored in the local memory 350 of the web server.
In a general case, the author at computer system 380 may transfer the document
382 and objects 384 to the web server 300 using the technique discussed above with regard to
web server storage. One or more other users may then access the web server 300 and transfer
the modified document 352 and the referenced objects in the memory 350 to their destination
computer systems 390 for local viewing. An example of this process is shown in FIGs. 4A-4C.
FIGs. 4A-4C illustrate a modification of reference locators within a hypertext
document in accordance with this invention. FIG. 4A is an authored document 400A, a letter
written as a hypertext document. The letter 400A contains two modifiable reference locators
410A and 420A. In this example, the reference locators 410A and 420A are identified by the
author as being modifiable by the use of the keyword "<A MREF=". The reference locator
410A references frames of a video recording. The frames are accessible via a reference to
"Frame0,0,0-Frame5,0,0" at a "videorecorder" that is at "Myhome", illustrating, for example, a
home computer system in which devices such as video recorders are accessible via a network
within the home. The reference locator 420A references a photograph stored as a "gif" image.
The photograph is accessible via a reference to "mikespill.gif" at a file directory "gifs" that is
on a "ct:" drive of a computer "PC" in the "Myhome" network. Conventionally, for another
user to access the referenced video frames and picture from this hypertext document 400A, the
other user would need a direct access to the network "Myhome" and the referenced
"videorecorder" and the referenced "PC" file structure leading to the "mikespill.gif". Also, at
the time the other user accessed the "videorecorder", the appropriate videotape would need to
be in the video recorder.
In accordance with one aspect of this invention, the document 400A and the objects referenced by each modifiable reference locator are uploaded to a web server. In this process, the modifiable reference locators 410A and 420A of the document 400A are modified to reflect the new locations of the referenced objects. The modified copy of document 400A is shown in FIG. 4B as document 400B, with modified reference locators 410B and 420B. As discussed previously, in accordance with one aspect of this invention, the objects referenced by the reference locators in the source document are placed at locations in the destination web server memory. In the example of FIGs. 4A-4B, the frames of the video recording that are referenced by the modifiable reference locator 410A is stored at reference locator 410B as an MPEG file "videofile.mpg" in a file directory "User1" of a "videoserver" on the machine "http://philips.com". If another user is given access to the "User1" directory of the referenced video server, the other user can view the video file that corresponds to the referenced frames on the "Myhome" video recorder. Once an object referenced by a modifiable reference locator is relocated to the location identified by the reference locator in the modified hypertext document, it need no longer reside at the source reference locator. That is, once the frames referenced by reference locator 410A are uploaded to the web server, the video recorder is no longer required to access the frames. Similarly, the photograph at reference locator 420A is uploaded to a reference locator 420B. Reference locator 420B identifies a file "imgfile.gif" at the "User1" file directory at "http://philips.com/var/spool/mail", illustrating, for example, a mail service at the web server. As noted above, once the object referenced by the reference locator 420A is uploaded to 420B, access to the "mikespfile.gif" file on the "Myhome" network is no longer required for another user to view the referenced photograph.
In accordance with another aspect of this invention, the document 400A or 400B and the objects referenced by each modifiable reference locator may be communicated to another computer system as shown in FIG. 4C. If the other computer system, the destination system, is in direct contact with the authoring computer system, the document 400A and the objects referenced by the reference locators 410A and 420A are transferred directly to the destination system. The reference locators 410A and 420A in document 400A are modified to be reference locators 410C and 420C in document 400C, in the same manner as discussed above with regard to an upload to a web server. Alternatively, if the document 400A and the objects referenced by each modifiable reference locator 410A and 420A are uploaded to the web server as document 400B and reference locators 410B and 420B, the authoring system and the destination system need not be in direct contact. The user at the destination system accesses the web server and either views the document 400B and the referenced objects on the
web server, or downloads the document 400B and the referenced objects to the destination system. By downloading the document 400B and the referenced objects, the user is able to repeatedly view the document and referenced objects without further access to the web server. The reference locators 410B and 420B are not expressly identified as modifiable reference locators. In a preferred embodiment of this invention, when the user initiates the download of the document 400B, the web server will prompt the user for authorization to download each object, and also allows the user to specify the destination location for each object, or to specify a default path name for all downloaded objects. If the user does not authorize the download of an object, the reference locator associated with that object is treated as a non-modifiable reference locator.
In the example of FIGs. 4B-4C, the frames of the video referenced by reference locator 410B are downloaded to an MPEG file "videofile.mpg" in a "downloads" file directory on the destination system's "c:" drive. The photograph referenced by 420B is downloaded to an "imgfile.gif" in the same "downloads" file directory. In this example, the file names of the source and destination reference locators are the same, illustrating the use of a default reference locator naming convention as discussed above. Note that if the destination system is configured to have devices such as a video recorder accessible via a reference locator, as in the authoring system, the destination reference locator 410C could refer to the video recorder, thereby providing for a download directly to the reference video recorder. In this manner, for example, if the authoring system and the destination system were in direct contact, the actual video recording could be transferred from one video recorder to the other, obviating the need to create and store an intermediate MPEG file.
The examples and illustrations discussed above are presented for illustrating purposes, and alternative embodiments and applications will be apparent to one of ordinary skill in the art. For example, the parsing and processing may be effected at either the source or destination system, and the transfer of the objects corresponding to the reference locators may be effected via techniques common in the art. Similarly, if the source system is easily contacted, for example the source and destination systems both being web servers, the actual transfer of the objects corresponding to the reference locators may not occur at the same time that the hypertext document is transferred. A system in accordance with the principles of this invention can be configured to allocate new reference locators to effect the hypertext document transfer, and then upload the referenced object when the document is accessed and the particular hypertext entry is first accessed. In this manner, only those objects that are selected at least once will actually be transferred to the destination system. These and other
variations will be recognized by one of ordinary skill in the art and are thus within the spirit and scope of this invention.
CLAIMS:
1. A method for relocating objects (150) comprising the steps of:
parsing (220) a document (100) for a first reference locator (<MURL>)
that references an object in a first file system (380);
determining a second reference locator (<URL>) that references a target
location (350, 392) in a second file system (300, 390);
placing a copy of the object (150', 354, 356, 358, 394) at the target location in
the second file system (300, 390)
replacing the first reference locator in the document (100', 352, 392) with the
second reference locator.
2. The method of claim 1, further including the step of:
removing the object from the first file system.
3. The method of claim 1, further including the step of:
establishing a communications link (310) with the first file system for receiving
the copy of the object.
4. The method of claim 1, further including the step of:
establishing a communications link (360) with the second file system for
communicating the copy of the object.
5. The method of claim 1, wherein the object is one of the following:
an audio message, a digital image, a video image, an audio-video recording, and
another document.
6. The method of claim 1, wherein the first file system is associated with one of
the following:
a personal computer system, a network computer, and a Web server.
7. The method of claim 1, wherein
the document is a Hypertext Markup Language (HTML) document, and the first
and the second reference locators are Universal Resource Locators (URLs).
8. A program containing instructions for execution by a computer, the program
comprising:
a parser (110) that parses a document (100) and identifies a first reference
(REF1) to an object (150);
an address determinator (130) that identifies a second reference (REF2);
a data transferrer (140) that receives the object and transfers it to the second
reference; and,
a reference replacer (120) that replaces the first reference with the second
reference.
9. The program of claim 8, wherein:
the first reference is to a first memory device (384) of a first computer (380),
and,
the second reference is to a second memory device (394) of a second computer
(390).
10. The program of claim 8, wherein
the document is a Hypertext Markup Language (HTML) document, and the first
and the second references are Universal Resource Locators (URLs).
11. A web-server (300) comprising:
a memory (350) for storing a plurality of objects (354, 356, 358), each object of
the plurality of objects being identified by a corresponding Universal Resource Locator
(URL),
a receiver (310) for receiving a document (382) from a first computer system
(380), the document containing at least one Modifiable Universal Resource Locator (MURL)
that identifies a source object (384) at the first computer system,
a data transferrer (340) that receives the source object at the at least one MURL
and stores it in a memory (350) at a destination URL (URL1, URL2, URL3), and
a reference replacer (320) that replaces the at least one MURL with the
destination URL in a copy (352) of the document (382).
12. The web-server of claim 11, further including:
a transmitter (360) for transferring the document (322) and the source object
(314) to a second computer system (390), and
a reference locator (330) for determining at least one remote locator (URL) for
storing the source object to the second computer system;
wherein the reference replacer (320) replaces the at least one MURL with the at
least one remote locator (URL).
INTERNATIONAL SEARCH REPORT
A. CLASSIFICATION OF SUBJECT MATTER
IPC 7 G06F.17/30
According to International Patent Classification (IPC) or to both national classification and IPC
B. FIELDS SEARCHED
Minimum documentation searched (classification system followed by classification symbols)
IPC 7 G06F
Documentation searched other than minimum documentation to the extent that such documents are included in the fields searched
Electronic database consulted during the international search (name of database and, where practical, search terms used)
C. DOCUMENTS CONSIDERED TO BE RELEVANT
<table>
<thead>
<tr>
<th>Category</th>
<th>Citation of document, with indication, where appropriate, of the relevant passages</th>
<th>Relevant to claim No.</th>
</tr>
</thead>
<tbody>
<tr>
<td>X</td>
<td>WEBER K: "Chapter 6, in which Pooh proposes improvements to Web authoring tools, having seen said tools for the Unix platform" COMPUTER NETWORKS AND ISDN SYSTEMS, vol. 27, no. 6, 1 April 1995 (1995-04-01), page 823-829 XP004013184 ISSN: 0169-7552 page 825, right-hand column, line 40 -page 826, left-hand column, line 5 page 829, right-hand column, line 18 - line 20</td>
<td>1-12</td>
</tr>
</tbody>
</table>
[X] Further documents are listed in the continuation of box C.
[X] Patent family members are listed in annex.
<table>
<thead>
<tr>
<th>Special categories of cited documents</th>
<th>Later document published after the international filing date or priority date and not in conflict with the application but cited to understand the principle or theory underlying the invention</th>
</tr>
</thead>
<tbody>
<tr>
<td>"A" document defining the general state of the art which is not considered to be of particular relevance</td>
<td>"X" document of particular relevance; the claimed invention cannot be considered novel or cannot be considered to involve an inventive step when the document is taken alone</td>
</tr>
<tr>
<td>"E" earlier document but published on or after the international filing date</td>
<td>"Y" document of particular relevance; the claimed invention cannot be considered novel or cannot be considered to involve an inventive step when the document is combined with one or more other such documents, such combination being obvious to a person skilled in the art</td>
</tr>
<tr>
<td>"L" document which may throw doubts on priority claim(s) or which is cited to establish the publication date of another citation or other special reason (as specified)</td>
<td>"S" document member of the same patent family</td>
</tr>
<tr>
<td>"O" document referring to an oral disclosure, use, exhibition or other means</td>
<td></td>
</tr>
<tr>
<td>"P" document published prior to the international filing date but later than the priority date claimed</td>
<td></td>
</tr>
</tbody>
</table>
Date of the actual completion of the international search | Date of mailing of the international search report
1 November 1999 | 12/11/1999
Name and mailing address of the ISA
European Patent Office, P.B. 5818 Patentlaan 2 NL - 2280 HV Rijswijk
Tel. (+31-70) 340-2040, Tx. 31 651 epo.nl,
Fax. (+31-70) 340-3016
Authorized officer
Fournier, C
Form PCT/ISA/210 (second sheet) (July 1992)
<table>
<thead>
<tr>
<th>Category</th>
<th>Citation of document, with indication, where appropriate, of the relevant passages</th>
<th>Relevant to claim No.</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>LEVITT J: "Managing your Web site" INFORMATIONWEEK, 19 FEB. 1996, CMP PUBLICATIONS, USA, no. 567, pages 62-64, 68 - 69, XP002121176 <a href="http://techweb.cmp.com">http://techweb.cmp.com</a> ISSN: 8750-6874 page 63, left-hand column, line 36 - line 64 page 64, left-hand column, line 16 - line 34 page 64, right-hand column, line 59 - page 68, left-hand column, line 2</td>
<td>1-12</td>
</tr>
<tr>
<td>A</td>
<td>TAKAHASHI K ET AL: "Analysis and design of Web-based information systems" COMPUTER NETWORKS AND ISDN SYSTEMS, vol. 29, no. 8-13, 1 September 1997 (1997-09-01), page 1167-1180 XP004095314 ISSN: 0169-7552 page 1173, left-hand column, paragraph 3 -page 1176, right-hand column, paragraph 3.2.47</td>
<td>1,8,11</td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://patentimages.storage.googleapis.com/46/19/17/06f16e87f1fc21/WO2000004461A1.pdf", "len_cl100k_base": 9691, "olmocr-version": "0.1.53", "pdf-total-pages": 22, "total-fallback-pages": 0, "total-input-tokens": 23518, "total-output-tokens": 10283, "length": "2e13", "weborganizer": {"__label__adult": 0.0007042884826660156, "__label__art_design": 0.0018968582153320312, "__label__crime_law": 0.0106658935546875, "__label__education_jobs": 0.002727508544921875, "__label__entertainment": 0.0004627704620361328, "__label__fashion_beauty": 0.0003578662872314453, "__label__finance_business": 0.01384735107421875, "__label__food_dining": 0.0003685951232910156, "__label__games": 0.0012731552124023438, "__label__hardware": 0.0283203125, "__label__health": 0.0005712509155273438, "__label__history": 0.0008134841918945312, "__label__home_hobbies": 0.00026035308837890625, "__label__industrial": 0.0015544891357421875, "__label__literature": 0.0012598037719726562, "__label__politics": 0.0009870529174804688, "__label__religion": 0.0007185935974121094, "__label__science_tech": 0.231689453125, "__label__social_life": 0.00010079145431518556, "__label__software": 0.339599609375, "__label__software_dev": 0.360107421875, "__label__sports_fitness": 0.00018358230590820312, "__label__transportation": 0.0010805130004882812, "__label__travel": 0.00029730796813964844}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 39843, 0.04576]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 39843, 0.55457]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 39843, 0.87055]], "google_gemma-3-12b-it_contains_pii": [[0, 1388, false], [1388, 4025, null], [4025, 6040, null], [6040, 9010, null], [9010, 11971, null], [11971, 14257, null], [14257, 17186, null], [17186, 20094, null], [20094, 23057, null], [23057, 25947, null], [25947, 29026, null], [29026, 32046, null], [32046, 32172, null], [32172, 33546, null], [33546, 35255, null], [35255, 35809, null], [35809, 35809, null], [35809, 35809, null], [35809, 35809, null], [35809, 35809, null], [35809, 38933, null], [38933, 39843, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1388, true], [1388, 4025, null], [4025, 6040, null], [6040, 9010, null], [9010, 11971, null], [11971, 14257, null], [14257, 17186, null], [17186, 20094, null], [20094, 23057, null], [23057, 25947, null], [25947, 29026, null], [29026, 32046, null], [32046, 32172, null], [32172, 33546, null], [33546, 35255, null], [35255, 35809, null], [35809, 35809, null], [35809, 35809, null], [35809, 35809, null], [35809, 35809, null], [35809, 38933, null], [38933, 39843, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 39843, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 39843, null]], "pdf_page_numbers": [[0, 1388, 1], [1388, 4025, 2], [4025, 6040, 3], [6040, 9010, 4], [9010, 11971, 5], [11971, 14257, 6], [14257, 17186, 7], [17186, 20094, 8], [20094, 23057, 9], [23057, 25947, 10], [25947, 29026, 11], [29026, 32046, 12], [32046, 32172, 13], [32172, 33546, 14], [33546, 35255, 15], [35255, 35809, 16], [35809, 35809, 17], [35809, 35809, 18], [35809, 35809, 19], [35809, 35809, 20], [35809, 38933, 21], [38933, 39843, 22]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 39843, 0.2008]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
ac9a10370b17e6df605329fd6c2b22a0d5e15c66
|
Reasoning on Robot Knowledge from Discrete and Asynchronous Observations
Pouyan Ziafati, Yehia Elrakaiby, Marc van Zee, Leendert van der Torre, Holger Voos
SnT, University of Luxembourg
Mehdi Dastani and John-Jules Meyer
Intelligent Systems Group, Utrecht University
{M.M.Dastani, J.J.C.Meyer}@uu.nl
Abstract
Robot knowledge of the world is created from discrete and asynchronous events received from its perception components. Proper representation and maintenance of robot knowledge is crucial to enable the use of robot knowledge for planning, user-interaction, etc. This paper identifies some of the main issues related to the representation, maintenance and querying of robot knowledge built upon discrete asynchronous events such as event-history management and synchronization, and introduces a language for simplifying the developers’ job at making a suitable representation of robot knowledge.
Autonomous robots with cognitive capabilities such as planning, knowledge intensive task execution and human interaction need to maintain and reason on knowledge about their environment (Beetz, Mosenlechner, and Tenorth 2010; Ziafati et al. 2013a; Tenorth and Beetz 2012; Lemaignan et al. 2011). Robot knowledge is collected by its perception components, which continuously process input sensory data and asynchronously output the results in the form of events representing various information types, such as recognized objects, faces and robot position (Heintz, Kvarnström, and Doherty 2010; Wrede 2009).
Robot knowledge, consisting of events representing observations made by its perception components, need to be properly represented and maintained to reason about it. However, the discrete and asynchronous nature of observations and their continuity make querying and reasoning on such knowledge difficult and pose many challenges on its use in robot task execution. The representation, fusion and management of various sources of knowledge and the integration of different reasoning capabilities have been the focus of many projects such as logic-based knowledge bases (Tenorth and Beetz 2012; Lemaignan et al. 2010) and active memories (Wrede 2009; Hawes, Sloman, and Wyatt 2008). In this paper, we address three requirements, that are not satisfactorily supported by existing systems. These requirements are (1) representation of continuous and discrete information, (2) dealing with asynchronousity of events and (3) management of event-histories.
Building robot knowledge upon its discrete events, time-stamped with the time of their occurrence, is not always a straightforward task since events contain different information types that should be represented and dealt with differently. For example, to accurately calculate the robot position at a time point, one needs to interpolate its value based on the discrete observations of its value in time. One also needs to deal with the persistence of knowledge and its temporal validity. For example, it is reasonable to assume that the color of an object remains the same until a new observation indicating a change of the object’s color is made. In some other cases, it may not be safe to infer an information, such as the location of an object, based on an observation that is made in the far past.
To perform its tasks, the robot’s components such as its control component query its knowledge base. Queries are answered based on the knowledge inferred from events, representing observations made by perception components, processed and received over a distributed and asynchronous network. Hence, observations may be received with some delay and out of order. For example, the event indicating the recognition of an object in a 3D image is generated by the object recognition component sometime after the actual time at which the object is observed because of the delay caused by the recognition process. Therefore, correct evaluation of a query may require waiting for the perception components to finish processing of sensory data to ensure that all data necessary to evaluate the query is present in the knowledge base. For example, the query, “how many cups are on the table at time t?” should not be answered immediately at time t, but answering the query should be delayed until after the processing of pictures of the table by the object recognition component and the reception of the results by the knowledge base.
Robot perception components continuously send their observations to the knowledge base, leading to a growth of the memory required to store and maintain the robot knowledge. The unlimited growth of the event-history leads to a degradation of the efficiency of query evaluation and may even lead to memory exhaustion.
In this paper, we introduce a knowledge management system, so-called SLR, for robot software that aims at dealing with the aforementioned issues. SLR supports the definition of programs to create a suitable representation of robot knowledge based on its discrete and asynchronous observations. It also supports synchronizing queries to ensure that
all data necessary to answer a query is gathered before the query is answered. Furthermore, SLR provides two memory management mechanisms for the removal of outdated and unneeded data from memory.
The remainder of the paper is organized as follows. After presenting an exemplary robot software architecture, we present the syntax and semantics of the SLR language. Then we describe the usability of SLR for reasoning on robot knowledge from its discrete events. Afterwards, we continue with describing the SLR supports for memory management and synchronization of queries. Finally, we present related work and conclude.
**Robot Software Architecture**
A user is interacting with robot X, requesting information about objects around it. To reply to the user’s questions, the robot’s software relies on its components shown in Figure 1: The segmentation component uses a real-time algorithm such as the one presented by Uckermann et al. (Uckermann, Haschke, and Ritter 2012) to process 3D images from the robot’s Kinect camera into 3D point cloud data segments corresponding to individual objects. Its output to SLR consists of events of the form \( \text{seg}(O,L)^T \), each corresponding to the recognition of an object \( O \) at time \( T \) at a location \( L \) relative to the camera. An identifier \( O \) is assigned to each event, using an anchoring and data association algorithm such as the one presented by Elfring et al. (Elfring et al. 2012), to distinguish between events corresponding to the recognition of the same object segment. When a new object segment \( O \) is recognized, the segmentation component sends its corresponding data to the objRec component. The objRec component processes the data and sends an event of the form \( \text{obj}(O,\text{Type}, \text{Color})^T \) to SLR, specifying the type \( \text{Type} \) and color \( \text{Color} \) of the recognized object. The StatePublisher component generates events of the form \( \text{tf}('base','world',TF) \) and \( \text{tf}('cam','base',TF) \). These events specify the relative position \( TF \) between the reference and the robot’s base, and between the robot’s base and camera coordination frames respectively at time \( T \). The control component handles the interaction with the user and queries SLR for the robot’s knowledge of the world answered by SLR based on events received from perception components. The control component also controls the orientation of the head of the robot by sending commands to the Gaze component.

**SLR Language**
SLR is a knowledge management system for robot software enabling the high-level representation, querying and maintenance of robot knowledge. In particular, SLR is aimed at simplifying the representation of the discrete pieces of information received from the robot software components, and improving efficiency and accuracy of query processing by providing synchronization and event-history management mechanisms.
The input data to SLR is a stream of events, representing robot’s observations of the world. An event is a piece of sensory information, time-stamped by the component generating it. For example, the event \( \text{face}(\text{Neda}, 70)^{28} \) could mean that Neda’s face was recognized at time 28 with a confidence of 70%. An Event can also be stamped with a time interval. For example \( \text{observed}(\text{Neda})^{28,49} \) could mean that Neda’s face was continuously perceived between times 28 and 49.
The SLR language bears close resemblance to logic programming and is both in syntax and semantics very similar to Prolog, which is the most familiar logic programming system today. Therefore we first review the main elements of Prolog upon which we then define the SLR language.
In the Prolog syntax, a term is an expression of the form \( P(t_1, \ldots, t_n) \), where \( P \) is a functor symbol and \( t_1, \ldots, t_n \) are constants, variables or terms. A term is ground if it contains no variables. A Horn clause is of the form \( B_1 \land \ldots \land B_n \rightarrow A \), where \( A \) is a term called the head of the clause, and \( B_1, \ldots, B_n \) are terms or negation of terms called the body. \( A \leftarrow \text{true} \) is called a fact and usually written as \( A \). A Prolog program \( P \) is a finite set of Horn clauses.
One executes a logic program by asking it a query. Prolog employs the SLDNF resolution method (Apt and van Emden 1982) to determine whether or not a query follows from the program. A query may result in a substitution of the free variables. We use \( P \vdash_{\text{SLDNF}} Q \theta \) to denote a query \( Q \) on a program \( P \), resulting in a substitution \( \theta \).
**SLR Syntax**
An SLR signature includes constant symbols, floating point numbers, variables, time points, and two types of functor symbols. Some functor symbols are ordinary Prolog functor symbols called static functor symbols, while the others are called event functor symbols.
**Definition (SLR Signature).** A signature \( S = \langle C, R, V, Z, P^s, P^e \rangle \) for SLR language consists of:
- A set \( C \) of constant symbols.
- A set \( R \subseteq \mathbb{R} \) of real numbers.
- A set \( V \) of variables.
- A set \( Z \subseteq \mathbb{R}_{t \geq 0} \cup V \) of time points
- \( P^s \), a set of \( P^s_n \) of static functor symbols of arity \( n \) for \( n \in \mathbb{N} \).
- \( P^e \), a set of \( P^e_n \) of event functor symbols of arity \( n \) for \( n \in \mathbb{N}_{n \geq 2} \), disjoint with \( P^s_n \).
**Definition (Term).** A static/event term is of the form \( t ::= p^s_n(t_1, \ldots, t_{n-2})/p^e_n(t_1, \ldots, t_{n-2}, z_1, z_2) \) where \( p^s_n \in P^s_n \) and \( p^e_n \in P^e_n \) are static/event functor symbols, \( t_i \) are constant symbols, real numbers, variables or terms themselves and \( z_1, z_2 \) are time points such that \( z_1 \leq z_2 \).
For the sake of readability, an event term is denoted as \( p_n(t_1, \ldots, t_{n-2})^{[z_1, z_2]} \). Moreover, an event term whose \( z_1 \) and \( z_2 \) are identical is denoted as \( p_n(t_1, \ldots, t_{n-2})^z \).
Definition (Event). An event is a ground event term \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \), where \( z_1 \) is called the start time of the event and \( z_2 \) is called its end time. The functor symbol \( p_n \) of an event is called its event type.
We introduce two types of static terms, next and prev terms who respectively refer to occurrence of an event of a certain type observed right after and right before a time point, if such event exists. In the next section we will give semantics to these notions. For now, we restrict ourselves to the syntax of SLR.
Definition (Next term). Given a signature \( S \), a next term \( \text{next}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_{s}, z_{e}) \) has an event term \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \) and two time points \( z_s, z_e \) representing a time interval \([z_s, z_e]\) as its arguments.
Definition (Previous term). Given a signature \( S \), a previous term \( \text{prev}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_{s}) \) has an event term \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \) and a time point \( z_s \) as its arguments.
Definition (SLR Program). Given a signature \( S \), an SLR program \( D \) consists of a finite set of Horn clauses of the form \( B_1 \land \ldots \land B_m \rightarrow A \) built from the signature \( S \), where \( \text{next} \) and \( \text{prev} \) terms can only appear in body of rules and the program excludes event facts (events).
**SLR Operational Semantics**
An SLR knowledge base is modelled as an SLR program and an input stream of events. In order to limit the scope of queries on SLR knowledge base, we introduce a notion of an event stream view, which contains all events occurring up to a certain time point.
Definition (Event Stream). An event stream \( \epsilon \) is a (possibly infinite) set of events.
Definition (Event Stream View). An event stream view \( \epsilon(z) \) is the maximum subset of event stream \( \epsilon \) such that events in \( \epsilon(z) \) have their end time before or at the time point \( z \), i.e.
\[
\epsilon(z) = \{ p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \in \epsilon \mid z_2 \leq z \}
\]
Definition (Knowledge base). Given a signature \( S \), a knowledge base \( k \) is a tuple \( \langle D, \epsilon \rangle \) where \( D \) is an SLR program and \( \epsilon \) is an event stream defined upon \( S \).
Definition (SLR Query). Given a signature \( S \), an SLR query \( \langle Q, z \rangle \) on an SLR knowledge base \( k \) consists of a regular Prolog query \( Q \) built from the signature \( S \) and a time point \( z \). We write \( k \vdash_{\text{SLR}} \langle Q, z \rangle \theta \) to denote an SLR query \( \langle Q, z \rangle \) on the knowledge base \( k \), resulting in the substitution \( \theta \).
The operational semantics of SLR for query evaluation follows the standard Prolog operational semantics (i.e. unification, resolution and backtracking) (Apt and van Emden 1982) as follows: The evaluation of a query \( \langle Q, z \rangle \) given an SLR knowledge base \( k = \langle D, \epsilon \rangle \) consists in performing a depth-first search to find a variables binding that enables derivation of \( Q \) from the rules and static facts in \( D \), and event facts (i.e. events) in \( \epsilon \). The result is a set of substitutions (i.e. variable bindings) \( \theta \) such that \( D \cup \epsilon \vdash_{\text{SLDNF}} Q \theta \) under the condition that event terms which are not arguments of \( \text{next} \) and \( \text{prev} \) terms can be unified with event facts only if such events belong to \( \epsilon(z) \).
The event stream models observations made by robot perception components. Events are added to the SLR knowledge base in the form of facts when new observations are made. Each event is time-stamped with the time of its occurrence. In a query \( \langle Q, z \rangle \), the parameter \( z \) limits query evaluation to the set of observations made up until the time \( z \). This means that the query \( \langle Q, z \rangle \) cannot be evaluated before the time \( z \), since SLR would not have received robot’s observations necessary to evaluate \( Q \).
A query \( \langle Q, z \rangle \) can be posted to SLR long after the time \( z \) in which case the SLR knowledge base contains observations made after the time \( z \). In order to have a clear semantics of queries, the SLR operational semantics applies the following rule. When evaluating a query \( \langle Q, z \rangle \), only event facts in the knowledge base are taken into account whose end times are earlier or equal to \( z \) (i.e. event facts in \( \epsilon(z) \)). The only exception is for the case of \( \text{next} \) or \( \text{prev} \) clauses which are evaluated based on their declarative definitions regardless of the \( z \) parameter of the query as follows.
The \( \text{prev}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_s) \) term unifies \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \) with an event \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \in \epsilon(z_s) \) such that \( z_s \geq z_{\prime 2} \) and there is no other such event in \( \epsilon(z_s) \) which has the end time later than \( z_{\prime 2} \). If such a unification is found, the \( \text{prev} \) clause succeeds and fails otherwise.
A \( \text{prev} \) clause \( \text{prev}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_s) \) is evaluated using the following rule over the event facts in \( \epsilon \). By definition, the variable \( z_s \) should be already instantiated when the \( \text{prev} \) clause is evaluated and an error is generated otherwise. It is also worth noting that the \( \text{prev} \) clause can be evaluated only after the time \( z_s \) when all events with end time earlier or equal to \( z_s \) have been received by and stored in the SLR knowledge base. The \( \neg \) symbols represents Prolog negation.
\[
\text{prev}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_s) :- \\
p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_2 \leq z_s \\
\neg(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_2, z_2^\prime \leq z_s, z_2^\prime > z_2).
\]
The \( \text{next}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_s, z_e) \) term unifies \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \) with an event \( p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}] \in \epsilon(z_e) \) such that \( z_e \leq z_1^\prime, z_2^\prime \leq z_e \) and there is no other such event in \( \epsilon \) which has the start time earlier than \( z_1^\prime \). If such a unification is found, the \( \text{next} \) clause succeeds and fails otherwise.
A \( \text{next} \) clause \( \text{next}(p_n(t_1, \ldots, t_n)[z_1, \ldots, z_{n-2}], z_s, z_e) \) is evaluated using the following rule over the event facts in \( \epsilon \). By definition, the variables \( z_s \) and \( z_e \) should be instantiated when the \( \text{next} \) clause is evaluated and an error is generated otherwise. The \( \text{next} \) clause can only be evaluated after the time \( z_e \) when all events with end time earlier or equal to \( z_e \) have been received and stored in the SLR knowledge base. However, if we assume that events of the same type (i.e. with same functor symbol and arity) are received by SLR in order of their start times, the next clause can be evaluated as
\[1\] The input to Etalis event-processing system is similarly modelled as a stream of events (Anicic 2011).
soon as the first event unifiable with \( p_n(t_1, \ldots, t_n)|^{|z_1, z_2|} \) with start time later than \( z_1 \) is received by SLR, not to postpone queries when unnecessary. This holds when only one perception component generates events of type \( p_n(t_1, \ldots, t_n) \) and those events are sent to SLR in order of their start time.
\[
\text{next}(p_n(t_1, \ldots, t_n)|^{z_1, z_2}, [z_1, z_2]) \quad \text{--}
\]
\[
\text{p}_n(t_1, \ldots, t_n)|^{z_1, z_2}, z_1 \leq z_2, z_2 \leq z_p,
\]
\[
\neg(p_n(t_1, \ldots, t_n)|^{z_1, z_2}), z_1 \leq z_1^n, z_2^n \leq z_n, z_1^n < z_1.
\]
### Persistent and Maintaining State
Robot knowledge of the world is constructed from observations made by its perception components. These observations take the form of discrete events, stamped with the time of their occurrence. This representation of robot knowledge makes the formulation of queries over the knowledge base difficult. For example, if an object was observed at some location \( L \) at time 2 and again at the same location at time 4, then a query about whether the object was at \( L \) at time 3 will fail since the knowledge base does not include an event indicating the location of the object at time 3.
SLR, by enabling the definition of programs, aims at simplifying the task of the programmer of making a suitable representation of robot knowledge. In particular, programs are meant to enable transforming the event-based representation of robot knowledge, i.e. events, into a state-based representation of knowledge, using derived facts. This section discusses some of the typical cases where a state-based representation is more suitable and how it can be specified.
### Persistent Knowledge
Persistent knowledge refers to information such as color of an object that is assumed not to change over time.
**Example.** The following rule specifies that the color of an object at a time \( T \) is the color that the object was perceived to have at its last observation.
\[
\text{color}(O, C)^T : \text{prev}(obj(O, C)|^{|Z|}, T).
\]
### Persistence with Temporal Validity
The temporal validity of persistence means the period of time during which it is safe to assume that information derived from an observation remains valid. For example, when an object is observed at time \( t_1 \) at a location \( L \), it may be safe to assume that the object is at \( L \) for some time period \( \delta \) after \( t_1 \). However, after the elapse of \( \delta \), it should be considered that the location of the object is unknown since it has not observed for a long time, i.e. \( \delta \).
**Example.** To pick up an object \( O \), its location should be determined and sent to a planner to produce a trajectory for the manipulator to perform the action. This task can be naively presented as a sequence of actions 1) determine the object’s location \( L \), 2) compute a manipulation trajectory \( Trj \), and 3) perform the manipulation. However, due to for example environment dynamics, the robot needs to check that the object’s location has not been changed and the computed trajectory is still valid before executing the actual manipulation task. The following three rules in SLR program can be used to determine the location of an object and its validity as follows. If the last observation of the object is within last 5 seconds, the object location is set to the location at which the object was seen last time. If the last observation was made before 5 seconds ago, the second rule specifies that the location is outdated and finally, the third rule sets the location to “never-observed”, if such an object has never been observed by the robot. The symbol \( \text{prev} \) represents Prolog cut operator. For the sake of brevity, Object’s locations determined by these rules are relative to robot’s camera. In reality we either need to calculate object’s locations in the world reference frame, or in the case we are using relative locations, we should also encode that the movement of the robot itself invalidates locations.
\[
\text{location}(O, L)^T : \text{prev}(\text{seg}(O, L)|^{|Z|}, T), T - Z \leq 5, !.
\]
\[
\text{location}(O, \text{“outdated”})^T : \text{prev}(\text{seg}(O, L)|^{|Z|}, T), T - Z > 5, !.
\]
\[
\text{location}(O, \text{“never-observed”})^T.
\]
### Continuous Knowledge
Continuous knowledge refers to information that takes continuous values such as a relative position between a moving robot’s camera and its base coordinate frames. For example, to precisely position an object in the world reference coordination frame, the camera to base relative position at time of the recognition of the object needs to be interpolated/extrapolated based on discrete events of observations of camera to base relative position over time.
**Example.** The following rule calculates the camera to base relative position \( TF \) at a time \( T \) by interpolating from the last observation (i.e. event) of the camera to base relative position \( TF1 \) at time \( T1 \) equal or earlier than \( T \) and the first observation of the camera to base relative position \( TF2 \) at time \( T2 \) equal or later than \( T \). The \( \text{interpolate} \) term is a user defined term which performs the actual interpolation. When evaluating the camera to base position at time \( T \) using this rule, the SLR execution system postpones the evaluation of the query until it receives the first \( \text{if}(\text{"cam"}, \text{"base"}, TF1)^{T2} \) event whose start time (i.e. \( T2 \)) is equal or later than \( T \).
\[
\text{tf}(\text{"cam"}, \text{"base"}, TF)^T : =
\]
\[
\text{prev}(\text{tf}(\text{"cam"}, \text{"base"}, TF1)^T, T),
\]
\[
\text{next}(\text{tf}(\text{"cam"}, \text{"base"}, TF2)^{T2}, [T, \infty]).
\]
\[
\text{interpolate}([TF, T1], [TF1, T1], [TF2, T2]).
\]
The following rule calculates the base to world relative position \( TF \) at a time \( T \) by checking whether the first \( \text{tf}(\text{"base"}, \text{"world"}, TF2)^{T2} \) event occurring at or later than \( T \) occurs within a second after \( T \) (i.e. within \( [T, T + 1] \)). In this case, the value of \( TF \) is interpolated similar to the previous example. Otherwise, the value of \( TF \) is extrapolated solely based on the last observation of the base to world relative
position $TF1$ at time $T1$ equal or earlier than $T$. The SLR execution system evaluates the value of $TF$ using this rule as soon as it receives the first $tf(‘base’, ‘world’, TF2)^T$ event whose start time is equal or later than $T$ or as soon as it waits enough to assure that such an event did not occur within $[T, T+1]$. The $\rightarrow$ symbol represents Prolog “If-Then-Else” choice operator.
$$
tf(‘base’, ‘world’, TF)^T : -
prev(tf(‘base’, ‘world’, TF1)^T, T),
(next(tf(‘base’, ‘world’, TF2)^T, [T, T+1]) ->
interpolate([TF, T], [TF1, T1], [TF2, T2]));
extrapolate([TF, T], [TF1, T1]).$$
The following rule calculates the position $WorldPos$ of an object $O$ in the world reference coordination frame by querying the knowledge base (implemented by previous two rules) for camera to base and base to world relative positions at the time $T$ at which the object was recognized at the position $RelativePos$ relative to the robot’s head camera.
$$
position(seg(O, RelPos)^T, WorldPos) : -
tf(‘cam’, ‘base’, TF1)^T,
tf(‘base’, ‘world’, TF2)^T,
pos\_multiply([RelPos, TF1, TF2], WorldPos).
$$
Aggregation It is often needed to query the number of some items in a state such as the objects in the environment the robot is aware of. The formulation of these queries can be simplified by transforming the event-based representation of events into a state-based representation.
Example. The query $\langle goal, t_e \rangle$ with the goal below gives the list $List$ of all objects used for drinking tea that the robot is aware of up to the time $t_e$, along with their positions in the world, taken from their last observations. The result is a list of $object(O, WorldPos)$ facts as specified by the template given as the first argument of the $findAll$ clause.
$$
findAll(object(O, WPos), (obj(O, Type, Color)^T, usedFor(Type, tea), prev(seg(O, RPos)^T, t_e), position(seg(O, RPos)^T, WPos)), List).
$$
Event History Management
An SLR knowledge base continuously receives and stores the events generated by robot’s software components processing the robot’s sensory data. All sensory events cannot be permanently stored as the amount of information grows unbounded over the lifetime of the robot. Therefore outdated data needs to be pruned from the memory to cope with the memory limited size and to increase efficiency in evaluating queries on the knowledge base.
SLR language supports two types of event history management mechanisms allowing the programmer to specify which events should be maintained and the duration of their storage. Event history management mechanisms in SLR are configured using two special purpose types of facts:
- time-buffer $tBuffer(P, T)$ and count-buffer $cBuffer(P, N)$. A $tBuffer(P, T)$ fact specifies that events unifiable with $P$ should be maintained in the knowledge base for $T$ seconds after their end time. A $cBuffer(P, N)$ fact in the knowledge base specifies that only the last $N$ events, unifiable with $P$ by substituting their anonymous variables represented by _ sign should be kept in the knowledge base. If $P$ contains non-anonymous variables, for each distinct values of those variables, a separate count-buffer is created.
To eliminate any ambiguity in query evaluation due to the memory management mechanisms, SLR requires that there should not be any count or time buffers $buffer(P1, X)$ and $buffer(P2, Y)$ defined whose first argument $P1$ and $P2$ could be unified with each other. Otherwise, one buffer could for example specify that only the last event of type $a$ needs to be maintained in the memory and the other one specify that all events of type $a$ occurring during last 300 seconds should be maintained. This property of an SLR program can be checked automatically to generate an error if it is not satisfied.
Example. The following time buffers specify that all $face(P)$ events with end time during the last 60 seconds and all $tf(S, D, TF)$ events with end time during the last 300 seconds should be kept in the memory and be removed otherwise.
$$
tBuffer(face(P), 60s).
\quad tBuffer(tf(S, D, TF), 300s).$$
The following count buffers specify that only the last event of recognition of each distinct person and only the last event of recognition of each distinct object should be kept in the memory.
$$
cBuffer(observe(face(P, _)), 1).
\quad cBuffer(observe(obj(O, _)), 1).$$
Having the memory management mechanisms implemented as above, the query $\langle goal, now \rangle$ with the goal below queries the SLR knowledge base for all people and objects that the robot have observed so far. The result contains only one fact corresponding to each person or object including the last location of the observation.
$$
findAll(Item, observe(Item, L)^T, List).
$$
Note that the non-anonymous variable $P$ in $cBuffer(\text{inView}(face(P, _), L))$ means buffering the last recognition of each distinct person. In contrast, $cBuffer(\text{observe}(face(-, _), L))$ means only keeping the recognition of the last person and $cBuffer(\text{inView}(face(P, _), L))$ means keeping the last recognition of each distinct person in each distinct location.
Synchronizing Queries over Asynchronous Events
Robot’s perception components process their sensory inputs in a distributed and parallel setting. SLR receives their results as events published asynchronously and possibly over
a computer network. When SLR evaluates a query \((goal, z)\), it needs to ensure that it has already received all relevant events with end time earlier or equal to \(z\). Intuitively, this means that when SLR is to answer a query based on robot’s observations of the world up to time \(z\), it needs to first make sure that the processing of relevant sensory inputs acquired up to \(z\) has been finished by all corresponding perception components and it has received all the results. SLR receives queries with unique IDs and answers them as soon as they can be evaluated. This means in principle postponing the evaluation of one query does not delay the evaluation of the others.
**Definition (Event Processing Time).** The processing time (i.e. \(t_p(e)\)) of an event \(e\) is the time at which the event is received and added to the SLR knowledge base.
**Definition (Event Delay Time).** The delay time (\(d(e)\)) of an event \(e\) is the difference between its processing time and its end time (i.e. \(t_p(p^{[z_1,z_2]})) = t_p(p^{[z_1,z_2]} - z_2)\).
The delay time of an event is mainly due to the time it takes for a perception component to generate it. For example, if Neda is recognized in the picture taken at time \(t_1\) and it takes \(k\) ms for the face recognition component to process that image, the event recognized(‘Neda’) \(t_1\) is generated at a time \(t_1 + k\). Then this event is sent to SLR, possibly over a computer network and hence processed by SLR at some later time \(t_2\). To guarantee the correct evaluation of a query, the delay times of events needs to be taken into account. Otherwise, SLR might answer a query using incomplete information not having the complete set of events relevant to the query received and stored in its knowledge base.
**Definition (Goal Set).** The goal set of a query \((goal, z)\) for an SLR program \(D\) is the largest set of event types (i.e. event functor symbols) which the SLDNF method could possibly backtrack on event terms of such types, when evaluating \(goal\) on SLR knowledge base with the SLR program \(D\). In other words, the goal set determines the set of all event types that if events of such types are part of the \(e\), then the result of \((goal, z)\) on SLR knowledge base \((D, e)\) could be different than the case of not having those events included in \(e\). The goal set can be determined by going through all rules in \(D\) using which the \(goal\) could be possibly proven and gathering all event functor symbols appearing in bodies of those rules.
Before evaluating a query \((goal, z)\), SLR first makes sure that it has received all input events with end time up to the time \(z\) whose types are included in the goal set of \(goal\). In other words, the query can be evaluated when the full history of all event types in the goal set of \(goal\) is available up to the time \(z\) as defined below.
**Definition (Full History Availability).** The history of events of a type \(p_n\) up to the time \(z\) is fully available at a time \(t\) when at this time the SLR has received and stored all events of the type \(p_n\) occurring by the time \(z\) (having end time earlier or equal to \(z\)).
A query \((goal, z)\) can be evaluated only after 1- the full history of the goal set of \(goal\) up to the time \(z\) is available and 2- all next and prev clauses which are backtracked on when evaluating the query can be evaluated based on their declarative definitions. A prev clause \(prev(p_n(t_1, \ldots t_n)^{[z_1,z_2]}, z_3)\) can be evaluated only after the full history of events of type \(p_n(t_1, \ldots t_n)^{[z_1,z_2]}\) up to the time \(z_3\) is available. A next clause \(next(p_n(t_1, \ldots t_n)^{[z_1,z_2]}, [z_3, z_4])\) can be evaluated as soon as the first event of type \(p_n(t_1, \ldots t_n)^{[z_1,z_2]}\) with start time later than \(z_3\) is received by SLR or when the full history of such events is fully available up to time \(z_4\).
To determine when the history of events of a type \(p_n\) up to a time \(z\) is fully available, SLR can be programmed in two complementary ways. In the first way, the programmer specifies a maximum delay time (i.e. \(t_{max}\)) for events of each type. When the system time passes \(t_{max}(p_n)\) seconds after \(z\), SLR assumes that the history of events of type \(p_n\) up to the time \(z\) is fully available.
The maximum delay times of events depends on the runtime of the perception components generating such events and need to be approximated by the system developer or derived based on monitoring the system at runtime. When less maximum delay times of events are assumed, queries are evaluated sooner and hence the overall system works in more real-time fashion, but there is more chance of answering a query when the complete history of events asked by the query is not in place yet. When larger maximum delay times of events are assumed, there is a higher chance to have all sensory data up to the time specified by the query already processed by perception components and their results received by SLR when the query is evaluated. However, queries are performed with more delays.
The other way that SLR can ensure to have received the full history of events of a type \(p_n\) up to a time \(z\) in its knowledge base is by being told so by a component, usually the one generating events of the type \(p_n\). When SLR receives an event fullyUpdated(\(P_n\))\(^2\), it considers that the history of events of the type \(p_n\) up to the time \(z\) is fully available.
**Example.** When the position of an object \(O\) in the world coordination frame at a time \(T\) is queried, the query can be answered as soon as both camera to base and base to world relative positions at the time \(T\) can be evaluated. The former can be evaluated (i.e. interpolated) as soon as SLR receives the first \(tf(‘cam’,'base', P)\) event with a start time equal or later than \(T\). The latter can be evaluated as soon as the SLR receives the first \(tf(‘base’, ‘world’, P)\) event with the start time equal or later than \(T\), or when it can ensures that there is no \(tf(‘base’, ‘world’, P)\) event occurred within \([T, T + 1]\). If we assume \(t_{max}(tf(‘base’, ‘world’, P))\) is set to 0.05 seconds, SLR has to wait 1.05 seconds after \(T\) to ensure this.
The \(t_{max}(tf(‘base’, ‘world’, P))\) can be set by the system developer but it can be also set by monitoring the system runtime performance. Whenever a \(tf(‘base’, ‘world’, P)\) event is processed, SLR can check its delay, the difference between its end time and its time of process, and sets the
\(^2\)For practical reasons, we also allow unsynchronized queries which are immediately evaluated only on events which have been actually received by the knowledge base by the time of the evaluation.
\( t_{\text{delay}}(\text{tf}('base', 'world', F)) \) to the maximum delay of such events encountered so far.
**Example.** The robot is asked to look at the \textit{table}1 and tell about the cups it sees. To answer the question, the control component controls the head of the robot to take 3D pictures of the \textit{table}1 from its left to its right side starting by the time \( t_1 \) and finishing by the time \( t_2 \). Finally, it queries \textit{SLR} for the cups observed on the table as \( \{\text{goal}, t_2\} \) where the goal is
\[
\text{findall}(O, (\text{obj}(O, "cup", C)^T, \text{next}(\text{seg}(O, P)^T, [t_1, t_2]), L).
\]
The query lists a set of all object segments \( O \) whose type is "cup" and are observed at least once during \([t_1, t_2]\) in \( L \). One could also calculate the objects’ positions and check whether they are on \textit{table}1, but such details have been omitted for the sake of brevity.
To answer this query, \textit{SLR} should wait until the segmentation component processes all images acquired up to the time \( t_2 \) and to receive the results. Moreover, if a new object segment is recognized, the \textit{objRec} component processes it for its type. Therefore \textit{SLR} should also wait for the \textit{objRec} component to process all new object segments recognized in acquired pictures up to the \( t_2 \) and to receive the results. Whenever the segmentation component processes an image acquired at a time \( t \), it outputs the recognized object segments and at the end, it sends an event \( \text{finished}(\text{segmentation})_t \) to \textit{SLR}. Whenever \textit{SLR} receives a \( \text{finished}(\text{segmentation})_t \) event, it knows that it has already received all object segments up to the time \( t \) (the history of \( \text{seg}(O, P)^T \) events up to the time \( t \) is fully available). The \textit{objectRec} component also informs the \textit{SLR}, when it finishes processing of its input data up to each time point. \textit{SLR} processes these event signals and proceeds with evaluating the query whenever the full history of both \( \text{obj}(O, T, C)^T \) and \( \text{seg}(O, P)^T \) events up to the time \( t_2 \) is available. Then the result is sent back to the control component.
**Related Work**
There are several tools for sensory data and knowledge integration in robotics, surveys of which can be found in (Wrede 2009) and (Lemaignt 2012). A category of these tools are active memories provided for instance in IDA (Wrede 2009) and CAST (Hawes and Hanheide 2010) frameworks. Active memories are used to integrate, fuse and store robot sensory data. These systems usually do not process or reason on knowledge themselves but employ event-based mechanisms to notify other components when contents of their memories change. When notified through events, external components query the memories, process the results and often update back the memories which in turn can activate other processes. Another category of these tools are knowledge management systems such as ORO (Lemaignt et al. 2010) and KnowRob (Tenorth and Beetz 2009). These systems are used to store and reason on logical facts. The focus of these systems are on providing common ontologies for robotic data, integration and sharing of various knowledge including common-sense knowledge and integration of various reasoning functionalities such as ontological, rule-based and spatial reasoning.
**Persistence and Maintaining State**
Dealing with the persistence of knowledge over time is an issue that has been extensively studied in the area of languages for reasoning about knowledge and change, for example in knowledge formalisms such as the event calculus (Kowalski and Sergot 1989; Shanahan 1999) and the situation calculus (Levesque, Pirri, and Reiter 1998). The \textit{SLR} language, on the other hand, aims at providing a practical solution for representing robots’ knowledge based on discrete observations. \textit{SLR} therefore provides means to deal with aspects not considered in these theoretical formalisms such as dealing with the temporal validity of data and representation of continuous knowledge. Among the robotic knowledge management systems, \textit{KnowRob} applies a similar approach to ours where observations are time-stamped and the knowledge base can be queried for the world state at different time points. For example, a qualitative relation \( \text{rel}(A, B) \) between objects \( A \) and \( B \) for an arbitrary point in a time \( T \) can be examined using \( \text{holds}(\text{rel}(A, B), T) \) term. This term is evaluated by reading the location of the last perception of the objects before time the \( T \). However, similar functionalities are to be implemented by the programmer in pure Prolog. The \text{next} and \text{prev} clauses in \textit{SLR} support the programming of such functionalities by providing an easy way of referring to observations ordered in time.
**Synchronization of Queries**
A unique feature of \textit{SLR} comparing to other robotic sensory data and knowledge integration systems is its support for synchronizing queries over asynchronous events from distributed and parallel processes. \textit{SLR} provides two synchronization mechanisms to ensure that all sensory data up to a time point have been processed by corresponding processes and the results have been made available to \textit{SLR} when a query on such data is evaluated. These mechanisms are not supported by other systems and hence need to be implemented by external components who issue queries. This lack of support obviously makes the programming of external components querying data complex. The other disadvantage is that it makes a modular integration of external processes in active memories or knowledge management systems difficult. For example, consider a component validating the recognition of the “typing” action, denoting a human typing on a keyboard, by checking whether a computer is also recognized in the scene (Wrede 2009). \textit{SLR} query synchronization mechanisms allow such a component to query the \textit{SLR} for a recognized computer whenever this component receives an event of the recognition of the “typing” action. This component can be sure that if a computer has been recognized by the time of the query, the query result contains its corresponding information no matter which component processes data to recognize computers and how much time such a process takes.
**History Management**
Pruning outdated data from memory is a necessary functionality for any system managing and integrating robotic sensory data. \textit{CoSy} and \textit{KnowRob} rely on external components to prune data from their memory. In \textit{ORO}, knowledge is stored in different memory profiles, each
keeping data for a certain period of time. In IDA, a scripting language is provided to program various tasks operating on the memory. These tasks are activated periodically or in response to events generated when a memory operation is performed. IDA uses this mechanism to implement a garbage collection functionality similar to the time-based history management in SLR. In SLR, flexible garbage collection functionalities are blended in the syntax of the language. This functionalities allow to specify a time period to keep the history of certain events or for example to specify that only the record of the last occurrence of certain events needs to be kept in the memory.
An early version of the synchronization and memory management mechanisms introduced in this paper are previously presented in (Ziafati et al. 2013b). However, those mechanisms are to synchronize queries over, and prune outdated data from so called memory buffers which are similar to memory items in active memory systems. In this work, these mechanisms are tightly integrated into a Prolog-based logic programming language.
Conclusion
The discrete and asynchronous nature of observations made by robot perception components make the representation, maintenance and querying of robot knowledge a challenging task. This paper identifies three requirements for robotic knowledge management systems related to discreetness, asynchronosity and management of robot observations and introduces the SLR language to support these requirements.
SLR aims at supporting the programming tasks of 1-) reasoning on persistence, continuity and temporal validity of information, 2-) managing histories of observations to prune outdated and unnecessary data from memory and 3-) dealing with query synchronization. In particular, SLR supports state-based representation of robot knowledge through the definition of SLR programs and implements two automatic synchronization mechanisms to make query and reasoning about robot knowledge more accurate. Furthermore, SLR provides two mechanisms to enable the programmer to deal with the growth of event-histories.
Acknowledgement
Pouyan Ziafati is supported by FNR, Luxembourg.
References
|
{"Source-Url": "https://cdn.aaai.org/ocs/7738/7738-34342-1-PB.pdf", "len_cl100k_base": 11478, "olmocr-version": "0.1.42", "pdf-total-pages": 8, "total-fallback-pages": 0, "total-input-tokens": 34693, "total-output-tokens": 13436, "length": "2e13", "weborganizer": {"__label__adult": 0.0003390312194824219, "__label__art_design": 0.000530242919921875, "__label__crime_law": 0.0005273818969726562, "__label__education_jobs": 0.0008435249328613281, "__label__entertainment": 8.803606033325195e-05, "__label__fashion_beauty": 0.00018906593322753904, "__label__finance_business": 0.0003452301025390625, "__label__food_dining": 0.0004088878631591797, "__label__games": 0.0007443428039550781, "__label__hardware": 0.0016727447509765625, "__label__health": 0.0006823539733886719, "__label__history": 0.0002770423889160156, "__label__home_hobbies": 0.00016498565673828125, "__label__industrial": 0.0008387565612792969, "__label__literature": 0.0003287792205810547, "__label__politics": 0.0003292560577392578, "__label__religion": 0.0004203319549560547, "__label__science_tech": 0.134765625, "__label__social_life": 8.922815322875977e-05, "__label__software": 0.01280975341796875, "__label__software_dev": 0.84228515625, "__label__sports_fitness": 0.0003273487091064453, "__label__transportation": 0.000850677490234375, "__label__travel": 0.0001863241195678711}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 49771, 0.01404]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 49771, 0.71706]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 49771, 0.89551]], "google_gemma-3-12b-it_contains_pii": [[0, 5151, false], [5151, 11328, null], [11328, 18832, null], [18832, 25162, null], [25162, 30540, null], [30540, 37366, null], [37366, 44199, null], [44199, 49771, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5151, true], [5151, 11328, null], [11328, 18832, null], [18832, 25162, null], [25162, 30540, null], [30540, 37366, null], [37366, 44199, null], [44199, 49771, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 49771, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 49771, null]], "pdf_page_numbers": [[0, 5151, 1], [5151, 11328, 2], [11328, 18832, 3], [18832, 25162, 4], [25162, 30540, 5], [30540, 37366, 6], [37366, 44199, 7], [44199, 49771, 8]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 49771, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-22
|
2024-11-22
|
3887695f6a1fe42ab6950f42279e8d1b2df31c67
|
[REMOVED]
|
{"Source-Url": "https://iswc2017.semanticweb.org/wp-content/uploads/papers/MainProceedings/309.pdf", "len_cl100k_base": 15006, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 65471, "total-output-tokens": 16570, "length": "2e13", "weborganizer": {"__label__adult": 0.0004239082336425781, "__label__art_design": 0.0005750656127929688, "__label__crime_law": 0.0004880428314208984, "__label__education_jobs": 0.0024394989013671875, "__label__entertainment": 0.000186920166015625, "__label__fashion_beauty": 0.00022149085998535156, "__label__finance_business": 0.0006308555603027344, "__label__food_dining": 0.0004940032958984375, "__label__games": 0.000823974609375, "__label__hardware": 0.0008807182312011719, "__label__health": 0.00087738037109375, "__label__history": 0.0006003379821777344, "__label__home_hobbies": 0.00012743473052978516, "__label__industrial": 0.0005254745483398438, "__label__literature": 0.0009222030639648438, "__label__politics": 0.0003840923309326172, "__label__religion": 0.0006680488586425781, "__label__science_tech": 0.2177734375, "__label__social_life": 0.00019741058349609375, "__label__software": 0.0272979736328125, "__label__software_dev": 0.7421875, "__label__sports_fitness": 0.0002532005310058594, "__label__transportation": 0.0006785392761230469, "__label__travel": 0.00028896331787109375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 56328, 0.02087]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 56328, 0.35603]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 56328, 0.8777]], "google_gemma-3-12b-it_contains_pii": [[0, 2901, false], [2901, 6226, null], [6226, 10015, null], [10015, 13379, null], [13379, 17720, null], [17720, 20282, null], [20282, 23441, null], [23441, 27307, null], [27307, 30921, null], [30921, 33331, null], [33331, 37383, null], [37383, 40851, null], [40851, 44247, null], [44247, 48579, null], [48579, 52791, null], [52791, 56328, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2901, true], [2901, 6226, null], [6226, 10015, null], [10015, 13379, null], [13379, 17720, null], [17720, 20282, null], [20282, 23441, null], [23441, 27307, null], [27307, 30921, null], [30921, 33331, null], [33331, 37383, null], [37383, 40851, null], [40851, 44247, null], [44247, 48579, null], [48579, 52791, null], [52791, 56328, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 56328, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 56328, null]], "pdf_page_numbers": [[0, 2901, 1], [2901, 6226, 2], [6226, 10015, 3], [10015, 13379, 4], [13379, 17720, 5], [17720, 20282, 6], [20282, 23441, 7], [23441, 27307, 8], [27307, 30921, 9], [30921, 33331, 10], [33331, 37383, 11], [37383, 40851, 12], [40851, 44247, 13], [44247, 48579, 14], [48579, 52791, 15], [52791, 56328, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 56328, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-05
|
2024-12-05
|
80892eadde753c4d8b1e249bd7f8af77d7b1d7b3
|
## Description
libc's malloc is a problem, it fragments badly meaning forks share less memory and is slow compared to tcmalloc or jemalloc.
Both jemalloc and tcmalloc are heavily battle tested and stable.
To quote antirez:
But an allocator is a serious thing. Since we introduced the specially encoded data types Redis started suffering from fragmentation. We tried different things to fix the problem, but basically the Linux default allocator in glibc sucks really, really hard.
I recently bench Discourse with tcmalloc / jemalloc and default and noticed 2 very important thing:
- median request time reduce by up to 10% (under both)
- PSS (proportional share size) is reduced by 10% under jemalloc and 8% under tcmalloc.
We can always use LD_PRELOAD to yank these in, but my concern is that standard distributions are using a far from optimal memory allocator. It would be awesome if the build, out-of-the-box, just checked if it was on Linux (eg: [https://github.com/antirez/redis/blob/unstable/src/Makefile#L30-L34](https://github.com/antirez/redis/blob/unstable/src/Makefile#L30-L34)) and then used jemalloc instead.
## Associated revisions
**Revision 6ab08d2e - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)**
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
**Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)**
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
**Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)**
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
re-definition to suppress warnings.
Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
Revision 46354 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
Revision 46355 - 06/05/2014 05:36 AM - nobu (Nobuyoshi Nakada)
version.c: show malloc_conf
- configure.in (jemalloc): check for the header regardless drop-in libjemalloc is found, for malloc_conf declaration.
- version.c (ruby_show_version): show malloc_conf if set. [Feature #9113]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Revision 46355 - 06/05/2014 05:36 AM - nobu (Nobuyoshi Nakada)
version.c: show malloc_conf
- configure.in (jemalloc): check for the header regardless drop-in libjemalloc is found, for malloc_conf declaration.
- version.c (ruby_show_version): show malloc_conf if set. [Feature #9113]
Revision 46355 - 06/05/2014 05:36 AM - nobu (Nobuyoshi Nakada)
version.c: show malloc_conf
- configure.in (jemalloc): check for the header regardless drop-in
libjemalloc is found, for malloc_conf declaration.
- Version.c (ruby_show_version): show malloc_conf if set.
Revision 46355 - 06/05/2014 05:36 AM - nobu (Nobuyoshi Nakada)
version.c: show malloc_conf
- configure.in (jemalloc): check for the header regardless drop-in
libjemalloc is found, for malloc_conf declaration.
- Version.c (ruby_show_version): show malloc_conf if set.
Revision 46355 - 06/05/2014 05:36 AM - nobu (Nobuyoshi Nakada)
version.c: show malloc_conf
- configure.in (jemalloc): check for the header regardless drop-in
libjemalloc is found, for malloc_conf declaration.
- Version.c (ruby_show_version): show malloc_conf if set.
Revision 46355 - 06/05/2014 05:36 AM - nobu (Nobuyoshi Nakada)
version.c: show malloc_conf
- configure.in (jemalloc): check for the header regardless drop-in
libjemalloc is found, for malloc_conf declaration.
- Version.c (ruby_show_version): show malloc_conf if set.
History
#1 - 11/15/2013 02:45 PM - naruse (Yui NARUSE)
- Status changed from Open to Assigned
- Assignee set to kosaki (Motohiro KOSAKI)
Could you comment this?
#2 - 11/15/2013 02:49 PM - nobu (Nobuyoshi Nakada)
- Status changed from Assigned to Third Party's Issue
If system malloc is replaced with those newer libraries, ruby will use it.
Otherwise, configure with LIBS=-ljemalloc.
#3 - 11/15/2013 02:49 PM - nobu (Nobuyoshi Nakada)
- Category set to build
- Assignee deleted (kosaki (Motohiro KOSAKI))
#4 - 11/15/2013 03:23 PM - duerst (Martin Dürst)
On one level, this feels like a non-brainer. But then the question is
why the standard memory allocator in libc hasn't been improved.
I can imagine all kinds of reasons, from "alternatives use too much
memory" to "not invented here". Any background info?
Regards, Martin.
On 2013/11/15 12:08, sam.saffron (Sam Saffron) wrote:
https://bugs.ruby-lang.org/issues/9113
I recently benched Discourse with tcmalloc / jemalloc and default and noticed 2 very important thing:
median request time reduce by up to 10% (under both)
PSS (proportional share size) is reduced by 10% under jemalloc and 8% under tcmalloc.
We can always use LD_PRELOAD to yank these in, but my concern is that standard distributions are using a far from optimal memory allocator. It would be awesome if the build, out-of-the-box, just checked if it was on Linux (eg: https://github.com/antirez/redis/blob/unstable/src/Makefile#L30-L34) and then used jemalloc instead.
#5 - 11/15/2013 04:16 PM - sam.saffron (Sam Saffron)
@martin this is a great "oldish" article by facebook about this
@nobu (Nobuyoshi Nakada) I guess my suggestion here is to include jemalloc source in the the repo, and compile on demand for linux (by default with an option to opt-out) that way everyone will pick this change up and it becomes "officially blessed" allocator.
At Github @tmm1 (Aman Karmani) has been using tcmalloc for years now, fragmentation is less good than jemalloc (tmm1 said perf is better, but I think its time to re-test cause I found jemalloc to perform better)
Regardless, libc allocator is a problem and default compiles should not use it.
Firefox has been using jemalloc for years and years, it is safe for production http://glandium.org/blog/?p=2581
#6 - 11/15/2013 09:53 PM - nobu (Nobuyoshi Nakada)
- Status changed from Third Party's Issue to Rejected
Then it is a task of package maintainers.
#7 - 11/22/2013 11:40 AM - kosaki (Motohiro KOSAKI)
@durent (Martin Dürst) It is not correct. I and glibc folks are working on several improvement about malloc. Moreover, each allocator has different pros/cons. jemalloc can retrieve some workload better and glibc allocator can retrieve some other workload. There is no single perfect allocator. That's our difficulty.
@sam.saffron (Sam Saffron) The Facebook's page you pointed out is out of date. It compare glibc 2.5 vs jemalloc 2.1.0. But latest are glibc 2.18 and jemalloc 3.4.1. And, glibc malloc and jemalloc shares a lot of basic design. So, this documentation is completely useless. If you have several workload which glibc doesn't work well, please make and share benchmark instead of rumor. Then, we can improve several bottlenecks.
#8 - 11/22/2013 11:41 AM - kosaki (Motohiro KOSAKI)
It does NOT mean jemalloc has no chance. But we don't discuss performance issue if nobody has a number.
#9 - 11/22/2013 02:44 PM - naruse (Yui NARUSE)
- Status changed from Rejected to Feedback
#10 - 01/22/2014 10:19 PM - normalperson (Eric Wong)
Btw, jemalloc 3.5 includes an updated non-standard experimental API.
It looks like it has the ability to specify different arenas for allocation (via MALLOCX_ARENA(a)). Perhaps could be used to distinguish long/short-lived allocations.
Probably worth experimenting on some day...
#11 - 01/26/2014 02:11 AM - normalperson (Eric Wong)
I tried jemalloc 3.5.0 vs eglIBC 2.13-38 (Debian x86_64)
http://80x24.org/bmlog-20140126-003136.7320.gz
Mostly close results, but I think our "make benchmark" suite is incomplete and we need more fork/concurrency-intensive benchmarks of large apps.
io_file_read and vm2_bigarray seem to be big losses because jemalloc tends to release large allocations back to the kernel more aggressively (and the kernel must zero that memory).
I have applied two patches for improved benchmark consistency:
https://bugs.ruby-lang.org/issues/5985#change-44442
https://bugs.ruby-lang.org/issues/9430
(Note: I still don't trust the vm_thread* benchmarks too much, they seem very inconsistent even with no modifications)
#12 - 02/18/2014 11:39 PM - sam.saffron (Sam Saffron)
I can confirm 2 findings. When heaps are small you barely notice a different. When heaps grow and general memory fragmentation grows, jemalloc is far better.
I see a 6% reduction of RSS running discourse bench on 2.1.0 https://github.com/discourse/discourse/blob/master/script/bench.rb
An artificial test is:
```ruby
@retained = []
MAX_STRING_SIZE = 100
def stress(allocate_count, retain_count, chunk_size)
chunk = []
while retain_count > 0 || allocate_count > 0
if retain_count == 0 || (Random.rand < 0.5 && allocate_count > 0)
chunk << " " * (Random.rand * MAX_STRING_SIZE).to_i
allocate_count -= 1
if chunk.length > chunk_size
chunk = []
end
else
@retained << " " * (Random.rand * MAX_STRING_SIZE).to_i
retain_count -= 1
end
end
start = Time.now
stress(1_000_000, 600_000, 200_000)
puts "Duration: #{(Time.now - start).to_f}"
puts `ps aux | grep #{Process.pid} | grep -v grep`
end
For glibc
sam@ubuntu ~ % time ruby stress_mem.rb
Duration: 0.705922489
sam 17397 73.0 2.5 185888 156884 pts/10 Sl+ 10:37 0:00 ruby stress_mem.rb
ruby stress_mem.rb 0.78s user 0.08s system 100% cpu 0.855 total
For jemalloc 3.5.0
Duration: 0.676871705
sam 17428 70.0 2.3 186248 144800 pts/10 Sl+ 10:37 0:00 ruby stress_mem.rb
LD_PRELOAD=/home/sam/Source/jemalloc-3.5.0/lib/libjemalloc.so ruby 0.68s user 0.09s system 100% cpu 0.771 total
You can see the 8% or so better RSS with jemalloc
Note the more iterations you add the better jemalloc does. up allocations to 10 million
jemalloc 200mb rss vs glibc 230mb rss
glibc gets fragmented at a far faster rate than jemalloc
#13 - 02/18/2014 11:53 PM - sam.saffron (Sam Saffron)
Note, this pattern of
1. Retaining large number of objects
2. Allocating a big chunk of objects (and releasing)
3. Repeating (2)
Is very representative of web apps / rails apps. For our application requests will range between 20k allocations and 200k allocations.
It is very much a scenario we want to optimise for.
on another note Rust lang just picked jemalloc, golang uses a fork of tcmalloc http://golang.org/src/pkg/runtime/malloc.h?h=tcmalloc
#14 - 02/19/2014 12:00 AM - normalperson (Eric Wong)
sam.saffron@gmail.com wrote:
An artificial test is:
```ruby
@retained = []
MAX_STRING_SIZE = 100
def stress(allocate_count, retain_count, chunk_size)
Note: I think we should seed the RNG to a constant to have consistent data between runs
srand(123)
chunk = []
while retain_count > 0 || allocate_count > 0
if retain_count == 0 || (Random.rand < 0.5 && allocate_count > 0)
chunk << " " * (Random.rand * MAX_STRING_SIZE).to_i
allocate_count -= 1
else
@retained << " " * (Random.rand * MAX_STRING_SIZE).to_i
retain_count -= 1
end
end
end
end
```
Sam: Thank you!
I think we should integrate this test into the mainline benchmark suite. Perhaps even provide an option to run with all the existing tests with the big @retained array.
ko1: what do you think?
#15 - 02/19/2014 12:05 AM - sam.saffron (Sam Saffron)
@eric (Eric Anderson)
sure bench needs a bit more love to be totally representative of a rails request. Also this test will do ko1 lots of help improving the promotion to oldgen algorithm, we are talking about changing oldgen promotion to either use additional flags (as a counter) or only promote on major GC.
Either change will slash RSS in this test.
```bash
sam@ubuntu ~ $ rbenv shell 2.1.0
sam@ubuntu ~ $ ruby stress_mem.rb
Duration: 5.459891703
sam@ubuntu ~ $ ruby stress_mem.rb
Duration: 5.619282557
```
This is basically a repro of the memory growth under 2.1.0 people are seeing.
238mb in Ruby 2.1 vs 125mb in 2.0
#16 - 02/21/2014 12:57 AM - nobu (Nobuyoshi Nakada)
I'm absolutely against including external libraries into ruby repository itself, e.g., libyaml.
It may not be the worst idea to bundle them with the tarballs.
@nobusan I think that would be a reasonable approach
@eric (Eric Anderson) / @ko1 (Koichi Sasada) / everyone
here are the results of running that script across every 5 builds in the last year (with seeded rand)
https://gist.github.com/SamSaffron/9162366
I think big jumps should be investigated
Btw, I also hope to experiment with a slab allocator since many internal objects are around the same size (like an OS kernel). This idea is originally from the Solaris kernel, but also in Linux and FreeBSD. One benefit with slab allocators over a general purpose malloc is malloc has too little context/information make some decisions:
- long-lived vs short-lived (good for CoW)
- shared between threads or not
- future allocations of the same class
Notes on slab: I don't think caching constructed objects like the reference Solaris implementation does is necessary (or even good), since it should be possible to transparently merge objects of different classes (like SLUB in Linux, I think).
Anyways, I think jemalloc is a great general-purpose malloc for things that don't fit well into slabs. And it should be easy to let a slab implementation switch back to general-purpose malloc for testing/benching.
Recently I'm working around this topic.
(1) Life-time oriented, similar to Copying GC
(2) CoW friendly (read only) memories
More detail about (2):
The following figure shows the stacked memory usage (snapshot) collected by valgrind/massif, on discourse benchmark by @sam's help.
http://www.atdot.net/fp_store/f.69bk1n/file.copipa-temp-image.png
Interestingly, 50MB is consumed by iseq (iseq.c, compile.c). Most of data are read only, so it can be more CoW friendly. Now, we mixes read-only data and r/w data such as inline cache.
There are several ideas. And I belive it is good topic to consider for Ruby 2.2.
--
// SASADA Koichi at atdot dot net
Btw, I also hope to experiment with a slab allocator since many internal objects are around the same size (like an OS kernel). This idea is originally from the Solaris kernel, but also in Linux and FreeBSD. One benefit with slab allocators over a general purpose malloc is malloc has too little context/information make some decisions:
- long-lived vs short-lived (good for CoW)
- shared between threads or not
- future allocations of the same class
Notes on slab: I don't think caching constructed objects like the reference Solaris implementation does is necessary (or even good), since it should be possible to transparently merge objects of different classes.
classes (like SLUB in Linux, I think).
Anyways, I think jemalloc is a great general-purpose malloc for things that don't fit well into slabs. And it should be easy to let a slab implementation switch back to general-purpose malloc for testing/benching.
Recently I'm working around this topic.
(1) Life-time oriented, similar to Copying GC
(2) CoW friendly (read only) memories
Yes. We should be able to do moving/defragmentation of long-lived internal allocations, even.
Interestingly, 50MB is consumed by iseq (iseq.c, compile.c). Most of data are read only, so it can be more CoW friendly. Now, we mixes read-only data and r/w data such as inline cahce.
Yes, also the iseq struct is huge (300+ bytes on 64-bit). I think we can shrink it (like I did with struct vtm/time_object) and move r/w data off to a different area.
There are several ideas. And I believe it is good topic to consider for Ruby 2.2.
OK; especially since this should have no public API breakage.
#20 - 02/26/2014 09:12 AM - normalperson (Eric Wong)
Sam: btw, if you have time, can you prepare a patch which integrates jemalloc with the build/tarball dist?
We should also see if using the non-standard jemalloc API is worth it. (with fallbacks to standard APIs on systems where jemalloc is unsupported).
#21 - 05/13/2014 02:58 AM - normalperson (Eric Wong)
- File 0001-configure.in-add-with-jemalloc-option.patch added
Attached patch to use jemalloc by default on GNU/Linux iff jemalloc is already installed. Maybe we can integrate/force it later, but this is a first step (and some distros like Debian already ship jemalloc).
#22 - 05/13/2014 03:22 AM - nobu (Nobuyoshi Nakada)
"linux-gnu" in "target_os" is substituted by "linux", so your AS_CASE never match. You should check for libjemalloc availability instead, I think.
"linux-gnu" in "target_os" is substituted by "linux", so your AS_CASE never match. You should check for libjemalloc availability instead, I think.
I used $target, not $target_os. An early version of my patch used $target_os, but I noticed it was a noop so I changed it to use $target.
I've tested this with bare "./configure" and also --without-jemalloc. Both work as expected on my GNU/Linux systems.
I worry this leads to platform-specific problems on non-GNU/Linux systems. It seems varnish/redis only tries jemalloc on Linux, too.
Also, I get one failure on both 32-bit and 64-bit:
```
[1/1] Test_StringModifyExpand#test_modifyExpand_memory_leak = 0.02 s
1. Failure:
Test_StringModifyExpand#test_modifyExpand_memory_leak
[/home/ew/ruby/test/-ext-/string/test_modifyExpand.rb:7]:
rb_str_modifyExpand().
size: 14307328 => 31084544..
Expected 2.1726309762381906 to be < 1.5.
```
It looks like certain allocation patterns are worse with jemalloc, but I think real-world apps use less memory.
I can update this to limit=2.2 to workaround the failure and commit my original patch soon. Any comment/objections?
Platform maintainers for non-GNU/Linux may enable jemalloc detection if they feel comfortable, but I don't want to potentially break things behind their backs. For example, I cannot test/fix OSX problems, but I have read using non-standard malloc is a difficult problem on that platform (but possible).
```
[1/1] Test_StringModifyExpand#test_modifyExpand_memory_leak = 0.02 s
1. Failure:
Test_StringModifyExpand#test_modifyExpand_memory_leak
[/home/ew/ruby/test/-ext-/string/test_modifyExpand.rb:7]:
rb_str_modifyExpand().
size: 14307328 => 31084544..
Expected 2.1726309762381906 to be < 1.5.
```
It looks like certain allocation patterns are worse with jemalloc, but I think real-world apps use less memory.
I can update this to limit=2.2 to workaround the failure and commit my original patch soon. Any comment/objections?
which one?
--
// SASADA Koichi at atdot dot net
```
[25 - 05/19/2014 09:18 PM - ko1 (Koichi Sasada)]
(2014/05/20 5:09), normalperson@yhbt.net wrote:
I can update this to limit=2.2 to workaround the failure and commit my original patch soon. Any comment/objections?
```
which one?
---
```
[26 - 05/19/2014 09:25 PM - ko1 (Koichi Sasada)]
Sorry I found https://bugs.ruby-lang.org/attachments/download/4424/0001-configure.in-add-with-jemalloc-option.patch
```
I want to suggest only add "--enable-jemalloc" (not default).
I'm afraid that it makes performance prediction more difficult.
(someone use it and someone doesn't use)
#27 - 05/19/2014 10:09 PM - normalperson (Eric Wong)
ko1@atdot.net wrote:
I want to suggest only add "--enable-jemalloc" (not default).
I am considering it, but I am not sure non-default is worth it over
nobu's original suggestion of using ".configure LIBS=-ljemalloc"
Sam: what do you think?
I'm afraid that it makes performance prediction more difficult.
(someone use it and someone doesn't use)
I understand. Maybe a big warning at the end of ./configure?
Fwiw, I am mildly against bundling jemalloc in the tarball. It is
more to maintain and keep up-to-date. Varnish no longer bundles
jemalloc for this reason, either.
I chose to detect + enable jemalloc by default since it can encourage
distributors and packagers to use and depend on it (like gmp).
#28 - 05/23/2014 09:59 PM - normalperson (Eric Wong)
Warning moved to the end of output where it may be more visible:
http://yhbt.net/ruby-9113-jemalloc-v2.patch
Comments?
#29 - 05/24/2014 04:07 AM - nobu (Nobuyoshi Nakada)
I'm still negative to enable it by default.
#30 - 05/24/2014 06:21 PM - kosaki (Motohiro KOSAKI)
On Sat, May 24, 2014 at 1:07 PM, nobu@ruby-lang.org wrote:
Issue #9113 has been updated by Nobuyoshi Nakada.
I'm still negative to enable it by default.
Do we have only one benchmark provided by Sam? I don't think it is
enough much comparison to make decision.
Anyway, I don't think Linux distros enable jemalloc because of their
packaging policy even if we enable by default.
So we need, at least
1. A way to disable it
2. Easy to detect which malloc is used from bug reports. For our maintenance.
#31 - 05/25/2014 01:48 AM - normalperson (Eric Wong)
KOSAKI Motohiro kosaki.motohiro@gmail.com wrote:
Do we have only one benchmark provided by Sam? I don't think it is
enough much comparison to make decision.
Empirical evidence on my 32-bit yahns server after running several days
shows ~40M RSS w/ jemalloc 3.0/3.6 vs 60-80M RSS for eglibc malloc on
Debian stable. I'll work on gathering more data for other systems.
Anyway, I don't think Linux distros enable jemalloc because of their
packaging policy even if we enable by default.
I know distros do not like bundling extra libs, but I'm not aware of policies against extra linkage for already packaged libraries.
Looking at Debian stable packages, both redis and varnish packages[1] use jemalloc on common architectures. For redis, Debian just favors the system jemalloc instead of the bundled one.
So we need, at least
1. A way to disable it
My patch respects the --without-jemalloc option
1. Easy to detect which malloc is used from bug reports. For our maintenance.
rb_bug already shows dynamically loaded libraries. My patch only enables dynamic link by default.
http://http.us.debian.org/debian/pool/main/r/redis/redis_2.4.14-1.debian.tar.gz
http://http.us.debian.org/debian/pool/main/v/varnish/varnish_3.0.2-2+deb7u1.dsc
http://http.us.debian.org/debian/pool/main/v/varnish/varnish_3.0.2.orig.tar.gz
http://http.us.debian.org/debian/pool/main/v/varnish/varnish_3.0.2-2+deb7u1.debian.tar.gz
#32 - 06/01/2014 07:27 PM - hansdegraaff (Hans de Graaff)
Eric Wong wrote:
ko1@atdot.net wrote:
I want to suggest only add "--enable-jemalloc" (not default).
I am considering it, but I am not sure non-default is worth it over nobu’s original suggestion of using "/configure LIBS=-ljemalloc"
Speaking from the Gentoo perspective: with "--enable-jemalloc" I could give my Gentoo users a choice of enabling jemalloc via our "USE flag" mechanism. I’d rather not do that with the LIBS mechanism since then I cannot be sure that this is a maintained and supported configuration.
Fwiw, I am mildly against bundling jemalloc in the tarball. It is more to maintain and keep up-to-date. Varnish no longer bundles jemalloc for this reason, either.
In Gentoo we would always remove or ignore the bundled version and build against our system version.
#33 - 06/02/2014 02:56 AM - nobu (Nobuyoshi Nakada)
Hans de Graaff wrote:
I’d rather not do that with the LIBS mechanism since then I cannot be sure that this is a maintained and supported configuration.
It's a common method for autoconfisticated programs.
Did you have troubles with it?
#34 - 06/02/2014 05:11 PM - hansdegraaff (Hans de Graaff)
Nobuyoshi Nakada wrote:
It's a common method for autoconfisticated programs.
Did you have troubles with it?
I have not tried. My point was that, being one of the Gentoo ruby maintainers, I would not want to use this mechanism to officially support jemalloc or tmalloc for the ruby packages that we offer in Gentoo.
#35 - 06/03/2014 12:42 AM - kosaki (Motohiro KOSAKI)
On Sat, May 24, 2014 at 9:48 PM, normalperson@yhbt.net wrote:
Issue #9113 has been updated by Eric Wong.
KOSAKI Motohiro <kosaki.motohiro@gmail.com> wrote:
Do we have only one benchmark provided by Sam? I don't think it is enough much comparison to make decision.
Empirical evidence on my 32-bit yahns server after running several days shows ~40M RSS w/ jemalloc 3.0/3.6 vs 60-80M RSS for eglibc malloc on Debian stable. I'll work on gathering more data for other systems.
So, I'd suggest two phase action.
1. Commit your patch, but disable by default.
2. Gather more use-case and performance data.
Note: They should be reproducible. We need measure them again and again when libs updated.
3. Change the default when the community is convinced the benefit.
#36 - 06/03/2014 01:10 AM - nobu (Nobuyoshi Nakada)
Hans de Graaff wrote:
My point was that, being one of the Gentoo ruby maintainers, I would not want to use this mechanism to officially support jemalloc or tmalloc for the ruby packages that we offer in Gentoo.
$ ./configure --help
(snip)
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations.
#37 - 06/04/2014 07:51 PM - normalperson (Eric Wong)
KOSAKI Motohiro <kosaki.motohiro@gmail.com> wrote:
So, I'd suggest two phase action.
1. Commit your patch, but disable by default.
OK, r46349
1. Gather more use-case and performance data.
Note: They should be reproducible. We need measure them again and again when libs updated.
2. Change the default when the community is convinced the benefit.
I wouldn't mind changing the default. However small applications take up more memory with jemalloc. Using MALLOC_CONF=lg_chunk:21 or smaller numbers can reduce it (at performance cost).
Users may also try the Lockless Inc allocator. However we cannot ship it with Ruby since Ruby is not GPLv3.
http://locklessinc.com/downloads/
#38 - 06/05/2014 01:06 AM - hsbt (Hiroshi SHIBATA)
I tried to build with --with-jemalloc option.
OS X 10.9.4 pre-release
jemalloc-3.6.0 via homebrew
r46350
but it got build failure.
checking for malloc_conf in -ljemalloc... no
configure: error: jemalloc requested but not found
libjemalloc.dylib is following location:
$ ls -l /usr/local/lib/libjemalloc.dylib
lrwxr-xr-x 1 hsbt admin 46 6 5 09:18 /usr/local/lib/libjemalloc.dylib -> ../Cellar/jemalloc/3.6.0/lib/libjemalloc.dylib
config.log: https://gist.github.com/hsbt/87f2748dd4117d3cd139
#39 - 06/05/2014 01:58 AM - nobu (Nobuyoshi Nakada)
jemalloc prefixes "je_" to each public symbols at Mach-O (Mac OS X) and PE-COFF (Windows), so it can't be drop-in by default.
Or you have to install it with --with-jemalloc-prefix option unless compiling with "jemalloc/jemalloc.h".
#40 - 06/05/2014 05:16 AM - nobu (Nobuyoshi Nakada)
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
Applied in changeset r46354.
configure.in, missing.h: jemalloc mangling
- configure.in (with-jemalloc): also check for header, for ABIs which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF platforms. [ruby-core:62939] [Feature #9113]
- include/ruby/missing.h: include alternative malloc header to replace memory management functions.
- dln.c, io.c, parse.y, st.c: undef malloc family before re-definition to suppress warnings.
#41 - 08/20/2014 07:48 PM - normalperson (Eric Wong)
SASADA Koichi ko1@atdot.net wrote:
Recently I'm working around this topic.
(1) Life-time oriented, similar to Copying GC
(2) CoW frindly (read only) memories
More detail about (2):
The following figure shows the stacked memory usage (snapshot) collected by valgrind/massif, on discorse benchmark by @sam's help.
http://www.atdot.net/fp_store/f.69bk1n/file.copipa-temp-image.png
Interestingly, 50MB is consumed by iseq (iseq.c, compile.c). Most of data are read only, so it can be more CoW frindly. Now, we mixes read-only data and r/w data such as inline cahce.
There are several ideas. And I belive it is good topic to consider for Ruby 2.2.
ko1: any progress on this front? I may use dlmalloc mspace API[1] to make a special CoW-friendly heap for read-only parts of the iseq structure (and probably other read-only data such as frozen pathnames).
And continue using regular malloc (e.g. jemalloc) for r/w heap.
<table>
<thead>
<tr>
<th>File Name</th>
<th>Size</th>
<th>Date</th>
<th>Author</th>
</tr>
</thead>
<tbody>
<tr>
<td>0001-configure.in-add-with-jemalloc-option.patch</td>
<td>1.29 KB</td>
<td>05/13/2014</td>
<td>normalperson (Eric Wong)</td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://bugs.ruby-lang.org/issues/9113.pdf", "len_cl100k_base": 9111, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 31327, "total-output-tokens": 10829, "length": "2e13", "weborganizer": {"__label__adult": 0.00023615360260009768, "__label__art_design": 0.0002510547637939453, "__label__crime_law": 0.0001852512359619141, "__label__education_jobs": 0.00019729137420654297, "__label__entertainment": 4.988908767700195e-05, "__label__fashion_beauty": 8.654594421386719e-05, "__label__finance_business": 0.00015842914581298828, "__label__food_dining": 0.0001982450485229492, "__label__games": 0.0003573894500732422, "__label__hardware": 0.0005879402160644531, "__label__health": 0.00015842914581298828, "__label__history": 0.00012010335922241212, "__label__home_hobbies": 6.127357482910156e-05, "__label__industrial": 0.00017964839935302734, "__label__literature": 0.000125885009765625, "__label__politics": 0.00013589859008789062, "__label__religion": 0.0002117156982421875, "__label__science_tech": 0.003726959228515625, "__label__social_life": 6.252527236938477e-05, "__label__software": 0.010406494140625, "__label__software_dev": 0.98193359375, "__label__sports_fitness": 0.00014662742614746094, "__label__transportation": 0.00018215179443359375, "__label__travel": 0.00011527538299560548}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 33004, 0.06386]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 33004, 0.09611]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 33004, 0.81278]], "google_gemma-3-12b-it_contains_pii": [[0, 2858, false], [2858, 6517, null], [6517, 8381, null], [8381, 11861, null], [11861, 14022, null], [14022, 16152, null], [16152, 18684, null], [18684, 20493, null], [20493, 22933, null], [22933, 25236, null], [25236, 27936, null], [27936, 30356, null], [30356, 32743, null], [32743, 33004, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2858, true], [2858, 6517, null], [6517, 8381, null], [8381, 11861, null], [11861, 14022, null], [14022, 16152, null], [16152, 18684, null], [18684, 20493, null], [20493, 22933, null], [22933, 25236, null], [25236, 27936, null], [27936, 30356, null], [30356, 32743, null], [32743, 33004, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 33004, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 33004, null]], "pdf_page_numbers": [[0, 2858, 1], [2858, 6517, 2], [6517, 8381, 3], [8381, 11861, 4], [11861, 14022, 5], [14022, 16152, 6], [16152, 18684, 7], [18684, 20493, 8], [20493, 22933, 9], [22933, 25236, 10], [25236, 27936, 11], [27936, 30356, 12], [30356, 32743, 13], [32743, 33004, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 33004, 0.00644]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
66fe149464665f014482f852965fe61cac24bef9
|
NetKit-SRL Userguide
Sofus A. Macskassy
smacskas@stern.nyu.edu
Dept. of Information, Operations & Mgmt Sciences
Leonard N. Stern School of Business
New York University, 44 W. 4th Street
New York, NY 10012-1126
May 24, 2005
Contents
1 System Requirements ................................................. 1
2 Installation .......................................................... 2
3 Running NetKit ...................................................... 3
3.1 Data Files ...................................................... 3
3.1.1 Schema file .............................................. 3
3.1.2 Node files .............................................. 4
3.1.3 Edge files .............................................. 4
3.2 Command-line options ......................................... 6
3.2.1 Option -attribute ....................................... 6
3.2.2 Option -depth .......................................... 6
3.2.3 Option -format ......................................... 7
3.2.4 Option -inferenceMethod ................................ 7
3.2.5 Option -known .......................................... 8
3.2.6 Option -lclassifier ..................................... 8
3.2.7 Option -learnWithTruth ................................ 9
3.2.8 Option -loo .............................................. 9
3.2.9 Option -output ......................................... 9
3.2.10 Option -priorfile ...................................... 9
3.2.11 Option -pruneSingletons ............................... 10
3.2.12 Option -pruneZeroKnowledge ......................... 10
3.2.13 Option -rclassifier .................................. 10
3.2.14 Option -runs .......................................... 11
3.2.15 Option -sample ........................................ 11
3.2.16 Option -saveItPredict ................................ 11
3.2.17 Option -saveROC ...................................... 12
3.2.18 Option -seed .......................................... 12
3.2.19 Option -showAUC ...................................... 12
3.2.20 Option -showAssort ................................... 12
3.2.21 Option -showItAcc .................................... 12
3.2.22 Option -test .......................................... 12
3.2.23 Option -truth ......................................... 13
3.2.24 Option -vprior ....................................... 13
3.2.25 Option -key ........................................... 13
3.3 Example runs .................................................. 14
3.3.1 Getting help screen ..................................... 14
3.3.2 Basic run .............................................. 14
3.3.3 Evaluation using k-fold cross-validation ............... 14
3.3.4 Evaluation using explicit sampling sizes ............... 14
3.3.5 Applying to a partially/unlabeled labeled graphs ...... 15
3.3.6 Customizing the output format for scores ............... 15
List of Tables
3.1 NetKit filename conventions. .......................................................... 3
3.2 NetKit schema specification. ......................................................... 4
3.3 Example NetKit schema file. ......................................................... 5
3.4 Brief list of command-line options. ............................................. 6
3.5 Specification for 'format' string using -format option. .............. 7
3.6 Valid tags and their node-specific values for the 'format' string using the -format option. .................................................. 7
3.7 Valid parameters for the -inferenceMethod option. ................... 8
3.8 Valid parameters for the -lclassifier option. .............................. 9
3.9 File format for -priorfile option. .............................................. 10
3.10 Valid parameters for the -rclassifier option. ............................. 10
3.11 Valid values for aggregation key. ............................................. 11
3.12 Valid values for aggregators key. ............................................ 11
4.1 Property files used by NetKit ....................................................... 16
4.2 Logging levels. ........................................................................... 17
4.3 Default NetKit logging handler. ................................................... 17
4.4 Configuration parameters for a FileHandler. ............................. 18
4.5 Example FileHandler definition. ................................................. 18
4.6 Default logging levels for NetKit components. ......................... 18
4.7 Syntax for defining and configuring an inference method. .......... 18
4.8 Default relaxation labeling configuration. ................................ 18
4.9 Default network-only logistic-regression configuration. ........... 18
4.10 Syntax for defining an aggregator. ............................................. 19
4.11 Default WEKA configuration file. ............................................. 19
Chapter 1
System Requirements
NetKit requires java 1.5+. For many learning tasks, the optional weka machine learning library (jar-file) is also needed. NetKit needs version 3.4+ of this toolkit.\(^1\) It is available at:
http://www.cs.waikato.ac.nz/~ml/weka/index.html
You will need to name the library “weka.jar”. If you only plan on using the homophily-based methods such as the weighted-vote Relational Neighbor, then you will not need the weka library.
For more information, please refer to the technical report:
This report describes the various learning and inferencing components in detail. These components are not discussed in this document.
---
\(^1\)It is known to work with version 3.4.2
Chapter 2
Installation
Installing NetKit is very simple:
1. Obtain the zipfile (NetKit.zip) or gzipped tarfile (NetKit.tgz) from:
http://www.research.rutgers.edu/~sofmac/NetKit.html
If you are running windows, you will probably want the zipfile, and if you are on a MacOS, Linux or any kind of unix system then you will probably want the gzipped tarfile (they both contain the exact same files, and this is only a matter of uncompressing the files).
2. Uncompress the compressed file. This should result in a directory structure:
NetKit/
examples/
The primary directory contains the following files:
NetKit.jar
NetKit.properties
aggregator.properties
distance.properties
inferencemethod.properties
lclassifier.properties
logging.properties
rclassifier.properties
readestimate.properties
weka.jar (optional, depending on the compressed file you download)
weka.properties
The examples directory contains a list of example files and the file:
example-runs.txt
This file shows a list of possible ways to run NetKit.
3. Download the weka library, if needed, and put it in the NetKit directory.¹
Note: you must name the weka library: weka.jar
4. Install java 1.5+ if you haven’t already.
5. You are done.
¹The library (you need at least version 3.4) can be downloaded at http://www.cs.waikato.ac.nz/~ml/weka/index.html
Chapter 3
Running NetKit
NetKit is a commandline tool. It requires a dos-prompt or command-line prompt and is all text based. It takes as input a set of flat files and outputs its predictions to either the screen or a given filename. This section describes in more detail what is needed to run NetKit.
3.1 Data Files
NetKit takes as its primary input a schema file, which describes the schema of the data in terms of nodes and edges. The data for each type of node and edge should defined in its own separate file. The filename conventions listed in Table 3.1.
<table>
<thead>
<tr>
<th>filename</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>dataset.arff</td>
<td>The schema file should always end in .arff</td>
</tr>
<tr>
<td>nodetype.csv</td>
<td>Files describing nodes and attributes end in .csv</td>
</tr>
<tr>
<td>edgetype.rn</td>
<td>Files describing edges end in .rn</td>
</tr>
</tbody>
</table>
Table 3.1: NetKit filename conventions.
NetKit, for legacy reasons, also supports GDA format from the k-Groups/GDA software released by the Auton Lab at Carnegie Mellon University. We will not specify, or talk about, this format here. For more information about the GDA format, please go to:
http://www.autonlab.org/autonweb/showSoftware/147/
(this link was working on May 11, 2005).
3.1.1 Schema file
The name of the schema file should follow the filenaming convention:
`dataset.arff`
where `dataset` can be any name, such as a descriptive name of the data.
The schema file format specification is shown in Table 3.2.
Note that node-types referred to in an edge-type definition must be defined above the edge-type definition. Other than that, edges and nodes can be defined in any order.
**DEFAULT PREDICTION ATTRIBUTE:** Note that the last attribute of the first node-type will be the default attribute to build a model for and do estimation on. Also note that the attribute to build a model for currently must be of type categorical.
An example schema file is shown in Table 3.3. The schema consists of people, transactions and items. People can be connected to each other directly through marriage and children/parent links. People also have transactions and two people could be linked by following the edges Order–Items–OrderedIn–OrderedBy.
Table 3.2: NetKit schema specification.
3.1.2 Node files
The name of a node file should follow the filenaming convention:
nodefile.csv
where nodefile can be any name, such as a descriptive name of the nodetype. The file itself consists of lines with values on a line being separated by commas. Each line represents a node of the given nodetype, and the values should be in the exact same order as given in the nodetype block in the schema file.
NOTE: Unknown values must be identified by a '?'.
3.1.3 Edge files
The name of an edge file should follow the filenaming convention:
edgefile.rn
where edgefile can be any name, such as a descriptive name of the edgetype. The file itself consists of lines with values on a line being separated by commas. Each line represents an edge of the given edgetype, and must follow the format:
srcID,destID,weight
where srcID and destID refers to the IDs of the nodes being connected, and the weight is a positive real value representing the strength of the connection between the two nodes. This weight is generally 1, but could also be larger numbers representing information such as how often two people have met.
Table 3.3: Example NetKit schema file.
3.2 Command-line options
NetKit can be run in one of two ways:
```
NetworkLearning [OPTIONS] schema-file
NetworkLearning [OPTIONS] -gda class-file edge-file
```
The GDA option takes two GDA files as specified by their software (for more info on GDA support, see §3.1). The available options, which will be explained in greater detail below, are listed in Table 3.4.
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>-h</td>
<td>a help screen</td>
</tr>
<tr>
<td>-attribute NT:A</td>
<td>which attribute(A) to classify, where NT is the nodetype</td>
</tr>
<tr>
<td>-depth d</td>
<td>when training, make neighbor class labels visible up to depth d</td>
</tr>
<tr>
<td>-format 'string'</td>
<td>output result lines using this line-format</td>
</tr>
<tr>
<td>-inferenceMethod ic</td>
<td>use the given inference method</td>
</tr>
<tr>
<td>-known FILE</td>
<td>a file consisting of known labels</td>
</tr>
<tr>
<td>-lclassifier lc</td>
<td>use the given local (non-relational) classifier</td>
</tr>
<tr>
<td>-learnWithTruth</td>
<td>use complete truth for learning a model</td>
</tr>
<tr>
<td>-loo</td>
<td>perform a leave-one-out estimation</td>
</tr>
<tr>
<td>-output FILE</td>
<td>where to send output estimates</td>
</tr>
<tr>
<td>-priorfile FILE</td>
<td>read in prior estimates from the given file</td>
</tr>
<tr>
<td>-pruneSingletons</td>
<td>remove singleton nodes in the graph</td>
</tr>
<tr>
<td>-pruneZeroKnowledge</td>
<td>remove zeroKnowledge nodes in the graph</td>
</tr>
<tr>
<td>-rclassifier rc</td>
<td>use the given relational classifier</td>
</tr>
<tr>
<td>-runs r</td>
<td>perform r train-test runs</td>
</tr>
<tr>
<td>-sample s</td>
<td>how much of the graph to sample for training purposes</td>
</tr>
<tr>
<td>-saveItPredict</td>
<td>save the predictions after each inference iteration</td>
</tr>
<tr>
<td>-saveROC</td>
<td>save ROC curves after final iteration, one per class.</td>
</tr>
<tr>
<td>-seed seed</td>
<td>use this random seed for sampling</td>
</tr>
<tr>
<td>-showAUC</td>
<td>show the Area Under the ROC curve (for each class)</td>
</tr>
<tr>
<td>-showAssort</td>
<td>sow assortativity coefficients.</td>
</tr>
<tr>
<td>-showItAcc</td>
<td>show the accuracy after each inference iteration</td>
</tr>
<tr>
<td>-test FILE</td>
<td>a file consisting of the IDs and labels of nodes to test on</td>
</tr>
<tr>
<td>-truth FILE</td>
<td>a file consisting of true labels</td>
</tr>
<tr>
<td>-vprior FILE</td>
<td>read class priors from this file</td>
</tr>
<tr>
<td>-key value</td>
<td>overrides properties of the same name in the NetKit properties files</td>
</tr>
</tbody>
</table>
Table 3.4: Brief list of command-line options.
3.2.1 Option -attribute
This option is used to specify which attribute to build a model for and do estimation on. NT is the name of the node-type as given in the schema file, and A is the name of the attribute.
**NOTE:** The attribute to build a model for currently must be of type categorical.
**SYNTAX:** -attribute NT : A
**DEFAULT:** The last attribute of the first node-type in the schema file.
3.2.2 Option -depth
This option is primarily for testing purposes. When estimating the performance of a model, some known labels $v_{test}$ are hidden while learning the model $M$. Model $M$ is then applied to estimate the labels in $v_{test}$. This option is used to make labels of neighbors up to the given depth visible while training model $M$. With this, it is possible to get an estimate of how well you could do, were you to be given this information. This can also be thought of as sampling subgraphs of the given depth.
3.2.3 Option -format
This option specifies the format of the predictions. NetKit will output a prediction for each of the nodes that are given in the test set (see §3.2.5, §3.2.15). Each such prediction is printed on one line, using the given output format.
**SYNTAX:** -format 'FORMAT'
<table>
<thead>
<tr>
<th>tag</th>
<th>value</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>the id(KEY) of the node whose attribute-value is estimated</td>
</tr>
<tr>
<td>class</td>
<td>the true (if known) value of the attribute</td>
</tr>
<tr>
<td>label</td>
<td>alias for the 'class' tag</td>
</tr>
</tbody>
</table>
| string | the score for the class defined by 'string'
| (this class must be one of the possible categorical values for the attribute whose value is being estimated) |
| predictlabel | the attribute-value with the highest score |
| predictscore | the highest score |
| prediction!string | this is equivalent to the string: |
| string:%string |
| EXCEPT: if the string is the same as the predicted class, in which case this evaluates to an empty string. |
Table 3.6: Valid tags and their node-specific values for the 'format' string using the -format option.
**DEFAULT** value is based on the categories of the attribute to be estimated. If we assume that the possible values are \{high, medium, low\}, then the default format string is:
'\%id %label %predictlabel:%predictscore %prediction!high %prediction!medium %prediction!low'
**EXAMPLE:** This option makes it very flexible to customize the output needed. For example, were you to estimate whether a person is a threat, where the attribute could take on either 'threat' or 'nonthreat' you could generate an SQL insertion command for each of the predicted scores:
'insert into persontable (id,threatscore) values (%id,%threat);'
or you could update an existing table:
'update persontable set threatscore = %threat where id = %id;'
3.2.4 Option -inferenceMethod
This option is used to tell NetKit which inference method to use. The list of available inference methods are given in the help page (use the '-h' option). Also, you can inspect the inferencemethod.properties file (see §4.2).
Currently valid parameters are listed in Table 3.7. These can be configured and customized in a properties file (see §4.2). Their default configurations can be overridden on the commandline by specifying different values for their configuration parameters (using the “-key value” option).
<table>
<thead>
<tr>
<th>IC</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>null</td>
<td>no inference is to take place. In this case, the local classifier is applied, and then the relational classifier is applied only once</td>
</tr>
</tbody>
</table>
| relaxlabel | relaxation labeling is used. valid key-value pairs (see §3.2.25):
| | numit, how many iterations to run (default: 99)
| | beta, what is the initial temperature (default: 1)
| | decay, how much to decay beta at each iteration (default: 0.99) |
| gibbs | gibbs sampling valid key-value pairs (see §3.2.25):
| | numit, how many iterations to run (default: 2000)
| | burnin, what are the number of burnin iterations (default: 200)
| | numchains, how many chains to run (default: 10) |
| iterative | iterative classification valid key-value pairs:
| | numit, how many iterations to run (default: 1000) |
Table 3.7: Valid parameters for the -inferenceMethod option.
### 3.2.5 Option -known
The -known option is used to specify the known attribute information. This can be used in two ways:
1. If the nodetable has more information and you want to evaluate the learning performance based only on the specified information.
2. Using this, you can introduce 'noise' without changing the original table.
NetKit will assume that it is to estimate the attribute values for all nodes not specified in the given known file. This can be overridden by using the -test option (see §3.2.22).
**SYNTAX:** -known FILE
**DEFAULT:** none
The file format of the known file is:
| id,known-value,
| ...
| id_k,known-value_k |
### 3.2.6 Option -lclassifier
This option is used to tell NetKit which local, or non-relational, classifier to use. The local classifier is used to initialize the priors. Using this by itself is akin to traditional machine learning. The list of available classifiers are given in the help page (use the '-h' option). Also, you can inspect the lclassifier.properties file (see §4.4).
**SYNTAX:** -lclassifier LC
**DEFAULT:** classprior
Currently valid parameters are listed in Table 3.8. These can be configured and customized in a properties file (see §4.4). Their default configurations can be overridden on the commandline by specifying different values for their configuration parameters (using the “-key value” option).
null does nothing
classprior sets all to-be-estimated attributes to the class prior
the class prior can be overridden by using the -vprior option (see §3.2.24).
uniform sets all to-be-estimated attributes to a uniform distribution
external gets priors from an external file.
you must use the -priorfile option with this (see §3.2.10).
weka There are various classifiers from WEKA defined. You must refer to the properties file for these definitions (see §4.4).
NOTE: This requires the WEKA library.
<table>
<thead>
<tr>
<th>Table 3.8: Valid parameters for the -lclassifier option.</th>
</tr>
</thead>
</table>
### 3.2.7 Option -learnWithTruth
This option is used for testing purposes. It tells NetKit to learn models based on the truth. It will build models based on the training samples as implied by the -known (§3.2.5), -test (§3.2.22) or -sample (§3.2.15) options, but it will have access to the complete truth when learning the models (e.g., although neighbor nodes might not be in the training set, their attributes will be available when learning the model).
**SYNTAX:** `-learnWithTruth`
### 3.2.8 Option -loo
This option is used for testing purposes. It runs a leave-one-out estimation: With-hold the attribute value of one node, learn a model based on all other nodes, then apply the model to the with-held node. Do this for all nodes and report the final performance statistics. Because there is always only one node to be tested, no collective inferencing (see §3.2.4) is done—just like using the null inference method.
**SYNTAX:** `-loo`
This cannot be used with any of the other options that imply a train/test split on the nodes in the data. These options include:
**CANNOT BE USED WITH:**
- `-known`, `-runs`, `-sample`, `-test`
### 3.2.9 Option -output
This option specifies a file-stem of where to send predictions. The actual file it will be sent to is: `FILE.predict`
This option is also indirectly used by the `saveItPredict` (§3.2.16) and `saveROC` (§3.2.17) options.
**SYNTAX:** `-output FILE`
**DEFAULT:** standard output
### 3.2.10 Option -priorfile
Use this option with the external local classifier (see §3.2.6). The option specifies an external file from which to read initial priors.
**SYNTAX:** `-priorfile FILE`
**DEFAULT:** none
The current supported file format for this external file is listed in Table 3.9.
Each line contains a prediction for a given node, where the ID identifies the node and the truevalue specifies what the truth is. There must be a score for each of the possible labels for the attribute being estimated. The ordering of these scores does not matter.
3.2.11 Option -pruneSingletons
Use this option to prune out nodes in the data that are not connected to any other nodes. This is the setting that is often used for evaluating the relational learners, as these singleton nodes obviously have no relations and therefore do not give any insight into how well the relational learners are performing.
**SYNTAX:** -pruneSingletons
3.2.12 Option -pruneZeroKnowledge
This is a stronger pruning than the -pruneSingletons (see §3.2.11) option. Given a set of nodes whose labels are known (the training examples), this setting will remove any node in the graph that are not connected (directly or indirectly) to a node in the training set.
**SYNTAX:** -pruneZeroKnowledge
3.2.13 Option -rclassifier
This option is used to tell NetKit which relational, classifier to use. The relational classifier is used in the inner loop of the collective inference methods. The list of available classifiers are given in the help page (use the ‘-h’ option). Also, you can inspect the rclassifier.properties file (see §4.3).
**SYNTAX:** -rclassifier
**DEFAULT:** wvrn
Currently some of the valid parameters are listed in Table 3.10. These can be configured and customized in a properties file (see §4.3). Their default configurations can be overridden on the commandline by specifying different values for their configuration parameters (using the “-key value” option).
<table>
<thead>
<tr>
<th>wvrn</th>
<th>use the weighted-vote Relational Neighbor classifier</th>
</tr>
</thead>
<tbody>
<tr>
<td>(previously referred to as pRN—the probabilistic Relational Neighbor)</td>
<td></td>
</tr>
<tr>
<td>cdnnormcos</td>
<td>use the class-distributional RN classifier with normalized</td>
</tr>
<tr>
<td></td>
<td>values of neighbor-class values and using the cosine distance metric</td>
</tr>
<tr>
<td></td>
<td>valid key-value pairs (in addition to those specified below):</td>
</tr>
<tr>
<td></td>
<td>distance, which distance function to use (cosine, l1, l2)</td>
</tr>
<tr>
<td>nobayes</td>
<td>use the network-only Bayes classifier (with a markov random field formulation).</td>
</tr>
<tr>
<td>nolb-lr-distrib</td>
<td>use the logistic regression link-based classifier where values are normalized. <strong>NOTE:</strong> This requires the WEKA library.</td>
</tr>
<tr>
<td>nolb-lr-count</td>
<td>use the logistic regression link-based classifier where values are absolute counts. <strong>NOTE:</strong> This requires the WEKA library.</td>
</tr>
<tr>
<td>weka</td>
<td>There are various classifiers from WEKA defined. You must refer to the properties file for these definitions (see §4.3). <strong>NOTE:</strong> This requires the WEKA library.</td>
</tr>
<tr>
<td>*</td>
<td>key-value pairs that are valid with any of the above:</td>
</tr>
<tr>
<td></td>
<td>aggregation, which attributes to aggregate on</td>
</tr>
<tr>
<td></td>
<td>aggregators, which aggregators to use</td>
</tr>
<tr>
<td></td>
<td>useintrinsic, include intrinsic variables when learning the model (true, false)</td>
</tr>
</tbody>
</table>
Table 3.10: Valid parameters for the -rclassifier option.
Valid values for the **aggregation** key are listed in Table 3.11.
Valid values for the **aggregators** are listed in Table 3.12. You can specify a list of aggregators through a comma-separated list. See §4.5 for more information about aggregators.
### 3.2.14 Option -runs
This option is used for testing and evaluation of the system. It tells the system how many test runs to perform. The system will output performance statistics on each run as well as a summary statistic across all runs. Each test run is based on a new training set and test set split. These splits can be defined in two ways. See §3.2.15 for details.
**SYNTAX:** -runs int
**DEFAULT:** 10
This cannot be used with leave-one-out or any of the options that imply only one train/test split on the nodes in the data. These options include:
**CANNOT BE USED WITH:**
- -loo, -known, -test
### 3.2.15 Option -sample
This option is used for evaluation and testing of the learning system. It is used to specify how much of the graph to use as the training set (the remaining part is then used to test the system). The amount of the graph to use for training can be specified in three ways:
1. **absolute** — if the value given is 1 or larger, then it is assumed to be an integer and tells the system how many nodes (randomly sampled) to use for learning a model.
2. **relative** — if the value given lies between 0 and 1, then it is used as the ratio of the nodes (e.g., 0.2 means to randomly sample 20% of the nodes for training).
3. **cross-validation** — if the value given is 0, then the system will perform a cross-validation based on the number of runs specified by the -runs option (see §3.2.14). This is equivalent to specifying a ratio of $\frac{1}{\#\text{runs}}$.
**SYNTAX:** -sample (int|real)
**DEFAULT:** 0
### 3.2.16 Option -saveItPredict
This option tells the system to save for each iteration of the inference step the predictions at that iteration. The system will output the predictions to the files:
FILE.iteration#.predict
where FILE is the name specified in the -output option (see §3.2.9).
**SYNTAX:** -saveItPredict
3.2.17 Option -saveROC
This option tells the system to save the ROC curves that can be used to visualize system performance. The system will output the ROC curves to the files:
FILE-class-value-run#.roc
where FILE is the name specified in the -output option (see §3.2.9). If no name has been specified, then FILE is set to “roc”.
SYNTAX: -saveROC
3.2.18 Option -seed
Use this option to set the random seed that is used by the system for any stochastic processes.
SYNTAX: -seed long
DEFAULT: random value based on current time
3.2.19 Option -showAUC
This is an evaluation option which tells the system to output the Area Under the ROC Curve (AUC) as part of the evaluation metrics. There will be one AUC for each possible value of the class attribute, which reflects how well the prediction-scores for that class-value are separated from all other classes.
SYNTAX: -showAUC
3.2.20 Option -showAssort
This is an option to report graph statistics. Using this option, NetKit will report the assortativity value for the graph, both based on the ‘truth’ as well as for each of the ‘training’ sets.
SYNTAX: -showAssort
3.2.21 Option -showItAcc
This is an option to report inference statistics. Using this option, NetKit will report the accuracy of the predictions after every inference iteration if the number of iterations to run is < 250, otherwise it will show the accuracies after every 10 iterations.
SYNTAX: -showItAcc
3.2.22 Option -test
This option is used to specify which nodes in the graph to estimate predictions for, where the test file specifies node ids as well as an attribute value against which to evaluate the predictions. NetKit will assume that it is to learn a model based on all nodes not specified in the given test file. This can be overridden by using the -known option (see §3.2.5).
SYNTAX: -test FILE
DEFAULT: none
The file format of the test file is:
id1,test-value1
...
idk,test-valuek
This cannot be used with leave-one-out or any of the options that imply more than one train/test split on the nodes in the data. These options include:
CANNOT BE USED WITH:
- loo, -sample, -runs
3.2.23 Option -truth
This option is used to specify the ground truth against which all evaluations are based. This will override any values seen in the node-table.
<table>
<thead>
<tr>
<th>SYNTAX:</th>
<th>-truth FILE</th>
</tr>
</thead>
<tbody>
<tr>
<td>DEFAULT:</td>
<td>none</td>
</tr>
</tbody>
</table>
The file format of the truth file is:
id, true-value
...
$id_k$, true-value
3.2.24 Option -vprior
Use this option to tell NetKit the probability of seeing each of the possible attribute values for the attribute NetKit is to predict. If this is not specified, then it will be estimated from the training set. This can be used in various manners, but is especially important if the training set does not contain at least one instance of each possible class (this can happen if we are only given positive instances but not negative instances — for example, we only know a few entities to be malicious but know of no entities that are known to be benign).
<table>
<thead>
<tr>
<th>SYNTAX:</th>
<th>-vprior FILE</th>
</tr>
</thead>
<tbody>
<tr>
<td>DEFAULT:</td>
<td>none</td>
</tr>
</tbody>
</table>
The file format of the vprior file is:
value, probability
...
value, probability
The probability values will be normalized to add to 1 if they don’t already. Also, all possible attribute values must be listed in the file.
EXAMPLE: If NetKit is to predict whether the threat-level of an entity, where the possible values are \{high, medium, low\}, then the vprior file might look like this:
| high, 0.01 |
| medium, 0.05 |
| low, 0.94 |
In this case, the a priori probability of being a high threat is 1%, being a medium level threat is 5% and being a low threat is 94%.
3.2.25 Option -key
This last option in NetKit is used to override any configuration parameters in the property files. For example, if a property in a file is:
cdrm.distance=cosine
then the key is “distance” and the value is “cosine”. To override the value of this parameter to be “l2” for this particular run of NetKit, you would use the option
<table>
<thead>
<tr>
<th>SYNTAX:</th>
<th>-key VALUE</th>
</tr>
</thead>
<tbody>
<tr>
<td>DEFAULT:</td>
<td>N/A</td>
</tr>
</tbody>
</table>
To get a list of various keys, see any of the tables above, or see the sections describing the various property files in §4.
3.3 Example runs
There are more example runs described in the examples directory that should have come with the NetKit package. The example runs described in this section will work using the example files provided. The example runs assume the following directory structure:
```
some-path/NetKit/{all netkit jar files and property files} some-path/NetKit/examples/{example files}
```
Change directory to:
```
some-path/NetKit/examples
```
NOTE: NetKit by default sends logging output to STDOUT. Unless you use the (-output) parameter, predictions will also go to STDOUT.
The example runs show how to use simple combinations of parameters. These can be combined to your own specifications.
### 3.3.1 Getting help screen
You can run NetKit with no parameters to get help:
```
java -jar ../NetKit.jar
```
### 3.3.2 Basic run
The basic run takes only a schema file as its input:
```
java -jar ../NetKit.jar goodbad-schema.arff
```
This will perform a 10-fold cross validation run (or whichever is the max number of nodes). By default, NetKit will use the class prior as the local classifier, the weighted vote Relational Neighbor classifier as the relational classifier and relaxation labeling as the inference method. These defaults can be changed by editing the NetKit.properties file. This run is to be used for evaluation only as it assumes that everything is known in the graph.
### 3.3.3 Evaluation using \( k \)-fold cross-validation
To use a \( k \)-fold cross validation, you need to use the -runs (§3.2.14) option. This run uses a 5-fold cross validation and sends the output predictions to goodbad-out.predict (-output):
```
java -jar ../NetKit.jar -runs 5 -output goodbad-out goodbad-schema.arff
```
This run assumes that the graph is completely labeled. It splits the nodes into 5 equal-sized sets and performs 5 evaluations runs where it holds out one of the sets and trains on the rest. It then predicts the holdout set and finally reports summary performance statistics.
### 3.3.4 Evaluation using explicit sampling sizes
If you want to do sensitivity analysis on how much data is labeled, then you need to use the -sample (§3.2.15) option. This example performs 20 runs where it samples 10% at every run to train on (and test on the remaining 90%). It sends the output to goodbad-out.predict and uses the priors specified in the goodbad-classprior file to set the initial priors on the unknowns:\(^1\):
```
java -jar ../NetKit.jar -runs 20 -sample 0.1 -vprior goodbad-classprior -output goodbad-out goodbad-schema.arff
```
\(^1\)Remember that by default NetKit uses the classprior local classifier—we use the file to specify what that class prior should be.
### 3.3.5 Applying to a partially/unlabeled labeled graphs
If the graph is only partially labeled, or even unlabeled, then you can specify a set of nodes and their labels for NetKit to use as the training set. It will then estimate the labels for the remaining nodes. Note that NetKit will not at this time identify the known labels in a partially labeled graph—these must still be specified in an external file.
An example of this type of run is:
```java
java -jar ../NetKit.jar -known goodbad-known.csv -rclassifier cdrn-norm-cos -output goodbad-out goodbad-schema.arff
```
The run specifies that the known labels are in the file `goodbad-known.csv`, to use the relational classifier `cdrn-norm-cos` and to redirect output predictions to `goodbad-out.predict`. The file format for the known files is given in §3.2.5 (pg. 8).
### 3.3.6 Customizing the output format for scores
You can customize the estimated score output format. For example, if you have an existing database (which was exported into NetKit format), and you want to insert the new scores, then you can have NetKit specifically output SQL commands to update the given table in the database.
An example run might look like this:
```java
java -jar ../NetKit.jar -known goodbad-known.csv -format "insert into persontable (id,threatscore) values (%id,%Bad)" -output goodbad-out goodbad-schema.arff
```
This command takes a list of specified labels (`goodbad-known.csv`), estimates the good/bad scores for the remaining nodes, and outputs lines of the form:
```c
insert into persontable (id,threatscore) values (PersonK, 0.039)
...
insert into persontable (id,threatscore) values (PersonM, 0.591)
```
15
Chapter 4
Customizing NetKit
This chapter describes ways to customize the various components of NetKit. These are the files that need to be edited if you develop new components as well (this is not a developer’s guide and we will not discuss developing new components here).
NetKit has 9 configuration files, which are listed in Table 4.1. We will discuss 6 of these below.
<table>
<thead>
<tr>
<th>Property File</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>NetKit.properties</td>
<td>sets default commandline options</td>
</tr>
<tr>
<td>aggregator.properties</td>
<td>defines aggregators and their behaviors (see §4.5)</td>
</tr>
<tr>
<td>distance.properties</td>
<td>defines vector-distance functions</td>
</tr>
<tr>
<td>inferencemethod.properties</td>
<td>defines inference methods and their default parameters (see §4.2)</td>
</tr>
<tr>
<td>lclassifier.properties</td>
<td>defines non-relational classifiers and their default parameters (see §4.4)</td>
</tr>
<tr>
<td>logging.properties</td>
<td>defines logging parameters (see §4.1)</td>
</tr>
<tr>
<td>rclassifier.properties</td>
<td>defines relational classifiers and their default parameters (see §4.3)</td>
</tr>
<tr>
<td>readeestimate.properties</td>
<td>lists the classes that are available to read in the priorfile (see §3.2.10)</td>
</tr>
<tr>
<td>weka.properties</td>
<td>names the classifiers that are available through WEKA (see §4.6)</td>
</tr>
</tbody>
</table>
Table 4.1: Property files used by NetKit
4.1 Logging
NetKit outputs a lot of logging information to the screen by default. The file that controls this logging is:
```
logging.properties
```
This property file can be used to fine-tune how much information to log. NetKit uses the Java logging utility classes and this file configures this utility.
Logging happens in two parts:
1. setting and configuring a logging handler.
2. setting the logging levels for each class.
The possible logging levels are listed in Table 4.2.
4.1.1 Defining the log handler
The logging handler specifies where to send logs. It also defines the format of the logging as well as the global most detailed level it will log. This overrides any more detailed logging requested for various classes (see below).
By default, NetKit uses a ConsoleHandler at the finest logging level as listed in Table 4.3:
The Java logging utility classes also support logging to a file using the FileHandler. The configuration of a FileHandler is a little more complex. Table 4.4 shows the configuration properties for a FileHandler.
The pattern consists of a string that includes the following special components that will be replaced at runtime:
### 4.1.2 Defining custom log-levels
The logging facility allows for setting the logging levels for various classes. These can be as fine-grained as needed. Note that although you can set the log-levels as detailed as you want here, the handler will not output more details than its own level.
NetKit defines log-levels for some of the standard components which is listed in Table 4.6. Each line specifies a log level at a specific component level. These logging names are hierarchical. For example, a class which logs to `netkit.classifiers.relational`, can get its log-level from one of the log-definition lines:
```plaintext
netkit.classifiers.relational.level
netkit.classifiers.level
netkit.level
```
The logging utility takes the most specific line when deciding which level to log at.
### 4.2 Inference Methods
The inference methods are named, defined and configured in the `inferenceMethod.properties` file. The configuration of an inference method uses the syntax shown in Table 4.7.
For example, the default configuration for relaxation labeling is shown in Table 4.8. NetKit comes with four inference methods: null method (no inference), gibbs sampling, iterative classification and relaxation labeling. Read the properties file for their default configuration and explanation of their configuration keys.
### 4.3 Relational Classifiers
The relational classifiers are named, defined and configured in the `rclassifer.properties` file. The configuration of a relational classifier uses the same syntax as the inference methods and is shown in Table 4.7.
For example, the default configuration for the network-only logistic regression link-based method (see the tech report referred to in §1) is shown in Table 4.9. NetKit comes with twelve configured relational classifiers: weighted vote relational neighbor, probabilistic relational neighbor classifier, two configurations of a class-distributional relational neighbor, network-only bayes classifier, four
### Table 4.4: Configuration parameters for a FileHandler.
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>level</code></td>
<td>what is the logging level (default: ALL)</td>
</tr>
<tr>
<td><code>limit</code></td>
<td>what is the maximum file size (default: 0 — limitless)</td>
</tr>
<tr>
<td><code>count</code></td>
<td>what is the number of rotating logs (default: 1 — no rotating)</td>
</tr>
<tr>
<td><code>append</code></td>
<td>should it append to an existing logfile (default: false)</td>
</tr>
<tr>
<td><code>pattern</code></td>
<td>what is the output log-file name. (default: “%h/java%u.log”) (described below).</td>
</tr>
</tbody>
</table>
```java
handlers=java.util.logging.FileHandler
java.util.logging.FileHandler.level=FINEST
java.util.logging.FileHandler.limit=1000000
java.util.logging.FileHandler.count=5
java.util.logging.FileHandler.append=false
java.util.logging.FileHandler.pattern=%h/netkit-%g.log
```
### Table 4.5: Example FileHandler definition.
```java
netkit.level=INFO
netkit.graph.level=CONFIG
netkit.graph.io.level=OFF
netkit.classifiers.level=INFO
netkit.util.level=INFO
netkit.inference.level=CONFIG
```
### Table 4.6: Default logging levels for NetKit components.
```java
name.class=fully.specified.class.name
name.configuration.key=value
```
### Table 4.7: Syntax for defining and configuring an inference method.
```java
relaxlabel.class=netkit.inference.RelaxationLabeling
relaxlabel.numit=99
relaxlabel.beta=1.00
relaxlabel.decay=0.99
```
### Table 4.8: Default relaxation labeling configuration.
```java
nolb-lr-distrib.class=netkit.classifiers.relational.NetworkWeka
nolb-lr-distrib.classifier=logistic
nolb-lr-distrib.useintrinsic=false
nolb-lr-distrib.aggregators=ratio
nolb-lr-distrib.aggregation=ClassOnly
```
### Table 4.9: Default network-only logistic-regression configuration.
configurations for network-only logistic regression, logistic regression, naive bayes, and J48. The last three use the WEKA machine learning toolkit. Read the properties file for their default configuration and explanation of their configuration keys.
4.4 NonRelational Classifiers
The non-relational (local) classifiers are named, defined and configured in the lclassifier.properties file. The configuration of a non-relational classifier uses the same syntax as the inference methods and is shown in Table 4.7. NetKit comes with seven configured non-relational classifiers: null (does no estimation), uniform prior, class prior, external prior, logistic regression, naive bayes and J48. The last three use the WEKA machine learning toolkit. Read the properties file for their default configuration and explanation of their configuration keys.
4.5 Aggregators
The available aggregators are named and defined in the aggregator.properties file. An aggregator is defined by its name, class and which types of attributes it can aggregate.
| name.class=fully.specified.class.name |
| name.accept=ATTRIBUTE_TYPE[\,ATTRIBUTE_TYPE...] |
Table 4.10: Syntax for defining an aggregator.
NetKit comes with seven aggregators: count, exist, max, mean, min, mode and ratio. Read the properties file for their default configuration and explanation of their configuration keys.
4.6 WEKA
In order to make classifiers from WEKA available to NetKit, you need to let NetKit know about them and give them a name for lookup purposes. The weka.properties file does this. In fact, you can list any classifier that uses the WEKA API—therefore thirdparty classifiers that uses the WEKA API could also be listed here. In order to make a classifier available, you need to give it a name and specify the fully specified class name. The default weka properties file is shown in Table 4.11.
| logistic.class=weka.classifiers.functions.Logistic |
| leastsquares.class=weka.classifiers.functions.LeastMedSq |
| naivebayes.class=weka.classifiers.bayes.NaiveBayesMultinomial |
| j48.class=weka.classifiers.trees.J48 |
Table 4.11: Default WEKA configuration file.
Chapter 5
Known issues and limitations
NetKit runs everything in memory. It is therefore constrained by the amount of memory available. On a 32-bit machine, this means that it can only allocate about 1.8Gb worth of memory at most. NetKit has been successfully run on such a machine on a data set of 1 million entities and 10 million links, where the entities only had 2 attributes. NetKit has been very successful on many domains when using the vanilla weighted-vote Relational Neighbor (wvRN) classifier with relaxation labeling. These include domains such as people (terrorists), companies, web-pages, and bibliometrics.
We have found that wvRN is sensitive to the sparsity of links—if a node in the graph is not connected (Even indirectly) to a node whose label is 'known', then wvRN will not be able to make any reasonable estimation of the attribute-value. This should not be surprising.
One last potential sensistivity issue for wvRN is the noise level (ratio of mislabeled entities whose labels are 'known'). For terrorist domains, our studies have shown that wvRN is quite robust up until a noise level of 25%, after which it starts to break down.
|
{"Source-Url": "http://research.cs.rutgers.edu/~sofmac/downloads/NetKit/NetKit-20050526-userguide.pdf", "len_cl100k_base": 11194, "olmocr-version": "0.1.49", "pdf-total-pages": 24, "total-fallback-pages": 0, "total-input-tokens": 54169, "total-output-tokens": 11839, "length": "2e13", "weborganizer": {"__label__adult": 0.00033736228942871094, "__label__art_design": 0.0005755424499511719, "__label__crime_law": 0.0004417896270751953, "__label__education_jobs": 0.0032939910888671875, "__label__entertainment": 0.00010693073272705078, "__label__fashion_beauty": 0.00020503997802734375, "__label__finance_business": 0.0007009506225585938, "__label__food_dining": 0.00028324127197265625, "__label__games": 0.0007905960083007812, "__label__hardware": 0.0010995864868164062, "__label__health": 0.00030684471130371094, "__label__history": 0.0003428459167480469, "__label__home_hobbies": 0.00014674663543701172, "__label__industrial": 0.0006365776062011719, "__label__literature": 0.00034165382385253906, "__label__politics": 0.0003924369812011719, "__label__religion": 0.0004498958587646485, "__label__science_tech": 0.08184814453125, "__label__social_life": 0.0001804828643798828, "__label__software": 0.063720703125, "__label__software_dev": 0.8427734375, "__label__sports_fitness": 0.0002872943878173828, "__label__transportation": 0.000335693359375, "__label__travel": 0.0002008676528930664}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46040, 0.0315]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46040, 0.54257]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46040, 0.73383]], "google_gemma-3-12b-it_contains_pii": [[0, 225, false], [225, 3115, null], [3115, 3115, null], [3115, 5173, null], [5173, 6103, null], [6103, 7498, null], [7498, 9788, null], [9788, 10967, null], [10967, 11006, null], [11006, 14953, null], [14953, 17043, null], [17043, 19771, null], [19771, 22414, null], [22414, 25562, null], [25562, 27433, null], [27433, 29560, null], [29560, 31678, null], [31678, 34369, null], [34369, 36046, null], [36046, 38856, null], [38856, 40834, null], [40834, 42742, null], [42742, 44881, null], [44881, 46040, null]], "google_gemma-3-12b-it_is_public_document": [[0, 225, true], [225, 3115, null], [3115, 3115, null], [3115, 5173, null], [5173, 6103, null], [6103, 7498, null], [7498, 9788, null], [9788, 10967, null], [10967, 11006, null], [11006, 14953, null], [14953, 17043, null], [17043, 19771, null], [19771, 22414, null], [22414, 25562, null], [25562, 27433, null], [27433, 29560, null], [29560, 31678, null], [31678, 34369, null], [34369, 36046, null], [36046, 38856, null], [38856, 40834, null], [40834, 42742, null], [42742, 44881, null], [44881, 46040, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46040, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46040, null]], "pdf_page_numbers": [[0, 225, 1], [225, 3115, 2], [3115, 3115, 3], [3115, 5173, 4], [5173, 6103, 5], [6103, 7498, 6], [7498, 9788, 7], [9788, 10967, 8], [10967, 11006, 9], [11006, 14953, 10], [14953, 17043, 11], [17043, 19771, 12], [19771, 22414, 13], [22414, 25562, 14], [25562, 27433, 15], [27433, 29560, 16], [29560, 31678, 17], [31678, 34369, 18], [34369, 36046, 19], [36046, 38856, 20], [38856, 40834, 21], [40834, 42742, 22], [42742, 44881, 23], [44881, 46040, 24]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46040, 0.18875]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
02481eeab20d355cfa38844e1f0c155713bbb7af
|
Abduction and Dialogical Proof in Argumentation and Logic Programming
Richard Booth\textsuperscript{1} and Dov Gabbay\textsuperscript{1,2} and Souhila Kaci\textsuperscript{3} and Tjitze Rienstra\textsuperscript{1,3} and Leendert van der Torre\textsuperscript{1}
Abstract. We develop a model of abduction in abstract argumentation, where changes to an argumentation framework act as hypotheses to explain the support of an observation. We present dialogical proof theories for the main decision problems (i.e., finding hypotheses that explain skeptical/credulous support) and we show that our model can be instantiated on the basis of abductive logic programs.
1 Introduction
In the context of abstract argumentation \cite{12}, abduction can be seen as the problem of finding changes to an argumentation framework (or AF for short) with the goal of explaining observations that can be justified by making arguments accepted. The general problem of whether and how an AF can be changed with the goal of changing the status of arguments has been studied by Baumann and Brewka \cite{3}, who called it the enforcing problem, as well as Bisquert et al. \cite{4}, Perotti et al. \cite{15} and Kontarinis et al. \cite{15}. None of these works, however, made any explicit link with abduction. Sakama \cite{20}, on the other hand, explicitly focused on abduction, and presented a model in which additions as well as removals of arguments from an abstract AF act as explanations for the observation that an argument is accepted or rejected.
While Sakama did address computation in his framework, his method was based on translating abstract AFs into logic programs. Proof theories in argumentation are, however, often formulated as dialogical proof theories, which aim at relating the problem they address with stereotypical patterns found in real world dialogue. For example, proof theories for skeptical/credulous acceptance have been modelled as dialogues in which a proponent persuades an opponent to accept the necessity/possibility of an argument \cite{17}, while credulous acceptance has also been related to Socratic style dialogue \cite{9}. Thus, the question of how decision problems in abduction in argumentation can similarly be modelled as dialogues remains open.
Furthermore, argumentation is often used as an abstract model for non-monotonic reasoning formalisms. For example, an instantiated AF can be generated on the basis of a logic program. Consequences can then be computed by looking at the extensions of the instantiated AF \cite{12}. In the context of abduction, one may ask whether a model of abduction in argumentation can similarly be seen as an abstraction of abductive logic programming. Sakama, however, did not explore the instantiation of his model, meaning that this question too remains open.
This brings us to the contribution of this paper. We first present a model of abduction in abstract argumentation, based on the notion of an AAF (abductive argumentation framework) that encodes different possible changes to an AF, each of which may act as a hypothesis to explain an observation that can be justified by making an argument accepted. We then do two things:
1. We present sound and complete dialogical proof procedures for the main decision problems, i.e., finding hypotheses that explain skeptical/credulous acceptance of arguments in support of an observation. These proof procedures show that the problem of abduction is related to an extended form of persuasion, where the proponent uses hypothetical moves to persuade the opponent.
2. We show that AAFs can be instantiated by ALPs (abductive logic programs) in such a way that the hypotheses generated for an observation by the ALP can be computed by translating the ALP into an AAF. The type of ALPs we focus on are based on Sakama and Inoue’s model of extended abduction \cite{13,14}, in which hypotheses have a positive as well as a negative element (i.e., facts added to the logic program as well as facts removed from it).
In sum, our contribution is a model of abduction in argumentation with dialogical proof theories for the main decision problems, which can be seen as an abstraction of abduction in logic programming.
The overview of this paper is as follows. After introducing the necessary preliminaries in section 2 we present in section 3 our model of abduction in argumentation. In section 4 we present dialogical proof procedures for the main decision problems (explaining skeptical/credulous acceptance). In section 5 we show that our model of abduction can be used to instantiate abduction in logic programming. We discuss related work in section 6 and conclude in section 7.
2 Preliminaries
An argumentation framework consists of a set $A$ of arguments and a binary attack relation $\rightarrow$ over $A$ \cite{12}. We assume in this paper that $A$ is a finite subset of a fixed set $\mathcal{U}$ called the universe of arguments.
Definition 1. Given a countably infinite set $\mathcal{U}$ called the universe of arguments, an argumentation framework (AF, for short) is a pair $F = (A, \rightarrow)$ where $A$ is a finite subset of $\mathcal{U}$ and $\rightarrow$ a binary relation over $A$. If $a \rightarrow b$ we say that $a$ attacks $b$. $\mathcal{F}$ denotes the set of all AFs.
Extensions are sets of arguments that represent different viewpoints on the acceptance of the arguments of an AF. A semantics is a method to select extensions that qualify as somehow justifiable. We focus on one of the most basic ones, namely the complete semantics \cite{12}.
Definition 2. Let \( F = (A, \neg \neg) \). An extension of \( F \) is a set \( E \subseteq A \). An extension \( E \) is conflict-free if for no \( a, b \in E \) it holds that \( a \neg \neg b \). An argument \( a \in A \) is defended by \( E \) if for all \( b \) such that \( b \neg \neg a \) there is a \( c \in E \) such that \( c \neg \neg b \). Given an extension \( E \), we define \( \text{Def}_E(E) \) by \( \text{Def}_E(E) = \{ a \in A \mid E \text{ defends } a \} \). An extension \( E \) is admissible iff \( E \) is conflict-free and \( E \subseteq \text{Def}_E(E) \), and complete iff \( E \) is conflict-free and \( E = \text{Def}_E(E) \). The set of complete extension of \( F \) will be denoted by \( \text{Co}(F) \). Furthermore, the grounded extension (denoted by \( \text{Gr}(F) \)) is the unique minimal (w.r.t. \( \subseteq \)) complete extension of \( F \).
An argument is said to be skeptically (resp. credulously) accepted iff it is a member of all (resp. some) complete extensions. Note that the set of skeptically accepted arguments coincides with the grounded extension. Furthermore, an argument is a member of a complete extension iff it is a member of a preferred extension, which is a maximal (w.r.t. \( \subseteq \)) complete extension. Consequently, credulous acceptance under the preferred semantics (as studied e.g. in [17]) coincides with credulous acceptance under the complete semantics.
### 3 Abductive AFs
Abduction is a form of reasoning that goes from an observation to a hypothesis. We assume that an observation translates into a set \( X \subseteq A \). Intuitively, \( X \) is a set of arguments that each individually support the observation. If at least one argument \( x \in X \) is skeptically (resp. credulously) accepted, we say that the observation \( X \) is skeptically (resp. credulously) supported.
**Definition 3.** Given an AF \( F = (A, \neg \neg) \), an observation \( X \subseteq A \) is skeptically (resp. credulously) supported iff for all (resp. some) \( E \in \text{Co}(F) \) it holds that \( x \in E \) for some \( x \in X \).
The following proposition implies that checking whether an observation \( X \) is skeptically supported can be done by checking whether an individual argument \( x \in X \) is in the grounded extension.
**Proposition 1.** Let \( F = (A, \neg \neg) \) and \( X \subseteq A \). It holds that \( F \) skeptically supports \( X \) iff \( x \in \text{Gr}(F) \) for some \( x \in X \).
**Proof of proposition 1.** If the direction is immediate. For the only if direction, assume \( F = (A, \neg \neg) \) explains skeptical support for \( X \). Then for every complete extension \( E \subseteq F \) of \( F \), there is an \( x \in X \) s.t. \( x \in E \). Define \( G \) by \( G = (A \cup \{ a, b \} \cup \{ x \} \mid x \in X \cup \{ (a, b) \}) \), where \( a, b \notin A \). Then for every complete extension \( E \subseteq F \) of \( G \), it holds that \( E \) supports \( x \), hence \( E \) is conflict-free and \( E = \text{Gr}(G) \). Thus \( x \in \text{Gr}(G) \), for some \( x \in X \).
It may be that an AF \( F \) does not skeptically or credulously support an observation \( X \). Abduction then amounts to finding a change to \( F \) so that \( X \) is supported. We use the following definition of an AAF (Abductive AF) to capture the changes w.r.t. \( F \) (each change represented by an AF \( G \) called an abducible AF) that an agent considers. We assume that \( F \) itself is also an abducible AF, namely one that captures the case where no change is necessary. Other abducible AFs may be formed by addition of arguments and attacks to \( F \), removal of arguments and attacks from \( F \), or a combination of both.
**Definition 4.** An abductive AF is a pair \( M = (F, I) \) where \( F \) is an AF and \( I \subseteq F \) a set of AFs called abducible such that \( F \in I \).
Given an AAF \((F, I)\) and observation \( X \), skeptical/credulous support for \( X \) can be explained by the change from \( F \) to some \( G \in I \) that skeptically/credulously supports \( X \). In this case we say that \( G \) explains skeptical/credulous support for \( X \). The arguments/attacks added to and absent from \( G \) can be seen as the actual explanation.
**Definition 5.** Let \( M = (F, I) \) be an AAF. An abducible AF \( G \in I \) explains skeptical (resp. credulous) support for an observation \( X \) iff \( G \) skeptically (resp. credulously) supports \( X \).
One can focus on explanations satisfying additional criteria, such as minimality w.r.t. the added or removed arguments/attacks. We leave the formal treatment of such criteria for future work.
**Example 1.** Let \( M = (F, \{G_1, G_2, G_3\}) \), where \( F, G_1, G_2 \) and \( G_3 \) are as defined in figure 1. Let \( X = \{b\} \) be an observation. It holds that \( G_1 \) and \( G_2 \) both explain skeptical support for \( X \), while \( G_2 \) only explains credulous support for \( X \).

**Remark 1.** The main difference between Sakama’s [20] model of abduction in abstract argumentation and the one presented here, is that he takes an explanation to be a set of independently selectable abducible arguments, while we take it to be a change to the AF that is applied as a whole. In section 5 we show that this is necessary when applying the abstract model in an instantiated setting.
### 4 Explanation dialogues
In this section we present methods to determine, given an AAF \( M = (F, I) \) (for \( F = (A, \neg \neg) \)) whether an abducible AF \( G \in I \) explains credulous or skeptical support for an observation \( X \subseteq A \). We build on ideas behind the grounded and preferred games, which are dialogical procedures that determine skeptical or credulous acceptance of an argument [17]. To sketch the idea behind these games (for a detailed discussion cf. [17]): two imaginary players (PRO and OPP) take alternating turns in putting forward arguments according to a set of rules. PRO either as an initial claim or in defence against OPP’s attacks, while OPP initiates different disputes by attacking the arguments put forward by PRO. Skeptical or credulous acceptance is proven if PRO can win the game by ending every dispute in its favour according to a “last-word” principle.
Our method adapts this idea so that the moves made by PRO are essentially hypothetical moves. That is, to defend the initial claim (i.e., to explain an observation) PRO can put forward, by way of hypothesis, any attack \( x \neg \neg y \) present in some \( G \in I \). This marks a choice of PRO to focus only on those abducible AFs in which the attack \( x \neg \neg y \) is present. Similarly, PRO can reply to an attack \( x \neg \neg y \) put forward by OPP, with the claim that this attack is invalid, marking the choice of PRO to focus only on the abducible AFs in which the attack \( x \neg \neg y \) is not present. Thus, each move by PRO narrows down the set of abducible AFs in which all of PRO’s moves are valid. The objective is to end the dialogue with a non-empty set of abducible AFs. Such a dialogue represents a proof that these abducible AFs explain skeptical or credulous support for the observation.
Alternatively, such dialogues can be seen as games that determine skeptical/credulous support of an observation by an AF that are played simultaneously over all abducible AFs in the AAF. In this view, the objective is to end the dialogue in such a way that it represents a proof for at least one abducible AF. Indeed, in the case where \( M = (F, \{F\}) \), our method reduces simply to a proof theory for skeptical or credulous support of an observation by \( F \).
Before we move on we need to introduce some notation.
**Definition 6.** Given a set \( I \) of AFs we define:
- \( A_I = \{A \mid (A, \sim) \in I\} \),
- \( \sim_I = \{\sim \mid (A, \sim) \in I\} \),
- \( I_{x \sim y} = \{(A, \sim) \in I \mid x, y \in A, x \sim y\} \),
- \( I_X = \{(A, \sim) \in I \mid X \subseteq A\} \).
We model dialogues as sequences of moves, each move being of a certain type, and made either by PRO or OPP.
**Definition 7.** Let \( M = (F, I) \) be an AAF. A dialogue based on \( M \) is a sequence \( S = (m_1, \ldots, m_n) \), where each \( m_i \) is either:
- an OPP attack \( "OPP: y \rightarrow x\" \), where \( x \rightarrow y \),
- a hypothetical PRO defence \( "PRO: y \rightarrow^+ x\" \), where \( y \rightarrow x \),
- a hypothetical PRO negation \( "PRO: y \rightarrow^- x\" \), where \( y \rightarrow x \),
- a conceding move \( "OPP: ok\" \),
- a success claim move \( "PRO: win\" \).
We denote by \( S \cdot S' \) the concatenation of \( S \) and \( S' \).
Intuitively, a move \( OPP: y \rightarrow x \) represents an attack by OPP on the argument \( x \) by putting forward the attacker \( y \). A hypothetical PRO defence PRO: \( y \rightarrow^+ x \) represents a defence by PRO who puts forward \( y \) to attack the argument \( x \) put forward by OPP. A hypothetical PRO negation PRO: \( y \rightarrow^- x \) on the other hand, represents a claim by PRO that the attack \( y \rightarrow x \) is not a valid attack. The conceding move OPP: ok is made whenever OPP runs out of possibilities to attack a given argument, while the move PRO: win is made when PRO is able to claim success.
In the following sections we specify how dialogues are structured. Before doing so, we introduce some notation that we use to keep track of the abducible AFs on which PRO chooses to focus in a dialogue \( D \). We call this set the **information state** of \( D \) after a given move. While it initially contains all abducible AFs in \( M \), it is restricted when PRO makes a move PRO: \( x \rightarrow^+ y \) or OPP: \( x \sim^- y \).
**Definition 8.** Let \( M = (F, I) \) be an AAF. Let \( D = (m_1, \ldots, m_n) \) be a dialogue based on \( M \). We denote the information state in \( D \) after move \( i \) by \( J(D, i) \), which is defined recursively by:
\[
J(D, i) = \begin{cases}
I & \text{if } i = 0, \\
J(D, i - 1) \cap I_{x \sim y} & \text{if } m_i = \text{PRO: } x \sim^+ y, \\
J(D, i - 1) \setminus I_{x \sim y} & \text{if } m_i = \text{PRO: } x \sim^- y, \\
J(D, i - 1) & \text{otherwise.}
\end{cases}
\]
We denote by \( J(D) \) the information state \( J(D, n) \).
### 4.1 Skeptical explanation dialogues
We define the rules of a dialogue using a set of production rules that recursively define the set of sequences constituting dialogues. (The same methodology was used by Booth et al. [7] in defining a dialogical proof theory related to preference-based argumentation.) In a skeptical explanation dialogue for an observation \( X \), an initial argument \( x \) is challenged by the opponent, who puts forward all possible attacks OPP: \( y \sim x \) present in any of the abducible AFs present in the AAF, followed by OPP: ok. We call this a **skeptical OPP** reply to \( x \). For each move OPP: \( y \sim x \), PRO responds with a **skeptical PRO** reply to \( y \sim x \), which is either a hypothetical defence PRO: \( z \sim^+ y \) (in turn followed by a skeptical OPP reply to \( z \)) or a hypothetical negation PRO: \( y \sim^- x \). Formally:
**Definition 9.** (Skeptical explanation dialogue). Let \( F \equiv (A, \sim) \), \( M = (F, I) \) and \( x \in A \).
- A skeptical OPP reply to \( x \) is a finite sequence \( \text{OPP: } y_1 \sim x \). \( S_1, \ldots, (\text{OPP: } y_n \sim x) \cdot S_n \cdot \text{OPP: } \text{ok} \) where \( \{y_1, \ldots, y_n\} = \{y \mid y \sim x\} \) and each \( S_i \) is a skeptical PRO reply to \( y_i \sim x \).
- A skeptical PRO reply to \( y \sim x \) is either: (1) A sequence \( \text{PRO: } z \sim^+ y \cdot S \) where \( z \sim y \) and \( S \) is a skeptical OPP reply to \( z \), or (2) The sequence \( \text{PRO: } y \sim^- x \).
Given an observation \( X \subseteq A \) we say that \( M \) generates the skeptical explanation dialogue \( D \) for \( X \) iff \( D \equiv S \cdot \text{PRO: win} \), where \( S \) is a skeptical OPP reply to some \( x \in X \).
Due to space constraints we only provide a sketch of the proof.
**Theorem 1.** Let \( M = (F, I) \) be an AAF where \( F = (A, \sim) \). Let \( X \subseteq A \) and \( G \in I \). It holds that \( G \) explains skeptical support for \( X \) iff \( M \) generates a skeptical explanation dialogue \( D \) for \( X \) such that \( G \in J(D) \).
**Example 2.** The listing below shows a skeptical explanation dialogue \( D = (m_1, \ldots, m_8) \) for the observation \( \{b\} \) that is generated by the AAF defined in example 1.
<table>
<thead>
<tr>
<th>i</th>
<th>( m_i )</th>
<th>( J(D, i) )</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>OPP: c ( \sim b )</td>
<td>{F, G_1, G_2, G_3}</td>
</tr>
<tr>
<td>2</td>
<td>PRO: e ( \sim^+ c )</td>
<td>{G_1, G_3}</td>
</tr>
<tr>
<td>3</td>
<td>OPP: ok</td>
<td>{G_1, G_3}</td>
</tr>
<tr>
<td>4</td>
<td>OPP: a ( \sim b )</td>
<td>{G_1, G_3}</td>
</tr>
<tr>
<td>5</td>
<td>PRO: a ( \sim^- b )</td>
<td>{G_3}</td>
</tr>
<tr>
<td>6</td>
<td>OPP: ok</td>
<td>{G_3}</td>
</tr>
<tr>
<td>7</td>
<td>PRO: win</td>
<td>{G_3}</td>
</tr>
</tbody>
</table>
Here, PRO defends \( b \) from \( c \) by using the argument \( e \), but defends \( b \) from \( a \) by claiming that the attack \( a \mp b \) is invalid. This leads to the focus first on the admissible AFs \( G_1, G_2 \) (in which the attack \( a \mp c \) exists) and then on \( G_3 \) (in which the attack \( a \mp b \) does not exist). This dialogue proves that \( G_3 \) explains skeptical support for \( \{b\} \).
### 4.2 Credulous explanation dialogues
The definition of a credulous explanation dialogue is similar to that of a skeptical one. The difference lies in what constitutes an acceptable defence. To show that an argument \( x \) is skeptically accepted, \( x \) must be defended from its attackers by arguments other than \( x \) itself. For credulous acceptance, however, it suffices to show that \( x \) is a member of an admissible set, and hence \( x \) may be defended from its attackers by any argument, including \( x \) itself. To achieve this we need to keep track of the arguments that are, according to the moves made by PRO, accepted. Once an argument \( x \) is accepted, PRO does not need to defend \( x \) again, if this argument is put forward a second time.
Formally a credulous OPP reply to \((x, Z)\) (for some \( x \in A_T \) and set \( Z \subseteq A_I \) used to keep track of accepted arguments) consists of all possible attacks \( \text{OPP: } \forall y \mp x \) on \( x \), followed by \( \text{OPP: ok} \) when all attacks have been put forward. For each move \( \text{OPP: } \forall y \mp x \), PRO responds either by putting forward a hypothetical defence \( \text{PRO: } \exists z \mp y \) which (this time \( \forall z \not\in Z \)) is followed by a credulous OPP reply to \((z, Z \cup \{z\})\), or by putting forward a hypothetical negation \( \text{PRO: } \forall y \not\mp x \). We call this response a credulous OPP reply to \((y \mp x, Z)\). A credulous explanation dialogue for a set \( X \) consists of a credulous OPP reply to \((x, \{x\})\) for some \( x \in X \), followed by a success claim \( \text{PRO: win} \).
In addition, arguments put forward by PRO in defence of the observation may not conflict. Such a conflict occurs when OPP puts forward \( \text{OPP: } \forall x \mp y \) and \( \text{OPP: } \forall y \mp z \) (indicating that both \( y \) and \( z \) are accepted) while PRO does not put forward \( \text{PRO: } y \not\mp z \). If this situation does not occur we may say that the dialogue is conflict-free.
**Definition 10** (Credulous explanation dialogue). Let \( F = (A, \rhd) \),
\[
M = (F, I), \quad x \in A \land Z \subseteq A.
\]
- A credulous OPP reply to \((x, Z)\) is a finite sequence \( \text{OPP: } y_1 \mp x \cdot \text{S}_1 \cdot \ldots \cdot \text{OPP: } y_n \mp x \cdot \text{S}_n \cdot \text{OPP: ok} \) where \( \{y_1, \ldots, y_n\} = \{y \mid y \mp x \} \) and each \( S_i \) is a credulous OPP reply to \((y_i \mp x, Z)\).
- A credulous PRO reply to \((y \mp x, Z)\) is either: (1) a sequence \( \text{PRO: } z \mp y \cdot \text{S} \) such that \( \exists z \mp y, z \not\in Z \) and \( S \) is a credulous OPP reply to \((z, Z \cup \{z\})\), (2) a sequence \( \text{PRO: } z \mp y \) such that \( \not\exists z \mp y \) and \( z \not\in Z \) or (3) the sequence \( \text{PRO: } y \mp x \).
Given a set \( X \subseteq A \) we say that \( M \) generates the credulous explanation dialogue \( D \) for \( X \) iff \( M \) generates a conflict-free credulous explanation dialogue \( D \) for \( X \) such that \( D \in J(D) \).
**Sketch of proof.** Let \( M = ((A, \rhd), I) \), \( X \subseteq A \) and \( G \in I \). (Only if.) Assume for some \( x \in X \) and \( E \in \text{Co}(G) \) that \( x \in E \). Using the fact that \( E \subseteq \text{Def}_G(E) \) one can recursively define a credulous OPP reply \( D \) to \((x, Z)\) for some \( Z \subseteq A \) and hence a credulous explanation dialogue \( D \cdot \text{PRO: win} \). Conflict-freeness of \( E \) implies conflict-freeness of \( D \). (If.) Assume \( M \) generates a credulous explanation dialogue \( D \cdot \text{PRO: win} \) for \( X \) such that \( D \in J(D) \). Then \( D \) is a credulous OPP reply to \((a, \{a\})\) for some \( a \in X \). It can be shown that the set \( E = \{a\} \cup \{x \mid \text{PRO: } x \mp z \in D \} \) satisfies \( E \subseteq \text{Def}_G(E) \). Conflict-freeness of \( D \) implies conflict-freeness of \( E \). Hence \( a \in E \) for some \( E \in \text{Co}(G) \).
**Example 3.** The listing below shows a conflict-free credulous explanation dialogue \( D = (m_1, \ldots, m_n) \) for the observation \( \{b\} \) generated by the AAF defined in example 1.
<table>
<thead>
<tr>
<th>( i )</th>
<th>( m_i )</th>
<th>( J(D, i) )</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>( \text{OPP: } x \mp b )</td>
<td>( {F, G_1, G_2, G_3} )</td>
</tr>
<tr>
<td>2</td>
<td>( \text{PRO: } b \mp c )</td>
<td>( {F, G_1, G_2, G_3} )</td>
</tr>
<tr>
<td>3</td>
<td>( \text{OPP: } a \mp b )</td>
<td>( {F, G_1, G_2, G_3} )</td>
</tr>
<tr>
<td>4</td>
<td>( \text{PRO: } a \mp b )</td>
<td>( {G_2, G_3} )</td>
</tr>
<tr>
<td>5</td>
<td>( \text{OPP: ok} )</td>
<td>( {G_2, G_3} )</td>
</tr>
<tr>
<td>6</td>
<td>( \text{PRO: win} )</td>
<td>( {G_2, G_3} )</td>
</tr>
</tbody>
</table>
Here, the sequence \( \{m_1, \ldots, m_n\} \) is a credulous OPP reply to \((b, \{b\})\). PRO defends \( b \) from OPP’s attack \( c \mp b \) by putting forward the attack \( b \mp c \). Since \( b \) was already assumed to be accepted, this suffices. At move \( m_4 \), PRO defends itself from the attack \( a \mp b \) by negating it. This restricts the focus on the admissible AFs \( G_2 \) and \( G_3 \). The dialogue proves that these two admissible AFs explain credulous support for the observation \( \{b\} \). Finally, the skeptical explanation dialogues from example 2 are also credulous explanation dialogues.
### 5 Abduction in logic programming
In this section we show that AAFs can be instantiated with abductive logic programs, in the same way that regular AFs can be instantiated with regular logic programs. In sections 5.1 and 5.2 we recall the necessary basics of logic programming and the relevant results regarding logic programming as instantiated argumentation. In section 5.3 we present a model of abductive logic programming based on Sakama and Inoue’s model of extended abduction [13, 14], and in section 5.2 we show how this model can be instantiated using AAFs.
#### 5.1 Logic programs and partial stable semantics
A logic program \( P \) is a finite set of rules, each rule being of the form \( C \leftarrow A_1, \ldots, A_n, \neg B_1, \ldots, \neg B_m \) where \( C, A_1, \ldots, A_n, B_1, \ldots, B_m \) are atoms. If \( m = 0 \) then the rule is called **definite**. If both \( n = 0 \) and \( m = 0 \) then the rule is called a **fact** and we identify it with the atom \( C \). We assume that logic programs are ground. Alternatively, \( P \) can be regarded as the set of ground instances of a set of non-ground rules. We denote by \( At_P \) the set of all (ground) atoms occurring in \( P \). The logic programming semantics we focus on can be defined using 3-valued interpretations [19]:
**Definition 11.** A 3-valued interpretation \( I \) of a logic program \( P \) is a pair \( I = (T, F) \) where \( T, F \subseteq At_P \) and \( T \cap F = \emptyset \). An atom \( A \in At_P \) is true (resp. false, undecided) in \( I \) iff \( A \in T \) (resp. \( A \in F \), \( A \in At_P \setminus (T \cup F) \)).
The following definition of a partial stable model is due to Przymusinska [19]. Given a logic program \( P \) and 3-valued interpretation \( I \) of \( P \), the **GL-transformation** \( \downarrow I \) is a logic program obtained by replacing in every rule in \( P \) every premise \( \neg B \) such that \( B \) is true (resp. undecided, false) in \( I \) by the atoms 0 (resp. 1, 2), where 0 (resp. 1, 2, 3).
1) are defined to be false (resp. undecided, true) in every interpretation. It holds that for all 3-valued interpretations $I$ of $P$, $\frac{P}{I}$ is definite (i.e., consists only of definite rules). This means that $\frac{P}{I}$ has a unique least 3-valued interpretation $(T, F)$ with minimal $T$ and maximal $F$ that satisfies all rules. That is, for all rules $C \leftarrow A_1, \ldots, A_n$, in $\frac{P}{I}$, $C$ is true (resp. not false) in $(T, F)$ if for all $i \in \{1, \ldots, n\}$, $A_i$ is true (resp. not false) in $(T, F)$. Given a 3-valued interpretation $I$, the least 3-valued interpretation of $\frac{P}{I}$ is denoted by $\Gamma(I)$. This leads to the following definition of a partial stable model of a logic program, along with the associated notions of consequence.
**Definition 12.** [19] Let $P$ be a logic program. A 3-valued interpretation $I$ is a partial stable model of $P$ iff $I = \Gamma(I)$. We say that an atom $C$ is a skeptical (resp. credulous) consequence of $P$ iff $C$ is true in all (resp. some) partial stable models of $P$.
It has been shown that the above defined notion of skeptical consequence coincides with the well-founded semantics [19].
### 5.2 Logic programming as argumentation
Wu et al. [22] have shown that a logic program $P$ can be transformed into an AF in such a way that the consequences of $P$ under the partial stable semantics can be computed by looking at the complete extensions of $F$. The idea is that an argument consists of a conclusion $C \in \text{At}_P$, a set of rules $R \subseteq P$ used to derive $C$ and a set $N \subseteq \text{At}_P$ of atoms that must be derivable in order for the argument to be acceptable. The argument is attacked by another argument with a conclusion $C'$ iff $C' \in N$. The following definition, apart from notation, is due to Wu et al. [22].
**Definition 13.** Let $P$ be a logic program. An instantiated argument is a triple $(C, R, N)$, where $C \in \text{At}_P$, $R \subseteq P$ and $N \subseteq \text{At}_P$. We say that $P$ generates $(C, R, N)$ iff either:
- $r = C \leftarrow B_1, \ldots, B_m$ is a rule in $P$, $R = \{r\}$ and $N = \{B_1, \ldots, B_m\}$.
- $(I) \ r = C \leftarrow A_1, \ldots, A_n, \sim B_1, \ldots, \sim B_m$ is a rule in $P$ (2) $P$ generates, for each $i \in \{1, \ldots, n\}$ an argument $(A_i, R_i, N_i)$ such that $r \notin R_i$, and (3) $R = \{r\} \cup R_1 \cup \ldots \cup R_n$ and $N = \{B_1, \ldots, B_m\} \cup N_1 \cup \ldots \cup N_n$.
We denote the set of arguments generated by $P$ by $\text{At}_P$. Furthermore, the attack relation generated by $P$ is denoted by $\sim_P$ and is defined by $(C, R, N) \sim_P (C', R', N')$ iff $C \notin N'$.
The following theorem states that skeptical (resp. credulous) acceptance in $(\text{At}_P, \sim_P)$ corresponds with skeptical (resp. credulous) consequences in $P$ as defined in definition 12. It follows from theorems 15 and 16 due to Wu et al. [22].
**Theorem 3.** Let $P$ be a logic program. An atom $C \in \text{At}_P$ is a skeptical (resp. credulous) consequence of $P$ iff some $(C, R, N) \in \text{At}_P$ is skeptically (resp. credulously) accepted in $(\text{At}_P, \sim_P)$.
### 5.3 Abduction in logic programming
The model of abduction in logic programming that we use is based on the model of extended abduction studied by Inoue and Sakama [13, 14]. They define an abductive logic program (ALP) to consist of a logic program and a set of atoms called abducibles.
**Definition 14.** An abductive logic program is a pair $(P, U)$ where $P$ is a logic program and $U \subseteq \text{At}_P$ a set of facts called abducibles.
Note that, as before, the set $U$ consists of ground facts of the form $C \leftarrow$ (identified with the atom $C$) and can alternatively be regarded as the set of ground instances of a set of non-ground facts. A hypothesis, according to Inoue and Sakama’s model, consists of both a positive element (i.e., abducibles added to $P$) and a negative element (i.e., abducibles removed from $P$).
**Definition 15.** Let $\text{ALP} = (P, U)$ be an abductive logic program. A hypothesis is a pair $(\Delta^+, \Delta^-)$ such that $\Delta^+, \Delta^- \subseteq U$ and $\Delta^+ \cap \Delta^- = \emptyset$. A hypothesis $(\Delta^+, \Delta^-)$ skeptically (resp. credulously) explains a query $Q \in \text{At}_P$ if and only if $Q$ is a skeptical (resp. credulous) consequence of $(P \cup \Delta^+) \setminus \Delta^-$.
Note that Sakama and Inoue focus on computation of explanations under the stable model semantics of $P$, and require $P$ to be acyclic to ensure that a stable model of $P$ exists and is unique [14]. We, however, define explanation in terms of the consequences according to the partial stable models of $P$, which always exist even if $P$ is not acyclic [19], so that we do not need this requirement.
The following example demonstrates the previous two definitions.
**Example 4.** Let $\text{ALP} = (P, U)$ where $P = \{(p \leftarrow \sim s, r), (p \leftarrow \sim s, q), (q \leftarrow \sim p), r\}$ and $U = \{r, s\}$. The hypothesis $r, q$ skeptically explains $q$, witnessed by the unique model $I = \{(r, s, q), \{p\}\}$ satisfying $I = \Gamma(I)$. Similarly, $\{s\}$ skeptically explains $q$ and $\{\emptyset, \{r\}\}$ credulously explains $q$.
### 5.4 Instantiated abduction in argumentation
In this section we show that an AAF $(F, I)$ can be instantiated on the basis of an abductive logic program $(P, U)$. The idea is that every possible hypothesis $(\Delta^+, \Delta^-)$ maps to an abducible AF generated by the logic program $(P \cup \Delta^+) \setminus \Delta^-$. The hypotheses for a query $Q$ then correspond to the abducible AFs that explain the observation $X$ consisting of all arguments with conclusion $Q$. The construction of $(F, I)$ on the basis of $(P, U)$ is defined as follows.
**Definition 16.** Let $\text{ALP} = (P, U)$ be an abductive logic program. Given a hypothesis $(\Delta^+, \Delta^-)$, we denote by $F_{(\Delta^+, \Delta^-)}$ the AF $(A(P \cup \Delta^+, \sim_P(P \cup \Delta^+), \Delta^-)$. The AAF generated by $\text{ALP}$ is denoted by $\text{MALP}$ and defined by $\text{MALP} = \{(A(P, \sim_P), I_{\text{MALP}}), I_{\text{MALP}} = \{|F_{(\Delta^+, \Delta^-)} | \Delta^+, \Delta^- \subseteq U, \Delta^+ \cap \Delta^- = \emptyset\}\}$. The following theorem states the correspondence between the explanations of a query $Q$ in an abductive logic program $\text{ALP}$ and the explanations of an observation $X$ in the AAF $\text{MALP}$.
**Theorem 4.** Let $\text{ALP} = (P, U)$ be an abductive logic program, $Q \in \text{At}_P$ a query and $(\Delta^+, \Delta^-)$ a hypothesis. Let $\text{MALP} = (F, I)$. We denote by $\text{XQ}$ the set of $(C, R, N) \in \text{At}_P$ such that $C = Q$. It holds that $(\Delta^+, \Delta^-)$ skeptically (resp. credulously) explains $Q$ iff $F_{(\Delta^+, \Delta^-)}$ skeptically (resp. credulously) explains $\text{XQ}$.
**Proof of theorem 4.** Via theorem 3 and definitions 15 and 16.
This theorem shows that our model of abduction in argumentation can indeed be seen as an abstraction of abductive logic programming.
**Example 5.** Let $\text{ALP} = (P, U)$ be the ALP as defined in example 4. All arguments generated by $\text{ALP}$ are:
| $a$ | $\{(p \leftarrow \sim s, r), \{s\}\}$ |
| $b$ | $\{q, \{q \leftarrow \sim p\}\}$ |
| $c$ | $\{(p \leftarrow \sim s, \sim q)\}$ |
$\text{MALP} = (F, I)$.
Given these definitions, the AAF in example 1 is equivalent to \( M_{AF} \).
In example 4 we saw that \( q \) is skeptically explained by \( \{ \{s\} \}, \emptyset \) and \( \{ \{s\}, \{r\} \} \), while \( \{ \emptyset, \{r\} \} \) only credulously explains it. Indeed, looking again at example 1, we see that \( G_1 = F_{\{s\}, \emptyset} \) and \( G_3 = F_{\{s\}, \{r\}} \) explain skeptical support for the observation \( \{b\} \) in \( q \), while \( G_2 = F_{\emptyset, \{r\}} \) only explains credulous support.
**Remark 2.** This method of instantiation shows that, on the abstract level, hypotheses cannot be represented independently. The running example shows e.g. that \( a \) and \( d \) cannot be added or removed independently. (Cf. remark 1.)
### 6 Related work
We already discussed Sakama’s [20] model of abduction in argumentation and mentioned some differences. Our approach is more general because we consider a hypothesis to be a change to the AF that is applied as a whole, instead of a set of independently selectable abducible arguments. On the other hand, Sakama’s method supports a larger range of semantics, including (semi-)stable and skeptical preferred semantics. Furthermore, Sakama also considers observations leading to rejection of arguments, which we do not.
Some of the ideas we applied also appear in work by Wakaki et al. [21]. In their model, ALPs generate instantiated AFs and hypotheses yield a division into active/inactive arguments.
Kontarinis et al. [15] use term rewriting logic to compute changes to an abstract AF with the goal of changing the status of an argument. Two similarities to our work are: (1) our production rules to generate dialogues can be seen as a kind of term rewriting rules. (2) their approach amounts to rewriting goals into statements to the effect that certain attacks in the AF are enabled or disabled. These statements resemble the moves PRO: \( x \leadsto^+ \ y \) and PRO: \( x \leadsto^- \ y \) in our system. However, they treat attacks as entities that can be enabled or disabled independently. As discussed, different arguments (or in this case attacks associated with arguments) cannot be regarded as independent entities, if the abstract model is instantiated.
Goal oriented change of AFs is also studied by Baumann [2], Baumann and Brewka [3], Bisquet et al. [4] and Perotti et al. [5]. Furthermore, Booth et al. [8] and Coste-Marquis et al. [11] frame it as a problem of belief revision. Other studies in which changes to AFs are considered include [6, 10, 16, 18].
### 7 Conclusions and Future work
We developed a model of abduction in abstract argumentation, in which changes to an AF act as explanations for skeptical/credulous support for observations. We presented sound and complete dialogical proof procedures for the main decision problems, i.e., finding explanations for skeptical/credulous support. In addition, we showed that our model of abduction in abstract argumentation can be seen as an abstract form of abduction in logic programming.
As a possible direction for future work, we consider the incorporation of additional criteria for the selection of good explanations, such as minimality with respect to the added and removed arguments/attacks, as well as the use of arbitrary preferences over different abducible AFs. An interesting question is whether the proof theory can be adapted so as to yield only the preferred explanations.
### 8 Acknowledgements
Richard Booth is supported by the Fonds National de la Recherche, Luxembourg (DYNGBaT project).
### REFERENCES
|
{"Source-Url": "http://orca-mwe.cf.ac.uk/89685/1/FAIA263-0117.pdf", "len_cl100k_base": 10916, "olmocr-version": "0.1.42", "pdf-total-pages": 6, "total-fallback-pages": 0, "total-input-tokens": 26251, "total-output-tokens": 12884, "length": "2e13", "weborganizer": {"__label__adult": 0.000568389892578125, "__label__art_design": 0.0008907318115234375, "__label__crime_law": 0.0013494491577148438, "__label__education_jobs": 0.01102447509765625, "__label__entertainment": 0.0004341602325439453, "__label__fashion_beauty": 0.0003902912139892578, "__label__finance_business": 0.0006470680236816406, "__label__food_dining": 0.0011920928955078125, "__label__games": 0.004985809326171875, "__label__hardware": 0.0010538101196289062, "__label__health": 0.0014982223510742188, "__label__history": 0.000774383544921875, "__label__home_hobbies": 0.00026488304138183594, "__label__industrial": 0.0012025833129882812, "__label__literature": 0.0056304931640625, "__label__politics": 0.0014476776123046875, "__label__religion": 0.001232147216796875, "__label__science_tech": 0.46875, "__label__social_life": 0.0003581047058105469, "__label__software": 0.01465606689453125, "__label__software_dev": 0.479736328125, "__label__sports_fitness": 0.0006012916564941406, "__label__transportation": 0.0011768341064453125, "__label__travel": 0.0002560615539550781}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 41194, 0.02383]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41194, 0.37469]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41194, 0.82531]], "google_gemma-3-12b-it_contains_pii": [[0, 5580, false], [5580, 12867, null], [12867, 18567, null], [18567, 26334, null], [26334, 33770, null], [33770, 41194, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5580, true], [5580, 12867, null], [12867, 18567, null], [18567, 26334, null], [26334, 33770, null], [33770, 41194, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41194, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41194, null]], "pdf_page_numbers": [[0, 5580, 1], [5580, 12867, 2], [12867, 18567, 3], [18567, 26334, 4], [26334, 33770, 5], [33770, 41194, 6]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41194, 0.11429]]}
|
olmocr_science_pdfs
|
2024-11-22
|
2024-11-22
|
ba474da79f40df7591cd821eda1dbcd5471fb38c
|
A Generic Tool for Teaching Compilers
Riad Jabri
1 University of Jordan, Amman, Jordan
Correspondence: Riad Jabri, Computer Science Department, King Abdullah II School for Information Technology, University of Jordan, Amman 11942, Jordan. E-mail: jabri@ju.edu.jo
Received: March 11, 2013 Accepted: April 24, 2013 Online Published: April 26, 2013
doi:10.5539/cis.v6n2p134 URL: http://dx.doi.org/10.5539/cis.v6n2p134
Abstract
In this paper, we propose a two-fold generic tool for compiler construction. First, it facilitates teaching compilers. Second, it constitutes a new approach for compiler construction. In addition, it enables a smooth transition from theory to practice and introduces a unified approach for the implementation of the different compiler phases. Such unification is achieved based on the representation of the compiler phases as a generic domain that is then mapped into a generic automaton. The generic automaton simulates the behavior of finite and shift-reduce automata, annotated by respective translation schemes. Thus, the tool acts as a scanner, a parser or as syntax directed translator. Without loss of generality, the proposed tool is used within a compiler-teaching framework. Comparisons with similar and well-known approaches have shown that our approach is pedagogical, conceptually simpler, requires less student efforts and more relevant to core curriculum.
Keywords: teaching framework, scanning, parsing, grammars, syntax directed translation
1. Introduction
In this paper, we propose a generic tool for teaching compilers. Usually, compiler construction is taught as a one-semester course having as prerequisites courses in programming languages; data structures and computer organization. Within the framework of the compiler construction course, the students are requested to write a compiler from a given language specification, using automated tools such as Lex and Yacc (Mason & Brown, 1990). However, such teaching approach loosely-couples the theory of scanning and parsing. In addition, it constitutes an ambiguous shift from theory to practice, associated by the inherent difficulties and the typical errors of automated tools (Mallozzi, 2005). Hence, in this paper we set an objective to tightly couple scanning, parsing and translation, as well as to keep a connection and a smooth transition between theory and practice.
Such coupling is based on a proposed generic tool for the construction of scanners, parsers, and syntax directed translators. The proposed tool is used as a unifying tool within the following framework for teaching compilers
1) Introduce compilation, including its different phases.
2) Introduce regular expressions and context-free grammars. Emphasize their roles in specifying the lexical and syntactic levels of high level programming languages.
3) Introduce scanning in terms of finite automata. Emphasize the role of automata as scanners of languages specified by regular expressions (definitions).
4) Introduce parsing in terms of push down storage automata. Emphasize the role of automata as parsers of languages specified by context free grammars.
5) Introduce the concepts of a generic grammar that can be instantiated either by regular expressions and context-free grammars. Emphasize its role in constructing a generic automaton (scanner-parser).
6) Construct the generic automaton as a scanner.
7) Construct the generic automaton as a parser.
8) Introduce the concepts of the syntax directed translation. Emphasize the role of the translation schemes.
9) Consider the remaining compilation phases in their subsequent order. Extend the automaton as type-checker, intermediate code generator and as code generator.
The outlined framework is consistent with ACM’s Curriculum 2001. It is motivated by the strategies and the teaching approaches suggested in (Aho, 2008; Waite, 2006). However, the proposed framework adopts a unified approach for teaching theory and its practical application. Such unification is achieved by adopting a generic grammar that can be either instantiated by context-free grammars or by regular definitions. Such grammar is annotated by appropriate translation schemes. As such, the augmented grammar is then transformed into an augmented generic automaton (AGA). The states and the transitions of AGA are defined based on combining concepts from LR automata, finite automata, with embedded translation schemes (Aho et al., 2007). Hence, the parsing behavior of AGA is generic. It simulates finite automata, shift–reduce automata and syntax directed translator. However, AGA is a nondeterministic. It is efficiently transformed into a reduced one, called RAGA, using a proposed subset construction approach. In addition, the subset construction produces parsing and translation tables that specify the RGA parsing/translation actions, respective a given state and each one of the input symbols. A simulator is then constructed to simulate the run (scanner/parser/translator) of RGA on strings derived from a generic grammar.
Our parsing approach is based on position parsing automata (PPA), as proposed in (Jabri, 2009, 2012). However, it extends PPA to act as a scanner/parser/translator and uses different construction approach that handles recursion by reduced stack activities in a way similar to the generalized bottom up parsers and the reduction-incorporated parsers, as proposed in (Ayock, 2001; Johnstone & Scott, 2007; Scott & Johnstone, 2005) respectively. In addition, it handles nondeterminism in a way similar to SLR parsing as proposed in (Jabri, 2012).
The remainder of this paper is organized as follows. Section 2 presents preliminaries. Section 3 presents the proposed generic tool and the respective algorithms for its implementation. Section 4 presents experimental results, followed by a discussion and a conclusion that are given in Section 5 and Section 6 respectively.
2. Preliminaries
For our further discussions, we assume the following definitions based on the ones given by Aho et al. (2007) and by Jabri (2012). These definitions are used to specify the subsequent phases of a compiler as follows:
- The specification needed for lexical analysis and parsing are based on regular definition and context free grammars as given in Definition 1 and Definition 2 respectively. A unified definition for both is based on a generic grammar as given in Definition 3.
- The specification needed for the remaining compiler phases are based on syntax directed translation schemes (Aho et al., 2007) where program fragments are embedded within the productions of the generic grammar. These fragments are enclosed between braces ( {...}) and denoted as translation schemes.
**Definition 1.** Given an alphabet \( \Sigma \), a regular expression (RE) is defined as a notation to describe all languages that can be built from the symbols of \( \Sigma \) by applying the operations: union (\( | \)), concatenation (\( . \)) and exponentiation (\( * \)). RE is then inductively defined as follows:
- The symbol \( \varepsilon \) is RE if \( x \in \Sigma \) then \( x \) is RE.
- Let \( x, y \) be RE. Then RE is inductively defined as: \( xy \) is RE; \( x | y \) is RE; \( x^* \) is RE and (\( X \)) is RE.
**Definition 2.** Given an alphabet \( \Sigma \), a regular definition (RD) is a sequence of definitions of the form: \( RD_1 \rightarrow RE_1 \), \( RD_2 \rightarrow RE_2 \), ..., \( RD_n \rightarrow RE_n \), where \( RD_i \in \Sigma \) and \( RE_i \) is defined over \( \Sigma \cup \{ RD_1, RD_2, ..., RD_n \} \).
**Definition 3.** An Action-annotated Generic Grammar is defined by the 5-tuple \( AGG = (\Sigma, N, P, S, TS) \) that is either instantiated by a context free grammar (CFG) or by RD. In addition, it is annotated by translation schemes to specify a particular translation as follows:
1) AGG is instantiated by CFG, if:
- \( \Sigma \) is an alphabet of terminal symbols.
- \( N \) is a finite set of nonterminal symbols, where \( S \in N \) is a starting symbol.
- \( P \) is a finite set of productions \( p \) having the form \( A \rightarrow V \), where \( A \in N \) and \( V \in (\Sigma \cup N) \).
- \( TS \) is set of translation schemes to specify particular translation phase, where the individual productions are annotated by such schemes as in \( p: A \rightarrow V:: \{ \) translation scheme \( \} \).
2) AGG is instantiated by RD, if:
- $\Sigma$ is an alphabet of symbols.
- $N = \{RD_1, RD_2, ..., RD_n\} \cup OP$, where $\{RD_1, RD_2, ..., RD_n\}$ is an ordered set of nonterminal symbols; $S \in N$ is a starting symbol and OP are special nonterminals representing the operations: $|$, $( )$, $(.)$ and $\ast$.
- $P$ is a finite set of productions $p$ having the form $A_i \rightarrow R_i$, where $A_i \in \{RD_1, RD_2, ..., RD_n\}$ and $R_i$ defined by applying OP over ($\Sigma \cup \{RD_1, RD_2, ..., RD_n\}$).
- $T$ is a set of translation schemes to specify the translation of lexical entities into appropriate tokens as in $p: A_i \rightarrow R_i :: \{ \text{translation scheme} \}$.
Subsequently, in our further discussion, we use a string as a generic term to either denotes strings, generated by RD, or sentences generated by CFG. These strings are annotated by appropriate translation schemes.
Example 1. Let $G = (\Sigma, N, P, S, TS)$ be AGG instantiated by RD, where: $(a-z, 0-9, +, *) \in \Sigma$, $(Id, num, op, ws, token, tokenlst) \in N$, $P = \{ \text{letter} \rightarrow a | b | ... | z, \text{digit} \rightarrow 0 | ... | 9, \text{ws} \rightarrow \text{blank}, id \rightarrow \text{letter (letter | digit)}, \text{num} \rightarrow \text{digit (digit)}, \text{op} \rightarrow + | \ast, \text{token} \rightarrow \text{id | num | op, tokenlst} \rightarrow \text{tokenlst ws token} \}$ and $TS$ is a set of translation schemes. Examples for strings generated by $G$ are: xy2z, 23.5 and 56.9. A possible annotation of $G$ is as follows:
- $id \rightarrow \text{letter (letter | digit)} :: \{ \text{Return (ID)} \}$, where ID is an encoding of a token of type id; $\text{num} \rightarrow \text{digit (digit)} :: \{ \text{Return (NUM)} \}$, where NUM is an encoding of a token of type num and $\text{op} \rightarrow + | \ast :: \{ \text{Return (OP)} \}$, where OP is an encoding of a token of type op.
Example 2. Let $G = (\Sigma, N, P, S, TS)$ be AGG grammar. It is instantiated by CFG as follows: $\Sigma = \{id, +, \ast\}$, $N = \{E, T, F\}$, $P = \{ E \rightarrow E + T | T, T \rightarrow T*F | F, F \rightarrow id \}$ and $TS$ is a set of translation schemes. Examples for strings generated by $G$ are: id*id, id, and id +id*id. A possible annotation of $G$ for type checking is as follows:
- $\text{F} \rightarrow \text{id} :: \{ \text{Type.F = Type.id} \}$ and $\text{E} \rightarrow \text{E + T :: Type.E = f(Type.E, Type.T)}$.}
3. The Proposed Generic Tool
Let $G = (\Sigma, N, P, S, TS)$ be an AGG grammar. The proposed generic tool (GCT) is defined either as a scanner, if $G$ is instantiated by RD, or as a parser, if $G$ is instantiated by CFG. In addition, GCT is defined in away that permit its transformation to a translator respective to the translation schemes (TS), annotating the individual productions of $G$. As such, GCT has the structure shown in Figure 1, where:
\[
\text{AGG} \rightarrow \underline{\text{Construction Algorithm}} \rightarrow \text{AGA} \rightarrow \underline{\text{Subset Construction}} \rightarrow \text{RAGA}
\]

- AGA is a nondeterministic automaton defined and constructed as given by Definition 4 and Section 3.1.
- RGA is a reduced automaton obtained as a result of applying a subset construction on AGA as given in Section 3.2.
- A simulator for RGA constructed as given in Section 3.3. Such simulator acts either as a scanner/translator or a parser/translator.
- Once a string is fed as an input to RGA simulator, an output is then produced as consisting of a respective sequence of AGG's production reductions and the results of the execution of the translation schemes annotating the individual AGG's productions.
Definition 4. An Augmented Generic Automaton (AGA)
Let $(\Sigma, N, P, S, TS)$ be AGG grammar. AGA is then defined by the 5-tuple $((\Sigma \cup \epsilon), Q, q_{\text{in}}, q_{\text{fin}}, TA)$, where:
- $\Sigma$ represents strings generated by the AGG grammar.
- Each grammar symbol $V \in (\Sigma \cup N)$ is represented by the pair $(V^i, V^f)$ to represent a prediction and an acceptance of $V$ in an assumed translation. Consequently, The GCCT states respective to each $V \in (\Sigma \cup N)$ are defined as the set $\{q' = V^i, q^f = V^f\}$, where: $q'$ is an initial state instantiated by $V^i$ and acts as a predictor (scanner) for $V$. The state $q^f$ is a final one, instantiated by $V^f$ and acts as its respective
136
acceptor. In addition and if \( V \) is associated with a translation scheme, the state \( q^f \) is augmented by such scheme as a translation action to be executed upon transition to \( q^f \). Hence, the set of AGA states is defined as \( Q = \{(q^i = V^i, q^f = V^f) \mid V \in (\Sigma \cup N)\} \) where, each state is instantiated by a respective grammar symbols.
- \( (q_{in} = S_i) \) and \( (q_{fin} = S^f) \) are the initial and final states, instantiated by the symbols respective to the starting grammar symbol of the AGG grammar.
- \( TA \) is a set of the translation actions of AGA. It consists of parsing actions annotated by translation schemes. The parsing actions consist of move transitions and reductions. Upon transitions and reductions, the action specified by such scheme is executed as an integral part of the parsing action. The move parsing actions are defined by the set \( SPA = \{\sigma(q_i, V) = (q_j) \mid \{\text{translation scheme}\}\} \), where \( \sigma(q_i, V) = (q_j) \) specifies a subsequent state \( q_j \in Q \) for a given state \( q_i \in Q \) and a given grammar symbol \( V \in T \). Upon transitions, a program fragment is performed as indicated by the annotating translation scheme. The reduce parsing actions are defined by the set \( RPA = \{\delta(q, V) = \text{reduce}(r) \mid \{\text{translation scheme}\}\} \), where \( \delta(q, V) = \text{reduce}(r) \) defines a reduction rule \( r \) for every \( V \in N, q \in Q \) such that \( q \) has been instantiated by \( V^f \) and \( V \) is the LHS \((r)\). RPA performs the indicated \{translation scheme\}. If the reduction is associated with such scheme.
The states and the parsing actions of AGA are dependent on the production types; the types of the grammar symbols and their respective positions in the individual productions of AGG, They are inductively constructed as given in Section 3.1.
### 3.1 AGA Construction Approach
Let \( G = (\Sigma, N, P, S, TS) \) be an AGG grammar, where:
- \( G \) is either instantiated by CFG or RD. Respectively, the set of productions \( P \) is generic and is either instantiated by grammar productions or regular definitions.
- The productions of CFG are classified into three types: simple productions, productions having alternatives and productions having embedded recursion.
- Given \( p \in P \), the grammar symbols \( V \) in \( p \) are classified into the following types: terminals, ranked terminals, nonterminals, a recursive-head (\( V \) is LHS \((p)\) and \( p \) is a production having embedded recursion) and a recursive-instance (\( V \in RHS(p) \) and \( V \) is LHS \((p)\)). In addition, each nonterminals with repeated occurrences in RHS of different productions is classified as repeated–instance.
- The right hand side of RD are regular expressions on which the following operations are applied: Concatenation; alternation; exponentiation.
- Considering a particular compilation phase, respective translation schemes (TS) are defined and used to annotate the set \( P \).
Assuming that the right hand sides (regular expressions) of RD are decomposed into their constituent sub expressions, Algorithm 1 constructs AGA for RD (AGA (RD)) as well as for CFG (AGA (CFG)). The construction of AGA (RD) or (AGA (CFG)) proceeds according to the same steps from which Algorithm 1 is composed. However, the construction of AGA (RD) excludes the step covering embedded recursions, while the construction of AGA (CFG) excludes the one covering exponentiation.
**Algorithm 1: AGA Construction Algorithm**
**Input:** An AGG grammar \( G = (\Sigma, N, P, S, TS) \).
**Output:** GA defined by the 5-tuple \( ((\Sigma \cup \varepsilon), Q, q_{in}, q_{fin}, TA) \) and its respective transition graph.
**Method:**
Initially, the states of AGA are constructed as the set as \( Q = \{(q^i = V^i, q^f = V^f) \mid V \in (\Sigma \cup N)\} \). AGA is then inductively constructed as follows:
1. **Basis:**
- Let \( (q_i, q_f) \in Q \) be an arbitrary states, denoted as an initial state and a final one respectively, AGA for the grammar symbol \( \varepsilon \) (AGA (\( \varepsilon \))) is then constructed as shown in Figure 2.
Figure 2. AGA (ε)
It constitutes an ε-transition (σ(qi, ε) = (qf, ::{ translation scheme}) between qi and qf, associated with a translation scheme.
- Let V ∈ Σ, AGA (V) is then constructed as consisting of two states (Fig.3) with the following transitions σ(qi, V) = (qf) ::{ translation scheme}

2) Induction:
2.1 Let p ∈ P: LHS(p) → RHS(p) be either a simple production or a concatenation of subexpressions; AGA (p) is then constructed as shown in Figure 4.

where: qi is the initial state and qf the final state of AGA (p). AGA (RHS(p)) is an aggregation of AGA1, …, and AGAn respective to the individual grammar symbols from which RHS (p) is composed. Hence, it is constructed as shown in Figure 5.
![Figure 5. AGA (RHS(p))] (image)
Each AGAi has qi and qf as an initial and final states respectively. AGA(p) has the following translation actions:
SPA: σ(qi, ε) = (qi) ::{ translation scheme}, where qi is an initial state of AGA (RHS(p)).
SPA: σ(qf, ε) = (qf) ::{ translation scheme} where qf is the final state of AGA (RHS(p)).
SPA: {σ(qi, ε) = (qi+1) ::{ translation scheme} | i=1,…, n-1 }.
RPA: δ(qf, LHS(p)) = reduce (LHS(p)) ::{ translation scheme}.
2.2 Let p ∈ P: LHS(p) → RHS1(p) |…|RHSn(p) be either a production with alternative right hand sides or alternative subexpressions RHS1(p), RHS2 (p),…, RHSn(p). AGA (p) is then constructed as shown in Figure 6.
Each alternative RHS_\_i (p) has a respective AGA(RHS_\_i (p)) with initial and final states q_\_i^i and q_\_i^f respectively. The initial and the final states of AGA (p) are q_i and q_f. AGA(p) has the actions:
SPA: \{ \sigma (q_\_i^i, \epsilon ) = (q_\_i^j) ::\{ translation scheme\} | j=1,..n\}, where q_\_i^j is the initial state of AGA_j.
SPA: \{ \sigma (q_\_i^f, \epsilon ) = (q_\_i^\_f) ::\{ translation scheme\} | j=1,..n\}, where q_\_i^\_f is the final state of AGA_j.
RPA: \delta (q_\_i, LHS(p)) = reduce (LHS(p)) ::\{ translation scheme\}.
2.3 Let p \in P: LHS(p) \rightarrow RHS(p) be a production having embedded recursion, where LHS(p) \in RHS(p) at position ( i ). AGA is constructed as shown in Figure 7.
AGA(p) consists of: the initial state q_i, the final state q_f and the AGA respective to (RHS(p)).
AGA(RHS(p)) has the states q_\_i^i, ..., q_{i-1}^i, q_{i-1}^\_f, q_i^i, q_i^\_f, ..., q_n^f, where q_\_i^i and q_n^f are the initial and final states; q_{i-1}^i and q_{i-1}^\_f are the initial and final respective to the embedded recursion. AGA actions are as follows:
SPA: \{ \sigma (q_\_i^i, \epsilon ) = (q_\_i^\_f) ::\{ recursion-initialization 1\}, where\{ recursion-initialization\} is a program segment, executed during parsing, that creates a stack (q_i) initialized with the symbol \epsilon at the top.
SPA: \{ \sigma (q_n^f, \epsilon ) = (q_f) ::\{ translation scheme\} \}
SPA: \{ \sigma (q_{i-1}^\_f, \epsilon ) = (q_{i-1}^i) ::\{ translation scheme\} \}
SPA: \{ \sigma (q_{i-1}^i, \epsilon ) = (q_i) ::\{ translation scheme\} ::\{ recursion-initialization 2\}, where\{ recursion-initialization 2\} is a program segment, executed during parsing, that initializes a recursive path with a return address q_{i-1}^\_f, pushed on the top of stack (q_i).
RPA: \delta (q_i, LHS(p)) = reduce (LHS(p)) ::\{ translation scheme\} \cup \{ recursion-termination\}, where\{ recursion-termination\} is a program segment, executed during parsing, that terminates a recursive path by performing an \epsilon-transition to the address at top of stack (q_i), if top( stack (q_i)) \neq \epsilon .
SPA: \{ \sigma (q_{i-1}^i, \epsilon ) = (q_{i-1}^\_f) ::\{ translation scheme\} \}.
2.4 Let \( \{ p \in P : \text{LHS}(p) \rightarrow \text{RHS}(p) \} \) be a set of productions having \((A \in \mathbb{N}) \in \text{RHS}(p)\), where \( A \) is classified as repeated-instance. AGA \((A)\) is then constructed for a selected instance. An AGA for each one of the other instance is constructed following the steps for embedded recursion.
2.5 Let \( p \in P : \text{LHS}(p) \rightarrow \text{RHS}(p) \) be a production (regular definition) having a sub expression \( r^* \) at position \((i)\), where \( r^* \in \text{RHS}(p) \) at position \((i)\). AGA \((p)\) is constructed as shown in Figure 8.

AGA \((p)\) consists of: the initial state \(q_0\), the final state \(q_f\) and AGA \((\text{RHS}(p))\) respective to \((\text{RHS}(p)).\) AGA \((\text{RHS}(p))\) has the states \(q_{1}^{i}, \ldots, q_{i-1}^{f}, \text{AGA}(r^*), q_i^{1}, \ldots, q_i^{n}, \) where: \(q_{1}^{i}\) and \(q_{1}^{f}\) are the initial and final states for AGA\((r^*)\); \(q_{i}^{1}\) and \(q_{i}^{f}\) are the initial and final respective to the exponentiation. AGA actions are:
- \(\text{SPA: } \sigma(q_0, \varepsilon) = (q_1^i, ) :: \{ \text{translation scheme} \} \)
- \(\text{SPA: } \sigma(q_i^f, \varepsilon) = (q_i^f, ) :: \{ \text{translation scheme} \} \)
- \(\text{SPA: } \sigma(q_{i+1}^f, \varepsilon) = (q_{i+1}^f, ) :: \{ \text{translation scheme} \} \)
- \(\text{SPA: } \sigma(q_{i+1}^f, \varepsilon) = (q_{i+1}^f, ) :: \{ \text{translation scheme} \} \)
- \(\text{SPA: } \sigma(q_{i+1}^f, \varepsilon) = (q_{i+1}^f, ) :: \{ \text{translation scheme} \} \)
- \(\text{SPA: } \sigma(q_{i+1}^f, \varepsilon) = (q_{i+1}^f, ) :: \{ \text{translation scheme} \} \)
- \(\text{RPA: } \delta(q_f, \text{LHS}(p)) = \text{reduce (LHS}(p)) :: \{ \text{translation scheme} \} \)
**Example 3.** Let \( G = (\Sigma, N, P, S, TS) \) be GAA grammar with simple productions. Where: \((\text{id}, +, *) \in \Sigma, (E, T, F) \in N\) and \( P = \{ E \rightarrow E^+T, T \rightarrow T^*F, F \rightarrow \text{id} \} \). A nondeterministic automaton representing AGA respective to \( G \) is shown in Figure 9.

Example 4. Let $G = (\Sigma, N, P, S, TS)$ be GGA grammar instantiated by regular definitions as given in Example 1. Fig. 10 shows a nondeterministic automaton representing AGA respective to the productions: \text{letter} \rightarrow a | b | \ldots | z; \text{digit} \rightarrow 0 | \ldots | 9; \text{id} \rightarrow \text{letter (letter | digit)}^*; \text{token} \rightarrow \text{id}; \text{and tokenlst} \rightarrow \text{token}.
3.2 RAGA Construction Approach
In this section, we propose a construction approach for the reduced automaton RAGA based on extension of the subset construction algorithms given in (Aho et al., 2007; Jabri, 2012). Such extension is a twofold. First, it covers a wider class of grammars including RD and CFG. Second, it has a deterministic behavior upon the RGAG reduce actions, as well as upon return actions as determined by recursion-termination.
The constructed automaton in (Jabri, 2012) has multiple transitions and respective reductions. In contrast, according to the proposed approach, the sets of follow symbols for the nonterminals are used to determine their respective reduction in a deterministic way, similar to the one adopted for SLR parsers (Aho et al., 2007). Based on such approach a proposed algorithm, denoted by Algorithm 2 is given below. Having the AGA states $Q_{AGA}$ and their respective translation actions $TA_{AGA} = \{\text{AGA.PAS, AGA.PAR}\}$ as an input, Algorithm 2 constructs RAGA respective to the nondeterministic one. RAGA (G) is represented by its respective states $Q_{RGA}$ and translation actions $TA_{RGA}$. In its turn, two tables represent $TA_{RGA}$ The first one constitutes a transition table (TRT), where each entry (TRT $[q_i, V_j]$) of such table specifies the transitions of type SPA. The second table RTT specifies the reductions (RPA) and to the translation actions (as indicated by the translation schemes respective to SPA and RPA) to be performed by RAGA (G) during its run on an input alphabet, generated from the grammar G. Thus, Algorithm 2 computes $Q_{RGA}$ using an $\epsilon$-closure function (Aho et al., 2007). This function closes the initial states and the final states respective to the different grammar symbol types. However, it does not close the initial states instantiated by grammar symbols of types recursive-instances ($V_i^i, V_i^f$) and repeated-instance. Algorithm 2 handles these symbols by creating respective states and transitions, including the translation schemes {recursion-initialization} and {recursion-termination}.
Algorithm 2. RAGA Construction
Input: AGA automaton, defined by the 5-tuple: $((\Sigma \cup \epsilon), Q_{AGA}, T_{AGA}, q_{in}, q_{fin})$.
Output: RAGA automaton, defined by the 5-tuple: $((\Sigma \cup \epsilon), Q_{RGA}, T_{RGA}, q_{in}, q_{fin})$.
Figure 10. AGA for the grammar of Example 4
Method:
Step 1: Construct the set \( Q_{RGA} \) of RAGA states and a respective set \( TA_{RGA} \) of type shift as \( \varepsilon \)-closures of the states in \( Q_{GA} \) and their respective transitions.
Step 2: Complete the construction of the set \( TA_{RGA} \) and construct the respective transition and reduction/translation tables, represented by the tables \( TRT \) and \( RTT \).
Step 1 of Algorithm 1 proceeds by executing the program segment as shown in Figure 11, where it starts by constructing the initial state \( RAGA.q_{in} \) and then repeatedly considers each constructed state \( q \) in \( Q_{RGA} \) to constructs the subsequent states \( q_i \) as \( \varepsilon \)-closure (\( \sigma(q_{pii}, V) \)) such that \( q_{pii} \) in \( q \) and \( \sigma(q_{pii}, V) \in TAGA \). The transitions \( TARGA \) respective to \( q \) are then constructed as \( \sigma(q, V) = q_i \). In addition, it registers the states representing recursion and repetition and constructs \( \varepsilon \)-closures respective to the states initialized by grammar symbols of type \( q_{pi} \). Step 2 of Algorithm 1 proceeds by executing the program segment as shown in Figure 12, where: First, it constructs the transitions respective to the registered-heads as well as the states and transitions respective to the registered-instances. Second, it constructs the reduce/translation actions respective RAGA states and represents these actions (and the RAGA transitions) as entries in the tables \( RTT \) and \( TRT \).
Example 5. Let \( G = (\Sigma, N, P, S) \) be a grammar with simple productions as given in Example 3. \( G \) is annotated by translation schemes to translate expressions in infix notation into ones in postfix notation as given in (Aho et al., 2007). The automaton representing RAGA (\( G \)) as constructed by Algorithm 2 is given in terms of its transition graph and the tables \( TRT \) and \( RTT \) as shown in Figure 13 and Table 1 respectively.
Example 6. Let \( G = (\Sigma, N, P, S) \) be a generic grammar instantiated by regular definitions as given in Example 2.2 but annotated by translation schemes to produce recognized tokens. The automaton representing RAGA(G) as constructed by Algorithm 2 is given in terms of its \( TNT \) and \( TRT \) as shown in Table 2.
For each state $q$ in registered-head
\[
\{ \text{Add } (j, \text{RTT (recursion-initialization)}_1(q)); \text{Add } (\text{RTT}[q, \cdot] = j) \}
\]
For each pair $(q_i^0, q_f)$ in registered-instances
\[
\{ q = \text{Select } (q_i^0, \text{registered-head}); \text{Add } (\text{RTT}[q, \cdot] = q_i^0) \}
\]
For all $V \in \Sigma$ such that ($\sigma(q, V) = q_i) \in \mathcal{T}_{\text{RGA}}$ \{Add (RTT[$q_i^0, V] = q_i\}
\]
\[
\text{Add } (j, \text{RTT(recursion-initialization)}_2(q_f)); \text{Add } (\text{RTT}[q, \cdot] = j);
\]
\}
For each state $q$ in $\mathcal{Q}_{\text{RGA}}$
\[
\{ \text{For each } V \in \Sigma \text{ such that such that } (\sigma(q, V) = q_i) \in \mathcal{T}_{\text{RGA}} \}
\]
\[
\{ \text{Add } (\text{RTT}[q, V] = q_i) \};
\]
For (every $X \in \mathcal{N}$ such that $X' \in q_i$) and (every $V \in \text{Follow } (X)$);
\[
\{ \text{Add } (\delta(q, V) = \text{reduce } r(X) ::= \{\text{translation scheme}\}) \} \text{ to } \mathcal{T}_{\text{RGA}}
\]
\[
\text{Add } (j, \text{RTT } (\mathcal{T}_{\text{RGA}}) (\delta(q, V)) \text{ Add } (\text{RTT}[q, V] = j);
\]
If (X is a recursive-head or a repeated-head)
\[
\{ \text{Add } (j, \text{RTT } (\text{recursion-termination}), \text{Add } (\text{RTT}[q, V] = j)) \}
\]
If (X is a starting symbol) \{Add (j, RTT (Accept), Add (RTT[q, S] = j))\}
Figure 12. The Construction of the RAGA reduce/translation actions and its tables

Figure 13. The transition graph of RAGA for the grammar of Example 5
Table 1. The transition/reduction tables of RAGA for the grammar of Example 5
<table>
<thead>
<tr>
<th>State</th>
<th>Input Symbols</th>
<th>Entry</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>$q_0$</td>
<td>$q_0$, $q_1$</td>
<td>1</td>
<td>$R (F \rightarrow \text{id}, T \rightarrow F, E \rightarrow T)_i::{(\text{print}(\text{id})), \text{Accept}}$</td>
</tr>
<tr>
<td></td>
<td>$q_1$</td>
<td>2</td>
<td>$R (F \rightarrow \text{id}, T \rightarrow F, E \rightarrow T)_i::{(\text{print}(\text{id})), {(\text{rec-termination})= q_f}$</td>
</tr>
<tr>
<td></td>
<td>$q_2$</td>
<td>3</td>
<td>$R (F \rightarrow \text{id}, T \rightarrow F, E \rightarrow T)_i::{(\text{print}(\text{id})), {(\text{rec-termination})= q_f}$</td>
</tr>
<tr>
<td></td>
<td>$q_3$</td>
<td>4</td>
<td>${(\text{recursion-initialization})}$</td>
</tr>
<tr>
<td></td>
<td>$q_4$</td>
<td>5</td>
<td>${(\text{recursion-initialization})}$</td>
</tr>
<tr>
<td></td>
<td>$q_5$</td>
<td>6</td>
<td>$R (E \rightarrow E+T):{(\text{print}(\text{+})))};\text{Accept}$</td>
</tr>
<tr>
<td></td>
<td>$q_6$</td>
<td>7</td>
<td>$R (E \rightarrow E+T):{(\text{print}(\text{+})))};{(\text{recursion-termination})= q_f}$</td>
</tr>
<tr>
<td></td>
<td>$q_7$</td>
<td>8</td>
<td>$R (E \rightarrow E+T):{(\text{print}(\text{+})))};{(\text{recursion-termination})= q_f}$</td>
</tr>
<tr>
<td></td>
<td>$q_8$</td>
<td>9</td>
<td>$R (F \rightarrow \text{id}, T \rightarrow T<em>F):{(\text{print}(\text{id})), {(\text{print}(\text{</em>})))};{(\text{recursion-termination})= q_f}$</td>
</tr>
<tr>
<td></td>
<td>$q_9$</td>
<td>10</td>
<td>$R (F \rightarrow \text{id}, T \rightarrow T<em>F):{(\text{print}(\text{id})), {(\text{print}(\text{</em>})))};{(\text{recursion-termination})= q_f}$</td>
</tr>
<tr>
<td></td>
<td>$q_{10}$</td>
<td>11</td>
<td>$R (F \rightarrow \text{id}, T \rightarrow T<em>F):{(\text{print}(\text{id})), {(\text{print}(\text{</em>})))};{(\text{recursion-termination})= q_f}$</td>
</tr>
</tbody>
</table>
Table 2. The transition/reduction tables of RAGA for the grammar of Example 6
<table>
<thead>
<tr>
<th>State</th>
<th>Input Symbols</th>
<th>TRT table</th>
<th>RTT table</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td>$\varepsilon$</td>
<td>+</td>
</tr>
<tr>
<td>$q_0$</td>
<td>$q_{1r}$</td>
<td>$q_3$</td>
<td>$q_4$</td>
</tr>
<tr>
<td>$q_{1r}$</td>
<td>$q_{1r}$</td>
<td>$q_3$</td>
<td>$q_4$</td>
</tr>
<tr>
<td>$q_{1r}$</td>
<td>$q_2$</td>
<td></td>
<td></td>
</tr>
<tr>
<td>$q_3$</td>
<td>$q_3$</td>
<td>$q_4$</td>
<td>$q_7$</td>
</tr>
<tr>
<td>$q_4$</td>
<td>$q_5$</td>
<td>$q_5$</td>
<td>$q_6$</td>
</tr>
<tr>
<td>$q_5$</td>
<td>$q_7$</td>
<td>$q_7$</td>
<td>$q_8$</td>
</tr>
</tbody>
</table>
3.3 RAGA Simulation
Let $G$ be an AGG grammar, respective AGA($G$) and RAGA($G$) are constructed by Algorithm 1 and Algorithm 2. The run of RAGA($G$) on input strings generated by $G$ is then simulated by Algorithm 3, as given below.
Algorithm 3. RAGA Simulator
**Input:** An input string ($w\$)$ and the RAGA($G$) automaton, respective to a grammar $G$. RAGA($G$) is represented by two tables: the transition table TRT and the reduction-translation table RTT.
**Output:** Set of reductions as they occur, if $w \in (G)$ Translation actions as indicated by parsing actions.
**Method:**
Initially, the simulator is in its initial configuration, consisting from the RAGA($G$) initial state $q_{in}$ and the input string, represented as $INPUT[\ ] = w\$. As the individual input symbols are read, the simulator performs their respective parsing actions. This is achieved by executing the following program segment.
```plaintext
NextStates = NextStates \cup \{q_{in}\};
Create-simulation-path (\{q_{in}\});
For each recursive-head $q_{ir}$ in NextStates
{ perform RTT [TRT[q_{ir}]].S (recursion-initialization)};
For $i = 1$ to MaxSize (INPUT)
{Subsequentstates= $\phi$
For each state $q$ in NextStates
{ Movet-states = $\phi$ ; Reduce-states = $\phi$ ; Return-states = $\phi$ ;
Shift-states = TRT [q, INPUT [i]] ;
If (Shift-states = $\phi$) { output(Error)}
Elseif
{For each state $s$ in Shift-states
{Movestates = Movestates \cup s;
Create-simulation-path ( s, simulation-path(q));
If (s = $q_{ir}$) { perform RTT[[TRT[s, -]].S (recursion-initialization)};
If (Reduce-state (s))
{ Output (RTT[[TRT[s, LA]].R( reductions);
Output (RTT[[[TRT[s, LA]].S (translation scheme)
```
If \((s = q_r^i)\)
\{ Return-states = Return-states ∪
( perform RTT([[TRT[s, LA]].S (recursion-termination)]) ;
\}
Subsequent-states = Subsequent-states ∪ Shift-states ∪ Return-states;
\}
NextStates = Subsequent-states;
\}
If \((NextStates \cap q_{\text{fin}} \neq \emptyset)\) \{ Accept (Input) \; \}
**Example 7.** Let \(a \cdot c\) be a string generated by the grammar of examples 2.2 and 3.4. The run of RAGA on such string is shown in Table 3.
**Example 8.** Let \(i d \cdot id\) be a string generated by the grammar of examples 2.1 and 3.3. The run of RAGA on such string is shown in Table 4.
<table>
<thead>
<tr>
<th>Table 3. The run of RAGA simulator on a string</th>
</tr>
</thead>
<tbody>
<tr>
<td>Current state</td>
</tr>
<tr>
<td>q0; q1r</td>
</tr>
<tr>
<td>q7</td>
</tr>
<tr>
<td>q8</td>
</tr>
<tr>
<td>q1r; q7r</td>
</tr>
<tr>
<td>q4</td>
</tr>
<tr>
<td>{ R (OP \rightarrow *), {\text{print}(op, *)}, R(T \rightarrow op)}</td>
</tr>
<tr>
<td>q0; q1r</td>
</tr>
<tr>
<td>q7</td>
</tr>
<tr>
<td>q8</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Table 4. The run of RGCCT simulator on a string</th>
</tr>
</thead>
<tbody>
<tr>
<td>Current state</td>
</tr>
<tr>
<td>q0; q1r</td>
</tr>
<tr>
<td>q7</td>
</tr>
<tr>
<td>q8</td>
</tr>
<tr>
<td>q1r; q7r</td>
</tr>
<tr>
<td>q4</td>
</tr>
<tr>
<td>{ R (OP \rightarrow *), {\text{print}(op, *)}, R(T \rightarrow op)}</td>
</tr>
<tr>
<td>q0; q1r</td>
</tr>
<tr>
<td>q7</td>
</tr>
<tr>
<td>q8</td>
</tr>
</tbody>
</table>
4. Experimental Results
To validate the correctness, the simplicity and the applicability of our proposed approach, and in addition, to inspect how easily the transition from theory to practice can be made, the proposed GCT has been assigned as a graduation project. Based on the GCT concepts and its implementation algorithms, the assignment is reduced to the implementation of a version that can be used by students as tool for the construction of the different compiler's phases. The parsing phase has been selected as representative one. As such, GCT has been implemented, using Microsoft Visual C++ 6.0., by the program given in Figure 14, where:
- InteractionContext ( ) is a method to input a AGG grammar defined by the 4-tuple $G = (\Sigma, N, P, S)$. It is implemented by the three functions: Terminals ( ); NonTerminals ( ); and Productions ( ) to facilitate the input of the terminal symbols ( $\Sigma$ ), the nonterminal symbols (N) and the AGG productions (P) respectively. The productions are entered one by one (p), where LHS(p) is entered first followed by the symbols of RHS (p), from left to right. This enables automatic indexing of the grammar symbols by their respective positions within each production. As the productions are entered they are mapped into respective automaton (AGA) states (Q), where for each grammar symbol $V_p$, its corresponding initial state $q_p^i \in Q$ and final state $q_p^f \in Q$ are created.
- Based on the construction algorithm, the method construct_aga( ) completes the construction of the AGA automaton by creating the parsing actions respective to Q. Such construction is achieved using the attached index of the individual states as indicator for the positions of their corresponding grammar symbols within their respective productions. In addition, construct_aga( ) produces as an output the transition graph respective to AGA.
- construct_raga ( ) is a method to construct RAGA automaton according to the subset construction algorithm. It produces as an output the parsing table respective to RAGA.
The outlined implementation of GCT and its use as a scanner/parser/translator have been experimented by the students from three sections of a compiler construction course over three semesters. Several grammars, annotated by respective translation schemes have been used. Compared to previous semesters, the number of students completed their assignments has been increased by 30%. The following is an example of such experiments.
**Example 9.** Considering the grammar $G = (\Sigma, N, P, S)$, where: $(d, b, c) \in \Sigma, (S, A, B, X) \in N$ and $P = \{ S \rightarrow Ad, A \rightarrow BX, B \rightarrow b, X \rightarrow c \}$. Its parsing using GCT proceeds as follows
The grammar G is inputted using an interaction context to enter $\Sigma, N$ and $P$ as shown in Figures 15 and 16 respectively.
The output produced by the method construct_aga ( ) consists of a transition graph of AGA respective to the inputted grammar as shown in Figure 17.
The output produced by the method `construct_raga()` consists of the set of RAGA states and its representative parsing and translation tables as shown in Figure 18, Figure 19 and Figure 20 respectively.
Figure 15. The GCT interaction context to input grammar symbols
Figure 16. The GCT interaction context to input grammar productions
Figure 17. A transition graph of AGA respective to the grammar (3.5) as produced by GCT
Figure 18. The set of RAGA states as constructed by GCT
5. Discussion
The proposed tool has been analyzed and experimented against the set objectives and in two directions. The first one considers GCT as a new compiler construction approach. The second direction considers GCT as a teaching tool.
As a compiler construction approach, GCT has demonstrated the following properties: Generality and soundness of its construction approach. GCT constructs a bottom up parsing automaton (RAGA) that simulates shift–reduce one, but with reduced stack activities. In addition, regular definitions are recognizable by RAGA. Semantic action can be inserted within grammar productions. As a result, GCT can easily provide a syntax directed translator.
RAGA features the finite automata (Aho et al., 2007) in two aspects. The first one is the number of its states transitions. The second aspect is the complexity of its subset construction algorithm. However, these aspects are with additional overhead to handle recursion. Compared to LR parsers (Aho et al., 2007), RAGA has less number of states and less parser size. This is due to the fact that it performs shift-reduce operations with stack activities reduced to recursion handling. In addition, RAGA has no goto-transition on non terminals. Hence, their respective computational overhead and the construction of the goto-part of the parsing table are not included in the subset construction algorithm for RAGA.
RAGA is based on position parsing automata (PPA) as proposed in (Jabri, 2009) In addition, it handles recursion in a similar way as the one in recursion incorporated generalized parsers (RI) (Galves et al., 2006; Johnstone & Scott, 2007; Scott & Johnstone, 2005). However, compared to such approaches RAGA is distinguished by its annotation with translation schemes and the following properties:
(1) Compared to PPA, RAGA is considered as an extension since it handles left, embedded and direct right recursion, while PPA handles the embedded ones only. Furthermore, their handling approach is different. PPA handles recursion by state and transition instantiation while RAGA handles recursion by reduced stack activities. Finally, the reduced version of PPA (Jabri, 2012) has non deterministic behavior while RAGA has deterministic one. Such determinism is achieved by using look ahead symbols, upon the reduction actions of RAGA.
(2) Compared to RI, RAGA handles left and right recursion while RI handles embedded ones and follows different construction and parsing approach. In addition to stacks needed for recursion handling, in RI two parsing stacks are used while in RAGA no parsing stacks are used.
As a teaching tool, GCT has been experimented and compared against existing ones. It has been shown that GCT is distinguished by the following:
(1) GCT is based on concepts from finite and LR automata as well as syntax directed translation. Hence, it obeys strictly to theory and facilitates a smooth transition to practice.
Its use within the proposed teaching framework is consistent with the compiler construction phases and their respective order. In contrast, the existing tools are based on a particular approach, for examples:
- The suggested tool in (Mallozzi, 2005) is based on recursive descent approach.
- The suggested one in (Demaille & Levillain, 2008) is an extension of the well-known Bison tool (Corbett et al., 2003) and based on LALR grammar (Aho et al., 2007).
- A third tool suggested in (Morell & Middleton, 2003) follows recursive ascent approach that simulates tabular-less bottom up parsers.
In contrast to such tools and a similar one (Pinaki et al., 2011), GCT simulates a generic bottom-parser and maintains its inherent tables but with reduced size and overhead. Furthermore, compared to Lex and Yacc (Mason & Brown, 1990) GCCT is a pedagogical tool. Its input features regular and context-free grammars. Its construction approach is a direct mapping to an automaton. It produces as an output the transition graph and the parsing table respective to the constructed automaton, associated with textual information. Furthermore, it enables more experiments to be conducted by students within the framework of the compiler construction course. For example, students were asked to construct a parser using the same grammar (Example 9) and following the proposed approach as well as the SLR approach (Aho et al., 2007). It has been shown that the parser constructed according to our approach requires less construction time and less states (8) as compared to the one constructed by SLR (15 states). Furthermore, the ease of use of GCT as automated tool is demonstrated by the fact that it use reduced to an interaction context consisting of the textual representation of the context-free grammars without any modification. A graphical, tabular and textual information representing GCT are then displayed as an output.
6. Conclusion
In this paper, we have proposed and implemented a tool for teaching compilers. The tool is based on a new compiler construction approach that is characterized by its soundness, generality and efficiency. Having as an input, a generic grammar (Regular definitions or context-free grams), annotated by translation schemes, the proposed tool respectively reacts either as a scanner, a parser, or as a syntax directed translator. Such reaction proceeds as follows. First, it constructs a nondeterministic bottom–up automaton (AGA). The states and the transitions of AGA are defined based on concepts from the LR (0) items and the finite deterministic automata. Second, AGA is transformed into a reduced one (RAGA) in efficient way. Such automaton simulates the parsing behavior of the shift-reduce automata. Finally, the tool produces as an output the transition graph and the parsing / translation tables respective to RAGA. The experiments and the analysis of the proposed approach for have shown its superiority over similar ones, either in terms of its generality or in terms of its performance and ease of use. In addition, the tool has proved its practical application within a compiler teaching framework and in a way that tightly couples theory and practice. Since such experiments have emphasized the syntax analysis phase of compilers, further experiments, as a future work, are to be conducted to demonstrate the capability of the proposed tool in the subsequent compilation phases such as code generation.
References
|
{"Source-Url": "http://www.ccsenet.org/journal/index.php/cis/article/download/26919/16424", "len_cl100k_base": 12687, "olmocr-version": "0.1.50", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 42279, "total-output-tokens": 14783, "length": "2e13", "weborganizer": {"__label__adult": 0.0004100799560546875, "__label__art_design": 0.00046133995056152344, "__label__crime_law": 0.00031495094299316406, "__label__education_jobs": 0.0056915283203125, "__label__entertainment": 8.815526962280273e-05, "__label__fashion_beauty": 0.00021564960479736328, "__label__finance_business": 0.0002772808074951172, "__label__food_dining": 0.00047969818115234375, "__label__games": 0.0007696151733398438, "__label__hardware": 0.0010423660278320312, "__label__health": 0.000713348388671875, "__label__history": 0.0003211498260498047, "__label__home_hobbies": 0.00012922286987304688, "__label__industrial": 0.0005693435668945312, "__label__literature": 0.00045013427734375, "__label__politics": 0.0003838539123535156, "__label__religion": 0.0007815361022949219, "__label__science_tech": 0.023681640625, "__label__social_life": 0.0001347064971923828, "__label__software": 0.00432586669921875, "__label__software_dev": 0.95751953125, "__label__sports_fitness": 0.00040340423583984375, "__label__transportation": 0.0007686614990234375, "__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, 47950, 0.02446]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 47950, 0.69716]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 47950, 0.83548]], "google_gemma-3-12b-it_contains_pii": [[0, 3731, false], [3731, 8401, null], [8401, 12852, null], [12852, 17044, null], [17044, 18484, null], [18484, 20677, null], [20677, 22876, null], [22876, 25717, null], [25717, 28023, null], [28023, 31282, null], [31282, 33634, null], [33634, 35650, null], [35650, 38664, null], [38664, 39147, null], [39147, 42086, null], [42086, 46799, null], [46799, 47950, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3731, true], [3731, 8401, null], [8401, 12852, null], [12852, 17044, null], [17044, 18484, null], [18484, 20677, null], [20677, 22876, null], [22876, 25717, null], [25717, 28023, null], [28023, 31282, null], [31282, 33634, null], [33634, 35650, null], [35650, 38664, null], [38664, 39147, null], [39147, 42086, null], [42086, 46799, null], [46799, 47950, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 47950, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 47950, null]], "pdf_page_numbers": [[0, 3731, 1], [3731, 8401, 2], [8401, 12852, 3], [12852, 17044, 4], [17044, 18484, 5], [18484, 20677, 6], [20677, 22876, 7], [22876, 25717, 8], [25717, 28023, 9], [28023, 31282, 10], [31282, 33634, 11], [33634, 35650, 12], [35650, 38664, 13], [38664, 39147, 14], [39147, 42086, 15], [42086, 46799, 16], [46799, 47950, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 47950, 0.15082]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
b325782915218dc2cbb96b3769339e7ab5463388
|
Shortcut Fusion of Monadic Programs
Cecilia Manzino\textsuperscript{1}, Alberto Pardo\textsuperscript{2}
\textsuperscript{1} Facultad de Ciencias Exactas, Ingeniería y Agrimensura
Universidad Nacional de Rosario, Argentina
\textsuperscript{2} Instituto de Computación, Facultad de Ingeniería
Universidad de la República, Montevideo, Uruguay
ceciliam@fceia.unr.edu.ar, pardo@fing.edu.uy
Abstract. Functional programs often combine separate parts of the program using intermediate data structures for communicating results. Programs so defined are easier to understand and maintain, but suffer from inefficiencies due to the generation of those data structures. In response to this problematic, some program transformation techniques have been studied with the aim to eliminate the intermediate data structures that arise in function compositions. One of these techniques is known as shortcut fusion. This technique has usually been studied in the context of purely functional programs. In this work we propose an extension of shortcut fusion that is able to eliminate intermediate data structures generated in the presence of monadic effects. The extension to be presented can be uniformly defined for a wide class of data types and monads.
1. Introduction
Functional programs often combine separate parts of the program using intermediate data structures for communicating results. Programs so defined have many benefits, such as clarity, modularity, and maintainability, but suffer from inefficiencies caused by the generation of those data structures. In response to this problematic, some program transformation techniques have been developed aiming at the elimination of the intermediate data structures. One of these techniques, known as shortcut fusion (or shortcut deforestation) [Gill et al. 1993], has mainly been studied in the context of purely functional programs. The aim of this paper is the proposal of an extension of shortcut fusion for programs with monadic effects. The goal is to achieve fusion of monadic programs, maintaining the global effects. Like standard deforestation, we will be interested in eliminating the intermediate data structures generated in function compositions, but with the difference that now those intermediate structures are produced as the result of monadic computations. An important feature of the extension to be presented is that it is generic, in the sense that it is given by a uniform, single definition that can then be instantiated to a wide class of data types and monads.
This work has strong connections with previous work on fusion techniques for recursion schemes for programs with effects [Pardo 2001, Pardo 2005]. The main difference is that in the present work we adopt a shortcut fusion approach based on parametricity properties of polymorphic functions, known in functional programming as free theorems [Wadler 1989]. The results of this paper were preliminary presented in [Manzino 2005]. Throughout we will use Haskell notation, assuming a cpo semantics (in terms of pointed cps), but without the presence of the \textit{seq} function [Johann and Voigtländer 2004].
The paper is organized as follows. We start in Section 2 with a review of the concept of shortcut fusion. In Section 3, by means of specific examples, we show the extension of shortcut fusion to programs with effects. The generic constructions that give rise to the specific program schemes and laws presented in Sections 2 and 3 are developed in Section 4; a proof of the monadic shortcut fusion law is also presented. Section 5 summarizes related work, and Section 6 concludes the paper.
2. Shortcut fusion
Shortcut fusion [Gill et al. 1993] is a program transformation technique originally proposed for lists, but that can be defined for other datatypes as well. Given a function composition \( c \circ p \), the idea of shortcut fusion is to eliminate the intermediate data structure produced by \( p \) (the producer) and consumed by \( c \) (the consumer) by a suitable combination of their definitions. We analyse the case of lists and arithmetic expressions.
Lists Shortcut fusion requires the consumer to be given by a structural recursive definition that treats all elements of a list in a uniform manner. This is captured by a recursion scheme called fold:
\[
\begin{align*}
\text{fold}_L & \quad :: (b, a \to b \to b) \to [a] \to b \\
\text{fold}_L (\text{nil}, \text{cons}) [\ ] & = \text{nil} \\
\text{fold}_L (\text{nil}, \text{cons}) (a : as) & = \text{cons} a (\text{fold}_L (\text{nil}, \text{cons}) as)
\end{align*}
\]
A fold is a function that traverses the input list and replaces the occurrences of the list constructors \( [\ ] \) and \( (\cdot) \) by \text{nil} and \text{cons}, respectively. For example, \( \text{fold}_L (\text{nil}, \text{cons}) \) applied to the list \( 1 : 2 : 3 : [\ ] \) returns the expression \text{cons} 1 (\text{cons} 2 (\text{cons} 3 \text{nil})).
The producer, on the other hand, is required to be able to show that the list constructors can be abstracted from the process that generates the intermediate list. This is expressed by a function called build:
\[
\begin{align*}
\text{build}_L & \quad :: (\forall b \cdot (b, a \to b \to b) \to b) \to [a] \\
\text{build}_L g & = g ([\ ], (\cdot))
\end{align*}
\]
For example, the list \( 1 : 2 : 3 : [\ ] \) can be written as \( \text{build}_L (\lambda (n, c) \to c 1 (c 2 (c 3 n))) \).
With the forms required to the producer and the consumer it is now possible to state the following fusion law, known as shortcut fusion.
Law 1 (fold/build for lists)
\[
\text{fold}_L (\text{nil}, \text{cons}) (\text{build}_L g) = g (\text{nil}, \text{cons})
\]
The intuition behind this law is the following: since \( g \) explicitly exhibits that the intermediate list generation relies on the constructors \( [\ ] \) and \( (\cdot) \), and those constructors are immediately replaced by \text{nil} and \text{cons} by the fold, then the final result corresponds to \( g \) applied directly to \text{nil} and \text{cons}.
To see an example, consider the following definition of factorial:
\[1\text{The fold for lists is known as foldr in the functional programming jargon [Bird 1998].}\]
Given \( n \), we first compute the list of numbers between \( n \) and 1 and then calculate their product. However, as we all know, it is not necessary to produce an intermediate list to compute factorial. The listless definition can be obtained by shortcut fusion. To do so we need to express the product and down in terms of fold and build, respectively.
\[
\text{product} = \text{fold}_E (1, (*)) \\
down n = \text{build}_E (g\down n)
\]
where
\[
g\down 0 (\text{nil}, \text{cons}) = \text{nil} \\
g\down n (\text{nil}, \text{cons}) = \text{cons} n (g\down (n - 1) (\text{nil}, \text{cons}))
\]
By applying Law 1 we obtain \( \text{fact} n = g\down n (1, (*)) \), which corresponds to the usual definition of factorial: \( \text{fact} 0 = 1 \) and \( \text{fact} n = n \ast \text{fact} (n - 1) \).
**Arithmetic expressions** Consider a datatype for simple arithmetic expressions formed by numerals and addition.
\[
data \text{Exp} = \text{Num} \text{Int} | \text{Add Exp Exp}
\]
The fold and build functions for this datatype are defined as follows:
\[
\text{fold}_E :: (\text{Int} \rightarrow a, a \rightarrow a \rightarrow a) \rightarrow \text{Exp} \rightarrow a \\
\text{fold}_E (\text{num}, \text{add}) (\text{Num} n) = \text{num} n \\
\text{fold}_E (\text{num}, \text{add}) (\text{Add} e e') = \text{add} (\text{fold}_E (\text{num}, \text{add}) e) (\text{fold}_E (\text{num}, \text{add}) e') \\
\text{build}_E :: (\forall a . (\text{Int} \rightarrow a, a \rightarrow a \rightarrow a) \rightarrow a) \rightarrow \text{Exp} \\
\text{build}_E g = g (\text{Num}, \text{Add})
\]
**Law 2 (fold/build for expressions)**
\[
\text{fold}_E (\text{num}, \text{add}) (\text{build}_E g) = g (\text{num}, \text{add})
\]
### 3. Monadic shortcut fusion
In functional programming, monads are a powerful mechanism to structure programs that produce effects, such as exceptions, state, or input/output [Wadler 1995]. A monad is usually presented as a triple formed by a type constructor \( m \), a polymorphic function return and a polymorphic operator (\( \Rightarrow \)) (often called bind), such that certain laws are satisfied [Wadler 1995]. In Haskell, a monad can be defined in terms of a class:
\[
\text{class Monad } m \text{ where}
\]
With the aim at improving readability of monadic programs, Haskell provides a special syntax called the do notation. It is defined by the following translation rules:
\[
\begin{align*}
\text{return} &:: a \rightarrow m a \\
(\gg=) &:: m a \rightarrow (a \rightarrow m b) \rightarrow m b \\
(\gg) &:: m a \rightarrow m b \rightarrow m b \\
m \gg m' &= m \gg \lambda a \rightarrow m'
\end{align*}
\]
Before introducing a law corresponding to monadic shortcut fusion, we first analyze what happens when we consider compositions of effectful functions. After that we present a fusion law that considers a restricted form of monadic compositions in which only the function that generates the intermediate data structure may produce an effect, while the consumer is purely functional. The conception of this law has strong connections with similar laws developed for monadic recursion schemes like the monadic versions of fold and hylomorphism [Pardo 2001, Pardo 2005].
3.1. Fusion of effectful functions
Computations ordering is what makes effectful functions more difficult to be fused. In fact, the main difference with fusion of pure programs is that, when fusing two monadic functions, we must ensure the preservation of the order in which monadic computations are performed. Like in the case of purely functional programs, fusion laws for monadic programs rely on the representation of the involved functions in terms of recursion schemes and the properties those representations require to make fusion possible. For example, when the monadic versions of fold and hylomorphism [Pardo 2001, Pardo 2005] are used as representation, a strong condition to the monad, namely, commutativity, is required in order to make fusion possible. A monad is said to be commutative if the order in which computations are performed is irrelevant. The essential property is the following:
\[
\begin{align*}
\text{do} \{ a \leftarrow m; b \leftarrow m'; \text{return} (a, b) \} &= \text{do} \{ b \leftarrow m'; a \leftarrow m; \text{return} (a, b) \}.
\end{align*}
\]
Cases like the state reader (also known as the environment monad) or the identity monad are commutative, while monads like state or IO are not.
We analyze examples on lists and binary trees; the case on trees will raise the necessity of a commutativity condition for the monad.
Lists Consider the following composition of two effectful functions:
\[
\begin{align*}
\text{displaySeq} &:: \text{Show } a \Rightarrow [\text{IO } a] \rightarrow \text{IO } () \\
\text{displaySeq } ms &= \text{do} \{ xs \leftarrow \text{sequence } ms; \text{display } xs \}
\end{align*}
\]
sequence :: [IO a] → IO [a]
sequence [] = return []
sequence (m : ms) = do {x ← m; xs ← sequence ms; return (x : xs)}
display :: Show a ⇒ [a] → IO ()
display [] = return ()
display (x : xs) = do {display xs; putStrLn (show x)}
put x = do {putStrLn (show x); return x}
The `sequence` function executes a list of IO computations from left-to-right, collecting their results in a list, while `display` prints the elements of a list in reverse order. For example, when applied to the list `[put 1, put 2, put 3]`, `displaySeq` produces the string "12321" in the standard output.
A definition of `displaySeq` that avoids the generation of the intermediate list can be derived by case analysis. Two cases have to be considered:
\[
\begin{align*}
\text{displaySeq} [] & = \text{return} () \\
\text{displaySeq} (m : ms) & = \text{do} \{x ← m; \text{displaySeq} ms; \text{putStrLn} \ (\text{show} \ x)\}
\end{align*}
\]
In this case fusion succeeds because the computations are in a “suitable” order. This situation can be captured by the following shortcut fusion law, presented by Meijer and Jeuring [Meijer and Jeuring 1995], which is associated to a recursion scheme called monadic fold.
**Law 3 (mfold/mbuild for lists)**
\[
\text{do} \{a s ← \text{mbuild}_L \ g; \text{mfold}_L (\text{mnil}, \text{mcons}) \ a s\} = g (\text{mnil}, \text{mcons})
\]
where
\[
\begin{align*}
\text{mfold}_L :: & \text{Monad} \ m ⇒ (m \ b, a → b → m b) → [a] → m b \\
\text{mfold}_L (\text{mnil}, \text{mcons}) & [] = \text{mnil} \\
\text{mfold}_L (\text{mnil}, \text{mcons}) (a : as) = \text{do} \{y ← \text{mfold}_L (\text{mnil}, \text{mcons}) \ as; \text{mcons} a y\}
\end{align*}
\]
\[
\begin{align*}
\text{mbuild}_L :: & \text{Monad} \ m ⇒ (\forall \ b. \ (m \ b, a → b → m b) → m b) → m [a] \\
\text{mbuild}_L \ g & = g (\text{return} []), λa as → \text{return} (a : as)
\end{align*}
\]
By writing `sequence` and `display` in terms of `mbuild_L` and `mfold_L`, respectively, we arrive at the same recursive definition of `displaySeq` shown before.
**Trees** Now, we present a similar example on trees but that requires the monad to be commutative.
\[
\begin{align*}
data \ Tree a & = \text{Leaf} a \mid \text{Join} (\text{Tree} \ a) (\text{Tree} \ a) \\
\text{displaySeq}_T :: & \text{Show} a ⇒ \text{Tree} (\text{IO} \ a) → \text{IO} () \\
\text{displaySeq}_T \ ms & = \text{do} \{t ← \text{seq}_T \ ms; \text{display}_T \ t\}
\end{align*}
\]
\[
\begin{align*}
\text{seq}_T :: & \text{Tree} (\text{IO} \ a) → \text{IO} (\text{Tree} \ a) \\
\text{seq}_T \ (\text{Leaf} \ m) & = \text{do} \{a ← m; \text{return} \ (\text{Leaf} \ a)\}
\end{align*}
\]
The `seq_T` function executes from left-to-right the IO computations stored in the leaves of a tree, while `display_T` prints the elements that result from those computations. For example, when applied to the tree `Join (Leaf (put 1)) (Join (Leaf (put 2)) (Leaf (put 3)))`, `displaySeq_T` produces the string "123123" in the standard output.
In this case, we would like to eliminate the intermediate tree that is generated by `seq_T` and consumed by `display_T`. Like for lists, we proceed by case analysis.
However, in the case of a join node:
\[
\text{displaySeq}_T (\text{Join } m l m r) = \text{do } \{ l \leftarrow \text{seq}_T ml; r \leftarrow \text{seq}_T mr; \text{return } (\text{Join } l r) \}
\]
We get stuck at this point as it is not possible to reorder the terms in the do-expression so that to introduce a recursive call to `displaySeq_T` (a change in the order of the IO computations would produce a different output).
Taking a slightly different approach, Chitil [Chitil 2000] and Ghani and Johann [Ghani and Johann 2008] give a shortcut fusion law that permits fusion of effectful functions without requiring commutativity of the monad. The law presented in [Ghani and Johann 2008] is related with the shortcut fusion law to be introduced next.
### 3.2. Fusion with pure functions
Now we focus our attention on a restricted form of compositions involving effects. Concretely, we will consider compositions between a monadic producer `p` and the lifting of a fold: `do \{ t \leftarrow p x; \text{return } (\text{fold } h t) \}`. These are compositions where the effect is produced by the first function and only propagated by the second one. We introduce a shortcut fusion law for this kind of monadic compositions by means of specific examples.
#### Lists
Consider the following composition:
\[
\text{sumSeq} :: \text{Num } a \Rightarrow [\text{IO } a] \rightarrow \text{IO } a
\]
\[
\text{sumSeq } ms = \text{do } \{ xs \leftarrow \text{sequence } ms; \text{return } (\text{sum } xs) \}
\]
\[
\text{sum} :: \text{Num } a \Rightarrow [a] \rightarrow a
\]
\[
\text{sum } [ ] = 0
\]
\[
\text{sum } (a : as) = a + \text{sum } as
\]
For example, when applied to the list `[put 1, put 2, put 3]`, `sumSeq` returns a computation that yields 6 as result and prints the string "123" in the standard output. A recursive definition can be derived for `sumSeq`:
\[
\text{sumSeq} [] = \text{return } 0 \\
\text{sumSeq} (m : ms) = \{ x \leftarrow m; y \leftarrow \text{sumSeq} ms; \text{return } (x + y) \}
\]
In this case, we can observe that fusion simply performs the substitution of the intermediate list constructors by corresponding actions in function \text{sum}. That is, it is a substitution between purely functional objects; no effects are involved.
This transformation can be captured by a shortcut fusion law associated with fold where we have to reflect the fact that the producer may be an effectful function and that the consumer (a fold) must appear lifted.
**Law 4 (fold/mbuild for lists)**
\[
\text{do} \{ as \leftarrow \text{mbuild}_L g; \text{return } (\text{fold}_L (\text{nil}, \text{cons}) \ as) \} = g (\text{nil}, \text{cons})
\]
where
\[
\text{mbuild}_L :: \text{Monad } m \Rightarrow (\forall b . (b, a \rightarrow b) \rightarrow m b) \rightarrow m [a] \\
\text{mbuild}_L g = g ([], (:))
\]
The recursive definition of \text{sumSeq} can then be obtained by first writing \text{sum} and \text{sequence} in terms of fold and the monadic build, respectively, and then applying Law 4.
\[
\text{sum} = \text{fold}_L (0, (+)) \\
\text{sequence ms} = \text{mbuild}_L (\text{gseq ms})
\]
where
\[
\text{gseq} [] (n, c) = \text{return } n \\
\text{gseq} (m : ms) (n, c) = \text{do} \{ x \leftarrow m; y \leftarrow \text{gseq ms} (n, c); \text{return } (c \times x) \}
\]
**Parsing**
Shortcut fusion is well suited to be used in the context of monadic parsers [Hutton and Meijer 1998]. A parser usually returns an abstract syntax tree which is then consumed by another function that performs the semantic actions. Using shortcut fusion, we show how these two phases can be merged together. To illustrate this, we present a simple parser that recognizes natural numbers. We adopt the usual definition of the parser monad (see [Hutton and Meijer 1998] for more details):
\[
\text{newtype } \text{Parser } a = P (\text{String} \rightarrow [(a, \text{String})])
\]
\[
\text{instance } \text{Monad } \text{Parser} \text{ where} \\
\text{return } a = P (\lambda cs \rightarrow [(a, cs)]) \\
\text{p } \gg= f = P (\lambda cs \rightarrow \text{concat } [\text{parse } (f \ a) \ cs' \mid (a, cs') \leftarrow \text{parse } p \ cs])
\]
\[
\text{parse } :: \text{Parser } a \rightarrow \text{String} \rightarrow [(a, \text{String})] \\
\text{parse } (P \ p) = p \\
\text{pzero } :: \text{Parser } a \\
\text{pzero } = P (\lambda cs \rightarrow []) \\
\]
\[
\text{P} = (P \ p) \oplus (P q) = P (\lambda cs \rightarrow \text{case } p \ cs \oplus q \ cs \text{ of}
\]
\[
\]
item :: Parser Char
item = P (λcs → case cs of
" " → []
(c : cs) → [(c, cs)])
Alternatives are represented by a deterministic choice operator (⊕), which returns at most
one result. The parser pzero is a parser that always fails. The item parser returns the first
character in the input string.
Suppose we want to parse a string formed by digits and return a list containing their integer
conversion. For example, given the string "123" the parser returns the list [1, 2, 3].
digits :: Parser [Int]
digits = do { d ← digit; ds ← digits; return (d : ds) } ⊕ return []
digit :: Parser Int
digit = do { c ← item; if isDigit c then return (ord c − ord '0') else pzero }
isDigit c = (c ≥ '0') ∧ (c ≤ '9')
We want to test whether the number represented by the list of digits is divisible by 3, but
without computing the number itself. It is well known that a number is divisible by 3 if
the sum of its digits is also divisible by 3.
sumDigits :: Parser Int
sumDigits = do { ds ← digits; return (sum ds) }
divby3 :: Parser Bool
divby3 = do { n ← sumDigits; return (n 'mod' 3 == 0) }
Since digits can be written as a monadic build,
digits = mbuildL gdig
where gdig (nil, cons) = do { d ← digit; ds ← gdig (nil, cons); return (cons d ds) }
⊕ return nil
and sum is a fold, we can apply Law 4, obtaining the following monolithic definition:
sumDigits = do { d ← digit; y ← sumDigits; return (d + y) } ⊕ return 0
Arithmetic Expressions Let us now consider a parser for arithmetic expressions. The
parser takes a string containing an arithmetic expression and returns an abstract syntax
tree of type Exp. For example, given the string "1+2+3" the parser returns the term
Add (Num 1) (Add (Num 2) (Num 3)).
expression :: Parser Exp
expression = do { n ← number; plusop;
e ← expression; return (Add (Num n) e) }
⊕ do { n ← number; return (Num n) }
number :: Parser Int
number = do { (n, p) ← numpow10; return n }
numpow10 :: Parser (Int, Int)
numpow10 = do { d ← digit; (n, p) ← numpow10; return (d * p + n, 10 * p) }
⊕ return (0, 1)
plusop :: Parser ()
plusop = do { c ← item; if c == ‘+’ then return () else pzero }
Given an arithmetic expression, we want to evaluate it.
evalexpr :: Parser Int
evalexpr = do { e ← expression; return (eval e) }
eval :: Exp → Int
eval (Num n) = n
eval (Add e e′) = eval e + eval e′
Function evalexpr generates an intermediate expression that we would like to eliminate with fusion. The monadic shortcut fusion law in this case is the following:
**Law 5 (fold/mbuild for expressions)**
do { e ← mbuild_E g; return (fold_E (num, add) e) } = g (num, add)
where
mbuild_E :: Monad m ⇒ (∀ a . (Int → a, a → a → a) → m a) → m Exp
mbuild_E g = g (Num, Add)
Now, if we write eval and expression in terms of fold and build, respectively:
eval = fold_E (id, (+))
expression = mbuild_E gexpr
where gexpr (num, add) = do { n ← number; plusop;
e ← gexpr (num, add); return (add (num n) e) }
⊕ do { n ← number; return (num n) }
we can apply shortcut fusion (Law 5) to evalexpr, obtaining the following definition:
evalexpr = do { n ← number; plusop; z ← evalexpr; return (n + z) }
⊕ do { n ← number; return n }
4. Shortcut fusion, generically
In this section, we show that the instances of fold, build, and shortcut fusion presented in the previous sections correspond to generic definitions valid for a wide class of datatypes.
4.1. Data types
The structure of datatypes can be captured using the concept of a functor. A functor consists of a type constructor \( F \) and a function \( \text{map}_F :: (a \to b) \to (F a \to F b) \), which preserves identities and compositions: \( \text{map}_F \text{id} = \text{id} \) and \( \text{map}_F (f \circ g) = \text{map}_F f \circ \text{map}_F g \). A standard example of a functor is that formed by the list type constructor and the well-known \( \text{map} \) function.
Semantically, recursive datatypes are understood as least fixed points of functors. That is, given a datatype declaration it is possible to derive a functor \( F \) such that the datatype is the least solution to the equation \( \tau \cong F \tau \). We write \( \mu F \) to denote the type corresponding to the least solution. The isomorphism between \( \mu F \) and \( F \mu F \) is provided by two strict functions \( \text{in}_F :: F \mu F \to \mu F \) and \( \text{out}_F :: \mu F \to F \mu F \), inverses of each other. Function \( \text{in}_F \) packs the constructors of the datatype while \( \text{out}_F \) the destructors (for more details see e.g \[Abramsky and Jung 1994, Gibbons 2002\]).
For example, for the datatype of expressions we can derive a functor \( E \) such that:
\[
\begin{align*}
\text{data} & \ E a = \text{FNum} \text{Int} \mid \text{FAdd} \ a \ a \\
\text{map}_E & :: (a \to b) \to E a \to E b \\
\text{map}_E f \ (\text{FNum} \ n) & = \text{FNum} \ n \\
\text{map}_E f \ (\text{FAdd} \ a \ a') & = \text{FAdd} \ (f \ a) \ (f \ a')
\end{align*}
\]
In this case, \( \mu E = \text{Exp} \) and
\[
\begin{align*}
\text{in}_E & :: E \text{Exp} \to \text{Exp} \\
\text{in}_E (\text{FNum} \ n) & = \text{Num} \ n \\
\text{in}_E (\text{FAdd} \ e \ e') & = \text{Add} \ e \ e' \\
\text{out}_E & :: \text{Exp} \to E \text{Exp} \\
\text{out}_E (\text{Num} \ n) & = \text{FNum} \ n \\
\text{out}_E (\text{Add} \ e \ e') & = \text{FAdd} \ e \ e'
\end{align*}
\]
In the case of lists, the structure is captured by a bifunctor \( L \) (a functor on two variables) because of the presence of the type parameter. That is, \( \mu (L a) = [a] \).
\[
\begin{align*}
\text{data} & \ L a b = \text{FNil} \mid \text{FCons} \ a \ b \\
\text{map}_L & :: (a \to c) \to (b \to d) \to L a b \to L c d \\
\text{map}_L f \ g \ (\text{FNil}) & = \text{FNil} \\
\text{map}_L f \ g \ (\text{FCons} \ a \ b) & = \text{FCons} \ (f \ a) \ (g \ b)
\end{align*}
\]
4.2. Fold
Let \( F \) be a functor that captures the structure of a datatype. Given a function \( h :: F a \to a \), fold [Gibbons 2002] is defined as the least function \( \text{fold}_F \ h :: \mu F \to a \) such that:
$$fold_F \ h \circ \ in_F = h \circ F (fold_F \ h)$$
A function \( h :: F \ a \to a \) is called an \( F \)-algebra. For example, an algebra corresponding to the functor \( E \) is a function \( h :: E \ a \to a \) of the form:
\[
\begin{align*}
h (FNum \ n) &= \text{num} \ n \\
h (FAdd \ a \ a') &= \text{add} \ a \ a'
\end{align*}
\]
with \( \text{num} :: \text{Int} \to a \) and \( \text{add} :: a \to a \to a \). In the specific instance of fold for the \( \text{Exp} \) datatype we wrote an algebra \( h \) simply as a pair \((\text{num}, \text{add})\). For the list datatype we did something similar, in the fold for lists we wrote an algebra \( h :: L \ a \ b \to b \) as a pair \((\text{nil}, \text{cons})\). The same can be applied to any other inductive datatype.
An \( F \)-homomorphism between two algebras \( h :: F \ a \to a \) and \( k :: F' \ b \to b \) is a function \( f :: a \to b \) between the carriers that commutes with the operations. This is specified by the condition \( f \circ h = k \circ F f \). Notice that fold is a homomorphism between the algebras \( in_F \) and \( h \).
### 4.3. Shortcut fusion
Given a functor \( F \), we can define a corresponding build operator:
\[
\begin{align*}
\text{build}_F &:: (\forall a. (F a \to a) \to a) \to \mu F \\
\text{build}_F \ g &= g \ in_F
\end{align*}
\]
Together with \( fold \), \( build \) enjoys the following fusion law [Takano and Meijer 1995], which is an instance of a free theorem [Wadler 1989].
**Law 6 (fold/build)** For strict \( h \),
\[
fold_F \ h \ (\text{build}_F \ g) = g \ h
\]
### 4.4. Monadic shortcut fusion
The shortcut fusion law for monadic programs can be obtained as a special case of an extended form of shortcut fusion that captures the case when the intermediate data structure is generated as part of another structure given by a functor. To state that law it is necessary to introduce an extended form of build. Given a functor \( F \) (signature of a datatype) and another functor \( N \), we define:
\[
\begin{align*}
\text{build}_{F,N} &:: (\forall a. (F a \to a) \to N a) \to N \mu F \\
\text{build}_{F,N} \ g &= g \ in_F
\end{align*}
\]
When \( N \) is a monad we obtain a monadic build,
\[
\begin{align*}
\text{mbuild}_F &:: \text{Monad} \ m \Rightarrow (\forall a. (F a \to a) \to m a) \to m \mu F \\
\text{mbuild}_F \ g &= g \ in_F
\end{align*}
\]
---
\(^2\)The strictness condition on \( h \) was not mentioned in the concrete instances of the law shown in Section 2 because a function defined by pattern matching is strict. That was the case of the algebras for expressions and lists considered in those instances.
On the other hand, the standard \( \text{build}_F \) is obtained by considering the identity functor.
**Law 7 (extended fold/build)** For strict \( h \) and strictness preserving \( N \),
\[
\text{map}_N (\text{fold}_F h) (\text{build}_{F,N} g) = g h
\]
**Proof** The free theorem associated with \( g \)'s type states that, for all types \( b \) and \( b' \), algebras \( \varphi :: F b \to b \) and \( \psi :: F b' \to b' \), and strict function \( f :: b \to b' \), the following holds:
\[
f \circ \varphi = \psi \circ \text{map}_F f \Rightarrow \text{map}_N f \ (g \ \varphi) = g \ \psi.
\]
By considering \( f = \text{fold}_F h \), \( \varphi = \text{in}_F \) and \( \psi = h \), we get \( \text{map}_N (\text{fold}_F h) (g \ \text{in}_F) = g \ h \), because, again, the premise of the implication holds by definition of \( f \). Finally, we apply the definition of \( \text{build}_{F,N} \) to obtain the law. The strictness on \( h \) is necessary for instantiation: if the algebra \( h \) is strict, then so is \( \text{fold}_F h \), and we can instantiate \( f \) with \( \text{fold}_F h \). The strictness-preserving assumption on the functor means that \( \text{map}_N \) preserves strict functions, i.e., if \( f \) is strict, then so is \( \text{map}_N f \). This condition is necessary for stating the free theorem itself, and therefore it is inherited by the instantiation.
Monadic shortcut fusion is then obtained from this law by considering the functor associated with a monad \( m \) and by unfolding the corresponding \( \text{mmap} \) function:
**Law 8 (fold/mbuild)** For strict \( h \) and strictness preserving \( \text{mmap} \),
\[
\text{do} \ \{ t \leftarrow \text{mbuild}_F g; \ \text{return} \ (\text{fold}_F h \ t) \} = g \ h
\]
5. Related work
In [Pardo 2001, Pardo 2005], fusion laws for monadic versions of some recursion schemes (fold, unfold and hylomorphism) are presented. It is simple to see that so-called “acid rain laws” (a kind of fusion laws) associated with monadic folds and hylomorphisms are particular cases of monadic shortcut fusion. This is something that should not be surprising if we take into account that corresponding laws for purely functional versions of the same operators can be expressed in terms of standard shortcut fusion [Takano and Meijer 1995].
Let us consider, for example, the generic definition of monadic fold:
\[
\text{mfold}_F :: \text{Monad } m \Rightarrow (F \ a \to m \ a) \to \mu F \to m \ a
\]
\[
\text{mfold}_F \ h = h \bullet \hat{F} (\text{mfold}_F h) \circ \text{out}_F
\]
where \( (f \bullet g) \ x = \text{do} \ \{ y \leftarrow f \ x; \ g \ y \} \), for monadic functions \( f \) and \( g \), and \( \hat{F} f = \text{dist}_F \circ \text{map}_F f \), for monadic function \( f \), such that \( \text{dist}_F :: F (m \ a) \to m (F \ a) \)
distributes the functor over the monad (see e.g. [Pardo 2005]). Consider the following acid rain law associated with monadic fold: For \( \tau :: \forall \ a . \ (F \ a \to a) \to (G \ a \to m \ a) \), strict \( h \) and strictness-preserving \( \text{mmap} \),
\[
\text{do} \ \{ t' \leftarrow \text{mfold}_G (\tau \ \text{in}_F) \ t; \ \text{return} \ (\text{fold}_F h \ t') \} = \text{mfold}_G (\tau \ h) \ t
\]
If we define \( \text{gmfold} \ t \ \varphi = \text{mfold}_G (\tau \ \varphi) \ t \), then \( \text{mfold}_G (\tau \ \text{in}_F) \ t = \text{gmfold} \ t \ \text{in}_F = \text{mbuild}_F (\text{gmfold} \ t) \), and therefore the acid rain law reduces to monadic shortcut fusion.
For the acid rain law associated with monadic hylomorphism the situation is the same.
Chitil’s PhD thesis [Chitil 2000] presents a generalized shortcut fusion law for the list case that is able to fuse effectful functions. We recall that law by giving its generic definition. Let \( q :: \forall \ a . \ (F \ a \to a) \to (a \to b) \to c \) and \( h :: F \ b \to b \). Then,
\[ q \text{ in}_F (\text{fold}_F h) = q h \text{ id} \]
To see an example, consider again the function \( \text{displaySeq}_T \). If we define,
\[
q(\text{leaf}, \text{join}) = \lambda ms \rightarrow \text{do} \{ t \leftarrow \text{gseq}_T ms (\text{leaf}, \text{join}); f t \}
\]
\[
gseq_T (\text{Leaf } m) (\text{leaf}, \text{join}) = \text{do} \{ a \leftarrow m; \text{return} (\text{leaf } a) \}
\]
\[
gseq_T (\text{Join } ml mr) (\text{leaf}, \text{join}) = \text{do} \{ l \leftarrow \text{gseq}_T ml (\text{leaf}, \text{join});
\]
\[ r \leftarrow \text{gseq}_T mr (\text{leaf}, \text{join});
\]
\[ \text{return} (\text{join } l r) \}
\]
\[
\text{display}_T = \text{fold}_T (\text{putStr } \circ \text{show}, \lambda ml mr \rightarrow \text{do} \{ ml; mr \})
\]
\[
\text{fold}_T :: (a \rightarrow b, b \rightarrow b) \rightarrow \text{Tree } a \rightarrow b
\]
\[
\text{fold}_T (\text{leaf}, \text{join}) (\text{Leaf } a) = \text{leaf } a
\]
\[
\text{fold}_T (\text{leaf}, \text{join}) (\text{Join } l r) = \text{join} (\text{fold}_T (\text{leaf}, \text{join}) l) (\text{fold}_T (\text{leaf}, \text{join}) r)
\]
then,
\[
\text{displaySeq}_T ms
\]
\[
= \text{do} \{ t \leftarrow \text{seq}_T ms; \text{display}_T t \}
\]
\[
= q (\text{Leaf}, \text{Join}) (\text{display}_T t) ms
\]
\[
= q (\text{putStr } \circ \text{show}, \lambda ml mr \rightarrow \text{do} \{ ml; mr \}) \text{ id } ms
\]
\[
= \text{do} \{ m \leftarrow \text{gseq}_T (\text{putStr } \circ \text{show}, \lambda ml mr \rightarrow \text{do} \{ ml; mr \}) ms; m \}
\]
Observe that the obtained expression is formed by a function that returns a computation that yields computations as result, such that, the outer computation produces the effects of the producer \( (\text{seq}_T) \), while the inner computations produce the effects of the consumer \( (\text{display}_T) \). By inlining \( f = gseq_T (\text{putStr } \circ \text{show}, \lambda ml mr \rightarrow \text{do} \{ ml; mr \}) \) we get a clear picture of the generated computation.
\[
f (\text{Leaf } m) = \text{do} \{ a \leftarrow m; \text{return} (\text{putStr } (\text{show } a)) \}
\]
\[
f (\text{Join } ml mr) = \text{do} \{ ml' \leftarrow f ml; mr' \leftarrow f mr; \text{return} (\text{do} \{ ml'; mr' \}) \}
\]
At the same time to us, but independently, Ghani and Johann [Ghani and Johann 2008] presented a shortcut fusion law that is able to fuse compositions of effectful programs. Like our monadic shortcut fusion law, their fusion law is also based on extended shortcut fusion (Law 7). The crucial difference with ours is that they consider a fold with monadic carrier as consumer. The law is the following: For strict \( h \),
\[
\text{do} \{ t \leftarrow m\text{build}_F g; f h t \} = \text{do} \{ m \leftarrow g \text{ h; m} \}
\]
The left-hand side of the expression can be rewritten as \( \text{do} \{ t \leftarrow m\text{build}_F g; m \leftarrow \text{return} (f h t); m \} \), which by Law 8 is transformed to the right-hand side. It is interesting to see that the monadic expression obtained with this fusion law is exactly the same as the one produced by Chitil’s law. In fact, if we define \( q h f = \text{do} \{ t \leftarrow g \text{ h; f} \} \), this law reduces to Chitil’s.
6. Conclusions
This paper presented a shortcut fusion law tailored to a restricted form of compositions of programs with effects. The monadic shortcut fusion law introduced is simple, generic,
and easy to apply in practice.
We have used the rewrite rules mechanism (RULES pragma) of the Glasgow Haskell Compiler (GHC) to obtain a prototype implementation of monadic shortcut fusion. Experimental results measuring time and space improvements for a set of examples are available in the webpage http://www.fing.edu.uy/~pardo/MonadicShortcut/.
Acknowledgements We would like to thank the referees for their helpful comments and suggestions.
References
|
{"Source-Url": "http://www.lbd.dcc.ufmg.br/colecoes/sblp/2008/002.pdf", "len_cl100k_base": 10641, "olmocr-version": "0.1.53", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 54591, "total-output-tokens": 12547, "length": "2e13", "weborganizer": {"__label__adult": 0.000453948974609375, "__label__art_design": 0.0003528594970703125, "__label__crime_law": 0.0004167556762695313, "__label__education_jobs": 0.0006356239318847656, "__label__entertainment": 7.599592208862305e-05, "__label__fashion_beauty": 0.00018787384033203125, "__label__finance_business": 0.0001920461654663086, "__label__food_dining": 0.0004978179931640625, "__label__games": 0.0006194114685058594, "__label__hardware": 0.0007195472717285156, "__label__health": 0.0008001327514648438, "__label__history": 0.00026535987854003906, "__label__home_hobbies": 0.00010347366333007812, "__label__industrial": 0.0004546642303466797, "__label__literature": 0.000396728515625, "__label__politics": 0.0003659725189208984, "__label__religion": 0.0006265640258789062, "__label__science_tech": 0.0210723876953125, "__label__social_life": 0.00010573863983154296, "__label__software": 0.0034942626953125, "__label__software_dev": 0.966796875, "__label__sports_fitness": 0.0003554821014404297, "__label__transportation": 0.0005960464477539062, "__label__travel": 0.0002186298370361328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37335, 0.00781]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37335, 0.80684]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37335, 0.76833]], "google_gemma-3-12b-it_contains_pii": [[0, 3142, false], [3142, 6231, null], [6231, 8478, null], [8478, 11105, null], [11105, 13751, null], [13751, 16136, null], [16136, 18766, null], [18766, 20477, null], [20477, 21936, null], [21936, 24832, null], [24832, 27496, null], [27496, 31402, null], [31402, 34850, null], [34850, 37335, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3142, true], [3142, 6231, null], [6231, 8478, null], [8478, 11105, null], [11105, 13751, null], [13751, 16136, null], [16136, 18766, null], [18766, 20477, null], [20477, 21936, null], [21936, 24832, null], [24832, 27496, null], [27496, 31402, null], [31402, 34850, null], [34850, 37335, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37335, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37335, null]], "pdf_page_numbers": [[0, 3142, 1], [3142, 6231, 2], [6231, 8478, 3], [8478, 11105, 4], [11105, 13751, 5], [13751, 16136, 6], [16136, 18766, 7], [18766, 20477, 8], [20477, 21936, 9], [21936, 24832, 10], [24832, 27496, 11], [27496, 31402, 12], [31402, 34850, 13], [34850, 37335, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37335, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
d4a239e151b2ce01c7c716ab356a02a9e0ddb6b7
|
1 Introduction
Bitcoin’s Lightning Network\cite{1} introduced a means of solving the bitcoin scaling problem through off-chain channels which reduce the overall load on the network by reducing the total number of transactions that need to be broadcast on it. Users who know they will have many recurring payments between each other can set up channels which allow them to engage in secure, atomic payments between each other. However, concerns have been raised about the viability of the lightning network in practice, due to the need for a single user to have many channels funded in order to route their transactions to the rest of the network, thereby tying up much of users’ funds. One overarching concern among bitcoin users is that the only users who will be able to fund enough channels to route transactions will be the ones who already have most of the capital on the network, introducing a centralizing effect whereby central ‘banks’ will form who offer the service of routing many lightning transactions for fees. For the goal of bitcoin and other cryptocurrencies in enabling scalable, cheap, and near-instant worldwide transactions on a decentralized network, the high capital requirements of the lightning network limit its potential to add value for cryptocurrency users.
In this project, we developed a framework for conducting similar off-chain transactions without the need for channels. Instead, funds are put into a ‘pool’ which can be used to trade with any party with funds placed in escrow on multiple blockchains. The atomicity of these cross-currency trades is ensured by hash-timelocked contracts of the type used in Bitcoin’s Lightning\cite{1} network as well as in Ethereum’s Raiden\cite{2} network.
We found that we gain an ability to trade with multiple parties in-exchange for the added risk that our counterparties may be double-spending their inputs when they trade with us. This risk can be mitigated through the involvement of a trusted insurance agent, who, through a provably-accurate mechanism of assigning blame on the smart-contract, developed by us, can identify double-spenders and compensate wronged-parties.
2 Overview
The two main components of off-chain networks are the protocol that participants use to engage in trades and the smart-contract they use to manage funds on-chain.
In the protocol, participants trade their escrowed funds by exchanging signed IOU’s which can be posted to the contract to obtain the agreed-upon funds. Our protocol enables parties to engage in reversible and atomic IOU swaps using hash-timelocked contracts (HTLC’s) of the sort found in lightning[1], and enables them to use outputs of incoming IOU’s as inputs to outgoing IOU’s, i.e., to trade funds that they received via other trades, off-chain. This means that participants can engage in constant re-writing of their balances with other parties and act as ‘middlemen’ to allow funds to go from one escrow account to another, enabling trading at a near-unlimited rate and with the full expected functionality of a traditional cryptocurrency exchange.
The smart-contract contains logic for handling the postings of IOU’s to the network. In practice, the smart-contract may be encoded in slightly different forms on all of the blockchains the participants wish to trade on, but it will have the same functionality regardless of which programmable blockchain it is coded on. We will assume that all blockchains have Turing-complete scripting languages for smart-contracts, and so the pseudo-code given later in this paper could be translated to any such blockchain. We also assume that all properties of blockchains, such as full visibility of called functions and their arguments, apply.
Because IOU’s can be voided and can be dependent on payment received from other IOU’s, the contract contains a system of timeouts to ensure that the funds cannot be withdrawn from a user’s account until that user has had time to post all relevant IOU’s and contest the posted IOU with proof if necessary. Once the timeout on an IOU expires, it can be redeemed directly from the escrow balance of the sending account by its intended recipient. Since IOU’s can be dependent on other IOU’s, the smart contract contains logic that makes the timeouts of IOU’s which are dependent on other IOU’s dependent on those IOU’s timeouts.
Finally, because the protocol does not protect against double-spends, the contract contains logic to publicly label the perpetrators of double-spends as at-fault for those transactions, and ensure that IOU’s sent by honest parties that depend on invalid IOU’s are not executed, and that the party to blame for an IOU not being executed is publicly noted.
The contract has the property that if an IOU posted by an honest party can’t be executed, at-least one perpetrator of the failure will always always be found and labelled. This provides a sort of 'API' for 3rd parties who wish to act as 'insurance agents' for the participants of an off-chain swap agreement. If an IOU cannot be completed as-promised, the intended recipient of funds can present the insurer with evidence that they are not to blame for the failure of the payment from the smart-contract itself, along with a proof that the receiving party was unaware that the IOU was fraudulent (discussed in the ‘passing proofs’
subsection of the 'protocol' section), to request remuneration from the insurance-agent for the funds promised. The insurance agent role can be taken by a 3rd party with a reputation, or it can be codified in the form of another smart-contract. The incentives for the insurance agents to play the role could come in the form of payments or deposits from all members of the agreement, giving insurance agents the ability to keep deposits and penalize malicious parties, as well as take compensation for the risk they take on.
To conclude, we have greatly improved the speed and scalability of off-chain payments while sacrificing some of the security from double-spends, but we incorporate functionality that enables incentives for third parties to protect honest parties in off-chain agreements.
3 Shared Constructions
The following data-structures are used in both the off-chain protocol and the on-chain contract. Though they may differ in the addition or removal of one or two attributes, the equivalent version of the given off-chain/on-chain version of the struct can be produced by its recipient without any additional information.
3.1 The IOU
```python
struct IOU {
Currency uint;
Amount uint;
From address;
To address;
Hashlock uint;
Timelock uint;
Lasthash uint;
Signature uint;
}
```
An IOU is a data-structure that is passed by a participant of the protocol, along with a signature, to counterparties to whom they wish to transfer funds off-chain. IOU’s are the medium of cryptocurrency exchange in the network. An IOU is a data structure that contains all relevant information about a payment that a party in the network has agreed to. These IOU’s can be published to the blockchain in order to retrieve promised funds. They do not, however, guarantee that the funds promised have not been double-spent.
It is important to note that the IOU stored in the contract has additional attributes, but they are initialized to null values and are only used by the internal contract logic.
A description of the struct attributes is given below:
- **Currency**: uint that maps via a previously agreed-upon map to a digital asset (cryptocurrency)
- **Amount**: The total units of digital asset to be sent
- **From**: the public key of the sender
- **To**: the public key of the intended recipient of the funds
- **Hashlock**: (optional) denotes the hash-value that must be matched by a hashlock
- **Timelock**: (optional) determines when the IOU expires
- **Lasthash**: (optional) the hash of the previous incoming IOU that is being voided-out (explained later)
- **Signature**: A signature of the hash of the entire IOU contents (without the signature field) signed with the public key corresponding to the `From` field of the IOU
Also, it is important to note that the smart-contract’s internal representation of an IOU contains more fields which are only relevant in the context of the contract, so those will be introduced and explained in a later section.
### 3.2 Hash-Timelocks
A **hash-timelocked** IOU is one which will only be executed if the user calling its execution can present a value such that its hash matches the hashlock on the contract. Such an IOU can only be executed if it is posted within a time-interval defined by the IOU.
Hash-timelocks are represented as fields in the IOU struct. When an IOU does have a hash-timelock, its Hashlock and Timelock attributes are set by the creator to non-null values (in the case where they are null, the contract views the IOU as possessing no hash- or time-lock). For a hash-timelocked IOU presented to the contract to be considered valid, its recipient must post the value \( v \), such that under an agreed-upon hash function, \( \text{hash}(v) = a \), where \( a \) is the ‘Hashlock’ value of the signed struct. In addition, the current system time must be before the time given in the ‘Timelock’ field of the IOU.
Hash-Timelocks are used in a protocol similar to *lightning’s*[1] in order to ensure atomic swaps of IOU’s between parties, thereby enabling trading.
### 4 The Protocol
#### 4.1 Entering the Escrow Agreement
Before they can begin trading, participants in the pool must deposit their escrow funds into contracts on each of the blockchains they would like to trade on. The smart-contract pseudo-code is given in a later section.
4.2 Conducting Trades
4.2.1 IOUs:
In order for two participants to agree to a trade, they must engage in an atomic HTLC (hash-time-locked contract) protocol to swap IOU’s. IOU’s are exchanged in a protocol similar to lightning, in which users exchange signed, hash-time-locked revocable IOU’s. When a user sends IOU’s to a counterparty, they actually send several separate IOU’s, one for each blockchain they wish to send currency from. In addition, each IOU has the ability to nullify one or more IOU’s that were completed between the two parties before it. This provides the same functionality as lightning’s ‘Breach-Remedy Transactions’[1], which are used to secure one-way payment channels.
4.2.2 HTLC Protocol:
This protocol enables users to trustlessly trade tokens, and ensures that they can adjust their channel-balances without settling-out on the main chain.
Here we assume that it takes $\Delta$ time for a party to read an event the blockchain and post to the next block. If parties $A$ and $B$ are members of the agreement, they are trading in tokens $t_1$ and $t_2$, and they would like to trade $n_A$ of token $t_1$ to party $A$ from $B$ and $n_B$ of token $t_2$ to party $B$ from $A$, then the swap would proceed as-follows:
1. The two must agree on who will sign the first IOU. Assume that they both agree that party $A$ will sign and send the first IOU.
2. Party $A$ signs and sends sends IOU $I_A$, where:
\begin{itemize}
\item $I_A.Currency$ is set to the positive integer that maps to $t_2$
\item $I_A.Amount = n_B$
\item $I_A.From$ is set to $A$’s address on the $t_2$ blockchain
\item $I_A.To$ is set to $B$’s address on the $t_2$ blockchain
\item $I_A.Hashlock = h_A$, some hashlock for which the hash-value is known by $A$
\item $I_A.Timelock = t + 2\Delta$, where $t$ is the current time.
\item $I_A.Signature$ is $A$’s signature of the hash of the rest of $I_A$
\end{itemize}
3. Party $B$ receives $I_A$ and creates, signs, and sends $I_B$ where:
\begin{itemize}
\item $I_B.Currency$ is set to the positive integer that maps to $t_1$
\item $I_B.Amount = n_A$
\item $I_B.From$ is $B$’s address on the $t_1$ blockchain
\item $I_B.To$ is $A$’s address on the $t_1$ blockchain
\item $I_B.Hashlock = h_A$
\end{itemize}
• $I_B.Timelock = t + \Delta$
• $I_B.Signature$ is B's signature of the hash of the rest of $I_B$
At this point, the HTLC atomic swap protocol has been completed. For convenience, the two parties can now exchange 'finalized' versions of these two IOU's without the hashlocks or timelocks (starting with A sending its finalized version). Note that it wasn’t necessary to broadcast any messages to any of the main chains in order for both parties to trustlessly and securely agree to a trade.
**Example:**
If Alice wishes to trade Bob 1 NEO for 1 Ether, Alice will make an IOU with a payment of 1 NEO out to Bob with a timeout of $2*\Delta$, hash-locked with $h_A$, and send it to Bob. Bob will then create an IOU with a payment of 1 ether to Alice with a timeout of $\Delta$, also hash-locked by $h_A$. At this point, the payment may be completed in any manner the counterparties choose. Once Alice sees that the payment has been ensured, she may send a non-hash-locked and non-time-locked version of the payment to Bob and Bob could then respond with a non-hash-locked and non-time-locked version of the payment.
### 4.3 Revoking Past IOU’s
A key feature of IOU’s is that they are revocable. That is, two parties may mutually agree to render old IOU’s void at any point and create a new balance between them for any currencies included in the agreement. This is done using the Lasthash field of the IOU struct. The Lasthash field denotes the hash of the contract that has been voided by the current contract. An important feature of voiding is that it operates in a ‘zipper’ pattern, in which A’s outgoing payment to B voids the previous payment from B to A. (see figure 1) Using HTLC’s ensures security when voiding old contracts, as a later contract cannot be used to void out an earlier one if the later contract’s timelock has expired.
Contract hashes act as backpointers to the previous contract in IOU structs which enable compact ‘proofs’ that old IOU’s have been voided-out by their recipients. Since the recipient of a payment only ever sends outgoing payments to its counterparty, incoming payments always act as invalidators for previous outgoing payments. The smart-contract enables parties to use the new IOU issued by a counterparty as a means to invalidate any attempt by the counterparty to execute said payment. This means that users must store old IOUs, even after they have been overwritten.
**Example:** We use the previous example in which Alice wishes to trade Bob 1.0 NEO for 1.0 Ether. We assume that this trade has been completed and finalized. Then, Alice and Bob decide to increase their trade to 1.5 NEO for 1.5 Ether. They can void their old trade by having Alice include the hash of Bob’s 1.0 Ether payment in the Lasthash section of her payment, and Bob do the same, adding Alice’s 1.0 NEO payment to his Lasthash field.
4.4 Passing Proofs
In addition to interacting with the smart-contract and engaging in the trading protocol, participants must, for each trade they make, pass on proofs of the full source of each payment, in the form of a list of IOU’s from the source to the party they were paying. For example, if A were to pay B one token, who then went on to trade that token to C, then, when engaging in the trade with C, party B would need to send C A’s IOU to B in addition to his own IOU to C. In concrete terms, participants must send the entire list of transactions that a given asset has moved through, from its original escrow account to the account of the sender. This proof would be provided to the insurance party in the case of assigning blame, to prevent a malicious party from bankrupting the insurance agent with malicious trades. The insurance-agent may also limit the total ‘length’ of a trade, in terms of how many accounts a particular asset passes through, in order to limit risk, and so the number of IOU’s in a proof would be limited by this value.
4.5 Payment ’Sourcing’
This protocol allows users to trade funds they received in other off-chain trades with any other member of the agreement - providing significant increases in off-chain payment freedom over the lightning network and other channel-based off-chain protocols. For example, if A received 10 bitcoin off-chain in a trade with B, A could then trade those bitcoin with C for any currency they agree upon. In the version being discussed currently, however, the protocol would limit A to send from that 10 bitcoin only to C if it wished to trade them.
4.6 Timeout Structure
Once IOU’s are published to the smart-contract, they are instantly given a *timeout* by the contract, in terms of the number of *blocks* until those IOU’s can be redeemed. Once an IOU’s timeout has elapsed, its recipient can use it to pull funds directly from the sender’s escrow account on the contract, and if this payment fails, the party to blame for its failure is instantly assigned.
Once an IOU is published to the contract, it is given an initial 3 block time-out period, during which the involved parties may post various messages to the contract in order to reach a conclusion on whether the IOU should be executed, and when. The intended activities for each block after an IOU is published are given below:
**Block 0:** Party A publishes IOU I, in which party B has promised to pay some funds to A, publicly on the smart-contract
**Block 1:** The following events may occur:
1. Party B publishes the source (incoming) payment for I
2. Party B proves that A posted an old IOU, thereby nullifying it and publicly notifying the participants that party A is guilty of foul-play
3. Party B *sets* the source (by calling a function on the contract) for I to an already-posted IOU, and I is set to timeout after the payment I is dependent on expires.
**Block 2:**
Figure 4: A visual depiction of the order of events when a user interacts with the contract for the first time
1. **Party B sets** the source (by calling a function on the contract) for $I$ to an already-posted IOU, and $I$ is set to timeout after the payment $I$ is dependent on expires.
**Block 3:**
1. If the IOU wasn’t nullified and the dependent payment for the IOU has been executed, or the source for the payment was the sender’s own escrow funds (and therefore wasn’t set), the timeout on the IOU expires and $A$ attempts to pull its funds. Either the payment succeeds, or it fails and the contract determines which party is at-fault.
Once the source on a contract has been set by its creator, if the given source is a valid one, the contract sets the contract timeout to dynamically timeout one block after its source does. The timeout is defined by the formula:
$$t(I_1) = t(I_0) + 1$$
where $t$ represents the block-number on which contract $I$ will expire, and $I_0$ is the listed source of $I_1$. This way, the payer has one block to collect the required
funds for the outgoing payment before the recipient will be able to siphon them from their escrow account.
4.7 Blame Assignment
Blame can be assigned via the *smart-contract* in the case where a given payment fails (a payee has insufficient funds to complete the payment) using the following logic:
```
if payment A fails:
if A.source exists and A.source failed:
A.AtFault = A.source.AtFault
else:
A.AtFault = A.From
```
There is one other situation in which blame needs to be assigned:
If payment A has been found to be an outdated and previously nullified payment, then A.AtFault = A.From
The proof of the correctness of this blame-assignment scheme is given in the appendix.
5 The Smart-Contract
The pseudocode for the smart-contract assumes a blockchain programming language with the following features:
- A *now()* function that returns the current system time, with all validators sharing a synchronized system time
- A *GetCurrentBlock()* function that returns the block-number of the current block it is mining on.
- User addresses encoded in a *address* datatype
- *map* datastructures which map keys (in the form of unsigned-integers) to values
- A *hash* function which can be applied to any byte array and which can be called on any struct or primitive datatype
- users may send assets to the contract along-with their method-calls, accessible to the language via the *msg.value* keyword
- events, which can be watched for on the blockchain and automatically initiate behavior on behalf of the watcher when an event is created with the *emit* keyword (similar to how they are used in solidity)
The ability to verify a signature using public-key cryptography
The pseudocode itself is a modified version of Ethereum’s *solidity* smart-contract programming language.
### 5.1 Contract Structure
```solidity
Contract EscrowAgreement {
users [] address;
balances map[address]uint;
iouMap map[uint]IOU;
timeoutMap map[uint]Timeout
joinTimeout time;
tradingEnd time;
minEscrow uint;
maxPaymentLength uint;
thisCurrency uint;
}
```
The contract attributes are described here:
- **users**: a list of addresses of users who are participating in the agreement
- **iouMap**: a mapping of IOU-hashes to the IOU structs they represent
- **timeoutMap**: a mapping of IOU-hashes to their timeouts
- **joinTimeout**: a time after-which new addresses will not be able to join the agreement
- **tradingEnd**: the time after-which parties can withdraw their funds from escrow
- **minEscrow**: an unsigned-integer representing the minimum amount that must be deposited in order to participate in the agreement
- **maxPaymentLength**: an unsigned-integer encoding the maximum number of intermediates an asset may go through in a trade
- **thisCurrency**: an integer set by a pre-defined mapping that corresponds to the blockchain and asset the contract is on
### 5.2 IOU Structure
```solidity
struct IOU {
Currency uint;
Amount uint;
}
```
The contract-representation of an IOU contains the following additional attributes:
- **Source**: denotes the hash of the payment that the current payment depends on, or null if the source is the sender’s escrow account
- **Invalid**: a boolean value that denotes whether the IOU has been invalidated due to counterparty action
- **Withdrawn**: a boolean value that denotes whether the funds promised in the IOU have been moved via the smart-contract
- **AtFault**: an address responsible for payment failure, if applicable
These attributes do not need to be provided as part of the protocol and are assumed to initially be filled in by the contract as null values.
### 5.3 Timeout Structure
```plaintext
struct Timeout {
Startblock: blocknumber;
Timeout: uint;
SourceSet: bool;
Source: uint
}
```
The timeout is a datastructure that represents the timeout structure for an IOU published to the contract.
- **Startblock** is the block number of the block the IOU was published on
- **Timeout** is the number of blocks after the source times-out that this payment will time-out
- **SourceSet** is a boolean value denoting whether the IOU this timeout represents has had its source set
- **Source** is the hash of the source-contract, if applicable
5.4 Contract Publish Event
We emit the following event in the case of an IOU successfully being published to the smart-contract:
```solidity
event ContractPublish {
From address;
Amount uint;
}
```
This enables protocol-participants to watch the contract for IOU’s involving them and respond in-time allowed by the protocol.
5.5 Failure Event
We emit the following event in the case of withdraw failure during an `execute` call.
```solidity
event Failure {
Hash uint;
AtFault address;
}
```
The event tells the watcher what the contract hash of the failed contract was, and which party was at-fault. A 3rd-party insurer could use these events to watch the blockchain for failed withdrawals and determine who it needs to compensate by examining the state of the virtual-machine with regards to the smart-contract.
5.6 Invalid Contract Posted Event
```solidity
event InvalidPosted {
Hash uint;
From address;
}
```
This event is emitted in the event of a correct call of `contestIOU`.
5.7 Joining the Agreement and Posting IOUs
```solidity
func join() {
require msg.sender not in users
require msg.value > minEscrow
require now() <= joinTimeout
users.append(msg.sender)
balances[msg.sender] = msg.value
}
```
func postIOU(iou IOU, hashval uint) {
require that iou.Signature is valid and matches IOU
require iou.Currency == thisCurrency
require not iou timelock expired
if iou.Hashlock is not null {
require hash(hashval) == iou.Hashlock
}
require iou.To != iou.From
iouMap[hash(iou)] = iou
timeout = Timeout {
Startblock: currentBlock(),
Timeout: 3,
SourceSet: false,
}
timeoutMap[hash(iou)] = timeout
emit ContractPublish(iou.From, iou.Amount)
}
Joining the contract agreement involves a contract check that the user is depositing at least the minimum amount before the timeout has expired, after which the contract adds the user to its list of all users and adds an entry for it in its balances map.
Posting an IOU first requires checking that the signature passed with the IOU matches the IOU itself, and checking that the currency on the IOU matches the blockchain the contract is on. Then, if the contract has a hash-time-lock, the contract checks to see if the conditions for the hash-timelock have been met. If all checks pass, the contract is stored as-per its hash and it is given the standard 3-block timeout given to all newly-posted valid IOU’s.
5.8 Setting the Source of an IOU
func setSource(iou_hash uint, source_hash uint) {
require source_hash in iouMap
require iou_hash in iouMap
iou = iouMap[iou_hash]
require iou.From == msg.Sender
timeout = timeoutMap[iou_hash]
require not timeoutExpired(timeout)
source_iou = iouMap[source_hash]
require not source_iou.Invalid
require iou.Source is null
require iou.Amount >= source_iou.Amount
The `setSource` function is intended to be called by the *sender* of an IOU once its *recipient* has posted it to the contract. In order for an IOU to have its source set, it must not have timed-out, the source iou must have been published on the contract, and only the paying party of an IOU can set its source. In addition, the source of an IOU must be able to pay for the entire promised amount of digital asset.
### 5.9 Contesting an Invalid IOU
```go
func contestIOU(contract_hash uint, iou IOU) {
require contract_hash in iouMap
contest = iouMap[contract_hash]
require iou.Signature is valid and matches iou
require iou.From == contest.To
require hash(contest) == iou.LastHash
contest.Invalid = true
contest.AtFault = contest.To
emit InvalidPosted(contract_hash, contest.To)
}
```
The `contestIOU` function should be called by the *sender* of an already-revoked IOU once its *recipient* has posted it to the smart-contract. The contesting party should include the iou sent by the poster invalidating the old iou (which it should have saved) which includes the old iou’s hash in its LastHash field.
Once an IOU is successfully contested, it is marked as invalid and its poster is considered at-fault for any payments involving the old iou.
### 5.10 Executing an IOU
```go
func execute(iou_hash uint, hashval uint) {
require iou_hash in iouMap
iou = iouMap[iou_hash]
require not iou.Withdrawn
require msg.sender == iou.To
if iou.Hashlock is not null {
require hashlockAccepted(iou, hashval)
}
require not iou.Invalid
```
require not iou timelock expired
timeout = timeoutMap[iou_hash]
require timeoutExpired(timeout)
if iou.Source is not null {
source_iou = iouMap[iou.Source]
// we only withdraw from an iou
// if its source has been withdrawn
if not source_iou.Withdrawn {
if source_iou.Invalid {
iou.AtFault = iou.From
} else {
if source_iou.AtFault is not null {
iou.AtFault = source_iou.AtFault
} else {
iou.AtFault = iou.From
}
}
emit Failure(iou_hash, iou.AtFault)
return
}
}
if balances[iou.From] < iou.Amount {
iou.AtFault = iou.From
emit Failure(iou_hash, iou.AtFault)
} else {
balances[iou.From] -= iou.Amount
balances[iou.To] += iou.Amount
iou.Withdrawn = true
}
The `execute` function should be called by the recipient of funds under a valid and timed-out IOU. Once all requirements are met, the caller receives all funds under the IOU. The requirements are:
- The IOU must be valid
- The IOU must have timed out
- If there is a hashlock, the caller must provide the correct hash value
- If there is a timelock, the timelock must have not elapsed
- The IOU must not have been withdrawn already
- The IOU source must have been withdrawn
If the funds cannot be paid, blame-assignment functions as follows:
- If the iou has a valid source and that source-payment also failed, then the AtFault party is the same as the party who was at-fault for the source payment
- If the iou payment does not have a source, an invalid source, or its source-payment executed successfully, then the AtFault party is the payer (From attribute) of the IOU
The proof of the correctness of this blame-assignment mechanism is given in the Appendix
5.11 Entire Smart-Contract:
```solidity
Contract EscrowAgreement {
users [] address;
balances map[address]uint;
iouMap map[uint]IOU;
timeoutMap map[uint]Timeout
joinTimeout time;
tradingEnd time;
minEscrow uint;
maxPaymentLength uint;
thisCurrency uint;
struct IOU {
Currency uint;
Amount uint;
From address;
To address;
Hashlock uint;
Timelock uint;
LastHash uint;
Signature uint;
Source uint
Invalid bool;
Withdrawn bool;
AtFault address;
}
struct Timeout {
Startblock: blocknumber;
Timeout: uint;
SourceSet: bool;
}
}
```
event Failure {
Hash uint;
AtFault address;
}
event ContractPublish {
From address;
Amount uint;
}
event InvalidPosted {
Hash uint;
By address;
}
func join() {
require msg.sender not in users
require msg.value > minEscrow
require now() <= joinTimeout
users.append(msg.sender)
balances[msg.sender] = msg.value
}
func postIOU(iou IOU, hashval uint) {
require that iou.Signature is valid and matches IOU
require iou.Currency == thisCurrency
require not iou timelock expired
if iou.Hashlock is not null {
require hash(hashval) == iou.Hashlock
}
require iou.To != iou.From
iouMap[hash(iou)] = iou
timeout = Timeout {
Startblock: currentBlock(),
Timeout: 3,
SourceSet: false,
}
timeoutMap[hash(iou)] = timeout
emit ContractPublish(iou.From, iou.Amount)
}
func setSource(iou_hash uint,
source_hash uint) {
require source_hash in iouMap
require iou_hash in iouMap
iou = iouMap[iou_hash]
require iou.From == msg.Sender
timeout = timeoutMap[iou_hash]
require not timeoutExpired(timeout)
source_iou = iouMap[source_hash]
require not source_iou.Invalid
require iou.Source is null
require iou.Amount >= source_iou.Amount
iou.Source = source_hash
timeout.SourceSet = true
}
func contestIOU(contract_hash uint, iou IOU) {
require contract_hash in iouMap
contest = iouMap[contract_hash]
require iou.Signature is valid and matches iou
require iou.From == contest.To
require hash(contest) == iou.LastHash
contest.Invalid = true
contest.AtFault = contest.To
emit InvalidPosted(contract_hash, contest.To)
}
func execute(iou_hash uint, hashval uint) {
require iou_hash in iouMap
iou = iouMap[iou_hash]
require not iou.Withdrawn
require msg.sender == iou.To
if iou.Hashlock is not null {
require hashlockAccepted(iou, hashval)
}
require not iou.Invalid
require not iou timelock expired
timeout = timeoutMap[iou_hash]
require timeoutExpired(timeout)
if iou.Source is not null {
source_iou = iouMap[iou.Source]
// we only withdraw from an iou
// if its source has been withdrawn
if not source_iou.Withdrawn {
if source_iou.Invalid {
iou.AtFault = iou.From
} else {
if source_iou.AtFault is not null {
iou.AtFault = source_iou.AtFault
} else {
iou.AtFault = iou.From
}
}
emit Failure(iou_hash, iou.AtFault)
return
}
if balances[iou.From] < iou.Amount {
iou.AtFault = iou.From
emit Failure(iou_hash, iou.AtFault)
} else {
balances[iou.From] -= iou.Amount
balances[iou.To] += iou.Amount
iou.Withdrawn = true
}
}
func timeoutExpired(timeout Timeout) bool {
totblocks = 0
while timeout.SourceSet && timeout.Source != null {
totblocks += timeout.Timeout
timeout = timeoutMap[timeout.Source]
}
totblocks += timeout.Timeout
end_block = totblocks + timeout.Startblock
return end_block <= getCurrentBlock()
}
func withdraw() {
require trading period over
amount = balances[msg.sender]
balances[msg.sender] = 0
send amount to msg.sender
}
5.12 Expanding the Construction to Allow for Batching Payments
In a situation where parties are conducting trades off-chain and in which parties act as intermediaries for payments to pass through, it seems natural to allow parties to batch incoming IOU’s into one or more outgoing IOUs and to break down incoming IOU’s into smaller outgoing IOU’s. However when allowing for such transactions, the accounting process isn’t as simple, and it isn’t apparent if such a change would preserve the timeout structure and the proper detection of double-spends. In order to provide batching and splitting functionality while allowing the protocol to remain relatively simple and correct, we introduce additions to the IOU struct and contract, as well as a special kind of IOU contract transaction that is used to split up payments.
First, we add a new field to IOU’s to tell the contract whether or not the given IOU is a ’batched’ payment. So, the modified (contract version) IOU would be defined as follows:
\[
\text{struct IOU} \{ \\
\quad \text{Currency uint;} \\
\quad \text{Amount uint;} \\
\quad \text{From address;} \\
\quad \text{To address;} \\
\quad \text{Hashlock uint;} \\
\quad \text{Timelock uint;} \\
\quad \text{LastHash uint;} \\
\quad \text{Source [] uint} \\
\quad \text{Signature} \\
\quad \text{Invalid bool;} \\
\quad \text{Withdrawn bool;} \\
\quad \text{AtFault [] address;} \\
\quad \text{Batched bool;} \\
\}
\]
- **Source** is now a list of IOU hashes which the given IOU has as source
- **AtFault** is now a list of at-fault addresses for the failure of a given payment
- **Batched** tells the contract whether the IOU has been formed by combining more than one IOU
In order to batch payments, we add a method to the contract which creates one or more unique type of IOU’s that represent a transaction from a user to themselves. The sources for these IOUs are incoming IOUs which are being combined, and the To and From values are both the address of the user who wishes to combine or break-up funds.
We make the same modification to the Timeout struct:
5.12.1 Creating Batched IOU’s
In order to create batched IOU’s, users call the following contract method
```solidity
func combineAndCreate(inputs []IOU, hashvals []uint, outputs []IOU) {
tot_in = 0
for each input in inputs {
require that input.proof is valid
require input.To == msg.Sender
require input.currency == this.currency
require not input.Timelock expired
require input.Hashlock matches hashval if not null
tot_in += input.Amount
}
tot_out = 0
for each output in outputs {
require output.currency == this.currency
require output.To == msg.Sender
require output.From == msg.Sender
tot_out += output.Amount
}
require tot_in >= tot_out
for each input in inputs {
if hash(input) not in iouMap {
iouMap[hash(input)] = input
} else {
input_iou = iouMap[hash(input)]
require not input_iou.Withdrawn
}
}
for each output in outputs {
output.Source = inputs
timeoutMap[hash(output)] = Timeout {
Startblock: currentBlock(),
Timeout: 1,
}
}
}
```
The contract first checks that the input IOU’s and output IOU’s are valid and that the sum of the outputs does not exceed that of the inputs. If these requirements are met, the input IOU’s are added to the contract. Then, special output IOU’s are created that have these input IOU’s as their source, and the user calling the function as both their sender and receiver. The calling user may then use these output IOU’s as payment-sources for other IOU’s.
In terms of the timeout structure described in section 4.6, if a user wishes to combine IOUs to use as a source for another payment, they may call the combineAndCreate function on the contract in the first block after an IOU has been posted rather than the postIOU function, and the result will be that they have an IOU on the contract that they can set as the source for an outgoing payment in the next block. So this functionality does not change the timeout structure of the protocol.
We also modify the logic of the timeoutExpired function as follows:
```go
func timeoutExpired(timeout Timeout) bool {
end_block = getEndBlock(timeout)
return end_block <= getCurrentBlock()
}
func getEndBlock(timeout Timeout) uint {
if timeout.Batched {
var timeouts []uint
for source in timeout.Source {
batch_timeout = timeoutMap[source]
timeouts.append(getEndBlock(batch_timeout))
}
last_timeout = max(timeouts)
return last_timeout + timeout.Timeout
}
if timeout.SourceSet && timeout.Source != null {
source = timeoutMap[timeout.Source[0]]
return getEndBlock(source) + timeout.Timeout
}
return timeout.Startblock + timeout.Timeout
}
```
As we trace back through the source-payments, we must now account for the existence of intermediary ‘batched’ payments. When a batched payment is
reached, the timeout value used by the contract is the one that is last out of all of its source payments.
Batched payments also change the logic of blame assignment slightly, as if a batched payment is the source of a payment, and more than one of its incoming payments failed, then all of those payments that failed would be considered at-fault for the payment which the batched payment was the source of.
This also means that, after submitting a batched payment to themselves, a party must call the `execute` function on that payment when the timeouts on all of its sources expire, so that if the batched payment fails, blame can be assigned and used for payments that use it as a source.
We modify the logic of blame-assignment in the `execute` function in the following ways:
```go
func execute(iou_hash uint, hashval uint) {
iou = iouMap[iou_hash]
require not iou.Withdrawn
require msg.sender == iou.To
require hashlockAccepted(iou, hashval)
require not iou.Invalid
require not iou.timelock.expired
timeout = timeoutMap[iou_hash]
require timeoutExpired(timeout)
if iou.Batched {
var at_fault []address
for source in iou.Source {
source_iou = iouMap[source]
if not source_iou.Withdrawn {
if source_iou.Invalid {
at_fault.append(source_iou.From)
} else {
if source_iou.AtFault is not null {
at_fault.append(source_iou.AtFault)
} else {
at_fault.append(source_iou.To)
}
}
} else {
}
}
if len(at_fault) > 0 {
iou.Withdrawn = false
iou.AtFault = at_fault
emit Failure(iou_hash, iou.AtFault)
}
}
return
```
In the case where a batched payment is being executed, the contract first checks to see that all of its source-payments succeeded. If any of them failed, the contract adds all of the failed payments to the batched payment’s AtFault field and marks it as incomplete. In the case where the source iou wasn’t withdrawn but it doesn’t have an at-fault value, and so execute was never called, then the user batching the payments is at-fault for never calling execute.
If the batched payment has all successful source payments, then the contract checks that the funds in the users account match the amount being bundled. If they do, the payment is marked successful (no funds need actually be trans-
ferred, as they are already in that user’s escrow balance). If they do not, then the user has double-spent at-least one of those source payments and thus is at-fault for the batched payment.
6 Appendix
6.1 Proof of Correctness of Blame-Assignment
The blame-assignment logic of the smart-contract is reproduced here:
```java
if iou.Source is not null {
source_iou = iouMap[iou.Source]
// we only withdraw from an iou
// if its source has been withdrawn
if not source_iou.Withdrawn {
if source_iou.Invalid {
iou.AtFault = iou.From
} else {
if source_iou.AtFault is not null {
iou.AtFault = source_iou.AtFault
} else {
iou.AtFault = iou.From
}
}
}
}
if balances[iou.From] < iou.Amount {
iou.AtFault = iou.From
} else {
balances[iou.From] -= iou.Amount
balances[iou.To] += iou.Amount
iou.Withdrawn = true
}
```
Once the timeout on an IOU has expired, the user may call the withdraw function and attempt to pull funds from the payee’s escrow-balance.
For the rest of the section we assume that the currency is fixed, as IOUs on different blockchains do not affect one another, and so if we prove correctness for an arbitrary blockchain, we’ve proved correctness for the entire protocol.
6.1.1 Protocol Model
Assume that at a given instant $t$, a party $P$ has
- an escrow account on the smart-contract with $e_P$ units of the given asset
• \( n \) incoming IOU’s, labeled \( I_1, \ldots, I_n \), where each \( I_k \) has not been revoked by any subsequent IOU.
• \( n_o \) outgoing IOU’s, labeled \( O_1, \ldots, O_{n_o} \), where each \( O_k \) has not been revoked by any subsequent IOU.
We assume that these IOU’s will eventually be published to the contract and executed in an order that depends on the contract logic and the user’s behavior. That is, they will be executed in the order \( H_1, H_2, \ldots, H_{n+n_o} \), where each \( H_k \) refers to a unique incoming or outgoing IOU.
**Definition 6.1.1.** An IOU \( H_k \) from party \( A \) fails if the contract executes \( A \)’s incoming and outgoing payments in the order \( H_1, \ldots, H_k \) and (here we will use \( H_k \) as shorthand for \( H_k.\text{Amount} \))
\[
e_A + \sum_{i=1}^{l_k-1} 1\{H_i \text{ is incoming and doesn’t fail}\} \cdot H_i - \\
\sum_{i=1}^{l_k-1} 1\{H_i \text{ is outgoing and doesn’t fail}\} \cdot H_i - H_k < 0. \tag{1}
\]
**Lemma 6.1.1.** If an IOU fails according to this definition, it fails in the contract (a Failed event is generated).
**Proof.** In the situation where equation (1) holds, then either the check in the execute function that determines if the escrow account has sufficient balance fails, and so a Failed event is generated and no funds are transferred, or a Failed event is generated prior to that. \( \square \)
**Definition 6.1.2.** An IOU \( I_1 \) is directly-responsible for the failure of payment \( I_2 \) if \( I_1 \) was attempted to be executed before \( I_2 \), \( I_1 \) failed, and if \( I_1 \) had not failed, then \( I_2 \) would not have failed.
**Definition 6.1.3.** A party \( P \) behaves honestly if
1. \( e_P + \sum_{I_i \text{ is incoming}} I_i - \sum_{I_o \text{ is outgoing}} I_o > 0 \) at any time \( t \), where all are un-executed, un-revoked payments
2. \( P \) follows the protocol outlined in section 4
**Theorem 6.1.1.** Honest parties will not be identified as at-fault by the blame-assignment logic of the smart-contract
**Proof.** Assume an outgoing IOU from \( A, I_A \), fails, and that \( A \) is an honest party. Also assume incoming and outgoing IOU’s for \( A \) are attempted to be executed (from the start of trading) in the order \( I_1, I_2, \ldots, I_A \)
Assume \( I_A \) fails. Let all of the outgoing IOU’s successfully executed before \( I_A \) be \( I_{o_1}, \ldots, I_{o_k} \). We can divide these into two groups, \( \{I_{o_1}\} \) and \( \{I_{o_2}\} \), where the first consists of payments with a source set and the second consisting of
Lemma 6.1.2. If a party could be considered at-fault for the failure of a single payment.
Definition 6.1.4. A party payments without a source set, therefore coming from the escrow account of A. Because A follows the part of the protocol outlined in section 4.6, \( \forall I_o, \exists I_i \) where \( I_i \) is incoming, \( I_i > I_o \), and \( I_i \) is set by A as the source for \( I_o \). Let \( l \) be the leftover value when taking \( \sum I_j - I_o \). By equation (1) we have \( l + e_A - \sum I_o - I_A < 0 \rightarrow I_A + \sum I_o > e_A + l \). If \( I_A \) were an escrow payment, then A would’ve spent more from escrow than it was able. However, A is honest, so it must be the case that \( I_A \) had a source-payment. Also given that A is honest, it didn’t double-spend the source-payment to \( I_A \). However, if the source of \( I_A \) succeeded, \( I_A \) would be cancelled by \( l \) and we’d get \( \sum I_o > e_A + \epsilon \) where \( \epsilon > 0 \) and \( \sum I_o < e_A \), a contradiction.
So, the source-payment for \( I_A \) must have failed. If the source-payment for \( I_A \) failed, then by the contract logic, some party other than A would’ve been at-fault for its failure (as long as the source wasn’t a payment from A to itself, which is not allowed).
As-per the contract, when \( I_{ta} \) was executed and failed, its at-fault value must have been set to some address not belonging to A, so A would not be considered at-fault. An honest party couldn’t be considered at-fault for its own outgoing payment. Therefore, it couldn’t be considered at-fault for any payment. \( \square \)
**Definition 6.1.4.** A party P is at-fault for payment I if \( \exists I_P \) such that \( I_P.From = P.Address \) and \( \exists I_1, ..., I_n \) published IOU’s that all failed, \( I_P \) is directly-responsible for \( I_1 \), \( I_1 \) is directly-responsible for \( I_2 \), and so on, \( I_P \) is directly-responsible for \( I \), and there is no published \( I_0 \) such that \( I_0 \) is directly-responsible for \( I_P \).
We see here that the definition of at-fault leaves some ambiguity. Multiple parties could be considered at-fault for the failure of a single payment.
**Lemma 6.1.2.** If a party P is at-fault for payment I according to the definition, and all other members of the agreement were honest, then P will be labeled at-fault for payment I.
**Proof.** If \( I_P \) is directly responsible for \( I_1 \)’s failure, then it must be the case that \( I_P \) was set as the source of \( I_1 \). This is because of equation (1) along with the fact that the creator of \( I_1 \) followed the protocol. Assume the string of payments attempted to be executed involving \( I_1.From \) leading up to \( I_1 \) was \( H_1, ..., H_k \). We know that for each sourced outgoing payment in \( \{ H_i \} \) there is an equivalently-valued incoming payment, so we can reduce equation (1) to \( l + e_A - \sum N_i - I_1 < 0 \), where \( N_i \) are all escrow payments. \( I_1 + \sum N_i > e_A + l \) so \( I_1 \) couldn’t have been an escrow-payment. Since the only source that could have failed was \( I_P \) (every other member followed the protocol), it must be the case that \( I_P \) was set as the source for \( I_1 \), and since no payment was directly responsible for \( I_P \)'s failure, it must be the case that \( I_P \)'s source was either successful or didn’t exist, and so the contract would label P as at-fault for \( I_P \) and therefore for \( I_1 \).
If \( I_P \) is at-fault for \( I_k \), and \( I_k \) is directly-responsible for \( I_{k+1} \), then with similar logic we see that \( I_k \) must have been the source for \( I_{k+1} \). \( l + e_{k+1} - \sum N_i - I_{k+1} > 0 \), \( I_{k+1} \) must have been sourced, and \( I_k \) is the only candidate for \( I_{k+1} \)'s source, and so \( P \) is labeled at-fault for \( I_{k+1} \).
We’ve shown that \( P \) will be labeled \textit{at-fault} for payment \( I \) under the given conditions.
6.2 Correctness of At-Fault assignment under Bundled payments
With bundled payments, the notion of blame must change slightly to accommodate philosophical questions regarding fault assignment. If payments \( P_1 \) and \( P_2 \) are bundled payments that pay out \( P_3, P_4, \) and \( P_5 \), and \( P_1 \) and \( P_2 \) both fail, then which of \( P_1 \) and \( P_2 \) should be considered at-fault for the failure of payments \( P_3, P_4, \) and \( P_5 \)? Our solution is to name \( P_1 \) and \( P_2 \) both responsible for the failure of all three, and this motivates the modified definition of \textit{at-fault} when bundled payments are involved.
\textbf{Definition 6.2.1.} An IOU \( I_1 \) is partially-responsible for the failure of payment \( I_2 \) if \( I_1 \) was executed before \( I_2 \), and \( I_1 \) failed, and there is a set of payments \( I_1 \in \{I_k\} \) which had they not failed, then \( I_2 \) would not have failed.
We modify the at-fault definition in the bundled-payments model:
\textbf{Definition 6.2.2.} A party \( P \) is at-fault for payment \( I \) if \( \exists I_P \) such that \( I_P.\text{From} = P.\text{Address} \) and \( \exists I_1, ..., I_n \) published IOU’s that all failed, \( I_P \) is partially-responsible for \( I_1 \), \( I_1 \) is partially-responsible for \( I_2 \), and so on, \( I_P \) is partially-responsible for \( I \), and there is no published \( I_0 \) such that \( I_0 \) is partially-responsible for \( I_P \).
The proof of the correctness of modified at-fault assignment is essentially the same as the proof of correctness of the original algorithm, however slightly more machinery is required to consolidate the difference between the two algorithms.
\textbf{Theorem 6.2.1.} \textit{Honest parties will not be identified as at-fault by the blame-assignment logic of the smart-contract
Proof. Assume an outgoing IOU from \( A \), \( I_A \), fails, and that \( A \) is an honest party. Also assume incoming and outgoing IOU’s for \( A \) are executed (from the start of trading) in the order \( I_1, I_2, ..., I_A \)
Assume \( I_A \) fails. Let all of the outgoing IOU’s executed before \( I_A \) be \( I_{o_1}, ..., I_{o_m} \). In the case where the source of \( I_A \) is not batched, the proof is the same. If \( I_A \)’s source is batched, then because \( A \) follows the part of the protocol outlined in section 5.9, there are payments \( I_1, ..., I_n \) set as the source of \( I_A \) by \( A \). The sum of the values of those sources is at least that of \( I_A \), so the sum in the previous proof remains positive. That means that if \( I_A \) fails, one of those payments must have been attempted to be executed and failed, and so the at-fault for \( I_A \) is not \( A \).
So, an honest party \( A \) couldn’t be considered at-fault for an outgoing payment. Therefore, it couldn’t be considered at-fault for \textit{any} outgoing payment.
Due to the weaker notions of partial-responsibility, we are unable prove the equivalent of lemma 6.1.2 in this case.
6.3 Safety and Correctness of the HTLC Protocol
The HTLC protocol is nearly identical to lightning’s[1], and a proof of its correctness can be found in the lightning whitepaper.
References
|
{"Source-Url": "https://cs.brown.edu/research/pubs/theses/masters/2018/sharma.abhishek.pdf", "len_cl100k_base": 12914, "olmocr-version": "0.1.53", "pdf-total-pages": 30, "total-fallback-pages": 0, "total-input-tokens": 71356, "total-output-tokens": 14602, "length": "2e13", "weborganizer": {"__label__adult": 0.0008573532104492188, "__label__art_design": 0.0007786750793457031, "__label__crime_law": 0.0014705657958984375, "__label__education_jobs": 0.0015459060668945312, "__label__entertainment": 0.0002837181091308594, "__label__fashion_beauty": 0.0003802776336669922, "__label__finance_business": 0.04534912109375, "__label__food_dining": 0.0009007453918457032, "__label__games": 0.0025310516357421875, "__label__hardware": 0.005519866943359375, "__label__health": 0.0013332366943359375, "__label__history": 0.000904083251953125, "__label__home_hobbies": 0.0003995895385742187, "__label__industrial": 0.0019283294677734375, "__label__literature": 0.0006031990051269531, "__label__politics": 0.00142669677734375, "__label__religion": 0.0008492469787597656, "__label__science_tech": 0.4462890625, "__label__social_life": 0.00020825862884521484, "__label__software": 0.029327392578125, "__label__software_dev": 0.453369140625, "__label__sports_fitness": 0.0005936622619628906, "__label__transportation": 0.0024566650390625, "__label__travel": 0.0005221366882324219}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 52426, 0.00735]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 52426, 0.39582]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 52426, 0.90237]], "google_gemma-3-12b-it_contains_pii": [[0, 2155, false], [2155, 5337, null], [5337, 7526, null], [7526, 9693, null], [9693, 11988, null], [11988, 14846, null], [14846, 15904, null], [15904, 17767, null], [17767, 18841, null], [18841, 20480, null], [20480, 21832, null], [21832, 23101, null], [23101, 24363, null], [24363, 26024, null], [26024, 27623, null], [27623, 28913, null], [28913, 30103, null], [30103, 31007, null], [31007, 32416, null], [32416, 33317, null], [33317, 35396, null], [35396, 36574, null], [36574, 38414, null], [38414, 40269, null], [40269, 40964, null], [40964, 42447, null], [42447, 45029, null], [45029, 48924, null], [48924, 52077, null], [52077, 52426, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2155, true], [2155, 5337, null], [5337, 7526, null], [7526, 9693, null], [9693, 11988, null], [11988, 14846, null], [14846, 15904, null], [15904, 17767, null], [17767, 18841, null], [18841, 20480, null], [20480, 21832, null], [21832, 23101, null], [23101, 24363, null], [24363, 26024, null], [26024, 27623, null], [27623, 28913, null], [28913, 30103, null], [30103, 31007, null], [31007, 32416, null], [32416, 33317, null], [33317, 35396, null], [35396, 36574, null], [36574, 38414, null], [38414, 40269, null], [40269, 40964, null], [40964, 42447, null], [42447, 45029, null], [45029, 48924, null], [48924, 52077, null], [52077, 52426, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 52426, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 52426, null]], "pdf_page_numbers": [[0, 2155, 1], [2155, 5337, 2], [5337, 7526, 3], [7526, 9693, 4], [9693, 11988, 5], [11988, 14846, 6], [14846, 15904, 7], [15904, 17767, 8], [17767, 18841, 9], [18841, 20480, 10], [20480, 21832, 11], [21832, 23101, 12], [23101, 24363, 13], [24363, 26024, 14], [26024, 27623, 15], [27623, 28913, 16], [28913, 30103, 17], [30103, 31007, 18], [31007, 32416, 19], [32416, 33317, 20], [33317, 35396, 21], [35396, 36574, 22], [36574, 38414, 23], [38414, 40269, 24], [40269, 40964, 25], [40964, 42447, 26], [42447, 45029, 27], [45029, 48924, 28], [48924, 52077, 29], [52077, 52426, 30]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 52426, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
f0243dcbbe4d16ad723d5c72d77078c6dc529d83
|
AN IMPROVED WEB SERVICE DISCOVERY FRAMEWORK BASED ON SIMILARITY MEASUREMENT AND QOS RANKING
R. Jeberson Retna Raj, Dr. T. Sasipraba
1Research Scholar, Sathyabama University, Chennai, India
2Professor & Dean, Sathyabama University, Chennai, India,
Email: 1jebersonin@yahoo.co.in
ABSTRACT
Reducing the irrelevant web services and not missing the most relevant web services are the two complimentary issues in web service discovery process. Due to the lack of support from Universal Business Registries (UBR) for complex queries, web service search engine has been introduced to discover the pertinent web services. Traditionally, web services can be discovered by keywords. Since the keywords are unable to bear the underlying semantics of the search query, operation based discovery has been introduced. Furthermore, clients search interest often changed, we propose a model to discover similar web services based on QoS requirements. To achieve this, find the degree of the functional component that matches with the search query can be computed, and its respective QoS attributes that can be normalized by the proposed algorithm. These two factors can be aggregated to provide overall score value for the web service. For a search request, the list of candidate services will be provided to the client based on the degree of closeness with the search query. The system has been tested with the real and synthetic data, and the test result shows very favorable results.
Key words: web services, QoS attributes, Normalization, web service discovery.
I. INTRODUCTION
Proliferation of web services paves a way for many service providers implement their business services using web services. Omnipresent of the internet and technology provides incentive to the service providers to create, locate and access required web services regardless of platform. Since the web service becomes the realization of Service Oriented Architecture (SOA), developers relying on this technology for its support on reusability and interoperability [1]. Due to the increasing number of web services in the internet for similar functionality, identifying the pertinent web service to the client’s requirement is a challenging research problem in services computing paradigm [2]. Due to the vigorous proliferation of web services, locating the desired web service for a given request has become a very valuable task [3]. Due to the availability of a large number of web service providers, it is often the case that a large number of services are available for a given request. The selected service must incorporate all the requested operation. Reducing irrelevant services and not missing the most relevant services are the two complementary issues about the selection process. Current research shows most of the services implemented by .NET web service. For a request, more than hundred service providers readily available in the internet to satisfy the request. Due to the failure of the public registries, search engines are the alternate tool to discover web services. Generally, web services can be searched by keywords [4]. If the searched query does not contain in the part of web service name exactly, then the service may not be retrieved. [5] Furthermore, the user not able to specify their search request more precisely rather than by keywords [6]. Traditional web search engines devoted to website and not for web services as they are unable to articulate the search query well [10]. As the semantics of website and web service are differs, we argue that a dedicated web service search engine to discover the pertinent web service. Furthermore, a client want to search a web service, current systems are unable to deliver the requested task accurately. So we advocate that the system assist the user to discover web services based on QoS requirements. Our contribution is in two fold, first to store all published web services in the service pool. Extract the metadata such as service, portType, message, operation elements. Compute the quality of web services for response time, throughput, availability and reliability using the metrics. Secondly, compute the functional and non functional evaluation by the proposed algorithm. Aggregating the functional and non
functional values to provide the rank value so that the client can get the web service based on QoS requirements. The gist of this approach is the consumer can specify the search request as input operation and its expected output operation. Furthermore, the client can specify the required QoS attributes. Based on the request, a list of candidate services which are matched with the request will be provided to the client for setting weights over the QoS attributes. Since this search is based on input and output operations, the unwanted services will be filtered from the list. So how wisely select the appropriate web services for the benefit of the customer is a key issue to the selection process.
The paper is organized as follows. The brief introduction of web service discovery and the related work done in the proposed technique is discussed in section II. Section III describes the proposed QoS driven web service discovery and ranking process for efficient web service selection. Section IV discusses with the experimental results of a search query based on keyword search as well as operation based search. Finally, section V end with conclusion.
II. WEB SERVICE DISCOVERY
Locating the desired web service is an important research issue in services computing paradigm. Due to the advent of the internet and proliferation of web services which makes internet as a huge resource library for a client to locate, select and compose business applications. Furthermore, competition among web services is ready to satisfy a client request. A business process consists of participating an individual or group of web services to execute a task. Service discovery is an integral part of semantic web services. Since traditional methods don’t support the Quality of search, the need of the hour is a system which assists the user to select the pertinent web service for a client request. Selection of web service becomes challenge when the composition of the web services is to be done automatically.
A. Limitation of UDDI and search engines
Universal Business Registry (UBR) terminates their registry operations from early 2006 for public use. Due to the failure of the UDDI, the clients are forced to use an alternate search method such as search engines and crawlers etc. During the discovery process in UDDI, a client may experience several setbacks. Most of the UDDI are seldom updated and significant parts of information in these registries are out of date [18]. Due to the lack of semantics descriptions of web services, the results returned by the registries are effectively inadequate. Universal Business Registries (UBR) such as Microsoft, SAP, IBM are close their registry operations for public use. The reason behind their shut down is cited as the goal is achieved. The entries of the web services are scaled up day by day basis so that duplication of entries may inevitable. Generally, UDDI is based on keywords [4]. The consumer has to do view-select-request queries several times. These enormous hardships may hindrance the consumer to locate the desired web service [5]. Moreover, once the desired web service is not available in the internet, the search process again restarted. Recent survey shows more than 53% of the UBR registered services are invalid. This kind of procedure leads to less usage of UDDI and relying on web service pool. Searching web services using search engines is also based on keyword which is inherently impractical for discovery process. Search engines do not understand the web service functionality outlined in the description file [16].
The idea behind the keyword based search is that the keyword involved in the query which matches them with web service description. Since the keyword based searching unable to match the underlying semantics of web service, they may miss the relevant results and returns irrelevant one to the client. User unable describes the search request more precisely than keyword is another limitation of keyword search. Furthermore, keywords do not suffice for accurately specifying user’s information needs. Web services are developed and maintained by their provider. Suppose the service is modified or no longer available, the service consumer have to repeat the discovery process.
B. Operation Based Search
A web service is a reusable software component interacts over systems in a heterogeneous environment. Web services can be discovered, located and invoked across the internet. A web service consists of interface description and implementation description used to expose the service functionality. Interface description containing the type and definition elements and implementation definition containing port type, binding and service elements. A web service consists of several operations. Each operation deals with individual task assign to them for execution. The
operation contains an asset of parameters. These parameters are structured in a hierarchy by using complex types. The operation based search is to provide the search result more accurately than the keyword based search. Since the web service operation is going to be as part of the application, the user would like to prefer operation based search than the keyword based search.
C. Web service discovery classification
Current discovery approaches can be classified into two categories namely syntactic discovery and semantic discovery. Syntactic discovery incorporates the techniques such as UDDI based search, text document based search, schema matching and software component matching. Semantic-based discovery is mainly based on ontology. Generally, UDDI is based on keyword search. Seldom updating of the service providers information and simultaneous access will not be encouraged are the serious limitation of UDDI based search. Typically, text document search is widely used in search engines and web pages [6]. This is also based on keywords. Search engines are unable to articulate and bear the underlying semantics of the searched query so that search engines are inherently impractical for web service discovery. The functionality of schema matching is based on to capture clues about the semantics of schema and suggests matches based on them [7][8]. Operations are typically much more loosely related to each other than are tables in a schema and each web service in isolation has much less information than a schema. Finally, software component matching defines the problem of examining signature (data type) and specification (behavior) matching [9]. It is mainly for software reuse. For Semantic discovery, Ontology based discovery is one of the approach for discovering web services [5]. The ontology based discovery approach suffers from performance problems due to the use of ontology reasoners. Furthermore, constructing ontology as a semantic backbone for a large number of distributed web service is really not easy. These are the major setback for ontology based discovery. All the aforementioned approaches don't deal with QoS based operation search. Thus the proposed QoS based web service discovery stress the need of searching a web service based on QoS based input/output operation.
D. Overview of the proposed Service Discovery
Proliferation of web services is expected to introduce competition among large number of web services that offer similar functionality. Selecting highly configurable web services in terms of performance is of paramount important for web service selection. Since the keyword search unable to provide the accurate search result for a client request, operation based search has been introduced. In this approach, the single similar and composite operation which incorporates with the QoS requirements can be searched. The idea is to retrieve the metadata of input/output operation from a WSDL and apply a mining algorithm used to measure the co-occurrence of terms and cluster the terms into a set of concepts, and leverage these concepts to determine the similarity of inputs/outputs operations.
Assume all the web services are published. The web service crawler collect the list of web services from the internet and stored in the service pool. The WSDL parser extracts the metadata from the WSDL such as service name, operation name, input, output type, message and it can be can be stored in the service pool. QoS attributes of a web service is normalized by the proposed algorithm and the appropriate match score value is stored in the service pool. Whenever a request has been performed, QoS consultant selects a list of pertinent candidate web services that are matched with the input/output operation will be provided to the client.
E. Related Work
QoS based web service discovery is an important solution for filtering and selecting between functionally equivalent web services stored in registries or other repositories. Unfortunately, Functional discovery of web service is not adequate and may circumvent the client interest, as there may be hundreds of equivalent web services. Users further must be assisted in selecting the appropriate web service for their needs. Recently, several works has been done in QoS based web service discovery. Xin Dong Et al., proposed “Similarity Search for Web Services approach for web services discovery” [24] for searching web services. They construct a search engine named as woogle used to search similar services. The clustering module used to group the similar web service operation and generate a meaningful concept. However, the work is not supported the QoS based search for a user request.
Xuanzhe Liu [6] proposed a model for homogeneous web service discovery. The search model is based on input/output operation. Web service operations are extracted from WSDL file and stored in the service pool. The Single similar and composite operations are grouped based on terms and leverage these terms into concepts by the clustering algorithm. The Composite operations can be grouped by agglomeration graph algorithm. Furthermore, the service provider changes of web service contents can be updated by atom feed.
In [17], a web service search engine WSExpress has been introduced. The functional value and the non functional values are aggregated to get the overall score value used to index the web services for a search query. Authors in [23] proposed URBE(Uddi Registry By Example) for web service retrieval model. The model is based on bipartite graph clustering the related services for retrieval process. However, the model doesn’t incorporate with the client QoS requirements.
III. PROPOSED QUALITY DRIVEN WEB SERVICE DISCOVERY
QoS deals with a set of nonfunctional properties of a web service that encompasses performance characteristics. As the user more concern about the performance of web service they use, QoS can be used to discriminate functionally similar web services. Discovering a web service according to the client requirement is a complex task as many services are available to satisfy a request. Search a service using keyword which circumvents the user to get an appropriate web service instead of offering a less specific one. Moreover, irrelevant information may be provided to the client which leads to take a vague decision as which one will be the most suitable one. To alleviate these difficulties, QoS driven web service discovery has been introduced. The gist of this approach is to provide the required web service based on users QoS requirements. Figure 1. Shows the architecture of QoS based web service discovery process.
The QoS driven web service discovery model is to search a web service according to the client requirement. The proposed system assists the client to search web services based on input/output operations. The web services of single similar and composite operations can be searched based on user’s QoS requirements. The system allows the user to specify the input operation and the output operation incorporate with the QoS requirements. The functional details are used to identify the operations and the QoS requirements will be normalized to calculate the merit of non functional requirements. Matching algorithm used to match the client request with the available services.

Fig. 1. Proposed QoS driven web service discovery architecture
The architecture of the proposed QoS driven web service discovery has been shown in Figure 1. The web services descriptions are searched by a crawler and stored the WSDL in the database. The QoS handler stores all the QoS attribute values and using the normalization algorithm to normalize the values and store it in service pool. The WSDL parser extracts the Meta data from a WSDL file and stores it in service pool. The cluster agent cluster the terms and generate the concept which will be stored in a service pool. The feed manager used to index the web services. Whenever a client performs a search via user interface, the consultant selects the pertinent web services to the client’s QoS requirements. The Service pool manager consists of all discovery components including similarity
cluster. The proposed architecture consists of web service Meta data extraction and clustering module which extracts the input/output operation from WSDL file and store these Meta data into the service pool. The extracting features from WSDL documents will be done in offline process. The QWS Dataset [21][22] consist of 2507 web services WSDL files are taken for experiment, the input and output operations are extracted from the service descriptions. The extraction process used in [14] can be followed for extract the metadata such as web service name, type, ports, operations, input/output name and stored in a service pool.
Web Service Metadata extraction and Clustering
The Meta data requirement of a web service is shown in table I, the Meta data can be extracted from WSDL file and stored in the service pool. For example, Table II shows the Meta data of currency converter web service and its equivalent location is shown in Table III. The idea is to identify the terms and cluster the terms into concepts, and leverage these concepts to determine the similarity of inputs/outputs operations.
F. Service Meta Data Model
A web service can be defined in terms of Meta data as follows.
\[ WS = \{\text{Name, Message Exchange, Data types, set of operations}\} \]
Where \( \text{operation} = \{\text{no. of operation, input, output}\} \)
The operations can be described by name and text description in WSDL defined by port Type element and associated with at least one input message and one output message.
Each input and output contains a set of parameter for an operation defined by the message element and type element used in the message.
A message has optionally \( m \) parts \( m \geq 1 \) (at least one)
A simple WSDL structure for simple operation is shown in figure 2.

Service pool
The structure of the service pool is represented as the vector of \( SP = \{\text{Service Name, Profile, Op, Input/output, list of QoS}\} \) Table 1 shows the tag entries which are used in service pool.
<table>
<thead>
<tr>
<th>Tag</th>
<th>Naming Rules</th>
</tr>
</thead>
<tbody>
<tr>
<td>Service Name</td>
<td>The service name of the web service</td>
</tr>
<tr>
<td>Profile</td>
<td>The domain and functionality description of the service providers in the pool</td>
</tr>
<tr>
<td>Op</td>
<td>The operation name of the web service</td>
</tr>
<tr>
<td>Input</td>
<td>The input name can be used for client search</td>
</tr>
<tr>
<td>Output</td>
<td>The output name can be used for client search</td>
</tr>
<tr>
<td>QoS values</td>
<td>List of QoS attributes</td>
</tr>
</tbody>
</table>
Table 2. Example of Generating a Pool WSDL
<table>
<thead>
<tr>
<th>Name</th>
<th>Input</th>
<th>Output</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr>
<td>WS1</td>
<td>Currency Rates</td>
<td>get Currencies List</td>
<td>get Rate</td>
</tr>
<tr>
<td>WS2</td>
<td>DOTS Currency Exchange</td>
<td>Convert From Currency</td>
<td>Convert To Currency</td>
</tr>
<tr>
<td>WS3</td>
<td>Currency Rates</td>
<td>From Currency Code</td>
<td>To Currency Code</td>
</tr>
<tr>
<td>WS4</td>
<td>Currency Converter</td>
<td>From Currency</td>
<td>To Currency</td>
</tr>
<tr>
<td>WS5</td>
<td>Currency Server Web Service</td>
<td>src Currency</td>
<td>dst Currency</td>
</tr>
</tbody>
</table>
Table 2 described about 5 currency converter web services with similar functionality. The metadata of service pool consist of name, input, output, and operations, which are derived from WSDL file. The WSDL file definition, message, port Type, binding and service elements. To search a web service based on operation, we require the extracted features of name of the service, input/output name, and operation included in port type element and stored in service pool. Table 3 shows the 25 different web services retrieved by the crawler.
Table 3. Functionally Similar Web Services - Currency converter
<table>
<thead>
<tr>
<th>Currency converter Web service URLs - WSDL (25 web services)</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://ws2.serviceobjects.net/ce/CurrencyExchange.asmx?WSDL">http://ws2.serviceobjects.net/ce/CurrencyExchange.asmx?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.webservicex.com/CurrencyConverter.asmx?wsdl">http://www.webservicex.com/CurrencyConverter.asmx?wsdl</a></td>
</tr>
<tr>
<td><a href="http://www.currencyservice.de/webservice/currencyserviceweb.asmx?WSDL">http://www.currencyservice.de/webservice/currencyserviceweb.asmx?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.webservicex.com/CurrencyConverter.asmx?wsdl">http://www.webservicex.com/CurrencyConverter.asmx?wsdl</a></td>
</tr>
<tr>
<td><a href="http://currencyconverter.kowabunga.net/converterservice?WSDL">http://currencyconverter.kowabunga.net/converterservice?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.currencyservice.de/webservice/currencyserviceweb.asmx?WSDL">http://www.currencyservice.de/webservice/currencyserviceweb.asmx?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.currencyservice.de/webservice/currencyserviceweb.asmx?WSDL">http://www.currencyservice.de/webservice/currencyserviceweb.asmx?WSDL</a></td>
</tr>
<tr>
<td><a href="http://alloysoft.ru/BSCurrency/currency.axm?WSDL">http://alloysoft.ru/BSCurrency/currency.axm?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.alltaz.net/webservies/GetCurrencyExchange.wsdl">http://www.alltaz.net/webservies/GetCurrencyExchange.wsdl</a></td>
</tr>
<tr>
<td><a href="http://server1.pointasp.net/ws/finance/currency.axm?WSDL">http://server1.pointasp.net/ws/finance/currency.axm?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.freewebs.com/jimmy_chen/CurrencyExchangeService.wsdl">http://www.freewebs.com/jimmy_chen/CurrencyExchangeService.wsdl</a></td>
</tr>
<tr>
<td><a href="http://ws.soatrader.com/gama-system.com/1.0/CurrencyExchangeRates?wsdl">http://ws.soatrader.com/gama-system.com/1.0/CurrencyExchangeRates?wsdl</a></td>
</tr>
<tr>
<td><a href="http://www.serviceobjects.com/ce/CityNameByZipCode.axm?WSDL">http://www.serviceobjects.com/ce/CityNameByZipCode.axm?WSDL</a></td>
</tr>
<tr>
<td><a href="http://ws2.serviceobjects.com/ce/CityNameByZipCode.axm?WSDL">http://ws2.serviceobjects.com/ce/CityNameByZipCode.axm?WSDL</a></td>
</tr>
<tr>
<td><a href="http://currency.niekulfs.net/currency.axm?wsdl">http://currency.niekulfs.net/currency.axm?wsdl</a></td>
</tr>
<tr>
<td><a href="http://cs.danet.de/webservice/CurrencyserviceWebService.axm?WSDL">http://cs.danet.de/webservice/CurrencyserviceWebService.axm?WSDL</a></td>
</tr>
<tr>
<td><a href="http://www.signum.de/ForeignExchangeRate.axm?WSDL">http://www.signum.de/ForeignExchangeRate.axm?WSDL</a></td>
</tr>
<tr>
<td><a href="http://ws.soatrader.com/baydonhill.com/0.1/Currency?wsdl">http://ws.soatrader.com/baydonhill.com/0.1/Currency?wsdl</a></td>
</tr>
</tbody>
</table>
G. Concept clustering
To measure the similar and co-occurrences of term can be identified using association rules. Obtaining the association rules for the term set, we then try to cluster the concept set. Agglomerating algorithm [6], this is used to generate the concept from terms. i.e. Input/output, data types. The over frequent terms and infrequent terms are filtered in this step.
H. Predicting the Similarity
The similarity measurement of web service operation can be achieved by employing traditional TF/IDF (Term Frequency/Inverse Document Frequency) measurement. A web service operation op can be represented by three tuple vector. For a given two operations we can find the similarity by combining the similarity of each individual elements respectively.
1. By using the traditional TF/IDF measurement, estimate the text description of operation and the web services the operation belong to.
2. Estimate the similarity of input and output by considering the underlying semantics the input/output parameter cover.
Input <= <min, Cl Where min - text description of input names and concepts that associates with
Similarly the output Output <= <nout, Co >
3. Find similarity of input in the following two ways.
Evaluate the similarity of the description of input names by TF/IDF.
Split min into a set of terms. We should filter the terms related to outputs (eg. “ZipCode” in the input “City Name ByZipCode”). Then we replace each term with its corresponding concepts, and then use the TF/IDF measure.
The output can be processed in a similar fashion. Now, we define the similarity between two operations op_i, op_j the following formula
\[
\text{Sim}(op_i, op_j) = \sum_{k=1}^{4} w_i \cdot \text{Sim}(N_{op_i}, N_{op_j})
\]
\[
+ w_2 \cdot \text{Sim}(input_i, input_j) + w_4 \cdot \text{Sim}(output_i, output_j)
\]
Here, \(w(i=1, 2, 3, 4)\) is the weight assigned to similarity of operation text description, input and output, \(\sum w = 1\). Then, we define the two operations that are similar as follows:
Given two operations op_i, op_j a threshold \(w_i\) then claim that op_i, op_j are similar operations if \(\text{Sim}(op_i, op_j) \geq w_i\)
I. Constructing Service Aggregation Graph
Two service discovery types are specified against a given request of input and output. We are follow the same approach used in [6] and the step is as follows,
1. A list of similar single operations that can accept the request and
2. A sequence of operations that can be composed to fulfill the request.
In our approach, we process these two requirements within a directed graph, \( G = (V, E) \), in which:
1. \( V \) is the vertex set. Each vertex in the graph \( G \) corresponds to an operation in our data set;
2. \( E \) is the edge set. Each edge corresponds to the input or output of the vertex.
To find single similar and composable operation in the web service pool, a "Service Aggregation Graph" (SAG) algorithm can be used [6].
J. QoS based Web Service discovery process
Generally, the UDDI and search engines are used to search the services by keyword. Since the keyword search is not able to extract the underlying semantics of the searched query, operation based search has been introduced. The discovery process completed only if the QoS based requirement incorporate with operation based search. Thus QoS driven web service discovery approach efficiently selects the required web service. The system assists the user to specify the input operation and the output operation along with the QoS requirements. QoS values of the web service such as response time in millisecond, throughput in seconds, cost in dollar, both reliability and availability in percentage. These heterogeneous values such as millisecond, second and percentage can be normalized by the simple weighted average method. The range of the normalized value is between \([0, 1]\).
We have taken four metric for QoS assessment. First metric measures the average execution time of a web service, it takes the values from the integer set \([1, \infty]\), while its measurement unit in millisecond. The second metric measures the average throughput of a web service, its values also belong to the integer set \([1, \infty]\), whereas its measurement unit in seconds. The next two metric measures the average availability and reliability of a web service, it takes the real values and is computed as percentage. Table 4 consist of QoS web service parameters which are used in [19] such as response time, throughput, reliability and availability that can be retained in the proposed method.
**Table 4. QoS Attributes for web service selection**
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Definition</th>
<th>Unit of measurement</th>
</tr>
</thead>
<tbody>
<tr>
<td>Response time</td>
<td>Time taken to send a request and receive a response</td>
<td>Millisecond</td>
</tr>
<tr>
<td>Throughput</td>
<td>Total number of invocations for a given period of time</td>
<td>Invocations per second</td>
</tr>
<tr>
<td>Reliability</td>
<td>Ratio of the number of error messages to total messages</td>
<td>Percent</td>
</tr>
<tr>
<td>Availability</td>
<td>Number of successful invocations/total invocations</td>
<td>Percent</td>
</tr>
</tbody>
</table>
Let \( S \) be the set of preselected services, describes the utility score decreased if the QoS value is increased. Lower is better policy can be maintained. Here, the response time, throughput and cost are come under this category. QOS\textsuperscript{decrement} \( q_i \) represents the positive QoS attribute such as availability and reliability. If the QoS values are increased then the utility value also in a increased direction. Higher is better policy is taken under this category.
\[
s \in S \text{ if } \forall_{i=1}^{N} \left\{ \begin{array}{ll}
q_i \leq q_i (s) & \text{if } Q_i \in QOS\textsuperscript{decrement} (q_i) \\
q_i \geq q_i (s) & \text{if } Q_i \in QOS\textsuperscript{increment} (q_i)
\end{array} \right.
\]
To illustrate matchmaking step, consider five instance of web service \( WS_1, WS_2, WS_3, WS_4, WS_5 \) with respective offers: these QoS values are normalized by equation (2)
\[
WS_1 (QoS) = \{ 205.33 \text{ms, 3.5s, 80, 60} \}
\]
\[
WS_2 (QoS) = \{ 104.75 \text{ms, 19.4s, 89, 73} \}
\]
\[
WS_3 (QoS) = \{ 126.25 \text{ms, 3.6s, 100, 60} \}
\]
WS₄ (QoS) = (648ms, 0.6s, 92, 73)
WS₅ (QoS) = (539.29ms, 6.2s, 63, 80)
K. Normalization
At this stage all the eligible services offer a quality level that is equal to or higher than the requested and come at the affordable costs. We will thus evaluate service offers in terms of the gain in quality and cost that is proposed. Let Q and C be the evaluation metrics of gains in quality and cost respectively. We here by define q as scalar values between 0 and 1.
We first evaluate the gain in each quality dimension. For each, we define two parameters (q)_{max} and (q)_{min} as follows
\[
(q)_{max} = \begin{cases}
\max_{s \in S} q_i(s) & \text{if } Q_i \in QoS_{\text{Increment}} \\
(q_i)_r & \text{if } Q_i \in QoS_{\text{Decrement}}
\end{cases} \\
(q)_{min} = \begin{cases}
\min_{s \in S} q_i(s) & \text{if } Q_i \in QoS_{\text{Increment}} \\
(q_i)_r & \text{if } Q_i \in QoS_{\text{Decrement}}
\end{cases}
\]
(1)
The scaling function is defined as Utility_i(q_i) and takes values in [0, 1]. Utility_i(q_i) is increasing for QoS_{\text{Increment}} attributes and decreasing for QoS_{\text{Decrement}} attributes.
\[
Utility_i(q_i) = \begin{cases}
\frac{q_i - (q_i)_{min}}{(q_i)_{max} - (q_i)_{min}} & \text{if } Q_i \in QoS_{\text{Increment}} \\
\frac{(q_i)_{max} - q_i}{(q_i)_{max} - (q_i)_{min}} & \text{if } Q_i \in QoS_{\text{Decrement}} \\
1 & \text{if } (q_i)_{max} - (q_i)_{min}
\end{cases}
\]
(2)
We can easily show that for all \( i = 1 \cdots N \), Utility_i((q_i)) = 0. We now derive the scalar metric Q from the vector (Utility_i(q_i)), \( W = (w_1, w_2, \ldots) \) denotes consumer's quality preferences. Where 0 ≤ W ≤ 1 and \( \sum_{k=1}^{N} W_k = 1 \).
The rank value of the web service can be calculated as
\[
\text{Rank} = \sum_{i}^{n} Utility_i(q_i) * W_i
\]
IV. EXPERIMENTAL RESULTS
Discovering a web service according to the client requirement is an elusive task as similar services are ready to satisfy a request. To alleviate the difficulties, QoS driven web service discovery has been introduced. The important elements which are participated in the message exchanges are service consumer, service provider, service pool manager, and the feed manager. The Feed manager used for subscribing the Service to the client. The system user interface allows the service provider to register their services. For example, Webservice.net, it successfully added it to the service providers list. The WSDL parser extracts the Meta data such as name of web service, input/output operation, web service operation from WSDL file. For example, as stated in table 1 for currency converter web service, name of the web service is “Currencyconverter”, input message operation as “Fromcurrency”, output message operation as “Tocurrency” and the operation name as “ConversionRate”. These Meta data are extracted by the WSDL parser and stores it into the Service pool.
Whenever a request comes, the consultant communicates the service pool manager for selecting a suitable web service. The service pool manager finds the single similar and composite operations by using the clustering algorithm and agglomeration graph algorithm. Based on this computation, the related concepts are grouped and the list is provided to the client for setting weights over QoS attributes.
L. Keyword search
As service providers publish the web service content on the internet using standard WSDL interface, people from anywhere can access the web service on any platform and any operating system. The system interface allows the user to specify the keyword and in response the system returns the list of matched service to the client. For example, the keyword “currency”, the services which are matched with the searched query currency will be returned. Here all the 25 web services are returned as a search result.
The search engines are searched by using a plain textual description, which describes the general kind of service that is offered, for example, service related to “weather forecasting” or “travel agency.” As the keyword search not able to provide the underlying semantics of the web service search operations, we
advocate the homogeneous service discovery mechanism for searching a web service.
M. Input/output operation based search
Service Pool contains the Meta data information of the WSDL file. It's not only maintains the operations with similar inputs/outputs, but also the "hyperlink" between the operations. This approach combines multiple sources of evidence to determine the similarity. The search domain of the operation that captures the purposed functionality such as "GetWeatherByZipCode," "SearchBook," or "QueryAirplaneTimetable." Finally, we find the data type deriving from the input/output. The data types do not relate to the low-level encoding issues such as integer or string, but to the semantic meanings such as "weather," "zipcode," etc. Service Pool can return two types of results: the operations with similar inputs and outputs, and the sequentially composable operations. The component Service Pool analyzes each WSDL file, filter the irrelevant information, and retrieve terms from the input/output data types.
The service consumers can search the homogeneous Web services within their Web browser. The users can type in their desired input and output names and get the returned results. It shows the similar single operations and composite operations into two parts. The similar operations are highlighted as well as their inputs and outputs, in the description of the Web services they belong to. The composite operations are listed in a tree, where the upper node's output can be accepted as input by the lower ones. The returned results are sorted by their similarity against the requests. And the user can able to subscribe the service.
Figure 4 shows the search for similar services based on input and output operations. So the system will return the single similar operation against the given input and output operations. For example, getting similar services, the request contains input operation GetCurrency and respected output parameter GetCountries. The search has been performed and the list contains the requested web services.
The following figure 3 shows the user interface for searching composable operations web services. Composable in the sense the output of the service operation will be the input of the others in a chain manner. This type of functionality has been tested by the sample search data as Get Currency and requested output operation is GetCountries. By getting this data a search has been conducted and the composable operation based services has been listed and which is shown in figure 6. The resulted service operation against the given request is GetCountries, GetCurrencyByCountry, GetCurrencyCodeByCurrencyName. This output has been shown in a tree structure format.

For specifying the composite search operation Get Currency, the GetCountries composite web service has been open for invocation. By invoking GetCountries web service another web service GetCurrencyByCountry has been opened. By specifying India as a country name the details of the currency details will be provide in a XML description by calling GetCurrencyCodeByCurrencyName web service as this invocation in a chain and interrelated, this kind of search service is composite search is rightly justified.
Subscribing the Service
In ServicePool, the Feed Manager component attaches the metadata to the Atom feeds and indexes the feeds to the corresponding Web services by using the standard Atom publish protocol. Here, it is necessary to make the binding between the Atom feeds and WSDL, to ensure the consistency with the original Atom syntax and semantics. Due to the functionalities that Service Pool provides, we adopt two feed types. The first one is the Web service entry, which is used to subscribe exactly one Web service. This element represents Web service by binding the metadata of the Web service to an Atom feed. Figure 4 shows
subscribing web service to the client. The system has been tested with the subscription of data.

Fig. 4. Subscribing a web service using RSS Feed
### QOS based discovery
Here the system is tested for searching the service based on Quality of Service parameters. The parameters considered here is Response time, Throughput and Availability and Reliability for selecting optimal web service. The QWS dataset can be used to validate the proposed system [18][20]. These QoS values can be measured by standard benchmark tools [21][22].
### Table 5. The QOS values for 5 Functionally Similar Web Services
<table>
<thead>
<tr>
<th>Service</th>
<th>Response time (Milli Second)</th>
<th>Throughput (Second)</th>
<th>Availability (Percentage %)</th>
<th>Reliability (percentage %)</th>
</tr>
</thead>
<tbody>
<tr>
<td>WS1</td>
<td>205.33</td>
<td>3.5</td>
<td>90</td>
<td>60</td>
</tr>
<tr>
<td>WS2</td>
<td>104.75</td>
<td>19.4</td>
<td>89</td>
<td>73</td>
</tr>
<tr>
<td>WS3</td>
<td>126.25</td>
<td>3.6</td>
<td>100</td>
<td>60</td>
</tr>
<tr>
<td>WS4</td>
<td>648</td>
<td>0.6</td>
<td>92</td>
<td>73</td>
</tr>
<tr>
<td>WS5</td>
<td>536.29</td>
<td>6.2</td>
<td>63</td>
<td>80</td>
</tr>
</tbody>
</table>
Thus 5 different services of CurrencyConverter web service are registered with varying QoS Values. Table 5 shows the QoS requirement of a currencyconverter web service.
A user want to search the web service by input/output operation name means, they can use the exclusively designed interface along with QoS requirements. The system allows the user to specify the web service by input/output operation and QoS attribute he is looking for can be made through the user interface as a search query. The QoS attributes such as response time, throughput, reliability and availability are normalized and a match score value will be identified and it will be compared to the available web services. The highest matched services will be provided to the client for setting preference over QoS attribute. Table 6 show the normalized value getting from equation (2).
### Table 6. Normalized QOS Values
<table>
<thead>
<tr>
<th>Service</th>
<th>Response time</th>
<th>Throughput</th>
<th>Availability</th>
<th>Reliability</th>
</tr>
</thead>
<tbody>
<tr>
<td>WS1</td>
<td>0.8148</td>
<td>0.8457</td>
<td>0.7297</td>
<td>0</td>
</tr>
<tr>
<td>WS2</td>
<td>1</td>
<td>0</td>
<td>0.7027</td>
<td>0.65</td>
</tr>
<tr>
<td>WS3</td>
<td>0.96042</td>
<td>0.84042</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>WS4</td>
<td>0</td>
<td>1</td>
<td>0.7837</td>
<td>0.65</td>
</tr>
<tr>
<td>WS5</td>
<td>0.20011</td>
<td>0.70212</td>
<td>0</td>
<td>1</td>
</tr>
</tbody>
</table>
The client has set weightage for all the QoS parameters varying on its importance to him [0,1]. Based on these weightages the rank value of the services is evaluated using equation (3).
If the user assigned weight to each QoS attribute as (0.8,0.7,0.7,0.8), the utility value can be represented by
\[
\begin{pmatrix}
0.8148 & 0.8457 & 0.7297 & 0 \\
1 & 0 & 0.7027 & 0.65 \\
(0.8 & 0.7 & 0.7 & 0.8) & 0.9604 & 0.8404 & 1 & 0 \\
0.2001 & 0.7021 & 0 & 1
\end{pmatrix}
\]
\[
= \begin{pmatrix}
0.6518 & 0.5929 & 0.5107 & 0 \\
0.8 & 0 & 0.4918 & 0.52 \\
0.7683 & 0.5882 & 0.7 & 0 \\
0.1600 & 0.4914 & 0.8 & 0.65
\end{pmatrix} = \begin{pmatrix}
0.4388 \\
0.4529 \\
0.5141 \\
0.4421
\end{pmatrix}
\]
### Table 7. Rank Value for Web Service Using Proposed Ranking Algorithm
<table>
<thead>
<tr>
<th>Service</th>
<th>Rank value</th>
</tr>
</thead>
<tbody>
<tr>
<td>WS3</td>
<td>0.5141</td>
</tr>
<tr>
<td>WS2</td>
<td>0.4529</td>
</tr>
<tr>
<td>WS4</td>
<td>0.4421</td>
</tr>
<tr>
<td>WS1</td>
<td>0.4388</td>
</tr>
<tr>
<td>WS5</td>
<td>0.3628</td>
</tr>
</tbody>
</table>
The result is evaluated by weighted sum of all normalized QoS parameters and the final rank value is evaluated. According to this the rank value will be provided to the client from higher to lower order. So the recommendation will be based on higher is better can be followed.
A. Performance Analysis
In general, Web service discovery is based on keywords. Due to this search the user can get relevant as well as irrelevant result also. In the proposed system, the search is based on input and output search. So that the consumer can get the relevant web services.
The following table 8 shows the comparison between keyword based search and operation based search mechanisms.
Table 8. Comparison between Keyword search and operation based search
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>2</td>
<td>1</td>
<td></td>
<td>8</td>
<td>4</td>
<td>7</td>
<td>4</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
The following figure 5 shows the Comparison Chart for Keyword Search and Input/output based Search
Fig. 5. Graph shows the difference between keyword search and input/output operation based search for weather and currency converter web service.
obtained by clustering algorithm. The QoS computations of web services are measured and using normalization algorithm which provides rank values. Whenever a search has been performed, the system selects the list of matched services from the service pool and provided to the client. The test bed result shows that a sharp deviation between the keyword based search and operation based search. The proposed method incorporates with the client's non functional requirement which shows a promising result to the searched query. In future, the agglomerative algorithm can be replaced by hybrid hierarchical clustering algorithm to reduce the incorrectly grouped of object at an early stage can be alleviated.
REFERENCES
R.Jeberson Retna Raj is a research scholar from Sathyabama University, Chennai. Currently He is doing his Ph.D in Computer Science and Engineering in the area of Web Services. His research interest includes Service oriented architecture (SOA), web services, GIS web services etc. He had presented various papers in national & international Journals and conferences.
|
{"Source-Url": "http://www.journals-sathyabama.com/archives/isc/inter%20computer%20%20july%202011%20vol%205%20number%202%20final%20-%2010.pdf", "len_cl100k_base": 10470, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 14064, "total-output-tokens": 11658, "length": "2e13", "weborganizer": {"__label__adult": 0.0003399848937988281, "__label__art_design": 0.0005946159362792969, "__label__crime_law": 0.0003643035888671875, "__label__education_jobs": 0.0009751319885253906, "__label__entertainment": 0.00016260147094726562, "__label__fashion_beauty": 0.0001800060272216797, "__label__finance_business": 0.0006814002990722656, "__label__food_dining": 0.0003864765167236328, "__label__games": 0.0008549690246582031, "__label__hardware": 0.00101470947265625, "__label__health": 0.0004818439483642578, "__label__history": 0.00034999847412109375, "__label__home_hobbies": 7.462501525878906e-05, "__label__industrial": 0.00027370452880859375, "__label__literature": 0.0005483627319335938, "__label__politics": 0.0002467632293701172, "__label__religion": 0.0003955364227294922, "__label__science_tech": 0.0872802734375, "__label__social_life": 0.00011813640594482422, "__label__software": 0.039642333984375, "__label__software_dev": 0.8642578125, "__label__sports_fitness": 0.00021064281463623047, "__label__transportation": 0.0004620552062988281, "__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, 48005, 0.04883]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48005, 0.10294]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48005, 0.86827]], "google_gemma-3-12b-it_contains_pii": [[0, 4259, false], [4259, 9122, null], [9122, 13831, null], [13831, 17393, null], [17393, 20608, null], [20608, 25286, null], [25286, 29193, null], [29193, 33327, null], [33327, 37254, null], [37254, 41090, null], [41090, 44395, null], [44395, 48005, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4259, true], [4259, 9122, null], [9122, 13831, null], [13831, 17393, null], [17393, 20608, null], [20608, 25286, null], [25286, 29193, null], [29193, 33327, null], [33327, 37254, null], [37254, 41090, null], [41090, 44395, null], [44395, 48005, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48005, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48005, null]], "pdf_page_numbers": [[0, 4259, 1], [4259, 9122, 2], [9122, 13831, 3], [13831, 17393, 4], [17393, 20608, 5], [20608, 25286, 6], [25286, 29193, 7], [29193, 33327, 8], [33327, 37254, 9], [37254, 41090, 10], [41090, 44395, 11], [44395, 48005, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48005, 0.24648]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
fc952561df57a3de03947d15ef616136f9617035
|
Siebel Usability Best Practices
Making Siebel Easy to Use
Madhuri Kolhatkar
Director of Customer and User Experience Management
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Agenda
• Introduction to UX Direct
• Why is Usability Important for your Implementation?
• How to apply Siebel Usability Best Practices to your current implementation?
• How to leverage with new add-ons modules and applications?
• Key takeaways
Introduction to UX Direct
• Oracle Applications User Experience is launching a new program for our customers and partners
• Distribute and share Product Specific Usability Best Practices
• Enable the implementation team to incorporate usability into the development cycle
• Incorporate our Usability Best Practices when you upgrade to extend your applications
Why is Usability Important?
• Business Efficiency
• Customers expect enterprise applications to make them competitive and efficient
• If the business doesn’t trust its IT systems to work quickly and accurately, it will want to throw the system out
• Employee Productivity
• End-users expect to complete their tasks successfully and quickly
• End users expect to be confident and satisfied with using the system
• Information Accuracy
• Incorrect or missing data, or data in the wrong fields will slow down or stop a business process
• Manual intervention required – always more expensive
Usability is essential to make your business successful
Customer Implementation Cycle
Introducing Usability Best Practices
TEST
- Measuring productivity gains before/after
- Conducting usability testing
BUILD
- Tailoring your applications
- Validating with users
DEPLOY
- Sharing UX success stories with end users
PLAN & ANALYZE
- Adding UX in Requirements
- Understand users and tasks
- Identifying productivity needs
DESIGN
- Creating concepts and prototypes
- Applying UX Best Practices
- Validating with users
End Users
Top 5 Usability Principles – Must Know
1. Allow the users to achieve their goals and tasks as quickly, efficiently and accurately as possible
2. Make the application enjoyable and satisfying to use
3. Make the application easy to learn and remember
4. Allow users to avoid making errors and make it easy to recover from errors
5. Automate tedious and repetitive tasks
Siebel Best Practices
Siebel Best Practices
Navigation – Getting Started
Problem:
Too much navigating to get to the initial view and record to start work
Solutions:
1. Train users on the User Profile Preferences, Behavior view, Startup View field setting.
2. Train users to drag and drop key records and views onto their desktops, into emails, into the Microsoft Windows Start menu or onto the Microsoft Windows task bar.
3. Configure a launch pad to store all the favorite start up views and records.
4. Reconfigure home pages to make them more dynamic and useful or remove them altogether.
Navigation – Startup View
Navigation – Drag and Drop Bookmarks
Navigation – Launch Pad
Navigation – Dynamic Home Pages
Monthly Periodical vs. Daily Newspaper
Navigation - Confusing
Problem:
Too confusing to find the views needed to do my work
Solutions:
1. Train users to complete the User Profile Preferences, Tab Layout view, and Show/Hide View menu icons.
2. Train users on the thread bar.
3. Reconfigure applets into consolidated views so that users can complete a single business process without changing views or screens.
4. Reconfigure views and navigation menus so that links are not the main navigation mechanism within a single business process.
5. Configure Inbox to consolidate approval in workflow requests.
6. Configure iHelp to coach users through steps to complete a business process.
7. Implement task-based UI to streamline and simplify data entry for complex business processes.
Navigation – Tab Layout
Navigation – Thread Bar
Navigation – Consolidate Views
Navigation – Links
Promotions
Promoted Categories SKU’s
Promoted Categories
Corporate
Details
Promotions
Audit Trail
Defaults
Funds
Attachments
Analytics Calendar
Sales Analysis
Details
Post-Event Analysis
Promoted Categories SKU’s
Scenario
Dates
Tactics
Promoted Category Volumes
Promotions
Status
Name
Account
Category
Period
Base Vol
Incr. Vol
Tot Vol
Baseline Revenue
Incr Profit
New
2011 - ABC Mart West CSD Plan
ABC Mart US West (SVP)
CSD (SVP)
2011
675,789
307,317
982,250
57,042.00
($232,662)
New
7 Up
CSD 12oz - 12pk (SVP)
21
3
2
10%
Front Page
Shelf
$252.00
63.85
New
2L Dr. Pepper Fall Finale
CSD 12oz - 12pk (SVP)
40
2
6
15%
Front Page
Off-Shelf
$20,000.00
808.28
New
Dr. Pepper
CSD 12oz - 12pk (SVP)
30
2
4
20%
Front Page
End-of-Isle
$0.00
3.19
CSD 12oz - 12pk (SVP)
20%
Front Page
Shelf
$100.00
$0.10
$0.15
$21,530.00
CSD 2L
10%
Front Page
Shelf
$152.00
$0.00
$0.00
$152.00
12oz 12pk - Dr. Pepper (SVP)
10%
Front Page
Shelf
$0.00
$0.00
$0.00
$0.00
Navigation – Inbox
Navigation – iHelp
**How do I...**
**Create a New Account**
**Enter New Record**
1. Navigate to the Accounts screen > My Accounts View.
2. Click New in the Account list or form.
**Base Information**
3. Enter the base account information.
**Account Team**
4. Assign an account team.
**Account Detail**
5. Add account detail on the Account Profile view.
**Contacts**
6. Add or Create Contacts on the Account Contacts View.
7. Enter Contact profile information.
**ABC Mart Global (SVP)**
**Menu**
**Site**: Global HQ
**Address**: 1440 Avenue of the
**City**: New York
**Zip Code**: 10023
**Parent**: ABC Mart Global (SVP)
**Main Phone #**: (908) 456-8900
**ABC Mart US (SVP)**
**Site**: Stamford
**Parent**: ABC Mart Global (SVP)
**Main Phone #**: (800) 783-0909
**ABC Mart US East (SVP)**
**Site**: Pequannock
**Parent**: ABC Mart US (SVP)
**Main Phone #**: (908) 325-6701
**ABC Mart US West (SVP)**
**Site**: Princeton
**Parent**: ABC Mart US (SVP)
**Main Phone #**: (908) 325-6780
**My New Account Template**
Navigation – Task-based UI
Create Account and SR: Enter Account Details
- Account Name: Oracle Corporation
- Address: 500 Oracle Parkway
- City: Redwood Shores
- Zip Code: 94065
- Account Team: SADMIN
- Main Phone #: (650) 506-7000
- Status: Active
- Account Type: Commercial
Pause | Previous | Next | Cancel
Easier Querying
Querying
Problem:
Too difficult to find information in the system
Solutions:
1. Train users on the Applet menu, Record Count command.
2. Train users on predefined queries, including defaulting the first PDQ.
3. Train users on query operators.
4. Configure key fields for case or accent-insensitive querying for usable yet performant querying.
5. Configure flattened or denormalized list views to make children records more accessible and exportable.
6. Configure Explorer views.
7. Implement secured enterprise search for multifield and unstructured data searches.
Querying – Applet Menu, Record Count
Querying – Predefined Queries
# Querying – Query Operators
<table>
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>*</td>
<td>Wildcard operator. Placed anywhere in a string, returns records containing the string or containing the string plus any additional characters at the position at which the asterisk appears, including a space. You cannot use * to find dates. To find words on more than one line in a field, you must use an asterisk (*) to separate the words. You cannot query for control characters or nonprintable characters, such as line feeds (LF) or carriage returns (CR).</td>
<td><em>rang</em> finds arrange, arranged, orange, orangutan, range, ranges, ranging, ring, strange, stranger, strangest, strange, wrangle, and so on. <strong>NOTE:</strong> If performance is poor when you use the asterisk (*), substitute "IS NOT NULL" in your query. This often improves performance, and will return the same sets of records.</td>
</tr>
<tr>
<td>?</td>
<td>Wildcard operator. Placed anywhere in a string, returns records containing the characters specified in the string plus any one additional character that appears at the location of the question mark. ?rag finds drag, craq, or drag. ?type finds type and tape, but not tripe.</td>
<td>?rag finds drag, craq, or drag.</td>
</tr>
<tr>
<td>**</td>
<td>Surrounds a string that, unless modified by a wildcard (* or ?), must be matched exactly. Quotes let you query for a group of words in its exact order with exact upper or lower case lettering.</td>
<td>"Sun Solaris" finds records that contain Sun Solaris in the query field.</td>
</tr>
<tr>
<td>=</td>
<td>Placed before a value, returns records containing a value equal to the query value.</td>
<td>=smith finds all records for which the value in the query field is Smith. It also turns off wildcards within the query value. <strong>NOTE:</strong> For CIAI-enabled fields, if you type "=abc?", the query becomes a case-sensitive query, because you use an equal sign (=) as an operator in the query.</td>
</tr>
<tr>
<td><</td>
<td>Placed before a value, returns records containing a value less than the query value.</td>
<td><8/20/01 finds all records in which the value of the query field is before 20 June 2001. When entering a date, use the format that is specific to your implementation.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>></td>
<td>Placed before a value, returns records containing a value greater than the query value.</td>
<td>>5/31/01 finds all records in which the date in the query field is later than 31 May 2001. When entering a date, use the format that is specific to your implementation.</td>
</tr>
<tr>
<td><></td>
<td>Placed before the value, returns records containing a value that is not equal to the query value.</td>
<td><6/20/01 finds all records in which the date in the query field is not 20 June 2001. <>Paris finds all the records in which the value in the query field is not Paris.</td>
</tr>
<tr>
<td><=</td>
<td>Placed before a value, returns records containing a value less than or equal to the query value.</td>
<td><=500 finds all the records in which the value in the query field is less than or equal to 500.</td>
</tr>
<tr>
<td>>=</td>
<td>Placed before a value, returns records containing a value greater than or equal to the query value.</td>
<td>>=500 finds all records in which the value in the query field is greater than or equal to 500.</td>
</tr>
<tr>
<td>NOT LIKE</td>
<td>Placed before a value, returns records not containing the value.</td>
<td>NOT LIKE Smi* finds all records in which the value in the query field do not start with Smi.</td>
</tr>
<tr>
<td>IS NULL</td>
<td>Placed in the query field, returns records for which the query field is blank.</td>
<td>Enter IS NULL in the Due Date query field to find all records for which the Due Date field is blank.</td>
</tr>
<tr>
<td>IS NOT NULL</td>
<td>Placed in the query field, returns records for which the query field is not blank.</td>
<td>Enter IS NOT NULL in the Due Date query field to find all records for which the Due Date field is not blank.</td>
</tr>
<tr>
<td>~</td>
<td>Placed before LIKE and a value with a wildcard operator, returns all matching records regardless of case.</td>
<td>~LIKE Sea* finds all records in which the value in the query field starts with Smi, smi, Smi, and so on. Using this operator might affect performance. <strong>NOTE:</strong> You can enter a CIAI query expression for a contact as follows: [Last Name] ~Like abc*</td>
</tr>
</tbody>
</table>
## Querying – Query Operators
<table>
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>AND, and</td>
<td>Placed between values, returns only records for which all the given conditions are true.</td>
<td><code>*performance* AND *memory*</code> finds all records that contain both <code>performance</code> and <code>memory</code> in the query field.</td>
</tr>
</tbody>
</table>
| OR, or | Placed between values, returns records for which at least one condition is true. | `*performance* OR *memory*` finds all records that contain either `performance` or `memory` in the query field.
`performance` OR `memory` finds all records that start with either `performance` or `memory` in the query field. |
| NOT, not | Placed before a value, returns only records that do not contain the value. | `*performance* AND NOT LIKE *memory*` finds all records that contain `performance` but not `memory` in the query field.
NOT (performance OR memory) finds all records that contain neither `performance` nor `memory` in the query field. |
| () | Surrounds the values and operators that will be processed first, regardless of the default processing order. | (`sun OR moon`) AND NOT stars returns records that contain `sun` or `moon`, but not `stars`, in the query field. |
| LIKE, like | Placed before a value, returns records containing the value. | (`performance` OR `memory`) AND LIKE (problem) finds all records in which the query field starts with `performance` or `memory` and also includes `problem`.
**NOTE:** The LIKE operator is case sensitive. To find matches regardless of case, see (`~`). |
Querying – Case-insensitive Querying
Querying – Flat or Denormalized Views
Querying – Explorer Views
Querying – Secured Enterprise Search
Faster Data Entry
Data Entry – Mass Changes
Problem:
Too much work to manage and edit data
Solutions:
1. Train users on the Edit, Change Records command.
2. Train users to use the Edit, Merge Records command. Show users how this command can be used to delete multiple records by merging them and then deleting the remaining record.
3. Configure Reverse Views to enable a child record to be associated with multiple parent records at once, such as with the Employee, Account view instead of the Account, Sales Team view.
Data Entry – Change Records
Data Entry – Merge Records
Data Entry – Reverse Views
![Diagram showing reverse views of data entry]
Data Entry – Confusing View Layout
Problem:
Too frustrating figuring out the uses of fields and buttons
Solutions:
1. Train users on the Text Editor button.
2. Reconfigure applets to remove unnecessary fields.
3. Reconfigure applets to reduce the number of mandatory fields.
4. Reconfigure the location and order of buttons, auto-instantiate them when appropriate, and put them in sequence of the business process.
5. Configure separate views for entering data versus managing and analyzing data.
6. Configure hover functionality to describe what fields are intended for.
7. Train users to lock columns in list views with a double-click.
8. Train users to expand and collapse applets and to toggle between form and list applets with a button (may require configuration).
9. Reconfigure form views using personalization to dynamically display fields based on user attributes.
Data Entry – Text Editor
Data Entry – Unnecessary Fields
Data Entry – Mandatory Fields
Data Entry – Buttons
Data Entry – Separate Views
### Data Entry – Hover
#### Account Promotions
<table>
<thead>
<tr>
<th>Promotion</th>
<th>Name</th>
<th>Promoted Category</th>
<th>Plan</th>
<th>Promotion End Date</th>
<th>Status</th>
<th>Tot Vol</th>
<th>Duration</th>
<th>Lift %</th>
<th>Predict Lift %</th>
<th>Display</th>
<th>Tot Fixed Fee</th>
</tr>
</thead>
<tbody>
<tr>
<td>12oz 12pk Dr. Pepp Dr. Dr. Pepp</td>
<td>12oz 12pk Dr. Pepp</td>
<td>12oz 12pk - Dr. Pepp 2011 - ABC Mart W</td>
<td>1/26/2011</td>
<td>New</td>
<td>16,291</td>
<td>2</td>
<td>200%</td>
<td>$2,000</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>12oz 12pk A&W Aut</td>
<td>12oz 12pk A&W Aut</td>
<td>12oz 12pk - A&W (S) 2011 - ABC Mart W</td>
<td>10/15/2011</td>
<td>New</td>
<td>32,555</td>
<td>3</td>
<td>150%</td>
<td>$1,000</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>12oz 12pk 7 Up Sum</td>
<td>12oz 12pk 7 Up Sum</td>
<td>12oz 12pk - 7 Up (S) 2011 - ABC Mart W</td>
<td>7/20/2011</td>
<td>New</td>
<td>26,321</td>
<td>4</td>
<td>75%</td>
<td>$3,000</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>12oz 12pk All-In Wr</td>
<td>12oz 12pk All-In Wr</td>
<td>12oz 12pk - All-In Wr (S) 2011 - ABC Mart W</td>
<td>12/7/2011</td>
<td>New</td>
<td>54,385</td>
<td>5</td>
<td>25%</td>
<td>$0</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>ABC Mart US-Wide</td>
<td>ABC Mart US-Wide</td>
<td>ABC Mart US-Wide 2011 - ABC Mart W</td>
<td>10/9/2011</td>
<td>New</td>
<td>0</td>
<td>0</td>
<td>0%</td>
<td>$0</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
#### Month Calendar
- **Promotion:** 12oz 12pk 7 Up Summer Bash
- **Status:** New
- **Type:** Discretionary
- **Start Date:** 6/22/2011
- **End Date:** 7/20/2011
---
**Note:** The above data is for demonstration purposes only and does not reflect real data or sales figures.
Data Entry – Lock Columns
Data Entry – Expand and Collapse Applets
Data Entry – Personalization
Data Entry – Too Many Mouse Clicks
Problem:
Too many mouse clicks to enter data
Solutions:
1. Train users on how to use the keyboard with pick lists.
2. Train users on how to use the keyboard with pick applets.
3. Train users on how to use keyboard shortcuts.
4. Train users how to use drag-and-drop functionality for attachments.
5. Reconfigure tab order in form applets.
6. Reconfigure column order and column width in list applets.
7. Reconfigure pick lists with a short listed set of values based on user context.
8. Reconfigure multivalue group pick applets as shuttle applets instead.
9. Reconfigure single-value pick applets as pick lists, check boxes, and radio buttons.
Data Entry – Pick Lists
Data Entry – Pick Applets
## Data Entry – Keyboard Shortcuts
### Table 19. Data Management Keyboard Shortcuts
<table>
<thead>
<tr>
<th>Action</th>
<th>Basic Mode</th>
<th>Extended Mode</th>
<th>Context</th>
</tr>
</thead>
<tbody>
<tr>
<td>New record</td>
<td>CTRL+ALT+N</td>
<td>CTRL+N</td>
<td>List, form</td>
</tr>
<tr>
<td>New record using Quick Fill template</td>
<td>CTRL+K</td>
<td></td>
<td>Form</td>
</tr>
<tr>
<td>New record using last used Quick Fill template</td>
<td>CTRL+J</td>
<td></td>
<td>Form</td>
</tr>
<tr>
<td>Apply Quick Fill template to record</td>
<td>CTRL+Q</td>
<td></td>
<td>Form</td>
</tr>
<tr>
<td>Copy record</td>
<td>CTRL+ALT+C</td>
<td>CTRL+B</td>
<td>Record</td>
</tr>
<tr>
<td>Save record</td>
<td>CTRL+SHIFT+S</td>
<td>CTRL+S</td>
<td>List, form</td>
</tr>
<tr>
<td>Delete record</td>
<td>CTRL+ALT+D</td>
<td>CTRL+D</td>
<td>Record</td>
</tr>
<tr>
<td>Undo record</td>
<td>CTRL+ALT+U -or- ESC</td>
<td>CTRL+U -or- ESC</td>
<td>Record</td>
</tr>
<tr>
<td>Select all</td>
<td>CTRL+ALT+A</td>
<td>CTRL+A</td>
<td>List</td>
</tr>
<tr>
<td>Invoke selection dialog box</td>
<td>CTRL+ALT+P</td>
<td>F2 or DOWN ARROW</td>
<td>Field</td>
</tr>
<tr>
<td>Open the calendar control</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Open the calculator control</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Open a drop-down list</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
### Table 20. Record Navigation Keyboard Shortcuts
<table>
<thead>
<tr>
<th>Action</th>
<th>Basic Mode</th>
<th>Extended Mode</th>
<th>Context</th>
</tr>
</thead>
<tbody>
<tr>
<td>Drill down into record</td>
<td>CTRL+SHIFT+SPACE</td>
<td></td>
<td>List</td>
</tr>
<tr>
<td>(Cursor focus must be on the hyperlinked field.)</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Go to previous record</td>
<td>CTRL+SHIFT+. (comma)</td>
<td>CTRL+UP ARROW</td>
<td>List, form</td>
</tr>
<tr>
<td>Go to next record</td>
<td>CTRL+SHIFT+. (period)</td>
<td>CTRL+DOWN ARROW</td>
<td>List, form</td>
</tr>
<tr>
<td>Go to previous record set</td>
<td>CTRL+ALT+. (comma)</td>
<td>ALT+UP ARROW</td>
<td>List</td>
</tr>
<tr>
<td>Go to next record set</td>
<td>CTRL+ALT+. (period)</td>
<td>ALT+DOWN ARROW</td>
<td>List</td>
</tr>
<tr>
<td>Go to first record</td>
<td>CTRL+ALT+F</td>
<td>ALT+F</td>
<td>List, form</td>
</tr>
<tr>
<td>Go to last record</td>
<td>CTRL+ALT+L</td>
<td>ALT+L</td>
<td>List, form</td>
</tr>
</tbody>
</table>
Data Entry – Drag and Drop Attachments
# Data Entry – Tab Order

### Payee Quota
- Last Name:
- First Name:
- Territory:
- Sales Hierarchy:
- Description:
- Quota:
- Measure:
- Frequency:
- Cumulative:
- Quota Period:
- Start:
- End:
- Seasonality Skew:
### Target
- Initial:
- Factored:
- Rolled Up:
### Amount
### Quantity
### Status
- Status:
- Changed:
- Version:
- Roll Down:
### By
- Accepted:
- Approved:
- Revised:
### Date
Data Entry – Column Order and Width
Data Entry – Shortlist Lists of Values
Data Entry – Shuttle Applets
Data Entry – Pick Lists, Check Boxes, and Radio Buttons
Data Entry – Business Rules
Problem:
Too many business rules locking the system down (shouldn’t versus can’t)
Solutions:
1. Train managers to delegate administrative work to assistants and power users leveraging the Change Position feature.
2. Reconfigure security rules so that more people have the ability and mandate to view and update data.
3. Reconfigure using data validation to enforce field-level business rules.
4. Configure an audit trail to track updates rather than locking down the system.
5. Configure OBIEE exception reports to track and manage bad data.
Data Entry – Change Position
Data Entry – Security Rules
ABC Mart US East (SVP)
<table>
<thead>
<tr>
<th>Account Name</th>
<th>Site</th>
<th>Account Team</th>
<th>Main Phone</th>
<th>Main Fax</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<tr>
<td>ABC Mart US East (SVP)</td>
<td>Pequannock</td>
<td>CTRIPP</td>
<td>(908) 325-6701</td>
<td></td>
<td><a href="http://www.abcMart.com">www.abcMart.com</a></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Address</th>
<th>State</th>
<th>Country</th>
<th>Zip Code</th>
</tr>
</thead>
<tbody>
<tr>
<td>901 State Hwy 23</td>
<td>NJ</td>
<td>USA</td>
<td>07440</td>
</tr>
</tbody>
</table>
Contacts
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Mr/Ms</th>
<th>Job Title</th>
<th>Work Phone #</th>
<th>Work Fax #</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>David</td>
<td>Ard</td>
<td>Mr.</td>
<td></td>
<td>(908) 554-9439</td>
<td></td>
<td><a href="mailto:dard@abc.com">dard@abc.com</a></td>
</tr>
<tr>
<td>Lisa</td>
<td>Bamont</td>
<td>Mrs.</td>
<td></td>
<td>(908) 554-2282</td>
<td></td>
<td><a href="mailto:lbamont@abc.com">lbamont@abc.com</a></td>
</tr>
<tr>
<td>Sandy</td>
<td>Black</td>
<td>Ms.</td>
<td></td>
<td>(908) 554-8843</td>
<td></td>
<td><a href="mailto:sblack@abc.com">sblack@abc.com</a></td>
</tr>
<tr>
<td>Bill</td>
<td>Dowdall</td>
<td>Mr.</td>
<td></td>
<td>(908) 554-6999</td>
<td></td>
<td><a href="mailto:bdowdall@abc.com">bdowdall@abc.com</a></td>
</tr>
<tr>
<td>Gina</td>
<td>Lyng</td>
<td>Mrs.</td>
<td></td>
<td>(908) 554-6868</td>
<td></td>
<td><a href="mailto:glyn@abc.com">glyn@abc.com</a></td>
</tr>
</tbody>
</table>
### Data Entry – Data Validation

#### Validation Rule Set Details
<table>
<thead>
<tr>
<th>Sequence #</th>
<th>Name</th>
<th>Expression</th>
<th>Business Component</th>
<th>Apply To</th>
<th>Start Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Price list is Null.</td>
<td><code>[Price List] IS NOT NULL</code></td>
<td>Service Agreement</td>
<td>Current Record</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Account is Null.</td>
<td><code>[Account] IS NOT NULL</code></td>
<td>Service Agreement</td>
<td>Current Record</td>
<td></td>
</tr>
<tr>
<td>3</td>
<td>Agreement Start Date or End Date is Null.</td>
<td><code>(Agreement Start Date) IS NOT NULL AND ((Agreement End Date) IS NOT NULL) </code></td>
<td>Service Agreement</td>
<td>Current Record</td>
<td></td>
</tr>
<tr>
<td>4</td>
<td>Agreement End Date is before Agreement Start Date.</td>
<td><code>[Agreement End Date] > [Agreement Start Date]</code></td>
<td>Service Agreement</td>
<td>Current Record</td>
<td></td>
</tr>
<tr>
<td>5</td>
<td>Agreement Start Date is before Agreement Item End Date.</td>
<td><code>[Agreement Start Date] < [Agreement Start Date]</code></td>
<td>Service Agreement</td>
<td>Current Record</td>
<td></td>
</tr>
<tr>
<td>6</td>
<td>Agreement End Date is after Agreement Item Start Date.</td>
<td><code>[Agreement End Date] > [Agreement Item End Date]</code></td>
<td>Service Agreement</td>
<td>Current Record</td>
<td></td>
</tr>
<tr>
<td>7</td>
<td>Initial Quantity is less than Current Quantity.</td>
<td><code>[Initial Quota] < [Current Quota]</code></td>
<td>Agreement Entitlement</td>
<td>All Records</td>
<td></td>
</tr>
<tr>
<td>8</td>
<td>Entitlement Priority is less than zero.</td>
<td><code>[Entitlement Priority] < 0</code></td>
<td>Agreement Entitlement</td>
<td>All Records</td>
<td></td>
</tr>
<tr>
<td>9</td>
<td>Percent must be less than 100%.</td>
<td><code>If([(Unit) = Lookup(value(SERVICE_METRIC_UNIT, 'Percent'), [Value] <= 100, 'Y')]</code></td>
<td>Service Agreement Metric</td>
<td>All Records</td>
<td></td>
</tr>
</tbody>
</table>
**Actions**
- **Name:** Price list is Null.
- **Sequence #:** 1
- **Business Component:** Service Agreement
- **Expression:** `[Price List] IS NOT NULL
- **Return Code:** 101
- **Message:** Price list is Null.
Data Entry – Audit Trail
Data Entry – Exception Reports
Lift Analysis by PPG
YTD by PPG (compared with Year Ago Figures)
<table>
<thead>
<tr>
<th>Year</th>
<th>PPG</th>
<th>Total Sales</th>
<th>Total Sales YTD</th>
</tr>
</thead>
<tbody>
<tr>
<td>2000</td>
<td>Favourites 600g</td>
<td>$2,453,000</td>
<td>$3,453,000</td>
</tr>
<tr>
<td></td>
<td>Milled 250g Blocks</td>
<td>$103,210,000</td>
<td>$114,210,000</td>
</tr>
<tr>
<td></td>
<td>Milled 250g Old Gold</td>
<td>$25,210,000</td>
<td>$26,210,000</td>
</tr>
<tr>
<td></td>
<td>Parent Family Bags</td>
<td>$10,210,000</td>
<td>$11,210,000</td>
</tr>
<tr>
<td></td>
<td>Share Packs</td>
<td>$10,210,000</td>
<td>$11,210,000</td>
</tr>
<tr>
<td></td>
<td>2000 Total</td>
<td>$138,210,000</td>
<td>$150,210,000</td>
</tr>
</tbody>
</table>
Customer is equal to Woolworths
YTD by Month (compared with Year Ago Figures)
<table>
<thead>
<tr>
<th>Year</th>
<th>PPG</th>
<th>Month</th>
<th>Total Sales</th>
<th>Total Sales YTD</th>
</tr>
</thead>
<tbody>
<tr>
<td>2000</td>
<td>Favourites 600g</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>1</td>
<td>$154,000</td>
<td>$180,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>2</td>
<td>$175,000</td>
<td>$190,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>3</td>
<td>$195,000</td>
<td>$210,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>4</td>
<td>$215,000</td>
<td>$230,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>5</td>
<td>$235,000</td>
<td>$250,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>6</td>
<td>$255,000</td>
<td>$270,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>7</td>
<td>$275,000</td>
<td>$290,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>8</td>
<td>$295,000</td>
<td>$310,000</td>
</tr>
<tr>
<td></td>
<td></td>
<td>2000 Total</td>
<td>$4,850,000</td>
<td>$5,150,000</td>
</tr>
</tbody>
</table>
Customer is equal to Woolworths
Problem:
Too much data to enter
Solutions:
1. Train users on User Profile Preferences, Quick Fill Templates.
2. Reconfigure fields to be defaulted based on parent records or fields already entered in the current record, such as the record name field.
3. Raise the master data (accounts, products, LOVs) tracking level so that a higher level of data, and thus less data, is referenced.
4. Restructure master data hierarchies from being ERP-centric to sales, service, and marketing centric so that less time is spent navigating hierarchies to find data.
Data Entry – Quick Fill Templates
Data Entry – Defaulting Values
![Plan List with Plan Details]
**Plan List**
- **Status**: New
- **Name**: 2011 - ABC Mart West CSD Plan
- **Account**: ABC Mart US West (SVP)
- **Category**: CSD (SVP)
- **Period**: 2011
- **Team**: CTRIPP
**Preferred Payment Method Defaults**
- Fixed Slot Fee Pay Method: Bill Back
- Variable Spend Pay Method: Deduction
- Other Fixed Spend Pay Method: Check
# Data Entry – Master Data Level
<table>
<thead>
<tr>
<th>Category Name</th>
<th>Display Name</th>
<th>Effective Start Date</th>
<th>Effective End Date</th>
<th>Sequence</th>
<th>Usage</th>
<th>Private</th>
<th>Count</th>
</tr>
</thead>
<tbody>
<tr>
<td>DPSG (SVP)</td>
<td>DPSG (SVP)</td>
<td>4/23/2002 11:17:39</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>11</td>
</tr>
<tr>
<td>CSD (SVP)</td>
<td>CSD (SVP)</td>
<td>5/8/2000 10:52:15</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>15</td>
</tr>
<tr>
<td>CSD 12oz - 12pk (SVP)</td>
<td>CSD 12oz - 12pk (SVP)</td>
<td>5/8/2000 10:52:48</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>11</td>
</tr>
<tr>
<td>12oz 12pk - Dr. Pepper (SVP)</td>
<td>12oz 12pk - Dr. Pepper (SVP)</td>
<td>4/23/2002 11:20:44</td>
<td></td>
<td></td>
<td>✓</td>
<td>✓</td>
<td>7</td>
</tr>
<tr>
<td>CSD 2L (SVP)</td>
<td>CSD 2L (SVP)</td>
<td>8/19/2011 12:28:30</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>4</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Product</th>
<th>Thumbnail Image File Name</th>
<th>Effective Start Date</th>
<th>Effective End Date</th>
<th>Product Code</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>12oz 12pk - Dr. Pepper - Cherry (SVP)</td>
<td></td>
<td>1/1/1993</td>
<td>12/31/2015</td>
<td>000009</td>
<td>12 oz - 12 pk - Dr. Pepper - Cherry</td>
</tr>
<tr>
<td>12oz 12pk - Dr. Pepper - Diet (SVP)</td>
<td></td>
<td>1/1/1998</td>
<td>12/31/2015</td>
<td>000005</td>
<td>12 oz - 12 pk - Dr. Pepper - Diet</td>
</tr>
<tr>
<td>12oz 12pk - Dr. Pepper - Vanilla (SVP)</td>
<td></td>
<td>1/1/1993</td>
<td>12/31/2015</td>
<td>000013</td>
<td>12 oz - 12 pk Dr. Pepper - Vanilla</td>
</tr>
</tbody>
</table>
Data Entry – Master Data Hierarchies
### Promoted Categories SKU's
<table>
<thead>
<tr>
<th>Status</th>
<th>Name</th>
<th>Category</th>
<th>Start Week</th>
<th>Duration</th>
<th>TPR %</th>
<th>Catalog Tactics</th>
<th>Display Tactic</th>
<th>Fixed Fee</th>
<th>Lifelift</th>
</tr>
</thead>
<tbody>
<tr>
<td>New</td>
<td>New 7Up Promotion</td>
<td>CSD 12oz - 12pk (SVP)</td>
<td>1</td>
<td>2</td>
<td>4</td>
<td>10%</td>
<td></td>
<td>$0.00</td>
<td>10</td>
</tr>
<tr>
<td>New</td>
<td>12oz 12pk Dr. Pepper Rev</td>
<td>CSD 12oz - 12pk (SVP)</td>
<td>5</td>
<td>2</td>
<td>8</td>
<td>10% Front Page Shelf</td>
<td>$0.00</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>New</td>
<td>Everything in Week 1</td>
<td>CSD 12oz - 12pk (SVP)</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td></td>
<td></td>
<td>$0.00</td>
<td></td>
</tr>
</tbody>
</table>
### Promoted Categories
<table>
<thead>
<tr>
<th>Category</th>
<th>TPR%</th>
<th>Catalog Tactics</th>
<th>Display Tactic</th>
<th>Fixed Fee</th>
<th>Bill Back Rate</th>
<th>Off Invoice Rate</th>
<th>Tot Spend</th>
<th>Base Vol</th>
<th>Incr Vol</th>
<th>Total Vol</th>
<th>Fixed Fee</th>
<th>Bill Back Spend Of</th>
</tr>
</thead>
<tbody>
<tr>
<td>12oz 12pk - Dr. Pepper (SVP)</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>1,108</td>
<td>0</td>
<td>1,108</td>
<td>$0.00</td>
<td>$0.00</td>
</tr>
<tr>
<td>12oz 12pk - 7UP (SVP)</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>1,108</td>
<td>0</td>
<td>1,108</td>
<td>$0.00</td>
<td>$0.00</td>
</tr>
<tr>
<td>12oz 12pk - A&W (SVP)</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>$0.00</td>
<td>0</td>
<td>$0.00</td>
<td>$0.00</td>
<td></td>
</tr>
</tbody>
</table>
### Promoted Products
<table>
<thead>
<tr>
<th>Product Description</th>
<th>Base Vol</th>
<th>Incr Vol</th>
<th>Total Vol</th>
<th>Fixed Fee</th>
<th>Bill Back Rate</th>
<th>Bill Back Spend Of</th>
</tr>
</thead>
<tbody>
<tr>
<td>12oz 12pk - Dr. Pepper - Cherry (SVP)</td>
<td>1,108</td>
<td>0</td>
<td>1,108</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
</tr>
<tr>
<td>12oz 12pk - Dr. Pepper - Diet (SVP)</td>
<td>1,108</td>
<td>0</td>
<td>1,108</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
</tr>
<tr>
<td>12oz 12pk - Dr. Pepper - Vanilla (SVP)</td>
<td>1,083</td>
<td>0</td>
<td>1,083</td>
<td>$0.00</td>
<td>$0.00</td>
<td>$0.00</td>
</tr>
<tr>
<td></td>
<td>3,299</td>
<td>0</td>
<td>3,299</td>
<td>$0.00</td>
<td>$0.00</td>
<td></td>
</tr>
</tbody>
</table>
User Interface
User Interface – Fresh Look
Problem:
Siebel UI looks old and outdated
Solution:
1. Embed Google Maps or Web Excel.
2. Add or enlarge icons.
3. Change font types, color, and sizes.
User Interface – Map Integration
User Interface – Icons
Welcome to Siebel Pharma Sean Phillips!
Today is Friday, May 09, 2008.
Your Team Territory Rating is 36/40. Please continue to work with your team to achieve maximum exposure against your call plan.
Your goal is 85%. **Well done!**
* You are currently working in **Daily** mode. Click here to work in **Admin** mode.
My KPIs - Quarter to Date
<table>
<thead>
<tr>
<th>Call Days to Qtr Close</th>
<th>Call Execution to Plan</th>
<th>Unsubmitted Calls</th>
<th>Current Sample Inventory Level</th>
<th>Team Performance</th>
</tr>
</thead>
<tbody>
<tr>
<td>28</td>
<td>44%</td>
<td>9</td>
<td>Acceptable (68%)</td>
<td><strong>⭐⭐⭐⭐⭐</strong></td>
</tr>
</tbody>
</table>
May 05 - May 11
<table>
<thead>
<tr>
<th>Monday, May 06</th>
<th>12:00 AM</th>
<th>12:00 AM</th>
<th>Taking the "Trends in Cardiology" session</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>9:30 AM</td>
<td>10:00 AM</td>
<td>Svaiten Zuberi</td>
</tr>
<tr>
<td></td>
<td>11:00 AM</td>
<td>11:30 AM</td>
<td>Mont Anani</td>
</tr>
<tr>
<td>Tuesday, May 06</td>
<td>9:00 AM</td>
<td>9:30 AM</td>
<td>Rita Herrera</td>
</tr>
<tr>
<td></td>
<td>12:00 PM</td>
<td>1:30 PM</td>
<td>Lunch & Learn, Diabetes Treatment Pathways</td>
</tr>
<tr>
<td></td>
<td>2:30 PM</td>
<td>3:00 PM</td>
<td>Lisa Dachowitz</td>
</tr>
<tr>
<td>Wednesday, May 07</td>
<td>9:30 AM</td>
<td>10:00 AM</td>
<td>Ponnella Clinic</td>
</tr>
<tr>
<td></td>
<td>1:30 PM</td>
<td>2:00 PM</td>
<td>Svaiten Zuberi</td>
</tr>
<tr>
<td></td>
<td>3:00 PM</td>
<td>3:30 PM</td>
<td>Vidal Moorefield</td>
</tr>
<tr>
<td>Thursday, May 08</td>
<td>10:00 AM</td>
<td>10:30 AM</td>
<td>Avesta Village Hospital</td>
</tr>
<tr>
<td></td>
<td>3:30 PM</td>
<td>4:00 PM</td>
<td>Michael De la Cruz</td>
</tr>
<tr>
<td></td>
<td>4:30 PM</td>
<td>5:00 PM</td>
<td>Rajat Gupta</td>
</tr>
</tbody>
</table>
Flash Alert
Key Messaging for Today
**Territory Update - Sean Phillips**
You have 3 new Professionals in your territory. Please map them to their appropriate routes and update your call plan.
**Tip of the Day:**
Update Your Time Off Territory Today.
* Click on the Admin Link link.
* Drill in on ‘Time Off Territory’
* Create a new record
My Objectives
User Interface – Fonts
Welcome Back Mike Carlson!
Today is Thursday, March 29, 2007.
**Recommended Items**
**PCS 4700C**
Enhanced Performance, Small Design. Save space without sacrificing power. Over 60% smaller! Click Here to Register for a Free 4700C!
**PCS 6700 Wi-Fi Network Printer**
<table>
<thead>
<tr>
<th>Last Item Added:</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Line Items:</strong></td>
</tr>
<tr>
<td>View Details</td>
</tr>
</tbody>
</table>
**Quick Add**
Complete one of the two fields below and click Add Item
- **Item Name:**
- **Item Code:**
Add Item
User Interface – Color Coding
<table>
<thead>
<tr>
<th>SR #</th>
<th>Summary</th>
<th>Account</th>
<th>Customer Refere</th>
<th>Last Name</th>
<th>Status</th>
<th>Owner</th>
</tr>
</thead>
<tbody>
<tr>
<td>1-40ZL</td>
<td></td>
<td>Atherton Group</td>
<td>Agee</td>
<td>Closed</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-365121</td>
<td></td>
<td>Agee</td>
<td></td>
<td>Closed</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-643937</td>
<td>Change of address</td>
<td>Atherton Group</td>
<td>Agee</td>
<td>Open</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-657125</td>
<td></td>
<td>1-643937</td>
<td>Abby</td>
<td>Open</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-660972</td>
<td></td>
<td>Abby</td>
<td></td>
<td>Open</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-680982</td>
<td></td>
<td>Abby</td>
<td></td>
<td>Open</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-698490</td>
<td></td>
<td>GH-105</td>
<td>Judd</td>
<td>Closed</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-600043</td>
<td></td>
<td></td>
<td></td>
<td>Open</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-914801</td>
<td></td>
<td>Atherton Group</td>
<td>Agee</td>
<td>Open</td>
<td></td>
<td>SADMIN</td>
</tr>
<tr>
<td>1-48961</td>
<td></td>
<td>Aaron-Jones Dry Cl</td>
<td>Aarons</td>
<td>Closed</td>
<td></td>
<td>SADMIN</td>
</tr>
</tbody>
</table>
**SR Information**
- **SR #**: 1-643937
- **Last Name**: Agee
- **First Name**: Paul
- **Account**: Atherton Group
**Status and Ownership**
- **Status**: Open
- **Owner**: SADMIN
**Summary**
- **Opened**: 7/7/2000 9:19:39 AM
User Interface – Alternative UIs
Problem:
Users want a new or different UI
Solutions:
1. A handheld client for Microsoft Windows devices can now be extended with C++ scripting and COM integration.
2. Adobe and Google Gadgets enables users convenient access to data in Siebel.
3. CRM Desktop enables users to use Microsoft Outlook as their UI for Siebel.
4. Web services and REST API-enabled objects enable new UIs to be easily built using tools such as Microsoft Silverlight and Adobe Flex.
5. SonGo is Siebel’s new Adobe Flex-based mobile client specifically designed for tablets.
6. *iSales, Oracle’s new mobile platform, will leverage iPad/iPhone, Blackberry, and Android native app technology to access in disconnected mode.
7. *Open UI will leverage Jquery/Jscript technology to enable users access with any browser using a modern and fully flexible and extensible framework.
* Denotes not generally available as of October 27, 2011.
User Interface – Handheld
User Interface - Gadgets
User Interface – CRM Desktop (Outlook)
User Interface – REST API
User Interface – SonGo (Adobe Flex)
User Interface – iSales (iPad)
User Interface – Open UI Prototype
Left Navigation Menu
User Interface – Open UI Prototype
Top Navigation Menu
<table>
<thead>
<tr>
<th>Feature</th>
<th>Remote</th>
<th>Smart Phone</th>
<th>Tablet</th>
<th>MS Windows</th>
<th>Apple iPad/iPhone</th>
<th>Blackberry/Android</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>HH</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td>Now extensible with C++/COM integration</td>
</tr>
<tr>
<td>Open UI</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Currently Apple/iPad compatible New Jquery/Jscript UI framework coming soon</td>
</tr>
<tr>
<td>OBIEE</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Now 11g with geospatial mapping</td>
</tr>
<tr>
<td>Gadgets</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Adobe and Google mini UI</td>
</tr>
<tr>
<td>CRM Desktop</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td>New Outlook UI</td>
</tr>
<tr>
<td>Web Services and REST APIs</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Can leverage Adobe Flex or Microsoft Silverlight</td>
</tr>
<tr>
<td>SonGo</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td></td>
<td></td>
<td>Requires Adobe Flash</td>
</tr>
<tr>
<td>iSales</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>New disconnected mobile client coming soon</td>
</tr>
<tr>
<td>Oracle Fusion</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>New enterprise application platform coming soon</td>
</tr>
</tbody>
</table>
Oracle Business Intelligence
Business Intelligence
• **BI Publisher** for ad hoc pixel perfect reports that combine data from Siebel and external sources that do not require the involvement of IT
• **OBIEE real-time federated reports**, write-back capabilities, and geo-spatial reports
• **OBIEE embedded analytics** for what-if scenario planning and ad hoc reporting
• **OBIEE geospatial mapping** to capture and display geography specific data
• **Real-time decisions** to enable users to intelligently determine the best offer to present to customers in real-time
• **Segmentation Manager** to enable analysts to create balanced logic, as well as "interesting" segments that marketing managers can leverage in their marketing campaigns
Business Intelligence – Geospatial Mapping
Siebel Add-on Modules
Horizontal Modules
- **Correspondence** to automatically mail merge and email documents to multiple recipients
- **Presentations** to automatically generate and manage multisection presentations
- **Forecasting** for discrete opportunity or time series volume forecasting
- **Product Configurator** to dynamically guide users to appropriate product combinations
- **Price Configurator** to dynamically determine pricing
- **Contracts** for sales and service agreements, including tiered maintenance and repair offerings, usage-based offerings, rentals, and leases
- **Solutions** to intelligently direct users to the right solutions
- **eMail Response** for parsing incoming emails
- **SmartScript** to enable business users to create branching logic questionnaires
- **Assessments** to enable business users to create answer-constrained questionnaires
- **Marketing Campaigns** to plan, create, test, deploy, and analyze personalized and permission based multichannel campaigns
- **Marketing Resources Management** to manage marketing funds and activities
- **Loyalty Management** track and manage loyalty points
- **Partner Relationship Manager** to delegate user administration to partners’ administrators
- **Secured Enterprise Search** to intelligently search for structured and unstructured data
Industry Modules
• **Personal Content Delivery** to enables marketing managers to compile interactive multimedia presentations and field sales representatives to deliver them on touchpad devices
• **Territory Management** to automatically manage sales territories based on a set of flexible and configurable rules
• **Trade Promotion Management** for promotions, claims, and rebate management
• **Trade Funds Management** to manage trade, partner, customer, or other types of funds
• **Sales Volume Planning** for time series volume planning
• **eBilling** for electronic presentations of customer bills
• **Events Management** for managing a wide range of events such as seminars, product demonstrations, trade shows, conferences, webinars, and sporting events
• **Group Sales Management** to manage the planning and booking of group sales
• **Warranty Management** to handle warranty claims
Oracle Ecosystem
Oracle Ecosystem – Add-on Applications
• **ATG**, the leading eCommerce software for retailers, has a superior user experience for customers to enter orders, as well as sophisticated up-sell and cross-sell functionality.
• **Policy Automation** enables business rules to be developed and managed by the business rather than by IT, using a natural language business rules engine in a familiar tool such as Microsoft Word.
• **Data Quality Management** validates addresses and postal codes and intelligently checks for duplicates using phonetic matching.
• **UPK** enables self-paced end-user training, either in line during regular use, or off line with easy-to-create interactive training sessions.
• **Crystal Ball** enables users to run through multiple deal scenarios to determine the optimum deal to strive for, with consideration of possible parameter constraints.
• **Deal Management** enables users to determine the ideal deal to offer a customer based on the company’s deal history.
• **Demantra** Predictive Planning predicts sales volumes based on sales history, market trends, and causal factors.
• **Master Data Management and Dimension Relationship Management** enables companies to smoothly integrate their master data with multiple systems and manage multiple hierarchies that change frequently.
• **Real-time Scheduler** optimizes the scheduling of resources based on a myriad of possible parameters and conditions.
• **WebCenter Content** to manage content across the enterprise.
• **InQuira** for intelligent searching and displaying of unstructured data.
• **Oracle Fusion** for Oracle’s new open standards-based enterprise software platform.
User Productivity Kit (UPK)
Single Authoring – Multiple Deployments
Author Once
Interact
- See It – Recorded Demos
- Try It – Interactive Simulations
- Do It – Context-Sensitive Help
Publish
- Word - Requirement Docs and Test Scripts
- PDF - User Manuals and Job Aids
- PPT - Instructor Training
- HTML - Websites
Integrate
- Testing Tools
- Learning Management Systems
Context-Sensitive Help
Oracle Fusion
Questions?
To request
a copy of this presentation,
a recording of this webcast,
more information about material covered in this webinar,
or to have a complimentary usability workshop conducted for your implementation,
please contact your Oracle CRM sales representative or Matt.Wenzel@Oracle.com.
|
{"Source-Url": "http://www.oracle.com/webfolder/ux/applications/uxd/assets/practices/siebel-usability-best-practice.pdf", "len_cl100k_base": 13554, "olmocr-version": "0.1.49", "pdf-total-pages": 97, "total-fallback-pages": 0, "total-input-tokens": 123864, "total-output-tokens": 15062, "length": "2e13", "weborganizer": {"__label__adult": 0.0005688667297363281, "__label__art_design": 0.002277374267578125, "__label__crime_law": 0.0003826618194580078, "__label__education_jobs": 0.01119232177734375, "__label__entertainment": 0.0004241466522216797, "__label__fashion_beauty": 0.0002892017364501953, "__label__finance_business": 0.032012939453125, "__label__food_dining": 0.000568389892578125, "__label__games": 0.0017900466918945312, "__label__hardware": 0.00206756591796875, "__label__health": 0.0004417896270751953, "__label__history": 0.0004575252532958984, "__label__home_hobbies": 0.0003659725189208984, "__label__industrial": 0.0010557174682617188, "__label__literature": 0.0004258155822753906, "__label__politics": 0.00023424625396728516, "__label__religion": 0.00047087669372558594, "__label__science_tech": 0.01026153564453125, "__label__social_life": 0.00016510486602783203, "__label__software": 0.26025390625, "__label__software_dev": 0.6728515625, "__label__sports_fitness": 0.0004544258117675781, "__label__transportation": 0.0005431175231933594, "__label__travel": 0.0005016326904296875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 44819, 0.06711]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 44819, 0.01906]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 44819, 0.75085]], "google_gemma-3-12b-it_contains_pii": [[0, 129, false], [129, 568, null], [568, 814, null], [814, 1175, null], [1175, 1835, null], [1835, 2309, null], [2309, 2682, null], [2682, 2704, null], [2704, 2704, null], [2704, 2726, null], [2726, 3276, null], [3276, 3302, null], [3302, 3339, null], [3339, 3363, null], [3363, 3435, null], [3435, 4177, null], [4177, 4201, null], [4201, 4225, null], [4225, 4256, null], [4256, 5232, null], [5232, 5251, null], [5251, 6293, null], [6293, 6605, null], [6605, 6621, null], [6621, 7188, null], [7188, 7225, null], [7225, 7255, null], [7255, 11421, null], [11421, 12969, null], [12969, 13006, null], [13006, 13044, null], [13044, 13070, null], [13070, 13107, null], [13107, 13125, null], [13125, 13629, null], [13629, 13657, null], [13657, 13684, null], [13684, 13759, null], [13759, 14636, null], [14636, 14661, null], [14661, 14693, null], [14693, 14723, null], [14723, 14744, null], [14744, 14772, null], [14772, 16088, null], [16088, 16114, null], [16114, 16155, null], [16155, 16184, null], [16184, 16865, null], [16865, 16889, null], [16889, 16915, null], [16915, 19401, null], [19401, 19440, null], [19440, 19866, null], [19866, 19902, null], [19902, 19941, null], [19941, 19970, null], [19970, 20026, null], [20026, 20598, null], [20598, 20627, null], [20627, 21812, null], [21812, 24054, null], [24054, 24079, null], [24079, 25629, null], [25629, 26182, null], [26182, 26216, null], [26216, 26613, null], [26613, 29117, null], [29117, 31690, null], [31690, 31705, null], [31705, 31910, null], [31910, 31943, null], [31943, 34161, null], [34161, 34669, null], [34669, 36157, null], [36157, 37099, null], [37099, 37125, null], [37125, 37150, null], [37150, 37189, null], [37189, 37215, null], [37215, 37251, null], [37251, 37282, null], [37282, 37339, null], [37339, 37395, null], [37395, 39412, null], [39412, 39441, null], [39441, 40157, null], [40157, 40200, null], [40200, 40222, null], [40222, 41525, null], [41525, 42419, null], [42419, 42436, null], [42436, 44110, null], [44110, 44485, null], [44485, 44508, null], [44508, 44522, null], [44522, 44819, null]], "google_gemma-3-12b-it_is_public_document": [[0, 129, true], [129, 568, null], [568, 814, null], [814, 1175, null], [1175, 1835, null], [1835, 2309, null], [2309, 2682, null], [2682, 2704, null], [2704, 2704, null], [2704, 2726, null], [2726, 3276, null], [3276, 3302, null], [3302, 3339, null], [3339, 3363, null], [3363, 3435, null], [3435, 4177, null], [4177, 4201, null], [4201, 4225, null], [4225, 4256, null], [4256, 5232, null], [5232, 5251, null], [5251, 6293, null], [6293, 6605, null], [6605, 6621, null], [6621, 7188, null], [7188, 7225, null], [7225, 7255, null], [7255, 11421, null], [11421, 12969, null], [12969, 13006, null], [13006, 13044, null], [13044, 13070, null], [13070, 13107, null], [13107, 13125, null], [13125, 13629, null], [13629, 13657, null], [13657, 13684, null], [13684, 13759, null], [13759, 14636, null], [14636, 14661, null], [14661, 14693, null], [14693, 14723, null], [14723, 14744, null], [14744, 14772, null], [14772, 16088, null], [16088, 16114, null], [16114, 16155, null], [16155, 16184, null], [16184, 16865, null], [16865, 16889, null], [16889, 16915, null], [16915, 19401, null], [19401, 19440, null], [19440, 19866, null], [19866, 19902, null], [19902, 19941, null], [19941, 19970, null], [19970, 20026, null], [20026, 20598, null], [20598, 20627, null], [20627, 21812, null], [21812, 24054, null], [24054, 24079, null], [24079, 25629, null], [25629, 26182, null], [26182, 26216, null], [26216, 26613, null], [26613, 29117, null], [29117, 31690, null], [31690, 31705, null], [31705, 31910, null], [31910, 31943, null], [31943, 34161, null], [34161, 34669, null], [34669, 36157, null], [36157, 37099, null], [37099, 37125, null], [37125, 37150, null], [37150, 37189, null], [37189, 37215, null], [37215, 37251, null], [37251, 37282, null], [37282, 37339, null], [37339, 37395, null], [37395, 39412, null], [39412, 39441, null], [39441, 40157, null], [40157, 40200, null], [40200, 40222, null], [40222, 41525, null], [41525, 42419, null], [42419, 42436, null], [42436, 44110, null], [44110, 44485, null], [44485, 44508, null], [44508, 44522, null], [44522, 44819, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 44819, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 44819, null]], "pdf_page_numbers": [[0, 129, 1], [129, 568, 2], [568, 814, 3], [814, 1175, 4], [1175, 1835, 5], [1835, 2309, 6], [2309, 2682, 7], [2682, 2704, 8], [2704, 2704, 9], [2704, 2726, 10], [2726, 3276, 11], [3276, 3302, 12], [3302, 3339, 13], [3339, 3363, 14], [3363, 3435, 15], [3435, 4177, 16], [4177, 4201, 17], [4201, 4225, 18], [4225, 4256, 19], [4256, 5232, 20], [5232, 5251, 21], [5251, 6293, 22], [6293, 6605, 23], [6605, 6621, 24], [6621, 7188, 25], [7188, 7225, 26], [7225, 7255, 27], [7255, 11421, 28], [11421, 12969, 29], [12969, 13006, 30], [13006, 13044, 31], [13044, 13070, 32], [13070, 13107, 33], [13107, 13125, 34], [13125, 13629, 35], [13629, 13657, 36], [13657, 13684, 37], [13684, 13759, 38], [13759, 14636, 39], [14636, 14661, 40], [14661, 14693, 41], [14693, 14723, 42], [14723, 14744, 43], [14744, 14772, 44], [14772, 16088, 45], [16088, 16114, 46], [16114, 16155, 47], [16155, 16184, 48], [16184, 16865, 49], [16865, 16889, 50], [16889, 16915, 51], [16915, 19401, 52], [19401, 19440, 53], [19440, 19866, 54], [19866, 19902, 55], [19902, 19941, 56], [19941, 19970, 57], [19970, 20026, 58], [20026, 20598, 59], [20598, 20627, 60], [20627, 21812, 61], [21812, 24054, 62], [24054, 24079, 63], [24079, 25629, 64], [25629, 26182, 65], [26182, 26216, 66], [26216, 26613, 67], [26613, 29117, 68], [29117, 31690, 69], [31690, 31705, 70], [31705, 31910, 71], [31910, 31943, 72], [31943, 34161, 73], [34161, 34669, 74], [34669, 36157, 75], [36157, 37099, 76], [37099, 37125, 77], [37125, 37150, 78], [37150, 37189, 79], [37189, 37215, 80], [37215, 37251, 81], [37251, 37282, 82], [37282, 37339, 83], [37339, 37395, 84], [37395, 39412, 85], [39412, 39441, 86], [39441, 40157, 87], [40157, 40200, 88], [40200, 40222, 89], [40222, 41525, 90], [41525, 42419, 91], [42419, 42436, 92], [42436, 44110, 93], [44110, 44485, 94], [44485, 44508, 95], [44508, 44522, 96], [44522, 44819, 97]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 44819, 0.23586]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
10c722accdc4d280dc399a771c9c5c5e70b061a2
|
[REMOVED]
|
{"Source-Url": "https://hal-lirmm.ccsd.cnrs.fr/lirmm-01374249/document", "len_cl100k_base": 9457, "olmocr-version": "0.1.49", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 58216, "total-output-tokens": 11239, "length": "2e13", "weborganizer": {"__label__adult": 0.0004193782806396485, "__label__art_design": 0.0006256103515625, "__label__crime_law": 0.0003094673156738281, "__label__education_jobs": 0.00049591064453125, "__label__entertainment": 5.9604644775390625e-05, "__label__fashion_beauty": 0.00015425682067871094, "__label__finance_business": 0.00013566017150878906, "__label__food_dining": 0.00031304359436035156, "__label__games": 0.0005393028259277344, "__label__hardware": 0.0005145072937011719, "__label__health": 0.00033545494079589844, "__label__history": 0.0002186298370361328, "__label__home_hobbies": 5.340576171875e-05, "__label__industrial": 0.0002532005310058594, "__label__literature": 0.00029397010803222656, "__label__politics": 0.00024247169494628904, "__label__religion": 0.0004742145538330078, "__label__science_tech": 0.0050201416015625, "__label__social_life": 6.490945816040039e-05, "__label__software": 0.0038394927978515625, "__label__software_dev": 0.98486328125, "__label__sports_fitness": 0.0002720355987548828, "__label__transportation": 0.0003509521484375, "__label__travel": 0.0001984834671020508}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48720, 0.04854]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48720, 0.45424]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48720, 0.90707]], "google_gemma-3-12b-it_contains_pii": [[0, 573, false], [573, 3139, null], [3139, 6598, null], [6598, 10130, null], [10130, 13471, null], [13471, 15435, null], [15435, 18364, null], [18364, 21844, null], [21844, 23738, null], [23738, 26889, null], [26889, 29284, null], [29284, 32000, null], [32000, 35512, null], [35512, 38672, null], [38672, 42162, null], [42162, 45506, null], [45506, 48720, null]], "google_gemma-3-12b-it_is_public_document": [[0, 573, true], [573, 3139, null], [3139, 6598, null], [6598, 10130, null], [10130, 13471, null], [13471, 15435, null], [15435, 18364, null], [18364, 21844, null], [21844, 23738, null], [23738, 26889, null], [26889, 29284, null], [29284, 32000, null], [32000, 35512, null], [35512, 38672, null], [38672, 42162, null], [42162, 45506, null], [45506, 48720, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48720, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48720, null]], "pdf_page_numbers": [[0, 573, 1], [573, 3139, 2], [3139, 6598, 3], [6598, 10130, 4], [10130, 13471, 5], [13471, 15435, 6], [15435, 18364, 7], [18364, 21844, 8], [21844, 23738, 9], [23738, 26889, 10], [26889, 29284, 11], [29284, 32000, 12], [32000, 35512, 13], [35512, 38672, 14], [38672, 42162, 15], [42162, 45506, 16], [45506, 48720, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48720, 0.29412]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
ff0c1d755c6226febc567a2d0157dc11e900c019
|
eAUDIT: Designing a generic tool to review entitlements
Francois Begin
Abstract
In a perfect world, identity and access management would be handled in a fully automated way. On their first day of work, new employees would receive all the required access to the systems they need in order to perform their job function. Over time, as their roles within the company evolved, these entitlements would be automatically adjusted. Unfortunately, we do not live in a perfect world. Access to systems is often cumulative, with employees keeping access they no longer require. This in turn poses a risk to the enterprise: unneeded access can lead to abuses and increases the possibility of data leakage if an employee is social engineered. This paper proposes a system to help address this problem: eAUDIT is a custom-built, generic entitlement review system that can simplify the task of reviewing user entitlements. eAUDIT is well suited to cases where no such tool exists in an enterprise, but can also complement an identity management system that does not fully cover all systems and applications. This paper covers the design of eAUDIT as well as an overview of its implementation, including sample code.
Доверяй, но проверяй
*Trust, but verify*
Russian proverb
Special thanks to my A-Team of coders, Kobe Lin and Jaya Balasubramaniam, who made eAUDIT happen.
1. Introduction
When a new employee joins a company, he should be automatically provided an identity within this company as well as various methods to authenticate himself. These authentication methods can take various forms: a physical access badge, a centrally-managed username and password, a virtual smart card carrying a cryptographically signed certificate, etc. Once an identity has been established for the new employee, this identity should be automatically associated with all the access entitlements he requires to perform his job functions. From that point on, as the employee progresses in his career, it is fairly likely that he will change teams, roles and positions. At every such milestone, his entitlements should be automatically re-adjusted, ensuring that he always has the access he requires. This will ensure that the employee’s access is limited to the resources he requires, a key element of a good authorization policy (Ballad, Ballad, and Banks, 2010).
This, of course, is an idealized description of Identity and Access Management (IAM), which is of great value to any enterprise. But IAM can be challenging. As Mather, Kumaraswamy and Latif (2009) aptly pointed out, “Many of these [IAM] initiatives are entered into with high expectations, which is not surprising given that the problem is often large and complex.”
This is particularly true for organizations that have grown through mergers and acquisition, as well as for organizations that have existed for decades and rely on legacy systems. Building IAM hooks (if that is even an option) into these systems can be costly or complicated. Sometimes, the best approach is to retain existing entitlements and address any access management gaps by conducting regular reviews of these entitlements to prune the ones that are no longer required.
Building a system that can conduct regular entitlement reviews is in itself a significant project, best handled by following a software development life cycle model. As part of the pre-development activities, one element of the discussion will invariably touch upon whether to develop the software functions in-house, outsource them, get an off-the-shelf package, or adapt and reuse exiting software (Saleh, 2009). While there are commercial products that can help conduct reviews of entitlements, these tools are often
François Bégin, francois.begin@telus.com
tied to large, costly products related to both IAM and Governance, Risk and Compliance (GRC) management. This paper chooses the first path: a custom-built solution. The main argument in favor of this choice is that, with a suitably clear scope, such a tool can be built and deployed at limited cost and provide a quick and significant benefit to an enterprise that does not have this capability. The tool presented here is called eAUDIT and can achieve a simple goal of providing a custom-made solution for entitlement review. The scope, design and high-level implementation of this tool are covered in this paper.
2. eAUDIT
2.1. Defining the elements of an entitlement audit
Prior to diving into the main topic, some of the key words that will be used throughout this paper need to be clearly defined.
In this paper, an entitlement refers to a privilege that has been granted to a user. Typical examples of entitlements include authorization to access a particular software application/data source, privileged access to a system or application, etc. Note that entitlements are granular: if a specific system has different levels of access, e.g. read access vs. read/write access, each of these count as a separate entitlement. The goal of an audit is to determine whether or not the entitlement is still valid.
An authorizer is defined as the person (or persons) who can grant someone a specific entitlement. In many organizations, managers often take on that role for their direct reports. This is supported by the fact that managers are well positioned to assess the business needs related to this type of access. Security professionals who may wish for more access control enforcements should be reminded that “Business will always trump security […]” (Kadrich, 2007). With that said, a manager is not always the main authorizer, as some systems have a specific business owner who plays that role.
Entitlements are granted to entities. In most cases, an entity will simply be an employee of the company, but since the goal of eAUDIT it to create a system that is purely generic, the word ‘entity’ is used instead. For instance, an audit could be conducted against physical access cards that are not associated directly to a user e.g.
generic access cards for escorted access that are left in the care of the security guard desk. These cards are a good example of a business need (convenience of being able to provide quick access to vendors on support calls) that outweighs security concerns (difficulty in associating a specific user to these cards).
One of the key elements of eAUDIT is its generic nature. Entities can be anything and the various characteristics that these entities possess can also be anything. In the previous example, badge entities can have attributes such as: Badge ID, Badge Label, Manager (if applicable), Badge Type, Expiry Date, etc., as shown in Table 1.
<p>| | | | |</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Primary attributes</strong></td>
<td><strong>Secondary attributes</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Badge ID</td>
<td>Manager (if applicable)</td>
<td>Badge Type</td>
<td>Expiry date</td>
</tr>
<tr>
<td>1000000</td>
<td>Penny Robinson, John Robinson</td>
<td>Employee badge</td>
<td>2020-01-01</td>
</tr>
<tr>
<td>1000001</td>
<td>Guard Desk</td>
<td>Generic cards</td>
<td>2015-12-31</td>
</tr>
</tbody>
</table>
Table 1. Mockup data for an audit of physical access badges.
In another example such as Table 2, where entities are defined as employees, the attributes of these employees would be different: Employee ID, First Name, Last Name, Title, Computer ID, City, etc.
<p>| | | | | |</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Primary attributes</strong></td>
<td><strong>Secondary attributes</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Employee ID</td>
<td>First Name</td>
<td>Last Name</td>
<td>Title</td>
<td>Computer ID</td>
</tr>
<tr>
<td>200002</td>
<td>Don West</td>
<td>Pilot</td>
<td>LX73-26</td>
<td>Toronto</td>
</tr>
<tr>
<td>200003</td>
<td>Judy Robinson</td>
<td>Zoologist</td>
<td>LD04-34</td>
<td>Edmonton</td>
</tr>
</tbody>
</table>
Table 2. Mockup data for an audit of employee.
eAUDIT users are those individuals responsible to conduct audits based on any type of entities and/or attributes. Giving eAUDIT users the ability to define their own attributes to meet their needs is crucial. In eAUDIT, entity attributes are therefore referred to as user-defined entity attributes (UEDA). Furthermore, a distinction is made between primary attributes and secondary attributes. Primary attributes are those attributes that normally suffice to an authorizer for an entitlement review. Secondary attributes contain extra information that an authorizer may need to consult to make a final
determination. How these attributes are presented to authorizers will prove important when discussing the creation of the web interface for the audit engine.
### 2.2. Scope
Since eAUDIT is a custom-built design and implementation project, one of the most important aspects of this project is to provide a clear scope. This will avoid *scope creep*, which is one of the top five reasons why a project can fail (Doraiswamy and Shiv, 2012).
The main elements of eAUDIT’s scope are:
- Import generic data by relying on user-defined entity attributes.
- Present a simple landing page to authorizers, showing them active audits that need their attention.
- Present a simple entitlement review page where all entities are listed in a sortable/filterable data table. The data table will show the primary entity attributes (always) and secondary attributes (on demand) to the authorizer.
- Conduct entitlement review based on binary responses (confirm | revoke) through a single click for each entity.
- Support for multiple authorizers for any given entitlement.
- Ability to group similar entitlements together.
The last point is important to clarify: in eAUDIT, a given audit can cover more than one entitlement, provided that all entities have the same attributes. For example, consider Table 3, a mockup of the entitlement review page presented to an authorizer:
François Bégin, francois.begin@telus.com
Table 3. Mockup of an entitlement review page as presented to an authorizer.
<table>
<thead>
<tr>
<th>Badge ID</th>
<th>Badge Label</th>
<th>Entitlement</th>
<th>Verify</th>
</tr>
</thead>
<tbody>
<tr>
<td>1000000</td>
<td>Penny Robinson</td>
<td><em>R</em> Main Data Center</td>
<td>Review</td>
</tr>
<tr>
<td>1000001</td>
<td>Guard Desk</td>
<td><em>R</em> Main Data Center</td>
<td>Review</td>
</tr>
<tr>
<td>1000002</td>
<td>Maj. Don West</td>
<td><em>R</em> DR Site</td>
<td>Review</td>
</tr>
<tr>
<td>1000003</td>
<td>Robot</td>
<td><em>R</em> Wire Center</td>
<td>Review</td>
</tr>
</tbody>
</table>
In this particular audit, John Robinson is responsible for three different entitlements: *R* Main Data Center, *R* DR Site and *R* Wire Center. Since all these entitlements are similar in nature – and since they all relate to the same type of entities with the same attributes (badges granting physical access to buildings) – they are all part of the same meta-audit. Section 2.5 will discuss how the web interface will support the authorizers who are faced with multiple entitlements to review.
When entities and their attributes are loaded at the start of an audit, they are locked-in for the duration of the audit. This is an important design decision that warrants some additional explanation: after all, if we are reviewing administrative access to company-issued laptops, should users be added and removed from the audit if they are granted those rights while the audit is taking place?
Although this may appear to provide a more accurate representation of the data, the complications associated with auto-adjusting the dataset greatly outweigh the benefits of a locked-in audit. In some cases, data will be loaded in eAUDIT through a spreadsheet. Re-creating the spreadsheet throughout the audit would be time-consuming, and additional code would be required to adjust the existing data to handle deltas. Furthermore, audits conducted by eAUDIT typically last 3-4 weeks. These short audit windows are another mitigating factor. Rather than capturing in-flight deltas, eAUDIT will strive for a high success rate and repeated audits throughout the year. With all of this said, if data is loaded dynamically inside eAUDIT through an adapter, then that adapter can be written to handle in-flight changes.
François Bégin, francois.begin@telus.com
2.3. Design
As previously alluded to, the design of eAUDIT (Figure 1) is fairly simple. At a high level, entitlement data needs to be acquired from various data sources, and then presented to authorizers for review. Section 2.4 covers data acquisition in more detail. How the data ends up in the database is critical. eAUDIT needs to handle generic data efficiently. Taking a page from Jurney (2013): “In choosing our tools, we seek linear scalability, but above all, we seek simplicity”, the data model for eAUDIT seeks simplicity. In Jurney’s case, he was referring to NoSQL big data tools, but his comment is just as applicable to a traditional SQL database. eAUDIT’s data is held in a SQL database, with a simple data model (see Appendix A). Let us consider the data model and go over some of the key characteristics.
The AuditTypeReference table (figure 2) holds the base audit type information, such as the name and description of the audit, a start and end date and some instructions. This is where the overall type of audit is defined: reviewing active contractors at TELUS, reviewing badges with *R* profiles attached, etc. Since TELUS is a bilingual company, various key fields are held in two separate fields (EN | FR), which will be required by the Web interface.
François Bégin, francois.begin@telus.com
The AuditTypeReference table also holds the labels for the primary and secondary User Defined Entity Attributes (UDEA) fields. Initially, a pre-defined set of fields was considered e.g. \textit{UDEAPrimaryField1}, \textit{UDEAPrimaryField2}, etc. but this set a hard limit as well as being less than esthetically pleasing from a data model perspective. Another approach considered was a mapping table that would hold as many of these user-defined fields as required, with a many-to-one relationship with the AuditTypeReference table. In the end though, a simple and elegant solution was chosen: the UDEA fields hold the labels in JSON format. Figure 3 shows examples of primary and secondary fields (labels) for two different types of audits:
<table>
<thead>
<tr>
<th>AuditName</th>
<th>UDEAPrimaryField\textsubscript{EN}</th>
<th>UDEAsecondaryField\textsubscript{EN}</th>
</tr>
</thead>
<tbody>
<tr>
<td>eSAM active contractor audit</td>
<td>[Emp ID,"FirstName","LastName","SAP ID","Mgr ID... [Contractor Type,"Province","Vendor","Access]</td>
<td></td>
</tr>
<tr>
<td>Restricted privileges in data centers</td>
<td>[Emp ID,"FirstName","LastName","Mgil ID","Mgr ID... [Cards]</td>
<td></td>
</tr>
</tbody>
</table>
Figure 3. User-defined entity attributes fields for two different audits.
Table \textbf{Audit} (Figure 4) defines the actual entitlements being reviewed within an audit type. It also has a count of the total number of entities that bear each entitlement.
François Bégin, francois.begin@telus.com
Using our previous example of restricted profiles on access badges, this table would hold all the different types of restricted profiles that are to be reviewed (Figure 5). The table uses a foreign key to link itself to the AuditTypeReference table. It is the relationship between Audit and AuditTypeReference that allows eAUDIT to group similar entitlement reviews together.
<table>
<thead>
<tr>
<th>idAudit</th>
<th>TotalNumberOfEntitites</th>
<th>Entitlement</th>
<th>CreatedDateTime</th>
<th>CreatedBy</th>
</tr>
</thead>
<tbody>
<tr>
<td>2006</td>
<td>52</td>
<td>"R" Main Data Center</td>
<td>2015-04-23 03:30:39</td>
<td>eAUDIT_BatchOps</td>
</tr>
<tr>
<td>2008</td>
<td>35</td>
<td>"R" DR Site</td>
<td>2015-04-23 03:30:39</td>
<td>eAUDIT_BatchOps</td>
</tr>
<tr>
<td>2009</td>
<td>47</td>
<td>"R" Wire Center</td>
<td>2015-04-23 03:30:40</td>
<td>eAUDIT_BatchOps</td>
</tr>
</tbody>
</table>
Figure 5. Different entitlements reviewed within the same audit.
The Entities table (Figure 6) is the one that holds a list of who (or what) was granted entitlements. This is where the UDEAprimaryFields and UDEAsecondaryFields from the AuditTypeReference table will find their counterparts, called UDEAprimaryFieldsValues and UDEAsecondaryFieldsValues respectively.
The values are saved in JSON format (see Figure 7), just like the labels. The choice of JSON as a format to hold field values may appear a little strange at first. After all, flattening all entities’ attributes in a single field will make SQL searches more expensive. But the main goal of eAUDIT is not efficient searches. The goal is to efficiently present datasets for entitlement review. The choice of JSON to keep labels and values is directly related to the web interface that will allow authorizers to conduct their review – and having field values in this format will prove useful once we start discussing eAUDIT’s web implementation in section 2.5.
The **EntitiesAuditResponses** table (Figure 8) holds the responses i.e. whether or not the authorizer confirmed or revoked the entitlement. Keeping this data in a separate table allows for fields such as *LastUpdatedDateTime* and *LastUpdatedBy* to capture who reviewed the entitlement. Although mentioned here, note that the full implementation of this table’s functionality is not covered in this paper.
François Bégin, francois.begin@telus.com
Finally, the **Authorizers** table (Figure 9) is where the authorizers of a particular Audit record are kept. This table has a many-to-one relationship to the Audit table, allowing multiple individuals to be named authorizers of a particular audit. TELUS uses a unique numerical value for its employee IDs, and this is reflected in field **AuthorizerEmpID**, which is defined as an integer value.
### 2.4. Data acquisition
Since eAUDIT is all about validating data, acquiring data is key to the tool. Not only that, but from the scope defined in section 2.2, data need to be acquired as easily as possible.
possible. After all, if you cannot load authorizers, entitlements and entities into the eAUDIT database, you cannot review these records. To help with the acquisition of data, a java library called jEAUDITlibrary was created (Figure 10).

As would be expected from any other java library, jEAUDITlibrary contains classes for the main objects that are at the core of eAUDIT: Audit, AuditTypeReference, Authorizers, Entities, and EntitiesAuditResponses. These classes map to the data model (Appendix A) that was discussed in the previous section. There are also *Util classes that contains static methods related to these objects: AuditUtil, AuditTypeReferenceUtil, AuthorizersUtil, EntitiesUtil, and EntitiesAuditResponsesUtil. The eAUDIT library relies on two external libraries: the standard MySQL java connector and a toolbox library called UnifiedToolBoxV2, which is mostly used to help manage SQL connections as well as provide logging capabilities.
François Bégin, francois.begin@telus.com
The source code for jEAUDITlibrary is available from the eAUDIT project page on GitHub (https://github.com/francoisbegin/eAUDIT). The project page also includes the source code for eAUDIT_BatchOps (Figure 11), a program that contains sample code to demonstrate data acquisition using the eAUDIT library. Appendix B gives a quick overview of how to set up an environment to use the library and eAUDIT_BatchOps.
Figure 11. Main classes of eAUDIT_BatchOps (supporting libraries not shown)
### 2.4.1. Excel-driven data acquisition
The first demo in eAUDIT_BatchOps covers data import from an Excel spreadsheet. This particular section of the code relies heavily on Apache POI, an open-source Java API for Microsoft Documents (Apache Foundation, 2015). Note that all libraries required by eAUDIT_BatchOps are included with the project.
A demo spreadsheet, `dataLoadExample.xlsx`, is included with the eAUDIT_BatchOps project (Figure 12)

**Figure 12.** `DataLoadExample.xlsx` spreadsheet included with eAUDIT_BatchOps.
This spreadsheet holds three separate sheets: `AuditTypeRef` (Appendix C) contains all the data required to create the AuditTypeReference record in the eAUDIT database. `AuditData` (Appendix D) contains all the data required to create the Authorizers, Entities and Audit records. Finally, `Notes` contains notes to help users fill in the template correctly.
This spreadsheet can be used as a template for Excel-driven data loads. It is built to support generic data. To add/remove primary and secondary user-defined entity attribute fields, one only has to create/delete columns in the AuditData sheet and set the top row label to either `UDEAprimary` or `UDEAsecondary`.
Multiple Authorizers per entitlements is supported by listing them under the Authorizers column and separating each authorizer by a semi-colon. As mentioned in section 2.3, authorizer’s IDs are expected to be integer values that map to the TELUS employee ID of the authorizer. Using eAUDIT at a company that relies on non-numerical employee IDs would require making modifications to the Authorizers class of jEAUDIT library.
Method `Ops_ExcelDataLoader.loadFromExcelTemplate` handles the spreadsheet data load, provided it matches the expected template. To demonstrate this, one can create a new directory called `dataLoad` under the base path of eAUDIT and copy the demo spreadsheet to that location. One then compiles and runs eAUDIT_BatchOps with the `loadFromExcelTemplate` switch (or runs it with that switch inside a Java IDE):
Francois Bégin, francois.begin@telus.com
In the example shown in Figure 13, a new AuditTypeReference record with id = 4 was created. Under that audit type reference, 5 sub-audits were created to match the 5 different entitlements that were defined in the spreadsheet (Figure 14), and 43 entities will need to be reviewed (Figure 15).
Obviously, loading data from a spreadsheet is not ideal. Dealing with spreadsheets comes with pitfalls such as sensitive data exposure (Walsh, 2014). Still, spreadsheet imports may prove useful in cases where an application/system does not have a simple API to extract the data, or when a support team is reluctant to provide direct access to its data.
François Bégin, francois.begin@telus.com
Another well-known reality is that, in many cases, spreadsheets are all that people know (Allen, 2015). Asking a subject-matter expert to do an export of the key data, and massaging these data to fit the eAUDIT Excel template might be the path of least resistance to acquire audit data.
2.4.2. Adapter-driven data acquisition
A better solution to an Excel data-load is to write an adapter to retrieve the audit data from a system. In its current incarnation, eAUDIT does not provide a generic interface for such adapters, but the jEAUDITlib library provides methods and classes to support their creation. Additionally, method `Ops_AdapterDataLoad.loadFromAdapter()` of eAUDIT_BathOps demonstrates the implementation of a simple adapter.
The first step in building a custom adapter is to determine how the data can be acquired programmatically. In this case, each solution will likely be custom-built. For instance, TELUS has developed a custom adapter to interact with the Lenel Onguard physical access system. Data acquisition was achieved by the use of two database service accounts: one account to interact with Lenel Onguard to obtain a list of badges and access profiles, and another account to interact with the database where authorizers of these access profiles are maintained. The adapter simply correlates the two data sources and feeds the resulting data to the eAUDIT database.
For an adapter data load, one must refer back to the data model and note that the Audit table is at the heart of the model. Contrary to all other tables in the model, its primary key, `idAudit`, is not an auto-increment field. This was done on purpose as it allows for the controlled creation of new records. When a custom-adapter needs to send data to the eAUDIT database, it needs to determine the next available `idAudit` value. Then, each new entitlement is assigned the next `idAudit` value. As this list is built up, the list of corresponding Authorizers and Entities records can also be built.
If all of these records were written one at a time, data loads would be woefully slow. A custom-built adapter should therefore take a different approach. In the demo code proposed in method `loadFromAdapter()`, a HashMap is built as the code iterates through all entities. If it finds a new entitlement, it creates a new Audit record and attaches to it the authorizers for that entitlement and the entity record. If it finds an
entitlement it already knows about, it retrieves it from the HashMap, increments field Audit.TotalNumberOfEntities, and adds the new entity to previously correlated entities for that particular entitlement. All of this is done in memory, inside the HashMap. A special object called jEAUDITlibrary.AuditDataLoaderObject (Figure 16) is used to organize all the data:
```java
public class AuditDataLoaderObject {
private int idAuditID;
private int idAuditTypeReference;
private Audit audit;
private ArrayList<Authorizers> auditAuthorizers;
private ArrayList<Entities> auditEntities;
}
```
**Figure 16. Fields for java class AuditDataLoaderObject.**
This object is a meta-object, which can hold all the key data: idAudit, the corresponding Audit record, a list of Authorizers associated with the Audit record, and all entities for that particular audit. Once the HashMap has been fully populated, a simple call to method AuditDataLoaderObjectUtil.massLoad() handles batched writes to the database. Compiling eAUDIT_BatchOps and running it with the -loadFromAdapter switch demonstrates a simple adapter (Figure 17):
2.5. Web interface implementation
Gathering data and normalizing it into a database is fine, but eAUDIT needs to present this data to authorizers to allow for an efficient review. Currently, the web interface implementation of eAUDIT exists as a proof-of-concept written in Java and deployed in a customized Spring framework commonly used by TELUS Chief Security Office (CSO). Obviously, this customized framework is infused with TELUS enterprise standards: it relies on TELUS’s single sign-on (SSO) infrastructure, it has built-in security groups based on TELUS employee IDs, and it makes heavy use of TELUS-branded CSS. Many of these elements are either irrelevant to another organization or considered proprietary to TELUS and therefore will not be discussed here.
That being said, the core of the eAUDIT web implementation can be covered. This core is the audit interface, and to a lesser extent, the landing page for authorizers. Figure 18 shows the landing page for eAUDIT.
François Bégin, francois.begin@telus.com
François Bégin, francois.begin@telus.com
Figure 18. eAUDIT web interface main landing page for an authorizer.
The landing page is a simple data table triggered when an authorizer logs in to the tool. A query is run using the employee ID of the authorizer as authenticated by SSO and returns audits that are currently active for that person (see Figure 19):
```sql
// SQL AuditTypeReference for Authorizer 18059
SELECT DISTINCT t1.idAuditTypeReference, t1.AuditName, t1.AuditDescription
FROM Audit AS t4
LEFT JOIN Authorizers AS t6 ON (t1.auditId = t6.auditId)
LEFT JOIN AuditTypeReference AS t7 ON (t7.idAuditTypeReference = t1.auditId)
WHERE t6.authorizedEmployeeId = '18059' AND t4.t4.auditEnd > NOW
```
Figure 19. SQL query to build the authorizer main landing page.
The names of the audits are links to the review engine. Note that the audits here are AuditTypeReference records, with a single such record potentially representing multiple entitlements of similar entities.
If a user selects a specific audit, this request is intercepted by the controller. Appendix E and F show the simple code for the controller, as well as the SQL query that retrieves Entities records for a particular AuditTypeReference record – and a particular authorizer. Entities data is attached as an attribute called `EntityList` to a ModelAndView object (See Code sample 1).
Audit.jsp (Appendix G) is where this data gets presented to the authorizer. Fundamentally, this is a simple page that presents the audit name, description and a data table with the entities (Code sample 2 and Figure 20)
```java
ModelAndView mv = new ModelAndView("audit");
[...]
mv.addObject("EntityList", auditDao.getEntitiesByAuditAndAuthorizer(auditID,
SDDIHelper.getCurrentTeamMemberNumericalPIDFromRequest(request)));
```
**Code sample 1. Attaching entity data to a ModelView.**
```html
<div>
<h3>${AuditDetail.auditName}</h3>
</div>
<div>
<h5>${AuditDetail.auditDescription}</h5>
</div>
<div id="tableContainer"
style="margin-left:auto; margin-right:auto; width:auto;clear:both;">
<table id="dataTable" style="width:100%;"></table>
</div>
```
**Code sample 2. Main section of audit.jsp.**
Canucks? stay or go?
Audit Canucks players and decide to keep them on the team next year – or not!
<table>
<thead>
<tr>
<th>Number</th>
<th>Full Name</th>
<th>Stats</th>
<th>Salary</th>
<th>Entitlement</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>22</td>
<td>Daniel Sedin</td>
<td>20 G, 55 A, 76 P</td>
<td>$700,000</td>
<td>Keep on team?</td>
<td>☑️</td>
</tr>
<tr>
<td>13</td>
<td>Henrik Sedin</td>
<td>18 G, 85 A, 73 P</td>
<td>$700,000</td>
<td>Keep on team?</td>
<td>☑️</td>
</tr>
<tr>
<td>30</td>
<td>Ryan Miller</td>
<td>29-16-1, 2.53 GAA</td>
<td>$600,000</td>
<td>Keep on team?</td>
<td>☑️</td>
</tr>
<tr>
<td>17</td>
<td>Radim Vrbata</td>
<td>31 G, 32 A, 63 P</td>
<td>$500,000</td>
<td>Keep on team?</td>
<td>☑️</td>
</tr>
<tr>
<td>3</td>
<td>Kevin Bieksa</td>
<td>4 G, 10 A, 14 P</td>
<td>$400,000</td>
<td>Keep on team?</td>
<td>☑️</td>
</tr>
</tbody>
</table>
Figure 20. eAUDIT web interface audit review page.
The design decision to keep user-defined fields in JSON format was motivated by the fact that this data format can easily be manipulated. Javascript is used to generate the main audit data table on the fly. Although these fields are not easily or efficiently searchable by the system from the perspective of the whole dataset, once re-formatted in a data table, that data becomes easily sortable and filterable.
User-defined primary fields form visible rows while hidden rows hold the secondary attributes. Clicking on the details icon 📊 will trigger the hidden rows and present them to the authorizer (Code sample 3 and Figure 21):
Code sample 3. Trigger to display/hide secondary entity attributes.
Canucks? stay or go?
Audit Canucks players and decide to keep them on the team next year—or not!

The table auto-adjusts to the number of user-defined primary fields and to the number of user-defined secondary fields. There is obviously a physical limitation on the amount of screen real estate that one has access to, so the number of primary fields must be kept reasonable. Primary fields should be chosen amongst those fields that are most likely to clearly identify the entity to an authorizer, with secondary fields used occasionally by the authorizer to ascertain whether or not to confirm the entitlement. This confirmation is handled by action buttons at the end of each row.
As previously mentioned, using a data table has numerous advantages, including the ability to sort and filter the data. The filtering in particular can be used to focus on specific entitlements if multiple entitlements are being reviewed by the same authorizer within the same audit (see figure 22). Moreover, all of the work is offloaded to the client, leaving the server to simply process user requests.
François Bégin, francois.begin@telus.com
Generic Audit example
An example of a generic audit to illustrate how the tool template works.
<table>
<thead>
<tr>
<th>Emp ID</th>
<th>Full Name</th>
<th>Type</th>
<th>System ID</th>
<th>Entitlement</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>123465</td>
<td>Melvina Holmed</td>
<td>Contractor</td>
<td>MHolmed1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123466</td>
<td>Sol Ruckham</td>
<td>Contractor</td>
<td>SRuckham1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123463</td>
<td>Rebecca Fugna</td>
<td>Regular</td>
<td>RFugna1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123464</td>
<td>Tomoko Mclean</td>
<td>Regular</td>
<td>TMclean1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123465</td>
<td>Treschka Bugg</td>
<td>Contractor</td>
<td>TBugg1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123471</td>
<td>Sonia Leen</td>
<td>Regular</td>
<td>SLeen2</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123472</td>
<td>Andy Bmtman</td>
<td>Regular</td>
<td>ABmtman1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123473</td>
<td>Hayley Nienmann</td>
<td>Contractor</td>
<td>HNienmann1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123475</td>
<td>Frederic Calen</td>
<td>Contractor</td>
<td>FCalen1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123476</td>
<td>Leslie Roysser</td>
<td>Contractor</td>
<td>LRoysser1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123481</td>
<td>Shelley Pracrer</td>
<td>Regular</td>
<td>SPracrer1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
<tr>
<td>123482</td>
<td>Avrilid Glidman</td>
<td>Regular</td>
<td>AGlidman1</td>
<td>Guest of Ticketing System</td>
<td>✓</td>
</tr>
</tbody>
</table>
Figure 22. eAUDIT search filter capability used to group entitlements.
Since most of the heavy lifting is handled client-side, the tool must ensure that authorizers can only review entities and entitlements for which they are authorized, and this verification is made server-side, prior to updating table EntitiesAuditResponses.
2.6. Future enhancement
eAUDIT is still a proof-of-concept at this stage and requires polishing. The data model supports the ability for authorizers to delegate an audit to someone else. Delegation will give a busy authorizer the ability to offload some of his audit work to a trusted direct report. Additionally, the TELUS implementation will implicitly provide access to the supervisors of authorizers. This means that anyone above a base audit authorizer will be a super-authorizer, able to view and delegate any of these audits – or let their subalterns know they need to pick up the pace! Both the delegation feature and the implied super-authorizers feature should help promote high audit completion rates.
Another reality of audits is that the data provided may be stale or inadequate at load time. For instance, an employee loaded as an entity may not have a current manager. If the manager is the authorizer of a particular entitlement, this employee will not be reviewed. eAUDIT will address this challenge by taking the company’s organizational
François Bégin, francois.begin@telus.com
hierarchy into account when allowing entitlement review. It will provide reports to the audit administrator of these stale/incomplete records, allowing the administrator to review them himself, or re-assign them to someone who can.
Yet another feature of TELUS’s planned eAUDIT implementation is the use of a PrimaryKey in the Entities table to provide historical correlation between audits. This will allow an authorizer to determine whether or not this entity’s entitlement was reviewed or revoked the last time the audit ran.
Another important aspect of auditing that this paper did not cover is communication. A successful audit is one where authorizers are clearly informed of deadlines and reminded to meet them. The TELUS CSO has a communication tool called eMAC that is capable of handling audit communications (kickoff email, reminders, escalations) and eAUDIT will be tightly integrated with this tool to offer an end-to-end auditing solution.
3. Conclusion
This paper presented eAUDIT, a generic audit review tool to conduct entitlement reviews. This tool is currently being implemented at TELUS to mitigate some shortcomings of our identity and access management infrastructure. It should be noted that IAM is often seen through the lenses of compliance, and it is true that TELUS’s audit tools predecessors have been compliance-driven. On the other hand, there are other solid business cases to be made with regard to auditing and managing access properly: operational effectiveness (or cost savings) as well as business enablement are other considerations (Osmanoglu, 2013). There is already evidence to support the proposition that eAUDIT will benefit TELUS beyond compliance.
François Bégin, francois.begin@telus.com
References
Appendix A – eAUDIT data model
Appendix B – Setting up eAUDIT for a demo
Here is a quick overview of how to set up an environment to run/demo eAUDIT’s data acquisition capability. First, in a directory of your choice, clone the eAUDIT project code (Figure B-1).

There are two separate projects in the code pulled from GitHub: the jEAUDITlibrary itself, as well as eAUDIT_BatchOps, a project to demonstrate data acquisition. You can import these projects into your preferred Java IDE to examine the code.
Next, you need to set up a server to run the eAUDIT database. eAUDIT was built on MySQL and the data model has been included as a MySQL WorkBench file inside jEAUDITlibrary (Figure B-2). A service account with read-write access to the database also needs to be created.

François Bégin, francois.begin@telus.com
Prior to running eAUDIT_BatchOps, a few configuration changes must be made:
1. Edit files `db_eAUDITDV` and `db_eAUDITPR`. Set the database name, user, password and URL to point to the database that was created to hold eAUDIT data.
2. Edit files `StaticParamsDV` and `StaticParamsPR` (Figure B-3). Set the path for the system where you will be trying out eAUDIT_BatchOps. Logging can also be adjusted through the various `LOG_*` parameters.
```
# This section contains keys/values that are expected if you are using the UnifiedToolBoxv2 library
#
# Note: All paths are relative to toolBasePath.
# For example, on Windows, your lockfile will be c:/elpm/tmp/lock
10 toolName = eAUDIT_BatchOps
11 toolBasePathWin = c:/eTOOLS/eaudit
12 toolBasePathNix = /export/data/eaudit
13TmpFilesPath = /tmp
14 LOG_writeToFile = /logs/eaudit-app
15 LOG_MainLog = /logs/eAUDIT_BatchOps.err
16 LOG_ErrorLog = /logs/eAUDIT_BatchOps.err
17 LOG_writeToScreen = true
18 LOG_writeToDB = true
19 LOG_dbProperties = com.telus.sddi.eAUDIT_BatchOps.db_eAUDITDV
20 LOG_eventSource = eAUDIT_BatchOps
21 adminEmail = francois.begin@telus.com
```
Figure B-3. Static parameters as defined in class StaticParamsDV/PR.
3. Create the `toolBasePath` directories. Assuming the demo is running on a Linux computer and the configuration file shown in Figure B-3, the following directories would need to be created:
a. `/export/data/eaudit`
b. `/export/data/eaudit/tmp`
c. `/export/data/eaudit/logs`
Appendix C – AuditTypeRef sheet of the eAUDIT Excel template
<table>
<thead>
<tr>
<th>Field</th>
<th>Values</th>
<th>Help</th>
</tr>
</thead>
<tbody>
<tr>
<td>AuditName</td>
<td>Generic Audit example</td>
<td>Enter a short name that represents your audit</td>
</tr>
<tr>
<td>AuditDescription</td>
<td>An example of a generic audit to illustrate how the tool works</td>
<td>Enter a short description of your audit</td>
</tr>
<tr>
<td>AuditStart</td>
<td>Sunday, May 10, 2015</td>
<td>Enter audit start date. Audit can only start 1 week from today at the earliest</td>
</tr>
<tr>
<td>AuditEnd</td>
<td>Sunday, May 31, 2015</td>
<td>Enter audit end date. Audit must last at least 1 week from start date</td>
</tr>
<tr>
<td>AuditInstructionsEN</td>
<td><HTML> (All of the employees in this list need to have entitlements for which you are the authorizer. Please review these entitlements at your earliest convenience. For each employee, please click the appropriate button to confirm or revoke the entitlement. Note that choosing revoke will not remove access until the audit has closed and the responses been reviewed by the admin team. For any questions related to this audit, please contact <email>.) <HTML></td>
<td>Enter the instructions that people you are auditing will see on the audit screen - English. HTML markup allowed</td>
</tr>
<tr>
<td>AuditInstructionsFR</td>
<td>Instructions in French here</td>
<td>Enter the instructions that people you are auditing will see on the audit screen - French. HTML markup allowed</td>
</tr>
<tr>
<td>UDEAprimaryFieldsEN</td>
<td>("Emp ID","Full Name","Emp Type","System ID")</td>
<td>List of UDEA primary fields names (labels) in English, JSON format</td>
</tr>
<tr>
<td>UDEAprimaryFieldsFR</td>
<td>UDEA in French</td>
<td>List of UDEA primary fields names (labels) in French</td>
</tr>
<tr>
<td>UDEAsecondaryFieldsEN</td>
<td>("Work Location","Province","Last login time to system")</td>
<td>List of UDEA secondary fields names (labels) in English, JSON format</td>
</tr>
<tr>
<td>UDEAsecondaryFieldsFR</td>
<td>UDEA in French</td>
<td>List of UDEA secondary fields names (labels) in French</td>
</tr>
<tr>
<td>AuthorityManager</td>
<td>0</td>
<td>The name/ID of the person responsible to manage this particular audit. The Audit manager has extended rights to the audit (delegation, reporting, etc.)</td>
</tr>
<tr>
<td>DataLoadType</td>
<td>Excel-load</td>
<td>Either Excel-Load for data loaded via this template or Adapter-Load for data loaded by an adapter script</td>
</tr>
<tr>
<td>eMACCircleTimelineID</td>
<td>0</td>
<td>TELUS-specific field to connect audit with CSO emailing tool</td>
</tr>
<tr>
<td>UseEMAC</td>
<td>0</td>
<td>TELUS-specific field to connect audit with CSO emailing tool</td>
</tr>
</tbody>
</table>
François Bégin, francois.begin@telus.com
## Appendix D – AuditData sheet of the eAUDIT Excel template
<table>
<thead>
<tr>
<th>PrimaryKey</th>
<th>Entitlement</th>
<th>Authorizer</th>
<th>USERequest</th>
<th>USERequest</th>
<th>USERequest</th>
<th>USERequest</th>
<th>USERequest</th>
<th>USERequest</th>
</tr>
</thead>
<tbody>
<tr>
<td>123456</td>
<td>Guest of Ticketing System</td>
<td>Melvin Bobo</td>
<td>Contractor</td>
<td>MH001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123457</td>
<td>Regular User of Ticketing System</td>
<td>Soojae Kim</td>
<td>Regular</td>
<td>SCA001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123458</td>
<td>Regular User of Ticketing System</td>
<td>Jack Slack</td>
<td>Regular</td>
<td>NH001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123459</td>
<td>Guest of Ticketing System</td>
<td>Sal Rakhshani</td>
<td>Contractor</td>
<td>SHR001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123460</td>
<td>Admin of Ticketing System</td>
<td>Bandi Kafkia</td>
<td>Contractor</td>
<td>BKF001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123461</td>
<td>Regular User of Ticketing System</td>
<td>Kristian Duker</td>
<td>Contractor</td>
<td>EID001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123462</td>
<td>Regular User of Ticketing System</td>
<td>Cilicii Harper</td>
<td>Contractor</td>
<td>CHI001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123463</td>
<td>Guest of Ticketing System</td>
<td>Rebecca Puga</td>
<td>Regular</td>
<td>BPG001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123464</td>
<td>Guest of Ticketing System</td>
<td>Tomyo Morita</td>
<td>Regular</td>
<td>TRK001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123465</td>
<td>Guest of Ticketing System</td>
<td>Tenebra Bugis</td>
<td>Contractor</td>
<td>TEB001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123466</td>
<td>Admin of Ticketing System</td>
<td>Eleonor Vannoy</td>
<td>Regular</td>
<td>EAV001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123467</td>
<td>Regular User of Ticketing System</td>
<td>Giovanni Vannoy</td>
<td>Regular</td>
<td>GAV001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123468</td>
<td>Guest of Ticketing System</td>
<td>Randee Naga</td>
<td>Regular</td>
<td>BNP001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123469</td>
<td>Regular User of Ticketing System</td>
<td>Barren Backley</td>
<td>Regular</td>
<td>BBR001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123470</td>
<td>Regular User of Ticketing System</td>
<td>Monet Dohar</td>
<td>Regular</td>
<td>MDH001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123471</td>
<td>Guest of Ticketing System</td>
<td>Sonia Laun</td>
<td>Regular</td>
<td>SLA001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123472</td>
<td>Guest of Ticketing System</td>
<td>Andy Fillman</td>
<td>Regular</td>
<td>AFF001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123473</td>
<td>Guest of Ticketing System</td>
<td>Hanyly Ninnman</td>
<td>Contractor</td>
<td>HHN001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123474</td>
<td>Regular User of Ticketing System</td>
<td>Samuel Pryor</td>
<td>Contractor</td>
<td>SLP001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123475</td>
<td>Guest of Ticketing System</td>
<td>Frederic Caxton</td>
<td>Contractor</td>
<td>FCT001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123476</td>
<td>Guest of Ticketing System</td>
<td>Lilli Raynor</td>
<td>Contractor</td>
<td>LLR001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123477</td>
<td>Admin of Ticketing System</td>
<td>Iris Skyt</td>
<td>Regular</td>
<td>ISK001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123478</td>
<td>Regular User of Ticketing System</td>
<td>Jodie Volka</td>
<td>Regular</td>
<td>JV001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123479</td>
<td>Regular User of Ticketing System</td>
<td>Su Roptothal</td>
<td>Regular</td>
<td>SR001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123480</td>
<td>Regular User of Ticketing System</td>
<td>Kenna Stigman</td>
<td>Contractor</td>
<td>KS001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123481</td>
<td>Guest of Ticketing System</td>
<td>Shirley Procter</td>
<td>Regular</td>
<td>SPR001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123482</td>
<td>Guest of Ticketing System</td>
<td>Awilda Glickman</td>
<td>Regular</td>
<td>AGC001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123483</td>
<td>Admin of Ticketing System</td>
<td>Alonso Herwig</td>
<td>Regular</td>
<td>AHW001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123484</td>
<td>User of Backend System</td>
<td>Wes George</td>
<td>Regular</td>
<td>WGE001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123485</td>
<td>User of Backend System</td>
<td>Seema Cutlanso</td>
<td>Regular</td>
<td>SCA001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123486</td>
<td>User of Backend System</td>
<td>Jack Zfan</td>
<td>Regular</td>
<td>ZFA001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123487</td>
<td>User of Backend System</td>
<td>Kristin Decker</td>
<td>Contractor</td>
<td>KDD001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123488</td>
<td>User of Backend System</td>
<td>Gisela Harper</td>
<td>Contractor</td>
<td>GH001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123489</td>
<td>User of Backend System</td>
<td>Parrett Buckley</td>
<td>Regular</td>
<td>PB001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123490</td>
<td>User of Backend System</td>
<td>Monet Dohar</td>
<td>Regular</td>
<td>MDH001</td>
<td>Canada</td>
<td>Alberta</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123491</td>
<td>User of Backend System</td>
<td>Samuel Rye</td>
<td>Contractor</td>
<td>SRY001</td>
<td>USA</td>
<td>California</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123492</td>
<td>User of Backend System</td>
<td>Jodie Volka</td>
<td>Regular</td>
<td>JV001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123493</td>
<td>User of Backend System</td>
<td>So Roptothal</td>
<td>Regular</td>
<td>SR001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123494</td>
<td>User of Backend System</td>
<td>Kenna Stigman</td>
<td>Contractor</td>
<td>KS001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
<tr>
<td>123495</td>
<td>Admin of Backend System</td>
<td>Alonso Herwig</td>
<td>Regular</td>
<td>AHW001</td>
<td>Canada</td>
<td>Quebec</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Francois Bégin, francois.begin@telus.com
Appendix E – Controller that maps a request to an authorizer view of audit data
```java
@RequestMapping({
"/audit/{auditID}"}
)
public ModelAndView displayAuditDetailsPage(@PathVariable String auditID)
throws ObjectNotFoundException,
SQLException {
ModelAndView mv = new ModelAndView("audit");
//TODO: validate permission
IAuditDao auditDao = getAuditDao();
mv.addObject(USER_NAME,
SDDIHelper.getCurrentTeamMemberNameFromRequest(request));
mv.addObject(USER_TID,
SDDIHelper.getCurrentTeamMemberTIDFromRequest(request));
mv.addObject("AuditDetail",
auditDao.getAuditDetailsByID(auditID));
mv.addObject("EntityList", auditDao.getEntitiesByAuditAndAuthorizer(auditID,
SDDIHelper.getCurrentTeamMemberNumericalPIDFromRequest(request)));
return mv;
}
```
Appendix F – SQL query getEntitiesByAuditIDAndAuthorizer to retrieve entities of a specific audit and specific authorizer
```xml
<statement id="getEntitiesByAuditIDAndAuthorizer"
resultMap="resultEntity"
parameterClass="map">
SELECT
e.idEntities, e.PrimaryKey, e.UDEAprimaryFieldsValues, e.UDEAsecondaryFieldsValues, a.Entitlement, resp.RecordedResponse
FROM Entities as e
INNER JOIN Audit as a
ON (e.Audit_idAudit=a.idAudit
AND a.AuditTypeReference_idAuditTypeReference = #auditType#)
LEFT JOIN Authorizers as auth
ON (auth.Audit_idAudit=a.idAudit)
LEFT JOIN EntitiesAuditResponses as resp
ON e.idEntities = resp.Entities_idEntities
WHERE auth.AuthorizerEmpID=#authorizerID#
</statement>
```
Appendix G – audit.jsp: main page of the eAUDIT review engine
```html
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" prefix="sec"%>
<script>
var numOfPrimaryColumns = ${fn:length(AuditDetail.primaryFields)};
$(document).ready(function() {
var rootPath = '${pageContext.request.contextPath}';
var data = [];
var secondaryFields = [
<c:forEach items="${AuditDetail.secondaryFields}" var="pfield2" varStatus="loop">
${pfield2}<c:if test="${!loop.last}">,</c:if>
</c:forEach>
];
<c:forEach items="${EntityList}" var="entity">
data.push(['<img src="${pageContext.request.contextPath}/img/details_open.png">',
<c:forEach items="${entity.primaryFields}" var="fieldValue" >
${fieldValue},
</c:forEach>
'${entity.entitlement}',
'<div class="ui-corner-all list_icon text_icon grey action_yes" title="Keep"><span class="ui-icon ui-icon-check"></span></div></c:forEach>
]);
</c:forEach>
<c:forEach items="${EntityList}" var="entity">
data.push(['<img src="${pageContext.request.contextPath}/img/details_open.png">',
<c:forEach items="${entity.primaryFields}" var="fieldValue" >
${fieldValue},
</c:forEach>
'${entity.entitlement}',
'<div class="ui-corner-all list_icon text_icon grey action_yes" title="Keep"><span class="ui-icon ui-icon-check"></span></div></c:forEach>
]);
</c:forEach>
</script>
```
François Bégin, francois.begin@telus.com
François Bégin, francois.begin@telus.com
François Bégin, francois.begin@telus.com
/* Add event listener for opening and closing details */
$('#dataTable tbody td img').click(function() {
var nTr = this.parentNode.parentNode;
if (this.src.match('details_close')) {
this.src = '${pageContext.request.contextPath}/img/details_open.png';
oTable.fnClose(nTr);
} else {
this.src = '${pageContext.request.contextPath}/img/details_close.png';
oTable.fnOpen(nTr, fnFormatDetails(oTable, nTr), 'details');
}
});
$( "div.action_yes" ).mouseover(function() {
$(this).addClass('green').removeClass('grey');
}).mouseout(function() {
$(this).addClass('grey').removeClass('green');
}).click(function() {
$(this).addClass('greenSelected').removeClass('grey');
$(this).parent().find('div.action_no').removeClass('redSelected').addClass('grey');
});
Francois Bégin, francois.begin@telus.com
$( "div.action_no" ).mouseover(function() {
$(this).addClass('red').removeClass('grey');
}).mouseout(function(){
$(this).addClass('grey').removeClass('red');
}).click(function(){
$(this).addClass('redSelected').removeClass('grey');
$(this).parent().find('div.action_yes').removeClass('greenSelected').addClass('grey');
});
/* Formating function for row details */
function fnFormatDetails(table, nTr) {
var aData = table.fnGetData(nTr);
return aData[numOfPrimaryColumns+3];
}
</script>
<div><h3>${AuditDetail.auditName}</h3></div>
<div><h5>${AuditDetail.auditDescription}</h5></div>
<div id="tableContainer" style="margin-left:auto; margin-right:auto; width:auto; clear:both;">
<table id="dataTable" style="width:100%;"></table>
</div>
## Upcoming SANS Training
Click here to view a list of all SANS Courses
<table>
<thead>
<tr>
<th>Event Name</th>
<th>Location</th>
<th>Dates</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>SANS Chicago Spring 2020</td>
<td>Chicago, IL</td>
<td>Jun 01, 2020 - Jun 06, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS ICS Europe Summit & Training 2020</td>
<td>Munich, DE</td>
<td>Jun 08, 2020 - Jun 13, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS Budapest June 2020</td>
<td>Budapest, HU</td>
<td>Jun 08, 2020 - Jun 13, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS Las Vegas Summer 2020</td>
<td>Las Vegas, NV</td>
<td>Jun 08, 2020 - Jun 13, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS Zurich June 2020</td>
<td>Zurich, CH</td>
<td>Jun 15, 2020 - Jun 20, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS Silicon Valley - Cupertino 2020</td>
<td>Cupertino, CA</td>
<td>Jun 22, 2020 - Jun 27, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS London June 2020</td>
<td>OnlineGB</td>
<td>Jun 01, 2020 - Jun 06, 2020</td>
<td>Live Event</td>
</tr>
<tr>
<td>SANS OnDemand</td>
<td>Books & MP3s Only</td>
<td>Anytime</td>
<td>Self Paced</td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://www.sans.org/reading-room/whitepapers/compliance/eaudit-designing-generic-tool-review-entitlements-36027", "len_cl100k_base": 14913, "olmocr-version": "0.1.53", "pdf-total-pages": 41, "total-fallback-pages": 0, "total-input-tokens": 86229, "total-output-tokens": 14882, "length": "2e13", "weborganizer": {"__label__adult": 0.0002770423889160156, "__label__art_design": 0.0004954338073730469, "__label__crime_law": 0.00039005279541015625, "__label__education_jobs": 0.0016918182373046875, "__label__entertainment": 6.663799285888672e-05, "__label__fashion_beauty": 0.00013244152069091797, "__label__finance_business": 0.0012083053588867188, "__label__food_dining": 0.00023305416107177737, "__label__games": 0.0004360675811767578, "__label__hardware": 0.0007457733154296875, "__label__health": 0.00023734569549560547, "__label__history": 0.00015091896057128906, "__label__home_hobbies": 9.018182754516602e-05, "__label__industrial": 0.0003705024719238281, "__label__literature": 0.00015735626220703125, "__label__politics": 0.00016617774963378906, "__label__religion": 0.0002040863037109375, "__label__science_tech": 0.01209259033203125, "__label__social_life": 0.00010192394256591796, "__label__software": 0.0252532958984375, "__label__software_dev": 0.955078125, "__label__sports_fitness": 0.0001550912857055664, "__label__transportation": 0.00019359588623046875, "__label__travel": 0.00012612342834472656}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 53632, 0.03029]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 53632, 0.15104]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 53632, 0.83212]], "google_gemma-3-12b-it_contains_pii": [[0, 72, false], [72, 1204, null], [1204, 1362, null], [1362, 3751, null], [3751, 5995, null], [5995, 8123, null], [8123, 9529, null], [9529, 11792, null], [11792, 13112, null], [13112, 14838, null], [14838, 16081, null], [16081, 17188, null], [17188, 17797, null], [17797, 18872, null], [18872, 19706, null], [19706, 21467, null], [21467, 22156, null], [22156, 24580, null], [24580, 25714, null], [25714, 26738, null], [26738, 28110, null], [28110, 28927, null], [28927, 30236, null], [30236, 30304, null], [30304, 31526, null], [31526, 34319, null], [34319, 36056, null], [36056, 37109, null], [37109, 37140, null], [37140, 38051, null], [38051, 39529, null], [39529, 42963, null], [42963, 47233, null], [47233, 48031, null], [48031, 48725, null], [48725, 50580, null], [50580, 50621, null], [50621, 50662, null], [50662, 51518, null], [51518, 52284, null], [52284, 53632, null]], "google_gemma-3-12b-it_is_public_document": [[0, 72, true], [72, 1204, null], [1204, 1362, null], [1362, 3751, null], [3751, 5995, null], [5995, 8123, null], [8123, 9529, null], [9529, 11792, null], [11792, 13112, null], [13112, 14838, null], [14838, 16081, null], [16081, 17188, null], [17188, 17797, null], [17797, 18872, null], [18872, 19706, null], [19706, 21467, null], [21467, 22156, null], [22156, 24580, null], [24580, 25714, null], [25714, 26738, null], [26738, 28110, null], [28110, 28927, null], [28927, 30236, null], [30236, 30304, null], [30304, 31526, null], [31526, 34319, null], [34319, 36056, null], [36056, 37109, null], [37109, 37140, null], [37140, 38051, null], [38051, 39529, null], [39529, 42963, null], [42963, 47233, null], [47233, 48031, null], [48031, 48725, null], [48725, 50580, null], [50580, 50621, null], [50621, 50662, null], [50662, 51518, null], [51518, 52284, null], [52284, 53632, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 53632, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 53632, null]], "pdf_page_numbers": [[0, 72, 1], [72, 1204, 2], [1204, 1362, 3], [1362, 3751, 4], [3751, 5995, 5], [5995, 8123, 6], [8123, 9529, 7], [9529, 11792, 8], [11792, 13112, 9], [13112, 14838, 10], [14838, 16081, 11], [16081, 17188, 12], [17188, 17797, 13], [17797, 18872, 14], [18872, 19706, 15], [19706, 21467, 16], [21467, 22156, 17], [22156, 24580, 18], [24580, 25714, 19], [25714, 26738, 20], [26738, 28110, 21], [28110, 28927, 22], [28927, 30236, 23], [30236, 30304, 24], [30304, 31526, 25], [31526, 34319, 26], [34319, 36056, 27], [36056, 37109, 28], [37109, 37140, 29], [37140, 38051, 30], [38051, 39529, 31], [39529, 42963, 32], [42963, 47233, 33], [47233, 48031, 34], [48031, 48725, 35], [48725, 50580, 36], [50580, 50621, 37], [50621, 50662, 38], [50662, 51518, 39], [51518, 52284, 40], [52284, 53632, 41]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 53632, 0.26813]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
1062df419b8954cb7942e06b7b74fe8cccfe03f2
|
Calvin Ko
Trusted Information Systems, Inc.
444 Castro Street, Suite 800
Mountain View, CA 94041
ko@tis.com
Manfred Ruschitzka Karl Levitt
Department of Computer Science
University of California, Davis
Davis, CA 95616
{ruschitzka, levitt}@cs.ucdavis.edu
Abstract
This paper describes a specification-based approach to detect exploitations of vulnerabilities in security-critical programs. The approach utilizes security specifications that describe the intended behavior of programs and scans audit trails for operations that are in violation of the specifications. We developed a formal framework for specifying the security-relevant behavior of programs, on which we based the design and implementation of a real-time intrusion detection system for a distributed system. Also, we wrote security specifications for 15 Unix setuid root programs. Our system detects attacks caused by monitored programs, including security violations caused by improper synchronization in distributed programs. Our approach encompasses attacks that exploit previously unknown vulnerabilities in security-critical programs.
1. Introduction
Many security problems are directly or indirectly related to vulnerabilities in security-critical programs (e.g., privileged programs). Intruders exploit vulnerabilities in these programs to gain unauthorized access or to exceed their privileges in a system. Also, inappropriate uses of these programs could lead to security breaches.
Intrusion detection is an alternative approach to coping with these problems besides testing and verification. Three major approaches to intrusion detection are anomaly detection, misuse detection, and specification-based detection. Anomaly detection [1, 2] assumes that attacks will result in behavior different from that normally observed in a system, and can be detected by comparing the current behavior with the pre-established normal behavior. Statistics-based [11, 5], rule-based [15], and immunology-based [3] methods have been employed in modeling normal behavior. Anomaly detection has the advantage that no specific knowledge about security flaws is required in order to detect penetrations. However, it is difficult to set up the anomaly thresholds so that attacks produce significant anomalies. In addition, anomaly detection alone cannot detect all kinds of intrusions, since not all intrusions produce an identifiable anomaly.
Misuse detection [11, 9, 4] attempts to identify known patterns of intrusions (intrusion signatures) when they occur. A misuse detection system detects intrusions by matching the audit trails with the set of predefined signatures. It can guarantee the detection of an intrusion if a signature of the intrusion is included in the system. However, it cannot detect previously unknown attacks, since it is not possible to specify intrusion signatures for exploiting a vulnerability if the vulnerability is still unknown. Also, it is difficult to write signatures that capture all variants of an intrusion (e.g., different ways to exploit a known weakness).
Specification-based detection [8] relies on program specifications that describe the intended behavior of security-critical programs. The monitoring of executing programs involves detecting deviations of their behavior from these specifications, rather than detecting the occurrence of specific attack patterns. Thus, attacks can be detected even though they may not previously have been encountered. Early efforts focused on sequential programs, and their intended behavior was specified in terms of a static set of allowable operations [8].
This paper introduces a formal intrusion-detection model that makes use of traces, ordered sequences of execution events, for specifying the intended behavior of concurrent programs in distributed systems. A formal
specification language expresses the set of valid operation sequences of such programs in a general and efficient manner. Moreover, an intrusion detection system for distributed computer systems and networks is discussed. According to the model, a specification describes valid operation sequences of the execution of one or more programs, collectively called a (monitored) subject. A sequence of operations performed by the subject that does not conform to the specification is considered a security violation. Since a specification determines whether an execution trace of a subject is valid, it is called a trace policy.
The valid operation sequences of subjects are specified in terms of grammars whose alphabets are system operations. We developed a novel type of grammar, parallel environment grammars (PE-grammars), for specifying trace policies. PE-grammars can describe many different classes of trace policies that are important to security, including behavior related to synchronization in concurrent or distributed programs. Parsing of audit trails thus becomes the detection mechanism in a specification-based detection system; it detects operations performed by subjects that are in violation of the trace policies. We designed PE-grammars in a way that permits them to be parsed efficiently in many practically important cases.
We developed a prototype intrusion detection system for Unix and wrote trace policies for 15 Unix programs. Our method can be used to detect known attacks on these programs and has the potential to detect previously unknown attacks. It can also detect exploitations of race-conditions in privileged programs and security violations caused by improper synchronization in distributed programs.
The remainder of the paper is organized as follows. Section 2 identifies several aspects of program behavior that are important to security. Section 3 describes the basic concepts and the monitoring model. Section 4 describes the specification language. Section 5 describes the design and implementation of a prototype specification-based detection system for a distributed system. Section 6 presents conclusions and suggests future research.
2. Security-Relevant Aspects of Program Behavior
Our goal is to specify the intended behavior of programs that are security-relevant, as it is not possible to specify in full the behavior of a program. In this section, we discuss and identify aspects of program behavior that are relevant to security.
- **Accesses of system objects:** A simple but important aspect of the behavior a program is the set of objects (e.g., files) it accesses. The executing program is treated as the subject of access control. Specifying the files a program can access permit the detection of many attacks involving privileged programs in Unix. In most cases, the number of files that a privileged program needs to access is very limited, and can be enumerated easily. For example, the finger daemon `fingerd` should execute only the finger program `(/usr/ucb/finger)`, and read only some status files (e.g., `/etc/utmp, .plan, .profile`). An attacker who exploits the finger daemon causing it to perform any other operations (e.g., execute programs other than the finger program or modify the password file) will be caught. By specifying the valid accesses of a privileged program, it is possible to detect attacks that cause the privileged program to perform accesses that are not part of the specification. In addition, one can specify the access policy of a suspect program so that any unauthorized accesses of files can be detected even if the program is a Trojan horse.
- **Sequencing:** In some situations, it is not only the set of operations performed by a program that is of concern, but also the order of these operations. For example, the `login` program ought to read the password file before it lets a user enter the system by starting a shell program and passing control to the user. Thus, it should be ascertained that the operation of reading the password file appears prior to the execution of a shell in the trace of a `login` program. Another example concerns locking. When a process locks a file for exclusive access, it needs to be ensured that the process removes the lock on the file before it exits in order to prevent the file from being locked permanently.
- **Synchronization:** In a distributed system, security failures often result from improper synchronization of programs. For example, if a user invokes the `passwd` program to change his or her password while the system administrator is editing the password file, the password file may be left inconsistent [7, Chapter 2]. In addition, synchronization problems occur in concurrent or distributed programs, whose execution consists of multiple processes. Therefore, the order among operations performed by different concurrent processes in a concurrent or distributed program is also of concern, and we need to be able to specify valid synchronization behavior of concurrent programs. Two predominant synchronization activities are mutual ex-
clusion and precedence. Since two processes must not modify a file in the system simultaneously, one process has to wait until the other process finishes. Similarly, there may be a precedence relation between operations of different processes (e.g., process B should not read file C until process A finishes writing it).
- Race conditions: A race condition is a special case of the synchronization problem. If a program has a race-condition flaw, an attacker can affect the behavior of the program by performing certain operations during the execution of the program. Monitoring exploitations of a race condition requires monitoring of the operation sequence of the executing program and of all other relevant processes in the system.
3 The Model
A distributed system consists of a number of hosts that are connected by a network. The basic entities that perform operations on objects in the system (e.g., files) are processes. An event denotes an execution of an operation in the system, and is attributed to the process that performs the operation. Events happening in the system can be totally ordered [10], and the history of the system is the sequence of events that occurred since the system started.
Definition 1 (System Traces) The execution of a distributed system $S$ produces a sequence of events
$$v_1, v_2, \ldots, v_i, v_{i+1}, \ldots,$$
which is called a system trace of the system. Each event $v_i$ has an occurrence time, denoted by $C(v_i)$. Events are totally ordered, that is, $C(v_i) < C(v_{i+1})$ for all $i \geq 1$. A sequence of events $v_{i_1}, v_{i_2}, \ldots, v_{i_k}$ is a subtrace of a system trace if $l_1, l_2, \ldots, l_k$ is a subsequence of $1, 2, \ldots$. Two subtraces $v^a_1, v^a_2, \ldots, v^a_k$ and $v^b_1, v^b_2, \ldots, v^b_k$ are said to be distinct if and only if $v^a_i \neq v^b_j$ for all $1 \leq i \leq k$, $1 \leq j \leq l$.
The execution of a sequential process (or simply process) $p_i$ in the system produces a sequence of events
$$v^i_1, v^i_2, \ldots, v^i_i, v^i_{i+1}, \ldots$$
The sequence of events is called a process trace, and denotes the sequence of operations performed by the process from the time it starts to the time it terminates. A process trace is a subtrace of the system trace.
Definition 2 (Merge of Traces) Given two distinct subtraces $V_1$ and $V_2$ of $V$, the merge of the two traces is a subtrace of $V$, denoted by $V_1 \oplus V_2$, and is defined by $V_1 \oplus V_2 = v_1, v_2, v_3, v_4, \ldots, v_{m+n}$ if and only if there exist two subsequences $i_1, \ldots, i_m$ and $j_1, \ldots, j_n$ of the sequence $1, 2, \ldots, m+n$ s.t. $V_1 = v_{i_1}, v_{i_2}, \ldots, v_{i_m}$ and $V_2 = v_{j_1}, v_{j_2}, \ldots, v_{j_n}$.
Definition 3 (Filter of Traces) A filter $\nabla_p$ is a function that maps a trace $V = v_1, v_2, \ldots, v_n$ to another trace $V_*$, a subtrace of $V$, where $p$ is a predicate on the set of possible event attributes, and $V_*$ is obtained from $V$ by removing all events $v_i$ ($i \geq 0$) in $V$ s.t. $p(v_i) = false$. For example, given a predicate $q$ s.t. $q(v)$ is $true$ if only if the event $e$ describes an operation performed by the user $ko$, $\nabla_q(V)$ is a subtrace of $V$ that consists of events caused by $ko$.
3.1. Monitoring Programs
A program is a passive entity. To monitor a program means to monitor the executions of the program. An execution of a program is a distributed process $dp = \{p_1, p_2, \ldots, p_n\}$, $n \geq 1$, which consists of one or more processes. For instance, the execution of a sequential program is a distributed process consisting of a single process, while the execution of a distributed program or a concurrent program is a distributed process which consists of multiple processes.
The trace of a program execution is the sequence of events corresponding to the operations performed by the distributed process, which is the merge of the individual traces of the processes forming the distributed process. With $dp = \{p_1, p_2, \ldots, p_n\}$ denoting the distributed process, the execution trace is
$$V_{dp} = V_{p_1} \oplus V_{p_2} \oplus \cdots \oplus V_{p_n},$$
where $V_{p_i}$ ($1 \leq i \leq n$) is the execution trace of process $p_i$. $V_{dp}$ is a subtrace of the system trace $V$.
A single program can have a number of executions existing at the same time. For example, two users can execute the same program at the same time, resulting in two distributed processes both running the program under the same or different operating systems. In some situations, the executions need to be monitored separately. In other situations, all executions of a program need to be monitored. For example, in order to detect whether a user using $passwd$ and an administrator using $vi$ are modifying the password file simultaneously, all executions of $vi$ by the administrator (i.e., $root$) and all executions of $passwd$ need to be monitored. In this case, the input to the monitor is the merge of the filtered traces corresponding to all executions of $vi$ (predicate: user $root$) and the traces of all executions of $passwd$.
177
3.3. Selection Expression
Each trace policy contains a selection expression, which serves to identify subjects that are to be monitored. The elements in a selection expression are derived from the characteristics of the distributed system, which include the set of programs \( P \), the set of users \( U \), and the set of hosts \( H \). Moreover, the two special symbols * and ? are used to signify "all" and "any", respectively. A selection expression is a list of selectors \( (s_1, s_2, \ldots, s_n) \) where \( s_i (1 \leq i \leq n) \) is a selector of the form
\[
< \text{PID}, \text{PS}, \text{US}, \text{HS} >,
\]
where
- \( \text{PID} \) is the distributed process selector, \( \text{PID} \in \{*, ?\} \),
- \( \text{PS} \) is the program, \( \text{PS} \in P \cup \{*, ?\} \),
- \( \text{US} \) is the user, \( \text{US} \in U \cup \{*, ?\} \), and
- \( \text{HS} \) is the host, \( \text{HS} \in H \cup \{*, ?\} \).
A selection expression identifies one or more subjects. A selection expression without the ? symbol defines a single subject; a selection expression consisting of ? defines a set of subjects. The symbol ? in a selection expression is similar to a variable in a generic template, which is given a value in an instantiation. For instance, \( <*, \text{rdist}, \text{ko}, ?> \) defines a set of subjects which contains the subjects \( <*, \text{rdist}, \text{ko}, \text{k2}>, <*, \text{rdist}, \text{ko}, \text{blanc}>, \) and so on, with ? replaced by each of the hosts in the distributed system. Several selection expressions and the subjects they identify are listed below.
1. \( <?, \text{rdist}, *, *> \) defines a set of subjects; a subject here is a distributed process executing the \( \text{rdist} \) program for any user on any host, for example, \( <234, \text{rdist}, *, *> \).
2. \( <*, \text{passwd}, *, \text{blanc}>, <*, \text{vi}, \text{root}, \text{blanc}> \) defines one subject: all executions of \( \text{passwd} \) and all executions of \( \text{vi} \) by \( \text{root} \) on the host \( \text{blanc} \).
3. \( <*, ?, \text{ko}, *> \) defines a set of subjects; a subject refers to all executions of a program \( p (p \in P) \) by user \( \text{ko} \) on any host.
4. \( <*, *, \text{ko}, \text{blanc}> \) defines the user \( \text{ko} \) on the host \( \text{blanc} \).
5. \( <*, *, *, \text{k2}> \) defines the host \( \text{k2} \), i.e., all processes on \( \text{k2} \).
3.2. The Subject of Monitoring
A trace policy describes the valid operation sequences of a single program execution, multiple program executions, a user, a group of users, a host, etc. The entity or entities are collectively called a monitored subject, or simply a subject. At the user level, a subject could be one or more program executions, one or more users, and one or more hosts. At the system level, a subject consists of one or more processes. A host refers to all processes running on the host. A user refers to all processes that are owned by the user.
Monitoring a subject means analyzing the sequence of operations performed by the subject. The execution trace of a subject is the time-ordered sequence of operations performed by the processes forming the subject. The execution trace of a subject \( sp = \{p_1, p_2, \ldots, p_n\} \) is
\[
V_{sp} = V_{p_1} \oplus V_{p_2} \oplus \cdots \oplus V_{p_n},
\]
where \( V_{p_i} (1 \leq i \leq n) \) is the execution trace of process \( p_i \), \( V_{sp} \) is a subtrace of the system trace \( V \). Fig. 1 depicts the situation of monitoring a program execution which involves three processes. Each process produces an execution trace. The process traces are merged to form the single trace of the three processes. The latter trace forms the input to the monitor.
The execution of a program is a distributed process, which is identified by a process ID (pid), the user it is representing, the program it is executing, and the host on which it is running. Given a selection expression and a distributed process identified by its pid, user, program and host, a simple matching operation can determine whether the distributed process belongs to any of the monitored subjects specified by a selection expression.
4. Specification Language
In our approach, a trace policy, which captures the intended behavior of a program, is specified by means of a grammar. This grammar defines a formal language (a set of sentences) whose alphabet consists of program operations. Monitoring a subject amounts to syntax-driven parsing of the sequence of program operations executed by the subject. This sequence of operations (the trace) is obtained from audit trails in real time. An unsuccessful parsing attempt indicates a violation of the trace policy and triggers remedial responses.
4.1. Parallel Environment Grammars
In view of the large variety of possible trace policies and the constraints imposed by real-time parsing, the expressiveness of the grammar and parser efficiency demand special attention. We developed a novel type of grammar, the parallel environment grammar (PE-grammar) [7], to meet these demands. PE-grammars form parallel extensions of environment grammars [12] which have been applied to real-time data translations in heterogeneous relational database systems. Owing to their support of parallel sequences, PE-grammars can be used to specify traces of concurrent processes.
A PE-grammar involves four quantities: a set of terminals (the alphabet), a set of hyperrules, a set of environment variables, and a start expression. Rather than using production rules directly to define a language, PE-grammars use parameterized versions of such rules. These parameterized versions, called hyperrules, serve as templates for the dynamic generation of production rules as the parsing progresses. A production rule is generated by replacing the parameter variables of a hyperrule by their current values. Collectively, the parameter variables are referred to as the environment variables. An environment variable is either global or local to a sub-grammar, analogous to the concept of global and local variables in programming languages. The parallel aspect of a PE-grammar arises from the start expression, which defines several start notions.
A PE-grammar can be viewed as consisting of n sub-grammars, each corresponding to one start notion in the start expression. The sentence derived from the start expression is the ordered merge of the sentence derived from the individual start notions. For an in-depth treatment of PE-grammars, see reference [7].
To introduce the general properties of PE-grammars, we will refer to the specific PE-grammar shown in Fig. 2. This PE-grammar contains two environment variables, E and L. E is a global environment variable and L is a local environment variable. Both environment variables are initialized to 0 on lines 1 and 2. Line 3 denotes the start expression, which consists of the two start notions <proga> and <progB>. In general, the start expression has the form s1 || s2 || ⋯ || sn, where si is a start notion (1 ≤ i ≤ n). In a parallel derivation, each start notion si derives a sentence xi, and the sentence derived from the start expression is the ordered merge x1 ⊕ x2 ⊕ ⋯ ⊕ xn.
Lines 4-11 show the hyperrules of the grammar. In general, a hyperrule has the form
\[ X_0 \rightarrow X_1 X_2 \cdots X_m [B] \]
where \( X_0 \) is a hypertonot, \( X_i, 1 \leq i \leq m \), is either a hypertonot or a terminal, and \( B \) is a set of attached actions. A hypertonot is a tuple \( <x_1, x_2, \cdots, x_n> \), where \( x_i, 1 \leq i \leq n \) is a symbol or an environment variable. The set of attached actions may contain assignments to environment variables and semantic actions. For example, the hyperrule on line 5 has an attached environment assignment which decreases the value of \( E \) by 1.
**Environment Variables**
1. ENV int E = 0;
2. LOCAL ENV int L = 0;
**Start Expression**
3. SE: <proga> || <progB>
**Hyperrules**
4. <proga> → <writeA, E>.
5. <writeA, 0> → <openA> <closeA> \{ E = E - 1 \}.
6. <openA> → open_A \{ E = E + 1; L = 1 \}.
7. <closeA> → close_A.
8. <progb> → <writeB, E>.
9. <writeB, 0> → <openB> <closeB> \{ E = E - 1 \}.
10. <openB> → open_B \{ E = E + 1; L = 1 \}.
11. <closeB> → close_B.
**Figure 2. An Example of a Parallel Environment Grammar.**
Given a hyperrule in a PE-grammar, a production rule is obtained from the hyperrule and the current environment by replacing each environment variable \( e_i \) in
the rule with its current value $V_i$; the hyprerule is called the reference of the generated production rule. A hyprerule serves as a template for the replacement. The left-hand side of the resulting production rule becomes a single protonotion (i.e., a hypernotion without any environment variables) and the right-hand side a combination of protonotions and terminals. The resulting production rules are equivalent to production rules of context-free grammars (with protonotions corresponding to nonterminals) and their applications correspond to derivation steps in context-free grammars.
However, the set of production rules is not constant; it varies with the environment as a derivation progresses. A change in the environment occurs when an environment assignment in $B$ is executed upon successful application of a production rule. For example, the hyprerule on line 4 in Fig. 2 generates the production rule $\langle\text{progA} \rangle \rightarrow \langle\text{writeA}, 0\rangle$ when $E = 0$, and produces the production rule $\langle\text{progA} \rangle \rightarrow \langle\text{writeA}, 1\rangle$ when $E = 1$.
The language defined by the grammar in Fig. 2 is \{openA closeA openB closeB openB closeB openA closeA\}. Table 1 shows a parallel derivation of the sentence \{openA closeA openB closeB\}. Sentential forms labeled with $|$ represent intermediate results of derivation steps that involve executions of environment assignments or semantic actions. In general, a parallel derivation can be thought of as $n$ individual derivations where $s_i$ derives $x_i$ for $1 \leq i \leq n$; the $n$ derivations proceed in parallel and each consists of a sequence of (leftmost) derivation steps. The order among the derivation steps is driven by the occurrence times of the tokens. For an individual derivation, parsing corresponds to a (leftmost) traversal of the derivation tree of $x_i$. We affiliate with each internal node of the derivation tree (which represents a protonotion) a traversal time, the occurrence time of the leftmost leaf node (a token) in the subtree rooted at the internal node. In each step, the node with the earliest traversal time is traversed.
The parallel derivation consists of the two individual derivations of openA closeA from $\langle\text{openA} \rangle$ (steps 1-4) and of openB closeB from $\langle\text{closeA} \rangle$ (steps 5-8). In the table, $L_1^1$ and $L_2^1$ denote the local values of $L$ from the perspective of sub-grammar 1 (corresponding to $\langle\text{progA} \rangle$) and sub-grammar 2 (corresponding to $\langle\text{progB} \rangle$). Let $t_1$, $t_2$, $t_3$, and $t_4$ denote the occurrence times of the tokens openA, closeA, openB and closeB, respectively, i.e., $t_1 < t_2 < t_3 < t_4$. These times pace the traversals of the two derivation trees (cf. discussion of Fig. 3 below). In derivation step 1, the production rule $\langle\text{progA} \rangle \rightarrow \langle\text{writeA}, 0\rangle$, which is obtained from hyprerule 4 in Fig. 2 while the environment has the initial value $E = 0$, is applied to the first senten-
tial form, changing it to $\langle\text{writeA}, 0\rangle$. Step 2 converts it to $\langle\text{openA} \rangle <\langle\text{closeA} \rangle \{E = E - 1\}$. In step 3, $\langle\text{openA} \rangle$ is first changed to openA \{E = E + 1; L = 1\}, and after the execution of the environment assignment (which sets $E$ and $L$ to 1) it becomes openA. Similarly, step 4 results in openA closeA after setting $E$ to 0. The derivation of openB closeB proceeds analogously.

Fig. 3 depicts the derivation trees of the parallel derivation and shows a subscript for the traversal time affiliated with each node. The first derivation step expands $\langle\text{progA} \rangle$ (rather than $\langle\text{progB} \rangle$) because $t_1 < t_3$. The next two derivation steps expand $\langle\text{writeA}, 0\rangle$ and $\langle\text{openA} \rangle$ for the same reason. Since $t_2 < t_3$, $\langle\text{closeA} \rangle$ is expanded next, followed by $\langle\text{progB} \rangle$.
Note that openA openB closeA closeB is not a sentence of the grammar; after step 3 sets $E$ to 1, $\langle\text{progB} \rangle$ (which would have an earlier traversal time than $\langle\text{closeA} \rangle \{E = E - 1\}$) derives $\langle\text{writeA}, 1\rangle$, which does not match any of the left-hand sides of the grammar. Thus, the parser returns a failure indication which signals the detection of a violation of the trace policy.
4.2. A Trace Policy for Rdist
The program rdist [13] (Remote File Distribution Program) is a Unix utility for maintaining identical copies of files over multiple hosts. It has a race-condition flaw 1, which enables an attacker to acquire root privileges. The flaw relates to the way in which rdist updates a file as well as to the semantics of the chown and chmod system calls regarding symbolic links. Specifically, the flaw enables a nonprivileged user to change the permission mode of any file in the system. It has been exploited by attackers to set the setuid bit of a system shell (e.g., /bin/sh), resulting in a setuid root shell that is publicly executable. We explain below how our method detects such an attack.
---
1. The flaw exists in 4.3 BSD Unix and other variants of Unix.
Table 1. An Example of a Parallel Derivation.
| Step | Sub-grammar 1 | Sub-grammar 2 | E | L | L
|------|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------|---|---|---
| 1. | <writeA, 0> | <progB> | | 0 | 0
| 2. | <openA> <closeA> \{ E = E - 1 \} | | 0 | 0 | 0
| 3. | open_A \{ E = E + 1; L = 1 \} <closeA> \{ E = E - 1 \} | | 0 | 0 | 0
| 4. | open_A <openA> \{ E = E - 1 \} | | 1 | 1 | 0
| 5. | open_A <closeA> \{ E = E - 1 \} | | 1 | 1 | 0
| 6. | <writeB, 0> | | 0 | 0 | 0
| 7. | <openB> <closeB> \{ E = E - 1 \} | | 0 | 0 | 0
| 8. | open_B \{ E = E + 1; L = 1 \} <closeB> \{ E = E - 1 \} | | 1 | 1 | 1
Fig. 4. A PE-grammar for Monitoring Rdist.
Fig. 4 shows the trace policy for *rdist*. This PE-grammar describes the valid operations of a single *rdist* execution. Line 1 shows the selection expression for the subjects with which the specification is concerned. For this specification, it describes the operation sequence of a single execution of *rdist* on the host *blanc*. Lines 2-6 show the initial environment assignments. *U* is initialized to the user associated with the execution, which is returned from `getuser()`. *PID* contains the process ID (obtained from `getpid()`) of the process corresponding to the execution. FILECD (PATHCD) is an associative array for storing the *inode* numbers (path names) of the files created by the program execution. They are both initialized to empty and are changed during parsing when a create-file operation is recognized. HOME is initialized to the home directory of the invoker, which is `/export/home/<Username>`. Its value will not be changed thereafter.
On line 7, the start expression contains only the start notion `<rdist>`, which implies that the input is described by the hypernotion `<rdist>`.
Hyperrule 8 recursively defines the input as a repetition of the valid operations specified by `<valid_op>`, the second alternative represents the termination condition.
Hyperrule 9 describes the operations *rdist* is allowed to perform. It has 9 alternative right-hand sides. The first alternative contains just a terminal, and each of the remaining eight alternatives contains a terminal followed by one or more semantic actions. The tokens recognized by the hyperrule are `open_r_worldread` and `open_r_not_worldread`, `open_r` operation on a publicly readable file, `open_r_not_worldread`, `open_r` operation on a file that is not publicly readable `open_rw`, `create_file` (any operation that results in creation of a file), `create_dir` (any operation that results in creation of a directory), `symlink`, `chown`, `chmod`, and `rename`.
The semantic actions in the various alternatives of the hyperrule check the attributes (such as the path name and the *inode* of the file) of the recognized operation to determine whether the operation is valid. They raise a violation for an invalid operation by calling the function `violation()`. Several attributes of operations are referenced in the semantic actions: *F* denotes characteristics of the process and the file associated with the recognized operation, *P* denotes the path name of the file, *M.newuid* denotes the new owner and *M.newpt* denotes the new path name. The semantic action in the second alternative of hyperrule 9 in Fig. 4 raises a
violation if the file is not created by the process. The semantic action in the third alternative raises a violation if the recognized open rw operation is not associated with a device file. There are three semantic actions following creat file in the fourth alternative. The first semantic action raises a violation if the file associated with the operation is not inside the /tmp directory or the home directory (specified by the environment variable HOME). The second and third semantic actions update the environment variables FILECD and PATHCD to indicate that a new file and a new path has been created. The semantic action following symlink raises a violation if the file is not inside the /tmp directory or the home directory. The semantic actions following chown and chmod raise a violation if the file is not created by the process. The semantic action following rename raises a violation if the old path name associated with the rename operation is not created by the program or the new path name is not inside the home directory of the invoker.
To summarize, the trace policy specifies that an execution of rdist on host blanc may (1) open a publicly readable file for reading, (2) open a file that is created for reading, (3) open a device file for both reading and writing, (4) create a new file, directory, or symbolic link in the /tmp directory or the home directory of the invoker, (5) change the permission mode and the ownership of a file that it created, and (6) rename a file that it created in the host directory. Since the trace policy allows rdist to change the permission mode of only those files that are created by the program execution itself, attacks that exploit rdist to change the permission mode of other files (e.g., /bin/sh) will be detected.
5. Design and Implementation
The section presents the design and implementation of a specification-based intrusion detection system, the Distributed Program Execution Monitor (DPEM), which monitors executions of programs in a distributed system to detect behavior inconsistent with their trace policies.
5.1. Design of DPEM
The target platform is a distributed system which consists of several hosts connected by a local area network. Each host in the system collects audit trails about the system operations that occur in the host, which should include all system calls.
DPEM consists of a director, a specification manager, trace dispatchers, trace collectors, and analyzers situated in various hosts in the distributed system. Our design combines distributed data collection and data reduction with decentralized analysis. Our system enables audit data to be collected and filtered in individual hosts and data analysis to be carried out concurrently on multiple hosts. Also, each component is designed to minimize the amount of audit data that needs to be transferred across the network.
Fig. 5 depicts the architecture of DPEM from the perspective of a host in the distributed system. It also shows the data flow among its components. Analyzers are the components that perform the monitoring. An analyzer checks the execution trace of a subject for violations with respect to a given trace policy. Thus, an analyzer can be thought of as the runtime counterpart of a policy specification. The number of analyzers running in the system may change dynamically. In Fig. 5, three analyzers are running, and each of them is associated with a different trace policy. The first analyzer may be associated with a trace policy for a single execution of rdist. The second analyzer may be associated with a trace policy concerning the behavior of a single execution of fingerd. The third analyzer may monitor all executions of passwd and vi. Additional analyzers will be started when new subjects need to be monitored. Analyzers terminate when the subjects they monitor exit. For instance, if a user executes rdist, an analyzer associated with the trace policy concerned with rdist will be executed to monitor that execution of rdist (Analyzer 4 in Fig. 5). An analyzer reports
any erroneous behavior of its monitored subject to the director, which carries out the appropriate response for the incident, such as notifying the system security officers or starting up additional analyzers. An analyzer can run on any host in the system. Therefore, the analysis of audit data is distributed among multiple hosts in the distributed system.
A trace dispatcher must be present on each host on which analyzers are running. It is responsible for sending the execution traces of the subjects to the analyzers running on the host. Conceptually, it reads the audit trace from each of the hosts in the system, merges them to form the system trace \( V \) of the whole distributed system, and filters (pred: \( pid \in sp \), see Sec. 3) it to obtain the trace of the subject \( sp \) required by an analyzer. A trace dispatcher gets audit records from the trace collectors situated in various hosts. Depending on the subjects monitored by the attached analyzers, a trace dispatcher may or may not request audit records from the trace collector in a particular host. It identifies the trace collectors from which audit records are needed for monitoring, and it requests audit records from them only as long as they are needed.
A trace collector runs on each host on which an audit trail resides. It fetches the audit records directly from the audit repository and sends the records to the trace dispatchers (possibly situated on different hosts) that request the records. It filters the records such that only the records requested by a dispatcher will be sent, thus minimizing the network bandwidth used by the monitoring system.
The specification manager enables the system administrator to manage the security specifications. An administrator can add, modify, or delete the security specifications in the system through the specification manager interface. The specification manager starts up analyzers to monitor program executions when programs that need to be monitored are executed.
5.2. The Specification Manager
The specification manager keeps all trace policies in a specification database. Each trace policy is associated with a selection expression indicating the subjects with which the policy is concerned. At a high level, a subject can be one or more program executions, one or more users, and one or more hosts. At the system level, a subject consists of one or more distributed processes. When a new distributed process is created, i.e., a program is started, the specification manager checks the selection expressions to determine if the distributed process belongs to any of the monitored subjects. If so, it invokes a corresponding analyzer to monitor the new process.
Recall from Section 3.1 that the execution of a program is a distributed process. A distributed process is identified by a process ID (\( pid \)), the user it is representing, the program it is executing, and the host on which it is running. Given a selection expression and a distributed process identified by its \( pid \), user, program and host, a simple matching can determine whether the distributed process belongs to any of the monitored subjects specified by a selection expression.
When the specification manager receives an audit record indicating a process \( pid \) associated with a user \( u \) who executes a program \( p \) on a host \( h \), it matches \( < pid, p, u, h > \) with the selection expression of each trace policy. If the selection expression of a trace policy matches the audit record, a new subject is instantiated. For example, the selection expression \( < ?, rdist, *, * > \) of a trace policy \( P \) causes the instantiation of the subject \( <456, rdist, *, * > \) when a user executes \( rdist \), and the \( pid \) of the process created is 456. If there is no analyzer associated with \( P \), an analyzer will be started to monitor the subject. In general, no two analyzers monitor the same trace policy and the same subject.
5.3. Analyzers
An analyzer monitors the execution of a subject with respect to a trace policy. A different analyzer is constructed for each trace policy and is invoked when a subject that is to be monitored starts. It determines whether the execution of the monitored subject violates the trace policy by parsing the execution trace.
Fig. 6 shows the structure of an analyzer, which consists of a parallel hyperparser, a lexical analyzer, and a semantic-action module. The parallel hyperparser forms the core of an analyzer. It is constructed based on the PE-grammar representing the trace policy.
Fig. 7 depicts the structure of a parallel hyperparser. A parallel hyperparser consists of a hyperdispatcher, one or more (sequential) hyperparsers, a set of global environment variables shared by all hyperparsers, and
an initialization procedure for performing the initial environment assignments to the global environment variables. Each hyperparser is a top-down parser, similar to the hyperparser of an environment grammar [12].
The next token is available. The hyperprocedure subsequently uses the environment variables to generate the current production rule by obtaining the protons (or terminals) $Y_i$ from the hypernotions (or terminals) $X_i$ on the right-hand side of the hyperrule. The hyperprocedures for the references (see Sec. 4.1) of the protonotions $Y_i$ (or lexical procedures in case the latter are terminals) are first identified and subsequently called in sequence. If all $m$ procedures return successfully, any attached environment assignments or semantic actions $B$ are performed and the hyperprocedure returns indicating success.
If $HP.X_0()$ represents a set of alternative hyperrules, the order in which they are processed is determined by consulting the next input token. Processing is as above, but a failure indication by a called procedure causes the hyperparser to backtrack and start the processing of the next alternative rather than to immediately return with a failure indication.
5.3.3. Parsing
When an analyzer starts, it first calls the initialization procedure of the parallel hyperparser with information on the monitored subject to initialize the environment variables. It also calls the initialization procedure of the lexical analyzer, the dispatcher module, and the semantic action module with information on the subject it monitors. After the initialization, it passes control to the parallel hyperparser.
Within the parallel hyperparser, the hyperdispatcher first performs the global initialization procedures to initialize the global environment variables, and subsequently starts all hyperparsers. It then reads the tokens one by one and dispatches them to the input queue of the appropriate hyperparsers. After dispatching a token to a hyperparser, it waits until the queue of the hyperparser is empty (i.e., the token is accepted) and the hyperparser pauses by calling inspectQueue() for the next token (i.e., any actions following the recognition of the previous token have been performed) before it feeds the next token to another hyperparser. Therefore, only one hyperparser is active at any single time, and all others are blocked waiting for the next token.
When a hyperparser starts, it first initializes its local environment variables. It then calls the hyperprocedure $HP.s_i()$ for the hyperrule with the start notion $s_i$ on the left-hand side. The execution of each hyperparser is driven by the input tokens. A hyperparser either
5.3.1. Hyperparsers
There is one hyperparser per start notion $s_i$ in the start expression. Each hyperparser contains a set of local environment variables, a local initialization procedure for performing the initial environment assignments to the local environment variables, a set of lexical procedures for reading and recognizing the terminals, and a set of (possibly recursive) hyperprocedures for generating and applying production rules. There is one hyperprocedure per hyperrule, where a hyperrule may contain alternative right-hand sides. Also, each hyperparser has a local variable current_token which holds the token it is processing.
5.3.2. Hyperprocedures
The hyperprocedures form the core of a hyperparser. Let $HP.X_0()$ be the hyperprocedure corresponding to the hyperrule $X_0 \rightarrow X_1X_2\cdots X_m[B]$. It first calls the function inspectQueue() to inspect the next token in the input queue and sets current_token to that token. The function inspectQueue() waits and returns when
pauses in a lexical procedure or at the beginning of a
hyperprocedure when the next token is not available,
i.e., the input queue is empty. In particular, the hyper-
procedure $HP_x()$ stops if the next input token is not
available when the hyperparser starts.
The purpose of a hyperparser is to parse the se-
quence of tokens in its input queue and report any vi-
olations. When each hyperparser parses the sequence
of tokens in its input queue successfully, the sentence is
recognized by the parallel hyperparser. Otherwise, the
input sentence is not a sentence of the PE-grammar,
signaling the detection of a violation.
The lexical analyzer scans the source input for tokens
of the PE-grammar. The hyperparser invokes the lex-
ical analyzer with a specification of the expected token
type, and the lexical analyzer returns a success/failure
indication together with the token value in case of suc-
cess. The semantic-action module contains the neces-
sary procedures for performing the semantic actions. It
includes a procedure violation() which reports a viola-
tion and pertinent information to the security officer.
This procedure does not terminate the parser; it allows
parsing to continue. In general, users can code up their
own procedures for semantic actions.
5.4. A Unix Prototype DPEM
We built a prototype DPEM for a single host based
on the design above. It serves as a proof-of-concept
implementation for our approach.
The prototype is written in the C programming lan-
guage [6]. The C programming language was chosen
because of its wide-spread use and portability across
different Unix platforms. The prototype runs under
the Solaris 2.4 operating system and uses the auditing
services provided by the Sun BSM audit subsystem [14].
The BSM audit subsystem provides a log of the ac-
tivities that occur in the system. It records the se-
quence of system events in the order of occurrence.
Thus, the audit trails contain a trace of the system. An
audit record contains information such as the process
ID and the user ID of the process involved as well as
the path name, the inode, and the permission mode of
the files being accessed. However, it does not contain
information about the program the process is running.
Therefore, we added an audit record preprocessor to
associate a program identification with each audit re-
cord.
The audit record preprocessor actually serves two
purposes. First, it filters audit records that are irrele-
vant to the monitoring system. Second, it translates
the BSM audit records into the format required by the
monitoring system. It keeps an array $pg$ that holds the
identification of the program each process is currently
executing. When it reads an audit record associated
with process ID $x$, it associates the program in $pg[x]$ with that record. It monitors all exec and fork calls
and updates the array accordingly. When an exec call
invokes a program P, the program associated with the
new process becomes P. When a fork call creates a new
process, the program associated with the new process
is that of its parent.
Our prototype maintains a table of registered pro-
grams. Each entry contains the name of a program, as
well as the pathname and the inode of the physical file
that contains the program. For the identification of a
program that is started by an execve event, the inode
number in the record is used as the key because the
pathname is not a unique identifier of a program. For
example, an attacker can create a hard link to a setuid
root program and execute the hard link, in effect exe-
cuting the setuid root program. Yet the pathname of the
execve record would not indicate an execution of a
setuid root program.
When the prototype is started, several processes are
typically executing in the system. It is generally im-
possible to trace back how the processes got created
from the audit trail as the audit records could have been
modified or deleted. To obtain identifications of the
programs that existing processes are executing, the
audit record preprocessor inspects the kernel memory
and initializes the array $pg$ when it starts up.
5.5. Experimental Efforts
We have written trace policies for 15 setuid root
programs and servers in Unix, including fingerd, rdist,
sendmail, binnmail, passwd and vi. Using these trace
policies, we tested the prototype with three different
kinds of intrusions. These intrusions exploit vulner-
bilities in rdist, sendmail, and binnmail.
The experiments described below were performed on
a Sun SPARCstation 5 with 32MB of memory running
Solaris 2.4. We configured the audit system to log all
successful events for all users, and for all network dae-
mons including inetd, fingerd, rlogind, and telnetd. The
original version of rdist and sendmail were replaced by
the SUN 4.3 versions, as their vulnerabilities have been
removed in Solaris 2.4. The prototype DPEM runs con-
tinuously and analyzes the audit data generated by the
audit system in real time and reports any violations to
the security specification.
The intrusions were realized using combinations of
a Perl [16] scripts and C programs. One intrusion ex-
loited a vulnerability in rdist; another intrusion ex-
loped a vulnerability in the sendmail program that
causes sendmail to create a setuid shell in the /tmp directory that is owned by root and is publicly executable. A third intrusion caused binmail to overwrite the shadow password file with values that the attacker desires. The prototype detected these intrusions within 0.1 seconds. Also, no noticeable degradation of performance was noted.
Fig. 8 shows the report generated by the prototype DPEM for the first intrusion. The trace policy in Fig 4 was used for rdistr. This intrusion produced two violations. The first was that rdistr changed the ownership of a file not created by the program. The second was that rdistr changed the permission mode of /usr/bin/exech. The time elapsed between the occurrence of the violation and the detection was approximately 0.06 seconds. The time of detection was obtained by the gettimeofday() library call when the hyperparser executed a semantics action that called the violation() function. The time of the operation was obtained from the audit records.
```
% rdistr -t /bin/sh
% /bin/sh
VIOLATION -- Tue May 14 16:52:20 1996 + 0.894236000 sec
--------------
Tue May 14 16:52:20 1996 + 0.520030000 sec
lchown, (5456, 5000, 0, rdistr), nodeid: 27, path: /tmp/r
distr05456
--------------
VIOLATION -- Tue May 14 16:52:20 1996 + 0.972196000 sec
--------------
Tue May 14 16:52:20 1996 + 0.630008500 sec
chmod, (5456, 5000, 0, rdistr), nodeid: 4149, path: /usr/in/exech, mode: 4777
```
Figure 8. A Report Generated by the Prototype DPEM.
We also tested the prototype with a scenario involving simultaneous modifications of the password file. This scenario was simulated manually. In one window, one author logged on as the superuser and executed the command vi /etc/shadow to modify the shadow password file. Subsequently, this author logged on as a normal user in another window and executed passwd to change the password. We used a trace policy which requires that only one execution of passwd or vi can modify the password file at any time. The passwd program obtained the old password, but when it started to modify the password file, the prototype detected and reported the violation. The violation was detected approximately 0.05 seconds after passwd opened the shadow password file.
6. Conclusions
We presented advancements on specification-based intrusion detection [8]. We identified aspects of program behavior that are security-relevant, and presented a detection model based on traces and a formal notion of monitored subjects. The model uses a formal language for describing the intended behavior of programs. In addition, we developed a prototype of a specification-based intrusion detection system that detects attacks exploiting the vulnerabilities of privileged programs in Unix.
Our approach lends itself to a decentralized analysis system, which enhances the scalability of the intrusion detection system. In particular, data analysis is carried out by various analyzers situated on different hosts. Also, audit data that is relevant to an analyzer is precisely defined, thus enabling effective audit filtering at the trace collectors. Moreover, our approach explicitly addresses security problems due to the lack of synchronization in concurrent programs.
An innovation of our approach is the use of grammars for specifying valid traces of programs. It has the advantage that many results of the mature discipline of formal languages can be readily applied. We developed a language framework, parallel environment grammars, for specifying trace policies. These parameterized grammars can express a large variety of trace policies in a compact manner. Yet they can also be parsed efficiently in many cases of practical importance. We described the principal features of such a parsing method, and illustrated its application to the detection of intrusions that exploit vulnerabilities in security-critical programs.
Our detection system is not without limitations. A trace policy deals mainly with operations, e.g., file accesses that a subject is authorized to perform. It does not consider the particular data values that a subject reads or writes. The detection of reading or writing unauthorized data values would require the inclusion of a description of authorized data values in the specifications. Moreover, contemporary audit records would have to be expanded to capture data values, resulting in a significant increase in overhead costs.
In addition to monitoring privileged programs, the specification-based approach can be used to monitor network components or network services that are relevant to security, including domain name services (DNS), network file systems, and routers. The systematic methodology for developing trace policies for programs may also be useful in future research on developing overall security policies for computer systems and networks.
---
3In Solaris 2.4, the occurrence time associated with an audit record denotes the finishing time of the system call.
Acknowledgments
This work was supported in part by the Defense Advanced Research Projects Agency under Contract DOD/DABT63-93-C-0045 (DARPA Order A785) and by the National Security Agency University Research Program under Contract DOD-MDA904-93-C4083. The authors thank Heather Hinton and the anonymous referees for their helpful comments on revising the paper.
References
|
{"Source-Url": "http://seclab.cs.ucdavis.edu/papers/pdfs/ck-mr-kl-97.pdf", "len_cl100k_base": 12402, "olmocr-version": "0.1.50", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 15229, "total-output-tokens": 14071, "length": "2e13", "weborganizer": {"__label__adult": 0.0004489421844482422, "__label__art_design": 0.0004487037658691406, "__label__crime_law": 0.00211334228515625, "__label__education_jobs": 0.001132965087890625, "__label__entertainment": 0.0001220107078552246, "__label__fashion_beauty": 0.0001888275146484375, "__label__finance_business": 0.00032448768615722656, "__label__food_dining": 0.0003185272216796875, "__label__games": 0.0011415481567382812, "__label__hardware": 0.00232696533203125, "__label__health": 0.0005412101745605469, "__label__history": 0.00034880638122558594, "__label__home_hobbies": 0.0001341104507446289, "__label__industrial": 0.0006814002990722656, "__label__literature": 0.0003693103790283203, "__label__politics": 0.00040268898010253906, "__label__religion": 0.0004508495330810547, "__label__science_tech": 0.141357421875, "__label__social_life": 0.00011539459228515624, "__label__software": 0.032989501953125, "__label__software_dev": 0.81298828125, "__label__sports_fitness": 0.0002715587615966797, "__label__transportation": 0.0004448890686035156, "__label__travel": 0.00016355514526367188}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 58255, 0.03154]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 58255, 0.55868]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 58255, 0.89661]], "google_gemma-3-12b-it_contains_pii": [[0, 3926, false], [3926, 9020, null], [9020, 14124, null], [14124, 17883, null], [17883, 22631, null], [22631, 28011, null], [28011, 32519, null], [32519, 36575, null], [36575, 41371, null], [41371, 45065, null], [45065, 50317, null], [50317, 55288, null], [55288, 58255, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3926, true], [3926, 9020, null], [9020, 14124, null], [14124, 17883, null], [17883, 22631, null], [22631, 28011, null], [28011, 32519, null], [32519, 36575, null], [36575, 41371, null], [41371, 45065, null], [45065, 50317, null], [50317, 55288, null], [55288, 58255, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 58255, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 58255, null]], "pdf_page_numbers": [[0, 3926, 1], [3926, 9020, 2], [9020, 14124, 3], [14124, 17883, 4], [17883, 22631, 5], [22631, 28011, 6], [28011, 32519, 7], [32519, 36575, 8], [36575, 41371, 9], [41371, 45065, 10], [45065, 50317, 11], [50317, 55288, 12], [55288, 58255, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 58255, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
d63fe5bb94746eddbb81943a5e9dd62d47ee165f
|
[REMOVED]
|
{"len_cl100k_base": 12129, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 63897, "total-output-tokens": 15116, "length": "2e13", "weborganizer": {"__label__adult": 0.0004010200500488281, "__label__art_design": 0.0004134178161621094, "__label__crime_law": 0.000545501708984375, "__label__education_jobs": 0.0015497207641601562, "__label__entertainment": 0.00010406970977783204, "__label__fashion_beauty": 0.00020396709442138672, "__label__finance_business": 0.00030684471130371094, "__label__food_dining": 0.0005030632019042969, "__label__games": 0.0010852813720703125, "__label__hardware": 0.00107574462890625, "__label__health": 0.00083160400390625, "__label__history": 0.00034165382385253906, "__label__home_hobbies": 0.00016379356384277344, "__label__industrial": 0.0006670951843261719, "__label__literature": 0.0005688667297363281, "__label__politics": 0.00037288665771484375, "__label__religion": 0.0007238388061523438, "__label__science_tech": 0.09063720703125, "__label__social_life": 0.00013577938079833984, "__label__software": 0.007099151611328125, "__label__software_dev": 0.890625, "__label__sports_fitness": 0.0003566741943359375, "__label__transportation": 0.0008893013000488281, "__label__travel": 0.0002191066741943359}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 44763, 0.03885]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 44763, 0.68803]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 44763, 0.82558]], "google_gemma-3-12b-it_contains_pii": [[0, 3379, false], [3379, 6593, null], [6593, 10195, null], [10195, 13530, null], [13530, 16823, null], [16823, 20617, null], [20617, 24548, null], [24548, 26798, null], [26798, 28505, null], [28505, 30429, null], [30429, 33169, null], [33169, 37075, null], [37075, 40774, null], [40774, 42234, null], [42234, 44426, null], [44426, 44763, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3379, true], [3379, 6593, null], [6593, 10195, null], [10195, 13530, null], [13530, 16823, null], [16823, 20617, null], [20617, 24548, null], [24548, 26798, null], [26798, 28505, null], [28505, 30429, null], [30429, 33169, null], [33169, 37075, null], [37075, 40774, null], [40774, 42234, null], [42234, 44426, null], [44426, 44763, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 44763, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 44763, null]], "pdf_page_numbers": [[0, 3379, 1], [3379, 6593, 2], [6593, 10195, 3], [10195, 13530, 4], [13530, 16823, 5], [16823, 20617, 6], [20617, 24548, 7], [24548, 26798, 8], [26798, 28505, 9], [28505, 30429, 10], [30429, 33169, 11], [33169, 37075, 12], [37075, 40774, 13], [40774, 42234, 14], [42234, 44426, 15], [44426, 44763, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 44763, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
7b8b2cfc8d3238afb7ab94ae1affa3f48a0e183a
|
Abstract
This package adds hyper features to the package doc that is used in the documentation system of \LaTeXe. Bookmarks are added and references are linked as far as possible.
Contents
1 Features 2
2 Usage 3
2.1 Options .................................................. 3
2.2 Simple example ........................................... 3
2.3 Example source2e.tex ..................................... 4
3 Implementation 4
3.1 Options .................................................. 4
3.2 Package loading ........................................... 4
3.2.1 Patch for bug latex/4096 ............................. 5
3.3 Bookmarks ............................................... 5
3.4 \tableofcontents ........................................ 6
3.5 \listoffigures .......................................... 6
3.6 \listoftables .......................................... 7
3.7 \thebibliography ....................................... 7
3.8 \theindex ................................................ 7
3.9 \theglossary ........................................... 8
3.10 Index ..................................................... 9
3.11 \PrintDescribeMacro ................................... 11
3.12 \PrintMacroName ....................................... 11
3.13 \theCodelineNo ......................................... 12
3.14 \SpecialUsageIndex .................................... 12
3.15 \autoindex ............................................ 12
3.16 \SpecialEnvIndex ...................................... 13
3.17 \SortIndex ............................................ 13
3.18 \@wrglossary ........................................... 13
3.19 \MacroIndent .......................................... 13
4 Installation 14
4.1 Download ................................................. 14
4.2 Bundle installation ...................................... 14
4.3 Package installation ..................................... 14
4.4 Refresh file name databases ............................. 15
4.5 Some details for the interested ........................ 15
5 Catalogue 15
1 Features
The package adds the following features:
**Bookmarks:** For supporting bookmarks package hyperref is loaded. Some \TeX code inside section titles can cause problems during bookmark processing; these can be warnings, ugly bookmark titles or even errors. With the help of `\pdfstringdefDisableCommands` or `\texorpdfstring` you can manage these things, see hyperref’s package documentation.
**Additional bookmarks:** Unnumbered bookmark entries are generated for:
- Table of contents
- List of figures
- List of tables
- Index
- Glossary
Option `numbered` controls, whether these section or chapters should be numbered. The exception is the table of contents if this it would be the first numbered section. Then just a bookmark is added.
**Metadata:** The loaded package hyperref, enforced by option `pdfusetitle`, tries to detect `\title` and `\author` and sets the corresponding PDF information fields. In case of problems see the previous item about bookmarks. These entries can be overwritten or new ones added by `\hypersetup` after the packages is loaded, see documentation of package hyperref.
**References, links:** Because of package \hyperref `\ref` become links, also `\url`, footnote referencing are supported.
**Index:** The main part of this package deals with index links in order to support the kind of index that package doc provides.
**Thumbnails:** Package `thumbpdf` is loaded for the case that the PDF file also should contain thumbnails, see the documentation of this package. But thumbnail embedding is not really necessary, because nowadays AcrobatReader is able to generate and view thumbnails on the fly.
2 Usage
The purpose of this packages is to add PDF features to the documentation of LaTeX packages. Thus just load the package in the driver file that generates the documentation:
\usepackage{hypdoc}
Package doc is loaded by hypdoc, thus you also can replace a \usepackage{doc} with this line. At any case, the package must be loaded before macros of package doc such as \CodelineIndex or \PageIndex are used.
If the class ltxdoc is used, you can also use the configuration file for this class to add package hypdoc. Add the following line to the file ltxdoc.cfg (or create a new one):
\AtEndOfClass{\RequirePackage{hypdoc}}
2.1 Options
There is one option numbered. It controls, whether the starred versions of section or chapter inside \tableofcontents, \listoffigures, ...should be replaced by the non-star versions.
2.2 Simple example
Example of a simple driver file foobar.drv of a package foobar. Often the driver file is packed in the file foobar.dtx and can be extracted by docstrip or if an instruction file for docstrip is provided by:
tex foobar.ins
Note that although docstrip doesn’t rely on \LaTeX, sometimes you need to run the .ins file through \LaTeX. Oddly enough, often the only \LaTeX feature in use is \NeedsTeXFormat{LaTeX2e} in the first line.
\documentclass{ltxdoc}
\usepackage{hypdoc}
\RecordChanges
\EnableCrossrefs
\CodelineIndex
\begin{document}
\title{Title for package \texttt{foobar}}
\author{Author of package \texttt{foobar}}
\date{...}
\maketitle
\tableofcontents
\DocInput{foobar.dtx}
\PrintChanges
\PrintIndex
\end{document}
Then compile it, for example with pdf\LaTeX.
pdflatex foobar.drv
makeindex -s gind.ist foobar.idx
makeindex -s gglo.ist -o foobar.gls foobar.glo
pdflatex foobar.drv
You will need several cycles until the cross references and similar things are correct.
2.3 Example source2e.tex
The source code of the base of \LaTeX is available as a bunch of .dtx files. \LaTeX provides the file source2e.tex to merge them all together.
Now you can either load package hypdoc in a private copy of this file (please, respect the LPPL) or use the configuration file ltxdoc.cfg. Example that also sets A4 paper size:
\PassOptionsToClass{a4paper}{article}
\AtEndOfClass{\RequirePackage{hypdoc}}
Then source2e.tex can be compiled by pdf\LaTeX, for example:
pdflatex source2e
makeindex -s gind.ist source2e.idx
makeindex -s gglo.ist -o source2e.glo source2e.gls
pdflatex source2e
makeindex -s gind.ist source2e.idx
makeindex -s gglo.ist -o source2e.glo source2e.gls
pdflatex source2e
3 Implementation
The package identification is done at the top of the .dtx file in order to use only one identification string.
For unique command names this package uses HD@ as prefix
3.1 Options
\ifHD@numbered
\newif\ifHD@numbered
\DeclareOption{numbered}{\HD@numberedtrue}
\ProcessOptions*
elax
\fi
3.2 Package loading
\RequirePackage{atveryend}[2010/03/24]
\RequirePackage{doc}
\ifx\numexpr\@undefined\undefined
\RequirePackage{calc}%
\fi
\RequirePackage[%
hyperindex=false,%
pdfusetitle,%
colorlinks,%
pdfpagelabels%
]\hyperref[2002/05/09]%
\hypersetup{%
plainpages=false,%
bookmarksopen,%
bookmarksopenlevel=0,%
pdfstartview={FitBH \hypercalcbp{%
paperheight-\topmargin-1in-\headheight-\headsep%
}},%}
\RequirePackage{thumbpdf}
\newcounter{HD@unique}
\renewcommand{\theHD@unique}{\number\value{HD@unique}}
\g@addto@macro\Hy@UseMaketitleInfos{%
\ifx\@pdfsubject\@empty
\hypersetup{pdfsubject={\fileinfo}}
\fi
}%
\pdfstringdefDisableCommands{%
\let\thanks\@gobble
\let\footnote\@gobble
\def\cs#1{\textbackslash #1}
\let\normalfont\@empty
\let\scshape\@empty
\def\and{\and }
}\
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname mod@math@codes\endcsname\relax
\else
\def\HD@ModFix#1{\mathcode`#1=`#1\relax}
\g@addto@macro\mod@math@codes{%
\HD@ModFix\-%
\HD@ModFix\+%
\HD@ModFix\:%
\HD@ModFix\=%
\HD@ModFix\*%
}%
\fi
\endgroup
3.2.1 Patch for bug latex/4096
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname mod@math@codes\endcsname\relax
\else
\def\HD@ModFix#1{\mathcode`#1=`#1\relax}
\g@addto@macro\mod@math@codes{%
\HD@ModFix\-%
\HD@ModFix\+%
\HD@ModFix\:%
\HD@ModFix\=%
\HD@ModFix\*%
}%
\fi
\endgroup
3.3 Bookmarks
\begingroup\expandafter\expandafter\expandafter\endgroup
\def\HD@sectionpatch{%
\ifHD@numbered
\HD@@sectionpatch{section}%
\HD@@sectionpatch{chapter}%
\else
\let\Hy@writebookmark\HD@disable@writebookmark
\fi
}\endgroup
\def\HD@disable@writebookmark#1#2#3#4#5{}
A wild guessing of the toclevel. There is the hope, that the macro \texttt{#1} starts with a sectioning command.
\begin{verbatim}
def\HD@guesstoclevel#1{%
\expandafter\HD@@guesstoclevel#1\section\HD@end
}
\end{verbatim}
As first section the table of contents shouldn’t go into the toc itself. Also a number looks too funny then. Just a bookmark is enough in this case.
\begin{verbatim}
def\tableofcontents{%
\begingroup
@ifundefined{c@section}{\def\c@section{0}}{}
\expandafter\endgroup\ifcase\c@section
\stepcounter{HD@unique}%
\pdfbookmark[\HD@guesstoclevel{\HDorg@tableofcontents}]{\contentsname}{toc\theHD@unique}%
\HDorg@tableofcontents
\else
@ifHD@numbered
\else
\stepcounter{HD@unique}%
\pdfbookmark[\HD@guesstoclevel{\HDorg@tableofcontents}]{\contentsname}{toc\theHD@unique}%
\fi
\fi
\begingroup
HD@sectionpatch
HDorg@tableofcontents
\endgroup
\fi
}
\end{verbatim}
As first section the list of figures shouldn’t go into the toc itself. Also a number looks too funny then. Just a bookmark is enough in this case.
\begin{verbatim}
def\listoffigures{%
\ifHD@numbered
\else
\stepcounter{HD@unique}%
\pdfbookmark[\HD@guesstoclevel{\HDorg@listoffigures}]{\contentsname}{toc\theHD@unique}%
\fi
\begingroup
HD@sectionpatch
HDorg@listoffigures
\endgroup
\fi
}
\end{verbatim}
3.6 \listoftables
\HDorg@listoftables
\listoftables
def\listoftables{%
ifHD@numbered
else
stepcounter{HD@unique}%
\pdfbookmark[\HD@guesstoclevel{\HDorg@listoftables}]{\contentsname}{toc\theHD@unique}%
fi
begingroup
\HD@sectionpatch\HDorg@listoftables
endgroup
\listoftables
}
3.7 \thebibliography
\HDorg@thebibliography
\thebibliography
def\thebibliography{%
ifHD@numbered
else
stepcounter{HD@unique}%
\pdfbookmark[\HD@guesstoclevel{\HDorg@thebibliography}]{\ifundefined{chapter}{\refname}{\bibname}]{bib\theHD@unique}%
fi
\HD@sectionpatch\HDorg@thebibliography
}}
3.8 \theindex
\HDorg@theindex
\theindex
def\theindex{%
let\HDorg@index@prologue\index@prologue
\let\HDorg@writebookmark\Hy@writebookmark
\HD@sectionpatch
\g@addto@macro\IndexParms{%
ifHD@numbered
else
\let\Hy@writebookmark\HDorg@writebookmark
fi
\let\bfseries\HD@bfseries
\edef\HD@toclevel@index{\HD@guesstoclevel{\index@prologue}}%
\begingroup
\count@=\HD@toclevel@index
7
\advance\count@ by 1 \\
\def\HD@toclevel@subindex{\the\count@}
\endgroup
\def\index@prologue{
\if\HD@numbered
\begin{group}
\stepcounter{\HD@unique}
\let\Hy@writebookmark=\HDorg@writebookmark
\pdfbookmark[\HD@toclevel@index]{\indexname}{index\the\HD@unique}
\end{group}
\else
\fi
\HDorg@index@prologue
}
\HDorg@theindex
\HDorg@bfseries
\let\HDorg@bfseries=\bfseries
\HD@bfseries
\def\HD@bfseries{\futurelet\HD@hfil\HD@@bfseries}
\HD@@bfseries
\def\HD@@bfseries\hfil#1\hfil{\ifx\HD@hfil\hfil\expandafter\HD@@@bfseries\fi\hfil#1\hfil}
\def\HD@@@bfseries\hfil#1\hfil{\ifx\\#1\%
\else
\raisebox{\baselineskip}[0pt]{\kern-\HD@margin\relax
\pdfbookmark[\HD@toclevel@subindex]{#1}{HD.#1}\kern\HD@margin\relax
}\fi
}
\def\HD@margin{1mm}
3.9 \theglossary
\theglossary
\def\theglossary{
\let\HDorg@glossary@prologue=\glossary@prologue
\let\HDorg@writebookmark=\Hy@writebookmark
\HD@sectionpatch
\def\glossary@prologue{
\if\HD@numbered
\else
\fi
\HDorg@glossary@prologue
}
\glossaryname
\providecommand*{\glossaryname}{Change History}
3.10 Index
\HD@helplength
\ifHD@savedest
\newif\ifHD@savedest\HD@savedesttrue
\AtBeginDocument{%
\HD@savedest@init
}
\RequirePackage{rerunfilecheck}[2009/12/10]
\HD@savedest@init
\begingroup
\catcode`\^^M=\active
\@firstofone{
\def\HD@savedest@init{%
\ifHD@savedest
\let\HDorg@tilde~%
\let\~\HD@savedest@entry
\edef\HDorg@catcodeM{\the\catcode`\^^M}%
\catcode`\^^M=\active
\def\M{}%
\InputIfFileExists{\jobname.hd}{}{}%
\let\~\HDorg@tilde
\catcode`\^^M=\HDorg@catcodeM\relax
\newwrite\HD@savedest@out
\RerunFileCheck{\jobname.hd}{%}
\immediate\closeout\HD@savedest@out
}
\else
\let\HD@savedest@add\@gobble
\fi
}
\HD@savedest@entry
\def\HD@savedest@entry#1\^^M{%
\@namedef{HD.#1}{}%
\def\M{}%
\InputIfFileExists{\jobname.hd}{}{}%
\let\~\HDorg@tilde
\catcode`\^^M=\HDorg@catcodeM\relax
\newwrite\HD@savedest@out
\RerunFileCheck{\jobname.hd}{}%
\immediate\closeout\HD@savedest@out
}
\else
\let\HD@savedest@add\@gobble
\fi
}
\endgroup
\def\HD@savedest@add{\immediate\write\HD@savedest@out{\string~#1}}
\ifHD@targetraise\newif\ifHD@targetraise\HD@targetraisetrue\HD@target{\ifHD@targetraise\ifhmode\settoheight{\HD@helplength}{[H]}\addtolength{\HD@helplength}{0.4ex}\raisebox{\HD@helplength}[0pt][0pt]{\HD@maketarget}\else\HD@maketarget\fi\else\HD@maketarget\fi}
\def\HD@maketarget{\stepcounter{HD@hypercount}\def\HD@next{\llap{\hypertarget{HD.\the\c@HD@hypercount}{}\,}}\ifHD@savedest\expandafter\ifx\csname HD.\the\c@HD@hypercount\endcsname\@empty\else\let\HD@next\relax\fi\HD@next\fi}
\g@addto@macro\CodelineIndex{\let\special@index\HD@codeline@wrindex}
\g@addto@macro\PageIndex{\let\special@index\HD@page@wrindex}
\def\HD@codeline@wrindex#1{\begingroup\let\HDorg@encapchar\encapchar\def\encapchar##1\encapchar##2\@nil{\HDorg@encapcharhdclindex{\the\c@HD@hypercount}{##1}}\codeline@wrindex{#1\encapchar\encapchar\@nil}}
\g@addto@macro\CodelineIndex{\let\special@index\HD@codeline@wrindex}
\g@addto@macro\PageIndex{\let\special@index\HD@page@wrindex}
\begin{document}
\section{Introduction}
In this section, we introduce the main concepts and ideas that will be developed throughout the document. This section sets the stage for the subsequent sections.
\subsection{Concept 1}
Concept 1 is a fundamental idea that underpins much of the work presented in this document. It is essential to understand Concept 1 before proceeding further.
\subsection{Concept 2}
Concept 2 builds upon Concept 1 and introduces new ideas that expand upon the initial framework.
\section{Methodology}
The methodology employed in this work is based on a combination of theoretical and empirical approaches. This section details the specific methods used in the research.
\subsection{Methodology A}
Methodology A is the primary approach used in this study. It involves the following steps:
\begin{itemize}
\item Step 1
\item Step 2
\item Step 3
\end{itemize}
\subsection{Methodology B}
Methodology B complements Methodology A and provides additional insights into the research question.
\section{Results}
The results section presents the findings of the research. These results are based on the data collected and analyzed using the methodologies described in the previous section.
\subsection{Result 1}
Result 1 demonstrates a significant finding that supports the hypothesis discussed in the introduction.
\subsection{Result 2}
Result 2 further substantiates the conclusions drawn from the data analysis.
\section{Discussion}
The discussion section delves deeper into the implications of the results and how they fit into the broader context of the field.
\subsection{Implications of Result 1}
The implications of Result 1 are far-reaching and have important implications for future research.
\subsection{Implications of Result 2}
The implications of Result 2 suggest new directions for future investigation.
\section{Conclusion}
In conclusion, the research presented in this document has shown that...
\section{References}
This section lists the sources and resources used in the research. It serves as a guide for readers interested in exploring the topics further.
\bibitem{Reference1}
Reference 1 provides foundational knowledge that is essential for understanding the concepts discussed in this document.
\bibitem{Reference2}
Reference 2 offers additional perspectives on the topic and expands on some of the ideas presented.
\bibitem{Reference3}
Reference 3 offers further reading and is recommended for those interested in delving deeper into the subject.
\end{document}
3.11 \PrintDescribeMacro
\HDorg@PrintDescribeMacro
\PrintDescribeMacro
\renewcommand\PrintDescribeMacro[1]{%
\begingroup
\let\HDorg@MacroFont\MacroFont
\def\MacroFont{%
\HD@target
\HDorg@MacroFont
}%
\HDorg@PrintDescribeMacro{#1}%
\endgroup
}
3.12 \PrintMacroName
\HDorg@PrintMacroName
\PrintMacroName
\renewcommand\PrintMacroName[1]{%
\begingroup
\let\HDorg@MacroFont\MacroFont
\def\MacroFont{%
\HD@target
\HDorg@MacroFont
}%
\HDorg@PrintMacroName{#1}%
\endgroup
}
3.13 \texttt{\theCodelineNo}
\let\HDorg@theCodelineNo\theCodelineNo
\begin{verbatim}
350 \let\HDorg@theCodelineNo\theCodelineNo
\theCodelineNo
351 \renewcommand*{\theCodelineNo}[1]{
352 \settowidth{\HD@helplength}{\HDorg@theCodelineNo}\ }
353 \ifdim\HD@helplength<\MacroIndent
354 \addtolength{\HD@helplength}{-\MacroIndent}\%
355 \llap{\%
356 \begingroup\HD@target\endgroup
357 \hspace*(-\HD@helplength)\%
358 )\%
359 \else
360 \\HD@target
361 \fi
362 \HDorg@theCodelineNo
363 }
\end{verbatim}
\HDorg@index
\AtBeginDocument{%
\let\HDorg@index\index
%
}
3.14 \texttt{\SpecialUsageIndex}
\let\HDorg@SpecialUsageIndex\SpecialUsageIndex
\begin{verbatim}
364 \AtBeginDocument{%
365 \let\HDorg@index\index
366 }
\end{verbatim}
\HDorg@SpecialUsageIndex
3.15 \texttt{\autoindex}
\begin{verbatim}
371 \HD@target
372 \let\index\HDorg@index
373 \let\HDorg@encapchar\encapchar
374 \edef\encapchar usage{%
375 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
376 )%
377 \HDorg@SpecialUsageIndex[#1]%
378 \endgroup
379 \@esphack
380 }
\end{verbatim}
\begin{verbatim}
382 \expandafter\ifx\csname autoindex\endcsname\relax
383 \else
\end{verbatim}
\autoindex
\begin{verbatim}
385 \renewcommand*{\autoindex}[1]{%
386 \@bsphack
387 \begingroup
388 \HD@target
389 \let\index\HDorg@index
390 \let\HDorg@encapchar\encapchar
391 \edef\encapchar usage{%
392 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
393 )%
\end{verbatim}
3.16 \SpecialEnvIndex
\SpecialEnvIndex
\let\SpecialEnvIndex\SpecialEnvIndex
\SpecialEnvIndex
\renewcommand*{\SpecialEnvIndex}[1]{%
\@bsphack
\begingroup
\HD@target
\let\encapchar\encapchar
\edef\encapchar usage{\the\c@HD@hypercount}{usage}%
}%
\HDorg@SpecialEnvIndex{#1}%
\endgroup
\@esphack }
3.17 \SortIndex
\SortIndex
\let\SortIndex\SortIndex
\renewcommand*{\SortIndex}[2]{%
\@bsphack
\begingroup
\let\index\HD@page@wrindex
\HDorg@SortIndex{#1}{#2}%
\endgroup
\@esphack }
3.18 \@wrglossary
\@wrglossary
\let\wrglossary\@wrglossary
\def\@wrglossary#1{%
\let\encapchar\encapchar
\def\encapchar##1\encapchar##2\@nil{\HDorg@encapchar hdpindex{##1}%
}%
\HDorg@wrglossary{#1\encapchar\encapchar\@nil}%
}
3.19 \MacroIndent
\MacroIndent automatically calculated.
\AfterLastShipout{%
\if@filesw
\endgroup
}
4 Installation
4.1 Download
Package. This package is available on CTAN:\(^1\):
Bundle. All the packages of the bundle ‘oberdiek’ are also available in a TDS compliant ZIP archive. There the packages are already unpacked and the documentation files are generated. The files and directories obey the TDS standard.
CTAN:install/macros/latex/contrib/oberdiek.tds.zip
TDS refers to the standard “A Directory Structure for \TeX{} Files” (CTAN:tds/tds.pdf). Directories with \texttt{texmf} in their name are usually organized this way.
4.2 Bundle installation
Unpacking. Unpack the \texttt{oberdiek.tds.zip} in the TDS tree (also known as \texttt{texmf} tree) of your choice. Example (linux):
```
unzip oberdiek.tds.zip -d ~/texmf
```
Script installation. Check the directory TDS:scripts/oberdiek/ for scripts that need further installation steps. Package \texttt{attachfile2} comes with the Perl script \texttt{pdfatfi.pl} that should be installed in such a way that it can be called as \texttt{pdfatfi}. Example (linux):
```
chmod +x scripts/oberdiek/pdfatfi.pl
cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/
```
4.3 Package installation
Unpacking. The .dtx file is a self-extracting docstrip archive. The files are extracted by running the .dtx through plain \TeX{}:
```
tex hypdoc.dtx
```
\(^1\)ftp://ftp.ctan.org/tex-archive/
Now the different files must be moved into the different directories in your installation TDS tree (also known as \texttt{texmf} tree):
```
hypdoc.sty → tex/latex/oberdiek/hypdoc.sty
hypdoc.pdf → doc/latex/oberdiek/hypdoc.pdf
hypdoc.dtx → source/latex/oberdiek/hypdoc.dtx
```
If you have a \texttt{docstrip.cfg} that configures and enables \texttt{docstrip}'s TDS installing feature, then some files can already be in the right place, see the documentation of \texttt{docstrip}.
### 4.4 Refresh file name databases
If your \TeX{} distribution (\TeX{}, \mikTeX{}, ...) relies on file name databases, you must refresh these. For example, \TeX{} users run \texttt{texhash} or \texttt{mktexlsr}.
### 4.5 Some details for the interested
**Attached source.** The PDF documentation on CTAN also includes the \texttt{.dtx} source file. It can be extracted by AcrobatReader 6 or higher. Another option is \texttt{pdftk}, e.g. unpack the file into the current directory:
```
pdftk hypdoc.pdf unpack_files output .
```
**Unpacking with \LaTeX{}.** The \texttt{.dtx} chooses its action depending on the format:
- **\plain\TeX{}**: Run \texttt{docstrip} and extract the files.
- **\LaTeX{}**: Generate the documentation.
If you insist on using \LaTeX{} for \texttt{docstrip} (really, \texttt{docstrip} does not need \LaTeX{}), then inform the autodetect routine about your intention:
```
latex \let\install=y\input{hypdoc.dtx}
```
Do not forget to quote the argument according to the demands of your shell.
**Generating the documentation.** You can use both the \texttt{.dtx} or the \texttt{.drv} to generate the documentation. The process can be configured by the configuration file \texttt{ltxdoc.cfg}. For instance, put this line into this file, if you want to have A4 as paper format:
```
\PassOptionsToClass{a4paper}{article}
```
An example follows how to generate the documentation with \texttt{pdflatex}:
```
pdflatex hypdoc.dtx
makeindex -s gind.ist hypdoc.idx
pdflatex hypdoc.dtx
makeindex -s gind.ist hypdoc.idx
pdflatex hypdoc.dtx
```
### 5 Catalogue
The following XML file can be used as source for the \TeX{} Catalogue. The elements \texttt{caption} and \texttt{description} are imported from the original XML file from the Catalogue. The name of the XML file in the Catalogue is \texttt{hypdoc.xml}.
```
<catalogue>
<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE entry SYSTEM 'catalogue.dtd'>
<entry datestamp='$Date$' modifier='$Author$' id='hypdoc'>
<name>hypdoc</name>
</entry>
```
An example follows how to generate the documentation with \texttt{pdflatex}:
```
pdflatex hypdoc.dtx
makeindex -s gind.ist hypdoc.idx
pdflatex hypdoc.dtx
makeindex -s gind.ist hypdoc.idx
pdflatex hypdoc.dtx
```
```
6 History
[2002/05/10 v1.0]
• First standalone version.
[2006/02/20 v1.1]
• Option numbered added.
• \HD@savedest@init fixed (empty .hd file triggered first page with fl
ligature).
• Bookmarks for \listoffigures and \listoftables.
• Documentation: features and usage added.
• LPPL 1.3.
[2006/04/27 v1.2]
• \HD@target fixed (multicol.dtx).
[2006/06/01 v1.3]
• Support for package amsdtx's \autoindex added.
[2006/06/02 v1.4]
• Bookmark fixed if there are several table of contents, bibliographies,
glossaries, ...
[2007/04/11 v1.5]
• Line ends sanitized.
[2007/11/12 v1.6]
- Bug fix in \listoffigures (Axel Sommerfeldt).
- Markup added in implementation section.
[2009/12/10 v1.7]
- Use of package rerunfilecheck.
[2010/02/03 v1.8]
- Fix for bug latex/4096 added.
[2010/03/26 v1.9]
- Definition of \HD@SetMacroIndex is provided in the .aux file.
[2011/05/05 v1.10]
- \raisebox in \HD@target with height and depth of 0pt (request of GL).
[2011/08/19 v1.11]
- Latest comma in option list for hyperref removed to avoid option clash because of \TeX 2011/06/27 with the new \in@.
## 7 Index
Numbers written in italic refer to the page where the corresponding entry is described; numbers underlined refer to the code line of the definition; plain numbers refer to the code lines where the entry is used.
<table>
<thead>
<tr>
<th>Symbols</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td>*</td>
<td>59</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>+</td>
<td>56</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>,</td>
<td>279</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>-</td>
<td>55</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>:</td>
<td>57</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@auxout</td>
<td>58</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@bsphack</td>
<td>392,393</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@empty</td>
<td>369,386,401,414</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@esphack</td>
<td>379,396,410,419</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@firstofone</td>
<td>232</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@gobble</td>
<td>41,42,82,85,249</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@ifstar</td>
<td>74</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@ifundefined</td>
<td>34,82,91,145</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@namedef</td>
<td>73,253</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@nameuse</td>
<td>74,85</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@nil</td>
<td>298,303,310,314,424,428</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@pdfsubject</td>
<td>35</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@undefined</td>
<td>10</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>@wrglossary</td>
<td>421,422</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\1</td>
<td>191,318,324</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>^</td>
<td>231,237,238,242</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\u</td>
<td>352,443</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\active</td>
<td>231,238</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\addtolength</td>
<td>265,354</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\advance</td>
<td>165</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\AfterLastShipout</td>
<td>430</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\and</td>
<td>46</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\AtBeginDocument</td>
<td>226,364</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\autoindex</td>
<td>384,385</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\baselineskip</td>
<td>193</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\bfaeries</td>
<td>160,182</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\bibname</td>
<td>145</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\c@HD@hypercount</td>
<td>279,282,300,375,392,406</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\c@section</td>
<td>92,95</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\catcode</td>
<td>231,237,238,242</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\closeout</td>
<td>245</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\codeline@windex</td>
<td>302</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\CodelineIndex</td>
<td>289</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\contentsname</td>
<td>98,105,119,132</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\count@</td>
<td>164,165,166</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\cs</td>
<td>43</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\csname</td>
<td>49,71,72,282,318,324,382</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\DeclareOption</td>
<td>6</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>N</td>
<td>S</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>--------------------</td>
<td>--------------------</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\NeedsTeXFormat</td>
<td>\sshape</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\newcounter</td>
<td>\section</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\newif</td>
<td>\settoheight</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\newlength</td>
<td>\settowidth</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\newwrite</td>
<td>\SortIndex</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\normalfont</td>
<td>\specialindex</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\number</td>
<td>\SpecialEnvIndex</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\numexpr</td>
<td>\SpecialUsageIndex</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\openout</td>
<td>\stepcounter</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\PageIndex</td>
<td>103, 117, 143, 172, 212, 277</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\paperheight</td>
<td>\tableofcontents</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\pdfbookmark</td>
<td>\textbackslash</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\pdfstringdefDisableCommands</td>
<td>\thanks</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\PrintDescribeMacro</td>
<td>\the</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\PrintMacroName</td>
<td>\thebibliography</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\ProcessOptions</td>
<td>\theCodelineNo</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\providecommand</td>
<td>\theglossary</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\ProvidesPackage</td>
<td>\theindex</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\raisebox</td>
<td>\topmargin</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\refname</td>
<td>\value</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\renewcommand</td>
<td>\w</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\RequirePackage</td>
<td>\write</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\RerunFileCheck</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\settoheight</td>
<td>31, 436, 442</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\settowidth</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\specialindex</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\the</td>
<td>166, 237, 279, 282, 300, 375, 392, 406</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\thebibliography</td>
<td>139, 140</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\theCodelineNo</td>
<td>350, 351</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\theglossary</td>
<td>202, 203</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\theindex</td>
<td>150, 151</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>\topmargin</td>
<td>25</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://caligari.dartmouth.edu/doc/texmf-dist/doc/latex/oberdiek/hypdoc.pdf", "len_cl100k_base": 10111, "olmocr-version": "0.1.49", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 53347, "total-output-tokens": 10399, "length": "2e13", "weborganizer": {"__label__adult": 0.0003211498260498047, "__label__art_design": 0.0012645721435546875, "__label__crime_law": 0.0003197193145751953, "__label__education_jobs": 0.00408172607421875, "__label__entertainment": 0.00021278858184814453, "__label__fashion_beauty": 0.0001614093780517578, "__label__finance_business": 0.0005121231079101562, "__label__food_dining": 0.00020694732666015625, "__label__games": 0.0010805130004882812, "__label__hardware": 0.0004529953002929687, "__label__health": 0.0001589059829711914, "__label__history": 0.0005559921264648438, "__label__home_hobbies": 0.00022292137145996096, "__label__industrial": 0.00022912025451660156, "__label__literature": 0.0009527206420898438, "__label__politics": 0.0003249645233154297, "__label__religion": 0.0004589557647705078, "__label__science_tech": 0.00815582275390625, "__label__social_life": 0.00031495094299316406, "__label__software": 0.2379150390625, "__label__software_dev": 0.7412109375, "__label__sports_fitness": 0.0002092123031616211, "__label__transportation": 0.0001832246780395508, "__label__travel": 0.0003249645233154297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28009, 0.04705]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28009, 0.18236]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28009, 0.53393]], "google_gemma-3-12b-it_contains_pii": [[0, 2136, false], [2136, 3785, null], [3785, 5614, null], [5614, 7069, null], [7069, 8408, null], [8408, 9691, null], [9691, 10660, null], [10660, 11624, null], [11624, 12619, null], [12619, 16182, null], [16182, 16701, null], [16701, 18137, null], [18137, 19006, null], [19006, 20469, null], [20469, 23199, null], [23199, 23765, null], [23765, 26483, null], [26483, 26483, null], [26483, 28009, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2136, true], [2136, 3785, null], [3785, 5614, null], [5614, 7069, null], [7069, 8408, null], [8408, 9691, null], [9691, 10660, null], [10660, 11624, null], [11624, 12619, null], [12619, 16182, null], [16182, 16701, null], [16701, 18137, null], [18137, 19006, null], [19006, 20469, null], [20469, 23199, null], [23199, 23765, null], [23765, 26483, null], [26483, 26483, null], [26483, 28009, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28009, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28009, null]], "pdf_page_numbers": [[0, 2136, 1], [2136, 3785, 2], [3785, 5614, 3], [5614, 7069, 4], [7069, 8408, 5], [8408, 9691, 6], [9691, 10660, 7], [10660, 11624, 8], [11624, 12619, 9], [12619, 16182, 10], [16182, 16701, 11], [16701, 18137, 12], [18137, 19006, 13], [19006, 20469, 14], [20469, 23199, 15], [23199, 23765, 16], [23765, 26483, 17], [26483, 26483, 18], [26483, 28009, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28009, 0.11003]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
9d3a3ec045df5d69415012db5397692bff95503f
|
The Homomorphism Problem and Conjunctive Queries
- **Theorem**: Chandra & Merlin, 1977
- CQE and CQC are the “same” problem.
- Moreover, each is an NP-complete problem.
- **Question**: What is the common link?
- **Answer**:
- Both CQE and CQC are “equivalent” to the Homomorphism Problem.
- The link is established by bringing into the picture
- Canonical conjunctive queries and
- Canonical database instances.
Homomorphisms, CQE, and CQC
**The Homomorphism Theorem:** Chandra & Merlin – 1977
For Boolean CQs Q and Q’, the following are equivalent:
- \( Q \subseteq Q' \)
- There is a homomorphism \( h: I^Q \rightarrow I^Q \)
- \( I^Q \models Q' \).
In dual form:
**The Homomorphism Theorem:** Chandra & Merlin – 1977
For instances I and I’, the following are equivalent:
- There is a homomorphism \( h: I \rightarrow I' \)
- \( I' \models Q^I \)
- \( Q'^I \subseteq Q^I \)
The Homomorphism Theorem for non-Boolean Conjunctive Queries
**The Homomorphism Theorem:** Chandra & Merlin – 1977
Consider two k-ary conjunctive queries
\[ Q(x_1, ..., x_k) : \neg R_1(u_1), ..., R_n(u_n) \]
and
\[ Q'(x_1, ..., x_k) : \neg T_1(v_1), ..., T_m(v_m), \]
Then the following are equivalent:
- \( Q \subseteq Q' \)
- There is a homomorphism \( h: I^Q \rightarrow I^Q \) such that
\[ h(x_1) = x_1, h(x_2) = x_2, ..., h(x_k) = x_k. \]
- \( I^Q, x_1, ..., x_k \models Q'. \)
The Homomorphism Theorem for non-Boolean Conjunctive Queries
**Example:** Consider the binary conjunctive queries
\[ Q(x,y) :\ E(y,x), E(x,u) \]
and
\[ Q'(x,y) :\ E(y,x), E(z,x), E(w,x), E(x,u) \]
Then \( Q \subseteq Q' \) because there is a homomorphism
\[ h: \mathcal{I}^{Q'} \rightarrow \mathcal{I}^{Q} \]
with \( h(x) = x \) and \( h(y) = y \),
namely,
\[ h(x) = x, h(y) = y, h(z) = y, h(w) = y, h(u) = u. \]
### The Complexity of Database Query Languages
<table>
<thead>
<tr>
<th>Query Evaluation Problem: Combined Complexity</th>
<th>Relational Calculus</th>
<th>Conjunctive Queries</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>PSPACE-complete</td>
<td>NP-complete</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Query Evaluation Problem: Data Complexity</th>
<th>In LOGSPACE (hence, in P)</th>
<th>In LOGSPACE (hence, in P)</th>
</tr>
</thead>
</table>
<table>
<thead>
<tr>
<th>Query Equivalence Problem</th>
<th>Undecidable</th>
<th>NP-complete</th>
</tr>
</thead>
</table>
<table>
<thead>
<tr>
<th>Query Containment Problem</th>
<th>Undecidable</th>
<th>NP-complete</th>
</tr>
</thead>
</table>
Beyond Conjunctive Queries
- What can we say about query languages of intermediate expressive power between conjunctive queries and the full relational calculus?
- Conjunctive queries form the sublanguage of relational algebra obtained by using only cartesian product, projection, and selection with equality conditions.
- The next step would be to consider relational algebra expressions that also involve union.
Beyond Conjunctive Queries
■ Definition:
- A union of conjunctive queries is a query expressible by an expression of the form \( q_1 \cup q_2 \cup ... \cup q_m \), where each \( q_i \) is a conjunctive query.
- A monotone query is a query expressible by a relational algebra expression which uses only union, cartesian product, projection, and selection with equality condition.
■ Fact:
- Every union of conjunctive queries is a monotone query.
- Every monotone query is equivalent to a union of conjunctive queries, but the union may have exponentially many disjuncts. (normal form for monotone queries).
- Monotone queries are precisely the queries expressible by relational calculus expressions using \( \land, \lor, \text{ and } \exists \text{ only.} \)
Unions of Conjunctive Queries and Monotone Queries
- **Union of Conjunctive Queries**
\[ E \cup \pi_{1,4} (\sigma_{x_2=x_3} (E \times E)) \text{ or, as a relational calculus expression,} \]
\[ E(x_1,x_2) \lor \exists z(E(x_1,z) \land E(z,x_2)) \]
- **Monotone Query**
Consider the relation schemas \( R_1(A,B), R_2(A,B), R_3(B,C), R_4(B,C) \).
The monotone query
\[ (R_1 \cup R_2) \bowtie (R_3 \cup R_4) \]
is equivalent to the following union of conjunctive queries:
\[ (R_1 \bowtie R_3) \cup (R_1 \bowtie R_4) \cup (R_2 \bowtie R_3) \cup (R_2 \bowtie R_4). \]
The Containment Problem for Unions of Conjunctive Queries
Theorem: Sagiv and Yannakakis – 1981
Let \( q_1 \cup q_2 \cup \ldots \cup q_m \) and \( q'_1 \cup q'_2 \cup \ldots \cup q'_n \) be two unions of conjunctive queries. Then the following are equivalent:
1. \( q_1 \cup q_2 \cup \ldots \cup q_m \subseteq q'_1 \cup q'_2 \cup \ldots \cup q'_n \).
2. For every \( i \leq m \), there is \( j \leq n \) such that \( q_i \subseteq q'_j \).
Proof: Use the Homomorphism Theorem
1. \( \Rightarrow \) 2. Since \( I^q_i \models q_i \), we have that \( I^q_i \models q_1 \cup q_2 \cup \ldots \cup q_m \), hence \( I^q_i \models q'_1 \cup q'_2 \cup \ldots \cup q'_n \), hence there is some \( j \leq n \) such that \( I^q_i \models q'_j \), hence (by the Homomorphism Theorem) \( q_i \subseteq q'_j \).
2. \( \Rightarrow \) 1. This direction is obvious.
### The Complexity of Database Query Languages
<table>
<thead>
<tr>
<th></th>
<th>Relational Calculus</th>
<th>Conjunctive Queries</th>
<th>Unions of Conjunctive Queries</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Query Evaluation: Combined Complexity</strong></td>
<td>PSPACE-complete</td>
<td>NP-complete</td>
<td>NP-complete</td>
</tr>
<tr>
<td><strong>Query Evaluation: Data Complexity</strong></td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
</tr>
<tr>
<td><strong>Query Equivalence</strong></td>
<td>Undecidable</td>
<td>NP-complete</td>
<td>NP-complete</td>
</tr>
<tr>
<td><strong>Query Containment</strong></td>
<td>Undecidable</td>
<td>NP-complete</td>
<td>NP-complete</td>
</tr>
</tbody>
</table>
Monotone Queries
- Even though monotone queries have the same expressive power as unions of conjunctive queries, the containment problem for monotone queries has higher complexity than the containment problem for unions of conjunctive queries (syntax/complexity tradeoff).
- **Theorem:** Sagiv and Yannakakis – 1982
The containment problem for monotone queries is $\Pi_2^p$-complete.
- **Note:**
- $\Pi_2^p$ is a complexity class that contains NP and is contained in PSPACE.
- The prototypical $\Pi_2^p$-complete problem is $\forall \exists$-SAT, i.e., the restriction of QBF to formulas of the form
\[ \forall x_1 \cdots \forall x_m \exists y_1 \cdots \exists y_n \varphi. \]
Monotone Queries
Computational Complexity Classes
- LOGSPACE
- NLOGSPACE
- P
- NP
- $\Pi_2^p$
- PSPACE
Monotone Queries
<table>
<thead>
<tr>
<th>Problem</th>
<th>Complexity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Query Containment</td>
<td>$\Pi_2^p$-complete</td>
</tr>
<tr>
<td>Query Equivalence</td>
<td>$\Pi_2^p$-complete</td>
</tr>
<tr>
<td>Query Evaluation</td>
<td>NP-complete</td>
</tr>
<tr>
<td>(combined complexity)</td>
<td></td>
</tr>
</tbody>
</table>
Computational Complexity Classes
Facts:
- \( P \subseteq NP \subseteq \Pi^P_2 \subseteq PH \subseteq PSPACE \)
(these containments are believed to be proper)
- PH is the polynomial hierarchy, which is obtained by starting with NP and then considering all decision problems solvable by a (deterministic) polynomial-time Turing machine with oracles for solving decision problems from lower levels of PH.
- \( \Pi^P_2 \) is the second level of PH.
- \( NP \cup coNP \subseteq \Pi^P_2 \).
- For more information, visit the Petting Complexity Zoo
http://qwiki.stanford.edu/wiki/Petting_Zoo
## The Complexity of Database Query Language
<table>
<thead>
<tr>
<th></th>
<th>Relational Calculus</th>
<th>Conjunctive Queries</th>
<th>Unions of Conjunctive Queries</th>
<th>Monotone Queries</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Query Eval.: Combined Complexity</strong></td>
<td>PSPACE-complete</td>
<td>NP-complete</td>
<td>NP-complete</td>
<td>NP-complete</td>
</tr>
<tr>
<td><strong>Query Eval.: Data Complexity</strong></td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
</tr>
<tr>
<td><strong>Query Equivalence</strong></td>
<td>Undecidable</td>
<td>NP-complete</td>
<td>NP-complete</td>
<td>$\Pi_2^p$-complete</td>
</tr>
<tr>
<td><strong>Query Containment</strong></td>
<td>Undecidable</td>
<td>NP-complete</td>
<td>NP-complete</td>
<td>$\Pi_2^p$-complete</td>
</tr>
</tbody>
</table>
Conjunctive Queries with Inequalities
- **Definition:** Conjunctive queries with inequalities form the sublanguage of relational algebra obtained by using only cartesian product, projection, and selection with equality and inequality (≠, <, ≤) conditions.
- **Example:** Relational schema Movie(title, star)
- Find all movies starring at least two different governors.
- Q(x) :- Movie(x,y), Movie(x,z), Governor(y), Governor(z), y ≠ z
- **Example:** Q(x,y):-- E(x,z), E(z,w), E(w,y), z ≠ w, z < y.
- **Note:** The use of < assumes a total order on the domain of values.
Conjunctive Queries with Inequalities
- FACULTY(name, dpt, salary), CHAIR(name, dpt)
- Find the names of faculty who earn a higher salary than that of their department chair:
\[Q(x) : \text{FACULTY}(x,y,z), \text{FACULTY}(x',y,z'), \text{CHAIR}(x',y), z > z'\]
- Find the names of faculty who are not the lowest paid ones in their department
\[Q(x) : \text{FACULTY}(x,y,z), \text{FACULTY}(x',y,z'), z > z'\]
Conjunctive Queries with Inequalities
**Theorem:** The query containment problem for conjunctive queries with ≠, ≤, ≥ is \( \Pi_2^p \)-complete.
- **A. Klug** – 1988: Membership in \( \Pi_2^p \).
It suffices to test containment on exponentially many “canonical” databases, each of size polynomial in the size of the queries.
- **R. van der Meyden** – 1992: \( \Pi_2^p \)-hardness
\( \Pi_2^p \)-hardness holds, even for conjunctive queries with only ≠.
(difficult reduction)
Note: The Homomorphism Theorem fails for conjunctive queries with inequalities.
Example: Consider the queries
- \( q(x,y) \) :- \( E(x,y), F(u,v) \)
- \( p(x,y) \) :- \( E(x,y), F(u,v), u \neq v \).
Then
- \( q(x,y) \not\subseteq p(x,y) \) (why?)
- Yet, \( I_p \) is the same as \( I_q \);
- in particular, there is a homomorphism \( h: I_p \rightarrow I_q \).
- Note also that \( p(x,y) \subseteq q(x,y) \) (why?)
## The Complexity of Database Query Languages
<table>
<thead>
<tr>
<th></th>
<th>Relational Calculus</th>
<th>Conjunctive Queries</th>
<th>Unions of Conjunctive Queries</th>
<th>Monotone Queries/ Conj. Queries with ≠</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Query Eval.: Combined Complexity</strong></td>
<td>PSPACE-complete</td>
<td>NP-complete</td>
<td>NP-complete</td>
<td>NP-complete</td>
</tr>
<tr>
<td><strong>Query Eval.: Data Complexity</strong></td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
<td>In LOGSPACE (hence, in P)</td>
</tr>
<tr>
<td><strong>Query Equivalence</strong></td>
<td>Undecidable</td>
<td>NP-complete</td>
<td>NP-complete</td>
<td>$II_2^p$-complete</td>
</tr>
<tr>
<td><strong>Query Containment</strong></td>
<td>Undecidable</td>
<td>NP-complete</td>
<td>NP-complete</td>
<td>$II_2^p$-complete</td>
</tr>
</tbody>
</table>
Complexity of Query Containment
- So, the complexity of query containment for conjunctive queries and their variants is well understood.
**Caveat:**
- All preceding results assume set semantics, i.e., queries take sets as inputs and return sets as output (duplicates are eliminated).
- DBMS, however, use bag semantics (multiset semantics), since they return bags (multisets) (recall that duplicates are not eliminated in SQL, unless explicitly specified).
A *Real* Conjunctive Query
- Consider the following SQL query:
Table Employee has attributes salary, dept, ...
```sql
SELECT salary
FROM Employee
WHERE dept = 'CS'
```
- Recall that SQL keeps duplicates, because:
- User may care about duplicates
- \{100, 100, 200\} different than \{100, 200\} for **AVERAGE**
- In general, bags can be more “efficient” than sets.
## Query Evaluation under Bag Semantics
<table>
<thead>
<tr>
<th>Operation</th>
<th>Multiplicity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Union</td>
<td>$m_1 + m_2$</td>
</tr>
<tr>
<td>$R_1 \cup R_2$</td>
<td></td>
</tr>
<tr>
<td>Intersection</td>
<td>$\min(m_1, m_2)$</td>
</tr>
<tr>
<td>$R_1 \cap R_2$</td>
<td></td>
</tr>
<tr>
<td>Product</td>
<td>$m_1 \times m_2$</td>
</tr>
<tr>
<td>$R_1 \times R_2$</td>
<td></td>
</tr>
<tr>
<td>Projection and Selection</td>
<td>Duplicates are not eliminated</td>
</tr>
</tbody>
</table>
- **$R_1$**
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>3</td>
</tr>
</tbody>
</table>
- **$R_2$**
<table>
<thead>
<tr>
<th>B</th>
<th>C</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>4</td>
</tr>
<tr>
<td>2</td>
<td>5</td>
</tr>
</tbody>
</table>
- **$(R_1 \bowtie R_2)$**
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>5</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>5</td>
</tr>
</tbody>
</table>
Bag (Multiset) Semantics
S. Chaudhuri & M.Y. Vardi – 1993
Optimization of *Real* Conjunctive Queries
- Called for a re-examination of conjunctive-query optimization under bag semantics.
- In particular, they initiated the study of the containment problem for conjunctive queries under bag semantics.
Bag Semantics vs. Set Semantics
- $Q^{\text{BAG}}(I)$: Result of evaluating $Q$ on (bag) database instance $I$.
- For bags $R_1$, $R_2$:
$R_1 \subseteq_{\text{BAG}} R_2$ if $m(a, R_1) \leq m(a, R_2)$, for every tuple $a$.
- $Q_1 \subseteq_{\text{BAG}} Q_2$ if for every (bag) database $I$, we have that $Q_1^{\text{BAG}}(I) \subseteq_{\text{BAG}} Q_2^{\text{BAG}}(I)$.
**Fact:**
- $Q_1 \subseteq_{\text{BAG}} Q_2$ implies $Q_1 \subseteq Q_2$ (this is obvious from the definitions).
- The converse does **not** always hold.
Bag Semantics vs. Set Semantics
Fact:
- $Q_1 \subseteq_{BAG} Q_2$ implies $Q_1 \subseteq Q_2$ (this is obvious from the definitions).
- The converse does **not** always hold:
- $Q_1(x,y) :\neg P(x,y), R(x,z)$
- $Q_2(x,y) :\neg P(x,y)$
Then $Q_1 \subseteq Q_2$, but **not** $Q_1 \subseteq_{BAG} Q_2$ (Why?)
Fact: The following statements need **not** be equivalent:
- $Q_1 \subseteq_{BAG} Q_2$
- $Q_1 \land Q_2 \equiv_{BAG} Q_1$
Conjunctive Query Evaluation under Bag Semantics
Consider:
- $K_3$: the complete graph with 3 nodes
- $G=(V,E)$ an arbitrary graph and the canonical conjunctive query $Q^G$ of $G$.
Then
- **Set Semantics**
\[ Q^G(K_3) = \text{“true” if and only if G is 3-colorable.} \]
- **Bag Semantics**
\[ Q^{G\text{-BAG}}(K_3) = \# \text{3-colorings of the graph G}. \]
**Corollary:** The conjunctive query evaluation problem under bag semantics is $\#P$-complete.
Chaudhuri & Vardi - 1993 stated that:
Under bag semantics, the containment problem for conjunctive queries is $\Pi_2^p$-hard.
**Open Problem:**
- What is the exact complexity, under bag semantics, of the containment problem for conjunctive queries?
- Is this problem decidable? Even this is not known to date!
Unions of Conjunctive Queries
**Theorem:** Ioannidis & Ramakrishnan – 1995
Under bag semantics, the containment problem for unions of conjunctive queries is **undecidable**.
**Hint of Proof:**
Reduction from Hilbert’s 10th Problem.
Hilbert’s 10\textsuperscript{th} Problem
- Hilbert’s 10\textsuperscript{th} Problem – 1900
(10\textsuperscript{th} in his list of 23 problems)
Find an algorithm for the following problem:
Given a polynomial equation $p(x_1,...,x_n) = 0$ with integer coefficients,
does it have an all-integer solution?
- Matijasevic – 1971
- Hilbert’s 10\textsuperscript{th} Problem is **undecidable**, hence no such algorithm
exists.
- **Undecidable**, even for degree $d = 4$ and $n = 58$.
Fact: The following variant of Hilbert’s 10th Problem is undecidable:
- Given two polynomials $p_1(x_1, \ldots, x_n)$ and $p_2(x_1, \ldots, x_n)$ with positive integer coefficients and no constant terms, is it true that $p_1 \leq p_2$? i.e., is it true that $p_1(a_1, \ldots, a_n) \leq p_2(a_1, \ldots, a_n)$, for all positive integers $a_1, \ldots, a_n$?
So, there is no algorithm for deciding questions like:
- Is $3x_1^4x_2x_3 + 2x_2x_3 \leq x_1^6 + 5x_2x_3$?
Theorem: Ioannidis & Ramakrishnan – 1995
Under bag semantics, the containment problem for unions of conjunctive queries is undecidable, even if all relations are unary.
Hint of Proof:
- Reduction from the previous variant of Hilbert’s 10th Problem:
- Use joins of unary relations to encode monomials (products of variables).
- Use unions to encode sums of monomials.
Theorem: Ioannidis & Ramakrishnan – 1995
Under bag semantics, the containment problem for unions of conjunctive queries is **undecidable**, even if all relations are unary.
Example: Consider the polynomial $3x_1^4x_2x_3 + 2x_2x_3$
- The monomial $x_1^4x_2x_3$ is encoded by the conjunctive query $P_1(w), P_1(w), P_1(w), P_1(w), P_2(w), P_3(w)$.
- The monomial $x_2x_3$ is encoded by the conjunctive query $P_2(w), P_3(w)$.
- The polynomial $3x_1^4x_2x_3 + 2x_2x_3$ is encoded by the union having:
- three copies of $P_1(w), P_1(w), P_1(w), P_1(w), P_2(w), P_3(w)$ and
- two copies of $P_2(w), P_3(w)$.
---
Unions of Conjunctive Queries
# Computational Complexity of Query Containment
<table>
<thead>
<tr>
<th>Class of Queries</th>
<th>Complexity – Set Semantics</th>
<th>Complexity – Bag Semantics</th>
</tr>
</thead>
<tbody>
<tr>
<td>Conjunctive queries</td>
<td>NP-complete</td>
<td>Open</td>
</tr>
<tr>
<td></td>
<td>Chandra Merlin – 1977</td>
<td></td>
</tr>
<tr>
<td>Unions of conj. queries</td>
<td>NP-complete</td>
<td>Undecidable</td>
</tr>
<tr>
<td>Conj. queries with $\neq, \leq, \geq$</td>
<td>$\Pi^p_2$-complete</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Van der Meyden – 1992</td>
<td></td>
</tr>
<tr>
<td>Relational calculus queries</td>
<td>Undecidable</td>
<td>Undecidable</td>
</tr>
<tr>
<td></td>
<td>Trakhtenbrot - 1949</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Variance of complexity</td>
<td></td>
</tr>
</tbody>
</table>
Bag Semantics and Conjunctive Queries with $\neq$
**Theorem**: Jayram, K... , Vee – 2006
Under bag semantics, the containment problem for conjunctive queries with $\neq$ is **undecidable**.
In fact, this problem is **undecidable** even if
- the queries use only a **single** relation of arity 2;
- the **number of inequalities** in the queries is at most some **fixed constant**.
Bag Semantics and Conjunctive Queries with ≠
**Proof Idea:**
Reduction from another variant of Hilbert’s 10th Problem:
Given homogeneous polynomials $P_1(x_1,\ldots,x_{59})$ and $P_2(x_1,\ldots,x_{59})$ both with integer coefficients and both of degree 5, is $P_1(x_1,\ldots,x_{59}) \leq (x_1)^5 P_2(x_1,\ldots,x_{59})$, for all integers $x_1,\ldots,x_{59}$?
The reduction is much more involved than the earlier reduction for unions of conjunctive queries.
Proof Idea (continued)
- Given polynomials $P_1$ and $P_2$
- Both with integer coefficients
- Both homogeneous, degree 5
- Both with at most $n=59$ variables
- We want to find $Q_1$ and $Q_2$ such that
- $Q_1$ and $Q_2$ are conjunctive queries with inequalities $\gamma_0$
- $P_1(x_1,\ldots,x_{59}) \leq (x_1)^5 P_2(x_1,\ldots,x_{59})$
for all integers $x_1, \ldots, x_{59}$
if and only if
$Q_1(D) \subseteq_{\text{BAG}} Q_2(D)$ for all (bag) databases $D$.
Proof Outline:
Proof is carried out in three steps.
**Step 1:** Only consider DBs of a special form.
Show how to use conjunctive queries to encode polynomials (without using inequalities!)
**Step 2:** “Force” DB to have special form using inequalities.
- If $D$ is not of special form, then $Q_1(D) \subseteq_{BAG} Q_2(D)$ necessarily.
**Step 3:** Show that we only need a single relation of arity 2.
Step 1: DBs of a Special Form - Example
- Encode a homogeneous, 2-variable, degree 2 polynomial in which all coefficients are 1.
\[ P(x_1,x_2) = x_1^2 + x_1x_2 + x_2^2 \]
- DBs of special form:
- Ternary relation TERM consisting of
- \((X_1,X_1,T_1), (X_1,X_2,T_2), (X_2,X_2,T_3)\)
all special DBs have precisely this table for TERM
- Binary relation VALUE
- Table for VALUE varies to encode different values for the variables \(x_1, x_2\).
- Query \(Q : - \text{TERM}(u_1,u_2,t), \text{VALUE}(u_1,v_1), \text{VALUE}(u_2,v_2)\)
Step 1: DBs of a Special Form - Example
- \( P(x_1, x_2) = x_1^2 + x_1 x_2 + x_2^2 \)
\( x_1 = 3, \ x_2 = 2 \), \( P(3,2) = 3^2 + 3 \cdot 2 + 2^2 = 19 \).
- Query \( Q : \text{TERM}(u_1,u_2,t), \text{VALUE}(u_1,v_1), \text{VALUE}(u_2,v_2) \)
- DB \( D \) of special form:
- \( \text{TERM}: \ (X_1,X_1,T_1), \ (X_1,X_2,T_2), \ (X_2,X_2,T_3) \)
- \( \text{VALUE}: \ (X_1,1), \ (X_1,2), \ (X_1,3) \)
\( (X_2,1), \ (X_2,2) \)
**Claim:** \( P(3,2) = 19 = Q^{\text{BAG}}(D) \)
Step 1: DBs of a Special Form - Example
- \( P(3,2) = 3^2 + 3 \cdot 2 + 2^2 = 19. \)
- Query \( Q : \text{TERM}(u_1, u_2, t), \text{VALUE}(u_1, v_1), \text{VALUE}(u_2, v_2) \)
- \( D \) has \( \text{TERM: } (X_1, X_1, T_1), (X_1, X_2, T_2), (X_2, X_2, T_3) \)
\( \text{VALUE: } (X_1, 1), (X_1, 2), (X_1, 3), (X_2, 1), (X_2, 2) \)
- \( Q^{\text{BAG}}(D) = 19, \) because:
- \( t \to T_1, u_1 \to X_1, u_2 \to X_1. \) Hence:
- \( v_1 \to 1, 2, \) or \( 3 \) and \( v_2 \to 1, 2, \) or \( 3 \) so we get \( 3^2 \) witnesses.
- \( t \to T_2, u_1 \to X_1, u_2 \to X_2. \) Hence:
- \( v_1 \to 1, 2, \) or \( 3 \) and \( v_2 \to 1 \) or \( 2, \) so we get \( 3 \cdot 2 \) witnesses.
- \( t \to T_3, u_1 \to X_2, u_2 \to X_2. \) Hence:
- \( v_1 \to 1 \) or \( 2, \) and \( v_2 \to 1 \) or \( 2, \) so we get \( 2^2 \) witnesses.
Step 1: Complete Argument and Wrap-up
- Previous technique only works if all coefficients are 1
- For the complete argument:
- add a fixed table for every term to the DB;
- encode coefficients in the query;
- only table for VALUE can vary.
- **Summary:**
- If the database has a special form, then we can encode separately homogeneous polynomials $P_1$ and $P_2$ by conjunctive queries $Q_1$ and $Q_2$.
- By varying table for VALUE, we vary the variable values.
- No $\neq$-constraints are used in this encoding; hence, conjunctive query containment is **undecidable**, if restricted to databases of the special form.
Step 2: Arbitrary Databases
**Idea:**
Use inequalities ≠ in the encoding queries to achieve the following:
- If a database $D$ is of special form, then we are back to the previous case.
- If a database $D$ is not of special form, then $Q_1(D) \subseteq_{BAG} Q_2(D)$ necessarily.
Step 2: Arbitrary Databases - Hint
1. Ensure that certain “facts” in special-form DBs appear (else neither query is satisfied).
- This is done by adding a part of the canonical query of special-form DBs as subgoals to each encoding query.
2. Modify special-form DBs by adding gadget tuples to TERM and to VALUE.
- TERM: \((X_1, X_1, T_1), (X_1, X_2, T_2), (X_2, X_2, T_3), (T_0, T_0, T_0)\)
- VALUE: \((X_1, 1), (X_1, 2), (X_1, 3), (X_2, 1), (X_2, 2), (T_0, T_0)\)
3. Add extra subgoals to \(Q_2\), so that if \(D\) is not of special form, then \(Q_2\) “benefits” more than \(Q_1\) and, as a result, \(Q_1(D) \subseteq_{BAG} Q_2(D)\).
Step 2: Arbitrary Databases - Example
- \( P_1(x_1, x_2) = x_1^2 + x_1x_2 + x_2^2 \)
- \( \text{Poly}_1(u_1, u_2, t) :- \text{TERM}(u_1, u_2, t), \text{VALUE}(u_1, v_1), \text{VALUE}(u_2, v_2) \)
the query encoding \( P_1 \) on special-form DBs.
- \( \text{TERM}: (X_1, X_1, T_1), (X_1, X_2, T_2), (X_2, X_2, T_3), (T_0, T_0, T_0) \)
- \( \text{VALUE}: (X_1, 1), (X_1, 2), (X_1, 3), (X_2, 1), (X_2, 2), (T_0, T_0) \)
- \( Q_1 :- \text{Poly}_1(u_1, u_2, t) \)
- \( Q_2 :- \text{Poly}_2(u_1, u_2, t), \text{Poly}_1(w_1, w_2, w), w \neq T_1, w \neq T_2, w \neq T_3 \)
**Fact:**
- If DB is of special form, then \( Q_2 \) gets no advantage, because \( w \rightarrow T_0, w_1 \rightarrow T_0, w_2 \rightarrow T_0 \) is the only possible assignment.
- If DB not of special form, say it has an extra fact \((X_2, X_1, T')\),
Step 2: Arbitrary Databases – Wrap-up
- Additional tricks are needed for the full construction.
- Full construction uses seven different control gadgets.
- Additional complications when we encode coefficients.
- Inequalities $\neq$ are used in both queries.
- Number of inequalities $\neq$ depends on size of special-form DBs, not counting the facts in VALUE table.
- Hence, depends on degree of polynomials, # of variables.
- It is a huge constant (about $59^{10}$).
## Complexity of Query Containment
<table>
<thead>
<tr>
<th>Class of Queries</th>
<th>Complexity – Set Semantics</th>
<th>Complexity – Bag Semantics</th>
</tr>
</thead>
<tbody>
<tr>
<td>Conjunctive queries</td>
<td>NP-complete</td>
<td>Open</td>
</tr>
<tr>
<td></td>
<td>CM – 1977</td>
<td></td>
</tr>
<tr>
<td>Unions of conj. queries</td>
<td>NP-complete</td>
<td>Undecidable</td>
</tr>
<tr>
<td></td>
<td>SY - 1980</td>
<td>IR - 1995</td>
</tr>
<tr>
<td>Conj. queries with ≠ , ≤ , ≥</td>
<td>$\Pi_2^p$-complete</td>
<td>Undecidable</td>
</tr>
<tr>
<td></td>
<td>vdM - 1992</td>
<td>JKV - 2006</td>
</tr>
<tr>
<td>First-order (SQL) queries</td>
<td>Undecidable</td>
<td>Undecidable</td>
</tr>
<tr>
<td></td>
<td>Gödel - 1931</td>
<td></td>
</tr>
</tbody>
</table>
Directions for Future Work
- **Major Open Problem:**
Conjunctive query containment problem (no inequalities), under bag semantics.
- Is it **decidable**?
- If so, what is the exact complexity?
- Identify classes of queries for which, under bag semantics, the containment problem is **tractable**.
- Pinpoint the exact complexity of **bag-equivalence**.
Query Containment vs. Query Equivalence
- **Under set semantics,** query equivalence and query containment are reduced to each other, as long as the language is closed under conjunctions. In particular, they are of the same complexity for conjunctive queries and for conjunctive queries with inequalities ≠.
- **Under bag semantics,**
- Query equivalence is reducible to query containment
- Query containment need not be reducible to query equivalence.
- **Under bag semantics,** query equivalence and query containment may have very different complexity.
The Query Equivalence Problem
- **Query Equivalence**: given \( Q_1, Q_2 \), is \( Q_1 \equiv Q_2 \)?
- Under bag semantics,
- For conjunctive queries, it has the same complexity as GRAPH ISOMORPHISM
- Chaudhuri & Vardi - 1993
- For conjunctive queries with inequalities \( \neq \),
- **Lower Bound**: It is GRAPH ISOMORPHISM-hard.
- **Upper Bound**: It is in PSPACE
- Nutt, Sagin, Shurin (Cohen) – 1998
Big gap between the lower and the upper bound.
|
{"Source-Url": "https://courses.soe.ucsc.edu/courses/cmps277/Fall11/01/pages/attached-files/attachments/2805", "len_cl100k_base": 9262, "olmocr-version": "0.1.53", "pdf-total-pages": 50, "total-fallback-pages": 0, "total-input-tokens": 84125, "total-output-tokens": 10636, "length": "2e13", "weborganizer": {"__label__adult": 0.0005583763122558594, "__label__art_design": 0.0005049705505371094, "__label__crime_law": 0.0010585784912109375, "__label__education_jobs": 0.006252288818359375, "__label__entertainment": 0.00023555755615234375, "__label__fashion_beauty": 0.00034880638122558594, "__label__finance_business": 0.0010290145874023438, "__label__food_dining": 0.00103759765625, "__label__games": 0.002330780029296875, "__label__hardware": 0.0010242462158203125, "__label__health": 0.0020046234130859375, "__label__history": 0.0007796287536621094, "__label__home_hobbies": 0.0003142356872558594, "__label__industrial": 0.0011034011840820312, "__label__literature": 0.0016565322875976562, "__label__politics": 0.0005555152893066406, "__label__religion": 0.0008325576782226562, "__label__science_tech": 0.427734375, "__label__social_life": 0.0002636909484863281, "__label__software": 0.01849365234375, "__label__software_dev": 0.5302734375, "__label__sports_fitness": 0.0003972053527832031, "__label__transportation": 0.0011119842529296875, "__label__travel": 0.0003402233123779297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27411, 0.02923]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27411, 0.39638]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27411, 0.72084]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 430, false], [430, 897, null], [897, 1391, null], [1391, 1813, null], [1813, 2774, null], [2774, 3191, null], [3191, 3961, null], [3961, 4539, null], [4539, 5388, null], [5388, 6122, null], [6122, 6812, null], [6812, 7221, null], [7221, 7811, null], [7811, 8516, null], [8516, 9094, null], [9094, 9511, null], [9511, 9994, null], [9994, 10415, null], [10415, 11355, null], [11355, 11814, null], [11814, 12200, null], [12200, 12877, null], [12877, 13181, null], [13181, 13712, null], [13712, 14148, null], [14148, 14617, null], [14617, 14928, null], [14928, 15162, null], [15162, 15658, null], [15658, 16124, null], [16124, 16496, null], [16496, 17144, null], [17144, 18471, null], [18471, 18853, null], [18853, 19313, null], [19313, 19795, null], [19795, 20204, null], [20204, 20751, null], [20751, 21234, null], [21234, 22076, null], [22076, 22707, null], [22707, 22989, null], [22989, 23636, null], [23636, 24463, null], [24463, 24942, null], [24942, 26009, null], [26009, 26371, null], [26371, 26934, null], [26934, 27411, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 430, true], [430, 897, null], [897, 1391, null], [1391, 1813, null], [1813, 2774, null], [2774, 3191, null], [3191, 3961, null], [3961, 4539, null], [4539, 5388, null], [5388, 6122, null], [6122, 6812, null], [6812, 7221, null], [7221, 7811, null], [7811, 8516, null], [8516, 9094, null], [9094, 9511, null], [9511, 9994, null], [9994, 10415, null], [10415, 11355, null], [11355, 11814, null], [11814, 12200, null], [12200, 12877, null], [12877, 13181, null], [13181, 13712, null], [13712, 14148, null], [14148, 14617, null], [14617, 14928, null], [14928, 15162, null], [15162, 15658, null], [15658, 16124, null], [16124, 16496, null], [16496, 17144, null], [17144, 18471, null], [18471, 18853, null], [18853, 19313, null], [19313, 19795, null], [19795, 20204, null], [20204, 20751, null], [20751, 21234, null], [21234, 22076, null], [22076, 22707, null], [22707, 22989, null], [22989, 23636, null], [23636, 24463, null], [24463, 24942, null], [24942, 26009, null], [26009, 26371, null], [26371, 26934, null], [26934, 27411, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27411, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27411, null]], "pdf_page_numbers": [[0, 0, 1], [0, 430, 2], [430, 897, 3], [897, 1391, 4], [1391, 1813, 5], [1813, 2774, 6], [2774, 3191, 7], [3191, 3961, 8], [3961, 4539, 9], [4539, 5388, 10], [5388, 6122, 11], [6122, 6812, 12], [6812, 7221, 13], [7221, 7811, 14], [7811, 8516, 15], [8516, 9094, 16], [9094, 9511, 17], [9511, 9994, 18], [9994, 10415, 19], [10415, 11355, 20], [11355, 11814, 21], [11814, 12200, 22], [12200, 12877, 23], [12877, 13181, 24], [13181, 13712, 25], [13712, 14148, 26], [14148, 14617, 27], [14617, 14928, 28], [14928, 15162, 29], [15162, 15658, 30], [15658, 16124, 31], [16124, 16496, 32], [16496, 17144, 33], [17144, 18471, 34], [18471, 18853, 35], [18853, 19313, 36], [19313, 19795, 37], [19795, 20204, 38], [20204, 20751, 39], [20751, 21234, 40], [21234, 22076, 41], [22076, 22707, 42], [22707, 22989, 43], [22989, 23636, 44], [23636, 24463, 45], [24463, 24942, 46], [24942, 26009, 47], [26009, 26371, 48], [26371, 26934, 49], [26934, 27411, 50]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27411, 0.1814]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
ea35f6b326c9802c408fdf1a99e6ca56ab307309
|
Puppet Plug-in for VMware vRealize Automation
## Contents
**Puppet Plug-in for VMware vRealize Automation** ................................................................. 3
Puppet Plug-in for VMware vRealize Automation ................................................................. 3
What the Puppet plug-in can do ......................................................................................... 3
Installing and configuring a reference implementation ....................................................... 4
Prerequisites ...................................................................................................................... 4
Removing previous versions of the Puppet plug-in ......................................................... 5
Install and configure Puppet Enterprise ....................................................................... 5
Install and configure the Puppet Plug-in ...................................................................... 6
Getting started with vRA on an existing primary server .................................................. 6
Configure the primary server ....................................................................................... 7
Install and configure the Puppet plug-in ................................................................. 11
Add a primary server endpoint in vRA ........................................................................ 11
Managing and provisioning infrastructure with vRA and Puppet .................................... 11
Designing blueprints with Puppet features .................................................................. 11
vRO/vRA property reference ......................................................................................... 12
vRO/vRA actions reference .......................................................................................... 15
Encrypting content with eyaml .................................................................................... 16
Troubleshooting .................................................................................................................. 16
vRO release notes ............................................................................................................ 17
vRO plug-in 3.3 ............................................................................................................... 17
vRO plug-in 3.2 ............................................................................................................... 17
vRO plug-in 3.1 ............................................................................................................... 18
vRO Puppet plug-in 3.0 .................................................................................................. 18
The Puppet Plug-in for vRealize Automation (vRA) provides tools and out-of-the-box components that easily create, provision, and manage application stacks on virtual servers.
This guide walks you through setting up a reference implementation of the plug-in, vRO, and vRA, as well as setting up a production implementation to use on an existing primary server in PE. The reference implementation is meant to be a demo and isn’t designed for out-of-the-box use in production, but you can modify it to meet your needs. See Installing and configuring a reference implementation on page 4 to get started with the reference implementation. If you want to start fresh and intend to use this in production, go to Getting started with vRA on an existing primary server on page 6.
Once you’ve completed this guide, you should have a working environment and examples with which you can develop your own Puppet code, vRO workflows, and vRA blueprints.
What the Puppet plug-in can do
With a single click, Puppet, vRealize Orchestrator (vRO), and vRealize Automation (vRealize Automation) can automatically create a VM, install the Puppet agent, autosign its certificate, add Puppet roles and profiles, install the required Puppet modules and the software they configure, and set up the server for immediate use.
If you’re new to Puppet and vRO, you can use vRO and vRealize Automation to set up a live, functional Puppet managed system with much less effort than building one manually.
If you’re experienced with vRO, vRealize Automation, and Puppet, you can also use this plug-in to model common Puppet workflows as vRO workflows and vRealize Automation blueprints, then deploy them just as easily as other VMs while maintaining the advantages of a Puppet managed infrastructure.
For vRealize Automation Enterprise 7.4 and newer versions of the 7.x line, adding Puppet management to blueprints is built into the vRealize Automation GUI. This plugin is still required for the integration to work. Once you have installed the plugin and configured it with vRealize Automation 7.4 you can drag and drop Puppet management into blueprints.
Installing and configuring a reference implementation
This guide you walks you through installing and configuring a reference implementation of the Puppet plug-in using Puppet Enterprise 2018.1 or newer and vRA 7.3 or newer. This implementation is designed to create a development environment with vRO, vRA, and Puppet running as quickly as possible in order to help you learn how these tools work together.
The reference implementation isn't designed to be used in a production environment. Once you're familiar with how the plug-in works, you can install it into your production vRO/vRA infrastructure and build compatible workflows and blueprints.
The plug-in works with many implementations of Puppet Enterprise, vRO, and vRA. While you can use these instructions to set up this plugin with other versions of Puppet Enterprise and vRO/vRA, we recommend using this reference implementation the first time through.
Note: If you're already experienced with Puppet, vRO, vRA, and the Puppet plug-in, see Managing and provisioning infrastructure with vRA and Puppet on page 11 for a quick reference of properties and usage.
Related information
Managing and provisioning infrastructure with vRA and Puppet on page 11
Once you have configured vRO and the Puppet vRO Plug-in, you can use vRealize Automation (vRA) to request servers using blueprints.
Prerequisites
The Puppet plug-in 3.0 is compatible with the following configurations.
You can use the Puppet plug-in 3.0 with vRA 7.3 Enterprise edition, which includes an advanced GUI experience with drag-and-drop Puppet components on blueprints. To do so, you must have:
- A primary server running Puppet Enterprise 2018.1 or newer
- vRealize Automation Enterprise 7.3
- Either internal/external vRO 7.x appliance (vRA includes an internal vRO appliance)
You can also use the plug-in with any vRA version from 6 to 7.3. To do so, you must have:
- A primary server running Puppet Enterprise 2016.4 or newer
- vRealize Orchestrator 6.x or 7.x (vRA includes an internal vRO appliance)
- vRealize Automation 6.x or 7.x
- vRealize Automation Enterprise 7.3 or newer required for GUI integration
Agent nodes being managed by Puppet must run an operating system supported by the Puppet agent.
Note: The 32-bit version of Microsoft Windows Puppet agent is not compatible with vRO plug-in management. You must use the 64-bit (x64) agent.
Network requirements
In order to use vRealize Automation, you must have the correct port configuration for provisioning the primary server, new Linux VMs, and new Windows VMs.
<table>
<thead>
<tr>
<th>Origin</th>
<th>Destination</th>
<th>Port</th>
</tr>
</thead>
<tbody>
<tr>
<td>vRO</td>
<td>Primary server</td>
<td>SSH (22)</td>
</tr>
<tr>
<td>vRO</td>
<td>new Linux VM</td>
<td>SSH (22)</td>
</tr>
<tr>
<td>vRO</td>
<td>new Windows VM</td>
<td>WinRM (5985, 5986)</td>
</tr>
</tbody>
</table>
## Origin
- new Linux and Windows VMs
<table>
<thead>
<tr>
<th>Destination</th>
<th>Port</th>
</tr>
</thead>
<tbody>
<tr>
<td>Primary server</td>
<td>Primary server (8140)</td>
</tr>
<tr>
<td>Compile masters</td>
<td>Orchestrator (8142)</td>
</tr>
<tr>
<td>Load balancers</td>
<td>MCollective (61613)</td>
</tr>
<tr>
<td></td>
<td>RBAC (4433)</td>
</tr>
</tbody>
</table>
### Removing previous versions of the Puppet plug-in
The plug-in does not currently support upgrades from the previous vRO Puppet plug-in versions.
If you're using any previous version of the plug-in, you must completely remove it before installing a newer version. For best results, delete all puppet elements from the vRO GUI client first and then copy this script from the vRO starter content to the appliance and execute it.
### Install and configure Puppet Enterprise
For this reference implementation of the vRO plug-in, you must use a new, clean installation of Puppet Enterprise with Code Manager disabled. After running the setup script, you can opt to enable Code Manager.
1. Review the Puppet Enterprise hardware and operating system requirements.
2. Install Puppet Enterprise on a VM or server. This will be the primary server and must be accessible over the network from the vRO appliance or server. An easy way to install PE is to run the installer in text mode. Then there is only one question to answer: the password for the PE Console GUI.
3. Add the Puppet plug-in starter pack content by following the instructions in the README.
The starter content repository provides reference implementations of Puppet roles and profiles for Linux and Windows web server stacks, utility scripts to prepare the primary server for vRO, and a templated autosigning script. Once you understand how Puppet, vRO, and vRA work together, you can use these reference implementations to help build your own Puppetized vRO/vRA implementations.
If you’re already experienced with Puppet, vRO, and vRA, you can replace this reference implementation with your own code or control repository.
4. Ensure that the primary server has a valid DNS hostname and NTP configured. If you don’t have or use a DNS server, provide a valid hostname for the server’s IP address in the primary server’s hosts file (typically `/etc/hosts`).
**Note:**
Make sure that a hostname is properly configured on the machines you’re installing PE on. To prevent PowerShell authentication failures, Windows nodes should have their domain/forests configured or an appropriate PowerShell proxy configured prior to running install PE agent workflows.
5. Initiate a Puppet run on the primary server by running `sudo puppet agent -t`
The vRO starter content creates a PE RBAC user and Linux user account on them primary server (both are named `vro-plugin-user`, default password `puppetlabs`) and adds rules to the `sudoers` file allowing it to run commands with elevated privileges as required by the plug-in.
It also adds the following settings to the primary server's `sshd_config`:
```
PermitRootLogin yes
PasswordAuthentication yes
ChallengeResponseAuthentication no
```
© 2020 Puppet, Inc.
6. To display role class descriptions in the vRealize Automation web GUI, the starter content installs `puppet-strings`, a Puppet documentation extraction command built on YARD. If puppet-strings is not installed, you can install it by running:
```bash
puppet resource package puppet-strings provider=puppet_gem
```
Role class descriptions come from the `@summary` tag in your Puppet code, which `puppet-strings` can digest. The vRO starter content role and profile classes already have this built-in. To do this with your own role classes, add a `@summary` line with a 140 characters or less description. For example:
```puppet
# This role installs a MySQL database and sample data
#
# @summary MySQL database server on Linux with sample data
class role::linux_mysql_database {
include profile::linux_baseline
include profile::mysql
include profile::sample_data
}
```
7. If you do not allow a sudo-capable user to run commands for vRO — for instance, if you remove the `vro-plugin-user` account or revoke its sudoers privileges:
a) Provide vRO with remote access to a user account on the primary server with those capabilities, or to the primary server's root user, which is insecure.
b) Make a user with the same username in PE RBAC.
### Install and configure the Puppet Plug-in
For the reference implementation, we recommend using the vRO built into the vRA appliance.
If you choose to install your own vRO, refer to the [vRO documentation](https://docs.vmware.com/en/vsphere-realize-automation/vra/7.6.0/1268_SET_1101.html). If you previously installed version 1.0 or 2.0 of the plug-in, you must [completely remove it](https://docs.vmware.com/en/vsphere-realize-automation/vra/7.6.0/1268_SET_1101.html) before installing version 3.2. The vRO starter content repository includes a script to assist with removing the plug-in.
**Related topics:** [Puppet knowledge base: Removing the Puppet plugin from VMware vRealize Automation](https://kb.puppet.com/solutions/53165)
**Install the Puppet plug-in**
Download and install the Puppet plug-in.
1. Download the Puppet plug-in’s `.vmoapp` package from the [VMware Solution Exchange](https://www.vmware.com/solution-exchange).
3. Click the **Plugins** tab.
4. Click **Install plug-in**.
5. Install the Puppet plug-in’s `.vmoapp` package downloaded from the VMware Solution Exchange. Read and accept the EULA, then click **Install**.
6. After the installation confirmation message appears, click **Startup Options** in the message reminding you to restart the Orchestrator server. In some versions of vRO this message may not appear, but you still must restart the Orchestrator server.
7. On the **Startup Options** page, click **Restart** under the Current Status heading.
### Getting started with vRA on an existing primary server
The following guide provides high level requirements for installing and configuring the Puppet vRO Plug-in using Puppet Enterprise (PE) 2018.1 and vRealize Automation (vRA) 7.x in an existing environment. As existing deployments vary, this guide does not specify implementation details.
For a greenfield deployment, see [Installing and configuring a reference implementation](https://kb.puppet.com/solutions/53165) on page 4.
© 2020 Puppet, Inc.
Configure the primary server on page 7
The Puppet vRO Plug-in requires you install and configure a Puppet Enterprise (PE) 2018.1.0+ primary server, which can be done manually or with a module. Ensure it is accessible on the same network as the vRO appliance.
Install and configure the Puppet plug-in on page 11
Add a primary server endpoint in vRA on page 11
Follow the vRA 7.4 docs to start using vRO plugins in vRA.
Configure the primary server
The Puppet vRO Plug-in requires you install and configure a Puppet Enterprise (PE) 2018.1.0+ primary server, which can be done manually or with a module. Ensure it is accessible on the same network as the vRO appliance.
The easiest way to configure the primary server is using the puppetlabs/vra_puppet_plugin_prep module. The module helps you automatically configure SSH, creates an RBAC user, configures autosign, and installs puppet strings. You still need to classify nodes, create a rule, and add the primary server endpoint manually.
If you decide to use the module to set up your primary server, you can skip over the first four setup processes in this guide and proceed to Role class location on page 10.
If you don't want to use the module for setup, the guide walks you through all of the following steps:
- Configuring ssh into the primary server with a password and running commands as root.
- Creating an RBAC user on the primary server. Note as of plug-in version 3.2, RBAC permissions have changed.
- Configuring autosigning to use challengePassword in the CSR with a shared secret.
- Installing puppet-strings.
- Making sure role manifests are in the environment/site/role/manifests directory.
- Checking nodes are classified with the trustes.extensions.pp_role in the console or $trusted['pp_role'] in the site.pp.
- Configuring PE environment groups to use the trused.extensions.pp_environment fact.
Primary server shell access
The vRO Plug-in needs to be able to ssh into the primary server and run commands. You can run these commands as the root user or a non-root user with sudo.
Configure one of the following on your primary server:
- Root user ssh
- Enable root ssh access
- Non-root user ssh
- Create a local user on the primary server
- Enable ssh with password authentication
- Enable passwordless sudo for the user
An example set of the /etc/sudoers.d/user file:
```bash
## This file allows the vRO plugin user 'vro-plugin-user' to remove nodes that are destroyed in vRO/vRA.
## This file also disallows the user 'vro-plugin-user' from removing the primary server and other PE Internal certs.
Defaults:vro-plugin-user !requiretty
vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet config
print *
vro-plugin-user ALL = (root) NOPASSWD: !/opt/puppetlabs/bin/puppet config
print *
vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet resource
service puppet ensure=stopped
```
Create an RBAC user
The vRO Plug-in uses an RBAC user to read console data. The username and password need to be the same as the ssh user.
1. Create a new user role for the vRO Plug-in.
a) In the console, click Access control > User roles.
b) In the Name field, enter a name for the vRO user.
c) In the Description field, enter a description for the role, for example, vRO Plug-in user role.
d) Click Add role.
2. Assign permissions to the newly created user role to allow for viewing node data.
a) On the User roles page, click vRO Puppet Plug-in
b) Click Permissions.
c) In the Add a permission dropdown, add the following permissions:
<table>
<thead>
<tr>
<th>Type</th>
<th>Action</th>
<th>Instance</th>
</tr>
</thead>
<tbody>
<tr>
<td>Nodes</td>
<td>View node data from PuppetDB</td>
<td></td>
</tr>
<tr>
<td>Agent</td>
<td>Run Puppet on the agent nodes</td>
<td></td>
</tr>
<tr>
<td>Tasks</td>
<td>Run tasks</td>
<td>Tasks: all permitted on all nodes</td>
</tr>
<tr>
<td>Job Orchestrator</td>
<td>Start, stop, and view jobs</td>
<td></td>
</tr>
<tr>
<td>Certificate requests</td>
<td>Accept and reject</td>
<td></td>
</tr>
</tbody>
</table>
d) Click Commit.
3. Create a new RBAC user for the vRO plugin.
Ensure the name of the user is the same as the ssh user.
a) In the console, click Access control > Users.
b) In the Full name field, enter the user name.
c) In the Login field, enter the user name.
d) Click Add local user.
4. Add the new user to the user role you just created.
a) On the User role page, click User role.
b) Click vRO Puppet user.
c) In the Member users tab, in the User name field, select the user you just created.
d) Click Add user, and commit changes.
5. Set the password for the new user to be the same as the ssh password.
a) On the Users page, click the user's full name.
b) Click Generate password reset.
c) Copy the link provided in the message and open it in a new browser window.
**Autosign configuration**
The Puppet vRO Plug-in installs the PE agent on newly deployed nodes.
To avoid manually approving new agent certificates, you can automate this process securely with an autosigning policy. Use the vra_puppet_plugin_prep module to configure autosigning using a shared key when classified on the primary server.
If you want autosigning but don’t want to use the vra_puppet_plugin_prep module, you can configure the same shared-key autosigning manually. The csr_attributes.yaml contains the challengePassword, which can be used inside the autosigning script to confirm that the certificate can be signed.
The vra_puppet_plugin_prep module autosign script:
```ruby
#!/opt/puppetlabs/puppet/bin/ruby
#
# A note on logging:
# This script's stderr and stdout are only shown at the DEBUG level
# of the primary server's logs. This means you won't see the error
# messages in puppetserver.log by default. All you'll see is the exit code.
# https://docs.puppet.com/puppet/latest/ssl_autosign.html#policy-executable-api
#
# Exit Codes:
# 0 - A matching challengePassword was found.
# 1 - No challengePassword was found.
# 2 - The wrong challengePassword was found.
#
require 'puppet/ssl'
csr = Puppet::SSL::CertificateRequest.from_s(STDIN.read)
valid_pass = 'SecretPassword'
if pass = csr.custom_attributes.find do |attribute|
['challengePassword', '1.2.840.113549.1.9.7'].include? attribute['oid']
end
else
puts 'No challengePassword found. Not automatically accepting the request.'
exit 1
end
if pass['value'] == valid_pass
exit 0
else
puts "challengePassword does not match: #{pass['value']}"
exit 2
end
```
© 2020 Puppet, Inc.
Install Puppet strings
Install the puppet-strings gem on the primary server by running the following commands:
```
puppet resource package rgen provider=puppet_gem
puppet resource package puppet-strings provider=puppet_gem
```
The puppet-strings gem is responsible for populating the descriptions of the roles in vRA. The role classes need the @summary tag to populate this section.
An example role with the @summary tag:
```
# This role installs a MySQL database and sample data
#
# @summary MySQL database server on Linux with sample data
class role::linux_mysql_database {
include profile::linux_baseline
include profile::mysql
include profile::sample_data
}
```
Role class location
The Puppet vRO plugin is designed to populate the $trusted['pp_role'] fact with the role specified in the blueprint.
These roles are populated in the vRA UI by looking for <environment>/site/role/manifests/**/*.pp files. The files are then parsed with puppet-strings to populate a summary. Classes in other locations in the control repository are not accessible to the Puppet configuration management item in the vRA blueprint. If you are not using the enterprise version of vRA, you can populate any class by setting the Puppet.RoleClass property in the blueprint.
See the vRO/vRA property reference for more information.
Node classification
The vRO Plug-in populates the $trusted['pp_role'] fact with the classname of the role from the request.
Use the $trusted['pp_role'] fact to classify the node with the class. The reference implementation uses a node group for each role with a rule that matches the role to the trusted.extensions.pp_role fact.
Example of a matching rule for the node group:
```
trusted.extensions.pp_role = role::webserver
```
Alternatively, if you use the site.pp for managing classification, you can leverage the $trusted['pp_role'] for inclusion. For example:
```
if $trusted['pp_role'] and defined($trusted['pp_role']) {
include $trusted['pp_role']
}
```
Use the method that complies with your existing configuration.
Environment group configuration
The PE console is responsible for classifying the node into the correct environment.
In the vRO configuration, each node has the $trusted['pp_environment'] fact populated with the environment configured in vRA. Use the trusted.extensions.pp_environment in the rules for your environment groups. See the environment node group documentation for instructions on creating environment node groups and the rules documentation for adding rules to the environment node group.
An example rule for the development environment group:
trusted.extensions.pp_environment = development
Install and configure the Puppet plug-in
If you choose to install your own vRO, refer to the vRO documentation. If you have previously installed version 1.0 or 2.0 of the plug-in, you must completely remove it before installing version 3.1.
1. Download the Puppet vRO Plug-in's .vmoapp package from the VMware Solution Exchange.
3. Click the Plugins tab.
4. Click Install plug-in.
5. Install the plug-in's .vmoapp package downloaded from the VMware Solution Exchange.
6. Read and accept the End User Terms and Conditions (EULA).
7. Click Install.
8. After the installation confirmation message appears, click the Startup options link in the message reminding you to restart the orchestrator server. In some versions of vRO, this message may not appear, but you must still restart the orchestrator server.
Add a primary server endpoint in vRA
Follow the vRA 7.4 docs to start using vRO plugins in vRA.
Run the Add a Puppet Enterprise (PE) primary server workflow provided by the Puppet vRO Plugin with these parameters:
- Display Name for this Puppet master: The name for this primary server
- Hostname or IP Address: The hostname or IP address of the PE master
- SSH Port: 22
- SSH and RBAC Username: The user you created
- SSH and RBAC Password: The password you configured
- Use sudo for shell commands on this master?: yes (no if using the root user)
After you have added the master endpoint, follow the Designing blueprints with Puppet features documentation.
Managing and provisioning infrastructure with vRA and Puppet
Once you have configured vRO and the Puppet vRO Plug-in, you can use vRealize Automation (vRA) to request servers using blueprints.
Note: If you haven't yet installed vRA, refer to the vRA documentation.
Designing blueprints with Puppet features
In the previous version of the starter content we shipped Blueprints that you could install via CloudClient, but with vRealize Automation 7.4 Enterprise and the Puppet plug-in for vRealize Automation 3.2, it is simpler to create a new blueprint from scratch using the new Puppet component in the GUI. Follow these instructions to create your own blueprints.
Note: You can still access the previous version of these docs for consuming those prebuilt blueprints for vRA 7.x here and download them from this branch of the starter content.
- Create a Puppet Enterprise primary server and follow the instructions at the bottom of the starter content README to install the starter content.
- Remove any previous Puppet plug-ins and install the Puppet plug-in for vRealize Automation 3.0 into vRO.
- Follow the vRA 7.4 docs to add a Puppet endpoint (points to your primary server), and create your Puppet Enterprise blueprints using code from this repo that is now on your primary server.
- Puppet endpoint - username: vro-plugin-user
- Puppet endpoint - password: puppetlabs
- Puppet endpoint - use sudo: true
- Puppet component on blueprints - shared secret (cert autosigning): S3cr3tP@ssw0rd!
Note: For detailed information about designing vRA blueprints, consult the vRA blueprint documentation.
vRO/vRA property reference
The plug-in uses the following properties for blueprint and workflow development.
They can be used when creating traditional IaaS blueprints without the GUI component in vRA 7.4 Enterprise. There is a hierarchy of assignment for these properties. Properties that are set in the GUI override VRA properties set at the VM or tenant level. For certain properties there is a second override version of the property that takes precedence over the non-override version.
Here is a list of vRO JavaScript variables with their corresponding vRA property names, types, and override values where applicable:
puppetRoleClass
vRA property name: Puppet.RoleClass
Override value: Puppet.RoleClass.Override
Type: string
Description: The fully qualified class that implements the node's role.
puppetCodeEnvironment
vRA property name: Puppet.CodeEnvironment
Override value: Puppet.CodeEnvironment.Override
Type: string
Description: The environment on the master in which vRO should look for code.
puppetInstallMaster
vRA property name: Puppet.Master.InstallMaster
Type: string
Description: Optional FQDN or IP Address of the load balancer or compile master to install agent from. Defaults to the Puppet Master selected from vRO inventory.
puppetNodeCertname
vRA property name: Puppet.Node.Certname
Type: string
Description: The agent sets this based on the node's certname, which is based on its fully qualified domain name.
puppetNode
vRA property name: Puppet.Node.IPAddress
Type: string
Description: The IP Address of the node to install Puppet Agent on. Will default to the node name if left undefined.
ignoreChanges
vRA property name: Puppet.Node.IgnoreChanges
Type: boolean
Description: Ignores changes in the Puppet Run. If True, Puppet Runs that exits with changes (exit code 2) will still pass. Defaults to false.
puppetAutosignSharedSecret
vRA property name: Puppet.Autosign.SharedSecret
Override value: Puppet.Autosign.SharedSecret.Override
Type: secureString
Description: The shared secret that nodes should provide to the master in order to autosign certificate requests.
sshUsername
vRA property name: Puppet.SSH.Username
Override value: Puppet.SSH.Username.Override
Type: string
Description: Username used to connect to a node via SSH.
sshPassword
vRA property name: Puppet.SSH.Password
Override value: Puppet.SSH.Password.Override
Type: secureString
Description: Password used to connect to a node via SSH.
winRMUsername
vRA property name: Puppet.WinRM.Username
Override value: Puppet.WinRM.Username.Override
Type: string
Description: Username used to connect to a node via WinRM.
useSudo
vRA property name: Puppet.SSH.UseSudo
Override value: Puppet.SSH.UseSudo.Override
Type: boolean
Description: Use sudo commands run on a node via SSH. This requires NOPASSWD sudo for the user defined in sshUsername.
winRMPassword
vRA property name: Puppet.WinRM.Password
Override value: Puppet.WinRM.Password.Override
Type: secureString
Description: Password used to connect to a node via WinRM.
puppetAgentAccountUser
vRA property name: Puppet.Windows.AgentAccountUser
Override value: Puppet.Windows.AgentAccountUser.Override
Type: string
Description: User for the puppet agent service to run as rather than default of Local System
puppetAgentAccountPassword
vRA property name: Puppet.Windows.AgentAccountPassword
Override value: Puppet.Windows.AgentAccountPassword.Override
Type: secureString
Description: Password for the agent service user
puppetAgentAccountDomain
vRA property name: Puppet.Windows.AgentAccountDomain
Override value: Puppet.Windows.AgentAccountDomain.Override
Type: string
Description: Domain, if any, for the agent service user
UseHTTPS
vRA property name: Puppet.WinRM.UseHTTPS
Type: boolean
Description: If true, use HTTPS for WinRM, if false use HTTP
winRMAuthMethod
vRA property name: Puppet.WinRM.AuthMethod
Type: enum[Basic,Kerberos]
Description: Basic or Kerberos auth method for WinRM
sshKeyPath
vRA property name: Puppet.SSH.KeyPath
Override value: Puppet.SSH.KeyPath.Override
Type: string
Description: A path to the ssh key that can be used instead of password authentication
sshPassphrase
vRA property name: Puppet.SSH.Passphrase
Override value: Puppet.SSH.Passphrase.Override
Type: secureString
Description: A passphrase used for the sshKeyPath
puppetApptier
vRA property name: Puppet.Extensions.Apptier
Override value: Puppet.Extensions.Apptier.Override
Type: string
Description: pp_apptier certificate extension. For example "dev", "uat", "production" etc. Not to be confused with the Puppet code environment.
puppetDepartment
vRA property name: Puppet.Extensions.Department
Override value: Puppet.Extensions.Department.Override
Type: string
Description: pp_department certificate extension. For example, "finance", "digital", etc.
puppetService
vRA property name: Puppet.Extensions.Service
Override value: Puppet.Extensions.Service.Override
Type: string
Description: pp_service certificate extension. For example, "puppet", "corporate_web", etc.
keepFailedVMs
vRA property name: Puppet.Debug.KeepFailedVMs
Type: boolean
Description: To enable returning a successful result despite failures in the module.
vRO/vRA actions reference
The Puppet plug-in ships with several actions that can be used in workflows and integrations with vRA, for instance to populate the contents of input fields or dropdown menus.
For more information, see the vRA documentation for actions.
<table>
<thead>
<tr>
<th>Action name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>escapeShellArgument</td>
<td>Used internally by the plugin to escape a string used in a shell command.</td>
</tr>
<tr>
<td>escapePowerShellValue</td>
<td>Used internally by the plugin to escape a string used in a PowerShell command.</td>
</tr>
<tr>
<td>escapeJSON</td>
<td>Used internally by the plugin to escape a JSON string for structured facts or other uses.</td>
</tr>
<tr>
<td>getSectionText</td>
<td>Used internally by the plugin for parsing Error messages.</td>
</tr>
<tr>
<td>formatShellArguments</td>
<td>Used internally by the plugin to format and escape a set of strings containing arguments to a shell command. Calls escapeShellArgument.</td>
</tr>
<tr>
<td>executeCommand</td>
<td>Used internally by the plugin to execute a shell command on a Linux Puppet master.</td>
</tr>
<tr>
<td>getMasters</td>
<td>Returns an array of strings containing the UUIDs of all of the Puppet:Master objects in the vRO inventory. Returns ["" ] if there are no Puppet:Master objects.</td>
</tr>
<tr>
<td>Action name</td>
<td>Description</td>
</tr>
<tr>
<td>-----------------------------</td>
<td>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</td>
</tr>
<tr>
<td>getMasterByUUID</td>
<td>Returns a Puppet:Master object given a UUID string. Returns null if there is no object matching that UUID.</td>
</tr>
<tr>
<td>getEnvironments</td>
<td>Returns an array of strings which are the environment names on the Puppet:Master specified by a UUID. Returns ["" ] if there are no environments.</td>
</tr>
<tr>
<td>getRoleClasses</td>
<td>Returns an array of strings which are role class names on the Puppet:Master specified by a UUID and in a specified environment. Returns ["" ] if there are no role classes there.</td>
</tr>
<tr>
<td>getRoleClassesWithDescriptions</td>
<td>Used internally, returns specially formatted JSON string used by vRA 7.3 Enterprise with the role classes and their descriptions from a master's environment. Throws an error if no master UUID or environment name provided. Optionally accepts a filter regex string to limit results.</td>
</tr>
</tbody>
</table>
All actions are visible on the "Actions" tab of the Java vRO client when in "Design" view, where you can view the full source code of each action, including parameters and return types.
**Encrypting content with eyaml**
Securing passwords used in the manifest is beyond the scope of this reference implementation. As a starting point, many Puppet deployments use Hiera, a key/value lookup tool for configuration, with eyaml, or encrypted YAML, to solve this problem.
This solution not only provides secure storage for the password value, but also provides parameterization to support reuse, opening the door to easy password rotation policies across an entire network of nodes.
For information, see the Hiera documentation and the blog post Encrypt your data using Hiera-eyaml.
**Troubleshooting**
**Note:** The Puppet Plug-in for VMware vRealize Automation is for vRA 7. Starting in vRA 8, Puppet is integrated directly into vRA by VMware and does not require this plug-in. For details, see the VMware vRealize Automation documentation or contact VMware support.
**Configuring Windows domain and forest on a new Puppet agent node**
The Puppet vRO Plug-in contains features to install and run a Puppet agent on provisioned nodes. Configure networking on newly provisioned nodes to allow the download of the install and request a certificate from the primary server. Set up the domain and forest configuration on Windows hosts before running the "Install PE Agent on Windows Node" workflow to allow for installation of the agent and potential classification of the node into a defined environment.
**Running workflows after upgrading from plug-in version 1.0 or 2.0 results in errors**
The plug-in does not currently support upgrades from the previous vRO Puppet plug-in versions. If you're using any previous version of the plug-in, you must completely remove it before installing. The vRO starter content repository includes a script to assist with removing the plug-in.
**Related topics:** Puppet knowledge base: Removing the Puppet plugin from VMware vRealize Automation
© 2020 Puppet, Inc.
vRO release notes
See the vRO Puppet plug-in documentation for more information about the plug-in and instructions on installing and using it.
**CAUTION:** The plug-in does not support upgrades from previous vRO Puppet plug-in versions. If you're using a previous version of the plug-in, you must completely remove it before installing a newer version. For info on removing the plug-in, see the VMWare knowledge base.
- vRO plug-in 3.3 on page 17
- vRO plug-in 3.2 on page 17
Released 9 July 2019
- vRO plug-in 3.1 on page 18
Released 23 May 2018
- vRO Puppet plug-in 3.0 on page 18
Released May 16, 2017.
**vRO plug-in 3.3**
Released 16 October 2019
This section contains improvements and fixes in this version.
**New in Version 3.3**
- Adds `pp_apptier`, `pp_department` and `pp_service` certificate extensions to Puppet agent install workflows.
- Adds `param` to run Puppet workflows to ignore changes in Puppet run. This support allows those that expect changes or non-zero exit codes from failing the workflow.
- Adds new vRA Properties:
- `puppetApptier`
- `puppetDepartment`
- `puppetService`
- `ignoreChanges`
**Fixes in Version 3.3**
- Fixes running Puppet from PE master to support multiple RBAC service URL on HA masters. Automatically selects the first in the list.
- Fixes an infinite retry bug in the run Puppet from PE master workflow.
- Properly purges node certs on failure of installing PE Agent with role if `keepFailedVMs` is true.
**vRO plug-in 3.2**
Released 9 July 2019
This section contains improvements and fixes in this version.
**New in Version 3.2**
- Workflow to run Puppet from the master orchestrator, works with both Linux and Windows nodes managed by the master.
- Separated the “drop facts” functionality into its own workflow.
- Adds an optional vRA parameter `Puppet.Node.IPAddress` to specify an IPAddress for the node to install an agent on. Used in the event that a hostname is not yet defined in DNS.
© 2020 Puppet, Inc.
• Adds an optional vRA parameter, allowing you to specify an FQDN or IP address of a compile master or load balancer to install from, that is a different server to the master defined in the vRO inventory to manage cert signing.
• Installing an agent with a user-defined environment now sets the `environment` in the puppet.conf of the agent.
Fixes in Version 3.2
• Fixes a backwards compatibility bug introduced in 3.1 that required users to specify a hostname (FQDN) to the “Install PE Agent on Linux Node with SSH” and “Install PE Agent on Windows Node with PowerShell” workflows. The fix allows for IP addresses again.
• Fixes an issue where a user specified certname wasn't being passed into the agent install script.
• Fixes an issue where the plugin did not manage ssh HostKey checking for the ssh connection to the master.
• Fixes shell escaping for Windows paths.
• Fixes inconsistent behavior leading to failures during “drop facts” functionality when installing an agent on Windows.
vRO plug-in 3.1
Released 23 May 2018
This section contains improvements and fixes in this version.
New in Version 3.1
• Support for an SSH key for login to Linux agents.
• First run of Puppet is controlled tightly for better reliability instead of an automatic async run.
• Hostnames are used throughout instead of IP addresses to connect to new agents.
• Many properties have override capability. For example, Puppet.RoleClass.Override
• Accepts Windows MSI installer props so users can set alternate run-as user for Puppet agent (to access network shares, etc).
• Property to exit install workflow with success to preserve hosts for debugging. Puppet.Debug.KeepFailedVMs
• Properties to specify desired Windows auth schemes: Puppet.WinRM.AuthMethod, Puppet.WinRM.UseHTTPS
• No longer dependent on vCenter, which means they might be suitable for AWS, Azure, Openstack provisioning with vRA (not currently with Puppet drag-n-drop component).
Fixes in Version 3.1
• sudo is used everywhere in Linux workflows and actions. It was absent in a couple of places previously causing issues on some OSs.
• Remove Master workflow does not hard fail if master not present. Leaves log message and finishes with success so vRA gets no error when removing endpoint.
• Better handling of warnings in Windows to prevent transient errors especially on Windows 2016.
• Resolution of Puppet master restart issues when purging nodes. Now Puppet master handles CRL reload automatically with no downtime (PE 2017.3 and higher).
vRO Puppet plug-in 3.0
Released May 16, 2017.
• Adds support for integration within the vRealize Automation Enterprise GUI in version 7.3 and higher.
• Role classes can be dynamically fetched from the Puppet master.
• vRA GUI displays each role class’s description based on the `@summary` puppet-strings tag if it is present.
• Major version release that drops support for open source Puppet.
• One vRA/vRO instance can support multiple Puppet masters.
• `csr_attributes.yaml` file is deleted after provisioning if you are using the shared-secret autosigning workflow.
• If Puppet agent runs during provision do not succeed, the Puppet agent service is left in running state.
• Adjustments to avoid timeouts in Windows provisioning.
• Puppet::SSH::useSudo is now exposed as a custom property.
• Improved error handling in the Add a Puppet Master workflow.
• Improved error message if Puppet:Master is not set.
• Run Puppet workflows no longer perform one more Puppet run than necessary.
|
{"Source-Url": "https://tech-pubs-pdf.s3-us-west-2.amazonaws.com/vro-3.x/puppet_plugin_for_vro.pdf", "len_cl100k_base": 9334, "olmocr-version": "0.1.53", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 40727, "total-output-tokens": 10293, "length": "2e13", "weborganizer": {"__label__adult": 0.0002341270446777344, "__label__art_design": 0.0003399848937988281, "__label__crime_law": 0.00018417835235595703, "__label__education_jobs": 0.00046324729919433594, "__label__entertainment": 9.000301361083984e-05, "__label__fashion_beauty": 9.691715240478516e-05, "__label__finance_business": 0.00029969215393066406, "__label__food_dining": 0.00016224384307861328, "__label__games": 0.0006737709045410156, "__label__hardware": 0.0006089210510253906, "__label__health": 0.00011134147644042967, "__label__history": 0.00013267993927001953, "__label__home_hobbies": 6.830692291259766e-05, "__label__industrial": 0.00020396709442138672, "__label__literature": 0.00014066696166992188, "__label__politics": 0.0001443624496459961, "__label__religion": 0.00022029876708984375, "__label__science_tech": 0.004421234130859375, "__label__social_life": 7.855892181396484e-05, "__label__software": 0.1197509765625, "__label__software_dev": 0.87109375, "__label__sports_fitness": 0.0001252889633178711, "__label__transportation": 0.00012576580047607422, "__label__travel": 0.00016832351684570312}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42649, 0.01501]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42649, 0.15148]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42649, 0.76552]], "google_gemma-3-12b-it_contains_pii": [[0, 46, false], [46, 2918, null], [2918, 5048, null], [5048, 7854, null], [7854, 11063, null], [11063, 14421, null], [14421, 17329, null], [17329, 18767, null], [18767, 20956, null], [20956, 23133, null], [23133, 25915, null], [25915, 28306, null], [28306, 29771, null], [29771, 31293, null], [31293, 33554, null], [33554, 37160, null], [37160, 39151, null], [39151, 42232, null], [42232, 42649, null]], "google_gemma-3-12b-it_is_public_document": [[0, 46, true], [46, 2918, null], [2918, 5048, null], [5048, 7854, null], [7854, 11063, null], [11063, 14421, null], [14421, 17329, null], [17329, 18767, null], [18767, 20956, null], [20956, 23133, null], [23133, 25915, null], [25915, 28306, null], [28306, 29771, null], [29771, 31293, null], [31293, 33554, null], [33554, 37160, null], [37160, 39151, null], [39151, 42232, null], [42232, 42649, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42649, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42649, null]], "pdf_page_numbers": [[0, 46, 1], [46, 2918, 2], [2918, 5048, 3], [5048, 7854, 4], [7854, 11063, 5], [11063, 14421, 6], [14421, 17329, 7], [17329, 18767, 8], [18767, 20956, 9], [20956, 23133, 10], [23133, 25915, 11], [25915, 28306, 12], [28306, 29771, 13], [29771, 31293, 14], [31293, 33554, 15], [33554, 37160, 16], [37160, 39151, 17], [39151, 42232, 18], [42232, 42649, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42649, 0.06274]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
290a8fc8d6731afadff97a33d99cdbe979d9a724
|
Requirements-driven self-optimization of composite services using feedback control
How to cite:
© 2013 IEEE
Version: Accepted Manuscript
Link(s) to article on publisher’s website:
http://dx.doi.org/doi:10.1109/TSC.2014.2298866
Copyright and Moral Rights for the articles on this site are retained by the individual authors and/or other copyright owners. For more information on Open Research Online's data policy on reuse of materials please consult the policies page.
Requirements-Driven Self-Optimization of Composite Services using Feedback Control
Bihuan Chen, Xin Peng, Yijun Yu, Member, IEEE and Wenyun Zhao
Abstract—In an uncertain and changing environment, a composite service needs to continuously optimize its business process and service selection through runtime adaptation. To achieve the overall satisfaction of stakeholder requirements, quality tradeoffs are needed to adapt the composite service in response to the changing environments. Existing approaches on service selection and composition, however, are mostly based on quality preferences and business processes decisions made statically at the design time. In this paper, we propose a requirements-driven self-optimization approach for composite services. It measures the quality of services (QoS), estimates the earned business value, and tunes the preference ranks through a feedback loop. The detection of unexpected earned business value triggers the proposed self-optimization process systematically. At the process level, a preference-based reasoner configures a requirements goal model according to the tuned preference ranks of QoS requirements, reconfiguring the business process according to its mappings from the goal configurations. At the service level, selection decisions are optimized by utilizing the tuned weights of QoS criteria. We used an experimental study to evaluate the proposed approach. Results indicate that the new approach outperforms both fixed-weighted and floating-weighted service selection approaches with respect to earned business value and adaptation flexibility.
Index Terms—QoS, quality tradeoffs, self-optimization, earned business value, process reconfiguration, service selection.
1 INTRODUCTION
SERVICE-oriented architecture (SOA) has been an emerging paradigm for developing and integrating business applications. For a service-oriented system, the development focus has shifted from in-house custom application construction to the design of business processes and the selection and composition of services [1]. For Web services orchestration in particular, BPEL (Business Process Execution Language) [2] is widely used to specify the business process of a composite service based on the interactions between the composite service and external Web services.
Apart from functional requirements concerning the business logic, composite services should also fulfill non-functional requirements concerning the quality of services (QoS) [1]. In a changing and uncertain environment, however, composite services cannot always run optimally with statically configured business processes and selected services that only reflect design-time decisions which may not hold at runtime. Therefore, self-optimization through runtime adaptation is a promising way for composite services to better meet their overall QoS requirements [3].
To address the problem of runtime adaptation for composite services, a number of service selection and composition approaches have been recently proposed. Given a statically configured business process consisting of a set of abstract services, these approaches use local [4], [5], [6], global [1], [4], [7], [8], heuristic [9] or hybrid [10], [11] optimizations to dynamically select and bind a concrete service for each abstract service. The objective is to maximize user satisfaction as well as to meet all the QoS constraints. The user satisfaction is usually expressed by a utility function weighing multiple QoS criteria with fixed QoS weights.
However, these approaches are based on static decisions about the quality preferences and the business processes made at design time, i.e., the weights of QoS criteria and the structure of business processes used in service selection and composition are determined at design time and do not change at runtime. Such static decisions may become unfashionable at runtime, making composite services run in a sub-optimal manner.
On the one hand, to better optimize the overall satisfaction of stakeholder requirements, dynamic quality tradeoffs are needed to adapt a system in response to the changing environments [12]. For example, it is meaningless for an order processing service to keep a high preference to risk prevention (which requires a large amount of time and resource for additional processing such as credit verification) when its response time is so long that most users may lose their patience.
On the other hand, considering process variability like optional activities and alternative sub-processes, there are often several alternative configurations that fulfill the same business goals but fit differently in the QoS requirements. Therefore, business processes need
to be flexible so as to be reconfigured to accommodate different preferences to the QoS requirements [13]. For example, following the preference tradeoff decision of response time over risk prevention, the order processing process can be reconfigured to temporarily skip credit verification to improve the response time.
The above analysis motivates the need for requirements-driven self-optimization of composite services. First, dynamic quality tradeoffs should be conducted for maximizing the overall satisfaction of stakeholder requirements. Second, system specifications should be dynamically planned and adapted based on runtime requirements models capturing the solution space for high-level requirements. Third, business processes of composite services should be reconfigured and concrete services be selected dynamically to reflect the adapted quality preferences and system specifications.
Further, apart from the technical benefits such as efficient development and graceful evolution, the main driver for adopting SOA is to create business value for stakeholders not only at design time but also at runtime. Value-based software engineering [14] is proposed to integrate value consideration into software engineering principles and practices. Its emphasis is to incorporate business value achievement into feedback control systems. Therefore, self-optimization for composite services should take into account the business value achievement, which can usually be measured by successfully committed transactions.
Motivated by the ideas of requirements-driven and value-based self-optimization, in this paper, we propose a new approach for self-optimization of composite services with the following characteristics:
- support dynamic quality tradeoffs;
- combine runtime process reconfiguration and service selection;
- use earned business value to reflect the runtime overall satisfaction of stakeholder requirements.
Measuring quality attributes and estimating earned business value using a predefined value formula, our approach makes dynamic quality tradeoffs, i.e., tunes the preference ranks of quality attributes using a feedback controller. The detection of a violation of earned business value triggers our self-optimization process systematically. At the business level, a preference-based reasoner [12] configures a requirements model according to the tuned preference ranks of QoS requirements; and then a process configurator reconfigures the business process according to its mappings from goal configurations. At the service level, service selection is optimized by integrating the selection approach in [10] with the tuned weights of QoS criteria.
To evaluate the effectiveness of our approach, we conducted an experimental study on an order processing service adapted from an IBM’s sample example. The results show the improvement of our approach over both fixed-weighted and floating-weighted service selection approaches in terms of earned business value and adaptation flexibility. The study also demonstrates the acceptable performance of our approach and shows the rationality of combining process reconfiguration and service selection for self-optimization of composite services.
The rest of the paper is organized as follows. Section 2 introduces a number of existing proposals and compares them with ours. Section 3 introduces goal models and process variability on top of which we build our proposal. Section 4 presents our requirements-driven self-optimization approach. Section 5 gives the details of our implementation. Section 6 evaluates the proposed approach. Section 7 makes some discussion before Section 8 draws our conclusions.
2 Related Work
Our work falls in the area of self-adaptive service-oriented applications [3]. Here we focus our discussion on the most closely related studies in three areas: service selection and composition, business process adaptation, and requirements-driven self-adaptation.
2.1 Service Selection and Composition
Service selection and composition have been a challenging problem because the number of the candidate services that have the same functionalities but differ in QoS is increasing with the prevalence of SOA, Cloud Computing and Software as a Service.
In the local optimization approaches [4], [5], [6], service selections for different abstract services are independent of each other. Given a utility function weighing multiple QoS criteria, for each abstract service, a concrete service with the highest utility is selected. Though usually efficient, local optimization approaches cannot satisfy end-to-end constraints, and the selection result is usually not globally optimal.
The global optimization approaches [1], [4], [7], [8] turn the optimization problem into a mixed integer programming problem, i.e., maximizing an objective function weighing multiple QoS criteria as well as meeting multiple QoS constraints. They can always satisfy end-to-end constraints and produce an optimal selection result when the problem is solvable, but the time complexity is exponential.
Attempting to overcome the shortcomings of local and global approaches, Yu et al. [9] propose to model this problem as a multi-dimension multi-choice 0-1 knapsack problem and a multi-constraint optimal path problem, and to use efficient heuristic algorithms to find near-optimal solutions. Alrifai et al. [10] and Sun and Zhao [11] propose hybrid approaches that first decompose end-to-end QoS constraints into local QoS constraints and then perform local selections, thus combining both the efficiency of local approaches and the optimality of global approaches.
These approaches pay their major attention to the selection algorithm itself with an assumption that
QoS weights given by experts at design time will not change at runtime. Complementary to them, our approach allows the QoS weights to be dynamically tuned to reflect quality tradeoffs using a feedback controller. Our approach further supports dynamic reconfiguration of business processes, i.e., changes the structure and behavior of business processes, from the requirements perspective.
2.2 Business Process Adaptation
To the best of our knowledge, dynamic runtime business process reconfiguration is rarely systematically addressed in literature, which mainly faces two challenges. One is to make business processes adaptable at runtime, i.e., process variability can be well represented at design time as well as be dynamically configured at runtime. The other is to provide appropriate decision and control mechanisms for achieving QoS-driven self-adaptation.
For the first challenge, several advances have been made to model variability [17], [18] and support adaptation [19] of BPEL processes. Topaloglu et al. [17] differentiate architecture-oriented and task-oriented variability by the criterion that whether architectural elements (e.g., type of protocol) or Web services are involved. Charfi and Mezini [19] propose AO4BPEL, an aspect-oriented extension to BPEL, to achieve runtime process adaptation by dynamic weaving. Koning et al. [18] propose VxBPEL, an extension to BPEL, to capture and model variability for BPEL services. They also implement a prototype of runtime adaptation by extending an existing BPEL engine. These approaches focus on how to make business processes adaptable and provide the infrastructure for runtime adaptation. Compared to them, our approach only uses standard BPEL elements to model variability, but we make a step forward to provide supports for the adaptation decision and control mechanisms.
For the second challenge, Lapouchnian et al. [13] propose a requirements-driven approach for the design and configuration management of business processes. They use goal models to capture alternative business process variability and generate BPEL processes. Their approach supports process variability customization based on user-prescribed preference ranks of relevant QoS requirements. While this approach supports limited process variability types and only deployment-time customization, thus cannot be used for headless (unsupervised) self-adaptation, our approach focuses on runtime process reconfiguration and service selection without human intervention.
2.3 Requirements-Driven Self-Adaptation
Self-adaptive systems should be requirements-aware because these systems are increasingly running under poorly-understood environments [16]. Several advances have been made on requirements-driven self-adaptation. Wang et al. [20] propose a requirements monitoring and diagnosing approach, which finds a set of goal configurations that are free of failures by goal reasoning and then selects the best one for repairing the system from failures. Salehie et al. [21] propose a requirements-driven approach to support adaptive security for protecting variable assets at runtime. They respectively focus on self-repairing and self-protecting while our work focuses on self-adaptation.
In earlier work we have proposed a general framework for value-based and requirements-driven self-optimization [12], where a PID controller is proposed to achieve dynamic quality tradeoffs and a preference-based reasoner is proposed to reason about the optimal goal configuration. Following this, we propose to integrate dynamic quality tradeoffs with dynamic functional tradeoffs, i.e., sacrificing desirable components to assure crucial components, for the survivability of Web systems [22]. Compared with our earlier work, in this paper, we apply the similar value-based feedback control loop with a deeper exploration of earned business value and the application domain changed to self-optimization for composite services. Further, we revise the PID controller in [12] by combining a PD controller to stabilize the preference tuning process by avoiding overshoots, and use dynamic quality tradeoffs to drive both process reconfiguration and service selection. To the best of our knowledge, our work is the first one that combines requirements-driven process reconfiguration with service selection on the basis of dynamic quality tradeoffs.
3 Baseline
We use requirements goal models [15] to capture business goals and explore business alternatives because they provide sufficient modeling and reasoning support at an appropriate abstraction level [16] (Section 3.1). And we identify three types of process variability to reflect business process variations (Section 3.2). We also establish a mapping schema from goal variations to process variations for mapping goal configurations to process reconfigurations (Section 3.3).
3.1 Goal Models
Goal-oriented requirements engineering (GORE) [15] as a methodology has been widely used in the past two decades. In GORE, stakeholders are usually modeled by actors and their intentions are represented by goals. Goal models are used to capture intentions of stakeholders on the system-to-be and explore alternative ways to satisfy these intentions. Once the relationships between agents and requirements are elicited, a goal model is constructed to represent AND/OR refinements of requirements.
Requirements that have clear-cut satisfaction criteria are modeled as hard goals or tasks in goal models, and others that do not have are modeled as soft goals. For example, Fig. 1 shows the goal model of order
processing, where Order be checked is a hard goal that is either fulfilled or not and Customer satisfaction be enhanced is a soft goal that can be fulfilled or not to some degree. Most quality requirements can be seen as soft goals, which have no optimal but only “good enough” satisfactions. Such uncertainty of quality requirements makes soft goals suitable for expressing the criteria for comparing alternative design choices [23].
Goals can be refined into subgoals by AND/OR decomposition links until leaf-level tasks can be accomplished by either a software component or a human agent. To fulfill an AND/OR-decomposed goal, all/at least one of its subgoals should be fulfilled. Therefore, goal models can capture alternative ways for fulfilling high-level goals by OR-decompositions. For example, Get order, Order be checked, Pack order and Order be shipped and paid in Fig. 1 have to be all fulfilled to fulfill Order be processed; and Order be paid can be fulfill either by Pay by credit card or Pay in cash.
Goals can be related to soft goals through a series of contribution links such as Help, Hurt, Make, Break. A Help/Make link indicates that the fulfillment of the source goal contributes to the partial/full fulfillment of the target goal, whilst a Hurt/Break link indicates that the fulfillment of the source goal contributes to the partial/full denial of the target goal. Usually, each subgoal of an OR-decomposed goal has different contributions to certain soft goals, implying different quality tradeoff decisions. For example, Pay by credit card helps to enhance customer satisfaction for its convenience but hurts to reduce the cost due to the expense paid to third-party payment service providers; its alternative goal Pay in cash contributes to these two soft goals in the other way around.
### 3.2 Process Variability
A business process often has several process variants, each of them constituting an adjustment of a reference process model to accommodate specific requirements in the process context [24]. Such process variability forms the basis of runtime process reconfiguration in our approach. For example, both regular verification (e.g., checking order details such as the quantity and total amount of products) and credit verification (e.g., checking if customers cheat in online shopping) are required during regular order processing to reduce the transaction risk. However, when the load of service requests is high, it may be reasonable to skip credit verification to improve throughput. Variability of a system usually can be characterized by variation points and variants. A variation point is a certain part in a system that can vary, and the alternatives for such a variation point are called variants [18].
To support runtime process reconfiguration, three types of variability in business processes are identified as follows:
- **Optional**: An optional service or sub-process can be either invoked (if bound) or skipped (if unbound) during the execution of a process.
- **Alternative**: An alternative service or sub-process has several variant services or sub-processes, one and only one of which can be bound at runtime.
- **Temporal**: A set of services constituting a sub-process can be invoked in different orders. A sub-process with temporal variability can be seen as a special kind of alternative sub-process.
### 3.3 Mapping from Goal Variations to Process Variations
Fig. 2 shows our mapping schema from goal variations to the three types of process variations for mapping goal configurations to process reconfigurations. Fig. 2 (a1), (b1), and (c1) give the goal variations, and Fig. 2 (a2.1) and (a2.2), (b2.1) and (b2.2), and (c2) show the corresponding process variations.
For an optional goal, e.g., \( g_{op} \) in Fig. 2 (a1), an OR-decomposition is introduced with a new goal \( g_{opt} \) as its parent goal and a virtual Dummy task (i.e., nothing to achieve) as its sibling goal. Thus, an optional goal...
can be bound or unbound during process execution, and can be mapped to an optional service $S_{op}$ in Fig. 2 (a2.1) or an optional sub-process $SP_{op}$ in Fig. 2 (a2.2).
For an OR-decomposed goal with alternatives, e.g., $g_{alt}$ in Fig. 2 (b1), its subgoals $g_{alt-v1}$ to $g_{alt-vn}$ can be seen as its variants, and can be mapped to the alternative service $S_{alt}$ in Fig. 2 (b2.1) or the alternative sub-process $SP_{alt}$ in Fig. 2 (b2.2) depending on if these subgoals correspond to individual services or composite services.
For a temporal goal, e.g., $g_{tmp}$ in Fig. 2 (c1), it is OR-decomposed into subgoals $g_{tmp-v1}$ to $g_{tmp-vn}$, each of which represents a possible execution order of the same set of goals $g_1$ to $g_n$. Thus, $g_{tmp}$ can be regarded as an alternative goal, and its subgoals can be mapped to the alternative sub-process $SP_{tmp}$ in Fig. 2 (c2).
Fig. 3 illustrates the goal model of order processing after introducing temporal and optional variability and corresponding contribution links into the goal model in Fig. 1. The two temporal variant goals Order be paid then be shipped and Order be shipped then be paid represent two different execution orders of payment and shipping. The former helps to reduce risk but hurts to enhance customer satisfaction, whereas the latter contributes to them in the other way around. And the optional goal Verify credit, if bound, can help to reduce risk but hurt to response time.
With these goal variants and their contribution links represented in goal models and the preference ranks of QoS requirements dynamically tuned (Section 4.3), we can then reason about and reconfigure goal variations and map goal configurations to process reconstructions at runtime based on this mapping schema (Section 4.4). For example, if customer satisfaction is preferred to cost and thus $Order be paid$ is configured to $Pay by credit card$, the business process will be reconfigured to execute the credit card payment service.
4 OUR APPROACH
In this section, we first present an overview of our approach, and then explain in detail the key techniques involved in our approach, including runtime value indicator, dynamic quality tradeoffs, and process reconfiguration and service selection.
4.1 Approach Overview
To achieve self-optimization for composite services, our approach continuously seeks opportunities to improve the earned business value (i.e., the indicator of overall satisfaction of QoS requirements) by making dynamic quality tradeoffs and then performing process reconfiguration and service selection accordingly. Fig. 4 shows the overview of our approach, with a mapping of its main components to the MAPE (Monitor, Analyze, Plan, Execute) control loop [25].
In particular, a value indicator is executed at regular intervals (e.g., one minute) at runtime to measure the quality attributes from runtime data collected by sensors and estimate the earned business value on the basis of a predefined value formula (Section 4.2).
Taking runtime quality measurements and earned business value as feedbacks, a control-theoretic preference tuner is used to make dynamic quality tradeoffs, i.e., tune the preference ranks of relevant quality attributes, to reflect the relative importance of those quality attributes (Section 4.3).
Following the dynamic quality tradeoffs, our self-optimization is triggered by a violation of expected earned business value and is conducted at the process and service levels respectively (Section 4.4). The adaptations at the two levels, i.e., process reconfiguration and service selection, are decoupled: the former only concerns abstract services and their process flows and the latter only concerns concrete services and service replacement.
At the process level, requirements-driven process adaptation is conducted. A preference-based goal reasoner configures the requirements goal model according to the tuned preference ranks of QoS requirements (soft goals). The goal configurations are then mapped to process reconstructions by process configurator based on the mapping schema in Fig. 2.
At the service level, a service selector is used to find an optimal combination of concrete services from can-
didate services for the abstract services, with the objective of maximizing the utility function and meeting the QoS constraints. The utility function is computed on relevant QoS criteria with floating weights tuned through dynamic quality tradeoffs.
Note that our approach currently focuses on the Analyze (value indicating) and Plan (preference tuning, process reconfiguration and service selection) parts which are detailed in the following subsections, and simplifies the Monitor and Execute parts which are usually supported by service-oriented middlewares.
4.2 Runtime Value Indicator
The objective of self-optimization for composite services can be regarded as maximizing the value propositions of stakeholders [12], [22]. Following this value-based perspective, we propose to use a value indicator to measure the earned business value and then to determine whether the objective is met. To this end, it is required to define a quantitative value measurement that can provide comprehensive and timely feedback for the self-optimization process.
For composite services, earned business value usually can be measured as the accumulative value earned from every successfully committed transaction (e.g., completing an order processing) in a time interval (e.g., one minute). Further, an earning rule, such as the 0-100 rule and 50-50 rule, should be specified. If the 0-100 rule is used, no value will be earned until a transaction is successfully committed. On the contrary, the 50-50 rule means 50% of the value will be earned as long as the transaction is started.
In order to measure earned business value comprehensively, both business capabilities (i.e., what services a system has provided) and quality of services (i.e., how well the services are provided) should be taken into account because they both heavily influence earned business value. For example, if a business process is finished successfully but takes a long time, or it is completed quickly but suffers a failure, the earned business value will be limited due to either poor quality or weak capability.
On the other hand, for measuring earned business value timely, some long-term influence factors should be captured as an instant positive or negative factor to earned business value rather than be captured when it actually makes the influence. For example, customer satisfaction often takes a long time and a slow process to be reflected in the business value of an organization; and it is too late to take actions to re-establish customer satisfaction once it produces notable bad influence (e.g., customer losing, sales decreasing, etc.).
Based on the above analysis, it can be seen that a predefined application-specific value formula should be provided to measure the earned business value on the basis of business market analysis, risk analysis, business losing trend analysis, etc. by business experts from the economic perspective.
For example, in order processing, different quality attributes can contribute to the earned business value from different perspectives: reducing response time and enhancing service availability are demanded for a higher system throughput under a given bandwidth; reducing cost is aimed for lower third-party service cost; reducing risk is targeted at a higher rate of valid orders; and enhancing customer satisfaction is aimed for a larger number of placed orders. Among these quality attributes, risk and customer satisfaction are long-term influence factors to earned business value. In this study, we use the 0-100 earning rule, and simplify the formula as
\[
value = \$3 \times \#sucOrders - \$3 \times \#sucOrders \times risk - \$3 \times \#sucOrders \times (1 - satisfaction) - cost
\]
on the assumption that every successfully processed order will produce a value of $3 for the organization. For example, in a time interval, there are 10 successfully processed orders which are instantly influenced by the response time and availability, the risk is 10%, the customer satisfaction is 70%, the cost is $2.8, then the earned business value is $15.2.
Besides earned business value, the value indicator also measures quality attributes such as availability and response time by analyzing the collected runtime data (e.g., failure/success, response time of a service invocation, etc.). Both earned business value and individual quality measurements are used as feedbacks for the planning process (see Fig. 4).
4.3 Dynamic Quality Tradeoffs
To achieve dynamic quality tradeoffs, our approach dynamically tunes the preference ranks of quality attributes. While many tuning techniques have been proposed in the literature, such as analytic hierarchy process [26], multi-criteria analysis method [27] and machine learning-based technique [28], they more or less involve human intervention, making it infeasible to our headless self-adaptation approach. Therefore, the difficulty here is how to tune the preference ranks quantitatively and autonomously.
Intuitively, there is an approximately proportional relationship between the preference rank and expectation of a quality attribute, i.e., the better a quality attribute is expected, the higher its preference rank should be. For example, at the service level, if a service suffers failures frequently, the preference rank of availability should be increased such that another service with higher availability will be selected and then the actual availability will become close to its expectation; at the process level, if a process responses extremely slowly, the preference rank of response time should be increased such that another process with quicker response will be reconfigured and then the actual response time will become close to its expectation. Therefore, the error between the expected and actual...
quality measurement reflects the degree of preference rank tuning; the error should be accumulated continuously to tune the preference rank precisely; and the error can be minimized by reflecting the tuned preference rank into the system behavior and structure. Thus a control-theoretic feedback controller [29] can be used for such preference tuning.
Earlier we have proposed a preference tuning algorithm using a PID (proportional-integral-derivative) controller [12]. However, we observe that the integral part in the PID controller tends to accumulate a larger error, i.e., compensating one error may introduce another in the reverse direction if a large change occurs in quality measurement. To avoid this overshoot and stabilize the tuning process, the integral part can be frozen in such situations, which is known as the PD (proportional-derivative) controller. Hence, we revise our earlier version of preference tuner by combining the PID controller with a PD controller. The tuner is designed to strengthen the previous tuning directions if obtaining positive feedbacks, and adjust the previous tuning directions if obtaining negative feedbacks.
Algorithm 1 The Procedure of Preference Tuning
```plaintext
1: procedure PREFERENCE-TUNING(qm)
2: for i ← 1, l do
3: exp[i] ← average of all the past qm[i]
4: e_k[i] ← (exp[i] - qm[i])/exp[i] × isPositive[i]
5: if |e_k[i]| > 1.0 then
6: convVar[i] ← convVar[i] + k_p × (e_k[i] - e_k-1[i]) + k_d × (e_k[i] - 2 × e_k-1[i] + e_k-2[i])
7: else
8: convVar[i] ← convVar[i] + k_p × (e_k[i] - e_k-1[i]) + k_i × e_k[i] + k_d × (e_k[i] - 2 × e_k-1[i] + e_k-2[i])
9: end if
10: e_k-2[i] ← e_k-1[i], e_k-1[i] ← e_k[i]
11: rank[i] ← INL_R[i] + INL_R[i] × convVar[i]
12: if rank[i] > 10 then
13: rank[i] ← 10
14: else if rank[i] < 1 then
15: rank[i] ← 1
16: end if
17: end for
18: return rank
19: end procedure
```
Algorithm 1 shows the procedure of preference tuning. It takes as input the actual quality measurements, and returns the tuned preference ranks. The algorithm has an iterative loop over all the quality attributes that are concerned. It first computes the expected quality measurement as an average of all the past actual quality measurements (Line 3) because the expectation cannot be fixed and should be continuously updated from the old value to the new one that reflects the runtime environments. Then it obtains the current error signal as an incremental or decremental percentage (Line 4). Depending on whether a quality attribute is positive (i.e., the higher the better, e.g., availability) or negative (i.e., the lower the better, e.g., response time), the current error signal is multiplied by 1 or -1. Then the algorithm executes the PD controller if the quality measurement suffers a sudden large change (Line 5-6); otherwise, it executes the PID controller (Line 7-8). The control variable, representing the incremental or decremental percentage of a preference rank, accumulates the errors in an incremental manner such that only three past error signals are stored. Finally, it updates the error signals (Line 10) and tunes the preference rank according to the control variable and the initial preference rank (Line 11-16).
Note that the preference rank is a value between 1 and 10. And $k_p$, $k_i$, and $k_d$ are the controller parameters of proportional control, integral control and derivative control respectively. These controller parameters may vary from one control system to another, and can be specified at design time by the Ziegler Nichols method [29]. For example, in our study, $k_p$, $k_i$, $k_d$ are respectively set to 0.5, 0.3, 0.2.
### 4.4 Process Reconfiguration and Service Selection
QoS plays a significant role in both process-level and service-level optimization. Therefore, a quality model is needed to specify what quality attributes are concerned at each level and how to aggregate quality measurements from runtime executions. Table 1 shows the quality model of an order processing process. The quality attributes concerned at the service level are cost, response time and availability, while those concerned at the process level are cost, response time, risk and customer satisfaction. An aggregation function (e.g., summation, average, minimum) is used to measure each quality attribute of a BPEL process from its execution records in an interval.
<table>
<thead>
<tr>
<th>Quality Attributes</th>
<th>Aggregation</th>
<th>Service</th>
<th>Process</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cost</td>
<td>Summation</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td>Response Time</td>
<td>Average</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td>Availability</td>
<td>Average</td>
<td>✓</td>
<td></td>
</tr>
<tr>
<td>Risk</td>
<td>Average</td>
<td></td>
<td>✓</td>
</tr>
<tr>
<td>Customer Satisfaction</td>
<td>Average</td>
<td></td>
<td>✓</td>
</tr>
</tbody>
</table>
In addition, QoS can be either provided by service providers directly (e.g., cost), recorded from execution monitoring (e.g., response time), fed back from customers (e.g., customer satisfaction) [5], or even given by domain experts (e.g., risk).
#### 4.4.1 QoS-Driven Self-Optimization at the Two Levels
The adaptations at the process level and the service level can be regarded as adaptations on high-level strategies and low-level tactics respectively. Naturally, once a tactic-level adaptation is enough for the self-optimization, no further strategy-level adaptation is needed; if no tactic-level adaptation is suitable for the
self-optimization, a strategy-level adaptation should be planned and a corresponding tactic-level adaptation should also be made. Hence, service-level self-optimization should be conducted first; if it fails, then process-level self-optimization should be involved.
Based on the above analysis, we propose the procedure of our self-optimization process in Algorithm 2. It takes as input the given goal model and the claimed QoS constraints. The procedure is triggered at regular intervals (e.g., one minute). It first analyzes the runtime data to obtain the current earned business value and the actual quality measurements relevant to the service and process level in the previous interval (Line 2), gets the tuned preference ranks of relevant quality attributes by invoking Algorithm 1 (Line 3-4), and calculates the expected earned business value as an average of all the past earned business values (Line 5). The procedure terminates if the current earned business value is beyond the expectation by \( \alpha \); otherwise, it normalizes the preference ranks into weights of QoS criteria at the service level (Line 7) and tries to find a new service selection for the current process configuration (Line 8-9). If possible, the procedure puts the new selection into effect and terminates (Line 10-12); if not possible, the procedure tries to find a new process configuration (Line 14-15). If found, the procedure needs to find a service selection for the new process configuration and put them into effect (Line 16-19); otherwise, the procedure terminates.
**Algorithm 2** The Procedure of Self-Optimization
1: procedure **SELF-OPTIMIZATION**(gm, c)
2: \(v, qm^{ser}, qm^{pro}\) ← analyze runtime data
3: \(r^{ser}\) ← Preference-Tuning\((gm^{ser})\)
4: \(r^{pro}\) ← Preference-Tuning\((gm^{pro})\)
5: \(expValue\) ← average of all the past \(v\)
6: if \((v - expValue)/expValue < \alpha\) then
7: \(w\) ← normalize \(r^{ser}\)
8: \(curCon\) ← get current process configuration
9: \(sel\) ← Service-Selecting\((c, w, curCon)\)
10: \(curSel\) ← get current service selection
11: if \(sel \neq curSel\) then
12: put \(sel\) into effect
13: else
14: \(goalCon\) ← Goal-Reasoning\((gm, r^{pro})\)
15: \(con\) ← map \(goalCon\) to process configuration
16: if \(con \neq curCon\) then
17: \(sel\) ← Service-Selecting\((c, w, con)\)
18: put \(con\) and \(sel\) into effect
19: end if
20: end if
21: end if
22: end procedure
Note that there are four possible adaptation results in our self-optimization process: (a1) no adaptation is needed because earned business value satisfies its expectation; (a2) a new service selection is produced (service-level optimization); (a3) a new process configuration and its corresponding service selection are produced (process-level and service-level optimization); and (a4) no new service selection or process configuration can be produced although an adaptation is needed (optimization failure). Besides, the setting of \( \alpha \) should involve considerations on the system’s tolerance of earned business value fluctuation. The lower the tolerance is, the larger \( \alpha \) should be. Hence, it should be determined through analysis of the business goal and policy. For example, in our study, \( \alpha \) is set to -0.05.
### 4.4.2 Process Reconfiguration
The purpose of process reconfiguration is to configure the process variations such that the process can best satisfy the QoS requirements. To this end, we use a preference-based reasoner [12] to dynamically configure the runtime goal model. The reasoner takes as input the given goal model and the tuned preference ranks of soft goals. The reasoner first encodes the goal model elements into CNF (Conjunctive Normal Form) proposition formulas to feed a SAT solver and then has an iterative step to invoke the solver for finite times. It tries initially to find a configuration that can satisfy all the soft goals. If not possible, the lowest ranked soft goals will be removed from the encoding so as to satisfy the remaining soft goals, and so on, until either a configuration is found or all soft goals have been removed. It always terminates with a valid configuration because we assume the root hard goal is satisfied by design. Detailed descriptions about the reasoning algorithm can be found in [12].
For example, if response time and customer satisfaction are preferred to risk and cost, Dummy task will be selected for **Credit be verified** since it helps to reduce response time, which means the process will be reconfigured to skip the optional credit verification service; Pay by credit card and Order be shipped then be paid will be selected for **Order be paid** and **Order be shipped and paid** respectively since they help to enhance customer satisfaction, which means the process will be reconfigured to execute the alternative credit card payment service and to execute the shipment service before payment service.
### 4.4.3 Service Selection
Given the QoS constraints, QoS weights and a process configuration, the service selection is to find an optimal combination of concrete services for the abstract services in a business process, with the purpose of satisfying the constraints and maximizing a weighted utility function.
A number of service selection methods have been proposed. Here we integrate the method proposed in [10]. It uses mixed integer programming (MIP) to find the optimal decomposition of global QoS constraints into local ones. It then uses a local selection method to find for each abstract service a concrete service that satisfies the local constraints and maximizes
a local utility function. Details about the selection algorithm can be found in [10].
The utility function used in [10] is shown in Eq. 1 with $CS$ being a combination of the candidate concrete services, $u(q_k(CS))$ being the utility value of $CS$ on the $k$-th QoS criterion and $w_k \left( \sum_{k=1}^{n} w_k = 1 \right)$ being the weight of $k$-th QoS criterion.
$$U(CS) = \sum_{k=1}^{n} u(q_k(CS)) \times w_k \quad (1)$$
Different from fixed weights in [10], our approach allows QoS weights to be changed by dynamic quality tradeoffs, making the selection process better reflect the changing quality preferences. Note that each QoS weight $w_k$ is the normalization of the corresponding preference rank $r_k$ of a quality attribute by Eq. 2.
$$w_k = r_k / \sum_{k=1}^{n} r_k \quad (2)$$
5 IMPLEMENTATION
We implement the proposed approach in an extensible way such that a generic infrastructure is provided for self-optimization of composite services. The application-independent components, i.e., preference tuner, goal reasoner, process configurator and service selector are implemented as plug-ins. The application-specific components, i.e., sensor, value indicator, service effector and process effector, are programmed as RMI interfaces using RMI-IIOP technology to decouple the generic parts and the BPEL engine and to make them distributed and stand-alone. Thus, developers should provide their own implementation to these interfaces for applying our approach.
For example, when we apply the approach to order processing, sensors are implemented with log4j for recording the runtime data such as response time of a service invocation; value indicator is realized as introduced in Section 4.2; and service/process effectors are realized by dynamically updating process configuration and service selection result in XML files. Thus, the BPEL engine can use XPath at runtime to extract process configuration information to customize business processes and extract service selection information to bind selected concrete services.
Besides, currently we adopt a light-weight way, i.e., using standard BPEL elements, to support the three types of variability in executable business processes. Generally, they are realized through the if-elseif activity. Specifically, alternative variability is realized by putting in corresponding condition bodies the alternative services (or sub-processes); optional variability is realized with only one condition body being the optional service (or sub-process); temporal variability is realized by putting in corresponding condition bodies a set of services with possible execution orders. Note that condition expressions in the if-elseif activities are equality matches between the possible configurations of the variations and the current configuration.
6 EXPERIMENTAL STUDY
To evaluate the proposed approach, we conducted an experimental study on an order processing service to answer the following two questions:
- **Q1**: Can a composite service achieve better overall satisfaction (in terms of earned business value) and more adaptation flexibility by combining process reconfiguration and service selection? (effectiveness evaluation)
- **Q2**: How can our approach scale with the growth of goal models and business processes? (performance evaluation)
6.1 Experimental Setting
The order processing process is adapted from an IBM's sample example\(^1\) by extending the following variations to make reconfiguration possible: making credit verification optional, adding two alternative payment services, and adding the temporal variability between shipment and payment.
The order processing goal model is shown in Fig. 3, its quality model is shown in Table 1, and the corresponding BPEL process is illustrated in Fig. 5. The BPEL process and its candidate concrete services were developed in Oracle JDeveloper 10.1.3.1 and deployed on Oracle BPEL Process Manager 10.1.3.1.0. The experiments were conducted on a ThinkPad R400 laptop with 2 Intel Core2 Duo 2.53 GHz processors and 2GB RAM, running Windows XP.
For simplicity, we assume that five candidate concrete services have been discovered for each abstract service in the BPEL process in Fig. 5 except for service “Get Order” which can be seen as a local service and has only one concrete service and thus is not considered in service selection. Table 2 lists the claimed QoS of each candidate concrete service. The first, second,
---
\(^1\) http://pic.dhe.ibm.com/infocenter/adiehelp/v5r1m1/topic/com.ibm.etools.ctc.bpel.doc/samples/orderprocessing/orderProcessing.html
**TABLE 2**
<table>
<thead>
<tr>
<th>S</th>
<th>C($)</th>
<th>R(ms)</th>
<th>A(%)</th>
<th>S</th>
<th>C($)</th>
<th>R(ms)</th>
<th>A(%)</th>
</tr>
</thead>
<tbody>
<tr>
<td>CD₁</td>
<td>0.01</td>
<td>500</td>
<td>90</td>
<td>VC₁</td>
<td>0.02</td>
<td>1000</td>
<td>90</td>
</tr>
<tr>
<td>CD₂</td>
<td>0.02</td>
<td>400</td>
<td>92</td>
<td>VC₂</td>
<td>0.04</td>
<td>800</td>
<td>92</td>
</tr>
<tr>
<td>CD₃</td>
<td>0.03</td>
<td>300</td>
<td>94</td>
<td>VC₃</td>
<td>0.06</td>
<td>600</td>
<td>94</td>
</tr>
<tr>
<td>CD₄</td>
<td>0.04</td>
<td>200</td>
<td>96</td>
<td>VC₄</td>
<td>0.08</td>
<td>400</td>
<td>96</td>
</tr>
<tr>
<td>CD₅</td>
<td>0.05</td>
<td>100</td>
<td>98</td>
<td>VC₅</td>
<td>0.10</td>
<td>200</td>
<td>98</td>
</tr>
<tr>
<td>PO₁</td>
<td>0.01</td>
<td>1000</td>
<td>87</td>
<td>SO₁</td>
<td>0.01</td>
<td>500</td>
<td>87</td>
</tr>
<tr>
<td>PO₂</td>
<td>0.02</td>
<td>800</td>
<td>90</td>
<td>SO₂</td>
<td>0.02</td>
<td>400</td>
<td>90</td>
</tr>
<tr>
<td>PO₃</td>
<td>0.03</td>
<td>600</td>
<td>93</td>
<td>SO₃</td>
<td>0.03</td>
<td>300</td>
<td>93</td>
</tr>
<tr>
<td>PO₄</td>
<td>0.04</td>
<td>400</td>
<td>96</td>
<td>SO₄</td>
<td>0.04</td>
<td>200</td>
<td>96</td>
</tr>
<tr>
<td>PO₅</td>
<td>0.05</td>
<td>200</td>
<td>99</td>
<td>SO₅</td>
<td>0.05</td>
<td>100</td>
<td>99</td>
</tr>
<tr>
<td>PCC₁</td>
<td>0.02</td>
<td>500</td>
<td>90</td>
<td>PC₁</td>
<td>0.01</td>
<td>1000</td>
<td>87</td>
</tr>
<tr>
<td>PCC₂</td>
<td>0.04</td>
<td>400</td>
<td>92</td>
<td>PC₂</td>
<td>0.02</td>
<td>800</td>
<td>90</td>
</tr>
<tr>
<td>PCC₃</td>
<td>0.06</td>
<td>300</td>
<td>94</td>
<td>PC₃</td>
<td>0.03</td>
<td>600</td>
<td>93</td>
</tr>
<tr>
<td>PCC₄</td>
<td>0.08</td>
<td>200</td>
<td>96</td>
<td>PC₄</td>
<td>0.04</td>
<td>400</td>
<td>96</td>
</tr>
<tr>
<td>PCC₅</td>
<td>0.10</td>
<td>100</td>
<td>98</td>
<td>PC₅</td>
<td>0.05</td>
<td>200</td>
<td>99</td>
</tr>
</tbody>
</table>
third and fourth columns respectively list the service name, cost, response time and availability. It can be observed that a service with higher cost can guarantee lower response time and higher availability. Besides, the QoS constraints on the cost, response time and availability of the BPEL process in Fig. 5 were set to $0.25, 3100ms and 93% respectively.
We conducted the experiments with three kinds of approaches using the same experimental setting:
- **Static**: this is a trivial approach with the business process configured and concrete services selected statically at design time (i.e., no optimization).
- **Single**: this approach configures the business process statically at design time, but makes dynamic quality tradeoffs and selects concrete services at runtime (i.e., only service-level optimization).
- **Double**: this is the approach proposed in this paper with both the business process reconfigured and concrete services selected dynamically.
For the BPEL process in Fig. 5, there are $2^3$ possible process configurations and at least $5^2$ possible service selections. Due to this large possibility, we conducted the experiments with the initial process configuration and service selection only being some typical ones.
Differently, the initial process configuration of order processing is determined by the initial preference rank setting for [Risk be reduced, Response time be reduced, Cost be reduced, Customer satisfaction be enhanced]. Its two typical settings are [6, 3, 6, 3] and [3, 6, 3, 6], which have reverse preferences over the soft goals. If the preference rank is set to [6, 3, 6, 3], the three goal variations in Fig. 3 will be configured to Verify credit, Order be paid then be shipped and Pay by credit card, and the process will be correspondingly configured to [Check Details, Verify Credit, Pack Order, Pay in Cash, Ship Order], referred as Config₁. If the preference rank is set to [3, 6, 3, 6], the three goal variations in Fig. 3 will be configured to Dummy task, Order be shipped then be paid and Pay by credit card, and the process will be correspondingly configured to [Check Details, Pack Order, Ship Order, Pay by Credit Card], referred as Config₂.
Similarly, the initial service selection of order processing is determined by the initial QoS weight setting for [cost, response time, availability]. Its four typical settings are [0.50, 0.25, 0.25], [0.25, 0.50, 0.25], [0.25, 0.25, 0.50] and [0.33, 0.33, 0.33], which either prefer one of the three QoS criteria or have equal preferences. For example, if the QoS weight is set to [0.50, 0.25, 0.25], the service selection with Config₁ will be [CD₁, VC₁, PO₅, PC₅, SO₅], simplified as [1, 1, 5, 5, 5], and the service selection with Config₂ will be [CD₃, PO₅, SO₅, PCC₁], simplified as [3, 5, 5, 1].
In this study, we conducted 12 experiments, each of which has a running of 60 minutes with 10 concurrent threads. Among them, 8 experiments were conducted for the **static** approach with the initial process being configured to Config₁ and Config₂, and the initial services being selected according to the four typical QoS weight settings. For the **single** and **double** approaches, 2 experiments were respectively conducted with the initial process being configured to Config₁ and Config₂, and the initial services being selected according to one typical QoS weight setting [0.33, 0.33, 0.33] since the QoS weight will be changed at runtime by our dynamic quality tradeoffs technique.
### 6.2 Effectiveness Evaluation (Q1)
In each experiment, the self-optimization interval was set to one minute, i.e., our self-optimization process was triggered every one minute. We analyzed earned business value and the quality attributes in the quality model in Table 1 as the numerical indicators, and recorded the runtime adaptation actions as an adaptation process indicator. We measured the numerical indicators every one minute as introduced in Section 4.2 by system log analysis, and collected the adaptation process indicator by adaptation log analysis. Note that in the experiments risk and customer satisfaction of different process configurations were stochastically distributed with different density to simulate real-life risk analysis and customer feedbacks.
#### 6.2.1 Numerical Indicators
Table 3 shows the numerical results of the 12 experiments in detail. The first column lists the involved approach; the second, third and fourth columns respectively list the initial process configuration, weight setting and service selection; the fifth and sixth columns respectively list the average earned business value and the quality attributes in the quality model, and the last column lists the average runtime adaptation actions in one minute; and the second to the sixth columns respectively list the average cost, response time, availability, risk and customer satisfaction in one minute.
TABLE 3
Numerical Results of the Three Approaches
<table>
<thead>
<tr>
<th>App.</th>
<th>Con$_{ini}$</th>
<th>Weight$_{ini}$</th>
<th>Sel$_{ini}$</th>
<th>Val($)$</th>
<th>Ord.($#$)</th>
<th>Cos($)$</th>
<th>Re.(ms)</th>
<th>Ava.(%)</th>
<th>Ris.(%)</th>
<th>Sat.(%)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Static</td>
<td>Config1</td>
<td>[0.50,0.25,0.25]</td>
<td>[1,1,5,5,5]</td>
<td>15.30</td>
<td>9.38</td>
<td>1.79</td>
<td>1358</td>
<td>95.71</td>
<td>9.00</td>
<td>69.82</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Config2</td>
<td>[0.50,0.25,0.25]</td>
<td>[3,5,5,1]</td>
<td>14.55</td>
<td>11.33</td>
<td>1.88</td>
<td>1084</td>
<td>95.59</td>
<td>30.70</td>
<td>79.36</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>[0.50,0.50,0.25]</td>
<td>[5,5,5,5]</td>
<td>15.72</td>
<td>12.33</td>
<td>3.18</td>
<td>508</td>
<td>98.95</td>
<td>29.88</td>
<td>81.14</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>[0.50,0.25,0.50]</td>
<td>[5,5,5,5]</td>
<td>15.49</td>
<td>12.72</td>
<td>3.24</td>
<td>489</td>
<td>98.44</td>
<td>30.59</td>
<td>79.71</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>[0.33,0.33,0.33]</td>
<td>[5,5,5,3]</td>
<td>15.32</td>
<td>11.90</td>
<td>2.66</td>
<td>687</td>
<td>96.72</td>
<td>30.12</td>
<td>80.52</td>
</tr>
<tr>
<td>Single</td>
<td>Config1</td>
<td>[0.33,0.33,0.33]</td>
<td>[5,5,5,5]</td>
<td>16.25</td>
<td>10.50</td>
<td>2.79</td>
<td>1363</td>
<td>97.56</td>
<td>9.27</td>
<td>69.82</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Config2</td>
<td>[0.33,0.33,0.33]</td>
<td>[5,5,5,3]</td>
<td>16.10</td>
<td>12.05</td>
<td>2.65</td>
<td>794</td>
<td>96.96</td>
<td>28.72</td>
<td>80.62</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>[0.33,0.33,0.33]</td>
<td>[5,5,5,5]</td>
<td>16.93</td>
<td>11.73</td>
<td>2.94</td>
<td>952</td>
<td>96.87</td>
<td>20.73</td>
<td>77.33</td>
</tr>
<tr>
<td>Double</td>
<td>Config1</td>
<td>[0.33,0.33,0.33]</td>
<td>[5,5,5,5]</td>
<td>17.20</td>
<td>11.90</td>
<td>2.53</td>
<td>797</td>
<td>96.86</td>
<td>20.38</td>
<td>75.78</td>
</tr>
</tbody>
</table>
For the static approach, the 8 experiments have similar results in terms of earned business value. Besides, the experiments with the same process configurations differ in cost, response time and availability because of their different QoS weight settings, but are similar in risk and customer satisfaction because these two quality attributes are only relevant at the process level. And the higher the weight is set to a quality attribute, the better the quality attribute is, i.e., the service selections are better in the preferred quality attributes, but are worse in others. Moreover, the experiments with Config1 have lower risk and cost whereas the experiments with Config2 have higher customer satisfaction and lower response time because Config1 prefers Risk be reduced and Cost be reduced whereas Config2 prefers Customer satisfaction be enhanced and Response time be reduced. This shows that these process configurations and service selections are competitive with each other from the business value perspective and have their own preferences over the quality attributes, and thus it is really hard and maybe even impossible for business analysts to decide at design time what process configuration and service selection should be used at runtime.
For the single and double approaches, we can observe that the single approach outperforms the static approach in terms of earned business value by 5.76% in average; and our approach outperforms the static approach by 11.58% and the single approach by 5.50% in average. On the other hand, in terms of the quality attributes, we can observe that our approach is not totally superior to the static and single approaches as well as not totally inferior to them because our approach focuses on the overall optimization from the business value perspective rather than on the quality attributes. This shows that a composite service cannot always run optimally with statically designed processes (i.e., the static approach) or with only dynamic service selection (i.e., the single approach), and should also dynamically adapt its process structure and behavior to achieve better overall satisfaction (in terms of earned business value).
In summary, the evaluation of numerical indicators answers Q1 positively that a composite service can achieve better overall satisfaction in terms of earned business value by combining both process reconfiguration and service selection. Further, it also demonstrates that it is reasonable to combine them for the purpose of self-optimization for composite services.
6.2.2 Adaptation Process Indicator
Fig. 6 illustrates the self-optimization process of the single and double approaches, with the X axis denoting discrete time intervals of one minute and the Y axis denoting the earned business value in each time interval. Here we only show the comparison result on the initial process configuration Config1 because we got similar result on Config2. On the curve, the adaptation actions as introduced in Section 4.4.1, including service-level optimization (a2), process-level and service-level optimization (a3) and optimization failure (a4), are respectively recorded as dark gray, light gray and black points. For the single approach, optimization failure means no new service selection result is found; for the double approach, optimization failure means neither new process configuration nor new service selection result is found.
From the curve of the single approach (Fig. 6(a)), we can observe that it is often the case that no new service selection result can be found when the earned business value drops (e.g., from time 13 to 15, from time 51 to 55) although an adaptation is really needed to improve the earned business value. Among the 36 adaptation actions in this experiment, 25 of them failed. As a result of such optimization failures, the earned business value was often below the expected level. This further shows that only dynamic service selection is not enough for the optimization of composite services.
From the curve of the double approach (Fig. 6(b)), we can observe that optimization failure hardly happens because the business process will be reconfig-
ured once no service selection result can be found. In this experiment, only 3 of the 32 adaptation actions suffered a failure, and 10 of them involved process-level optimization. This shows that self-optimization by combining process reconfiguration and service selection gives the adaptation process more flexibility.
In summary, the evaluation of this adaptation process indicator answers Q1 positively that a composite service can achieve better overall satisfaction in terms of more adaptation flexibility by combining process reconfiguration and service selection.
6.3 Performance Evaluation (Q2)
The service selector and the goal reasoner are the two most time-consuming parts of our approach. They use MIP and SAT, both of which are generally NP-hard problems, for searching and reasoning respectively. Their performance is mainly determined by the sizes of business processes and goal models. To evaluate the performance of our approach, we conducted a set of experiments with randomly generated goal models whose sizes varied from 75 to 200 goals, corresponding business processes whose sizes varied from 28 to 115 abstract services, and the goal/process variations whose numbers varied from 9 to 24. In addition, the number of soft goals was fixed to 20 soft goals; every abstract service had 100 candidate concrete services; and the number of QoS constraints was fixed to 3.
As shown in Fig. 7, the goal reasoner takes around 1 second to produce the configuration result for the size of 200 goals, and increases gently; the service selector takes around 2.5 seconds to produce the selection result for the size of 115 abstract services, and increases faster than goal reasoner. Since our approach performs at most two service selections and one goal reasoning in one self-optimization loop, the curve of “total” shows this maximum overhead. And the total overhead is less than 6 seconds for the size of 200 goals and 115 abstract services, which is still feasible in our approach.
This answers Q2 positively that our approach has an acceptable performance overhead, which means that approach can scale well with the growth of goal models and business processes and can be effectively applied to real-life composite services.
7 DISCUSSION
We make several assumptions to better illustrate the main focus of this paper. First, we assume that the concrete services for an abstract service share identical interfaces and thus are interchangeable. If they do not, however, they can become interchangeable by using service substitution techniques [30]. Second, we focus on sequential processes because processes with more complex structures such as parallel and loop can be reduced to sequential ones with loop unfolding [31] and loop peeling [32] techniques. Third, all possible process configurations are currently in-built to one business process with the standard BPEL element if-elseif. With the increasing number of variations, the business process will be too complex to be understood and maintained. Thus, more flexible techniques such as VxBPEL [18] and AO4BPEL [19] should be explored.
to support the graceful definition and adaptation of process variability in BPEL processes. These assumptions mostly affect the specific mechanisms for service selection and adaptation execution, which are not the main focus of this paper.
In this paper we focus on self-optimization rather than personalization since the adaptation is conducted for all the composite service instances with the purpose of maximizing the overall requirements satisfaction. The preference ranks of quality attributes are tuned not for the satisfaction of individual composite service requesters, but for the overall requirements satisfaction from the perspective of composite service providers. However, being combined with the preference profiles of individual service requesters, our approach can be adapted to support personalization by reconfiguring the business process and selecting optimal concrete services for individual service requesters based on their own quality preference profiles.
Instead of using utility function based on quality attributes, we exploit earned business value to measure the overall satisfaction of stakeholder requirements. The definition of the value formula reflects the current business strategies of the composite service provider. For example, for a company providing order processing service, it may focus on the direct profits obtained from successfully processed orders during some time, but may emphasize more on the customer experience and feedback during other time. Such changes of the value formula will further guide the change of self-optimization strategies and provide a way to map business strategies to IT infrastructures.
Further, when applying our approach, if an appropriate value formula can be defined is the main threat to validity. On the one hand, to capture and reflect the changes of business strategies, online analytical processing (OLAP) and business intelligence (BI) can be combined with our approach. On the basis of the large amounts of business data about a composite service, OLAP and BI can provide predictive analysis on business strategies and then guide the definition or adjustment of the value formula. On the other hand, to capture and reflect some long-term influence factors such as reputation and customer satisfaction, specific analysis like market investigation and customer losing trend analysis should be conducted by business experts to help define the value formula. However, if the definition of value formula is incorrect (e.g., violating the stakeholders’ original intentions) or less sensitive to the changing environments (e.g., failing to properly capture long-term influence factors), our approach may also take undesired or delayed adaptation actions since its indicator is inappropriate; and if the relevant business data is unavailable or the specific analysis is impractical, our approach will be not applicable.
Last but not the least, we evaluate the effectiveness of our approach on only one composite service. Surely, experiments on more real-life composite services are needed to further evaluate the feasibility of our approach, which is one of our future work. We cannot guarantee the same improvement of about 12% in earned business value with other composite services, which actually may be better or worse depending on application-specific factors such as the number of process variation points, the value measurement and the environments. However, we believe that in general our approach can produce certain improvement since it can exploit a larger adaptation space by considering dynamic quality tradeoffs and process variability.
8 Conclusions
In this paper we have proposed a requirements-driven self-optimization approach for composite services. Firstly, it combines high-level process reconfiguration and low-level service selection to provide more adaptation flexibility. Secondly, it supports dynamic quality tradeoffs to reflect the changing environments by employing a feedback controller to tune the preference ranks of relevant quality attributes. Thirdly, it uses earned business value as the objective and trigger for self-optimization.
An experimental study on an order processing service indicated that our approach outperformed both fixed-weighted and floating-weighted service selection approaches in terms of earned business value and adaptation flexibility, and demonstrated the acceptable performance overhead of a combined adaptation of process reconfiguration and service selection.
In future, we intend to improve this work by integrating more advanced process variability mechanisms, e.g., VxBPEL [18] in order to achieve even more flexible process variability definition and adaptation. We also plan to apply our approach to more real-life composite services to further validate its feasibility.
Acknowledgments
This work is supported by National Natural Science Foundation of China under Grant No. 6136120097, National High Technology Development 863 Program of China under Grant No. 2013AA01A605, and ERC Advanced Grant 291652 - ASAP.
References
|
{"Source-Url": "http://oro.open.ac.uk/39225/1/chen14tsc.pdf", "len_cl100k_base": 15177, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 52748, "total-output-tokens": 15620, "length": "2e13", "weborganizer": {"__label__adult": 0.0003762245178222656, "__label__art_design": 0.0007605552673339844, "__label__crime_law": 0.0003383159637451172, "__label__education_jobs": 0.002033233642578125, "__label__entertainment": 0.00014781951904296875, "__label__fashion_beauty": 0.0002359151840209961, "__label__finance_business": 0.0025539398193359375, "__label__food_dining": 0.00041294097900390625, "__label__games": 0.0008234977722167969, "__label__hardware": 0.0009555816650390624, "__label__health": 0.0007257461547851562, "__label__history": 0.0004658699035644531, "__label__home_hobbies": 0.00011539459228515624, "__label__industrial": 0.0006728172302246094, "__label__literature": 0.00052642822265625, "__label__politics": 0.00038504600524902344, "__label__religion": 0.00048732757568359375, "__label__science_tech": 0.10955810546875, "__label__social_life": 0.00011652708053588869, "__label__software": 0.0188446044921875, "__label__software_dev": 0.8583984375, "__label__sports_fitness": 0.0002677440643310547, "__label__transportation": 0.00067138671875, "__label__travel": 0.00026607513427734375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 66770, 0.06192]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 66770, 0.07144]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 66770, 0.91818]], "google_gemma-3-12b-it_contains_pii": [[0, 677, false], [677, 5389, null], [5389, 11135, null], [11135, 16722, null], [16722, 20701, null], [20701, 24936, null], [24936, 30733, null], [30733, 36185, null], [36185, 41861, null], [41861, 46454, null], [46454, 52366, null], [52366, 57946, null], [57946, 61054, null], [61054, 66770, null], [66770, 66770, null]], "google_gemma-3-12b-it_is_public_document": [[0, 677, true], [677, 5389, null], [5389, 11135, null], [11135, 16722, null], [16722, 20701, null], [20701, 24936, null], [24936, 30733, null], [30733, 36185, null], [36185, 41861, null], [41861, 46454, null], [46454, 52366, null], [52366, 57946, null], [57946, 61054, null], [61054, 66770, null], [66770, 66770, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 66770, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 66770, null]], "pdf_page_numbers": [[0, 677, 1], [677, 5389, 2], [5389, 11135, 3], [11135, 16722, 4], [16722, 20701, 5], [20701, 24936, 6], [24936, 30733, 7], [30733, 36185, 8], [36185, 41861, 9], [41861, 46454, 10], [46454, 52366, 11], [52366, 57946, 12], [57946, 61054, 13], [61054, 66770, 14], [66770, 66770, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 66770, 0.15649]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
a21cd0913bff004cac02ee5cd8eb8dfd3f423062
|
Sequential Composition in the Presence of Intermediate Termination (Extended Abstract)
Jos Baeten
CWI
Amsterdam, the Netherlands
University of Amsterdam,
Amsterdam, the Netherlands
Jos.Baeten@cwi.nl
Bas Luttik
Eindhoven University of Technology
Eindhoven, the Netherlands
s.p.luttik@tue.nl
Fei Yang
Eindhoven University of Technology
Eindhoven, the Netherlands
f.yang@tue.nl
The standard operational semantics of the sequential composition operator gives rise to unbounded branching and forgetfulness when transparent process expressions are put in sequence. Due to transparency, the correspondence between context-free and pushdown processes fails modulo bisimilarity, and it is not clear how to specify an always terminating half counter. We propose a revised operational semantics for the sequential composition operator in the context of intermediate termination. With the revised operational semantics, we eliminate transparency, allowing us to establish a close correspondence between context-free processes and pushdown processes. Moreover, we prove the reactive Turing powerfulness of TCP with iteration and nesting with the revised operational semantics for sequential composition.
1 Introduction
Sequential composition is a standard operator in many process calculi. The functionality of the sequential composition operator is to concatenate the behaviours of two systems. It has been widely used in many process calculi with the notation “·”. We illustrate its operational semantics by a process \( P \cdot Q \) in TCP [2]. If the process \( P \) has a transition \( P \xrightarrow{a} P' \) for some action label \( a \), then the composition \( P \cdot Q \) has the transition \( P \cdot Q \xrightarrow{a} P' \cdot Q \). Termination is an important behaviour for models of computation [2].
A semantic distinction between successful and unsuccessful termination in concurrency theory (CT) is especially important for a smooth incorporation of the classical theory of automata and formal languages (AFT): the distinction is used to express whether a state in an automaton is accepting or not. Automata may even have states that are accepting and may still perform transitions; this phenomenon we call intermediate termination. From a concurrency-theoretic point of view, such behaviour is perhaps somewhat unnatural. To be able to express it nevertheless, we let an alternative composition inherit the option to terminate from just one of its components. The expression \( a \cdot (b + 1) \) then denotes the process that does an \( a \)-transition and subsequently enters a state that is successfully terminated but can also do a \( b \)-transition.
To specify the operational semantics of sequential composition in a setting with a explicit successful termination, usually the following three rules are added: the first one states that the sequential composition \( P \cdot Q \) terminates if both \( P \) and \( Q \) terminate; the second one states that if \( P \) admits a transition \( P \xrightarrow{a} P' \), then \( P \cdot Q \xrightarrow{a} P' \cdot Q \); and the third one states that if \( P \) terminates, and there is a transition \( Q \xrightarrow{a} Q' \), then we have the transition \( P \cdot Q \xrightarrow{a} Q' \).
In this paper, we discuss a complication stemming from these operational semantics of the sequential composition operator. The complication is that a process expression \( P \) with the option to terminate is transparent in a sequential context \( P \cdot Q \): if \( P \) may still perform observable behaviour other than termination, then this may be skipped by doing a transition from \( Q \). There are two disadvantages of...
transparency in our attempts to achieve a smooth integration of process theory and the classical theory of automata and formal languages [7]:
The relationship between context-free processes (i.e., processes that can be specified with a guarded recursive specification over a language with action constants, constants for deadlock (0) and successful termination (1), and binary operations for sequential and alternative composition) and pushdown automata has been extensively discussed in the literature [4]. It has been shown that every context-free process is equivalent to the behaviour of some pushdown automaton (i.e., a pushdown process) modulo contra simulation, but not modulo rooted branching bisimulation. By stacking unboundedly many transparent terms with sequential composition, we would get an unboundedly branching transition system. It was shown that unboundedly branching behaviour cannot be specified by any pushdown process modulo rooted branching bisimulation [4]. In order to improve the result to a finer notion of behaviour equivalence, we need to eliminate the problem of unbounded branching.
Transparency also complicates matters if one wants to specify some form of memory (e.g., a counter, a stack, or a tape) that always has the option to terminate, but at the same time does not lose data. If the standard process algebraic specifications of such memory processes are generalised to a setting with intermediate termination, then either they are not always terminating, or they are ‘forgetful’ and may non-deterministically lose data. This is a concern when one tries to specify the behaviour of a pushdown automaton or a Reactive Turing machine in a process calculus [5, 19, 20]. The process calculus TCP with iteration and nesting is Turing complete [11, 12]. Moreover, it follows from the result in [12] that it is reactively Turing powerful if intermediate termination is not considered. However, it is not clear to us how to reconstruct the proof of reactive Turing powerfulness if termination is considered. Due to the forgetfulness on the stacking of transparent process expressions, it is not clear to us how to define a counter that is always terminating, which is crucial for establishing the reactive Turing powerfulness.
In order to avoid the (in some cases) undesirable feature of unbounded branching and forgetfulness, we propose a revised operational semantics for the sequential composition operator. The modification consists of disallowing a transition from the second component of a sequential composition if the first component is able to perform a transition. Thus, we avoid the problems mentioned above with the revised operator. We shall prove that every context-free process is bisimilar to a pushdown process, and that TCP with iteration and nesting is reactively Turing powerful modulo divergence-preserving branching bisimilarity (without resorting to recursion) in the revised semantics.
The research presented in this article is part of an attempt to achieve a smoother integration of the classical theory of automata and formal languages (AFT) within concurrency theory (CT). The idea is to recognise that a finite automaton is just a special type of labelled transition system, that more complicate automata (pushdown automata, Turing machines) naturally generate transition systems, and that there is a natural correspondence between regular expressions and grammars on the one hand and certain process calculi on the other hand. In [7, 9, 10] we have studied the various notions of automata from AFT modulo branching bisimilarity. In [8] we have explored the correspondence between finite automata and regular expressions extended with parallel composition modulo strong bisimilarity. In [5] we have proposed reactive Turing machines as an extension of Turing machines with concurrency-style interaction.
The paper is structured as follows. We first introduce TCP with the standard version of sequential composition in Section 2. Next, we discuss the complications caused by transparency in Section 3. Then, in Section 4, we propose the revised operational semantics of the sequential composition operator, and show that rooted divergence-preserving branching bisimulation is a congruence. In Section 5, we revisit the relationship between context-free processes and pushdown automata, and show that every context-free process is bisimilar to a pushdown process in our revised semantics. In Section 6, we prove that TCP with iteration and nesting is reactively Turing powerful in the revised semantics. In Section 7, we draw
some conclusions and propose some future work. The full version of this extended abstract, including proofs of the results, is available as [6].
2 Preliminaries
We start with introducing the notion of labelled transition system, which is used as the standard mathematical representation of behaviour. We consider transition systems with a subset of states marked as terminating states. We let $A$ be a set of action symbols, and we extend $A$ with a special symbol $\tau \not\in A$, which intuitively denotes unobservable internal activity of the system. We shall abbreviate $A \cup \{\tau\}$ by $A_{\tau}$.
**Definition 1.** An $A_{\tau}$-labelled transition system is a tuple $(S, \rightarrow, \uparrow, \downarrow)$, where
1. $S$ is a set of states,
2. $\rightarrow \subseteq S \times A_{\tau} \times S$ is an $A_{\tau}$-labelled transition relation,
3. $\uparrow \in S$ is the initial state, and
4. $\downarrow \subseteq S$ is a set of terminating states.
Next, we shall introduce the process calculus *Theory of Sequential Processes* (TSP) that allows us to describe transition systems.
Let $N$ be a countably infinite set of names. The set of process expressions $P$ is generated by the following grammar ($a \in A_{\tau}, N \in N$):
$$P := 0 \mid 1 \mid a.P \mid P.P \mid P + P \mid N.$$
We briefly comment on the operators in this syntax. The constant $0$ denotes *deadlock*, the unsuccessfully terminated process. The constant $1$ denotes *termination*, the successfully terminated process. For each action $a \in A_{\tau}$ there is a unary operator $a.$ denoting action prefix; the process denoted by $a.P$ can do an $a$-labelled transition to the process $P$. The binary operator $+$ denotes alternative composition or choice. The binary operator $\cdot$ represents the sequential composition of two processes.
Let $P$ be an arbitrary process expression; and we use an abbreviation inductively defined by: $P^0 = 1$; and $P^{n+1} = P \cdot P^n$ for all $n \in \mathbb{N}$.
A recursive specification $E$ is a set of equations $E = \{ N \overset{\text{def}}{=} P | N \in N, P \in \mathcal{P} \}$, satisfying:
1. for every $N \in N$ it includes at most one equation with $N$ as left-hand side, which is referred to as the *defining equation* for $N$; and
2. if some name $N'$ occurs in the right-hand side $P'$ of some equation $N' = P'$ in $E$, then $E$ must include a defining equation for $N'$.
An occurrence of a name $N$ in a process expression is *guarded* if the occurrence is within the scope of an action prefix $a.$ for some $a \in A$ ($\tau$ cannot be a guard). A recursive specification $E$ is guarded if all occurrences of names in right-hand sides of equations in $E$ are guarded.
We use structural operational semantics to associate a transition relation with process expressions defined in TSP. A term is *closed* if it does not contain any free variables. Structural operational semantics induces a transition relation on closed terms. We let $\rightarrow$ be the $A_{\tau}$-labelled transition relation induced on the set of process expressions by operational rules in Figure 1. Note that we presuppose a recursive specification $E$, and we omit the symmetrical rules for $\cdot$.
the symmetrical rules).
Given a TSP process expression $P$, the transition system $T(P) = (S_P, \rightarrow_P, \uparrow_P, \downarrow_P)$ associated with $P$ is defined as follows:
1. the set of states $S_P$ consists of all process expressions reachable from $P$;
2. the transition relation $\rightarrow_P$ is the restriction to $S_P$ of the transition relation defined on all process expressions by the structural operational semantics, i.e., $\rightarrow_P = \rightarrow \cap (S_P \times A_t \times S_P)$;
3. $\uparrow_P = P$; and
4. the set of final states $\downarrow_P$ consists of all process expressions $Q \in S_P$ such that $Q \downarrow$, i.e., $\downarrow_P = \downarrow \cap S_P$.
We also use (a restricted variant of) the process calculus TCP in later sections. It is obtained by adding a parallel composition operator to TSP. Let $C$ be a set of channels and $D_{\square}$ be a set of data symbols. For every subset $C' \subseteq C$, we propose a special set of actions $I_{C'} \subseteq A_t$ defined by: $I_{C'} = \{c?d, c!d \mid d \in D_{\square}, c \in C'\}$.
The actions $c?d$ and $c!d$ denote the events that a datum $d$ is received or sent along channel $c$, respectively. We include binary parallel composition operators $[\_\_\_\_\_\_\_\_]_{C'} (C \subseteq C)$. Communication along the channels in $C'$ is enforced and communication results in $\tau$.
The operational semantics of the parallel composition operators is presented in Figure 2 (We omit the symmetrical rules).
The notation of behavioural equivalence has been used extensively in the theory of process calculi. We first introduce the notion of strong bisimilarity [21, 23], which does not distinguish $\tau$-transitions from other labelled transitions.
Definition 2. A binary symmetric relation $R$ on a transition system $(S,\rightarrow,\uparrow,\downarrow)$ is a strong bisimulation if, for all states $s,t \in S$, $sRt$ implies
1. if $s \xrightarrow{a} s'$, then there exist $t' \in S$, such that $t \xrightarrow{a} t'$, and $s'\sim R t'$;
2. if $s \downarrow$, then $t \downarrow$.
The states $s$ and $t$ are strongly bisimilar (notation: $s \preceq t$) if there exists a strong bisimulation $R$ s.t. $sRt$.
The notion of strong bisimilarity does not take into account the intuition associated with $\tau$ that it stands for unobservable internal activity. We proceed to introduce the notion of (divergence-preserving) branching bisimilarity, which does treat $\tau$-transitions as unobservable. Divergence-preserving branching bisimilarity is the finest behavioural equivalence in van Glabbeek’s linear time - branching time spectrum [16], and, moreover, the coarsest behavioural equivalence compatible with parallel composition that preserves validity of formulas from the well-known modal logic CTL minus the next-time modality $X$ [18]. Let $\rightarrow$ be an $\mathcal{A}_\tau$-labelled transition relation on a set $S$, and let $a \in \mathcal{A}_\tau$; we write $s \xrightarrow{(a)} t$ for the formula “$s \xrightarrow{a} t \lor (a = \tau \land s = t)$”. Furthermore, we denote the transitive closure of $\xrightarrow{\tau}$ by $\xrightarrow{+}$ and the reflexive-transitive closure of $\xrightarrow{\tau}$ by $\xrightarrow{*}$.
Definition 3. Let $T = (S,\rightarrow,\uparrow,\downarrow)$ be a transition system. A branching bisimulation is a symmetric relation $R \subseteq S \times S$ such that for all states $s,t \in S$, $sRt$ implies
1. if $s \xrightarrow{a} s'$, then there exist $t',t'' \in S$, such that $t \xrightarrow{*} t'' \xrightarrow{(a)} t'$, $sRt''$ and $s'Rt'$;
2. if $s \downarrow$, then there exists $t' \in S$ such that $t \xrightarrow{*} t'$, $t' \downarrow$ and $sRt'$.
The states $s$ and $t$ are branching bisimilar (notation: $s \preceq_b t$) if there exists a branching bisimulation $R$ such that $sRt$.
A branching bisimulation $R$ is divergence-preserving if, for all states $s$ and $t$, $sRt$ implies
3. if there exists an infinite sequence $(s_i)_{i \in \mathbb{N}}$ such that $s = s_0$, $s_i \xrightarrow{\tau} s_{i+1}$ and $s_iRt_i$ for all $i \in \mathbb{N}$, then there exists a state $t'$ such that $t \xrightarrow{\tau} t'$ and $s_iRt_i$ for some $i \in \mathbb{N}$.
The states $s$ and $t$ are divergence-preserving branching bisimilar (notation: $s \preceq_{b}^{\Delta} t$) if there exists a divergence-preserving branching bisimulation $R$ such that $sRt$.
The relation $\preceq_{b}^{\Delta}$ satisfies the conditions of Definition 3, and is, in fact, the largest divergence-preserving branching bisimilarity relation. Divergence-preserving branching bisimilarity is an equivalence relation [15].
Divergence-preserving branching bisimilarity is not a congruence for TSP; it is well-known that it is not compatible with alternative composition. A rootedness condition needs to be introduced.
Definition 4. Let $T = (S,\rightarrow,\uparrow,\downarrow)$ be a transition system. A divergence-preserving branching bisimulation relation $R$ on $T$ satisfies the rootedness condition for a pair of states $s_1,s_2 \in S$, if $s_1R s_2$ and
1. if $s_1 \xrightarrow{a} s'_1$, then $s_2 \xrightarrow{a} s'_2$ for some $s'_2$ such that $s'_1Rs'_2$;
2. if $s_1 \downarrow$, then $s_2 \downarrow$.
$s_1$ and $s_2$ are rooted divergence-preserving branching bisimilar (notation: $s_1 \preceq_{rb}^{\Delta} s_2$) if there exists a divergence-preserving branching bisimulation $R$ that satisfies rootedness condition for $s_1$ and $s_2$.
We can extend the above relations ($\preceq$, $\preceq_b$, $\preceq_{b}^{\Delta}$, and $\preceq_{rb}^{\Delta}$) to relations over two transition systems by defining that they are bisimilar if their initial states are bisimilar in their disjoint union. Namely, for two transition systems $T_1 = (S_1,\rightarrow,\uparrow_1,\downarrow_1)$ and $T_2 = (S_2,\rightarrow,\uparrow_2,\downarrow_2)$, we make the following pairing on their states. We pair every state $s \in S_1$ with 1 and every state $s \in S_2$ with 2. We have $T'_i = (S'_i,\rightarrow'_i,\uparrow'_i,\downarrow'_i)$ for $i = 1, 2$ where $S'_1 = \{(s,i) \mid s \in S_i\}, \rightarrow'_i = \{((s,i),a,(t,i)) \mid (s,a,t) \in \rightarrow_i\}$, $\uparrow'_i = (\uparrow_i,i)$, and $\downarrow'_i = \{(s,i) \mid s \in \downarrow_i\}$. We say $T_1 \equiv T_2$ if in $T = (S'_1 \cup S'_2,\rightarrow'_1 \cup \rightarrow'_2,\uparrow'_1,\downarrow'_1 \cup \downarrow'_2)$ we have $\uparrow'_1 \equiv \uparrow'_2$.
Sequential Composition in the Presence of Intermediate Termination
3 Transparency
Process expressions that have the option to terminate are transparent in a sequential context: if $P$ has the option to terminate and $Q \xrightarrow{a} Q'$, then $P \cdot Q \xrightarrow{a} Q'$ even if $P$ can still do transitions. In this section we shall explain how transparency gives rise to two phenomena that are undesirable in certain circumstances. First, it facilitates the specification of unboundedly branching behaviour with a guarded recursive specification over TSP. Second, it gives rise to forgetful stacking of variables, and as a consequence it is not clear how to specify an always terminating half-counter.
We first discuss process expressions with unbounded branching. It is well-known from formal language theory that the context-free languages are exactly the languages accepted by pushdown automata. The process-theoretic formulation of this result is that every transition system specified by a TSP specification is language equivalent to the transition system associated with a pushdown automaton and, vice versa, every transition system associated with a pushdown automaton is language equivalent to the transition system associated with some TSP specification. The correspondence fails, however, when language equivalence is replaced by (strong) bisimilarity. The currently tightest result is that for every context-free process there is a pushdown process to simulate it modulo contra simulation [4]; we conjecture that not every context-free process is simulated by a pushdown process modulo branching bisimilarity. The reason is that context-free processes may have an unbounded branching degree. Consider the following process:
$$X = a.X \cdot Y + b.1 \quad Y = c.1 + 1 .$$
The transition system associated with $X$ is illustrated in Figure 3. Note that every state in the second row is a terminating state. The state $Y^n$ has $n$ c-labelled transitions to $1, Y, Y^2, \ldots, Y^{n-1}$, respectively. Therefore, every state in this transition system has finitely many transitions leading to distinct states, but there is no upper bound on the number of transitions from each state. Therefore, we say that this transition system has an unbounded branching degree.
We can prove that the process defined by the TSP specification above is not strongly bisimilar to a pushdown process since it has an unbounded branching degree, whereas a pushdown process is always boundedly branching. The correspondence does hold modulo contra simulation [4], and it is an open problem as to whether the correspondence holds modulo branching bisimilarity. In Section 5, we show that with a revised operational semantics for sequential composition, we eliminate such unbounded branching and indeed obtain a correspondence between pushdown processes and context-free processes modulo strong bisimilarity.
Figure 3: A transition system with unboundedly branching behaviour
Next, we discuss the phenomenon of forgetfulness. Bergstra, Bethke and Ponse introduce a process calculus with iteration and nesting \cite{11, 12} in which a binary nesting operator $\sharp$ and a Kleene star operator $^*$ are added. In this paper, we add these two operators to TCP (Strictly speaking, we use an unary variant Kleene star operator). We give the operational semantics of these two operators in Figure 4.
\[
\begin{array}{c}
\begin{array}{c}
P \xrightarrow{a} P' \\
\end{array} \\
\begin{array}{c}
P^* \downarrow \\
\end{array} \\
\begin{array}{c}
P_1 \xrightarrow{a} P'_1 \\
\end{array} \\
\begin{array}{c}
P_1 \sharp P_2 \xrightarrow{a} (P_1 \sharp P_2) \cdot P_1 \\
\end{array} \\
\begin{array}{c}
P_1 \sharp P_2 \xrightarrow{a} P'_1 \cdot (P_1 \sharp P_2) \cdot P_1 + P_2 \\
\end{array} \\
\begin{array}{c}
P_2 \xrightarrow{a} P'_2 \\
\end{array} \\
\begin{array}{c}
P_2 \downarrow \\
\end{array} \\
\end{array}
\]
Figure 4: The operational semantics of nesting and iteration
To get some intuition for the operational interpretation of these operators, note that the processes $P^*$ and $P_1 \sharp P_2$ respectively satisfy the following equations modulo bisimilarity:
\[
P^* = P \cdot P^* + 1 \quad P_1 \sharp P_2 = P_1 \cdot (P_1 \sharp P_2) \cdot P_1 + P_2
\]
Bergstra et al. show how one can specify a half counter using iteration and nesting, which then allows them to conclude that the behaviour of a Turing machine can be simulated in the calculus with iteration and nesting (not including recursion) \cite{11, 12}.
The half counter is specified as follows:
\[
\begin{align*}
CC_n &= a.CC_{n+1} + b.BB_n (n \in \mathbb{N}) \\
BB_n &= a.BB_{n-1} (n \geq 1) \\
BB_0 &= c.CC_0.
\end{align*}
\]
The behaviour of a half counter is illustrated in Figure 5. The initial state is $CC_0$. From $CC_0$ an arbitrary number of $a$ transitions is possible. After a $b$-labelled transition, the process performs the same number of $a$-labelled transitions as before the $b$-labelled transition, to the state $BB_0$. In state $BB_0$, a zero testing transition, labelled by $c$ is enabled, leading back to the state $CC_0$.
An implementation in a calculus with iteration and nesting is provided in \cite{12} as follows:
\[
HCC = ((a \sharp b) \cdot c)^*.
\]
Figure 5: The transition system of a half counter
It is straightforward to establish that \(((a^\#b) \cdot a^n \cdot c) \cdot HCC\) is equivalent to \(CC_n\) for all \(n \geq 1\) modulo strong bisimilarity, and \((a^n \cdot c) \cdot HCC\) is equivalent to \(BB_n\) for all \(n \in \mathbb{N}\) modulo strong bisimilarity.
In a context with intermediate termination, one may wonder if it is possible to generalize their result. It is, however, not clear how to specify an always terminating half counter. At least, a naive generalization of the specification of Bergstra et al. does not do the job. The culprit is forgetfulness. We define a half counter that terminates in every state as follows:
\[
C_n = a \cdot C_{n+1} + b \cdot B_n + 1 \quad (n \in \mathbb{N})
\]
\[
B_n = a \cdot B_{n-1} + 1 \quad (n \geq 1)
\]
\[
B_0 = c \cdot C_0 + 1.
\]
Now consider the process \(HC\) defined by:
\[
HC = ((a + 1)^{#}(b + 1) \cdot (c + 1))^*.
\]
Note that due to transparency, \(((a + 1)^n \cdot (c + 1)) \cdot HC\) is not equivalent to \(B_n\) modulo any reasonable behavioural equivalence for \(n > 1\) since \(B_n\) only has an \(a\)-labelled transition to \(B_{n-1}\) whereas the other process has at least \(n + 1\) transitions leading to \(HC, (c + 1) \cdot HC, (a + 1) \cdot (c + 1) \cdot HC, \ldots, (a + 1)^{n-1} \cdot (c + 1) \cdot HC\), respectively. This process may choose to “forget” the transparent process expressions that have been stacked using the sequential composition operator. We conjecture that, due to forgetfulness, the always terminating half counter cannot be specified in TCP\(^\#\).
In Section 6, we show that with the revised semantics, it is possible to specify an always terminating half counter and we shall prove that TCP extended with \(\ast\) and \(\#\) (but without recursion) is reactively Turing powerful.
## 4 A Revised Semantics of the Sequential Composition Operator
Inspired by the work in [1] and [13], we revise the operational semantics for sequential composition and propose a calculus TCP\(^\;\). Its syntax is obtained by replacing the sequential composition operator \(\cdot\) by \(;\) in the syntax of TCP. Note that we also use the abbreviation of \(P^n\) as we did for the standard version of the sequential composition operator.
The operational rules for \(;\) are given in Figure 6. Note that the third rule has a negative premise \(P_1 \not\rightarrow\). Intuitively, this rule is only applicable if there does not exist a closed term \(P'_1\) and an action \(a \in \mathcal{A}_r\) such that the transition \(P_1 \xrightarrow{a} P'_1\) is derivable. For a sound formalisation of this intuition, using the notions of irredundant and well-supported proof, see [17]. As a consequence, the branching degree of a context-free process is bounded and sequential compositions may have the option to terminate, without being forgetful.
<table>
<thead>
<tr>
<th>(P_1 \downarrow)</th>
<th>(P_2 \downarrow)</th>
<th>(P_1 \xrightarrow{a} P'_1)</th>
<th>(P_2 \xrightarrow{a} P'_2)</th>
<th>(P_1 \not\rightarrow)</th>
</tr>
</thead>
<tbody>
<tr>
<td>(P_1; P_2 \downarrow)</td>
<td>(P_1; P'_2 \downarrow)</td>
<td>(P_1; P'_1; P_2)</td>
<td>(P_1; P'_2)</td>
<td>(P_1 \not\rightarrow)</td>
</tr>
</tbody>
</table>
Figure 6: The revised semantics of sequential composition
\(P_1 \not\rightarrow\).
Let us revisit the first example in Section 3. We rewrite it with the revised sequential composition operator:
\[ X = a.X; Y + b.1 \quad Y = c.1 + 1. \]
Its transition system is illustrated in Figure 7. Every state in the transition system now has a bounded branching degree. For instance, a transition from \( Y^2 \) to \( Y^1 \) is abandoned because \( Y \) has a transition and only the transition from the first \( Y \) in the sequential composition is allowed.
Congruence is an important property to fit a behavioural equivalence into an axiomatic framework. We have that in the revised semantics, \( \equiv_{\Delta \text{rb}} \) is a congruence. Note that the congruence property can also be inferred from a recent result of Fokkink, van Glabbeek and Luttik [14].
**Theorem 1.** \( \equiv_{\Delta \text{rb}} \) is a congruence with respect to TCP^\text{x}.
As a remark, unlike the divergence-preserving variant of rooted branching bisimilarity, the more standard variant that does not require divergence-preservation (\( \equiv_{\text{rb}} \)) is not a congruence for TCP^\text{x}. Consider
\[ P_1 = \tau.1 \quad P_2 = (\tau.1)^* \quad Q = a.1. \]
We have \( P_1 \equiv_{\text{rb}} P_2 \) but not \( P_1; Q \equiv_{\text{rb}} P_2; Q \), for \( P_1; Q \) can do a \( a \)-transition after the \( \tau \)-transition, whereas \( P_2; Q \) can only do \( \tau \) transitions.
We also define a version of TCP with iteration and nesting (TCP^\#) in the revised semantics. By removing the facility of recursive specification and the operations \( * \) and \( \# \), we get TCP^\#. The operational rules for \( * \) and \( \# \) are obtained by replacing, in the rules in Figure 4, all occurrences of \( \cdot \) by \( ; \).
## 5 Context-free Processes and Pushdown Processes
The relationship between context-free processes and pushdown processes has been studied in the literature [4]. We consider the process calculus *Theory of Sequential Processes* (TSP^\text{x}). We define context-free processes as follows:
**Definition 5.** A context-free process is the strong bisimulation equivalence class of the transition system generated by a finite guarded recursive specification over TSP^\text{x}.
Note that there is a method to rewrite every context-free process into Greibach normal form [3], which is also valid in the revised semantics. In this paper, we only consider context-free processes in Greibach normal form, i.e., defined by guarded recursive specifications of the form
\[ X = \sum_{i \in I_X} \alpha_i \xi_i (+1). \]
In this form, every right-hand side of every equation consists of a number of summands, indexed by a finite set \( I_X \) (the empty sum denotes 0), each of which is 1, or of the form \( \alpha_i, \xi_i \), where \( \xi_i \) is the sequential composition of names (the empty sequence denotes 1).
We shall show that every context-free process is equivalent to a pushdown process modulo strong bisimilarity. The notion of pushdown automaton is defined as follows:
**Definition 6.** A pushdown automaton (PDA) is a 7-tuple \( (S, \Sigma, D, \rightarrow, \uparrow, Z, \downarrow) \), where
1. \( S \) is a finite set of states,
2. \( \Sigma \) is a finite set of input symbols,
3. \( D \) is a finite set of stack symbols,
4. \( \rightarrow \subseteq S \times D \times \Sigma \times D^* \times S \) is a finite transition relation, (we write \( s \xrightarrow{a,d,\delta} t \) for \( (s,d,a,\delta,t) \in \rightarrow \)),
5. \( \uparrow \in S \) is the initial state,
6. \( Z \in D \) is the initial stack symbol, and
7. \( \downarrow \subseteq S \) is a set of accepting states.
We use a sequence of stack symbols \( \delta \in D^* \) to represent the contents of a stack. We associate with every pushdown automaton a labelled transition system. The bisimulation equivalence classes of transition systems associated with pushdown automata are referred to as pushdown processes.
**Definition 7.** Let \( M = (S, \Sigma, D, \rightarrow, \uparrow, Z, \downarrow) \) be a PDA. The transition system \( T(M) = (S_T, \rightarrow_T, \uparrow_T, \downarrow_T) \) associated with \( M \) is defined as follows:
1. its set of states is the set \( S_T = \{ (s, \delta) \mid s \in S, \delta \in D^* \} \) of all configurations of \( M \),
2. its transition relation \( \rightarrow_T \subseteq S_T \times A_T \times S_T \) is the relation satisfying, for all \( a \in \Sigma, d \in D, \delta, \delta' \in D^* \):
\( (s,d,\delta) \xrightarrow{a,d,\delta'} (t,\delta'') \) iff \( s \xrightarrow{a,d,\delta} t \),
3. its initial state is the configuration \( \uparrow_T = (\uparrow, Z) \), and
4. its set of terminating states is the set \( \downarrow_T = \{ (s, \delta) \mid s \in S, s \downarrow, \delta \in D^* \} \).
Recall that a context-free process is defined by a recursive specification in Greibach normal form; all states of the context-free process are denoted by sequences of names defined in this recursive specification. Note that a sequence of names denotes a terminating state only if all names have the option to terminate. Hence, to be able to determine whether a configuration of the pushdown automaton should have the option to terminate, we need to know whether all names currently on the stack have the option to terminate. We annotate the states of the pushdown automaton with the subset of names currently on the stack. We shall use the stack to record the sequence of names corresponding to the current state. The deepest occurrence of a name on the stack is marked and we shall include special transitions in the automaton for the treatment of marked names. If a marked name is removed from the stack, then, intuitively, it should be removed from the set annotating the state from the set. On the other hand, if a name not in the set is added to the stack, then we shall mark that name and add that name to the set annotating the state. As an example, we introduce a PDA as in Figure 8 to simulate the process in Figure 7 modulo \( \leftrightarrow \).
To obtain a general result, we consider a context-free process defined by a set of names \( V = \{X_0, X_1, \ldots, X_m\} \) with \( X_0 \) as the initial state, where
\[
X_j = \sum_{i \in I_X} \alpha_{ij}, \xi_{ij}(+1).
\]
We introduce the following auxiliary functions:
1. $\text{length} : \mathcal{V}^* \rightarrow \mathbb{N}$, $\text{length}(\xi)$ is the length of $\xi$;
2. $\text{get} : \mathcal{V}^* \times \mathbb{N} \rightarrow \mathcal{V}$, $\text{get}(\xi, i)$ is the $i$-th name of $\xi$;
3. $\text{sufset} : \mathcal{V}^* \times \mathbb{N} \rightarrow 2^{\mathcal{V}^*}$, $\text{sufset}(\xi, i) = \{\text{get}(\xi, j) \mid j = i + 1, \ldots \text{length}(\xi)\}$ computes the set that contains all the names in the suffix which starts from the $i$-th name of $\xi$.
We define a PDA $\mathcal{M} = (S, \Sigma, D, \rightarrow, \uparrow, Z, \downarrow)$ to simulate the transition system associated with $X_0$ as follows: $S = \{D \mid D \subseteq \mathcal{V}\}$; $\Sigma = \mathcal{A}_\land$; $D = \mathcal{V} \cup \{X^\uparrow \mid X \in \mathcal{V}\}$; $\uparrow = \{X_0\}$; $Z = X_0^\uparrow$; $\downarrow = \{D \mid \text{for all } X \in D, X \downarrow\}$; and the transition relation $\rightarrow$ is defined as follows:
\[
\rightarrow = \{(D, X_j^\uparrow, \alpha_{ij}, \delta(D, X_j^\uparrow, \xi_{ij}), \text{merge}(D, X_j^\uparrow, \xi_{ij})) \mid i \in I_X, j = 1, \ldots, n, D \subseteq \mathcal{V}\}
\]
where $\delta(D, X_j^\uparrow, \xi_{ij})$ is the string of length $\text{length}(\xi_{ij})$ defined as follows: for $k = 1, \ldots, \text{length}(\xi_{ij})$, we let $X_k = \text{get}(\xi_{ij}, k)$,
1. if $X_k \notin (D/\{X_j\}) \cup \text{sufset}(\xi_{ij}, k)$, then the $k$-th symbol of $\delta(D, X_j^\uparrow, \xi_{ij})$ is $X_k^\uparrow$,
2. otherwise, the $k$-th symbol of $\delta(D, X_j^\uparrow, \xi_{ij})$ is $X_k$,
$\delta(D, X_j, \xi_{ij})$ is a string of length $\text{length}(\xi_{ij})$ defined as follows: for $k = 1, \ldots, \text{length}(\xi_{ij})$, we let $X_k = \text{get}(\xi_{ij}, k)$,
1. if $X_k \notin D \cup \text{sufset}(\xi_{ij}, k)$, then the $k$-th symbol of $\delta(D, X_j, \xi_{ij})$ is $X_k^\uparrow$,
2. otherwise, the $k$-th symbol of $\delta(D, X_j, \xi_{ij})$ is $X_k$, and
we also define $\text{merge}(D, X_j^\uparrow, \xi_{ij}) = (D/\{X_j\}) \cup \text{sufset}(\xi_{ij}, 0)$ and $\text{merge}(D, X_j, \xi_{ij}) = D \cup \text{sufset}(\xi_{ij}, 0)$;
We have the following result:
**Lemma 1.** $\mathcal{T}(X_0) \subseteq \mathcal{T}(\mathcal{M})$.
We have the following theorem.
**Theorem 2.** For every name $X$ defined in a guarded recursive specification in Greibach normal form there exists a PDA $\mathcal{M}$, such that $\mathcal{T}(X) \subseteq \mathcal{T}(\mathcal{M})$.
Note that the converse of this theorem does not hold in general, a counterexample was established by F. Moller in [22], and we conjecture that it is also valid modulo $\equiv_b$ in the revised semantics.
6 Executability in the Context of Termination
The notion of reactive Turing machine (RTM) [5] was introduced as an extension of Turing machines to define which behaviour is executable by a computing system. The definition of RTM is parameterised with the set $\mathcal{A}_r$, which we now assume to be finite, and with another finite set $\mathcal{D}$ of data symbols. We extend $\mathcal{D}$ with a special symbol $\square \notin \mathcal{D}$ to denote a blank tape cell, and denote the set $\mathcal{D} \cup \{\square\}$ of tape symbols by $\mathcal{D}_\square$.
**Definition 8** (Reactive Turing Machine). A reactive Turing machine (RTM) is a quadruple $(\mathcal{S}, \rightarrow, \uparrow, \downarrow)$, where
1. $\mathcal{S}$ is a finite set of states,
2. $\rightarrow \subseteq \mathcal{S} \times \mathcal{D}_\square \times \mathcal{A}_r \times \mathcal{D}_\square \times (\mathcal{L}, \mathcal{R}) \times \mathcal{S}$ is a finite collection of $(\mathcal{D}_\square \times \mathcal{A}_r \times \mathcal{D}_\square \times \{\mathcal{L}, \mathcal{R}\})$-labelled transitions (we write $s \xrightarrow{a[d:e]^M} t$ for $(s, d, a, e, M, t) \in \rightarrow$),
3. $\uparrow \in \mathcal{S}$ is a distinguished initial state, and
4. $\downarrow \subseteq \mathcal{S}$ is a finite set of final states.
Intuitively, the meaning of a transition $s \xrightarrow{a[d:e]^M} t$ is that whenever the RTM is in state $s$, and $d$ is the symbol currently read by the tape head, then it may execute the action $a$, write symbol $e$ on the tape (replacing $d$), move the read/write head one position to the left or the right on the tape (depending on whether $M = \mathcal{L}$ or $M = \mathcal{R}$), and then end up in state $t$.
To formalise the intuitive understanding of the operational behaviour of RTMs, we associate with every RTM $\mathcal{M}$ an $\mathcal{A}_r$-labelled transition system $\mathcal{T}(\mathcal{M})$. The states of $\mathcal{T}(\mathcal{M})$ are the configurations of $\mathcal{M}$, which consist of a state from $\mathcal{S}$, its tape contents, and the position of the read/write head. We denote by $\mathcal{D}_\square = \{\check{d} \mid d \in \mathcal{D}_\square\}$ the set of marked symbols; a tape instance is a sequence $\delta \in (\mathcal{D}_\square \cup \mathcal{D}_\square)^*$ such that $\delta$ contains exactly one element of the set of marked symbols $\mathcal{D}_\square$, indicating the position of the read/write head. We adopt a convention to concisely denote an update of the placement of the tape head marker. Let $\delta$ be an element of $\mathcal{D}_\square$. Then by $\delta^L$ we denote the element of $(\mathcal{D}_\square \cup \mathcal{D}_\square)^*$ obtained by placing the tape head marker on the right-most symbol of $\delta$ (if that exists; otherwise $\delta^L$ denotes $\square$). Similarly, $\delta^R$ is obtained by placing the tape head marker on the left-most symbol of $\delta$ (if that exists; otherwise $\delta^R$ denotes $\square$).
**Definition 9.** Let $\mathcal{M} = (\mathcal{S}, \rightarrow, \uparrow, \downarrow)$ be an RTM. The transition system $\mathcal{T}(\mathcal{M})$ associated with $\mathcal{M}$ is defined as follows:
1. its set of states is the set $\mathcal{C}_\mathcal{M} = \{(s, \delta) \mid s \in \mathcal{S}, \delta \text{ a tape instance}\}$ of all configurations of $\mathcal{M}$;
2. its transition relation $\rightarrow \subseteq \mathcal{C}_\mathcal{M} \times \mathcal{A}_r \times \mathcal{C}_\mathcal{M}$ is the relation satisfying, for all $a \in \mathcal{A}_r, d, e \in \mathcal{D}_\square$ and $\delta_L, \delta_R \in \mathcal{D}_\square^*$: $(s, \delta_L \check{d} \delta_R) \xrightarrow{a} (t, \delta_L^e e \delta_R)$ iff $s \xrightarrow{a[d:e]^L} t$, and $(s, \delta_L \check{d} \delta_R) \xrightarrow{a} (t, \delta_L e \check{e} \delta_R)$ iff $s \xrightarrow{a[d:e]^R} t$;
3. its initial state is the configuration $((\uparrow), \square)$; and
4. its set of final states is the set $\{(s, \delta) \mid \delta \text{ a tape instance, } s \downarrow\}$.
Turing introduced his machines to define the notion of *effectively computable function* in [24]. By analogy, the notion of RTM can be used to define a notion of *effectively executable behaviour*.
**Definition 10** (Executability). A transition system is executable if it is the transition system associated with some RTM.
Executability can be used to characterise the absolute expressiveness of process calculi in two ways. On the one hand, if every transition system associated with a process expression specified in a process calculus is executable modulo some behavioural equivalence, then we say that the process calculus is executable modulo that behavioural equivalence. On the other hand, if every executable transition system is behaviourally equivalent to some transition system associated with a process expression specified in a process calculus modulo some behavioural equivalence, then we say that the process calculus is reactively Turing powerful modulo that behavioural equivalence.
Our aim in this section is to prove that all executable processes can be specified, up to divergence-preserving branching bisimilarity in TCP$^\#$. TCP$^\#$ is obtained from TCP by removing recursive definitions and adding the iteration and nesting operators.
To see that TCP$^\#$ is executable modulo branching bisimilarity, it suffices to observe that their transition systems are effective. Thus we can apply the result from [5] and conclude that they are executable modulo $\sqsubseteq_b$.
Now we show that TCP$^\#$ is reactively Turing powerful modulo $\sqsubseteq_b^\Lambda$.
We first introduce the notion of bisimulation up to $\sqsubseteq_b$, which is a useful tool to establish the proofs in this section. Note that we adopt a non-symmetric bisimulation up to relation.
**Definition 11.** Let $T = (S, \rightarrow, \uparrow, \downarrow)$ a transition system. A relation $R \subseteq S \times S$ is a bisimulation up to $\sqsubseteq_b$ if, whenever $s_1 R s_2$, then for all $a \in \mathcal{A}_r$:
1. if $s_1 \rightarrow s''_1 \xrightarrow{a} s'_1$, with $s_1 \sqsubseteq_b s''_1$, and $a \neq \tau \lor s''_1 R s'_1$, then there exists $s'_2$ such that $s_2 \xrightarrow{a} s''_2$, $s''_1 \sqsubseteq_b R s_2$ and $s'_1 \sqsubseteq_b R s'_2$;
2. if $s_2 \xrightarrow{a} s'_2$, then there exist $s'_1, s''_1$ such that $s_1 \rightarrow s''_1 \xrightarrow{a} s'_1$, $s''_1 \sqsubseteq_b s_1$ and $s'_1 \sqsubseteq_b R s'_2$;
3. if $s_1 \downarrow$, then there exists $s'_2$ such that $s_2 \rightarrow s''_2, s'_2 \downarrow$ and $s_1 \sqsubseteq_b R s'_2$ and
4. if $s_2 \downarrow$, then there exists $s'_1$ such that $s_1 \rightarrow s'_1, s'_1 \downarrow$ and $s'_1 \sqsubseteq_b R s_2$.
**Lemma 2.** If $R$ is a bisimulation up to $\sqsubseteq_b$, then $R \subseteq \sqsubseteq_b$.
Next we show that TCP$^\#$ is reactively Turing powerful by writing a specification of the transition system associated with a reactive Turing machine in TCP$^\#$ modulo $\sqsubseteq_b^\Lambda$. The proof proceeds in five steps:
1. We first specify an always terminating half counter.
2. Then we show that every regular process can be specified in TCP$^\#$.
3. Next we use two half counters and a regular process to encode a terminating stack.
4. With two stacks and a regular process we can specify a tape.
5. Finally we use a tape and a regular control process to specify an RTM.
We first recall the infinite specification in TSP$^\#$ of a terminating half counter from Section 3. We provide a specification of a counter in TCP$^\#$ as follows:
$$HC = ((a + 1)^2(b + 1); (c + 1))^*$$
We have the following lemma:
**Lemma 3.** $C_0 \sqsubseteq_b^\Lambda HC$.
Next we show that every regular process can be specified in TCP$^\#$ modulo $\sqsubseteq_b^\Lambda$. A regular process is given by $P_i = \sum_{j=1}^n a_{ij}P_j + \beta_i (i = 1, \ldots, n)$ where $a_{ij}$ and $\beta_i$ are finite sums of actions from $\mathcal{A}_r$ and possibly with a 1-summand. We have the following lemma.
Lemma 4. Every regular process can be specified in TCP$^\#$ modulo $\equiv_b^A$.
Now we show that a stack can be specified by a regular process and two half counters. We first give an infinite specification in TSP$^*$ of a stack as follows:
$$S_{\epsilon} = \Sigma_{d \in D_\epsilon \text{push}} ? d.S_d + \text{pop}! \square.S_{\epsilon} + 1$$
$$S_{\delta_0} = \text{pop}! d.S_\delta + \Sigma_{e \in D_\delta \text{push}} ? \epsilon.S_{\delta e\delta} + 1.$$
Note that $D_\delta$ is a finite set of symbols. We suppose that $D_\Delta$ contains $N$ symbols (including $\square$). We use $\epsilon$ to denote the empty sequence. We inductively define an encoding from a sequence of symbols to a natural number $[\cdot] : D_\Delta^* \rightarrow \mathbb{N}$ as follows:
$$[\epsilon] = 0 \quad [d_k] = k \quad (k = 1, 2, \ldots, N) \quad [d_k \sigma] = k + N \times [\sigma].$$
Hence we are able to encode the contents of a stack in terms of natural numbers recorded by half counters. We define a stack in TCP$^\#$ as follows:
$$S = [X_0 || P_1 || P_2]_{[a_1, a_2, b_1, b_2, c_1, c_2]}$$
$$P_j = ((a_j ? a + 1)^j (b_j ? b + 1); (c_j ? c + 1); (b_j + 1); (X_j) + \text{pop}! \square)^*$$
$$X_0 = (\Sigma_{j=1}^N ((\text{push} ? d_j + 1); (a_j ? a + 1)^j (b_j + 1); (X_j) + \text{pop}! \square)^*$$
$$X_k = \Sigma_{j=1}^N ((\text{push} ? d_j + 1); (\text{Push}_j) + \text{pop}! d_k + 1); \text{Pop}_k \quad (k = 1, 2, \ldots, N)$$
$$\text{Push}_k = \text{Shift1to2} (a_i ? a + 1)^k; \text{NShift2to1} (X_k) \quad (k = 1, 2, \ldots, N)$$
$$\text{Pop}_k = (a_i ? a + 1)^k; 1 / \text{NShift1to2} (X_0)$$
$$\text{Shift1to2} = ((a_1 ? a + 1); (a_2 ? a + 1))^*; (c_1 ? c + 1); (b_2 ? b + 1)$$
$$\text{NShift2to1} = ((a_2 ? a + 1); (a_1 ? a + 1)^N)^*; (c_2 ? c + 1); (b_1 ? b + 1)$$
$$1 / \text{NShift1to2} = ((a_1 ? a + 1)^N; (a_2 ? a + 1)^*; (c_1 ? c + 1); (b_2 ? b + 1)$$
$$\text{Test}_0 = (a_2 ? a + 1); (a_1 ? a + 1); \text{Test}_1 + (c_2 ? c + 1); X_0$$
$$\text{Test}_1 = (a_2 ? a + 1); (a_1 ? a + 1); \text{Test}_2 + (c_2 ? c + 1); X_1$$
$$\text{Test}_2 = (a_2 ? a + 1); (a_1 ? a + 1); \text{Test}_3 + (c_2 ? c + 1); X_2$$
$$\ldots$$
$$\text{Test}_N = (a_2 ? a + 1); (a_1 ? a + 1); \text{Test}_1 + (c_2 ? c + 1); X_N.$$
We have the following result.
Lemma 5. $S_{\epsilon} \equiv_b^A S.$
Next we proceed to define the tape by means of two stacks. We consider the following infinite specification in TSP$^*$ of a tape:
$$T_{d_1 \delta_1 \delta_2} = r ! d.T_{d_1 \delta_1 \delta_2} + \Sigma_{e \in D_\epsilon \text{push}} ? e.T_{\delta_1 \delta_2 + \epsilon}.L ? m.T_{d_1 \delta_1 \delta_2} + R ? m.T_{d_1 \delta_1 \delta_2} + 1.$$
We define the tape process in TCP$^\#$ as follows:
$$T = [T_\epsilon || S_1 || S_2]_{[\text{push}_1 \text{pop}_1, \text{push}_2 \text{pop}_2]}$$
$$T_d = r ! d.T_d + \Sigma_{e \in D_\epsilon \text{push}} ? e.T_e + L ? m.\text{Left}_d + R ? m.\text{Right}_d + 1 \quad (d \in D_\Delta)$$
$$\text{Left}_d = \Sigma_{e \in D_\epsilon \epsilon \text{push}} ? (e + 1); (\text{push}_2 ! d + 1); T_e$$
$$\text{Right}_d = \Sigma_{e \in D_\epsilon \epsilon \text{push}} ? (e + 1); (\text{push}_1 ! d + 1); T_e,$$
where $S_1$ and $S_2$ are two stacks obtained by renaming $\text{push}$ and $\text{pop}$ in $S$ to $\text{push}_1 \text{pop}_1, \text{push}_2 \text{pop}_2$, respectively. We establish the following result.
Lemma 6. $T_0 \xrightarrow[\Delta]{\alpha} T$.
Finally, we construct a finite control process for an RTM $M = (S_M, \rightarrow_M, \uparrow_M, \downarrow_M)$ as follows:
$$C_{s,d} = \sum_{(s,a,d,e,M,f) \in \rightarrow_M} (a.w^1e.M\downarrow_m\sum_{f \in D_\Delta} r^f(C_{i.f})[+1]_{\downarrow_M} (s \in S_M, d \in D_\Delta)).$$
We prove the following lemma.
Lemma 7. $T(M) \xrightarrow[\Delta]{\alpha} \{C_{\uparrow_M, \Delta} \parallel T\}_{\{w,l,R\}}$.
We have the following theorem.
Theorem 3. TCP$^\#$ is reactively Turing powerful modulo $\xrightarrow[\Delta]{\alpha}$.
7 Conclusion
The results established in this paper show that a revision of the operational semantics of sequential composition leads to a smoother integration of process theory and the classical theory of automata and formal languages. In particular, the correspondence between context-free processes and pushdown processes can be established up to strong bisimilarity, which does not hold with the more standard operational semantics of sequential composition in a setting with intermediate termination [2]. Furthermore, the revised operational semantics of sequential composition also seems to work better in combination with the recursive operations of [12]. We conjecture that it is not possible to specify an always terminating counter or stack in a process calculus with iteration and nesting if the original operational semantics of sequential composition is used.
There are also some disadvantages to the revised operational semantics.
First of all, the negative premise in the operational semantics gives well-known formal complications in determining whether some process does, or does not, admit a transition. For instance, consider the following unguarded recursive specification:
$$X = X; Y + 1 \quad Y = a.1.$$
It is not a priori clear whether an $a$-transition is possible from $X$: if $X$ only has the option to terminate, then $X; Y$ can do the $a$-transition from $Y$, but then also $X$ can do the $a$-transition, contradicting the assumption that $X$ only has the option to terminate.
Second, as we have illustrated in Section 4, rooted branching bisimilarity is not compatible with respect to the new sequential composition operation. The divergence-preserving condition is required for the congruence property.
Finally, note that $(a + 1); b$ is not strongly bisimilar to $(a;b) + (1;b)$, and hence $;$ does not distribute from the right over $+$. It is to be expected that there is no finite sound and ground-complete set of equational axioms for the process calculus TCP$^\#$ with respect to strong bisimilarity. We leave for future work to further investigate the equational theory of sequential composition.
Another interesting future work is to establish the reactive Turing powerfulness on other process calculi with non-regular iterators based on the revised semantics of the sequential composition operator. For instance, we could consider the pushdown operator “$\&$” and the back-and-forth operator “$\leftrightarrow$” introduced by Bergstra and Ponse in [12]. They are given by the following equations:
$$P_1 \& P_2 = P_1;(P_1 \& P_2);(P_1 \& P_2) + P_2 \quad P_1 \leftrightarrow P_2 = P_1;(P_1 \leftrightarrow P_2);P_2 + P_2.$$
By analogy to the nesting operator, we shall also give them some proper rules of operational semantics, and then use the calculus obtained by the revised semantics to define other versions of terminating counters. In a way, we should be able to establish their reactive Turing powerfulness.
References
|
{"Source-Url": "https://pure.tue.nl/ws/portalfiles/portal/91517594/Proceedings.pdf", "len_cl100k_base": 14118, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 74423, "total-output-tokens": 17580, "length": "2e13", "weborganizer": {"__label__adult": 0.0005626678466796875, "__label__art_design": 0.000835418701171875, "__label__crime_law": 0.0005578994750976562, "__label__education_jobs": 0.002124786376953125, "__label__entertainment": 0.00026917457580566406, "__label__fashion_beauty": 0.0003178119659423828, "__label__finance_business": 0.0005230903625488281, "__label__food_dining": 0.0008335113525390625, "__label__games": 0.0016765594482421875, "__label__hardware": 0.0014371871948242188, "__label__health": 0.0016374588012695312, "__label__history": 0.0006966590881347656, "__label__home_hobbies": 0.0002288818359375, "__label__industrial": 0.000957965850830078, "__label__literature": 0.002002716064453125, "__label__politics": 0.000682830810546875, "__label__religion": 0.0009984970092773438, "__label__science_tech": 0.44921875, "__label__social_life": 0.00021016597747802737, "__label__software": 0.007244110107421875, "__label__software_dev": 0.52490234375, "__label__sports_fitness": 0.0004172325134277344, "__label__transportation": 0.0012826919555664062, "__label__travel": 0.00027680397033691406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 55810, 0.02795]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 55810, 0.50906]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 55810, 0.78656]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 3687, false], [3687, 8277, null], [8277, 11498, null], [11498, 13243, null], [13243, 17947, null], [17947, 20920, null], [20920, 23250, null], [23250, 26520, null], [26520, 29062, null], [29062, 32810, null], [32810, 35498, null], [35498, 39871, null], [39871, 43550, null], [43550, 46894, null], [46894, 50438, null], [50438, 54113, null], [54113, 55810, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 3687, true], [3687, 8277, null], [8277, 11498, null], [11498, 13243, null], [13243, 17947, null], [17947, 20920, null], [20920, 23250, null], [23250, 26520, null], [26520, 29062, null], [29062, 32810, null], [32810, 35498, null], [35498, 39871, null], [39871, 43550, null], [43550, 46894, null], [46894, 50438, null], [50438, 54113, null], [54113, 55810, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 55810, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 55810, null]], "pdf_page_numbers": [[0, 0, 1], [0, 3687, 2], [3687, 8277, 3], [8277, 11498, 4], [11498, 13243, 5], [13243, 17947, 6], [17947, 20920, 7], [20920, 23250, 8], [23250, 26520, 9], [26520, 29062, 10], [29062, 32810, 11], [32810, 35498, 12], [35498, 39871, 13], [39871, 43550, 14], [43550, 46894, 15], [46894, 50438, 16], [50438, 54113, 17], [54113, 55810, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 55810, 0.00935]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
c75cd9aeb27ab5814cccf144a79996a53800c010
|
Red Hat Enterprise Linux 8
Upgrading from RHEL 7 to RHEL 8
Instructions for an in-place upgrade from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8
Red Hat Enterprise Linux 8 Upgrading from RHEL 7 to RHEL 8
Instructions for an in-place upgrade from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8
Abstract
This document provides instructions on how to perform an in-place upgrade from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8 using the Leapp utility. During the in-place upgrade, the existing RHEL 7 operating system is replaced by a RHEL 8 version.
## Table of Contents
- MAKING OPEN SOURCE MORE INCLUSIVE .................................................. 3
- PROVIDING FEEDBACK ON RED HAT DOCUMENTATION ................................. 4
- CHAPTER 1. PLANNING AN UPGRADE ...................................................... 5
- CHAPTER 2. PREPARING A RHEL 7 SYSTEM FOR THE UPGRADE ...................... 7
- CHAPTER 3. REVIEWING THE PRE-UPGRADE REPORT .................................. 11
- 3.1. ASSESSING UPGRADABILITY FROM THE COMMAND LINE ...................... 11
- 3.2. ASSESSING UPGRADABILITY AND APPLYING AUTOMATED REMEDIATIONS THROUGH THE WEB CONSOLE ................................................................. 12
- CHAPTER 4. PERFORMING THE UPGRADE FROM RHEL 7 TO RHEL 8 ................. 17
- CHAPTER 5. VERIFYING THE POST-UPGRADE STATE OF THE RHEL 8 SYSTEM ........ 19
- CHAPTER 6. PERFORMING POST-UPGRADE TASKS ..................................... 20
- CHAPTER 7. APPLYING SECURITY POLICIES ............................................. 22
- 7.1. CHANGING SELINUX MODE TO ENFORCING ..................................... 22
- 7.2. SETTING SYSTEM-WIDE CRYPTOGRAPHIC POLICIES ............................ 23
- 7.3. REMEDIATING THE SYSTEM TO A SECURITY BASELINE ....................... 23
- CHAPTER 8. TROUBLESHOOTING .......................................................... 25
- 8.1. TROUBLESHOOTING RESOURCES ................................................. 25
- 8.2. TROUBLESHOOTING TIPS .......................................................... 25
- 8.3. KNOWN ISSUES ........................................................................... 27
- 8.4. OBTAINING SUPPORT ............................................................... 29
- CHAPTER 9. RELATED INFORMATION ..................................................... 30
- APPENDIX A. RHEL 7 REPOSITORIES ...................................................... 31
MAKING OPEN SOURCE MORE INCLUSIVE
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
PROVIDING FEEDBACK ON RED HAT DOCUMENTATION
We appreciate your input on our documentation. Please let us know how we could make it better. To do so:
- For simple comments on specific passages:
1. Make sure you are viewing the documentation in the *Multi-page HTML* format. In addition, ensure you see the **Feedback** button in the upper right corner of the document.
2. Use your mouse cursor to highlight the part of text that you want to comment on.
3. Click the **Add Feedback** pop-up that appears below the highlighted text.
4. Follow the displayed instructions.
- For submitting more complex feedback, create a Bugzilla ticket:
1. Go to the [Bugzilla](https://bugzilla.redhat.com/) website.
2. As the Component, use **Documentation**.
3. Fill in the **Description** field with your suggestion for improvement. Include a link to the relevant part(s) of documentation.
4. Click **Submit Bug**.
CHAPTER 1. PLANNING AN UPGRADE
An in-place upgrade is the recommended and supported way to migrate your system to the next major version of RHEL.
You should consider the following before upgrading to RHEL 8:
- **Operating system** - The operating system is upgraded by the Leapp utility under the following conditions:
- The Server variant installed of the latest available RHEL 7 version which currently is:
- RHEL 7.9 on the 64-bit Intel, IBM POWER 8 (little endian), and IBM Z architectures
- RHEL 7.6 on architectures that require kernel version 4.14: 64-bit ARM, IBM POWER 9 (little endian), or IBM Z (Structure A)
- See Supported in-place upgrade paths for Red Hat Enterprise Linux for more information.
- Minimum hardware requirements for RHEL 8 met
- Access to up-to-date RHEL 7.9 and RHEL 8.2 content provided; see Preparing a RHEL 7 system for the upgrade, step 1 for details.
- **Applications** - You can migrate applications installed on your system using Leapp. However, in certain cases, you have to create custom actors, which specify actions to be performed by Leapp during the upgrade, for example, reconfiguring an application or installing a specific hardware driver. For more information, see Handling the migration of your custom and third-party applications. Note that custom actors are unsupported by Red Hat.
- **Security** - You should evaluate this aspect before the upgrade and take additional steps when the upgrade process completes. Consider especially the following:
- Before the upgrade, define the security standard your system needs to comply with and understand the security changes in RHEL 8.
- During the upgrade process, the Leapp utility sets SELinux mode to permissive.
- In-place upgrades of systems in FIPS mode are not supported.
- After the upgrade is finished, re-evaluate and re-apply your security policies. For information about applying security policies that have been disabled during the upgrade or newly introduced in RHEL 8, see Applying security policies.
- **Storage and file systems** - You should always back up your system prior to upgrading. For example, you can use the Relax-and-Recover (ReaR) utility, LVM snapshots, RAID splitting, or a virtual machine snapshot.
- **Downtime** - The upgrade process can take from several minutes to several hours.
- **Satellite** - If you manage your hosts through Satellite, you can upgrade multiple hosts simultaneously from RHEL 7 to RHEL 8 using the Satellite web UI. For more information, see Upgrading Hosts from RHEL 7 to RHEL 8.
- **Public Clouds** - The in-place upgrade is supported for on-demand instances on Amazon Web Services (AWS) and Microsoft Azure, using Red Hat Update Infrastructure (RHUI).
- **Known limitations** - Notable known limitations of Leapp currently include:
- Encryption of the whole disk or a partition, or file-system encryption currently cannot be used on a system targeted for an in-place upgrade.
- No network-based multipath and no kind of network storage mount can be used as a system partition (for example, iSCSI, or NFS).
- The in-place upgrade is currently unsupported for on-demand instances on the remaining Public Clouds (Huawei Cloud, Alibaba Cloud, Google Cloud) that use Red Hat Update Infrastructure but not Red Hat Subscription Manager for a RHEL subscription.
See also [Known Issues](#).
You can use Red Hat Insights to determine which of the systems you have registered to Insights is on a supported upgrade path to RHEL 8. To do so, navigate to the respective Advisor recommendation in Insights, enable the recommendation under the *Actions* drop-down menu, and inspect the list under the *Affected systems* heading. Note that the Advisor recommendation considers only the RHEL 7 minor version and does not perform a pre-upgrade assessment of the system.
CHAPTER 2. PREPARING A RHEL 7 SYSTEM FOR THE UPGRADE
This procedure describes the steps that are necessary before performing an in-place upgrade to RHEL 8 using the Leapp utility.
If you do not plan to use Red Hat Subscription Manager during the upgrade process, follow instructions in Upgrading to RHEL 8 without Red Hat Subscription Manager.
Prerequisites
- The system meets conditions listed in Planning an upgrade.
Procedure
1. Ensure your system has been successfully registered to the Red Hat Content Delivery Network (CDN) or Red Hat Satellite 6.5 or later using the Red Hat Subscription Manager.
**IMPORTANT**
If your system is registered to Satellite Server, ensure that Satellite meets the following conditions:
a. Satellite has a subscription manifest with RHEL 8 repositories imported. For more information, see the Managing Subscriptions chapter in the Content Management Guide for the particular version of Red Hat Satellite, for example, for version 6.8.
b. The following repositories are enabled and synchronized with the latest updates, and published on Satellite:
- Red Hat Enterprise Linux 7 Server RPMs x86_64 7 or Red Hat Enterprise Linux 7 Server RPMs x86_64 7.9
- Red Hat Enterprise Linux 7 Server - Extras (RPMs)
- Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs x86_64 8.2
- Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs x86_64 8.2
For more information, see the Importing Red Hat Content chapter in the Content Management Guide for the particular version of Red Hat Satellite, for example, for version 6.8.
c. The content host belongs to one of the following:
- A Content View containing the above RHEL 7 and RHEL 8 repositories.
- The Default Organization View Content View and the Library life cycle environment.
For more information, see the Managing Content Views chapter in the Content Management Guide for the particular version of Red Hat Satellite, for example, for version 6.8.
2. Verify that you have the Red Hat Enterprise Linux Server subscription attached:
You should see `Server` in the product name and `Subscribed` as the status.
3. Ensure you have appropriate repositories enabled. The following commands list repositories for the 64-bit Intel architecture; for other architectures, see RHEL 7 repositories.
a. Enable the Base repository:
```
# subscription-manager repos --enable rhel-7-server-rpms
```
b. Enable the Extras repository where `Leapp` and its dependencies are available:
```
# subscription-manager repos --enable rhel-7-server-extras-rpms
```
**NOTE**
You can also have the Optional or Supplementary repositories enabled; see their list in RHEL 7 repositories. In such a case, `Leapp` enables the RHEL 8 CodeReady Linux Builder or the RHEL 8 Supplementary repositories, respectively.
4. Set the Red Hat Subscription Manager to consume the latest RHEL 7 content:
```
# subscription-manager release --unset
```
5. Optional: If you want to use custom repositories, configure them per instructions in Configuring custom repositories.
6. If you use the `yum-plugin-versionlock` plug-in to lock packages to a specific version, clear the lock by running:
```
# yum versionlock clear
```
See How to restrict yum to install or upgrade a package to a fixed specific package version? for more information.
7. Ensure you have the system locale set to `en_US.UTF-8`:
```
$ cat /etc/locale.conf
```
If the locale is different, follow instructions in How to change system locale on RHEL7?.
8. If you are upgrading using Red Hat Update Infrastructure (RHUI) on a public cloud, complete the following tasks to ensure your system is ready for upgrade.
a. For AWS, enable the Red Hat Update Infrastructure 3 Client Configuration Server 7 repository and install required RHUI packages.
i. For non-ARM architectures:
```
# yum-config-manager --enable rhui-client-config-server-7
# yum -y install rh-amazon-rhui-client leapp-rhui-aws
```
ii. For the ARM architecture:
```
# yum-config-manager --enable rhui-client-config-server-7-arm
# yum -y install rh-amazon-rhui-client-arm leapp-rhui-aws
```
b. For Microsoft Azure, enable the Microsoft Azure RPMs for Red Hat Enterprise Linux 7 repository and install required RHUI packages.
```
# yum-config-manager --enable rhui-microsoft-azure-rhel7
# yum -y install rhui-azure-rhel7 leapp-rhui-azure
```
**NOTE**
If you locked the Azure virtual machine (VM) to a minor release, remove the version lock. For more information, see [Switch a RHEL 7.x VM back to non-EUS](#).
9. If you manage containers in Docker, recreate those containers with the appropriate container images using Podman and then attach any in-use volumes. For more information, see [How do I migrate my Docker containers to Podman prior to moving from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8?](#)
10. Update all packages to the latest RHEL 7 version:
```
# yum update
```
11. Reboot the system:
```
# reboot
```
12. Install the **Leapp** utility:
```
# yum install leapp leapp-repository
```
Note that currently you need version 0.11.1 or later of the **leapp** package and version 0.12.0 or later of the **leapp-repository** package.
13. Download additional required data files (RPM package changes and RPM repository mapping) attached to the Knowledgebase article [Data required by the Leapp utility for an in-place upgrade from RHEL 7 to RHEL 8](#) and place them in the `/etc/leapp/files/` directory. This is necessary for a successful upgrade. Note that currently you need data files from the **leapp-data12.tar.gz** archive or later.
NOTE
If you are upgrading on a public cloud using RHUI and do not have a Red Hat subscription or Red Hat Customer Portal account, create a no-cost RHEL developer subscription so that you can access the Knowledgebase article and download required data packages. For more information, see How do I get a no-cost Red Hat Enterprise Linux Developer Subscription or renew it?
14. Ensure you have any configuration management (such as Salt, Chef, Puppet, Ansible) disabled or adequately reconfigured to not attempt to restore the original RHEL 7 system.
15. Ensure your system does not use more than one Network Interface Card (NIC) with a name based on the prefix used by the kernel (eth). For instructions on how to migrate to another naming scheme before an in-place upgrade to RHEL 8, see How to perform an in-place upgrade to RHEL 8 when using kernel NIC names on RHEL 7.
16. Ensure you have a full system backup or a virtual machine snapshot. You should be able to get your system to the pre-upgrade state if you follow standard disaster recovery procedures within your environment. For example, you can use the Relax-and-Recover (ReaR) utility. For more information, see the ReaR documentation and What is Relax and Recover (ReaR) and how can I use it for disaster recovery?. Alternatively, you can use LVM snapshots, or RAID splitting. In case of upgrading a virtual machine, you can create a snapshot of the whole VM.
CHAPTER 3. REVIEWING THE PRE-UPGRADE REPORT
To assess upgradability of your system, start the pre-upgrade process by the `leapp preupgrade` command. During this phase, the Leapp utility collects data about the system, assesses upgradability, and generates a pre-upgrade report.
The pre-upgrade report is available both in the `/var/log/leapp/leapp-report.txt` file and in the web console. The report summarizes potential problems and proposes recommended solutions. The report also helps you decide whether it is possible or advisable to proceed with the upgrade.
In certain configurations, Leapp generates true/false questions to determine how to proceed. All questions are stored in `/var/log/leapp/answerfile` and in the pre-upgrade report in the Missing required answers in the answer file message. Leapp inhibits the upgrade if you do not provide answers to all the questions.
You have two options when assessing upgradability in the pre-upgrade phase:
a. Review the pre-upgrade report in the generated `leapp-report.txt` file and manually resolve reported problems using the command-line interface.
b. Use the web console to review the report, apply automated remediations where available, and fix remaining problems using the suggested remediation hints.
IMPORTANT
During the pre-upgrade phase, Leapp neither simulates the whole in-place upgrade process nor downloads all RPM packages.
Reviewing a pre-upgrade report is useful also if you decide or need to redeploy a RHEL 8 system without the in-place upgrade process.
3.1. ASSESSING UPGRADABILITY FROM THE COMMAND LINE
Identify potential upgrade problems during the pre-upgrade phase using the command-line interface.
Prerequisites
- The steps listed in Preparing a RHEL 7 system for the upgrade have been completed.
Procedure
1. On your RHEL 7 system, perform the pre-upgrade phase:
```bash
# leapp preupgrade
```
NOTE
If you are going to use custom repositories from the `/etc/yum.repos.d/` directory for the upgrade, enable the selected repositories as follows:
```
# leapp preupgrade --enablerepo repository_id1 --enablerepo repository_id2 ...
```
If you are going to upgrade without RHSM or using RHUI, add the `--no-rhsm` option.
2. Provide answers to each question required by Leapp by either of the following methods:
a. Execute the `leapp answer` command, specifying the question you are responding to and your confirmed answer.
```
# leapp answer --section question_section.confirm=answer
```
For example, to confirm a True response to the question **Disable pam_pkcs11 module in PAM configuration?**, execute the following command:
```
# leapp answer --section remove_pam_krb5_module_check.confirm=True
```
b. Manually edit the `/var/log/leapp/answerfile` file, uncomment the `confirm` line of the file by deleting the `#` symbol, and confirm your answer as True or False; see Leapp answerfile.
1. Examine the report in the `/var/log/leapp/leapp-report.txt` file, and manually resolve all the reported problems before proceeding with the in-place upgrade.
3.2. ASSESSING UPGRADABILITY AND APPLYING AUTOMATED REMEDIATIONS THROUGH THE WEB CONSOLE
Identify potential problems in the pre-upgrade phase and how to apply automated remediations using the web console.
Prerequisites
- The steps listed in Preparing a RHEL 7 system for the upgrade have been completed.
Procedure
1. Install the `cockpit-leapp` plug-in:
```
# yum install cockpit-leapp
```
2. Navigate to the web console in your browser and log in as root or as a user configured in the `/etc/sudoers` file. See Managing systems using the RHEL 7 web console for more information about the web console.
3. On your RHEL 7 system, perform the pre-upgrade phase either from the command-line interface or from the web console terminal:
```
# leapp preupgrade
```
NOTE
If you are going to use custom repositories from the `/etc/yum.repos.d/` directory for the upgrade, enable the selected repositories as follows:
```
# leapp preupgrade --enablerepo repository_id1 --enablerepo repository_id2
```
If you are going to upgrade without RHSM or using RHUI, add the `--no-rhsm` option.
4. In the web console, select **In-place Upgrade Report** from the left menu.

The report table provides an overview of the problems found, their risk assessment, and remediations (if available).
- **Risk factor:**
- High - very likely to result in a deteriorated system state
- Medium - can impact both the system and applications
- Low - should not impact the system but can have an impact on applications
- **Inhibitor** - will inhibit (hard stop) the upgrade process, otherwise the system could become unbootable, inaccessible, or dysfunctional
- **Remediation** - an actionable solution to a reported problem:
- Remediation command - can be executed directly through the web console
5. Examine the content of the report. You can sort the table by clicking a header. To open a detail pane, click a selected row.
**Figure 3.2. Detail pane**
<table>
<thead>
<tr>
<th>Title</th>
</tr>
</thead>
<tbody>
<tr>
<td>Packages not signed by Red Hat found in the system</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>26.08.2019 15:23:57</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Risk factor</th>
</tr>
</thead>
<tbody>
<tr>
<td>High</td>
</tr>
</tbody>
</table>
**Summary**
The following packages have not been signed by Red Hat and may be removed in the upgrade process: - leapp - leapp-deps - leapp-repository - leapp-repository-deps - leapp-repository-sos-plugin - python2-leapp - snactor
**Links**
- Information about package signatures
**Remediations**
![Remediation button]
**Related resources**
- leapp
- leapp-deps
- leapp-repository
The detail pane displays the following additional information:
- Summary of the problem and links to Knowledgebase articles describing the problem in more detail
- Remediations - you can run or schedule an automated remediation (if available), and see its results when applied
- Affected system resources: packages, repositories, files (configuration, data), disks, volumes
6. Optionally filter the results. Click the Filters button in the top left corner above the report and apply a filter based on your preferences. Filter categories are applied in conjunction with one another.
**Figure 3.3. Filters**

7. Select issues for which you want to apply an automated remediation. You have two options:
a. Choose individual items by clicking the Add to Remediation Plan button in the detail pane. Alternatively, you can execute individual remediations directly by clicking Run Remediation in the detail pane.
b. Select all items for which a remediation is available by clicking the Add all remediations to plan button in the top right corner above the report.
8. Review and answer questions required by Leapp in the web console. Each unanswered question appears as a Missing required answers in the answer file title in the Upgrade Report. Select a title to answer the question:
a. To confirm the default True answer, select Add to Remediation Plan to execute the remediation later or Run Remediation to execute the remediation immediately.
b. To select the non-default answer instead, perform either of the following:
i. Execute the leapp answer command, specifying the question you are responding to and your confirmed answer.
```bash
# leapp answer --section question_section.confirm=answer
```
For example, to confirm a False response to the question Disable pam_pkcs11 module in PAM configuration?, execute the following command:
```bash
# leapp answer --section remove_pam_krb5_module_check.confirm=False
```
ii. Manually edit the `/var/log/leapp/answerfile` file, uncomment the `confirm` line of the file by deleting the `#` symbol, and confirm your answer as **True** or **False**; see Leapp answerfile example.

**Figure 3.4. Missing unanswered Leapp question**
9. Open the remediation plan by clicking the **Remediation plan** link in the top right corner above the report. The remediation plan provides a list of all executed or scheduled remediations.
**Figure 3.5. Remediation plan**
- **Remediation Plan**
- Execute Remediation Plan
```
> yum remove leapp leapp-deps leapp-repository leapp-repository-daps leapp-repository-xos-plugin python2-levapp smactor
```
<table>
<thead>
<tr>
<th>Remediation-ID</th>
<th>Status Code</th>
<th>Runtime</th>
</tr>
</thead>
<tbody>
<tr>
<td>30499418:8169f1a59646cd5910642258411e4cabc6e148e4df89195b046416c</td>
<td>(scheduled)</td>
<td>(scheduled)</td>
</tr>
</tbody>
</table>
10. Process all scheduled remediations by clicking **Execute Remediation Plan**. The following information is displayed for each remediation entry:
- A unique ID of the remediation
- Exit status of the command
- Elapsed time of the executed remediation
- Standard output
- Standard error
11. After executing selected remediations, generate the pre-upgrade report again by using the `leapp preupgrade` command, examine the new report, and take additional remediation steps if needed.
CHAPTER 4. PERFORMING THE UPGRADE FROM RHEL 7 TO RHEL 8
Upgrade to RHEL 8 using the **Leapp** utility.
**Prerequisites**
- The steps listed in *Preparing a RHEL 7 system for the upgrade* have been completed, including a full system backup.
- The steps listed in *Reviewing the pre-upgrade report* have been completed and all reported issues resolved.
**Procedure**
1. On your RHEL 7 system, start the upgrade process:
```
# leapp upgrade
```
**NOTE**
If you are going to use custom repositories from the `/etc/yum.repos.d/` directory for the upgrade, enable the selected repositories as follows:
```
# leapp upgrade --enablerepo repository_id1 --enablerepo repository_id2 ...
```
If you are going to upgrade without RHSM or using RHUI, add the `--no-rhsm` option.
At the beginning of the upgrade process, **Leapp** performs the pre-upgrade phase described in *Reviewing the pre-upgrade report*.
If the system is upgradable, **Leapp** downloads necessary data and prepares an RPM transaction for the upgrade.
If your system does not meet the parameters for a reliable upgrade, **Leapp** terminates the upgrade process and provides a record describing the issue and a recommended solution in the `/var/log/leapp/leapp-report.txt` file. For more information, see *Troubleshooting*.
2. Manually reboot the system:
```
# reboot
```
In this phase, the system boots into a RHEL 8-based initial RAM disk image, initramfs. **Leapp** upgrades all packages and automatically reboots to the RHEL 8 system.
Alternatively, you can run the `leapp upgrade` command with the `--reboot` option and skip this manual step.
If a failure occurs, investigate logs as described in *Troubleshooting*.
3. Log in to the RHEL 8 system and verify its state as described in *Verifying the post-upgrade state of the RHEL 8 system*.
4. Complete post-upgrade tasks as described in Performing post-upgrade tasks. Especially, re-evaluate and re-apply your security policies.
CHAPTER 5. VERIFYING THE POST-UPGRADE STATE OF THE RHEL 8 SYSTEM
This procedure lists verification steps recommended to perform after an in-place upgrade to RHEL 8.
Prerequisites
- The system has been upgraded following the steps described in Performing the upgrade from RHEL 7 to RHEL 8 and you have been able to log in to RHEL 8.
Procedure
After the upgrade completes, determine whether the system is in the required state, at least:
- Verify that the current OS version is Red Hat Enterprise Linux 8:
```
# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.2 (Ootpa)
```
- Check the OS kernel version:
```
# uname -r
4.18.0-193.el8.x86_64
```
Note that `.el8` is important.
- If you are using the Red Hat Subscription Manager:
- Verify that the correct product is installed:
```
# subscription-manager list --installed
+-----------------------------------------+
| Installed Product Status |
+-----------------------------------------+
| Product Name: Red Hat Enterprise Linux |
| for x86_64 |
| Product ID: 479 |
| Version: 8.2 |
| Arch: x86_64 |
| Status: Subscribed |
```
- Verify that the release version is set to 8.2 immediately after the upgrade:
```
# subscription-manager release
Release: 8.2
```
- Verify that network services are operational, for example, try to connect to a server using SSH.
- Check the post-upgrade status of your applications. In some cases, you may need to perform migration and configuration changes manually. For example, to migrate your databases, follow instructions in RHEL 8 Database servers documentation.
CHAPTER 6. PERFORMING POST-UPGRADE TASKS
This procedure lists major tasks recommended to perform after an in-place upgrade to RHEL 8.
Prerequisites
- The system has been upgraded following the steps described in Performing the upgrade from RHEL 7 to RHEL 8 and you have been able to log in to RHEL 8.
- The status of the in-place upgrade has been verified following the steps described in Verifying the post-upgrade status of the RHEL 8 system.
Procedure
After performing the upgrade, complete the following tasks:
1. Ensure your system remains supported after the in-place upgrade. With the general availability of RHEL 8.3, update your system either to RHEL 8.3 or to RHEL 8.2 Extended Update Support (EUS).
a. Update the system to RHEL 8.3:
i. Unset Red Hat Subscription Manager to consume the latest RHEL 8.3 content:
```
# subscription-manager release --unset
```
ii. Update your system to the latest RHEL 8.3 version:
```
# yum update
```
b. Update the system to RHEL 8.2 EUS:
i. Enable RHEL 8 EUS repositories:
```
# subscription-manager repos --enable repository_id1 --enable repository_id2 ...
```
Replace `repository_id*` with IDs of EUS repositories available with your subscription. Enable at least the BaseOS and AppStream repositories. For example, on the Intel 64 architecture:
```
# subscription-manager repos --enable rhel-8-for-x86_64-baseos-eus-rpms --enable rhel-8-for-x86_64-appstream-eus-rpms
```
ii. Update your system to the latest RHEL 8.2 EUS version
```
# yum update
```
2. If you upgraded using RHUI on AWS or Microsoft Azure and your software certification is not available on a later minor release version, lock your system to a minor release version supported by your certification.
```
# echo '8.x' > /etc/yum/vars/releasever
```
3. Re-evaluate and re-apply your security policies. Especially, change the SELinux mode to enforcing. For details, see Applying security policies.
CHAPTER 7. APPLYING SECURITY POLICIES
During the in-place upgrade process, certain security policies must remain disabled. Furthermore, RHEL 8 introduces a new concept of system-wide cryptographic policies and also security profiles might contain changes between major releases. This section guides you when securing your upgraded RHEL systems.
7.1. CHANGING SELINUX MODE TO ENFORCING
During the in-place upgrade process, the Leapp utility sets SELinux mode to permissive. When the system is successfully upgraded, you have to manually change SELinux mode to enforcing.
Prerequisites
- The system has been upgraded and you have performed the verification steps described in Verifying the post-upgrade state of the RHEL 8 system.
Procedure
1. Ensure that there are no SELinux denials, for example, by using the ausearch utility:
```
# ausearch -m AVC,USER_AVC -ts boot
```
Note that the previous step covers only the most common scenario. To check for all possible SELinux denials, see the Identifying SELinux denials section in the Using SELinux title, which provides a complete procedure.
2. Open the /etc/selinux/config file in a text editor of your choice, for example:
```
# vi /etc/selinux/config
```
3. Configure the SELINUX=enforcing option:
```
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
```
4. Save the change, and restart the system:
```
# reboot
```
Verification steps
1. After the system restarts, confirm that the getenforce command returns Enforcing:
7.2. SETTING SYSTEM-WIDE CRYPTOGRAPHIC POLICIES
Crypto policies is a system component that configures the core cryptographic subsystems, covering the TLS, IPSec, SSH, DNSSec, and Kerberos protocols.
After a successful installation or an in-place upgrade process, the system-wide cryptographic policy is automatically set to DEFAULT. The DEFAULT system-wide cryptographic policy level offers secure settings for current threat models.
To view or change the current system-wide cryptographic policy, use the update-crypto-policies tool:
```bash
$ update-crypto-policies --show
DEFAULT
```
For example, the following command switches the system-wide crypto policy level to FUTURE, which should withstand any near-term future attacks:
```bash
# update-crypto-policies --set FUTURE
Setting system policy to FUTURE
```
RHEL 8.2 also introduces customization of system-wide cryptographic policies. For details, see the Customizing system-wide cryptographic policies with policy modifiers and Creating and setting a custom system-wide cryptographic policy sections.
Additional resources
- Using system-wide cryptographic policies
- `update-crypto-policies(8)` man page.
7.3. REMEDIATING THE SYSTEM TO A SECURITY BASELINE
The OpenSCAP suite provides remediations to make your system compliant with security baselines, such as PCI-DSS, OSPP, or ACSC E8. Use the steps in the following procedure for changing your system settings to conform with the PCI-DSS profile.
**IMPORTANT**
Red Hat does not provide any automated method to revert changes made by security-hardening remediations. Remediations are supported on RHEL systems in the default configuration. If your system has been altered after the installation, running remediation might not make it compliant with the required security profile.
Prerequisites
The scap-security-guide package is installed on your RHEL 8 system.
Procedure
1. Use the oscap command with the --remediate option:
```
# oscap xccdf eval --profile pci-dss --remediate /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
```
You can replace pci-dss in the previous example by a profile required by your scenario.
2. Restart your system:
```
# reboot
```
Verification steps
1. Evaluate the system of how it complies with the PCI-DSS profile, and save results to the pcidss_report.html file:
```
$ oscap xccdf eval --report pcidss_report.html --profile pci-dss /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
```
Additional resources
- Scanning the system for security compliance and vulnerabilities
- scap-security-guide(8) man page
- oscap(8) man pages
CHAPTER 8. TROUBLESHOOTING
You can refer to the following tips to troubleshoot upgrading from RHEL 7 to RHEL 8.
8.1. TROUBLESHOOTING RESOURCES
You can refer to the following troubleshooting resources.
**Console output**
By default, only error and critical log level messages are printed to the console output by the `Leapp` utility. To change the log level, use the `--verbose` or `--debug` options with the `leapp upgrade` command.
- In `verbose` mode, `Leapp` prints info, warning, error, and critical messages.
- In `debug` mode, `Leapp` prints debug, info, warning, error, and critical messages.
**Logs**
- The `/var/log/leapp/leapp-upgrade.log` file lists issues found during the initramfs phase.
- The `/var/log/leapp/dnf-debugdata/` directory contains transaction debug data. This directory is present only if the `leapp upgrade` command is executed with the `--debug` option.
- The `/var/log/leapp/answerfile` contains questions required to be answered by `Leapp`.
- The `journalctl` utility provides complete logs.
**Reports**
- The `/var/log/leapp/leapp-report.txt` file lists issues found during the pre-upgrade phase. The report is also available in the web console, see Assessing upgradability and applying automated remediations through the web console.
8.2. TROUBLESHOOTING TIPS
You can refer to the following troubleshooting tips.
**Pre-upgrade phase**
- Verify that your system meets all conditions listed in Planning an upgrade.
- Make sure you have followed all steps described in Preparing a RHEL 7 system for the upgrade for example, your system does not use more than one Network Interface Card (NIC) with a name based on the prefix used by the kernel (`eth`).
- Make sure you have answered all questions required by `Leapp` in the `/var/log/leapp/answerfile` file. If any answers are missing, `Leapp` inhibits the upgrade. Example questions:
- Disable pam_pkcs11 module in PAM configuration?
- Disable pam_krb5 module in PAM configuration?
- Configure PAM and nsswitch.conf with the following authselect call?
Make sure you have resolved all problems identified in the pre-upgrade report, located at `/var/log/leapp/leapp-report.txt`. To achieve this, you can also use the web console, as described in Assessing upgradability and applying automated remediations through the web console.
Example 8.1. Leapp answerfile
The following is an example of an unedited `/var/log/leapp/answerfile` file that has one unanswered question:
```
[remove_pam_pkcs11_module_check]
# Title: None
# Reason: Confirmation
# ----------------=------------------- remove_pam_pkcs11_module_check.confirm =-------------------
# Label: Disable pam_pkcs11 module in PAM configuration? If no, the upgrade process will be interrupted.
# Description: PAM module pam_pkcs11 is no longer available in RHEL-8 since it was replaced by SSSD.
# Type: bool
# Default: None
# Available choices: True/False
# Unanswered question. Uncomment the following line with your answer
confirm =
```
The **Label** field specifies the question that requires an answer. In this example, the question is **Disable pam_pkcs11 module in PAM configuration?**
To answer the question, uncomment the `confirm` line and enter an answer of **True** or **False**. In this example, the selected answer is **True**:
```
[remove_pam_pkcs11_module_check]
... # Available choices: True/False
# Unanswered question. Uncomment the following line with your answer
confirm = True
```
Download phase
- If a problem occurs during downloading RPM packages, examine transaction debug data located in the `/var/log/leapp/dnf-debugdata/` directory.
initramfs phase
- During this phase, potential failures redirect you to the Dracut shell. Check the Journal log:
```
# journalctl
```
Alternatively, restart the system from the Dracut shell using the `reboot` command and check the `/var/log/leapp/leapp-upgrade.log` file.
Post-upgrade phase
- If your system seems to be successfully upgraded but booted with the old RHEL 7 kernel, restart the system and check the kernel version of the default entry in GRUB.
---
Red Hat Enterprise Linux 8 Upgrading from RHEL 7 to RHEL 8
26
• Make sure you have followed the recommended steps in Verifying the post-upgrade state of the RHEL 8 system.
• If your application or a service stops working or behaves incorrectly after you have switched SELinux to enforcing mode, search for denials using the ausearch, journalctl, or dmesg utilities:
```bash
# ausearch -m AVC,USER_AVC -ts boot
# journalctl -t setroubleshoot
# dmesg | grep -i -e selinux -e type=1400
```
The most common problems are caused by incorrect labeling. See Troubleshooting problems related to SELinux for more details.
### 8.3. KNOWN ISSUES
The following are Known Issues you may encounter when upgrading from RHEL 7 to RHEL 8.
• Network teaming currently does not work when the in-place upgrade is performed while Network Manager is disabled or not installed.
• If you use an HTTP proxy, Red Hat Subscription Manager must be configured to use such a proxy, or the subscription-manager command must be executed with the --proxy `<hostname>` option. Otherwise, an execution of the subscription-manager command fails. If you use the --proxy option instead of the configuration change, the upgrade process fails because Leapp is unable to detect the proxy. To prevent this problem from occurring, manually edit the rhsm.conf file as described in How to configure HTTP Proxy for Red Hat Subscription Management. (BZ#1689294)
• If your RHEL 7 system is installed on an FCoE Logical Unit Number (LUN) and connected to a network card that uses the bnx2fc driver, the LUN is not detected in RHEL 8 after the upgrade. Consequently, the upgraded system fails to boot. (BZ#1718147)
• If your RHEL 7 system uses a device driver that is provided by Red Hat but is not available in RHEL 8, Leapp inhibits the upgrade. However, if the RHEL 7 system uses a third-party device driver that is not included in the list of removed drivers (located at /etc/leapp/repos.d/system_upgrade/el7toel8/actors/kernel/checkkerneldrivers/files/remove_d_drivers.txt), Leapp does not detect such a driver and proceeds with the upgrade. Consequently, the system might fail to boot after the upgrade.
• You cannot perform an in-place upgrade when the winbind and wins Samba modules are used in the /etc/nsswitch.conf file at the moment. The upgrade transaction fails with the following error messages and Leapp inhibits the upgrade:
```bash
upgrade[469]: STDERR:
upgrade[469]: Error in PREIN scriptlet in rpm package unbound-libs
upgrade[469]: Error: Transaction failed
upgrade[469]: Container el8userspace failed with error code 1.
unbound-libs has a PREIN failure
```
To work around this problem, configure the system so that it uses only local providers for the user, groups, and hosts database during the update:
1. Open the system /etc/nsswitch.conf configuration file and search for entries that contain the winbind or wins strings.
2. If you find such entries, create a backup of /etc/nsswitch.conf.
3. Edit `/etc/nsswitch.conf` and remove `winbind` or `wins` from the entries that contain them.
4. Perform an in-place upgrade.
5. After the upgrade, add the `winbind` and `wins` strings to the respective entries in `/etc/nsswitch.conf`, based on your system configuration requirements.
(BZ#1410154)
- The `Leapp` utility does not change customized authentication configuration during the upgrade process. If you used the deprecated `authconfig` utility to configure authentication on your RHEL 7 system, authentication on RHEL 8 might not work correctly. To ensure that your custom configuration functions properly on the RHEL 8 system, re-configure your RHEL 8 system with the `authselect` utility.
**IMPORTANT**
During the in-place upgrade, the deprecated `pam_krb5` or `pam_pkcs11` pluggable authentication modules (PAM) are removed. Consequently, if the PAM configuration on your RHEL 7 system contains the `pam_krb5` or `pam_pkcs11` modules and if these modules have the `required` or `requisite` control values, performing the in-place upgrade might result in locking you out of the system. To work around this problem, reconfigure your RHEL 7 system not to use `pam_krb5` or `pam_pkcs11` before you start the upgrade process.
- On IBM Z systems, `Leapp` always expects a DASD disk attached. Consequently, if the `/etc/dasd.conf` file does not exist, the in-place upgrade fails. To work around this problem, create an empty `dasd.conf` file by using the `touch > /etc/dasd.conf` command. (BZ#1783248)
- If a name of a third-party package (not signed by Red Hat) installed on your system is the same as of a package provided by Red Hat, the in-place upgrade fails. To work around this problem, choose one of the following options prior to upgrading:
a. Remove the third-party package
b. Replace the third-party package with the package provided by Red Hat
- During an in-place upgrade, the `docker` package is removed without a warning. If you use containers in RHEL, migrate to Podman prior to upgrading to RHEL 8. For instructions, see How do I migrate my Docker containers to Podman prior to moving from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8?. (BZ#1858711)
- Due to security reasons, support for single-DES (DES) and triple-DES (3DES) encryption types has been removed from RHEL 8.3.0. RHEL 7 Identity Management (IdM), however, still supports 3DES encryption. Upgrading an IdM environment from RHEL 7 to RHEL 8 is possible because both versions of RHEL prefer stronger AES encryption types by default:
<table>
<thead>
<tr>
<th>Version of IdM</th>
<th>Default encryption types</th>
<th>Additional supported encryption types</th>
</tr>
</thead>
<tbody>
<tr>
<td>RHEL 7</td>
<td>aes256-cts</td>
<td>camellia256-cts</td>
</tr>
<tr>
<td></td>
<td>aes128-cts</td>
<td>camellia128-cts</td>
</tr>
<tr>
<td></td>
<td></td>
<td>des3-hmac</td>
</tr>
<tr>
<td></td>
<td></td>
<td>arcfour-hmac</td>
</tr>
<tr>
<td>Version of IdM</td>
<td>Default encryption types</td>
<td>Additional supported encryption types</td>
</tr>
<tr>
<td>---------------</td>
<td>--------------------------</td>
<td>----------------------------------------</td>
</tr>
<tr>
<td>RHEL 8</td>
<td>aes256-cts</td>
<td>aes256-sha2</td>
</tr>
<tr>
<td></td>
<td>aes128-cts</td>
<td>aes128-sha2</td>
</tr>
<tr>
<td></td>
<td></td>
<td>camellia256-cts</td>
</tr>
<tr>
<td></td>
<td></td>
<td>camellia128-cts</td>
</tr>
<tr>
<td></td>
<td></td>
<td>arcfour-hmac [a]</td>
</tr>
</tbody>
</table>
[a] RC4 encryption has been deprecated and disabled by default in RHEL 8, as it is considered less secure than the newer AES-128 and AES-256 encryption types. For more information on enabling RC4 support for compatibility with legacy Active Directory environments, see Ensuring support for common encryption types in AD and RHEL.
If you manually configured a non-IdM Kerberos Distribution Center (KDC), any services, or any users to only use DES or 3DES encryption, you might experience service interruptions after updating to the latest Kerberos packages in RHEL 8, such as:
- Kerberos authentication errors
- unknown enctype encryption errors
- KDCs with DES-encrypted Database Master Keys (K/M) fail to start
Red Hat recommends you do not use DES or 3DES encryption in your environment. For more information on re-keying Kerberos principals to use stronger encryption types, see Retiring DES from MIT Kerberos Documentation.
### 8.4. OBTAINING SUPPORT
You can open a support case, select RHEL 8 as the product, and provide a sosreport from your system.
- To generate a sosreport on your system, run:
```
# sosreport
```
Note that you can leave the case ID empty.
For details on generating a sosreport, see the solution What is an sosreport and how to create one in Red Hat Enterprise Linux?.
For more information on opening and managing a support case on the Customer Portal, see the article How do I open and manage a support case on the Customer Portal?
CHAPTER 9. RELATED INFORMATION
You can refer to the following instructional materials:
- Red Hat Enterprise Linux technology capabilities and limits
- Considerations in adopting RHEL 8
- Customizing your Red Hat Enterprise Linux in-place upgrade
- How do I upgrade from Red Hat Enterprise Linux 6 to Red Hat Enterprise Linux 7?
- Upgrading from RHEL 6 to RHEL 8
- How to convert from CentOS or Oracle Linux to RHEL
- Upgrading Hosts from RHEL 7 to RHEL 8 in Red Hat Satellite
- Red Hat Insights Documentation
APPENDIX A. RHEL 7 REPOSITORIES
Before the upgrade, ensure you have appropriate repositories enabled as described in step 3 of the procedure in Preparing a RHEL 7 system for the upgrade.
If you plan to use Red Hat Subscription Manager during the upgrade, you must enable the following repositories before the upgrade by using the `subscription-manager repos --enable repository_id` command:
<table>
<thead>
<tr>
<th>Architecture</th>
<th>Repository</th>
<th>Repository ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>64-bit Intel</td>
<td>Base</td>
<td>rhel-7-server-rpms</td>
</tr>
<tr>
<td></td>
<td>Extras</td>
<td>rhel-7-server-extras-rpms</td>
</tr>
<tr>
<td>64-bit ARM</td>
<td>Base</td>
<td>rhel-7-for-arm-64-rpms</td>
</tr>
<tr>
<td></td>
<td>Extras</td>
<td>rhel-7-for-arm-64-extras-rpms</td>
</tr>
<tr>
<td>IBM POWER8 (little endian)</td>
<td>Base</td>
<td>rhel-7-for-power-le-rpms</td>
</tr>
<tr>
<td></td>
<td>Extras</td>
<td>rhel-7-for-power-le-extras-rpms</td>
</tr>
<tr>
<td>IBM POWER9 (little endian)</td>
<td>Base</td>
<td>rhel-7-for-power-9-rpms</td>
</tr>
<tr>
<td></td>
<td>Extras</td>
<td>rhel-7-for-power-9-extras-rpms</td>
</tr>
<tr>
<td>IBM Z</td>
<td>Base</td>
<td>rhel-7-for-system-z-rpms</td>
</tr>
<tr>
<td></td>
<td>Extras</td>
<td>rhel-7-for-system-z-extras-rpms</td>
</tr>
<tr>
<td>IBM Z (Structure A)</td>
<td>Base</td>
<td>rhel-7-for-system-z-a-rpms</td>
</tr>
<tr>
<td></td>
<td>Extras</td>
<td>rhel-7-for-system-z-a-extras-rpms</td>
</tr>
</tbody>
</table>
You can enable the following repositories before the upgrade by using the `subscription-manager repos --enable repository_id` command:
<table>
<thead>
<tr>
<th>Architecture</th>
<th>Repository</th>
<th>Repository ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>64-bit Intel</td>
<td>Optional</td>
<td>rhel-7-server-optional-rpms</td>
</tr>
<tr>
<td></td>
<td>Supplementary</td>
<td>rhel-7-server-supplementary-rpms</td>
</tr>
<tr>
<td>64-bit ARM</td>
<td>Optional</td>
<td>rhel-7-for-arm-64-optional-rpms</td>
</tr>
<tr>
<td></td>
<td>Supplementary</td>
<td>N/A</td>
</tr>
<tr>
<td>Architecture</td>
<td>Repository</td>
<td>Repository ID</td>
</tr>
<tr>
<td>-------------------------------</td>
<td>------------------------</td>
<td>----------------------------------------</td>
</tr>
<tr>
<td>IBM POWER8 (little endian)</td>
<td>Optional</td>
<td>rhel-7-for-power-le-optional-rpms</td>
</tr>
<tr>
<td></td>
<td>Supplementary</td>
<td>rhel-7-for-power-le-supplementary-rpms</td>
</tr>
<tr>
<td>IBM POWER9 (little endian)</td>
<td>Optional</td>
<td>rhel-7-for-power-9-optional-rpms</td>
</tr>
<tr>
<td></td>
<td>Supplementary</td>
<td>rhel-7-for-power-9-supplementary-rpms</td>
</tr>
<tr>
<td>IBM Z</td>
<td>Optional</td>
<td>rhel-7-for-system-z-optional-rpms</td>
</tr>
<tr>
<td></td>
<td>Supplementary</td>
<td>rhel-7-for-system-z-supplementary-rpms</td>
</tr>
<tr>
<td>IBM Z (Structure A)</td>
<td>Optional</td>
<td>rhel-7-for-system-z-a-optional-rpms</td>
</tr>
<tr>
<td></td>
<td>Supplementary</td>
<td>N/A</td>
</tr>
</tbody>
</table>
**NOTE**
If you have enabled a RHEL 7 Optional or a RHEL 7 Supplementary repository before an in-place upgrade, **Leapp** enables the **RHEL 8 CodeReady Linux Builder** or **RHEL 8 Supplementary** repositories, respectively.
If you decide to use custom repositories, enable them per instructions in **Configuring custom repositories**.
|
{"Source-Url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/upgrading_from_rhel_7_to_rhel_8/Red_Hat_Enterprise_Linux-8-Upgrading_from_RHEL_7_to_RHEL_8-en-US.pdf", "len_cl100k_base": 12384, "olmocr-version": "0.1.53", "pdf-total-pages": 36, "total-fallback-pages": 0, "total-input-tokens": 66583, "total-output-tokens": 13695, "length": "2e13", "weborganizer": {"__label__adult": 0.0003657341003417969, "__label__art_design": 0.0005235671997070312, "__label__crime_law": 0.0004267692565917969, "__label__education_jobs": 0.002834320068359375, "__label__entertainment": 0.00017595291137695312, "__label__fashion_beauty": 0.00016558170318603516, "__label__finance_business": 0.0096282958984375, "__label__food_dining": 0.00024771690368652344, "__label__games": 0.0012264251708984375, "__label__hardware": 0.005794525146484375, "__label__health": 0.00025081634521484375, "__label__history": 0.0003685951232910156, "__label__home_hobbies": 0.00023305416107177737, "__label__industrial": 0.0008883476257324219, "__label__literature": 0.00022482872009277344, "__label__politics": 0.0005626678466796875, "__label__religion": 0.00037598609924316406, "__label__science_tech": 0.052947998046875, "__label__social_life": 0.00015103816986083984, "__label__software": 0.41259765625, "__label__software_dev": 0.50927734375, "__label__sports_fitness": 0.0001455545425415039, "__label__transportation": 0.00035309791564941406, "__label__travel": 0.00022614002227783203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 50463, 0.01721]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 50463, 0.05832]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 50463, 0.83162]], "google_gemma-3-12b-it_contains_pii": [[0, 160, false], [160, 160, null], [160, 319, null], [319, 589, null], [589, 2509, null], [2509, 2509, null], [2509, 2900, null], [2900, 3817, null], [3817, 6558, null], [6558, 7674, null], [7674, 9765, null], [9765, 11444, null], [11444, 13474, null], [13474, 14899, null], [14899, 16789, null], [16789, 18767, null], [18767, 19853, null], [19853, 20935, null], [20935, 22583, null], [22583, 23955, null], [23955, 25838, null], [25838, 25977, null], [25977, 27785, null], [27785, 29757, null], [29757, 29904, null], [29904, 31800, null], [31800, 33616, null], [33616, 34394, null], [34394, 36447, null], [36447, 38661, null], [38661, 41578, null], [41578, 44641, null], [44641, 46713, null], [46713, 47224, null], [47224, 49125, null], [49125, 50463, null]], "google_gemma-3-12b-it_is_public_document": [[0, 160, true], [160, 160, null], [160, 319, null], [319, 589, null], [589, 2509, null], [2509, 2509, null], [2509, 2900, null], [2900, 3817, null], [3817, 6558, null], [6558, 7674, null], [7674, 9765, null], [9765, 11444, null], [11444, 13474, null], [13474, 14899, null], [14899, 16789, null], [16789, 18767, null], [18767, 19853, null], [19853, 20935, null], [20935, 22583, null], [22583, 23955, null], [23955, 25838, null], [25838, 25977, null], [25977, 27785, null], [27785, 29757, null], [29757, 29904, null], [29904, 31800, null], [31800, 33616, null], [33616, 34394, null], [34394, 36447, null], [36447, 38661, null], [38661, 41578, null], [41578, 44641, null], [44641, 46713, null], [46713, 47224, null], [47224, 49125, null], [49125, 50463, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 50463, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 50463, null]], "pdf_page_numbers": [[0, 160, 1], [160, 160, 2], [160, 319, 3], [319, 589, 4], [589, 2509, 5], [2509, 2509, 6], [2509, 2900, 7], [2900, 3817, 8], [3817, 6558, 9], [6558, 7674, 10], [7674, 9765, 11], [9765, 11444, 12], [11444, 13474, 13], [13474, 14899, 14], [14899, 16789, 15], [16789, 18767, 16], [18767, 19853, 17], [19853, 20935, 18], [20935, 22583, 19], [22583, 23955, 20], [23955, 25838, 21], [25838, 25977, 22], [25977, 27785, 23], [27785, 29757, 24], [29757, 29904, 25], [29904, 31800, 26], [31800, 33616, 27], [33616, 34394, 28], [34394, 36447, 29], [36447, 38661, 30], [38661, 41578, 31], [41578, 44641, 32], [44641, 46713, 33], [46713, 47224, 34], [47224, 49125, 35], [49125, 50463, 36]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 50463, 0.09748]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
41b1b9911559e9fa48749e1b37f586eee14409a4
|
NAG Library Function Document
nag_2d_cheb_fit_lines (e02cac)
1 Purpose
nag_2d_cheb_fit_lines (e02cac) forms an approximation to the weighted, least squares Chebyshev series surface fit to data arbitrarily distributed on lines parallel to one independent coordinate axis.
2 Specification
#include <nag.h>
void nag_2d_cheb_fit_lines (const Integer m[], Integer n, Integer k,
Integer l, const double x[], const double y[], const double f[],
const double w[], double a[], const double xmin[], const double xmax[],
const double nux[], Integer inuxp1, const double nuy[], Integer inuyp1,
NagError *fail)
3 Description
nag_2d_cheb_fit_lines (e02cac) determines a bivariate polynomial approximation of degree \(k\) in \(x\) and \(l\) in \(y\) to the set of data points \((x_{r,s}, y_{r,s}, f_{r,s})\), with weights \(w_{r,s}\), for \(s = 1, 2, \ldots, n\) and \(r = 1, 2, \ldots, m_s\). That is, the data points are on lines \(y = y_s\), but the \(x\) values may be different on each line. The values of \(k\) and \(l\) are prescribed by you (for guidance on their choice, see Section 9). The function is based on the method described in Sections 5 and 6 of Clenshaw and Hayes (1965).
The polynomial is represented in double Chebyshev series form with arguments \(\tilde{x}\) and \(\tilde{y}\). The arguments lie in the range \(-1\) to \(+1\) and are related to the original variables \(x\) and \(y\) by the transformations
\[
\tilde{x} = \frac{2x - (x_{\text{max}} + x_{\text{min}})}{(x_{\text{max}} - x_{\text{min}})} \quad \text{and} \quad \tilde{y} = \frac{2y - (y_{\text{max}} + y_{\text{min}})}{(y_{\text{max}} - y_{\text{min}})}.
\]
Here \(y_{\text{max}}\) and \(y_{\text{min}}\) are set by the function to, respectively, the largest and smallest value of \(y_s\), but \(x_{\text{max}}\) and \(x_{\text{min}}\) are functions of \(y\) prescribed by you (see Section 9). For this function, only their values \(x_{\text{max}}^{(s)}\) and \(x_{\text{min}}^{(s)}\) at each \(y = y_s\) are required. For each \(s = 1, 2, \ldots, n\), \(x_{\text{max}}^{(s)}\) must not be less than the largest \(x_{r,s}\) on the line \(y = y_s\), and, similarly, \(x_{\text{min}}^{(s)}\) must not be greater than the smallest \(x_{r,s}\).
The double Chebyshev series can be written as
\[
\sum_{i=0}^{k} \sum_{j=0}^{l} a_{ij} T_i(\tilde{x}) T_j(\tilde{y})
\]
where \(T_i(\tilde{x})\) is the Chebyshev polynomial of the first kind of degree \(i\) with argument \(\tilde{x}\), and \(T_j(\tilde{y})\) is similarly defined. However, the standard convention, followed in this function, is that coefficients in the above expression which have either \(i\) or \(j\) zero are written as \(\frac{1}{2}a_{ij}\), instead of simply \(a_{ij}\), and the coefficient with both \(i\) and \(j\) equal to zero is written as \(\frac{1}{4}a_{0,0}\). The series with coefficients output by the function should be summed using this convention. nag_2d_cheb_eval (e02cbc) is available to compute values of the fitted function from these coefficients.
The function first obtains Chebyshev series coefficients \(c_{s,i}\), for \(i = 0, 1, \ldots, k\), of the weighted least squares polynomial curve fit of degree \(k\) in \(\tilde{x}\) to the data on each line \(y = y_s\), for \(s = 1, 2, \ldots, n\), in turn, using an auxiliary function. The same function is then called \(k + 1\) times to fit \(c_{s,i}\), for \(s = 1, 2, \ldots, n\), by a polynomial of degree \(l\) in \(\tilde{y}\), for each \(i = 0, 1, \ldots, k\). The resulting coefficients are the required \(a_{ij}\).
You can force the fit to contain a given polynomial factor. This allows for the surface fit to be constrained to have specified values and derivatives along the boundaries \(x = x_{\text{min}}, x = x_{\text{max}}, y = y_{\text{min}}\) and \(y = y_{\text{max}}\).
and \( y = y_{\text{max}} \) or indeed along any lines \( \bar{x} = \) constant or \( \bar{y} = \) constant (see Section 8 of Clenshaw and Hayes (1965)).
### 4 References
### 5 Arguments
1. \( m[n] \) – const Integer
**Input**
*On entry:* \( m[s-1] \) must be set to \( m_s \), the number of data \( x \) values on the line \( y = y_s \), for \( s = 1, 2, \ldots, n \).
*Constraint:* \( m[s-1] > 0 \), for \( s = 1, 2, \ldots, n \).
2. \( n \) – Integer
**Input**
*On entry:* the number of lines \( y = \) constant on which data points are given.
*Constraint:* \( n > 0 \).
3. \( k \) – Integer
**Input**
*On entry:* \( k \), the required degree of \( x \) in the fit.
*Constraint:* for \( s = 1, 2, \ldots, n \), \( \text{inuxp1} - 1 \leq k < \text{mdist}(s) + \text{inuxp1} - 1 \), where \( \text{mdist}(s) \) is the number of distinct \( x \) values with nonzero weight on the line \( y = y_s \). See Section 9.
4. \( l \) – Integer
**Input**
*On entry:* \( l \), the required degree of \( y \) in the fit.
*Constraints:*
\[ l \geq 0; \]
\[ \text{inuypl} - 1 \leq l < n + \text{inuypl} - 1. \]
5. \( x[\text{dim}] \) – const double
**Input**
*Note:* the dimension, \( \text{dim} \), of the array \( x \) must be at least \( \left( \sum_{s=1}^{n} m[s-1] \right) \).
*On entry:* the \( x \) values of the data points. The sequence must be
all points on \( y = y_1 \), followed by
all points on \( y = y_2 \), followed by
\[ \vdots \]
all points on \( y = y_n \).
*Constraint:* for each \( y_s \), the \( x \) values must be in nondecreasing order.
6. \( y[n] \) – const double
**Input**
*On entry:* \( y[s-1] \) must contain the \( y \) value of line \( y = y_s \), for \( s = 1, 2, \ldots, n \), on which data is given.
*Constraint:* the \( y_s \) values must be in strictly increasing order.
7: \( f[\text{dim}] \) – const double
**Input**
**Note:** the dimension, \( \text{dim} \), of the array \( f \) must be at least \( \left( \sum_{s=1}^{n} m[s-1] \right) \).
**On entry:** \( f \), the data values of the dependent variable in the same sequence as the \( x \) values.
---
8: \( w[\text{dim}] \) – const double
**Input**
**Note:** the dimension, \( \text{dim} \), of the array \( w \) must be at least \( \left( \sum_{s=1}^{n} m[s-1] \right) \).
**On entry:** the weights to be assigned to the data points, in the same sequence as the \( x \) values. These weights should be calculated from estimates of the absolute accuracies of the \( f_r \), expressed as standard deviations, probable errors or some other measure which is of the same dimensions as \( f_r \). Specifically, each \( w_r \) should be inversely proportional to the accuracy estimate of \( f_r \). Often weights all equal to unity will be satisfactory. If a particular weight is zero, the corresponding data point is omitted from the fit.
---
9: \( a[\text{dim}] \) – double
**Output**
**Note:** the dimension, \( \text{dim} \), of the array \( a \) must be at least \( (k + 1) \times (l + 1) \).
**On exit:** contains the Chebyshev coefficients of the fit. \( a[i \times (l + 1) + j - 1] \) is the coefficient \( a_{ij} \) of Section 3 defined according to the standard convention. These coefficients are used by \texttt{nag_2d_cheb_eval (e02cbc)} to calculate values of the fitted function.
---
10: \( \text{xmin}[n] \) – const double
**Input**
**On entry:** \( \text{xmin}[s-1] \) must contain \( x^{(s)}_{\text{min}} \), the lower end of the range of \( x \) on the line \( y = y_s \), for \( s = 1, 2, \ldots, n \). It must not be greater than the lowest data value of \( x \) on the line. Each \( x^{(s)}_{\text{min}} \) is scaled to \(-1.0\) in the fit. (See also Section 9.)
---
11: \( \text{xmax}[n] \) – const double
**Input**
**On entry:** \( \text{xmax}[s-1] \) must contain \( x^{(s)}_{\text{max}} \), the upper end of the range of \( x \) on the line \( y = y_s \), for \( s = 1, 2, \ldots, n \). It must not be less than the highest data value of \( x \) on the line. Each \( x^{(s)}_{\text{max}} \) is scaled to \(+1.0\) in the fit. (See also Section 9.)
**Constraint:** \( \text{xmax}[s-1] > \text{xmin}[s-1] \).
---
12: \( \text{nux}[\text{inuxp1}] \) – const double
**Input**
**On entry:** \( \text{nux}[i-1] \) must contain the coefficient of the Chebyshev polynomial of degree \( (i - 1) \) in \( \tilde{x} \), in the Chebyshev series representation of the polynomial factor in \( \tilde{x} \) which you require the fit to contain, for \( i = 1, 2, \ldots, \text{inuxp1} \). These coefficients are defined according to the standard convention of Section 3.
**Constraint:** \( \text{nux}[\text{inuxp1} - 1] \) must be nonzero, unless \( \text{inuxp1} = 1 \), in which case \( \text{nux} \) is ignored.
---
13: \( \text{inuxp1} \) – Integer
**Input**
**On entry:** \( I\text{UNIX} + 1 \), where \( I\text{UNIX} \) is the degree of a polynomial factor in \( \tilde{x} \) which you require the fit to contain. (See Section 3, last paragraph.)
If this option is not required, \( \text{inuxp1} \) should be set equal to 1.
**Constraint:** \( 1 \leq \text{inuxp1} \leq k + 1 \).
---
14: \( \text{nuy}[\text{inuyp1}] \) – const double
**Input**
**On entry:** \( \text{nuy}[i-1] \) must contain the coefficient of the Chebyshev polynomial of degree \( (i - 1) \) in \( \tilde{y} \), in the Chebyshev series representation of the polynomial factor which you require the fit to
contain, for \( i = 1, 2, \ldots, \text{inuyp1} \). These coefficients are defined according to the standard convention of Section 3.
Constraint: \( \text{nuy}[\text{inuyp1} - 1] \) must be nonzero, unless \( \text{inuyp1} = 1 \), in which case \( \text{nuy} \) is ignored.
15: \( \text{inuyp1} \) – Integer
\text{Input}
On entry: \( \text{INU} + 1 \), where \( \text{INU} \) is the degree of a polynomial factor in \( \bar{y} \) which you require the fit to contain. (See Section 3, last paragraph.) If this option is not required, \( \text{inuyp1} \) should be set equal to 1.
16: \( \text{fail} \) – NagError *
\text{Input/Output}
The NAG error argument (see Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
NE_BAD_PARAM
On entry, argument \( \langle\text{value}\rangle \) had an illegal value.
NE_INT
On entry, \( \text{inuxp1} = \langle\text{value}\rangle \).
Constraint: \( \text{inuxp1} \geq 1 \).
On entry, \( \text{inuyp1} = \langle\text{value}\rangle \).
Constraint: \( \text{inuyp1} \geq 1 \).
On entry, \( k = \langle\text{value}\rangle \).
Constraint: \( k \geq 0 \).
On entry, \( l = \langle\text{value}\rangle \).
Constraint: \( l \geq 0 \).
On entry, \( n = \langle\text{value}\rangle \).
Constraint: \( n > 0 \).
NE_INT_2
On entry, \( \text{inuxp1} = \langle\text{value}\rangle \) and \( k = \langle\text{value}\rangle \).
Constraint: \( \text{inuxp1} \leq k + 1 \).
On entry, \( \text{inuyp1} = \langle\text{value}\rangle \) and \( l = \langle\text{value}\rangle \).
Constraint: \( \text{inuyp1} \leq l + 1 \).
NE_INT_3
On entry, \( n = \langle\text{value}\rangle \), \( l = \langle\text{value}\rangle \) and \( \text{inuxp1} = \langle\text{value}\rangle \).
Constraint: \( \text{inuxp1} - 1 \leq l < n + \text{inuxp1} - 1 \).
On entry, \( n = \langle\text{value}\rangle \), \( l = \langle\text{value}\rangle \) and \( \text{inuxp1} = \langle\text{value}\rangle \).
Constraint: \( l \geq 0 \) and
On entry, \( n = \langle\text{value}\rangle \), \( l = \langle\text{value}\rangle \) and \( \text{inuxp1} = \langle\text{value}\rangle \).
Constraint: \( n \geq 1 - \text{inuxp1} + 2 \).
NE_INT_ARRAY
On entry, \( I = \langle\text{value}\rangle \), \( m[I - 1] = \langle\text{value}\rangle \), \( k = \langle\text{value}\rangle \) and \( \text{inuxp1} = \langle\text{value}\rangle \).
Constraint: \( m[I - 1] \geq k - \text{inuxp1} + 2 \).
On entry, \( \text{inuxp1} = \langle \text{value} \rangle, \text{nux}[\text{inuxp1} - 1] = \langle \text{value} \rangle \) and \( \text{nuy}[\text{inuxp1} - 1] = \langle \text{value} \rangle \).
Constraint: if \( \text{nux}[\text{inuxp1} - 1] = 0.0 \), \( \text{inuxp1} = 1; \) if \( \text{nuy}[\text{inuxp1} - 1] = 0.0 \), \( \text{inuxp1} = 1 \).
On entry, \( m[\langle \text{value} \rangle] = \langle \text{value} \rangle \).
Constraint: \( m[s - 1] > 0, \) for \( s = 1, 2, \ldots, n \).
**NE_INTERNAL_ERROR**
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
**NE_NO_LICENCE**
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
**NE_NON_ZERO_WEIGHTS**
On entry, the number of distinct \( x \) values with nonzero weight on \( y = y[I - 1] \) is less than \( k - \text{inuxp1} + 2: I = \langle \text{value} \rangle, y[I - 1] = \langle \text{value} \rangle, k = \langle \text{value} \rangle \) and \( \text{inuxp1} = \langle \text{value} \rangle \).
**NE_NOT_NON_DECREASING**
On entry, the data \( x \) values are not nondecreasing for \( y = y[I - 1]: I = \langle \text{value} \rangle \) and \( y[I - 1] = \langle \text{value} \rangle \).
**NE_NOT.Strictly_Increasing**
On entry, \( I = \langle \text{value} \rangle, y[I - 1] = \langle \text{value} \rangle \) and \( y[I - 2] = \langle \text{value} \rangle \).
**NE_REAL_ARRAY**
On entry, \( \text{xmin}[I - 1] \) and \( \text{xmax}[I - 1] \) do not span the data \( x \) values on \( y = y[I - 1]: I = \langle \text{value} \rangle, \text{xmin}[I - 1] = \langle \text{value} \rangle, \text{xmax}[I - 1] = \langle \text{value} \rangle \) and \( y[I - 1] = \langle \text{value} \rangle \).
7 Accuracy
No error analysis for this method has been published. Practical experience with the method, however, is generally extremely satisfactory.
8 Parallelism and Performance
\( \text{nag_2d_cheb_fit_lines (e02cac)} \) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users’ Note for your implementation for any additional implementation-specific information.
9 Further Comments
The time taken is approximately proportional to \( k \times \left( k \times \left( \sum_{s=1}^{n} m[s - 1] \right) + n \times l^2 \right) \).
The reason for allowing \( x_{\text{max}} \) and \( x_{\text{min}} \) (which are used to normalize the range of \( x \)) to vary with \( y \) is that unsatisfactory fits can result if the highest (or lowest) data values of the normalized \( x \) on each line \( y = y_s \) are not approximately the same. (For an explanation of this phenomenon, see page 176 of
Clenshaw and Hayes (1965). Commonly in practice, the lowest (for example) data values \(x_{1,s}\), while not being approximately constant, do lie close to some smooth curve in the \((x, y)\) plane. Using values from this curve as the values of \(x_{\text{min}}\), different in general on each line, causes the lowest transformed data values \(\tilde{x}_{1,s}\) to be approximately constant. Sometimes, appropriate curves for \(x_{\text{max}}\) and \(x_{\text{min}}\) will be clear from the context of the problem (they need not be polynomials). If this is not the case, suitable curves can often be obtained by fitting to the lowest data values \(x_{1,s}\) and to the corresponding highest data values of \(x\), low degree polynomials in \(y\), using function \text{nag_1d_cheb_fit (e02adc)}, and then shifting the two curves outwards by a small amount so that they just contain all the data between them. The complete curves are not in fact supplied to the present function, only their values at each \(y_s\), and the values simply need to lie on smooth curves. More values on the complete curves will be required subsequently, when computing values of the fitted surface at arbitrary \(y\) values.
Naturally, a satisfactory approximation to the surface underlying the data cannot be expected if the character of the surface is not adequately represented by the data. Also, as always with polynomials, the approximation function may exhibit unwanted oscillations (particularly near the ends of the ranges) if the degrees \(k\) and \(l\) are taken greater than certain values, generally unknown but depending on the total number of coefficients \((k + 1) \times (l + 1)\) should be significantly smaller than, say not more than half, the total number of data points. Similarly, \(k + 1\) should be significantly smaller than most (preferably all) the \(m_s\), and \(l + 1\) significantly smaller than \(n\). Closer spacing of the data near the ends of the \(x\) and \(y\) ranges is an advantage. In particular, if \(\bar{y}_s = -\cos(\pi(s - 1)/(n - 1))\), for \(s = 1, 2, \ldots, n\) and \(\bar{x}_{r,s} = -\cos(\pi(r - 1)/(m - 1))\), for \(r = 1, 2, \ldots, m_s\) (thus \(m_s = m\) for all \(s\)), then the values \(k = m - 1\) and \(l = n - 1\) (so that the polynomial passes exactly through all the data points) should not give unwanted oscillations. Other datasets should be similarly satisfactory if they are everywhere at least as closely spaced as the above cosine values with \(m\) replaced by \(k + 1\) and \(n\) by \(l + 1\) (more precisely, if for every \(s\) the largest interval between consecutive values of \(\arccos \bar{x}_{r,s}\), for \(r = 1, 2, \ldots, m_s\), is not greater than \(\pi/k\), and similarly for the \(\bar{y}_s\)). The polynomial obtained should always be examined graphically before acceptance. Note that, for this purpose it is not sufficient to plot the polynomial only at the data values of \(x\) and \(y\); intermediate values should also be plotted, preferably via a graphics facility.
Provided the data are adequate, and the surface underlying the data is of a form that can be represented by a polynomial of the chosen degrees, the function should produce a good approximation to this surface. It is not, however, the true least squares surface fit nor even a polynomial in \(x\) and \(y\), the original variables (see Section 6 of Clenshaw and Hayes (1965), ), except in certain special cases. The most important of these is where the data values of \(x\) are the same on each line \(y = y_s\), (i.e., the data points lie on a rectangular mesh in the \((x, y)\) plane), the weights of the data points are all equal, and \(x_{\text{max}}\) and \(x_{\text{min}}\) are both constants (in this case they should be set to the largest and smallest data values of \(x\) respectively).
If the dataset is such that it can be satisfactorily approximated by a polynomial of degrees \(k'\) and \(l'\), say, then if higher values are used for \(k\) and \(l\) in the function, all the coefficients \(a_{ij}\) for \(i > k'\) or \(j > l'\) will take apparently random values within a range bounded by the size of the data errors, or rather less. (This behaviour of the Chebyshev coefficients, most readily observed if they are set out in a rectangular array, closely parallels that in curve-fitting, examples of which are given in Section 8 of Hayes (1970).) In practice, therefore, to establish suitable values of \(k'\) and \(l'\), you should first be seeking (within the limitations discussed above) values for \(k\) and \(l\) which are large enough to exhibit the behaviour described. Values for \(k'\) and \(l'\) should then be chosen as the smallest which do not exclude any coefficients significantly larger than the random ones. A polynomial of degrees \(k'\) and \(l'\) should then be fitted to the data.
If the option to force the fit to contain a given polynomial factor in \(x\) is used and if zeros of the chosen factor coincide with data \(x\) values on any line, then the effective number of data points on that line is reduced by the number of such coincidences. A similar consideration applies when forcing the \(y\)-direction. No account is taken of this by the function when testing that the degrees \(k\) and \(l\) have not been chosen too large.
10 Example
This example reads data in the following order, using the notation of the argument list for nag_2d_cheb_fit_lines (e02cac) above:
\[
\begin{align*}
&n \quad k \quad l \\
&y[i-1] \quad m[i-1] \quad \text{xmin}[i-1] \quad \text{xmax}[i-1], \quad \text{for } i = 1, 2, \ldots, n \\
&x[i-1] \quad f[i-1] \quad w[i-1], \quad \text{for } i = 1, 2, \ldots, \left( \sum_{s=1}^{n} m[s-1] \right).
\end{align*}
\]
The data points are fitted using nag_2d_cheb_fit_lines (e02cac), and then the fitting polynomial is evaluated at the data points using nag_2d_cheb_eval (e02cbc).
The output is:
- the data points and their fitted values;
- the Chebyshev coefficients of the fit.
10.1 Program Text
```c
/* nag_2d_cheb_fit_lines (e02cac) Example Program. */
/* Copyright 2014 Numerical Algorithms Group. */
/* Mark 7, 2001. */
#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nage02.h>
int main(void) {
/* Scalars */
double ymax;
Integer exit_status, i, j, k, l, mi, mj, n, r, t,
na, one;
NagError fail;
/* Arrays */
double *a = 0, *f = 0, *ff = 0, *w = 0,
*x = 0, *xmax = 0, *xmin = 0, *y = 0;
Integer *m = 0;
INIT_FAIL(fail);
exit_status = 0;
printf("nag_2d_cheb_fit_lines (e02cac) Example Program Results\n");
/* Skip heading in data file */
#ifdef _WIN32
scanf_s("%*[\n] ");
#else
scanf("%*[\n] ");
#endif
/* Input the number of lines Y = Y(I) on which data is given, */
/* and the required degree of fit in the X and Y directions */
#ifdef _WIN32
while (scanf_s("%"NAG_IFMT"%"NAG_IFMT"%"NAG_IFMT"%*[\n] ", &n, &k, &l) != EOF)
#else
while (scanf("%"NAG_IFMT"%"NAG_IFMT"%"NAG_IFMT"%*[\n] ", &n, &k, &l) != EOF)
#endif
{
printf("\n");
if (n > 0)
{
```
/* Allocate arrays \(m, y, \text{ xmin and xmax} \) */
if (!(m = NAG_ALLOC(n, Integer)) ||
! (y = NAG_ALLOC(n, double)) ||
! (xmin = NAG_ALLOC(n, double)) ||
! (xmax = NAG_ALLOC(n, double)))
{
printf("Allocation failure\n");
exit_status = -1;
goto END;
}
mj = 0;
/* Input \(Y(i), \) the number of data points on \(Y = Y(i)\) and the */
/* range of \(X\)-values on this line, for \(i = 1,2,...N\) */
for (i = 0; i < n; ++i)
{
#ifdef _WIN32
scanf_s("%lf\"NAG_IFMT\"%lf%f%\"[\"n\"] \", &y[i], &mi, &xmin[i],
&xmax[i]);
#else
scanf("%lf\"NAG_IFMT\"%lf%f%\"[\"n\"] \", &y[i], &mi, &xmin[i],
&xmax[i]);
#endif
m[i] = mi;
mj += mi;
}
/* Allocate arrays \(x, f, ff, w\) and \(a\) */
na = (k + 1) * (l + 1);
if (!(x = NAG_ALLOC(mj, double)) ||
! (f = NAG_ALLOC(mj, double)) ||
! (ff = NAG_ALLOC(mj, double)) ||
! (w = NAG_ALLOC(mj, double)) ||
! (a = NAG_ALLOC(na, double)))
{
printf("Allocation failure\n");
exit_status = -1;
goto END;
}
/* Input the \(X\)-values and function values, \(F\), together with */
/* their weights, \(W\). */
for (i = 0; i < mj; ++i)
{
#ifdef _WIN32
scanf_s("%lf%lf%lf", &x[i], &f[i], &w[i]);
#else
scanf("%lf%lf%lf", &x[i], &f[i], &w[i]);
#endif
#ifdef _WIN32
scanf("%*\"[\"n\"] \n");
#else
scanf("%*\"[\"n\"] \n");
#endif
}
/* Evaluate the coefficients, \(A\), of the fit to this set of data */
one = 1;
/* nag_2d_cheb_fit_lines (e02cac). */
/* Least-squares surface fit by polynomials, data on lines */
if (fail.code != NE_NOERROR)
{
printf(
"Error from nag_2d_cheb_fit_lines (e02cac).\n\n\n", fail.message);
exit_status = 1;
goto END;
}
printf(
printf(
Data Y Data X Data F Fitted F Residual
printf("\n");
mi = 0;
for (r = 1; r <= n; ++r)
{
t = mi + 1;
mi += m[r-1];
ymax = y[n-1];
if (n == 1)
ymax += 1.0;
/* Evaluate the fitted polynomial at each of the data points */
/* on the line Y = Y(R) */
/* nag_2d_cheb_eval (e02cbc). */
/* Evaluation of fitted polynomial in two variables */
/* nag_2d_cheb_eval(t, mi, k, l, x, xmin[r-1], xmax[r-1],
y[r-1], y[0], ymax, ff, a, &fail); */
if (fail.code != NE_NOERROR)
{
printf("Error from nag_2d_cheb_eval (e02cbc).\n%s\n",
fail.message);
exit_status = 1;
goto END;
}
/* Output the data and fitted values on the line Y = Y(R) */
for (i = t-1; i < mi; ++i)
{
printf("%11.4f%11.4f%11.4f%11.4f",
y[r-1], x[i], f[i], ff[i]);
printf("%11.2e\n", ff[i] - f[i]);
}
printf("\n");
}
/* Output the Chebyshev coefficients of the fit */
printf("Chebyshev coefficients of the fit\n");
printf("\n");
for (j = 1; j <= k + 1; ++j)
{
for (i = (j - 1) * (l + 1); i < j * (l + 1); ++i)
printf("%11.4f ", a[i]);
printf("\n");
}
END:
NAG_FREE(a);
NAG_FREE(f);
NAG_FREE(ff);
NAG_FREE(w);
NAG_FREE(x);
NAG_FREE(xmax);
NAG_FREE(xmin);
NAG_FREE(y);
NAG_FREE(m);
return exit_status;
10.2 Program Data
\texttt{nag\_2d\_cheb\_fit\_lines (e02cac) Example Program Data}
\begin{verbatim}
4 3 2
0.0 8 0.0 5.0
1.0 7 0.1 4.5
2.0 7 0.4 4.0
4.0 6 1.6 3.5
0.1 1.0 1.01005 1.0
1.0 1.1 1.10517 1.0
1.6 1.6 1.17351 1.0
2.1 2.1 1.23368 1.0
3.3 3.3 1.39097 1.0
3.9 3.9 1.47698 1.0
4.2 4.2 1.52196 1.0
4.9 4.9 1.63232 1.0
0.1 1.0 2.02010 1.0
1.1 1.1 2.23256 1.0
1.9 1.9 2.41850 1.0
2.7 2.7 2.61993 1.0
3.2 3.2 2.75426 1.0
4.1 4.1 3.01364 1.0
4.5 4.5 3.13662 1.0
0.5 0.5 3.15381 1.0
1.1 1.1 3.34883 1.0
1.3 1.3 3.41649 1.0
2.2 2.2 3.73823 1.0
2.9 2.9 4.00928 1.0
3.5 3.5 4.25720 1.0
3.9 3.9 4.43094 1.0
1.7 1.7 5.92652 1.0
2.0 2.0 6.10701 1.0
2.4 2.4 6.35625 1.0
2.7 2.7 6.54982 1.0
3.1 3.1 6.81713 1.0
3.5 3.5 7.09534 1.0
\end{verbatim}
10.3 Program Results
\texttt{nag\_2d\_cheb\_fit\_lines (e02cac) Example Program Results}
\begin{verbatim}
<table>
<thead>
<tr>
<th>Data Y</th>
<th>Data X</th>
<th>Data F</th>
<th>Fitted F</th>
<th>Residual</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.0000</td>
<td>0.1000</td>
<td>1.0100</td>
<td>1.0175</td>
<td>7.40e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>1.0000</td>
<td>1.1052</td>
<td>1.1126</td>
<td>7.39e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>1.6000</td>
<td>1.1735</td>
<td>1.1809</td>
<td>7.43e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>2.1000</td>
<td>1.2337</td>
<td>1.2412</td>
<td>7.55e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>3.3000</td>
<td>1.3910</td>
<td>1.3992</td>
<td>8.19e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>3.9000</td>
<td>1.4770</td>
<td>1.4857</td>
<td>8.72e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>4.2000</td>
<td>1.5220</td>
<td>1.5310</td>
<td>9.03e-03</td>
</tr>
<tr>
<td>0.0000</td>
<td>4.9000</td>
<td>1.6323</td>
<td>1.6422</td>
<td>9.83e-03</td>
</tr>
<tr>
<td>1.0000</td>
<td>0.1000</td>
<td>2.0201</td>
<td>1.9987</td>
<td>-2.14e-02</td>
</tr>
<tr>
<td>1.0000</td>
<td>1.0000</td>
<td>2.3226</td>
<td>2.3110</td>
<td>-2.16e-02</td>
</tr>
<tr>
<td>1.0000</td>
<td>1.9000</td>
<td>2.4185</td>
<td>2.3962</td>
<td>-2.23e-02</td>
</tr>
<tr>
<td>1.0000</td>
<td>2.7000</td>
<td>2.6199</td>
<td>2.5966</td>
<td>-2.34e-02</td>
</tr>
<tr>
<td>1.0000</td>
<td>3.2000</td>
<td>2.7543</td>
<td>2.7299</td>
<td>-2.43e-02</td>
</tr>
<tr>
<td>1.0000</td>
<td>4.1000</td>
<td>3.0136</td>
<td>2.9869</td>
<td>-2.68e-02</td>
</tr>
<tr>
<td>1.0000</td>
<td>4.5000</td>
<td>3.1366</td>
<td>3.1084</td>
<td>-2.82e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>0.5000</td>
<td>3.1538</td>
<td>3.1700</td>
<td>1.62e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>1.1000</td>
<td>3.3488</td>
<td>3.3648</td>
<td>1.60e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>1.3000</td>
<td>3.4165</td>
<td>3.4325</td>
<td>1.60e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>2.2000</td>
<td>3.7382</td>
<td>3.7549</td>
<td>1.66e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>2.9000</td>
<td>4.0093</td>
<td>4.0272</td>
<td>1.79e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>3.5000</td>
<td>4.2572</td>
<td>4.2769</td>
<td>1.97e-02</td>
</tr>
<tr>
<td>2.0000</td>
<td>3.9000</td>
<td>4.4309</td>
<td>4.4521</td>
<td>2.12e-02</td>
</tr>
<tr>
<td>4.0000</td>
<td>1.7000</td>
<td>5.9265</td>
<td>5.9231</td>
<td>-3.42e-03</td>
</tr>
<tr>
<td>4.0000</td>
<td>2.0000</td>
<td>6.1070</td>
<td>6.1036</td>
<td>-3.41e-03</td>
</tr>
</tbody>
</table>
\end{verbatim}
Chebyshev coefficients of the fit
15.3482 5.1507 0.1014
1.1472 0.1442 -0.1046
0.0490 -0.0031 -0.0070
0.0015 -0.0003 -0.0002
Example Program
Calculation and Evaluation of Least-squares Bi-variate Polynomial Fit
|
{"Source-Url": "https://www.nag.com/numeric/cl/nagdoc_cl25/pdf/e02/e02cac.pdf", "len_cl100k_base": 10206, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 39109, "total-output-tokens": 11544, "length": "2e13", "weborganizer": {"__label__adult": 0.0003211498260498047, "__label__art_design": 0.0006036758422851562, "__label__crime_law": 0.0003859996795654297, "__label__education_jobs": 0.0013093948364257812, "__label__entertainment": 0.00011783838272094728, "__label__fashion_beauty": 0.00018906593322753904, "__label__finance_business": 0.00025272369384765625, "__label__food_dining": 0.0005564689636230469, "__label__games": 0.0008139610290527344, "__label__hardware": 0.0016689300537109375, "__label__health": 0.0005478858947753906, "__label__history": 0.00042629241943359375, "__label__home_hobbies": 0.0002027750015258789, "__label__industrial": 0.0008258819580078125, "__label__literature": 0.00026679039001464844, "__label__politics": 0.0003273487091064453, "__label__religion": 0.0006051063537597656, "__label__science_tech": 0.1854248046875, "__label__social_life": 0.00015175342559814453, "__label__software": 0.020050048828125, "__label__software_dev": 0.78369140625, "__label__sports_fitness": 0.0003342628479003906, "__label__transportation": 0.00046372413635253906, "__label__travel": 0.0002503395080566406}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 27993, 0.09598]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 27993, 0.73188]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 27993, 0.69911]], "google_gemma-3-12b-it_contains_pii": [[0, 3811, false], [3811, 5957, null], [5957, 9562, null], [9562, 12093, null], [12093, 15216, null], [15216, 20515, null], [20515, 22373, null], [22373, 24118, null], [24118, 25455, null], [25455, 27782, null], [27782, 27993, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3811, true], [3811, 5957, null], [5957, 9562, null], [9562, 12093, null], [12093, 15216, null], [15216, 20515, null], [20515, 22373, null], [22373, 24118, null], [24118, 25455, null], [25455, 27782, null], [27782, 27993, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 27993, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 27993, null]], "pdf_page_numbers": [[0, 3811, 1], [3811, 5957, 2], [5957, 9562, 3], [9562, 12093, 4], [12093, 15216, 5], [15216, 20515, 6], [20515, 22373, 7], [22373, 24118, 8], [24118, 25455, 9], [25455, 27782, 10], [27782, 27993, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 27993, 0.06265]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
db5c46998713161fa352263676e4f1605317527f
|
Adapting the Proofs-as-Programs to Imperative SML
Iman Poernomo
School of Computer Science & Software Engineering
Monash University
Australia
Overview
- Constructive Program Synthesis
- The Curry-Howard protocol
- Proofs-as-imperative-programs
- Conclusions
Constructive program synthesis
- Proofs-as-programs
- 30 years of research
- Martin-Lof’s type theory
- Nuprl
- Calculus of Constructions
- Hayashi’s PX
- Tyugu’s SSL
- Two approaches
- basic
- transformative
The general idea
- Build a constructive proof of a specification
- During a constructive proof, the user must provide information to derive the specification
- This information is used to derive a correct program that satisfies the specification
- Constructive information is encoded via a type theoretic representation of proofs, according to the Curry-Howard isomorphism
The Curry-Howard isomorphism
First described by Curry and extended to first-order logic by Howard
Constructive logic corresponds to a type theory
- Proofs are encoded as terms of a lambda calculus with disjoint unions, dependent products and sums
- Proven formulae can be considered to be types of proof terms
- Proof rules correspond to type inference rules
- Valid typing defines a realizability relation between formulae and terms
- Normalization is lambda reduction
Example: ND rules as type inference rules
Introduction rule for universal quantification corresponds to a type inference rule for lambda abstraction with dependent product type
\[
\frac{\Delta \vdash A[y/x]}{\Delta \vdash \forall x : s \cdot A} \quad (\forall\text{-I})
\]
\[
\frac{\Delta \vdash p^A[y/x]}{\Delta \vdash \lambda x : s. p^{\forall x : s \cdot A}} \quad (\forall\text{-I})
\]
Elimination rule for universal quantification corresponds to a type inference rule for lambda application with instantiation of dependent product type
\[
\frac{\Delta \vdash \forall x : s \cdot A}{\Delta \vdash A[c/x]} \quad (\forall\text{-E})
\]
\[
\frac{\Delta \vdash p^{\forall x : s \cdot A}}{\Delta \vdash app(p, c)^A[c/x]} \quad (\forall\text{-E})
\]
Example: Encoding a proof as a lambda term
\[
\begin{align*}
\forall x : \text{int}. x &= x & \text{Axiom} \\
\text{input} \ast 2 &= \text{input} \ast 2 & \forall - E \\
\exists \text{output} : \text{int}. \text{output} &= \text{input} \ast 2 & \exists - I \\
\forall \text{input} : \text{int}. \exists \text{output} : \text{int}. \text{output} &= \text{input} \ast 2 & \forall - I
\end{align*}
\]
\[
\lambda \text{input} : \text{int}. (\text{input} \ast 2, \text{app}(\text{Axiom}, \text{input} \ast 2)) \forall \text{input} : \text{int}. \exists \text{output} : \text{int}. \text{output} = \text{input} \ast 2
\]
Normalization
- Proof normalization corresponds to lambda reduction
- Example: Redundant introduction and elimination of an implication is normalized thus
\[
\frac{x}{A \vdash A} \quad \frac{a}{B \vdash A \rightarrow B} \quad \frac{(\Rightarrow-I) \quad b}{A \vdash B} \quad \frac{(\Rightarrow-E)}{B}
\]
which reduces to
\[
app(\lambda x. a^{(A\rightarrow B)}, b^A) \triangleright a[b/X]^B
\]
With corresponding lambda reduction rule
Basic proofs-as-programs
Based directly on the Curry-Howard isomorphism
The lambda calculus of the logical type theory is considered as a programming language
Formulae = types = specifications of required realizing programs
Normalization = lambda term reduction = program evaluation
Program specifications
E.g., Input/Output specification of a program
\[ \forall input : \text{int.} \exists output : \text{int.} \quad output = input \times 2 \]
Given any integer input
There is an integer output
Require a program whose output is equal to the input \( \times 2 \)
Realizability
*This approach to proofs-as-programs takes realizability to correspond to correct typing*
Well-typed terms, as realizers, do two things:
- Yield a correct program with respect to a specification
- Contain a proof of correctness of the program
Example: proof as a program
Given a constructive proof of
$$\forall x : t \bullet \exists y : s \bullet A(x, y)$$
we can form a corresponding term $p$ in the logical type theory of the form
$$\lambda x : t. (g_1(x) : s, g_2(x) A(x, y)) \forall x : t \bullet \exists y : s \bullet A(x, y)$$
Example: proof as realizing program
The proof-term $p$ is considered to be a program such that,
- on every input $x : t$, the evaluation of $app(p \ x)$ terminates (by strong normalization)
- the first projection $\pi_1 app(p \ x)$ of the output is such that
\[ A(x, \pi_1 app(p \ x)) \]
holds – satisfying the derived specification formula.
- the second projection $\pi_2 app(p \ x)$ is a proof of this.
Two problems with the basic approach (1)
Usability of proofs terms considered as programs:
- Commonly used programming languages (such as SML, Haskell, C++ with STL or Java) do not have dependent sum and product type constructors -- essential for defining types that correspond to AE specifications.
- Execution of realizing terms requires custom-built compiler or interpreter for the type theory.
- For larger scale practical programming problems, this can result in inefficient code that is not readily interoperable or maintainable.
Two problems with the basic approach (2)
Efficiency of proof terms considered as programs:
- A further problem is that lambda terms corresponding to constructive proofs often encode *computationally irrelevant*, non-constructive information.
- Such irrelevant information is introduced when proving Harrop formulae.
Transformative approaches
Based on the Curry-Howard isomorphism, but with additional program transformation
Two type theories involved:
- constructive logical type theory (LTT) for representing proofs
- a commonly used functional programming language (e.g., SML)
Specification of programs given by a different modified realizability relation between formulae and programs
Proof terms in the LTT are transformed into programs that satisfy the proved specification formulae (as modified realizers)
Modified realizability
Our modified realizers are simply typed SML programs – they are correct with respect to a specification, but do not carry proofs of correctness with them.
Formally, a program p is a modified realizer of a formula A when p can be used in place of the Skolem function for the Skolem form of A:
That is, when
$$\text{Sk}(A)[p/f_A]$$
is provable
Skolem form (1)
<table>
<thead>
<tr>
<th>$F$</th>
<th>$\text{xsort}(F')$</th>
</tr>
</thead>
<tbody>
<tr>
<td>$P(\bar{a})$</td>
<td>$\text{Unit}$</td>
</tr>
<tr>
<td>$A \land B$</td>
<td>$\begin{cases} \text{xsort}(A) & \text{if not Harrop}(B) \ \text{xsort}(B) & \text{if not Harrop}(A) \ \text{xsort}(A) \ast \text{xsort}(B) & \text{otherwise} \end{cases}$</td>
</tr>
<tr>
<td>$A \lor B$</td>
<td>$\text{xsort}(A) \mid \text{xsort}(B)$</td>
</tr>
<tr>
<td>$A \rightarrow B$</td>
<td>$\begin{cases} \text{xsort}(B) & \text{if not Harrop}(B) \ \text{xsort}(A) \rightarrow \text{xsort}(B) & \text{otherwise} \end{cases}$</td>
</tr>
<tr>
<td>$\forall x : S.A$</td>
<td>$s \rightarrow \text{xsort}(A)$</td>
</tr>
<tr>
<td>$\exists x : S.A$</td>
<td>$\begin{cases} s & \text{if Harrop}(A) \ s \ast \text{xsort}(A) & \text{otherwise} \end{cases}$</td>
</tr>
<tr>
<td>$\bot$</td>
<td>$\text{Unit}$</td>
</tr>
</tbody>
</table>
Skolem form (2)
(Skolem form and Skolem functions). Given a closed formula $A$, we define the Skolemization of $A$ to be the Harrop formula $Sk(A) = Sk'(A, \emptyset)$, where $Sk'(A, AV)$ is defined as follows. A unique function letter $f_A$ (of sort corresponding to SML type $\text{xsort}(A)$) called the Skolem function, is associated with each $A$. $AV$ represents a list of variables which will be arguments of $f_A$.
If $A$ is Harrop, then $Sk'(A, AV) \equiv A$.
If $A \equiv B \lor C$, then
$$Sk'(A, AV) = (\forall x : \text{xsort}(A). f_A(AV) = \text{Inl}(x) \rightarrow Sk'(B, AV)[x/f_B])$$
$$\land (\forall y : \text{xsort}(B). f_B(AV) = \text{Inr}(y) \rightarrow Sk(C, AV)[y/f_C])$$
If $A \equiv B \land C$, then
$$Sk'(A, AV) = Sk'(B, AV)[\text{fst}(f_A)/f_B] \land Sk'(C, AV)[\text{snd}(f_A)/f_C]$$
If $A \equiv B \rightarrow C$, then
1) if $B$ is Harrop, $Sk'(A, AV) = B \rightarrow Sk'(C, AV)[f_A/f_C]$.
2) if $B$ is not Harrop and $C$ is not Harrop,
$$Sk'(A, AV) = \forall x : s.(Sk'(B, AV)[x/f_B] \rightarrow Sk'(C, AV)[(f_Ax)/f_C])$$
If $A \equiv \exists y : s.P$, then
1) when $P$ is Harrop, $Sk'(A, AV) = Sk'(P, AV)[f_A(AV)/y]$
2) when $P$ is not Harrop, $Sk'(A, AV) = Sk'(P, AV)[\text{fst}(f_A(AV))/y][\text{snd}(f_A(AV))/f_P]$.
If $A \equiv \forall x : s.P$, then $Sk'(A, AV) = \forall x. Sk'(P, AV)[(f_Ax)/f_P]$.
Skolem form
The Skolem form of
\[ \text{dbConnected} \lor \neg \text{dbConnected} \]
is equivalent to
\[ f = \text{inl}() \rightarrow \text{dbConnected} \land \]
\[ f = \text{inr}() \rightarrow \neg \text{dbConnected} \]
A modified realizer is a function \( f \) that says if there is a connection to the db or not
Modified realizer does not prove this fact – it exists in a separate language
Transforming proofs into programs
We use an *extraction map* to transform a proof-term into a program — the program is correct in the sense that it is a modified realizer of the formula.
The map does the following:
- Normalizes the proof, simplifying the proof-term by applying reduction rules of the lambda calculus.
- Removes “useless” non-constructive information from the proof term.
Normalization is *not* evaluation — the resulting program evaluates according to the semantics of the target programming language.
Extraction
\[ \lambda \text{input} : \text{int.} \ (\text{input} \times 2, \ \text{app}(\text{Axiom}, \ \text{input} \times 2)) \]
Constructive information
"Useless" non-constructive information
Normalize, then extract SML program from proof-term
This program is a modified realizer of the derived formula
fun input : int -> input * 2
In C/Java, this program might be written
function (int input) {return input*2;}
The Curry-Howard protocol
The problem
How should this transformative style of program synthesis be generalized over arbitrary logics and programming paradigms?
Logics: Linear logic, Modal logics, Hoare logic, Hennessy-Milner proof systems, etc.
Programming paradigms: Imperative, structured, object-oriented, parallelism, etc.
The protocol
- We identify a ontology of roles and relations that abstract the entities and relations of transformative proofs-as-programs.
- We claim that good, useful adaptations of proofs-as-programs are achieved by identifying these roles and relations in new contexts.
## Roles in the protocol
<table>
<thead>
<tr>
<th>Rôle</th>
<th>Domain in the Curry-Howard protocol</th>
<th>Properties of domain</th>
</tr>
</thead>
<tbody>
<tr>
<td>Logic</td>
<td>Natural deduction system</td>
<td>A formal system that defines a logical calculus.</td>
</tr>
<tr>
<td>Proofs</td>
<td>Logical type theory (<em>LTT</em>)</td>
<td>A type theory that enables encoding of proofs in the logical calculus, according to the Curry-Howard isomorphism: types denote statements, terms denotes proofs and type inference corresponds to logical inference.</td>
</tr>
<tr>
<td>Programming language</td>
<td>Computational type theory (<em>CTT</em>)</td>
<td>A type theory for the programming language, equipped with an operational semantics.</td>
</tr>
</tbody>
</table>
The protocol requires
- a realizability relation realizes between formulae of programs of the $CTT$ and the $LTT$
- a program extraction and optimization map extract from proofs of the $LTT$ to programs of the $CTT$ such that, given a proof of a specification, the extracted program should realize the specification.
Relations between the roles (2)
The concepts of the protocol are related according to the following diagram (with $t^S$ denoting a proof-term $t$ of $S$ in the logical type theory):
$LTT$: $t_1^S$ \(\xrightarrow{\text{normalizes to}}\) $t_2^S$
extract
$CTT$: $p_1$ realizes $S$ \(\xrightarrow{\text{computationally equivalent}}\) $p_2$ realizes $S$
A useful generalizing framework?
It can be seen that functional/constructive logic transformative proofs-as-programs conforms to this framework.
The usefulness of the protocol as a generalization can only be shown through applications to new logics and programming languages.
Application: Proofs-as-imperative programs
Problem
- Proofs-as-programs approach generates *functional* programs – programs that do not use state
- Imperative programs use state: e.g.
\[
s := s + 10
\]
is an imperative program that increments the state \( s \) by 10
- Want to be able to adapt proofs-as-programs to *Hoare logic* for synthesis of correct *return values*
Hoare Logic
Hoare Logic allows us to build imperative programs that are correct for a specification.
Specifications take the form of pre- and post-conditions.
\[ \text{correct}(\text{pin}) = true \rightarrow \text{db.status'} = \text{connected} \]
Pre-condition: assume the \textit{state}_{\text{pin}} is initially acceptable by the program.
Post-condition: the final status of the database is that it must be connected.
Hoare logic
Rules of the logic allow us to (simultaneously) deduce new truths about programs from old and to form new programs from old.
If \( b \) is true, after running \( l_1 \), \( C \) is true.
If \( b \) is true, after running \( l_2 \), \( C \) is true.
If \( b \) is true, after running \( \text{if } b \text{ then } l_1 \text{ else } l_2 \), \( C \) is true.
\[
\begin{align*}
l_1 \cdot b &= \text{true} \rightarrow C \\
l_2 \cdot b &= \text{false} \rightarrow C \\
\text{if } b \text{ then } l_1 \text{ else } l_2 \cdot C
\end{align*}
\]
after running if \( b \) then \( l_1 \) else \( l_2 \), \( C \) is true.
(because when \( b \) is true, \( l_1 \) is executed and \( C \) is true – similarly, when \( b \) is false, \( l_2 \) is executed and \( C \) is still true)
Correct synthesis of return values
The presence of side-effects is what distinguishes the imperative paradigm from the functional one. However, side-effect-free return values are also important in imperative programs because they enable access to data, obtaining views of state. For example, the SML program
\[ s := 10; \ !s \times 2 \]
involves a side-effect producing assignment statement, \( s := 10 \) followed by a side-effect-free term \( !s \times 2 \), which will evaluate to a return value.
We want to adapt the constructive approaches to specify and extract imperative programs with return values.
How to adapt constructive results?
- Follow the Curry-Howard protocol
- Design a constructive version of Hoare logic (natural deduction system)
1) Design augmented lambda terms to encode proofs in Hoare logic to form a Logical Type Theory
2) Consider subset of imperative SML programs with return values as the Computational Type theory
3) Define a notion of realizability between LTT and CTT
4) Define extraction map to transform proofs of specifications into programs that realize the specifications
Constructive Hoare logic
We consider a constructive version of Hoare logic.
5 core rules parametrized over the usual intuitionistic rules: e.g.,
\[
\frac{\Delta \vdash_{\text{int}} P[a/y]}{\Delta \vdash_{\text{int}} \exists y : s \bullet P} \quad (\exists\text{-I})
\]
\[
\frac{\Delta_1 \vdash_{\text{int}} \exists y : s \bullet P \quad \Delta_2, P[x/y] \vdash_{\text{int}} C}{\Delta_1, \Delta_2 \vdash_{\text{int}} C} \quad (\exists\text{-E})
\]
where \( x \) not occur free in \( C \)
\[
\frac{\Delta \vdash_{\text{int}} A \quad \Delta' \vdash_{\text{int}} B}{\Delta, \Delta' \vdash_{\text{int}} (A \land B)} \quad (\land\text{-I})
\]
Core rules
\[ \vdash_{\text{IHL}} s := v \leadsto s_f = \text{tologic}_{i}(v) \]
(assign)
where \( s \in \text{StateRef} \).
\[ \vdash_{\text{IHL}} p \leadsto (\text{tologic}_{i}(b) = \text{true} \rightarrow C) \quad \vdash_{\text{IHL}} q \leadsto (\text{tologic}_{i}(b) = \text{false} \rightarrow C) \]
(ite)
\[ \vdash_{\text{IHL}} \quad \text{if } b \text{ then } p \text{ else } q \leadsto C \]
\[ \vdash_{\text{IHL}} p \leadsto (A[\bar{s}_i/\bar{v}] \Rightarrow B[\bar{s}_f/\bar{v}]) \quad \vdash_{\text{IHL}} q \leadsto (B[\bar{s}_i/\bar{v}] \Rightarrow C[\bar{s}_f/\bar{v}]) \]
(seq)
\[ \vdash_{\text{IHL}} p; q \leadsto (A[\bar{s}_i/\bar{v}] \Rightarrow C[\bar{s}_f/\bar{v}]) \]
where \( A \) and \( B \) are free of state identifiers.
\[ \vdash_{\text{IHL}} q \leadsto (\text{tologic}_{i}(b) = \text{true} \land A[\bar{s}_i/\bar{v}] \Rightarrow A[\bar{s}_f/\bar{v}] \]
(loop)
\[ \vdash_{\text{IHL}} \quad \text{while } b \text{ do } q \leadsto A[\bar{s}_i/\bar{v}] \Rightarrow (A[\bar{s}_f/\bar{v}] \land \text{tologic}_{f}(b) = \text{false}) \]
where \( A \) is free of state identifiers.
\[ \vdash_{\text{IHL}} p \leadsto P \quad \vdash_{\text{Int}} (P \Rightarrow A) \]
(cons)
\[ \vdash_{\text{IHL}} p \leadsto A \]
Logical type theory
- Program/formulae pairs used in the Hoare logic are treated as types in a corresponding type theory.
- An augmented lambda calculus is used with extra constructors corresponding to applications of the core rules.
- A typing judgment corresponds to a proof derivation.
Core type inference rules
\( \vdash_{LTT(IHL)} \text{assign}(s, v)^{s:=v \diamond s_f \Rightarrow \text{tologic}_i(v)} \) (assign)
where \( s \in \text{StateRef} \)
\( \vdash_{LTT(IHL)} q_1^{\top_1 \diamond (\text{tologic}_i(b) = \text{true} \Rightarrow C)} \) \( \vdash_{LTT(IHL)} q_2^{\top_2 \diamond (\text{tologic}_i(b) = \text{false} \Rightarrow C)} \)
\( \vdash_{LTT(IHL)} \text{ite}(q_1, q_2) \) \text{if } b \text{ then } l_1 \text{ else } l_2 \diamond C \) (ite)
\( \vdash_{LTT(IHL)} p^{\top_1 \diamond (A[\bar{s}_i/\bar{v}] \Rightarrow B[\bar{s}_f/\bar{v}])} \) \( \vdash_{LTT(IHL)} q^{\top_2 \diamond (B[\bar{s}_i/\bar{v}] \Rightarrow C[\bar{s}_f/\bar{v}])} \)
\( \vdash_{LTT(IHL)} \text{seq}(p^{\top_1 \diamond (A[\bar{s}_i/\bar{v}] \Rightarrow B[\bar{s}_f/\bar{v}])}, q^{\top_2 \diamond (B[\bar{s}_i/\bar{v}] \Rightarrow C[\bar{s}_f/\bar{v}])})^{w_1;w_2 \diamond (A[\bar{s}_i/\bar{v}] \Rightarrow C[\bar{s}_f/\bar{v}])} \) (seq)
where \( A \) and \( B \) do not contain any state identifiers
\( \vdash_{LTT(IHL)} q^{\top \diamond (\text{tologic}_i(b) = \text{true} \wedge A[\bar{s}_i/\bar{v}] \Rightarrow A[\bar{s}_f/\bar{v}])} \) (loop)
\( \vdash_{LTT(IHL)} \text{wd}(q)^{\text{while } b \text{ do } w \diamond (A[\bar{s}_i/\bar{v}] \Rightarrow (A[\bar{s}_f/\bar{v}] \wedge \text{tologic}_f(b) = \text{false}))} \)
where \( A \) does not contain any state identifiers
\( \vdash_{LTT(IHL)} q_1^{p \diamond P} \) \( \vdash_{LTT(IHL)} q_2^{(P \Rightarrow A)} \)
\( \vdash_{LTT(IHL)} \text{cons}(q_1, q_2)^{p \diamond A} \) (cons)
A program $p$ is a *return value realizer* of formula $A$ when all return values of $p$ are modified realizers of $A$
- I.e., for each evaluation of the program $p$, $Sk(A)'[r/f_A]$ is true, where $r$ is a representation of the return value and $Sk(A)'$ is $Sk(A)$ with initial and final values of the run substituted for corresponding state references
Example
\[ s := s \times 3; !s \times 2 \]
is a return value realizer of
\[ s := s \times 3 \bullet s_f > s_i \land (\exists x : \text{int} \bullet Even(x) \land x > s_i) \]
because, for every evaluation
\[ \langle s := s \times 3; !s \times 2, \sigma \rangle \triangleright \langle \text{answer}, \sigma' \rangle \]
it is true that
\[ \sigma'(s) > \sigma(s) \land (Even(\text{answer}) \land answer > \sigma(s)) \]
Realizability
An SML program $p$ with return values realizes a specification in the Hoare logic $q \triangleleft A$ when
- $p$ has the required side-effects that are specified by $A$, just like $q$ does
- $p$ is a return value realizer of $A$ – all return values form modified realizers of $A$
Extraction
- We extend the extraction map of ordinary proofs-as-programs to our case, to extract return-value realizers from proofs in the Hoare logic.
- The map is from our LTT to our CTT (SML with return values).
Example cases:
<table>
<thead>
<tr>
<th>$\overrightarrow{wT}$</th>
<th>extract_{IHL}(t)</th>
</tr>
</thead>
<tbody>
<tr>
<td>any proof-term $t$ with $H(T)$</td>
<td>$w$</td>
</tr>
<tr>
<td>$\text{wd}(u)\text{while } b \text{ do } l \circ P$ where $P$ is $A[\bar{s}_i / \bar{u}] \Rightarrow (A[\bar{s}_f / \bar{u}] \land \text{tologic}_f(b) = false)$</td>
<td>$rv_1 := \text{fn } x : \text{etype}(A) => x;$ while $b$ do $rv_2 := \text{extract}_{IHL}(q);$ $rv_1 := (\text{fn } x_2 :: x_1 => \text{fn } x : \text{etype}(A) => x_2(x_1 x))$ !$rv_2$ !$rv_1 ;$ !$rv_1 ;$</td>
</tr>
<tr>
<td>$\text{ite}(q_1, q_2) \text{if } b \text{ then } l_1 \text{ else } l_2 \circ C$</td>
<td>if $b$ then extract($q_1$) else extract($q_2$)</td>
</tr>
</tbody>
</table>
- Extraction over Harrop terms is trivial: the program of the program/formula pair is used (only side-effects are important)
- Extraction over (ite) case results in conditional statement with alternate return values
- Extraction over while-loop term is complicated in the non-Harrop case, due to iterated application of the functional return value for the looped term
Example cases
<table>
<thead>
<tr>
<th>$t^w{\Theta}$</th>
<th>$\text{extract}_{\text{IHL}}(t)$</th>
</tr>
</thead>
</table>
| seq($p^{w_1\circ P}, q^{w_2\circ Q})^{w_3\circ A[\bar{s}_I/\bar{v}]} \Rightarrow C[\bar{s}_f/\bar{v}]$) | \[
\begin{align*}
\text{rv}_p & := \text{extract}(p); \\
\text{rv}_q & := \text{extract}(q); \\
(\text{fn } x_p & => \text{fn } x_q => \\
\text{fn } x & : \text{etype}(A) => x_q (x_p x)) \\
!\text{rv}_p \! & \! \text{rv}_q
\end{align*}
\]
not $H(A)$
not $H(B)$
and
not $H(C)$ |
| $P$ is $A[\bar{s}_I/\bar{v}] \Rightarrow B[\bar{s}_f/\bar{v}]$ | \[
\begin{align*}
\text{rv}_p & := \text{extract}(p); \\
\text{rv}_q & := \text{extract}(q); \\
\text{rv}_q \! \text{rv}_p
\end{align*}
\]
$H(A)$
not $H(B)$
and not $H(C)$ |
| $Q$ is $B[\bar{s}_I/\bar{v}] \Rightarrow C[\bar{s}_f/\bar{v}]$ | \[
\begin{align*}
\text{rv}_q & := \text{extract}(q); \\
!\text{rv}_q
\end{align*}
\]
$H(A)$
$H(B)$
and
not $H(C)$ |
| $w;$ | \[
\begin{align*}
\text{rv}_q & := \text{extract}(q); \\
!\text{rv}_q
\end{align*}
\]
not $H(A)$
and $H(B)$
and
not $H(C)$ |
Example extraction case: (seq) rule
\[
\vdash_{LTT(IHL)} p_{w_1}^\diamond (A[s_i/v] \Rightarrow B[s_f/v]) \quad \vdash_{LTT(IHL)} q_{w_2}^\diamond (B[s_i/v] \Rightarrow C[s_f/v])
\]
\[
\vdash_{LTT(IHL)} \text{seq}(p_{w_1}^\diamond (A[s_i/v] \Rightarrow B[s_f/v]), q_{w_2}^\diamond (B[s_i/v] \Rightarrow C[s_f/v]))_{w_1; w_2}^\diamond (A[s_i/v] \Rightarrow C[s_f/v])
\]
If all formulae used are non-Harrop, then return values for sub-terms are functions – the output of the first is passed as input to the second to give the required return value overall.
\[
\begin{align*}
r_v_p & := \text{extract}(p); \\
r_v_q & := \text{extract}(q); \\
(\text{fn } x_p & \Rightarrow \text{fn } x_q \Rightarrow \\
\text{fn } x & : \text{etype}(A) & \Rightarrow x_q (x_p x)) \\
!r_v_p & !r_v_q
\end{align*}
\]
ATM Example: specification of return values
Example specification: ATM Bank machine
- user puts in card, enters PIN number (denoted by state pin)
- irrespective of whether the PIN is incorrect or not, we require an appropriate response send to the ATM screen
Return value specified as required return value realizer
\[ InMachine(pin) \rightarrow \exists x : \text{string.appropriateResponse}(x) \]
Pre-condition – PIN has been entered into machine
Require a return value x that is an appropriate response
ATM example
We use the following axioms that define the domain knowledge about the behaviour of the ATM machine.
This axiom says that, for any program, if the card is destroyed, it is appropriate to tell the user about it:
\[
\begin{align*}
\text{any} \cdot \text{card_destroyed}' &= \text{true} \rightarrow \text{appropriateResponse} \left( \text{"Your card has been destroyed"} \right) \\
\text{any} \cdot \text{db.status}' &= \text{connected} \rightarrow \text{appropriateResponse} \left( \begin{array}{l}
\text{Menu} \\
(1) \text{Withdraw} \\
(2) \text{Deposit} \\
(3) \text{Balance}
\end{array} \right) \\
\text{correct_pin_action} \cdot \left( \text{InMachine}(\text{pin}) \rightarrow \text{correct}(\text{pin}) = \text{true} \rightarrow \text{db.status}' = \text{connected} \right) \\
\text{incorrect_pin_action} \cdot \left( \text{InMachine}(\text{pin}) \rightarrow \text{correct}(\text{pin}) = \text{false} \rightarrow \text{card_destroyed}' = \text{true} \right)
\end{align*}
\]
This program destroys the card if the PIN is incorrect.
Example: Extended lambda terms
- We define new lambda terms to represent proofs in a constructive version of Hoare logic.
- We can use Hoare logic to prove specification
\[ \text{InMachine}(\text{pin}) \rightarrow \exists x : \text{string.appropriateResponse}(x) \]
we obtain a proof of
\[
\left( \begin{array}{l}
\text{if } \text{correct}(\text{pin}) \\
\text{then } \text{correct\_pin\_action} \\
\text{else } \text{incorrect\_pin\_action}
\end{array} \right) \quad \text{InMachine}(\text{pin}) \rightarrow \exists x : \text{string.appropriateResponse}(x)
\]
with proof-term …
\[ \text{itecase}(\lambda Y. Z. \text{app}(< (\text{Axiom}(\text{any } \bullet \text{db.status'} = \text{connected} \rightarrow \\
\text{appropriateResponse}(\text{"Menu (1) Withdraw (2) Deposit (3) Balance"}), \text{correct_pin_action}), \text{app}(\text{app}(\text{Axiom}(\text{correct_pin_action } \bullet \text{InMachine}(\text{pin}) \\
\rightarrow \text{correct}(\text{pin}) = \text{true} \rightarrow \text{db.status'} = \text{connected}), \\
Z^{\text{correct_pin_action } \bullet \text{InMachine}(\text{pin})}, \\
Y^{\text{correct_pin_action } \bullet \text{correct}(\text{pin}) = \text{true}))), \\
\lambda Y. Z. \text{app}(< (\text{Axiom}(\text{any } \bullet \text{card_destroyed'} = \text{true} \rightarrow \\
\text{appropriateResponse}(\text{"Your card has been destroyed"})), \text{incorrect_pin_action}), \text{app}(\text{app}(\text{Axiom}(\text{incorrect_pin_action } \bullet \\
\text{InMachine}(\text{pin}) \rightarrow \text{correct}(\text{pin}) = \text{false} \rightarrow \\
\text{card_destroyed'} = \text{true}), Z^{\text{incorrect_pin_action } \bullet \text{InMachine}(\text{pin})}, \\
Y^{\text{incorrect_pin_action } \bullet \text{correct}(\text{pin}) = \text{true}))))) \]
Extraction: Example
The extraction map removes non-constructive elements of proof-terms, to give imperative SML program.
The resulting SML programs have return values that are realizers of the specifications proved.
Applying the map to the lambda term for our proof gives the correct program:
```sml
if correct(pin) then
correct_pin_action; "Menu (1) Withdraw (2) Deposit (3) Balance"
else
incorrect_pin_action; "Your card has been destroyed"
```
Application: Design-by-contract
Design-by-contract is a well established method of software development (see Meyer)
- When a program is developed, it must be accompanied with two boolean-valued functions, called assertions. These form the so-called contract of the program.
- The boolean functions are called the pre- and post-condition assertions.
- Programs are tested at run-time by evaluating the values of the assertions in a dedicated test suite.
- If the pre-condition assertion evaluates to true before the program is executed, and the post-condition evaluates to false, then the program has an error and the designer is alerted by the test suite.
Complex code requires complex, sometimes functional assertions
Contracts as return values
Assertions are a special kind of return value
We can simulate assertions in SML as return values of disjoint union type
- The post-condition assertion for a program is taken to be true if it is of the form \( \text{Inl}(a) \) and false if it is of the form \( \text{Inr}(b) \).
- For example, assume a program that \( \text{s} := \text{s} \times 2; \text{Even}(\text{s}) \) consists of some imperative code \( \text{s} := \text{s} \times 2 \) with return values arising from \( \text{Even}(\text{s}) \), of type \( \text{Unit} | \text{Unit} \).
- If the state value \( \text{s} \) is even, then the return value of the program is \( \text{Inl}() \), and \( \text{Inr}() \) otherwise.
- Programs with assertions can then be evaluated within a testing tool that will generate appropriate error reports whenever a post-condition is violated.
Specification and Synthesis of contracts
- The specification of a required post-condition assertion is given by a disjunction of the form $(A \lor \neg A)$.
- The disjunction specifies the required post-condition as a return value realizer, of type $\text{xsort}(A \lor \neg A) = (\text{xsort}(A) | \text{xsort}(\neg A))$.
- So, given a proof of the form
$$\vdash \text{body} \cdot A \lor \neg A$$
we can extract a program that has equivalent side-effect to body, but with an accompanying post-condition assertion that correctly expresses the expectations of the designer, as stated as the Skolem function for the disjunction specification.
Improving programs built with faults
By utilizing our synthesis methods, we can analyze and improve programs that may be built from faulty sub-programs, complementing the ideas of design-by-contract.
The designer uses the rules of our Hoare logic to make proofs of the above contractual form.
As usual with the logic, only true, known properties about given programs are used.
Faulty programs may, however, be used and reasoned about.
Improving programs built with faults
- Instead of using formulae that assert the correctness of programs, we use disjunctive statements stating that the program may or may not be faulty.
- Because disjunctive statements correspond to post-condition assertions, our synthesis enables the automatic construction of a program with accompanying assertions, through the reasoning about the potential known faults of subprograms.
Example
- Consider a program designed to connect to a database, \texttt{connectDB}. The program is intended to always result in a successful connection, specified by formula $connected_f = true$.
- The program has a fault, and sometimes results in an unsuccessful connection.
- This situation is described truthfully by the disjunction
\[ \vdash \texttt{connectDB} \bullet connected_f = true \lor \neg connected_f = true \]
- This property is true of the program, and so the program may be used within Hoare logic to develop a larger program/formula theorem, without jeopardizing the truth of the final result.
Example
By our synthesis methods, proofs that involve this theorem can also be transformed into programs that use a version of `connectDB` with an accompanying assertion.
The assertion returns `inl()` when a connection has been made and `inr()` otherwise.
Larger programs built using our methods can make use of this assertion to deal with the possibility of a faulty connection.
Conclusions and Future Work
The Curry-Howard protocol is a very general semi-formal framework for adapting proofs-as-programs.
Applications show the framework can be used to produce useful adaptations.
Crossley, Poernomo and Wirsing applied the protocol to synthesis of structured SML code from proofs about structured CASL specifications.
Future work:
- Investigate further adaptations – currently Hennessy-Milner proof systems – synthesis of component data-views.
- Investigate ways of formalizing the protocol itself for the purposes of automation.
Further reading and Questions
Iman Poernomo, John N. Crossley, Martin Wirsing, *Programs, Proofs and Parameterized Specifications*, in Maura Cerioli, Gianna Reggio (Eds.), *WADT 2001*, LNCS 2267
All papers available on request from the author at email: ihp@csse.monash.edu.au
|
{"Source-Url": "http://www.cs.cornell.edu/Nuprl/PRLSeminar/PRLSeminar03_04/Poernomo/iman_nuprl_seminar.pdf", "len_cl100k_base": 9514, "olmocr-version": "0.1.49", "pdf-total-pages": 60, "total-fallback-pages": 0, "total-input-tokens": 81416, "total-output-tokens": 12143, "length": "2e13", "weborganizer": {"__label__adult": 0.00039076805114746094, "__label__art_design": 0.0003478527069091797, "__label__crime_law": 0.00043272972106933594, "__label__education_jobs": 0.0009851455688476562, "__label__entertainment": 5.346536636352539e-05, "__label__fashion_beauty": 0.0001742839813232422, "__label__finance_business": 0.00022077560424804688, "__label__food_dining": 0.0004489421844482422, "__label__games": 0.0005340576171875, "__label__hardware": 0.0008187294006347656, "__label__health": 0.00060272216796875, "__label__history": 0.000232696533203125, "__label__home_hobbies": 0.00011354684829711914, "__label__industrial": 0.0004987716674804688, "__label__literature": 0.00030159950256347656, "__label__politics": 0.0003056526184082031, "__label__religion": 0.0006422996520996094, "__label__science_tech": 0.015655517578125, "__label__social_life": 0.00010031461715698242, "__label__software": 0.0030803680419921875, "__label__software_dev": 0.97265625, "__label__sports_fitness": 0.0003857612609863281, "__label__transportation": 0.0006933212280273438, "__label__travel": 0.00020825862884521484}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 32564, 0.00424]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 32564, 0.50826]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 32564, 0.70204]], "google_gemma-3-12b-it_contains_pii": [[0, 143, false], [143, 260, null], [260, 484, null], [484, 862, null], [862, 1334, null], [1334, 2087, null], [2087, 2704, null], [2704, 3144, null], [3144, 3431, null], [3431, 3717, null], [3717, 3976, null], [3976, 4270, null], [4270, 4681, null], [4681, 5219, null], [5219, 5537, null], [5537, 6037, null], [6037, 6407, null], [6407, 7298, null], [7298, 8649, null], [8649, 9045, null], [9045, 9568, null], [9568, 9989, null], [9989, 10015, null], [10015, 10319, null], [10319, 10594, null], [10594, 11528, null], [11528, 11846, null], [11846, 12199, null], [12199, 12477, null], [12477, 12520, null], [12520, 12859, null], [12859, 13285, null], [13285, 14071, null], [14071, 14683, null], [14683, 15194, null], [15194, 15837, null], [15837, 17086, null], [17086, 17376, null], [17376, 18929, null], [18929, 19283, null], [19283, 19705, null], [19705, 20001, null], [20001, 20217, null], [20217, 21238, null], [21238, 22294, null], [22294, 23092, null], [23092, 23602, null], [23602, 24651, null], [24651, 25235, null], [25235, 26427, null], [26427, 26882, null], [26882, 27604, null], [27604, 28473, null], [28473, 29117, null], [29117, 29556, null], [29556, 29982, null], [29982, 30596, null], [30596, 30979, null], [30979, 31535, null], [31535, 32564, null]], "google_gemma-3-12b-it_is_public_document": [[0, 143, true], [143, 260, null], [260, 484, null], [484, 862, null], [862, 1334, null], [1334, 2087, null], [2087, 2704, null], [2704, 3144, null], [3144, 3431, null], [3431, 3717, null], [3717, 3976, null], [3976, 4270, null], [4270, 4681, null], [4681, 5219, null], [5219, 5537, null], [5537, 6037, null], [6037, 6407, null], [6407, 7298, null], [7298, 8649, null], [8649, 9045, null], [9045, 9568, null], [9568, 9989, null], [9989, 10015, null], [10015, 10319, null], [10319, 10594, null], [10594, 11528, null], [11528, 11846, null], [11846, 12199, null], [12199, 12477, null], [12477, 12520, null], [12520, 12859, null], [12859, 13285, null], [13285, 14071, null], [14071, 14683, null], [14683, 15194, null], [15194, 15837, null], [15837, 17086, null], [17086, 17376, null], [17376, 18929, null], [18929, 19283, null], [19283, 19705, null], [19705, 20001, null], [20001, 20217, null], [20217, 21238, null], [21238, 22294, null], [22294, 23092, null], [23092, 23602, null], [23602, 24651, null], [24651, 25235, null], [25235, 26427, null], [26427, 26882, null], [26882, 27604, null], [27604, 28473, null], [28473, 29117, null], [29117, 29556, null], [29556, 29982, null], [29982, 30596, null], [30596, 30979, null], [30979, 31535, null], [31535, 32564, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 32564, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 32564, null]], "pdf_page_numbers": [[0, 143, 1], [143, 260, 2], [260, 484, 3], [484, 862, 4], [862, 1334, 5], [1334, 2087, 6], [2087, 2704, 7], [2704, 3144, 8], [3144, 3431, 9], [3431, 3717, 10], [3717, 3976, 11], [3976, 4270, 12], [4270, 4681, 13], [4681, 5219, 14], [5219, 5537, 15], [5537, 6037, 16], [6037, 6407, 17], [6407, 7298, 18], [7298, 8649, 19], [8649, 9045, 20], [9045, 9568, 21], [9568, 9989, 22], [9989, 10015, 23], [10015, 10319, 24], [10319, 10594, 25], [10594, 11528, 26], [11528, 11846, 27], [11846, 12199, 28], [12199, 12477, 29], [12477, 12520, 30], [12520, 12859, 31], [12859, 13285, 32], [13285, 14071, 33], [14071, 14683, 34], [14683, 15194, 35], [15194, 15837, 36], [15837, 17086, 37], [17086, 17376, 38], [17376, 18929, 39], [18929, 19283, 40], [19283, 19705, 41], [19705, 20001, 42], [20001, 20217, 43], [20217, 21238, 44], [21238, 22294, 45], [22294, 23092, 46], [23092, 23602, 47], [23602, 24651, 48], [24651, 25235, 49], [25235, 26427, 50], [26427, 26882, 51], [26882, 27604, 52], [27604, 28473, 53], [28473, 29117, 54], [29117, 29556, 55], [29556, 29982, 56], [29982, 30596, 57], [30596, 30979, 58], [30979, 31535, 59], [31535, 32564, 60]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 32564, 0.0433]]}
|
olmocr_science_pdfs
|
2024-11-26
|
2024-11-26
|
7f18390bb8f97f09d35e6ff13cf2b821b3cdc727
|
Minutes of the General Assembly on 13th December, 2018
Minute taker: Colin Finck
The General Assembly of the Association “ReactOS Deutschland e.V.” took place in the internet (SSL secured IRC server) on 13th December, 2018 at 20:00 (local German time).
Attendant members
- Matthias Kupfer (President of the Association)
- Daniel Reimer (Vice President of the Association)
- Colin Finck (Treasurer)
- Mark Jansen
- Amine Khaldi
- Thomas Faber
- Pierre Schweitzer (from 20:34)
Summary of the decisions
- Members of the Association plan to represent ReactOS on several events in 2019:
- March: Chemnitzer Linux-Tage in Chemnitz, Germany
- July: RMLL in Strasbourg, France
- December: Open Source Summit in Paris, France
- The Association will organize another one-week ReactOS Hackfest in 2019, most likely again around August. Based on the input from Association and project members, there will not be a second official ReactOS Hackfest in the same year. However, the Association may sponsor independently locally organized Hackfests.
- The Board has been discharged of its responsibilities.
- §7.1 and §7.2 of the Articles of Association have been changed to extend the Board to four persons, adding a second Vice President.
- Matthias Kupfer, Daniel Reimer, Pierre Schweitzer, and Colin Finck have been elected as Board members, each with 7 “Yes” votes, 0 “No” votes, and no abstentions. They will serve as President (Matthias Kupfer), Vice President (Daniel Reimer), Vice President (Pierre Schweitzer), and Treasurer (Colin Finck).
- All members of the Association agreed to generally enable the compensation of Board members for their work, within the limits given by law and the Articles of Association.
The original wordings of all attendant members can be read in the attached IRC Log.
Aachen, 13th December, 2018
For the correctness of the minutes
(signed Colin Finck) (signed Matthias Kupfer)
(Minute taker) (President)
Attachments
- Automatically created IRC Log of the General Assembly
- Annual Report 2017
he also joined us this year, enabling experimental write support, but both times shortly after gsoc he went a-wall
We had one student working on ntfs, building on the work of pierre?
He worked on the Rapps application manager, to get it up to shape for the CE
(I only have one hand free for typing right now so would rather not elaborate.)
Do we have any mentor around?
that there were 4 projects)
what means 6/2?
(GSoC student)
Also something to consider: The student invited in 2017 is still with the project, as well as the student invited in 2018
haha
If you plan a hackfest 2019 I need to know asap regarding holidays and b33r shipping preparation ^^)
Therefore, their location was also technically well-equipped and came with a large kitchen with cheap beverages :)
This became necessary, because while the room in 2017 offered space for working and accommodation, it would have been too small if we had more attendees
We shouldn’t idle just for him. Just do whatever helps and doesn’t make the situation uncomfortable
As usual a year starts with the participation at the Chemnitz Linux-Days, which will grow by the way in 2019
Are we registered yet? Is someone taking care?
Not from my side.
definite, we shouldn’t idle just for him. Just do whatever helps and doesn’t make the situation uncomfortable
As usual a year starts with the participation at the Chemnitz Linux-Days, which will grow by the way in 2019
Are we registered yet? Is someone taking care?
Not from my side.
not sure if it’s possible to rearrange some agenda points to give him a chance to join late and participate himself in as many votings as possible
but we have to elect a new board today
Are there any remarks at this point otherwise I would like to start with the first point, which is the annual report of 2017
but we have to elect a new board today
It’s in discussion, but we have a little bit to consider the sudden end of CeBIT
so I’m kinda up to date about his personal situation, but that’s it basically
of 2017 and 2018
well, even of 2017 and 2018
both have been very successful in my opinion
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
Not yet, but yes, I take care
Definitely, we should limit the time to - I would say maximum of 30 minutes
you have to decide yourself to what extend you are able to participate in the project activities, but I think we should limit the time to - I would say maximum of 30 minutes
Definitely, we should limit the time to - I would say maximum of 30 minutes
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I met him at HackFest in Muenster
I think that was rather 2016 and 2017.
Mark Jansen has joined in.
Colin Finck: This year, we had Victor Perevertkin as our only GSoC student.
Mark Jansen: Right.
Matthias Kupfer: Okay, I was asking just for a brief summary.
Colin Finck: But I think we learned what we can do better and hope to get better applications and therefore more mentored students for next year's Google Summer of Code.
Daniel Reimer: Well, more is not always better. Only accept what you can mentor. That's what we did that year.
Matthias Kupfer: Okay, as far as the development, potential, the google offer and money.
Colin Finck: Daniel Reimer: Yeah, but one of the reasons was also the few and mostly bad quality of the other student applications.
Colin Finck: If we advertise our GSoC participation better, we should get better student applications too.
Matthias Kupfer: Matthias Kupfer: definitely.
Matthias Kupfer: I don't have any impression how much time the mentor have to invest, can a mentor give me a rough idea?
Daniel Reimer: Mark Jansen ping.
Daniel Reimer: Thomas Faber: one hand: ping.
<Thomas Faber> It highly depends on the student, at the very least it's a weekly check-in and answering any questions about development specifics.
Mark Jansen: huh.
Thomas Faber: Often it's most productive if you talk to the student almost daily, so it can be a relatively significant amount of time.
Mark Jansen: I was gonna say that this is hard to estimate, depends on the student.
Colin Finck: In my opinion, the past foundation activities have been elaborated in all detail through the Annual Reports and our monthly project meetings. Maybe let's talk a bit more about the plans for the future to really move on from this agenda point.
Matthias Kupfer: avg. 3 hours per week - just for an impression?
Matthias Kupfer: Colin: when was deadline?
Colin Finck: CLT 2019 - Daniel Reimer wants to sign us up, Matthias Kupfer will be involved in the organization again, so this is a pretty safe bet I guess.
Matthias Kupfer: Well, I'm in my opinion, the past foundation activities have been elaborated in all detail through the Annual Reports and our monthly project meetings. Maybe let's talk a bit more about the plans for the future to really move on from this agenda point.
Mark Jansen: but in general, students will also find help in #reactos-dev
Matthias Kupfer: Pierre Schweitzer: I think we can skip the year 2018, which is almost over.
Matthias Kupfer: Colin: when was deadline?
Colin Finck: Colin Finck: CLT 2019 - Daniel Reimer wants to sign us up, Matthias Kupfer will be involved in the organization again, so this is a pretty safe bet I guess.
Matthias Kupfer: Colin: when was deadline?
Colin Finck: Colin: CLT 2019 - Daniel Reimer wants to sign us up, Matthias Kupfer will be involved in the organization again, so this is a pretty safe bet I guess.
Matthias Kupfer: Pierre Schweitzer: maybe you should start a doodle to get a proper overview and everyone is directly asked for an opinion.
Pierre Schweitzer: Thanks Colin Finck.
Matthias Kupfer: Pierre Schweitzer: we reordered the agenda, so no votes has started yet.
Matthias Kupfer: *votes have.
Pierre Schweitzer: Thanks :)..
Colin Finck: Are there any other events we should attend in 2019?
Pierre Schweitzer: For CLT we should consider a presentation after all this years.
Colin Finck: I recall that we once suddenly had too many people for the stand, but I thought we just paid the extra amount for an additional person and that was it.
Pierre Schweitzer has joined in.
Pierre Schweitzer: had joined in assembly with voice status.
Pierre Schweitzer: Evening, sorry for being late.
Colin Finck: Yay!
Daniel Reimer: Yeah, problem was that one guy came by to help and had nothing to do the whole day in the end.
Pierre Schweitzer: We shifted the agenda around a bit to let you vote on everything on your own :)
Matthias Kupfer: I had to lead a doodle to get a proper overview and everyone is directly asked for an opinion.
Pierre Schweitzer: Thanks Colin Finck.
Matthias Kupfer: Colin Finck.
Matthias Kupfer: Pierre Schweitzer: we reordered the agenda, so no votes has started yet.
Matthias Kupfer: *votes have.
Pierre Schweitzer: Thanks :).
Colin Finck: Are there any other events we should attend in 2019?
Matthias Kupfer: so after CLT, a hackfest again in 2019 as Colin mentioned.
Colin Finck: We had a booth at FOSDEM in 2017, but that only happened because it was so close to the Hackfest in Köln.
Colin Finck: If we continue to have our Hackfests in August each year, we will hardly be able to attend FOSDEM.
Colin Finck: but the productivity during the Hackfest really outweighs attending another event :)..
Colin Finck: And we would have to celebrate my bday @ hackfest... :P.
Pierre Schweitzer: For the record, I'll try to attend the Open Source Summit next year, at Paris.
Matthias Kupfer: Are there other major events worth attending?
Pierre Schweitzer: And perhaps again the RMLL, I've always had good attendees.
Colin Finck: Pierre Schweitzer: Cool! with a booth? Do you need support?
Colin Finck: Paris is just 2 hours from here.
Pierre Schweitzer: No both, just talks :P.
Pierre Schweitzer: "booth"
Pierre Schweitzer: Hmm, actually, the OS can have stands, IIRC.
Colin Finck: Colin Finck: I see.
Pierre Schweitzer: Would deserve a look, that's a major event.
Matthias Kupfer: Colin Finck: once more for the record, if we are going to make any DVD or CD for any of the event I strongly recommend to press them professionally.
Pierre Schweitzer: Industry oriented, so it can be quite difficult to get in, but could bring nice benefits.
Matthias Kupfer: the prices have been dropped over the last few years and it looks more professional.
Colin Finck: Matthias Kupfer: Why? Daniel Reimer has a professional CD burning machine now :)
Daniel Reimer: I do, but the printer is really really bad.
Colin Finck: Colin Finck: oh, I see.
Daniel Reimer: Or the color plastic thing is too old.
Daniel Reimer: plastic
Colin Finck: anyway, I'm more afraid nobody has a CD drive anymore these days
Colin Finck: been looking at the prices of USB drives for quite a while, but they're still rather expensive just to give them away for free.
Daniel Reimer: Yeah, USB sticks and being able too boot off it needs more attention I guess.
Matthias Kupfer: Matthias Kupfer: okay, so nowhere my suggestion
Colin Finck: however, we should consider this at least as soon as ReactOS is usable for a specific business case.
Pierre Schweitzer: yup.
Daniel Reimer: CDs pressed would be great and I fully support it as long as we have no 100% working USB yet.
Colin Finck: Pierre Schweitzer: For the record, when is the Open Source Summit Paris in 2019?
Daniel Reimer: #1 fix the printer.
Matthias Kupfer: My point was, we should give our merchendize a professional look, as long as we can afford this now.
Matthias Kupfer: Colin Finck: should we proceed with the next point?
Colin Finck: Colin Finck: let's get our calendar for next year together first.
Daniel Reimer: Professional looking is what we lack a bit regarding the free media, right...
Pierre Schweitzer: End of the year Colin Finck.
Pierre Schweitzer: Generally, mid december.
Pierre Schweitzer: (For 2018, it's missed.)
Colin_Finck: Hackfest probably around August 2019 again
Pierre_Schweitzer: RML is July 2019
Colin_Finck: And Open Source Summit Paris in Mid-December 2019
Pierre_Schweitzer: (most of the Time)
Colin_Finck: Regarding the Hackfest:
Colin_Finck: I already asked during the last monthly meeting of ReactOS, however I should bring it up here as well:
Matthias_Kupfer: For CLT and Hackfest we should start a doodle to collect the information about the attendees
Matthias_Kupfer: For planning purpose
Colin_Finck: As our Hackfests are so productive every time, I was thinking about having more than one Hackfest each year
Colin_Finck: What do you think about that?
Daniel_Reimer: yeah. Doodle is a good idea
Colin_Finck: Right now, it’s a one-week event each year
Matthias_Kupfer: It’s a matter of time and money
Daniel_Reimer: well, if you can find enough ppl having enough free time... sure
Colin_Finck: I think we shouldn’t shorten the duration of a single Hackfest
Pierre_Schweitzer: The answer you got was rather interesting: one officially organized by e.V., and support to a second one organized by a local group of person.
Matthias_Kupfer: As long as the docs need to travel and to use their holidays, we have to think seriously about that
Colin_Finck: This is why it’s more a question to the individual persons
Matthias_Kupfer: Pierre_Schweitzer: what a good idea, we can support the local hackfests with money if necessary
Colin_Finck: If we can get a room at IN-Berlin e.V. for free, it’s not a matter of money for ReactOS Deutschland e.V. at all
Matthias_Kupfer: Colin I think we should continue with one central per year and maybe consider additional local ones
Colin_Finck: Frankly asked, who of you could or could not take enough holidays for two one-week ReactOS Hackfests each year?
Matthias_Kupfer: I can’t
Mark_Jansen: I yes, 2 would be tight
Thomas_Faber: I won’t have time to really attend even one next year. Though if it’s in Berlin I might visit
Colin_Finck: okay, I see
Daniel_Reimer: holidays is tricky here.
Colin_Finck: think I got an impression now
Colin_Finck: so we will continue to have one official Hackfest organized and sponsored by ReactOS Deutschland e.V.
Colin_Finck: and if people organize local hackfests, ReactOS Deutschland e.V. may sponsor them
Colin_Finck: I think we have enough plans for 2019 then
Mark_Jansen: but without people know that, they will not ask for sponsoring?
Colin_Finck: and in my opinion, we can move on with the agenda
Matthias_Kupfer: So all present members excluding the board members themselves are asked for that, please Colin setup the Vote
VoteBot: Colin_Finck has set up a vote and I'm asking all participating members in private messages now.
VoteBot: excluded from voting:
VoteBot: Colin_Finck
VoteBot: Daniel_Reimer
VoteBot: Matthias_Kupfer
VoteBot: The vote is over. Here are the results!
VoteBot: Question: Do you agree with discharging the responsibilities of the Board? (in German: "Sprechen Sie dem Vorstand Entlastung aus?")
VoteBot: Answers:
No - 0 votes
Yes - 4 votes
Abstention - 0 votes
Total number of votes: 4
Colin_Finck: Thank you very much! :)
Matthias_Kupfer: Okay, thanks for your trust
Matthias_Kupfer: You can straight move on to the more tricky point 3
Matthias_Kupfer: Discussion for the election of the board for the next election period
Colin_Finck: May I present my view on that?
Matthias_Kupfer: Yes, you can start I would continue afterwards
Colin_Finck: Currently, we have 3 Board members, all doing that in their free time with no financial compensation. However, the project, the foundation activities, and our financial possibilities have all grown over the recent years
Colin_Finck: Therefore, I would be glad if we could get more members on the Board
Colin_Finck: gladly, Pierre_Schweitzer volunteered to do that and I would really like to see him on the Board, given his excellent handling of the ReactJS case back in 2017
Daniel_Reimer: No objections here.
Colin_Finck: can I add my point now?
Colin_Finck: apart from managing the finances of the foundation, I’m also managing the server infrastructure of ReactOS Deutschland e.V. (website, foundation management software)
Colin_Finck: as Pierre is also an infra guy, with whom I already work successfully on the general ReactOS Infra, I’m sure he could also help with the ReactOS Deutschland e.V. infrastructure if he was elected to the Board
Colin_Finck: them basically had 5 duties (representative for Germany and German authorities, representative for international, event manager, financial manager, infrastructure) split on 4 Board members
Colin_Finck: provided that the entire current Board and Pierre run and get elected
Matthias_Kupfer: that would be what I hope for :
Matthias_Kupfer: So, I have to add something for myself
Matthias_Kupfer: and foundations of comparable Open-Source projects, like openSUSE, have even more Board members
Matthias_Kupfer: now you have the word
Matthias_Kupfer: As you already may have noticed I’m not deeply involved in any activities in the past due to my time constraints.
Matthias_Kupfer: I try to respond as quick as possible if there comes something to my attention, but as I already told to Colin
Matthias_Kupfer: I’m not comfortable with the president role as long as I don’t do enough for the Foundation
Matthias_Kupfer: Basically I was going to step back in the second row, but on the other hand I might of help for some legal issues and for the authorities
Colin_Finck: The problem I see is that the president of ReactOS Deutschland e.V. always needs to be a German speaker living in Germany, because he will be the first person contacted by the authorities.
Colin_Finck: So, if you are all aware of my constraints and “insist” that I should continue, I would be available as wished
Daniel_Reimer: well... you do/did way more than the vice president did that year. I can only speak for me, but I had no problems with your limited presence due to less spare time. If your help was needed, you were available
Matthias_Kupfer: But for the sake of fairness you should be warned properly
Pierre_Schweitzer: I believe we all know that is a voluntary based work, along with another “real” work work, we cannot expect you to be 100% dedicated to the task
Matthias_Kupfer: I just would like to inform you in the most honest way
Colin_Finck: With you having done that well in the past and having such experience with German authorities due to your job, I would
Colin_Finck has set up a vote and I'm asking all participating members in private messages now.
Colin_Finck: ok, I take it that we want to extend the Board to 4 people and we have 4 people running.
Colin_Finck: one for changing the articles of association to extend the Board to 4 people
Colin_Finck: and a vote on each person of the Board
Colin_Finck: ugh, 5 votes in total actually.
Colin_Finck: ok, then. round 1 ^^
Matthias_Kupfer: Colin_Finck: moment please
Colin_Finck: ok, I'll wait.
Matthias_Kupfer: Are there any more candidates around and if not any opinions?
Matthias_Kupfer: Can anyone of the non-board members give a short statement, so that we can start the votes?
Mark_Jansen: Thanks for the elaboration of your current position Matthias_Kupfer, but I don’t see that as a problem in a non-profit org like this.
Mark_Jansen: so I think that we would be happy with what has just been proposed for all the 3 current + 1 possibly new member of the board.
Colin_Finck: well, just a point regarding my volunteering: I've the same constraints as Matthias_Kupfer or Daniel_Reimer; I don’t have plenty of time, but want to be able to help when required.
Matthias_Kupfer: okay, I didn’t make my point, anyway, let’s start with the votes and be prepared for surprises.
Colin_Finck: it’s technically your turn
Colin_Finck: working on it
Colin_Finck has set up a vote and I’m asking all participating members in private messages now.
The vote is over. Here are the results!
Matthias_Kupfer: Do you agree with electing Daniel Reimer into the Board? (in German: Stimmen Sie für die Wahl von Daniel Reimer zum Vorstandsmitglied?)
Matthias_Kupfer: Question: Do you agree with electing Matthias Kupfer into the Board? (in German: Stimmen Sie für die Wahl von Matthias Kupfer zum Vorstandsmitglied?)
Matthias_Kupfer: We have 4 people who want to run for the Board.
Matthias_Kupfer: Let’s hope we still have 4 people.
Matthias_Kupfer: Colin_Finck: it’s technically your turn.
Matthias_Kupfer: Colin_Finck: we could have 2 Vice Presidents actually
Matthias_Kupfer: Colin_Finck: I think that’s the easiest and most universal way to do it.
Matthias_Kupfer: Sounds good.
Matthias_Kupfer: You can think about that while I already prepare the vote on it.
Pierre_Schweitzer: well, sounds good, indeed.
Matthias_Kupfer: Colin_Finck: just for your information, if we extend the board, we need to do all steps including notarial acts for Pierre.
Matthias_Kupfer: I’m fully aware of that.
Matthias_Kupfer: Okay, so is Pierre?
Pierre_Schweitzer: ok, as I.
Pierre_Schweitzer: :-p
Pierre_Schweitzer: Colin_Finck has set up a vote and I’m asking all participating members in private messages now.
Pierre_Schweitzer: At least, my family name sounds local.
Pierre_Schweitzer: Pierre Schweitzer: do you speak a little bit german?
Pierre_Schweitzer: Ich spreche ein bisschen Deutsch.
Pierre_Schweitzer: 'sigh' where is all the 'we are one europe' stuff in that case? German bureaucracy... ok, I hope it’s enough to survive the legal process in a comfortable manner.
Pierre_Schweitzer: heh
Colin_Finck: let’s first try it out before talking about problems.
Colin_Finck: he may be able to visit a local notary and it’s just a matter of sending snail mail back and forth.
Colin_Finck: The vote is over. Here are the results!
Colin_Finck: Question: Do you agree with changing §7.2 of the Articles of Association from "a Vice-President" to "two Vice Presidents"? (in German: Stimmen Sie der Änderung von §7.1 der Satzung von "drei Personen" auf "vier Personen" zu?)
Colin_Finck: Colin_Finck: I think that’s the easiest and most universal way to do it.
Colin_Finck: Sounds good.
Colin_Finck: You can think about that while I already prepare the vote on it.
Pierre_Schweitzer: well, sounds good, indeed.
Matthias_Kupfer: Colin_Finck: just for your information, if we extend the board, we need to do all steps including notarial acts for Pierre.
Matthias_Kupfer: I’m fully aware of that.
Matthias_Kupfer: Okay, so is Pierre?
Pierre_Schweitzer: ok, as I.
Pierre_Schweitzer: :-p
Pierre_Schweitzer: Colin_Finck has set up a vote and I’m asking all participating members in private messages now.
Pierre_Schweitzer: At least, my family name sounds local.
Pierre_Schweitzer: Pierre Schweitzer: do you speak a little bit german?
Pierre_Schweitzer: Ich spreche ein bisschen Deutsch.
Pierre_Schweitzer: 'sigh' where is all the 'we are one europe' stuff in that case? German bureaucracy... ok, I hope it’s enough to survive the legal process in a comfortable manner.
Pierre_Schweitzer: heh
Colin_Finck: let’s first try it out before talking about problems.
Colin_Finck: he may be able to visit a local notary and it’s just a matter of sending snail mail back and forth.
Colin_Finck: The vote is over. Here are the results!
Colin_Finck: Question: Do you agree with changing §7.2 of the Articles of Association from "a Vice-President" to "two Vice Presidents"? (in German: Stimmen Sie der Änderung von §7.1 der Satzung von "drei Personen" auf "vier Personen" zu?)
Colin_Finck: Colin_Finck: I think that’s the easiest and most universal way to do it.
Colin_Finck: Sounds good.
Colin_Finck: You can think about that while I already prepare the vote on it.
Pierre_Schweitzer: well, sounds good, indeed.
Matthias_Kupfer: Colin_Finck: just for your information, if we extend the board, we need to do all steps including notarial acts for Pierre.
Matthias_Kupfer: I’m fully aware of that.
Matthias_Kupfer: Okay, so is Pierre?
Pierre_Schweitzer: ok, as I.
Pierre_Schweitzer: :-p
Pierre_Schweitzer: Colin_Finck has set up a vote and I’m asking all participating members in private messages now.
Pierre_Schweitzer: At least, my family name sounds local.
Pierre_Schweitzer: Pierre Schweitzer: do you speak a little bit german?
Pierre_Schweitzer: Ich spreche ein bisschen Deutsch.
Pierre_Schweitzer: 'sigh' where is all the 'we are one europe' stuff in that case? German bureaucracy... ok, I hope it’s enough to survive the legal process in a comfortable manner.
Pierre_Schweitzer: heh
Colin_Finck: let’s first try it out before talking about problems.
Colin_Finck: he may be able to visit a local notary and it’s just a matter of sending snail mail back and forth.
Colin_Finck: The vote is over. Here are the results!
Colin_Finck: Question: Do you agree with changing §7.2 of the Articles of Association from "a Vice-President" to "two Vice Presidents"? (in German: Stimmen Sie der Änderung von §7.1 der Satzung von "drei Personen" auf "vier Personen" zu?)
Colin_Finck: Colin_Finck: I think that’s the easiest and most universal way to do it.
Colin_Finck: Sounds good.
Colin_Finck: You can think about that while I already prepare the vote on it.
Pierre_Schweitzer: well, sounds good, indeed.
Matthias_Kupfer: Colin_Finck: just for your information, if we extend the board, we need to do all steps including notarial acts for Pierre.
<Colin_Finck> General Assembly? Nope, we're only doing the legally required minimum :P
<Matthias_Kupfer> When should we plan the next general assembly?
<Colin_Finck> and when we met the Wine guys at FOSDEM some years ago
<Colin_Finck> anyway, I'm speaking from the position of the nice meet-up I had with Stefan Dösinger at Google Summer of Code Mentor Summit
<Pierre_Schweitzer> True
<Colin_Finck> I don't think AJ's answer was too much about ReactOS. It could have been any project they don't know in detail
<Matthias_Kupfer> So of there ar no further wuestions, suggestions, information, I think that's it for today
<Pierre_Schweitzer> I'm OK with this
<Colin_Finck> Pierre_Schweitzer: well, I rather think they want people to look at documentation in general and not other source
<Mark_Jansen> considering they discourage people looking at reactos
<Mark_Jansen> yeah
<Pierre_Schweitzer> And even with our partner projects such as Wine, it's rather complex
<Thomas_Faber> FWIW, I'm totally in favor of compensating you guys for that work. Please don't hesitate to ask
<Matthias_Kupfer> Does anyone need a compensation, for the board member stuff, do we need to think about that?
<Colin_Finck> ok, I will, in February
<Colin_Finck> But, normally, you have :p
<Pierre_Schweitzer> Still Paris, if that's the address you have :-)~
<Colin_Finck> Matthias_Kupfer: I in, February
<Colin_Finck> Pierre_Schweitzer: Yes, I have that address
<Colin_Finck> Matthias_Kupfer: Colin Finck: inside Germany?
<Colin_Finck> Pierre_Schweitzer: Matthias_Kupfer: ok, you hopefully forgive me one last question.
<Colin_Finck> So it's great timing that we need to send changes to the German authorities anyway
<Thomas_Faber> I do have a new address. I think I mentioned this to Colin but didn't send him the new one yet. Who do I PM it to?
<Colin_Finck> Thomas_Faber: PM to me please
<Thomas_Faber> xx
<Colin_Finck> Matthias_Kupfer: sure, go ahead
<Colin_Finck> Matthias_Kupfer: Does anyone need a compensation, for the board member stuff, do we need to think about that?
<Thomas_Faber> FWIW, I'm totally in favor of compensating you guys for that work. Please don't hesitate to ask
<Mark_Jansen> seems fair. Indeed
<Daniel_Reimer> too me
<Colin_Finck> I don't ask for myself, but I noticed in other foundations and volunteer driven organisations that they have rules
<Matthias_Kupfer> well, I do never think about it and don't need it that for sure. But if anyone considers it, I have no problem with that
<Colin_Finck> I only ask for compensation when I move somewhere for ROS :p
<Colin_Finck> I wouldn't be opposed to that for other Board members, provided that it aligns with our Articles of Association. Don't need it myself right now
<Matthias_Kupfer> we do not need to concern ourselves with time-consuming tasks at the moment.
<Matthias_Kupfer> I'm fine with that, I'm just asking if there are time consuming tasks coming up, it's very limited per year
<Colin_Finck> I think we can skip the discussion of further development plans as long as it's part of the monthly status meeting
<Colin_Finck> I managed to automate the most time-consuming task, namely importing PayPal donations, with code and even
<Matthias_Kupfer> I agree
<Colin_Finck> ok
<Pierre_Schweitzer> Agreed
<Daniel_Reimer> I agree
<Colin_Finck> Colin Finck has set up a vote and I'm asking all participating members in private messages now.
<Colin_Finck> The vote is over. Here are the results!
<Colin_Finck> Question: Do you agree with electing Pierre Schweitzer into the Board? (in German: Stimmen Sie für die Wahl von Pierre Schweitzer zum Vorstandsmitglied?)
<Colin_Finck> Answers:
<Colin_Finck> Abstention - 0 votes
<Colin_Finck> Yes - 7 votes
<Colin_Finck> Total number of votes: 7
<Colin_Finck> Thank you very much!
<Colin_Finck> Voting is over :)
Is there an advantage to doing it twice a year?
no, no :-P
Due to the legal changes and the time, I propose December 2019
well, this is how it always ends up, even if we try to do it earlier :D
sounds good
I misremember something :-P
short before Christmas or, if possible between Xmas and new years eve
just to make that clear, I set up a doodle early this year but no one made an entry
I had asked this year to not do it between Christmas and New Year’s Eve due to holidays - and I think I will continue to have holidays around this time (or Chaos Communication Congress :P)
Due to the legal changes and the time, I propose December 2019
well, this is how it always ends up, even if we try to do it earlier :D
sounds good
I misremember something :-P
short before Christmas or, if possible between Xmas and new years eve
just to make that clear, I set up a doodle early this year but no one made an entry
I had asked this year to not do it between Christmas and New Year’s Eve due to holidays - and I think I will continue to have holidays around this time (or Chaos Communication Congress :P)
No one
short before Christmas or, if possible between Xmas and new years eve
just to make that clear, I set up a doodle early this year but no one made an entry
I had asked this year to not do it between Christmas and New Year’s Eve due to holidays - and I think I will continue to have holidays around this time (or Chaos Communication Congress :P)
This time period was rather good
I prefer Thursday evening over Saturday thb
reminding some General Assemblies of past years, we sometimes had problems to motivate people between Christmas and New Year’s Eve, even if they were well-informed and agreed to that date
I prefer Thursday evening over Saturday thb
reminding some General Assemblies of past years, we sometimes had problems to motivate people between Christmas and New Year’s Eve, even if they were well-informed and agreed to that date
but that’s just me
I think Thursday evening is an established date due to our monthly meetings already, so I would opt for that as well
removing some General Assemblies of past years, we sometimes had problems to motivate people between Christmas and New Year’s Eve, even if they were well-informed and agreed to that date
I think Thursday evening is an established date due to our monthly meetings already, so I would opt for that as well
everything here is logged and will become part of the official meeting minutes sent to the authorities
should non-board members also be there?
don’t think so :P
Think it was board only.
ok
Annual Report 2017
As stipulated in the Articles of Association of ReactOS Deutschland e.V., the Annual Report gives an overview of the work of the Association in the year 2017. It is separated into Activities, Outlook and Finances. The primary purpose of the Association lies in the support of the ReactOS Project. In 2017, the main tasks were:
- Organizing the ReactOS Hackfest 2017
- Organizing the participation in Google Summer of Code
- Presenting the project on popular exhibitions/events
- Awarding scholarships to eligible students working on ReactOS
Activities
The following annual activities, which directly contribute to the Association’s purpose, are not presented in detail. These were in particular:
- Continued development on the operating system ReactOS and related components (like RosBE), also by non-members
- Receiving donations and managing the collected funds
- Accounting and managing the members
By returning to a 3-month release schedule, the ReactOS Project had four releases this year. This led to an overall increase in donations and enhanced financial possibilities throughout the entire year.
The donation money was primarily used to continue financing the two scholarships that were awarded in the end of 2016. While one of them could only be continued until the end of February, the other student fulfilled the requirements throughout the entire year. Due to a lack of applications, no further scholarships have been awarded in 2017.
Members of the ReactOS Project again presented the project at popular Open-Source exhibitions in 2017, such as the FOSDEM in Brussels in February and the Chemnitzer Linux-Tage in Chemnitz in March. Just like last year, ReactOS Deutschland e.V. supported this by providing merchandising material and covering the travelling expenses.
With the support of ReactOS Deutschland e.V., the ReactOS Project also participated in Google Summer of Code again this year. Like in 2016, the project selected 4 students to work on specific ReactOS tasks between May and September and was awarded the sum of $4700 for successfully mentoring these people. The involved students were also
financially rewarded by Google and one of them stayed with the project and became a ReactOS team member after completing the program.
Based on the positive experience from 2015, Board member Colin Finck again organized a ReactOS Hackfest in Germany in 2017. It took place in Cologne from 14th to 18th August. Afterwards, several project members stayed for the weekend and presented the ReactOS Project at the FrOSCon event in Bonn. As the number of participants was roughly predictable this time, it was decided to book a loft in Cologne that is suitable both as a coworking space for the Hackfest and for accommodating all participants. It was also decided to let ReactOS Deutschland e.V. cover the travel expenses of some project members, who could not afford visiting the Hackfest otherwise. Both actions resulted in a large attendance and another successful ReactOS Hackfest.
Due to a switch of the server hosting provider, a final invoice of the old provider, and the upgrade of several existing servers between January and April, infrastructure costs were significantly higher in 2017 compared to previous years. However, this is a one-off exception and the expenses for infrastructure already returned to a constant monthly rate by the end of April.
**Outlook**
ReactOS Deutschland e.V. seeks to continue its support of the ReactOS Project in 2018 by collecting donations and using that money to finance scholarships, the participation at popular Open-Source events, as well as the infrastructure to run a complex project like ReactOS. Based on the success of 2017 and the less required efforts to organize a Hackfest compared to 2015, the Association also plans to organize another ReactOS Hackfest in 2018.
## Finances
### Incomes
Donations: 16,151.36 €
Google Summer of Code Student Mentoring: 3,872.59 €
Membership fees: 600.00 €
### Expenses
Scholarships: 8,576.00 €
Infrastructure costs (Servers): 4,555.41 €
Hackfest Loft in Cologne: 2,492.00 €
Travel expenses: 1,318.22 €
Shipping costs: 109.73 €
Advertising costs: 106.29 €
Infrastructure costs (Domains): 32.32 €
### Totals
Total incomes: 20,623.95 €
Total expenses: 17,189.97 €
Reserves from 2016: 33,192.02 €
Balance on 2017-12-31: 36,626.00 €
Matthias Kupfer (President of the Board)
Daniel Reimer (Vice President)
Colin Finck (Board Member/Treasurer)
|
{"Source-Url": "https://ev.reactos.org/files/GA2018.pdf", "len_cl100k_base": 9496, "olmocr-version": "0.1.53", "pdf-total-pages": 11, "total-fallback-pages": 0, "total-input-tokens": 28503, "total-output-tokens": 10519, "length": "2e13", "weborganizer": {"__label__adult": 0.0006451606750488281, "__label__art_design": 0.0011224746704101562, "__label__crime_law": 0.0011606216430664062, "__label__education_jobs": 0.09613037109375, "__label__entertainment": 0.00022292137145996096, "__label__fashion_beauty": 0.0003795623779296875, "__label__finance_business": 0.009521484375, "__label__food_dining": 0.0008068084716796875, "__label__games": 0.0026073455810546875, "__label__hardware": 0.002193450927734375, "__label__health": 0.0009775161743164062, "__label__history": 0.0007576942443847656, "__label__home_hobbies": 0.00144195556640625, "__label__industrial": 0.0010061264038085938, "__label__literature": 0.0004467964172363281, "__label__politics": 0.006450653076171875, "__label__religion": 0.0006895065307617188, "__label__science_tech": 0.0162811279296875, "__label__social_life": 0.006740570068359375, "__label__software": 0.0732421875, "__label__software_dev": 0.775390625, "__label__sports_fitness": 0.0005769729614257812, "__label__transportation": 0.0007338523864746094, "__label__travel": 0.0004835128784179687}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 36893, 0.01646]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 36893, 0.00603]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 36893, 0.91972]], "google_gemma-3-12b-it_contains_pii": [[0, 1804, false], [1804, 2039, null], [2039, 5035, null], [5035, 12432, null], [12432, 18962, null], [18962, 25927, null], [25927, 29784, null], [29784, 32388, null], [32388, 34535, null], [34535, 36255, null], [36255, 36893, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1804, true], [1804, 2039, null], [2039, 5035, null], [5035, 12432, null], [12432, 18962, null], [18962, 25927, null], [25927, 29784, null], [29784, 32388, null], [32388, 34535, null], [34535, 36255, null], [36255, 36893, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 36893, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 36893, null]], "pdf_page_numbers": [[0, 1804, 1], [1804, 2039, 2], [2039, 5035, 3], [5035, 12432, 4], [12432, 18962, 5], [18962, 25927, 6], [25927, 29784, 7], [29784, 32388, 8], [32388, 34535, 9], [34535, 36255, 10], [36255, 36893, 11]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 36893, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
518084c3ece29e32855d2bdd23dcacf3effac65a
|
[REMOVED]
|
{"Source-Url": "http://repository.bilkent.edu.tr/bitstream/handle/11693/27678/Generalised%20logic%20program%20transformation%20schemas.pdf;jsessionid=728394F2FFCB74CB525AF8EE80AC2D1E?sequence=1", "len_cl100k_base": 12306, "olmocr-version": "0.1.49", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 70187, "total-output-tokens": 14949, "length": "2e13", "weborganizer": {"__label__adult": 0.00030422210693359375, "__label__art_design": 0.0003228187561035156, "__label__crime_law": 0.0003409385681152344, "__label__education_jobs": 0.0007948875427246094, "__label__entertainment": 6.258487701416016e-05, "__label__fashion_beauty": 0.0001348257064819336, "__label__finance_business": 0.0002353191375732422, "__label__food_dining": 0.00035500526428222656, "__label__games": 0.0006427764892578125, "__label__hardware": 0.000865936279296875, "__label__health": 0.00046181678771972656, "__label__history": 0.00021398067474365232, "__label__home_hobbies": 0.0001163482666015625, "__label__industrial": 0.0004973411560058594, "__label__literature": 0.0002980232238769531, "__label__politics": 0.0002340078353881836, "__label__religion": 0.0004897117614746094, "__label__science_tech": 0.032867431640625, "__label__social_life": 7.712841033935547e-05, "__label__software": 0.006587982177734375, "__label__software_dev": 0.953125, "__label__sports_fitness": 0.00026226043701171875, "__label__transportation": 0.0005245208740234375, "__label__travel": 0.0001653432846069336}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48950, 0.02304]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48950, 0.51287]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48950, 0.8293]], "google_gemma-3-12b-it_contains_pii": [[0, 2608, false], [2608, 5430, null], [5430, 8385, null], [8385, 11487, null], [11487, 12445, null], [12445, 14220, null], [14220, 17533, null], [17533, 17559, null], [17559, 20450, null], [20450, 22999, null], [22999, 25449, null], [25449, 28044, null], [28044, 30142, null], [30142, 32799, null], [32799, 35765, null], [35765, 39331, null], [39331, 42381, null], [42381, 44602, null], [44602, 47527, null], [47527, 48950, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2608, true], [2608, 5430, null], [5430, 8385, null], [8385, 11487, null], [11487, 12445, null], [12445, 14220, null], [14220, 17533, null], [17533, 17559, null], [17559, 20450, null], [20450, 22999, null], [22999, 25449, null], [25449, 28044, null], [28044, 30142, null], [30142, 32799, null], [32799, 35765, null], [35765, 39331, null], [39331, 42381, null], [42381, 44602, null], [44602, 47527, null], [47527, 48950, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48950, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48950, null]], "pdf_page_numbers": [[0, 2608, 1], [2608, 5430, 2], [5430, 8385, 3], [8385, 11487, 4], [11487, 12445, 5], [12445, 14220, 6], [14220, 17533, 7], [17533, 17559, 8], [17559, 20450, 9], [20450, 22999, 10], [22999, 25449, 11], [25449, 28044, 12], [28044, 30142, 13], [30142, 32799, 14], [32799, 35765, 15], [35765, 39331, 16], [39331, 42381, 17], [42381, 44602, 18], [44602, 47527, 19], [47527, 48950, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48950, 0.01989]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
aa4f42164c7caf5be556575f92c05c22fbd67242
|
A Reference Architecture for the Component Factory
VICTOR R. BASILI and
GIANLUIGI CALDIERA
University of Maryland
and
GIOVANNI CANTONE
Università di Napoli
Software reuse can be achieved through an organization that focuses on utilization of life cycle products from previous developments. The component factory is both an example of the more general concepts of experience and domain factory and an organizational unit worth being considered independently. The critical features of such an organization are flexibility and continuous improvement. In order to achieve these features we can represent the architecture of the factory at different levels of abstraction and define a reference architecture from which specific architectures can be derived by instantiation. A reference architecture is an implementation and organization independent representation of the component factory and its environment. The paper outlines this reference architecture, discusses the instantiation process, and presents some examples of specific architectures by comparing them in the framework of the reference model.
General Terms: Economics, Design, Management, Measurement
Additional Key Words and Phrases: Component factory, experience factory, reference architecture, reusability
1. INTRODUCTION
1.1 Background
The issue of productivity and quality is becoming critical for the software industry at its current level of maturity. Software projects are requested to do more with less resources: deliver required systems faster, reduce
Research for this study was supported in part by NASA grant NSO-5123, by ONR grant N00014-87-K-0037 and by Italian CNR grant 89.08052.69.
Authors' addresses: V. R. Basili and G. Caldiera, Institute for Advanced Computer Studies, Department of Computer Science, University of Maryland, College Park, Maryland; G. Cantone, Dipartimento di Informatica e Sistemistica, Università di Napoli, Naples, Italy.
Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission.
© 1992 ACM 1049-331X/92/0000-003 $1.50
turnaround time in maintenance, increase performance reliability and security of systems. With this in mind, significant changes in the way software is produced today are needed. A straightforward solution to the problem of increasing quality and productivity is summarized in three goals: improve the effectiveness of the process, reduce the amount of rework, and reuse life-cycle products.
The production of software using reusable components is a significant step forward for all three of those goals. Use of preexisting well designed, tested, and documented elements as building blocks of programs will amplify the programming capabilities, reduce the amount of work needed on new programs and systems, and achieve a better overall control over the production process and the quality of its products.
The possibility of assembling programs and systems from modular software units "classified by precision, robustness, time-space performance, size limits, and binding time of parameters" [15] has been suggested from the beginnings of software engineering. However, such an approach has never acquired real momentum in industrial environments and software projects, despite the large amount of informal reuse already there.
Reuse is a simple concept: use the same thing more than once. But as far as software is concerned, it is sometimes difficult to define what is an object by itself, in isolation from its context [12]. Software objects may be programs, parts of programs, specifications, requirements, architectures, test cases and plans, all related to each other. Reuse of each software object implies the concurrent reuse of the other objects associated with it. This means we need to reuse more than code. Software objects and their relationships incorporate a large amount of experience from past development activities: it is the reuse of this experience that needs to be fully incorporated into the production process of software and that makes it possible to reuse software objects [4].
Problems in achieving higher levels of reuse are the inability to package experience in a readily available way, to recognize which experience is appropriate for reuse, and to integrate reuse activities into the software development process. Reuse is assumed to take place totally within the context of the project development. This is difficult because the project focus is the delivery of the system; packaging of reusable experience can be, at best, a secondary focus of the project. Besides, project personnel are not always in the best position to recognize which pieces of experience are appropriate for other projects. Finally, existing process models are not defined to support and to take advantage of reuse, much less to create reusable experience. They tend to be rigidly deterministic where, clearly, multiple process models are necessary for reusing experience and creating packaged experience for reuse.
1.2 Approach
In order to practice reuse effectively, an organization is needed whose main focus is to make reuse easy and effective. This implies a significant cultural change in the software industry, from a project-based frame of mind centered on the ideas and experience of project designers, to an organization-wide one,
where a portion of those ideas and experience becomes a permanent corporate asset, independent from the people who originate it. This cultural change will probably happen slowly, and a way to facilitate this change is to provide an organization that is flexible enough to accept this evolution. Two characteristics will typify such an organization:
— *Flexibility.* The organization must be able to change its configuration without a negative impact on its performance, thereby incrementally gaining control over the main factors affecting production.
— *Continuous improvement* (the Japanese "kaizen"). The organization must be able to learn from its own experience and to evolve towards higher levels of quality by building competencies and reusing them.
This paper presents some ideas on how to design the production of software using reusable components. In particular, we show the effectiveness of a representation of the organization with different levels of abstraction in order to achieve the desired flexibility. This leads us to the concept of a reference architecture that provides a representation of the organization as a collection of interacting parts, each one independent of the way the others perform their task. In this framework, methods and tools can be changed inside each one of those independent "development islands," like implementations in an object-oriented development, without the need for a change in the other ones. We outline a possible reference architecture and illustrate it with some examples.
After having automated other organizations’ business and production, today the software industry is facing the problem of a substantial automation of its activities. Without mechanically translating concepts that are pertinent to very different production environments, Flexible Manufacturing systems combine many desirable features: modular architecture, integration of heterogeneous methods and tools, configuration and reconfiguration capabilities, and wide automation under human control. Flexible manufacturing comes of age in the software industry through the definition of integrated software engineering environments, if they are based on the concepts of flexibility and continuous improvement that we have mentioned earlier.
The next two sections of this paper present an organizational framework designed to make reuse happen in the most effective manner. Sections 4 and 5 discuss the representation that we propose for this framework, which uses different levels of abstraction in order to obtain a flexible and evolutionary organizational design. Section 6 outlines our methodology for deriving a particular environment from the general one, and Section 7 illustrates this derivation with some theoretical and actual examples.
2. A REUSE-ORIENTED ORGANIZATION
In order to address the problems of reuse in a comprehensive way, Basili has proposed an organizational framework that separates the project-specific activities from the reuse packaging activities, with process models for supporting each of the activities [2]. The framework defines two separate organizations: a project organization and an experience factory.
One organization is project oriented. Its goal is to deliver the systems required by the customer. It is called the project organization. The other organization, called experience factory, has the role of monitoring and analyzing project developments, developing and packaging experience for reuse in the form of knowledge, processes, tools and products, and supplying it to the project organization upon request.
Each project organization can choose its process model, based upon the characteristics of the project, taking advantage of prior experience with the various process models provided by the experience factory. It can access information about prior system requirements and solutions, effective methods and tools, and even available system components. Based upon access to this prior experience, the project can choose and tailor the best possible processes, methods, and tools. It can reuse prior products tailored to its needs.
The experience factory, conceptually represented in Figure 1, is a logical and/or physical organization that supports project development by analyzing and synthesizing all kinds of experience, acting as a repository for such experience, and supplying that experience to various projects on demand. There are a variety of forms for packaged experience. There are, for instance,
(A) Reusable products
- reusable products of the life cycle (i.e., the Ada package that creates and updates B-trees);
- equations defining the relationship between variables (e.g., Effort = α"Size");
- models and algorithms specifying processes, methods, and techniques (e.g., an SADT diagram defining Design Inspections with the reading technique as a variable dependent upon the focus and the reader perspective).
(B) Reusable experience
- charts of data (e.g., Pareto chart of classes of software defects);
- management curves (e.g., product size growth over time with confidence levels);
- specific lessons learned associated with project types, phases, and activities (e.g., in code inspections, reading by stepwise abstraction is most effective for finding interface faults).
From this brief discussion we see that the organization of the experience factory can be divided into several suborganizations, each dedicated to identifying, collecting, organizing, providing, and maintaining a particular kind of experience.
A first level of subdivision of the experience factory can be based on the application domain [16]: for each different domain we have a different domain factory, conceptually represented in Figure 2, whose purpose is to define the process for producing applications within the domain, to implement the environment needed to support that process, and to monitor and improve that environment and process. Examples of domains are satellite ground support
software, information management software for insurance companies, some classes of C³ Systems, and so on. The experience manipulated by the domain factory is the definition of an application domain and the experience relative to engineering within that specific domain [8]. A further subdivision of the experience factory, that is the object of the discussion in this paper, is the development and packaging of software components. This function is performed by an organization we call the component factory, conceptually represented in Figure 3, which supplies software components to projects upon demand and creates and maintains a repository of those components for future use. The experience manipulated by
the component factory is the programming and application experience as it is embodied in requirements, specifications, designs, programs, and associated documentation. The software component produced and manipulated by the component factory is a collection of artifacts that provide the project organization with everything needed to integrate it in an application system and to provide life-cycle support for this system.
The separation of project organization and (experience, domain, or component) factory is not as simple as it appears in our diagrams. Having one organization that designs and integrates only, and another that develops and packages only, is an ideal picture that can present itself in many different variations. For instance, in many cases, some development will be performed in the project organization according to its needs. Therefore, the flows of data and products across the boundary are different from the ones we have shown in the figures. One of the aims of this paper is to deal with this complexity, providing a rigorous framework for the representation of problems and solutions.
We focus on the concept of component factory, both as an example of the more general concept of experience factory and as an organizational unit worth being considered independently. On one hand, the component factory will be the framework used to define and discuss various organizational structures via our concept of reference architecture, which is applicable as well to the more general frameworks of domain and experience factory. On the other hand, the discussion will give us better insight into the role of the component factory as a milestone on the roadway to an industrialization of software development.
3. THE COMPONENT FACTORY
The concept of component factory is an extension and a redefinition of the concept of software factory, as it has evolved from the original meaning of integrated environment to the one of flexible software manufacturing [10].
The major difference is that, while the software factory is thought of as an independent unit producing code and using an integrated production environment, the component factory handles every kind of code-related information and experience. The component factory is defined as a part of the experience factory, and therefore it is recognized that its potential benefits can be fully exploited only within this framework.
As noted earlier, a software component is any product in the software life-cycle, such as the following:
- **Code components**: objects implemented in some compilable, interpretable, or executable language. This includes programs, subprograms, program fragments, macros, simple classes and objects. Requirements can also be considered as code components if they are specified using some formal representation; otherwise, they are textual objects and fall into the last class of this list.
- **Designs**: objects representing function, structure, and interfaces of software components (and collections) written in a language that can be formal, semiformal, graphic, or natural. This includes structured design specifications, interface specifications, functional specifications, and logical schemata. In some cases designs are code components themselves.
- **Collections of code component or designs**: objects obtained by aggregation of several functionally homogeneous code components or designs. This includes the libraries (mathematical, statistical, graphic), the collections of packages of Ada-like languages, the composite classes of object-oriented languages, the architectures of structured design techniques.
- **Documents**: textual objects written in natural language with figures, tables, and formulas to communicate information in some organized way. This includes requirements documents, standards and policy documents, recommendations, lessons-learned documents, reports from specific studies and analyses. Hypertext objects can, in many cases, be considered in this class.
The software component produced and maintained in the component factory is the **reusable software component** (RSC); it is a collection made of a software component packaged with everything that is necessary to reuse and maintain it in the future. This means very different things in different contexts, but it should include at least the code of the component, its functional specification, its context (i.e., borrowing the term from the Ada language, the list of the software components that are in some way associated with it), a full set of test cases, a classification according to a certain taxonomy and a reuser’s manual [9].
The project organization uses reusable software components to integrate them into the programs and systems that have been designed previously. Being closer to the customer/user and more aware of its needs, the project organization is responsible for the development and the deployment of the end product.
The capability of the component factory to make reuse happen in an efficient and reliable way is a critical element for the successful application
of the reuse technology. The catalog of available components much therefore be rich, in order to reduce the chances of development from scratch, and components must be easy to find.
There are three major groups of activities associated with the production of software through reusable software components
*Use reusable software components.* When the project organization needs a component described by a certain specification, the catalog of available components is searched:
- if a ready-to-integrate component that matches the specification is found, the project organization uses it;
- if a component that needs some adaptation in order to match the specification is found, the project organization uses it after the needed modifications have been applied to the component;
- if either no component is found that matches the specification or the needed adaptation is too large to be considered a simple modification of a preexisting component, the component is ordered.
*Develop and maintain reusable software components.* A reusable software component enters into the production process because it has been recognized as useful from a preliminary analysis of the application domains associated with the project organizations [1], or, because it was needed, it has been deemed "reusable," and was not available.
Once the need for some component has been recognized or the component has been ordered, there are three ways for the component to enter into the production process:
1. by direct development either from scratch or from preexisting generic elementary processes [13];
2. by direct procurement from an external source (an external repository, a vendor) [17];
3. by extraction and adaptation from existing programs and systems [9].
In whatever way the reusable component has entered into the production process, it is adapted for further reuse by enhancement or generalization of its functions and structure, by fusion with other similar components, or by tailoring to expected needs. It is maintained to satisfy the evolving needs of the applications as identified by domain analysis and to guarantee its correctness.
Planning and economic analysis for reuse are part of this group of activities. The component factory can optimize its performance by understanding the future needs of the project organizations and developing in advance the needed artifacts, and by selecting the most economic way of coping with those needs.
*Collect and package experience from activities.* The activities of project organizations and component factory are recorded and transformed
into reusable process packages. This means they are packaged in units that are understandable by everybody interested in using them, either independent or explicitly declared and packaged with their dependencies, and retrievable using some kind of search procedure.
The experience is formalized and translated into a model. Different kinds of models are produced in order to represent the knowledge that the project organizations and the component factory have of products, process, resources, and quality factors;
- product models representing the observable characteristics of the software components through measures;
- process models representing the observable characteristics of the production process, its phases and states, and the measures that allow its control;
- resource and cost models representing the amount of resources allocated to, or estimated for, a set of activities and their distribution; and
- lessons-learned models representing the knowledge acquired from former projects and experiments.
The ability to anticipate future needs is critical to the efficient implementation of a reuse oriented paradigm and to the work of the component factory, in order to satisfy the requests coming from the project organization as soon as possible. Also critical is the ability to learn from past activities and to improve the service while providing it. Therefore, crucial to the component factory are creation and improvement of the models, based on a methodology to systematize the learning and reuse process and to make it more efficient. Models are defined and constantly improved through use—learning from past experience and translating this knowledge into changes to the model. The methodology that systematizes the learning and improving processes is the Improvement Paradigm [2] outlined in the following steps (Figure 4):
1. Plan
1.1 Characterize the activity and the environment in order to identify and isolate the relevant experience.
1.2 Set the goals and refine them into a measurable form (this is done using the GQM approach).
1.3 Choose the execution process model, the supporting methods and tools, and the associated control measurement.
2. Execute the process, control it, using the chosen measurement, and provide real-time feedback to the project organization.
3. Analyze the results and compare them with the goals defined in the planning phase.
4. Synthesize
4.1 Consolidate the results into updates to the formal models and to their relationships.
4.2 Package the updated models into reusable units and store them for future reuse.
The improvement paradigm is based upon the notion that improving the software process and product requires the continual accumulation of evaluated experience in a form that can be effectively understood and modified into a repository of integrated models which can be accessed and modified to meet current needs. It is derived from the scientific method to supply environments such as software projects, in which mathematical formalization and organizational institutionalization play a prominent role, with an incremental learning methodology. It plays, in software environments, a role similar to the Shewart–Deming cycle [11], plan/do/check/act in manufacturing environments.
4. LEVELS OF REPRESENTATION OF A COMPONENT FACTORY
The experience factory and its specialization, the component factory, are necessarily very general organizational elements. Every environment has its characteristics and pursues its goals by means different from every other one. Therefore, we need different levels of abstraction in the description of the architecture of a component factory in order to introduce at the right level
the specificity of each environment. The allocation of a function to an organizational unit is a first distinction; the actual implementation of some functions, for instance through automated tools, is another distinction. However, these choices are only variations of the paradigm of the component factory that can be captured using different levels of abstraction in representing the framework of the factory.
In this section we briefly discuss the levels of abstraction that we want to use to represent the architecture of a component factory (Figure 5):
Reference level. At this first and most abstract level we represent the building blocks, and the rules to connect them, that can be used to represent an architecture. This is not the description of a component factory but a modeling language for it. The basic building blocks are called architectural agents and represent the active elements performing
tasks within the component factory or interacting with it. They exchange among each other software objects and messages.
Example. In the last section, we discussed the activities associated with the production of software through reusable components and decided that a reusable component may enter into the production process by direct development, by procurement from an external source, or by extraction and adaptation from preexisting software. Each one of these possibilities becomes a function that can be assigned to an active element of the reference level:
- an agent decides which reusable components are needed,
- an agent develops reusable components,
- an agent provides external off-the-shelf reusable components,
- an agent extracts and reengineers reusable components, and
- an agent manages the internal repository of reusable components.
These agents have potential connections with other agents: for instance, the agent that develops reusable components is able to receive specifications from another agent, and the agent that decides which reusable components are needed is able to provide these specifications, but the actual connection is not specified at the reference level.
Conceptual level. At this level, we represent the interface of the architectural agents and the flows of data and control among them, and specify who communicates with whom, what is done in the component factory and what in the project organization. The boundary of the component factory, i.e., the line that separates it from the project organization, is defined at this level, based on needs and characteristics of an organization, and can change with them.
Example. In a possible conceptual architecture, the agent that designs systems and orders components, located in the project organization, is connected with an agent that develops reusable components, located in the component factory. Specifications and designs are exchanged between these two agents.
In another conceptual architecture, the agent that designs systems and orders components, still located in the project organization, communicates with an agent that coordinates the activities of component development and adaptation in the component factory. It is this agent that communicates with an agent that develops reusable components, exchanging specifications and designs with it.
Implementation level. At this level, we define the actual implementation, both technical and organizational, of the agents and of their connections specified at conceptual level. We assign to them process and product models, synchronization and communication rules, appropriate performers (people or computers), and specify other implementation details. The
mapping of the agents over the departments of the organization is included in the specifications provided at this level of abstraction.
Example. The organization is partitioned into the following departments:
- system analysis and deployment,
- system development,
- quality assurance and control, and
- software engineering laboratory.
In a possible organizational choice, the functions of component design are allocated to system development, and the functions of system integration are divided between system analysis and deployment and quality assurance and control. The software engineering laboratory analyzes the production process, provides the models to control the activities, and improves those models through experience. The component factory includes system development and software engineering laboratory. The process model for design is the iterative enhancement model: it starts from a group of kernel functions and delivers it to system analysis and deployment, and then expands this group of functions in order to cover the whole set of requirements in successive makes of the system. Development is done in Ada using a language-sensitive structured editor and an interactive debugger.
Each one of these levels of abstraction can be divided into sublevels by different operations applied to the agents or their connections:
- functional decomposition: an agent is decomposed in a top-down fashion into more specific agents; and
- connection decomposition or specialization: a connection between agents is decomposed into different pipelines, or the object types are refined, or synchronization rules are defined in greater detail;
The drawing of the boundary separating project organization and component factory at the conceptual level is motivated by the need for defining a formal interface between the two organizations, more formal than the one between the agents that lay inside each one. We can, for instance, imagine the boundary as a validation and verification checkpoint for the products that go across it. More generally, we can look at the pair project organization/component factor as at a user/server pair that can be used for quality measurement and improvement.
The next section discusses in some detail the reference level and then deals with the problem of the instantiation of a generic architecture into a specific one.
5. THE REFERENCE ARCHITECTURE
While the reference level describes a generic architecture, the conceptual and implementation levels describe a specific one at different levels of detail. In
order to obtain a specific architecture, we can either design it from scratch or obtain it as an instantiation of a generic architecture. The problem with the architecture designed from scratch is that it does not give enough assurances that it will be able to evolve to match the needs of the organization or to follow its evolution; designing from scratch is often focused on the needs and goals of the present organization and does not take its evolution into account.
The instantiation of a generic architecture is instead a technique that leads to more flexible architectures, because the adaptability is already in the abstraction. The specific architecture can be obtained from the abstract one through instantiation. It can be modified by altering the instantiation without changing the generic architecture, which is explicitly parametric and reusable. Besides, a generic architecture is a common denominator for comparing and evaluating different specific instantiations. It allows us to choose the architecture that is best suited for a particular organization.
The reference level provides this generic architecture. A reference architecture for the component factory is a description of the component factory in terms of its parts, structure, and purpose, defining which parts might cooperate and to what purpose [7]. The interacting parts of the reference architecture are kept free from unnecessary linkages between each other in order to keep the concerns separate and to leave this to the instantiation process. The genericity of the reference of the reference model is represented by the many possible ways of connecting parts at the conceptual level for a specific architecture, and the many ways to map them into the implementation level.
The elements of the reference architecture, the architectural agents, are the components of the factory production process. We do not make any assumption about the way they are implemented: they can be a person, a group of people, or a computer-based system. The reference architecture specifies only their tasks and the necessary communication paths, leaving to particular instantiations implementation and the specification of their nature. We can look at the agents as islands in the component factory, whose nature and implementation can be changed according to the needs and the improvement goals of the organization, independent of other agents. This allows us to implement the tasks of an agent today with a group of people, and tomorrow with a computer-based system, introducing changes that do not impact the whole organization.
Reference architecture can be associated with different life-cycle models. A previous paper has discussed the relationship between the “waterfall” model and component factory [9], showing how it is possible to split that life cycle into two separate ones. It can be shown that other life-cycle models, such as the iterative enhancements model, the spiral model, and explorative prototyping models, can be used in this context without substantial changes to the reference architecture. However, we do not deal with this issue here because it is outside the scope of this paper.
From our discussion in Section 3 of the activities associated with the production of software through reusable components, we can derive a set of functional requirements for the architectural agents operating in the compo-
ment factory or interacting with it:
—Receive the specifications of a system and produce its design, taking into account the information about existing reusable software components made available by the component factory. These functions specify the role of the designer agent.
—Build the specified system according to the design, using the reusable components made available by the component factory, and perform the system test in order to verify the conformance of the developed system with the requirements. These functions specify the role of the integrator agent.
—Choose how to fulfill a given request for a reusable software component, based on the specification of the component and on the information about existing reusable software components already available in the component factory. The choice between development from scratch and adaptation of an existing component is probably done according to a model of cost and time effectiveness, i.e., whether it is worth modifying an existing component or the modification would be so substantial that it is more convenient to develop a new component. These functions specify the role of the shopfloor coordinator agent.
—Develop a reusable software component according to a given specification. The development includes the design of the component, its implementation, and verification. These functions specify the role of the developer agent.
—Modify a reusable software component that is “close enough” to the one described by a given specification. The modification activities include the analysis of the impact of a certain adaptation, its implementation, and verification. These functions specify the role of the adapter agent.
—Produce and update reusable components based on domain knowledge, extract reusable components from existing code, and generalize already existing reusable components into other reusable components. The main difference between these functions and the development ones is that these are asynchronous with respect to the production process in the project organization. These functions specify the role of the component manipulator agent.
—Develop formal models analyzing the experience developed in the component factory and in its interfaces with the project organizations. The experience that is collected and processed has different levels of formalization, according to the incremental perspective provided by the improvement paradigm. It starts with very simple models that are improved in a continuous way in order to fit better in the actual environment of the component factory. These functions specify the role of the experience modeler agent.
—Manage the collection of objects and information that is used by the component factory to store experience and products derived from its activities (experience base). In particular, this function includes the management of the repository of reusable software components, which is a subset
of the experience base. Every agent, while performing its tasks, accesses the experience base either to use its contents or to record a log of its activity. The access control, the manipulation of objects and the search strategy to answer a request are the main experience base management functions. These functions specify the role of the Experience Base Manager agent.
Supply commercial or public domain off-the-shelf reusable components that satisfy the specifications developed by the organization. This function specifies the role of an External Repository Management agent.
This list of agents represent a complete set of architectural agents that cover all the activities of the component factory and of the project organization. However, we could have defined the agents differently. For example, the reference level can be decomposed into several sublevels, and the set of agents in the reference architecture presented here is one of these levels. Agents can be composed into larger ones or decomposed into more specific ones in a way that is very similar to the functional decomposition used in structured analysis. For instance, the designer agent can be merged with the shopfloor coordinator, obtaining an agent that specifies not only the components that are needed but also the way to obtain them. Or, the designer agent can be decomposed into a system designer agent performing the preliminary design of the system and also into the software designer agent performing the critical design.
It is also possible to expand the scope of the analysis, for instance, by introducing the collection and analysis of requirements into the picture and by specifying the agent that performs these functions in the reference architecture.
Besides a set of agents, the reference architecture contains a set of architectural rules that specify how the architectural agents can be configured and connected in the specific architectures derived from a reference architecture. One set of rules deals with the presence and replication of the agents. The agents in component factory can be unique or replicated: in the former case only one instance of the agent can be active, in the latter many instances of the agent are possibly active at the same time. For example, there might be two designer agents that share the service provided by one adapter agent.
Another set of rules deals with the connections between agents. The agents communicate with each other exchanging objects and experience at different levels of formalization, and cooperating towards the completion of certain tasks. This communication is realized through communication ports. A port is specified when we know what kind of objects can travel through it. For instance, the component manipulator agent has a port through which it receives and returns reusable software components. There are data ports and control ports: the port through which the designer agent receives the requirements for the system is a data port; the port through which it receives the process model to design the system is a control port. A port bundles several channels: each one is an elementary access point specifying the kinds of objects traveling through it and their direction. For instance, the port through
which the designer communicates, say with the shopfloor coordinator, has
two channels: an output channel to send component specifications and an
input channel to receive the requested reusable software components.
Ports can be mandatory, i.e., always presented on the agent in one or more
instances, or optional, i.e., possibly absent in certain implementations of the
agent. For instance, the developer agent always has a port through which it
receives the specifications of the components it must develop and a port
through which it returns the components it develops; these are mandatory
ports. On the other hand, the developer might or might not have a port
to receive external off-the-shelf reusable components to be used in the
development of the requested components. From the point of view of the
reference architecture, we do not make this choice, leaving it to the specific
architecture.
We can represent our reference architecture using an Ada-like language in
which the agents are task types that encompass port types in the way Ada
task types encompass entries [6]. This allows us to use the distinction
between specification and body of the task type to defer the implementation
of the agent to the specific architecture, and also to use Ada generics to
represent certain abstractions that are specified at the conceptual level. In
this representation, the architectural rules are declarative statements, incor-
porated in the definition of the agent to which they are applied.
The specification language for the reference architecture is complemented
by a configuration language whose purpose is to represent the choices made
to instantiate the reference architecture into a specific conceptual architec-
ture: presence and number of agents, presence and number of ports, and
connection of the ports. The implementation of the agents is specified by
another language, the implementation language, which assigns a task body to
each task type.
6. INSTANTIATION OF THE REFERENCE ARCHITECTURE
Reference architecture has been defined as a collection of architectural
agents and rules supported by an experience base managed by an agent.
Some freedom in this collection is eliminated by choices made when the
architecture is instantiated at the different levels of abstraction.
(A) Choices at the reference level:
(a) Activities that are part of the software development process. In
defining these activities one chooses the set of process models that
are either currently used or will be used by the organization and
breaks them down into activities that can be performed by someone
or some machine. The granularity level of this decomposition is such
that activity interfaces can be specified without specifying implemen-
tation details.
(b) Clustering of activities into agents. One chooses activities that have
strong bindings and deal with products at the same "level" of detail,
and groups them into architectural agents.
(B) Choices at the conceptual level:
(a) Boundary between component factory and project organization. In making this choice one tries to optimize reuse by incorporating more functions into the component factory on the one hand, and to optimize customer service, on the other hand, by concentration of the appropriate activities in the project organization.
(b) Presence of agents, number of agents of each type, fusion of several agents. This choice is about communication complexity: a large number of agents increases the complexity and the overhead due to communication, a small number of agents produces bottlenecks that would affect the whole organization.
(c) Presence of ports and number of ports. As in case (b), this choice deals with communication complexity: a large number of ports increases the complexity of the activities of a single agent but reduces the impact of possible bottlenecks.
(d) Interconnection of ports between different agents. This choice is about distribution of control: concentrating the control in a small group of agents makes planning easier, but serializes many activities that could otherwise be performed concurrently.
(C) Choices at the implementation level:
(a) Distribution of the agents over organizational units. This choice deals with the optimization of the already existing organization units and the smooth evolution to factory concepts. It takes into account the available resources and the historical roles of those units.
(b) Implementation of the functions of the agents (the task bodies). In choosing algorithms, procedures, methods and tools, one tries to achieve an organizational and technical profile that is correct, efficient, and best suited to the overall mission by dealing with the available resources and technology.
Therefore, in order to design a specific component factory, we need to instantiate the reference architecture by an instantiation process based on the levels of abstraction introduced earlier (Figure 6). This instantiation process is embedded in the methodological framework of the improvement paradigm now applied to the specific architecture. The four steps of the paradigm, introduced previously in a different context, become, in this context, the following:
1. Plan component factory: the desired instantiation is designed on the basis of characteristics of the organization and on the goals to be achieved.
1.1 Characterize the activities and the environment of the current organization: production process, products, formal and informal models currently in use, software tools and standards.
1.2 Set goals and priorities for the introduction of the component factory and for its separation from the project organization: productivity, customer satisfaction, product maintenance and environment stability. The goals can be refined into questions and metrics that will be used to control the production of the component factory.
1.3 Instantiate the reference architecture into a particular component factory architecture and define the associated measurement environment.
Instantiation process
A. Configuration of the architecture. (reference level → conceptual level)
A.1 Definition of the activities of the organization and mapping of those activities into specific architectural agents.
A.2 Identification of the boundary of a specific factory by specifying which agent is in the project organization and which is in the component factory.
A.3 Definition of the conceptual representation of the specific component factory by specifying the agents and connecting their ports using the configuration language.
B. Implementation of the architecture. (conceptual level → implementation level)
B.1 Specification of the mapping between the agents and their functions and the departments of the organization, and of the responsibilities for production control.
B.2 Definition of the implementation representation of the specific component factory by mapping agents and functions over specific units (e.g., people, automated or semiautomated tools), and specifying algorithms, protocols, and process models.
2. Produce components for the project organizations and load products and information into the experience base.
2.1 Execute the production process using the particular architecture that has been defined.
2.2 Control the process while executing by using the measurement environment that has been defined.
3. Analyze the results, after a preestablished period of time, assessing the level of achievement of the goals that were behind the introduction of the component factory.
4. Synthesize the results
4.1 Consolidate the results of the analysis into plans for new products, models, measures (etc.), or for updates for the existing ones
4.2 Package the new and updated products, models and measures into reusable units and store them for future reuse;
4.3 Modify the instantiation of the particular architecture and the measurement environment associated with it.
The crucial point of the process is the possibility, offered by the reference architecture, of modifying the particular architecture without modifying the interfaces between its building blocks. The modular structure allows configuration and reconfiguration of the processes as required by an efficient and realistic implementation of an optimizing paradigm. The evolution of the conceptual level and sublevels is more difficult because it has impact on the implementation level, but the explicit definition of the interface types, which is part of the reference architecture, offers a certain freedom in the evolution, even at the conceptual level. Changes in the automation and organizational choices definitely have a lower impact, if they are applied to the implementation level, leaving the conceptual level unchanged.
7. EXAMPLES OF COMPONENT FACTORY ARCHITECTURES
7.1 Clustered and Detached Architectures
In the following examples we present different approaches to the problem of software reuse. We assume we are dealing with an organization that has already made the choice of software reuse and, therefore, has some kind of process model for doing so. This assumption is not very restrictive because, at least in an informal way, reuse happens in every software project.
In order to illustrate the concepts of reference architecture and instantiation, we can present two different conceptual architectures for the component factory. The two architectures differ in the different roles they assign to the designer agent:
- in the first architecture, the designer coordinates all software development activities from the side of the project organization, we call it "clustered" architecture;
- in the second architecture, the development activities are concentrated in the component factory under the control of the shopfloor coordinator agent, we call it a "detached" architecture.
In a clustered component factory architecture (Figure 7a), every development takes place in the project organization, and the role of the component factory is to process and provide existing reusable software components. The agents are assigned in the following way:
<table>
<thead>
<tr>
<th>Project Organization</th>
<th>Component Factory</th>
</tr>
</thead>
<tbody>
<tr>
<td>Designer/Integrator/Shopfloor</td>
<td>Component manipulator</td>
</tr>
<tr>
<td>Coordinator</td>
<td>Experience modeler</td>
</tr>
<tr>
<td>Developer Adapter</td>
<td>Experience base manager</td>
</tr>
</tbody>
</table>
In a detached component factory architecture (Figure 7b), no development takes place in the project organization, but only design and integration. The project organization develops its design of the system based on the information existing in the experience base and requests from the component factory all necessary developments. It then integrates the components received from the component factory according to the design. The agents are assigned in the following way:
<table>
<thead>
<tr>
<th>Project Organization</th>
<th>Component Factory</th>
</tr>
</thead>
<tbody>
<tr>
<td>Designer Integrator</td>
<td>Shopfloor coordinator</td>
</tr>
<tr>
<td></td>
<td>Developer</td>
</tr>
<tr>
<td></td>
<td>Adapter</td>
</tr>
<tr>
<td></td>
<td>Component manipulator</td>
</tr>
<tr>
<td></td>
<td>Experience modeler</td>
</tr>
<tr>
<td></td>
<td>Experience base manager</td>
</tr>
</tbody>
</table>
The activities of the agents that form the kernel of the component factory (component manipulator, experience modeler, experience base manager) do not change in the two instantiations. However, the role of the component factory in the detached architecture is much more relevant because it encompasses activities that are both synchronous and asynchronous with the project organization.
An evaluation of the two instantiations can be performed using the GQM approach [5]. After setting the goals of the evaluation by focusing on characteristics such as performance, functionality, and evolutionary nature, from
the viewpoint of the technical management of the organization, it is possible to derive questions and metrics that allow us to collect data to perform the comparison. The GQM is a rigorous approach to the problem of comparing two different architectures. If we want to stay at an intuitive level, the following remarks can be made:
—**Performance**: The level of productivity and serviceability of the project organization/component factory system.
In the clustered architecture, the project organization develops the components that are not available; if therefore it has enough resources, it probably performs faster because there is less communication overhead and more pressure for delivery. On the other hand, the components developed in the framework of a project are more context dependent, and this puts more load on the component factory, and in particular on the component manipulator.
In the detached architecture, there is more emphasis on developing general-purpose components in order to serve more efficiently several project organizations—planning is easier and the optimization of resources is more
effective. On the other hand, there are more chances for bottlenecks and periods of inactivity, due to a lack of requests from the projects, that affect the overall performance of the organization.
— Functionality: The conformance to the operating characteristics of an organization producing software using reusable components.
In the clustered architecture, all functions are implemented, but the most critical ones are concentrated on the designer/integrator/shopfloor coordinator. Thus the errors and operating failures of this agent can affect the functionality of the whole organization.
In the detached architecture, the high modularity of functions reduces the impact of errors and failures of one agent but increases the possibility of communication errors.
— Evolutionary nature
The clustered architecture is much closer to the way software is currently implemented, and therefore its impact on the organization would be less drastic.
The detached architecture provides the component factory with additional possibilities for adaptation and configuration, making continuous improvement easier and less expensive.
The detached architecture is probably better suited for environments where the practice of reuse is somewhat formalized and mature. An organization that is just starting should probably instantiate its component factory using the clustered architecture and then, when it reaches a sufficient level of maturity and improvement with this architecture, start implementing the detached architecture to continue the improvement. The improvement paradigm, as applied to the component factory in the last section, provides a methodology for a step-by-step approach to this implementation. In this way the organization takes advantage of the flexibility and evolutionary nature of this approach, which are among the primary benefits of reasoning in terms of instantiations of a reference architecture.
7.2 The Toshiba Software Factory
A further illustration of the concepts of reference architecture and instantiation comes from the analysis of a real case study.
One of the most significant accomplishments in the attempt to make software development into an industrial process is represented by the experience of Toshiba Corp, in establishing, in 1977, the Fuchu Software Factory to produce application programs for industrial process control systems [14]. In 1985, the factory employed 2,300 people and shipped software at a monthly rate of 7.2 million EASL¹ per month.
The Toshiba accomplishments are due, first of all, to the emphasis set by the Toshiba management on teamwork and to its commitment to high performance and quality. The continuous analysis and improvement of the software process are other elements of strength in the Toshiba (and, in general, in the Japanese) experience. Since there is no improvement that is not based on reuse of prior experience, the process is designed to achieve a high level of reusability (Figure 8).
Projects design, implement, and test the application systems reusing parts that are found in a reusable software items database. Just to give an idea of the size of an application system developed by a project, we have an average size of four million EASL, but there are projects that go up to 21 million EASL. The parts are made available by a parts manufacturing department, based on the requirements specified by a software parts steering committee made up of project people and of parts manufacturing people. Statistics on alteration and utilization of parts are processed and maintained by a parts manufacturing department.
The conceptual architecture of the Fuchu software factory (Figure 9) presents the replication of some agents.
--- Project Organization
Shopfloor coordinator. This agent performs the functions of the software parts steering committee. It is very much project oriented, but some of its functions, such as planning for reuse, can be identified with some functions
¹ EASL: Equivalent Assembler Source Line of code.
of the experience modeler in the reference architecture—we can therefore position it at the border between project organization and component factory.
*Designer* 1. This agent designs the application system and the components that have been deemed project specific by the coordinator.
*Developer* 1. This agent develops the software components specified by designer 1.
*Integrator*. This agent assembles the system using the components received from developer 1 and from the component factory, according to the design provided by designer 1, and verifies its conformance with the requirements.
—*Component Factory*
*Designer* 2. This agent designs the components that have been deemed reusable by the coordinator.
*Developer* 2. This agent develops the software components specified by designer 2.
Component adapter and manipulator. This agent can be identified with the parts manufacturing department that adapts and supplies parts under request and, based on the statistics on the utilization of the software parts contained in the database, modifies and improves those parts.
Experience base manager. This agent is in charge of the management of the parts center and, in particular, of access to the reusable software items database.
A function that is not explicitly implemented in this architecture is the experience modeling function, even though the factory uses state-of-the-art techniques to manage its projects. The absence of formal modeling experience is probably one of the causes for which (according to data reported by Matsumoto) the major factor affecting productivity is the reuse of code (52.1%), while improvement of processes, techniques, and tools have a less significant impact.
8. FUTURE DIRECTIONS
Flexible automation of software development combined with reuse of life cycle products seems the most promising program to solve many of the quality and productivity problems of the software industry. It is very likely
that in the coming years we will see a wide and deep change in the industry, similar to the one that took place in manufacturing through the introduction of CIM (Computer Integrated Manufacturing).
The abstraction levels and the reference architecture presented in this paper are aimed at providing a framework to make both automation and reuse possible. The major benefits of this approach are the following:
— a better understanding of reuse and of the requirements that need to be satisfied in order to implement it in a cost-effective way;
— the possibility of using a quantitative approach, based on models and metrics, in order to analyze the tradeoffs in design associated with use of the component factory;
— formalization of the analysis of the software development process and organization, with a consequent enhancement of the possibilities for automation; and,
— the definition and use of an evolutionary model for the improvement of a reuse-oriented production processes.
Two of the major problems the software industry is facing today, when using automated production-support tools like CASE (application generators, analysis and design tools, configuration management systems, debuggers) are rigidity and lack of integration. These problems also dramatically affect the chances of reusing life-cycle products across different projects.
Tools modeled over the reference architecture would represent a significant step towards the solution of these problems because the interfaces would be specified and standardized. An organization would have the possibility of using different sets of methodologies and tools in different contexts, without dramatic change to those parts of the organization not affected by a specific choice. Besides, different alternatives can be analyzed and benchmarked, based on the input provided by the experience base on the performance of methods and tools in similar situations.
This aspect of simulation, based on historical data and formal models, is one of the most important benefits of the proposed approach, and is one of the focuses of our research. The development of a complete specification for a component factory and its execution in a simulation environment using historical data, as well as the study of the connection between application architecture and factory architecture, will be the main goals of our future work.
REFERENCES
factory. Computer Science Technical Report Series, CS-TR-91-34, Univ. of Maryland, College
12. Freeman, P. Reusable software engineering concepts and research directions. In ITT
129–137.
of Computer Science, Univ. of Maryland, College Park, Md., Jan. 1990.
14. Mathur, Y. A software factory: An overall approach to software production. In Tuto-
rial: Software Reusability, P. Freeman, Ed., Computer Society Press, Washington, D.C.,
15. McInroy, M. Mass produced software components. Software Engineering Concepts and
88–96.
17. Trace, W. Ada reusability efforts: A survey of the state of the practice. In Proceedings of
the Joint Ada Conference. Fifth National Conference on Ada Technology and Washington
Ada Symposium, U.S. Army Communications-Electronics Command, Fort Monmouth, N.J.,
1987, pp. 35–44.
Received March 1991; revised September 1991; accepted September 1991
|
{"Source-Url": "http://www.cs.umd.edu/~basili/publications/journals/J46.pdf", "len_cl100k_base": 11213, "olmocr-version": "0.1.50", "pdf-total-pages": 28, "total-fallback-pages": 0, "total-input-tokens": 25844, "total-output-tokens": 13440, "length": "2e13", "weborganizer": {"__label__adult": 0.0002942085266113281, "__label__art_design": 0.0003566741943359375, "__label__crime_law": 0.00024056434631347656, "__label__education_jobs": 0.0009031295776367188, "__label__entertainment": 4.273653030395508e-05, "__label__fashion_beauty": 0.00012946128845214844, "__label__finance_business": 0.0002334117889404297, "__label__food_dining": 0.00025200843811035156, "__label__games": 0.00044417381286621094, "__label__hardware": 0.0004892349243164062, "__label__health": 0.00026416778564453125, "__label__history": 0.00019371509552001953, "__label__home_hobbies": 5.668401718139648e-05, "__label__industrial": 0.0002601146697998047, "__label__literature": 0.0002014636993408203, "__label__politics": 0.00017893314361572266, "__label__religion": 0.0003199577331542969, "__label__science_tech": 0.00510406494140625, "__label__social_life": 5.626678466796875e-05, "__label__software": 0.005084991455078125, "__label__software_dev": 0.984375, "__label__sports_fitness": 0.0002014636993408203, "__label__transportation": 0.0003349781036376953, "__label__travel": 0.00015401840209960938}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 65265, 0.02496]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 65265, 0.60729]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 65265, 0.92965]], "google_gemma-3-12b-it_contains_pii": [[0, 2726, false], [2726, 6066, null], [6066, 9324, null], [9324, 12212, null], [12212, 13011, null], [13011, 14997, null], [14997, 18102, null], [18102, 20689, null], [20689, 23185, null], [23185, 24385, null], [24385, 25386, null], [25386, 28100, null], [28100, 30656, null], [30656, 34058, null], [34058, 36999, null], [36999, 40261, null], [40261, 43294, null], [43294, 46227, null], [46227, 47084, null], [47084, 49740, null], [49740, 52449, null], [52449, 53658, null], [53658, 54875, null], [54875, 57851, null], [57851, 58655, null], [58655, 59802, null], [59802, 62815, null], [62815, 65265, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2726, true], [2726, 6066, null], [6066, 9324, null], [9324, 12212, null], [12212, 13011, null], [13011, 14997, null], [14997, 18102, null], [18102, 20689, null], [20689, 23185, null], [23185, 24385, null], [24385, 25386, null], [25386, 28100, null], [28100, 30656, null], [30656, 34058, null], [34058, 36999, null], [36999, 40261, null], [40261, 43294, null], [43294, 46227, null], [46227, 47084, null], [47084, 49740, null], [49740, 52449, null], [52449, 53658, null], [53658, 54875, null], [54875, 57851, null], [57851, 58655, null], [58655, 59802, null], [59802, 62815, null], [62815, 65265, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 65265, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 65265, null]], "pdf_page_numbers": [[0, 2726, 1], [2726, 6066, 2], [6066, 9324, 3], [9324, 12212, 4], [12212, 13011, 5], [13011, 14997, 6], [14997, 18102, 7], [18102, 20689, 8], [20689, 23185, 9], [23185, 24385, 10], [24385, 25386, 11], [25386, 28100, 12], [28100, 30656, 13], [30656, 34058, 14], [34058, 36999, 15], [36999, 40261, 16], [40261, 43294, 17], [43294, 46227, 18], [46227, 47084, 19], [47084, 49740, 20], [49740, 52449, 21], [52449, 53658, 22], [53658, 54875, 23], [54875, 57851, 24], [57851, 58655, 25], [58655, 59802, 26], [59802, 62815, 27], [62815, 65265, 28]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 65265, 0.03869]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
5dd56063edf4d865aa37603e9aeed66f7fd973eb
|
SYSTEM FOR INITIATING INTERACTIVE COMMUNICATION IN RESPONSE TO AUDIO CODES
Inventor: Charles H. Isaacs, San Jose, CA (US)
Application No.: 12/984,365
Filed: Jan. 4, 2011
Related U.S. Application Data
Continuation-in-part of application No. 12/893,316, filed on Sep. 29, 2010, Continuation-in-part of application No. 12/894,483, filed on Sep. 30, 2010.
Abstract
A communication appliance has a processor, a data store, a display screen, an interface to a wireless network, a microphone, and software executable from a machine-readable physical medium, wherein the software provides a function for comparing incoming audio signals with signals stored in the data store as trigger signals, and a function for initiating an action or sequence of actions in response to recognizing an incoming signal as a trigger signal.
User exposed to Audio/Video Visual Stimulus
Want more detailed info?
YES
User invokes Handheld App/Listen
NO
Listen for Header
Header Recognized?
YES
Listen for Tone Body
NO
Display menu on Appliance
Download Menu from Server
NO
NO
END
Fig. 2
301 Retailer or Provider creates frequency/code
302 Embed or Combine Frequencies into Ads/Media
303 Retailer or Provider registers Frequencies
304 Upload tone Sequences and Service Menus
305 Place Ads load Media
306 Man customer Access Channels accordingly
307 Update Service Option Menu as Needed
Fig. 3
<table>
<thead>
<tr>
<th></th>
<th>Octave 3 Frequency</th>
<th>Octave 2 Code Mapping (Octal)</th>
<th>Alphanumeric Equivalent</th>
</tr>
</thead>
<tbody>
<tr>
<td>C</td>
<td>130.8</td>
<td>101</td>
<td>A</td>
</tr>
<tr>
<td>C#</td>
<td>138.6</td>
<td></td>
<td>B</td>
</tr>
<tr>
<td>D</td>
<td>146.8</td>
<td>102</td>
<td>C</td>
</tr>
<tr>
<td>E</td>
<td>155.6</td>
<td>103</td>
<td>D</td>
</tr>
<tr>
<td>F</td>
<td>164.8</td>
<td>104</td>
<td>E</td>
</tr>
<tr>
<td>F#</td>
<td>174.6</td>
<td>105</td>
<td>F</td>
</tr>
<tr>
<td>G</td>
<td>185</td>
<td></td>
<td>G</td>
</tr>
</tbody>
</table>
Assemble Code
Code Tone Sequence
82.4 Hz, 146.8 Hz, 246.9 Hz, 196.0 Hz, 110.0 Hz
Code Tone Size Property
ToneSize = 5
Code Tone Sequence
110.0 Hz, 196.0 Hz, 246.9 Hz, 146.8 Hz, 82.4 Hz
Assemble Code
Code
110196247147825
Application Code Assembly
Fig. 5
SYSTEM FOR INITIATING INTERACTIVE COMMUNICATION IN RESPONSE TO AUDIO CODES
CROSS-REFERENCE TO RELATED DOCUMENTS
BACKGROUND OF THE INVENTION
[0002] 1. Field of the Invention
[0003] The present invention is in the field of electronic commerce and pertains particularly to methods and apparatus for initiating interactive communication through a system that utilizes tone sequences to communicate code to or cause generation of code on digital computing appliances.
[0004] 2. Discussion of the State of the Art
[0005] In the field of electronic commerce, much development and advancement has been made relative to reaching potential consumers through common channels in order to make doing business over a network more efficient and less task intensive. In many advertising campaigns proactive contact with potential consumers is made through traditional media such as email, web-based banner advertising, billboard and print ads, and telephony.
[0006] The inventors are aware of a system for enabling immediate conveyance of real-time information from a contact center servicing a business. This system is described in unpublished application Ser. No. 12/893,316 listed above in the Cross-Reference to Related Documents, and is not prior art. That system utilizes an application program interface (API) implemented in software (SW) on a digital medium executable from the digital medium to be embedded into the business’s customer website. An option launch container implemented in SW executable from the digital medium associated with the website for displaying and for providing direct access to service options through the container. The container automatically downloads and temporarily or permanently installs in the toolbar area of a visitor’s browser application or as a pop-up window while that visitor is visiting the Website of the business entity.
[0007] The inventors are aware of another system for retrieving information over a network. This system is described in unpublished application Ser. No. 12/894,483 filed Sep. 30, 2010, listed in the Cross-Reference to Related Documents above, and is also not prior art. In this system, a machine-readable code is implemented in a visible fashion on a product or product representation such as a visible advertisement. Additionally, a set of machine instructions is implemented as a software application resident on and executable from the digital medium of a mobile network appliance. In this system the user operating the mobile appliance aided by the application acquires the machine readable code associated with the product or product representation such as by scanning, whereupon the machine readable code is interpreted by the application to identify, retrieve and display one or more interactive menu options relative to the product or product representation on the mobile appliance. The interactive menu options displayed may be interacted with to cause navigation to and or connection with an information source on the network adapted to service inquiries and requests relative to the product code scanned.
[0008] It has occurred to the inventor that while the above-mentioned systems provide interactive access to service options to potential consumers in a more efficient manner than can be provided through traditional media, more innovation is required to broaden the avenues through which the potential consumer can receive such proactive information.
[0009] Therefore, what is clearly needed is a system for communicating that allows potential consumers to receive or otherwise capture tone sequences proceeding from a device or system enabled for audio output that, when received and analyzed on the consumer’s appliance, cause automatic initiation of interaction between the consumer and the source or a third party representing the source of the tone sequences.
SUMMARY OF THE INVENTION
[0010] The problem stated above is that more efficient interaction between potential clients and systems marketing to those clients is desirable but many of the conventional means for creating or initiating interaction such as by proactive contact through digital media, such as by email, also introduces latency and extra work on the part of the potential client. The inventors therefore considered functional components of a mass marketing or advertising system, looking for elements that exhibit interoperability that could potentially be harnessed to provide initiation of interaction between potential clients and a commercial system but in a manner that would not create latency or add extra task work for the potential clients.
[0011] Every advertising campaign or marketing system is propelled by client response, one by-product of which is an abundance of clients willing and ready to interact with the advertising or marketing program. Most advertising and marketing campaigns employ digital media including audio and visual advertising from disparate sources to reach potential clients, and the World Wide Web (WWW), radio, television, and telephony networks and apparatus are typically part of such apparatus.
[0012] The present inventor realized in an inventive moment that if, at the point of contact with a potential client, audio signals that represent code could be efficiently communicated to the potential client’s communication appliance where such code causes the device to perform an action such as automatically retrieving and displaying interactive menu to open up a communications channel, significant reduction in latency and work associated with traditional interaction between two parties might result. The inventor thereupon provided a unique communication appliance and method for communicating that allowed potential clients to receive or otherwise capture tone sequences emanated from a device or system enabled for audio output that, when received, cause automatic initiation of interaction between the potential client and the source or a third party represented by the source of the tone sequences. A significant reduction in latency between initial contact and completion of business results, with less work involved on the part of the potential client.
[0013] Accordingly, in one embodiment of the present invention, a communication appliance is provided comprising a processor, a data store, a display screen, an interface to a wireless network, a microphone, and software executable from a machine-readable physical medium, wherein the software provides a function for comparing incoming audio sig-
nals with signals stored in the data store as trigger signals, and a function for initiating an action or sequence of actions in response to recognizing an incoming signal as a trigger signal.
[0014] In one embodiment, the incoming audio signals source from a Website, a radio, a television, a tone emitter, or another digital appliance capable of audio output. In one embodiment, the action or sequence of actions is to navigate to a server and download a menu. In another embodiment, the action or sequence of actions in response to recognizing an incoming signal as a trigger signal is to listen for a subsequent set of audio signals causing one or more further actions to be initiated.
[0015] In one embodiment, the audio signals are inaudible to humans either outside of the high end or low end of the human range of hearing. In one embodiment, the audio signals are received through the microphone. In another embodiment, the audio signals are received through the network interface. In one embodiment, the audio signals are embedded into an audio or audio/video advertisement, a music selection, a video presentation, a television program or a radio program consumed by the appliance.
[0016] In one embodiment of the invention, the software provides a further function for converting audio signals to unified product code (UPC). In another embodiment, the communication appliance further includes a frequency-to-ASCII code conversion table for converting audio signals to ASCII code usable for initiating an action or sequence of actions including generating a specific menu on the appliance.
[0017] According to one aspect of the present invention, a method is provided for initiating one or more actions from a communication appliance in response to incoming audio signals comprising the steps, (a) receiving one or more audio signals, (b) comparing the received audio signal or signals to one or more signals stored as trigger signals in a data store, and (c) upon recognizing the one or more audio signals as a trigger signal, initiating an action or sequence of actions on the appliance.
[0018] In one aspect of the method, in step (a), the incoming audio signals source from a Website, a radio, a television, a tone emitter, or another digital appliance capable of audio output. In one aspect, in step (a), the audio signals are received through a microphone or through a network interface on the appliance. In one aspect, in step (a), the audio signals are inaudible to humans either outside of the high end or low end of the human range of hearing.
[0019] In one aspect, in step (a), the audio signals are embedded into an audio or audio/video advertisement, a music selection, a video presentation, a television program or a radio program consumed by the appliance. In one aspect, in step (a), receiving one or more audio signals is manually triggered by a user operating the communication appliance as a result of a visual or audio stimulus. In one aspect, in step (b), the data store is onboard the appliance or accessible to the appliance over a network.
[0020] In one aspect of the method, in step (c), the action or sequence of actions is to navigate to a server and download a menu. In another aspect, in step (c), the action or sequence of actions is to listen for a subsequent set of audio signals causing one or more further actions to be initiated on the appliance. In one aspect of the method in step (c), the action or sequence of actions is assembling a menu on the device and opening a communications channel through the menu to an appropriate third party.
BRIEF DESCRIPTION OF THE DRAWING FIGURES
[0021] FIG. 1 is an architectural overview of a communications network supporting initiation of communication in response to audio code according to an embodiment of the present invention.
[0022] FIG. 2 is a process flow chart illustrating steps for receiving and interpreting or generating audio code for initiating communication.
[0023] FIG. 3 is a process flow chart illustrating steps for creating and registering audio code for a proactive campaign.
[0024] FIG. 4 is a frequency to ASCII code table useful for converting specific frequency sequences to ASCII code for initiating communication according to an embodiment of the present invention.
[0025] FIG. 5 is a block diagram illustrating code assembly from a code tone sequence using the SW application of FIG. 1 according to an embodiment of the present invention.
DETAILED DESCRIPTION
[0026] The inventors provide a system for communication that allows an application on a receiving computing appliance to capture and interpret audio frequencies or tones as code that is executable to perform an action on the receiving appliance. The present invention is described in enabling detail using the following examples, which may describe more than one relevant embodiment falling within the scope of the present invention.
[0027] FIG. 1 is an architectural overview of a communications network 100 supporting initiation of communication in response to audio code according to an embodiment of the present invention. Communications network 100 includes a digital wireless carrier network 101. Carrier network 101 may be a digital cellular network or a wireless digital network that can support telephony and connection to a wider network such as the Internet network. The Internet network is illustrated in this example as network 102. Internet network 102 is also represented by an Internet backbone 115, which represents all of the lines, equipment, and access points that make up the Internet network as a whole. Therefore, there are no geographic limitations on the practice of the present invention.
[0028] Internet network 102 may be a corporate wide area network or a municipal area network without departing from the spirit and scope of the present invention. The inventors choose the Internet network in this example because of its high public access characteristic. Carrier network 101 and Internet network 102 are bridged for cross communication via a network bridge or gateway 114. Carrier network 101 includes a service provider 111, which may provide both telephony communications services and access to Internet 102 for subscribed users.
[0029] A first user is illustrated in this embodiment as a digital appliance in the form of a 3rd or 4th generation smart phone 104. Smart phone 104 may be assumed to include a digital medium that is adapted to contain all of the data and software required to enable function as a smart phone. Digital appliance 104 is enabled for telephone communications and network navigation via an operating system and a network
browser application (not illustrated). In this example, appliance 104 is a smart phone, in another embodiment appliance 104 may be an iPad, an Android, or some other personal digital assistant (PDA). Appliance 104 includes a speaker system and a microphone 110.
[0030] A second user is similarly illustrated in this embodiment as a digital appliance in the form of a 3rd or 4th generation smart phone 112. The description of features and capabilities ascribed to appliance 104 also apply is same or similar manner to digital appliance 112. Digital appliance 104 and digital appliance 112 are illustrated as having active connection to service provider 111 for active telephony and Internet-based services.
[0031] A telephone carrier or telephone company (Teleeo) 113 is illustrated in this example and has connection to service provider 111 and to network bridge 114. Service provider 111 may be a separate entity from Teeleo 113 or they may be part of the same entity. Internet 102 includes a web server 116 connected to Internet backbone 115. Web server 116 includes a digital medium provided thereon or accessible thereto that is adapted to contain all of the data and software to enable function as a web server. Web server 116 hosts a registration website 117.
[0032] Registration website 117 may be provided by a third party company that may provide registration services for frequency sequences created by companies offering products and services to their consumer base. In one embodiment, companies may provide their own registration and management services to their own customer bases so web server 116 is not specifically required in order to practice the present invention. It merely provides a unified interface to consumers who may wish to interact with a variety of products and services offered by various companies.
[0033] Web server 116 may be hosted by a company that manages links and data for clients that include companies who wish to register their specific audio codes or frequencies that they may include in proactive advertisements and marketing campaigns to potential consumers such as user 104 and user 112. In one embodiment consumers may register at website 117 and have their digital appliances enabled by software to recognize audio sequences and interpret or generate executable code as a result of capturing and identifying tone sequences, for example, that various client companies have registered with the website.
[0034] One existing service that may be incorporated as a platform for practicing the invention at least one embodiment is Alluc.org. Alluc.org is a link sharing website that catalogues links to TV shows, movies, music videos, sport, anime and cartoons to make them more easily accessible. Alluc.org does not host any content itself. Alluc.org also does not contain any download links, all are links to streaming video sharing websites. Users provide the links in the right category and they are released to the site after having been checked by the administrators. Video hosting sites that are linked to Alluc.org include YouTube™, DailyMotion™ and Veoh™, amongst others.
[0035] Web server 116 has access to a repository 119 labeled links. Repository 119 is adapted to contain all of the universal resource locators (URLs) to interactive menus or other interactive data provided by business clients that may include enterprises, small businesses, and individuals. Consumers operating digital appliances like smart phone 104 as a result of executing generated or interpreted code derived from one or more tone sequences received at specified frequencies may access such links to download the information.
[0036] Web server 116 also includes connection to a repository 118 labeled data. Data repository 118 is adapted to contain all of the data associated with client registration and billing, as well as any data that might be pertinent to aiding consumers to discover the correct URL information when interpreted or generated code is executed on the receiving digital appliances. To this end, a digital appliance such as appliance 104, for example, has a software application 105a provided thereon and adapted to recognize and interpret the tone sequences that are registered at website 117. In this example, application 105a is also illustrated as opened in the form of open application 106. Open application 106 has a minimum number of functional components including a manually selectable network and ambient listening function 107, an automatic tone sequence identification or reading function 108, and a resulting action function 109 for performing an action on the appliance.
[0037] Application 105a running on digital appliance 104 may be manually invoked by a user that intends to "listen" for any transmitted tone sequences that the user's appliance may be exposed to in premeditative fashion such as by target advertising or by circumstance such as with passive consumption of generated media like web-based media or broadcast television, a movie, or a radio program. Digital appliance 112 includes an application 1056. Application 1056 may include the functions of application 105a and in addition, a function for creating tone sequences that can be embedded in an audio stream or that can be emitted as standalone audio tone sequences.
[0038] Network backbone 115 supports a web server 120. Web server 116 includes a digital medium provided thereon or accessible thereto that is adapted to contain all of the data and software to enable function as a web server. Web server 120 hosts a website 121. Website 121 represents any website managed for a company that has registered tone sequences with third-party website 117. Website 121 includes a dynamic or static, but interactive advertisement 122. Advertisement 122 represents a possible source for emanating one or more tone sequences upon interaction with the ad such as by clicking on an icon that may indicate that the advertisement is enabled to emit audio tones that may be detected relative to frequency of those tones in sequence by digital appliance 104 running application 105a, for example.
[0039] Advertisement 122 may be an audio or audio/video advertisement. A user such as one operating digital appliance 104 may visit website 121 through normal Internet service provision and click on or otherwise invoke advertisement 122. With application 105a in the invoked state 106, the user may manually select the function listen 107 causing the application to monitor the audio of advertisement 122 as it is received over the established connection for a sequence of tones that may be a forerunner to a second sequence of tones that may emulate or represent a code that becomes executable on the handheld appliance. In one embodiment, a first sequence of tones may be identified automatically by function 108 of application 105a as an alert sequence or header tone.
[0040] The header tone may comprise one or more specific frequencies that are recognized on appliance 104 by virtue of a library of "header tone sequences" belonging to different companies that may be stored on the permanent or removable memory of the digital appliance when application 105a is
A consumer registering to receive and interpret tone sequences may, in one embodiment and as part of the registration process for consumers, select from a number of product and service providers who have their own proprietary tone sequences registered with the website. In such an embodiment, the third-party service may be the service provider and may register both companies and consumers to participate. A user operating digital appliance 104 may listen for and receive and recognize a “header tone sequence” and then may listen for, receive and recognize a “code tone sequence.”
The code tone sequence may include code emulation through frequency identification such that the actual code is derived from the particular sequence of frequencies. It is noted herein that the tones or frequencies may be outside of the range of human hearing yet can still be detected by the receiving appliance. In this way tone sequences may be embedded in streaming audio and may be picked up and interpreted without diminishing the quality of the audio playing for the consumer.
Application 105a has an action function 109 that comes into play when a code tone sequence is deciphered for the code that initiates the “action”. Therefore, action function 109 may vary as to the type of action and is a direct and automatic result of interpreting or assembling and executing the resulting code received at the digital appliance through the tone sequence. An action may be to navigate to a URL and download an options menu that is related to the product or service represented by the tone code sequence. In one embodiment, code tone sequence is interpreted with the aid of a forged connection to a third-party server that contains all of the code tone sequences for a particular header tone proprietary to a company. In such an embodiment, the user may receive and recognize the header tone sequence, which triggers automatic connection to the third-party server.
Once connected to the third-party server, the code tone sequence can be matched to code tone sequences stored at the server under the recognized header or alert tone sequence for a company or service provider. Once the tone sequence is matched at the server the functional code may be retrieved from the server and executed at the appliance to perform an action, such as navigate to an order site, retrieve a menu or toolbar of current contact options for the user to pursue more information or to order a product or service represented.
Internet backbone 115 supports a multimedia server 127. Multimedia server 127 includes a digital medium provided thereon or accessible thereto that is adapted to store all of the data and software necessary to enable function as a multimedia server. Multimedia server 127 might be a video server, an advertisement server, a pod cast or web cast server, or a messaging server enabled for serving messages embedded with audio or audio/video messages or advertisements. Multimedia server 127 is connected to a data repository 128 adapted to contain the type of media served to or downloaded by users.
In one embodiment, communications network 100 includes a head end source 123 for movies 124, television 125, or radio 126 illustrated in a cloud 103 labeled local proximity, meaning that the available sources of audio, movies 124, television 125, or radio 126 are within ambient listening range of digital appliances 104. For example, a user operating digital appliance 104 may open application 105a and select “listen” 107 while watching television 125, while watching a movie 124, or while listening to radio 126. The listen function may be invoked by the user when the user becomes interested in certain content of the media such as a commercial or a specific portion or point in a program. The appliance will then listen for a tone code sequence, which when interpreted will cause the resulting action to occur on the hand-held appliance, like navigating to a server-hosted website to download a contact menu, which may be presence enabled to report current availability of agents and so on.
The actual information retrieved will depend in part on the nature of the company advertising using the tone code. For example, if the tone sequence is embedded in a special music program the user is listening to, the digital appliance, set to listen during the program, might receive tickets to a concert or a discount coupon for an album upon interpreting a received code tone sequence. If the tone code sequence can be converted to a code like ASCII using onboard rules, the resulting executable code can be used to generate (on the appliance) a menu or coupon or some usuable key that can be traded for something or that can be used to access something online. In one aspect, SW 105a may recognize a certain audio signature and could compare the signature to pre-stored signatures to instantiate functionality. The functionality can be defined as access to or download of a menu or toolbar that has interactive and updated or refreshable choices for accessing a web site or calling a call center associated with the artist, a sales enterprise, and so on.
In one embodiment the system may emulate Morse code by regulating difference in length of tones (long or short) and frequency as well, and in other ways. For example, every code sequence might start with a header tone to indicate the start of a code tone. The header tone could be emitted as a sequence of notes arranged in short and long durations. A note might be the first note at 261 Hz followed by an E note at 329 Hz or the dots of the code could all be at 261 Hz while the dashes are all at 329 Hz. As soon as the “header” tone is discerned by the handheld appliance, it triggers the parser that converts the frequencies and duration of the next tones into the “UPC” code, menu code, compiler code, or the like. There may, in one aspect, be an ending tone sequence such as an end of message (EOM) tone or tone sequence. In one embodiment as soon as enough data is stored for a code the code listening module may trigger the event that brings the menu to the handheld appliance, or takes the appropriate action on the handheld appliance.
In one aspect of the invention, SW 105b can be used to generate a tone code sequence and send that sequence to another digital appliance like appliance 104 running SW 105a. This transaction scenario may be used to initiate payment of funds from one party to another through interpretation of the code at the receiving appliance. A version of altered form of SW 105b may be used in electronic packages, cards, and other products sold in retail outlets. For example, a shopper might open a card on a pair of jeans that plays a jingle followed by a tone code sequence that provides connection to a live or recorded manufacturing information source that provides more information about the pair of jeans. The ability to transmit something to the potential buyer’s handheld appliance may increase the likelihood of some repeat business.
assumes that the user is operating a handheld appliance that is enabled by SW to practice the invention. The SW may reside on a permanent digital medium or on a removable digital medium plug able into the handheld appliance. In one aspect the SW may reside on a digital medium accessible to a third-party server and may be implemented as a temporary download that is active only when a connection to the server is maintained.
At step 201, the user operating the handheld appliance is exposed to audio/video (audio and or audio with video) or some visual stimulus such as an icon flashing in media or on a product chip or electronic emitter that indicates that a tone code sequence is available. The audio/video may be ambient audio/video such as from a television, a movie in a theater, or from a like source. If audio only, a radio or electronically recorded audio clip or message may be the source. A wide variety of scenarios could apply from point of sale scenarios to electronic ecommerce scenarios where the user is pre-connected to a network.
At step 202, the user may determine whether or not more information is desired about the instant opportunity. In one embodiment, there may be myriad opportunities offering interaction between the user and a source for more information such as in a retail environment where individual products are enabled to emit tones or multiple selections are present for tone emitting audio like a list of music selections out a music site for example. If the user is interested in learning more, at step 202, about the pending transactional opportunity, then the user may invoke the application installed on the handheld appliance if it is not already open and set the application to “listen”.
If the tone source includes a header tone, the header tone and subsequent tone code sequence (body) might be repeated periodically to accommodate a user who invokes listen in the application after the tone sequencing as already started. In this way the header tone may be captured and recognized in its entirety. If at step 202 the user is not interested or does not want to know more about a product or advertisement being promoted then the process may resolve back to step 201 until the user becomes interested in getting some more information about the advertised product or service.
Referring now back to step 203, upon setting the application to listen, the application monitor begins listening for, in this example, a header tone or tone sequence at step 204. The header tone sequences may differ between advertising entities or companies. For example, a company like Intel may use its proprietary jingle termed Intel Inside. Each company may register its own proprietary header code. The handheld appliance may recognize the tone by virtue of a header tone library that may be downloaded to the handheld appliance when the application enabling the handheld appliance to practice the invention is downloaded.
At step 205 the application running on the handheld appliance determines if it has recognized a header tone or tone sequence. If at step 205, no header tone is recognized, the process might simply loop back until a header tone is recognized. In one aspect, a user might be listening for a header tone that is not recognizable to the appliance because the appliance does not have it in its header tone library. In such a case, the SW might prompt the user if they want to go online to retrieve the header tone and load it to the existing library. In one aspect, complete header tone libraries are available on special removable media or memory cards. In another aspect, the SW may check received header tones against an online source library of header tones.
If the header tone is recognized at step 205 then the system immediately begins listening for the tone code body or sequence of tone codes at step 206. Assuming that the handheld appliance receives those immediately after the header tone, a parser is launched and reads the tone code sequence at step 207. The tone code sequence may include a tone size property that tells the parser when the entire sequence has been received. For example, if there are 5 tones in the sequence, the tone size may simply be a value of 5. At step 208, the application determines if it has read the entire sequence. If not the process loops back to step 207 until all of the tones are received and interpreted. In one aspect the SW is able to determine if there is enough data stored for an executable code because the code itself may be self-executable once it is completely stored.
If the full tone sequence is read at step 208, then the SW application may assemble the code at step 209 via a code compiler or code interpreter. The next few steps in the process may vary according to design. For example, at step 210 the application may determine whether or not to generate and display a menu, a coupon, or some other resident information as a result of assembling and executing the code at step 209. If the system is enabled for onboard code generation, execution, and resulting display of a menu, coupon, or some other information, the information will be displayed and the process will end for that sequence at step 211.
It may be that the code, once assembled, is a self-executing universal resource locator (URL). Therefore, the process may resolve to a decision at step 212 as to whether the user will navigate to an online server and download a menu, coupon, or some other information. It is noted herein that the code is not limited to enabling network navigation from the handheld appliance. It may be a telephone number that simply connects the user to an interactive voice response (IVR) unit maintained by a contact center where further interaction is by telephone. A user may have control over whether the handheld appliance will connect online to receive or download any information once the code is assembled at step 209. If the user decides not to navigate to retrieve a menu or other data at step 212, the process may end for that code sequence at step 214.
If the user determines to navigate to a URL to retrieve a menu or other information at step 212, then the process may move to step 213 where the menu or other data is downloaded from the server. Once the menu or other data is downloaded to the handheld appliance, it can be displayed on the handheld appliance for user interaction at step 215. The level of automation in process 200 may vary without departing from the spirit and scope of the present invention. For example, step 210 and step 212 may be automatic results of code assembly or interpretation on the appliance as opposed to a decision step.
FIG. 3 is a process flowchart illustrating steps for creating and registering audio code for a proactive campaign. In one aspect, a third-party website manages code registration and access to information for a fee. In this aspect, a company would register its header and tone code sequences that point to more information or otherwise provide further interaction for the user. The service might also enable subscription to users. In another case users are not required to subscribe to any services, rather the SW is automatically downloaded and installed on the handheld appliance if the user visits an enabled shopping site on the web, for example.
In the retail embodiment, the user may be prompted to go online to the third-party service to download the SW application enabling them to practice the present invention prior to being exposed to any stimulus.
At step 301, the retailer, advertiser, or simply, the provider may create their tone frequencies and code. The provider may create a header tone that is unique to that provider and is proprietary to that provider. The same header tone for that provider might precede any subsequent frequency-based code the provider creates for different products and services.
At step 302, the service hosted by a third party might enable the provider of the code to embed the code into media such as audio, video, or into an audio advertisement. In another embodiment the service does not provide facilities for creating ads or other media. At step 302 the provide embeds/combines the tone code frequencies into their ads or media that the potential consumers will be exposed to. At step 303, the retailer, advertiser, or provider may register its header tone frequency and, possibly its tone code frequencies in sequence. If tone code frequencies are executed to cause navigation to a specific URL to obtain information proprietary to the retailer, advertiser, or provider, then such sequences might be unique to that retailer, advertiser, or provider and be subject to registration. If URLs can be generated at appliance level from the tone frequency assembled or interpreted, then only the header tones need be registered. A company may have more than one header tone registered, such tones pointing to categories of products or services. The complexity may depend upon the variety of products and services a company wishes to advertise.
At step 304, the retailer, advertiser, or provider may upload tone sequences and service menus. A service menu may contain further links to resources and real-time contact information for calling service agents, help lines, or other resources. At step 305, the retailer, advertiser, or provider may place ads in local media. Other options also exist like placing audio code sequences in audio that is attached to physical products on store shelves, television and radio ads, or advertisements that are delivered through a messaging protocol like email or multimedia messaging service (MMS).
Once the advertising is in place, the retailer, advertiser, or provider may use customer access codes accordingly at step 306 to service any requests that come in from the campaign. At step 307, the retailer, advertiser, or provider may update service menu options as needed.
In one embodiment the options are presence enabled such that while a user downloads and displays the contact options menu from the company, the server may maintain a connection to the contact center managing the campaign so that all of the most recent contact options and estimated waiting time if any for response is accurately reported. In one aspect of the invention, tone code frequencies are mapped to ASCII code and, if desired alphanumeric equivalents of the ASCII codes.
FIG. 4 is a plan view of frequency to ASCII code table 400 useful for converting specific frequency sequences to ASCII code for initiating communication according to an embodiment of the present invention. In one aspect code frequencies are converted locally on the receiving appliance to an equivalent function ID or even an ASCII code. In this way service option menus can be generated from the code tone sequences alone. Table 400 represents a frequency/ASCII cross-reference mapping table that might be part of SW 105a and 105b downloaded in FIG. 1.
Table 400 includes a row 401 listing notes. Row 402 lists the octave 3 or third octave frequencies for the notes in column format. A row 403 lists the ASCII code mapping for the frequencies also in column format. Row 404 lists optional alphanumeric equivalents to the listed ASCII values. Reading in column format, the note C has a third octave frequency of 130.8 Hz and is mapped to ASCII value 101, which also has an alphanumeric equivalent of A. If function ID is alphanumerically speaking, CAB, for example, then the code tone sequence would have to be D, C, and C# at frequencies 146.8 followed by 130.8 followed by 138.6. In this way functionality may be generated on the handheld appliance without the requirement for downloading any information from a server. In one embodiment, code is assembled from the frequencies received in sequence by a code compiler that is part of the down loaded SW application running on the handheld appliance.
FIG. 5 is a block diagram illustrating code assembly from a code tone sequence using the SW application of FIG. 1 according to an embodiment of the present invention. SW 105a may, in one embodiment, be capable of assembling UPC like code from a sequence of tones (frequencies) received. In this example, the handheld appliance receives a header tone sequence 501 with application 105a set to “listen”. Header tone sequence 501 contains five different frequencies in sequence beginning with 82.4 Hz followed by 146.8 Hz, 246.9 Hz, 199.0 Hz and ending with 110.0 Hz.
In this particular example, it may be that the code tone sequence illustrated herein as code tone sequence 503 that invokes function on the handheld appliance is the header tone sequence in the reverse order. In this example, the SW observes a code tone size parameter or property of five tones. Therefore the SW listens for an additional five tones after recognizing the header tone. Code tone sequence 503 is received and the SW stops listening after the fifth tone is received.
An assembly process 504 is then invoked to “assemble” the code. In this example, assembling the code from the received frequencies involves rounding each frequency up to express the frequency in three digits and then concatenating the frequencies into a single string revealing the code 505 that invokes functionality on the handheld appliance. It will be apparent to one with skill in the art that there are numerous different ways that incoming frequencies can be mapped to or assembled into code that can be used to invoke an action on the receiving appliance.
It is not strictly necessary that the header tone described above by a precursor to functionality enabled by code and/or data stored in a data repository at the handheld appliance or retrieved from, for example, from a web-site or other remote node. In some cases the tone may have a first header that alerts the appliance that the balance of the coded information directly enables a function. For example, the balance of the tone may cause the handheld appliance to dial a number or initiate an email to a specific address.
In one embodiment the invention may provide special functions for hearing-impaired persons. If hearing impaired people attend a presentation, a class, watch a video, etc. and there isn’t a closed captioning system available, but the presenter or video has a link where the transcript is available in real time (or ready before the speech begins), then a tone can be played and a visual signal can be flashed to tell the
hearing impaired person that there is data available for the presentation. Then the transcript can be viewed on the handheld device or the menu can be presented to the hearing impaired person so they can select which functions they need. This could also apply to sight-impaired people. The tone plays, the sight-impaired person gets the data onto the handheld and then audio descriptions of what they are viewing can be dictated to the sight-impaired person.
[0072] It will be apparent to one with skill in the art that the communication system of the invention may be provided using some or all of the mentioned features and components without departing from the spirit and scope of the present invention. It will also be apparent to the skilled artisan that the embodiments described above are specific examples of a single broader invention, which may have greater scope than any of the singular descriptions taught. There may be many alterations made in the descriptions without departing from the spirit and scope of the present invention.
What is claimed is:
1. A communication appliance comprising:
a processor;
a data store;
a display screen;
an interface to a wireless network;
an interface for receiving audio signals; and
software executable from a machine-readable physical medium;
wherein the software provides:
a function for comparing incoming audio signals with signals stored in the data store as trigger signals; and
a function for initiating an action or sequence of actions in response to recognizing an incoming signal as a trigger signal.
2. The communication appliance of claim 1 wherein the incoming audio signals source from a Website, a radio, a television, a tone emitter, or another digital appliance capable of audio output.
3. The communication appliance of claim 1 wherein the action or sequence of actions comprises navigating to an Internet server and download a menu.
4. The communication appliance of claim 1 wherein the action or sequence of actions in response to recognizing an incoming signal as a trigger signal comprises listening for a subsequent set of audio signals which may cause one or more further actions to be initiated.
5. The communication appliance of claim 1 wherein the audio signals are inaudible to humans either outside of the high end or low end of the human range of hearing.
6. The communication appliance of claim 1 wherein the interface for receiving audio signals is a microphone, and the audio signals are received through the microphone.
7. The communication appliance of claim 1 wherein the interface for receiving audio signals is a network interface, and the audio signals are received through the network interface.
8. The communication appliance of claim 1 wherein the audio signals are embedded into an audio or audio/video advertisement, a music selection, a video presentation, a television program or a radio program consumed by the appliance.
9. The communication appliance of claim 1 wherein the software provides a further function for converting audio signals to unified product code (UPC).
10. The communication appliance of claim 1 further including a frequency-to-ASCII code conversion table for converting audio signals to ASCII code usable for initiating an action or sequence of actions including generating a specific menu on the appliance.
11. A method for initiating one or more actions from a communication appliance in response to incoming audio signals comprising the steps:
(a) receiving one or more audio signals;
(b) comparing the received audio signal or signals to one or more signals stored as trigger signals in a data store; and
(c) upon recognizing the one or more audio signals as a trigger signal, initiating an action or sequence of actions on the appliance.
12. The method of claim 11 wherein in step (a), the incoming audio signals source from a Website, a radio, a television, a tone emitter, or another digital appliance capable of audio output.
13. The method of claim 11 wherein in step (a), the audio signals are received through a microphone or through a network interface on the appliance.
14. The method of claim 11 wherein in step (a), the audio signals are inaudible to humans either outside of the high end or low end of the human range of hearing.
15. The method of claim 11 wherein in step (a), the audio signals are embedded into an audio or audio/video advertisement, a music selection, a video presentation, a television program or a radio program consumed by the appliance.
16. The method of claim 11 wherein in step (a), receiving one or more audio signals is manually triggered by a user operating the communication appliance as a result of a visual or audio stimulus.
17. The method of claim 11 wherein in step (b), the data store is onboard the appliance or accessible to the appliance over a network.
18. The method of claim 11 wherein in step (c), the action or sequence of actions is to navigate to a server and download a menu.
19. The method of claim 11 wherein in step (c), the action or sequence of actions is to listen for a subsequent set of audio signals causing one or more further actions to be initiated on the appliance.
20. The method of claim 11 wherein in step (c), the action or sequence of actions is assembling a menu on the device and opening a communications channel through the menu to an appropriate third party.
* * * * *
|
{"Source-Url": "https://patentimages.storage.googleapis.com/f5/d8/39/dcd0a0b7756d1b/US20120075083A1.pdf", "len_cl100k_base": 9834, "olmocr-version": "0.1.49", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 16941, "total-output-tokens": 10993, "length": "2e13", "weborganizer": {"__label__adult": 0.0006594657897949219, "__label__art_design": 0.0022430419921875, "__label__crime_law": 0.0033416748046875, "__label__education_jobs": 0.0010175704956054688, "__label__entertainment": 0.0010089874267578125, "__label__fashion_beauty": 0.00027751922607421875, "__label__finance_business": 0.02801513671875, "__label__food_dining": 0.0005908012390136719, "__label__games": 0.002044677734375, "__label__hardware": 0.0340576171875, "__label__health": 0.0004391670227050781, "__label__history": 0.0004127025604248047, "__label__home_hobbies": 0.0002529621124267578, "__label__industrial": 0.001544952392578125, "__label__literature": 0.0005879402160644531, "__label__politics": 0.0009374618530273438, "__label__religion": 0.0005974769592285156, "__label__science_tech": 0.10882568359375, "__label__social_life": 8.291006088256836e-05, "__label__software": 0.38427734375, "__label__software_dev": 0.42724609375, "__label__sports_fitness": 0.00015926361083984375, "__label__transportation": 0.0010843276977539062, "__label__travel": 0.0002696514129638672}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 50093, 0.03665]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 50093, 0.39104]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 50093, 0.91153]], "google_gemma-3-12b-it_contains_pii": [[0, 821, false], [821, 821, null], [821, 1079, null], [1079, 1391, null], [1391, 2211, null], [2211, 2475, null], [2475, 9296, null], [9296, 15968, null], [15968, 23161, null], [23161, 30183, null], [30183, 37511, null], [37511, 44662, null], [44662, 50093, null]], "google_gemma-3-12b-it_is_public_document": [[0, 821, true], [821, 821, null], [821, 1079, null], [1079, 1391, null], [1391, 2211, null], [2211, 2475, null], [2475, 9296, null], [9296, 15968, null], [15968, 23161, null], [23161, 30183, null], [30183, 37511, null], [37511, 44662, null], [44662, 50093, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 50093, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 50093, null]], "pdf_page_numbers": [[0, 821, 1], [821, 821, 2], [821, 1079, 3], [1079, 1391, 4], [1391, 2211, 5], [2211, 2475, 6], [2475, 9296, 7], [9296, 15968, 8], [15968, 23161, 9], [23161, 30183, 10], [30183, 37511, 11], [37511, 44662, 12], [44662, 50093, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 50093, 0.05294]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
61c967b020a43971e2dcad7b9a014a6f2fae9f16
|
Pie: A Domain-Specific Language for Interactive Software Development Pipelines
Gabriël Konat, Michael J. Steindorfer, Sebastian Erdweg, and Eelco Visser
Department of Computer Science and Information Systems, Delft University of Technology, The Netherlands
Abstract
Context. Software development pipelines are used for automating essential parts of software engineering processes, such as build automation and continuous integration testing. In particular, interactive pipelines, which process events in a live environment such as an IDE, require timely results for low-latency feedback, and persistence to retain low-latency feedback between restarts.
Inquiry. Developing an incrementalized and persistent version of a pipeline is one way to reduce feedback latency, but requires implementation of dependency tracking, cache invalidation, and other complicated and error-prone techniques. Therefore, interactivity complicates pipeline development if timeliness and persistence become responsibilities of the pipeline programmer, rather than being supported by the underlying system. Systems for programming incremental and persistent pipelines exist, but do not focus on ease of development, requiring a high degree of boilerplate, increasing development and maintenance effort.
Approach. We develop Pipelines for Interactive Environments (PIE), a Domain-Specific Language (DSL), API, and runtime for developing interactive software development pipelines, where ease of development is a focus. The PIE DSL is a statically typed and lexically scoped language. PIE programs are compiled to programs implementing the API, which the PIE runtime executes in an incremental and persistent way.
Knowledge. PIE provides a straightforward programming model that enables direct and concise expression of pipelines without boilerplate, reducing the development and maintenance effort of pipelines. Compiled pipeline programs can be embedded into interactive environments such as code editors and IDEs, enabling timely feedback at a low cost.
Grounding. Compared to the state of the art, PIE reduces the code required to express an interactive pipeline by a factor of 6 in a case study on syntax-aware editors. Furthermore, we evaluate PIE in two case studies of complex interactive software development scenarios, demonstrating that PIE can handle complex interactive pipelines in a straightforward and concise way.
Importance. Interactive pipelines are complicated software artifacts that power many important systems such as continuous feedback cycles in IDEs and code editors, and live language development in language workbenches. New pipelines, and evolution of existing pipelines, is frequently necessary. Therefore, a system for easily developing and maintaining interactive pipelines, such as PIE, is important.
ACM CCS 2012
- Software and its engineering → Domain specific languages; Development frameworks and environments; Source code generation; Runtime environments;
Keywords domain-specific language, pipeline, interactive software development, incremental
1 Introduction
A pipeline is a directed acyclic graph of processors in which data flows from the output of one processor to the input of its succeeding processors. Pipelines are ubiquitously used in computer hardware and software. E.g., in hardware, CPUs contain instruction pipelines that allow interleaved execution of multiple instructions that are split into fixed stages. Software pipelines compose software components by programmatically connecting their input and output ports (e.g., UNIX pipes).
In software development, pipelines are used to automate parts of the software engineering process, such as building software systems via build scripts, or continuously testing and integrating the composition of subsystems. Such pipelines are suitable for batch-processing, and often run isolated on remote servers without user interaction.
Interactive software development pipelines build software artifacts, but react instantly to changes in input data and provide timely feedback to the user. Typical examples are continuous editing of source code in an Integrated Development Environment (IDE), providing feedback through editor services such as syntax highlighting; selective re-execution of failing test cases in the interactive mode of a build system during development; or development of languages in a language workbench [14].
Interactive pipelines focus on delivering timely results when processing an event, such that the user can subsequently act on the results. Furthermore, an interactive software development pipeline should persist its state on non-volatile memory so that a session can be restarted without re-execution. Especially in the context of an IDE, restarting the development environment should not trigger re-execution of the entire pipeline, especially if pipeline steps are costly, such as advanced static analyses [42].
Interactivity complicates the development of pipelines, if timeliness and persistency become responsibilities of the pipeline programmer, rather than being supported by the underlying system. Developing an incrementalized version of an expensive operation is one way to reduce the turnaround time when re-executing the operation. However, implementing support for incrementality in a pipeline is typically complicated and error-prone. Similarly, persisting the result of expensive operations reduces the turnaround time when restarting a session, but requires tedious management of files or a database. Furthermore, when persistency is combined with incrementality, dependency tracking and invalidation is required, which is also complicated and error-prone. Therefore, an expressive system for easily developing correct incremental and persistent interactive software development pipelines is required.
One system that partially achieves this is Pluto [12], a sound and optimal incremental build system. Pluto supports dynamic dependencies, meaning that dependencies to files and other build steps are created during build execution (as opposed to before or after building), enabling both increased incrementality through finer-grained dependencies, and increased expressiveness. While Pluto focusses on build systems, it is well suited for expressing correct incremental and persistent pipelines. However, ease of development is not a focus of Pluto, as pipelines are implemented as Java classes, requiring significant boilerplate which leads to an increase in development and maintenance effort. Furthermore, persistence in Pluto is not fully automated because pipeline developers need to manually thread objects through pipelines to
prevent hidden dependencies, and domain-specific features such as file operations are not first class. These are open problems that we would like to address.
In this paper, we introduce Pipelines for Interactive Environments (PIE), a Domain-Specific Language (DSL), Application Program Interface (API), and runtime for programming interactive software development pipelines, where ease of development is a focus. The PIE DSL provides a straightforward programming model that enables direct and concise expression of pipelines, without the boilerplate of encoding incrementality and persistence in a general-purpose language, reducing development and maintenance effort. The PIE compiler transforms high-level pipeline programs into programs implementing the PIE API, resulting in pipeline programs that can be incrementally executed and persisted to non-volatile memory to survive restarts with the PIE runtime. Compiled pipeline programs can be embedded in an interactive environment such as an IDE, combining coarse grained build operations with fine-grained event processing.
To summarize, the paper makes the following contributions:
- The PIE language, a DSL with high-level abstractions for developing interactive software development pipelines without boilerplate.
- The PIE API for implementing foreign pipeline functions, and as a compilation target for the DSL, with reduced boilerplate.
- The PIE runtime that executes pipelines implemented in the API in an incremental and persistent way, which fully automates persistence and automatically infers hidden dependencies.
- An evaluation of PIE in two critical case studies: (1) modeling of the pipeline of a language workbench in an IDE setting, and (2) a pipeline for incremental performance testing.
The PIE implementation is available as open source software [26].
Outline The paper continues as follows. In Section 2 we describe requirements for interactive software development pipelines, review the state of the art, and list open problems. In Section 3 we illustrate PIE by example. In Section 4 we describe the PIE API and runtime. In Section 5 we describe the syntax, static semantics, and compilation of the PIE DSL in more detail. In Sections 6 and 7 we present critical case studies of the application of PIE in an interactive language workbench and an interactive benchmarking setting. In Section 8 we discuss related work. In Section 9 we discuss directions for future work. Finally, we conclude in Section 10.
2 Problem Analysis
In this section, we first describe requirements for interactive software development pipelines, review the state of the art, and list open problems.
Requirements We first describe the requirements for interactive software development pipelines. In order to do so, we use the example pipeline from Figure 1 as the
PIE: A DSL for Interactive Software Development Pipelines
Figure 1 Example of an interactive software development pipeline, where text from a code editor is parsed, and parse error messages are displayed in the editor.
running example in this section. In this pipeline, a code editor parses its text buffers in order to display error messages interactively to the programmer. Parsing requires a parse table, which is generated by an external process and may change when a new version of a language is deployed, with new syntax that requires regeneration of the parse table. We identify the following requirements for interactive software development pipelines:
- Incrementality. A pipeline should attempt to recompute only what has been affected by a change. For example, when only a text buffer in the code editor changes, the pipeline reparses the text and new error messages are displayed, but the generated parse table is reused because it did not change.
- Correctness. Incremental pipeline executions must have the same results as from-scratch batch executions. For example, if the parse table does change, the pipeline also reparses text and displays new error messages.
- Persistence. Results of computation should be persisted to disk in order to enable incrementality after a restart of the pipeline. For example, if we restart the code editor, the parse table is retrieved from disk instead of requiring a lengthy recomputation.
- Expressiveness. In practice, pipelines are a lot more complex than the simple example shown here. It should be possible to express more complex pipelines as well.
- Ease of development. Pipelines are complex pieces of software, especially when the previous requirements are involved. Therefore, the development and maintenance effort of pipelines should be low.
State of the Art We now review the state of the art in interactive software development pipelines, and determine to what extent existing tools meet the requirements, focusing on build systems.
Make [38], and systems with similar dependency management (e.g., Ninja, SCons, MSBuild, CloudMake, Ant), are tools for developing build systems based on declarative rules operating on files. These tools support incremental builds, but incrementality is limited to static file dependencies which are specified up front in the build rules. Because dependencies cannot be the result of computation, the dependencies must either be soundly overapproximated, which limits incrementality, or underapproximated, which is unsound. For example, a Makefile that determines the version of a Java source file, in order to parse it with the corresponding parse table file, must...
Pluto dependency graph created by executing the pipeline from Figure 1, where the code editor has 2 open text buffers.
Pluto [11] is a sound and optimal incremental build system with support for dynamic dependencies. A build system in Pluto is implemented in terms of builders, which are functions that perform arbitrary computations and dynamically record dependencies to files and other builders during execution. Executing a builder with an input produces a build, containing an output object and recorded dependencies.
Figure 2 illustrates the dependency graph Pluto produces when it executes the pipeline of Figure 1 where the code editor has two open text buffers. The dependency graph differs from the pipeline by containing builds (function calls) instead of builders (function definitions). For example, the pipeline has one parse builder, but two parse builds, one for each text buffer. We use this dependency graph to illustrate Pluto’s adherence to requirements for interactive pipelines.
- Incrementality. The code editor has two text buffers open, which have separate dependencies to a parse build. When one text buffer changes, only the corresponding parse build is recomputed. Therefore, Pluto supports fine-grained incrementality.
- Correctness. The parse builds depend on the parse table build, such that when the parse table is regenerated, the parse builds are re-executed, and new error messages are displayed in the editor. Pluto enforces this by performing hidden dependency detection. That is, if a build requires a file, without requiring the build that provides that file, Pluto marks this as an error and aborts execution.
- Persistence. While not shown in the dependency graph, builds are persisted to disk to survive restarts.
- Expressiveness. Dependencies are recorded during build execution, allowing builds to depend on files or call other builds, based on results of computation. For example, when parsing Java code, the parse builder may choose to depend on a different parse table, based on whether we want to parse text of version 8 or 9 of Java. This greatly increases the expressiveness required for interactive software development pipelines.
- Ease of development. Pluto build systems are implemented in Java, requiring significant boilerplate.
### Listing 1 The parsing pipeline implemented as Java classes in Pluto.
```java
class GenerateTable extends Builder<File, Out<File>> {
static BuilderFactory<File, Out<File>, GenerateTable> factory =
BuilderFactoryFactory.of(GenerateTable.class, File.class);
GenerateTable(File syntaxFile) { super(syntaxFile); }
@Override File persistentPath(File syntaxFile) {
return new File("generate-table-" + hash(syntaxFile));
}
@Override Out<File> build(File syntaxFile) throws IOException {
require(syntaxFile); File tblFile = generateTable(syntaxFile);
provide(tblFile); return OutputPersisted.of(tblFile);
}
}
class Parse extends Builder<Parse.Input, Out<ParseResult>> {
static class Input implements Serializable {
File tblFile; String text; BuildRequest tblReq;
Input(File tblFile, String text, BuildRequest tblReq) {
this.tblFile = tblFile; this.text = text; this.tblReq = tblReq;
}
boolean equals(Object o) /* omitted */ int hashCode() /* omitted */
}
@Override Out<ParseResult> build(Input input) throws IOException {
requireBuild(input.tblReq); require(input.tblFile);
return OutputPersisted.of(parse(input.tblFile, input.text));
}
}
class UpdateEditor extends Builder<String, Out<ParseResult>> {
@Override Out<ParseResult> build(String text) throws IOException {
File syntaxFile = new File("syntax.sdf3");
File tblFile = requireBuild(GenerateTable.factory, syntaxFile).val;
BuildRequest tblReq = new BuildRequest(GenerateTable.factory, syntaxFile);
return requireBuild(Parse.factory, new Parse.Input(tblReq, tblFile, text));
}
}
```
To summarize, Pluto provides a great foundation for implementing interactive software development pipelines, but does not cater to the pipeline developer because ease of development is not a focus, leading to a higher implementation and maintenance effort than necessary.
**Open Problems** The main problem is that Pluto build systems are not easy to develop. We list four concrete open problems:
- **Boilerplate.** Pipelines in Pluto are written in Java, which has a rigid and verbose syntax, requiring significant *boilerplate*. Pipelines are implemented as classes extending the `Builder` abstract class, as seen in Listing 1. Such a class requires generics for specifying the input and output type, a `factory` and constructor enabling other builders to create instances of this builder to execute it, a `persistentPath` method for persistence, and finally a `build` method that performs the actual build computation. The `Parse` builder requires an inner class for representing multiple input values, which must correctly implement `equals` and `hashCode`, which Pluto uses to detect if an input has changed for incrementality. Finally, calling other
Gabriël Konat, Michael J. Steindorfer, Sebastian Erdweg, and Eelco Visser
builders through `requireBuild` is verbose, because the factory is referenced, and the result is unwrapped with `.val`.
- Semi-automated persistence. Pipeline developers need to implement the `persistentPath` method of a builder and return a unique and deterministic filesystem path where the result of the builder and its input are persisted. It must be unique to prevent overlap with other builders or other inputs. For example, if the Parse builder persists results to the same file for different text buffers, it overwrites the persisted result of other builds. It must be deterministic such that the persisted file can later be found again. Since the OS filesystem is used for persistence, there are also limitations to which characters can be used in paths, and to how long a path can be. For example, on Windows, the current practical limit is 260 characters which is frequently reached with deeply nested paths, causing persistence to fail.
- Hidden dependencies. Hidden dependency detection is crucial for sound incremental builds, but is also cumbersome. In the pipeline in Listing 1, we must construct a build request object for the parse table generator, pass that object to the Parse builder, and require it to depend on the parse table generator. This becomes tedious especially in larger and more complicated pipelines.
- Missing domain-specific features. Path (handle to file or directory) and list operations, which are prevalent in software development pipelines, are not first class in general-purpose languages such as Java.
Solving these concrete problems requires a proper abstraction over interactive software development pipelines, which we present in subsequent sections.
### 3 PIE by Example
To solve the open problems from the previous section, we introduce PIE: a DSL, API, and runtime for developing and executing interactive software development pipelines. Pipelines in PIE have minimal boilerplate, fully automated persistence, automatically infer hidden dependencies, and have domain-specific features such as path and list operations. In this section we illustrate PIE by means of an example that combines building and interaction. We discuss the example and the requirements for this pipeline, present the pipeline in the PIE DSL, and discuss its features and execution.
**Example Pipeline: Syntax-Aware Editors**
As example we consider a code editor with syntax styling based on a syntax definition. The pipeline to support this use case is depicted by the diagram in Figure 3. It generates a parse table from a syntax definition, parses the program text of an editor, computes syntax styling for each token, and finally applies the computed syntax styling to the text in the editor. We want this pipeline to be *interactive* by embedding it into the IDE such that changes to the syntax definition as well as changes to the text in an editor are reflected in updates to syntax styling. The example in Figure 3 is representative for *language workbenches* [13, 14],
which support edits on a language definition that are immediately reflected in the programming environment that is derived from it.
Concretely, we instantiate the pipeline with components from the Spoofax language workbench [24]. We process an SDF [45, 46] syntax definition in two stages. First, syntax definition modules are separately transformed (normalized) to a core language. Next, the normalized modules comprising the syntax definition for a language are transformed to a parse table. The parse table is interpreted by a scannerless parser [6, 44] to parse the contents of an editor, returning an Abstract Syntax Tree (AST), token stream, and error messages. A syntax highlighter annotates tokens in the token stream with styles.
**Integrated Pipelines with the PIE DSL** Listing 2 shows the pipeline program in the PIE DSL. We first explain what each function does, and then discuss the features and execution of PIE in more detail.
The `normalize` function executes a command-line tool to normalize an SDF source file into a normalized version that is ready for parse table generation, and retrieves (dynamic) dependencies from the generated dependency (.dep) file, implemented by the `extract-deps` foreign function. The `generate-table` function executes a command-line tool on normalized files, creating a parse table file. The `parse` function, when given a parse table object, parses text into an AST, token stream, and error messages. The `style` function produces a styling based on a token stream, which can be used in source code editors for styling the text of the source code. Finally, the `update-editor` function defines the complete pipeline by composing all previously defined functions.
**Composing Pipelines with Functions** In PIE, pipelines are defined in terms of function definitions which are the reusable processors of the pipeline, and function calls that compose these processors to form a pipeline. Function calls register a dynamic call dependency from caller to callee.
**Domain-Specific Types and Dependencies** Since build pipelines often interact with files and directories, PIE has native support for path types and several operations on paths. Path literals such as `./lexical.sdf` provide an easy way to instantiate relative or absolute paths. The `requires` operation dynamically registers a path dependency from the current function call to the path, indicating that the function reads the path,
Gabriël Konat, Michael J. Steindorfer, Sebastian Erdweg, and Eelco Visser
Listing 2 PIE DSL program for the pipeline illustrated in Figure 3. Identifiers of foreign functions and data types are omitted for brevity.
```
func normalize(file: path, includeDirs: path*) -> path = {
requires file;
val normFile = file.replaceExtension("norm");
val depFile = file.replaceExtension("dep");
exec(['"sdf2normalized"'] + ['$file' + ['"-I"dir | dir <- includeDirs'] +
"-o$normFile" + "-d$depFile"],
[requires dep by hash | dep <- extract-deps(depFile)]);
generates normFile; normFile
}
func extract-deps(depFile: path) -> path* = foreign
func generate-table(normFiles: path*, outputFile: path) -> path = {
exec(['"sdf2table"'] + ['$file' | file <- normFiles] +
"-o$outputFile"),
generates outputFile; outputFile
}
func exec(arguments: string*) -> (string, string) = foreign
whereas generates records a dependency indicating the function creates or writes to the path. The read operation reads the text of a given path, and also registers a path dependency.
Path dependencies to directories can specify a filter such as with extension "sdf" to only create dependencies to files inside the directory that match the filter. Finally, path dependencies can specify how changes are detected. For example requires dep by hash indicates that a change is only detected when the hash of the file changes, instead of the (default) modification date, providing more fine grained dependency tracking.
Foreign Functions and Types Some functions are foreign, indicating that they are implemented outside of the PIE DSL, either because they are outside of the scope of the DSL (e.g., text processing required for extract-deps), or because they require system calls. For example, exec is a foreign function that takes a list of command-line arguments, executes a process with those arguments, and returns its standard output.
PIE: A DSL for Interactive Software Development Pipelines
and error text. Unlike read, exec is not first class, because it does not induce special (path) dependencies.
PIE contains several built-in types such as string and bool, but foreign types can be defined to interface with existing types. Foreign data types are required to integrate with existing code, such as an editor that expects objects of type Styling and Msg, returned by foreign functions parse and style.
Comprehensions Pipelines frequently work with lists, which are natively supported in PIE by annotating a type with * multiplicity. Lists are instantiated with list literals between [ ], and concatenated using +. List comprehensions such as [f(elem) | elem <- elems] transform a list into a new list by applying a function f to each element of the list.
Execution and IDE Integration To execute a pipeline, we compile it into a program implementing the PIE API. We embed the compiled pipeline, together with the PIE runtime, into an IDE such as Eclipse. When an editor in Eclipse is opened or changed, it calls the update-editor function through the PIE runtime with the text from the editor. The PIE runtime then incrementally executes (and persists the results of) the pipeline and returns Styling and Msgs objects, which Eclipse displays in the editor. Because the results of the pipeline are persisted, a restart of Eclipse does not require re-execution of the pipeline. This becomes especially important with larger pipelines.
Solutions to Open Problems PIE solves the open problems listed in Section 2. First of all, PIE minimizes boilerplate by enabling direct expression of pipelines in the PIE DSL through function definitions, function calls, foreign data types and functions, and path dependencies. The compiler of the DSL generates the corresponding boilerplate. Furthermore, PIE supports fully automated persistence. There is no need to specify where the result of a function call is stored. The PIE runtime stores results automatically based on the function name and input arguments. It persists the function arguments, return value, and dependencies in a key-value store, preventing filesystem issues.
Hidden call dependencies are automatically inferred. In other words, when a function requires files that are generated by another function, the first function does not explicitly need to call the latter. For example, generate-table requires files that normalize generates, but does not need to explicitly call normalize to record a call dependency which keeps the required files up-to-date. The PIE runtime infers these dependencies by keeping track of which function call generated a file, further reducing boilerplate. Note that this only infers call dependencies, not path dependencies, which still need to be declared by the pipeline programmer.
Finally, the PIE DSL caters to the pipeline developer by including domain-specific features – such as path type and operations, list type and comprehensions, string and path interpolation, and tuples – to make pipeline development convenient.
Solving these problems reduces the implementation and maintenance effort. The equivalent Pluto implementation for this pipeline requires 396 lines of Java code in 8 files (excluding comments and newlines), whereas the PIE implementation is
Listing 3 The PIE Func API and implementation of a parsing pipeline in that API.
typealias In = Serializable; typealias Out = Serializable
interface Func<in I:In, out O:Out> {
fun ExecContext.exec(input: I): O
}
interface ExecContext {
fun require(path: PPath, stamper: PathStamper = PathStampers.modified)
fun generate(path: PPath, stamper: PathStamper = PathStampers.hash)
}
class GenerateTable: Func<PPath, PPath> {
override fun ExecContext.exec(syntaxFile: PPath): PPath {
require(syntaxFile);
val tableFile = generateTable(syntaxFile);
generate(tableFile); return tableFile
}
}
class Parse: Func<Parse.Input, ParseResult> {
data class Input(val tableFile: PPath, val text: String): Serializable
override fun ExecContext.exec(input: Input): ParseResult {
require(input.tableFile); return parse(input.tableFile, input.text)
}
}
class UpdateEditor: Func<String, ParseResult> {
override fun ExecContext.exec(text: String): ParseResult {
val tableFile = requireCall(GenerateTable::class, path("syntax.sdf3"))
return requireCall(Parse::class, Parse.Input(tableFile, text))
}
}
over 6 times shorter by only requiring 62 lines of code in 2 files. The PIE code consists of 34 lines of PIE DSL code, and 28 lines of PIE API code for interfacing with foreign functions.
4 PIE API and Runtime
In this section, we review the PIE API and runtime, and our reasons for not directly reusing the Pluto runtime.
API The PIE API is a Kotlin [23] library for implementing PIE function definitions on the Java Virtual Machine (JVM). Kotlin is a programming language with a focus on reducing verbosity and increasing extensibility compared to Java, while maintaining fully compatible with Java by running on the JVM. It shares many goals with Scala [10], but additionally focusses on fast compile times and simplicity. We chose to specify the API in Kotlin instead of Java, because it has a more flexible and concise syntax. The PIE API is heavily based on the Pluto API, but uses terminology from the pipeline domain (functions instead of builders), and requires less boilerplate.
Listing 3 illustrates the parsing pipeline implemented in the PIE API. A pipeline function definition is implemented by creating a class which subtypes the Func inter-
face and overrides the `exec` function. The `exec` function takes an input, is executed in an execution context `ExecContext`, and produces an output. The execution context enables calling other pipeline functions through the `requireCall` function, and recording of path dependencies through the `require` and `generate` functions, using Kotlin’s extension functions to make these functions accessible without a qualifier. The PIE runtime uses this execution context for dependency tracking and hidden dependency inference.
Inputs of `Func` implementations must be immutable, `Serializable`, and have an `equals` and `hashCode` implementation. These properties are required so that the PIE runtime can assume objects do not change inside a cache, can persist objects to non-volatile memory, and can detect if an object has changed for incrementality. The types used in Listing 3 all adhere to these properties. Furthermore, Kotlin’s data classes automatically implement `equals` and `hashCode`, reducing boilerplate for multiple input arguments.
Outputs of functions must adhere to the same properties, with the exception that outputs can opt-out of serialization. Some outputs are in-memory object representations and cannot be serialized, are too large to be serialized, or are not immutable. PIE supports these kind of objects as outputs of function calls, by wrapping the output in a special class (`OutTransient`) which prevents serialization. PIE still caches these outputs in volatile memory. However, when the runtime is restarted (thus clearing the in-memory cache), and such an output is requested by calling the function, PIE re-executes the function to recreate the output.
Although it is possible to implement a full pipeline directly in this API, there is more boilerplate involved compared to writing the pipeline in the PIE DSL. Therefore, the API should only be used for implementing foreign functions, such as interfacing with a parse table generator and parser, or for executing system calls such as executing command-line tools. However, reduced boilerplate for implementing foreign functions reduces implementation and maintenance effort.
**Runtime**
The job of the PIE runtime is to execute a pipeline – represented as a set of `Func` implementations, from compiled PIE DSL code, and from foreign function implementations against the PIE API – in an incremental and persistent way. The runtime is largely based on the Pluto runtime, from which we inherit the sound and optimal incremental and persistent build algorithm. However, we incorporate fully automated persistence and hidden dependency inference in the PIE runtime.
The runtime calls a `Func` by calling its `exec` function with an input argument, under an execution context. During execution, a function may call other functions, and record path dependencies, through the execution context, and finally return a value. After a function has been executed, the runtime persists the returned value and recorded dependency information in a key-value store, by mapping the function call (`Func` instance and input argument) to the returned value and dependency information. This mapping is used by the incremental build algorithm as a cache and for retrieving dependency information. We use the LMDB [41] key-value database, which persists to a single file on the filesystem, and is memory-mapped for fast read access.
Therefore, we fully automate persistence, meaning that pipeline developers are freed from reasoning about persistence.
To infer hidden dependencies, whenever a path (handle to file or directory) is generated, the runtime maps (in the key-value store) the path to the function call that generated the path. Whenever a path is required, the runtime consults the mapping to look up if that path was generated by a function call. If it was, then a function call dependency is inferred from the current executing function call to the function call that generated the path. For example, in Listing 3, a call of `GenerateTable` generates the parse table file, which a call of `Parse` requires. The runtime then infers a dependency from the `Parse` call to the `GenerateTable` call. This is sound, because there may be at most one function call that generates a single path. We validate this property and abort execution when multiple function calls generate a single path. Therefore, we automatically infer hidden dependencies.
**Reusing the Pluto Runtime**
We have implemented our own API and runtime, instead of reusing the Pluto runtime, for the following three reasons. First of all, we reimple-mented parts of the Pluto runtime in order to better understand Pluto’s incremental rebuild algorithm and concrete implementation. Second, we wanted to reduce boilerplate for writing foreign functions. Third, automated persistence would be hard to implement in Pluto, because Pluto requires every pipeline function to implement a `persistentPath` function (as seen in Listing 1), which returns a unique filesystem path for persisting the result of executing a function with a particular input. We could generate a `persistentPath` implementation from the PIE DSL, but then foreign functions still need to manually implement this functions. Furthermore, filesystem paths may not contain certain characters, and have size limits (e.g., 260 characters on many Windows systems), which makes using files as a persistent storage complicated and error prone. Therefore, in the PIE runtime, we persist to a memory-mapped database.
## 5 PIE Language
In this section, we present PIE’s language definition. We present PIE’s syntax specification, describe domain-specific language constructs, and briefly look at static semantics. Finally, we describe compilation from the PIE language to the API, providing incremental and persistent pipeline execution when executed with the PIE runtime.
**Syntax**
Listing 4 shows PIE’s syntax through an EBNF grammar specification. PIE programs are composed of (foreign) function definitions and foreign data types at the top level. Its constructs can be categorized into base constructs that can be directly translated to a general purpose language, and special constructs for the domain of interactive software development pipelines that require a special translation. Base constructs include regular unary and binary operations, control flow, list comprehen-sions, value declarations and references, function definitions and calls, early return or failure, literals, and string interpolation. Special constructs include path types, path
PIE is a statically typed and lexically scoped language. As base types, PIE has the unit type, booleans, integer, strings, paths, and user-defined foreign data types. Types can be made optional (`t?`), into a list (`t*`), and composed into tuples (`(t1, t2)`). All data type and function definitions are explicitly typed, but types are inferred inside function bodies. Static type checks prevent mistakes in the pipeline from appearing at runtime. For example, it is not possible to call a pipeline function with an argument of the wrong type, as PIE's type checker will correctly mark this as a type error. Name binding prevents mistakes such as duplicate definitions and unresolved references.
Static Semantics PIE is a statically typed and lexically scoped language. As base types, PIE has the unit type, booleans, integer, strings, paths, and user-defined foreign data types. Types can be made optional (`t?`), into a list (`t*`), and composed into tuples (`(t1, t2)`). All data type and function definitions are explicitly typed, but types are inferred inside function bodies. Static type checks prevent mistakes in the pipeline from appearing at runtime. For example, it is not possible to call a pipeline function with an argument of the wrong type, as PIE's type checker will correctly mark this as a type error. Name binding prevents mistakes such as duplicate definitions and unresolved references.
Compilation To execute a PIE program with the PIE runtime, we compile it to a Kotlin program implementing the PIE API. We compile every function definition in the program to a class implementing `Func`, with corresponding input and output types, and compile its function to the `exec` method. Multiple function arguments, as well as tuple types, are translated into an immutable data class, implementing the
required equals, and hashCode functions, and the Serializable interface. Function calls are compiled to requireOutput calls on the execution context, which records a function call dependency and incrementally executes that function.
Path dependencies are translated to require and generate calls on the execution context, which records path dependencies, and which infers hidden dependencies when requiring a generated file. Path dependencies can use different stampers, which instruct the PIE runtime as to how generated and required paths are checked for changes during incremental execution. The exists stamper checks that a file or directory exists, modified compares the modification date of a file or directory, and hash compares the hash of a file, or the hashes of all files in a directory. The exists, read, list, and walk path operations are translated to function calls of built-in functions that perform these tasks and register the corresponding path dependencies. For example, the walk construct recursively walks over files and directories in a top-down fashion, returns them, and registers dependencies for each visited directory. Some path constructs also accept a filter which filter down which files and directories are visited. For example, a requires on a directory with a filter only creates path dependencies for files and directories which are accepted by the filter. A regular expression, ANT pattern, or file extension filter can be used.
Other constructs (ones that do not affect incrementality or persistence) are compiled directly to Kotlin expressions. For example, list comprehensions are translated to maps.
6 Case Study: Spoofax Language Workbench
We evaluate PIE using two critical [15] case studies that are representative for the domain of interactive software development pipelines. In this section we discuss a case study in the domain of language workbenches. In the next section we discuss a case study in the domain of benchmarking.
Spoofax [24] is a language workbench for developing textual programming languages. Spoofax supports simultaneous development of a language definition and testing the programming environment generated from that language definition. This requires complex pipelines, including bootstrapping of languages [28]. In this case study we evaluate the feasibility of implementing the Spoofax pipeline using PIE.
In the Spoofax ecosystem, a programming language is specified in terms of multiple high-level declarative meta-language definitions, where each meta-language covers a language-independent aspect (e.g., separate syntax definition [45], name binding rules [3, 29, 35], or the dynamic semantics definition of a programming language [43]). Subsequently, Spoofax generates a complete implementation of a programming language, given all the meta-language definitions. Dividing a programming language implementation into linguistic abstractions in terms high-level meta-language definitions is the key enabler for maintainability of a language, however it complicates the necessary (interactive) software development pipelines.
Spoofax supports interactive language development in the Eclipse IDE, including developing multiple language specifications side-by-side. In contrast to a regular IDE
PIE: A DSL for Interactive Software Development Pipelines
that solely processes changes of source files in the source language, Spoofax additionally comes with support for interactive software development pipelines that respond to language specification changes. For example, changes to the syntax specification are reflected by reparsing source files of the language. In order to achieve this goal, Spoofax will: (1) execute a pipeline to regenerate the language implementation based on the language specification, (2) reload the updated language implementation into the language registry, and (3) execute a pipeline for all open source files of the changed language.
The pipeline for source files will: (1) parse the source file into an AST and token stream, (2) generate syntax styling based on the token stream, (3) show parse errors (if any) and apply syntax styling, and (4) analyze and transform the source file.
6.1 Pipeline Re-Implementation
We have implemented Spoofax’ management of multiple languages, parsing, and syntax-based styling with the PIE pipeline that is illustrated in Listing 5. This is an extension to the example pipeline of Section 3, but is still a subset of the complete pipeline due to space constraints. We omit the foreign keyword for brevity.
Language Specification Management The first part of the pipeline is used to manage multiple language specifications. The LangSpec data type represents a language specification, which has a file extension and configuration required for syntax specification and styling. The Workspace type represents a workspace with multiple language specifications, which has a list of relevant file extensions, and a function to get the LangSpec for a path based on its extension. The aforementioned data types are similar to classes by binding function definitions to them. In this particular case their implementations are foreign (i.e., implemented in a JVM language), but registered in PIE in order for using them in an interactive software development pipeline. An instance of the Workspace (which contains LangSpecs) is created by the getWorkspace function from a configuration file. Interfacing with foreign functions and data types is a key enabler for embedding PIE pipelines in other programs, while still benefiting from domain-specific features such as dependency tracking.
Parse Table Generation, Parsing, and Styling The second part implements parsing. There are several foreign data and function definitions which bind to Spoofax’s tools. For example, sdf2table takes a specification in the SDF meta-language, and produces a ParseTable which can be used to parse programs with the jsglrParse function. The parse function takes as input the text to parse and the language specification containing the syntax specification mainFile to derive a parser from, creates a parse table for the language specification, and uses that to parse the input text. Parsing returns a product type containing the Ast, Tokens, and error Messages. Since parsing can fail, the AST and tokens are annotated with ? multiplicity to indicate that they are nullable (optional). The third part implements syntax-based styling, similarly to parsing.
Spooxfax pipeline in PIE, with support for developing multiple language specifications, parsing, syntax styling, and embedding into the Eclipse IDE.
<table>
<thead>
<tr>
<th>Listing 5</th>
<th>Spooxfax pipeline in PIE, with support for developing multiple language specifications, parsing, syntax styling, and embedding into the Eclipse IDE.</th>
</tr>
</thead>
<tbody>
<tr>
<td>// 1) Language specification and workspace management</td>
<td></td>
</tr>
<tr>
<td>data LangSpec = {}</td>
<td></td>
</tr>
<tr>
<td>func syntax() -> path; func startSymbol() -> string; func styling() -> path</td>
<td></td>
</tr>
<tr>
<td>data Workspace = {}</td>
<td></td>
</tr>
<tr>
<td>func extensions() -> string*; func langSpec(path) -> LangSpec</td>
<td></td>
</tr>
<tr>
<td>func createWorkspace(string, path) -> Workspace</td>
<td></td>
</tr>
<tr>
<td>func getWorkspace(root: path) -> Workspace =</td>
<td></td>
</tr>
<tr>
<td>val text = read(root + "/workspace.cfg"); createWorkspace(text, root)</td>
<td></td>
</tr>
<tr>
<td>// 2) Creating parse tables and parsing</td>
<td></td>
</tr>
<tr>
<td>data ParseTable {} data Ast {} data Token {} data Msg {}</td>
<td></td>
</tr>
<tr>
<td>func sdf2table(path) -> ParseTable</td>
<td></td>
</tr>
<tr>
<td>func jsglrParse(string, string, ParseTable) -> (Ast?, Token*, Msg*)</td>
<td></td>
</tr>
<tr>
<td>func parse(text: string, langSpec: LangSpec) -> (Ast?, Token*, Msg*) =</td>
<td></td>
</tr>
<tr>
<td>val mainFile = langSpec.syntax(); requires mainFile;</td>
<td></td>
</tr>
<tr>
<td>val startSymbol = langSpec.startSymbol();</td>
<td></td>
</tr>
<tr>
<td>val table = sdf2table(mainFile); jsglrParse(text, startSymbol, table)</td>
<td></td>
</tr>
<tr>
<td>// 3) Syntax-based styling</td>
<td></td>
</tr>
<tr>
<td>data SyntaxStyler {} data Styling {}</td>
<td></td>
</tr>
<tr>
<td>func esv2styler(path) -> SyntaxStyler</td>
<td></td>
</tr>
<tr>
<td>func esvStyle(token: Token*, SyntaxStyler) -> Styling</td>
<td></td>
</tr>
<tr>
<td>func style(tokens: Token*, langSpec: LangSpec) -> Styling =</td>
<td></td>
</tr>
<tr>
<td>val mainFile = langSpec.styling(); requires mainFile;</td>
<td></td>
</tr>
<tr>
<td>val styler = esv2styler(mainFile); esvStyle(tokens, styler)</td>
<td></td>
</tr>
<tr>
<td>// 4) Combine parsing and styling to process strings and files</td>
<td></td>
</tr>
<tr>
<td>func processString(text: string, langSpec: LangSpec) -> (Msg*, Styling?) =</td>
<td></td>
</tr>
<tr>
<td>val (ast, tokens, msg) = parse(text, langSpec);</td>
<td></td>
</tr>
<tr>
<td>val styling = if(tokens != null) style(tokens, langSpec) else null;</td>
<td></td>
</tr>
<tr>
<td>(msg, styling)</td>
<td></td>
</tr>
<tr>
<td>func processFile(file: path, langSpec: LangSpec) -> (Msg*, Styling?) = processString(read file, langSpec)</td>
<td></td>
</tr>
<tr>
<td>// 5) Keep files of an Eclipse project up-to-date</td>
<td></td>
</tr>
<tr>
<td>func updateProject(root: path, project: path) -> (path, Msg*, Styling?)* =</td>
<td></td>
</tr>
<tr>
<td>val workspace = getWorkspace(root);</td>
<td></td>
</tr>
<tr>
<td>val relevantFiles = walk project with extensions workspace.extensions();</td>
<td></td>
</tr>
<tr>
<td>[updateFile(file, workspace)</td>
<td>file <- relevantFiles]</td>
</tr>
<tr>
<td>func updateFile(file: path, workspace: Workspace) -> (path, Msg*, Styling?) =</td>
<td></td>
</tr>
<tr>
<td>val langSpec = workspace.langSpec(file);</td>
<td></td>
</tr>
<tr>
<td>val (msgs, styling) = processFile(file, langSpec); (file, msgs, styling)</td>
<td></td>
</tr>
<tr>
<td>// 6) Keep an Eclipse editor up-to-date</td>
<td></td>
</tr>
<tr>
<td>func updateEditor(text: string, path: path) -> (Msg*, Styling?) =</td>
<td></td>
</tr>
<tr>
<td>val workspace = getWorkspace(root); val langSpec = workspace.langSpec(file);</td>
<td></td>
</tr>
<tr>
<td>processString(text, langSpec)</td>
<td></td>
</tr>
</tbody>
</table>
Processing Files in the IDE The fourth part combines parsing and styling to process a single string or file and return the error messages and styling, which we can display in the Eclipse IDE. The fifth and sixth parts interface with the Eclipse IDE, by providing functions to keep an Eclipse project and editor up-to-date. A project is kept up-to-date by walking over the relevant files of the project, and returning the messages and styling for each file which are displayed in Eclipse. An editor is kept up-to-date by processing the text in the editor.
6.2 Analysis
In this section we discuss the observations we made while re-implementing the incremental software development pipeline of Spoofax in PIE. Overall, the re-implementation improves on the areas mentioned below.
Canonical Pipeline Formalism The main benefit over the old pipeline of Spoofax is that the PIE re-implementation is written in a single and concise formalism that is easier to understand and maintain. The old pipeline of Spoofax is comprised of code and configuration in four different formalisms: 1) Maven Project Object Model (POM) file that describes the compilation of Java source code, 2) an incremental build system using the Pluto [12] Java API and runtime that builds language specifications, 3) a custom (partially incremental) build system for building and bootstrapping metala
guages, and 4) a custom language registry that manages multiple language specifications. Incrementality and persistence are only partially supported, and implemented and maintained explicitly.
In contrast, the PIE pipeline is specified as a single formalism in a readable, concise, and precise way, without having to implement incrementality and persistence explicitly.
Exact (Dynamic) Dependencies Spoofax’s old pipeline emits dependencies that are either overapproximated or underapproximated, resulting in poor incrementality and therefore longer execution times. For example, in Spoofax, changing the styling specification will trigger parsing, analysis, compilation, and styling for all editors, even though only recomputation of the styling is required (i.e., sound overapproximation). On the other hand, changing the syntax specification will not trigger reparsing of files that are not open in editors (i.e., unsound underapproximation). In the PIE pipeline, these problems do not occur because of the implicit incrementality of function calls, and the right path dependencies.
For example, the parse function creates several dependencies which enable incremental recomputation. When the input text, mainFile path, contents of the mainFile, or the startSymbol changes, the function is recomputed. Furthermore, the function creates a parse table, which is a long-running operation. However, because of incremental recomputation and persistence, the parse table is computed once, and after that only when the syntax specification changes.
Support for Complex Pipeline Patterns Due to space constraints, the code listing in Listing 5 omits the parts necessary for using Spoofax’s name binding language and constraint solver, interfacing with existing Spoofax languages, and bootstrapping languages, but our re-implementation does support the aforementioned features. The full implementation can be found online [27].
7 Case Study: Live Performance Testing
In this section we evaluate PIE on a case study for continuously monitoring the performance of a set of libraries. Specifically we use a snapshot of the Criterion benchmark suite [39] that measures the performance of immutable hash-set/map data structures...
on the JVM. The snapshot of Criterion was submitted as a well-documented artifact to accompany the findings of a research paper [40].
Under the hood, Criterion uses the Java Microbenchmarking Harness (JMH) [21] to execute benchmark suites against seven data structure libraries, producing Comma-Separated Values (CSV) files with statistical-relevant benchmarking data. Criterion uses bash scripts for orchestration, requiring to re-run all benchmarks whenever a benchmark or subject library changes. Those scripts are not able to exploit incrementality, which is tedious since benchmarking all combinations takes roughly two days, to produce statistically significant outputs.
We re-engineered the pipeline such that initially each subject and benchmark combination is tested in isolation, and then incrementally re-execute all benchmarks for a particular subject if and only if that subject changes. In case the implementation of a benchmark changes, all subjects are re-tested for that benchmark. Regardless of the scenario, the CSV result files are kept up-to-date for subsequent data visualization.
We can apply such a pipeline on a local machine while developing the benchmarks for timely performance test results, or on a remote benchmarking server to minimize the amount of benchmarking work when something changes. While it is technically possible to write such an incremental pipeline in bash scripts, it would require a lot of manual work to implement, and will likely result in error-prone code. Fortunately, it is straightforward to write this pipeline in PIE.
7.1 Pipeline Re-Implementation
Listing 6 illustrates the benchmarking pipeline in PIE. The build function builds the benchmark and yields an executable JAR file ./target/benchmarks.jar, by invoking Maven on the POM file ./pom.xml. The build function requires all Java and Scala source files, to ensure that the JAR file is rebuilt as soon as a single source files changes.
To produce a CSV result file, the run_benchmark function executes the JAR file with the necessary command-line arguments for the JMH library, including the combination of benchmark and subject. The tuples benchmark and subject both store unique name identifiers—that are later used for naming the CSV file—and references to files they are comprised of. These file references are used by PIE to create dependencies for incremental re-execution.
Finally, main glues everything together by creating a list of benchmarks and subjects, running the benchmark with each combination of those, and by returning the up-to-date CSV files for subsequent data visualization.
7.2 Analysis
Compared to the existing bash script, the PIE pipeline provides incremental and persistent execution, and static analysis. The main benefit of the PIE pipeline over the bash script is that it provides incremental execution by function calls and path dependency annotations. In bash, implementing an incremental pipeline requires the pipeline developer to explicitly encode dependency tracking, change detection, caching,
and more, which is why the existing bash script is not incremental. In the PIE pipeline, incrementality comes from stating the `requires` and `generates` dependencies in each function, which is straightforward because it is clear what the dependencies of each function are.
Furthermore, PIE performs static name and type analysis, before executing the pipeline, whereas bash has no static checks at all. This means that errors such as simple typographical errors, or appending a value of a wrong type to a list of strings, result in a static error in PIE which is easily fixed, but result in run-time errors in bash.
## 8 Related Work
In this section we discuss related work with a focus on build systems. Table 1 provides a feature overview of the systems we discuss throughout this section.
### Partial Domain-Specific Build Abstractions
Make [38] is a build automation tool based on declarative rules. Make extracts a static dependency graph from these rules, and executes the commands according to the dependency graph. Upon re-execution, Make is able to detect unchanged files that do not require regeneration based on time-stamps. Make supports a limited form of dynamic dependencies that does not generalize, i.e., an include directive that allows loading other Makefiles.
Automake [30] alleviates many of Make’s shortcomings by introducing a formalism on top of Make that generates Makefiles. Automake is mostly geared towards C compilation and other compilation processes that follow similar patterns, but cannot be used to write arbitrary interactive pipelines, making it less flexible than PIE. Due to a lack of static checking, ill-typed Automake scripts may propagate defects — that are only detectable at run time — to the generated Makefiles. In contrast, PIE catches such errors statically before pipeline execution.
OMake [18] is a build tool with a Make-like syntax, but with a richer dependency tracking mechanism. PIE is similar to OMake in that both supports a form of dynamic path dependencies (called side-effects in OMake), and incrementality based on these dependencies. However, like Make, OMake works exclusively with files and command-line processes, meaning that it is not possible to depend on the result of a function call, or to interface with foreign functions and types, making it unsuitable for interactive pipelines which require embedding into an interactive system.
Tup [37] is a build tool with Make-like rules. Tup automatically infers required file dependencies by instrumenting the build process, providing more fine-grained dependencies than Make. However, the dependency on the input file and generated file must still be declared statically upfront.
PROM [25] is a Prolog-based make tool where Make-like builds are specified declaratively and executed as Prolog terms, increasing expressiveness and ease of development. PROM's update algorithm executes in two phases, where first a file-dependency graph is created, after which creation rules are executed to create new files, or to update out-of-date files. Because of these phases, PROM does not support dynamic discovery of dependencies during build execution.
Nix [7, 9] is a purely functional language for building and deploying software, aimed to manage configurations of the operating system NixOS [8]. Nix supports incremental execution of pipelines through cryptographic hashes of attributes and files, but must be explicitly initiated by the developer through the use of the mkDerivation function. While incrementality becomes explicit, Nix puts the burden on pipeline developers, whereas PIE supports incrementality implicitly. Furthermore, Nix is dynamically checked, meaning that name and type defects are reported at runtime, as opposed to before runtime with static checking in PIE.
Maven [17] is a software dependency management and build tool, popular in the Java ecosystem. It features a fixed sequence of pipeline steps such as compile, package, and deploy, which are configured through an XML file. Maven is neither incremental nor interactive, requiring a full batch re-execution every time data in the pipeline changes.
Ant [16] is a build automation tool, using XML configuration files for defining software development pipelines. Ant supports incrementality by inserting up to date statements that check if a source file is up to date with its target file, making incrementality explicit, at the cost of burdening the developer. Ant does not provide static analysis.
Gradle [20] is a build automation tool, programmable with the Groovy language, featuring domain-specific library functions to specify builds declaratively. Gradle supports incremental task execution through annotations that specify a task's input/output variables, files, and directories. Like Make, dependencies have to be specified statically up-front, causing an overapproximation of dependencies.
Jenkins is a continuous integration server which can be programmed with its Groovy pipeline and a set of domain-specific library functions [22]. Jenkins can detect changes to a (remote) source code repository to trigger re-execution of an entire build pipeline, however without support for incrementality.
Software Development Pipelines as a Library Subsequently discussed software pipeline solutions are available as a library (i.e., internal DSL) implemented in a general-purpose programming language. Unlike an external DSL solution such as PIE, those libraries do not support domain-specific syntax or error reporting in terms of the domain, instead requiring encoding of domain concepts. Furthermore, it is hard, if not impossible, to restrict features of a programming language via a library, that heavily influence incrementality, such as mutable state. Finally, the compiler of the PIE DSL can be retargeted to a different environment or programming language, enabling a PIE pipeline to be embedded into different interactive environments without (or minimal) alteration.
Shake [33, 34] is a Haskell library for specifying build systems. Unlike Make, required file dependencies can be specified during builds in Shake, supporting more complex dependencies and reducing overapproximation of dependencies. However, like Make, targets (generated file dependencies) have to be specified up-front. This means that it is not possible to specify builds where the names of generated files are decided dynamically. For example, the Java compiler generates a class file for each inner class in a source file, where its file names are based on the inner and outer class name. Therefore, the generated file dependencies of the Java compiler are decided dynamically, and cannot be specified in Shake.
Pluto [12] is a Java library for developing incremental builds, which we have already discussed extensively in Section 2. One difference between Pluto and PIE is that Pluto supports incremental cyclic builders, whereas PIE does not. We have opted not to implicitly support cycles for simplicity of the build algorithm, and because cycles typically do not appear in pipelines. Cycles can be handled explicitly in PIE by programming the cyclic computation inside a single pipeline function.
Fabricate [19] is a Python library for developing incremental and parallel builds, that aims to automatically infer all file dependencies by tracing system calls. System call tracing is not cross-platform, only fully supporting Linux at the moment. PIE in contrast is cross-platform, because its runtime works on any operating system the JVM runs on.
Apache Spark [4] is a big data processing framework where distributed datasets are transformed by higher-order functions. PIE is similar to Spark in that both create dependency graphs between calculations. For example, when transforming a dataset with Spark (e.g., with map or filter), the derived dataset depends on the parent dataset, such that the derived dataset is rederived when the parent changes. PIE differs from Spark in that PIE works with local data only, whereas Spark works with a distributed storage system required for big data processing. However, PIE supports arbitrary computations (as opposed to a fixed set of higher-order functions in Spark), and dynamic file dependencies.
General-Purpose Languages Reusing an existing general-purpose language, such as Java or Haskell, and giving it an incremental and persistent interpretation is not feasible for several reasons. It requires adding additional constructs to the language, such as path dependencies and operations, which require changes to the syntax, static semantics, dynamic semantics (compiler or interpreter) of the language. That requires
at the very least being able to change the language, which is not always possible. Even when it is possible, language parsers, checkers, and compilers are often large codebases that require significant effort to change. Furthermore, we also need to ensure that existing constructs work under incrementality. For example, mutable state in Java interferes with incrementality.
**Reactive Programming** Reactive programming is characterized by asynchronous data stream processing, where data streams form a pipeline by composing streams with a set of stream combinators. Reactive programming approaches come in the form of libraries implemented in general-purpose languages, such as Reactive Extensions [31], or as an extended language such as REScala [36]. Reactive programming approaches provide a form of incrementality where the reactive pipeline will rerun if any input signal changes. However, they do not cache outputs or prevent re-execution of pipeline steps when there are no changes. Note that reactive programming approaches operate in volatile memory only, whereas PIE's runtime supports persistence (i.e., pause and resume) of pipeline executions. Preserving a pipeline's state is of special importance in interactive environments such as IDEs, to support restarting the programming environment without re-triggering potentially expensive calculations. Furthermore, reactive programming approaches do not support (dynamic) file dependencies.
**Workflow Languages** Workflows, like pipelines, describe components (processors) and how data flows between these components. Workflow languages are DSLs which are used to model data analysis workflows [2], business process management [1], and model-to-model transformations [5], among others. The crucial differentiation between many workflow systems and software development pipelines, is that the former model manual steps that require human interaction, whereas the latter focuses on processors that perform general purpose computations.
### Future Work
We now discuss directions for future work.
**First-Class Functions and Closures** Currently, the PIE DSL does not support first-class functions and closures, for simplicity. The PIE runtime does support first-class functions, since function calls are immutable and serializable values which can be passed between functions and called. However, closures are not yet supported, because (again for simplicity), functions must be registered with the runtime before a pipeline is executed.
To fully support first-class functions and closures, we must add them to the PIE DSL, and support closures in the runtime and API. This requires closures to be serializable, which the JVM supports. Closures from foreign functions must ensure not to capture mutable state, non-serializable values, or large objects graphs, as these can break incrementality. Spores [32] could be used to guarantee these properties for closures.
Live Pipelines PIE pipelines can dynamically evolve through the inputs into the pipeline: files on the filesystem such as configuration files, and objects passed through function calls such as editor text. However, the pipeline code itself currently cannot dynamically evolve at runtime. When the pipeline code itself is changed, the pipeline must be recompiled and reloaded. This process is relatively fast, because compiling PIE DSL code and restarting the JVM is fast, but can be improved nevertheless. Furthermore, dynamic evolution of pipelines at runtime is especially important if we want to apply PIE to live programming environments.
While there are known solutions for compiling and reloading code in the JVM, such as using class loaders, it is unclear how to handle incrementality in the face of changes to the pipeline program. For example, if the `normalize` function in Listing 2 is changed, all calls of `normalize` are potentially out-of-date and need to be re-executed, as well as all function calls that (transitively) call `normalize`. Similarly, foreign functions and data types can be changed, which require re-execution or even data migrations in the persistent storage.
Conclusion
We have presented PIE: a DSL, API, and runtime for developing interactive software development pipelines. PIE provides a straightforward programming model that enables direct and concise expression of pipelines with minimal boilerplate, reducing the development and maintenance effort of pipelines. Compared to the state of the art, PIE reduces the code required to express an interactive pipeline by a factor of 6 in a case study on syntax-aware editors. Furthermore, we have evaluated PIE on two complex interactive software development pipelines, showing that the domain-specific integration of features in PIE enable concise expression of pipelines, which are normally cumbersome to express with a combination of traditional build systems and general-purpose languages.
Acknowledgements
This research was supported by NWO/EW Free Competition Project 612.001.114 (Deep Integration of Domain-Specific Languages) and NWO VICI Project (639.023.206) (Language Designer’s Workbench).
References
[2] Peter Amstutz, Michael R. Crusoe, Nebojša Tijanić, Brad Chapman, John Chilton, Michael Heuer, Andrey Kartashov, Dan Leehr, Hervé Ménager, Maya Nedeljkovich,
PIE: A DSL for Interactive Software Development Pipelines
PIE: A DSL for Interactive Software Development Pipelines
PIE: A DSL for Interactive Software Development Pipelines
### About the authors
**Gabriël Konat** is a PhD candidate at Delft University of Technology, where he works on domain-specific languages, language workbenches, bootstrapping, and incrementalization. His current work includes designing a DSL for programming incremental pipelines, improving the scalability of incremental pipeline algorithms, and applying incremental pipelines to language workbenches. You can contact him at g.d.p.konat@tudelft.nl.
**Michael J. Steindorfer** is a senior software engineer working in industry and a guest researcher at the Delft University of Technology. His research and engineering efforts focus on optimizing functional data structures, the design and implementation of programming languages, and improving big data processing runtimes for cloud infrastructures. You can contact him at michael@steindorfer.name.
**Sebastian Erdweg** is an assistant professor at Delft University of Technology, where he works on the foundation and application of programming languages. His current work includes incremental static analysis and build systems, modernizing legacy code to adopt new language features, and safe refactorings, analyses, type systems, and program transformations. You can contact him at s.t.erdweg@tudelft.nl and find further information at http://erdweg.org.
**Eelco Visser** is Antoni van Leeuwenhoek Professor of Computer Science and chair of the Programming Languages Group at Delft University of Technology. His current research is on the foundation and implementation of declarative specification of programming languages. You can contact him at e.visser@tudelft.nl and find further information at http://eelcovisser.org.
|
{"Source-Url": "https://pure.tudelft.nl/portal/files/45645283/1803.10197v1.pdf", "len_cl100k_base": 14237, "olmocr-version": "0.1.49", "pdf-total-pages": 32, "total-fallback-pages": 0, "total-input-tokens": 87925, "total-output-tokens": 20032, "length": "2e13", "weborganizer": {"__label__adult": 0.000331878662109375, "__label__art_design": 0.0002646446228027344, "__label__crime_law": 0.0001863241195678711, "__label__education_jobs": 0.0005903244018554688, "__label__entertainment": 5.3882598876953125e-05, "__label__fashion_beauty": 0.00013208389282226562, "__label__finance_business": 0.0001398324966430664, "__label__food_dining": 0.0002796649932861328, "__label__games": 0.00043487548828125, "__label__hardware": 0.00048160552978515625, "__label__health": 0.0002765655517578125, "__label__history": 0.00015687942504882812, "__label__home_hobbies": 5.990266799926758e-05, "__label__industrial": 0.00022423267364501953, "__label__literature": 0.00019478797912597656, "__label__politics": 0.00019538402557373047, "__label__religion": 0.0003879070281982422, "__label__science_tech": 0.00255584716796875, "__label__social_life": 7.128715515136719e-05, "__label__software": 0.003490447998046875, "__label__software_dev": 0.98876953125, "__label__sports_fitness": 0.00023055076599121096, "__label__transportation": 0.00031638145446777344, "__label__travel": 0.0001646280288696289}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 83237, 0.02081]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 83237, 0.54541]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 83237, 0.83141]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 3071, false], [3071, 6667, null], [6667, 9492, null], [9492, 12166, null], [12166, 14455, null], [14455, 17324, null], [17324, 20408, null], [20408, 22856, null], [22856, 24787, null], [24787, 28119, null], [28119, 30574, null], [30574, 33977, null], [33977, 37141, null], [37141, 38960, null], [38960, 42231, null], [42231, 45435, null], [45435, 48326, null], [48326, 51245, null], [51245, 51924, null], [51924, 54975, null], [54975, 56814, null], [56814, 60181, null], [60181, 63637, null], [63637, 66571, null], [66571, 69118, null], [69118, 71823, null], [71823, 74605, null], [74605, 77446, null], [77446, 80370, null], [80370, 81559, null], [81559, 83237, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 3071, true], [3071, 6667, null], [6667, 9492, null], [9492, 12166, null], [12166, 14455, null], [14455, 17324, null], [17324, 20408, null], [20408, 22856, null], [22856, 24787, null], [24787, 28119, null], [28119, 30574, null], [30574, 33977, null], [33977, 37141, null], [37141, 38960, null], [38960, 42231, null], [42231, 45435, null], [45435, 48326, null], [48326, 51245, null], [51245, 51924, null], [51924, 54975, null], [54975, 56814, null], [56814, 60181, null], [60181, 63637, null], [63637, 66571, null], [66571, 69118, null], [69118, 71823, null], [71823, 74605, null], [74605, 77446, null], [77446, 80370, null], [80370, 81559, null], [81559, 83237, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 83237, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 83237, null]], "pdf_page_numbers": [[0, 0, 1], [0, 3071, 2], [3071, 6667, 3], [6667, 9492, 4], [9492, 12166, 5], [12166, 14455, 6], [14455, 17324, 7], [17324, 20408, 8], [20408, 22856, 9], [22856, 24787, 10], [24787, 28119, 11], [28119, 30574, 12], [30574, 33977, 13], [33977, 37141, 14], [37141, 38960, 15], [38960, 42231, 16], [42231, 45435, 17], [45435, 48326, 18], [48326, 51245, 19], [51245, 51924, 20], [51924, 54975, 21], [54975, 56814, 22], [56814, 60181, 23], [60181, 63637, 24], [63637, 66571, 25], [66571, 69118, 26], [69118, 71823, 27], [71823, 74605, 28], [74605, 77446, 29], [77446, 80370, 30], [80370, 81559, 31], [81559, 83237, 32]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 83237, 0.12011]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
88d54befa78bf39308363318c4499c24e68bee98
|
A multi-instance, multi-user animation platform includes a plurality of modeled parallel dimensions in a computer memory. Each of the parallel dimensions may be an independent model of a physical, three-dimensional space having corresponding features such that the parallel dimensions are recognizable as counterparts to each other. Avatars are located within corresponding ones of the parallel dimensions so as to prevent over-population of any one of the parallel dimensions by avatars. Avatars are animated within different ones of the parallel dimensions using input from respective users to provide virtual-reality data. The virtual-reality data may be configured to cause remote clients to output an animated display of a corresponding one of the parallel dimensions and avatars therein.
25 Claims, 7 Drawing Sheets
|-------------------------------------|-----------------|----------------|
**OTHER PUBLICATIONS**
* cited by examiner
FIG. 1
FIG. 7A
Virtual Service
Dr. Smith: Hi, how can I Help You?
Amy: My Legs are Acting Strangely. Would You Review My Configuration?
FIG. 7B
Virtual Service
The Doctor is Busy Assisting Another Patient. You are Next in Line. Estimated Wait Time: 5 mins
FIG. 7C
Virtual Service
Dr. Smith: Hi, how can I Help You?
Amy: My Legs are Acting Strangely. Would You Review My Configuration?
800
802
Model Dimensional Space
804
Monitor Avatar Population
806
Limit?
808
Generate or Open Duplicate Dimension
810
Distribute Avatars Between Dimensions
FIG. 8
900
902
Animate Avatars and Objects in Each Dimension
904
Generate Portal Output Data
906
Send Output to Multiple Remote Clients
910
Remote Clients Display Animated View of Dimensions
FIG. 9
1000
1002
Model Inter-dimensional Interface
1004
Monitor Approaching Objects
1006
Allowed ?
1008
Yes
Transfer or Duplicate Object in Destination Dimension
No
1010
Bounce or Stop Object in Originating Dimension
FIG. 10
BACKGROUND
1. Field of the Inventions
The present invention relates to virtual computer-generated environments in which participants are represented by computer-generated avatars, and in particular for environments that simulate an actual 3-D environment and allow for simultaneous participation of multiple players.
2. Description of Related Art
Computer generated virtual environments are increasingly popular for people, both real and automated, to interact within a networked system. The creation of virtualized worlds, three dimensional or otherwise, is well known. Simple text based adventures such as “Zork,” early “first person shooter” games such as “Doom,” and ultimately numerous highly complex environments such as “Halo” are well known in the art. Various on-line environments are known in which a 3-D physical world (actual or fantasy) is simulated. Environments of this type are sometimes referred to as “virtual reality” or “virtual reality universe” (VRU) environments. In known VRU environments, an actual or fantasy universe is simulated within a computer memory. Multiple players may participate in the environment through a computer network, such as a local area network or a wide area network. Each player selects an “avatar,” which may comprise a three-dimensional figure of a man, woman, or other being, to represent them in the VRU environment.
Players send inputs to a VRU engine to move their avatars around the VRU environment, and are able to cause interaction between their avatars and objects in the VRU. For example, a player’s avatar may interact with an automated entity or person, simulated static objects, or avatars operated by other players.
With the ubiquity of computer networking, engineers and designers included the ability for players within these virtual environments to interact. One drawback of the VRU is that, as in the actual world, space is limited by environmental constraints. In addition, limitations on computer processing speed, network bandwidth, and other factors also limit the number of participants and the richness of environment. Accordingly, prior art VRU environments may limit the number of simultaneous players and their methods of interactions for various reasons, including to avoid exceeding the programming, networking, and hardware limitations of the servers and/or clients.
Such limitations may be present in “massively multiplayer” environments, such as “Everquest” or “Second Life,” which are built specifically on the concept of mimicking real world environments, including the natural capacity of real world environments to hold numerous simultaneous inhabitants. Such limitations may be implemented in a less than desirable manner because they limit the ability of the VRU to accommodate the wishes of its clients. However, such limitations are provided for various reasons, including because (a) server capacity is incapable of simultaneously handling the number of users desired or (b) client capacity, for each user, is insufficient to process and display the data needed for each user’s computer to appropriately and adequately render avatars or other representations of the other users, and otherwise construct a complete and accurate representation of the environment; or (c) independent of hardware or software capacity considerations, limitations imposed by geometric constraints of the simulated environment, or simply put, lack of simulated space.
Mechanisms to address server capacity and client capacity issues, while flawed, exist in the art. Such mechanisms may include automatically moving avatars from one portion of the environment to another (with or without the player’s consent), barring additional avatars from entering an environment once a defined capacity is reached, limiting the ability of inhabitants of the environment to interact with each other and the environment, and having servers operate completely (or partially) independently.
For example, one problem in implementing a VRU arises from its presentation of content in a virtual approximation of real, three-dimensional space. As a result, there is a limit on how much modeled space can be occupied at the same time. When using the HTTP application layer or other conventional internet modalities, the number of users able to participate on a web site simultaneously is limited only by the computing power and network bandwidth available to the site hosting the page. In contrast, a VRU mimics the three-dimensional space found within the physical world and therefore the space limitations found in the real world also are experienced within the VRU. These include such limitations as the inability to realistically depict multiple users in the same place, the inability of users to walk through the same doorway simultaneously, the inability to exceed occupancy limitations, and similar real world space limitations. Because VRU users are visible to other users, they occupy space, a portion of the visual field, or both.
The problem may be further demonstrated with the example of a nightclub within a VRU. The nightclub would be represented as a fixed area of space within the VRU. While the VRU could in theory have a nightclub of enormous dimensions, there would be areas within the nightclub, such as proximate to a stage or proximate to celebrities present therein, which would be very desirable areas to inhabit. As a result, whether the area at issue is described as the full nightclub or the more desirable areas therein, some or the entire nightclub may have less space available for occupancy than there are people who desire to have their avatars occupy it. While the same solutions exist in a VRU as exist in the real world for increasing occupancy capacity (i.e. making the facility bigger, packing more people in with less space available to reach, etc.), the very limitations found in those real world solutions would apply in a VRU.
A second problem common to VRU’s is that they depend on their various users’ computers to render the environments that are presented within the VRU. Thus, there are limitations on how many avatars, objects, textures and other features can be rendered and animated for each user. Again utilizing the example of a nightclub, if the dimensions of the nightclub were drawn so that 10,000 avatars could simultaneously be accommodated, seen, and interacted with, each user computer would be tasked with tracking, rendering and animating each of 10,000 autonomously controlled avatars. Similarly, avatars within the same space, when permitted to communicate with each other, whether via chat, voice over IP, or otherwise, may generate too much content to permit effective communication.
It is desirable, therefore, to resolve these problems and to provide access for greater numbers of avatars within a VRU space while minimizing undesirable experiences for VRU participants, and providing new, more varied and interesting opportunities and experiences for users within the VRU space.
**SUMMARY**
The instant inventions disclose a method, system and apparatus for dynamically establishing and managing multiple instances of a space within a VRU. Such multiple instances may be referred to herein as “dimensions.” The inventions allow for the creation of an unlimited number of duplicate instances of a space in a VRU, which instances are created dynamically, and which instances users can interact across. Furthermore, the inventions permit such dimensions to be utilized in a manner that does little or nothing to impair the ability of the VRU to emulate those portions of the real world environment that may be crucial to a positive user experience within a VRU.
In an embodiment of the inventions, once the occupancy capacity of an area has been met, another attempt to access the area by an additional avatar may trigger creation of a new instance, or dimension, of the area. The new area may then be populated with avatars subsequently seeking to enter that area of the VRU environment. The term “new dimension” or “duplicate dimension” encompasses a virtual space such as may be provided by duplication of certain portions of the content within an area, such as, for example, walls and other simulated structural elements, a stage and all participants therein, or other elements. This may be accomplished, in the alternative by making the elements which are not desired to be duplicated (i.e. avatars) invisible and inaccessible to other, similarly non-duplicated elements (i.e. other avatars).
Further attempts to access the area may populate the new dimension until such time as the new dimension reaches its occupancy capacity, at which time an additional new dimension would be generated and the cycle repeated.
It is to be understood that in other embodiments, other algorithms for populating dimensions may be used. Such algorithms may include, for example, adding new avatars to the least populated dimension. Thus, if one or more avatars have left the first dimension after the creation and population of a second dimension, new users may be preferentially placed in the first dimension before the second dimension reaches its occupancy capacity. For further example, avatars may be added approximately evenly across several dimensions all of which are below their occupancy capacity, and/or avatars may be placed in one of duplicate dimensions based on the users’ status, achievements or other classifications. Users may also create their own duplicate dimension with limited enrollment or purposes. These may include and/or permit, without limitation, (a) themselves; (b) a private party; (c) members of a group; (d) the public at large; (e) paid attendees; and/or (1) specified invitees.
In embodiments, avatars may be distributed to a new dimension from one or more crowded dimensions. Crowding may be determined by various measures. For example, an optimal or “full” level of population for a particular dimension may be determined. Avatars may be allowed to continue to populate such dimensions in excess of their optimal capacity. New dimensions may be formed by transporting avatars from one or more of the dimensions into a new dimension when a trigger event occurs. Trigger events may include, for example, one or more dimensions exceeding their optimal occupancy capacity by some amount or percentage; and/or when the overall number of users in all relevant dimensions would warrant the creation of a new dimension, when at least one of those dimensions exceeds its optimal occupancy capacity. Thus, for example, if Dimension A exceeds its optimal capacity by 30% and Dimension B exceeds its optimal capacity by 50%, Dimension C is created and some users from Dimension A and Dimension B are imported into Dimension C. In the alternative, a trigger event may occur at some level less than the optimal or full occupancy level, for example, to leave room for preferred users of a particular dimension.
Two or more dimensions may be combined to form a larger dimension containing all the participants of the former dimensions. Likewise one or more dimensions may be split up into a number of smaller dimensions, with avatars assigned to dimensions based on random selection, user preferences, user profiles, and/or other criteria. Various triggers may be used to determine when a dimension should be combined or split up, such as, for example, the population of the dimension falling above or below a defined threshold.
In other embodiments, avatars may populate dimensions based on user generated preferences. Thus, for example, a Spanish speaking user may prefer to populate a dimension shared by other Spanish speaking users, even if such a dimension has, for example, fewer avatars than other available dimensions which are populated predominantly of speakers of other languages. Similarly, users from language groups that are more easily translated in a mechanical manner into the other users’ languages may be treated as a single group. Thus, for example, if Spanish and French are more easily translated between than are Spanish and Chinese, the Spanish and French users may be grouped together in a dimension having a translation function.
In other embodiments, avatars may populate dimensions based on preferences deduced from the user’s supplied information or information otherwise obtained about the user. Thus, for example, a user may prefer to populate a dimension shared by users that appear on his list of friends, even if such a dimension has, for example, fewer avatars than other available dimensions which are populated predominantly by users who do not appear on their list of friends. Similarly, a user may wish to avoid dimensions which are populated by users on their list of ignored users. Algorithms that incorporate users’ information including their friends, friends of friends, ignored users; as well as users who belong to groups or groups with similar interests to groups that the user is involved with are all examples of preferences that could be used to deduce a preferential dimension for a user to join.
Users may be given the opportunity to travel between dimensions, optionally subject to defined limits or conditions. Thus if a user is directed to populate a certain dimension, yet they would prefer to populate a different dimension, the user may select to have their avatar change dimensions to the desired dimension. Users may transport themselves to the desired dimension unless restricted from doing so by factors including but not limited to: that the desired dimension is restricted; that the desired dimension is private; and/or that the desired dimension is at or above its relevant occupancy capacity. Transport to different dimensions may be accomplished, for example, by clicking on the name of or a link relating to a user, an avatar or an object, or by manipulating an avatar so that enters a portal which may lead, either directly or through one or more additional portals, to a corresponding space in a different dimension. The avatar may then be transported to the dimension where the user, avatar, or object resides. In the alternative, or in addition, a VRU space may include “locked dimensions,” that do not permit travel to
and/or from the dimension, or that impose other restrictions not generally imposed on other dimensions in the VRU space.
Different dimensions may be related to one another and to interact or influence one another in defined ways. For example, users may also be permitted to observe other dimensions without being visible and/or able to interact with those dimensions at all. This may be useful, for example, prior to travel to such dimension, or if a user is merely interested in observing interactions of others. Users may be permitted to obtain information about what dimensions other users are in, such as users who are marked on the user's friends list or ignored users list.
Users may be given the option to chat between dimensions; i.e., with users populating other dimensions. Such chat may include private chat; public chat; or group chat or any other channel of chat that the user may desire. Thus, public chat may, for example, aggregate chat from more than one dimension. In the alternative, or in addition, the public chat may not aggregate more than one dimension, but individual users may wish to monitor or participate in public chat (or any other channel of chat) from dimensions other than the one in which their avatar presently populates.
In an embodiment of the invention, a defined area or portion of multiple dimensions may be visible to, and/or interact with, other parts or members of the dimensions. For example, a stage area may be defined that is visible and audible in multiple dimensions surrounding the stage area. Access to such a stage or common area may be limited in any desired way. Actions on the stage may affect multiple dimensions. For example, if a robot avatar or normal avatar throws an object out of a stage area into a surrounding nightclub, as the object passes a boundary between the stage area and the multi-dimensional nightclub floor, the thrown object may be replicated and appear in each of the surrounding dimensions.
Likewise, the surrounding multi-dimensional areas may influence a common area. Continuing the nightclub example, a performer on a common stage may receive audience feedback from multiple surrounding dimensions. For further example, a storefront may comprise a common area in which an avatar for a sales clerk may reside. The clerk may service avatar customers from multiple dimensions, with priority of service determined in different ways. For example, customers in different dimensions may summon the clerk, which may be depicted as "busy" (for example, depicted as interacting with another avatar) at times when the clerk is occupied with servicing a customer in another dimension. The waiting customer may be given a message with an estimated wait time, or an offer to make an appointment with the clerk. If multiple customers are waiting, they may be queued and serviced in any order desired by the clerk. For example, repeat customers may be serviced first.
In both of the foregoing examples, the performer and the clerk provide examples of an object—e.g., an avatar—that has a multi-instance presence in more than one dimension. In an embodiment of the invention, the presence in multiple dimensions may be asynchronous. In other words, each instance of the object in multiple dimensions may be generated asynchronously, depending on input from each dimension. In the alternative, the object may be generated synchronously, meaning as a single instance using the same input for each dimension.
A more complete understanding of the method and system for managing multiple dimensions in a VRU space will be afforded to those skilled in the art, as well as a realization of additional advantages and objects thereof, by a consideration of the following detailed description of the preferred embodiment. Reference will be made to the appended sheets of drawings, which will first be described briefly.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a schematic diagram showing a system according to the invention.
FIG. 2 is a schematic diagram showing a system according to the invention.
FIG. 3 is a schematic diagram showing aspects of a system with multiple dimensions according to the invention.
FIG. 4 is a block diagram showing aspects of a system for handling multiple dimensions according to the invention.
FIG. 5 is a schematic diagram showing aspects of a method for managing multiple dimensions according to the invention.
FIG. 6 is a block diagram showing aspects of managing an interface between multiple dimensions according to the invention.
FIGS. 7A-C are exemplary simplified screenshots of user displays according to the invention.
FIGS. 8-10 are flow diagrams showing exemplary steps of methods according to the invention.
DETAILED DESCRIPTION OF VARIOUS EMBODIMENTS
Referring to FIG. 1, a system 100 for providing a VRU to multiple users may comprise a plurality of client sites, nodes or terminals, for example a personal computer 104, portable computers 106, 110, a compact player, cell phone or digital assistant 108, and/or router 112 communicating via a WAN 102 to one or more servers 114. Servers 114 store and serve VRU data and software to the client sites. Software or firmware may also be located at each client site, configured to work cooperatively with software or firmware operating on servers 114. Generally, any number of users may be communicating with servers 114 for participation in the VRU at any given time.
Referring to FIG. 2, a system 200 for providing a VRU according to the invention may be considered to be comprised of server-side components (to the left of dashed line 222) and client-side components (to the right of dashed line 222). Server-side components may comprise a portal 220 for managing connections to multiple simultaneous players. Portal 220 may interact with a VRU engine 218, passing user input from multiple clients to a VRU engine, and passing data from the VRU engine to respective individual players. VRU engine 218 may be operatively associated with various memory spaces, including dimensional spaces 208 holding two or more parallel dimensions 212, 214, 215 and 216, and a personalized or common data space 210. As known in the art, objects in a VRU are modeled as three-dimensional objects, or two-dimensional objects, having a defined location, orientation, surface, surface texture, and other properties for graphic rendering or game behavior. Dimensional memory space 208 may hold active or inactive instances of defined spaces used in the VRU environment. For example, the environment of a popular simulated nightclub may be replicated in different spaces. Personalized space 210 may be comprised of various different personal areas each assigned to a different user, for example, avatar or avatar accessories data. The VRU engine may operate with other memory areas not shown in FIG. 2, for example various data libraries, archives, and records not inconsistent with the methods and systems disclosed herein.
In an embodiment of the invention, each user may customize an avatar to have an appearance and qualities specified by the user, by choosing avatar characters, features, clothing and/or accessories from an online catalog or store. The particular arrangement selected by a user may reside in a personalized space 210 associated with a particular user, specifying which avatar elements are to be drawn from a common space to construct an avatar. In an embodiment of the invention, a customized avatar instance may be stored in a personalized space for the user. In the alternative, or in addition, a user may own customized elements of an avatar, including clothing, accessories, simulated physical powers, etc., that are stored solely in the personalized space and are not available to other users. Avatars may move and interact both with common elements and personalized elements.
A separate administration module 202 may operate at the server level to create, update, modify or otherwise control the content of the VRU as defined in the memory areas 204 and 210. Generally, changes in the personal space area 210 are driven by individual users, either through the VRU administrator 202 or another module. Control of common areas, i.e., the game environment and the objects in it, including any multi-dimensional areas, may be via the administrator module 202.
At the client level, a player interface module 224 may be installed to receive player inputs from one or more user input devices 228, such as a keyboard, mouse or other pointer, or microphone, and provide data to the VRU engine 218 via portal 222 in response to the input. The player interface module may also receive game data from portal 220 and process the data for display on display 226 and/or for audio output on speaker 230. Various systems and methods for providing a three-dimensional, multiplayer interactive animation to multiple players are known in the art, or may be adapted by one of ordinary skill for use with the invention. For example, rendering of a scene may be performed at the client or server level. Generally, it may be advantageous to perform calculations and graphics operations, to the extent possible, at the client level, thereby freeing up network bandwidth and minimizing loads on the server. The invention is not limited to a particular hardware or software architecture for carrying out the steps described herein.
FIG. 5 shows a schematic fashion a system 300 for providing a multi-user, multi-dimensional animation. System 300 comprises a portal or interface 308 connected to receive data, such as through a wide area network 306, from a plurality of users 302, 304 (two of many shown). Users 302, 304 may operate a client computer having a web browser or application configured to communicate animation commands to VRU engine 310 via interface 308. VRU engine 310 may model a virtual three-dimensional environment 311 within a computer memory 312. A first user 302 may provide commands via portal 308 to VRU engine 310 used to control the operation of a first avatar 314. Likewise, a second user 304 may control a second avatar 316.
Environment 311 may include multiple scenes or regions modeled to simulate a region of space, for example, the surface of a planet or region thereof, the inside of a room or building, the surface of an island, and so forth. It should be appreciated that FIG. 5 presents a highly simplified schematic view of a modeled environment. An actual modeled environment may be highly complex, including thousands of different modeled spaces, some or all of which may exist in more than one dimension. Modeled scenes or spaces may be of different types, meaning they may be modeled according to different rules. They are connected in that transportation between scenes is allowed, at least for some avatars in the environment 311.
The environment 311 may allow for the passage of avatars between scenes via simulated portals or transportation elements, for example, simulated doorways, teleportation terminals, roads, cars, trains, etc. By entering a portal or transportation element, an avatar may leave a first scene and be delivered to a second scene being simulated in the memory 312. One of the tasks of the VRU engine may be to keep track of the various portals and transportation elements between scenes, operating these elements when requested by users, and adding or deleting portals as scenes are added or deleted. Generally, portals should act in a stable, predictable manner so that a user may navigate his or her avatar through the simulated environment 311 to accomplish the user’s objectives. For example, a simulated doorway at the simulated 100 East Main Street address of the simulated public road system in Computerville should always lead to the registered tenant at that address, be that a private residence or business. For further example, some transportation elements, for example teleportation portals or subways, may lead to different destinations. However, in this case the transportation element should be configured to allow the user to control the destination of the user’s avatar, if so desired.
VRU engine 310 may operate such that some scenes in environment 311 may be capable of being replicated to create another instance of the scene, for example multi-dimensional spaces 320, while other scenes cannot be replicated, for example a non-replicable or mono-dimensional space 318. Thus, environment 311 may contain both types of spaces, as well as portals or transportation elements allowing avatars to transport between multi-dimensional and mono-dimensional spaces. Avatars 314, 316 present in mono-dimensional space 318 may be transported via portal 317 to any one of the multi-dimensional spaces 320. Conversely, avatars in the multi-dimensional spaces 320 may pass into space 318 via portal 317, which may be replicated as an instance in each multi-dimensional space 321a-d. Multi-dimensional spaces 320 may originate as a single mono-dimensional, bounded modeled space. If the space becomes overly crowded, it may be replicated in any number of instances to provide room for growth in the population of avatars. However, the replicated space is not merely a copy, but rather exists as a connected part of the same environment 311. For example, space 321d may be a popular virtual nightclub originally existing in a single instance. As the popularity of the club grows, it may be desirable, for example, to replicate the nightclub experience for new customers. Hence, each dimension 321b, c and d may be created in response to population threshold of the existing club’s instances being exceeded. Each additional dimension may allow for two-way travel through a portal 317 to a common area, or through any number of alternative portals.
The additional dimensions 321b-d may therefore provide the advantages of accommodating any number of users without requiring users to subscribe to a new game or environment 311. The most popular and successful destination in the environment 311 may therefore be enjoyed by more users, almost without limit. User’s are therefore not required to exit a particular game or environment to enjoy these popular attractions. Likewise, users need not be cut off from communicating with or otherwise interacting with any other users participating in the multi-user environment 311 while still being able to freely access the most crowded destinations within the environment.
The existence of multiple dimensions 320 may be revealed or hidden from some of all users 302, 304. In an embodiment
of the invention, some or all users may enter into one or a series of multi-dimensional spaces without being aware of the existence of other dimensions. In the alternative, users may be given an indication that their avatars have entered or are entering a space for which multiple instances exist. Both alternatives may co-exist within the same environment, depending on the identity of the user and desired characteristics of a multi-dimensional space.
Environment 311 may further comprise one or more common spaces 322 that provide for simultaneous interaction with multiple instances of parallel dimensions 320. For example, a common space may comprise a stage to a club or theater. The interior of the common space may be visible and/or audible in each of the dimensions 321a-d. An avatar or other object in the common space 322 may be able to pass into each of the parallel spaces, being replicated in the process. Certain objects or avatars may also be able to pass from the parallel dimensions 320 into the common area. For example, avatars may queue up inside of different parallel dimensions and be granted access to the common area 322 in sequence. For further example, some avatars may be granted special rights or powers that permit them to enter a common space 322 that permits simultaneous interaction with multiple dimensions. Various other exemplary interactions between common spaces and parallel dimensions will be described in the detailed description below.
FIG. 3 may also serve to illustrate an alternative embodiment in which users are segregated into independent, isolated groups that simultaneously share a simulated space or facility. In this embodiment, the dimensions 321a-d may represent isolated groups of avatars and interactive objects. Such groups may be contained within a non-interactive common environment, such as the walls, ceilings and floors of a simulated nightclub or other space. The non-interactive common environment may serve as common backdrop that is shared by the different groups 321a-d, which need not be aware of one another's existence. This embodiment serves to illustrate that the experience of multiple parallel dimensions may be implemented in various ways, without departing from the spirit and scope of the inventions.
FIG. 4 is a block diagram showing exemplary aspects of a multi-dimensional system 400. System 400 may be implemented, for example, by a server or group of servers operating at a network-accessible site. Input data 402, including for example user commands or data used to direct the motion of avatars and other objects, may be provided to system 400 via a portal. Output data 404, including for example virtual-reality data configured to cause remote clients to output an animated display of a corresponding one of the parallel dimensions and avatars therein, may be output to a portal module for distribution to remote clients.
System 400 may comprise an avatar manager component 406 operably connected to a database 408 of avatar data. Like other components of system 400, the avatar manager component 406 may be implemented in any suitable software, hardware, or combination thereof. The avatar manager may process incoming user command and associate commands with corresponding avatar and other object data. For example, the avatar manager may ensure that each avatar is configured according to user commands with clothing, accessories, or gear available to its corresponding user. The avatar manager may communicate with a dimensional configurator 410 and population manager 418 to ensure that each avatar is placed correctly in one of parallel dimensions managed by the configurator and population manager. The avatar manager may further communicate with an animation component 414 to ensure that each avatar is positioned and moved in accordance with user commands. In addition, the avatar manager may cooperate with a communications component that operates to allow communication, for example text or audio chat, between different users.
A population manager 418 may monitor the population density of avatars in defined area of the environment, or more generally throughout the environment. If a population threshold is exceeded, the population manager may instruct the dimensional configurator 410 to generate or activate another instance of the overcrowded area. Likewise, the population manager may monitor parallel dimensions, and instruct the dimensional configurator to collapse two or more parallel dimensions into one, if population density falls below a defined threshold.
A dimensional configurator 410 may generate or activate additional parallel dimensions as needed to accommodate population growth. Essentially, the configurator may generate another instance of a crowded space within a virtual-reality environment by copying an existing space or template. In the alternative, different avatar populations may share common elements defining the envelope of a modeled space. Elements of modeled spaces may be stored in a dimensional database 412 in operative association with the configurator 410. The configurator may also ensure, in cooperation with the avatar manager 406, that each dimension is correctly populated with avatars. The configurator 410 may also operate to collapse empty or sparsely populated ones of parallel dimensions. For example, the configurator may move remaining avatars to another dimension and inactivate or delete the emptied dimension.
A communications module 416 may operate more or less independently of other components to enable communication, such as text chat, between different users. In an embodiment of the invention, chat operates independently of animation. In the alternative, a chat process may be coordinated with avatar animation. For example, an avatars lips may move in sync with audio chat. In either embodiments, the communications module may allow users to chat with other users corresponding to nearby avatars. In addition, the communications module may permit users to place a chat "telephone call" to any user logged into the system, regardless of the relative location of the users' avatars.
An animation component 414 may operate to process user commands, dimensional data and other model data to produce simulations of all active parallel spaces and other active regions of the modeled environment. Generally, a space or region may be considered active if it is within range of a user-selected viewpoint. Various methods are known for simulating avatars and objects within modeled spaces, and any suitable method may be used. In addition, it is anticipated that new method may be developed that may also be suitable. In general, any method that is suitable for modeling non-parallel, regular region of modeled space should be readily adaptable to modeling parallel dimensions.
The animator 414 may produce raw model data that is not configured for efficient distribution to remote clients. Accordingly, the animator may cooperate with an output control module 420 to prepare the output data 404 for distribution to remote clients. This may include translation or transformation of the animated model data from the animator to a format that is suitable for distribution to system clients. The form of translation or transformation will depend on the application software used at the client level and other details that should be apparent to one of ordinary skill.
In another preferred embodiment, various ones of the dimensions may overlap, for example, to prevent users from experiencing an overly empty dimension. Such overlap may
be geographical (i.e. areas within a virtual “club” or other environment), overlap between users grouped into dimensions, or otherwise. Referring to FIG. 5, an exemplary multidimensional system 500 is shown schematically, as it might be represented in a system memory. System 500 may comprise a first dimension 502 adjacent to a second dimension 504, representing, for example, areas of a virtual nightclub. The first dimension may be connected to a common space 506 via a transparent interface 507. The common space may represent, for example, a stage area. The first and second dimensions may be demarcated by a pair of interfaces 512, 514 that define an overlapping region 510 belonging to both dimensions 502, 504. Interfaces 512, 514 may also be transparent, so that all parts of the system 500 interior are potentially visible from viewpoint in any one of areas 502, 504 and 506. The parallel dimensions 502, 504 may also be enclosed by a common wall. In general, avatars within the parallel dimensions 502, 504 may not be able to pass through the interfaces 507, 512 and 514. In an embodiment of the invention, however, passing through one of the interfaces 512 and 514 may trigger a reassignment to another dimension designed to maintain the avatar within an assigned group of avatars.
With reference still to FIG. 5, one implementation of this embodiment may be to create four instances of a nightclub, with four different audiences (A,B,C, and D), as shown in Table 1 below.
<table>
<thead>
<tr>
<th>Instance Number</th>
<th>Audience Area 1</th>
<th>Audience Area 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Group A</td>
<td>Group B</td>
</tr>
<tr>
<td>2</td>
<td>Group C</td>
<td>Group D</td>
</tr>
<tr>
<td>3</td>
<td>Group D</td>
<td>Group A</td>
</tr>
<tr>
<td>4</td>
<td>Group B</td>
<td>Group C</td>
</tr>
</tbody>
</table>
The nightclub appears to be fully contiguous to all avatars in every instance, but the population of Areas 1 and 2 (corresponding to spaces 502, 504, respectively) depends on which instance and audience area an avatar is located in. Thus, for example, in Instance Number 1, Audience Area 1, an avatar looking into Audience Area 2 may see Group B. However, when the avatar moves into Audience Area 2, it may be automatically transitioned to Instance 3. Therefore, from the viewpoint of this avatar when looking back towards the stage, Group D is seen within Audience Area 1, and the avatar remains in Group A, albeit on the other side of the group.
Boundaries between the two Audience Areas, and between Audience Area 1 and the stage, may be referred to as an “interface”. The interfaces may be sharp, with no overlap, or there may be areas within the interface where multiple instances of the universe may exist simultaneously. Similarly, communication (visual, audio, chat, or otherwise), may be implemented across interfaces potentially limited by proximity of users to the interface. For example, an avatar 518 present in region 510 may be able to chat with avatar 520 in Audience Area 1, even if the avatar 518 belongs to a different group than present in Area 1.
The common dimension 506, or the stage area in the diagram above, may be created in a manner in which the performer 516 will be visible to all users in all instance numbers. Some audience groups, or members, may be permitted to interact with the performers and may be selected by any of a number of criteria, including without limitation paid members, early arrivals, random selection, etc. The performers may optionally see only one or more groups of users, may see all users even if shown via different computers, screens or windows by representative methods such as statistics, applause meters, etc. The audiences from multiple dimensions may also be rendered translucently and overlain on each other, so as to make additional members visible to the performers.
In embodiments of the invention, multiple end users may be merged into the same avatar with or without the ability to share control of the avatar. For shared control, the control inputs of multiple users may be aggregated in order to generate activity, or may be granted in a round robin or other manner. One example of this would be to permit people in multiple dimensions at a nightclub to get into the “stage diving” line, and then inhabit a single avatar which is then permitted to enter the “performer” dimension, be seen by all users, and then jump off the stage, disaggregate, and land, each user into his own dimension. Further examples of multi-user animations of one or more avatars may be found in provisional Application No. 60/871,446, filed Dec. 21, 2006, which application is incorporated herein by reference.
Objects moving from a common dimension may optionally automatically replicate when crossing an interface into a parallel dimension so as to replicate into multiple instances of themselves. FIG. 6 is a diagram showing an exemplary system 600 comprising a common dimension 604 linked to parallel dimensions 601, 602, and 603. In embodiments of the inventions, such replication may place a copy of the item into each dimension or instance of linked to the common dimension. The item may then be independently manipulated and utilized within each dimension or instance. Optionally, the items may be marked, numbered, or tracked by the dimension into which they first were replicated. For example, a performer avatar 606 may throw a ball 607 towards interface 610. As the ball penetrates the interface, it may be subtracted from common space 604 and appear as separate independent instances 607a-c in parallel dimensions 601, 602 and 603 respectively. Essentially, any number of new objects may be generated in this manner. After penetrating fully past the respective interfaces 611a-c, the newly-generated balls may exist as new objects 612a-c, respectively.
Common areas linked to multiple dimensions may also be useful for commercial use, for example, the provisions of services or virtual products. Some such application may involve the personal attention of a merchant or service provider. Such a user may desire to be marketed in all linked parallel dimensions, but cannot simultaneously serve users in different dimensions. For such applications, it may be desirable to manage the interface between the common area and the parallel dimensions to permit both pan-dimensional presence for the merchant or service provider, and personal service for each customer. FIGS. 7A-C are simplified screenshots exemplifying an implementation of an exemplary method for accomplishing this objective.
FIG. 7A shows a screenshot 710 representing system output data such as may be provided to a first user having an avatar 702 in a first parallel dimension visiting an avatar doctor 701 located in a common dimension. A client computer belonging to the first user may take the output data and render a display such as shown. The first user may see an animation of her own avatar 702 conversing with the doctor 701. A chat window 703 may comprise chat text of a conversation between the doctor and the first user. Other objects, for example virtual wares if the user of the common dimension is a merchant of such wares, may optionally be shown to the first user.
FIG. 7B shows a screenshot 720 similarly representing data provided to a second user operating an avatar 722 located in a second parallel dimension. This user may see an animation indicating that the doctor is busy with another patient. For
example, a view of a closed door 721 may be presented. Alternative presentations may include, for example, a robot avatar receptionist for the doctor. Optionally, a message box 723 may be provided explaining the status of the door; the second user’s place in the doctor’s queue, an estimated wait time, or any other desired information, including but not limited to advertising.
FIG. 7C shows an exemplary screenshot 730 similarly representing data that may be provided to a user of the common dimension. Such a user may be presented with views of all linked parallel dimensions. The illustrated example shows tiled views, but any other arrangement, for example overlays or successive views, may also be used. In this example, the doctor sees the active patient 702 and a view 731 of the first dimension where the active patient resides. A chat window 734 showing the active conversation may also be displayed. The doctor may also see a view 732 of the second dimension showing the patient 722 waiting there. In this example, a view 733 of a third dimension is provided showing no patients waiting in that dimension. In the alternative, views of dimensions with no waiting patients may be omitted. Any number of parallel dimensions may thus be made visible to a user operating in a common dimension.
According to the foregoing, therefore, parallel dimensions may be implemented in a computer platform using programming steps that should be apparent to one of ordinary skill in view of the present disclosure. FIG. 8 shows exemplary steps of a method 800 for managing multi-instance, multi-user animation platforms, such as may be implemented in a VRU environment.
Step 802 may comprise modeling a plurality of parallel dimensions in a computer memory. Computer modeling of three-dimensional spaces is known in the art. Such models may conform to rules that mimic the physical environment on earth, or may use modified rules to simulate other environments. Any suitable model and method of modeling may be used. As used herein, a “parallel dimension” means a duplicate or recognizable counterpart of a bounded, computer-modeled space that is accessible via a common environment. Parallel dimensions may be created, for example, by copying element of an existing space or template for a space in the computer memory. Each of the plurality of parallel dimensions may comprise an independent model of a physical, three-dimensional space having corresponding features such that the parallel dimensions are recognizable as counterparts to each other. It is not necessary that each dimension be an exact duplicate of other dimensions. Because the dimensions operate independently, some divergence may occur after the dimensions become active. For example, a piece of furniture that is initially positioned identically in counterpart dimensions may be moved.
The parallel dimensions may have the characteristic of operating concurrently in a system memory. While certain activities inside each parallel dimension may be independent, for example, the activity of avatars, nonetheless the parallel dimensions may retain some relationships to one another. For example, the parallel dimensions may share common spaces or portals to common spaces. For further example, communication between avatars in different dimensions may be permitted. Avatars may also be permitted to travel between dimensions.
One important inter-dimensional relationship may comprise inter-dimensional population control. The VRU system may comprise, for example, a VRU module that operates to monitor the population of certain spaces within the VRU to ensure that they do not become too crowded with avatars, as indicated at step 804. Besides ensuring that additional dimensions are generated or activated as needed to relieve overcrowding, the VRU system may operate to distribute avatars between parallel dimensions. For example, step 804 may comprise locating or assigning avatars within corresponding one of parallel dimensions so as to prevent over-population of any one of the parallel dimensions by avatars. To perform this step, the VRU engine or module may compare a present avatar population, population density, and/or rate of change of the foregoing, to criteria established for the space in question. For example, an optimal avatar density for a nightclub floor may be in the range of 1-4 avatars per square meter of simulated space, while for a simulated park the optimal density may be 0.2-1 avatars per square meter.
As the population of a space approaches or exceeds a defined limitation, as indicated at steps 808 and 808, the VRU system may generate or activate a parallel dimension that replicates the overcrowded dimension. In an embodiment of the invention, multiple parallel dimensions may operate simultaneously. If, for example, just one of these dimensions becomes overcrowded, the overcrowding may be resolved by transferring avatars to less crowded dimensions, as indicated at step 810. If no less crowded dimensions are available, a new dimension may be generated and/or activated. In an embodiment of the invention, a new parallel dimension may be generated by copying certain elements of an existing space, or by copying a template for an existing space that is reserved in memory for the purpose of generating parallel dimensions when needed.
Parallel dimensions may also be collapsed into fewer dimensions as avatar populations decline. For example, if an average population density across multiple dimensions falls below a defined threshold, any empty dimensions may be shut down. The process of shutting down a dimension may include erasing the dimension from the computer memory used to model the computer environment. In an embodiment of the invention, the closed dimension may be archived or reserved for future use, optionally for a limited period of time. If it is desired to shut down a dimension that is not empty of avatars, avatars present in the dimension may be transported to an adjacent parallel dimension. Before shutting down a dimension, the system may inform users corresponding to any avatars in the dimension. Such users may be given the option of transporting to a parallel dimension or elsewhere in the VRU environment. If a user does not select an alternative destination, the VRU system may choose for her. Advantageously, shutting down under-populated dimensions may conserve system resources and prevent users from encountering under-populated environments.
As indicated at step 810, avatars may be distributed between related parallel dimensions according to various schemes. Method 800 may further comprise relocating an avatar from a first one of the parallel dimensions to a second one of the parallel dimensions. Relocation may be accomplished by any desired method of transporting avatars within a VRU environment. For example, an avatar may walk through a door to another space or be "teleported" to another space in the environment. An avatar may be relocated from a first one of the parallel dimensions to a second one of the parallel dimensions (or to any other location in the environment) in response to user input signifying a request to relocate the avatar. In the alternative, relocation may be performed without user input. For example, an avatar may be relocated between parallel dimensions or out of a parallel dimension when a population of avatars in one or more of the parallel dimensions reaches a predetermined limit. One or more avatars may be automatically relocated from crowded ones of the
parallel dimensions into an additional parallel dimension that is generated or activated to accommodate avatar population growth.
Whatever the number of dimensions operable within an environment, a VRU system should operate to independently animate one or the plurality of avatars within different one of the parallel dimensions, using input from respective corresponding ones of users. "Animate," in this sense, essentially means to process user input data, rules of the modeled environment, modeled properties of objects in the environment, or other data to calculate the positions and/or shape of objects in the environment at successive instants of modeled time. Such an animation process may be encompassed in what is generally as "computer simulation." FIG. 9 shows exemplary steps of a method 900 for animating a VRU environment and objects therein. It should be appreciated that method 900 may be operated concurrently with method 800 to manage a multi-user, multi-dimensional animation process and provide a plurality of users with desired output data.
At step 902, the VRU engine may animate avatars and objects in each dimension. Avatars and objects may be modeled in any desired manner. In an embodiment of the invention, avatars may be modeled as jointed figures covered by a skin. Objects may interact with one another via "contact" that occurs when modeled objects attempt to occupy the same volume of modeled space. Various physical attributes, such as, for example, mass, momentum, muscle & skeletal limitations, and so forth, may be associated with the modeled objects to impart greater realism to the simulation. In embodiments of the inventions, physical rules may be modeled so as to permit activities that cannot occur in the real world, such as, for example, winged flight by humans. In general, various computer modeling methods are known in the art to simulate motion of objects and figures in modeled space, and any suitable method may be used to simulate motion of avatars and other objects.
Animation of objects in parallel dimensions may generally proceed independently of each other. For example, a first avatar in a first dimension should not be able to contact or be visible to a second avatar in a second dimension. Avatars may be able to chat across dimensions, which may be conducted as a separate process apart from animation. Objects and avatars in a common dimension may be modeled together with each parallel dimension. For example, if "c" represents the model of the common space and "p" represents the model of the parallel space, the animation for each parallel space "p," may comprise "p,c." At step 906, portal output data may be generated for a plurality of remote clients. A system module, e.g., a portal module, may separate and direct data from multiple animation streams so that the correct data is provided to each client in the correct format and sequence. Each client should receive sufficient data to generate a view of the environment as seen through the virtual eyes of his or her avatar, or as seen from another viewpoint near the avatar. The view should include at least nearby avatars and objects. More distant objects may also be visible, optionally at diminishing resolution with increasing distance from the viewpoint. In general, the identification of a viewpoint associated with each user may make it possible to reduce the amount of information sent to each user, as more distant information need not be provided.
As an output of the animation process, virtual-reality data may be provided to each of the plurality of users, as indicated at step 906. Various methods are known in the art for providing data to clients, and any suitable method may be used. A connection may be made to one or more communication ports of client computers running an application for receiving data and transforming it as necessary for a visual display. The virtual-reality data may be configured to cause remote clients of each of the users to output an animated display of a corresponding one of the parallel dimensions and avatars therein, as indicated at step 910. For example, a first user corresponding to an avatar located in parallel dimension 'A' may receive virtual-reality data for viewing objects and other avatars inside of dimension 'A,' while a second user controlling an avatar located in parallel dimension 'B' may receive data for displaying the interior of dimension 'B.' Both users may receive data for viewing a common dimension 'C' linked to dimensions 'A' and 'B,' if present.
As previously noted, a common space may be modeled in the computer memory, configured in relation to multiple parallel dimensions so that an interior of the common space is visible from viewpoints located inside each of the parallel dimensions. In an embodiment of the invention, the common space may be modeled so that information concerning each of the parallel dimensions is provided to a user operating an avatar in the common space, or otherwise assigned a viewpoint located in the common space. Such information may be provided, for example, as interior views of each of the plurality of dimensions.
In embodiments of the invention, it may be desirable to model a common space in a computer memory, configured in relation to multiple parallel dimensions so that a modeled object originating from the common space is capable of passing into at least one of the parallel dimensions, or vice-versa. FIG. 10 shows exemplary steps of a method 1000 for managing an interface between a common space and a parallel space. At step 1002, an inter-dimensional interface may be defined between the common space and two or more parallel spaces, or between adjacent parallel spaces. For example, a surface may be defined as a boundary between the common space and each of the parallel spaces. Such surfaces may be contoured to fit one another. That is, an interface surface dividing the common space from multiple parallel dimensions may be contoured to fit each of the surfaces that divide each of the parallel dimensions from the common space. An interface may be modeled to include an overlapping region interactive with both adjacent ones of the plurality of dimensions, or without an overlapping region.
In an embodiment of the invention, an interface may be modeled as a transparent object. Therefore, the common space may be visible to each of multiple parallel dimensions, for example as a stage, storefront, or entry area. Likewise, multiple parallel dimensions may be visible from the common space, either overlain on each other, tiled, presented in sequence, or in some other arrangement. If multiple parallel dimensions are arranged around a common space, providing a transparent interface around the common space may render adjacent ones of the parallel dimensions visible to each other. In the alternative, an interface may be modeled as a translucent or opaque object.
At step 1004, the interface may be monitored for approaching objects. When an object touches or approaches the interface, the system may determine the interface properties of the object, as shown at step 1006. For example, the system may consult a properties table associated with the object to determine whether or not the object has the capability of passing through the interface. The simulation may then proceed differently, depending on the properties of the object. If the object is allowed to "pass" through the interface, an object passing from the common space into multiple parallel dimensions may be replicated as it passes through the interface, as indicated at step 1008. The replicated objects may then be animated synchronously (as in the case of an avatar controlled
by a single user, or asynchronously (as in the case of a passive object) in each of the parallel dimensions.
In an embodiment of the invention, a common space in the computer memory may be configured in relation to multiple parallel dimensions so that an avatar originating from the common space is capable of passing into one of the parallel dimensions. This is a special case that may be used to populate multiple dimensions with avatars originating from a common space, for example a space modeled as a public road or hallway. In this embodiment, one of the parallel dimensions is selected as the destination for the object. Selection may be accomplished using various criteria. In an embodiment of the invention, selection may be based on avatar populations of each parallel space. For example, an avatar may be directed to a dimension having the lowest population, or any other desired population criteria. In the alternative, or in addition, selection may be based on a corresponding user preference. For example, a user may indicate a preference for a dimension populated by other French-speaking avatars.
In addition, a common space in the computer memory may be configured in relation to the plurality of parallel dimensions so that an avatar originating from any one of multiple parallel dimensions is capable of passing into the common space. An object passing from a parallel space into a common space may be subtracted from the parallel space and added to the common space as it passes through the interface. This may be used as a way for avatars to leave a parallel dimension and re-enter non-parallel portions of the modeled environment.
If the object is not allowed to pass through the interface, the object may be bounced from the interface, or stopped short of the interface, as indicated at step 1010. The object therefore cannot leave the dimension of origin through that particular interface. Of course, because the dimension is part of a larger modeled environment, it should contain at least one other doorway or other transportation element that allows objects to leave the dimension and enter other portions of the modeled environment.
According to the foregoing, therefore, implementations of parallel dimensions may require the creation and tracking of at least three different categories of items. The first category may include items such as walls that are non-manipulable and are identical in all dimensions. The walls may in fact exist only in a single dimension, which is shared via an interface with all other dimensions, in this manner minimizing the number of items that servers and clients must track. The second category may include items existing in a single dimension only, such as avatars. The third category may include items created identically in all dimensions but that become independent of each other once created. This third category may be exemplified by furniture and the like.
When a dimension is generated or activated, it may be populated with standardized furniture or other objects belonging to the third category. Such furniture, while potentially identical when created, and created simultaneously in multiple dimensions, may be manipulable, destructible, and otherwise alterable within each dimension independently. Movable replicated objects, for example, furniture and the like, existing in parallel dimensions may tend to migrate to different locations over time, as each instance of the dimension may be modeled separately. This may lead to divergence between otherwise parallel dimensions that may make travel or other interactions between parallel dimensions disorienting for those who experience them. At the same time, it may not be desirable to make such objects unmovable or unchangeable.
Therefore, it may be desirable to return certain movable objects back to a home position when displaced. In an embodiment of the invention, therefore, analogous objects may be tracked in different ones of parallel dimensions. Any ones of the analogous objects that become displaced from a home position may be moved back towards the home position, so that positions of analogous objects within each of the parallel dimension tend to converge on the home position over time. For example, a chair may be moved by an avatar in one of the dimensions. However, in related parallel dimensions, the chair is unmoved. A system component may cause the moved chair to slowly, potentially over the course of hours, to move back to the position of the chair in the adjoining dimensions. Return movement may be executed relatively slowly so that it is not noticeable to nearby avatars. Speed of return movement may depend, therefore, on the relative proximity of nearest avatars. For further example, if a glass is dropped within a dimension, the server may cause it to fall and roll in the direction of the corresponding glass in a neighboring dimension. In this manner, the dimensions would continue to resemble each other over time, making travel between the dimensions less disorienting for the persons manipulating the avatars.
In general, a VRU environment may provide communication tools for users to communicate with one another in real time. For example, a typical environment may include a text chat or audio chat feature. In general, it may be desirable to not disable such communication features for users associated with avatars located in different parallel dimensions. In other words, although parallel dimensions may be animated separately, they are still part of the same environment and may still make use of the same communication tools. In an embodiment of the invention, therefore, a communication channel may be provided between avatars in different ones of the plurality of dimensions.
Having thus described embodiments of method and system for a multi-user, multi-dimensional animation, it should be apparent to those skilled in the art that certain advantages of the system have been achieved. It should also be appreciated that various modifications, adaptations, and alternative embodiments thereof may be made within the scope and spirit of the present invention. For example, a method implemented over a public network such as the Internet has been illustrated, but the inventive concepts described above would be equally applicable to implementations over other networks. The invention is defined by the following claims.
What is claimed is:
1. A method for managing a multi-instance, multi-user animation process, comprising:
modeling, using a computer, a plurality of parallel dimensions in a computer memory, each of the plurality of parallel dimensions being a replica of a modeled three dimensional space configured for modeling occupancy and movement of multiple avatars within limits that are defined by at least one model of a three dimensional object;
assigning ones of a plurality of avatars within the computer memory so that each of the plurality of avatars populates a respective one of the parallel dimensions and each of the plurality of parallel dimensions is populated by a unique subset of the plurality of avatars, so as to prevent over-population of any one of the parallel dimensions by avatars; and
animating ones of the plurality of avatars populating different ones of the parallel dimensions in response to input from respective corresponding ones of a plurality of clients to provide virtual-reality data, using the computer, the virtual-reality data configured to enable the
clients to output an animated display of a corresponding one of the parallel dimensions and avatars populated therein.
2. The method of claim 1, further comprising relocating an avatar from a first one of the parallel dimensions to a second one of the parallel dimensions.
3. The method of claim 1, further comprising relocating an avatar from a first one of the parallel dimensions to a second one of the parallel dimensions in response to user input signifying a request to relocate the avatar.
4. The method of claim 1, further comprising relocating an avatar from a first one of the parallel dimensions to a second one of the parallel dimensions in response to determining that a population of avatars in the first one of the parallel dimensions has reached a predetermined limit.
5. The method of claim 1, further comprising generating an additional parallel dimension to accommodate an increase in avatar population.
6. The method of claim 5, further comprising relocating avatars from the plurality of parallel dimensions into the additional parallel dimension.
7. The method of claim 1, further comprising generating the plurality of parallel dimensions as replicas of a template space.
8. The method of claim 1, further comprising modeling a common space in the computer memory configured in relation to the plurality of parallel dimensions so that at least one object located inside the common space is visible from viewpoints located inside each of the plurality of parallel dimensions.
9. The method of claim 8, further comprising animating at least one avatar populating the common space in response to input from a corresponding client, to provide the virtual-reality data further enabling the corresponding client to output an animated display including at least a portion of each of the plurality of parallel dimensions and avatars populated therein.
10. The method of claim 1, further comprising modeling a common space in the computer memory configured in relation to the plurality of parallel dimensions so that a modeled object originating from the common space is capable of passing into at least one of the plurality of parallel dimensions.
11. The method of claim 10, further comprising replicating the modeled object passing into the plurality of parallel dimensions so that a replica of the object is modeled in each of the plurality of parallel dimensions after the object passes from the common space.
12. The method of claim 1, further comprising modeling a common space in the computer memory configured in relation to the plurality of parallel dimensions so that an avatar originating from the common space is capable of passing into one of the plurality of parallel dimensions.
13. The method of claim 12, further comprising selecting which one of the plurality of parallel dimensions the avatar is capable of passing into based on avatar populations of each parallel space.
14. The method of claim 12, further comprising selecting which one of the plurality of parallel dimensions the avatar is capable of passing into based on a corresponding user preference.
15. The method of claim 1, further comprising modeling a common space in the computer memory configured in relation to the plurality of parallel dimensions so that an avatar originating from any one of the plurality of parallel dimensions is capable of passing into the common space.
16. The method of claim 1, further comprising tracking analogous objects in different ones of the parallel dimensions and moving any displaced ones of the analogous objects so that positions of analogous objects within each of the parallel dimension tend to converge over time.
17. The method of claim 1, further comprising collapsing first and second ones of the plurality of parallel dimensions into a combined dimension populated by the avatars formerly in the first and second ones of the plurality of dimensions.
18. The method of claim 1, further comprising synchronously animating an avatar present in multiple ones of the plurality of dimensions.
19. The method of claim 1, further comprising asynchronously animating an avatar present in multiple ones of the plurality of dimensions.
20. The method of claim 1, further comprising modeling an interface between adjacent ones of the plurality of dimensions.
21. The method of claim 20, further comprising modeling the interface to include an overlapping region interactive with both adjacent ones of the plurality of dimensions.
22. The method of claim 20, further comprising modeling the interface as a transparent object rendering the adjacent ones of the plurality of dimensions visible to each other.
23. The method of claim 20, further comprising providing a communication channel between avatars populating different ones of the plurality of dimensions.
24. A non-transitory computer-readable medium encoded with instructions, that when executed by a computer, cause the computer to:
model a plurality of parallel dimensions, each of the plurality of parallel dimensions being a replica of a modeled three-dimensional space configured for modeling occupancy and movement of multiple avatars within limits defined for the three-dimensional space;
assign ones of a plurality of avatars between respective ones of the plurality of parallel dimensions so that each of the plurality of avatars populates a respective one of the parallel dimensions and each of the plurality of parallel dimensions is populated by a unique subset of the plurality of avatars, to control avatar population counts in each of the plurality of parallel dimensions; and
animate ones of the plurality of avatars populating different ones of the parallel dimensions in response to input identified as belonging to respective ones of multiple clients, to generate virtual-reality data configured to enable the respective ones of the clients to output an animated display of a corresponding one of the parallel dimensions and avatars populated therein.
25. A computer comprising a memory holding instructions, that when executed by the computer, cause the computer to:
generate a plurality of parallel dimensions in a computer memory, each being a replica of a modeled three-dimensional space configured for modeling occupancy and movement of multiple avatars within defined spatial limits;
assign ones of a plurality of avatars between respective ones of the plurality of parallel dimensions so that each of the plurality of avatars populates a respective one of the parallel dimensions and each of the plurality of parallel dimensions is populated by a unique subset of the plurality of avatars, to control avatar population counts in each of the plurality of parallel dimensions; and
animate ones of the plurality of avatars populating different ones of the parallel dimensions in response to input identified as belonging to respective ones of multiple clients, to generate virtual-reality data configured to enable the respective ones of the clients to output an animated display of an assigned one of the parallel dimensions and avatars populated therein.
* * * * *
|
{"Source-Url": "http://shuster.com/patents/US8276071.pdf", "len_cl100k_base": 14548, "olmocr-version": "0.1.49", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 25961, "total-output-tokens": 16307, "length": "2e13", "weborganizer": {"__label__adult": 0.0014095306396484375, "__label__art_design": 0.005313873291015625, "__label__crime_law": 0.0027904510498046875, "__label__education_jobs": 0.005619049072265625, "__label__entertainment": 0.0031566619873046875, "__label__fashion_beauty": 0.0005211830139160156, "__label__finance_business": 0.0058441162109375, "__label__food_dining": 0.0007128715515136719, "__label__games": 0.13232421875, "__label__hardware": 0.012237548828125, "__label__health": 0.001220703125, "__label__history": 0.0014009475708007812, "__label__home_hobbies": 0.0004875659942626953, "__label__industrial": 0.0014257431030273438, "__label__literature": 0.00154876708984375, "__label__politics": 0.0007114410400390625, "__label__religion": 0.0011539459228515625, "__label__science_tech": 0.2242431640625, "__label__social_life": 0.0002211332321166992, "__label__software": 0.293701171875, "__label__software_dev": 0.3017578125, "__label__sports_fitness": 0.00044846534729003906, "__label__transportation": 0.0011301040649414062, "__label__travel": 0.00066375732421875}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 76727, 0.11257]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 76727, 0.66347]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 76727, 0.9148]], "google_gemma-3-12b-it_contains_pii": [[0, 823, false], [823, 2014, null], [2014, 2021, null], [2021, 2021, null], [2021, 2021, null], [2021, 2021, null], [2021, 2407, null], [2407, 2771, null], [2771, 2996, null], [2996, 9701, null], [9701, 17230, null], [17230, 24205, null], [24205, 31791, null], [31791, 39387, null], [39387, 46865, null], [46865, 54413, null], [54413, 62123, null], [62123, 69617, null], [69617, 76727, null]], "google_gemma-3-12b-it_is_public_document": [[0, 823, true], [823, 2014, null], [2014, 2021, null], [2021, 2021, null], [2021, 2021, null], [2021, 2021, null], [2021, 2407, null], [2407, 2771, null], [2771, 2996, null], [2996, 9701, null], [9701, 17230, null], [17230, 24205, null], [24205, 31791, null], [31791, 39387, null], [39387, 46865, null], [46865, 54413, null], [54413, 62123, null], [62123, 69617, null], [69617, 76727, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 76727, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 76727, null]], "pdf_page_numbers": [[0, 823, 1], [823, 2014, 2], [2014, 2021, 3], [2021, 2021, 4], [2021, 2021, 5], [2021, 2021, 6], [2021, 2407, 7], [2407, 2771, 8], [2771, 2996, 9], [2996, 9701, 10], [9701, 17230, 11], [17230, 24205, 12], [24205, 31791, 13], [31791, 39387, 14], [39387, 46865, 15], [46865, 54413, 16], [54413, 62123, 17], [62123, 69617, 18], [69617, 76727, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 76727, 0.09135]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
24acd221eb033ece1cda4c18cfd0197532ce46f7
|
[REMOVED]
|
{"Source-Url": "http://eprints.qut.edu.au/56457/3/56457.pdf", "len_cl100k_base": 9194, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 51114, "total-output-tokens": 11414, "length": "2e13", "weborganizer": {"__label__adult": 0.0003294944763183594, "__label__art_design": 0.0005807876586914062, "__label__crime_law": 0.0004134178161621094, "__label__education_jobs": 0.0027008056640625, "__label__entertainment": 0.00012421607971191406, "__label__fashion_beauty": 0.0002124309539794922, "__label__finance_business": 0.003040313720703125, "__label__food_dining": 0.0003952980041503906, "__label__games": 0.0005292892456054688, "__label__hardware": 0.0006003379821777344, "__label__health": 0.0004949569702148438, "__label__history": 0.0003113746643066406, "__label__home_hobbies": 0.00012695789337158203, "__label__industrial": 0.0006227493286132812, "__label__literature": 0.0005717277526855469, "__label__politics": 0.0003135204315185547, "__label__religion": 0.00035762786865234375, "__label__science_tech": 0.0673828125, "__label__social_life": 0.0001360177993774414, "__label__software": 0.032257080078125, "__label__software_dev": 0.8876953125, "__label__sports_fitness": 0.00021028518676757812, "__label__transportation": 0.0005245208740234375, "__label__travel": 0.00019562244415283203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38380, 0.01262]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38380, 0.46579]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38380, 0.81544]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 2804, false], [2804, 5334, null], [5334, 9438, null], [9438, 12245, null], [12245, 14282, null], [14282, 16843, null], [16843, 19917, null], [19917, 23104, null], [23104, 25375, null], [25375, 28079, null], [28079, 29472, null], [29472, 29536, null], [29536, 29658, null], [29658, 32891, null], [32891, 35609, null], [35609, 38380, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 2804, true], [2804, 5334, null], [5334, 9438, null], [9438, 12245, null], [12245, 14282, null], [14282, 16843, null], [16843, 19917, null], [19917, 23104, null], [23104, 25375, null], [25375, 28079, null], [28079, 29472, null], [29472, 29536, null], [29536, 29658, null], [29658, 32891, null], [32891, 35609, null], [35609, 38380, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38380, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38380, null]], "pdf_page_numbers": [[0, 0, 1], [0, 2804, 2], [2804, 5334, 3], [5334, 9438, 4], [9438, 12245, 5], [12245, 14282, 6], [14282, 16843, 7], [16843, 19917, 8], [19917, 23104, 9], [23104, 25375, 10], [25375, 28079, 11], [28079, 29472, 12], [29472, 29536, 13], [29536, 29658, 14], [29658, 32891, 15], [32891, 35609, 16], [35609, 38380, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38380, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
65f40fbdd39492f894f0a578a29e6df895d07539
|
Package ‘lineup’
March 6, 2019
Version 0.37-11
Date 2019-03-06
Title Lining Up Two Sets of Measurements
Description Tools for detecting and correcting sample mix-ups between two sets of measurements, such as between gene expression data on two tissues.
Author Karl W Broman <broman@wisc.edu>
Maintainer Karl W Broman <broman@wisc.edu>
URL https://github.com/kbroman/lineup
BugReports https://github.com/kbroman/lineup/issues
Depends R (>= 2.10.1)
Imports qtl (>= 1.20-15), class, graphics, grDevices, utils, stats, parallel
Suggests roxygen2, knitr, rmarkdown, devtools, testthat
License GPL-3
VignetteBuilder knitr
LazyData true
ByteCompile true
Encoding UTF-8
RoxygenNote 6.1.1
NeedsCompilation yes
Repository CRAN
Date/Publication 2019-03-06 16:40:08 UTC
R topics documented:
calc.locallod ................................................................. 2
combinedist ................................................................. 3
corbetw2mat ................................................................. 5
distee .......................................................... 6
**calc.locallod**
* Calculate LOD score at physical position of each gene
**Description**
For gene expression data with physical positions of the genes, calculate the LOD score at those positions to assess evidence for local eQTL.
**Usage**
```r
calc.locallod(cross, pheno, pmark, addcovar = NULL, intcovar = NULL,
verbose = TRUE, n.cores = 1)
```
**Arguments**
- **cross**
- An object of class "cross" containing data for a QTL experiment. See the help file for `read.cross` in the R/qtl package ([http://www.rqtl.org](http://www.rqtl.org)). There must be a phenotype named "id" or "ID" that contains the individual identifiers.
- **pheno**
- A data frame of phenotypes (generally gene expression data), stored as individuals x phenotypes. The row names must contain individual identifiers.
- **pmark**
- Pseudomarkers that are closest to the genes in pheno, as output by `find.gene.pseudomarker`.
- **addcovar**
- Additive covariates passed to `scanone`.
- **intcovar**
- Interactive covariates passed to `scanone`.
- **verbose**
- If TRUE, print tracing information.
- **n.cores**
- Number of CPU cores to use in the calculations. With `n.cores`=0, `detectCores` is used to detect the number of available cores.
combinedist
Details
cross and pheno must contain exactly the same individuals in the same order. (Use findCommonID to line them up.)
We consider the expression phenotypes in batches: those whose closest pseudomarker is the same.
We use Haley-Knott regression to calculate the LOD scores.
Actually, we use a bit of a contortion of the data to force the scanone function in R/qtl to calculate the LOD score at a single position.
We omit any transcripts that map to the X chromosome; we can only handle autosomal loci for now.
Value
A vector of LOD scores. The names indicate the gene names (columns in pheno).
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
findNgeneNpseudomarker, plotEGclass, findCommonID, disteg
Examples
data(f2cross, expr1, genepos, pmap)
library(qtl)
# calc QTL genotype probabilities
f2cross <- calc.genoprob(f2cross, step=1)
# find nearest pseudomarkers
pmark <- find.gene.pseudomarker(f2cross, pmap, genepos, "prob")
# line up f2cross and expr1
id <- findCommonID(f2cross, expr1)
# calculate LOD score for local eQTL
locallod <- calc.lodod(f2cross[,id$first], expr1[id$second,], pmark)
combinedist
Combine distance matrices into a single such
Description
Combine multiple distance matrices into a single distance matrix providing an overall summary
Usage
combinedist(..., method = c("median", "mean"))
Arguments
... Set of distance matrices, as calculated by distee or disteg.
method Indicates whether to summarize using the median or the mean.
Details
The row and column names of the input distance matrices define the individual IDs.
If the input distance matrices all have an attribute "denom" (for denominator) and method="mean", we use a weighted mean, weighted by the denominators. This could be used to calculate an overall proportion.
Value
A distance matrix, with class "lineupdist". The individual IDs are in the row and column names.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
distee, disteg, summary.lineupdist
Examples
library(qtl)
# load example data
data(f2cross, expr1, expr2, pmap, genepos)
# calculate QTL genotype probabilities
f2cross <- calc.genoprob(f2cross, step=1)
# find nearest pseudomarkers
pmark <- find.gene.pseudomarker(f2cross, pmap, genepos)
# line up individuals
id1 <- findCommonID(f2cross, expr1)
id2 <- findCommonID(f2cross, expr2)
# calculate LOD score for local eQTL
locallod1 <- calc.locallod(f2cross[,id1$first], expr1[id1$second,], pmark)
locallod2 <- calc.locallod(f2cross[,id2$first], expr2[id2$second,], pmark)
# take those with LOD > 25
Calculate correlations between columns of two matrices
For matrices x and y, calculate the correlation between columns of x and columns of y.
Usage
corbetw2mat(x, y, what = c("paired", "bestright", "bestpairs", "all"), corthresh = 0.9)
Arguments
x A numeric matrix.
y A numeric matrix with the same number of rows as x.
what Indicates which correlations to calculate and return. See value, below.
corthresh Threshold on correlations if what="bestpairs".
Details
Missing values (NA) are ignored, and we calculate the correlation using all complete pairs, as in cor with use="pairwise.complete.obs".
Value
If what="paired", the return value is a vector of correlations, between columns of x and the corresponding column of y. x and y must have the same number of columns.
If what="bestright", we return a data frame of size ncol(x) by 3, with the ith row being the maximum correlation between column i of x and a column of y, and then the y-column index and y-column name with that correlation. (In case of ties, we give the first one.)
If what = "bestpairs", we return a data frame with five columns, containing all pairs of columns (with one in x and one in y) with correlation \( \geq \) corthresh. Each row corresponds to a column pair, and contains the correlation and then the x- and y-column indices followed by the x- and y-column names.
If what = "all", the output is a matrix of size \( \text{ncol}(x) \times \text{ncol}(y) \), with all correlations between columns of x and columns of y.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
distee, findCommonID
Examples
data(expr1, expr2)
# correlations with paired columns
r <- corbetw2mat(expr1, expr2)
# top 10, by absolute value
r[order(abs(r), decreasing=TRUE)[1:10]]
# all pairs of columns with correlation >= 0.8
r_allpairs <- corbetw2mat(expr1, expr2, what="bestpairs", corthresh=0.6)
# for each column in left matrix, most-correlated column in right matrix
r_bestright <- corbetw2mat(expr1, expr2, what="bestright")
Arguments
- **e1**: Numeric matrix of gene expression data, as individuals x genes. The row and column names must contain individual and gene identifiers.
- **e2**: (Optional) Like e1. An appreciable number of individuals and genes must be in common.
- **d.method**: Calculate inter-individual distance as RMS difference or as correlation.
- **labels**: Two character strings, to use as labels for the two data matrices in subsequent output.
- **verbose**: if TRUE, give verbose output.
Details
We calculate the pairwise distance between all individuals (rows) in e1 and all individuals in e2. This distance is either the RMS difference (d.method="rmsd") or the correlation (d.method="cor").
Value
A matrix with nrow(e1) rows and nrow(e2) columns, containing the distances. The individual IDs are in the row and column names. The matrix is assigned class "lineupdist".
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
pulldiag, omitdiag, summary.lineupdist, plot2dist, disteg, corbetw2mat
Examples
```r
# load the example data
data(expr1, expr2)
# find samples in common
id <- findCommonID(expr1, expr2)
# calculate correlations between cols of x and cols of y
thecor <- corbetw2mat(expr1[id$first,], expr2[id$second,])
# subset at genes with corr > 0.8 and scale values
eexpr1s <- expr1[,thecor > 0.8]/1000
eexpr2s <- expr2[,thecor > 0.8]/1000
# calculate distance (using "RMS difference" as a measure)
d1 <- distee(eexpr1s, eexpr2s, d.method="rmsd", labels=c("1","2"))
# calculate distance (using "correlation" as a measure...really similarity)
```
d2 <- distee(expr1s, expr2s, d.method="cor", labels=c("1", "2"))
# pull out the smallest 8 self-self correlations
sort(pulldiag(d2))[1:8]
# summary of results
summary(d1)
summary(d2)
# plot histograms of RMS distances
plot(d1)
# plot histograms of correlations
plot(d2)
# plot distances against one another
plot2dist(d1, d2)
---
disteg
*Calculate distance between two gene expression data sets*
**Description**
Calculate a distance between all pairs of individuals for two gene expression data sets
**Usage**
```r
disteg(cross, pheno, pmark, min.genoprob = 0.99, k = 20,
min.classprob = 0.8, classprob2drop = 1, repeatKNN = TRUE,
max.selfd = 0.3, phenolabel = "phenotype", weightByLinkage = FALSE,
map.function = c("haldane", "kosambi", "c-f", "morgan"),
verbose = TRUE)
```
**Arguments**
- **cross**: An object of class "cross" containing data for a QTL experiment. See the help file for `read.cross` in the R/qtl package ([http://www.rqtl.org](http://www.rqtl.org)). There must be a phenotype named "id" or "ID" that contains the individual identifiers.
- **pheno**: A data frame of phenotypes (generally gene expression data), stored as individuals x phenotypes. The row names must contain individual identifiers.
- **pmark**: Pseudomarkers that are closest to the genes in pheno, as output by `find.gene.pseudomarker`.
- **min.genoprob**: Threshold on genotype probabilities; if maximum probability is less than this, observed genotype taken as NA.
- **k**: Number of nearest neighbors to consider in forming a k-nearest neighbor classifier.
min.classprob Minimum proportion of neighbors with a common class to make a class prediction.
classprob2drop If an individual is inferred to have a genotype mismatch with classprob > this value, treat as an outlier and drop from the analysis and then repeat the KNN construction without it.
repeatKNN If TRUE, repeat k-nearest neighbor a second time, after omitting individuals who seem to not be self-self matches.
max.selfd Min distance from self (as proportion of mismatches between observed and predicted eQTL genotypes) to be excluded from the second round of k-nearest neighbor.
phenolabel Label for expression phenotypes to place in the output distance matrix.
weightByLinkage If TRUE, weight the eQTL to account for their relative positions (for example, two tightly linked eQTL would each count about 1/2 of an isolated eQTL)
map.function Used if weightByLinkage is TRUE
verbose if TRUE, give verbose output.
Details
We consider the expression phenotypes in batches, by which pseudomarker they are closest to. For each batch, we pull the genotype probabilities at the corresponding pseudomarker and use the individuals that are in common between cross and pheno and whose maximum genotype probability is above min.genoprob, to form a classifier of eQTL genotype from expression values, using k-nearest neighbor (the function knn). The classifier is applied to all individuals with expression data, to give a predicted eQTL genotype. (If the proportion of the k nearest neighbors with a common class is less than min.classprob, the predicted eQTL genotype is left as NA.)
If repeatKNN is TRUE, we repeat the construction of the k-nearest neighbor classifier after first omitting individuals whose proportion of mismatches between observed and inferred eQTL genotypes is greater than max.selfd.
Finally, we calculate the distance between the observed eQTL genotypes for each individual in cross and the inferred eQTL genotypes for each individual in pheno, as the proportion of mismatches between the observed and inferred eQTL genotypes.
If weightByLinkage is TRUE, we use weights on the mismatch proportions for the various eQTL, taking into account their linkage. Two tightly linked eQTL will each be given half the weight of a single isolated eQTL.
Value
A matrix with nind(cross) rows and nrow(pheno) columns, containing the distances. The individual IDs are in the row and column names. The matrix is assigned class "lineupdist".
The names of the genes that were used to construct the classifier are saved in an attribute "retained".
The observed and inferred eQTL genotypes are saved as attributes "obsg" and "infg".
The denominators of the proportions that form the inter-individual distances are in the attribute "denom".
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
distee, summary.lineupdist, pulldiag, omitdiag, findCommonID, find.gene.pseudomarker, calc.locallod, plot.lineupdist, knn, plotEGclass
Examples
library(qtl)
# load example data
data(f2cross, expr1, pmap, genepos)
# calculate QTL genotype probabilities
f2cross <- calc.genoprob(f2cross, step=1)
# find nearest pseudomarkers
pmark <- find.gene.pseudomarker(f2cross, pmap, genepos)
# line up individuals
id <- findCommonID(f2cross, expr1)
# calculate LOD score for local eQTL
locallod <- calc.locallod(f2cross[,id$first], expr1[id$second[,], pmark)
# take those with LOD > 25
expr1s <- expr1[, locallod>25, drop=FALSE]
# calculate distance between individuals
# (prop'n mismatches between obs and inferred eQTL geno)
d <- disteg(f2cross, expr1s, pmark)
# plot distances
plot(d)
# summary of apparent mix-ups
summary(d)
# plot of classifier for and second eQTL
par(mfrow=c(2,1), las=1)
plotEGclass(d)
plotEGclass(d, 2)
**Example gene expression data**
**Description**
Matrices of simulated gene expression data, each for 98 individuals at 5,000 genes. Think of expr1 and expr2 as expression data on two different tissues.
**Usage**
```
data(expr1)
data(expr2)
```
**Format**
A matrix of integers, individuals as rows and genes as columns.
**See Also**
`genepos, f2cross, pmap`
**Examples**
```
data(expr1)
data(expr2)
# identify the common individuals
id <- findCommonID(rownames(expr1), rownames(expr2))
# correlation between tissues for each gene
rho <- corbetwmat(expr1[id$first[,], expr2[id$second[,])
hist(rho, breaks=100)
```
**Example experimental cross data**
**Description**
Simulated experimental cross data with some sample mix-ups. The only phenotype is an individual ID. There are 100 individuals genotyped at 1000 markers on 19 autosomes.
**Usage**
```
data(f2cross)
```
find.gene.pseudomarker
Format
An object of class "cross". See read.cross in the R/qtl package for details.
See Also
expr1, expr2, genepos, pmap
Examples
library(qtl)
data(f2cross)
summary(f2cross)
find.gene.pseudomarker
Find nearest pseudomarker to each gene
Description
Pull out the pseudomarker that is closest to the position of each of a series of genes.
Usage
find.gene.pseudomarker(cross, pmap, geneloc, where = c("prob", "draws"))
Arguments
cross An object of class "cross" containing data for a QTL experiment. See the help file for read.cross in the R/qtl package (http://www.rqtl.org).
pmap A physical map of the markers in cross, with locations in Mbp. This is a list whose components are the marker locations on each chromosome.
geneloc A data frame specifying the physical locations of the genes. There should be two columns, chr for chromosome and pos for position in Mbp. The rownames should indicate the gene names.
where Indicates whether to pull pseudomarkers from the genotype probabilities (produced by calc.genoprob) or from the imputed genotypes (produced by sim.geno).
Details
We first convert positions (by interpolation) from those contained within cross to physical coordinates contained in pmap. We then use find.pseudomarker to identify the closest pseudomarker to each gene location.
We also include the positions of the pseudomarkers, and we print a warning message if pseudomarkers are > 2 Mbp from the respective gene.
findCommonID
Value
A data frame with columns chr (the chromosome) and pmark (the name of the pseudomarker). The third column pos contains the Mbp position of the pseudomarker. The final column is the signed distance between the gene and the pseudomarker. The rownames indicate the gene names.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
find.pseudomarker, find.pseudomarkerpos, plotEGclass, disteg, calc.locallod
Examples
data(f2cross, expr1, genepos, pmap)
library(qtl)
# calc QTL genotype probabilities
f2cross <- calc.genoprob(f2cross, step=1)
# find nearest pseudomarkers
pmark <- find.gene.pseudomarker(f2cross, pmap, genepos, "prob")
findCommonID
Find individuals in common between a cross and a phenotype matrix
Description
Identify which individuals are in common between a QTL mapping data set and a matrix of phenotypes, series of genes.
Usage
findCommonID(id1, id2)
Arguments
id1 A character vector of individual IDs. This can also be a QTL cross object (see read.cross), in which case getid is used to grab individual IDs, or a matrix or data frame, in which case the rownames are taken to be IDs.
id2 Like id1, can be a character vector, a cross or a matrix/data frame.
Value
A list with three components:
First, a data frame with rows corresponding to all individuals (across the two sets of individual IDs) and three columns: indexInFirst and indexInSecond contain numeric indices to the locations of the individuals within cross and pheno, and inBoth is a logical vector to indicate which individuals appear in both crosses. The row names are the individual identifiers.
The second and third components are vectors of indices in id1 and id2, respectively, indicating the paired locations of the individuals that are in common.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
calc.loclod, corbetw2mat
Examples
data(f2cross, expr1)
# align IDs
id <- findCommonID(f2cross, expr1)
# aligned data
f2cross_aligned <- f2cross[,id$first]
expr1_aligned <- expr1[id$second,]
---
fscale
*Standardize the columns of a matrix*
Description
Standardize each column in a matrix, so that the columns have mean 0 and SD 1.
Usage
fscale(x)
Arguments
x
A numeric matrix.
Details
Missing values (NA) are ignored and left as is.
If there is just 1 non-missing value in a column, it is left as is.
This function uses a one-pass algorithm to calculate the mean and SD, which is fast but can show a bit of round-off error.
Value
A matrix of the same form as the input, but with columns transformed to have mean 0 and SD 1.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
scale
Examples
x <- matrix(1:10, ncol=2)
y <- fscale(x)
---
**genepos**
*Genomic positions of genes in simulated expression data*
---
Description
A table with the genomic positions of genes in the simulated expression data, expr1 and expr2.
Usage
data(genepos)
Format
A data frame with two columns, chromosome and physical position (in Mb).
See Also
expr1, expr2, f2cross, pmap
Examples
data(genepos)
# interplot genetic positions
library(qtl)
data(pmap)
data(f2cross)
genepos_interp <- interpPositions(genepos, pmap, pull.map(f2cross))
genepos[1:5,] # 'newpos' column is the interpolated cM position
lineupversion
Installed version of R/lineup
Description
Print the version number of the currently installed version of R/lineup.
Usage
lineupversion()
Value
A character string with the version number of the currently installed version of R/lineup.
Author(s)
Karl W Broman, <broman@wisc.edu>
Examples
lineupversion()
omitdiag
Replace the diagonal in a distance matrix with missing values
Description
Replace the diagonal (that is, self-self distances) from a distance matrix calculated by distee or disteg with missing values (so that only self-nonself distances are left).
Usage
omitdiag(d)
**plot.lineupdist**
**Arguments**
- `d`: A distance matrix calculated by `distee` or `disteg`.
**Details**
We use the row and column names to identify which entries are self-self.
**Value**
A matrix of the same form as the input, but with self-self distances replaced with NA.
**Author(s)**
Karl W Broman, <broman@wisc.edu>
**See Also**
- `pulldiag`, `distee`, `disteg`, `summary.lineupdist`, `plot2dist`, `plot.lineupdist`
**Examples**
```r
data(expr1, expr2)
# distance as RMS difference
d <- distee(expr1, expr2)
# focus on the self-nonself distances
# (replace self-self distances with NA)
d_selfnonself <- omitdiag(d)
```
---
**plot.lineupdist**
*Plot summary of inter-individual distances*
**Description**
Plot histograms of self-self and self-nonself distances from a distance matrix calculated by `distee` or `disteg`.
**Usage**
```r
## S3 method for class 'lineupdist'
plot(x, breaks = NULL, add.rug = TRUE,
what = c("both", "ss", "sn"), ...)
```
Arguments
- **x**: Output of `distee` or `disteg`.
- **breaks**: Optional vector of breaks, passed to `hist`, though if it is length 1, we interpret it as the number of breaks and ensure that both histograms use the same set of breaks.
- **add.rug**: If true, also include `rug` below histograms.
- **what**: Indicates whether to plot both self-self and self-nonself distances (or correlations) or just one or the other. ("ss" indicates self-self and "sn" indicates self-nonself.)
- **...**: Ignored at this point.
Details
We call `pulldiag` and `omitdiag` to get the self-self and self-nonself distances. If all of the self-self distances are missing, we plot just the self-nonself distances.
Value
None.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
`pulldiag`, `distee`, `plot2dist`
Examples
```r
data(expr1, expr2)
# distance as correlation
d <- distee(expr1, expr2, "cor")
# plot histograms of self-self and self-nonself correlations
plot(d)
```
plot2dist
Plot two sets of inter-individual distances against one another
Description
Plot two sets of inter-individual distances against one another, colored by self and non-self distances.
Usage
plot2dist(d1, d2, hirow = NULL, hicol = NULL, xlab = NULL, ylab = NULL, smoothScatter = FALSE, colself = "black", colnonself = "gray", colhirow = "green", colhicol = "orange", ...)
Arguments
d1 Output of distee.
d2 Output of distee.
hirow Names of rows to highlight in green.
hicol Names of columns to highlight in orange.
xlab X-axis label (optional)
ylab Y-axis label (optional)
smoothScatter If TRUE, plot non-self distances with smoothScatter; if FALSE, use plot.
colself Color to use for the self-self points. If NULL, these aren’t plotted.
colnonself Color to use for the non-self points. If NULL, these aren’t plotted.
colhirow Color to use for the hirow points. If NULL, these aren’t plotted.
colhicol Color to use for the hicol points. If NULL, these aren’t plotted.
... Passed to plot and points.
Value
None.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
pulldiag, distee, summary.lineupdist
Examples
data(expr1, expr2)
# distances as RMS difference and correlation
d_rmsd <- distee(expr1, expr2, "rmsd")
d_cor <- distee(expr1, expr2, "cor")
# plot distances against one another
plot2dist(d_rmsd, d_cor)
plotEGclass
Plot classifier of eQTL genotype from expression data
Description
Diagnostic plot of one of the eQTL classifiers from the results of `disteg`: generally expression phenotype against observed eQTL genotype, colored by inferred eQTL genotype.
Usage
plotEGclass(d, eqtl = 1, outercol = "inferred",
innercol = "observed", thecolors = c("#7B68ED", "#1B9E78", "#CA3767",
"#E59E00"), ...)
Arguments
d Output of `disteg`.
eqtl Numeric index or a character vector (of the form "1@102.35") indicating the eQTL to consider.
outercol Indicates how to color the outer edge of the points: "observed" indicates to color based on observed genotypes; "inferred" indicates to color based on inferred genotypes; otherwise, give a color.
innercol Like outercol, but indicating the interior of the points.
thecolors The colors to use in the plot. The last element (after the number of genotypes) indicates the color to use for missing values.
... Passed to `plot` and `points`.
Details
The function produces a diagnostic plot for studying one of the k-nearest neighbor classifiers underlying the output from `disteg`.
In the case of one expression phenotype attached to the selected eQTL, the plot is a dot plot of gene expression against observed eQTL genotype.
plotEGclass
In the case of two expression phenotypes, the plot is a scatterplot of the two expression phenotypes against each other.
In the case of more than two expression phenotypes, we use `pairs` to produce a matrix of scatterplots.
**Value**
None.
**Author(s)**
Karl W Broman, <brroman@wisc.edu>
**See Also**
`disteg`, `plot.lineupdist`, `plot2dist`, `knn`
**Examples**
```r
library(qtl)
# load example data
data(f2cross, expr1, pmap, genepos)
# calculate QTL genotype probabilities
f2cross <- calc.genoprob(f2cross, step=1)
# find nearest pseudomarkers
pmark <- find.gene.pseudomarker(f2cross, pmap, genepos)
# line up individuals
id <- findCommonID(f2cross, expr1)
# calculate LOD score for local eQTL
locallod <- calc.locallod(f2cross[,id$first], expr1[id$second,], pmark)
# take those with LOD > 25
expr1s <- expr1[,locallod>25,drop=FALSE]
# calculate distance between individuals
# (prop'n mismatches between obs and inferred eQTL geno)
d <- disteg(f2cross, expr1s, pmark)
# plot of classifier for and second eQTL
par(mfrow=c(2,1), las=1)
plotEGclass(d)
plotEGclass(d, 2)
```
pmap
**Physical map of markers**
**Description**
Physical map (Mb positions) of the markers in *f2cross*
**Usage**
`data(pmap)`
**Format**
A list of vectors, each containing the locations of markers in Mb. (Technically, an object of class “map”.)
**See Also**
`expr1, expr2, f2cross, genepos`
**Examples**
```r
data(pmap)
summary(pmap)
plot(pmap)
```
pulldiag
**Pull out the diagonal from a distance matrix**
**Description**
Pull out the diagonal from a distance matrix calculated by *distee* (that is, self-self distances).
**Usage**
`pulldiag(d)`
**Arguments**
- `d`
A distance matrix calculated by *distee*.
**Details**
We use the row and column names to identify which entries are self-self.
Value
A vector with the self-self distances.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
omitdiag, distee, disteg, summary.lineupdist, plot2dist, plot.lineupdist
Examples
data(expr1, expr2)
# distance as RMS difference
d <- distee(expr1, expr2)
# pull out the self-self distances
d_selfself <- pulldiag(d)
# samples with smallest self-self correlation
sort(d_selfself)[1:10]
---
subset.lineupdist Subsetting distance matrix
Description
Pull out a specified set of rows and columns from a distance matrix calculated by distee or disteg.
Usage
## S3 method for class 'lineupdist'
subset(x, rows = NULL, cols = NULL, ...)
## S3 method for class 'lineupdist'
x[rows = NULL, cols = NULL]
Arguments
x
A distance matrix object as obtained from distee or disteg.
rows
Optional vector of selected rows.
cols
Optional vector of selected columns.
...
Ignored at this point.
Value
The input distance matrix object, but with only the specified subset of the data.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
disteg, distee, pulldiag
Examples
data(expr1, expr2)
# find samples in common
id <- findCommonID(expr1, expr2)
# calculate correlations between cols of x and cols of y
thecor <- corbetw2mat(expr1$id$first[,], expr2$id$second[,])
expr1s <- expr1[,thecor > 0.8]/1000
expr2s <- expr2[,thecor > 0.8]/1000
# calculate correlations among samples
d <- distee(expr1s, expr2s, d.method="cor")
# pull out distances for samples 24, 92, 44, 66
samp <- c("24", "92", "44", "66")
d[samp, samp]
summary.lineupdist Summarize inter-individual distances
Description
Summarize the results of distee or disteg, with inter-individual distances between two sets of gene expression data.
Usage
## S3 method for class 'lineupdist'
summary(object, cutoff = NULL, dropmatches = TRUE,
reorder = c("alignmatches", "bydistance", "no"), ...)
Arguments
- **object**: Output of `distee` or `disteg`.
- **cutoff**: (Optional) Cutoff on correlation/distance, with rows in the results only being kept if the best distance/correlation is above this cutoff or the self-self result is not missing and is above this cutoff.
- **dropmatches**: If TRUE, omit rows for which an individual’s best match is itself.
- **reorder**: If "bydistance", reorder rows by increasing distance (or decreasing correlation) to the best match and then by decreasing distance (or decreasing correlation) to self; if "alignmatches", group related errors together; if "no", leave as is.
- ... Passed to `print.data.frame`.
Value
A list with two components: the distances summarized by row and the distances summarized by column.
For each individual, we calculate the minimum distance to others, next-smallest distance, the self-self distance, the mean and SD of the distances to others, and finally indicate the individual (or individuals) that is closest.
Author(s)
Karl W Broman, <broman@wisc.edu>
See Also
- `pulldiag`, `omitdiag`, `distee`, `disteg`, `plot2dist`, `plot.lineupdist`
Examples
```r
data(expr1, expr2)
d <- distee(expr1, expr2, "cor")
summary(d)
```
Index
*Topic **array**
corbetw2mat, 5
fscale, 14
omitdiag, 16
pulldiag, 22
*Topic **datasets**
expr-data, 11
f2cross, 11
geneapos, 15
pmap, 22
*Topic **graphics**
plot2dist, 19
plotEGclass, 20
*Topic **manip**
subset.lineupdist, 23
*Topic **multivariate**
corbetw2mat, 5
*Topic **print**
lineupversion, 16
*Topic **univar**
corbetw2mat, 5
*Topic **utilities**
calc.locallod, 2
combinedist, 3
distee, 6
disteg, 8
find.gene.pseudomarker, 12
findCommonID, 13
plot.lineupdist, 17
summary.lineupdist, 24
[] . lineupdist (subset.lineupdist), 23
calc.genoprob, 12
calc.locallod, 2, 10, 13, 14
combinedist, 3
cor, 5
corbetw2mat, 5, 7, 14
detectCores, 2
distee, 4, 6, 6, 10, 16–19, 22–25
disteg, 3, 4, 7, 8, 13, 16–18, 20, 21, 23–25
expr-data, 11
expr1, 12, 15, 22
expr1 (expr-data), 11
expr2, 12, 15, 22
expr2 (expr-data), 11
f2cross, 11, 11, 15, 22
find.gene.pseudomarker, 2, 3, 8, 10, 12
find.pseudomarker, 12, 13
find.pseudomarkerpos, 13
findCommonID, 3, 6, 10, 13
fscale, 14
geneapos, 11, 12, 15, 22
getid, 13
hist, 18
knn, 9, 10, 21
lineupversion, 16
omitdiag, 7, 10, 16, 18, 23, 25
pairs, 21
plot, 19, 20
plot.lineupdist, 10, 17, 17, 21, 23, 25
plot2dist, 7, 17, 18, 19, 21, 23, 25
plotEGclass, 3, 10, 13, 20
pmap, 11, 12, 15, 22
points, 19, 20
print.data.frame, 25
pulldiag, 7, 10, 17–19, 22, 24, 25
read.cross, 2, 8, 12, 13
rug, 18
scale, 15
scanone, 2, 3
INDEX
sim.gen, 12
smoothScatter, 19
subset.lineupdist, 23
summary.lineupdist, 4, 7, 10, 17, 19, 23, 24
|
{"Source-Url": "http://cran.ms.unimelb.edu.au/web/packages/lineup/lineup.pdf", "len_cl100k_base": 8671, "olmocr-version": "0.1.53", "pdf-total-pages": 27, "total-fallback-pages": 0, "total-input-tokens": 55666, "total-output-tokens": 10381, "length": "2e13", "weborganizer": {"__label__adult": 0.0003764629364013672, "__label__art_design": 0.0009899139404296875, "__label__crime_law": 0.00043129920959472656, "__label__education_jobs": 0.00223541259765625, "__label__entertainment": 0.00032520294189453125, "__label__fashion_beauty": 0.00021791458129882812, "__label__finance_business": 0.0005636215209960938, "__label__food_dining": 0.0004963874816894531, "__label__games": 0.0010585784912109375, "__label__hardware": 0.0014219284057617188, "__label__health": 0.0007190704345703125, "__label__history": 0.0004963874816894531, "__label__home_hobbies": 0.0003740787506103515, "__label__industrial": 0.0009675025939941406, "__label__literature": 0.0004127025604248047, "__label__politics": 0.0005006790161132812, "__label__religion": 0.0005540847778320312, "__label__science_tech": 0.2861328125, "__label__social_life": 0.0003628730773925781, "__label__software": 0.099609375, "__label__software_dev": 0.6005859375, "__label__sports_fitness": 0.0003974437713623047, "__label__transportation": 0.0003883838653564453, "__label__travel": 0.0002332925796508789}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 30941, 0.03611]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 30941, 0.6272]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 30941, 0.74247]], "google_gemma-3-12b-it_contains_pii": [[0, 1093, false], [1093, 2349, null], [2349, 3645, null], [3645, 4906, null], [4906, 5954, null], [5954, 6913, null], [6913, 8483, null], [8483, 10074, null], [10074, 12837, null], [12837, 13819, null], [13819, 14695, null], [14695, 16156, null], [16156, 17366, null], [17366, 18378, null], [18378, 19176, null], [19176, 20010, null], [20010, 20993, null], [20993, 21963, null], [21963, 23081, null], [23081, 24561, null], [24561, 25665, null], [25665, 26390, null], [26390, 27292, null], [27292, 28267, null], [28267, 29473, null], [29473, 30838, null], [30838, 30941, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1093, true], [1093, 2349, null], [2349, 3645, null], [3645, 4906, null], [4906, 5954, null], [5954, 6913, null], [6913, 8483, null], [8483, 10074, null], [10074, 12837, null], [12837, 13819, null], [13819, 14695, null], [14695, 16156, null], [16156, 17366, null], [17366, 18378, null], [18378, 19176, null], [19176, 20010, null], [20010, 20993, null], [20993, 21963, null], [21963, 23081, null], [23081, 24561, null], [24561, 25665, null], [25665, 26390, null], [26390, 27292, null], [27292, 28267, null], [28267, 29473, null], [29473, 30838, null], [30838, 30941, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 30941, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 30941, null]], "pdf_page_numbers": [[0, 1093, 1], [1093, 2349, 2], [2349, 3645, 3], [3645, 4906, 4], [4906, 5954, 5], [5954, 6913, 6], [6913, 8483, 7], [8483, 10074, 8], [10074, 12837, 9], [12837, 13819, 10], [13819, 14695, 11], [14695, 16156, 12], [16156, 17366, 13], [17366, 18378, 14], [18378, 19176, 15], [19176, 20010, 16], [20010, 20993, 17], [20993, 21963, 18], [21963, 23081, 19], [23081, 24561, 20], [24561, 25665, 21], [25665, 26390, 22], [26390, 27292, 23], [27292, 28267, 24], [28267, 29473, 25], [29473, 30838, 26], [30838, 30941, 27]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 30941, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
499206b971d7a4fd35f60557d30945df6d052b85
|
This document explains how to set up WebLogic JNDI. It is intended for programmers who are developing WebLogic Server applications and want to use the JNDI feature. This document is written for application developers who want to design, develop, configure, and manage applications using the Java Platform, Enterprise Edition (Java EE) and want to use the JNDI API to provide a unified interface to multiple naming and directory services in their enterprise. It is assumed that readers know JNDI and the Java programming language.
1 Contents
This document contains the following topics:
- Section 2, "Introduction and Roadmap"
- Section 3, "Understanding WebLogic JNDI"
- Section 4, "WebLogic JNDI"
2 Introduction and Roadmap
The following sections describe the contents and organization of this guide—Programming JNDI for Oracle WebLogic Server.
- Section 2.1, "Guide to this Document"
- Section 2.2, "Related Documentation"
- Section 2.3, "Examples for the Web Application Developer"
- Section 2.4, "New and Changed Features in This Release"
2.1 Guide to this Document
- Section 2, "Introduction and Roadmap," describes the scope and organization of this guide.
- Section 3, "Understanding WebLogic JNDI," provides an overview of the Java Naming and Directory Interface (JNDI) implementation in WebLogic Server.
- Section 4, "WebLogic JNDI," describes programming with WebLogic JNDI.
2.2 Related Documentation
For additional information on JNDI, see the following documents:
2.3 Examples for the Web Application Developer
In addition to this document, Oracle provides examples for software developers within the context of the Avitek Medical Records Application (MedRec) sample application, as well as JNDI code examples.
2.3.1 Avitek Medical Records Application (MedRec)
MedRec is an end-to-end sample Java EE application shipped with WebLogic Server that simulates an independent, centralized medical record management system. The MedRec application provides a framework for patients, doctors, and administrators to manage patient data using a variety of different clients.
MedRec demonstrates WebLogic Server and Java EE features, and highlights Oracle-recommended best practices. MedRec is optionally installed (select Server Examples in the custom installation) with the WebLogic Server distribution, and can be accessed from the Start menu on Windows machines. For Linux and other platforms, you can start MedRec from the WL_HOME\samples\domains\medrec directory, where WL_HOME is the top-level installation directory for WebLogic Platform.
2.3.2 JNDI Examples in the WebLogic Server Distribution
WebLogic Server optionally installs API code examples in WL_HOME\samples\server\examples\src\examples, where WL_HOME is the top-level directory of your WebLogic Server installation. Select Server Examples in the custom installation. You can start the Examples server, and obtain information about the samples and how to run them from the WebLogic Server Start menu.
2.4 New and Changed Features in This Release
For a comprehensive listing of the new WebLogic Server features introduced in this release, see What’s New in Oracle WebLogic Server.
3 Understanding WebLogic JNDI
The following sections present an overview of the Java Naming and Directory Interface (JNDI) implementation in WebLogic Server including:
- Section 3.1, "What is JNDI?"
- Section 3.2, "WebLogic Server JNDI"
3.1 What is JNDI?
Applications use naming services to locate objects in data sources, EJBs, JMS, Mail Sessions, and so on in the network. A naming service associates names with objects and finds objects based on their given names. (The RMI registry is a good example of a naming service.)
JNDI provides a common-denominator interface to many existing naming services, such as LDAP (Lightweight Directory Access Protocol) and DNS (Domain Name System). These naming services maintain a set of bindings, which relate names to objects and provide the ability to look up objects by name. JNDI allows the components in distributed applications to locate each other.
The JNDI API, at [http://download.oracle.com/javase/6/docs/technotes/guides/jndi/reference.html](http://download.oracle.com/javase/6/docs/technotes/guides/jndi/reference.html), is defined to be independent of any specific naming or directory service implementation. It supports the use of a number of methods for accessing various new and existing services. This support allows any service-provider implementation to be plugged into the JNDI framework using the standard service provider interface (SPI) conventions.
### 3.2 WebLogic Server JNDI
The WebLogic Server implementation of JNDI supplies methods that:
- Give clients access to the WebLogic Server naming services
- Make objects available in the WebLogic namespace
- Retrieve objects from the WebLogic namespace
Each WebLogic Server cluster is supported by a replicated cluster-wide JNDI tree that provides access to both replicated and pinned RMI and EJB objects. While the JNDI tree representing the cluster appears to the client as a single global tree, the tree containing the cluster-wide services is actually replicated across each WebLogic Server instance in the cluster. For more information, see Section 4.6, "Using WebLogic JNDI in a Clustered Environment."
Other WebLogic services can use the integrated naming service provided by WebLogic Server JNDI. For example, WebLogic RMI can bind and access remote objects by both standard RMI methods and JNDI methods.
In addition to the standard Java interfaces for JNDI, WebLogic Server provides its own implementation, `weblogic.jndi.WLInitialContextFactory`, that uses the standard JNDI interfaces.
You need not instantiate this class directly. Instead, you can use the standard `javax.naming.InitialContext` class and set the appropriate hash table properties, as documented in the section Section 4.2, "Setting Up JNDI Environment Properties for the Initial Context." All interaction is done through the `javax.naming.Context` interface, as described in the JNDI Javadoc.
For instructions on using the WebLogic JNDI API for client connections, see Section 4, "WebLogic JNDI."
### 4 WebLogic JNDI
The following sections describe programming with WebLogic JNDI:
- Section 4.1, "Using WebLogic JNDI to Connect a Java Client to a Single Server"
- Section 4.2, "Setting Up JNDI Environment Properties for the Initial Context"
- Section 4.3, "Using the Context to Look Up a Named Object"
- Section 4.4, "Using a Named Object to Get an Object Reference"
- Section 4.5, "Closing the Context"
4.1 Using WebLogi c JNDI to Connect a Java Client to a Single Server
The WebLogic Server JNDI Service Provider Interface (SPI) provides an InitialContext implementation that allows remote Java clients to connect to WebLogic Server. The client can specify standard JNDI environment properties that identify a particular WebLogic Server deployment and related connection properties for logging in to WebLogic Server.
To interact with WebLogic Server, a Java client must be able to get an object reference for a remote object and invoke operations on the object. To accomplish this, the client application code must perform the following procedure:
1. Set up JNDI environment properties for the InitialContext.
2. Establish an InitialContext with WebLogic Server.
3. Use the context to look up a named object in the WebLogic Server namespace.
4. Use the named object to get a reference for the remote object and invoke operations on the remote object.
5. Close the context.
The following sections discuss JNDI client operations for connecting to a specific WebLogic Server instance. For information about using JNDI in a WebLogic Server cluster, see Section 4.6.5, "Using WebLogic JNDI from a Client in a Clustered Environment."
Before you can use JNDI to access an object in a WebLogic Server environment, you must load the object into the WebLogic Server JNDI tree.
4.2 Setting Up JNDI Environment Properties for the Initial Context
The first task that a Java client application must perform is to create environment properties. The InitialContext factory uses various properties to customize the InitialContext for a specific environment. You set these properties either by using a hash table or the set() method of a WebLogic environment object. These properties, which are specified name-to-value pairs, determine how the WLInitialContextFactory creates the context.
The following properties are used to customize the InitialContext:
- **Context.PROVIDER_URL**— specifies the URL of the WebLogic Server instance that provides the name service. The default is t3://localhost:7001.
- **Context.SECURITY_PRINCIPAL**— specifies the identity of the user (that is, a user defined in a WebLogic Server security realm) for authentication purposes. The property defaults to the guest user unless the thread has already been associated with a WebLogic Server user. For more information, see Section 4.2.4, "Associating a WebLogic User with a Security Context."
- **Context.SECURITY_CREDENTIALS**— specifies either the password for the user defined in the Context.SECURITY_PRINCIPAL property or an object that implements the weblogic.security.acl.UserInfo interface with the Context.SECURITY_CREDENTIALS property defined. If you pass a UserInfo
object in this property, the Context.PROVIDER_URL property is ignored. The property defaults to the guest user unless the thread has already been associated with a user. For more information, see Section 4.2.4, "Associating a WebLogic User with a Security Context."
You can use the same properties on either a client or a server. If you define the properties on a server-side object, a local context is used. If you define the properties on a client or another WebLogic Server instance, the context delegates to a remote context running on the WebLogic Server instance specified by the Context.PROVIDER_URL property. A remote object bound to the server will not be serviced by peerGone, and will not be reachable if the client should fail.
There are some properties that cannot be changed after the creation of the context. These properties include provider URL, user credentials, and factories. AddToEnvironment can be used to change other properties after the creation of the context.
Example 1 shows how to obtain a context using the properties Context.INITIAL_CONTEXT_FACTORY and Context.PROVIDER_URL.
Example 1 Obtaining a Context
```java
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,
"t3://localhost:7001");
try {
ctx = new InitialContext(ht);
// Use the context in your program
}
catch (NamingException e) {
// a failure occurred
}
finally {
try {ctx.close();}
catch (Exception e) {
// a failure occurred
}
}
```
Additional WebLogic-specific properties are also available for controlling how objects are bound into the cluster-wide JNDI tree. Bindings may or may not be replicated across the JNDI tree of each server within the cluster due to the way these properties are set. Properties such as these are identified by constants in the weblogic.jndi.WLContext class. For more information about JNDI-related clustering issues, see Section 4.6.5, "Using WebLogic JNDI from a Client in a Clustered Environment."
4.2.1 Creating a Context Using a Hashtable
You can create a context with a hashtable in which you have specified the properties described in Section 4.2, "Setting Up JNDI Environment Properties for the Initial Context."
To do so, pass the hashtable to the constructor for InitialContext. The property java.naming.factory.initial is used to specify how the InitialContext is
created. To use WebLogic JNDI, you must always set the
java.naming.factory.initial property to
weblogic.jndi.WLInitialContextFactory. This setting identifies the factory
that actually creates the context.
### 4.2.2 Creating a Context Using a WebLogic Environment Object
You can also create a context by using a WebLogic environment object implemented by
weblogic.jndi.environment. Although the environment object is
WebLogic-specific, it offers the following advantages:
- A set of defaults which reduces the amount of code you need to write.
- Convenience set() methods that provide compile-time type-safety. The
type-safety set() methods can save you time both writing and debugging code.
The WebLogic environment object provides the following defaults:
- If you do not specify an InitialContext factory,
WLInitialContextFactory is used.
- If you do not specify a user and password in the Context.SECURITY_
PRINCIPAL and Context.CREDENTIALS properties, the guest user and
password are used unless the thread has already been associated with a user.
- If you do not specify a Context.PROVIDER_URL property,
t3://localhost:7001 is used.
If you want to create an InitialContext with these defaults, write the following
code:
```java
Environment env = new Environment();
Context ctx = env.getInitialContext();
```
If you want to set only a WebLogic Server to a Distributed Name Service (DNS) name
for client cluster access, write the following code:
```java
Environment env = new Environment();
env.setProviderURL("t3://myweblogiccluster.com:7001");
Context ctx = env.getInitialContext();
```
---
**Note:** Every time you create a new JNDI environment object, you are
creating a new security scope. This security scope ends with a
context.close() method. The
environment.getInitialContext() method does not work
correctly with the IIOP protocol.
---
**Example 2** illustrates using a JNDI environment object to create a security context.
**Example 2 Creating a Security Context with a JNDI Environment Object**
```java
weblogic.jndi.Environment environment = new weblogic.jndi.Environment();
environment.setInitialContextFactory(
weblogic.jndi.Environment.DEFAULT_INITIAL_CONTEXT_FACTORY);
environment.setProviderURL(“t3://bross:4441”);
environment.setSecurityPrincipal(“guest”);
environment.setSecurityCrendentials(“guest”);
InitialContext ctx = environment.getInitialContext();
```
4.2.3 Creating a Context from a Server-Side Object
You may also need to create a context from an object (an Enterprise JavaBean (EJB) or Remote Method Invocation (RMI) object) that is instantiated in the Java Virtual Machine (JVM) of WebLogic Server. When using a server-side object, you do not need to specify the Context.PROVIDER_URL property. User names and passwords are required only if you want to sign in as a specific user.
To create a context from within a server-side object, you first must create a new InitialContext, as follows:
```java
Context ctx = new InitialContext();
```
You do not need to specify a factory or a provider URL. By default, the context is created as a context and is connected to the local naming service.
4.2.4 Associating a WebLogic User with a Security Context
See Section 4.2.5, "JNDI Contexts and Threads."
4.2.5 JNDI Contexts and Threads
When you create a JNDI context with a user name and password, you associate a user with a thread. When the context is created, the user is pushed onto the context stack associated with the thread. Before starting a new context on the thread, you must close the first context so that the first user is no longer associated with the thread. Otherwise, users are pushed down in the stack each time a new context created. This is not an efficient use of resources and may result in the incorrect user being returned by ctx.lookup() calls. This scenario is illustrated by the following steps:
1. Create a second context (with user name and credential) called ctx2 for user2. At this point, the thread has a stack of users associated with it. User2 is at the top of the stack and user1 is below it in the stack, so user2 is used as the current user.
2. If you do a ctx1.lookup("abc") call, user2 is used as the identity rather than user1, because user2 is at the top of the stack. To get the expected result, which is to have ctx1.lookup("abc") call performed as user1, you need to do a ctx2.close() call. The ctx2.close() call removes user2 from the stack associated with the thread and so that a ctx1.lookup("abc") call now uses user1 as expected.
---
**Note:** When the weblogic.jndi.enableDefaultUser flag is enabled, there are two situations where a close() call does not remove the current user from the stack and this can cause JNDI context problems. For information on how to avoid JNDI context problems, see Section 4.2.5.1, "How to Avoid Potential JNDI Context Problems."
---
4.2.5.1 How to Avoid Potential JNDI Context Problems
Issuing a close() call is usually as described in Section 4.2.5, "JNDI Contexts and Threads." However, the following is an exception to the expected behavior that occurs when the weblogic.jndi.enableDefaultUser flag is enabled:
4.2.5.2 Last Used
When using IIOP, an exception to expected behavior arises when there is one context on the stack and that context is removed by a close(). The
identity of the last context removed from the stack determines the current identity of the user. This scenario is described in the following steps:
1. Do a \texttt{ctx1.close()} call.
2. Do a \texttt{ctx1.lookup()} call. \textit{The current identity is user1.}
3. Create a context (with user name and credential) called \texttt{ctx2} for \texttt{user2}. In the process of creating the context, \texttt{user2} is associated with the thread and stored in the stack, that is, the current identity is set to \texttt{user2}.
4. Do a \texttt{ctx2.close()} call.
5. Do a \texttt{ctx2.lookup()} call. \textit{The current identity is user2.}
4.3 Using the Context to Look Up a Named Object
The \texttt{lookup()} method on the context is used to obtain named objects. The argument passed to the \texttt{lookup()} method is a string that contains the name of the desired object. Example 3 shows how to retrieve an EJB named \texttt{ServiceBean}.
\textbf{Example 3 \ Looking Up a Named Object}
\begin{verbatim}
try {
ServiceBean bean = (ServiceBean)ctx.lookup("ejb.serviceBean");
}catch (NameNotFoundException e) {
// binding does not exist
}catch (NamingException e) {
// a failure occurred
}
\end{verbatim}
4.4 Using a Named Object to Get an Object Reference
EJB client applications get object references to EJB remote objects from EJB Homes. RMI client applications get object references to other RMI objects from an initial named object. Both initial named remote objects are known to WebLogic Server as factories. A factory is any object that can return a reference to another object that is in the WebLogic namespace.
The client application invokes a method on a factory to obtain a reference to a remote object of a specific class. The client application then invokes methods on the remote object, passing any required arguments.
Example 4 contains a code fragment that obtains a remote object and then invokes a method on it.
\textbf{Example 4 \ Using a Named Object to Get an Object Reference}
\begin{verbatim}
ServiceBean bean = ServiceBean.Home.create("ejb.ServiceBean")
Servicebean.additem(66);
\end{verbatim}
4.5 Closing the Context
After clients finish working with a context, Oracle recommends that the client close the context in order to release resources and avoid memory leaks. Oracle recommends that you use a \texttt{finally{}} block and wrap the \texttt{close()} method in a \texttt{try{}} block. If you attempt to close a context that was never instantiated because of an error, the Java client application throws an exception.
In Example 5, the client closes the context, releasing the resource being used.
Example 5 Closing the Context
```java
try {
ctx.close();
} catch () {
//a failure occurred
}
```
4.6 Using WebLogic JNDI in a Clustered Environment
The intent of WebLogic JNDI is to provide a naming service for Java EE services, specifically EJB, RMI, and Java Messaging Service (JMS). Therefore, it is important to understand the implications of binding an object to the JNDI tree in a clustered environment.
The following sections discuss how WebLogic JNDI is implemented in a clustered environment and offer some approaches you can take to make your own objects available to JNDI clients.
4.6.1 Using the Relationship of RMI and JNDI to Enable WebLogic Clusters
WebLogic RMI is the enabling technology that allows clients in one JVM to access EJBs and JMS services from a client in another JVM. RMI stubs marshal incoming calls from the client to the RMI object. To make Java EE services available to a client, WebLogic binds an RMI stub for a particular service into its JNDI tree under a particular name. The RMI stub is updated with the location of other instances of the RMI object as the instances are deployed to other servers in the cluster. If a server within the cluster fails, the RMI stubs in the other server’s JNDI tree are updated to reflect the server failure.
When a client connects to a cluster, it is actually connecting to one of the WebLogic Server instances in the cluster. Because the JNDI tree for this WebLogic Server instance contains the RMI stubs for all services offered by the other WebLogic Servers in the cluster in addition to its own services, the cluster appears to the client as one WebLogic Server instance hosting all of the cluster-wide services. When a new WebLogic Server instance joins a cluster, each WebLogic Server instance already in the cluster is responsible for sharing information about its own services to the new WebLogic Server instance. With the information collected from all the other servers in the cluster, the new server will create its own copy of the cluster-wide JNDI tree.
RMI stubs significantly affect how WebLogic JNDI is implemented in a clustered environment:
- RMI stubs are relatively small. This allows WebLogic JNDI to replicate stubs across all WebLogic Server instances in a cluster with little overhead in terms of server-to-server cross-talk.
- RMI stubs serve as the mechanism for replication across a cluster. An instance of a RMI object is deployed to a single WebLogic Server instance, however, the stub is replicated across the cluster.
4.6.2 Making Custom Objects Available to a WebLogic Server Cluster
When you bind a custom object (a non-RMI object) into a JNDI tree in a WebLogic Server cluster, the object is replicated across all the servers in the cluster. However, if the host server goes down, the custom object is removed from the cluster’s JNDI tree. Custom objects are not replicated unless the custom object is bound again. You need to unbind and rebind a custom object every time you want to propagate changes made to the custom object. Therefore, WebLogic JNDI should not be used as a distributed
object cache. You can use a third-party solution with WebLogic Server to provide distributed caches.
Suppose the custom object needs to be accessed only by EJBs that are deployed on only one WebLogic Server instance. Obviously it is unnecessary to replicate this custom object throughout all the WebLogic Server instances in the cluster. In fact, you should avoid replicating the custom object in order to avoid any performance degradation due to unnecessary server-to-server communication. To create a binding that is not replicated across WebLogic Server instances in a cluster, you must specify the `REPLICATE_BINDINGS` property when creating the context that binds the custom object to the namespace. Example 6 illustrates the use of the `REPLICATE_BINDINGS` property.
**Example 6 Using the `REPLICATE_BINDINGS` Property**
```java
Hashtable ht = new Hashtable();
//turn off binding replication
ht.put(WLContext.REPLICATE_BINDINGS, "false");
try {
Context ctx = new InitialContext(ht);
//bind the object
ctx.bind("my_object", MyObject);
} catch (NamingException ne) {
//failure occurred
}
```
When you are using this technique and you need to use the custom object, you must explicitly obtain an `InitialContext` for the WebLogic Server instance. If you connect to any other WebLogic Server instance in the cluster, the binding does not appear in the JNDI tree.
If you need a custom object accessible from any WebLogic Server instance in the cluster, deploy the custom object on each WebLogic Server instance in the cluster without replicating the JNDI bindings.
When using WebLogic JNDI to replicate bindings, the bound object will be handled as if it is owned by the host WebLogic Server instance. If the host WebLogic Server instance fails, the custom object is removed from all the JNDI trees of all WebLogic Server instances in the cluster. This behavior can have an adverse effect on the availability of the custom object.
### 4.6.3 Data Caching Design Pattern
A common task in Web applications is to cache data used by multiple objects for a period of time to avoid the overhead associated with data computation or connecting to another service.
Suppose you have designed a custom data caching object that performs well on a single WebLogic Server instance and you would like to use this same object within a WebLogic Server cluster. If you bind the data caching object in the JNDI tree of one of the WebLogic Server instances, WebLogic JNDI will, by default, copy the object to each of the other WebLogic Server instances in the cluster. It is important to note that since this is not an RMI object, what you are binding into the JNDI tree (and copying to the other WebLogic Server instances) is the object itself, not a stub that refers to a single instance of the object hosted on one of the WebLogic Server instances. Do not assume from the fact that WebLogic Server copies a custom object between servers that custom objects can be used as a distributed cache. Remember the custom object is removed from the cluster if the WebLogic Server instance to which it was bound fails and
changes to the custom object are not propagated through the cluster unless the object is unbound and rebound to the JNDI tree.
For performance and availability considerations, it is often desirable to avoid using WebLogic JNDI’s binding replication to copy large custom objects with high availability requirements to all of the WebLogic Server instances in a cluster. As an alternative, you can deploy a separate instance of the custom object on each of the WebLogic Server instances in the cluster. When binding the object to each WebLogic Server instance’s JNDI tree, you should make sure to turn off binding replication as described in Section 4.6.2, “Making Custom Objects Available to a WebLogic Server Cluster”. In this design pattern, each WebLogic Server instance has a copy of the custom object but you will avoid copying large amounts of data from server to server. Regardless of which approach you use, each instance of the object should maintain its own logic for when it needs to refresh its cache independently of the other data cache objects in the cluster. For example, suppose a client accesses the data cache on one WebLogic Server instance. It is the first time the caching object has been accessed, so it computes or obtains the information and saves a copy of the information for future requests. Now suppose another client connects to the cluster to perform the same task as the first client only this time the connection is made to a different WebLogic Server instance in the cluster. If this is the first time this particular data caching object has been accessed, it will need to compute the information regardless of whether other data caching objects in the cluster already have the information cached. Of course, for any future requests, this instance of the data cache object will be able to refer to the information it has saved.
4.6.4 Exactly-Once-Per-Cluster Design Pattern
In some cases, it is desirable to have a service that appears only once in the cluster. This is accomplished by deploying the service on one machine only. For RMI objects, you can use the default behavior of WebLogic JNDI to replicate the binding (the RMI stub) and the single instance of your object will be accessible from all WebLogic Server instances in the cluster. This is referred to as a pinned service. For non-RMI objects, make sure that you use the REPPLICATE_BINDINGS property when binding the object to the namespace. In this case, you will need to explicitly connect to the host WebLogic Server instance to access the object. Alternatively, you can create an RMI object that is deployed on the same host WebLogic Server instance that can act as a proxy for your non-RMI object. The stub for the proxy can be replicated (using the default WebLogic JNDI behavior) allowing clients connected to any WebLogic Server instance in the cluster to access the non-RMI object via the RMI proxy.
For services with high-availability requirements, you can configure automatic migration of an RMI object to another server. For more information about automatic migration, see "Whole Server Migration" in Using Clusters for Oracle WebLogic Server.
4.6.5 Using WebLogic JNDI from a Client in a Clustered Environment
The JNDI binding for an object can appear in the JNDI tree for one WebLogic Server instance in the cluster, or it can be replicated to all the WebLogic Server instances in the cluster. If the object of interest is bound in only one WebLogic Server instance, you must explicitly connect to the host WebLogic Server instance by setting the Context.PROVIDER_URL property to the host WebLogic Server URL when creating the InitialContext, as described in Section 4.1, "Using WebLogic JNDI to Connect a Java Client to a Single Server."
In most cases, however, the object of interest is either a clustered service or a pinned service. As a result, a stub for the service is displayed in the JNDI tree for each
WebLogic Server instance in the cluster. In this case, the client does not need to name a specific WebLogic Server instance to provide its naming service. In fact, it is best for the client to simply request that a WebLogic cluster provide a naming service, in which case the context factory in WebLogic Server can choose whichever WebLogic Server instance in the cluster seems most appropriate for the client.
Currently, a naming service provider is chosen within WebLogic using a DNS name for the cluster that can be defined by the `ClusterAddress` attribute. This attribute defines the address to be used by clients to connect to a cluster. This address may be either a DNS host name that maps to multiple IP addresses or a comma separated list of single address host names or IP addresses. If network channels are configured, it is possible to set the cluster address on a per channel basis. See “Communications In a Cluster” in Using Clusters for Oracle WebLogic Server.
The context that is returned to a client of clustered services is, in general, implemented as a failover stub that can transparently change the naming service provider if a failure (such as a communication failure) with the selected WebLogic Server instance occurs.
Example 7 shows how a client uses the cluster’s naming service.
**Example 7 Using the Naming Service in a WebLogic Cluster**
```java
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://acmeCluster:7001");
try {
Context ctx = new InitialContext(ht);
// Do the client's work
} catch (NamingException ne) {
// A failure occurred
}
finally {
try {ctx.close();}
catch (Exception e) {
// a failure occurred
}
}
```
The hostname specified as part of the provider URL is the DNS name for the cluster that can be defined by the `ClusterAddress` setting in a Cluster stanza of the `config.xml` file. `ClusterAddress` maps to the list of hosts providing naming service in this cluster. For more information, see “Understanding Cluster Configuration” in Using Clusters for Oracle WebLogic Server.
In Example 7, the cluster name `acmeCluster` is used to connect to any of the WebLogic Server instances in the cluster. The resulting context is replicated so that it can fail over transparently to any WebLogic Server instance in the cluster.
An alternative method of specifying the initial point of contact with the WebLogic Server cluster is to supply a comma-delimited list of DNS server names or IP addresses.
- The following example specifies a list of WebLogic Server instances using the same port:
```java
ht.put(Context.PROVIDER_URL, 't3://acme1,acme2,acme3:7001');
```
All the WebLogic Server instances listen on the port specified at the end of the URL.
- The following example specifies a list of WebLogic Server instances using different ports:
```java
ht.put(Context.PROVIDER_URL, "t3://node1:7001,node2:7002,node3:7003");
```
When you use a DNS name which maps to multiple servers, WebLogic Server relies on DNS for load balancing.
When you use a comma-delimited list of DNS names for WebLogic Server nodes, failover is accomplished using the round-robin method, with the request going to a randomly chosen server until that server fails to respond, after which the request will go to the next server on the list. This will continue for each server instance that fails.
Once the client has gotten a context, no additional load balancing occurs unless there is a failure, in which case a WebLogic Server instance will fail over to another node in the cluster.
A remote client will get the context from the first available server. A client that is local to a server in the cluster will never go to a remote server for JNDI operations.
When you look up a stub, the first invocation of the stub will ordinarily go to the server from which you got the context. If the stub is clusterable, subsequent invocations will be load balanced based on the user defined load balancing policy.
For additional information about JNDI and clusters see "Overview" in Using Clusters for Oracle WebLogic Server.
### 4.7 Using JNDI from Within Java EE Components
Although it is possible for Java EE components to use the global environment directly, it is preferable to use the component environment. Each Java EE component within a Java EE application had its own component environment which is set up based on information contained in the component's deployment descriptors.
Java EE components are able to look up their component environments using the following code:
```java
Context ctx = new InitialContext();
Context comp_env = (Context)ctx.lookup("java:comp/env");
```
Because you are working within a Java EE component, you do not need to set up the hashtable or environment objects to define the connection information.
This context is used in the same way as the global environment, however, the names you use are the ones defined in the deployment descriptor for your component. For example, if you have an `ejb-ref` in your deployment descriptor that looks like:
```xml
<ejb-ref>
...
<ejb-ref-name>ejb1</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>ejb1.EJB1Home</home>
<remote>ejb1.EJB1</remote>
...
</ejb-ref>
```
you would look up the name defined with the `<ejb-ref-name>` setting, which in this case is "ejb1".
Using the component environment rather than the global environment to set your JNDI name is advantageous because the name it refers to is resolved during deployment. This means that naming conflicts can be resolved without rewriting the code.
4.8 Setting Up Foreign JNDI
Foreign JNDI is an API that allows you to access objects on a remote JNDI tree without having to connect directly to the remote tree.
Foreign JNDI enables you to make links to a JNDI tree on another server or provider including, but not limited to, WebLogic Server, or a JNDI tree in a Java program. Once you have configured Foreign JNDI, you can use an object that is somewhere else with the same ease that you would use an object bound in your WebLogic Server instance.
To configure Foreign JNDI, create a `ForeignJNDIProvider` with the address of the remote JNDI provider whose objects you want to use, and create a user name and password to access those objects. Optionally, you can target Foreign JNDI references to specific servers, clusters, or both. (If no targets are selected, Foreign JNDI references will be deployed to the entire domain). Then you can create `ForeignJNDILinks` and `ForeignJNDIObjects` that set up a relationship between a name in the local JNDI tree to the object in the remote tree.
For more information on how to configure Foreign JNDI, see "Create a foreign JNDI provider" in the Oracle WebLogic Server Administration Console Help.
5 Documentation Accessibility
For information about Oracle’s commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
Access to Oracle Support
Oracle customers have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.
|
{"Source-Url": "https://docs.oracle.com/cd/E24329_01/web.1211/e24489.pdf", "len_cl100k_base": 8240, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 35488, "total-output-tokens": 9108, "length": "2e13", "weborganizer": {"__label__adult": 0.0002137422561645508, "__label__art_design": 0.00015175342559814453, "__label__crime_law": 0.0001556873321533203, "__label__education_jobs": 0.0003800392150878906, "__label__entertainment": 3.153085708618164e-05, "__label__fashion_beauty": 7.2479248046875e-05, "__label__finance_business": 0.0002090930938720703, "__label__food_dining": 0.00015354156494140625, "__label__games": 0.0003159046173095703, "__label__hardware": 0.0006351470947265625, "__label__health": 0.0002007484436035156, "__label__history": 8.994340896606445e-05, "__label__home_hobbies": 4.076957702636719e-05, "__label__industrial": 0.00017952919006347656, "__label__literature": 8.994340896606445e-05, "__label__politics": 9.429454803466796e-05, "__label__religion": 0.0002651214599609375, "__label__science_tech": 0.0031909942626953125, "__label__social_life": 4.458427429199219e-05, "__label__software": 0.0158538818359375, "__label__software_dev": 0.97705078125, "__label__sports_fitness": 0.0001271963119506836, "__label__transportation": 0.00016689300537109375, "__label__travel": 0.00011092424392700197}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 37269, 0.01504]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 37269, 0.50957]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 37269, 0.8426]], "google_gemma-3-12b-it_contains_pii": [[0, 1485, false], [1485, 3697, null], [3697, 6582, null], [6582, 9327, null], [9327, 11785, null], [11785, 14193, null], [14193, 17105, null], [17105, 19754, null], [19754, 22869, null], [22869, 25990, null], [25990, 29918, null], [29918, 32672, null], [32672, 35353, null], [35353, 37269, null], [37269, 37269, null], [37269, 37269, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1485, true], [1485, 3697, null], [3697, 6582, null], [6582, 9327, null], [9327, 11785, null], [11785, 14193, null], [14193, 17105, null], [17105, 19754, null], [19754, 22869, null], [22869, 25990, null], [25990, 29918, null], [29918, 32672, null], [32672, 35353, null], [35353, 37269, null], [37269, 37269, null], [37269, 37269, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 37269, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 37269, null]], "pdf_page_numbers": [[0, 1485, 1], [1485, 3697, 2], [3697, 6582, 3], [6582, 9327, 4], [9327, 11785, 5], [11785, 14193, 6], [14193, 17105, 7], [17105, 19754, 8], [19754, 22869, 9], [22869, 25990, 10], [25990, 29918, 11], [29918, 32672, 12], [32672, 35353, 13], [35353, 37269, 14], [37269, 37269, 15], [37269, 37269, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 37269, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
0531199cb57ac90484e058cde4a9e3655d737bc4
|
[REMOVED]
|
{"Source-Url": "https://du1ux2871uqvu.cloudfront.net/sites/default/files/file/TR-KSU-CS-2008-04.pdf", "len_cl100k_base": 14191, "olmocr-version": "0.1.53", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 71672, "total-output-tokens": 17609, "length": "2e13", "weborganizer": {"__label__adult": 0.00034928321838378906, "__label__art_design": 0.0004191398620605469, "__label__crime_law": 0.0004544258117675781, "__label__education_jobs": 0.0014286041259765625, "__label__entertainment": 0.00018596649169921875, "__label__fashion_beauty": 0.0002191066741943359, "__label__finance_business": 0.00057220458984375, "__label__food_dining": 0.0004715919494628906, "__label__games": 0.0013132095336914062, "__label__hardware": 0.0020313262939453125, "__label__health": 0.000926494598388672, "__label__history": 0.0005173683166503906, "__label__home_hobbies": 0.00017726421356201172, "__label__industrial": 0.0005936622619628906, "__label__literature": 0.0006260871887207031, "__label__politics": 0.000385284423828125, "__label__religion": 0.0005717277526855469, "__label__science_tech": 0.40673828125, "__label__social_life": 0.00013816356658935547, "__label__software": 0.020477294921875, "__label__software_dev": 0.56005859375, "__label__sports_fitness": 0.0003559589385986328, "__label__transportation": 0.0007061958312988281, "__label__travel": 0.0002675056457519531}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 61336, 0.02893]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 61336, 0.48757]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 61336, 0.85966]], "google_gemma-3-12b-it_contains_pii": [[0, 921, false], [921, 5392, null], [5392, 9688, null], [9688, 13430, null], [13430, 17337, null], [17337, 20924, null], [20924, 23937, null], [23937, 26342, null], [26342, 31094, null], [31094, 34800, null], [34800, 39345, null], [39345, 43922, null], [43922, 47061, null], [47061, 50221, null], [50221, 53382, null], [53382, 56571, null], [56571, 59474, null], [59474, 61336, null]], "google_gemma-3-12b-it_is_public_document": [[0, 921, true], [921, 5392, null], [5392, 9688, null], [9688, 13430, null], [13430, 17337, null], [17337, 20924, null], [20924, 23937, null], [23937, 26342, null], [26342, 31094, null], [31094, 34800, null], [34800, 39345, null], [39345, 43922, null], [43922, 47061, null], [47061, 50221, null], [50221, 53382, null], [53382, 56571, null], [56571, 59474, null], [59474, 61336, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 61336, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 61336, null]], "pdf_page_numbers": [[0, 921, 1], [921, 5392, 2], [5392, 9688, 3], [9688, 13430, 4], [13430, 17337, 5], [17337, 20924, 6], [20924, 23937, 7], [23937, 26342, 8], [26342, 31094, 9], [31094, 34800, 10], [34800, 39345, 11], [39345, 43922, 12], [43922, 47061, 13], [47061, 50221, 14], [50221, 53382, 15], [53382, 56571, 16], [56571, 59474, 17], [59474, 61336, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 61336, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
722f411127d8aa3caba7332833cc607a77aca174
|
MANAGING USER RESISTANCE TO OPEN SOURCE MIGRATION
Hee-Woong Kim
Yonsei University, kimhw@yonsei.ac.kr
Follow this and additional works at: http://aisel.aisnet.org/icis2010_submissions
Recommended Citation
http://aisel.aisnet.org/icis2010_submissions/7
This material is brought to you by the International Conference on Information Systems (ICIS) at AIS Electronic Library (AISeL). It has been accepted for inclusion in ICIS 2010 Proceedings by an authorized administrator of AIS Electronic Library (AISeL). For more information, please contact elibrary@aisnet.org.
MANAGING USER RESISTANCE TO OPEN SOURCE MIGRATION
Completed Research Paper
Hee-Woong Kim
Yonsei University
Shinchon 134, Seoul 120-749, Korea
e-mail: kimhw@yonsei.ac.kr
Abstract
A large amount of resources and effort have been devoted to the development of open source software like Linux. The development of Linux as the most well-known open source software with graphical user interface and useful functionalities is expected to result in the high level of Linux adoption by individual users based on the technology adoption model. However, Linux has about one percent of the operating systems market for personal computers. User resistance to switch remains one of the major obstacles in any successful open source migration. Based on the integration of equity implementation model and technology adoption model, this study examines how users form their resistance and the effect of user resistance on the adoption of Linux by individual users for their personal computers. The findings show that the adoption intention is negatively influenced by user resistance to switch. This study discusses the role and effect of user resistance to switch based on the equity implementation model in comparison with the two main determinants of technology adoption. This study contributes toward advancing theoretical understanding of OSS migration and user resistance. The findings also offer OSS community and practitioners suggestion for promoting the use of OSS by individual users.
Keywords: Open source software, user resistance, technology adoption, equity implementation model
Introduction
The emergence of open source software (OSS) with its successful projects such as Linux operating system, Mozilla web browser and Apache web server, and its most prominent advantages such as cost savings, freedom in modification and availability of the source code create a vast interest among academics and practitioners (Ebert, 2008). The development and implementation of OSS becomes one of the most current topics of interest within the academic, business and political environments (Fitzgerald 2006; Hauge et al., 2010).
In the development of OSS, the OSS community and developers have been exerting much effort to produce competitive software against the proprietary software. More developers are motivated to participate in the software development because the OSS project is a good learning opportunity to improve their skills and gain experience. As of February 2009, SourceForge (http://sourceforge.net/), the world’s largest open source development and distribution portal, was hosting over 230,000 registered projects and more than 2 million users.
Linux is arguably the most well-known OSS project. A large amount of resources and effort have been devoted to the development of Linux. Wheeler (2001) estimated the amount of source code in GNU/Linux, using Red Hat Linux 7.1 as a representative GNU/Linux distribution. He found that Red Hat Linux 7.1 contained over 30 million physical source lines of code as of 2001 (Wheeler, 2001). The Debian GNU/Linux is also one of today’s most popular Linux-based distributions. It is intended not only for final users, but also as a basis for other projects. A
study of Debian GNU/Linux found that it totalled about 300 million lines of code as of 2007 (Gonzalez-Barahona et al., 2009). In comparison, Windows 98 contained an approximate 18 million source lines of code. Using the Constructive Cost Model (COCOMO), Red Hat Linux 7.1 is estimated to have required about 8,000 person-years of development time (Wheeler, 2001). According to the study, if all this software had been developed by conventional proprietary means, it would have cost over US$1 billion for the development in the United States (Wheeler, 2001).
As the development of OSS like Linux is growing in general, its adoption by companies and users in industry has increased (Ebert, 2008). However, the adoption and usage by individual users for their personal computers are still limited. There are several consideration factors in deciding the adoption of OSS (Ven et al., 2008). Those consideration factors can be understood as benefits (e.g., cost advantage and availability of source code) or costs (e.g., switching costs and lack of support) in the adoption. However, critics consider the features and functionality offered by the two operating systems (i.e., Linux and Microsoft Windows) to be comparable and some have even declared Linux better in areas such as customizability, reliability, and security (Wheeler, 2007). According to Market Share by Net Applications, the operating system market share for December 2009 indicated that Linux had 1.02 percent of the market and Microsoft Windows had a total of 92.21 percent.
This creates the interest of study – why does some OSS like Linux have a low level of individual usage though Linux has achieved a significant success due to the relatively comparable with Microsoft Windows in the perspective of performance, usability, reliability and functionality. Despite the huge development cost and effort of Linux, mentioned in the development of OSS, Microsoft Windows is still dominating the market share. Though the statistics show that the usage of OSS is growing, the growth rate is slow and the individual usage level is relatively much lower than the commercial software.
Linux is one of the successful OSS developments. It has been being developed with many useful functions for users. The development of graphical user interface makes Linux easy to use and user-friendly (e.g., KDE, GNOME, and Xfce). Therefore, it is expected that individual users should adopt Linux based on the two determinants of Technology Acceptance Model (TAM) – perceived usefulness and perceived ease of use (Davis, 1898). However, there are many people who still do not adopt and use the useful and easy to use Linux as their operating system in their personal computers. Moreover, although there is no doubt that users are quite comfortable with Linux servers due to the reliability, security and licensing benefits, but getting it on the desktop is going to be difficult (Express Computer, 2007). Hence, this cannot be explained by TAM alone, and we have to observe the factors that make the users difficult to adopt and use Linux on their personal computer.
One of the most viable causes is that most people are currently using an operating system which could be other than Linux. According to the market statistics, Microsoft windows family counts for nearly 90 percent of the operating system usage. That could be due to the Microsoft’s business strategy – bundling up the operating system with the personal computer, and it dominates the operating system market. It is arguably true that 90 percent of computer users have already adopted the Microsoft Windows. Therefore, Linux adoption involves switching from the current operating system to the new operating system. Adoption of a specific technology is often accompanied by the discontinuance of an existing technology that is already in place (Desouza et al., 2006). In this case, adoption introduces the discontinuous use of a current system. On the other hand, the system providers hold on to their consumers, and prevent existing consumers from abandoning their products and services, and even prevent them from switching to competitors. As a result, if the users resist switching, they may not adopt Linux regardless of the usefulness and ease of use related to Linux. It is thus noted that one of the major obstacles to OSS migration is user resistance. Therefore, it is imperative to consider the effect of user resistance while studying the adoption of useful and easy to use OSS, especially Linux for personal users.
Therefore, by selecting Linux as a representative OSS, this study aims to investigate the adoption of OSS (i.e., migration from the current system to OSS) by individual users from the user resistance perspective. To examine the development and effect of user resistance to switch (i.e., OSS migration), this study adopts equity implementation model (EIM) (Joshi, 1991) which was proposed to explain user resistance in IS implementation. The present study selects EIM as the theoretical foundation because EIM explains individuals decide their resistance based the net equity which is determined based on the comparison between benefits and costs. Because OSS adoption brings in
---
several benefits as well as costs (Ven et al., 2008), it is essential to consider both benefits and costs in the migration to OSS. By integrating TAM and EIM, this study examines (1) how users decide their resistance in the migration to OSS and (2) how users decide the adoption of OSS based on user resistance and the two determinants of TAM. The theoretical model in this study is validated through a survey of personal computer users. The contributions of this study include advancing theoretical understanding of technology adoption by adding a new perspective, user resistance, and offering practitioners and organizations for managing user resistance to open source migration and promoting the use of OSS.
This paper is organized as follows: The next section reviews the literature on user resistance and discusses EIM. This is followed by the research model and hypotheses based on the integration between two theoretical models, EIM and TAM. We then describe the research methodology. After interpreting the empirical results, we discuss the theoretical and practical implications and conclude with a summary of this study.
Conceptual Background
User Resistance
Previous research on user resistance has been studied in various fields. In psychology studies, the researches (Oreg, 2003) attribute the individual traits and attitude such as optimism, psychological resilience to the factors that affect the formation and extent of resistance. In management studies, change generally means organizational changes, and resistance commonly has been conceptualized as conduct that seeks to keep the status quo (Pardo del Val and Fuentes, 2003). Piderit (2000) suggested an attitudinal conceptualization of resistance in terms of cognitive, emotional, and intentional dimensions. In marketing studies, resistance is viewed as customer commitment as an attitude (Crosby and Taylor, 1983).
In the literature of information systems (IS) and information technology (IT), user resistance has been conceptualized in the two perspectives: behaviourally and attitudinally. The concept of resistance is adapted from psychology, management and marketing studies in most of the researches. It was behaviourally defined as an adverse reaction (Hirschheim and Newman, 1988) or the opposed intention of users to proposed changes resulting from IS implementation or use of system (Kim and Kankanhalli, 2009; Markus, 1983). By conceptualizing that resistance is manifested by behaviour, Fereneley and Sobrepererez (2006) further classified resistance into opposition (e.g., challenge or disruption to initiatives), negative resistance (e.g., sabotage) and positive resistance (e.g., support or improve). Apart from the behavioural perspective, user resistance also has been conceptualized from the attitudinal perspective. Newman and Noble (1990) interpreted the users’ attitude due to merely entrenched habit or dislike as resistance attitude towards any forms of change in an IS implementation. Similarly, resistance has been considered as a cognitive force precluding potential behaviour (Bhattacherjee and Hikmet, 2007).
In the present study, user resistance is conceptualized as the individual’s attitude towards the change, i.e., the user is resistant to switch from his current situation (e.g., use of current operating system) to a new situation (e.g., use of Linux). This study thus defines user resistance as oppositional attitude towards the change (i.e., OSS migration). We adopt EIM to explain user resistance as the theoretical background.
It is important to distinguish the phenomenon of user resistance from user adoption to justify why it needs to be studied separately. User resistance and user adoption are not simply the reverse of each other. User adoption has been defined as an individual’s initial decision to use a system (Agarwal, 2000), intention to use, or system usage (Davis, 1989) with alternative conceptualizations that include sustained use and even emergent use (Saga and Zmud, 1994). In contrast, user resistance refers to the opposition of individuals to the changes associated with a new system adoption (Bhattacherjee and Hikmet, 2007; Kim and Kankanhalli, 2009). This points to the first difference i.e., user resistance not only targets the system but more importantly occurs in response to the multifarious changes associated with it. On the other hand, IS acceptance tends to occur more in response to the characteristics of the system (Rogers, 1995; Davis, 1989) and its job outcomes (Davis, 1989). As a result, negative change factors (e.g., switching costs) may lead to user resistance but their absence (i.e., no switching costs) may not lead to user acceptance of technology.
Second, user resistance can come into play even before the deployment of a system, whereas the issue of acceptance arises after the IS is ready or has been deployed. Accordingly, most user acceptance research has modeled the concept and collected data after the IS implementation (e.g., Davis, 1989; Nah et al., 2004; Venkatesh et al., 2003;
Wixom and Todd, 2005). Users typically decide to accept a technology after experiencing its characteristics (Davis, 1989; Venkatesh et al., 2003), though they may be influenced by others to try it out. However, user resistance can occur before the system is ready (i.e., during the IS project) or after. In the first case, user resistance can result in project delays and overspending (Verton, 2002). In the second situation, consequences could be low usage (Barker and Frolick, 2003) or even refusal to use the system (Kim and Pan, 2006). In a certain sense, user resistance can be considered as the reverse of user acceptance (system usage) after the system has been implemented, though the absence of factors that cause user resistance do not necessarily cause user acceptance. Also, user resistance can include behaviors such as sabotage, which do not fall within the continuum of system usage (from none or low to high). Accordingly, it is important to study user resistance as a distinct phenomenon. Previous research (Bhattacherjee and Hikmet, 2007) also mentioned that “IT usage and resistance must be examined jointly within a common theoretical model because user resistance is clearly a barrier to IT usage in organization.” User resistance is thus not the mirror opposite of user adoption, but a possible antecedent to IT adoption (Bhattacherjee and Hikmet, 2007).
**Equity Implementation Model**
For the theoretical explanation of user resistance, the present study selects EIM which provides a theory-based understanding of IS users’ resistance to change (Joshi, 1991). In this study, we examine the attitudinal perspective of user resistance when the users have to switch from the system they are currently using to a new system, an OSS. The users may evaluate the inputs and outcomes based on the changes (i.e., OSS migration) of their system, and they may resist the changes or switching from their current system. EIM evaluated the net equity by comparing the changes in outcomes and changes in inputs, and the positive or negative net equity influences the resistance to switch (see Figure 1). EIM describes a process of comparison which is absent in TAM. Therefore, we believe that EIM helps us understand the user resistance attitude in OSS migration, which the users will have from the changes (i.e., switching operating systems).
According to EIM, users evaluate the change related to a new system based on the net equity. The net change in equity status is estimated based on the comparison between changes in benefits (i.e., outcomes) and changes in costs (i.e., inputs). If the net equity due to the change is negative, users would view the change as unfavourable and be resistant to the change. Conversely, if the perception of the net equity due to the change is positive, users would be favourably inclined towards the change. Joshi (1991) operationally defined net equity as following: Net equity = ΔOutcomes - ΔInputs = (Increase in outcomes – Decrease in outcomes) – (Increase in inputs – Decrease in inputs) = (Increase in outcomes + Decrease in inputs) – (Increase in inputs + Decrease in outcomes). The combination of increase in outcomes (e.g., higher productivity resulting from the system use) and decrease in inputs (e.g., less effort in using the system) means benefits in the switching (i.e., switching benefits). The combination of increase in inputs (e.g., more efforts in using the system) and decrease in outcomes (e.g., lower productivity or efficiency resulting from the system use) mean costs in the switching (i.e., switching costs). Similar to the benefits and costs in switching, Ven et al. (2008) discussed the advantages and disadvantages of OSS that organizations need to consider before adopting it. There are several advantages such as free of charge, lower hardware costs, course code
availability, and maturity of OSS. There are also disadvantages such as unclear total cost of ownership, lack of knowledge, unreliability of OSS, and lack of support.
In this study, at the individual level, the users may have to switch from their current system in order to adopt the new system, OSS, and switching the systems serves as a change for the users. Hence, there may be a case of user resistance due to the switching (i.e., user resistance to OSS migration). As per EIM, there is no fundamental or irrational resistance to a switch. Thus, the users may evaluate the switching related to the new system, OSS, based on the net equity perceived by them. The net equity is perceived or assessed by comparing the additional benefits gained relative to the new system (i.e., switching benefits) and additional costs incurred from switching (i.e., switching costs). There are different types of costs related to the switching such as procedural costs (i.e., the expenditure of time, effort, and economic resources incurred in switching operating systems), psychological costs (i.e., psychological or emotional discomfort due to the switching of operating systems), and loss costs (i.e., losses due to investments already made in the current operating system) (Burnham et al. 2003; Jones et al. 2002; Whitten and Wakefield 2006).
As a corresponding factor to net equity, we select value which has been conceptualized as the net benefits based on the comparison between benefits and costs (Zeithaml, 1988). Based on EIM, this study thus explains that user resistance to switch would be influenced by value which is perceived based on the comparison between switching benefits and switching costs.
**Research Model and Hypotheses**
Based on the integration of EIM and TAM, we develop the research model (see Figure 2). EIM explains how users become resistant to OSS migration which in turn would reduce the OSS adoption intention. TAM explains that people decide to adopt technology based on the perception of usefulness and ease of use. TAM and EIM thus complement each other in explaining OSS migration and adoption. Because TAM and its two determinants (usefulness and ease of use) are well tested, this study proposes the two factors as control variables without hypothesis proposition.
User resistance to switch refers to opposition of an individual to the use of a new system (Hirschheim and Newman, 1988; Kim and Kankanhalli 2009; Markus, 1983). In our study, the switch refers to the migration from the current operating system to a new operating system (i.e., Linux), and we conceptualize the individual’s attitude on such switching in terms of user resistance. Therefore, user resistance to switch is defined as the individual’s oppositional attitude towards the use of new system (i.e., OSS). Attitude is defined as an individual’s positive or negative tendency or orientation toward performing the target behaviour (Ajzen, 1991). Most previous research on technology adoption (e.g., Taylor and Todd, 1991; Wixom and Todd, 2005) has examined the effect of positive attitude on the adoption. Venkatesh et al. (2003), however, argued against the role of positive attitude as an affective reaction in explaining and predicting adoption intention. In contrast, user resistance is conceptualized as a negative attitude which will affect the adoption intention negatively according to the theory of planned behaviour (TPB). In the perspective of TAM alone, the users may adopt the new system based on perceived usefulness and perceived ease of use related to the new system. When the users are resistant to the switch, however, they may not easily decide to adopt the system even with the usefulness and ease of use of the target system. Thus, user resistance may decrease the adoption intention in the context of OSS (i.e., Linux) migration from the current operating system. Hence, we hypothesize,
**H1: User resistance has a negative effect on adoption intention.**
As a corresponding factor to net equity in EIM, perceived value means the perceived net benefits (perceived benefits relative to perceived costs) of switching to a new system (i.e., OSS migration) (Kim and Kankanhalli, 2009). According to the EIM, the users’ judgments of the switching affect their resistance attitude. Further, perceived value evaluates whether the benefits derived from the switch are worth the costs incurred in switching from the current situation (status quo) to the new situation. If the net change in the equity status proves to be positive, the switch will be welcomed. However, if the net change in the equity status is negative, switching to the new system will be resisted (Joshi, 1991). Therefore, if the perceived value from switching is high (perceived benefits are more than perceived costs), users are likely to have lower resistance to switch. Conversely, if the perceived value is low (perceived benefits are less than perceived costs), users are likely to have greater resistance to OSS migration. Moreover, people have a strong tendency to maximize value in their decision making and consequently are less likely to resist changes that deliver a higher perceived value (Joshi, 1991). Hence, we hypothesize,
**H2: Perceived value has a negative effect on user resistance.**
The benefits from the switch (i.e., OSS migration) have been conceptualized as the benefits or advantages people perceived from the switch (Moore and Benbasat, 1991). In our study, switching benefits refers to the perceived additional utility a user would enjoy in switching from the current system to the new system (Kim and Kankanhalli 2009). Perceived value is assessed as the overall evaluation of the net benefits of switch based on the comparison between switching benefits and costs (Kahneman and Tversky, 1979). According to the EIM, the change in equity status is positively affected by the changes in benefits (Joshi, 1991). As per the rational decision-making principles, higher switching benefits would increase the net benefits or perceived value of the change to users because value is accessed based on the benefits relative to the costs of change (Joshi, 1991; Zeithaml, 1988). Therefore, the values will be increased when the switching benefits are higher and the switching costs are lower. Hence, we hypothesize,
**H3: Switching benefits have a positive effect on perceived value.**
Following the previous research, switching costs represent the psychological costs such as uncertainty costs and emotional costs (Whitten and Wakefield, 2006), one-time costs in the process of switching such as set up costs and learning costs (i.e., procedural costs) (Burnham et al., 2003) and loss costs such as lost benefit costs and sunk costs (Jones et al., 2002). In our study, switching costs are defined as the perceived disutility a user would incur in switching from the current system to a new system (Chen and Hitt, 2002). As we have mentioned, perceived value is assessed as the overall evaluation of the net benefits of switch based on the comparison between switching benefits and costs (Kahneman and Tversky, 1979). According to the EIM, the change in equity status is negatively affected by the changes in costs (Joshi, 1991). As per the rational decision-making principles, higher switching costs in any forms would lower the net benefits or perceived value of the switch to users because value is accessed based on the benefits relative to the costs of change (Joshi, 1991; Zeithaml, 1988). Therefore, the values will be decreased when the changes in benefits are lower and the changes in costs are higher. Hence, we hypothesize,
**H4: Switching costs have a negative effect on perceived value.**
Apart from the indirect effects of switching benefits and switching costs on user resistance to switch through perceived value, we also expect the direct effects of them on user resistance. The switching benefits and switching
Cots are conceptualized as beliefs according to TPB which adopts from theory of reasoned action (TRA). Based on TRA, a person’s attitude toward behavior is determined by his or her salient beliefs (Davis et al., 1989). Therefore, users’ beliefs in gaining additional benefits from switching (i.e., OSS migration) will affect their attitude towards the switch. In other words, switching benefit (i.e., users’ beliefs) has influence on user resistance to switch (i.e., attitude towards the switch). The potential advantages (i.e., benefits) of switching from the current system to a new system provide users with the motivation to switch. In contrast, if the new system provides fewer switching benefits, users are more likely to resist switch from their current system (Martinko et al., 1996). Higher switching benefits may thus reduce user resistance to switch. Hence, we hypothesize,
**H5: Switching benefits have a negative effect on user resistance.**
Additionally, switching costs may directly influence user resistance to switch. Switching costs refer to any perceived disutility (Chen and Hitt, 2002) a user would experience from switching to a new alternative. Based on TRA, a person’s attitude toward behavior is determined by his or her salient beliefs (Davis et al., 1989). Therefore, users’ beliefs in incurring costs from the switch will affect their attitude towards the switch. Switching costs can be the psychological costs, procedural costs and loss costs which are conceptualized as the perceived disutility. These switching costs will inhibit the users to switch, OSS migration, because they generate disutility which is not welcomed by the user. Due to the disutility, people do not want to switch to the new system (Chen and Hitt, 2002). Therefore, higher switching costs would increase user resistance to switch. Hence, we hypothesize,
**H6: Switching costs have a positive effect on user resistance.**
**Research Methodology**
Data to empirically validate the research model of Figure 2 were collected through a field survey using a questionnaire.
**Instrument Development**
The survey instrument was developed based on the research model by adapting existing validated scales where possible. To measure adoption intention, we follow the scale guidelines of the Theory of Reasoned Action and ensure that the questions are specific and consistent with respect to action (adoption), target (Linux), context (individual purpose) and time (within the next six months). The three items of adoption intention were then adapted from Karahanna et al. (1999). The measurement items for user resistance were modified from Pritchard et al. (1999) to fit in the context of switching to a new system. Scales for perceived value were modified from the value construct of Sirdeshmukh et al. (2002) to the context of OSS migration. The items represent procedural aspect (PVL1), loss aspect (PVL2), and psychological aspect (PVL3) in the net benefit assessment. We developed the measurement items for switching benefits based on the definition and by referring to the items of relative advantage (Moore and Benbasat, 1991). Switching costs were conceptualized as a single-dimensional construct, with scales adapted from Jones et al. (2000) to reflect procedural costs (SWC2), psychological costs (SWC3), and loss costs (SWC1 and SWC4). Scales for perceived usefulness and perceived ease of use were adapted from Davis et al. (1989).
All items were phrased with respect to Linux under study. Three IS researchers reviewed the instrument for its face validity. The measurement items were anchored on seven-point Likert scales (1 = strongly disagree, 7 = strongly agree). The final version of the measurement items are presented in Table 1.
Data Collection
We considered the population of interest to be composed of computer users. The database of a market research firm was used to draw up a sample frame of panel members 19 years of age or older. The market research firm randomly selected members from a panel pool and sent each member an email invitation to participate in the survey and included a link to a Web-based survey questionnaire. The online survey was conducted for one week. A total of 216 responses were collected. The valid respondents should own personal computer or laptop computer. They should not use Linux as the current operating system in their computers but should have some ideas about Linux. Among 216 responses, we dropped 18 invalid responses because 8 of the respondents do not have the authority to change their operating system and 10 of the respondents are completely unfamiliar with Linux.
Table 2 describes the descriptive statistics of 198 valid respondents. The majority of respondents were male (75.1%) with an average age of 34.2 years (s.d. = 8.6), and an average usage experience of their current operating system of 3.4 years (s.d. = 2.2). All the subjects own a computer, and they have at least 2-year experience in using their current operating system. The average familiarity level of Linux (3.6, completely unfamiliar (1) to completely familiar (7)) shows that they know Linux as an alternative operating system.
<table>
<thead>
<tr>
<th>Demographic variable</th>
<th>Frequency</th>
<th>Percentage</th>
</tr>
</thead>
<tbody>
<tr>
<td>Gender</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Male</td>
<td>151</td>
<td>75.1</td>
</tr>
<tr>
<td>Female</td>
<td>50</td>
<td>24.9</td>
</tr>
<tr>
<td>Age (years) [mean = 34.2, s.d. = 8.6]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>19-29</td>
<td>73</td>
<td>36.9</td>
</tr>
<tr>
<td>30-39</td>
<td>102</td>
<td>51.5</td>
</tr>
<tr>
<td>40 – above</td>
<td>23</td>
<td>11.6</td>
</tr>
<tr>
<td>Profession</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Student</td>
<td>52</td>
<td>26.3</td>
</tr>
<tr>
<td>Professional</td>
<td>141</td>
<td>71.2</td>
</tr>
<tr>
<td>Others</td>
<td>5</td>
<td>2.5</td>
</tr>
<tr>
<td>Total</td>
<td>198</td>
<td>100.0</td>
</tr>
</tbody>
</table>
### Table 2. Descriptive Statistics of Respondents
**Data Analysis and Results**
**Instrument Validation**
To validate the survey instrument, we assessed its convergent and discriminant validity. We first performed confirmatory factor analysis (CFA) using LISREL. Convergent validity can be established using three criteria. First, the standardized path loading must be statistically significant and greater than 0.7 (Gefen et al., 2000). Second, the composite reliability (CR) and the Cronbach’s $\alpha$ for each construct must be larger than 0.7 (Nunnally, 1978). Third, the average variance extracted (AVE) for each construct must exceed 0.5 (Fornell and Larcker, 1981).
The standardized path loadings were all significant and greater than 0.7 except RST1. The CR and the Cronbach’s alpha for all constructs exceed 0.7. The AVE for each construct was greater than 0.5. The convergent validity was thus supported (see Table 3).
<table>
<thead>
<tr>
<th>Construct</th>
<th>Item</th>
<th>Std. Loading</th>
<th>AVE</th>
<th>CR</th>
<th>$\alpha$</th>
</tr>
</thead>
<tbody>
<tr>
<td>Adoption intention (INT)</td>
<td>INT1</td>
<td>0.80</td>
<td>0.71</td>
<td>0.88</td>
<td>0.90</td>
</tr>
<tr>
<td></td>
<td>INT2</td>
<td>0.88</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>INT3</td>
<td>0.85</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>User resistance (RST)</td>
<td>RST1</td>
<td>0.69</td>
<td>0.65</td>
<td>0.85</td>
<td>0.80</td>
</tr>
<tr>
<td></td>
<td>RST2</td>
<td>0.79</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>RST3</td>
<td>0.92</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Perceived value (PVL)</td>
<td>PVL1</td>
<td>0.72</td>
<td>0.73</td>
<td>0.91</td>
<td>0.90</td>
</tr>
<tr>
<td></td>
<td>PVL2</td>
<td>0.85</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>PVL3</td>
<td>0.92</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>PVL4</td>
<td>0.91</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Switching benefits (SWB)</td>
<td>SWB1</td>
<td>0.70</td>
<td>0.69</td>
<td>0.90</td>
<td>0.88</td>
</tr>
<tr>
<td></td>
<td>SWB2</td>
<td>0.85</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>SWB3</td>
<td>0.86</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Discriminant validity of the measurement model is assessed by comparing the square root of AVE for each construct with the correlations between that construct and other constructs. Discriminant validity is established if the square root of AVE for a given construct is greater than the correlations between that construct and other constructs (Fornell and Larcker, 1981). The square root of AVE for each construct (diagonal term) exceeded the correlations between the construct and other constructs (off-diagonal terms) (See Table 4).
As one of the correlation terms in the table was greater than the prescribed threshold of 0.6 (Carlson et al., 2000), we conducted a second test of discriminant validity using a process of constrained CFA as suggested by Anderson and Gerbing (1988). From the results of this test, all $\chi^2$ statistics were found significant indicating that the measurement model was significantly better than other alternative models (obtained by combining pairs of latent constructs). Hence, discriminant validity of the instrument was established.
We further tested our data for common method variance using the Harman’s single-factor test following the guidance of previous research (Podsakoff et al., 2003). Harman’s single-factor test involves an exploratory factor analysis (EFA) of all items to determine whether the majority of the variance is accounted for by one general factor. The test showed that the first factor accounts for 39.83 percent of the total variance. We further carried out principal component analysis using varimax rotation, which revealed that each of seven principal components explained almost an equal amount of the 75.96 percent of total variance, ranging from 8.65 percent to 13.14 percent. Results of the test indicate that our data do not suffer from common method variance.
### Table 4. Correlations between Constructs
<table>
<thead>
<tr>
<th></th>
<th>INT</th>
<th>S.D.</th>
<th>INT</th>
<th>RST</th>
<th>PVL</th>
<th>SWC</th>
<th>SWB</th>
<th>EOU</th>
<th>USF</th>
</tr>
</thead>
<tbody>
<tr>
<td>INT</td>
<td>3.31</td>
<td>1.66</td>
<td>0.84</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>RST</td>
<td>4.49</td>
<td>1.21</td>
<td>-0.50</td>
<td>0.81</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>PVL</td>
<td>3.62</td>
<td>1.15</td>
<td>0.63</td>
<td>-0.59</td>
<td>0.85</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>SWC</td>
<td>4.65</td>
<td>1.12</td>
<td>-0.24</td>
<td>0.29</td>
<td>-0.32</td>
<td>0.89</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>SWB</td>
<td>3.49</td>
<td>1.14</td>
<td>0.51</td>
<td>-0.47</td>
<td>0.60</td>
<td>-0.22</td>
<td>0.83</td>
<td></td>
<td></td>
</tr>
<tr>
<td>EOU</td>
<td>3.99</td>
<td>1.11</td>
<td>0.43</td>
<td>-0.38</td>
<td>0.42</td>
<td>-0.28</td>
<td>0.33</td>
<td>0.82</td>
<td></td>
</tr>
<tr>
<td>USF</td>
<td>3.96</td>
<td>1.10</td>
<td>0.46</td>
<td>-0.36</td>
<td>0.50</td>
<td>-0.27</td>
<td>0.61</td>
<td>0.61</td>
<td>0.84</td>
</tr>
</tbody>
</table>
Note: Leading diagonal shows the squared root of AVE of each construct
### Hypotheses Testing
We examined the structural model using LISREL. We applied the following indices and standards to assess model fit (Gefen et al., 2000): normed $\chi^2$ ($\chi^2$ to degree of freedom) lower than 3, root mean square of approximation (RMSEA) lower than 0.08, goodness-of-fit index (GFI), comparative fit index (CFI), and normed fit index (NFI) greater than 0.9, and adjusted goodness-of-fit index (AGFI) greater than 0.8.
The results of testing the structural model are shown in Figure 3. The structural model satisfied the threshold for all indices except GFI (0.87), which is close to the threshold: Normed $X^2 = 1.66$, RMSEA = 0.051, GFI = 0.87, AGFI = 0.83, CFI = 0.98, NFI = 0.95. The structural model thus appears to adequately fit the data.
The results indicate that user resistance (H1) together with perceived usefulness had significant effects on the adoption intention, explaining 52 percent of its variance. Perceived value (H2), switching benefits (H5) and switching costs (H6) had significant effects on user resistance, explaining 56 percent of its variance. Switching benefits (H3) and switching costs (H4) had significant effects on perceived value, explaining 53 percent of its variance. However, we could find a significant relationship between perceived ease of use and adoption intention. We additionally included three control variables (gender, age, profession) as alternative predictors of adoption intention. None of these variables had a significant effect on adoption intention.

**Discussion and Implications**
**Discussion of Findings**
There are several salient findings from this study. The first finding is that user resistance to switch has a significant negative impact on user adoption intention in the context of Linux migration. It supports the TPB where the individual's intention is determined by the attitude toward the behaviour (Ajzen, 1991). Our study extends this idea by conceptualizing user resistance as negative attitude towards the migration to Linux from the current operating system. This study also supports the ideas of having two characteristics in OSS (i.e., Linux) migration such as adopting a new system and discarding the current system. Most users have already adopted and used a proprietary system (e.g., Microsoft Windows) in their personal computers. In order to adopt Linux which is alternative of their current system, they have to discontinue the existing system. Therefore, the users can be resistant to OSS migration and discarding the current system, which then affects adoption intention.
The second finding is that perceived value has a significant negative impact on user resistance to switch. In addition, switching benefits increase perceived value while switching costs reduce perceived value, which is consistent with the EIM (Joshi, 1991) and previous research (Kim and Kankanhalli, 2009). If users perceive overall loss in net equity (greater switching costs than switching benefits) which means low perceived value, they develop the oppositional attitude and become averse to switch to the new system. It also supports the arguments of previous
research (Joshi, 1991; Joshi and Lauer, 1999) that changes delivering high perceived value are less likely to be resisted than those with low perceived value.
The third finding is that switching costs and switching benefits have direct impacts on user resistance to switch. The direct effect of switching costs parallels prior research (Kim and Kankanhalli 2009) that has argued that switching costs create resistance to switch. Moreover, the direct influence of switching benefits to user resistance to switch is consistent with the previous research (Martinko et al., 1996) which explained that the individuals’ beliefs on the positive outcomes or switching benefits regarding the new system reduce user resistance.
The fourth finding is that perceived usefulness has a significant impact on user adoption intention while perceived ease of use has not, which is in conflict with TAM (Davis, 1989). One possible reason is that users may put the usefulness of a system in the higher priority than its ease of use when they are deciding to adopt the system. In our study, users may find usefulness of Linux is more important than its ease of use in deciding the adoption of it. Another possible reason is that most respondents have used computers for very long time and so their computer skills are high. There are no special features which make Linux difficult to use compared to other operating systems. They may not perceive difficulties in using Linux. Hence, ease of use could be of less concern for them in deciding the OSS migration.
**Limitations and Future Research**
The results of this study should be interpreted in the context of its limitation. This study selected Linux as a representative of OSS and tested the research model based on the data collection from computer users. Especially, we focused on the use of Linux by individual users for their personal computers. We should note that many corporate users have used Linux as an operating system in their products such as server system and mobile devices. In contrast, Linux has only about one percent of the individual operating system market. Future research needs to check other types of OSS at different levels (i.e., individual level or organization level). While Linux migration requires switching from the current operating system to Linux, other types of OSS do not require such switching. Depending on the type of OSS, the theoretical research model should be redeveloped.
This research also suggests and opens a number of future research opportunities. First, the user resistance to OSS migration could be influenced by other factors besides the factors proposed in EIM. Further research could extend the model to study the factors that have influence on user resistance to switch and their direct effects on OSS migration intention. Second, further research could study in depth about the classification of switching costs which is a relevant and important concept in OSS migration. The study of switching costs might create a rich research potential on this topic. Next, further research could investigate the demands of the users regarding OSS and the factors that would increase the benefits of using OSS.
**Implications for Research**
This research offers several implications for research. First, this study has examined the relationship between user acceptance and user resistance and how they are different and linked. TAM explains that users decide the adoption of technology based on the perception of the target technology (i.e., OSS). In contrast, user resistance to OSS migration based on the EIM explains that users decide the resistance based on the overall evaluation and benefits and costs related to the switching (i.e., migration from the current system to a new system). This study has also conceptualized user resistance to switch as attitude and explained the relationship between user resistance and adoption based on the attitude-behaviour link of TPB.
Another theoretical implication is the development of the user resistance model based on the EIM to understand the reasons of resistance. Few theoretical foundations with empirical validation exist in the literature for explaining the user resistance. EIM (Joshi, 1991) provides an explanation about the role of net equity in causing user resistance and some examples of inputs and outcomes, but it does not examine the assessment of net equity based on the increase and decrease in outcomes and inputs, and has not been tested in the context of OSS. This study developed and tested a theoretical model to explain appraisal of switching to a new system through survey methodology.
---
3 What’s a desktop environment? Linux.com, Available at http://www.linux.com/whatislinux/114379
The present study adds to previous research on user resistance, especially Bhattacherjee and Hikmet (2007) and Kim and Kankanhalli (200). Bhattacherjee and Hitmet (2007) examined the relationship between resistance to change and intention to use healthcare information technology. They conceptualized resistance to change as a generalized opposition to change engendered by the expected adverse consequences of change. They have a contribution in finding the negative relationship between resistance to change and intention to use. However, they have a limitation in explaining the antecedents of resistance to change. They examined perceived threat as the main antecedent of resistance to change following the argument of previous conceptual research (Krovi, 1993; Lapointe and Rivard, 2005; Markus, 1983). In contrast, the present study has derived and empirically tested a theoretically grounded model to understand how OSS migration is evaluated for user resistance to occur. Especially, our study has shown that user resistance is influenced by not only threats or costs but also benefits.
Kim and Kankanhalli (2009) examined causes of user resistance based on an integrative framework centered on the theory of planned behaviour. They explained the key role of switching costs in causing user resistance. However, they have considered user resistance in the context of IS implementation, not technology adoption. For this reason, they did not pay attention to the relationship between user resistance and user acceptance. In contrast, the present study has examined the relationship between them.
This study also adds to OSS literature. Especially, there have been many researches on the characterization of OSS and the adoption of OSS (e.g., Fitzgerald 2006). Based on previous research, Hauge et al. (2010) classified ways of OSS adoption and discussed two main areas (i.e., deploying OSS products and using OSS in software development) in which organizations can benefit from OSS. However, there has been no consideration about the two different types of OSS. One requires switching the other one does not require switching. If the target OSS does not require users switch from existing system to it, the two main determinants of TAM will surely explain OSS adoption. However, the two determinants of TAM cannot explain the low market share of Linux as the most well-known OSS in the operating system market for individual users. The second type of OSS like Linux requires users switch from existing system. In this type of OSS, individual users may consider not only the characteristics of OSS and the issues related to the migration. By finding the role and effect of user resistance to OSS migration, the present study thus adds to OSS literature.
**Implications for Practice**
There are also several practical implications. The results of this study suggest OSS community and developers that just developing useful and easy to use OSS is not enough for facilitating the use of OSS. They need to pay attention on how to alleviate user resistance to switch in order to increase the OSS migration. Although the developed OSS like Linux is useful and easy to use, the oppositional attitude of users based on their value assessment of the migration may hinder the switch to the new system. OSS developers and advocates should thus be aware of the critical effect of user resistance on the adoption intention and aim to reduce it by increasing the perceived value.
Developers can attempt to increase the perceived value of switching to reduce user resistance. In evaluating perceived value, users estimate whether or not the cost for switch exceeds the benefits associated with the switch (Joshi, 1991; Zeithaml, 1988). In this study, the switch refers to the switching from current system to the new system, OSS. In order to increase the perceived value, the advantages of the OSS over the proprietary software (i.e., switching benefits) should be emphasized from the viewpoint of the user. Therefore, switching benefits in comparison with the current system need to be stated clearly together with the release of the developed OSS.
Developers can further increase perceived value and reduce user resistance to switch by reducing switching costs. Although the developed OSS is useful and has some benefits, the users may still be resistant due to the higher switching costs (i.e., costs is greater than benefits) (Joshi, 1991). The users can perceive the switching costs in different forms such as psychological cost (Whitten and Wakefield, 2006), procedural costs (Burnham et al., 2003) and loss costs (Jones et al., 2002). Therefore, developers should aim to reduce these switching costs perceived by the users.
Developers should aim to allay the users’ psychological costs by informing them clearly about the further changes in technology and feasible solutions for various anticipated issues which may be encountered by the users. Next, developers can attempt to alleviate procedural costs by providing the comprehensive and effective user guide of the OSS so that the users may find it easy to set up and learn how to use it. Again, developers should also try to eliminate the loss costs by providing them the benefits over their existing system so that they will perceive that it is worth to use the OSS.
Conclusion
This study identifies user resistance to switch as one of the most critical issues in the migration to OSS. Although OSS communities and developers have developed a number of useful and easy to use OSS, the number of individual OSS users for their personal computers is quite low. This is because most of the users have adopted a system and they may have to discontinue their existing system in order to adopt the new system. When the users need to discontinue and switch from the current system to the new system, they may resist switching in their adoption of the new system. The discontinuous and switching from the current system to the new system may cause the users to develop and have the resistant attitude. Therefore, the OSS developers should not just focus on the development of useful, easy to use and successful OSS, and they should also pay much attention on how to alleviate the user resistance in promoting the OSS migration.
Going beyond previous research, this study develops a model for user resistance based on equity implementation model (Joshi, 1991). This study also highlights the significance of perceived value, switching costs and switching benefits as key determinants of user resistance to switch based on the EIM. This study further shows that user resistance has a negative effect on user adoption intention. As such, this research provides the theoretical understanding of how users evaluate the OSS migration and how user resistance is formed. The findings from the research also offer the OSS communities and developers suggestions for minimizing user resistance to switch, thereby increasing the adoption of OSS. It also provides the practitioners methods to lower people’s resistance when involving the switching and opens a number of further researches in investigating the adoption of OSS, the characteristics of user resistance and its causes and effects.
References
|
{"Source-Url": "https://aisel.aisnet.org/cgi/viewcontent.cgi?referer=&httpsredir=1&article=1005&context=icis2010_submissions", "len_cl100k_base": 11487, "olmocr-version": "0.1.51", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 44354, "total-output-tokens": 14634, "length": "2e13", "weborganizer": {"__label__adult": 0.00047135353088378906, "__label__art_design": 0.001983642578125, "__label__crime_law": 0.0006189346313476562, "__label__education_jobs": 0.04656982421875, "__label__entertainment": 0.0004494190216064453, "__label__fashion_beauty": 0.000331878662109375, "__label__finance_business": 0.034393310546875, "__label__food_dining": 0.0005125999450683594, "__label__games": 0.0017461776733398438, "__label__hardware": 0.001822471618652344, "__label__health": 0.0014657974243164062, "__label__history": 0.000949382781982422, "__label__home_hobbies": 0.0004639625549316406, "__label__industrial": 0.0007948875427246094, "__label__literature": 0.0016021728515625, "__label__politics": 0.0011310577392578125, "__label__religion": 0.0006442070007324219, "__label__science_tech": 0.246826171875, "__label__social_life": 0.0007123947143554688, "__label__software": 0.257568359375, "__label__software_dev": 0.3974609375, "__label__sports_fitness": 0.00027680397033691406, "__label__transportation": 0.0006871223449707031, "__label__travel": 0.0004246234893798828}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 59828, 0.04863]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 59828, 0.33608]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 59828, 0.92794]], "google_gemma-3-12b-it_contains_pii": [[0, 671, false], [671, 3883, null], [3883, 9355, null], [9355, 14414, null], [14414, 18259, null], [18259, 20555, null], [20555, 26200, null], [26200, 29951, null], [29951, 30836, null], [30836, 34120, null], [34120, 37484, null], [37484, 39899, null], [39899, 44645, null], [44645, 49971, null], [49971, 54573, null], [54573, 59012, null], [59012, 59828, null]], "google_gemma-3-12b-it_is_public_document": [[0, 671, true], [671, 3883, null], [3883, 9355, null], [9355, 14414, null], [14414, 18259, null], [18259, 20555, null], [20555, 26200, null], [26200, 29951, null], [29951, 30836, null], [30836, 34120, null], [34120, 37484, null], [37484, 39899, null], [39899, 44645, null], [44645, 49971, null], [49971, 54573, null], [54573, 59012, null], [59012, 59828, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 59828, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 59828, null]], "pdf_page_numbers": [[0, 671, 1], [671, 3883, 2], [3883, 9355, 3], [9355, 14414, 4], [14414, 18259, 5], [18259, 20555, 6], [20555, 26200, 7], [26200, 29951, 8], [29951, 30836, 9], [30836, 34120, 10], [34120, 37484, 11], [37484, 39899, 12], [39899, 44645, 13], [44645, 49971, 14], [49971, 54573, 15], [54573, 59012, 16], [59012, 59828, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 59828, 0.19388]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
1273f0d79b67ababeb7f8943c4093409a1bc5c8b
|
AN ATTEMPT TO EXAMINE TOKENEER USING BAKAR KIASAN.
by
HARI HARA KUMAR EARLAPATI.
B.TECH, Kakatiya University, INDIA, 2009
A REPORT
Submitted in partial fulfillment of the requirements for the degree
MASTER OF SCIENCE
Department of Computing and Information Sciences.
College of Engineering.
KANSAS STATE UNIVERSITY
Manhattan, Kansas
2011
Approved by:
Major Professor
Dr. John Hatcliff
Abstract
In order to demonstrate that developing highly secure systems to the level of rigor required by the higher assurance levels of the common criteria is possible, the NSA asked Praxis High Integrity Systems to undertake a research project to develop a high integrity variant of part of an existing secure system (the Tokeneer System) in accordance with Praxis’ own high-integrity development process. Their objective is to show the security community that it is possible to develop secure systems rigorously in a cost-effective manner. Hence part of the Tokeneer (ID Station) is redeveloped in Spark programming language and is verified using the Spark proof tools. Bakar Kiasan is a symbolic execution tool for the Spark programming language built in Kansas State University, it can be used for bug finding, test case generation and contract checking. This tool’s proof process does not include the conventional Spark tools like the Examiner, Simplifier and Proof Checker. It mainly allows the programmer to focus entirely on the source code level. The goal of this MS report is to assess the extent to which symbolic execution techniques in Bakar Kiasan can be applied to the Tokeneer example implemented in Spark.
### Table of Contents
List of figures ................................................................................................................................. iv
Acknowledgements .......................................................................................................................... v
1. Introduction ....................................................................................................................................... 1
1.1 Goal: ........................................................................................................................................... 1
1.2 Motivation: ................................................................................................................................. 1
1.3 Challenges: ................................................................................................................................. 2
1.4 Software requirements: .............................................................................................................. 2
2. Tokeneer: ......................................................................................................................................... 3
2.1 Overall Tokeneer System: .......................................................................................................... 3
2.2 System boundaries: .................................................................................................................... 5
2.3 Scenarios: ..................................................................................................................................... 6
3. Formal Specification in Z: .............................................................................................................. 8
4. Introduction to Spark. ..................................................................................................................... 9
4.1 Steps (Life Cycle) in the process of proving the correctness of a Spark program: .............. 13
4.2 External variables: ..................................................................................................................... 17
5. Changes made in existing project to examine using Kiasan: ...................................................... 18
5.1. Flattening the nested Methods: ............................................................................................... 18
5.2. Eliminating Abstraction: ......................................................................................................... 22
5.3 Replacing the Proof functions with normal Spark Executable functions: .......................... 31
5.4. Removing the private child packages: ...................................................................................... 34
6. Summary of changes in the project for examining using Kiasan: ........................................... 37
7. Future Work: .................................................................................................................................. 40
8. References ........................................................................................................................................ 41
List of figures
Figure 1: Tokeneer System ................................................................................................................. 3
Figure 2: System Boundaries .............................................................................................................. 5
Figure 3: Diagram showing the Lifecycle: .......................................................................................... 13
Figure 4 - Specification Before eliminating Abstraction ..................................................................... 26
Figure 5 - Body before eliminating abstraction .................................................................................. 27
Figure 6 - Specification after removing abstraction ............................................................................. 28
Figure 7 - Body after eliminating abstraction ..................................................................................... 29
Acknowledgements
I would like to thank my major professor Dr. John Hatcliff for his constant guidance and help throughout the project. I would also like to thank Dr. Robby and Dr. Mitch Neilsen for graciously accepting to be on my committee. Finally, I wish to thank my family and friends for all their support and encouragement.
1. Introduction
In order to demonstrate that developing highly secure systems to the level of rigor required by the higher assurance levels of the Common Criteria is possible, the NSA asked Praxis High Integrity Systems to undertake a research project to develop a high integrity variant of part of an existing secure system (the Tokeneer System) in accordance with Praxis’ own high-integrity development process. Their objective is to show the security community that it is possible to develop secure systems rigorously in a cost-effective manner.
The development project for this high integrity variant has an objective:
To redevelop part of the software for the Identification Station (ID Station — part of the Tokeneer system) according to Praxis High Integrity System’s formal, high-integrity system development process.
1.1 Goal:
The principle goal of the project is to test to what extent we can examine the IDStation implemented in Spark using the symbolic execution tool Bakar Kiasan.
1.2 Motivation:
The prime motivation for using a tool like Bakar Kiasan to examine the Tokeneer is:
Existing Spark tools like the Examiner, Simplifier and Proof checker uses Verification Conditions (VC) approach for proving the correctness of the Spark programs. Examiner takes the Spark program as input and generates verification conditions; it is the duty of the automated tools like simplifier or proof checker to prove the verification conditions to true or false for checking the Spark programs correctness. The above proof process involves few issues:
1. We need to write the rule files (with extension .rlu) manually in order to prove certain verification conditions (VC). Rule files contain the ‘replacement rules’ that are used by the Spark tools in the process of proving the program correctness.
2. Rule files are written in FDL (Functional Description Language) so we need to learn the FDL syntax and semantics.
3. To understand the proof process thoroughly, we need to study other files that are generated by the examiner (for example: .rls, .vcg, .fdl) and how the simplifier and proof checker are dealing with them. We will discuss about all the intermediate files in detail in next sections.
Considering the above issues we want to explore the Tokeneer using Bakar Kiasan in order to see if it offers any advantages over the VC approach.
1.3 Challenges:
The main challenge was to understand the life cycle of the proof process for a Spark program completely. This involved studying all the intermediate files that are generated by the Examiner, learning the FDL syntax and semantics, understanding the rule files that hold the replacement rules for the proof functions. During the initial days, to understand how the tokeneer is modelled, I had to study basics of the ‘Z’ specifications language. ‘Z’ is used to model the tokeneer at the specifications level.
1.4 Software requirements:
1. Eclipse platform (version 3.6.2 used).
2. Spark.
3. Operating system: Linux/Mac/Windows.
2. Tokeneer:
Tokeneer is a security system that demonstrates the use of smart cards and biometrics for access control. It provides protection to secure information held on a network of workstations situated in a physically secured enclave.
2.1 Overall Tokeneer System:
Figure 1: Tokeneer System
The complete tokeneer system consists of a secure enclave and set of system components, some present inside the enclave and some outside. As it can be seen, ID Station is component of the Tokeneer system and its functionality is to provide user authentication.
There are two system boundaries: one boundary between ID Station machine and its environment, the other boundary between the IDStation core functions and its support functions. The existing ID Station has four connected peripherals and a number of internal drivers and libraries.
The physical devices that are interfaced to ID Station are:
1. Fingerprint reader.
2. Smartcard reader.
3. Door
Individuals enter the secured enclave via ‘door’ by providing the credentials either to ‘fingerprint reader’ or the ‘card reader’. ‘Visual display’ displays the messages that help to track the progress of user entry process into secured enclave.
We will now look at how the ID Station that controls the user access to the enclave is considered for development by the programmers.
Diagram showing System boundaries:
2.2 System boundaries:
Figure 2: System Boundaries
Praxis redeveloped the core functions of the ID Station according to their high-integrity development process. The required behavior of the ID Station is specified using scenarios, which run through typical uses of the ID Station and define the interaction between the ID Station and its connected systems. In each case the scenario focuses on a successful outcome, but it also covers various conditions that may arise that do not allow the successful outcome to be achieved. The full behavior of the system, including both successful and failed outcomes, constitutes the system requirements.
2.3 Scenarios:
1. User gains allowed initial access to Enclave.
2. User is denied prohibited initial access to Enclave.
3. User gains allowed repeat access to Enclave.
4. ID Station is started and enrolled with input from the Enrolment Station.
5. ID Station is started already enrolled.
6. ID Station is shut down.
7. Security Officer updates the configuration of the ID Station.
8. Audit log is archived.
9. Guard manually unlocks the door.
10. Administrator logs on.
11. Administrator logs off.
We now consider a sample scenario, give a high level description of it and then give small code snippets of how it is modeled in Z and then programmed in Spark.
This is done only to show how the actual scenarios are modeled in different levels (The reader is not expected to understand modeling in Z and programming in Spark at present). The below specifications in ‘Z’ and program snippet in Spark can be understood completely by looking into the documentation.
Consider the scenario: Administrator logs on (Scenario 10)
1. Administrator logs on by inserting card into the card reader.
2. We assume that the ID Station is quiescent. (No others are attempting to operate it)
3. We assume that door is closed and the card inserted by the admin is valid.
4. We also consider the success end conditions:
a. Administrator is able to successfully log in to the enclave.
b. Once admin comes in, door is closed and locked.
c. All the events are recorded in the audit log (It logs all the activities).
5. We now consider the failure conditions:
a. Admin is unable to log in as all the data on the card is not read successfully.
b. Unable to write the audit files to the audit log.
c. Audit log has no place.
6. The constraint that should hold is: user use or ID Station shutdown is not allowed during the entire scenario.
Above scenario modeled in Z as: ( FD.Admin.AdminLogon: page 76 of [1] )
\[\text{AdminLogonC} \]
\[\Delta \text{AdminC} \]
\[\text{requiredRole}\? : \text{ADMINPRIVILEGE} \]
\[\text{rolePresentC} = \text{nil} \]
\[\text{the rolePresentC}' = \text{requiredRole}\? \]
\[\text{currentAdminOpC}' = \text{nil}. \]
It is modeled in Spark as:
(Admin package in ‘core’ directory; Refer to code download for Tokeneer)
procedure Logon (TheAdmin : out T; Role : in PrivTypes.AdminPrivilegeT)
--# derives TheAdmin from Role;
--# post (Role = PrivTypes.Guard <-> Prf_rolePresent(TheAdmin) = PrivTypes.Guard ) and
--# not IsDoingOp(TheAdmin) and IsPresent(TheAdmin);
is begin
TheAdmin.RolePresent := Role;
end Logon;
3. Formal Specification in Z:
The behavior of the core of the ID Station is first specified using Z formal notations. The specifications model the ID Station as a number of state components and a number of operations that change the state.
These formal specifications are then programmed in Spark programming language.
Considering a simple example:
(token is the card that is inserted by the user to enter the enclave.)
‘user token presence’ (it defines whether user token is present or not) is modeled in Z as:
\[
\text{PRESENCE ::= present | absent}
\]
\[
\text{userTokenPresenceC : PRESENCE}
\]
Different privileges of the administrator are modeled as:
(Admin can be either a guard or auditManager or SecurityOfficer)
\[
\text{ADMINPRIVILEGE == \{guard, auditManager, securityOfficer\}}
\]
It is programmed in Spark as: (Shift it later to Spark section.)
\[
\text{TokenPresence : BasicTypes.PresenceT;}
\]
\[
\text{type PresenceT is \{Present, Absent\};}
\]
Few commonly used Z notations: (Z notation: What it denotes)
1. P: Set of.
3. Z: Set Of Integers
4. Delta: A change in the variable.
5. A \rightarrow B: (A, B) is a set of elements.
7. a!: Output from a.
4. Introduction to Spark.
Spark is a high level programming language designed for writing software for high integrity applications where safety and security are important.
Spark language comprises a Kernel, which is a subset of Ada plus additional features inserted as annotations in the form of Ada comments. These annotations are ignored by Ada compiler and can be compiled separately by a standard compiler. Spark annotations are written prefixed with ‘--#’. Packages are general means of encapsulation in Spark. Packages provide key facilities of Object oriented programming by controlling access to hidden entities through Subprogram methods. Spark subprograms can be procedures or functions. The purpose of a procedure is to perform an updating action of some kind. A function in general doesn’t have any side effects.
Spark annotations are in two categories:
1. Core Annotations:
A. Global definitions: using keyword ‘global’. They are used to access the ‘own’ variables inside a subprogram. ‘own’ variables are the package variables.
B. Annotations that concern coupling between variables: using ‘derives’ clause.
If a variable is prefixed with ‘in’, it means the value it holds at the beginning of the method must be used inside the method’s body.
If a variable is prefixed with ‘out’, it means there is a change in the value it holds at the beginning and in the end of the method.
Sample Spark program (1) using ‘global’ and ‘derives’ clauses:
```adi
procedure Add (X: in Integer)
--# global in out Total;
--# derives Total from Total, X;
```
Considering the sample program 'Add' we can say that:
- procedure Add uses the global variable ‘Total’ in its method body.
- Initial values of variable 'Total' and 'X' must be used in the procedure Add (initial values are the values upon entering the procedure Add).
- A new value of 'Total' will be produced at the end of procedure Add.
- 'derives' statement says that, initial values of 'X' and 'Total' must be used in deriving the final value of 'Total'.
There are also other core annotations that concern access to variables in packages.
- ' inherit ' clauses: they control the visibility of packages.
- ' own ' variable clauses: they control access to package variables (global variables).
- ' initialization ' annotations: indicate the initialization of own variables.
'own' variable is the one declared inside a package and it contains state preserved between calls of subprograms in the package. ' global ' is used to access the ' own ' variables inside a subprogram.
2. Proof Annotations:
A. Pre and Post conditions of subprograms.
B. assertions such as loop invariants and type assertions.
C. Declarations of proof functions and proof types.
Sample Spark program (2) using ‘own’, ‘global’, ‘derives’, 'post' annotations:
The example shown has two procedures and two functions. It can be seen that function does not have any side effects on the package; they just have the return statements. But procedures perform a number of operations.
~ Operator indicates 'prestate' value (initial value) for an identifier. An identifier that is both an import and export of a procedure may be decorated with a tilde and the identifier with tilde indicates the initial imported value of the identifier.
package Odometer
---# own Trip, Total: Integer; --package variable declarations.
is
procedure Zero_Total
---# global out Trip; -- package variable ‘Trip’ will be given a new value.
---# derives Trip from ; -- ‘Trip’ is not derived from any variable.
---# post Trip=0; -- At the end of the procedure, Trip value is 0.
function Read_Trip return Integer;
---# global in Trip; --uses the initial value of package variable ‘Trip’.
function Read_Total return Integer;
---# global in Total;
procedure Inc;
---# global in out Trip, Total;
---# derives Trip from Trip & Total from Total;
---# post Trip = Trip~ + 1 and Total = Total~ + 1;
end Odometer;
package body Odometer is
Trip, Total: Integer; --declarations of package variables in ada code.
procedure Zero_Trip is
begin
Trip:=0;
end Zero_Trip;
function Read_Trip return Integer is
begin
return Trip;
end Read_Trip;
function Read_Total return Integer is
begin
return Total;
end Read_Total;
procedure Inc is
begin
Trip := Trip + 1; Total := Total + 1; --Initializing the ‘initialize’ variable.
end Inc;
end Odometer;
‘Inherit’ and ‘Initialize’ annotations:
- 'inherit' clauses are used to control access to global entities outside packages.
- 'initialization' annotations ensure that 'own' variables are properly initialized.
Sample program (3) using ‘inherit’ and 'initialize' annotations:
```ada
--# inherit Odometer;
package Capture_Odometer_Total
--# own Temp;
--# initializes Temp;
is
procedure capture
--#global out Temp;
--# in Odometer.Total;
end Odometer;
with Odometer;
package body Capture_Odometer_Total is
Temp:Integer;
procedure capture
is
begin
Temp=Odometer.Total;
end capture;
begin
Temp:=0; -- Initializing the variable.
end Capture_Odometer_Total;
In the above example the package ‘Capture_Odometer_Total’ wants to capture the value of the variable ‘Total’ of package Odometer. Hence we include ‘inherit’ clause for that package on the top of package ‘Capture_Odometer_Total’. We declared the variable ‘Temp’ prefixing with ‘initializes’ annotations, so we initialized it in the initialization part(between ‘begin’ and ‘end’) of the package body ‘with’ clause is used on the package body. It allows accessing the outside package variables via dotted notation in the ada code.
4.1 Steps (Life Cycle) in the process of proving the correctness of a Spark program:
I studied the proof process in detail because, in the process of working on the project, I had to make a number of replacements in the original code. This required a deeper understanding of the entire proof process.
Figure 3: Diagram showing the Lifecycle:
Consider the life cycle: At first the Spark program is passed to the Examiner. It then generates a number of ‘verification conditions’. Proving the programs correctness amounts to proving the verification conditions. Automated tools like ‘The Simplifier’ and ‘The Proof checker’ are used for proving these verification conditions. POGS stands for Proof Obligation Summarizer. This tool summarizes what are the verification conditions that are discharged (proved) and that are not discharged. We now consider Spark Examiner, Simplifier and Proof checker in detail:
**Spark Examiner:** It is a key Spark tool that has been written in Spark. Its main functionality is:
1. It checks whether the code is syntactically correct.
2. It also checks whether Spark annotations conform to the Ada code in the program by performing three different levels of analysis:
A. **Data flow analysis:** It checks that the usage of parameters and global variables corresponds to their modes ('in' and 'out') and also checks that variables are not read before given a value and values are not overwritten without being used and also that all imported variables are used.
B. **Information flow analysis:** This needs ‘derives’ annotation. As well as carrying out the Data flow analysis, it checks that the modes of parameters and global variables and their usage in the code of the body matches the interdependencies given in the ‘derives’ annotation.
C. **Generation** of Verification conditions (VC's). These VC's need to be proved either manually or by using an automated tool like Simplifier or proof checker to prove that the program is correct with respect to the proof annotations.
**Verification conditions and how the Examiner generates them:** The Examiner generates Verification conditions (VC) by considering both the code and proof annotations. Verification conditions are written in FDL (Functional Description Language). Examiner performs the mapping from Spark expressions into FDL statements.
VC's take the form:
\[ H_1: \ldots \]
\[ H_2: \ldots \]
\[ H_3: \ldots \]
\[ \ldots \]
\[ \rightarrow \]
\[ C_1: \ldots \]
\[ C_2: \ldots \]
\[ \ldots \]
Here \( H_1, H_2, H_3 \) are called hypotheses (Assumptions) and they represent the precondition written for each subprogram. \( C_1, C_2, C_3 \) are called conclusions and these are to be proved.
VC's are generated for each procedure in the package. Each procedure can have more than one VC depending on the number of paths from procedure begin to end.
Example: A procedure that swaps two variables has only one path usually, but a procedure that has iterative loops will have more than one path from begin to end.
Considering a sample example (4) and then showing how VC's are generated:
```pascal
procedure Exchange (X, Y: in out Float)
--# derives X from Y &
--# Y from X;
--# post X=Y~ and Y=X~;
is
begin
T := Float;
T := X;
X := Y;
Y := T;
end Exchange;
```
Procedure ‘Exchange’ exchanges the variables ‘X’ and ‘Y’ that are passed as parameters to it. Post condition states that final value of \( X \) holds the initial value of \( Y \) and vice versa.
We now consider the post condition and then make all the replacements that are in the code from ‘bottom to top ‘. Remember that VC’s are generated by considering both the code and the annotations.
Post condition: X=Y~ and Y=X~.
Replacement 1: Y:=T, then the post condition becomes
X=Y~ and T=X~.
Replacement 2: X:=Y, post condition becomes
Y=Y~ and T=X~.
Replacement 3: T:=X, post condition becomes
Y=Y~ and X=X~.
While replacing, Y~ means the initial value so we did not replace it with T in the first replacement. The process of moving the post condition backward through some operation (replacement) is known as “hoisting“.
The condition that is obtained after making all the replacements on post condition is called the "weakest precondition". So the conclusion of a VC for a path is the weakest precondition obtained by hoisting its postcondition to the beginning of the path. Proving the VC amounts to showing that the "weakest precondition" is implied by the given precondition.
Now considering our example, the weakest precondition is: Y=Y~ and X=X~. It says that, at the beginning the current value of X must be initial value of X and the same is with Y. It is clear that, at the beginning the current values of X and Y are equal to their initial values. So tildes can be dropped. There is no precondition for the given procedure, so it can be taken as 'true'.
Verification Condition turns to be:
H1: true.
->
C1: Y=Y.
C2: X=X.
Both the conclusions are correct, and hence the procedure is proved to be correct. If there are
multiple VC's for a procedure then each of these need to be discharged to prove the procedure correctness.
**Simplifier and Proof checker:**
Simplifier and Proof checker are the automated tools that are used for proving the verification conditions. Role of proof checker comes after the simplifier. If the simplifier is unable to reduce a verification condition to true then proof checker does that job. There may be number of reasons why simplifier is unable to reduce a verification condition to true:
1. The verification condition may not be true. This could be the case that program is wrong or some proof statement is wrong.
2. Simplifier is unable to process the additional rules that are supplied. (This will be discussed in further sections).
3. Simplifier may not be clever enough.
**4.2 External variables:**
Moded ‘own’ variables are referred to as external variables. They are to be initialized by the environment. Mode can be in (for input) or out (for output). External variables cannot be ‘in out’. Sometimes external variables do not actually correspond to explicit variables in the program at all but only exists in the spark annotations for the purpose of reasoning. They generally represent some external state that changes independently of the program.
Example:
```
Package P
--# own in State;
is
....
end P;
Package body P is
...
end P;
```
5. Changes made in existing project to examine using Kiasan.
Tokeneer ID Station is implemented in Spark making use of most of the programming language features. Bakar Kiasan currently cannot deal with certain Spark features. For it to be able to examine the ID Station, we need to find replacements for these features. List of features that I considered for replacement, as Kiasan currently cannot deal with them are:
1. Nested methods.
2. Abstraction and Refinement.
3. Proof functions.
5.1. Flattening the nested Methods:
Kiasan currently cannot deal with the nested methods in the packages. So the nested methods need to be converted to arbitrary normal methods that are not nested any more. Converting the nested methods to normal methods is called flattening the nested methods.
<table>
<thead>
<tr>
<th>Nested Methods:</th>
<th>After flattening:</th>
</tr>
</thead>
<tbody>
<tr>
<td>Method A</td>
<td>Method B</td>
</tr>
<tr>
<td>--#...</td>
<td>--# ......</td>
</tr>
<tr>
<td>is</td>
<td>is</td>
</tr>
<tr>
<td>Method B</td>
<td>begin</td>
</tr>
<tr>
<td>--# .....</td>
<td>......</td>
</tr>
<tr>
<td>is</td>
<td>end B;</td>
</tr>
<tr>
<td>begin</td>
<td>--#.....</td>
</tr>
<tr>
<td>......</td>
<td>Method A</td>
</tr>
<tr>
<td>end B;</td>
<td>is</td>
</tr>
<tr>
<td>begin</td>
<td>begin</td>
</tr>
<tr>
<td>......</td>
<td>......</td>
</tr>
<tr>
<td>end A;</td>
<td>end A;</td>
</tr>
</tbody>
</table>
In the above example it can be seen that method B is nested in method A. After flattening B is converted to a normal method.
Sample project code that is flattened in the above format:
Consider the ‘enclave’ package in the Tokeneer code dump.
**Nested function in enclave.adb:**
```ada
function CurrentAdminActivityPossible return Boolean
--# global AdminToken.State,
--# Status;
--# return R => (R -> Status in NonQuiescentStates);
is
function AdminActivityInProgress return Boolean
--# global Status;
is
begin
return Status in ActiveEnclaveStates;
end AdminActivityInProgress;
begin
return AdminHasDeparted or AdminActivityInProgress;
end CurrentAdminActivityPossible;
After flattening the nested methods:
```ada
function AdminActivityInProgress return Boolean
--# global Status;
is
begin
return Status in ActiveEnclaveStates;
end AdminActivityInProgress;
function CurrentAdminActivityPossible return Boolean
--# global AdminToken.State,
--# Status;
--# return R => (R -> Status in NonQuiescentStates);
is
begin
return AdminHasDeparted or AdminActivityInProgress;
end CurrentAdminActivityPossible;
In the above example before flattening, the function ‘AdminActivityInProgress’ is nested inside the function ‘CurrentAdminActivityPossible’. Flattening the methods involves lifting the nested function ‘AdminActivityInProgress’ and placing it with the other methods in the package. Nested methods generally appear between "is" and "begin" of the method in which they are
nested. This is the region where the variables used in the method's body are declared. Following the above process to flatten methods in most of the packages in the project did not involve excessive refactoring as the nested methods are called only from the method in which they are nested. Considering the above example, the function ‘AdminActivityInProgress’ is called only from the function ‘CurrentAdminActivityPossible’ in the entire enclave package.
In few packages, nested method uses variables that are passed as parameters to the method in which they are nested; in such cases those variables are again passed as parameters to the flattened methods. The other case may be that, nested methods use variables that belong to method in which they are nested; in that case those variables are also passed as parameters to the flattened methods.
Example describing the above scenarios:
procedure UpdateEndTimeFromFile of AuditLog package.
It has one nested method before flattening: function OverwriteTimeInText.
procedure UpdateEndTimeFromFile (TheFile : in out File.T;
Description : in out AuditTypes.DescriptionT)
begin
Description := OverwriteTimeInText(Description);
end UpdateEndTimeFromFile;
After flattening the nested method:
```pascal
function OverwriteTimeInText(Description : AuditTypes.DescriptionT;
LastTime : Clock.TimeTextT;
TimeOK : Boolean)
return AuditTypes.DescriptionT
begin
--# global LastTime,
--# TimeOK;
is
begin
............
end OverwriteTimeInText;
end;
procedure UpdateEndTimeFromFile(TheFile : in out File.T;
Description : in out AuditTypes.DescriptionT)
is
OK : Boolean;
LastTime : Clock.TimeTextT;
TimeCount : Natural;
TimeOK : Boolean := True;
begin
...................
Description := OverwriteTimeInText(Description, LastTime, TimeOK);
end UpdateEndTimeFromFile;
end;
```
In the above example, variable ‘TimeOK’ belongs to procedure UpdateEndTimeFromFile. After flattening the methods, variable ‘TimeOk’ will not be present in the scope of the function OverwriteTimeInText but it uses that variable in the function body. Hence this variable is passed as parameter to OverwriteTimeInText.
In the project sometimes we find nested methods that are nested inside other methods. We need to follow the same procedure for flattening them.
Spark examiner and simplifier is run and the POGS (Proof Obligation Summarizer) report has been considered to check the number of undischarged VC’s. The report states that all the VC’s are discharged. Hence the changes that are made to the code in the process of lifting back the nested methods did not have any implications. Hence flattening the methods this way is both semantically and syntactically correct.
5.2. Eliminating Abstraction:
Abstraction and Refinement:
Spark packages typically come in two parts:
1. Specifications describing the external interface. They appear in .ads files (ads stands for ada specification).
2. Body providing the implementation details. They are written in .adb files (adb stands for ada body).
Specification itself may have two parts, a visible part that declares the various entities (types, constants and subprograms) that may be used outside the package and a private part that appears at the end of the package specification. Private part begins with the reserved word ‘private’. The entities that are in the private part cannot be referenced outside the package. Body contains the implementation details and these details are generally hidden from the users.
We now define ‘Abstract State machine’ and ‘Abstract own variable’ that helps us understand the concept of abstraction.
Abstract State machine is an entity that has well defined states plus a set of operations that cause state transitions. It can be represented by a package with variables, which record its state declared in its body. Procedures that act on the machine and functions that observe its state are specified in the visible part of the package specification. All other details are hidden in the package body.
Abstract own variable is not an ordinary variable, it represents a set of variables that are used in the implementation, and through this they provide the ‘refinement’ mechanism. Abstract own variable occurs in two annotations, the ‘own’ variable clause in the package specification and also in the refinement definition in the body that gives the set of variables onto which it is mapped (refined).
From now on, .ads files are referred as “specifications section” and .adb files are referred as “body section”. Annotations (Spark contracts) in the specifications section are called Abstract annotations and annotations present in the body are called refined annotations. Preconditions and Postconditions referring to abstract variables are called ‘Abstract preconditions’ and ‘Abstract Post conditions respectively’. The pre and post conditions referring to the refined variables are called ‘Refined preconditions’ and ‘Refined Post conditions’.
We already discussed that the Spark Examiner can generate more than one Verification condition for a procedure depending on the number of ‘paths’ present in that procedure. In addition, if there is refinement in the annotations of that procedure we can have more verification conditions one for each of the following:
1. Abstract Preconditions $\rightarrow$ Refined Preconditions.
2. Refined Preconditions $\rightarrow$ Refined Postconditions.
3. Refined Postconditions $\rightarrow$ abstract Postconditions.
**Sample Example program showing Abstraction and refinement:**
**The_Stack.ads:**
```plaintext
package The_Stack
--# own State; -- This is an abstract variable.
Is
procedure Push(X: in Integer);
--# global in out State; -- The annotations use the abstract variable
--# derives State from State, X;
procedure Pop(X: out Integer)
--# global in out State;
--# derives State, X from State;
end The_Stack;
```
The_Stack.adb:
package body The_Stack
--# own State is S, Pointer; -- The refinement definition for abstract variable.
is
-- Ada code declaring variables S and Pointer...
procedure Push(X: in Integer);
--># global in out S, Pointer; -- The annotations use the refined variables
--># derives S from S, Pointer X &
--># Pointer from Pointer;
is begin
............
end Push;
procedure Pop(X: out Integer)
--># global in S; in out Pointer;
--># derives Pointer from Pointer &
--># X from S, Pointer;
is begin
............
end Pop;
is
begin
............
end The_Stack;
In the above example, we can see that State is an abstract variable present in the specifications section of the package, it is refined to S & Pointer in the body. Refined state is not visible as the implementation details in the body are hidden from the external users. Hence all the external users who access the package ‘Stack’ do not have any idea bout the refinement of the variable ‘State’. Observe the difference in the annotations for the same procedure present in the specifications section and body section of the package: annotations for the procedure ‘Push’ in stack.ads use the abstract variable ‘State’ where as annotations in stack.adb for the same procedure uses ‘ S & pointer ’.
Kiasan currently cannot deal with the concept of abstraction and refinement, so we decided to eliminate it completely by lifting the refined state variables from body section (adb files) into specification section (ads file). Hence the state variables are declared only once and this is in the specifications section of the package.
The strategy followed for eliminating the abstraction is: First we transfer all the refined variables from body section into the specifications section, this is done by placing all the refined variables as fields in the record in .ads file. We leave the ‘own’ variable in the specifications section with the same name but it is declared to be of the type ‘record’ (Previously it was of the type ‘abstract’). The proof annotations for methods present in the specifications section of package are replaced by the proof annotations for the same methods present in the body section of the package. After this is done, all the annotations in the body section for those methods are eliminated, as we don’t want to repeat the same annotations twice. The reason for not replacing the core annotations is explained with an example. We finally remove all the ‘own’ annotations in the body section. This is the strategy that is followed for eliminating the abstraction.
We can even place the refined variables as normal variables in the specification section but the reason for transferring the refined variables into a record is to reduce the amount of refactoring that has to be done in the rest of the project once the abstraction is removed.
Eliminating abstraction from the sample project code: (Example: 5)
‘door’ package: consider door.ads and door.adb files.
(The example package that is described here will be used to explain all other transformations that are made in the rest of the report)
Before eliminating the Abstraction: (door.ads and door.adb)
Figure 4 - Specification Before eliminating Abstraction
door.ads: (Considering the length of the files, only the necessary parts are written here)
package Door
---# own State : StateType;
---# in Input;
is
---# type StateType is Abstract;
---# function prf_alarmTimeout(DoorState : StateType)
---# return Clock.TimeT;
function TheDoorAlarm return AlarmTypes.StatusT;
---# global State;
procedure Poll(SystemFault : out Boolean);
---# global in Input;
---# ……
---# ……
---# in out State;
---# ........
---# ........
---# derives AuditLog.State,
---# AuditLog.FileState from State,
---# Input,
---# …………… &
---# State from *,
---# Input,
---# …………… &
---# …………… &
---# SystemFault from Input;
---# post
---# …………… and
---# TheCurrentDoor(State) = Open and
---# Clock.GreaterThanOrEqual(Clock.TheCurrentTime(Clock.CurrentTime),
---# prf_alarmTimeout(State)) ) <->
---# TheDoorAlarm(State) = AlarmTypes.Alarming ) and
---# ………………
end Door;
with Door.Interface;
package body Door
--# own State is CurrentDoor,
--# AlarmTimeout,
--# DoorAlarm &
--# Input is in Door.Interface.Input;
is
CurrentDoor : DoorType.T;
DoorAlarm : AlarmTypes.StatusT;
AlarmTimeout : Clock.TimeT;
function TheDoorAlarm return AlarmTypes.StatusT
--# global DoorAlarm;
is begin
return DoorAlarm;
end TheDoorAlarm;
procedure Poll(SystemFault : out Boolean)
--# global in Clock.Now;
--# ................
--# in AlarmTimeout;
--# in Interface.Input;
--# in out DoorAlarm;
--# in out CurrentDoor;
--# derives AuditLog.State,
--# AuditLog.FileState from AuditLog.State,
--# ................
--# DoorAlarm,
--# AlarmTimeout,
--# CurrentDoor;
--# Interface.Input &
--# SystemFault from Interface.Input &
--# DoorAlarm from Clock.CurrentTime,
--# ................
--# AlarmTimeout,
--# CurrentDoor;
--# Interface.Input &
--# CurrentDoor from *,
--# Interface.Input;
--# post
--# ( ( CurrentDoor = Open and
--# .................... and
--# Clock.GreaterThanOrEqual(Clock.TheCurrentTime(Clock.CurrentTime),
--# AlarmTimeout) ) <->
--# DoorAlarm = AlarmTypes.Alarming ) and
--# .....................;
is
begin
end Poll;
end Door;
After eliminating the Abstraction from the package door:
**Figure 6 - Specification after removing abstraction**
door.ads:
```ada
package Door
--# inherit DoorInterface;
is
type StateType is record
CurrentDoor : DoorType.T;
DoorAlarm : AlarmTypes.StatusT;
AlarmTimeout : Clock.TimeT;
end record;
State : StateType;
--# global State;
function SparkExecutable_alarmTimeout return Clock.TimeT;
--# global State;
function TheDoorAlarm return AlarmTypes.StatusT;
procedure Poll(SystemFault : out Boolean);
```
```
end Door;
```
Figure 7 - Body after eliminating abstraction
door.adb:
with DoorInterface;
............;
package body Door is
-- This is the replacement for the proof function:
function SparkExecutable_alarmTimeout return Clock.TimeT
is
begin
return State.AlarmTimeout;
end SparkExecutable_alarmTimeout;
function TheDoorAlarm return AlarmTypes.StatusT
is
begin
return State.DoorAlarm;
end TheDoorAlarm;
procedure Poll(SystemFault : out Boolean)
is
............
............
begin
............
............
end Poll;
end Door;
Package Door has many procedures and functions, but we considered only one procedure, one function and one proof function for describing the refinement mechanism. For now one can ignore the replacement of the proof function with spark executable function (Its purpose is discussed later).
We have the abstract own variable ‘State’ in door.ads. This is refined to ‘CurrentDoor’, ‘DoorAlarm’, and ‘AlarmTimeOut’ in door.adb. Following the refinement mechanism: ‘State’ is changed to be just ‘own’ variable in door.ads. StateType is now not of the type Abstract, but we make it a record. We then transfer the refined variables from door.adb to door.ads, we declare the variables CurrentDoor, DoorAlarm, and AlarmTimeOut to be fields in the record (StateType) in door.ads. ‘State’ is then declared to be of type ‘StateType’. Hence ‘State’ is a record with three fields. We then remove all the ‘own’ variable annotations in the body section (door.adb). Then, for function TheDoorAlarm, procedure Poll, we copy the proof annotations from door.adb into
door.ads. We then remove all the annotations for those procedures from the door.adb file. As we made the three variables part of record, we cannot refer to them directly, but by ‘recordname.fieldname’ notation.
The reason for not replacing the core annotations in the specifications section is: The global and derives annotations cannot refer to the fields in the records. If we still want them to refer to fields in the record, we just mention the record name in those annotations. In the above example, own variable ‘State’ remains the same (we just changed its type to be record). Hence we need not change the core annotations.
We can say that semantics are preserved, as we did not remove any state variables but just shifted the refined variables from body to the specifications and made necessary refactoring in rest of the project. I considered only the packages that had proof functions in them for removing the abstraction; there may be few packages that have abstraction but no proof functions in them. Spark examiner is not run on the transformed project because the transformations had certain implications. These implications have to be resolved and then spark tools must be used.
**Issues:**
There might be some situations where the above mechanism for removing abstraction does not work. Consider a situation where the refined state has an abstract variable. Considering the above example, the abstract own variable ‘input’ is refined to Door.Interface.Input. Input is imported from the package Door.interface (this is child of door) and is an external variable. We already know ‘external’ variables get its input from external world and so it is not refined. As the input in Door.Interface is not refined, the variable ‘input’ in Door.ads also cannot be refined. Hence ‘input’ in Door.ads is removed. All the references to ‘input’ in Door and other packages are replaced with DoorInterface.input, this is explained in “Removing the child packages” section.
**Implications:**
By eliminating the abstraction we are actually exposing the implementation details. This is fine; because the motivation is not delivering the transformed project to end user but only use it for tool analysis.
5.3 Replacing the Proof functions with normal Spark Executable functions:
Proof function:
There may be some situations where spark tools will not be able to prove the correctness of a procedure because we are unable to express the pre or postcondition in a suitable form. This issue can be resolved by introducing a new type of function called proof function. Its syntax is just the same as for a normal ada function declaration. A proof function is only used in the spark annotations and is not defined in the ada program.
Spark Examiner uses it in the process of producing the verification conditions but it does not need to know what the proof function actually means, because the process of producing verification conditions simply involve formal substitution through the Hoisting process. Hoisting process is already discussed earlier. It is better to prefix the proof functions with 'prf”, as it can avoid the confusion with other normal function declarations in specification section.
Example: --# function prf_statusIsGotAdminToken (State: StateType) return Boolean;
Files with .rlu and .rls extension are called rule files. They contain rules that are used by the examiner or proof checker in the process of proving the verification conditions. All the rule files are written in FDL (functional description language). There are many predefined rules available to the tools covering the usual theorems of mathematics and logic. .rls (RulesSpark) are automatically generated by the examiner and they contain the replacement rules for each subprogram processed.
rlu (RulesUser), as the name suggests these rules are manually written by the user. All the additional rules that are needed for the proof process and which are not generated by the examiner in .rls files are written in .rlu files. For example: The replacement rules for the proof functions are written in .rlu files, as spark examiner cannot generate them. .rlu files can be present either as < procedurename >.rlu or < packagename >.rlu.
Kiasan cannot deal with Proof functions because it doesn’t employ the VC approach (used by simplifier and proof checker) for proving the correctness of the program. So all the proof
functions in the Tokeneer project have to be replaced with normal Spark executable functions. I started looking for proof functions from the main program (tismain) and at first listed all the proof functions that are directly and indirectly referenced through the main program.
When the spark examiner is run on the door package, we have following files generated:
- poll.vcg: This has all the Verification conditions corresponding to procedure Poll.
- poll.fdl: This has FDL declarations of all the variables found in the verification conditions.
- poll.rls: This has the some of the rules that are needed during the proof process.
- poll.prv: This is a proof review file, which will be discussed further.
Along with these, poll.rlu which is written by the user and that has the additional rules is supplied to the simplifier. This is done because the proof function prf_alarmTimeout is referenced in the annotations of the procedure poll. Verification conditions that are generated for procedure poll has FDL statements related to prf_alarmTimeout. Considering the Simplifier uses rules in poll.rlu for proving this verification conditions. Along with these additional files are generated for the function TheDoorAlarm like TheDoorAlarm.vcg, TheDoorAlarm.rls, TheDoorAlarm.fdl.
The strategy I employed for replacing the proof functions can be better explained by considering an example package from the project. Considering the same package Door that we already coded with a single function and procedure. The proof function in the package Door:
```
--# function prf_alarmTimeout(DoorState : StateType)
--# return Clock.TimeT;
```
First we consider the poll.vcg, which has a number of VC’s, among them we consider the VC that talks about the “refinement integrity”. This is the VC that gives us an idea how the state is refined (Recall we will have a VC that represent the Refined Postcondition as hypothesis and has Abstract Post condition as conclusion). We then consider poll.slg. .slg files are “SparkLog files” that logs how each VC is discharged. By following the log files, VC’s and using the rules in .rlu files, we can conclude what the proof function actually models (semantic meaning).
Once we understand the semantics of the proof function, we can replace the proof function with Spark executable function by following those semantics. Hence this replacement is semantically correct.
Following the above process, we give the replacement for prf_alarmTimeout() as:
```plaintext
function SparkExecutable_alarmTimeout return Clock.TimeT
is
begin
return State.AlarmTimeout;
end SparkExecutable_alarmTimeout;
```
This is the normal spark executable function that has a declaration in door.ads and body in the door.adb. This replacement is done in all the other packages that make a reference to the proof function.
**Issues:**
Some of the proof functions do not have replacement rules in the .rlu files. In those situations a type of files called Proof review files are used for proving the VC’s. These files hold identifiers that indicate specific Verification conditions in the .vcg files and the review team proves them. These identifiers may change once we make any changes in the original code. Hence prv files are to be removed, as we are making many transformations in the code. Proof review files have the extension .prv.
**Implications:**
The .rlu files are no longer needed as the proof functions are removed.
5.4. Removing the private child packages:
Child Packages:
Top-level packages and subprograms that are not nested in any other packages or subprograms are called library units. Library package can have child packages and these are themselves library packages. The name of the child uses the dotted notation, in which prefix is the name of its parent.
Consider an example:
```pascal
package P is
....... -- Visible part.
priate
....... -- private part.
end P;
package body P is
.......
begin
.......
end P;
```
Now its child package looks like:
```pascal
package P.child is
.......
end P.child;
```
We can call such child package as a ‘public child’. There is a difference between a child package and an arbitrary package: the private part and body of a child package can access the private part of its parent. The other difference is, a child package does not need a ‘with’ clause on its body section for inheriting its parent. A child package can have with clauses for its siblings. Body of the parent cannot have with clauses for its public children and cannot access them.
Now considering the private child package:
```pascal
private package P.child is
.......
end P.Child;
```
The key thing about a private child is it is not visible to external users. It can only be visible to body of its parent and both the body and specifications of its private siblings. Another key
difference between private and public children is that whole of a private child can see the private part of its parent. Hence public child can seen as adding to the specification of the package where as private child is like part of its body.
Kiasan currently cannot deal with the child packages. We need to convert them to the normal arbitrary packages. This includes refactoring the parent package and the child package as well. Now considering the example package Door. This package has a private child Door.Interface that looks like:
```
--# inherit Door;
private package Door.Interface
--# own in Input;
is
procedure GetDoorState (DoorState : out Door.T; Fault : out Boolean);
--# global in Input;
--# derives DoorState,
--# Fault from Input;
end Door.Interface;
```
This package inherits Door, because Door.T is used in the contracts in GetDoorState procedure. Now converting it into arbitrary package and making it public.
```
--# inherit Door;
package DoorInterface
--# own in Input;
is
procedure GetDoorState (DoorState : out Door.T; Fault : out Boolean);
--# global in Input;
--# derives DoorState,
--# Fault from Input;
end DoorInterface;
```
This package is made public because, earlier in the process of removing the abstraction we removed a field called ‘input’ from the Door.ads package (Remember it is refined to Door.Interface.input in Door.adb). There are few other packages that referred to ‘input’ in Door.ads earlier, as we removed this field completely we need to consider the ‘input’ in DoorInterface. So all the other packages that referred to ‘input’ in ‘Door’ earlier now refers to
‘input’ in DoorInterface. As the other packages are referring to fields (‘input’) in DoorInterface package, this cannot be a private package. Hence it is made public.
**Issues in dealing with private child packages:**
Some of the child packages inherit their parent in order to access the fields in parent. If we follow the above strategy of converting the private child packages into normal arbitrary package it leads to circular inheritance (DoorInterface is inherited by Door, because it uses ‘input’ in DoorInterface and Door is in turn inherited by DoorInterface, because it uses ‘T’ in Door). This issue can be solved by considering the fields that cause the circular inheritance and lifting them to a separate package. In the above packages, ‘input’ in DoorInterface and type ‘T’ in Door are causing circular inheritance. So we lift one of them, type ‘T’ into a separate package ‘DoorType’. This package has just one field, type ‘T’. Both Door and DoorInterface will inherit this package.
Some of the private child packages have proof functions. I did not find a systematic way to convert them to the Sparkexecutables, as the rule files did not have any useful semantics for replacement.
**Implications:**
The private child packages are converted to public arbitrary packages. This implies that any other arbitrary packages can inherit the contents of these packages. Earlier they were private child packages and no other packages were able to inherit the contents.
6. Summary of changes in the project for examining using Kiasan.
I listed few of the packages in the project that I worked on. For each of the package, features that are to be replaced are noted.
1. At first **Enclave** package is considered. It has nested methods, proof functions and abstraction. It is inheriting 21 other packages.
**Status:** Applying the techniques mentioned in the report, I was able to flatten all the nested methods, replace the proof functions with Spark executable functions and remove the abstraction in the enclave package. But Kiasan cannot examine it because it inherits other packages that have either abstraction or proof functions or child packages in them.
2. Package **Admin:** It has proof functions.
**Status:** Applying the above techniques, I was able to replace the proof functions with the Spark executable methods. But Kiasan cannot examine it as it inherits other packages that either has abstraction or proof functions or child packages in them.
3. Package **AdminToken:** It has nested methods, proof functions, child package and abstraction.
**Status:** Applying the above techniques, I was able to replace the nested methods. Kiasan cannot examine it because abstraction and proof functions are not replaced.
A. The child package **AdminToken.Interface** has abstract variables that are not refined.
**Status:** Unable to examine using Kiasan as it has external variables.
4. Package **Alarm:** It has proof functions, abstraction and child package.
**Status:** Applying the above techniques, child package can be removed. But abstraction is not removed. Proof functions are not yet replaced.
A. The child package **Alarm.Interface** has proof function, abstract variables that are not refined.
**Status:** Kiasan cannot examine it as it has external variables.
5. Package **AlarmTypes:** Kiasan can examine it.
6. Package **AuditLog:** It has abstraction, nested methods.
**Status:** Nested methods are rolled back. Abstraction can be removed.
7. Package AuditTypes: Kiasan can examine it.
8. Package BasicTypes: Kiasan can examine it.
**Status**: Applying the above techniques, Nested methods can be removed and abstraction also can be removed. But Kiasan cannot examine it as it has child packages.
A. The child package Bio.Interface has external variable, abstract variables that are not refined.
Kiasan cannot examine it as it has external variables.
10. Package Cert: It has proof function, child packages.
**Status**: Proof function can be removed. Unable to examine it using Kiasan as it has child packages.
A. The child package Cert.attr: It has child packages.
**Status**: Kiasan cannot examine it as it inherits other packages that have either proof functions or child packages or abstraction.
a. Cert.attr.auth: Nested method. They can be flattened. After flattening Kiasan can examine it.
b. Cert.attr.ianda: Kiasan can examine it.
c. Cert.attr.priv: Kiasan can examine it.
B. The child package Cert.id: Kiasan can examine it.
11. Package Configuration: It has nested methods.
**Status**: They can be flattened, but Kiasan cannot examine it, as it inherits other packages that either have child packages or abstraction or proof functions.
12. Package Door: It has child packages, abstraction and proof function.
**Status**: Unable to remove the abstraction completely. Proof function is replaced.
A. Door.Interface: It has external variables. Abstract variables are not refined.
**Status**: Kiasan cannot examine it as it has external variables.
13. Package Display: It has abstraction, child packages.
**Status**: Abstraction cannot be completely removed.
A. Display.Interface: It has external variables. Abstract variables are not refined.
**Status**: Kiasan cannot deal with it as it has external variables.
14. Package **Enrolment**: It has nested methods. They can be flattened.
**Status**: Kiasan cannot examine it as it inherits other packages that either have abstraction or child packages or proof functions.
15. Package **File**: Abstract variables are not refined.
**Status**: Kiasan cannot examine it.
16. Package **Floppy**: Abstract variables are not refined.
**Status**: Kiasan cannot examine it.
17. Package **KeyStore**: It has proof functions, nested methods, abstraction and child package.
**Status**: Nested methods are flattened but abstraction is not removed completely.
A. **KeyStore.Interface**: It has External variables. Abstract variables are not refined.
**Status**: Kiasan cannot examine it as it has external variables.
18. Package **Keyboard**: It has child packages, abstraction.
**Status**: Abstraction cannot be removed.
A. **Keyboard.Interface**: It has external variables.
**Status**: Kiasan cannot examine it as it has external variables.
19. Package **Latch**: Proof functions, abstraction and child package.
**Status**: Abstraction cannot be removed completely.
A. **Latch.Interface**: It has external variables, proof functions. Abstract variables are not refined.
**Status**: Kiasan cannot examine it as it has external variables.
20. Package **Screen**: Child package, abstraction and nested methods.
**Status**: Abstraction cannot be completely removed. Nested methods can be flattened.
A. **Screen.Interface**: It has external variables. Abstract variables are not refined.
**Status**: Kiasan cannot examine it as it has external variables.
**Status**: Abstraction cannot be completely removed. Nested methods are rolled back.
A. **UserToken.Interface**: It has external variables. Abstract variables are not refined.
**Status**: Kiasan cannot examine it as it has external variables.
7. Future Work:
Strings and operations on strings such as concatenations are used in the tokeneer project. Kiasan currently cannot deal with these; we need to find an alternative for handling them effectively. One way to deal them is to use ‘hash code’ replacements for the strings. Another way is to replace the strings with Integers (Kiasan can deal with integers). An alternative for proof functions that do not have the replacement rules in the .rlu files needs to be found. We also need to find a way to deal with external variables. One way would be to simulate the external devices with files that can supply the values for the external variables or take values from them.
8. References
[1] 50_1_Formal_Design (docs directory in the tokeneer download).
[2] 41_1_System_Requirements_Specification (docs directory in the tokeneer download)
|
{"Source-Url": "http://krex.k-state.edu/dspace/bitstream/handle/2097/12023/HariHaraKumarEarlapati2011.pdf?isAllowed=y&sequence=1", "len_cl100k_base": 13261, "olmocr-version": "0.1.49", "pdf-total-pages": 46, "total-fallback-pages": 0, "total-input-tokens": 86878, "total-output-tokens": 15487, "length": "2e13", "weborganizer": {"__label__adult": 0.00026106834411621094, "__label__art_design": 0.00027823448181152344, "__label__crime_law": 0.00030612945556640625, "__label__education_jobs": 0.00089263916015625, "__label__entertainment": 4.5359134674072266e-05, "__label__fashion_beauty": 9.846687316894533e-05, "__label__finance_business": 0.0002114772796630859, "__label__food_dining": 0.00023496150970458984, "__label__games": 0.0004401206970214844, "__label__hardware": 0.0006251335144042969, "__label__health": 0.0001811981201171875, "__label__history": 0.00012731552124023438, "__label__home_hobbies": 8.100271224975586e-05, "__label__industrial": 0.0002942085266113281, "__label__literature": 0.0001443624496459961, "__label__politics": 0.00015401840209960938, "__label__religion": 0.0002541542053222656, "__label__science_tech": 0.006580352783203125, "__label__social_life": 8.702278137207031e-05, "__label__software": 0.00592041015625, "__label__software_dev": 0.982421875, "__label__sports_fitness": 0.00017631053924560547, "__label__transportation": 0.0003056526184082031, "__label__travel": 0.00012135505676269533}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 63786, 0.00879]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 63786, 0.42379]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 63786, 0.85937]], "google_gemma-3-12b-it_contains_pii": [[0, 395, false], [395, 1619, null], [1619, 4880, null], [4880, 5845, null], [5845, 6176, null], [6176, 7985, null], [7985, 9179, null], [9179, 9739, null], [9739, 10569, null], [10569, 11215, null], [11215, 12904, null], [12904, 13793, null], [13793, 15019, null], [15019, 16589, null], [16589, 18306, null], [18306, 19413, null], [19413, 20665, null], [20665, 21009, null], [21009, 23010, null], [23010, 24138, null], [24138, 25685, null], [25685, 27053, null], [27053, 29552, null], [29552, 30979, null], [30979, 32197, null], [32197, 33733, null], [33733, 35453, null], [35453, 36932, null], [36932, 38195, null], [38195, 40023, null], [40023, 41129, null], [41129, 42284, null], [42284, 42830, null], [42830, 44502, null], [44502, 46709, null], [46709, 48906, null], [48906, 51117, null], [51117, 52358, null], [52358, 53768, null], [53768, 55405, null], [55405, 56883, null], [56883, 58993, null], [58993, 60885, null], [60885, 62853, null], [62853, 63534, null], [63534, 63786, null]], "google_gemma-3-12b-it_is_public_document": [[0, 395, true], [395, 1619, null], [1619, 4880, null], [4880, 5845, null], [5845, 6176, null], [6176, 7985, null], [7985, 9179, null], [9179, 9739, null], [9739, 10569, null], [10569, 11215, null], [11215, 12904, null], [12904, 13793, null], [13793, 15019, null], [15019, 16589, null], [16589, 18306, null], [18306, 19413, null], [19413, 20665, null], [20665, 21009, null], [21009, 23010, null], [23010, 24138, null], [24138, 25685, null], [25685, 27053, null], [27053, 29552, null], [29552, 30979, null], [30979, 32197, null], [32197, 33733, null], [33733, 35453, null], [35453, 36932, null], [36932, 38195, null], [38195, 40023, null], [40023, 41129, null], [41129, 42284, null], [42284, 42830, null], [42830, 44502, null], [44502, 46709, null], [46709, 48906, null], [48906, 51117, null], [51117, 52358, null], [52358, 53768, null], [53768, 55405, null], [55405, 56883, null], [56883, 58993, null], [58993, 60885, null], [60885, 62853, null], [62853, 63534, null], [63534, 63786, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 63786, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 63786, null]], "pdf_page_numbers": [[0, 395, 1], [395, 1619, 2], [1619, 4880, 3], [4880, 5845, 4], [5845, 6176, 5], [6176, 7985, 6], [7985, 9179, 7], [9179, 9739, 8], [9739, 10569, 9], [10569, 11215, 10], [11215, 12904, 11], [12904, 13793, 12], [13793, 15019, 13], [15019, 16589, 14], [16589, 18306, 15], [18306, 19413, 16], [19413, 20665, 17], [20665, 21009, 18], [21009, 23010, 19], [23010, 24138, 20], [24138, 25685, 21], [25685, 27053, 22], [27053, 29552, 23], [29552, 30979, 24], [30979, 32197, 25], [32197, 33733, 26], [33733, 35453, 27], [35453, 36932, 28], [36932, 38195, 29], [38195, 40023, 30], [40023, 41129, 31], [41129, 42284, 32], [42284, 42830, 33], [42830, 44502, 34], [44502, 46709, 35], [46709, 48906, 36], [48906, 51117, 37], [51117, 52358, 38], [52358, 53768, 39], [53768, 55405, 40], [55405, 56883, 41], [56883, 58993, 42], [58993, 60885, 43], [60885, 62853, 44], [62853, 63534, 45], [63534, 63786, 46]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 63786, 0.01759]]}
|
olmocr_science_pdfs
|
2024-11-27
|
2024-11-27
|
2afda909fdc3e896942f96f6cee0b88437f41206
|
A Divide and Conquer Approach for Web Services Location Allocation Problem
Harshal Tupsamudre∗
harshalcoep@gmail.com
Saket Saurabh†
sk.saurabh@tcs.com
Arun Ramamurthy†
raramamurthy.arun@tcs.com
Mangesh Gharote†
mangesh.g@tcs.com
Sachin Lodha†
sachin.lodha@tcs.com
ABSTRACT
The appropriate choice of locations for the deployment of web services is of significant importance. The placement of a web service closer to user centers minimizes the response time, however deployment cost may increase. The placement becomes more challenging when multiple web services are involved. In this paper, we address the problem of placing multiple web services with the aim of simultaneously minimizing conflicting objectives of total deployment cost and network latency. We solve the location allocation problem for each web service independently and combine the resulting solutions using a novel merge algorithm. We demonstrate through extensive experiments and simulations that the proposed approach is not only computationally efficient but also produces good quality solutions. Further, the proposed merge algorithm is generic and could be easily adapted to tackle any bi-objective optimization problem that can be decomposed into non-overlapping sub-problems.
KEYWORDS
Web services; Multi-Objective Optimization; Location Allocation Problem; Divide and Conquer
1 INTRODUCTION
Service-oriented computing using web services has emerged as a new computing paradigm for developing software applications. These web services provide a distributed computing infrastructure for both intra- and cross-enterprise application integration and collaboration. As the number of functionally similar web services is of significant importance. The placement of a web service closer to user centers minimizes the response time, however deployment cost may increase. The placement becomes more challenging when multiple web services are involved. In this paper, we address the problem of placing multiple web services with the aim of simultaneously minimizing conflicting objectives of total deployment cost and network latency. We solve the location allocation problem for each web service independently and combine the resulting solutions using a novel merge algorithm. We demonstrate through extensive experiments and simulations that the proposed approach is not only computationally efficient but also produces good quality solutions. Further, the proposed merge algorithm is generic and could be easily adapted to tackle any bi-objective optimization problem that can be decomposed into non-overlapping sub-problems.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.
ACM Reference Format:
∗Work was done as a part of TCS Research and Innovation
†TCS Research and Innovation, Tata Consultancy Services, India
WSLAP is a variant of a facility location problem which is proved to be NP-hard [4] [5]. The search space of WSLAP is combinatorial. If there are, say, s web services and n candidate locations, and each service can be deployed at multiple locations, then the number of solutions is 2sn [3]. To find multiple Pareto-optimal solutions using exact approaches such as Integer Linear Programming (ILP), branch and bound algorithm etc., is challenging.
Therefore, researchers have explored various Multi-Objective Evolutionary Algorithms (MOEAs) such as MOPSO [6], NSGAII [7] and NSGA-II with a local search [8] in WSLAP. As MOEAs work with a population of solutions, they can produce a set of trade-off solutions in a few generations. Further, MOEAs scale much better than ILPs due to the nature of heuristic search. Recently, Tan et al. [3] proposed a Binary Multi-Objective Particle Swarm Optimization with Crowding Distance (BMOPSOCD) algorithm to solve WSLAP and showed that it produces better solutions than NSGAIL. Many a time, decomposing the problem into smaller sub-problems, solving each sub-problem independently and merging is an efficient way to solve the problem [9]. The main contribution of this work is a novel merge algorithm to solve the WSLAP using a Divide and Conquer (D&C) approach. Particularly, we solve the location allocation problem for each web service using a MOEA (NSGAII or BMOPSOCD) and efficiently merge the resulting non-dominated solutions of each web service to obtain solutions for WSLAP. The major benefits of D&C are:
• Problem size reduces significantly.
• Sub-problems being independent can be solved in parallel.
• Sub-problems that are similar (in terms of configuration and requirements) need to be solved only once.
Further, the approach is incremental as it enables web service providers to find deployment locations for a new web service and
perform allocation of user centers without having to solve the entire problem from scratch.
The merge algorithm takes non-dominated solutions of multiple sub-problems (web services) and produces the solution to the original problem (WSLAP). We conducted multiple experiments with different WSLAP instance sizes to demonstrate that the D&C approach is not only efficient but also produces better solutions in terms of quality as well as diversity than the state-of-the-art [3].
The organization of this paper is as follows. First, we briefly describe the multi-objective WSLAP model as given by Tan et al. [3]. Subsequently, we explain our D&C algorithm in detail. Later, we compare the efficacy of our D&C approach with the state-of-the-art MOEAs [3] on the original WSLAP model. Finally, we conclude the paper and discuss the future work.
2 WSLAP DESCRIPTION
The location allocation problem involving multiple web services [3] is described as follows. A set of s web services \( W = \{W_1, W_2, \ldots, W_s\} \) needs to be deployed at one or more of the n candidate locations \( A = \{A_1, A_2, \ldots, A_n\} \). The locations could be the data centers of the enterprise itself and/or one or more cloud providers. The cost incurred to deploy a web service \( W_i \) at a location \( A_j \) is given by \( c_{ij} \).
The deployment cost varies from one data center to another due to the difference in electricity price, real estate price, human labour cost etc. All web services are assumed to be independent of each other. If that is not the case, we can merge dependent services into a single web service.
There are \( m \) user centers \( U = \{U_1, U_2, \ldots, U_m\} \) that require access to each of the s web services. A user center represents a geographic region. It also allows us to estimate the latency between the user center and candidate locations. The service invocation frequency (demand) of a web service \( W_i \) from a user center \( U_k \) over a unit time interval is represented by \( f_{ki} \). The service frequencies are computed as the average number of invocations over a period of time, such as over a month. The network latency between a user center \( U_k \) and a location \( A_j \) is given by \( l_{kj} \). Each service has to be deployed in at least one location. Further, a service can be deployed at multiple locations to improve its response time. Note that the requirement of a user center pertaining to a given web service is catered by exactly one location. The matrices required for modelling the input in WSLAP are given in Table 1.
<table>
<thead>
<tr>
<th>Matrix</th>
<th>Entry</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>( W_{s \times 1} )</td>
<td>( W_i )</td>
<td>( i^{th} ) web service</td>
</tr>
<tr>
<td>( A_{n \times 1} )</td>
<td>( A_j )</td>
<td>( j^{th} ) location</td>
</tr>
<tr>
<td>( U_{m \times 1} )</td>
<td>( U_k )</td>
<td>( k^{th} ) user center</td>
</tr>
<tr>
<td>( F_{s \times n} )</td>
<td>( F_{ki} )</td>
<td>Frequency invocation of service ( W_i ) at ( U_k )</td>
</tr>
<tr>
<td>( C_{s \times n} )</td>
<td>( C_{ij} )</td>
<td>Cost of deploying service ( W_i ) at ( A_j )</td>
</tr>
<tr>
<td>( L_{n \times n} )</td>
<td>( L_{kj} )</td>
<td>Latency between ( U_k ) and ( A_j )</td>
</tr>
<tr>
<td>( X_{s \times n} )</td>
<td>( X_{ij} )</td>
<td>Decision variable indicating whether ( W_i ) is deployed at location ( A_j )</td>
</tr>
</tbody>
</table>
The mathematical model of WSLAP is as follows:
\[
\text{minimize } f_1 = \sum_{i=1}^{s} \sum_{j=1}^{n} C_{ij} \cdot X_{ij} \quad (1)
\]
\[
\text{subject to: } \sum_{j=1}^{n} X_{ij} \geq 1 \quad \forall i \in \{1, \ldots, s\} \quad (3)
\]
\[
X_{ij} \in \{0, 1\} \quad \forall i \in \{1, \ldots, s\} \quad \forall j \in \{1, \ldots, n\} \quad (4)
\]
The objective of WSLAP is to locate a set of web services \( W \) among a set of candidate locations \( A \) such that the total deployment cost \( f_1 \) and the total response time \( f_2 \) are minimized. A service location matrix \( X \) of size \( s \times n \) is used to represent the entire location plan. The value of the decision variable \( X_{ij} \) is 1 if web service \( W_i \) is deployed at location \( A_j \); otherwise, it is 0. A user center is served from the nearest web service location among the deployed locations to minimize latency.
To minimize latency, each user center is served from the nearest web service location among the set of deployed locations. \( R_{ki} \) represents the minimal response time incurred when web service \( W_i \) is accessed by user center \( U_k \) and is calculated as follows.
\[
R_{ki} = \min \{l_{kj} | X_{ij} = 1 \text{ and } j \in \{1, \ldots, n\}\} \quad (5)
\]
As the dimensions of the service location matrix \( X \) is \( s \times n \) and each entry takes a binary value 0 or 1, the size of the search space for WSLAP is \( 2^{s \times n} \).
A solution of WSLAP is a tuple \((a, b)\), where \( a \) represents the total deployment cost \((f_1)\) and \( b \) represents the total latency \((f_2)\). A solution \( \theta_i = (a_i, b_i) \) is said to dominate solution \( \theta_j = (a_j, b_j) \), if \( \theta_i \) is at least as good as \( \theta_j \) in one objective and strictly better in the other objective.
- \( a_i \leq a_j \) and \( b_i \leq b_j \) or
- \( a_i \leq a_j \) and \( b_i < b_j \)
A solution \( \theta^* \) is referred to as Pareto-optimal if it is not dominated by any other solution. A multi-objective optimization problem typically has many Pareto-optimal (non-dominated) solutions.
**Locations**: In the original problem, a web service can be deployed in at most \( n \) locations. If the candidate locations are cloud regions, then the value of \( n \) is typically 50 (e.g., Microsoft Azure). If multiple cloud providers are considered, then the value of \( n \) easily exceeds 100. Solving WSLAP could generate many solutions where each service is deployed in a large number of locations. In practice, a web service provider might consider deploying its web service \( W_i \) in at most \( d_i \) locations \((d_i << n)\). Therefore, to accommodate this upper bound \( d_i \), we change the WSLAP constraint given in equation (3) as follows:
\[
1 \leq \sum_{j=1}^{n} X_{ij} \leq d_i \quad d_i \leq n \quad \forall i \in \{1, \ldots, s\} \quad (6)
\]
If we set \( d_i \) to be \( n \), then the problem becomes equivalent to the original WSLAP.
3 OUR APPROACH
We show that WSLAP with the aforementioned characteristics can be tackled efficiently using a D&C approach. The steps involved in our D&C approach is as follows:
1. Decompose WSLAP into \( s \) subproblems, one for each web service.
2. Solve each subproblem independently using MOEAs.
3. Merge solutions of all subproblems.
In the rest of the section, first, we prove that WSLAP can be decomposed into s sub-problems, where s is the number of unique web services, and each sub-problem can be solved independently. Later, we give a novel space and time efficient merge algorithm for combining non-dominated solutions of each sub-problem to obtain non-dominated solutions for the original WSLAP problem.
**Theorem 1.** The multi-objective service location allocation problem (WSLAP) comprising of s web services can be decomposed into s sub-problems, one corresponding to each web service.
We can re-write the first objective of WSLAP given in equations (1) as follows:
\[
f_1 = \left( \sum_{j=1}^{n} C_{ij} \cdot X_{ij} \right) + \left( \sum_{j=1}^{n} C_{j2} \cdot X_{j2} \right) + \ldots + \left( \sum_{j=1}^{n} C_{xn} \cdot X_{xn} \right)
\]
where, \( f_1 \) denotes the deployment cost of service \( W_i \).
Similarly, we can re-write the second objective as follows:
\[
f_3 = \left( \sum_{j=1}^{m} R_{kj} \cdot F_{kj} \right) + \left( \sum_{j=1}^{m} R_{k2} \cdot F_{k2} \right) + \ldots + \left( \sum_{j=1}^{m} R_{kn} \cdot F_{kn} \right)
\]
where, \( f_3 \) denotes the latency of service \( W_i \).
Grouping the corresponding terms in equations (9), (12) and (13), we can model and solve the location allocation problem for each web service independently.
**Corollary 1.** If a solution \((f_1, f_3)\) for web service \( W_i \) is not Pareto-optimal then the corresponding solution \((f_1, f_3)\) to the original problem WSLAP is also not Pareto-optimal.
By Theorem 1, the solution \((f_1, f_3)\) to WSLAP is computed using solution obtained for each web service. Therefore, we have:
\[
f_1 = f_{11} + f_{12} + \ldots + f_{1i} + \ldots + f_{1s} \\
f_3 = f_{31} + f_{32} + \ldots + f_{3i} + \ldots + f_{3s}
\]
Since the solution \((f_1, f_3)\) corresponding to web service \( W_i \) is not Pareto-optimal, there exists a better solution \((f_1^*, f_3^*)\) which dominates it. Assume that \( f_{1i} \leq f_{1} \) and \( f_{3i} < f_{3} \). Therefore, the new solution \((f_1^*, f_3^*)\) to the original WSLAP problem can be computed as follows:
\[
f_1' = f_{11} + f_{12} + \ldots + f_{1i} + \ldots + f_{1s} \leq f_1 \\quad f_3' = f_{31} + f_{32} + \ldots + f_{3i} + \ldots + f_{3s} < f_3
\]
As \((f_1, f_3)\) is dominated by \((f_1^*, f_3^*)\), it cannot be Pareto-optimal. Note: Similar argument can be made for the case of \( f_{1i} < f_{1} \) and \( f_{3i} \leq f_{3} \).
**Corollary 2.** If the relative invocation frequency and the deployment cost of a web service \( W_i \) is the same as that of another web service \( W_{i'} \), then the solution for \( W_{i'} \) can be obtained using solutions for \( W_i \) and vice versa.
Consider the relative invocation frequency of service \( W_i \) for \( m \) user centers, that is:
\[
F_i = \sum_{k=1}^{m} F_{ki} = \sum_{k=1}^{m} F_{k1} = \cdots = \sum_{k=1}^{m} F_{kn}
\]
Similarly, consider the relative invocation frequency of service \( W_{i'} \):
\[
F_{i'} = \sum_{k=1}^{m} F_{k'i'} = \sum_{k=1}^{m} F_{k'i1} = \cdots = \sum_{k=1}^{m} F_{kn}
\]
We are given that the relative invocation frequency and cost of both services are the same. Hence, we have:
\[
F_{ki} = \sum_{k=1}^{m} F_{k'i} = \sum_{k=1}^{m} F_{k'1} = \cdots = \sum_{k=1}^{m} F_{kn}
\]
Let \( \sum_{k=1}^{m} F_{ki} = z \cdot \sum_{k=1}^{m} F_{kg} \)
Therefore, we have:
\[
F_{ki} = z \cdot F_{kg} \quad \forall k \in \{1, \ldots, m\}
\]
Let \( \sum_{k=1}^{m} F_{ki} = z \cdot \sum_{k=1}^{m} F_{kg} \)
Therefore, there exists a solution \((f_{1k}, f_{3k})/z\) for \( W_{i'} \) that dominates \((f_{1k}, f_{3k})\) hence, the contradiction.
Once a web service \( W_i \) is located, allocation of user centers is relatively easy. Each user center is allocated to the nearest web service location. Therefore, search space for location allocation of a web service is \( \sum_{i=1}^{d_{i}} \binom{n}{i} \). After obtaining non-dominated solutions to each web service, we need to combine them to find the non-dominated solutions for the original problem. Let the set of non-dominated solutions for each web service \( W_i \) be denoted by \( S_i \). Therefore, the total solution space of WSLAP is:
\[
\text{search space} = \sum_{i=1}^{d_{i}} \binom{n}{i} + \sum_{i=1}^{s} |S_i|
\]
web service, find non-dominated solutions to each sub-problem (web service) and finally merge the solutions of all sub-problems to obtain solutions to the original problem (WSLAP). The major benefits of using D&C approach for WSLAP are as follows:
1. **Efficiency**: Each sub-problem is relatively smaller and independent, hence can be solved in parallel. The existing approaches proposed in the literature [6][7][3] do not exploit these characteristics and attempt to solve the problem in its entirety.
2. **Incremental**: If a new web service is added to the existing problem, then the previously proposed techniques [6][7][3] need to resolve the entire problem from scratch. With the D&C approach, we only need to find location-allocation for the new web service and merge the resulting solutions with the existing solutions. Thus, the proposed approach is incremental.
3. **Reuse**: In some applications, it is likely that the invocation frequency and deployment cost of few web services are the same. With the D&C approach, we only need to find solutions for one such web service (Corollary 2).
The pseudocode of our D&C approach is depicted in Algorithm 1. First, we obtain a set of non-dominated solutions $S_i$ for each web service $W_i$ using evolutionary algorithms described in the next section (lines 4-6). The resulting sets of non-dominated solutions $(S_1, S_2, \ldots, S_k)$ are then combined using the Merge procedure (line 7). The merge algorithm is iterative and starts by combining non-dominated solutions of the first two web services which are then combined with non-dominated solutions of the third web service and so on (lines 13-16). The Combine procedure consists of three main steps. First, it adds non-dominated solutions of two sub-problems $E_1$ and $E_2$ in all possible ways (lines 23-29). The resulting set of solutions $E = \{(a+c,b+d) | (a,b) \in E_1 \text{ and } (c,d) \in E_2\}$ is of size $|E_1| \cdot |E_2|$. Second, it sorts set $E$ by the first objective in ascending order. Third, it uses Kung’s et al. Front method [10] which is a recursive procedure to find non-dominated solutions from the input set $E$.
**Theorem 2.** The Merge procedure takes as input a list of non-dominated solution sets $S_1, S_2, \ldots, S_k$, where $S_i$ is a solution set for $i^{th}$ sub-problem, and computes the set of non-dominated solutions $S$ to the original problem.
We prove the correctness of Merge procedure using a loop invariant [11]. The loop invariant is at the start of $i^{th}$ iteration where set $S$ contains non-dominated solutions to the first $i-1$ sub-problems. **Initialization.** Before the loop starts, set $S$ is initialized to the set $S_1$ of non-dominated solutions for the first sub-problem (line 13). Hence, at the start of the loop, when the value of $i$ is 2, $S = S_1$. Therefore, the loop invariant initially holds.
**Maintenance.** Suppose that the invariant holds at the beginning of iteration $i$, that is, $S$ contains non-dominated solutions to the first $i-1$ sub-problems. The Combine procedure is called to merge solutions of the first $i-1$ sub-problems with solution set $S_i$ of the $i^{th}$ sub-problem (line 15). The procedure begins by adding non-dominated solutions in two sets $S$ and $S_j$ in all possible ways (lines 23-29) and creates a new set $E = \{(a+c,b+d) | (a,b) \in S \text{ and } (c,d) \in S_j\}$. Then, it sorts set $E$ by first objective in ascending order (line 30) and calls Kung’s et al. Front method [10] to find the set of non-dominated solutions $N$ in $E$ (line 31). The set $N$ is returned and assigned to $S$. The set $S$ now contains non-dominated solutions to the first $i$ sub-problems and, therefore, the invariant holds at the end of the iteration as well.
**Termination.** The loop terminates when $i = s + 1$. Thus, from the invariant, $S$ contain non-dominated solutions to all $s$ sub-problems and hence to the original problem.
We note that the Combine procedure given in Algorithm 1 requires $O(|E_1| \cdot |E_2|)$ space to store all possible solutions (lines 24-29) and $O(|E_1| \cdot |E_2| \cdot \log(|E_1| \cdot |E_2|))$ time for sorting all possible solutions (line 30). However, the number of non-dominated solutions could be much less than $|E_1| \cdot |E_2|$. In the next section, we give a space and time efficient method to combine non-dominated solutions of two sub-problems.
**3.1 Novel Combine Algorithm**
Consider two sub-problems $P_1$ and $P_2$. Suppose that $P_1$ has $r$ unique non-dominated solutions $E_1 = \{(a_1, b_1), \ldots, (a_r, b_r)\}$ and $P_2$ has $t$ unique non-dominated solutions $E_2 = \{(c_1, d_1), \ldots, (c_t, d_t)\}$, where $r \leq t$. We consider only unique solutions to avoid redundant computations. Further, assume that each solution set is sorted in ascending order by first objective $i.e., a_1 < a_2 < \ldots < a_r$ and $c_1 < c_2 < \ldots < c_t$. Adding solutions in sets $E_1$ and $E_2$ in all possible ways yields a solution set $E$ consisting of $r \cdot t$ tuples as shown in Figure 1.
**Theorem 3.** Consider a solution tuple $(a_i + c_j, b_i + d_j) \in E$. It cannot dominate or be dominated by tuples $(a_k + c_j, b_k + d_j)$, where $(k \leq i \text{ and } l \leq j)$ or $(k \geq i \text{ and } l \geq j)$.
Since all solutions in $E_1$ are unique, non-dominated and arranged in increasing order of the first objective $f_1$, they must be in decreasing order of the second objective $f_2$. Similar is the case with solutions in $E_2$.
Since $a_k < a_i$ and $b_j > b_i$ for $k < i$, and $c_l < c_j$ and $d_j > d_j$ for $l < j$.
---
**Algorithm 1 D&C Algorithm**
1. procedure DivideAndConquer
2. Input: Frequency matrix $F_{max}$, Cost matrix $C_{max}$ and Latency matrix $L_{max}$
3. Output: A set of non-dominated solutions $S$ to WSLAP
4. for $i = 1$ to $s$ do
5. $S_i = \text{Solve}(F[1 \cdot m][i], C[i], L)$
6. end for
7. Merge($S_1, S_2, \ldots, S_s$)
8. end procedure
9. procedure Merge
10. Input: A set of non-dominated solutions $S_i$ for each of the $s$ web services
11. Output: A set of non-dominated solutions $S$ to WSLAP
12. $S = S_1$
13. for $i = 2$ to $s$ do
14. $S = \text{Combine}(S, S_i)$
15. end for
16. return $S$
17. end procedure
18. procedure Combine
19. Input: Two sets of non-dominated solutions $E_1$ and $E_2$
20. Output: A set of non-dominated solutions in the combined set $E = \{(a + c, b + d) | (a,b) \in E_1 \text{ and } (c,d) \in E_2\}$
21. $E = \emptyset$
22. for $x = 1$ to $|E_1|$ do
23. for $y = 1$ to $|E_2|$ do
24. $s = (a_x + c_y, b_x + d_y)$
25. if $(a_x + c_y, b_x + d_y) \in E_1 \times E_2$ then
26. $E \leftarrow E \cup \{(a_x + c_y, b_x + d_y)\}$
27. end if
28. end for
29. end for
30. sort tuples in $E$ by first objective in ascending order
31. return $\text{Front}(E)$
32. end procedure
---
1349
Algorithm 2 which generates \( d_l \) or \( (a, b) \), the row index of recently removed tuple (from min-heap) for each \( f_l \) when \( \text{fla} \) is inspected. Similarly, to generate the solution in the row \( j \) and column \( i \) of the tuples dominated by \( a \) and \( b \), we need to check if the solution left to it (column \( i - 1 \)) is already removed from the min-heap (lines 17-19). For this, the \((i+1)\)th entry in \( \text{flag} \) array is inspected. Similarly, to generate the solution in the row \( j \) and column \( i \), we need to check if the solution above it (row \( j - 1 \)) is already removed from the min-heap (lines 20-23). For this, the \((i-1)\)th entry in \( \text{flag} \) array is inspected. This entire process repeats until all \( r \times t \) solutions are generated. In the end, the stack \( N \) contains the set of non-dominated solutions to the combined problem which is returned to the calling function (line 24).
Figure 1: Two sets \( E_1 \) and \( E_2 \) of non-dominated solutions containing \( r \) and \( t \) tuples respectively, and their combination \( E \) consisting of \( r \times t \) candidate solutions.
\[
l < j, \text{ we have} \\
ak + cl < a_i + c_j, b_k + dl > b_i + d_j \quad (15)
\]
The above inequality holds even when \( k = i \) (and \( l < j \)) or \( l = j \) (and \( k < i \)). Hence, \( (a_1 + c_j, b_1 + d_j) \) cannot dominate or be dominated by \( (a_k + c_i, b_k + d_k) \), where \( k \leq i \) and \( l \leq j \).
Similarly, \( a_i > a_j \) and \( b_k < b_i \) for \( k > i \), and \( c_i > c_j \) and \( d_k < d_j \) for \( l > j \). Hence, we have
\[
ak + c_i > a_i + c_j, b_k + d_i < b_i + d_j \quad (16)
\]
The above inequality holds even when \( k = i \) (and \( l > j \)) or \( l = j \) (and \( k > i \)). Hence, \( (a_1 + c_j, b_1 + d_j) \) cannot dominate or be dominated by \( (a_k + c_i, b_k + d_i) \), where \( k \geq i \) and \( l \geq j \). Thus, the proof.
Consider a solution \( (a_3 + c_2, b_3 + d_2) \in E \) which is highlighted in green in Figure 1c. The theorem implies that all solution tuples that lie to the top-left (shaded in cyan) of \((a_3 + c_2, b_3 + d_3)\) are better in the first objective but worse in the second objective. Similarly, all solution tuples that lie to the bottom right (shaded in yellow) are better in the second objective but worse in the first objective. Therefore, \((a_3 + c_2, b_3 + d_3)\) need not be compared with these solutions.
Based on this observation, we propose an iterative procedure CombineEff (Algorithm 2) which generates \( |E| = r \times t \) solution tuples strategically to avoid unnecessary comparisons and returns a set of non-dominated solutions \( N \subseteq E \). The strategy is to generate a solution tuple \((a_1 + c_j, b_1 + d_1)\) only if the left tuple \((a_{i-1} + c_j, b_{i-1} + d_1)\) and the top tuple \((a_1 + c_{j-1} + b_{1} + d_{j-1})\) have already been generated and compared with the existing non-dominated solutions. The new procedure uses two data structures, min-heap \( H \) and stack \( N \). The generated solutions are stored temporarily in the min-heap. The solutions that are confirmed to be non-dominated are removed from the min-heap and stored in the stack. The value of first objective \( f_1 \) is used as key of min-heap. If two tuples have the same key (\( f_1 \) value), then they are compared using the second objective \( f_2 \).
We imagine all possible solutions being arranged in a \( t \times r \) table (as shown in Figure 1c) and identify each solution tuple using a row number and column number. An integer array \( \text{flag} \) of size \( r \) stores the row index of recently removed tuple (from min-heap) for each column.
Algorithm 2 proceeds as follows. Initially, the stack \( N \) contains a dummy solution \((0, \infty)\) (lines 4-5). The first tuple \((a_1 + c_j, b_1 + d_1)\) is generated and added to the min-heap \( H \) since its \( f_1 \) value is the lowest (lines 6-7). At the start of each iteration, the tuple \( \text{min} = (f_1, f_2) \) is removed from the root node (line 10). Its \( f_2 \) value is compared with \( f_2 \) value of solution at the top of the stack \( N \). If the value is smaller, then the solution \( \text{min} \) is pushed in the stack (lines 11-13). Note that, solutions are removed from the heap in the increasing order of first objective \( f_1 \). If \( f_1 \) value of \( \text{min} \) is equal to \( f_1 \) value of solution at the top of the stack, then \( f_2 \) value of \( \text{min} \) must be less than the \( f_2 \) value of top solution.
Assume that the solution \( \text{min} \) belongs to row \( j \) and column \( i \) in the solution table of size \( t \times r \) (Figure 1c). The \( i^{th} \) entry in \( \text{flag} \) is updated with the row number \( j \) since it is the most recent solution in column \( i \) which is removed from the min-heap (line 16).
Theorem 4. The memory requirement of the CombineEff procedure is \( O(r) + |N| \), where \( r = |E_1| \) and \( N \subseteq E \) is the set of non-dominated solutions to the combined problem.
We claim that the size of the min-heap \( H \) at any point in time during execution never exceeds \( r \). Suppose that the candidate solutions \( E \) to the problem are arranged in \( t \times r \) table as depicted in (Figure 1c). If there are more than \( r \) tuples in min-heap, then by pigeonhole principle at least two tuples, say \( e_u \) and \( e_v \) must belong to the same column. Suppose that \( u < v \) and \( v \) indicates the row numbers of these tuples and let \( u < v \). Then by Theorem 3, \( e_u \) must be smaller than \( e_v \) with respect to the first objective \( f_1 \), i.e., \( e_u, f_1 < e_v, f_1 \) and \( e_u, f_1 \) represents the first objective value of the tuples \( e_u \) and \( e_v \), respectively. However, CombineEff does not generate \( e_u \) until \( e_u \) is removed from the min-heap. Therefore, tuples \( e_u \) and \( e_v \) cannot be present in the min-heap at the same time. Hence, the contradiction.
The size of the integer array \( \text{flag} \) is also \( O(r) \). Further, the stack \( N \) only stores the non-dominated solutions. Therefore, the total memory requirement of the CombineEff procedure is \( O(r) + |N| \), where \( N \subseteq E \) is the set of non-dominated solutions to the combined problem. As the \( for \) loop runs for \( r \times t \) iterations and the maximum amount of work done in each loop is \( O(\log(r)) \) (min-heap operations), the time complexity of the CombineEff procedure is \( O(r \times t \cdot \log(r)) \). Note: Algorithm 2 assumes that solutions in both sets \( E_1 \) and \( E_2 \) are sorted by the first objective. It generates all possible \( r \times t \) solutions in a strategic manner. The same algorithm works well (with minimum modifications) even if we sort solutions by the second objective.
Illustration: Consider two sets of non-dominated solutions \( E_1 \) and \( E_2 \) (sorted by the first objective) given in Table 2. The combined set of solutions \( E \) is also shown in Table 2. The non-dominated solutions are highlighted in bold. Table 3 illustrates the contents of
Algorithm 2 Efficient Algorithm to Combine Non-dominated Solutions of Two Sub-problems
1: procedure CombineEff
2: Input: Two sets of non-dominated solutions $E_1$ and $E_2$. Both sets are sorted by the first objective.
3: Output: A set of non-dominated solutions $N$ in the combined set $E = \{(a + c, b + d)\mid (a, b) \in E_1 \text{ and } (c, d) \in E_2\}$
4: initialize stack $N$
5: $N$.push((0, oo))
6: initialize min heap $H$ of size $r$
7: $H$.add((a1 + c1, b1 + d1))
8: $flag[1] = \text{int}[r]$
9: for $l = 1$ to $r$ do
10: $(f_1, f_2) = H$.remove() // min solution
11: if $f_2 < N.top()$, then
12: $N$.push($f_2$) // increments top and pushes element into stack
13: end if
14: $i = \text{col index of min tuple} (f_1, f_2)$
15: $j = \text{row index of min tuple} (f_1, f_2)$
16: $flag[i] = j$ //update entry in pos $i$ with the row index $j$ of min soln
17: if $i + 1 \leq r$ and $(j + 1 = 1 \text{ or } flag[i + 1] = j + 1)$ then
18: $H$.add($(a_{i+1} + c_j, b_{i+1} + d_j))$ // generate right tuple
19: end if
20: if $j + 1 \leq r$ and $(i + 1 = 1 \text{ or } flag[i + 1] = j + 1)$ then
21: $H$.add($(a_i + c_{j+1}, b_i + d_{j+1}))$ // generate bottom tuple
22: end if
23: end for
24: return solutions in stack $N$
25: end procedure
Table 2: Two sets $E_1$ and $E_2$ of non-dominated solutions each containing four tuples (sorted by the first objective), and their combination $E$ consisting of $4 \times 4 = 16$ candidate solutions. Non-dominated solutions are highlighted in bold.
<table>
<thead>
<tr>
<th>$E_1$</th>
<th>$E_2$</th>
<th>Combined $E$</th>
</tr>
</thead>
<tbody>
<tr>
<td>(1,4)</td>
<td>(2,10)</td>
<td>(3,14)</td>
</tr>
<tr>
<td>(5,3)</td>
<td>(4,7)</td>
<td>(5,11)</td>
</tr>
<tr>
<td>(6,2)</td>
<td>(5,6)</td>
<td>(6,10)</td>
</tr>
<tr>
<td>(13,1)</td>
<td>(7,5)</td>
<td>(8,9)</td>
</tr>
<tr>
<td></td>
<td></td>
<td>(12,8)</td>
</tr>
<tr>
<td></td>
<td></td>
<td>(13,7)</td>
</tr>
<tr>
<td></td>
<td></td>
<td>(20,6)</td>
</tr>
</tbody>
</table>
heap $H$, stack $N$ and array $flag$ during the iterations of Algorithm 2. In the beginning, a dummy entry $(0, oo)$ is added to the stack (line 5). Further, the solution tuple $(1,4)$ from $E_1$ and the solution tuple $(2,10)$ from $E_2$ are combined to produce $(3,14)$ and added to the heap (line 7). Thus, at the start of the first iteration, that is, $l = 1$, heap $H$ contains $(3,14)$. Subsequently, it is removed from the heap and compared with the top element in stack $N$. As the second objective value of the top element is $\infty$, the tuple $(3,14)$ is added to the stack (lines 11-13) and the dummy entry $(0, oo)$ is removed. As the first entry in the first column is generated and removed from the heap, $flag[0]$ is set to 1. Subsequently, the solution tuple $(5,3)$ from $E_1$ and the solution tuple $(2,10)$ from $E_2$ are combined to produce $(7,13)$, and added to the heap (lines 17-19). Similarly, the solution tuple $(1,4)$ from $E_1$ and the solution tuple $(4,7)$ from $E_2$ are combined to obtain $(5,11)$, and added to the heap (lines 20-22). Thus, at the start of the second iteration, that is, $l = 2$, heap $H$ contains $(5,11)$ and $(7,13)$, and stack $N$ contains a non-dominated solution $(3,14)$. In this way, in each iteration, the algorithm removes a tuple from heap $H$, pushes it on stack $N$ if appropriate, and generates at most two new tuples and adds them to heap $H$.
Table 3: Execution of Algorithm 2 on solutions $E_1$ and $E_2$ (Table 2) of two sub-problems (sorted by the first objective).
<table>
<thead>
<tr>
<th>Iter $l$</th>
<th>Heap $H$</th>
<th>Stack $N$</th>
<th>$flag$</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>(3,14)</td>
<td>(0, oo)</td>
<td>[0,0,0,0]</td>
</tr>
<tr>
<td>2</td>
<td>(5,11)(7,13)</td>
<td>(3,14)</td>
<td>[1,0,0,0]</td>
</tr>
<tr>
<td>3</td>
<td>(6,10)(7,13)</td>
<td>(3,14)(5,11)</td>
<td>[2,0,0,0]</td>
</tr>
<tr>
<td>4</td>
<td>(7,13)(8,9)</td>
<td>(3,14)(5,11)(6,10)</td>
<td>[3,0,0,0]</td>
</tr>
<tr>
<td>5</td>
<td>(8,9)(9,10)(8,12)</td>
<td>(3,14)(5,11)(6,10)</td>
<td>[3,1,0,0]</td>
</tr>
<tr>
<td>6</td>
<td>(8,12)(9,10)</td>
<td>(3,14)(5,11)(6,10)(8,9)</td>
<td>[4,0,0,0]</td>
</tr>
<tr>
<td>7</td>
<td>(9,10)(15,11)</td>
<td>(3,14)(5,11)(6,10)(8,9)</td>
<td>[4,1,0,0]</td>
</tr>
<tr>
<td>8</td>
<td>(10,9)(15,11)(10,9)</td>
<td>(3,14)(5,11)(6,10)(8,9)</td>
<td>[4,2,0,0]</td>
</tr>
<tr>
<td>9</td>
<td>(10,9)(15,11)</td>
<td>(3,14)(5,11)(6,10)(8,9)</td>
<td>[4,2,0,0]</td>
</tr>
<tr>
<td>10</td>
<td>(11,8)(15,11)(12,8)</td>
<td>(3,14)(5,11)(6,10)(8,9)</td>
<td>[4,3,2,0]</td>
</tr>
<tr>
<td>11</td>
<td>(12,8)(15,11)</td>
<td>(3,14)...(8,9)(11,8)</td>
<td>[4,3,3,0]</td>
</tr>
<tr>
<td>12</td>
<td>(13,7)(15,11)</td>
<td>(3,14)...(8,9)(11,8)</td>
<td>[4,4,3,0]</td>
</tr>
<tr>
<td>13</td>
<td>(15,11)</td>
<td>(3,14)...(11,8)(13,7)</td>
<td>[4,4,4,0]</td>
</tr>
<tr>
<td>14</td>
<td>(17,8)</td>
<td>(3,14)...(11,8)(13,7)</td>
<td>[4,4,4,1]</td>
</tr>
<tr>
<td>15</td>
<td>(18,7)</td>
<td>(3,14)...(11,8)(13,7)</td>
<td>[4,4,4,2]</td>
</tr>
<tr>
<td>16</td>
<td>(20,6)</td>
<td>(3,14)...(11,8)(13,7)</td>
<td>[4,4,4,3]</td>
</tr>
<tr>
<td>17</td>
<td>(23,4)</td>
<td>(3,14)...(13,7)(20,6)</td>
<td>[4,4,4,4]</td>
</tr>
</tbody>
</table>
3.2 Evolutionary Algorithms
Classical optimization methods typically convert a multi-objective problem to a single objective problem by assigning appropriate weights to each objective. Such methods yield only one Pareto-optimal solution for the given weights. To obtain multiple solutions, they have to be applied many times. On the other hand, evolutionary algorithms are considered to be more effective in solving multi-objective optimization problems since they work with a population of solutions and produce a set of non-dominated solutions in a single simulation run. Several multi-evolutionary algorithms have been proposed in the literature. NSGAI is an extended genetic algorithm that uses the concept of elitism, fast non-dominated sorting and crowding distance (for diversity) to solve multi-objective problems [12]. Recently, a binary particle swarm optimizer BMOPSOCD was proposed to solve WSLAP [3] and was shown to generate better solutions than NSGAI. BMOPSOCD maintains a set of non-dominated solutions in the external archive and uses crowding distance to find diverse solutions. In this work, we make use of NSGAI and BMOPSOCD to find the non-dominated solutions for each web service in WSLAP.
4 EXPERIMENT
We compare the efficacy of the proposed D&C approach with multi-objective evolutionary algorithms (MOEAs) proposed in the literature [3, 6, 7] on test instances of different sizes. Specifically, we consider four algorithms: NSGAI, BMOPSOCD, D&C NSGAI and D&C BMOPSOCD. All algorithms were implemented in Python version 3.7 and the experiments were conducted on a Windows 10 machine with i7-8650U 2.11 GHz processor and 16GB of RAM. We follow the experimental methodology used by [3].
4.1 Test Instances
We conducted experiments with 14 different WSLAP instances described in [3]. The search space of an instance is computed using the number of services and candidate locations \(2^sn\) as shown in Table 4. Since the computation complexity of an instance also depends on the number of user centers, for each search space, the number of user centers is varied. The test instances employ real-world WSdream dataset in obtaining latency numbers. This dataset contains only latencies between candidate locations and user centers, and lacks deployment costs for candidate locations and invocation frequencies for web services. Therefore, to generate a complete test instance, we followed the approach suggested in [3]. We randomly generated the deployment costs for candidate locations according to a normal distribution with a mean of 100 and a standard deviation of 20. We also randomly generated the invocation frequencies for user centers from a uniform distribution between 1 and 120.
Table 4: Different WSLAP Instances Used in Experiments.
<table>
<thead>
<tr>
<th>Instance</th>
<th>Services</th>
<th>Locations</th>
<th>User Centers</th>
<th>Search Space</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>20</td>
<td>5</td>
<td>10</td>
<td>2^100</td>
</tr>
<tr>
<td>2</td>
<td>20</td>
<td>10</td>
<td>10</td>
<td>2^100</td>
</tr>
<tr>
<td>3</td>
<td>50</td>
<td>15</td>
<td>20</td>
<td>2^750</td>
</tr>
<tr>
<td>4</td>
<td>50</td>
<td>15</td>
<td>40</td>
<td>2^750</td>
</tr>
<tr>
<td>5</td>
<td>50</td>
<td>25</td>
<td>20</td>
<td>2^1250</td>
</tr>
<tr>
<td>6</td>
<td>50</td>
<td>25</td>
<td>40</td>
<td>2^1250</td>
</tr>
<tr>
<td>7</td>
<td>100</td>
<td>15</td>
<td>20</td>
<td>2^1500</td>
</tr>
<tr>
<td>8</td>
<td>100</td>
<td>15</td>
<td>40</td>
<td>2^1500</td>
</tr>
<tr>
<td>9</td>
<td>100</td>
<td>25</td>
<td>20</td>
<td>2^2500</td>
</tr>
<tr>
<td>10</td>
<td>100</td>
<td>25</td>
<td>40</td>
<td>2^2500</td>
</tr>
<tr>
<td>11</td>
<td>200</td>
<td>25</td>
<td>40</td>
<td>2^5000</td>
</tr>
<tr>
<td>12</td>
<td>200</td>
<td>25</td>
<td>80</td>
<td>2^5000</td>
</tr>
<tr>
<td>13</td>
<td>200</td>
<td>40</td>
<td>40</td>
<td>2^5000</td>
</tr>
<tr>
<td>14</td>
<td>200</td>
<td>40</td>
<td>80</td>
<td>2^5000</td>
</tr>
</tbody>
</table>
4.2 Performance Metrics
We use HyperVolume (HV) [14, 15] and Inverted Generational Distance (IGD) [16] to evaluate the diversity and quality of solutions produced by four algorithms (NSGAI, BMOPSOCD, D&C NSGAII and D&C BMOPSOCD). HV is a measure that reflects the volume enclosed by a solution set and a reference point. A larger HV value indicates a better quality solution set. However, for calculating the HV value, we need a true Pareto front, and for our problem, the true Pareto front is unknown. Therefore, as discussed in [3], we computed an approximated Pareto front by combining all solutions produced by four algorithms and then applying a non-dominated sorting to obtain the final non-dominated set.
4.3 Parameter Settings
The parameter values used for each algorithm considered in the evaluation are shown in Table 5. We found the parameter values for NSGAI algorithm empirically, that is, we tried several values for parameters, and observed whether the solutions have converged (have similar fitness values between two consecutive generations). We used the same values of crossover probability (0.8) and mutation probability (0.2) for D&C NSGAII. The size of a chromosome used for NSGAII is \(s \cdot n\), where \(s\) is the number of web services and \(n\) is the number of candidate locations. Since D&C NSGAII, solves the location allocation for each web service independently, the size of a chromosome, in this case, is just \(n\). As the search space of NSGAII is larger \(2^sn\), we used a population size of 250. As the search space of D&C NSGAII is smaller \(2^n\), we used a smaller population size of 20. Note that, our study focuses on the effectiveness of D&C approach instead of selecting the best parameter set.
For BMOPSOCD algorithm, we used the parameter values as described in [3]. The value of static inertia weight \(w\) was set to 0.4 and the mutation probability \(\rho_m\) was set to 0.5. The parameters \(c_1\) and \(c_2\) were both set to 1. Hence, particle’s personal best and swarm’s global best had an equal influence on the swarm.
Table 5: Parameters Choice for the Four Algorithms.
<table>
<thead>
<tr>
<th>Parameter</th>
<th>NSGAII</th>
<th>D&C NSGAII</th>
<th>BMOPSOCD</th>
<th>D&C BMOPSOCD</th>
</tr>
</thead>
<tbody>
<tr>
<td>Population size</td>
<td>250</td>
<td>20</td>
<td>250</td>
<td>20</td>
</tr>
<tr>
<td>Chromosome size</td>
<td>(s \cdot n)</td>
<td>(n)</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Tournament size</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>Crossover probability</td>
<td>0.8</td>
<td>0.8</td>
<td>0.8</td>
<td>0.8</td>
</tr>
<tr>
<td>Mutation probability</td>
<td>0.2</td>
<td>0.2</td>
<td>0.2</td>
<td>0.2</td>
</tr>
<tr>
<td>Maximum generations</td>
<td>250</td>
<td>40</td>
<td>250</td>
<td>40</td>
</tr>
</tbody>
</table>
We normalized two objective functions (latency and cost) between 0 and 1. The point (1, 1) is the extreme point of objective values. We used (1, 1) as the reference point in calculating HV. For each experiment, the proposed algorithm was run ten times independently. The best results of all the runs were compared. To obtain the best result of ten runs, the results of all ten runs were combined and sorted by the non-dominated values.
4.4 Results
Figure 2a depicts the set of non-dominated solutions produced by the four algorithms for one of the instances (Instance 3). For better clarity, we have shown the closer view of the non-dominated solutions obtained for the instance in figure 2b. The figure clearly shows that D&C NSGAII and D&C BMOPSOCD are able to find better and diverse solutions than NSGAII and BMOPSOCD. Similar trends were observed for other instances. Although NSGA-II and
BMOPSOCD have longer tails (i.e., many solutions with cost > 0.5) than D&C NSGAI and D&C BMOPSOCD, the solutions present in the tails are dominated by the solutions of the D&C algorithms. Table 6 shows HV values and Table 7 shows IGD values (all values are rounded to two decimal places) calculated using non-dominated solutions obtained by each algorithm for all fourteen instances. A larger HV value indicates a better and diverse solution set. A lower IGD value indicates a better quality solution set. From the Tables 6 and 7, it is clear that solutions obtained using the D&C approach are much better than the ones obtained using the combined approach in terms of quality as well as diversity. Overall, D&C BMOPSOCD produced better solutions than the other three algorithms. Further, as observed in [3], BMOPSOCD produced better results than NSGAI. However, D&C NSGAI resulted in better solutions than BMOPSOCD.
Table 6: HV Values from the Four Algorithms
<table>
<thead>
<tr>
<th>Instance</th>
<th>NSGA II Mean</th>
<th>NSGA II Std</th>
<th>D&C NSGA II Mean</th>
<th>D&C NSGA II Std</th>
<th>BMOPSOCD Mean</th>
<th>BMOPSOCD Std</th>
<th>D&C BMOPSOCD Mean</th>
<th>D&C BMOPSOCD Std</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>0.72</td>
<td>0.03</td>
<td>0.82</td>
<td>0.01</td>
<td>0.78</td>
<td>0.01</td>
<td>0.90</td>
<td>0.00</td>
</tr>
<tr>
<td>2</td>
<td>0.68</td>
<td>0.07</td>
<td>0.92</td>
<td>0.00</td>
<td>0.89</td>
<td>0.01</td>
<td>0.96</td>
<td>0.00</td>
</tr>
<tr>
<td>3</td>
<td>0.55</td>
<td>0.09</td>
<td>0.95</td>
<td>0.00</td>
<td>0.89</td>
<td>0.01</td>
<td>0.97</td>
<td>0.00</td>
</tr>
<tr>
<td>4</td>
<td>0.56</td>
<td>0.09</td>
<td>0.95</td>
<td>0.00</td>
<td>0.90</td>
<td>0.01</td>
<td>0.97</td>
<td>0.00</td>
</tr>
<tr>
<td>5</td>
<td>0.54</td>
<td>0.10</td>
<td>0.97</td>
<td>0.00</td>
<td>0.93</td>
<td>0.01</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>6</td>
<td>0.55</td>
<td>0.10</td>
<td>0.97</td>
<td>0.00</td>
<td>0.93</td>
<td>0.00</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>7</td>
<td>0.54</td>
<td>0.09</td>
<td>0.95</td>
<td>0.00</td>
<td>0.86</td>
<td>0.01</td>
<td>0.97</td>
<td>0.00</td>
</tr>
<tr>
<td>8</td>
<td>0.55</td>
<td>0.09</td>
<td>0.95</td>
<td>0.00</td>
<td>0.87</td>
<td>0.01</td>
<td>0.97</td>
<td>0.00</td>
</tr>
<tr>
<td>9</td>
<td>0.54</td>
<td>0.10</td>
<td>0.97</td>
<td>0.00</td>
<td>0.90</td>
<td>0.01</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>10</td>
<td>0.54</td>
<td>0.10</td>
<td>0.96</td>
<td>0.00</td>
<td>0.91</td>
<td>0.01</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>11</td>
<td>0.51</td>
<td>0.00</td>
<td>0.96</td>
<td>0.00</td>
<td>0.88</td>
<td>0.01</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>12</td>
<td>0.51</td>
<td>0.00</td>
<td>0.96</td>
<td>0.00</td>
<td>0.89</td>
<td>0.01</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>13</td>
<td>0.51</td>
<td>0.00</td>
<td>0.95</td>
<td>0.00</td>
<td>0.92</td>
<td>0.00</td>
<td>0.98</td>
<td>0.00</td>
</tr>
<tr>
<td>14</td>
<td>0.51</td>
<td>0.00</td>
<td>0.94</td>
<td>0.00</td>
<td>0.92</td>
<td>0.00</td>
<td>0.98</td>
<td>0.00</td>
</tr>
</tbody>
</table>
Table 7: IGD Values from the Four Algorithms
<table>
<thead>
<tr>
<th>Instance</th>
<th>NSGA II Mean</th>
<th>NSGA II Std</th>
<th>D&C NSGA II Mean</th>
<th>D&C NSGA II Std</th>
<th>BMOPSOCD Mean</th>
<th>BMOPSOCD Std</th>
<th>D&C BMOPSOCD Mean</th>
<th>D&C BMOPSOCD Std</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>0.19</td>
<td>0.02</td>
<td>0.14</td>
<td>0.00</td>
<td>0.15</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>2</td>
<td>0.17</td>
<td>0.04</td>
<td>0.07</td>
<td>0.00</td>
<td>0.07</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>3</td>
<td>0.34</td>
<td>0.07</td>
<td>0.05</td>
<td>0.01</td>
<td>0.09</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>4</td>
<td>0.25</td>
<td>0.05</td>
<td>0.04</td>
<td>0.01</td>
<td>0.05</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>5</td>
<td>0.32</td>
<td>0.07</td>
<td>0.03</td>
<td>0.01</td>
<td>0.04</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>6</td>
<td>0.30</td>
<td>0.07</td>
<td>0.03</td>
<td>0.00</td>
<td>0.04</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>7</td>
<td>0.39</td>
<td>0.07</td>
<td>0.08</td>
<td>0.01</td>
<td>0.13</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>8</td>
<td>0.26</td>
<td>0.05</td>
<td>0.04</td>
<td>0.01</td>
<td>0.07</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>9</td>
<td>0.28</td>
<td>0.06</td>
<td>0.03</td>
<td>0.00</td>
<td>0.04</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>10</td>
<td>0.30</td>
<td>0.06</td>
<td>0.04</td>
<td>0.01</td>
<td>0.05</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>11</td>
<td>0.27</td>
<td>0.01</td>
<td>0.04</td>
<td>0.01</td>
<td>0.05</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>12</td>
<td>0.26</td>
<td>0.01</td>
<td>0.04</td>
<td>0.00</td>
<td>0.05</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>13</td>
<td>0.30</td>
<td>0.01</td>
<td>0.04</td>
<td>0.01</td>
<td>0.04</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>14</td>
<td>0.28</td>
<td>0.01</td>
<td>0.04</td>
<td>0.01</td>
<td>0.03</td>
<td>0.01</td>
<td>0.00</td>
<td>0.00</td>
</tr>
</tbody>
</table>
Figure 2: a) Pareto fronts obtained from the four algorithms for instance 3 (50,15,20). b) Closer view of the pareto fronts.
5 CONCLUSION AND FUTURE WORK
In this paper, we show that WSLAP can be solved effectively using a Divide and Conquer (D&C) approach; wherein, the location-allocation problem is solved independently for each web service. Further, we propose a novel merge algorithm to combine the solution from each service. We used NSGA-II and BMOPSOCD to compute the Pareto front for each service. We compared performance of both the algorithm with and without D&C approach. Our extensive experiments showed that the D&C approach is able to produce better quality (lower Inverted Generational Distance) and diverse solutions (higher HyperVolume) than solving the WSLAP as one problem. The computational time is also less for D&C approach.
Further, the computational time can be significantly reduced by exploiting the parallelization capability of the proposed algorithm to merge the non-dominated solutions of multiple services simultaneously. Specifically, we can generate solutions for each service in parallel, and, during merge, we could do pairwise merges in parallel going all the way up the complete binary tree. Since the proposed merge algorithm is generic, we plan to study the effectiveness of the algorithm for other bi-objective optimization problems.
REFERENCES
|
{"Source-Url": "http://www.cmap.polytechnique.fr/~nikolaus.hansen/proceedings/2021/GECCO/companion/companion_files/p1346-tupsamudre.pdf", "len_cl100k_base": 15880, "olmocr-version": "0.1.50", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 41379, "total-output-tokens": 17083, "length": "2e13", "weborganizer": {"__label__adult": 0.0003933906555175781, "__label__art_design": 0.0005726814270019531, "__label__crime_law": 0.0004987716674804688, "__label__education_jobs": 0.0017871856689453125, "__label__entertainment": 0.00016248226165771484, "__label__fashion_beauty": 0.00023853778839111328, "__label__finance_business": 0.0012655258178710938, "__label__food_dining": 0.0004696846008300781, "__label__games": 0.0010385513305664062, "__label__hardware": 0.0013866424560546875, "__label__health": 0.001033782958984375, "__label__history": 0.000621795654296875, "__label__home_hobbies": 0.00014495849609375, "__label__industrial": 0.0006747245788574219, "__label__literature": 0.0004987716674804688, "__label__politics": 0.0004954338073730469, "__label__religion": 0.0005249977111816406, "__label__science_tech": 0.349853515625, "__label__social_life": 0.00014841556549072266, "__label__software": 0.0174560546875, "__label__software_dev": 0.619140625, "__label__sports_fitness": 0.00037789344787597656, "__label__transportation": 0.000927448272705078, "__label__travel": 0.0002956390380859375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 53137, 0.07296]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 53137, 0.16941]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 53137, 0.84053]], "google_gemma-3-12b-it_contains_pii": [[0, 5572, false], [5572, 12095, null], [12095, 16526, null], [16526, 23347, null], [23347, 30576, null], [30576, 36763, null], [36763, 42519, null], [42519, 49615, null], [49615, 53137, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5572, true], [5572, 12095, null], [12095, 16526, null], [16526, 23347, null], [23347, 30576, null], [30576, 36763, null], [36763, 42519, null], [42519, 49615, null], [49615, 53137, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 53137, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 53137, null]], "pdf_page_numbers": [[0, 5572, 1], [5572, 12095, 2], [12095, 16526, 3], [16526, 23347, 4], [23347, 30576, 5], [30576, 36763, 6], [36763, 42519, 7], [42519, 49615, 8], [49615, 53137, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 53137, 0.26724]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
c8a0da6f52802586248bbb145069e38940c08da6
|
CS107, Lecture 10
Introduction to Assembly
Reading: B&O 3.1-3.4
1. **Bits and Bytes** - How can a computer represent integer numbers?
2. **Chars and C-Strings** - How can a computer represent and manipulate more complex data like text?
3. **Pointers, Stack and Heap** – How can we effectively manage all types of memory in our programs?
4. **Generics** - How can we use our knowledge of memory and data representation to write code that works with any data type?
5. **Assembly** - How does a computer interpret and execute C programs?
6. **Heap Allocators** - How do core memory-allocation operations like `malloc` and `free` work?
CS107 Topic 5: How does a computer interpret and execute C programs?
How does a computer interpret and execute C programs?
Why is answering this question important?
- Learning how our code is really translated and executed helps us write better code
- We can learn how to reverse engineer and exploit programs at the assembly level
**assign5:** find and exploit vulnerabilities in an ATM program, reverse engineer a program without seeing its code, and de-anonymize users given a data leak.
Learning Assembly
This Lecture
Moving data around
Lecture 11
Arithmetic and logical operations
Lecture 12
Control flow
Lecture 13
Function calls
Learning Goals
• Learn what assembly language is and why it is important
• Become familiar with the format of human-readable assembly and x86
• Learn the `mov` instruction and how data moves around at the assembly level
Lecture Plan
- **Overview**: GCC and Assembly
- **Demo**: Looking at an executable
- Registers and The Assembly Level of Abstraction
- The `mov` Instruction
```bash
cp -r /afs/ir/class/cs107/lecture-code/lect10 .
```
Lecture Plan
• Overview: GCC and Assembly
• Demo: Looking at an executable
• Registers and The Assembly Level of Abstraction
• The mov Instruction
```bash
cp -r /afs/ir/class/cs107/lecture-code/lect10 .
```
Bits all the way down
Data representation so far
• Integer (unsigned int, 2’s complement signed int)
• char (ASCII)
• Address (unsigned long)
• Aggregates (arrays, structs)
The code itself is binary too!
• Instructions (machine encoding)
GCC
• **GCC** is the compiler that converts your human-readable code into machine-readable instructions.
• C, and other languages, are high-level abstractions we use to write code efficiently. But computers don’t really understand things like data structures, variable types, etc. Compilers are the translator!
• Pure machine code is 1s and 0s – everything is bits, even your programs! But we can read it in a human-readable form called **assembly**. (Engineers used to write code in assembly before C).
• There may be multiple assembly instructions needed to encode a single C instruction.
• We’re going to go behind the curtain to see what the assembly code for our programs looks like.
Central Processing Units (CPUs)
Intel 8086, 16-bit microprocessor ($86.65, 1978)
Raspberry Pi BCM2836 32-bit ARM microprocessor ($35 for everything, 2015)
Intel Core i9-9900K 64-bit 8-core multi-core processor ($449, 2018)
Why are we reading assembly?
Main goal: Information retrieval
- We will not be writing assembly! (that’s the compiler’s job)
- Rather, we want to translate the assembly back into our C code.
- Knowing how our C code is converted into machine instructions gives us insight into how to write more efficient, cleaner code.
Lecture Plan
• **Overview:** GCC and Assembly
• **Demo:** Looking at an executable
• Registers and The Assembly Level of Abstraction
• The **mov** Instruction
```bash
cp -r /afs/ir/class/cs107/lecture-code/lect10 .
```
Demo: Looking at an Executable (objdump -d)
Our First Assembly
int sum_array(int arr[], int nelems) {
int sum = 0;
for (int i = 0; i < nelems; i++) {
sum += arr[i];
}
return sum;
}
What does this look like in assembly?
int sum_array(int arr[], int nelems) {
int sum = 0;
for (int i = 0; i < nelems; i++) {
sum += arr[i];
}
return sum;
}
0000000000401136 <sum_array>:
401136: b8 00 00 00 00
40113b: ba 00 00 00 00
401140: 39 f0
401142: 7d 0b
401144: 48 63 c8
401147: 03 14 8f
40114a: 83 c0 01
40114d: eb f1
40114f: 89 d0
401151: c3
mov $0x0,%eax
mov $0x0,%edx
cmp %esi,%eax
jge 40114f <sum_array+0x19>
movslq %eax,%rcx
add (%rdi,%rcx,4),%edx
add $0x1,%eax
jmp 401140 <sum_array+0xa>
mov %edx,%eax
retq
make objdump -d sum
Our First Assembly
0000000000401136 <sum_array>:
401136: b8 00 00 00 00 mov $0x0,%eax
40113b: ba 00 00 00 00 mov $0x0,%edx
401140: 39 f0 cmp %esi,%eax
401142: 7d 0b jge 40114f <sum_array+0x19>
401144: 48 63 c8 movslq %eax,%rcx
401147: 03 14 8f add (%rdi,%rcx,4),%edx
40114a: 83 c0 01 add $0x1,%eax
40114d: eb f1 jmp 401140 <sum_array+0xa>
40114f: 89 d0 mov %edx,%eax
401151: c3 retq
This is the name of the function (same as C) and the memory address where the code for this function starts.
Our First Assembly
These are the memory addresses where each of the instructions live. Sequential instructions are sequential in memory.
Our First Assembly
This is the assembly code: “human-readable” versions of each machine code instruction.
```
0000000000401136 <sum_array>:
401136: b8 00 00 00 00 00
40113b: ba 00 00 00 00 00
401140: 39 f0
401142: 7d 0b
401144: 48 63 c8
401147: 03 14 8f
40114a: 83 c0 01
40114d: eb f1
40114f: 89 d0
401151: c3
mov $0x0,%eax
mov $0x0,%edx
cmp %esi,%eax
jge 40114f <sum_array+0x19>
movslq %eax,%rcx
add (%rdi,%rcx,4),%edx
add $0x1,%eax
jmp 401140 <sum_array+0xa>
mov %edx,%eax
retq
```
Our First Assembly
This is the machine code: raw hexadecimal instructions, representing binary as read by the computer. Different instructions may be different byte lengths.
```
00000000000401136 <sum_array>:
401136: b8 00 00 00 00
40113b: ba 00 00 00 00
401140: 39 f0
401142: 7d 0b
401144: 48 63 c8
401147: 03 14 8f
40114a: 83 c0 01
40114d: eb f1
40114f: 89 d0
401151: c3
```
```cpp
mov $0x0,%eax
mov $0x0,%edx
cmp %esi,%eax
jge 40114f <sum_array+0x19>
movslq %eax,%rcx
add (%rdi,%rcx,4),%edx
add $0x1,%eax
jmp 401140 <sum_array+0xa>
mov %edx,%eax
retq
```
Our First Assembly
00000000000401136 <sum_array>:
401136: b8 00 00 00 00 00 mov $0x0,%eax
40113b: ba 00 00 00 00 00 mov $0x0,%edx
401140: 39 f0 cmp %esi,%eax
401142: 7d 0b jge 40114f <sum_array+0x19>
401144: 48 63 c8 movslq %eax,%rcx
401147: 03 14 8f add (%rdi,%rcx,4),%edx
40114a: 83 c0 01 add $0x1,%eax
40114d: eb f1 jmp 401140 <sum_array+0xa>
40114f: 89 d0 mov %edx,%eax
401151: c3 retq
Our First Assembly
0000000000401136 <sum_array>:
```
401136: b8 00 00 00 00 mov $0x0,%eax
40113b: ba 00 00 00 00 mov $0x0,%edx
401140: 39 f0 cmp %esi,%eax
401142: 7d 0b jge 40114f <sum_array+0x19>
401144: 48 63 c8 movslq %eax,%rcx
401147: 03 14 8f add (%rdi,%rcx,4),%edx
40114a: 83 c0 01 add $0x1,%eax
40114d: eb f1 jmp 401140 <sum_array+0xa>
40114f: 89 d0 mov %edx,%eax
401151: c3 retq
```
Each instruction has an operation name ("opcode").
Our First Assembly
```
0000000000401136 <sum_array>:
401136: b8 00 00 00 00 00
mov $0x0,%eax
40113b: ba 00 00 00 00
mov $0x0,%edx
401140: 39 f0
cmp %esi,%eax
401142: 7d 0b
jge 40114f <sum_array+0x19>
401144: 48 63 c8
movslq %eax,%rcx
401147: 03 14 8f
add (%rdi,%rcx,4),%edx
40114a: 83 c0 01
add $0x1,%eax
40114d: eb f1
jmp 401140 <sum_array+0xa>
40114f: 89 d0
mov %edx,%eax
```
Each instruction can also have arguments (“operands”).
Our First Assembly
00000000000401136 <sum_array>:
401136: b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40113b: ba 00 00 00 00 00 00 00 00 00 00 00 00 00 00
401140: 39 f0
401142: 7d 0b
401144: 48 63 c8
401147: 03 14 8f
40114a: 83 c0 01
40114d: eb f1
40114f: 89 d0
401151: c3
mov $0x0,%eax
mov $0x0,%edx
cmp %esi,%eax
jge 40114f <sum_array+0x19>
movslq %eax,%rcx
add (%rdi,%rcx,4),%edx
add $0x1,%eax
jmp 401140 <sum_array+0xa>
mov %edx,%eax
retq
$[number] means a constant value, or “immediate” (e.g. 1 here).
Our First Assembly
0000000000401136 <sum_array>:
401136: b8 00 00 00 00 00
40113b: ba 00 00 00 00 00
401140: 39 f0
401142: 7d 0b
401144: 48 63 c8
401147: 03 14 8f
40114a: 83 c0 01
40114d: eb f1
40114f: 89 d0
401151: c3
mov $0x0,%eax
mov $0x0,%edx
cmp %esi,%eax
jge 40114f <sum_array+0x19>
movslq %eax,%rcx
add (%rdi,%rcx,4),%edx
add $0x1,%eax
jmp 401140 <sum_array+0xa>
mov %edx,%eax
retq
[%[name]] means a register, a storage location on the CPU (e.g. edx here).
• **https://web.stanford.edu/class/cs107/resources/x86-64-reference.pdf**
• **B&O book:**
- Canvas -> Files
-> Bryant_OHallaron_ch3.1-3.8.pdf
• It’s like learning how to read (not speak) a new language! (again!)
Lecture Plan
• **Overview**: GCC and Assembly
• **Demo**: Looking at an executable
• **Registers and The Assembly Level of Abstraction**
• The **mov** instruction
Assembly Abstraction
• C abstracts away the low-level details of machine code. It lets us work using variables, variable types, and other higher-level abstractions.
• C and other languages let us write code that works on most machines.
• Assembly code is just bytes! No variable types, no type checking, etc.
• Assembly/machine code is processor-specific.
• What is the level of abstraction for assembly code?
Registers
%rax
### Registers
<table>
<thead>
<tr>
<th>Register</th>
<th>Diagram</th>
</tr>
</thead>
<tbody>
<tr>
<td>%rax</td>
<td>![rax]</td>
</tr>
<tr>
<td>%rbx</td>
<td>![rbx]</td>
</tr>
<tr>
<td>%rcx</td>
<td>![rcx]</td>
</tr>
<tr>
<td>%rdx</td>
<td>![rdx]</td>
</tr>
<tr>
<td>%rsi</td>
<td>![rsi]</td>
</tr>
<tr>
<td>%rdi</td>
<td>![rdi]</td>
</tr>
<tr>
<td>%rbp</td>
<td>![rbp]</td>
</tr>
<tr>
<td>%rsp</td>
<td>![rsp]</td>
</tr>
<tr>
<td>%r8</td>
<td>![r8]</td>
</tr>
<tr>
<td>%r9</td>
<td>![r9]</td>
</tr>
<tr>
<td>%r10</td>
<td>![r10]</td>
</tr>
<tr>
<td>%r11</td>
<td>![r11]</td>
</tr>
<tr>
<td>%r12</td>
<td>![r12]</td>
</tr>
<tr>
<td>%r13</td>
<td>![r13]</td>
</tr>
<tr>
<td>%r14</td>
<td>![r14]</td>
</tr>
<tr>
<td>%r15</td>
<td>![r15]</td>
</tr>
</tbody>
</table>
What is a register?
A register is a fast read/write memory slot right on the CPU that can hold variable values.
Registers are **not** located in memory.
• A **register** is a 64-bit space inside the processor.
• There are 16 registers available, each with a unique name.
• Registers are like “scratch paper” for the processor. Data being calculated or manipulated is moved to registers first. Operations are performed on registers.
• Registers also hold parameters and return values for functions.
• Registers are extremely *fast* memory!
• Processor instructions consist mostly of moving data into/out of registers and performing arithmetic on them. This is the level of logic your program must be in to execute!
Assembly instructions manipulate these registers. For example:
• One instruction adds two numbers in registers
• One instruction transfers data from a register to memory
• One instruction transfers data from memory to a register
Computer architecture
registers accessed by name
ALU is main workhorse of CPU
memory needed for program execution (stack, heap, etc.) accessed by address
disk/server stores program when not executing
• GCC compiles your program – it lays out memory on the stack and heap and generates assembly instructions to access and do calculations on those memory locations.
• Here’s what the “assembly-level abstraction” of C code might look like:
<table>
<thead>
<tr>
<th>C</th>
<th>Assembly Abstraction</th>
</tr>
</thead>
</table>
| int sum = x + y; | 1) Copy x into register 1
2) Copy y into register 2
3) Add register 2 to register 1
4) Write register 1 to memory for sum |
Assembly
- We are going to learn the x86-64 instruction set architecture. This instruction set is used by Intel and AMD processors.
- There are many other instruction sets: ARM, MIPS, etc.
Instruction set architecture (ISA)
A contract between program/compiler and hardware:
• Defines operations that the processor (CPU) can execute
• Data read/write/transfer operations
• Control mechanisms
Intel originally designed their instruction set back in 1978.
• Legacy support is a huge issue for x86-64
• Originally 16-bit processor, then 32 bit, now 64 bit. These design choices dictated the register sizes (and even register/instruction names).
Lecture Plan
• **Overview:** GCC and Assembly
• **Demo:** Looking at an executable
• Registers and The Assembly Level of Abstraction
• **The mov Instruction**
```bash
cp -r /afs/ir/class/cs107/lecture-code/lect10 .
```
The `mov` instruction copies bytes from one place to another; it is like the assignment operator (=) in C.
\[
\text{mov} \quad \text{src}, \text{dst}
\]
The `src` and `dst` can each be one of:
- Immediate (constant value, like a number) \((\text{only src})\)
\[\$0x104\]
\[%rbx\]
- Register
\[\text{Direct address} \quad 0x6005c0\]
- Memory Location
\((\text{at most one of src, dst})\)
Operand Forms: Immediate
```
mov $0x104,___
```
Copy the value 0x104 into some destination.
Operand Forms: Registers
Copy the value in register %rbx into some destination.
\texttt{mov} %rbx,____
Copy the value from some source into register %rbx.
\texttt{mov} ____,%rbx
Operand Forms: Absolute Addresses
Copy the value at address 0x104 into some destination.
\[
\text{mov} \quad 0x104, \\
\text{mov} \quad \\
\]
Copy the value from some source into the memory at address 0x104.
Practice #1: Operand Forms
What are the results of the following move instructions (executed separately)? For this problem, assume the value 5 is stored at address 0x42, and the value 8 is stored in %rbx.
1. mov $0x42,%rax
2. mov 0x42,%rax
3. mov %rbx,0x55
Operand Forms: Indirect
Copy the value at the address stored in register %rbx into some destination.
```
mov (%rbx),_____
```
Copy the value from some source into the memory at the address stored in register %rbx.
```
mov _____,(%rbx)
```
Operand Forms: Base + Displacement
```
mov 0x10(%rax),_________
```
Copy the value at the address (\texttt{0x10} plus what is stored in register \texttt{%rax}) into some destination.
```
mov __________,0x10(%rax)
```
Copy the value from some source into the memory at the address (\texttt{0x10 plus} what is stored in register \texttt{%rax}).
Operand Forms: Indexed
Copy the value at the address which is (the sum of the values in registers %rax and %rdx) into some destination.
```
mov (%rax,%rdx),__________
```
Copy the value from some source into the memory at the address which is (the sum of the values in registers %rax and %rdx).
```
mov _____________,(%rax,%rdx)
```
Operand Forms: Indexed
Copy the value at the address which is (the sum of 0x10 plus the values in registers %rax and %rdx) into some destination.
```
mov 0x10(%rax,%rdx),_____
```
Copy the value from some source into the memory at the address which is (the sum of 0x10 plus the values in registers %rax and %rdx).
```
mov ________,0x10(%rax,%rdx)
```
Practice #2: Operand Forms
What are the results of the following move instructions (executed separately)? For this problem, assume the value 0x11 is stored at address 0x10C, 0xAB is stored at address 0x104, 0x100 is stored in register %rax and 0x3 is stored in %rdx.
1. `mov $0x42,(%rax)`
2. `mov 4(%rax),%rcx`
3. `mov 9(%rax,%rdx),%rcx`
Imm\( (r_b, r_i) \) is equivalent to address Imm + R\[r_b\] + R\[r_i\]
Operand Forms: Scaled Indexed
Copy the value at the address which
is \(4\ \text{times}\) the value in register
\(\%rdx\) into some destination.
\[
\text{mov} \ (,\%rdx,4),\underline{}\]
Copy the value from some source into the
memory at the address which is \(4\ \text{times}\)
the value in register \(\%rdx\).
\[
\underline{} \ (,\%rdx,4)\]
The scaling factor
(e.g. 4 here) must
be hardcoded to
be either 1, 2, 4
or 8.
Operand Forms: Scaled Indexed
Copy the value at the address which is (4 times the value in register %rdx, plus 0x4), into some destination.
```
mov 0x4(%rdx,4),______
```
Copy the value from some source into the memory at the address which is (4 times the value in register %rdx, plus 0x4).
```
mov ______,0x4(%rdx,4)
```
Operand Forms: Scaled Indexed
Copy the value at the address which is (the value in register %rax plus 2 times the value in register %rdx) into some destination.
\[ \text{mov} \quad (%rax, %rdx, 2), \_\_\_\_\_\_\_\_ \]
Copy the value from some source into the memory at the address which is (the value in register %rax plus 2 times the value in register %rdx).
\[ \text{mov} \quad \_\_\_\_\_\_\_\_\_\_\_, (%rax, %rdx, 2) \]
Operand Forms: Scaled Indexed
Copy the value at the address which is \(0x4\) plus the value in register \(%rax\) plus 2 times the value in register \(%rdx\) into some destination.
```
mov \[0x4(%rax,%rdx,2)],_____
```
Copy the value from some source into the memory at the address which is \(0x4\) plus the value in register \(%rax\) plus 2 times the value in register \(%rdx\).
```
mov ______,\[0x4(%rax,%rdx,2)
```
Most General Operand Form
\[ \text{Imm}(r_b, r_i, s) \]
is equivalent to...
\[ \text{Imm} + R[r_b] + R[r_i]*s \]
**Most General Operand Form**
\[ \text{Imm}(r_b, r_i, s) \text{ is equivalent to address } \text{Imm} + R[r_b] + R[r_i]*s \]
- **Displacement:** pos/neg constant (if missing, = 0)
- **Index:** register (if missing, = 0)
- **Base:** register (if missing, = 0)
- **Scale** must be 1, 2, 4, or 8 (if missing, = 1)
### Operand Forms
<table>
<thead>
<tr>
<th>Type</th>
<th>Form</th>
<th>Operand Value</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>Immediate</td>
<td>$Imm$</td>
<td>Imm</td>
<td>Immediate</td>
</tr>
<tr>
<td>Register</td>
<td>$r_a$</td>
<td>R[$r_a$]</td>
<td>Register</td>
</tr>
<tr>
<td>Memory</td>
<td>Imm</td>
<td>M[Imm]</td>
<td>Absolute</td>
</tr>
<tr>
<td>Memory</td>
<td>($r_a$)</td>
<td>M[R[$r_a$]]</td>
<td>Indirect</td>
</tr>
<tr>
<td>Memory</td>
<td>Imm($r_b$)</td>
<td>M[Imm + R[$r_b$]]</td>
<td>Base + displacement</td>
</tr>
<tr>
<td>Memory</td>
<td>($r_b$, $r_i$)</td>
<td>M[R[$r_b$] + R[$r_i$]]</td>
<td>Indexed</td>
</tr>
<tr>
<td>Memory</td>
<td>Imm($r_b$, $r_i$)</td>
<td>M[Imm + R[$r_b$] + R[$r_i$]]</td>
<td>Indexed</td>
</tr>
<tr>
<td>Memory</td>
<td>($r_i$, $s$)</td>
<td>M[R[$r_i$] · $s$]</td>
<td>Scaled indexed</td>
</tr>
<tr>
<td>Memory</td>
<td>Imm($r_i$, $s$)</td>
<td>M[Imm + R[$r_i$] · $s$]</td>
<td>Scaled indexed</td>
</tr>
<tr>
<td>Memory</td>
<td>($r_b$, $r_i$, $s$)</td>
<td>M[R[$r_b$] + R[$r_i$] · $s$]</td>
<td>Scaled indexed</td>
</tr>
<tr>
<td>Memory</td>
<td>Imm($r_b$, $r_i$, $s$)</td>
<td>M[Imm + R[$r_b$] + R[$r_i$] · $s$]</td>
<td>Scaled indexed</td>
</tr>
</tbody>
</table>
**Figure 3.3 from the book:** “Operand forms. Operands can denote immediate (constant) values, register values, or values from memory. The scaling factor $s$ must be either 1, 2, 4, or 8.”
Practice #3: Operand Forms
What are the results of the following move instructions (executed separately)? For this problem, assume the value 0x1 is stored in register %rcx, the value 0x100 is stored in register %rax, the value 0x3 is stored in register %rdx, and value 0x11 is stored at address 0x10C.
1. mov $0x42,0x{fc(,%rcx,4)}
2. mov (%rax,%rdx,4),%rbx
\[
\text{Imm}(r_b, r_i, s) \text{ is equivalent to address } \text{Imm} + R[r_b] + R[r_i]*s
\]
Displacement Base Index Scale
(1,2,4,8)
Goals of indirect addressing: C
Why are there so many forms of indirect addressing?
We see these indirect addressing paradigms in C as well!
int \texttt{sum\_array}(\texttt{int} \ arr[\texttt{]}, \ \texttt{int} \ nelems) \{
\texttt{int} \ \texttt{sum} = 0;
\texttt{for} \ (\texttt{int} \ i = 0; \ i < \nelems; \ i++) \{
\texttt{sum} += \texttt{arr}[i];
\}
\texttt{return} \ \texttt{sum};
\}
\texttt{We’re 1/4}^{\text{th}} \text{ of the way to understanding assembly!}
\textbf{What looks understandable right now?}
Some notes:
\begin{itemize}
\item Registers store addresses and values
\item \texttt{mov} \texttt{src}, \texttt{dst} \textit{copies} value into \texttt{dst}
\item \texttt{sizeof} (\texttt{int}) is 4
\item Instructions executed sequentially
\end{itemize}
\texttt{00000000004005b6 <sum\_array>}:
\begin{verbatim}
4005b6: ba 00 00 00 00
4005bb: b8 00 00 00 00
4005c0: eb 09
4005c2: 48 63 ca
4005c5: 03 04 8f
4005c8: 83 c2 01
\end{verbatim}
\texttt{mov} \texttt{$0x0,%edx}
\texttt{mov} \texttt{$0x0,%eax}
\texttt{jmp} \texttt{4005cb <sum\_array+0x15>}
\texttt{movslq} \%edx,\%rcx
\texttt{add} \texttt{(%rdi,\%rcx,4),%eax}
\texttt{add} \texttt{$0x1,%edx}
\texttt{cmp} \texttt{%esi,\%edx}
\texttt{jl} \texttt{4005c2 <sum\_array+0xc>}
\texttt{repz retq}
\texttt{We’ll come back to this example in future lectures!}
From Assembly to C
Spend a few minutes thinking about the main paradigms of the mov instruction.
• What might be the equivalent C-like operation?
• Examples (note %r__ registers are 64-bit):
1. mov $0x0,%rdx
2. mov %rdx,%rcx
3. mov $0x42,(%rdi)
4. mov (%rax,%rcx,8),%rax
From Assembly to C
Spend a few minutes thinking about the main paradigms of the `mov` instruction.
• What might be the equivalent C-like operation?
• Examples (note `%r__` registers are 64-bit):
1. `mov $0x0,%rdx` -> maybe long `x = 0`
2. `mov %rdx,%rcx` -> maybe long `x = y;`
3. `mov $0x42,(%rdi)` -> maybe `*ptr = 0x42;`
4. `mov (%rax,%rcx,8),%rax` -> maybe long `x = arr[i];`
Indirect addressing is like pointer arithmetic/deref!
Recap
- **Overview:** GCC and Assembly
- **Demo:** Looking at an executable
- **Registers and The Assembly Level of Abstraction**
- **The mov instruction**
**Next time:** diving deeper into assembly
**Lecture 10 takeaway:**
Assembly is the human-readable version of the form our programs are ultimately executed in by the processor. The compiler translates source code to machine code. The most common assembly instruction is `mov` to move data around.
Extra Practice
1. Extra Practice
Fill in the blank to complete the C code that
1. generates this assembly
2. has this register layout
```c
int x = ...
int *ptr = malloc(...);
...
___???___ = _???_;
mov %ecx,(%rax)
```
(Pedantic: You should sub in `<x>` and `<ptr>` with actual values, like 4 and 0x7fff80)
Fill in the blank to complete the C code that 1. generates this assembly 2. has this register layout
```c
int x = ...;
int *ptr = malloc(...);
...
___???___ = _???_; *ptr = x;
mov %ecx,(%rax)
```
<val of x> <val of ptr>
%ecx %rax
2. Extra Practice
Fill in the blank to complete the C code that
1. generates this assembly
2. results in this register layout
```c
long arr[5];
...
long num = ____??__;
mov (%rdi, %rcx, 8),%rax
```
<val of num> 3 <val of arr>
%rax %rcx %rdi
Fill in the blank to complete the C code that generates this assembly and results in this register layout:
```
long arr[5];
...
long num = ____???____;
```
```
long num = arr[3];
long num = *(arr + 3);
long num = *(arr + y);
```
(assume long y = 3; declared earlier)
```
mov (%rdi, %rcx, 8),%rax
```
<val of num> 3 <val of arr>
%rax %rcx %rdi
Fill in the blank to complete the C code that
1. generates this assembly
2. has this register layout
```c
char str[5];
...
___???___ = 'c';
```
```asm
mov $0x63,(%rcx,%rdx,1)
```
<table>
<thead>
<tr>
<th><code><val of str></code></th>
<th>2</th>
</tr>
</thead>
<tbody>
<tr>
<td>%rcx</td>
<td>%rdx</td>
</tr>
</tbody>
</table>
Fill in the blank to complete the C code that 1. generates this assembly 2. has this register layout
```c
char str[5];
...
___???___ = 'c';
```
```assembly
mov $0x63,(%rcx,%rdx,1)
```
```c
str[2] = 'c';
*(str + 2) = 'c';
```
---
3. Extra Practice
<val of str>
<table>
<thead>
<tr>
<th><val of str></th>
<th>2</th>
</tr>
</thead>
<tbody>
<tr>
<td>%rcx</td>
<td></td>
</tr>
<tr>
<td>%rdx</td>
<td></td>
</tr>
</tbody>
</table>
|
{"Source-Url": "https://web.stanford.edu/class/archive/cs/cs107/cs107.1226/lectures/10/Lecture10.pdf", "len_cl100k_base": 8244, "olmocr-version": "0.1.53", "pdf-total-pages": 69, "total-fallback-pages": 0, "total-input-tokens": 88057, "total-output-tokens": 11416, "length": "2e13", "weborganizer": {"__label__adult": 0.0004565715789794922, "__label__art_design": 0.0006494522094726562, "__label__crime_law": 0.00036525726318359375, "__label__education_jobs": 0.0157623291015625, "__label__entertainment": 0.00011283159255981444, "__label__fashion_beauty": 0.0002321004867553711, "__label__finance_business": 0.00028204917907714844, "__label__food_dining": 0.0006575584411621094, "__label__games": 0.0009565353393554688, "__label__hardware": 0.002895355224609375, "__label__health": 0.0005140304565429688, "__label__history": 0.00036406517028808594, "__label__home_hobbies": 0.0002510547637939453, "__label__industrial": 0.0011625289916992188, "__label__literature": 0.00035452842712402344, "__label__politics": 0.0003676414489746094, "__label__religion": 0.0007457733154296875, "__label__science_tech": 0.0294342041015625, "__label__social_life": 0.00019550323486328125, "__label__software": 0.0066070556640625, "__label__software_dev": 0.935546875, "__label__sports_fitness": 0.0004837512969970703, "__label__transportation": 0.0011053085327148438, "__label__travel": 0.00029349327087402344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 23760, 0.10315]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 23760, 0.69683]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 23760, 0.73093]], "google_gemma-3-12b-it_contains_pii": [[0, 65, false], [65, 633, null], [633, 702, null], [702, 1127, null], [1127, 1280, null], [1280, 1501, null], [1501, 1720, null], [1720, 1929, null], [1929, 2169, null], [2169, 2863, null], [2863, 3089, null], [3089, 3411, null], [3411, 3632, null], [3632, 3676, null], [3676, 3877, null], [3877, 4426, null], [4426, 4934, null], [4934, 5043, null], [5043, 5181, null], [5181, 5717, null], [5717, 6323, null], [6323, 7012, null], [7012, 7611, null], [7611, 8127, null], [8127, 8658, null], [8658, 9135, null], [9135, 9355, null], [9355, 9519, null], [9519, 9930, null], [9930, 9946, null], [9946, 10375, null], [10375, 10530, null], [10530, 11096, null], [11096, 11326, null], [11326, 11529, null], [11529, 12056, null], [12056, 12246, null], [12246, 12700, null], [12700, 12921, null], [12921, 13333, null], [13333, 13427, null], [13427, 13609, null], [13609, 13820, null], [13820, 14081, null], [14081, 14326, null], [14326, 14673, null], [14673, 15010, null], [15010, 15365, null], [15365, 15777, null], [15777, 16202, null], [16202, 16528, null], [16528, 16955, null], [16955, 17376, null], [17376, 17492, null], [17492, 17805, null], [17805, 18964, null], [18964, 19461, null], [19461, 19604, null], [19604, 20840, null], [20840, 21115, null], [21115, 21554, null], [21554, 22010, null], [22010, 22025, null], [22025, 22321, null], [22321, 22557, null], [22557, 22808, null], [22808, 23157, null], [23157, 23410, null], [23410, 23760, null]], "google_gemma-3-12b-it_is_public_document": [[0, 65, true], [65, 633, null], [633, 702, null], [702, 1127, null], [1127, 1280, null], [1280, 1501, null], [1501, 1720, null], [1720, 1929, null], [1929, 2169, null], [2169, 2863, null], [2863, 3089, null], [3089, 3411, null], [3411, 3632, null], [3632, 3676, null], [3676, 3877, null], [3877, 4426, null], [4426, 4934, null], [4934, 5043, null], [5043, 5181, null], [5181, 5717, null], [5717, 6323, null], [6323, 7012, null], [7012, 7611, null], [7611, 8127, null], [8127, 8658, null], [8658, 9135, null], [9135, 9355, null], [9355, 9519, null], [9519, 9930, null], [9930, 9946, null], [9946, 10375, null], [10375, 10530, null], [10530, 11096, null], [11096, 11326, null], [11326, 11529, null], [11529, 12056, null], [12056, 12246, null], [12246, 12700, null], [12700, 12921, null], [12921, 13333, null], [13333, 13427, null], [13427, 13609, null], [13609, 13820, null], [13820, 14081, null], [14081, 14326, null], [14326, 14673, null], [14673, 15010, null], [15010, 15365, null], [15365, 15777, null], [15777, 16202, null], [16202, 16528, null], [16528, 16955, null], [16955, 17376, null], [17376, 17492, null], [17492, 17805, null], [17805, 18964, null], [18964, 19461, null], [19461, 19604, null], [19604, 20840, null], [20840, 21115, null], [21115, 21554, null], [21554, 22010, null], [22010, 22025, null], [22025, 22321, null], [22321, 22557, null], [22557, 22808, null], [22808, 23157, null], [23157, 23410, null], [23410, 23760, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 23760, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 23760, null]], "pdf_page_numbers": [[0, 65, 1], [65, 633, 2], [633, 702, 3], [702, 1127, 4], [1127, 1280, 5], [1280, 1501, 6], [1501, 1720, 7], [1720, 1929, 8], [1929, 2169, 9], [2169, 2863, 10], [2863, 3089, 11], [3089, 3411, 12], [3411, 3632, 13], [3632, 3676, 14], [3676, 3877, 15], [3877, 4426, 16], [4426, 4934, 17], [4934, 5043, 18], [5043, 5181, 19], [5181, 5717, 20], [5717, 6323, 21], [6323, 7012, 22], [7012, 7611, 23], [7611, 8127, 24], [8127, 8658, 25], [8658, 9135, 26], [9135, 9355, 27], [9355, 9519, 28], [9519, 9930, 29], [9930, 9946, 30], [9946, 10375, 31], [10375, 10530, 32], [10530, 11096, 33], [11096, 11326, 34], [11326, 11529, 35], [11529, 12056, 36], [12056, 12246, 37], [12246, 12700, 38], [12700, 12921, 39], [12921, 13333, 40], [13333, 13427, 41], [13427, 13609, 42], [13609, 13820, 43], [13820, 14081, 44], [14081, 14326, 45], [14326, 14673, 46], [14673, 15010, 47], [15010, 15365, 48], [15365, 15777, 49], [15777, 16202, 50], [16202, 16528, 51], [16528, 16955, 52], [16955, 17376, 53], [17376, 17492, 54], [17492, 17805, 55], [17805, 18964, 56], [18964, 19461, 57], [19461, 19604, 58], [19604, 20840, 59], [20840, 21115, 60], [21115, 21554, 61], [21554, 22010, 62], [22010, 22025, 63], [22025, 22321, 64], [22321, 22557, 65], [22557, 22808, 66], [22808, 23157, 67], [23157, 23410, 68], [23410, 23760, 69]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 23760, 0.06088]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
f77a1cf1bd64f00214fa67e05750b53ec4ee7552
|
Flow-Sensitive Pointer Analysis for Millions of Lines of Code
Ben Hardekopf
University of California, Santa Barbara
benh@cs.ucsb.edu
Calvin Lin
The University of Texas at Austin
lin@cs.utexas.edu
Abstract—Many program analyses benefit, both in precision and performance, from precise pointer analysis. An important dimension of pointer analysis precision is flow-sensitivity, which has been shown to be useful for applications such as program verification and static analysis of binary code, among many others. However, flow-sensitive pointer analysis has historically been unable to scale to programs with millions of lines of code. We present a new flow-sensitive pointer analysis algorithm that is an order of magnitude faster than the existing state of the art, enabling for the first time flow-sensitive pointer analysis for programs with millions of lines of code. Our flow-sensitive algorithm is based on a sparse representation of program code created by a staged, flow-insensitive pointer analysis. We explain how this new algorithm is a member of a new family of pointer analysis algorithms that deserves further study.
I. INTRODUCTION
Pointer analysis is an important enabling technology that can improve the precision and performance of many program analyses by providing precise pointer information. Considerable progress has been made in various dimensions of pointer analysis, particularly with regard to flow-insensitive analysis [15], [16] and BDD-based context-sensitive pointer analysis [2], [32]–[34]. However, flow-sensitive pointer analysis has received relatively little attention, which is unfortunate because it has been shown to be important for a growing list of program analyses [6], [13], including those that check for security vulnerabilities [4], [12], [14], those that synthesize hardware [34], and those that analyze multi-threaded codes [29].
One reason for this lack of attention may be the special challenges that flow-sensitive pointer analysis presents. Unlike a flow-insensitive analysis, which ignores statement ordering and computes a single solution that holds for all program points, a flow-sensitive analysis respects a program’s control-flow and computes a separate solution for each program point. Thus, the traditional flow-sensitive approach uses an iterative dataflow analysis (IDFA), which is extremely inefficient for pointer analysis. IDFA conservatively propagates all dataflow information from each node in the control-flow graph to every other reachable node, because the analysis cannot know which nodes might need that information. For large programs, the control flow graph (CFG) can have hundreds of thousands of nodes, with each node maintaining two points-to graphs—one for incoming information and one for outgoing information; each points-to graph can have hundreds of thousands of pointers; and each pointer can have thousands of elements in its points-to set. Thus, each node stores, propagates, and computes transfer functions on an enormous amount of information, which is inefficient in both time and space.
The typical method for optimizing a flow-sensitive dataflow analysis is to perform a sparse analysis [5], [27], which directly connects variable definitions (defs) with their uses, allowing data flow facts to be propagated only to those program locations that need the values. Unfortunately, sparse pointer analysis is problematic because pointer information is required to compute the very def-use information that would enable a sparse analysis. This paper shows how this difficulty can be overcome and how the use of a sparse analysis greatly increases the scalability of flow-sensitive pointer analysis.
A. Insights
The key insight behind our technique is to stage the pointer analysis. An auxiliary pointer analysis first computes conservative def-use information, which then enables the primary flow-sensitive analysis to be performed sparsely using the conservative def-use information. This idea actually defines a family of staged flow-sensitive analyses, described in Section IV-A, in which each member of the family uses a different auxiliary analysis (referred to henceforth as AUX). While other work on pointer analysis has previously employed auxiliary analyses [21], [28], none has used the results of the auxiliary analysis in the same way.
This paper explains how we address three main challenges facing a staged analysis, resulting in a scalable flow-sensitive pointer analysis. First, AUX must strike a good balance between precision and performance: If the results are too imprecise, the sparsity of the primary analysis will suffer; if AUX is not scalable, the primary analysis will never get to execute. Second, the primary analysis must deal with the complexity of incorporating the auxiliary analysis’ conservative def-use information while maintaining the precision of a flow-sensitive pointer analysis. Third, the primary analysis must efficiently manage the extremely large number of def-use chains that are computed by AUX.
B. Contributions
This paper makes the following contributions:
• We present staged flow-sensitive analysis (SFS), a new flow-sensitive pointer analysis that introduces the notion
of staging, in which the def-use chains created by a less precise auxiliary pointer analysis are used to enable the sparsity of the primary flow-sensitive pointer analysis.
- We introduce the notion of access equivalence, which partitions def-use chains into equivalence classes, allowing SFS to efficiently process large amounts of def-use information.
- We evaluate an instance of SFS that uses inclusion-based pointer analysis as the auxiliary analysis. This particular auxiliary analysis is attractive because it is the most precise of the flow- and context-insensitive pointer analyses and because it can analyze millions of lines of code in a matter of minutes [15], [16].
- Using a collection of 16 open source C programs, we compare the SFS algorithm to a baseline, semi-sparse analysis, which represents the prior state-of-the-art [17]. We show that our staged algorithm is an order of magnitude more scalable than the baseline; for example, SFS is able to analyze a program with 1.9M LOC in under 14 minutes. The primary strength of SFS is its improved scalability. For small programs—those with fewer than 100K LOC—SFS is efficient but provides no performance advantage over the baseline. For mid-sized programs—those with 100K to 400K LOC—SFS is 5.5 times faster than the baseline. For large programs—those with more than 800K LOC—SFS completes while the baseline does not.
The remainder of the paper is organized as follows. Section II gives background information that is important to understanding flow-sensitive pointer analysis and our technique. Section III discusses related work. Section IV describes our staging technique, and Section V gives a detailed description of the algorithm. Section VI experimentally evaluates the scalability of our technique compared to the current state of the art, and Section VII concludes.
II. BACKGROUND
This section provides background that is needed for understanding the remainder of the paper. We describe the basics of flow-sensitive pointer analysis and static single assignment form, and then we describe LLVM, the particular compiler infrastructure used for our work.
A. Flow-Sensitive Pointer Analysis
Traditional flow-sensitive pointer analysis analysis is carried out on the control-flow graph (CFG), which is a directed graph, \( G = (N, E) \), where \( N \) is a finite set of nodes (or program points) corresponding to program statements and where \( E \subseteq N \times N \) is a set of edges corresponding to the control-flow between statements. To ensure the decidability of the analysis, branch conditions are uninterpreted; thus branches are treated as non-deterministic.
Each node \( k \) of the CFG maintains two points-to graphs (i.e., sets of points-to relations): \( \text{IN}_k \) represents the incoming pointer information, and \( \text{OUT}_k \) represents the outgoing pointer information. Each node has a transfer function that transforms \( \text{IN}_k \) to \( \text{OUT}_k \); the function is characterized by the sets \( \text{GEN}_k \) and \( \text{KILL}_k \) which represent the pointer information generated by the node and killed by the node, respectively. The contents of these two sets depend on the particular program statement associated with node \( k \), and the contents can vary over the course of the analysis as new pointer information is accumulated. For all nodes \( k \), the analysis iteratively computes the following two functions until convergence:
\[
\text{IN}_k = \bigcup_{x \in \text{pred}(k)} \text{OUT}_x \quad (1)
\]
\[
\text{OUT}_k = \text{GEN}_k \cup (\text{IN}_k \setminus \text{KILL}_k) \quad (2)
\]
For a program statement \( k \) with an assignment \( \star x = y \), \( \text{KILL}_k = \{ x \rightarrow \_ \} \), which is called a strong update: All relations with \( x \) on the left-hand side are removed and replaced with new relations. For a program statement \( k \) with an assignment \( \star x = y \), the matter is more complicated. If \( \star \) definitely points to a single concrete memory location \( z \), then \( \text{KILL}_k = \{ z \rightarrow \_ \} \) and the analysis still performs a strong update. However, if \( \star \) may point to multiple concrete memory locations, then \( \text{KILL}_k = \{ \} \) and the analysis performs a weak update: The analysis cannot be sure which memory location will be updated by the assignment, so it adds the new information but conservatively preserves all existing points-to relations. A pointer may refer to multiple concrete memory locations if its points-to set contains multiple locations or if the single location in its points-to set is either (1) a heap variable (as described in the next paragraph), or (2) a local variable of a recursive function (which may have multiple instances on the program’s runtime stack at the same time).
An important aspect of any pointer analysis is the heap model, which abstracts the conceptually infinite-size heap into a finite set of memory locations. We adopt the common practice of treating each static memory allocation site as a distinct abstract memory location (which may map to multiple concrete memory locations during program execution).
B. SSA
In static single assignment (SSA) form [9], each variable is defined exactly once in the program text. Variables with multiple definitions in the original program are split into separate instances, one for each definition. At join points in the CFG, separate instances of the same variable are combined using a \( \phi \) function, producing an assignment to a new instance of the variable. SSA form is ideal for performing sparse analyses because it explicitly represents def-use information and allows dataflow information to flow directly from variable definitions to their corresponding uses [27].
The conversion to SSA form is complicated by the existence of indirect defs and uses through pointers, which can only be discovered using pointer analysis. Because the resulting pointer information is conservative, each indirect def and use is actually a possible def or use. Following Chow et al [8], we use \( \chi \) and \( \mu \) functions to represent these possible defs and uses. Each indirect store (e.g., \( \star x = y \)) in the original program
representation is annotated with a function $v = \chi(v)$ for each variable $v$ that may be defined by the store; similarly, each indirect load (e.g., $x = *y$) in the original representation is annotated with a function $\mu(v)$ for each variable $v$ that may be accessed by the load. When converting to SSA form, each $\chi$ function is treated as both a def and use of the given variable, and each $\mu$ function is treated as a use of the given variable.
To avoid the complications of dealing with indirect loads and stores, some modern compilers such as GCC [26] and LLVM [23] use a variant of SSA that we call partial SSA form. The idea is to divide variables into two classes. One class contains top-level variables that are never referenced by pointers, so their definitions and uses can be trivially determined by inspection without pointer information. These variables can be converted to SSA using any algorithm for constructing SSA form. The second class contains those variables that can be referenced by pointers (address-taken variables), and to avoid the above-mentioned complications, these variables are not placed in SSA form.
C. The LLVM IR
Our implementation uses the LLVM compiler infrastructure, so to make our discussion concrete, we now describe LLVM’s internal representation (IR) and its particular instantiation of partial SSA form. While the details are specific to LLVM, the ideas can be translated to other forms of partial SSA. In LLVM, top-level variables are kept in a conceptually infinite set of virtual registers which are maintained in SSA form. Address-taken variables are kept in memory rather than registers, and they are not in SSA form. Top-level variables are modified using ALLOC (memory allocation) and COPY instructions. Address-taken variables are accessed via LOAD and STORE instructions, which take top-level pointer variables as arguments. The address-taken variables are never referenced syntactically in the IR; they instead are only referenced indirectly using these LOAD and STORE instructions. LLVM instructions use a 3-address format, so there is at most one level of pointer dereference for each instruction (source statements with multiple levels of indirection are reduced to this form by introducing temporary variables).
Figure 1 shows a C code fragment and its corresponding partial SSA form. Variables $w$, $x$, $y$, and $z$ are top-level variables and have been converted to SSA form; variables $a$, $b$, $c$, and $d$ are address-taken variables, so they are stored in memory and accessed solely via LOAD and STORE instructions. Because the address-taken variables are not in SSA form, they can each be defined multiple times, as with variables $c$ and $d$ in the example.
Because address-taken variables cannot be directly named, LLVM maintains the invariant that each address-taken variable has at least one virtual register that refers only to that variable. The rest of this paper will assume the use of the LLVM IR, which means that address-taken variables can only be defined or used by LOAD and STORE instructions.
```c
int a, b, *c, *d;
int* w = &a;
int* x = &b;
int** y = &c;
int** z = y;
c = 0;
*y = w;
*z = x;
y = &d;
z = y;
*y = w;
*z = x;
\( w_1 = \text{ALLOC}_w \)
\( x_1 = \text{ALLOC}_x \)
\( y_1 = \text{ALLOC}_c \)
\( z_1 = y_1 \)
\( \text{STORE } 0 y_1 \)
\( \text{STORE } w_1 y_1 \)
\( \text{STORE } x_1 z_1 \)
\( y_2 = \text{ALLOC}_d \)
\( z_2 = y_2 \)
\( \text{STORE } w_1 y_2 \)
\( \text{STORE } x_1 z_2 \)
```
Fig. 1. An example of partial SSA form. On the left is the original C code; on the right is the transformed code in partial SSA form. Note that the address-taken variables $a$, $b$, $c$, and $d$ are not mentioned syntactically in the transformed program text; they are referred to only indirectly via the top-level pointers $w$, $x$, and $y$.
III. RELATED WORK
Most of the previous advancements in flow-sensitive pointer analysis have exploited some form of sparsity to improve performance.
Chase et al [5] propose that SSA form be dynamically computed during the course of the flow-sensitive pointer analysis. Chase et al do not evaluate their idea, but a similar idea is evaluated by Tok et al [31], whose algorithm can analyze C programs with almost 70,000 lines of code in roughly 30 minutes. The scalability of this approach is limited by the cost of dynamically updating SSA form. In contrast, our analysis pre-computes the SSA information prior to the actual flow-sensitive analysis.
Hardekopf and Lin [17] present a semi-sparse flow-sensitive pointer analysis, which exploits partial SSA form to perform a sparse analysis on top-level variables, while using iterative dataflow analysis on address-taken variables. By contrast, our staged analysis is completely sparse and uses SSA form for all variables. Our resulting analysis is an order of magnitude more scalable than semi-sparse analysis, as shown in Section VI.
Hasti and Horwitz [18] propose a scheme composed of two passes: a flow-insensitive pointer analysis that gathers pointer information and a conversion pass that uses the pointer information to transform the program into SSA form. The result of the second pass is iteratively fed back into the first pass until convergence is reached. Hasti and Horwitz leave open the question of whether the resulting pointer information is equivalent to a flow-sensitive analysis; we believe that the resulting information is less precise than a fully flow-sensitive pointer analysis. No experimental evaluation of this technique has been published. In contrast to their work, which uses multiple passes to compute results that are not fully flow-sensitive, our staged algorithm uses a single pass of the flow-insensitive analysis to compute a fully precise flow-sensitive analysis.
Hind and Pioli [19], [20] use a weaker form of sparsity in the form of the sparse evaluation graph (SEG) [7], which is
a graph that is derived from the CFG by eliding nodes that are irrelevant to pointer analysis (i.e., they do not manipulate pointer information) while at the same time maintaining the control-flow relations among the remaining nodes. Hind and Pioli [19], [20] also introduce the notion of filtered forward binding, which recognizes that when passing pointer information to the target of a function call, it is only necessary to pass pointer information that the callee can access from a global variable or from one of the function parameters. Hind and Pioli’s paper evaluates benchmarks up to 30K LOC; a modern re-implementation of their algorithm evaluated by Hardekopf and Lin [17] was unable to do any better.
A staging strategy for flow-sensitive pointer analysis that builds on HSSA form [8] was apparently implemented in the Open64 compiler in 1996, though the implementation is solely intra-procedural and, to our knowledge, a description has never been published.
Previous work has also used notions similar to staging to improve the efficiency of pointer analysis. Client-driven pointer analysis [14] analyzes the needs of a particular client and applies flow-sensitive and context-sensitive pointer analysis only to those portions of the program that require that level of precision. Fink et al [12] apply a similar technique specifically for typestate analysis by successively applying a series of increasingly precise pointer analyses to successively smaller programs by pruning away portions of the program once they have been successfully verified. Ruf [28] and Kahlon [21] bootstrap the flow-sensitive pointer analysis by using a flow-insensitive pointer analysis to first partition the program into sections that can be analyzed independently. Unlike staging, these techniques use a preliminary analysis to reduce the size of the input by either pruning [12], [14] or partitioning [21] the program. By contrast, our staging employs the def-use chains computed by the auxiliary pointer analysis to help create more precise def-use information that in turn allows the algorithm to produce more precise pointer information. Thus, pruning and partitioning are orthogonal to staging, and the ideas can be combined: A staged analysis does not need to compute flow-sensitive solutions for all variables, only the relevant ones.
IV. STAGING THE ANALYSIS
A key component of our new algorithm is AUX, the auxiliary pointer analysis that computes conservative def-use information for the primary flow-sensitive pointer analysis. The remainder of this section discusses AUX and explains how its results can be used to optimize the primary analysis.
A. The Family of Staged Analyses
As mentioned in the introduction, staged analysis represents a family of analyses, with each family member distinguished by the particular auxiliary pointer analysis that is used. As with any pointer analysis, there are two concerns: precision and scalability. A more precise AUX will yield a sparser primary analysis; a less scalable AUX could limit the scalability of the staged analysis.
The most natural choice for AUX is a flow- and context-insensitive analysis; there are many of these to choose from, ranging from the simplest address-taken analysis (which reports that any pointer can point to any variable whose address has been taken), to Steensgaard’s analysis [30], to Das’ One-Level Flow [11], to inclusion-based (i.e., Andersen-style) analysis. Any of these choices will result in an overall staged analysis that provides the same precision as a traditional flow-sensitive analysis. Interestingly, Hardekopf and Lin’s semi-sparse pointer analysis can be viewed as a bastardized member of the family, where AUX identifies top-level variables to allow the primary analysis to be partially sparse. For this paper we use an inclusion-based auxiliary analysis, which is the most precise of the flow- and context-insensitive pointer analyses, and which scales to millions of LOC [15], [16].
An intriguing choice for AUX, which we leave for future work, would be to use an analysis whose precision is incomparable to the primary analysis,
1 because by sequentially combining incomparable analyses we get some of the benefit of combining the two analyses but at lower cost. For example, by using a flow-insensitive, context-sensitive analysis for AUX, the overall analysis would incorporate both flow- and context-sensitive information, making it more precise than a traditional flow-sensitive, context-insensitive analysis. Such an analysis would be interesting for two reasons. First, full flow- and context-sensitivity often provide more precision than is necessary [14]. In fact, others have sacrificed some degree of precision (e.g., disallowing indirect strong updates [34]) for the sake of improved scalability. Second, flow- and context-sensitivity conspire to limit scalability; by providing a way to perform the analyses in sequence rather than at the same time, staged analysis can yield a much more scalable algorithm. Of course, the precision of the resulting analysis would need to be carefully studied.
To be clear, as long as the AUX analysis is sound, the primary SFS analysis will also be sound and it will be at least as precise as a traditional flow-sensitive pointer analysis. The precision of AUX mainly affects the sparsity (and hence performance) of the primary analysis.
B. Sparse Flow-Sensitive Pointer Analysis
The primary data structure for SFS is a def-use graph (DUG), which contains a node for each program statement and which contains edges to represent def-use chains—if a variable is defined in node \( x \) and used in node \( y \), there is a directed edge from \( x \) to \( y \). The def-use edges for top-level variables are trivial to determine from inspection of the program; the def-use edges for address-taken variables require AUX to compute. This section describes how these def-use edges are computed, as well as how the precision of the flow-sensitive analysis is maintained while using flow-insensitive def-use information.
The first step is to use the results of AUX to convert the address-taken variables into SSA form. Once the LOADS and
1Inclusion-based analysis is not incomparable to the primary analysis—it is strictly less precise than a flow-sensitive pointer analysis.
STORES are annotated with $\chi$ and $\mu$ functions as described in Section II-B, the program can be converted to SSA form using any standard SSA algorithm [1], [3], [9], [10]. Figure 2 shows an example program fragment along with some pointer information computed by $\text{AUX}$. Figure 3 shows the same program fragment annotated with $\chi$ and $\mu$ functions and translated into SSA. The annotation step comes directly from the points-to information computed by $\text{AUX}$—for example, for the CFG node $*p = w$ we add a $\chi$ function for each variable in $p$’s points-to set (i.e., $a$); for the CFG node $u = *v$ we add a $\mu$ function for each variable in $v$’s points-to set (i.e., $e$ and $f$). The other nodes are annotated in a similar fashion. Once all of the nodes have been annotated, any standard SSA algorithm can be used to derive the SSA form.
The def-use information computed by $\text{AUX}$ is conservative with respect to the more precise flow-sensitive information that will be computed by the primary analysis, so there are three possibilities that must be addressed for a $\text{STORE}$ command $*x = y$ that is annotated with $v_m = \chi(v_n)$:
1) $x$ might not point to $v$ in the flow-sensitive results. In this case, $v_m$ should be a copy of $v_n$ and incorporate none of $y$’s information.
2) $x$ might point only to $v$ in the flow-sensitive results. In this case, the analysis can strongly update the points-to information for $v$; in other words, $v_m$ should be a copy of $y$ and incorporate none of $v_n$’s information.
3) $x$ might point to $v$ as well as other variables in the flow-sensitive results. In this case, the analysis must weakly update the points-to information for $v$; in other words, $v_m$ should incorporate points-to information from both $v_n$ and $y$.
By using the computed SSA information to construct the def-use graph, we can accommodate all of these possibilities. To create the DUG we must add an edge from each indirect definition (i.e., $\text{STORE}$) to each statement where the indirectly-defined variable might be used. Thus we create, for each $\text{STORE}$ annotated with a function $v_m = \chi(v_n)$, a def-use edge from that $\text{STORE}$ to every statement that uses $v_m$ as the argument of a $\chi$, $\mu$, or $\phi$ function. We label each def-use edge that corresponds to an address-taken variable with the name of that variable; when propagating pointer information, the analysis only propagates a variable’s information along edges labeled with that variable’s name. Figure 4 shows the program from Figure 2 converted into a DUG based on the SSA information from Figure 3.
In principle, the actual flow-sensitive analysis works much like the traditional flow-sensitive analysis described in Section II, except that (1) the analysis propagates information along def-use edges instead of control-flow edges, and (2) a variable’s information is only propagated along edges labeled with that variable’s name. The exact steps of the analysis are deferred to Section V after we discuss some important issues that affect precision and performance.
In order for the sparse flow-sensitive analysis to compute a precise solution (i.e., one that is equivalent to a traditional iterative dataflow analysis for flow-sensitive, context-insensitive pointer analysis), it must handle the three $\text{STORE}$ possibilities listed above. The key insight required to show that the analysis correctly handles each possibility is that the points-to information at each DUG node increases monotonically—once a pointer contains a variable $v$ in its points-to set at node $n$, that pointer will always contain $v$ at node $n$. This fact constrains
the transitions that each STORE can make among the three possibilities.
Suppose we have a STORE \( *x = y \). When visiting this node, \( x \) must point to something (because the STORE is not processed if \( x \) is NULL—either we will revisit this node when \( x \) is updated, or the program will never execute past this point because it will be dereferencing a null pointer). The monotonicity property constrains the transitions that the analysis may take among the three possibilities for this STORE: The analysis may transition from possibility (1) or (2) to (3), and from (1) to (2), but it can never transition from possibility (2) to (1) and never from (3) to either (1) or (2).
More concretely, suppose that \( x \) does not point to \( v \) when the STORE is visited. Then the analysis will propagate the old value of \( v \) past this node. Later in the analysis, \( x \) may be updated to point to \( v \); if so, the STORE must be a weak update (possibility 3) because \( x \) already points to some variable other than \( v \) at this point in the program and it cannot change that fact. So the analysis will update \( v \) with both the old value of \( v \) and the value of \( y \), which is a superset of the value it propagated at the last visit (the old value of \( v \)). Similar reasoning shows that if the STORE is originally a strong update (possibility 2) and later becomes a weak update, the analysis still operates correctly.
Note that the previous argument assumes that AUX is flow- and context-insensitive; the use of a context-sensitive AUX would instead yield an analysis that is more precise than the traditional flow-sensitive, context-insensitive analysis. In particular, a context-sensitive AUX analysis will compute def-use chains that are incomparable to the set of def-use chains that the primary flow-sensitive, context-insensitive analysis would compute (because AUX would be more precise in the context-sensitive dimension than the primary analysis). Thus, with a context-sensitive AUX SFS will compute a more precise (but still sound) result, because the def-use chains used for the sparse primary analysis would benefit from the AUX analysis’ context-sensitivity.
C. Access Equivalence
A difficulty that immediately arises when using the technique described above is the sheer number of def-use edges that may be required. Each LOAD and STORE may access thousands of variables, based on the dereferenced variable’s points-to set size, and each variable may be accessed at dozens or hundreds of locations in the program—in large benchmarks, hundreds of millions of def-use edges may be created, far too many to enable a scalable analysis. To combat this problem we introduce the notion of access equivalence, represents the same information in a much more compact fashion.
Two address-taken variables \( x \) and \( y \) are access equivalent if whenever one is accessed by a LOAD or STORE instruction, the other is too; in other words, for all variables \( v \) such that \( v \) is dereferenced in a LOAD or STORE, \( x \in \text{points-to}(v) \iff y \in \text{points-to}(v) \). This notion of equivalence is similar, but not identical, to the notion of location equivalence described by Hardekopf and Lin [16]. The difference is that location equivalence examines all pointers in a program to determine whether two variables are equivalent, whereas access equivalence only looks at pointers dereferenced in a LOAD or STORE; two variables may be access equivalent without being location equivalent (but not vice-versa). Location equivalence is not useful in compilers such as LLVM that use partial SSA form; these compilers maintain the invariant that every address-taken variable \( v \) has at least one top-level pointer that points only to \( v \)—in such a case there are no location equivalent variables, but there can be many access equivalent variables.
The advantage of access equivalence is that the SSA algorithm will compute identical def-use chains for all access-equivalent variables. This is easy to see: By definition, any STORE that defines one variable must also define all access-equivalent variables, and similarly any LOAD that uses one variable must also use all access-equivalent variables.
To determine access equivalence using AUX, we must identify variables that are accessed by the same set of LOADS and STORES. Let \( AE \) be a map from address-taken variables to sets of instructions. For each LOAD or STORE instruction \( I \), and for each variable \( v \) accessed by \( I \), \( AE(v) \) includes \( I \). Once all instructions have been processed, any two variables \( x \) and \( y \) are access-equivalent if \( AE(x) = AE(y) \). This process takes \( O(I \cdot V) \) time, where \( I \) is the number of LOAD/STORE instructions and \( V \) is the number of address-taken variables.
Once the address-taken variables have been partitioned into access equivalence classes, the edges of the DUG are relabeled using the partitions instead of variable names. For Figure 2, the access equivalences are: \( \{a\}, \{b,d\}, \{c\}, \{e,f\} \). Figure 5 shows the same def-use graph as Figure 4 except with edges for access-equivalent variables in the same partition collapsed into a single edge.
Because the access equivalences are computed using AUX, they are conservative with respect to the actual access equivalences that would be computed using a flow-sensitive pointer analysis—that is, variables that are access equivalent using the AUX results may not be access equivalent using the flow-sensitive results. For this reason, while the DUG edges are labeled using the variable’s access equivalence partitions, the transfer functions and points-to graphs at each node use the
\[
\begin{align*}
\ast p &= w \\
\ast z &= y \\
\ast q &= x \\
&
\end{align*}
\]
actual variables and not the partitions.
D. Interprocedural Analysis
There are two possible approaches for extending the above analysis to an interprocedural analysis.
The first option is to compute sparseness separately for each function, treating a function call as a definition of all variables defined by the callee and as a use of all variables used by the callee. The downside of this approach is that def-use chains can span a number of functions; treating each function call between the definition and the actual use as a collection point can adversely affect the sparseness of the analysis.
The second option, and the one that we choose, is to compute the sparseness for the entire program as one unit, directly connecting variable definitions and uses even across function boundaries. An important consideration for this approach is the method of handling indirect calls via function pointers. Some of the def-use chains that span multiple functions may be dependent on the resolution of indirect calls. The analysis as given does not compensate for this problem—it assumes that the def-use chains are only dependent on the points-to sets of the pointers used by an instruction, without taking into account any additional dependences on the points-to sets of unrelated function pointers. In other words, this technique may lose precision if the call-graph computed by AUX over-approximates the call-graph computed by a flow-sensitive pointer analysis.
There are two possible solutions to this problem. The easiest is simply to assume that AUX computes a precise call-graph, i.e., the same call-graph as the flow-sensitive pointer analysis would compute. If AUX is fairly precise (e.g., an inclusion-based analysis), this is a good assumption to make—it has been shown that precise call-graphs can be constructed using only flow-insensitive pointer analysis [25]. We use an inclusion-based analysis for AUX, and hence this is the solution we use for our work.
If this assumption is not desirable, then the technique must be adjusted to account for the extra dependences. Each def-use chain that crosses a function boundary and depends on the resolution of an indirect call is annotated with the \((\text{function pointer}, \text{target function})\) pair that it depends on. Pointer information is not propagated across this def-use edge unless the appropriate target has been computed to be part of the function pointer’s points-to set.
V. The Final Algorithm
Putting everything together, the final algorithm for sparse flow-sensitive pointer analysis begins with a series of preprocessing steps that computes the DUG:
1) Run AUX to compute conservative def-use information for the program being analyzed. Use the results of AUX to compute the program’s interprocedural control-flow graph (ICFG [22]), including the resolution of indirect calls to their potential targets. All function calls are then translated into a set of COPY instructions to represent parameter assignments; similarly, function returns are translated into COPY instructions.
2) Compute exact SSA information for all top-level variables. The \(\phi\)-functions computed by this step are translated into COPY statements, e.g., \(x_1 = \phi(x_2, x_3)\) becomes \(x_1 = x_2 x_3\) (see processCopy below), which distinguishes these statements from the \(\phi\)-functions computed for the address-taken variables in step 4 below. Partition the address-taken variables into access equivalence classes as described in Section IV-C.
3) For each partition \(P\), use the results of AUX to label each store that may modify a variable in \(P\) with a function \(P = \chi(P)\), and label each load that may access a variable in \(P\) with a function \(\mu(P)\).
4) Compute SSA form for the partitions, using any of many available methods [1], [3], [9], [10].
5) Construct the def-use graph by creating a node for each pointer-related instruction and for each \(\phi\) function created by step 4; then:
- For each ALLOC, COPY, and LOAD node \(N\), add an unlabeled edge from \(N\) to every other node that uses the top-level variable defined by \(N\).
- For each STORE node \(N\) that has a \(\chi\) function defining a partition variable \(P_n\), add an edge from \(N\) to every node that uses \(P_n\) (either in a \(\phi\), \(\chi\) or \(\mu\) function), labeled by the partition \(P\).
- For each \(\phi\) node \(N\) that defines a partition variable \(P_n\), create an unlabeled edge to every node that uses \(P_n\).
Once the preprocessing is complete, the sparse analysis itself can begin. The analysis uses the following data structures:
- There is a node worklist Worklist, initialized to contain all \text{ALLOC} nodes.
- There is a global points-to graph \(PG\) that holds the points-to sets for all top-level variables. Let \(\mathcal{P}_{top}(v)\) be the points-to set for top-level variable \(v\).
- Every LOAD and \(\phi\)-function \(k\) contains a points-to graph \(IN_k\) to hold the pointer information for all address-taken variables that may be accessed by that node. Let \(\mathcal{P}_k(v)\) be the points-to set for address-taken variable \(v\) contained in \(IN_k\).
- Every \text{STORE} node \(k\) contains two points-to graphs to hold the pointer information for all address-taken variables that may be defined by that node: \(IN_k\) for the incoming pointer information and \(OUT_k\) for the outgoing pointer information. Let \(\mathcal{P}_k(v)\) be the points-to set of address-taken variable \(v\) in \(IN_k\). We lift \(\mathcal{P}_k()\) to operate of sets of address-taken variables such that its result is the union of the points-to sets of each variable in the set.
- For each address-taken variable \(v\), \(\text{part}(v)\) returns the variable partition that \(v\) belongs to.
The points-to graphs are all initialized to be empty. The main body of the algorithm is listed below. The loop iteratively selects and processes a node from the worklist, during which new nodes may be added to the worklist. The loop continues
until the worklist is empty, at which point the analysis is complete. Each different type of node is processed as given in the code listing below. The \( \leftarrow \) operator represents set update, \( \rightarrow \) represents an unlabeled edge in the def-use graph, and \( \xrightarrow{x} \) represents an edge labeled with \( x \).
### Main body of analysis:
while Worklist is not empty do
\[ k = \text{SELECT}(\text{Worklist}) \]
switch typeof\( (k) \):
- case ALLOC: \( \text{processAlloc}(k) \) \( \text{if} \ x = \text{ALLOC}_i \)
- case COPY: \( \text{processCopy}(k) \) \( \text{if} \ x = y \ z \ldots \)
- case LOAD: \( \text{processLoad}(k) \) \( \text{if} \ x = *y \)
- case STORE: \( \text{processStore}(k) \) \( \text{if} \ *x = y \)
- case \( \phi \): \( \text{processPhi}(k) \) \( \text{if} \ x = \phi(...) \)
---
**define processAlloc\( (k) \):**
\[ PG \leftarrow \{ x \rightarrow \text{ALLOC}_i \} \]
if \( PG \) changed then
\[ \text{Worklist} \leftarrow \{ n \mid k \rightarrow n \in E \} \]
**define processCopy\( (k) \):**
for all \( v \in \) right-hand side do
\[ PG \leftarrow \{ x \rightarrow P_{top}(v) \} \]
if \( PG \) changed then
\[ \text{Worklist} \leftarrow \{ n \mid k \rightarrow n \in E \} \]
---
**define processLoad\( (k) \):**
\[ PG \leftarrow \{ x \rightarrow P_k(P_{top}(y)) \} \]
if \( PG \) changed then
\[ \text{Worklist} \leftarrow \{ n \mid k \rightarrow n \in E \} \]
---
**define processStore\( (k) \):**
if \( P_{top}(x) \) represents a single concrete memory location then
\[
\text{// strong update} \\
\text{OUT}_k \leftarrow (IN_k - \{ P_{top}(x) \rightarrow \_ \}) \cup \{ P_{top}(x) \rightarrow P_{top}(y) \}
\]
else // weak update
\[ \text{OUT}_k \leftarrow IN_k \cup \{ P_{top}(x) \rightarrow P_{top}(y) \} \]
for all \( \{ n \in N, p \in P \mid k \xrightarrow{p} n \in E \} \) do
for all \( \{ v \in \text{OUT}_k \mid \text{part}(v) = p \} \) do
\[ IN_n(v) \leftarrow \text{OUT}_k(v) \]
if \( IN_n \) changed then
\[ \text{Worklist} \leftarrow \{ n \} \]
---
**define processPhi\( (k) \):**
for all \( \{ n \in N \mid k \rightarrow n \in E \} \) do
\[ IN_n \leftarrow IN_k \]
if \( IN_n \) changed then
\[ \text{Worklist} \leftarrow \{ n \} \]
---
### Table I
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>LOC</th>
</tr>
</thead>
<tbody>
<tr>
<td>gimp</td>
<td>image manipulation</td>
<td>87K</td>
</tr>
<tr>
<td>tshark</td>
<td>wireless network analyzer</td>
<td>1.946K</td>
</tr>
<tr>
<td>ghostscript</td>
<td>text-based game</td>
<td>167K</td>
</tr>
<tr>
<td>python</td>
<td>text-based game</td>
<td>185K</td>
</tr>
<tr>
<td>vim</td>
<td>text processor</td>
<td>268K</td>
</tr>
<tr>
<td>pine</td>
<td>e-mail client</td>
<td>342K</td>
</tr>
<tr>
<td>svn</td>
<td>source control</td>
<td>344K</td>
</tr>
<tr>
<td>pine</td>
<td>postscript viewer</td>
<td>354K</td>
</tr>
<tr>
<td>tshark</td>
<td>text-based game</td>
<td>167K</td>
</tr>
<tr>
<td>python</td>
<td>text-based game</td>
<td>185K</td>
</tr>
<tr>
<td>vim</td>
<td>text processor</td>
<td>268K</td>
</tr>
<tr>
<td>pine</td>
<td>e-mail client</td>
<td>342K</td>
</tr>
<tr>
<td>svn</td>
<td>source control</td>
<td>344K</td>
</tr>
<tr>
<td>pine</td>
<td>postscript viewer</td>
<td>354K</td>
</tr>
</tbody>
</table>
**VI. Evaluation**
To evaluate the scalability of our new technique, we compare it against the most scalable known flow-sensitive pointer analysis algorithm—semi-sparse flow-sensitive pointer analysis (SSO) [17]. SSO is able to analyze benchmarks with up to approximately 344K lines of code (LOC), an order of magnitude greater than (and almost 200× faster than) allowed by the best traditional, non-sparse flow-sensitive pointer analysis. We use SSO as the baseline for comparison with our new technique, which we refer to as SFS. SFS uses inclusion-based (i.e., Andersen-style) analysis for AUX and uses the method indicated in Section IV-D for handling function pointers. All of these algorithms—SSO, SFS, and AUX—are field-sensitive, meaning that each field of a struct is treated as a separate variable.
Both SFS and SSO are implemented in the LLVM compiler infrastructure [23] and use BDDs from the BuDDy library [24] to store points-to relations. We emphasize that neither technique is a symbolic analysis (which formulates the entire analysis as operations on relations represented as boolean functions). Instead, SFS and SSO only use BDDs to compactly represent points-to sets; other data structures could be swapped in for this purpose without changing the rest of the analysis. The analyses are written in C++ and handle all aspects of the C language except for varargs.
The benchmarks for our experiments are described in Table I. Six of the benchmarks are the largest SPECint 2000 benchmarks, and the rest are various open-source applications. Function calls to external code are summarized using hand-crafted function stubs. The experiments are run on a 2.66 GHz 32-bit processor with 4GB of addressable memory, except for our largest benchmark, tshark, which uses more than 4GB of memory—that benchmark is run on a 1.60 GHz 64-bit processor with 100GB of memory.
A. Performance Results
Table II gives the analysis time and memory consumption of the various algorithms. These numbers include the time to build the data structures, apply the optimizations, and compute the pointer analysis. The times for SFS are additionally broken down into the three main stages of the analysis: the auxiliary flow-insensitive pointer analysis, the preparation stage that computes sparseness, and the solver stage.
The premise of SFS—that a sparse analysis can be approximated by using an auxiliary pointer analysis to conservatively compute def-use information—is clearly borne out. For the small benchmarks, those less than 100K LOC, both analyses are fast, but the advantage is unclear: in some cases SFS is faster, and in other cases SFS is slower; on average SFS is 1.03× faster than SSO. For the mid-sized benchmarks, those with between 100K LOC and 400K LOC, SFS has a more distinct advantage; for the six benchmarks that both algorithms complete, SFS is on average 5.5× faster than SSO. The scalability advantage of SFS is seen from the fact that SSO cannot analyze the three largest benchmarks within an hour.
The one area where SSO has a clear advantage is memory consumption, but SFS has not been tuned with respect to memory consumption, and we believe its memory footprint can be significantly reduced.
B. Performance Discussion
There are several observations about the SFS results that may seem surprising.
First, the solve times for SFS are sometimes smaller than the AUX times, but remember that the AUX column includes the time for AUX to generate constraints, optimize those constraints, solve them, and then do some post-processing on the results to prepare them for the SFS solver. On the other hand, the solve times only include the time taken for SFS to actually compute an answer given the def-use graph.
Second, we see that the analysis times can vary quite widely, even for benchmarks that are close in size. Some smaller benchmarks take significantly longer than larger benchmarks. The analysis time for a benchmark depends on a number of factors besides the raw input size: the points-to set sizes involved; the characteristics of the def-use graph, which determines how widely pointer information is propagated; how the worklist algorithm interacts with the analysis; and so forth. It is extremely difficult to predict analysis times without knowing such information, which can only be gathered by actually performing the analysis.
Finally, the prep time for SFS, which includes the time to compute SSA information using the AUX results and the time to optimize the analysis using Top-level Pointer Equivalence and Local Points-to Graph Equivalence, takes a significant portion of the total time for SFS. While the prep stage is compute-intensive, there are several optimizations for this stage that we have not yet implemented. We believe that the times for this stage can be significantly reduced.
VII. Conclusions
The ability to perform a sparse analysis is critical to the scalability of any flow-sensitive analysis. In this paper, we have shown how pointer analysis can be performed sparsely with a staged approach. In particular, our algorithm uses a highly efficient inclusion-based pointer analysis to create conservative def-use information, and from this information the algorithm performs a sparse flow-sensitive pointer analysis. Our new algorithm is quite scalable even though it has not yet been carefully tuned. In particular, we have identified a number of memory optimizations that should reduce its high memory requirements, and other optimizations should improve its already fast analysis time.
This paper presents the first study of staged pointer analysis, a family of algorithms that we believe deserves further exploration. In particular, the idea of a context-sensitive auxiliary analysis is an intriguing idea for future work. As we have mentioned, a combined flow- and context-sensitive analysis limits scalability, but by obtaining context-sensitive and flow-sensitive information in sequence rather than in a combined analysis, this new staged analysis promises to offer significantly greater scalability than previous flow- and context-sensitive algorithms, albeit with less precision.
REFERENCES
TABLE II
<table>
<thead>
<tr>
<th>Name</th>
<th>SSO</th>
<th>SFS</th>
<th>Time</th>
<th>Mem</th>
<th>Prelim</th>
<th>Prep</th>
<th>Solve</th>
<th>Total Time</th>
<th>Mem</th>
<th>Time Comp</th>
<th>Mem Comp</th>
</tr>
</thead>
<tbody>
<tr>
<td>197.parser</td>
<td>0.41</td>
<td>0.29</td>
<td>0.07</td>
<td>0.08</td>
<td>0.37</td>
<td>275</td>
<td>1.11</td>
<td>0.50</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>300.twolf</td>
<td>0.23</td>
<td>0.34</td>
<td>0.07</td>
<td>0.00</td>
<td>0.41</td>
<td>281</td>
<td>0.56</td>
<td>0.50</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>gcc</td>
<td>0.35</td>
<td>0.29</td>
<td>0.10</td>
<td>0.00</td>
<td>0.40</td>
<td>277</td>
<td>0.88</td>
<td>0.51</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>255.vortex</td>
<td>0.60</td>
<td>0.45</td>
<td>0.14</td>
<td>0.02</td>
<td>0.62</td>
<td>285</td>
<td>0.97</td>
<td>0.51</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>254.gap</td>
<td>1.28</td>
<td>0.94</td>
<td>0.33</td>
<td>0.01</td>
<td>1.29</td>
<td>307</td>
<td>0.99</td>
<td>0.50</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>sendmail</td>
<td>1.21</td>
<td>0.70</td>
<td>0.27</td>
<td>0.03</td>
<td>1.00</td>
<td>301</td>
<td>1.21</td>
<td>0.49</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>253.peribnk</td>
<td>2.30</td>
<td>1.05</td>
<td>0.50</td>
<td>0.02</td>
<td>1.57</td>
<td>312</td>
<td>1.46</td>
<td>0.51</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>nethack</td>
<td>3.16</td>
<td>1.72</td>
<td>0.82</td>
<td>0.09</td>
<td>2.64</td>
<td>349</td>
<td>1.20</td>
<td>0.56</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>python</td>
<td>120.16</td>
<td>4.04</td>
<td>2.02</td>
<td>0.56</td>
<td>6.62</td>
<td>404</td>
<td>18.15</td>
<td>0.86</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>175.gcc</td>
<td>3.74</td>
<td>2.00</td>
<td>1.42</td>
<td>0.04</td>
<td>3.46</td>
<td>370</td>
<td>1.08</td>
<td>0.51</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>vim</td>
<td>61.85</td>
<td>2.93</td>
<td>2.44</td>
<td>0.16</td>
<td>5.53</td>
<td>436</td>
<td>11.18</td>
<td>0.55</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>pine</td>
<td>347.53</td>
<td>13.42</td>
<td>21.25</td>
<td>47.33</td>
<td>82.00</td>
<td>876</td>
<td>4.24</td>
<td>0.73</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>svn</td>
<td>185.10</td>
<td>5.40</td>
<td>5.07</td>
<td>0.21</td>
<td>10.69</td>
<td>418</td>
<td>17.32</td>
<td>0.56</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>ghostscript</td>
<td>OOT</td>
<td>—</td>
<td>42.98</td>
<td>86.13</td>
<td>1787.18</td>
<td>1916.29</td>
<td>2359</td>
<td>∞</td>
<td>0</td>
<td></td>
<td></td>
</tr>
<tr>
<td>gimp</td>
<td>OOT</td>
<td>—</td>
<td>90.59</td>
<td>105.87</td>
<td>1025.82</td>
<td>1222.28</td>
<td>3273</td>
<td>∞</td>
<td>0</td>
<td></td>
<td></td>
</tr>
<tr>
<td>tshark</td>
<td>OOT</td>
<td>—</td>
<td>232.54</td>
<td>219.83</td>
<td>376.096</td>
<td>828.47</td>
<td>6378</td>
<td>∞</td>
<td>0</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Performance: time (in seconds) and memory (in megabytes) of the analyses. OOT means the analysis ran out of time (exceeded a 1 hour time limit). SFS is broken down into the main stages of the analysis: the auxiliary pointer analysis, the preparation stage that computes sparseness, and the actual time to solve. Time Comp is the SSO time divided by the SFS time (i.e., speedup; larger is better). Mem Comp is the SSO memory divided by the SFS memory (larger is better).
|
{"Source-Url": "http://www.cs.ucsb.edu:80/~benh/research/papers/hardekopf11flow.pdf", "len_cl100k_base": 12416, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 39809, "total-output-tokens": 14515, "length": "2e13", "weborganizer": {"__label__adult": 0.00035881996154785156, "__label__art_design": 0.0002987384796142578, "__label__crime_law": 0.00030803680419921875, "__label__education_jobs": 0.0003228187561035156, "__label__entertainment": 5.4836273193359375e-05, "__label__fashion_beauty": 0.0001494884490966797, "__label__finance_business": 0.00015497207641601562, "__label__food_dining": 0.0003466606140136719, "__label__games": 0.0004992485046386719, "__label__hardware": 0.0011053085327148438, "__label__health": 0.0004394054412841797, "__label__history": 0.0002110004425048828, "__label__home_hobbies": 7.975101470947266e-05, "__label__industrial": 0.0003249645233154297, "__label__literature": 0.0002319812774658203, "__label__politics": 0.00026917457580566406, "__label__religion": 0.0004646778106689453, "__label__science_tech": 0.0111236572265625, "__label__social_life": 6.520748138427734e-05, "__label__software": 0.00385284423828125, "__label__software_dev": 0.978515625, "__label__sports_fitness": 0.0003104209899902344, "__label__transportation": 0.0005097389221191406, "__label__travel": 0.00020253658294677737}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 56629, 0.0314]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 56629, 0.4769]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 56629, 0.87376]], "google_gemma-3-12b-it_contains_pii": [[0, 5229, false], [5229, 11484, null], [11484, 17408, null], [17408, 23741, null], [23741, 27462, null], [27462, 33307, null], [33307, 39344, null], [39344, 44177, null], [44177, 50798, null], [50798, 56629, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5229, true], [5229, 11484, null], [11484, 17408, null], [17408, 23741, null], [23741, 27462, null], [27462, 33307, null], [33307, 39344, null], [39344, 44177, null], [44177, 50798, null], [50798, 56629, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 56629, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 56629, null]], "pdf_page_numbers": [[0, 5229, 1], [5229, 11484, 2], [11484, 17408, 3], [17408, 23741, 4], [23741, 27462, 5], [27462, 33307, 6], [33307, 39344, 7], [39344, 44177, 8], [44177, 50798, 9], [50798, 56629, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 56629, 0.12274]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
e90a4f69f36cc03ca8477092a1b2612433c53537
|
[REMOVED]
|
{"len_cl100k_base": 15762, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 57556, "total-output-tokens": 18845, "length": "2e13", "weborganizer": {"__label__adult": 0.00042557716369628906, "__label__art_design": 0.00043654441833496094, "__label__crime_law": 0.0005884170532226562, "__label__education_jobs": 0.0017566680908203125, "__label__entertainment": 0.00012445449829101562, "__label__fashion_beauty": 0.0002027750015258789, "__label__finance_business": 0.00036263465881347656, "__label__food_dining": 0.0006227493286132812, "__label__games": 0.0015554428100585938, "__label__hardware": 0.001056671142578125, "__label__health": 0.0009222030639648438, "__label__history": 0.0003497600555419922, "__label__home_hobbies": 0.0001819133758544922, "__label__industrial": 0.00061798095703125, "__label__literature": 0.0007042884826660156, "__label__politics": 0.0003936290740966797, "__label__religion": 0.0006504058837890625, "__label__science_tech": 0.10150146484375, "__label__social_life": 0.00011038780212402344, "__label__software": 0.00913238525390625, "__label__software_dev": 0.876953125, "__label__sports_fitness": 0.0003695487976074219, "__label__transportation": 0.00077056884765625, "__label__travel": 0.00020432472229003904}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 63449, 0.02825]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 63449, 0.63189]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 63449, 0.83935]], "google_gemma-3-12b-it_contains_pii": [[0, 1356, false], [1356, 6740, null], [6740, 13477, null], [13477, 19500, null], [19500, 23404, null], [23404, 30063, null], [30063, 35511, null], [35511, 42351, null], [42351, 45611, null], [45611, 48674, null], [48674, 54739, null], [54739, 60982, null], [60982, 63449, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1356, true], [1356, 6740, null], [6740, 13477, null], [13477, 19500, null], [19500, 23404, null], [23404, 30063, null], [30063, 35511, null], [35511, 42351, null], [42351, 45611, null], [45611, 48674, null], [48674, 54739, null], [54739, 60982, null], [60982, 63449, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 63449, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 63449, null]], "pdf_page_numbers": [[0, 1356, 1], [1356, 6740, 2], [6740, 13477, 3], [13477, 19500, 4], [19500, 23404, 5], [23404, 30063, 6], [30063, 35511, 7], [35511, 42351, 8], [42351, 45611, 9], [45611, 48674, 10], [48674, 54739, 11], [54739, 60982, 12], [60982, 63449, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 63449, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
7cd74b1723beb8e877b421db1e8ab15d946b9314
|
YIOOP FULL HISTORICAL INDEXING IN CACHE NAVIGATION
A Writing Report
Presented to
The Faculty of Department of Computer Science
San José State University
In Partial Fulfillment of
The Requirements for the Degree
Master of Science
By
Akshat Kukreti
May 2013
The Undersigned Project Committee Approves the Project Titled
YIOOP FULL HISTORICAL INDEXING IN CACHE NAVIGATION
By
Akshat Kukreti
APPROVED FOR THE DEPARTMENT OF COMPUTER SCIENCE
Dr. Chris Pollett, Department of Computer Science Date
Dr. Chris Tseng, Department of Computer Science Date
Dr. Soon Tee Teoh, Department of Computer Science Date
Abstract
Yioop Full Historical Indexing In Cache Navigation
This project adds new cache-related features to Yioop, an Open Source, PHP-based search engine. Search engines often maintain caches of pages downloaded by their crawler. Commercial search engines like Google display a link to the cached version of a web page along with the search results for that particular web page. The first feature enables users to navigate through Yioop’s entire cache. When a cached page is displayed along with its contents, links to cached pages saved in the past are also displayed. The feature also enables users to navigate cache history based on year and month. This feature is similar in function to the Internet Archive as it maintains snapshots of the web taken at different times. The contents of a web page can change over time. Thus, a search engine caching web pages has to make sure that the cached pages are fresh. The second feature of this project implements cache validation using information obtained from web page headers. The cache validation mechanism is implemented using Entity Tags and Expires header. The cache validation feature is then tested for effect on crawl speed and savings in bandwidth.
Acknowledgements
I would like to express my sincere gratitude to my Masters Project advisor, Dr. Chris Pollett. Without his guidance, constant encouragement and support, the project would not have been completed on time.
I would also like to express my appreciation to Dr. Chris Tseng and Dr. Soon Tee Teoh for their time, and for being part of my CS298 committee.
Contents
YIOOP FULL HISTORICAL INDEXING IN CACHE NAVIGATION .......................................................... 1
1. Introduction ........................................................................................................................................... 9
2. Background ......................................................................................................................................... 11
2.1 Web Crawlers .................................................................................................................................. 11
2.1.1 The Crawling Process .............................................................................................................. 11
2.2 Web Caches And Search Engines ................................................................................................. 12
2.3 The Internet Archive and WayBack Machine ................................................................................... 14
2.3.1 The Internet Archive ................................................................................................................. 14
2.3.2 The WayBack Machine ............................................................................................................. 14
2.4 Yioop Search Engine Software ...................................................................................................... 17
2.4.1 Yioop's Model ............................................................................................................................ 17
3. Implementing The History Feature .................................................................................................... 20
3.1 Modifying Yioop's Cache Request And Output Code ...................................................................... 20
3.2 Modifying Links Within Cache Pages ........................................................................................... 21
3.3 History UI ........................................................................................................................................ 23
4. Entity Tags And Expires Headers ....................................................................................................... 24
4.1 Entity Tags ....................................................................................................................................... 24
4.1.1 Experiment With Entity Tags, PHP, and cURL ........................................................................ 25
4.2 Expires Header ................................................................................................................................. 26
5. Modifying Yioop's Fetcher .................................................................................................................. 27
6. Disk Access Experiment ...................................................................................................................... 29
7. Data Structure for Cache Page Validators .......................................................................................... 31
7.1 B-Trees .......................................................................................................................................... 31
7.2 B-Tree Implementation in PHP ....................................................................................................... 33
7.3 Augmenting Yioop's Queue Server ................................................................................................. 34
7.4 Implementing the Cache Page Validation Feature ........................................................................... 35
7.4.1 Queue Server pseudo-code for storing Cache Page Validators .................................................. 35
7.4.2 Queue Server pseudo-code for Lookup of Cache Page Validation Data when producing fetch batches .......................................................................................................................... 36
7.4.3 Fetcher pseudo-code for Fetcher for handling Cache Page Validation Data .......................... 37
8. Experiments ......................................................................................................................................... 38
8.1 Testing the effect on fetch batch creation time ................................................................. 38
8.2 Determining effect of cache page validation on bandwidth ............................................ 41
9. Conclusion .......................................................................................................................... 43
Bibliography .......................................................................................................................... 44
List of Figures
Figure 1: Example of robots.txt Source: http://www.robotstxt.org/robotstxt.html .........................11
Figure 2: Google’s cache link Source: http://google.com .................................................................13
Figure 3: Section of a cached page Source: http://google.com ............................................................13
Figure 4: WayBack Machine interface Source: http://archive.org .....................................................15
Figure 5: Yioop crawl in a multiple Queue Server setting ...............................................................18
Figure 6: Searching within the cache ...................................................................................................21
Figure 7: Modified links within cached pages .......................................................................................22
Figure 8: Redirection within the cache ..................................................................................................22
Figure 9: Yioop's History feature ........................................................................................................23
Figure 10: ETag extraction using PHP cURL .......................................................................................25
Figure 11: ETag headers in PHP cURL ..................................................................................................26
Figure 12: Yioop Work Directory .........................................................................................................27
Figure 13: Cache page validation data written by Yioop's Fetcher .......................................................28
Figure 14: Disk access experiment results ...........................................................................................30
Figure 15: A B-Tree with minimum degree 501 ..................................................................................32
Figure 16: B-Tree node for cache page validation feature .................................................................33
Figure 17: Cache page validators written by Queue Server ..............................................................34
Figure 18: B-Tree nodes for cache page validators ..............................................................................34
Figure 19: Table comparing fetch schedule write times ......................................................................38
1. Introduction
The idea behind this project is to enhance Yioop’s cache related functionality in terms of displaying cached versions of web pages and maintaining cache freshness. The web is an important source of information and is ever changing. Web pages that are active today may become inactive tomorrow. The Internet Archive takes regular snapshots of the web so that along with the current versions of web pages, previous versions are also accessible. It does not however, support full text search on the archived pages. It would be an improvement; if, along with the search results displayed by a search engine, users are also able to access cached copies of the page taken at an earlier date, and also, be able to perform full text search on cached pages. This is the motivation behind the first feature of this project which enables users to view all cached copies of a web page. The feature keeps track of cached pages during search time. A search engine may re-crawl a set of web pages after a certain number of days. If the content of the page has not changed, bandwidth is wasted on downloading the page again. Bandwidth can be saved by checking if a web page is still fresh. For example, Google uses If-Modified-Since header for validating cached pages. The motivation behind the second feature of this project is to experiment with a different way of validating cached versions of web pages that uses Entity Tag and Expires header. The second feature keeps track of cached pages during crawl time.
This report describes the work done in my Masters project, and consists of the following sections. The first section describes the background and preliminary work where I explored Yioop! and the Internet Archive. The second section describes my experiments with Yioop!’s cache request and output mechanism, modification of links within cached pages and, implementing and testing a history feature that enables users to view all cached versions for a web page. The third section describes my experiments with PHP, cURL and Entity Tags. The fourth section describes how I modified Yioop!’s Fetcher program to separately send cache-
related data to the Queue Server. The fifth section describes my experiments for estimating a lower bound on the lookup of ETags. It also describes my implementation the B-Tree data structure for storage and lookup of ETags, and integration with Yioop!’s Queue Server for scheduling. The sixth section describes experiments with the modified Yioop! code and their results. The last section of the report is conclusion and future work.
2. Background
2.1 Web Crawlers
Search engines use web crawlers to build their search index of the web. Web crawlers are programs that visit links, download the web pages for those links, extract links from the downloaded web pages, and repeat the process for the extracted links (Stefan Büttcher, 2010). The responsibilities of a web crawler include de-duplicating web pages, re-crawling web pages to ensure that the search index is up to date, assigning priority to web pages so that the most important web pages are re-crawled before the less important ones. Web crawlers maintain a priority queue of URLs that have already been seen to determine which URLs should be re-crawled first (Stefan Büttcher, 2010).
2.1.1 The Crawling Process
The crawling process starts with an initial set of URLs. The web crawler begins by selecting URLs from the priority queue of URLs. Next, the web crawler performs Domain Name Translation to determine the IP address for the URL. Before downloading a web page, a web crawler must check if it is allowed to download that web page. Web site owners use "robots.txt" file to indicate to web crawlers, the pages of the web pages it is allowed to crawl (About /robots.txt). A "robots.txt" file contains directions along with paths to resources that the web crawler may not download.
```
User-agent: *
Disallow: /
```
Figure 1: Example of robots.txt Source: http://www.robotstxt.org/robotstxt.html
Figure 1 shows an example of a robots.txt file. The "User-agent: crawler-name" is at the start of the file. It denotes the names of the crawlers for which, the instructions that follow, apply. In the example, the * next to User-agent denotes that the instructions must be followed by all web crawlers (Stefan Büttcher, 2010). The "Disallow: path" indicates that the web crawler must not download the resource. In the example, Disallow: / indicates that all the web crawler must not download any resource associated with the URL.
After making sure that a page can be downloaded, the web crawler downloads the page. The web crawler then processes the page to extract information about the page which includes URLs. The page is then saved so that it may be added to the search engine's index. The URLs extracted during processing of the downloaded pages are then added to the priority queue of URLs. The web crawler then again extracts URLs from the priority queue, and the process continues.
2.2 Web Caches And Search Engines
A web cache is used to store copies of web pages accessed by the program maintaining the web cache. Maintaining web caches is useful as recent copies of web pages can be accessed without actually visiting the link for that particular web page. If a web page containing information of interest is not active, but the web cache contains a recent copy of the web page, the desired information can be obtained by accessing the cached copy (Web Cache).
Search engines also make use of web caches for saving copies of documents downloaded by their web crawlers. Commercial search engines like Google display the link to the cached version of the web page along with the results of the search query. Figure 2 shows how Google displays links to the cached version of a web page. Figure 3 shows what a cached page looks like. The top of the page contains the date at which the web page was cached.
noarchive: The noarchive directive can be used to tell the web crawler that a particular web page must not be archived. It can be specified using a <meta> tag within the contents of a web page, or specified using the X-Robots tag in the page headers.
For example, `<meta name="robots" content="noarchive"/>
HTTP 1.1 200 OK
(...)
X-Robots-Tag: noarchive
In this project, the new features modify how Yioop handles cached copies of web pages during search time, and add a new method for validating cached pages during crawl time.
Figure 2: Google's cache link Source: http://google.com
Figure 3: Section of a cached page Source: http://google.com
2.3 The Internet Archive and WayBack Machine
2.3.1 The Internet Archive
The Internet Archive is an internet library that maintains a vast collection of historical web content. Its web page archive currently has 333 billion pages (Internet Archive). It was established in 1996 by Brewster Kahle and Bruce Gilliat in San Francisco, California (Rackley, 2010). The Internet Archive uses Heritrix, an Open Source, Java-based web crawler, for downloading content from the web (Rackley, 2010). For storing web crawls, the internet archive uses the WARC file format. WARC files save the downloaded web resources along with the meta-data associated with them such as encoding (WARC, Web ARChive File Format).
The history feature of this project allows users to access all versions of a cached page. This feature is similar to the Internet Archive as the entire history of cache pages is accessible to the user. But the history feature allows users to do full-text searches on the cached pages which is not supported by the Internet Archive.
2.3.2 The WayBack Machine
Internet Archive’s WayBack machine allows users to access the archived web pages. The Wayback Machine allows users to enter the URL of the webpage for which they wish to see the archived pages. On entering the URL, the Wayback Machine redirects to a page that contains snapshots of the webpage grouped by years and months. Users can select year and month to view a particular snapshot of the web page. There can be more than one snapshots per day for a particular web page. The motivation behind the first feature of this project was to provide a feature similar to the WayBack Machine in a search engine so that users are able to access the archive of cached pages along with the latest version. The history feature in Yioop displays linked to all cached versions of a web page, grouped by year and month.
2.3.2.1 URL Modification In The WayBack Machine
The Internet Archive modifies the URLs of web pages before caching them. The URLs are modified so that they redirect to a cached page instead of the live page. The link is modified by appending the time at which the page was cached, and the URL to a web prefix.
For example, consider the following modified link:
web.archive.org/web/20050214202400/http://www.google.com
Web page URL: http://www.google.com
Web Prefix: web.archive.org/web/
The number **20050214202400** Corresponds to the time at which the web page was cached.
Year: **2005**
Day and Month: **0214 (February 14)**
Time: **202400 (20:24:00)**
The URL is modified using JavaScript. When a user clicks on a particular date in the WayBack Machine’s history interface, the JavaScript calculates the date and time from the click event, appends it to the Web prefix. The original URL is then appended after the date and time to form the modified link. The user is then redirected to the archive page with the modified link.
The history feature in this project also modifies links to cached pages. The link modification is done server-side unlike the WayBack machine’s client-side link modification.
2.4 Yioop Search Engine Software
Yioop is an Open Source, PHP-based search engine software developed at Seek Quarry by Dr. Chris Pollett (Pollett). Yioop allows users to crawl websites and create search indexes for those websites. The indexing of website is done alongside the website crawl. After stopping a crawl, the resultant search engine can be used for querying Yioop (Pollett). Yioop uses the C-based multi-curl library for multi-threading, which it uses to download multiple web pages concurrently. In order to implement cache page validation in Yioop, Yioop's crawl process had to be modified to support extraction and use of cache page validators like Entity Tags and Expires headers.
2.4.1 Yioop's Model
Yioop requires a running web server in order to perform crawls and building search indexes. The major components are listed below. Yioop can work on a single machine and also in a distributed setting. In a distributed setting, each node consists of the components listed below (Pollett).
1. **Name Server**: The Name Server is responsible for coordinating the crawl process. In a distributed setting. The name Server is present in the node that is responsible for coordinating the crawl.
2. **Queue Server**: The Queue Server program is responsible for maintaining a priority queue for URLs. The Queue Server schedules URLs of websites to be downloaded and also adds the downloaded pages to the search index.
3. **Fetcher**: The Fetcher program is responsible for downloading web pages.
2.4.1.1 How Yioop Works
The Queue Servers create batches of URLs to be downloaded and save them in their respective working directories. The Fetchers periodically look for URLs to be fetched. When found, the Fetchers read in the batch of URLs to be fetched and download the web pages for those URLs. After downloading the web pages, the Fetchers extract information from the web page headers like and create summaries of downloaded web pages. The summaries are then written back to the working directory. The URLs are hashed on to the id of Queue Servers to make sure that the summary data goes to the correct Queue Server. The Queue Servers read the summary data and incrementally add the data to the search index. The URLs extracted from web page summaries are then added to the priority queue.
Figure 5: Yioop crawl in a multiple Queue Server setting
Figure 5 depicts Yioop in a multiple Queue Server setting. The second feature of this project augments the Fetcher to separately send the cache page validation data to the Queue Server. The Queue Server is modified to store the cache page validation data received from Fetchers, and use the saved cache page validation data when creating URL fetch batches for the Fetcher.
3. Implementing The History Feature
3.1 Modifying Yioop's Cache Request And Output Code
As a first step towards building the history feature, I modified Yioop's cache request and output code. When Yioop displays the results of a search query, it also displays a link to the cached version along with each search result. The following is an example of a link to a cached page.
```
```
The parameter "a = cache" means that the search is taking place within the cache and the parameter "its = 1336804999" is the timestamp at which the page was cached. When a cache page is requested, Yioop searches for the specified timestamp. If a cached version of a page exists for the specified timestamp, it is displayed. Otherwise, the a "no cache" is returned.
I modified Yioop's code so that if the specified timestamp is not found, Yioop tries to look for a timestamp that is nearest (past or future) to the specified timestamp that has a cached page associated with it. If such a timestamp is found, the cached page is displayed. Otherwise "no-cache" is returned.
3.2 Modifying Links Within Cache Pages
In order to make sure that the links within a cached page also redirect to a cached page, I augmented Yioop's URL canonicalization code so that the links within the cached pages follow the cache search process in 3.1. The only difference is that if no timestamp with a cached page is found for a link within a cached page, the link redirects to the live page. The link modification is similar to the modification done by the WayBack Machine. The modification however, is done at server-side.
In Figure 7, the link at the bottom of the page includes the flag "from_cache = true" to indicate that the link is from a cached page. The timestamp is also appended to the link so that it redirects within the cache before going to the live site. The modified link redirects to a cached page as shown in Figure 8.
Figure 7: Modified links within cached pages
Figure 8: Redirection within the cache
3.3 History UI
The history feature combines the work done in steps 3.2 and 3.3. Step 3.1 enabled users to navigate from one cache page to another by changing the timestamp parameter in the link. In this step I created a User Interface for navigating through cached pages. The interface works by first finding links to all cached pages for a given URL. When a cached version of a web page is displayed, links to all cached versions are also displayed. For navigation, the User Interface allows users to select the year and month so that they can choose the time for the cached page. The links display the day and time for each year and month combination. The history feature is controlled by a Toggle link above the extracted headers and summaries link. I developed the history feature using PHP DOM and JavaScript.

This cached version of http://scholarworks.sjsu.edu/communities.html was obtained by the Yioop crawler on December 26, 2012 00:21:34.
4. Entity Tags And Expires Headers
4.1 Entity Tags
An Entity Tag or ETag is a unique identifier associated with web resource. It is a part of the HTTP header (HTTP ETag). Whenever a resource with an ETag is modified, a new ETag is generated for the modified resource. This can be used to compare different versions of the same web resource. The difference in ETag values can tell that the versions of the web resource are different. For all resources belonging to the same server, the ETags must be unique. When making a request to a server, the following HTTP headers may be sent to check the version of a particular resource. There are two types of ETags:
1. Strong ETag: Strong ETags are used to check if two resources are the same at every byte (HTTP ETag). For example, ETag: "1cabfJk4c9"
2. Weak ETag: Weak ETags are used to check if two resources are similar. The resources might not be identical. For example, ETag: W/"1cabfJk4c9"
For checking if a resource has changed or not, the following HTTP headers may be sent when making a request for a resource.
1. If-Match: ETag: If ETag matches the ETag value of the resource being requested, the entire resource is returned. Otherwise, a status 402 (precondition failed) is returned.
2. If-None-Match: ETag: If ETag matches the ETag value of the resource being requested, that means the resource has not been modified and a status 302 (not modified) is returned. Otherwise, the entire resource is returned.
4.1.1 Experiment With Entity Tags, PHP, and cURL
As mentioned earlier, Yioop uses cURL, a library written in C language, for downloading multiple pages concurrently. The second feature of this project uses ETags for validating cached web pages. As the first towards developing the second feature of this project, I experimented to learn how web pages can be downloaded using cURL and PHP, and also to experiment with different ETag headers.
I wrote a program that downloads a web page and checks if the page has an ETag associated with it. If the ETag is found, the program extracts it. The program then again tries to download the same web page, but with different ETag headers. This experiment helped me understand how various ETag headers work. The cache page validation feature of this project modifies Yioop's Fetcher to use ETags when downloading web pages.
---
**Figure 10: ETag extraction using PHP cURL**
4.2 Expires Header
The Expires header is also part of HTTP. For a resource, the Expires header has the date after which the resource will expire. The format of the Expires header is as follows (Header Definitions)
Expires: HTTP-Date
For example, Expires: Sun, 05 May 2013 15:00:00 GMT
The second feature if this project modifies Yioop’s Queue Server to check if a web page is still fresh. If yes, then the web page is not scheduled for download.
5. Modifying Yioop's Fetcher
After learning about Entity Tags and Expires headers, the next step was to modify Yioop so that it extracts ETags and Expires headers from web pages. As mentioned before, when the Fetcher downloads a web page, it extracts information from the web page such as Content-Type, Last-Modified etc. As the first step, I added the code for extracting ETags and Expires header for a website to the code that downloads the URL. The ETags and Expires headers were then saved with the website summaries, to be processed by the Fetcher.
Based on the size of the downloaded pages, Yioop's Fetcher periodically writes web page summaries, including extracted URLs to the Name Server so that it can be processed by the Queue Server. This data is written to files that are processed by the Queue Server.

Figure 12 shows the contents of the schedules directory within a Yioop instance’s working directory. The figure shows Index and Robot data that is written by the Fetcher. Data for different crawl times is written separately.
As shown in Figure 12, the Fetcher sends Robot Data and Index Data back to the Queue Server. Robot Data is used to filter out what paths of the website Yioop is allowed to crawl. The Index data is processed by the Queue Server for building the search index. The Robot data has a lifetime of one day. After one day, the Robot data is deleted and fresh Robot data is downloaded. I modified Yioop’s Fetcher so that along with Index and Robot data, Cache page validation data is also sent to the Queue Server.

Figure 13: Cache page validation data written by Yioop’s Fetcher
When information is extracted from the header of a web page, the modified code checks if there is an ETag and an Expires header. If either is found, the URL, along with the ETag and/or the Expires header is saved so that it can be written back to the Queue Server as cache page validation data. If no ETag and no Expires header is found, the URL is not saved in cache page validation data. The cache page validation data is then appended to Robot data and Index data, and sent to the Queue Server.
6. Disk Access Experiment
According to (WorlWideWebSize.com), the size of the indexed web is at least 14.37 billion pages. In order to validate a similar or number of cached web pages using by Entity Tags and /or Expires tags, it is important that the solution be efficient in both storing the cache page validators (ETags or Expires) headers, and also fast in lookup so that the crawl speed is not affected.
Let us assume that the average length of an ETag and a URL is 32 bytes. Then, in order to store 1 billion URL-ETag pairs, total space required would be \((32 + 32) \times 1,000,000,000\) bytes that is 64,000,000,000 bytes or 64 GB. There are limits on the maximum file size allowed and this limit varies from one file system to another. For example, the ext2 and ext3(second and third extended file systems) allow the maximum file size to be between 16 GB and 2 TB. Sun’s ZFS on the other hand, allows maximum file size to be up to 16 Exabytes. The cache page validation feature, apart from being able to work on modern file systems, should also be able to work on file systems where the maximum allowable size is less than the values mentioned above. According to (Comparison of file systems), the lowest maximum allowable file size is 2 GB for file systems like HFS and FAT16. Therefore I chose 2 GB as the size for my disk access experiment.
Using 2 GB as the file size, I conducted the following experiment to estimate a lower bound on the time it takes to look-up values from a file. I populated a file with values written with 4 byte intervals. The values were randomly generated, and were between 1 and 1 million. The first value was written at byte 0, the next one at byte 0 + length of first entry + 4 bytes, and so on. The file was populated to 2 GB.
When the Queue Server produces a fetch batch, the fetch batch consists of 5000 URLs. Thus, the second feature of this project would require 5000 lookups during scheduling. The
lookup should be fast enough so that the crawl speed is not affected. I generated 5000 random numbers along with their offsets within the file that was populated earlier. I did a lookup for those 5000 values and recorded the total time taken for the lookup.
Figure 14: Disk access experiment results
Figure 14 shows the results of the disk access experiment. The average time to do 5000 lookups for a file containing values at 4 byte offsets is 0.022 seconds. In order to do 5000 lookups on multiple files would require more time. Thus, the experiment helped me estimate the least amount of time required for doing 5000 lookups.
7. Data Structure for Cache Page Validators
After estimating the lower bound for doing 5000 lookups, the next step was to select an appropriate data structure for storing cache page validation data. As discussed earlier, 5000 lookups on a huge volume of data would require lookups in multiple files. Therefore, an efficient disk-based data structure would be required to save such large volumes of data and also provide fast lookups.
7.1 B-Trees
A B-Tree is a tree data structure that has a high branching factor. The branching factor can be as high as 1000. The branching factor for a B-Tree is decided by a number called the minimum degree of a B-Tree (Thomas H. Cormen, 2001). If the minimum degree of a B-Tree is min_deg, then
1. Minimum number of keys for nodes other than the root node = min_deg - 1
2. Minimum number of child nodes for nodes other than the root node = min_deg
3. Maximum number of keys for any node = 2 * min_deg - 1
4. Maximum number of links for any node = 2 * min_deg
Consider a B-Tree with order 501. Then,
Maximum number of keys in root = 2 * 501 - 1 = 1001
Maximum number of children for root node = 1,002
Therefore, at root level, 1001 keys can be saved
Similarly level 1, each one of 1002 nodes will have 1001 keys. Therefore, number of keys after completely filling up the first two levels = 1002 * 1001 = 1,003,002 keys
For level 2, number of keys = 1003003 * 1001 = 1,004,006,003 keys
Level 3, number of keys = \(1004006004 \times 1001 = 1,005,010,010,004\) keys
Thus, a B-Tree with minimum degree 1001 and height 3 can easily accommodate 100 billion keys. If the root node is kept in memory and each node is a file, then in order to do one lookup, we would access only 3 files. Going back to our assumption about the length of URLs and ETags, the size of a node would be 64 KB.
Due to the above mentioned reasons, I chose the B-Tree data structure for implementing the cache page validation feature. The B-Tree definition used in this project is defined in (Thomas H. Cormen, 2001). Each node, whether internal, or leaf, stores the complete information which is keys and values. Internal nodes also store links to child nodes.
Figure 15: A B-Tree with minimum degree 501
7.2 B-Tree Implementation in PHP
For the cache page validation feature of this project, I implemented a B-Tree for storage and lookup of cache page validation data. As explained above, I chose the minimum degree to be 501. I also made use of Yioop's hash function for generating keys for the B-Tree. Each node of the B-Tree consists of an array of key-value pair. The key-value pair consists of the hash of the URL, calculated using Yioop's hash function, and the ETag/Expires header as the value. Each internal node of the B-Tree also stores the links to child nodes. Each node has an integer id. Also, each internal node saves links to child nodes. The links are maintained using the node ids.

Figure 16: B-Tree node for cache page validation feature
Augmenting Yioop’s Queue Server
As the next step, I modified Yioop’s Queue Server to include the B-Tree implemented by me in the previous step. During a web crawl, the Queue Server periodically checks if the Fetcher has written Robot and Index data to the Name Server. If found, the Queue Server incrementally adds the Index Data to the search index for the current crawl timestamp. In section 5, I modified Yioop’s Fetcher to separately send Cache Page Validation Data along with Index and Robot Data. In this step, I modified the Queue Server to also check for Cache Page Validation Data when it checks for Robot and Index Data. If found, the Queue Server reads the data, and extracts the URL, ETag, and Expires header. The Queue Server then calculates the hash of the URL using its own hash function. The hash of the URL serves as the key for each key-value pair and, the ETag and Expires headers form the value. The hash of the URL, along with the ETag and the Expires header are inserted into the B-Tree. A separate B-Tree is used for each index timestamp and is saved in the work directory.
Figure 17: Cache page validators written by Queue Server
Figure 18: B-Tree nodes for cache page validators
Implementing the Cache Page Validation Feature
After modifying the Queue Server, the next step was to integrate the modified Queue Server with the modified fetcher program. I modified Queue Server to include lookup of ETags and Expires headers when the fetch batch is made. If an ETag is found, it is sent to the Fetcher along with the associated URL when sending the fetch batch. The Fetcher, on getting an ETag, appends the HTTP header with the If-None-Match ETag header before downloading the web page. On the other hand, if the Queue Server finds Expires Tags, it checks if the page is still fresh. If yes, the URL is not scheduled. Otherwise, the URL is scheduled.
7.4.1 Queue Server pseudo-code for storing Cache Page Validators
1. Lookup cachePageValidationData in Work Directory
2. if cachePageValidationData is found
3. data = read(cachePageValidationData)
4. array(url, array(etag, expires)) = data
5. url_hash = hash(url)
6. btree->insert(array(url_hash, array(etag, expires)))
Following is a screen-shot showing the contents of a B-Tree node with Cache Page Validation Data.
7.4.2 Queue Server pseudo-code for Lookup of Cache Page Validation Data when producing fetch batches
1. While creating fetch batch of URLs to be downloaded
2. for each URL selected from priority queue
3. url_hash = hash(url)
4. array(url_hash, array(etag, expires)) = btree->lookup(url_hash)
5. if etag found and expires found
6. if current timestamp < expires
7. continue
8. else
9. append etag to url
10. else if only etag found
11. append etag to url
12. else if only expires found
13. if current timestamp < expires
14. continue
15. add url to fetch batch
7.4.3 Fetcher pseudo-code for Fetcher for handling Cache Page Validation Data
Fetcher pseudo-code for downloading a web page using cURL
```plaintext
function download(url, header)
1. Initialize cURL with url
2. add headers to cURL HTTP header
3. downloaded_page = execute cURL request
4. return downloaded_page
```
Fetcher pseudo-code downloading web pages, extracting cache page validation data, and sending the data to the Queue Server
1. Lookup scheduledata
2. if scheduledata is found
3. urls = read(scheduledata)
4. for each url in urls
5. if url has etag appended to it
6. url_header = concatenate("If-None-Match:", etag)
7. downloaded_page = download(url, url_header)
8. if downloaded_page has etag and expires
9. add array(url, array(etag, expires)) to list of found sites
10. if sending Index and Robot Data
11. Check if found sites have etag and expires
12. CachePageValidationData = array(array(url1, array(etag1, expires1)),
array(url2, array(etag2, expires2),...))
13. send IndexData, RobotData, and CachePageValidationData to Queue Server
8. Experiments
The aim of the second feature of this project was to experiment with a different feature for cache page validation that uses Entity Tags and Expires headers. This section describes the experiments done with the implemented cache page validation feature. The first experiment determines the impact of the cache page validation feature on the crawl speed. The second experiment measures savings in bandwidth due to ETags and Expires headers. The experiments were conducted in a multiple Queue Server setting using two instances of Yioop. The tests were conducted on a single machine.
8.1 Testing the effect on fetch batch creation time
As mentioned earlier, the Queue Server maintains a priority queue of URLs to be crawled. The Queue Server produces a fetch batch by selecting URLs from the priority queue. For the first experiment, I recorded the time taken to create fetch batches. First, I crawled 100,000 pages using Yioop, but without the cache page validation feature. Then, I crawled 100,000 pages again using the cache page validation feature. The page re-crawl frequency was set to 3 hours.
The following table gives a comparison of the time taken to write a fetch schedule, measured in seconds for both the Queue Servers.
Figure 19: Table comparing fetch schedule write times
<table>
<thead>
<tr>
<th></th>
<th>Yioop without cache page validation</th>
<th>Yioop with cache page validation</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Queue Server 1</strong></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1.</td>
<td>0.0051290000000001</td>
<td>0.001525</td>
</tr>
<tr>
<td>2.</td>
<td>0.040342</td>
<td>0.004855</td>
</tr>
<tr>
<td>3.</td>
<td>0.001158</td>
<td>0.075212</td>
</tr>
<tr>
<td>4.</td>
<td>0.026641</td>
<td>0.045726</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>---</td>
<td>-------</td>
<td>------------------</td>
</tr>
<tr>
<td></td>
<td></td>
<td>0.66937</td>
</tr>
<tr>
<td></td>
<td></td>
<td>0.033845</td>
</tr>
<tr>
<td>6.</td>
<td>0.680713</td>
<td>0.962385</td>
</tr>
<tr>
<td>7.</td>
<td>0.638508</td>
<td>1.230332</td>
</tr>
<tr>
<td>8.</td>
<td>0.629087</td>
<td>0.957314</td>
</tr>
<tr>
<td>9.</td>
<td>0.639234</td>
<td>15.306216</td>
</tr>
<tr>
<td>10.</td>
<td>0.669248</td>
<td>15.788489</td>
</tr>
<tr>
<td>11.</td>
<td>0.762741</td>
<td>21.100715</td>
</tr>
<tr>
<td>12.</td>
<td>0.74138</td>
<td>24.837989</td>
</tr>
<tr>
<td>13.</td>
<td>0.677873</td>
<td>18.193379</td>
</tr>
<tr>
<td>14.</td>
<td>2.677664</td>
<td>20.571448</td>
</tr>
<tr>
<td>15.</td>
<td>1.67749</td>
<td>32.711314</td>
</tr>
<tr>
<td>16.</td>
<td>2.784278</td>
<td>23.794299</td>
</tr>
<tr>
<td>17.</td>
<td>2.443083</td>
<td>17.042238</td>
</tr>
<tr>
<td>18.</td>
<td>2.640033</td>
<td>26.596688</td>
</tr>
<tr>
<td>19.</td>
<td>0.015935</td>
<td>23.030196</td>
</tr>
<tr>
<td>20.</td>
<td>0.008443</td>
<td>20.791269</td>
</tr>
<tr>
<td>21.</td>
<td>0.04249</td>
<td>23.682045</td>
</tr>
</tbody>
</table>
**Queue Server 2**
<p>| | | |</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1.</td>
<td>0.023429</td>
<td>0.010415</td>
</tr>
<tr>
<td>2.</td>
<td>0.681112</td>
<td>0.05673</td>
</tr>
<tr>
<td>3.</td>
<td>0.230002</td>
<td>0.001767</td>
</tr>
<tr>
<td>4.</td>
<td>0.670079</td>
<td>0.942093</td>
</tr>
<tr>
<td>5.</td>
<td>0.682405</td>
<td>0.605549</td>
</tr>
<tr>
<td>6.</td>
<td>0.677915</td>
<td>0.955226</td>
</tr>
<tr>
<td>7.</td>
<td>0.693039</td>
<td>20.635931</td>
</tr>
<tr>
<td></td>
<td>Time (in seconds)</td>
<td>Server Time (in seconds)</td>
</tr>
<tr>
<td>---</td>
<td>------------------</td>
<td>--------------------------</td>
</tr>
<tr>
<td>8</td>
<td>0.663932</td>
<td>20.970049</td>
</tr>
<tr>
<td>9</td>
<td>0.68279</td>
<td>20.368085</td>
</tr>
<tr>
<td>10</td>
<td>0.678535</td>
<td>20.551323</td>
</tr>
<tr>
<td>11</td>
<td>0.72232</td>
<td>16.540064</td>
</tr>
<tr>
<td>12</td>
<td>0.666994</td>
<td>18.379397</td>
</tr>
<tr>
<td>13</td>
<td>0.687878</td>
<td>27.736767</td>
</tr>
<tr>
<td>14</td>
<td>0.760716</td>
<td>24.651495</td>
</tr>
<tr>
<td>15</td>
<td>0.730754</td>
<td>18.515776</td>
</tr>
<tr>
<td>16</td>
<td>0.729345</td>
<td>26.390242</td>
</tr>
<tr>
<td>17</td>
<td>1.465243</td>
<td>19.291583</td>
</tr>
<tr>
<td>18</td>
<td>0.962642</td>
<td>16.473845</td>
</tr>
<tr>
<td>19</td>
<td>0.861857</td>
<td>16.899316</td>
</tr>
<tr>
<td>20</td>
<td>1.715415</td>
<td>15.541988</td>
</tr>
<tr>
<td>21</td>
<td>0.013842</td>
<td>16.077356</td>
</tr>
</tbody>
</table>
From the table, it can be seen that the least time taken for a B-Tree lookup was **15.3 seconds**, and the largest time taken was **32.7 seconds**. The average times for Queue Server 1 and 2 are calculated below.
**For Queue Server 1**
Average time taken for writing fetch batch schedule without cache page validation: **0.87596381**
Average time taken for writing fetch batch schedule with cache page validation: **13.65511805**
**For Queue Server 2**
Average time taken for writing fetch batch schedule without cache page validation: **0.714297333**
Average time taken for writing fetch batch schedule with cache page validation: **14.36166652**
Total Average time taken without cache page validation: **0.7951305715**
Total Average time taken with cache page validation: **14.008391625**
**Conclusion:** For a 100,000 page crawl, the cache page validation feature was on average slower by 14 seconds due to B-Tree lookup.
### 8.2 Determining effect of cache page validation on bandwidth
The aim of the second experiment was to determine the savings in bandwidth. For this experiment, I recorded the URLs that were not scheduled by the Queue Server because of the expires timestamp being greater than the current timestamp, and the URLs that return HTTP status 304 Not Modified on download due no change in ETag. Then, using cURL, I downloaded the web pages to determine their size. 100,000 web pages were crawled using the same settings used in 8.1.
**Findings:**
1. Total time taken to crawl 100,000 pages = **8 hours**
2. Total number of entries of cache page validation data stored in B-Tree = **54,939**
3. Total number of URLs that were not re-crawled due to ETags and Expires headers = **412**
4. Savings in MB for the URLs that were not re-crawled = **15.64 MB**
5. Most URLs that resulted were not crawled due to ETag/Expires were image files.
**Conclusion:** For the 100,000 web page crawl with a re-crawl frequency of 3 hours, the total time taken was 8 hours. A re-crawl frequency of 3 hours means that after every 3 hours, if a URL that has been already downloaded is encountered by the Queue Server, it will be scheduled again. From the figures mentioned above, it can be seen that during the 8 hour crawl,
only 412 URLs were re-crawled and resulted in a total of 15.64 MB. The number of URLs re-crawled URLs is a small fraction of the total URLs with cache page validation data stored in the B-Tree (0.7%). This small fraction resulted in total 15.64 MB savings. Therefore, based on the re-crawl policy, as the number of re-crawled URLs increases, the savings will be more. Also, a large number of URLs that were not re-downloaded were images. This is useful for both Yioop and the source of the image as bandwidth is saved for both when images are not re-downloaded. This holds true for other types of documents such as videos and PDF documents.
9. Conclusion
Modern search engines often maintain caches of web pages and display the link to the cached version when displaying the search results. But, only the latest cached version is displayed. The Internet Archive maintains an archive of the web by taking periodic snapshots of web pages but does not allow users to do a full-text search on the archived pages. Also, content of the web keeps on changing and it is necessary for web crawlers to re-crawl pages to ensure that their index is fresh. But, re-crawling web content that has not change can lead to wastage of bandwidth. Google uses If-Modified-Since for validating its cached pages.
This project implements two new cache-related features for Yioop search engine. The first feature is a history feature that allows users to see all versions of cached pages maintained by Yioop. This feature is an improvement over modern search engines as the entire cache history is available to users. The feature also allows users to do full-text searches on cached pages which is not available with the Internet Archive. The second feature of this project uses Entity Tags and Expires headers to validate cached copies of web pages downloaded by Yioop’s crawler. The feature uses B-Trees for storage and lookup of cache page validation data.
This history feature acts an archive of web pages cached by Yioop’s crawler and will provide users with a new functionality capable of performing searches on the entire history of cached pages. The cache page validation slows down the Queue Server but is a promising feature, and a good start towards developing more efficient ways of using ETags and Expires headers for cache page validation. From the experiment, it can be seen that URLs re-crawled using cache page validation feature resulted in savings in bandwidth. The future work includes experimenting with B+ Trees that store all the data in the leaves, experimenting with different crawl policies to determine impact on savings in bandwidth, and testing the cache page validation feature on a multiple Queue Server setting on multiple machines.
Bibliography
|
{"Source-Url": "http://www.cs.sjsu.edu/faculty/pollett/masters/Semesters/Fall12/akshat/Readings/298final.pdf", "len_cl100k_base": 10908, "olmocr-version": "0.1.50", "pdf-total-pages": 44, "total-fallback-pages": 0, "total-input-tokens": 93068, "total-output-tokens": 13350, "length": "2e13", "weborganizer": {"__label__adult": 0.0003113746643066406, "__label__art_design": 0.0004057884216308594, "__label__crime_law": 0.00034618377685546875, "__label__education_jobs": 0.00307464599609375, "__label__entertainment": 0.00011283159255981444, "__label__fashion_beauty": 0.00017261505126953125, "__label__finance_business": 0.000431060791015625, "__label__food_dining": 0.0002696514129638672, "__label__games": 0.0005421638488769531, "__label__hardware": 0.0010747909545898438, "__label__health": 0.0003352165222167969, "__label__history": 0.0004887580871582031, "__label__home_hobbies": 0.00011736154556274414, "__label__industrial": 0.00030541419982910156, "__label__literature": 0.00033736228942871094, "__label__politics": 0.00022685527801513672, "__label__religion": 0.0004181861877441406, "__label__science_tech": 0.053009033203125, "__label__social_life": 0.0001653432846069336, "__label__software": 0.0367431640625, "__label__software_dev": 0.900390625, "__label__sports_fitness": 0.000164031982421875, "__label__transportation": 0.0003733634948730469, "__label__travel": 0.0002460479736328125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 50211, 0.07964]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 50211, 0.47383]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 50211, 0.79956]], "google_gemma-3-12b-it_contains_pii": [[0, 266, false], [266, 266, null], [266, 618, null], [618, 1828, null], [1828, 2195, null], [2195, 6587, null], [6587, 7096, null], [7096, 9568, null], [9568, 11714, null], [11714, 12149, null], [12149, 13582, null], [13582, 15499, null], [15499, 16148, null], [16148, 18019, null], [18019, 18680, null], [18680, 19231, null], [19231, 20740, null], [20740, 21596, null], [21596, 21969, null], [21969, 23158, null], [23158, 24005, null], [24005, 24090, null], [24090, 25086, null], [25086, 26552, null], [26552, 27470, null], [27470, 27920, null], [27920, 28785, null], [28785, 30120, null], [30120, 32070, null], [32070, 32701, null], [32701, 34131, null], [34131, 34921, null], [34921, 35733, null], [35733, 36940, null], [36940, 38031, null], [38031, 38640, null], [38640, 39700, null], [39700, 41694, null], [41694, 42766, null], [42766, 44171, null], [44171, 45850, null], [45850, 46491, null], [46491, 48593, null], [48593, 50211, null]], "google_gemma-3-12b-it_is_public_document": [[0, 266, true], [266, 266, null], [266, 618, null], [618, 1828, null], [1828, 2195, null], [2195, 6587, null], [6587, 7096, null], [7096, 9568, null], [9568, 11714, null], [11714, 12149, null], [12149, 13582, null], [13582, 15499, null], [15499, 16148, null], [16148, 18019, null], [18019, 18680, null], [18680, 19231, null], [19231, 20740, null], [20740, 21596, null], [21596, 21969, null], [21969, 23158, null], [23158, 24005, null], [24005, 24090, null], [24090, 25086, null], [25086, 26552, null], [26552, 27470, null], [27470, 27920, null], [27920, 28785, null], [28785, 30120, null], [30120, 32070, null], [32070, 32701, null], [32701, 34131, null], [34131, 34921, null], [34921, 35733, null], [35733, 36940, null], [36940, 38031, null], [38031, 38640, null], [38640, 39700, null], [39700, 41694, null], [41694, 42766, null], [42766, 44171, null], [44171, 45850, null], [45850, 46491, null], [46491, 48593, null], [48593, 50211, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 50211, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 50211, null]], "pdf_page_numbers": [[0, 266, 1], [266, 266, 2], [266, 618, 3], [618, 1828, 4], [1828, 2195, 5], [2195, 6587, 6], [6587, 7096, 7], [7096, 9568, 8], [9568, 11714, 9], [11714, 12149, 10], [12149, 13582, 11], [13582, 15499, 12], [15499, 16148, 13], [16148, 18019, 14], [18019, 18680, 15], [18680, 19231, 16], [19231, 20740, 17], [20740, 21596, 18], [21596, 21969, 19], [21969, 23158, 20], [23158, 24005, 21], [24005, 24090, 22], [24090, 25086, 23], [25086, 26552, 24], [26552, 27470, 25], [27470, 27920, 26], [27920, 28785, 27], [28785, 30120, 28], [30120, 32070, 29], [32070, 32701, 30], [32701, 34131, 31], [34131, 34921, 32], [34921, 35733, 33], [35733, 36940, 34], [36940, 38031, 35], [38031, 38640, 36], [38640, 39700, 37], [39700, 41694, 38], [41694, 42766, 39], [42766, 44171, 40], [44171, 45850, 41], [45850, 46491, 42], [46491, 48593, 43], [48593, 50211, 44]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 50211, 0.14404]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
b2af65c9a6dedc9841ffbeae5b18b799f1507cbb
|
## Contents
1 Introduction .................................................................................. 3
1.1 Description ................................................................................. 3
1.2 Functions .................................................................................. 3
1.2.1 Features ................................................................................. 3
1.2.2 Formats .................................................................................. 3
1.2.3 Conformance .......................................................................... 4
1.3 Operating Systems ..................................................................... 4
2 Installation .................................................................................... 5
2.1 Windows .................................................................................... 5
2.1.1 How to set the Environment Variable “Path” ....................... 5
2.2 Linux and macOS ....................................................................... 6
2.2.1 Linux ..................................................................................... 6
2.3 Uninstall .................................................................................... 7
2.4 Fonts ......................................................................................... 7
2.4.1 Font Cache ........................................................................... 7
2.5 Note about the Evaluation License .......................................... 7
2.6 Special Directories ..................................................................... 8
2.6.1 Directory for temporary files .............................................. 8
2.6.2 Cache Directory ................................................................... 8
2.6.3 Font Directories .................................................................. 8
3 License Management ....................................................................... 10
4 Getting Started ............................................................................. 11
4.1 Basics ....................................................................................... 11
4.1.1 Usage .................................................................................. 11
4.2 Specify the Folder of the Output File ....................................... 11
4.3 Process Description ................................................................... 11
4.4 Example .................................................................................... 12
4.5 Use Cases ................................................................................ 12
4.5.1 How to make text extractable ............................................. 12
4.5.2 How to tag scans for accessibility (PDF/A level A) ........... 13
4.5.3 How to detect barcodes ....................................................... 15
4.6 How to handle conversion warnings ...................................... 16
5 Interface Reference ....................................................................... 17
5.1 OCR Engine Configuration ..................................................... 17
5.1.1 -1e List OCR Engines ......................................................... 17
5.1.2 -ocr Load OCR Engine ....................................................... 17
5.1.3 -oc1 Set OCR Language .................................................... 18
5.1.4 -ocp Set OCR Parameters ............................................... 18
5.2 Image OCR Options ................................................................. 18
5.2.1 -oim Image OCR Mode ..................................................... 19
5.2.2 -oca Rotate Scan ............................................................... 19
5.2.3 -oecs Deskew Scan ............................................................. 19
5.3 Text OCR Options ................................................................. 19
5.3.1 -otm Text OCR Mode ....................................................... 19
5.3.2 -otks Text OCR Skip ......................................................... 20
1 Introduction
1.1 Description
The 3-Heights™ PDF OCR Shell enhances PDF documents using information detected by an OCR engine.
All text in PDF documents can be made extractable, regardless of how text is included in the document. Specifically, text in images, text written with vector graphics or other graphical effects (e.g. transparency effects), or text using a font that does not provide extractable text (i.e. Unicode information) can be detected.
Tagging of OCR text for accessibility is supported. This is useful as preparation for PDF/A level A conversion or to process tagged documents.
Detected barcodes or QR codes can be extracted or embedded into the document's metadata.
The product is optimized for performance, which guarantees low latency and high document throughput. This is achieved by minimizing the number of required OCR operations. Furthermore, OCR operations are executed asynchronously, if supported by the OCR engine.
1.2 Functions
1.2.1 Features
- Make text extractable
- Text contained in images
- Text with fonts that have no Unicode information
- Text written using vector graphics (e.g. in CAD drawings)
- Any visible text, regardless of the type of graphics objects used
- Scan improvements
- Deskew scanned images
- Rotate pages according to the recognized rotation of scan
- Detect barcodes and QR codes
- Process embedded files
- Tagging of OCR text for accessibility
- High performance
- Asynchronous processing
- Page analysis and result caching to minimize OCR operations
- High quality
- Conform to PDF/A
- High-fidelity conversion of existing page content
- 3-Heights™ PDF Rendering Engine 2.0.
- Automatic detection of optimal OCR resolution
1.2.2 Formats
- PDF 1.x (PDF 1.0, ..., PDF 1.7)
- PDF 2.0
- PDF/A-1, PDF/A-2, PDF/A-3
1.2.3 Conformance
Standards:
- ISO 32000-1 (PDF 1.7)
- ISO 32000-2 (PDF 2.0)
- ISO 19005-1 (PDF/A-1)
- ISO 19005-2 (PDF/A-2)
- ISO 19005-3 (PDF/A-3)
1.3 Operating Systems
The 3-Heights™ PDF OCR Shell is available for the following operating systems:
- Windows Client 7+ | x86 and x64
- Linux:
- Red Hat, CentOS, Oracle Linux 7+ | x64
- Fedora 29+ | x64
- Debian 8+ | x64
- Other: Linux kernel 2.6+, GCC toolset 4.8+ | x64
'+' indicates the minimum supported version.
2 Installation
2.1 Windows
The 3-Heights™ PDF OCR Shell comes as a ZIP archive or as an MSI installer.
The installation of the software requires the following steps.
1. You need administrator rights to install this software.
If you have no active downloads available or cannot log in, please contact pdfsales@pdf-tools.com for assistance.
You will find different versions of the product available. We suggest to download the version, which is selected by default. A different version can be selected using the combo box.
There is an MSI (*.msi) package and a ZIP (*.zip) archive available. The MSI (Microsoft Installer) package provides an installation routine that installs and uninstalls the product for you. The ZIP archive allows you to select and install everything manually.
There is a 32 and a 64-bit version of the product available. While the 32-bit version runs on both, 32 and 64-bit platforms, the 64-bit version runs on 64-bit platforms only. The MSI installs the 64-bit version, whereas the ZIP archive contains both the 32-bit and the 64-bit version of the product. Therefore, on 32-bit systems, the ZIP archive must be used.
3. If you select an MSI package, start it and follow the steps in the installation routine.
4. If you are using the ZIP archive, do the following. Unzip the archive to a local folder, e.g. C:\Program Files\PDF Tools AG\.
This creates the following subdirectories:
<table>
<thead>
<tr>
<th>Subdirectory</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>bin</td>
<td>Contains the runtime executable binaries.</td>
</tr>
<tr>
<td>doc</td>
<td>Contains documentation.</td>
</tr>
</tbody>
</table>
5. (Optional) To easily use the 3-Heights™ PDF OCR Shell from a shell, the directory needs to be included in the “Path” environment variable.
6. (Optional) Register your license key using the License Management.
7. Make sure your platform meets the requirements regarding fonts described in chapter Fonts.
8. Download and install the 3-Heights™ OCR Service, the OCR Service client plugin, and the OCR Engine as described in the respective manuals:
- 3-Heights™ OCR Add-On for Barcode and QR Code Recognition: OcrBarcodes.pdf
- 3-Heights™ OCR Service: OcrService.pdf from the separate product kit.
2.1.1 How to set the Environment Variable “Path”
To set the environment variable “Path” on Windows, go to Start → Control Panel (classic view) → System → Advanced → Environment Variables.
Select “Path” and “Edit”, then add the directory where pdfocr.exe is located to the “Path” variable. If the environment variable “Path” does not exist, create it.
2.2 Linux and macOS
This section describes installation steps required on Linux or macOS.
Here is an overview of the files that come with the 3-Heights™ PDF OCR Shell:
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>bin/x64/pdfocr</td>
<td>This is the main executable.</td>
</tr>
<tr>
<td>bin/x64/libPdfOcrAPI.so</td>
<td>This is a shared library required by pdfocr.</td>
</tr>
<tr>
<td>bin/x64/* .ocr</td>
<td>These are OCR plugin modules.</td>
</tr>
<tr>
<td>doc/* .*</td>
<td>Documentation</td>
</tr>
</tbody>
</table>
2.2.1 Linux
1. Unpack the archive in an installation directory, e.g. /opt/pdf-tools.com/
2. Verify that the GNU shared libraries required by the product are available on your system:
`ldd pdfocr`
In case the above reports any missing libraries you have three options:
a. Download an archive that is linked to a different version of the GNU shared libraries and verify whether they are available on your system. Use any version whose requirements are met. Note that this option is not available for all platforms.
b. Use your system's package manager to install the missing libraries. It usually suffices to install the package libstdc++6.
c. Use GNU shared libraries provided by PDF Tools AG:
2. Download the GNU shared libraries for your platform.
3. Install the libraries manually according to your system’s documentation. This typically involves copying
them to your library directory, e.g., `/usr/lib` or `/usr/lib64`, and running `ldconfig`.
4. Verify that the GNU shared libraries required by the product are available on your system now.
3. Create a link to the executable from one of the standard executable directories, e.g:
```bash
ln -s /opt/pdf-tools.com/bin/x64/pdfocr /usr/bin
```
4. Create a link to the shared library from one of the standard library directories, e.g:
```bash
ln -s /opt/pdf-tools.com/bin/x64/libPdfOcrAPI.so /usr/lib
```
5. Optionally register your license key using the license manager.
6. Make sure your platform meets the requirements regarding fonts described in chapter Fonts.
7. Download and install the 3-Heights™ OCR Service, the OCR Service client plugin, and the OCR Engine as
described in the respective manuals:
- 3-Heights™ OCR Add-On for Barcode and QR Code Recognition: OcrBarcodes.pdf
- 3-Heights™ OCR Service: OcrService.pdf from the separate product kit.
### 2.3 Uninstall
If you have used the MSI for the installation, go to Start → 3-Heights™ PDF OCR Shell… → Uninstall…
If you have used the ZIP file for the installation: In order to uninstall the product, undo all the steps done during
installation.
### 2.4 Fonts
Fonts are required, if OCR is preformed and OCR text is added to a PDF document. Hereby it is crucial, that the fonts
available in the Font Directories contain all characters required for the OCR text. For example, when recognizing
Japanese OCR text, it is recommended to add the fonts “MS Mincho” or “MS Gothic” to the Font Directories.
#### 2.4.1 Font Cache
A cache of all fonts in all Font Directories is created. If fonts are added or removed from the font directories, the
cache is updated automatically.
In order to achieve optimal performance, make sure that the cache directory is writable for the 3-Heights™ PDF OCR
Shell. Otherwise the font cache cannot be updated and the font directories have to be scanned on each program
startup.
The font cache is created in the subdirectory `<CacheDirectory>/Installed Fonts` of the Cache Directory.
### 2.5 Note about the Evaluation License
With the evaluation license the 3-Heights™ PDF OCR Shell automatically adds a watermark to the output files.
2.6 Special Directories
2.6.1 Directory for temporary files
This directory for temporary files is used for data specific to one instance of a program. The data is not shared between different invocations and deleted after termination of the program.
The directory is determined as follows. The product checks for the existence of environment variables in the following order and uses the first path found:
**Windows**
1. The path specified by the `%TMP%` environment variable.
2. The path specified by the `%TEMP%` environment variable.
3. The path specified by the `%USERPROFILE%` environment variable.
4. The Windows directory.
**Linux and macOS**
1. The path specified by the `$PDFTMPDIR` environment variable.
2. The path specified by the `$TMP` environment variable.
3. The `/tmp` directory.
2.6.2 Cache Directory
The cache directory is used for data that is persisted and shared between different invocations of a program. The actual caches are created in subdirectories. The content of this directory can safely be deleted to clean all caches.
This directory should be writable by the application, otherwise caches cannot be created or updated and performance will degrade significantly.
**Windows**
- If the user has a profile:
`%LOCAL_APPDATA%\PDF Tools AG\Caches`
- If the user has no profile:
`<TempDirectory>\PDF Tools AG\Caches`
**Linux and macOS**
- If the user has a home directory:
`~/.pdf-tools/Caches`
- If the user has no home directory:
`<TempDirectory>/pdf-tools/Caches`
where `<TempDirectory>` refers to the Directory for temporary files.
2.6.3 Font Directories
The location of the font directories depends on the operating system. Font directories are traversed recursively in the order as specified below.
If two fonts with the same name are found, the latter one takes precedence, i.e. user fonts will always take precedence over system fonts.
**Windows**
1. %SystemRoot%\Fonts
2. User fonts listed in the registry key \HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Fonts. This includes user specific fonts from C:\Users\<user>\AppData\Local\Microsoft\Windows\Fonts and app specific fonts from C:\Program Files\WindowsApps directory Fonts, which must be a direct sub-directory of where pdfocr.exe resides.
**Linux**
1. /usr/share/fonts
2. /usr/local/share/fonts
3. ~/.fonts
4. $PDFFONTDIR or /usr/lib/X11/fonts/Type1
3 License Management
The 3-Heights™ PDF OCR Shell requires a valid license in order to run correctly. If no license key is set or the license is not valid, then the executable will fail and the return code will be set to 10.
More information about license management is available in the license key technote.
4 Getting Started
4.1 Basics
4.1.1 Usage
The usage of the 3-Heights™ PDF OCR Shell is:
```
pdfocr [options] input.pdf output.pdf
```
A simple command to process a document requires four parameters: The name of the PDF input file, the PDF output file, an OCR engine name, and a processing mode.
**Example:** Read the input document `input.pdf`, create a new document `output.pdf`, and use the OCR Service to process images.
```
pdfocr -ocr service -oim update input.pdf output.pdf
```
In order to list all available features type `pdfocr` without any parameters.
4.2 Specify the Folder of the Output File
The output folder can simply be added in front of the output file name
```
pdfocr input.pdf myfolder\output.pdf
```
or absolute (Windows):
```
pdfocr input.pdf C:\myfolder\output.pdf
```
4.3 Process Description
The following is a simplified process description of the 3-Heights™ PDF OCR Shell:
1. **Open document:** The input document is opened.
2. **Process document:** The document is processed and the result written to the output.
1. **Process pages**
1. Analyze page: The page's content is analyzed in order to determine, whether processing by the OCR engine is required or not (see chapter Page Analysis below).
2. OCR page (optional)
1. Determine optimal OCR resolution
2. Render page: The page is converted to an image using the 3-Heights™ PDF Rendering Engine 2.0.
3. Send image to OCR engine.
4. Process OCR results (see chapter OCR Result Processing below).
3. Copy page: The page is copied to the output. If available, information from the OCR engine is added.
2. **Process embedded files:** Embedded files can be processed recursively or copied as-is.
**Page Analysis**
The page's content is analyzed. The modes of ocr parameters specified for images (-oim), text (-otm), and pages (-opm) are evaluated. The page is processed by the OCR engine if required by any of the modes.
**OCR Result Processing**
Each OCR result object is processed as follows:
1. If it is a barcode, it is processed according to the barcode mode.
2. If its location is on an image on the page, it is processed according to the image ocr mode.
3. If it corresponds to text on the page, it is processed according to the text ocr mode.
4. Otherwise it is added as OCR text to the page, if the page ocr mode is not none.
**4.4 Example**
**Example:** Example that shows how to add OCR text to images.
```
pdfocr -ocr service -ocp "PredefinedProfile=DocumentConversion_Accuracy" -ocl "..." -oim update input.pdf output.pdf
```
**4.5 Use Cases**
This chapter describes some common use cases.
**4.5.1 How to make text extractable**
This example shows how text in a PDF document can be made extractable. This is suitable both for born-digital and scanned documents.
**Note:** For tagged input documents, the configuration described in How to tag scans for accessibility (PDF/A level A) should be used.
**OCR Engine Configuration**
**Abbyy FineReader 11 or 12**
The following profile configuration abbyy_text.ini is optimized to extract as much text as possible:
```
[PagePreprocessingParams]
CorrectOrientation=TRUE
[PageAnalysisParams]
DetectVerticalEuropeanText=TRUE
[ObjectsExtractionParams]
DetectTextOnPictures = TRUE
```
Use the profile using the OCR engine running on the OCR Service:
Note: It is important that C:\path\to\abbyy_text.ini is the path to the configuration file on the OCR Service and the OCR Service process has read permissions.
Processing Configuration
1. Detect text contained in images: For documents that contain images, processing of images can be activated by setting an image OCR mode (see -oim):
pdfocr ... -oim update ...
2. Make text extractable: For documents that contain non-extractable text, processing of text can be activated by setting a text OCR mode (see -otm):
pdfocr ... -otm update ...
3. Make other visible text extractable: For documents that contain other forms of visible text, pages can be OCR processed by setting a page OCR mode (see -opm):
pdfocr ... -opm noText ...
Process Document
pdfocr -ocr service -opc "Profile=C:\path\to\abbyy_text.ini" -ocl "...
input.pdf output.pdf
4.5.2 How to tag scans for accessibility (PDF/A level A)
“Tagging” adds structural information to a PDF. This information can be used e.g. to read the document to the visually impaired.
The 3-Heights™ PDF OCR Shell supports tagging scans, e.g. such that they can be converted to PDF/A level A.
Tagging of scans that contain no figures or pictures, will conform to the PDF/UA specification (ISO 14289-1). For figures and pictures an alternative representation or replacement text must be included. Because this information is not provided by the OCR engine, tagging of such files cannot conform to PDF/UA.
Prerequisites
1. The OCR engine must provide structural information for OCR results. We recommend Abbyy FineReader 11 or newer.
2. If the 3-Heights™ OCR Service is used, it must be newer than 4.11.21.0.
OCR Engine Configuration
Abbyy FineReader 11 or 12
The following profile configuration `abbyy_tagging.ini` is suitable:
```ini
[PagePreprocessingParams]
CorrectOrientation=TRUE
```
This is essentially the predefined profile "DocumentConversion_Accuracy", but can also handle rotated pages. Use the profile using the OCR engine running on the OCR Service:
```
pdfo cr -ocr service -ocp "Profile=C:\path\to\abbyy_tagging.ini" -ocl "..." ...
```
**Note:** It is important that `C:\path\to\abbyy_tagging.ini` is the path to the configuration file on the OCR Service and the OCR Service process has read permissions.
Processing Configuration
1. Activate processing of images by setting an image OCR mode:
```
pdfo cr ... -oim update ...
```
2. (Optional) Enable scan enhancements:
```
pdfo cr ... -oca -occs ...
```
3. Activate creation of tagging information by setting the tagging mode:
```
pdfo cr ... -tm update ...
```
Process Document
```
pdfo cr -v -ocr service -ocp "Profile=C:\path\to\abbyy_tagging.ini" -ocl "..." -oim update
-o ca -occs -tm update input.pdf output.pdf
```
Error Handling
Tagging errors are classified as warnings by the 3-Heights™ PDF OCR Shell. Because tagging is crucial for this process, tagging warnings returned must be checked and treated as errors. In case of OCR warnings, the return code of 3-Heights™ PDF OCR Shell will be 7. See How to handle conversion warnings for more information.
4.5.3 How to detect barcodes
This example shows how to detect and extract barcodes and QR codes.
**OCR Engine Configuration**
There are two OCR engines available that support barcode recognition.
**Barcodes OCR Engine**
The OCR engine “barcodes” is a specialized plugin for barcode and QR code recognition.
No engine parameters are required. However, in order to speed up the recognition process, it can be limited to a specific set of code types:
```
pdfoocr -ocr barcodes -ocp "BarcodeTypes=QRCode" ...
```
**Abbyy FineReader 11 or 12 Engine**
The predefined profile “BarcodeRecognition_Accuracy” is optimized for this purpose and will detect all supported types of barcodes and QR codes.
Use the profile using the OCR engine running on the OCR Service:
```
pdfoocr -ocr service -ocp "PredefinedProfile=BarcodeRecognition_Accuracy" ...
```
*Note:* This profile detects barcodes only and cannot be used to make any text extractable. However, with a profile file barcode and text recognition can be performed in one step.
**Processing Configuration**
1. **Activate OCR processing:** Activate OCR processing of all pages:
```
pdfoocr ... -opm all ...
```
2. **Enable barcode extraction:** Write all detected barcodes in XML format to the file `barcodes.xml`:
```
pdfoocr ... -obx barcodes.xml ...
```
The format of the barcodes XML file is documented in the XML schema `barcodes.xsd` located in the documentation folder of the 3-Heights™ PDF OCR Shell.
**Process Document**
```
pdfoocr -ocr barcodes -ocp "BarcodeTypes=QRCode" -opm all -obx barcodes.xml input.pdf output.pdf
```
4.6 How to handle conversion warnings
There are two types of problems that may occur when processing a file.
Some problems are severe and hinder further processing. As a result, the processing is aborted and the return code of the 3-Heights™ PDF OCR Shell will indicate the error.
Problems that do not hinder further processing are classified as warnings. In this case, the return code of 3-Heights™ PDF OCR Shell will be 7. Using the option \(-v\), all warnings can be shown.
**Example:** The following command generates two warnings, because the input file is signed and the specified OCR resolution is too low for an optimal recognition.
```bash
Processing file input.pdf
OCR warnings:
- ocr: Max OCR DPI is 250 but should be at least 300 for optimal image OCR. (page 1)
- signed: The document signature of "Peter Pan" had to be removed. (page 1)
Done.
```
For some processes, certain warnings might be critical, e.g. as described in [How to make text extractable](#). In order to simplify the processing of warnings, they are divided into categories.
The format of the warnings shown using `\(-v\)` is as follows:
- `<category>`: `<message>` [(page `<number>`)]
The following categories are defined:
- **ocr** The warning is related to OCR recognition.
- **tagging** The warning is related to tagging. It must be considered critical when tagging documents for accessibility as described in [How to tag scans for accessibility (PDF/A level A)](#). Note that this warning does not mean, that OCR text has not been added, but merely that there was an issue with tagging it.
- **text** The warning is related to making text extractable. This is critical when making text extractable as described in [How to make text extractable](#).
- **signed** Processing a signed file changes it, such that all signatures become invalid. Therefore, all signatures are removed and this warning is generated.
### 5 Interface Reference
Switches are options that are provided with the command to define how the document should be processed. Switches can occur in two forms: As stand-alone option, such as `-v` (verbose mode) or they may require a parameter, such as `-pw` `password` (set password to read encrypted input document).
The last two parameters of the command line should always be the input and the output document.
Switches are parsed from left to right. If the same switch is applied multiple times the last set value is applied.
### 5.1 OCR Engine Configuration
#### 5.1.1 -le List OCR Engines
### List OCR Engines -le
OCR engines are accessed through the corresponding OCR interface DLLs. At present interfacing the following engines are supported:
- **Abbyy FineReader 11 OCR Engine**
This engine is accessed by the OCR interface DLL `pdfocrpluginAbbyy11.ocr`.
- **Abbyy FineReader 10 OCR Engine**
This engine is accessed by the OCR interface DLL `pdfocrpluginAbbyy10.ocr`.
- **3-Heights™ OCR Service**
This service is accessed by the OCR interface DLL `pdfocrpluginService.ocr`. The service accesses the Abbyy FineReader 10 or 11 OCR Engine.
The OCR interface DLLs are provided by the 3-Heights™ PDF OCR Shell. The OCR engine is provided as a separate product, such as 3-Heights™ OCR Enterprise Add-On.
Here is an example of listing available OCR engines:
```plaintext
pdfocr -le
List of available OCR engines:
- abbyy11
- abbyy10
- service
End of list.
```
In order to make use of the OCR engine, the OCR interface DLL and the OCR engine must be installed. The switch `-le` lists all available OCR interface DLLs. It does not verify the corresponding OCR engine is installed and can be initialized. The OCR engine is actually accessed when using the switch `-ocr`.
#### 5.1.2 -ocr Load OCR Engine
### Load OCR Engine -ocr <name>
If a PDF document has to be made fully text searchable even if the text is part of a raster image then the images which are contained in the PDF document must be run through an OCR engine. With this switch the user can select
an OCR engine, e.g. Abbyy11, and instruct the tool to embed the recognized text as a hidden layer on top of the image. If the add-in is not found or the engine cannot be initialized (because it is not installed or the license key is not valid) then an error message is issued.
The name of the OCR engine can be retrieved using the switch `-le`. If the switch `-ocr` is not used, no OCR is applied.
**Example:** The following switch sets the OCR engine to the OCR Service
```
pdfocr -ocr service input.pdf output.pdf
```
See also documentation for the 3-Heights™ OCR Add-On.
### 5.1.3 `-ocl` Set OCR Language
**Set OCR Language** `-ocl <languages>`
In order to optimize the performance of the OCR engine, it can be given hints what languages are used. The default language of the Abbyy FineReader 11 OCR Engine is English. This switch can only be used if the switch `-ocr` is set. This setting depends on the OCR engine.
The following switch set the languages to English and German:
```
pdfocr -ocr abbyy11 -ocl "English, German" input.pdf output.pdf
```
See also documentation for the 3-Heights™ OCR Add-On.
### 5.1.4 `-ocp` Set OCR Parameters
**Set OCR Parameters** `-ocp <params>`
Using this switch, OCR engine specific parameters (key/value pairs) can be set to optimize the performance.
The following switch sets a predefined profile (i.e. a configuration setting) which is optimized for creating electronic archives with high accuracy:
```
pdfocr -ocr abbyy11 -ocp "PredefinedProfile = DocumentArchiving_Accuracy"
input.pdf output.pdf
```
See also documentation for the 3-Heights™ OCR Add-On.
### 5.2 Image OCR Options
The image OCR parameters control under what conditions and how images should be processed.
Note: The options -oca and -occs have an effect only, if:
1. The page is a scan and not born-digital.
2. The page is processed by the OCR engine, which depends on the -oim set.
3. The required information is provided by the OCR engine, which depends on the type and settings of the engine.
5.2.1 -oim Image OCR Mode
Image OCR Mode -oim <mode>
The mode according to which images are processed. See chapter Process Description for a description on how setting this option affects OCR processing.
Available values for <mode> are:
none (default) Do not process images.
update Only process images that have no OCR text.
replace Process all images and remove existing OCR text.
remove Remove existing OCR text.
ifNoText Process images only if document contains no text.
5.2.2 -oca Rotate Scan
Rotate Scan -oca
Rotate scan according to the orientation detected by the OCR engine.
5.2.3 -occs Deskew Scan
Deskew Scan -occs
Deskew scan according to the angle detected by the OCR engine.
5.3 Text OCR Options
5.3.1 -otm Text OCR Mode
Text OCR Mode -otm <mode>
The mode according to which text is processed. See chapter Process Description for a description on how setting this option affects OCR processing.
Available values for <mode> are:
none (default) Do not process text.
update Only process text that is not extractable.
For all characters that have no meaningful Unicode, OCR processing is used to determine the Unicode. This is the recommended mode to make text extractable.
Note that making text extractable requires many OCR operations. The reason is that of all characters multiple instances must be recognized, to deal with erroneous OCR recognitions.
replace Process all text.
OCR is used to determine the Unicode of all characters, that is even if they seemingly have Unicode information. This is useful for documents that possibly contain wrong Unicode information. Wrong Unicode information is typically created by flawed PDF creators or to obfuscate text (i.e. to prevent copy-and-paste or search operations).
For documents that contain correct Unicode information, this mode produces the same result as the mode Update. The rare exceptions are special fonts for which the OCR engine produces wrong results, which might happen for some decorative or handwritten fonts. The main disadvantage of the mode Replace over Update is, that more OCR operations are required.
### 5.3.2 -ots Text OCR Skip
**Text OCR Skip -ots <list>**
Defines text that can be skipped from text OCR processing.
The value for `<list>` is a comma-separated list of the following values:
- **none** *(default)* Do not skip any text in text ocr processing.
- **knownSymbolic** Skip text of all fonts that are known to be symbolic, e.g. "ZapfDingbats" or "Wingdings".
For many symbols of these fonts there exist no Unicodes. Also, even the ones that have Unicodes, such as "✓" or "→", cannot be recognized by most OCR engines. Therefore, OCR processing of these fonts usually does not produce a meaningful result and could be skipped.
- **pua** Skip text with Unicodes from Private Use Areas (PUA), i.e. accept Unicodes from PUA as meaningful.
Unicodes from the PUA are typically used for symbols, for which no Unicodes exist. OCR processing of these symbols does not produce a result and could be skipped.
On the other hand, some bad PDF creators use PUA for normal text. For these cases, OCR processing should be performed.
### 5.3.3 -otu ToUnicode source
**ToUnicode source -otu <list>**
Defines additional ToUnicode sources, i.e. in addition to OCR processing.
The value for `<list>` is a comma-separated list of the following values:
- **none** *(default)* Do not use any additional sources. Only use ToUnicode information contained in the PDF document as described in the PDF Reference.
- **knownSymbolicPua** Use Unicodes from Private Use Areas (PUA) for all fonts that are known to be symbolic, e.g. "ZapfDingbats" or "Wingdings".
- **fallbackAllPua** Use Unicodes from Private Use Areas (PUA) for all characters for which no better Unicode can be determined.
installedFont If on the system a font of the same name is installed, use Unicodes of matching glyphs.
### 5.4 Page OCR Options
#### 5.4.1 -opm Page OCR Mode
**Page OCR Mode**
The mode according to which pages are processed. See chapter [Process Description](#) for a description on how setting this option affects OCR processing.
Available values for `<mode>` are:
- **none** *(default)* Do not process pages.
- **all** Process all pages that are not empty.
- **ifNoText** Process all pages that contain content but no text.
- **addResults** Do not trigger processing of pages. But if pages are OCR processed, e.g. due to another OCR mode, add results as OCR text to pages.
#### 5.4.2 -tm Tagging mode
**Tagging mode**
The mode according to which tagging information is processed.
Available values for `<mode>` are:
- **none** Do not add tagging information.
- **update** Update existing tagging information. A warning is generated, if no tagging information can be added. Therefore, this value is recommended if tagging information is crucial to your process.
- **auto** *(default)* Determine tagging mode automatically. Use `update` for scans and born-digital documents with tagging, and `none` otherwise.
### 5.5 Barcode Options
#### 5.5.1 -obx Process Recognized Barcodes
**Process Recognized Barcodes**
The mode according to which barcodes are processed.
`<stream>` may be either the string `xmp`, in which case recognized barcodes are embedded into the document’s XMP metadata, or a file name, in which case recognized barcodes are written to the file in XML format. The format of the resulting barcodes XML file is documented in the XML schema `barcodes.xsd` located in the documentation folder of the 3-Heights™ PDF OCR Shell.
5.6 General Options
5.6.1 -ocd OCR resolution
OCR resolution -ocd <d> <dmin> <dmax>
Each page’s optimal OCR resolution is determined automatically, such that all images and text can be recognized. The default resolution <d> is chosen, if it is within the range of optimal resolutions. The range of allowed resolutions can be chosen using <dmin> and <dmax>. The range should be in the range of resolutions supported by the OCR engine. Most OCR engines are optimized for resolutions around 300 DPI. Selecting a resolution that is too low will hinder the detection of small text. An excessively high resolution will reduce performance because of the higher resource requirements to render the page images and perform OCR on them.
If the optimal resolution of a page is not within the range, an OCR warning is generated.
Default: -ocd 300 200 400
5.6.2 -pef Process Embedded Files
Process Embedded Files -pef
Process embedded files recursively. Otherwise embedded files are copied as-is.
5.6.3 -pw Read an Encrypted PDF File
Read an Encrypted PDF File -pw <password>
A PDF document that has a user password (the password to open the document) can only be processed when either the user or the owner password is provided. The password can be provided using the option -pw followed by the password.
Example: The input PDF document is encrypted with a user password. Either the user or the owner password of the input PDF is “mypassword”. The command to process such an encrypted file is:
```
pdfocr -pw mypassword input.pdf output.pdf
```
When a PDF is encrypted with a user password and the password is not provided or is incorrect, the 3-Heights™ PDF OCR Shell cannot read and process the file. Instead it will generate the following error message:
Password wasn’t correct.
5.6.4 -v Verbose Mode
Verbose Mode -v
This option turns on the verbose mode.
5.6.5 -lk Set License Key
Set License Key -lk «key»
Pass a license key to the application at runtime instead of using one that is installed on the system.
pdfocr -lk X-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx ...
This is required in an OEM scenario only.
5.7 Frequent Error Source
It may happen that you type a command, or copy it from somewhere and it doesn't work even though it seems to
be correct. A common reason is that the dash (-) which is used for most parameters is accidently mistaken by an em
dash (—).
5.8 Return Codes
All return codes other than 0 indicate an error in the processing.
In case of an error, an error message is written to the standard error stream (stderr). It is highly recommended to
check the command’s return value and in case of an error, log the error output.
<table>
<thead>
<tr>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>Success.</td>
</tr>
<tr>
<td>1</td>
<td>Couldn't open input file.</td>
</tr>
<tr>
<td>2</td>
<td>PDF output file could not be created.</td>
</tr>
<tr>
<td>3</td>
<td>Error with given options, e.g. too many parameters.</td>
</tr>
<tr>
<td>4</td>
<td>PDF input file is encrypted and password is missing or incorrect.</td>
</tr>
</tbody>
</table>
| 5 | OCR infrastructure error.
The file could not be processed because of an error in the OCR infrastructure, e.g. page credits of OCR engine used. |
| 6 | OCR processing error.
The file could not be processed because of an error related to the input file or the processing options set. |
| 7 | OCR warnings occurred.
I.e. the file has been processed successfully, but warnings occurred. Use -v to get a list of them. If the warnings reported are not relevant for your process, the return code may be ignored and treated the same as 0. See How to handle conversion warnings for more information. |
<table>
<thead>
<tr>
<th>Return Codes</th>
</tr>
</thead>
<tbody>
<tr>
<td>10</td>
</tr>
</tbody>
</table>
6 Version History
6.1 Patches in Version 6.8
Patch 6.8.2
- Fixed a problem where the license manager could crash during license activation on macOS
6.2 Changes in Version 6
- Improved search algorithm for installed fonts: User fonts under Windows are now also taken into account.
- New option -ots to define text that can be skipped from text OCR processing.
- New option -otu to enable additional sources of ToUnicode information, i.e. in addition to OCR processing.
- Changed default of tagging mode option -tm to auto.
6.3 Changes in Version 5
- Improved wording of warning messages. The new messages do not contain the words "warning" nor "error", such that they can be used as both warning and error message.
- New warning, if signatures were removed.
- New version of OCR plugin "barcodes" with QR Code recognition improvements.
- Improved option -obx to extract the type of recognized barcodes.
6.4 Changes in Version 4.12
- Introduced license features Service, Ocr, and Barcode.
- Improved image ocr mode to cache OCR text of images. Images that occur on multiple pages must be OCR processed once only.
- New specialized OCR plugin "barcodes" to recognize barcodes and QR codes without an additional OCR engine.
- New OCR plugin "abbyy12" for the ABBYY FineReader 12 engine.
- Improved memory consumption of product.
- New detection of OCR text that is under images.
- Improved ocr result processing, notably the accuracy of associating OCR text to existing text on page.
- New HTTP proxy setting in the GUI license manager.
- New parameter addResults for page ocr mode -opm.
7 Licensing, Copyright, and Contact
PDF Tools AG is a world leader in PDF (Portable Document Format) software, delivering reliable PDF products to international customers in all market segments.
PDF Tools AG provides server-based software products designed specifically for developers, integrators, consultants, customizing specialists and IT-departments. Thousands of companies worldwide use our products directly and hundreds of thousands of users benefit from the technology indirectly via a global network of OEM partners. The tools can be easily embedded into application programs and are available for a multitude of operating system platforms.
**Licensing and Copyright** The 3-Heights™ PDF OCR Shell is copyrighted. This user’s manual is also copyright protected; it may be copied and given away provided that it remains unchanged including the copyright notice.
**Contact**
PDF Tools AG
Kasernenstrasse 1
8184 Bachenbülach
Switzerland
http://www.pdf-tools.com
pdfsales@pdf-tools.com
|
{"Source-Url": "https://www.pdf-tools.com/public/downloads/manuals/PdfOcrShell.pdf", "len_cl100k_base": 9680, "olmocr-version": "0.1.53", "pdf-total-pages": 27, "total-fallback-pages": 0, "total-input-tokens": 55230, "total-output-tokens": 11396, "length": "2e13", "weborganizer": {"__label__adult": 0.0003597736358642578, "__label__art_design": 0.002017974853515625, "__label__crime_law": 0.00027823448181152344, "__label__education_jobs": 0.00048661231994628906, "__label__entertainment": 0.00016748905181884766, "__label__fashion_beauty": 0.00015437602996826172, "__label__finance_business": 0.00044083595275878906, "__label__food_dining": 0.0002193450927734375, "__label__games": 0.0009102821350097656, "__label__hardware": 0.0015287399291992188, "__label__health": 0.00013840198516845703, "__label__history": 0.00021839141845703125, "__label__home_hobbies": 0.00011157989501953124, "__label__industrial": 0.0003740787506103515, "__label__literature": 0.00027179718017578125, "__label__politics": 0.0001232624053955078, "__label__religion": 0.0004513263702392578, "__label__science_tech": 0.005519866943359375, "__label__social_life": 8.016824722290039e-05, "__label__software": 0.39306640625, "__label__software_dev": 0.59228515625, "__label__sports_fitness": 0.0001404285430908203, "__label__transportation": 0.0001385211944580078, "__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, 42565, 0.02913]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42565, 0.28818]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42565, 0.73544]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 4232, false], [4232, 4232, null], [4232, 6039, null], [6039, 6591, null], [6591, 9477, null], [9477, 10928, null], [10928, 13715, null], [13715, 15466, null], [15466, 16097, null], [16097, 16408, null], [16408, 18153, null], [18153, 19777, null], [19777, 21449, null], [21449, 22903, null], [22903, 24516, null], [24516, 26557, null], [26557, 28654, null], [28654, 30387, null], [30387, 31669, null], [31669, 34474, null], [34474, 36233, null], [36233, 38098, null], [38098, 39826, null], [39826, 39910, null], [39910, 41568, null], [41568, 42565, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 4232, true], [4232, 4232, null], [4232, 6039, null], [6039, 6591, null], [6591, 9477, null], [9477, 10928, null], [10928, 13715, null], [13715, 15466, null], [15466, 16097, null], [16097, 16408, null], [16408, 18153, null], [18153, 19777, null], [19777, 21449, null], [21449, 22903, null], [22903, 24516, null], [24516, 26557, null], [26557, 28654, null], [28654, 30387, null], [30387, 31669, null], [31669, 34474, null], [34474, 36233, null], [36233, 38098, null], [38098, 39826, null], [39826, 39910, null], [39910, 41568, null], [41568, 42565, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42565, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42565, null]], "pdf_page_numbers": [[0, 0, 1], [0, 4232, 2], [4232, 4232, 3], [4232, 6039, 4], [6039, 6591, 5], [6591, 9477, 6], [9477, 10928, 7], [10928, 13715, 8], [13715, 15466, 9], [15466, 16097, 10], [16097, 16408, 11], [16408, 18153, 12], [18153, 19777, 13], [19777, 21449, 14], [21449, 22903, 15], [22903, 24516, 16], [24516, 26557, 17], [26557, 28654, 18], [28654, 30387, 19], [30387, 31669, 20], [31669, 34474, 21], [34474, 36233, 22], [36233, 38098, 23], [38098, 39826, 24], [39826, 39910, 25], [39910, 41568, 26], [41568, 42565, 27]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42565, 0.03344]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
9475c1d61a90f65005c302f756913ef1c9e4e106
|
[REMOVED]
|
{"len_cl100k_base": 13488, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 43518, "total-output-tokens": 16414, "length": "2e13", "weborganizer": {"__label__adult": 0.0005483627319335938, "__label__art_design": 0.00032520294189453125, "__label__crime_law": 0.0003464221954345703, "__label__education_jobs": 0.0011119842529296875, "__label__entertainment": 7.402896881103516e-05, "__label__fashion_beauty": 0.0001844167709350586, "__label__finance_business": 0.00017011165618896484, "__label__food_dining": 0.0003447532653808594, "__label__games": 0.0007538795471191406, "__label__hardware": 0.0007123947143554688, "__label__health": 0.0004239082336425781, "__label__history": 0.00020182132720947263, "__label__home_hobbies": 9.584426879882812e-05, "__label__industrial": 0.00028061866760253906, "__label__literature": 0.000286102294921875, "__label__politics": 0.00023806095123291016, "__label__religion": 0.00043702125549316406, "__label__science_tech": 0.0047454833984375, "__label__social_life": 0.0001245737075805664, "__label__software": 0.00356292724609375, "__label__software_dev": 0.98388671875, "__label__sports_fitness": 0.00037598609924316406, "__label__transportation": 0.0004808902740478515, "__label__travel": 0.00022089481353759768}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 67207, 0.03902]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 67207, 0.30704]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 67207, 0.84749]], "google_gemma-3-12b-it_contains_pii": [[0, 4391, false], [4391, 11031, null], [11031, 17956, null], [17956, 26078, null], [26078, 31830, null], [31830, 35174, null], [35174, 42725, null], [42725, 44252, null], [44252, 50761, null], [50761, 56294, null], [56294, 59609, null], [59609, 66026, null], [66026, 67207, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4391, true], [4391, 11031, null], [11031, 17956, null], [17956, 26078, null], [26078, 31830, null], [31830, 35174, null], [35174, 42725, null], [42725, 44252, null], [44252, 50761, null], [50761, 56294, null], [56294, 59609, null], [59609, 66026, null], [66026, 67207, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 67207, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 67207, null]], "pdf_page_numbers": [[0, 4391, 1], [4391, 11031, 2], [11031, 17956, 3], [17956, 26078, 4], [26078, 31830, 5], [31830, 35174, 6], [35174, 42725, 7], [42725, 44252, 8], [44252, 50761, 9], [50761, 56294, 10], [56294, 59609, 11], [59609, 66026, 12], [66026, 67207, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 67207, 0.23132]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
72226d1f31244e0e8e7fe07e80c0ff78de2ce6b5
|
[REMOVED]
|
{"Source-Url": "http://www.irisa.fr/LIS/cellier/publis/icfca08.pdf", "len_cl100k_base": 9191, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 39375, "total-output-tokens": 11190, "length": "2e13", "weborganizer": {"__label__adult": 0.00030875205993652344, "__label__art_design": 0.0002930164337158203, "__label__crime_law": 0.0003440380096435547, "__label__education_jobs": 0.0004334449768066406, "__label__entertainment": 5.02467155456543e-05, "__label__fashion_beauty": 0.00012683868408203125, "__label__finance_business": 0.00012636184692382812, "__label__food_dining": 0.00025463104248046875, "__label__games": 0.0005931854248046875, "__label__hardware": 0.0006303787231445312, "__label__health": 0.0003402233123779297, "__label__history": 0.00018405914306640625, "__label__home_hobbies": 7.11679458618164e-05, "__label__industrial": 0.0002751350402832031, "__label__literature": 0.00023424625396728516, "__label__politics": 0.00018870830535888672, "__label__religion": 0.0003490447998046875, "__label__science_tech": 0.01068115234375, "__label__social_life": 7.349252700805664e-05, "__label__software": 0.005462646484375, "__label__software_dev": 0.97802734375, "__label__sports_fitness": 0.0002460479736328125, "__label__transportation": 0.00034546852111816406, "__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, 42419, 0.0287]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42419, 0.63209]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42419, 0.91023]], "google_gemma-3-12b-it_contains_pii": [[0, 2763, false], [2763, 6041, null], [6041, 8255, null], [8255, 10926, null], [10926, 13626, null], [13626, 15485, null], [15485, 18932, null], [18932, 20754, null], [20754, 22678, null], [22678, 25227, null], [25227, 28456, null], [28456, 30344, null], [30344, 33696, null], [33696, 36875, null], [36875, 39761, null], [39761, 42419, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2763, true], [2763, 6041, null], [6041, 8255, null], [8255, 10926, null], [10926, 13626, null], [13626, 15485, null], [15485, 18932, null], [18932, 20754, null], [20754, 22678, null], [22678, 25227, null], [25227, 28456, null], [28456, 30344, null], [30344, 33696, null], [33696, 36875, null], [36875, 39761, null], [39761, 42419, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42419, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42419, null]], "pdf_page_numbers": [[0, 2763, 1], [2763, 6041, 2], [6041, 8255, 3], [8255, 10926, 4], [10926, 13626, 5], [13626, 15485, 6], [15485, 18932, 7], [18932, 20754, 8], [20754, 22678, 9], [22678, 25227, 10], [25227, 28456, 11], [28456, 30344, 12], [30344, 33696, 13], [33696, 36875, 14], [36875, 39761, 15], [39761, 42419, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42419, 0.08671]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
93ca490aa076c89d8dc6b568f59f2a02bdc4000c
|
Practical Assessment of the Models for Identification of Defect-prone Classes in Object-Oriented Commercial Systems Using Design Metrics
Giancarlo Succi, Witold Pedrycz, Milorad Stefanovic, James Miller
Department of Electrical and Computer Engineering, University of Alberta, Edmonton, AB
Abstract
The goal of this paper is to investigate and assess the ability of explanatory models based on design metrics to describe and predict defect counts in an object-oriented software system. Specifically, we empirically evaluate the influence of design decisions to defect behavior of the classes in two products from the commercial software domain. Information provided by these models can help in resource allocation and serve as a base for assessment and future improvements.
We use innovative statistical methods to deal with the peculiarities of the software engineering data, such as non-normally distributed count data. To deal with overdispersed data and excess of zeroes in the dependent variable, we use negative binomial and zero-inflated negative binomial regression in addition to Poisson regression.
Furthermore, we form a framework for comparison of models’ descriptive and predictive ability. Predictive capability of the models to identify most critical classes in the system early in the software development process can help in allocation of resources and foster software quality improvement. In addition to the correlation coefficients, we use additional statistics to assess a models’ ability to explain high variability in the data and Pareto analysis to assess a models’ ability to identify the most critical classes in the system.
Results indicate that design aspects related to communication between classes and inheritance can be used as indicators of the most defect-prone classes, which require the majority of resources in development and testing phases. The zero-inflated negative binomial regression model, designed to explicitly model the occurrence of zero counts in the dataset, provides the best results for this purpose.
1 Introduction
Software quality is a key element in the success of any software organization. Assuring high quality in development of large software systems has become an increasingly complex, time-consuming activity. Consequently, it is essential to focus the available resources on the most critical parts of the system.
Client’s satisfaction is crucial for commercial software systems. Ensuring that the product satisfies functional and other quality requirements is essential in achieving this goal. Early indication of most critical software modules and possible bottlenecks is a valuable asset in efficient management of commercial software projects.
A widely used set of software metrics for object-oriented systems is the suite proposed by (Chidamber and Kemerer, 1994), referred to as CK metrics. Clearly, it is valuable to empirically validate the ability...
of these metrics to help in identification of the classes that cause most of the defects in the system, and consequently consume a great portion of the effort in the development and testing activities.
There has been a lot of work in this area, both theoretical and empirical. (Li and Henry, 1993) employed the CK metrics (without CBO) for predicting maintainability of two commercial software systems developed in object-oriented Classic-Ada. (Basili et al., 1996) organized an experiment in the university environment to evaluate the ability of CK metrics to be used as predictors of fault-prone classes. (Chidamber et al., 1998) explored relation between CK metrics and the size and the development time for three financial applications. (Briand and Wüst, 1999) also investigated the impact CK metrics have on the time spent in development. They used data from the music editor developed in the university settings. More recently, (Ronchetti and Succi, 2000) applied the subset of CK metrics extracted from the analysis documentation of two telecommunication projects to model the size of the system. An overview of the related work in this area with comparison of the most important aspects of the different studies is shown in Table 5. Our paper contributes to the existing research on this subject by focusing on a specific application domain using data from an industrial project in commercial application domain.
For the application analyzed in this study, all the modifications of the classes caused by defects in software operation were recorded throughout the development process. We assume the number of modifications referring to defects represents a good estimation of the defect-proneness of the class.
The metrics we collected are the software size, represented by the number of source lines of code (LOC), and the set of CK metrics, measuring different aspects of software design, such as complexity, coupling, cohesion, and inheritance. We use this set of product metrics to identify the characteristics of the object-oriented design with the highest impact on the defect-proneness of classes. All the metrics are collected from the source code of a stable product release.
In statistical analysis and modeling of the dependent variable in our study, i.e., the number of defects for the class, we use methods appropriate for the count data. In order to deal with typical problems in modeling software characteristics, such as too high variance of the dependent variable and underprediction of the zero values, we apply the Poisson regression model (PRM), the negative binomial regression model (NBRM), and the zero-inflated negative binomial regression model (ZTNBRM). These models are employed for estimation of the number of defects from the design metrics (class 3 model; Fenton and Pfleeger, 1996).
Beside the coefficient of correlation between the model estimations and the observed data, and the dispersion parameter (see Section 2.4), we use Pareto analysis to further characterize the performance of the models. This analysis represents an additional method for assessment and comparison of the models’ ability to identify the most critical classes in the system.
This paper is organized as follows: An overview of the applied metrics and statistical methods used in this study is provided in Section 2. Section 3 discusses the evaluation of the construction of models to explain the collected data. The reference products and the experimental data are presented in Section 4. In Section 5, the regression models are applied for estimation of the number of defects for classes based on the extracted metrics. The analysis of the results is presented in Section 6. A comparison with the related work performed in this area is shown in Section 7. Conclusions and directions for future research are presented Section 8.
2 Background
In this chapter we discuss the metrics collection process, methods used in the statistical analysis and modeling, including Pareto analysis for evaluation of the resulting models.
2.1 Object-oriented metrics
As mentioned, we use the relatively simple and well-understood CK metrics suite. This set of six metrics shows a good potential in forming a complete measurement framework in an object-oriented environment (Mendonça and Basili, 2000). The CK suite includes the Depth of Inheritance Tree (DIT) for a class corresponds to the maximum length from the root of the inheritance hierarchy to the node of the observed class. Another metrics related to the inheritance is NOC representing the number of immediate descendants of the class in the inheritance tree. CBO is defined as the number of other classes to which a class is coupled through method invocation or use of instance variables. RFC is the cardinality of the set of all internal methods and external methods directly invoked by them. We use Number Of Methods (NOM) measure as in (Ronchetti and Succi, 2000). The number of internal methods is extracted instead of forming a weighted sum of the methods based on complexity. (Basili et al., 1996) and (Chidamber et al., 1998) refer to this measure as a WMC, using unit weight for methods. The lack of cohesion in methods (LCOM) is defined as the number of pairs of non-cohesive methods minus the count of cohesive method pairs, based on common instance variables used by the methods in a class. Since the analyzed code is written in C++, source lines of code are counted using semicolons.
A number of alternative object-oriented measures have been proposed. Some of them account for deficiencies of the CK metrics (Li, 1998). The metric suite proposed by (Li, 1998) consists of the number of ancestor classes (NAC), number of local methods (NLM), class method complexity (CMC), number of descendant classes (NDC), coupling through abstract data type (CTA), and coupling through message passing (CTM). (Marchesi 1998) introduces metrics for object oriented analysis models in UML. (Nesi and Querci, 1998) propose a set of complexity and size metrics for effort evaluation and prediction, providing also a validation for some of them. (Reyes and Carver, 1998) define an object-oriented inter-application reuse measure. (Shih et al., 1998) propose a concepts of unit repeated inheritance and inheritance level technique for measuring the software complexity of an inheritance hierarchy. (Bansiya and Davis, 1999) introduce Average Method Complexity (AMC) and Class Design Entropy (CDE) that measure the complexity of a class using the information content. (Kamiya et al., 1999) propose revised set of CK metrics for software with reused components. (Miller et al., 1999) propose four new measures of hierarchy, inheritance, identity, polymorphism, and encapsulation in an object-oriented design. (Teologlou, 1999) describes the predictive object points for size and effort estimation.
The set of object-oriented design metrics and the source lines of code count used in this paper are collected from the source code using WebMetrics, a software metrics collection system (Succi et al., 1998). This tool supports collection of procedural and object-oriented set of software metrics for multiple programming languages.
2.2 Regression models for the count data
In this study we deal with a count dependent variable (number of defects for a class) ranging on an absolute scale.
Treating count variables as continuous, although being common practice (Fenton and Neil, 1999; Gray and MacDonell, 1997), also endorsed by (Briand et al., 1996), may result in inefficient and biased models (Long, 1997).
The most common distributions applied to the count data are based on the Poisson and multinomial distributions (Lloyd, 1999). The Poisson distribution is particularly suitable for counting events occurring over time. In the corresponding PRM, the Poisson distribution determines the probability of a count, where the mean of the distribution is a function of the independent variables. PRM has been used in software engineering for modeling the number of faults (Graves et al., 2000) and the effort expressed in hours (Briand and Wüst, 1999). PRM requires equidispersion, i.e., equality of the
conditional variance and the conditional mean of the dependent variable. When conditions for the PRM are not met, e.g., in case of high conditional variance of the dependent variable, the Negative Binomial (NB) distribution and the associated NBRM can be used (Lloyd, 1999; Briand and Wüst, 1999).
It is common in software metrics data that the number of zeros exceeds the prediction of both PRM and NBRM. Zero-inflated count models explicitly model the number of predicted zeros (Lambert, 1990).
The following subsections explain these models.
2.3 Poisson model
The Poisson process is a simple model for occurrence of random variables that assumes the probability of an arrival in a small interval determined by the independent variables is determined only by the size of the interval, not on the history of the process to that time (Papoulis, 1991). A Poisson distribution is the distribution of the numbers of events resulting from a Poisson process.
With respect to the occurrence of the defects in the classes and the set of predictors used in the model, we assume that the requirements of the Poisson process about the individual and independent occurrence of events are satisfied to a reasonable extent.
The Poisson distribution for a dependent variable \( y \), and a vector of \( n \) independent variables \( x=(x_1, \ldots, x_n) \) is given with:
\[
Pr(y \mid x) = \frac{e^{-\mu} \cdot \mu^y}{y!}
\]
where \( \mu \) is the mean of the dependent variable \( y \).
The Poisson distribution requires equidispersion of data, that is, the conditional mean and the conditional variance of the dependent variable should be equal (Briand and Wüst, 1999; Lloyd, 1999):
\[ E(y \mid x) = Var(y \mid x) \]
In practice, the conditional variance of the dependent variable in the model is often higher than its conditional mean, i.e., the dependent variable is overdispersed. The main cause of the overdispersion is failure of the Poisson distribution to account for heterogeneity in the data. Beside other factors such as wrong selection of the regression function or outlier data points, over-dispersion also significantly influences the goodness of fit of the overall model (Lloyd, 1999).
The PRM accounts for heterogeneity in the data based on the observed characteristics of items, i.e., based on the independent variables. To fully define the PRM, a regression function describing the underlying pattern, i.e., the mean of the data has to be defined in combination with the error distribution. The goal of statistical analysis is to find a simple regression function that successfully models the main behavior of the data.
The exponential regression function, corresponding to the multiplicative model for the means, is commonly used with the Poisson distribution (Long, 1997; Lloyd, 1999). The conditional mean is given by:
\[
\mu(y \mid x) = e^{\beta_0 + \beta_1 x_1 + \cdots + \beta_n x_n} = e^{x \beta}
\]
where \( \beta \) is the vector of model parameters.
2.4 Negative binomial model
Empirical data are often over-dispersed, i.e., the value of the conditional variance is higher than the conditional mean of the dependent variable in the PRM. The main reason for this is the lack of complete control over experiments, attributing a great part of the variability in the observed data to unknown sources. This is also known as unexplained heterogeneity.
Overdispersion results in over-estimated statistical significance of the predictors in the model (Cameron and Trivedi, 1986). An extension of the PRM, the negative binomial regression model, allows the conditional variance of the dependent variable to exceed the conditional mean.
The NBRM can be derived from the Poisson distribution based on the unobserved heterogeneity by accounting for the combined effect of unobserved variables omitted from the original model (Gourieroux et al., 1984). In the NBRM, the mean $\mu$ is replaced with the random variable $\overline{\mu}$:
$$\overline{\mu} = e^{x^\top\beta + \varepsilon}$$
where $\varepsilon$ represents a random error uncorrelated with $x$.
The relationship between $\overline{\mu}$ and the original $\mu$ is:
$$\overline{\mu} = e^{x^\top\beta} = \mu e^\varepsilon = \mu \delta$$
With assumption that $E(\varepsilon) = 0$, the expected count after adding the new source of variation is the same as it was for the PRM, i.e., $E(\overline{\mu}) = \mu$.
In the NBRM, there is a distribution of $\overline{\mu}$'s rather than a single value for a given combination of independent variables. Consequently the probability distribution function for $\delta = e^\varepsilon$ must be specified in order to solve the probability for the dependent variable. The resulting distribution is a combination of the Poisson distribution and another two probability distributions.
$$Pr(y | x) = \int_0^\infty Pr(y | x, \delta) \cdot g(\delta) d\delta$$
Gamma distribution, with a relatively simple closed form of the resulting distribution (with parameter $\nu$), is commonly assumed for $\delta$ (Long, 1997):
$$g(\delta) = \frac{\nu^\nu}{\Gamma(\nu)} \delta^{\nu - 1} e^{-\nu \delta} \text{ for } \nu > 0$$
The resulting combined NB distribution is given with:
$$Pr(y_i | x_i) = \frac{\Gamma(y_i + \nu)}{\nu^\nu \Gamma(\nu)} \left(\frac{\nu}{\nu + \mu_i}\right)^\nu \left(\frac{\mu_i}{\nu + \mu_i}\right)^{y_i}$$
where $\nu$ is a positive estimated parameter, and $\Gamma$ stands for Euler gamma function:
$$\Gamma(x) = \int_0^\infty t^{x-1} e^{-t} dt$$
For the NB distribution, the conditional mean of the dependent variable remains the same while the conditional variance of the dependent variable becomes:
$$Var(y_i | x_i) = \mu(1 + \nu^{-1} \mu_i)$$
The conditional variance of the dependent variable in the NB distribution is quadratic in the mean and, since $\mu$ and $\nu$ are positive, it exceeds the conditional mean of the Poisson distribution. The $\nu^{-1}$ is usually referred to as the dispersion parameter $\alpha$ since increasing $\alpha$ increases the conditional variance of $y$. Consequently, a low value of $\alpha$ represents a low level of over-dispersion.
The NB distribution corrects three main sources of poor fit that are often found when the Poisson distribution is used. First, the variance of the NB-distributed dependent variable exceeds the corresponding variance of the Poisson distribution for the given mean. Second, the increased variance in the NB results in substantially larger probabilities for small counts. With increased $\alpha$, the probability
of zero values in the NB is increased. For sufficiently big \( \alpha \), the conditional mode for all the values of the independent variables becomes equal to 0. Finally, the probabilities for larger counts are slightly larger in the NB distribution. Consequently, the resulting NBRM is the most commonly used model based on the combination of the Poisson distribution with other distributions (Long, 1997).
An alternative way to derive the NB distribution is based on the contagion process (Long, 1997). Contagion is defined as a process where analyzed items with a set of the independent variables initially have the same probability of certain event, but this probability changes as events occur over time. Consequently, contagion violates the assumption of independence in the Poisson distribution. Both the unobserved heterogeneity and contagion can result in the NB distribution of the dependent variable. The heterogeneity can thus be referred to as spurious contagion.
The NBRM model can be estimated by the maximum likelihood method, maximizing the likelihood equation:
\[
L(\theta | y, X) = \prod_{i=1}^{n} Pr(y_i | x_i)
\]
2.5 Zero-inflated model
The underprediction of zeroes in the PRM is partially resolved by the NBRM's increased conditional variance for the same conditional mean. On the other hand, zero-inflated models change the mean structure in order to explicitly model the excessive occurrence of zero counts (Long, 1997). These models also result in increased conditional variance of the dependent variable.
Zero-inflated models introduce the possibility that different processes generate zero counts and positive counts. They assume the population is consists of two different groups. An item belongs to one of the groups with probability \( \psi \) and to the other with the complementary probability \( 1-\psi \). This probability is determined from the characteristics of the item (Lambert, 1992). Items in the first group always have zero counts. Such items are different from those that have zero counts with a certain probability. These items belong to the second group together with the items with non-zero counts. The concept of two groups represents a discrete, unobserved heterogeneity since it is not known to which of the two groups an item with a zero count belongs.
In the group with items that are not always equal to zero, the resulting counts are governed by the PRM or the NBRM. For the NBRM, zeroes in this group occur with probability:
\[
Pr(y = 0 | x) = \left( \frac{\nu}{\nu + \mu} \right)^\mu
\]
where \( \mu = e^{\beta g} \).
The overall probability of zeroes is a combination of the probabilities of zeroes from each group multiplied by the probability of an item belonging to a particular group.
The resulting model has the following form:
\[
Pr(y = 0 | x) = \psi(x) + (1- \psi(x))Pr(y=0|x)
\]
\[
Pr(y = 0 | x) = (1- \psi(x))Pr_{P}(y|x)
\]
where \( Pr_{P}(y|x) \) is the probability given by the PRM or NBRM.
In the combined zero-inflated model, probability \( \Psi \) is determined by either a probit or logit model \( \Psi = F(\gamma y) \), where \( F \) is the normal or the logistic cumulative distribution function, respectively (Long, 1997). In this paper, we use the ZINBRM based on logit probability for zero counts.
The corresponding maximum likelihood method is available for zero-inflated models. The predictor vector \( z \) can (but does not have to) be the same as the vector \( x \) in the original PRM or NBRM. Clearly,
if \( z \) and \( x \) are equal, i.e., if the same predictors are used in both parts of the model, the resulting model has twice as many parameters as the corresponding NRBM.
3 Evaluating Software Engineering Data
There are no universal and general criteria for assessment of software engineering models. It is necessary to select one or more models that are most suitable for the goals in the analysis and for particular software projects (Littlewood, 1981).
Applicability, effectiveness, and predictive ability are used as criteria for assessment of models (Tian et al., 1995). Applicability evaluates the performance of a model over time and across the different datasets, e.g., for different projects. Effectiveness of the model quantifies its ability to be fitted to the actual observations. The ability of the model to predict future behavior in the software development process, based on the historical data, is usually referred to as predictive validity or predictive ability of the model (Fenton and Pfleeger, 1997).
Goodness of fit, based on the sum of square errors, is commonly used measure of effectiveness of the model (Yamada et al., 1983). Other aspects of effectiveness can be evaluated correlation coefficients and graphical methods, such as Pareto Analysis.
Capability and simplicity are also important factors for practical assessment of different models (Pressman, 1991). Model capability estimates usefulness of the information that the model provides for the software development process. Clearly, it is desirable to have a model with parameters that have some physical meaning, which can be well understood and interpreted. For a model to be really useful, it is essential that data collection process is time- and cost-effective. This characteristic of the model is referred to as the model simplicity. For example, the information about the modifications in the software is usually easily available to project managers from the company’s software configuration management system, and our analysis is based on such dataset.
Following the approach similar to Succi et al. (2000), our goal is both to create an accurate description of influence of decisions made at the design time to later defect behavior of classes to serve as a base for assessment and future improvements, and to identify most critical classes in the system early in the software evolution.
Goodness and likelihood of fit are used to measure descriptive ability of the models, while Pareto analysis is applied to assess the predictive ability of the models.
A graphical method called Alberg diagram can be used to compare performance of the different models in terms of the criticality prediction for the classes in the system (Ohlsson and Alberg, 1996). This diagram is based on the Pareto principle (also referred to as 80/20 rule; Ebert and Baisch, 1998). Pareto rule states that a small number of modules (i.e., classes in our analysis) causes the major portion of the problems and, consequently, consumes the most effort in the system. Alberg diagram is formed by placing modules in decreasing order with respect to the number of defects. The x-axis is the percentage of the total number of modules, while y-axes represents the cumulative number of defects discovered in the corresponding classes. By comparing the curves formed using the observed data and the results estimated by the model, the effectiveness of the model in identifying critical classes can be assessed. It is reported that models with lower correlation coefficients sometimes provide better prediction with respect to the criticality of the analyzed modules (Ohlsson and Alberg, 1996).
3.1.1 Methods for model estimation
Although ordinary least squares (OLS) is the most frequently used method of estimation for regression models, its application for fitting the parameters of the model is justified if error distribution is assumed
to be normal. On the other hand, the maximum likelihood (ML) method provides a general solution for fitting of the model parameters for non-normally distributed data, when the underlying distribution is known or assumed. The OLS and the ML estimates of model parameters are approximately the same for the linear model if error distribution is assumed to be normal. ML is also applicable for models, such as PRM, where the variance of the data is not constant (Tryfos, 1998).
ML method is designed to maximize the probability that the model represents the best fit to the empirical data. This estimator is consistent, i.e., the probability that this estimator differs from the true parameter by an arbitrary small amount tends toward zero as the sample size grows. The variance of the ML estimator is the smallest possible among consistent estimators. This feature is usually referred to as asymptotic efficiency of the ML estimator. Thus, we use ML estimators for the models in our analysis.
Fitting models to the empirical data has two aspects – explaining the mean tendency in the data, and variability of the data. Ability of the model to describe the main trend is captured using the likelihood score, and capability of the model with respect to the variability in the empirical data is measured through the overdispersion parameter \( \alpha \).
4 Discussion of the experimental data
This study is focused on two software projects from the commercial application domain. Both projects are developed in C++ programming language; project A over two and a half years, and project B over 6 years. All the developers, approximately 50 developers for project A and 11 developers for project B. All developers had similar experience and education levels (equivalent to BSc in Electrical and Computer Engineering or Computer Science) were involved in the development process. No particular pattern was observed in the assignment of developers to different problems or parts of the system, suggesting no selection bias.
Project A consists of 150 classes and project B of 144 classes for which the set of object-oriented design metrics was extracted and the number of defects and changed LOC was recorded. Total size of the projects A and B is 23 and 25 KLOC (thousands of lines of code), respectively.
Summary of the descriptive statistics for the extracted metrics is provided in Table 1.
<table>
<thead>
<tr>
<th></th>
<th>Project A</th>
<th>Project B</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>Min</td>
<td>Max</td>
</tr>
<tr>
<td>CBO</td>
<td>0</td>
<td>111</td>
</tr>
<tr>
<td>DIT</td>
<td>0</td>
<td>2</td>
</tr>
<tr>
<td>LCOM</td>
<td>20710</td>
<td>428.91</td>
</tr>
<tr>
<td>NOC</td>
<td>0</td>
<td>5</td>
</tr>
<tr>
<td>NOM</td>
<td>0</td>
<td>205</td>
</tr>
<tr>
<td>RFC</td>
<td>0</td>
<td>336</td>
</tr>
<tr>
<td>LOC</td>
<td>1</td>
<td>1674</td>
</tr>
<tr>
<td>Defects</td>
<td>0</td>
<td>7</td>
</tr>
</tbody>
</table>
Table 1: Descriptive Statistics of the extracted CK metrics and LOC for project A
A high level of statistically significant correlation is present between some of the extracted metrics, in particular CBO, NOM, RFC and LCOM, as shown in Table 2.
<table>
<thead>
<tr>
<th></th>
<th>CBO</th>
<th>DIT</th>
<th>LCOM</th>
<th>LOC</th>
<th>NOC</th>
<th>NOM</th>
<th>RFC</th>
</tr>
</thead>
<tbody>
<tr>
<td>Project A</td>
<td>0.18</td>
<td>0.12</td>
<td>0.16</td>
<td>0.12</td>
<td>-0.12</td>
<td>0.14</td>
<td>0.17</td>
</tr>
<tr>
<td>Project B</td>
<td>0.20*</td>
<td>-0.05</td>
<td>0.22*</td>
<td>0.37*</td>
<td>-0.03</td>
<td>0.35*</td>
<td>0.34*</td>
</tr>
</tbody>
</table>
Table 2: Correlation coefficients between the extracted metrics and number of defects
Number of modifications directly related to software defects for a class is used as a proxy for the defect-proneness of the class. We build the models for this external measure as the dependent variable and metrics from the CK set as predictors.
For project A, there are in total 287 defects recorded, ranging from 0 to 17 defects per class. Total of 514 defects are recorded for project B, with up to 41 defects per class. Most of the classes in both projects have low number of defects. Histograms of the observed data in Figure 1 show that the normal distribution cannot be assumed for the dependent variable. Since we are dealing with count data, we use PRM, NBRM, and ZINBRM.

Figure 1: Histogram of the number of defects
The Pareto rule (Ebert and Baisch, 1998) is applicable with respect to the number of defects. Less than 30% of the classes in project A correspond to 80% of the total number of defects, while in project B only 2% of the classes accounts for 80% of defects in the system. The presence of this principle that a relatively small portion of the system consumes most of the effort is closer examined using Alberg diagrams, which implements Pareto analysis, are discussed in Table 5 (Ohlsson and Alberg, 1996).
5 Extraction and analysis of the models for number of defects
For modeling the number of defects, we use three regression models based on the extracted set of design metrics. In these models, the exponent of the regression function is a linear combination of the metrics used as predictors.
The regression function in the PRM can be written in the log-linear form:
$$ln(\mu) = x\beta$$
This suggests that the PRM can be approximated by the linear regression model:
$$ln(\gamma) = x\beta + \epsilon$$
Since $y$ can also take zero value, it is necessary to add a positive constant $c$ to the dependent variable before taking the log (Long, 1997). Values of $c$ equal to 0.1 and 0.5 are typically used. In our analysis, we use $c = 0.5$. The resulting regression model is given with:
$$\ln(y+c) = x\beta+c$$
The parameters of this generalized linear model are estimated using the method of ordinal least squares (OLS). Although potentially biased, OLS estimations can be used for approximation of the statistical significance of parameters in the corresponding PRM (King, 1988).
We first apply the stepwise regression method with the log-linear form of the PRM. All the available metrics are allowed to enter this model. In the stepwise regression, independent variables are selected to enter the model based on the $p$-value. $p$-value is a measure of the statistical significance, representing the probability the outcome of the analysis is just a result of chance. The lower the $p$-value is, the higher is the statistical significance of the result. The independent variable with the smallest $p$-value is entered at each step of the regression, if that value is sufficiently small. Variables already in the model are removed if their $p$-value becomes sufficiently large. The method terminates when no more variables are eligible for inclusion or removal. In this analysis, we use 0.01 $p$-value as the entry criteria for a variable to enter the model, and 0.05 $p$-value to remove variable.
The two PRMs (PRM OLS 1 and PRM OLS 2) identified by the stepwise method for both projects are based on RFC and DIT as predictors. Although colinearity between some of the metrics is relatively high, the two metrics in the identified models (RFC and DIT) are not highly correlated (Table 2). In both models, parameters associated with RFC have positive, highly significant values.
<table>
<thead>
<tr>
<th>Project A</th>
<th>Project B</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>Intercept</td>
</tr>
<tr>
<td>PRM OLS 1</td>
<td>-1.63*</td>
</tr>
<tr>
<td>PRM OLS 2</td>
<td>-0.09</td>
</tr>
</tbody>
</table>
Table 3: Coefficients of the PRM where statistical significance is indicated by the presence of an asterisk.
It is possible to argue the any model selection mechanism is flawed. In fact, several papers in the statistical literature report a significant bias in the general application of stepwise regression. To safeguard against this the selection was repeated with other selection models, and where the numerical results change the basic semantic selection is relatively robust. Hence, we believe that the presented interpretation of the data is the most likely and hence will form the basic for the remainder of this paper. Further, as is illustrated in Table 6, this approach to model selection is a relatively common approach within much of the empirical software engineering literature.
The application of the ordinal least squares (OLS) method for fitting the parameters of the generalized linear regression model is justified if error distribution is assumed to be normal. In this case the OLS and the maximum likelihood (ML) estimates of $\theta$ are approximately the same for the linear model. On the other hand, the ML provides a very general solution for fitting of the model parameters when the underlying distribution is known or assumed. The ML estimator is consistent, i.e., the probability that this estimator differs from the true parameter by an arbitrary small amount tends toward zero as the sample size grows. The variance of the ML estimator is the smallest possible among consistent estimators. This feature is usually referred to as asymptotic efficiency of the ML estimator. Thus, we use ML estimators for the models in our analysis.
Log-likelihood function for the ML estimation in case of the Poisson distribution is given by:
$$l(\theta) = \sum_{i=1}^{k} (y_i \cdot \ln \mu_i(\theta) - \mu_i(\theta))$$
The vector of model parameters \( \theta = (\theta_1, ..., \theta_n) \) is determined by maximizing this sum over the available data points.
Using the results given with the PRM OLS 1 and PRM OLS 2, we use the same pair of metrics (RFC and DIT) as predictors for building the other models. Instead of the OLS, we use more general ML method for estimation of the PRM, NBRM, and ZINBRM. In the ZINBRM, the logit model is used for prediction of zeroes in combination with the NBRM.
The comparison of the resulting univariate (with extension 1) and bivariate (with extension 2) models with respect to the correlation coefficient \( r \), dispersion parameter \( \alpha \), and Relative Square Error (RSE) is provided in Table 4.
<table>
<thead>
<tr>
<th>Project A</th>
<th>( r )</th>
<th>( \alpha )</th>
<th>RSE</th>
<th>( r )</th>
<th>( \alpha )</th>
<th>RSE</th>
</tr>
</thead>
<tbody>
<tr>
<td>PRM OLS</td>
<td>0.40</td>
<td>13.47</td>
<td>0.79</td>
<td>0.42</td>
<td>13.24</td>
<td>0.79</td>
</tr>
<tr>
<td>PRM ML</td>
<td>0.71</td>
<td>2.07</td>
<td>0.79</td>
<td>0.75</td>
<td>1.85</td>
<td>0.79</td>
</tr>
<tr>
<td>NBRM</td>
<td>0.69</td>
<td>0.51</td>
<td>0.79</td>
<td>0.67</td>
<td>0.42</td>
<td>0.80</td>
</tr>
<tr>
<td>ZINBRM</td>
<td>0.78</td>
<td>0.46</td>
<td>0.80</td>
<td>0.78</td>
<td>0.39</td>
<td>0.79</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Project B</th>
<th>( r )</th>
<th>( \alpha )</th>
<th>RSE</th>
<th>( r )</th>
<th>( \alpha )</th>
<th>RSE</th>
</tr>
</thead>
<tbody>
<tr>
<td>PRM OLS</td>
<td>0.28</td>
<td>0.47</td>
<td>9.15</td>
<td>0.29</td>
<td>0.65</td>
<td>9.12</td>
</tr>
<tr>
<td>PRM ML</td>
<td>0.24</td>
<td>0.32</td>
<td>9.57</td>
<td>0.23</td>
<td>0.48</td>
<td>9.84</td>
</tr>
<tr>
<td>NBRM</td>
<td>0.26</td>
<td>0.31</td>
<td>11.86</td>
<td>0.20</td>
<td>0.18</td>
<td>19.38</td>
</tr>
<tr>
<td>ZINBRM</td>
<td>0.23</td>
<td>0.24</td>
<td>11.82</td>
<td>0.21</td>
<td>0.16</td>
<td>19.24</td>
</tr>
</tbody>
</table>
**Table 4: Resulting models**
### 6 Analysis of the results and discussion
Two reasonably good PRMs based on RFC and DIT (univariate and bivariate) are identified by the stepwise regression. These models in the log-linear form are given with:
\[
\ln(\text{NumberOfDefects} + 0.5) = \beta_0 + \beta_1 \text{RFC} + \beta_2 \text{DIT}
\]
Where \( \beta_i \) parameters are zero for metrics that do not enter a specific model.
Corresponding NBRM and ZINBRM are built using the ML for estimation of parameters. Results in Table 4 suggest significant differences between the models and some quantitative improvements in compared to the baseline PRM OLS models.
First, a high level of overdispersion is present in the PRM OLS models. This result is not surprising for the software metrics data. However, overdispersion is significantly lower with ML estimators. The other result of the ML method is increased correlation between the model prediction and the observed data.
Models based on the NB distribution show even higher capability of dealing with overdispersion. This improvement is partially the result of increased probability of low and high values of the dependent variable with the NB distribution.
Although the NBRM deals with the overdispersion more successfully than PRM, the disadvantage is a lower resulting correlation with the observed data.
ZINB regression models result in the highest correlation coefficient and the lowest dispersion parameter. These models incorporate the capability to successfully predict zero values with the ability of the NB distribution to account for overdispersion. Improvements achieved by the ZINBRM come with the expense of doubling the number of model parameters compared to the original NBRM.
The resulting bivariate models in Table 4 show slightly better performance than univariate models. The additional variable enables bivariate models to better fit the observed data. However, this improvement is modest and depends on many factors, such as the underlying dataset.

**Figure 2: Histograms of RFC and DIT**
Since the metrics are non-negative, positive values of model parameters suggest positive influence of the predictors to the dependent variable. The link between the dependent variable and predictors is exponential in the analyzed regression models.
All resulting models suggest high influence of communication between classes measured by RFC to the dependent variable in the analysis. The additional predictor, the measure of inheritance DIT, does not significantly increase the performance of the bivariate models compared to the univariate RFC-based models. In addition, model parameters associated with DIT have much lower statistical significance than RFC-related parameters.
Relatively narrow range of DIT also limits the influence of this measure to the resulting models. RFC is a measure with a wider range of values. In our case RFC ranged from 5 up to 250. Clearly, the higher the communication of a class with other classes, the higher will be the need for modifications in that class.
As mentioned Pareto analysis is used to compare the ability of different models for criticality prediction of the modules in the software system (Ohlsson and Alberg, 1996). Table 5 shows the Pareto analysis for the models employed on our dataset with respect to the number of defects. Pareto analysis on the observed number of defects shows that about 30% of the classes cause 80% of the total number
of the defects in the system. The parteo analysis shows that both univariate and bivariate models have relatively good performance in prediction of the defect-prone classes. Using any of those models, less than 50% of the classes can be identified that cause 80% of the defects in the system.
<table>
<thead>
<tr>
<th></th>
<th>Project A</th>
<th>Project B</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>Univariate</td>
<td>Bivariate</td>
</tr>
<tr>
<td>PRM OLS</td>
<td>45</td>
<td>43</td>
</tr>
<tr>
<td>PRM ML</td>
<td>45</td>
<td>43</td>
</tr>
<tr>
<td>NBRM</td>
<td>45</td>
<td>44</td>
</tr>
<tr>
<td>ZINBRM</td>
<td>45</td>
<td>44</td>
</tr>
</tbody>
</table>
Table 5: The Pareto analysis for the models and predicted percentiles of the classes with 80% of the defects in the system
As mentioned, RFC is a measure of communication between classes defined as the number of internal and external methods that can be executed in response to a message received by an object of the class. Clearly, a large number of methods, potentially invoked from a class, increases the complexity of the class and requires greater level of understanding and effort in development and debugging of the class.
Depth of inheritance tree represents the position the class has in the inheritance hierarchy, i.e. the maximum distance from the root node when multiple inheritance is supported, i.e. in C++. Although the deeper position of the class in the hierarchy increases its potential for reuse through inheritance, at the same time the increased number of inherited methods makes it more difficult to predict the behavior of the class. It can be beneficial to keep the level of inheritance relatively low, at expense of compromising the potential of reuse through inheritance, in order to enable easier testing and understanding of design and implementation.
While some of the object-oriented design metrics tend to change through the evolution of the project from the design phase to implementation, DIT is one of the measures determined by the architecture of the system and it typically stays unchanged in this process. Consequently, the depth of inheritance tree information can be used relatively early in the software development process.
In this paper, we have explored various different statistical approaches to modeling this problem. One obvious question is does any one of the approaches seem obviously superior to be others:
- Effectiveness of the model can be expressed in terms of correlation of its estimations with the observed data and in terms of RSE. PRM OLS and PRM ML models show best performance with respect to these criteria on both datasets.
- Part of the capability of the models to explain the empirical data is attributed to their ability to account for overdispersion and occurrence of zero counts. With respect to these criteria, using dispersion parameter $\alpha$ as a measure, ZINB and NBRM perform best on the two datasets.
- Pareto analysis can be used to assess both effectiveness of the models and their predictive ability. Pareto analysis is applied to data in this analysis demonstrate only minor differences in performance of the models. The analysis suggests that predictive ability of bivariate univariate models are similar in this respect.
Clearly, the comparison of any multi-faceted decision is highly complex and when we consider the competing measures of fitness, we can only see that no obvious “winner” emerges. Hence, we can only conclude, that this survey is inconclusive in this respect.
7 Related studies
This section provides a table with an overview of the related work in this area, comparing the most important aspects of different studies.
<table>
<thead>
<tr>
<th>7.1.1.1 Study</th>
<th>Li and Henri, 1993</th>
<th>Basili et al., 1996</th>
<th>Chidamber et al., 1998</th>
<th>Briand and Wüst, 1999</th>
<th>Ronchetti and Succi, 2000</th>
<th>This work</th>
</tr>
</thead>
<tbody>
<tr>
<td>Environment</td>
<td>Industrial</td>
<td>University</td>
<td>Industrial</td>
<td>University</td>
<td>Industrial</td>
<td>Industrial</td>
</tr>
<tr>
<td>Lifecycle phase of the independent variable</td>
<td>Design & code</td>
<td>Code</td>
<td>Design & code</td>
<td>Design & code</td>
<td>Analysis</td>
<td>Design & code</td>
</tr>
<tr>
<td>Programming language</td>
<td>Classic-Ada</td>
<td>C++</td>
<td>C++</td>
<td>C++</td>
<td>C++</td>
<td>C++</td>
</tr>
<tr>
<td>Application domain</td>
<td>User interface and scientific</td>
<td>Information system</td>
<td>Financial application</td>
<td>Music editor</td>
<td>Telecomm.</td>
<td>Commercial application</td>
</tr>
<tr>
<td>Size</td>
<td>2 projects</td>
<td>8 projects</td>
<td>3 projects</td>
<td>1 project</td>
<td>2 projects</td>
<td>2 projects</td>
</tr>
<tr>
<td>Dependent variables</td>
<td>Number of lines changed during maintenance as a proxy for maintenance effort</td>
<td>Probability of fault</td>
<td>Productivity, rework effort, design effort</td>
<td>Development time as a proxy for effort</td>
<td>Size as proxy for development effort</td>
<td>Number of defects for classes</td>
</tr>
<tr>
<td>Statistical analysis</td>
<td>Parametric linear regression</td>
<td>Logistic regression</td>
<td>Stepwise linear regression including dummy variables</td>
<td>Poisson regression and regression trees</td>
<td>Parametric and non-parametric correlation: linear regression</td>
<td>Poisson, negative binomial, and zero-inflated regression</td>
</tr>
<tr>
<td>Conclusions</td>
<td>No other CK metrics but CBO influence significantly the dependent variable</td>
<td>NOM, DIT, CBO, RFC significantly influence the dependent variable</td>
<td>High values of CBO and LCOM significantly influence the dependent variable</td>
<td>Size measures can be used as good predictors of effort</td>
<td>NOM significantly influences the dependent variable</td>
<td>RFC and DIT have highest impact on both dependent variables</td>
</tr>
<tr>
<td>Other considerations</td>
<td>N/A</td>
<td>The cross-correlation of the CK metrics are low</td>
<td>DIT and NOC assume low values; CBO, NOM, and RFC are highly correlated; the other correlations between metrics are low</td>
<td>Coupling measures do not add substantial quality to the models</td>
<td>DIT and NOC assume low values; the cross-correlation between the three CK metrics are low</td>
<td>Some cross-correlation between the CK metrics are high (NOM, CBO, RFC, LCOM)</td>
</tr>
</tbody>
</table>
Table 5: Related work
After all of this work and endeavour, we would hope that a clear picture has emerged about the usefulness of the CK metrics. Unfortunately, no clear unifying conclusion exists. An interesting further study, would be to undertake a multi-analysis of these studies to attempt to reveal any underlying numerical patterns consistent within the studies. It is also interesting to note, that the underlying statistical approach in not constant across the studies, and one strong possibility is that the individual findings are strongly influenced by the analytical approach. Further, more complex analytical approaches are possible, such as the use of hierarchical linear models, and one possibility that exists is that work within this field will have to more to these more involved approaches in at attempt to discover the true underlying nature of the observed data.
8 Conclusion
In this paper we provided an empirical validation of the common object-oriented design metrics used for early identification of the defect-prone and effort-intensive classes. Using the number of modifications caused by defects as an external measure, we investigated the impact that the object-oriented design has on the number of defects for a class. The design of an object-oriented software system offers a substantial amount of information about the system even before any coding has started. We provide the results of this extensive study carried out on a project from the commercial application domain.
In this analysis we use statistical models for the count data, i.e., PRM, NBRM, and ZINBRM. These models account for the typical problems with the software metrics data, such as overdispersion and heterogeneity. The ability of the models to identify the most critical classes is assessed using Pareto analysis.
Results indicate that coupling (RFC) and inheritance (DIT and NOC) represent best indicators of the defect-intensive classes. By using these two measures, project managers can identify the classes and files that require more careful development and rigorous testing. The trade-offs in software design can be better understood and managed by having precise quantitative insights into relationship between the conflicting aspects (Chidamber and Kemerer, 1994). Corresponding models can be used to improve both the development and testing process.
References:
Cameron A.C. and Trivedi P.K. (1986) “Econometric models based on count data: Comparisons and applications of some estimators and tests,” Journal of Applied Econometrics, 1, 29-93
Lambert D. (1990) "Zero-inflated poisson regression with an application to defects in manufacturing," Technometrics, 34, 1-14
Reyes L. and Carver D. (1998) 'Predicting object reuse using metrics', SEKE '98, Tenth International Conference on Software Engineering and Knowledge Engineering, Skokie, IL, USA
|
{"Source-Url": "http://www.inf.unibz.it/~gsucci/publications/images/practical_assessment_j54.pdf", "len_cl100k_base": 11398, "olmocr-version": "0.1.49", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 18173, "total-output-tokens": 13440, "length": "2e13", "weborganizer": {"__label__adult": 0.0004014968872070313, "__label__art_design": 0.0003609657287597656, "__label__crime_law": 0.0003218650817871094, "__label__education_jobs": 0.0009613037109375, "__label__entertainment": 5.012750625610352e-05, "__label__fashion_beauty": 0.00017392635345458984, "__label__finance_business": 0.0002675056457519531, "__label__food_dining": 0.0002968311309814453, "__label__games": 0.0005483627319335938, "__label__hardware": 0.0007023811340332031, "__label__health": 0.0005097389221191406, "__label__history": 0.0002167224884033203, "__label__home_hobbies": 8.64863395690918e-05, "__label__industrial": 0.0003635883331298828, "__label__literature": 0.0002677440643310547, "__label__politics": 0.00022292137145996096, "__label__religion": 0.0003838539123535156, "__label__science_tech": 0.0106201171875, "__label__social_life": 8.547306060791016e-05, "__label__software": 0.0034351348876953125, "__label__software_dev": 0.97900390625, "__label__sports_fitness": 0.00029349327087402344, "__label__transportation": 0.00046634674072265625, "__label__travel": 0.00018465518951416016}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 52939, 0.04063]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 52939, 0.32879]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 52939, 0.88565]], "google_gemma-3-12b-it_contains_pii": [[0, 2932, false], [2932, 6976, null], [6976, 11098, null], [11098, 14476, null], [14476, 17623, null], [17623, 21127, null], [21127, 25040, null], [25040, 28570, null], [28570, 30688, null], [30688, 34656, null], [34656, 37907, null], [37907, 39664, null], [39664, 42986, null], [42986, 45710, null], [45710, 49119, null], [49119, 52351, null], [52351, 52939, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2932, true], [2932, 6976, null], [6976, 11098, null], [11098, 14476, null], [14476, 17623, null], [17623, 21127, null], [21127, 25040, null], [25040, 28570, null], [28570, 30688, null], [30688, 34656, null], [34656, 37907, null], [37907, 39664, null], [39664, 42986, null], [42986, 45710, null], [45710, 49119, null], [49119, 52351, null], [52351, 52939, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 52939, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 52939, null]], "pdf_page_numbers": [[0, 2932, 1], [2932, 6976, 2], [6976, 11098, 3], [11098, 14476, 4], [14476, 17623, 5], [17623, 21127, 6], [21127, 25040, 7], [25040, 28570, 8], [28570, 30688, 9], [30688, 34656, 10], [34656, 37907, 11], [37907, 39664, 12], [39664, 42986, 13], [42986, 45710, 14], [45710, 49119, 15], [49119, 52351, 16], [52351, 52939, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 52939, 0.1938]]}
|
olmocr_science_pdfs
|
2024-11-24
|
2024-11-24
|
633e1c3be3f94becec2c232912aebbb4b75a82f2
|
A Graph-based Approach for Deploying Component-based Applications into Channel-based Distributed Environments
Abbas Heydarnoori and Walter Binder
Faculty of Informatics, University of Lugano, Lugano, Switzerland
Email: firstname.lastname@usi.ch
Abstract—With significant advances in software development technologies, it is now possible to have complex software applications, which include a large number of heterogeneous software components distributed over a large network of computers with different computational capabilities. To run such applications, their components must be instantiated on proper hardware resources in their target environments so that user requirements and constraints are also met. This process is called software deployment. However, this process is often challenging for large, distributed, component-based applications with many constraints and requirements. This article presents a graph-based deployment approach that does the deployment with respect to the communication resources required by application components and communication resources available on the hosts in the target environment. In our approach, component-based applications and distributed environments are modeled with the help of graphs. Deployment of an application is then defined as the mapping of the application graph to the target environment graph. This article further discusses how this mapping could be done to minimize the cost and to maximize the reliability of deployments.
Index Terms—Component-based applications, software deployment, distributed environments, communication channels, reliability.
I. INTRODUCTION
In the past, software applications were stand-alone systems, without any connections to other software applications. In recent years, software applications have become more and more complex. They may consist of a large number of different components distributed over many computers, and large networks have moved to the center of software applications. In these applications, since different components provide their functionality only when their constraints and requirements are met, they should be installed on proper hardware resources in the distributed environment in order for them to provide the expected quality of service (QoS). In addition, different resources have different computational capabilities, making it impossible to install any kind of software components on them. The goal of the software deployment process [3], [4] is to place an already developed application into its target environment and bring it into an executing state. For simple stand-alone software systems that should be deployed only to a single computer, deployment activities can be easily done. However, suppose a complex component-based application is being deployed into a large distributed environment so that some QoS parameters, such as performance or reliability, are also maximized. In this situation, the deployment process is not so straightforward and automated tools and techniques are required.
This article presents a graph-based approach that does the deployment with respect to the communication resources required by application components and communication resources available on the hosts in the target environment. For this purpose, the concept of channel is used to model the intercommunications among components. A channel is a point-to-point communication medium with well-defined behavior. A component-based application is then modeled as a graph of components connected by a number of channels, possibly with different characteristics. A distributed environment is also modeled as a graph of hosts connected by different channel types that can exist between every two hosts. Deployment planning is then defined as the mapping of the application graph to the target environment graph so that the desired QoS parameter is maximized. As examples of this approach, we show how this mapping can be effectively done for minimum cost and maximum reliability of deployments.
This article is organized as follows: Section II presents the Reo coordination model as an example of channel-based coordination models and provides a running example which is used throughout this article. The required inputs for our deployment planning process are discussed in Section III. These inputs are then modeled as graphs in Section IV. Next, Section V introduces the problem of software deployment as a graph mapping problem. Section VI presents algorithms for solving this mapping problem for the QoS parameters cost and reliability. Finally, Section VII provides an overview of related work and Section VIII concludes.
II. REO COORDINATION MODEL
Reo is a channel-based coordination model that exogenously coordinates the cooperative behavior of component instances in a component-based application [5]. From
the point of view of Reo, an application consists of a number of component instances communicating through connectors that coordinate their activities. The emphasis of Reo is on connectors, their composition and their behavior. Reo does not say much about the components whose activities it coordinates. In Reo, connectors are compositionally constructed out of a set of simple channels. Thus, channels represent atomic connectors. A channel is a communication medium which has exactly two channel ends. A channel end is either a source channel end or a sink channel end. A source channel end accepts data into its channel. A sink channel end dispenses data out of its channel. Although every channel has exactly two ends, these ends can be of the same or different types (two sources, two sinks, or one source and one sink). Reo assumes the availability of an arbitrary set of channel types, each with well-defined behavior provided by the user. However, a set of examples in [5] show that exogenous coordination protocols that can be expressed as regular expressions over I/O operations correspond to regular expressions over I/O operations correspond to
- **Sync**: It has a source and a sink. Writing a value succeeds on the source of a Sync channel if and only if taking of that value succeeds at the same time on its sink.
- **LossySync**: It has a source and a sink. The source always accepts all data items. If the sink does not have a pending read or take operation, the LossySync loses the data item; otherwise the channel behaves as a Sync channel.
- **SyncDrain**: It has two sources. Writing a value succeeds on one of the sources of a SyncDrain channel if and only if writing a value succeeds on the other source. All data items written to this channel are lost.
- **AsyncDrain**: This channel type is analogous to SyncDrain except that the two operations on its two source ends never succeed simultaneously. All data items written to this channel are lost.
- **FIFO1**: It has a source and a sink and a channel buffer capacity of one data item. If the buffer is empty, the source channel end accepts a data item and its write operation succeeds. The accepted data item is kept in the internal buffer. The appropriate operation on the sink channel end (read or take) obtains the content of the buffer.
In Reo, a connector is represented as a graph of nodes and edges such that: zero or more channel ends coincide on every node; every channel end coincides on exactly one node; and an edge exists between two (not necessarily distinct) nodes if and only if there exists a channel whose channel ends coincide on those nodes. As an example of Reo connectors, Figure 1 shows a barrier synchronization connector in Reo. In this connector, a data item passes from A to C only simultaneously with the passing of a data item from B to D and vice versa. This is because of the “replication on write” property in Reo, and different characteristics of different channel types. In Reo, it is easily possible to construct different connectors by a set of simple composition rules out of a very small set of primitive channel types [6].
### A. Example: Modeling a Flight Reservation System with Reo
In this section, we provide a simple example of a flight reservation system which is used as the running example throughout this article. In this example, the barrier synchronization connector in Reo is used to compose a number of Web services. Web services refer to accessing services over the Web [7]. In this example, they are treated as black-box software components.
Suppose a travel agency wants to offer a Flight Reservation Service (FRS). For some destinations, a connection flight might be required. Suppose some other agencies offer services for International Flight Reservation (IFRS) and Domestic Flight Reservation (DFRS). Thus, FRS commits successfully whenever both IFRS and DFRS services commit successfully. This behavior can be easily modeled by a barrier synchronization connector in Reo (Figure 2). The FRS service makes commit requests on channel ends A and B. These commits will succeed if and only if the reservations at the IFRS and DFRS services succeed at the same time. This behavior is because of the semantic of the barrier synchronization connector in Reo.
### III. DEPLOYMENT PLANNER INPUTS
To generate deployment plans, the following inputs should be specified: (1) the component-based application being deployed, (2) the distributed environment in which the application will be deployed, and (3) the user-defined constraints regarding this deployment. In the following, these inputs are described in more detail.
A. Specification of the Application being Deployed
Any loosely coupled, component-based application consists of a number of components and interconnections that connect them. The nature of these components and interconnections are irrelevant to this specification. For example, components could be threads, processes, services, Java beans, CORBA components, and so on. In our model, a software component is viewed as a black-box software entity which reads data from its input port and writes data to its output port. How it manipulates the data, or its internal details are not important. The communication among these black-box entities is done via their interconnections. Again, these component interconnections could be anything connecting them; for example, glue code, middleware, connectors, and so on. Regardless of the type of these interconnections, different components send data/messages to other components and receive data/messages from other components of the application. Thus, it is possible to assume that the communication among the application components is done via a number of channels with different characteristics. Specially, it is proved that the primitives of other communication models (such as message passing, shared spaces, or remote procedure calls) can be easily modeled by the channel-based communication model [5].
In summary, the specification of the application should specify different components of the application and the channel types among them (e.g., Figure 2).
B. Specification of the Target Environment
In this article, the target environment for the deployment of the application is a distributed environment consisting of a number of hosts with computational capabilities (e.g., PCs, laptops, servers, etc.) connected by a network. Furthermore, the required software for the communication among the application components (e.g., the Reo coordination middleware) has been already installed on them. However, since different hosts may have different hardware properties, it might be impossible to install some sorts of communication software on them, or they may not be able to support some features of the communication software installed on them. It is also possible that different features/versions of the communication software are installed on different hosts because of some reasons (e.g., cost, security, etc.). With respect to this discussion, available hosts in the target environment may provide different sorts of communication resources required to interconnect applications’ components. In particular, since we are modeling the interconnections among the application components as a set of channels with different characteristics, different hosts might be able to support different sets of channel types (or implementations) with different behaviors and QoS characteristics. Thus, in this article, communication resources available on different hosts are different channel types (or implementations) they can support. As an example, Figure 3 shows a sample target environment for the flight reservation system consisting of five hosts \( H_1 \)–\( H_5 \), connected by a network (solid lines). In this figure, \( T_d \)'s represent different channel types (or implementations) that different hosts can support. For example, in the case of using Reo coordination model, \( T_1 \)–\( T_5 \) could be defined as the following channel types (or implementations):
- \( T_1 \): Sync channel type implemented by shared memory;
- \( T_2 \): Sync channel type implemented by encrypted peer-to-peer connection;
- \( T_3 \): Sync channel type implemented by simple peer-to-peer connection;
- \( T_4 \): SyncDrain channel type;
- \( T_5 \): SyncSpout channel type.
Logically, \( T_1 \)–\( T_3 \) are all implementations of the same channel type (Sync). However, their hardware requirements and QoS characteristics differ.
C. Specification of the User-defined Constraints and Requirements
Users may have special requirements and constraints regarding the deployment of the application that should be taken into account during the deployment planning. For example, users may want a special component to be run on a certain host, or they may have certain QoS requirements such as security, cost, or reliability. The deployment planner needs this information to generate a plan that answers these requirements too.
For example, in the flight reservation system, suppose users require the transfer of data between FRS and IFRS to be encrypted. In addition, they want FRS to be run on either \( H_1 \) or \( H_3 \).
IV. MODELING THE DEPLOYMENT PLANNER INPUTS
The deployment planner inputs should be modeled with well-defined structures in order to be used for effective deployment planning purposes. In this section, we show that it is possible to develop graph representations of these inputs. This graph-based modeling makes it feasible to apply graph theory algorithms in designing deployment planning algorithms.
A. Modeling the Application
In Section III-A, we mentioned that loosely coupled, component-based applications can be viewed as a number of components connected by a number of channels with different characteristics through which they communicate. With respect to this description of component-based applications, it is possible to model any loosely coupled, component-based application as a graph whose nodes are application components and its edges are channels among these components.
Definition 1 (Application Graph): Suppose \( C_1, \ldots, C_n \) represent different components of the application, and \( T_1, \ldots, T_m \) represent different channel types. Then, application graph \( AG = (V_{AG}, E_{AG}) \) is defined as a graph on \( V_{AG} = \{C_1, C_2, \ldots, C_n\} \) in which each edge \( e \in E_{AG} \) has a label \( l_e \in \{T_1, T_2, \ldots, T_m\} \).
For example, Figure 4 shows the application graph for the flight reservation system. This graph is built with respect to both the specifications of the application being deployed, and user-defined constraints regarding this deployment. For example, in the specification of the application (Figure 2), \( Sync \) channels are used to connect FRS and IFRS components. Nonetheless, as mentioned in Section III-C, users want the transfer of data between FRS and IFRS to be encrypted. Thus, in the application graph presented in Figure 4, \( Encrypted \ Sync \) channel type is used between FRS and IFRS components.
B. Modeling the Target Environment
As mentioned in Section III-B, in this article the target environment for the deployment of the application is a number of hosts with different computational capabilities connected by a network in a distributed environment and each of them can support a set of channel types. With respect to this description of the target environment, it is possible to model the target environment with the help of a graph in which:
- Nodes represent available hosts in the distributed environment.
- Edges represent different channel types that can exist between every two hosts.
To generate such a graph, first it is required to notice to the following definitions.
Definition 2 (Adjacent Hosts): Two distinct hosts \( H_x \) and \( H_y \) are adjacent if there is a direct physical link between them in the distributed environment.
As an example, hosts \( H_1 \) and \( H_4 \) in Figure 3 are adjacent.
Definition 3 (Virtual Channel Type): Two distinct hosts \( H_x \) and \( H_y \) are virtually connected if there is not any direct physical link between them in the distributed environment, but they are connected indirectly through intermediate hosts.
As an example, hosts \( H_1 \) and \( H_2 \) in Figure 3 are virtually connected.
Definition 4 (Transitive Channel Type): Suppose two hosts \( H_x \) and \( H_y \) are virtually connected. A channel type \( T_d \) is transitive if it is possible to create a channel of type \( T_d \) between them when (1) both of them can support channel type \( T_d \), and (2) all intermediate hosts between them can also support channel type \( T_d \).
For example, in the Reo coordination model, channel type \( Sync \) is a transitive channel type.
Definition 5 (Non-transitive Channel Type): A channel type \( T_d \) is non-transitive if it is possible to create a channel of type \( T_d \) between two hosts \( H_x \) and \( H_y \) only when (1) both of them can support channel type \( T_d \), and (2) they are adjacent.
As an example, in the Reo coordination model, channel type \( SyncDrain \) is a non-transitive channel type.
With respect to the above definitions, target environment graph is defined in the following way:
Definition 6 (Target Environment Graph): Suppose \( H_1, \ldots, H_m \) represent different hosts in the target environment, \( T_1, \ldots, T_n \) represent different channel types, and \( e_{H_x, H_y, T_d} \) represents an edge from node \( H_x \) to node \( H_y \) with label \( T_d \). Then, the target environment graph \( TG = (V_{TG}, E_{TG}) \) is defined as a graph on \( V_{TG} = \{H_1, H_2, \ldots, H_m\} \) in which the set of edges \( E_{TG} = \bigcup\{e_{H_x, H_y, T_d}\} \) is determined in the following way:
- If \( T_d \) is a transitive channel type, then there exists an edge \( e_{H_x, H_y, T_d} \) between two distinct nodes \( H_x \) and \( H_y \) only if (1) both of them are adjacent or virtually connected, (2) both of them support channel type \( T_d \), and (3) if they are virtually connected, all intermediate hosts support channel type \( T_d \).
- If \( T_d \) is a non-transitive channel type, then there exists an edge \( e_{H_x, H_y, T_d} \) between two distinct nodes \( H_x \) and \( H_y \) only if (1) they are adjacent, (2) both of them support channel type \( T_d \).
- If \( T_d \) can be supported by host \( H_x \), then there is an edge \( e_{H_x, H_y, T_d} \) from \( H_x \) to \( H_y \) (loopback edge).
As an example, Figure 5 shows the target environment graph generated by this method for the distributed environment presented in Figure 3. To make the figure simpler, loopback edges are not shown. For a more specific example, consider hosts \( H_1 \) and \( H_2 \) which are virtually connected (i.e., through host \( H_3 \)). As mentioned in Section III-B, in this example, \( T_1 – T_3 \) are different implementations of the \( Sync \) channel type which is a transitive channel type. Thus, it is possible to have channels of types \( T_1 – T_3 \) between \( H_1 \) and \( H_2 \). Furthermore, both \( H_1 \) and \( H_2 \) support channel type \( T_4 \) (i.e., \( SyncDrain \)).
which is a non-transitive channel type. However, since $H_1$ and $H_2$ are not adjacent, it is impossible to have a channel of type $T_4$ between them.
C. Target Environment Graph for a Peer-to-Peer Distributed Environment
In a peer-to-peer (P2P) distributed environment (e.g., Internet), two or more computers (called nodes) can directly communicate with each other, without the need for any intermediary devices [8]. In this situation, it is not required to consider the issues related to the physical connectivity among hosts, i.e., transitive property of channel types. In this case, the definition of the target environment graph becomes much simpler.
**Definition 7 (P2P Target Environment Graph):**
The target environment graph $TG = (V_{TG}, E_{TG})$ for a P2P distributed environment is a graph on $V_{TG} = \{H_1, H_2, \ldots, H_m\}$ in which there exists an edge $e_{H_x, H_y}$ between two not necessarily distinct nodes $H_x$ and $H_y$ if and only if both of them can support channel type $T_d$.
V. DEPLOYMENT PROBLEM
After specifying the deployment planner inputs, they can be used to generate the actual deployment plan. Figure 6 shows a sample deployment for the flight reservation system. As can be seen in this figure, for the purpose of this deployment, different components of the application and channels among them are mapped to different hosts in the target environment and network links among them in such a way that all requirements and constraints are satisfied. More specifically, it could be observed that different nodes and edges of the application graph $AG$ shown in Figure 4 are mapped to different nodes and edges of the target environment graph $TG$ presented in Figure 5. In this way, we can define the deployment problem as a graph mapping problem from the application graph to the target environment graph. To this end, we begin with defining some terms.
**Definition 8 (Candidate Host):** Let $T_{C_i} = \{T_d | T_d \in T, \exists (C_i, C_j) \in E_{AG} : \{C_i, C_j\} = T_d\}$ represent all required channel types by component $C_i$ in the application graph $AG = (V_{AG}, E_{AG})$ and let $T_{H_x} = \text{support}(H_x)$ represent the set of channel types that host $H_x$ can support. Then, host $H_x$ is a candidate host for the deployment of component $C_i$, only if (1) $T_{C_i} \subseteq T_{H_x}$, and (2) host $H_x$ satisfies user-defined constraints regarding the deployment of component $C_i$.
This definition implies that a host $H_x$ is a candidate host for the deployment of component $C_i$ if it supports all required channel types by component $C_i$ in the application graph and also the deployment of component $C_i$ on host $H_x$ meets user-defined constraints. As an example, Table I shows the candidate hosts for the deployment of the flight reservation system components. For a more specific example, consider component IFRS. In the application graph presented in Figure 4, IFRS just requires channel type $T_2$ and all of the hosts in the target environment presented in Figure 3 support this channel type. However, as mentioned in Section III-C, users want IFRS to be deployed on either hosts $H_2$ or $H_3$. So, with respect to this constraint, candidate hosts for the deployment of component IFRS are $H_2$ and $H_3$.
**Definition 9 (Candidate Deployment):** Suppose $CH_{C_i}$ represents the set of candidate hosts for the deployment of component $C_i$. Then, a candidate deployment $D_x$ is a set of pairs $(C_i, H_x)$ in which every component $C_i$ in the application graph $AG = (V_{AG}, E_{AG})$ is mapped to a host $H_x$ in the target environment graph $TG = (V_{TG}, E_{TG})$ so that host $H_x$ is a candidate host for the deployment of component $C_i$, i.e., $D_x = \{(C_i, H_x) | C_i \in V_{AG}, H_x \in V_{TG}, H_x \in CH_{C_i}\}$.
For example, $\{(\text{FRS} \leftrightarrow H_1), (\text{IFRS} \leftrightarrow H_2), (DFRS \leftrightarrow H_3), (N_1 \leftrightarrow H_4), (N_2 \leftrightarrow H_5)\}$ and $\{(\text{FRS} \leftrightarrow H_1), (\text{IFRS} \leftrightarrow H_3), (DFRS \leftrightarrow H_3), (N_1 \leftrightarrow H_4), (N_2 \leftrightarrow H_5)\}$ are two candidate deployments for the
flight reservation system.
Definition 10 (Valid Deployment): A candidate deployment $D_c$ is a valid deployment, if for all edges $e_{C_i, C_j, T_d}$ in the application graph $AG = (V_AG, E_AG)$ if components $C_i$ and $C_j$ are mapped to two not necessarily distinct hosts $H_x$ and $H_y$ in the target environment, then it should be possible to create a channel of type $T_d$ between hosts $H_x$ and $H_y$, i.e., there should be an edge $e_{H_x, H_y, T_d}$ in the target environment graph $TG = (V_TG, E_TG)$. Formally speaking, $\forall e_{C_i, C_j, T_d} \in E_AG \Rightarrow \exists e_{D_c(x_i, y_i, z_i), T_d} \in E_TG$.
As an example, $D_c = \{(FRS \rightarrow H_1), (IFRS \rightarrow H_2), (DFRS \rightarrow H_1), (N_1 \rightarrow H_1), (N_2 \rightarrow H_2)\}$ is an invalid deployment for the flight reservation system. Because, there is an edge $e_{N_1, N_2, T_4}$ in the application graph presented in Figure 4. Nonetheless, there is not an edge $e_{D_c(x_i, y_i, z_i), T_4} = e_{H_1, H_2, T_4}$ in the target environment graph presented in Figure 5. In other words, with respect to the specification of the target environment presented in Figure 3, it is impossible to create a channel of type $T_4$ between hosts $H_1$ and $H_2$.
With respect to above definitions, it is typically possible to deploy a complex component-based application into a large distributed environment in many different ways. As an example, consider again the candidate hosts for deploying each of the components of the flight reservation system shown in Table I. As can be understood from this table, it is possible to deploy this application into the target environment in at most $160 = 1 \times 2 \times 5 \times 4 \times 4$ different ways (because some of them are invalid deployments). Obviously, this number is much bigger for complex applications deployments. However, when some QoS parameters, such as cost, performance, reliability, etc., are considered, some of these candidate deployments are equivalent, some are better than others and only a few of them may accommodate the constraints and requirements of the application. Thus, when QoS of the application is important, it should be tried to deploy the application so that its desired QoS parameter is maximized.
One naïve solution to this problem is to generate all candidate deployments by permuting the sets of candidate hosts for different components of the application. Then, the desired QoS parameter of all valid candidate deployments is measured and the best one is selected. The complexity of this algorithm is $O(2^{mn + m^n}) = O(m^n)$, where $m$ is the number of available hosts in the target environment and $n$ is the number of components of the application. As we see, this is an exponentially complex solution to the deployment problem. Thus, when the number of candidate deployments is large, it is impractical to generate all of them and then select the best one. So, a set of algorithms and heuristics should be designed and applied to effectively solve such an exponentially complex problem. The following definition, provides a formal definition of the deployment problem we intend to solve.
Definition 11 (Deployment Problem): Suppose deployment planner inputs are used to build the application graph and the target environment graph according to the methods presented in Section IV. CH$_c$ also represents the set of candidate hosts for the deployment of component $C_i$. Then, for the given application graph $AG = (V_AG, E_AG)$, target environment graph $TG = (V_TG, E_TG)$, and QoS parameter $Q$, the problem is to find a polynomial time function $D : V_AG \rightarrow V_TG$ such that the following three conditions are satisfied:
1) Application’s $Q$ parameter is maximized;
2) $D(C_i) = H_x \Rightarrow H_x \in CH(C_i)$. This means that all components of the application must be mapped to one of their respective candidate hosts for the deployment;
3) $\forall e_{C_i, C_j, T_d} \in E_AG \Rightarrow \exists e_{D_c(x_i, y_i, z_i), T_d} \in E_TG$.
This means that the deployment $D$ must be a valid deployment.
This definition implies that during the deployment, it is possible to map several application components to a single host if that host is a candidate host for the deployment of those components. Furthermore, if there exists a channel of type $T_d$ between two components in the application graph, then those components can be mapped to two different hosts only if there exists a channel of type $T_d$ between them in the target environment graph.
VI. DEPLOYMENT ALGORITHMS
Section V introduced the problem of component deployment as a graph mapping problem in which the application graph is mapped to the target environment graph. This section presents polynomial time algorithms for solving this mapping problem when the target environment is a P2P distributed environment and the desired QoS parameters are minimum cost [1] and maximum reliability [2] of deployments.
A. Cost-Effective Deployment
Suppose different hosts in the target environment have different costs and whenever they are being used, their costs should be paid to their administrator(s). In this situation, one QoS parameter of a deployment is its cost and should be minimized in the deployment plan. To this end, two different cases can be considered:
Case 1: The cost should be paid for each component. In this case, for every component to be run on each host, its cost should be paid separately. For example, for each
<table>
<thead>
<tr>
<th>Component Name</th>
<th>Candidate Hosts</th>
</tr>
</thead>
<tbody>
<tr>
<td>FRS</td>
<td>$H_1$</td>
</tr>
<tr>
<td>IFRS</td>
<td>$H_2, H_3$</td>
</tr>
<tr>
<td>DFRS</td>
<td>$H_1, H_2, H_4, H_5$</td>
</tr>
<tr>
<td>N_1</td>
<td>$H_1, H_2, H_4, H_5$</td>
</tr>
<tr>
<td>N_2</td>
<td>$H_1, H_2, H_4, H_5$</td>
</tr>
</tbody>
</table>
TABLE I. CANDIDATE HOSTS FOR THE DEPLOYMENT OF THE FLIGHT RESERVATION SYSTEM COMPONENTS
For each component \( C_i \) in the application do
1. Find the set of candidate hosts, \( CH_{C_i} \)
2. if \( CH_{C_i} = \text{null} \) then
return “No Answer!”
3. else
\( H_x = \text{cheapest host in the set } CH_{C_i} \)
4. end
Output: \( C_i \rightarrow H_x \)
Figure 7. Cost-effective deployment algorithm when the cost should be paid for each component
component to be run on host \( H_1 \), $1000 should be paid to its administrator(s). Thus, if five components to be run on host \( H_1 \), \( 5 \times $1000 = $5000 \) should be paid. The required algorithm of this case is simple. In this case, in the set of candidate hosts for the deployment of each of the application components, the cheapest one is selected and that component is deployed on it. The pseudocode of this algorithm is shown in Figure 7. This algorithm has the polynomial complexity \( O(nm) \).
Case 2: The cost should be paid for each host, no matter how many components will be run on it. In this case, the number of components will be run on each host is not important; if the cost of one host is paid, it is possible to run as many components as you want on it. The complexity of this case is much more than the previous one. In this case, it should be tried to select a subset of available hosts in the target environment so that the total cost of the deployment is minimized and all the components of the application are also assigned to a host. It is easily possible to see that this problem is equivalent to the Minimum Set Cover [9] problem in graph theory.
Definition 12 (Minimum Set Cover Problem): Given a finite set \( U \) of \( n \) elements, a collection of subsets of \( U \), \( S = \{s_1, s_2, ..., s_k\} \) such that every element of \( U \) belongs to at least one \( s_i \), and a cost function \( c : S \rightarrow R \), the problem is to find a minimum cost subset of \( S \) that covers all elements of \( U \).
This case of the cost-effective deployment problem can be converted to a minimum set cover problem in the following way:
- Set \( U = \{C_1, C_2, ..., C_n\} \), i.e., the components of the application are set as the elements of the universe;
- Set \( S = \{CS_{H_1}, CS_{H_2}, ..., CS_{H_m}\} \) in which each \( CS_{H_x} \) corresponds to host \( H_x \) and it represents the subset of application components that can be run on host \( H_x \). In other words, each \( CS_{H_x} \) is a subset of application components which \( H_x \) is in their lists of candidate hosts for the deployment.
- Define \( c : S \rightarrow R \) so that \( c(CS_{H_x}) = c(H_x) \).
- Function \( c' : H \rightarrow R \) returns the cost of each host.
Theorem 1: If we define the elements of the minimum set cover problem as mentioned earlier, then the solution of the minimum set cover problem satisfies all conditions of the deployment problem defined in Definition 11.
\[
X = \emptyset, \tau = \emptyset
\]
while \( X \neq U \) do
1. Find the set \( \omega \in S \) that minimizes \( c(\omega)/|\omega\setminus X| \)
2. \( X = X \cup \omega, \tau = \tau \cup \{\omega\} \)
end
Output: \( \tau \)
Figure 8. Greedy approximation algorithm for the minimum set cover problem
It is proved that minimum set cover problem is a NP-hard problem and it can not be solved in polynomial time [10]. Nevertheless, there exist some greedy approximation algorithms that can find reasonably good answers in polynomial time. One of the key algorithms for solving this problem is presented in Figure 8 [10]. The main idea in this algorithm is to iteratively select the most cost-effective \( s_i \in S \) and remove the covered elements until all elements are covered. The complexity of this algorithm is \( O(|\log(|U|)|) \) [10].
To solve this case of the cost-effective deployment problem, first it should be converted to the minimum set cover problem as mentioned earlier. Then, it is easily possible to use the greedy approximation algorithm presented in Figure 8 to find a reasonably good solution for the problem. In other words, by using this algorithm, all components of the application will be assigned to at least one host and total cost of the deployment will be close to minimum too. As an example of using this greedy approximation algorithm, consider the flight reservation system example. With respect to Table I, the elements of the minimum set cover problem are defined in the following way:
- \( U = \{IFRS, IFRS, DFRS, N_1, N_2\} \);
- \( S = \{\{IFRS, DFRS, N_1, N_2\}, \{IFRS, DFRS, N_1, N_2\}, \{IFRS, DFRS\}, \{DFRS, N_1, N_2\}, \{DFRS, N_1, N_2\}\} \);
- \( c'(H_1) = $1000, c'(H_2) = $2500, c'(H_3) = $2000, c'(H_4) = $1500, c'(H_5) = $1000 \).
By applying the greedy approximation algorithm, we will have the following results and the minimum cost will be $3000:
- \( \{\{IFRS \rightarrow H_1\}, \{DFRS \rightarrow H_1\}, \{IFRS \rightarrow H_3\}, \{N_1 \rightarrow H_1\}, \{N_2 \rightarrow H_1\}\} \);
- \( \{\{IFRS \rightarrow H_1\}, \{DFRS \rightarrow H_3\}, \{IFRS \rightarrow H_3\}, \{N_1 \rightarrow H_1\}, \{N_2 \rightarrow H_1\}\} \).
Note that it is possible to use the algorithm presented here more generally for some other QoS parameters too, when you want to minimize the total usage of some resources of available hosts in the target environment. In this situation, it is possible to define the cost function \( c \) to return the amount of that resource for each host and then use the greedy approximation algorithm presented in Figure 8 to find the solution.
B. Reliable Deployment
One of the most important QoS parameters of a software system is its reliability, defined as the probability of failure-free software operation for a specified period of
Multiway cut is the problem of finding a set of edges $MC = \{ e \}$ and let $T = \{v_1, v_2, ..., v_n\}$ be an undirected graph on $V; E$ to the multiway cut problem in graph theory [12].
To solve this problem in polynomial time, we assume that the number of possible deployment configurations is large, this approach will not work effectively. To solve this problem in polynomial time, we permutate the sets of candidate deployment configurations by permutating the sets of candidate hosts for different components of the application. Then, the deployment configuration with the greatest number of local channels among the application components as local as possible. In this way, components located in the same host can communicate regardless of the network’s status. Thus, from this perspective, the most reliable deployment configuration can be defined as one with the least amount of communications among the hosts in the distributed environment. From another point of view, this can be also seen as the increased performance. This is due to the fact that in distributed environments, network communications have some overheads on software applications. Consequently, reduced communication among hosts can result in a higher performance.
One impractical way for finding the most reliable deployment configuration is to generate all possible deployment configurations by permutating the sets of candidate hosts for different components of the application. Then, the deployment configuration with the greatest number of local channels among the application components is selected. However, when the number of possible deployment configurations is large, this approach will not work effectively. To solve this problem in polynomial time, we show that the reliable deployment problem corresponds to the multiway cut problem in graph theory [12].
Definition 13 (Multiway Cut Problem): Let $G = (V, E)$ be an undirected graph on $V = \{v_1, v_2, ..., v_n\}$ in which each edge $e \in E$ has a non-negative weight $w(e)$, and let $T = \{t_1, t_2, ..., t_m\} \subseteq V$ be a set of terminals. Multiway cut is the problem of finding a set of edges $E' \subseteq E$ such that the removal of $E'$ from $E$ disconnects each terminal from all other terminals, and solution cost $MC = \sum_{e \in E'} w(e)$ is also minimized.
Suppose $AG = (V_{AG}, E_{AG})$ is the application graph of the software application being deployed, $V_{TG} = \{H_1, H_2, ..., H_m\}$ represents the set of available hosts in the target environment, and $CH_{C_i}$ represents the set of candidate hosts for the deployment of component $C_i$. To solve the reliable deployment problem, a graph $G = (V, E)$ is made in the following way:
- $V = V_{AG} \cup V_{TG}$.
- $E = E_{AG} \cup E_H$, where $E_H = \{(C_i, H_x)\} | C_i \in V_{AG}, H_x \in CH_{C_i}\).
- $w(e) = \begin{cases} 1 & e \in E_{AG} \\ n^2 & e \in E_H \end{cases}$, where $n^2$ shows a large number.
Figure 9 shows an example of a graph developed in this way for the application graph presented in Figure 4, and the target environment presented in Figure 3. In this graph, if we set hosts as the terminals of the multiway cut problem, we prove in the following theorem that the solution of the multiway cut problem is the solution of the reliable deployment problem we intend to solve.
**Theorem 2**: Suppose graph $G = (V, E)$ is built in the way mentioned earlier, and hosts of the target environment are set as the terminals. Then, the multiway cut solution of this graph is the solution of the reliable deployment problem we are looking for. This means that the application components that lie in the same subgraph with a host should be deployed on that host, and this deployment configuration has the least number of channels among hosts.
**Proof**: Suppose $n$ represents the number of components of the application, and $k$ represents the size of the $E_H$, i.e., $k = |E_H|$. In the multiway cut solution we are looking for, each component must be assigned to exactly one host. Thus, $(k - n)$ edges whose total weight is $n^2(k - n)$ will be removed from the $E_H$ in the cut. Also, suppose $L_{OPT}$ represents the solution of the reliable deployment problem, i.e., the least number of channels among hosts after the deployment of the application. Actually, these channels are those application graph edges that lie in the cut, and their total weight is $L_{OPT} \times 1 = L_{OPT}$. Thus, our goal is to prove that $MC = n^2(k - n) + L_{OPT}$.
**Case A**: $MC \leq n^2(k - n) + L_{OPT}$. Suppose a deployment $D : V_{AG} \rightarrow V_{TG}$ whose cost is optimum is done, i.e., it has $L_{OPT}$ number of channels among hosts. Now, assume that $C$ is its corresponding cut in the graph $G = (V, E)$:
$$C = \{(C_i, H_x) | D(C_i) \neq H_x, (C_i, H_x) \in E_H\} \cup \{(C_i, C_j) | D(C_i) \neq D(C_j), \{C_i, C_j\} \in E_{AG}\}$$
$M$ represents the set of edges of $E_H$ that lie in the cut, and $N$ represents the set of edges of $E_{AG}$ that lie in the cut. The size of $M$ is $(k - n)$ and the size of $N$ is $L_{OPT}$. Furthermore, the weight of the edges in $M$ is $n^2$.
and the weight of the edges in $N$ is 1. With respect to this description:
$$w(C) =$$
$$w(\{(C_i, H_x) | D(C_i) \neq H_x, \{C_i, H_x\} \in E_H\}) +$$
$$w(\{(C_i, C_j) | D(C_i) \neq D(C_j), \{C_i, C_j\} \in E_{AG}\}) =$$
$$n^2 \times |\{(C_i, H_x) | D(C_i) \neq H_x, \{C_i, H_x\} \in E_H\}| +$$
$$1 \times |\{(C_i, C_j) | D(C_i) \neq D(C_j), \{C_i, C_j\} \in E_{AG}\}| =$$
$$n^2(k - n) + L_{OPT}$$
Since $MC$ is the cost of the optimum multiway cut, for sure, $MC \leq w(C)$. Therefore, $MC \leq n^2(k - n) + L_{OPT}$.
**Case B:** $MC \geq n^2(k - n) + L_{OPT}$. Suppose $C$ is the optimum multiway cut for graph $G = (V, E)$ whose cost is $MC$. Now, we want to use this cut to generate its corresponding deployment $D$. For this purpose, we prove the following subcases:
**B.1: Cut $C$ includes at most $(k - n)$ edges of $E_H$.** Suppose we want to find a cut whose cost is the heaviest. In the deployment configuration we are looking for, each component should be assigned to exactly one host. For this purpose, for each component $C_i$ in graph $G$, we keep an arbitrary edge connecting that component to an arbitrary host, and we cut the rest of the edges in $E_H$ and $E_{AG}$. Since the maximum number of edges in the application graph is $\binom{2}{2}$, the cost of this cut is at most $\binom{k}{2} + n^2(k - n)$. Thus, the cost of the multiway cut $C$ can not be more than $\frac{n^2}{2} + n^2(k - n)$. This means that the cut $C$ includes at most $(k - n)$ edges of $E_H$. Because, for example, if it includes $(k - n + 1)$ edges of $E_H$, then the cost of the cut would be $\binom{k}{2} + n^2(k - n + 1)$ which is more than the maximum cost we found here.
**B.2: Each component $C_i$ is connected to at most one host in the cut $C$.** Suppose a component $C_i$ is connected to two different hosts $H_x$ and $H_y$ in the cut. This means that $H_x$ and $H_y$ are connected together in the cut. However, since $H_x$ and $H_y$ belong to the set of terminals, this is impossible. Therefore, $C_i$ is connected to at most one host in the cut.
**B.3: Each component $C_i$ is connected to exactly one host in the cut $C$.** From subcases B.1 and B.2 together, it can be easily understood that each component $C_i$ is connected to exactly one host in the cut $C$. $D(C_i)$ represents the host on which component $C_i$ is mapped.
By using the subcase B.3, cut C’s corresponding deployment configuration $D$ can be made. Suppose $L_D = |\{(C_i, C_j) | D(C_i) \neq D(C_j), \{C_i, C_j\} \in E_{AG}\}|$ represents the cost of the deployment configuration $D$, i.e., the number of channels among the hosts in the deployment configuration $D$. In the following, we prove the correctness of case B:
1) For each terminal $t_i \in T$, find a minimum-cost set of edges $C_{t_i}$ whose removal disconnects $t_i$ from the rest of the terminals
2) Discard cut $C_{t_i}$ whose cost $w(C_{t_i})$ is the heaviest
3) Output the union of the rest, call it $C$.
**Figure 10.** Approximation algorithm for solving the multiway cut problem.
$$MC = n^2(k - n) + |\{(C_i, C_j) | D(C_i) \neq D(C_j), \{C_i, C_j\} \in E_{AG}\}|$$
$$\geq n^2(k - n) + |\{(C_i, C_j) | D(C_i) \neq D(C_j), \{C_i, C_j\} \in E_{AG}\}|$$
$$= n^2(k - n) + L_{D} \geq n^2(k - n) + L_{OPT}$$
Cases A and B together imply that $MC = n^2(k - n) + L_{OPT}$. Therefore, the correctness of Theorem 2 is proved.
In Theorem 2, we showed that the solution of the reliable deployment problem can be found by solving the multiway cut problem in graph theory. However, it is proved that the multiway cut problem is an NP-hard problem when the number of terminals is greater than two. Thus, unless P=NP, it does not have a polynomial time solution [12]. However, it is possible to find many approximation algorithms for the multiway cut problem in literature [12], [13], [14]. One of the well-known and simple approximation algorithms developed by Dahlhaus et al. is provided in Figure 10 [12]. As an example, Figure 11 shows an example of applying this algorithm on the graph presented in Figure 9. As we see in this figure, one of the main problems of these approximation algorithms is that some components may not be assigned to any hosts (e.g., FRS). To solve this problem, after applying the multiway cut approximation algorithm on the graph, we check whether or not all components are assigned to a host. If there are some components which are not assigned to any hosts, we connect those components to one of their candidate hosts for the deployment, and we cut all the application graph edges that are connected to those components. Since, we are actually removing from the multiway cut approximation some heavy edges that connect the components to the hosts, this approach not only will solve the problem, but also will improve the approximation of the multiway cut. Consequently, the result is closer to the optimum solution we are looking for. After applying this improvement on the multiway cut approximation presented in Figure 9, one possible solution for the reliable deployment problem is $\{(FRS \rightarrow H_1), (IFRS \rightarrow H_2), (DFRS \rightarrow H_2), (N_1 \rightarrow H_2), (N_2 \rightarrow H_2)\}$.
**VII. RELATED WORK**
An application can provide its expected functionality only when it is deployed and configured correctly in its...
A commercial operational environment. Consequently, the process of software deployment has been the subject of extensive research in recent years and a variety of commercial as well as research-based tools and techniques for the purpose of software deployment have been introduced. This section provides an overview of these tools and techniques and characterizes them in terms of their support for different activities of the deployment process as introduced in [3]: (i) Release: packages, prepares, and advertises a system for deployment into operating environments; (ii) Acquire: acquires the components of the application from the software producer and puts them in a repository; (iii) Plan: given the specifications of the component-based application, the target environment, and user-defined constraints regarding this deployment, this activity determines where and how different components of the application will be executed in the target environment, resulting in a deployment plan; (iv) Install: uses the deployment plan generated in the previous activity to install the application into its operating environment; (v) Configure: changes the configuration of an already installed software system; (vi) Activate: actually launches the application; (vii) Update: modifies a previously installed system and deploys a new, previously unavailable configuration of that system or updates the components of the system with newer releases of those components; (viii) Deactivate: shuts down executing components of an activated system; (ix) Uninstall: completely removes the software system from its operating environment; and (x) Retire: makes a system release unavailable.
A. Commercial Software Deployment Technologies
A variety of commercial technologies support different activities of the software deployment process. We classify these technologies into six main categories as shown in Table II and characterize them in terms of their support for the activities of the software deployment process. A ‘•’ in Table II illustrates full support, a ‘○’ indicates partial support, and no circle means no support.
User-driven installers are used to install and uninstall software systems from a single machine. Many installers may also support some sort of configuration by which users can add or remove some functionalities from the installed software systems. The limitations of these tools include: they are targeted to a single machine and it is typically impossible to use them for distributed platforms. Also, users themselves have to administer their software systems.
Package managers often come with modern operating systems to assist in installing, uninstalling, and updating software systems. The main goal of all package managers is to install software packages in such a way that the correct dependencies among them are preserved. However, they are also targeted to a single machine and do not support distributed systems or large scale deployments. Additionally, they are also user-driven.
Systems management tools provide a set of capabilities (e.g., tools, procedures, policies, etc.) that enable organizations to more easily support their hardware and software resources. Systems management tools often have a centralized architecture in which the IT administrator performs operations from a centralized location and they are automatically applied to many systems in the organization. Systems management tools support many of the software deployment activities in a distributed environment. However, the issues associated with them are that they are often heavy and complicated systems, they all require reliable networks, they are all based on complete administration control, and they are more suitable for medium to large organizations.
In remote sessions, software systems are deployed to a single server machine. Then, each client initiates a session on that server and invokes desired software systems on it. Therefore, these tools only support the execution activity of the deployment process. The advantages of these tools are that they reduce the inconsistencies in deployed clients when the functionality is extended and it is not required to deploy the same application to several machines. The disadvantages are server load, under-utilized client resources, and consumption of network bandwidth.
In publish/subscribe tools, users express their interests (“subscribe”) in certain kinds of events on a server, such as installing a new application or updating installed applications. Then, whenever these events happen on that server, they will be applied (“publish”) automatically to the subscribed machines. This method is an efficient approach for the distribution of a software system from a source machine to a large number of target machines over a network. Nevertheless, the limitation is that the users themselves have to subscribe for the deployment of applications. Furthermore, these tools might not be efficient in costly and low-bandwidth networks.
Web-based deployment tools try to use the connectivity and popularity characteristics of the Internet during the process of software deployment. In these tools, it is not required to install or update the software system on every
The software architecture research community has also addressed configuration and deployment issues for component-based applications [39], [40], [55], [56], [57]. A software architecture represents high-level abstractions for structure, behavior, and key properties of a software system. Software architectures are usually specified in terms of components that define computational units, connectors that define types of interactions among components, and the configuration that describes the topologies of components and connectors. For this purpose, Architecture Description Languages or ADLs have been developed to describe software systems in terms of their architectural elements. In deployment techniques that employ the concepts of software architecture, ADLs are used to specify valid deployment configurations. Then, during the process of deployment, candidate deployment configurations are checked against those valid deployment configurations.
Model-driven architecture (MDA) [58] is an approach for software development based on models in which systems are built via transformations of models. MDA defines two levels of models: Platform-Independent Model (PIM) and Platform-Specific Model (PSM). Developers begin with creating a PIM which is then transformed step by step to a more platform-specific model until the desired level of specificity is approached. In the case of software deployment, the MDA approach starts with a platform-independent model of the target environment and the transformations finish with specific deployment configurations for the considered component-based applications [42].
Agent-based deployment approaches, like software dock [44] and TACOMA [45], use mobile agents for the purpose of software deployment. A mobile agent is defined as an object that migrates through many hosts in a heterogeneous network, under its own control, to perform tasks using resources of those hosts [59].
Deployment of component-based applications into computational grids has been the subject of extensive research [46], [60], [47], [61], [62], [63], [64]. A computational grid is defined as a set of efficient computing resources that are managed by a middleware that gives transparent access to resources wherever they are located on the network [46]. A computational grid can include many heterogeneous resources (e.g., computational nodes with various architectures and operating systems), networks with different performance properties, storage resources of different sizes, and so on. To take advantage of the computational power of grids, the application
<table>
<thead>
<tr>
<th>Deployment Technology</th>
<th>Representative Tools</th>
<th>Software Deployment Process</th>
</tr>
</thead>
<tbody>
<tr>
<td>User-Driven Installers</td>
<td>InstallShield [15], InstallAnywhere [16], Setup Factory [17], Setup Builder [18]</td>
<td>*</td>
</tr>
<tr>
<td>Package Managers</td>
<td>Linux RPM [19], Fedora yum [20], Debian Dpkg [21], Solaris pkg [22], Gemoo Portage [23]</td>
<td>*</td>
</tr>
<tr>
<td>Systems Management Tools</td>
<td>Microsoft Systems Management Server [24], IBM Tivoli Management Environment [25], Altiris Deployment Solution [26], HP Open-View [27]</td>
<td>*</td>
</tr>
<tr>
<td>Remote Sessions</td>
<td>Citrix [28], PowerTCP [29], Ssh [30]</td>
<td>*</td>
</tr>
<tr>
<td>Publish/Subscribe Tools</td>
<td>Tibco Rendezvous [31], IBM Gryphon [32], Oracle Java Message Service [33]</td>
<td>*</td>
</tr>
<tr>
<td>Web-based Deployment Tools</td>
<td>Java Web Start [34], Microsoft Windows Update [35], Microsoft ClickOnce [36]</td>
<td>*</td>
</tr>
</tbody>
</table>
The software deployment process is defined as a sequence of related activities for placing a developed application into its target environment and making it available for use. However, this process is often challenging for complex component-based applications that should be deployed into a large distributed environment and some QoS parameters should also be maximized. This article presented a graph-based approach for deploying the component-based applications into distributed environments. This approach uses the concept of channels to capture the properties of interconnections among the components of the application. In this approach, component-based applications and distributed environments are modeled with the help of graphs. Deployment of an application is then defined as the mapping of the application graph to the target environment graph. This article also presented the required algorithms for minimizing the cost and maximizing the reliability of a deployment.
VIII. CONCLUSIONS
<table>
<thead>
<tr>
<th>Deployment Approach</th>
<th>Representative Techniques</th>
<th>Software Deployment Process</th>
</tr>
</thead>
<tbody>
<tr>
<td>QoS-Aware Deployment</td>
<td>DeSI [37]</td>
<td>Release Acquire Plan Install Configure Activate Update Restore</td>
</tr>
<tr>
<td></td>
<td>MAX [38]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Caspan [4]</td>
<td></td>
</tr>
<tr>
<td>Architecture-Driven</td>
<td>Prisim-DE [39]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Olan [40]</td>
<td></td>
</tr>
<tr>
<td>Model-Driven</td>
<td>OMG DnC [41]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Deployment Factory [42]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>DASCE [43]</td>
<td></td>
</tr>
<tr>
<td>Agent-based Deployment</td>
<td>Software Dock [44]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>TACOMA [45]</td>
<td></td>
</tr>
<tr>
<td>Grid Deployment</td>
<td>Globus Toolkit [46]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>ORYA [47]</td>
<td></td>
</tr>
<tr>
<td>Hot Deployment</td>
<td>OpenRec [48]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>MagicBeans [49]</td>
<td></td>
</tr>
<tr>
<td>AI Planning-based</td>
<td>Sektori [50]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>CANS [51]</td>
<td></td>
</tr>
<tr>
<td>Formal Frameworks</td>
<td>LTS [52]</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Conceptual [53]</td>
<td></td>
</tr>
</tbody>
</table>
REFERENCES
Abbas Heydarnoori is a post-doctoral fellow at the University of Lugano, Switzerland. His research interests include software deployment, dynamic program analysis, and program comprehension. Abbas received his PhD from the University of Waterloo, Canada. Contact him at abbas.heydarnoori@usi.ch.
Walter Binder is an assistant professor at the University of Lugano, Switzerland. His research interests focus on dynamic program analysis, virtual execution environments, and aspect-oriented programming. Walter holds a PhD from the Vienna University of Technology, Austria. Contact him at walter.binder@usi.ch.
|
{"Source-Url": "http://www.jsoftware.us/vol6/jsw0608-1.pdf", "len_cl100k_base": 13675, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 57329, "total-output-tokens": 17389, "length": "2e13", "weborganizer": {"__label__adult": 0.0002765655517578125, "__label__art_design": 0.0003633499145507813, "__label__crime_law": 0.000255584716796875, "__label__education_jobs": 0.001987457275390625, "__label__entertainment": 8.285045623779297e-05, "__label__fashion_beauty": 0.00012600421905517578, "__label__finance_business": 0.0003082752227783203, "__label__food_dining": 0.0002498626708984375, "__label__games": 0.0006451606750488281, "__label__hardware": 0.0009546279907226562, "__label__health": 0.0003554821014404297, "__label__history": 0.00029659271240234375, "__label__home_hobbies": 9.679794311523438e-05, "__label__industrial": 0.00029397010803222656, "__label__literature": 0.00032401084899902344, "__label__politics": 0.0002067089080810547, "__label__religion": 0.0003440380096435547, "__label__science_tech": 0.03497314453125, "__label__social_life": 9.60230827331543e-05, "__label__software": 0.01189422607421875, "__label__software_dev": 0.94482421875, "__label__sports_fitness": 0.00019860267639160156, "__label__transportation": 0.0004756450653076172, "__label__travel": 0.0002065896987915039}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 68055, 0.02375]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 68055, 0.59445]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 68055, 0.90653]], "google_gemma-3-12b-it_contains_pii": [[0, 4840, false], [4840, 9492, null], [9492, 14459, null], [14459, 20092, null], [20092, 24270, null], [24270, 30127, null], [30127, 35828, null], [35828, 40957, null], [40957, 46281, null], [46281, 51507, null], [51507, 55013, null], [55013, 58382, null], [58382, 61567, null], [61567, 68055, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4840, true], [4840, 9492, null], [9492, 14459, null], [14459, 20092, null], [20092, 24270, null], [24270, 30127, null], [30127, 35828, null], [35828, 40957, null], [40957, 46281, null], [46281, 51507, null], [51507, 55013, null], [55013, 58382, null], [58382, 61567, null], [61567, 68055, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 68055, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 68055, null]], "pdf_page_numbers": [[0, 4840, 1], [4840, 9492, 2], [9492, 14459, 3], [14459, 20092, 4], [20092, 24270, 5], [24270, 30127, 6], [30127, 35828, 7], [35828, 40957, 8], [40957, 46281, 9], [46281, 51507, 10], [51507, 55013, 11], [55013, 58382, 12], [58382, 61567, 13], [61567, 68055, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 68055, 0.12324]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
248c0d78ce9d4e3c506b2301d6c73f28e50e77cf
|
SYSTEM AND METHOD FOR IDENTIFYING AND GENERATING BUSINESS EVENTS
Inventor: Alan Young, Mount Sinai, NY (US)
Assignee: Computer Associates Think, Inc., Islandia, NY (US)
Notice: Subject to any disclaimer, the term of this patent is extended or adjusted under 35 U.S.C. 154(b) by 818 days.
Appl. No.: 10/189,833
Filed: Jul. 5, 2002
Prior Publication Data
Related U.S. Application Data
Provisional application No. 60/303,593, filed on Jul. 5, 2001.
Int. Cl.
G06F 9/46 (2006.01)
U.S. Cl. ....................... 719/318; 705/10; 705/11; 705/12; 705/13; 705/14
Field of Classification Search ............... 709/224, 709/201, 223; 705/7, 9, 10–14, 1, 8, 35; 707/10, 102; 706/12, 46, 52; 719/318, 328
See application file for complete search history.
References Cited
U.S. PATENT DOCUMENTS
5,446,653 A * 8/1995 Miller et al. ................. 705/4
5,521,813 A 5/1996 Fox et al. ....................... 364/401
5,627,886 A 5/1997 Bowman ........................ 379/111
5,873,084 A * 2/1999 Brahe et al. ................. 707/10
5,889,993 A * 3/1999 Kroeger et al. ............... 717/128
6,067,525 A * 5/2000 Johnson et al. .............. 705/10
6,092,102 A 7/2000 Wagner ......................... 709/206
6,131,118 A 10/2000 Stupek et al. ................. 709/223
6,167,448 A 12/2000 Hemphill et al. .............. 709/224
6,199,047 B1* 3/2001 Dimino et al. ............... 705/10
6,327,550 B1* 12/2001 Vinberg et al. ............. 702/186
Primary Examiner—Van H Nguyen
Assistant Examiner—Phuong N. Hoang
Attorney, Agent, or Firm—Baker Botts L.L.P.
ABSTRACT
A system for identifying business events is provided. The system includes a store of business process policies, and a business process manager operative to define and process the business process policies. The system further includes an event manager. The event manager includes at least one rule-based application, at least one predictive application and a store of business events. The event manager is operative to employ the rule-based application and predictive application to identify business events according to the stored business process policies.
15 Claims, 6 Drawing Sheets
U.S. PATENT DOCUMENTS
6,865,562 B2 3/2005 Rainsberger et al. ........... 706/14
7,155,401 B1 12/2006 Cragun et al. .............. 705/10
2002/0038217 A1 * 3/2002 Young ..................... 705/1
2003/0115078 A1 6/2003 Young ....................... 705/1
OTHER PUBLICATIONS
* cited by examiner
Figure 1
CONTEXTUAL VISUALIZATION
- WEB
- COMMAND CONTROL
- PORTAL
- WIRELESS
- OTHER
BUSINESS PROCESS POLICIES
- REACTIVE
- PROACTIVE
- PREDICTIVE
EVENT MANAGER
DATA TRANSLATION SERVICES
NATURAL LANGUAGE PARISING
DATA SOURCES
- BUSINESS APPLICATION
- INTERNET
- APPX
- WEATHER
- TRAFFIC
Figure 1
BUSINESS PROCESS POLICIES
RULE-BASED APPLICATION
PREDICTIVE APPLICATION
BUSINESS EVENTS
DATA SOURCES
Figure 2
Define business process policies controlling identification and responses to business events.
Identify business event(s) based on subscription to single event.
Identify business event(s) based on compound business event definition.
Identify business event(s) based on event-listener application.
Generate object(s) for identified business event(s).
SYSTEM AND METHOD FOR IDENTIFYING AND GENERATING BUSINESS EVENTS
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims priority to U.S. Provisional Application entitled “System and Method for Identifying and Generating Business Events”, Ser. No. 60/305,933, filed Jul. 5, 2001, which is hereby incorporated by reference in its entirety.
TECHNICAL FIELD
The present application generally relates to information and data management systems and methods. More particularly, the present application relates to business management systems and methods for managing and improving business processes and business performance.
BACKGROUND
There is presently a need to provide advanced solutions to the emerging eBusiness paradigm. In the eBusiness paradigm, sources and formats of information/services are of secondary importance compared to the need to leverage such information and services. The goal of eBusiness is to provide solutions that will increase business value to organizations. Increased business value is attained, for example, through leveraging existing IT investments in technology and infrastructure, leveraging business application investments, and maintaining and expanding existing business opportunities with existing and new clients through the intelligent utilization of business data generated by these relationships.
The eBusiness paradigm presents a challenge where the boundaries between the different components and technologies in a business environment have to be either eliminated or made to work together. Furthermore, while trying to succeed in this challenge, IT and business professionals also have to focus their resources on creating an opportunity to implement and execute the strategy that is most suited for their particular business organization.
Current business management systems are typically reactive in nature and utilize an enterprise application integration (EAI) environment, which provides the ability to commonly represent data and identify business events. However, with the increasing diversity of both the business environment and the technology that drives it, IT and business professionals need to feed business critical information to a common computing environment in order to effectively manage their business.
In addition, the present methods and systems for processing business data are not sufficient to enable businesses to take full advantage of the available business information. Specifically, there is not presently a method or system that identifies and generates business events utilizing the disparate available sources of potentially relevant business information. Further, the current methods and systems cannot adequately propagate identified business events to components that are interested in the identified business events. An additional shortcoming of current business methods and systems is the inability to analyze business events from a reactive, proactive and predictive perspective.
SUMMARY
The following presents a simplified summary of methods, systems, and computer readable media associated with identifying and generating business events. This summary is not an extensive overview and is not intended to identify key or critical elements of the methods, systems, and/or media or to delineate the scope of the methods, systems, and media. It conceptually identifies the methods, systems, and media in a simplified form as a prelude to the more detailed description that is presented later.
In accordance with one aspect of the present application, a method is disclosed for identifying business events. The method includes defining a set of business process policies that control identification of at least one business event. The method also includes executing at least one knowledge/rule-based application implementing the business process policies. The method further includes executing at least one predictive application implementing the business process policies.
In accordance with a second aspect of the present application, a system is disclosed for identifying business events. The system includes a store of business process policies, and an event manager. The event manager includes at least one knowledge-based application, at least one predictive application, and a store of business events. The event manager is operative to employ the rule-based application and predictive application to identify business events according to the stored business process policies.
In accordance with another aspect of the present application, an article of manufacture is also disclosed. The article of manufacture includes processing instructions for identifying business events.
Certain illustrative aspects of the methods, systems, and computer readable media are described herein in connection with the following description and the annexed drawings. These aspects are indicative, however, of but a few of the various ways in which the principles of the methods, systems, and media may be employed and thus the examples are intended to include such aspects and equivalents. Other advantages and novel features may become apparent from the following detailed description when considered in conjunction with the drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
For a more complete understanding of the present methods and systems, reference is now made to the following description taken in conjunction with the accompanying drawings in which like reference numbers indicate like features and wherein:
FIG. 1 is a schematic block diagram of an example business event processing environment that may employ example systems and/or methods for processing business events;
FIG. 2 is a schematic block diagram of a portion of the example business event processing environment of FIG. 1 that identifies business events;
FIG. 3 is a flow chart that illustrate an example methodology for identifying business events and generating business notifications;
FIG. 4 is a schematic block diagram of a portion of the example business event processing environment of FIG. 1 that propagates business event notifications to interested components;
FIG. 5 is a diagram illustrating the flow of event data between various components of the example business event processing environment; and
FIG. 6 is a schematic block diagram of a portion of the example business event processing environment of FIG. 1 that integrates three analytical paradigms to analyze business events.
DETAILED DESCRIPTION
Example methods, systems, and computer readable media are now described with reference to the drawings, where like reference numerals are used to refer to like elements throughout. In the following description, for purposes of explanation, numerous specific details are set forth in order to facilitate thoroughly understanding the methods and systems. It may be evident, however, that the methods and systems can be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to simplify the description.
Business Event Processing Environment
Referring to FIG. 1, there is illustrated an example environment 100 in which business events may be processed. Generally, an event may be the identification of a significant happening in a computing environment as determined by business applications or human users. In other words, events may be generated automatically through software programs or manually through the intervention of a human. The event generation services described in this application provide a data and environment diagnostic service to accommodate multiple computing paradigms for information propagation.
Business event processing environment 100 includes a contextual visualization portion 110 that provides a graphical user interface ("GUI") for interacting with a human such as an end user or system administrator. The contextual visualization portion 110 may be embodied as a single simple interface, or it may be embodied as a collection of more complicated interfaces which may be integrated. For example, the contextual visualization portion 110 in the example environment 100 includes a web interface, a command and control console, a portal interface, a wireless interface to communicate with remote users, and it may be expanded to include other interfaces.
The contextual visualization portion 110 enables humans to receive information regarding identified business events and enables humans to provide feedback regarding business events, including defining a store of business process policies 115 that direct the manner in which business events are identified, propagated and analyzed.
In accordance with the present application, business process policies may be defined to employ reactive, proactive and predictive analytical frameworks to identify and respond to business events. Generally, reactive business process policies rely on correlation of data to identify and respond to business events. Proactive business process policies generally identify and respond to business events using inferences, and predictive business process policies typically involve the occurrence of compound events in identifying and responding to business events.
The business process policies within store 115 can be processed by both an event manager 120 and a business process manager 125. The event manager 120 identifies business events in accordance with defined business process policies. In general terms, such identification is accomplished based on a review of information from various data sources 140. In some cases, queries into the data sources 140 and the data received in response, may be altered and/or interpreted by data translation services 130 and/or natural language processing 135 in order to resolve any data formatting or interface differences between the event manager 120 and the individual data source. Typical data sources 140 may include, a business application, Internet data sources, and commercial or proprietary information sources providing weather and traffic data, for example.
Upon identifying an event based on the stored business process policies, event manager 120 generates a record of the event, such as an event object, for example, and notifies the business process manager 125 of the event. Business process manager 125 utilizes the defined business process policies to process a response to the identified business event. As illustrated, in some cases, while processing a response to a business event, business process manager 125 may request additional data from one or more data sources 140.
Business Event Identification
Referring now to FIG. 2, there is provided a more detailed view of an exemplary embodiment of the event manager 120. As shown, event manager 120 includes a store of business events 210, a rule-based application 220 and a predictive application 230. Rule-based application 220 and predictive application 230 reference the store of business process policies 115 and certain data sources 140 to identify business events. Once identified, a record of a business event, embodied as a business event object, for example, is added to the store of business events 210.
The illustrated configuration of event manager 120 enables events to be identified in many different ways. For example, events may be identified according to:
- Subscription to singular events;
- Singular events identified by event listeners; and
- Compound or intelligent events.
Rule-based application 220 may employ an information provider, such as the Advantage™ Integration Server (formerly known as Jasmine,) information provider offered by Computer Associates International, Inc., to enable subscription to singular events. The events are "thrown" or "published" by the information providers as objects in an object-based computing architecture that represent the occurrence of an event. Typically, the information contained within an event object will include particular data related to the occurrence. The nature of the information providers and the nature of the events can vary widely depending on the type of information associated with these sources.
Rule-based application 220 may also employ event listening applications, such as certain components built within an organization's business process management solution, such as the BizWorks e-business process management solution offered by Computer Associates International, Inc., to identify business events by detecting activity associated with a particular business object such as, for example, an account balance, bill of materials or purchase order. The information providers do not need to "throw" an event in order for an event listener to detect the event. Instead, an information provider simply performs a requested action such as, for example, "update account balance" or "generate bill of materials" and the environment services broker the information to components such as the event listener.
Predictive application 230 can utilize various intelligent technologies capable of predicting events either alone or in combination with other solutions to enable identification of compound events. Examples of such intelligent technologies include clustering, neural networks and other pattern recognition technologies. Predictive business process policies can
also identify a business event not necessarily from the occurrence of a single event but, for example, as an aggregation of multiple events that are analyzed and compounded to create other events. For example, a specific event such as “demand for product ABC is likely to increase in the next 30 days” is an event that is a derivation of the occurrence and analysis of previous, discrete events. Similarly, more abstract events such as “Company X in financial trouble” is also an event type supported by this application that leverages the accumulation of both discrete events and application of business policies regarding the definition of what “financial trouble” represents to a particular business. Combining predictive technology with rules-based technology creates intelligent knowledge-based applications that can then become sources for intelligent business events.
An example of neural network technology that may be employed is described by commonly assigned U.S. Pat. No. 6,327,550 entitled “Method and Apparatus for System State Monitoring Using Pattern Recognition and Neural Networks”, issued Dec. 4, 2001, which is incorporated herein in its entirety by reference.
Knowledge of the type of events that can be identified complement and increase the power benefits of this solution. For example, information providers such as business applications, ERP applications, or other typical participants in an EAI-like environment are further complemented by the incorporation of other out-of-band information sources that represent structured and unstructured data. Structured data is data available from information sources in a pre-defined or pre-formatted fashion. This makes it easier and more predictable for parsing purposes. Unstructured data poses a greater challenge, but also provides a greater benefit to the business process policies since it may represent information such as news or other textual information for which advanced technology, such as natural-language-parsing (“NLP”) is suitable.
For example, information such as “according to a news source ACME has just filed for bankruptcy” can be turned into intelligent events that may trigger event management services of any nature (reactive, proactive or predictive) to apply business policies defined to deal with this type of information. Some examples of appropriate business process policies include identifying all outstanding orders by ACME, putting a hold on them, notifying the sales manager, and escalating to the CFO.
FIG. 3 illustrates one example methodology 300 that may be employed to identify business events in accordance with the present application. At block 310 business process policies are defined to control identification of and responses to business events. The defined business process policies are implemented using a rule-based application and/or a predictive application.
The rule-based application processes block 315 to identify one or more business event based on a subscription to a single event. The rule-based application also processes block 320 to identify one or more business events employing an event-listener application.
The predictive application identifies one or more business event based on business process policies employing a compound business event definition as illustrated at block 325. Once the rule-based application or predictive application identifies a business event, the event manager generates a record of the event, such as a business event object, as shown at block 330.
The example system and method illustrate certain aspects of the present application, namely:
1. Using knowledge-based or rules-based applications that implement business process policies.
2. Using predictive applications that implement business process policies.
3. Using a combination of rules-based and predictive applications.
These combinations of technologies provide a way to detect situations and patterns using inference, correlation, and pattern prediction technology, as needed, to create new business events that need analysis and management. The data that these methods operate on can come from information management platform, such as the Advantage Integration Server information management platform. The data can also be the result of a continuous circle of executing business policies, workflow engines, or the data can be downloaded from relevant business information sources including, for example, global computer networks, such as Internet, B2B, B2C, WAN, LAN, batch, or human operator.
There are additional data sources that may be relied upon to identify (or detect) business events. For example, a user could employ out-of-band or discrete and seemingly unrelated information that may be structured or non-structured. Examples of such sources include weather, traffic and/or news sources. Data from such sources can be processed and analyzed using natural-language-parsing services 335, or the data can be processed through transformation methodologies capable of probing for or requesting additional information. Examples of information requests include: “What is the current temperature in Moscow, Russia?” or ‘Are there any major traffic alerts along the southeastern US?” or ‘Are any of our clients likely to file for bankruptcy?’
Upon identification, event generation services would be used to propagate the information appropriately, in whatever format is needed. Data translation could be provided by data transformation and translation service 330.
Business Event Generation
Referring now to FIG. 4, there is illustrated a more detailed view of contextual visualization portion 110, event manager 120, and business process manager 125. Further illustrated are exemplary data, formats, and communication protocols which may be employed among components within the business processing environment 100. FIG. 4 illustrates the architecture of the event generation and notification services, an exemplary event publishing and subscription infrastructure, as well as a Java-based servlet that provides a CI and API interfaces. The event generation’s services can be invoked as a URL, a software program library (using, for example, Java), a triggered or scheduled response to another event (using, for example, a CI), or as a pre-defined rules-based and/or neural-based library or other predictive technology.
The architecture augments an integrated data analysis and management system by providing an event services that employ a “publish and subscribe” information-sharing paradigm. Under this paradigm, the system provides the ability for an integrated or developed application, component, client, or any other form of software application using the system services to register themselves as event sources. Similarly, any client application, component or client can register or subscribe as clients or as interested on certain events emanating from event sources. This subscription capability is realized through the definition of data channels that may represent particular types of events and may also include many different Event Sources.
As previously mentioned with reference to FIGS. 2 and 3, business events can be created through different methods both within and outside the common environment. Business events can be created through applications built using publish and subscribe services from the common environment to provide
notification on any object transactions such as delete, modify, or add an object or class. These objects can represent any type of business and/or non-business data including, for example, data relating to supply chains, financials, banking, weather, traffic, bankruptcy, mergers and/or acquisitions, or any other type of information that can be represented as an object as defined by common software terms dealing with object-based computer architectures and environments.
Business events can also be created through an application utilizing the CLI and API-based services for message generation that are part of the event management services. The message generation and delivery services provide a robust, guaranteed delivery infrastructure.
Further, business events can be created through the execution and application of business process policies, as previously defined, that in turn may consume other business events and related information in order to determine the need for generation of an event. This provides a full operating circle where hierarchies of related events can be generated and managed, as appropriate.
The propagation and generation of events is accomplished using a web-based paradigm that supports different types of data formats representing the event. These types include:
Objects representing the event created in an object-based computing architecture and environment. Class, property, and object specification can be customized to suit a particular purpose.
Text-based, formatted messages using pre-defined and definable XML schema to be delivered to the event management services.
Text- or object-based representing triggers for workflow engines involved in the business process management. Triggers can assume any form including formatted text messages, XML, and objects.
Any other form of data to suit the particular needs of the business process policy that may deal with the event.
One benefit of using a web-based approach for the propagation and generation of events is that it enables a single, non-proprietary protocol and platform support. Another benefit is the ability to span LAN, WAN, or global networks, such as the Internet, in a common, supported platform while adhering to standard security approaches including proxies and firewalls.
As shown in FIG. 4, the services may be based on a publish/subscribe paradigm and support event queuing services. The architecture includes predefined event sources, and, for example, through the use of an XML API, can be extended to support other internal, as well as external, event sources. Any application or program can register with the notification services (publish/subscribe) engine via the API. After registering with the system, the application can publish events into the common environment where they become available to any event subscriber. An integrated notification services engine of the publish/subscribe engine manages the events received. The events are placed on one or more persistent queues. One or more notification dispatchers process the events and deliver them to the subscribers as necessary. The notification services engine may also include queuing services. The queuing services provide support for post-generation processing of events on a point-to-point basis. For example, an application that runs at specific intervals can wake up and process a dedicated queue containing all the events for which it subscribed.
Event subscribers can query the system for available event sources and can subscribe to any number of them. When subscribing to events, the subscriber specifies information such as the format in which they want to receive the event, the delivery method, whether there is a need to create a dedicated queue, etc. For example, an application can subscribe to weather events and request that the message be delivered as XML posted to the event console. It could also request that the same notification take the form of a Java serialized object delivered through an API callback. The available event formats and delivery methods can be specified when configuring the system. The system supports plug-in notification/delivery modules and thus provides a way to extend the delivery capabilities of the system.
The event listener publisher is one of the data sources delivered with the system. The event listener publisher exposes, for example Advantage Integration Server events to the common environment so that they can be delivered to any subscriber. The publisher can be configured via GUI, CLI and API. Preferably, this configuration is always persistent. It can also be configured to generate additional events on-demand by any application during subscription (XML). By default, on-demand configuration of the Event Listener Publisher is transient. That is, the additional requested events are only valid while the system is up.
The event listener publisher can expose any events proceeding from within Jasmine. This includes class, object, and property events as generated by the connected data sources. As a data source, the event listener publisher, through the notification services, can deliver Jasmine notifications to any application subscribed to it.
Referring now to FIG. 5, there is illustrated the data flow of events being generated from various sources. Events are generated using the event generation API. The API consists of various libraries supporting a variety of languages. Examples of the supported languages which may be included are Java, C, and Aion, a proprietary language offered by Computer Associates International, Inc. There is also a CLI interface, which allows for a solution without the need to write any additional code. In one embodiment, the services are implemented using servlets. It is also possible to use get and post requests from HTTP, ASP, or JSP pages to generate an event. All events should be generated in the common environment.
When a request to generate an event is submitted either by CLI or through an API call, the request is sent to the event generation servlet using an XML message format. The event generation servlet receives the request and generates the appropriate event within the common environment.
According to the example architecture, the interaction between the various event generation methods is through HTTP Get or Post requests. The event data is sent to the event generation service in XML. The event generation service validates the event, generates the event in XML format in the common environment and sends a response back in XML format. The API's and CLI's interpret the result from the response XML. If using web access methods, then the result is returned in XML. It is up to the program or page to determine if the operation was successful or not.
Event generation is handled by the event generation service. The service may be implemented as a Java servlet. When a request to generate an event is received, the event generation service creates an event object and/or create a Unicenter TNG or other enterprise management module.
Business Event Propagation
Once the event is generated in the common environment, the event is available to any program or process, which subscribed to the event or the to the general class of events that the particular event belongs to. During event subscription, a subscriber can specify how the event should be propagated to it. That is, the subscriber requests a supported delivery method.
For instance, an application can subscribe to data source 'A' and request that events be delivered to it via an HTTP connection, email, a wireless message, API callback or other method. The example architecture includes support for a wide set of delivery methods. These include XML messages, HTTP connection, Java interfaces, email, wireless, etc. The system is extensible by using Java interfaces that describe the requirements for an event delivery module. Any program implementing the interface can provide additional methods of delivery.
Business Event Analysis
The present application provides information and data management systems and methods that are capable of operating in any combination of reactive, proactive and predictive paradigms. The architecture of the present system enables these paradigms to be deployed in association with existing EAI environments. These different paradigms (reactive, proactive, predictive) represent the different capabilities provided by the system components, including event management services for generating multi-form messages into central repositories of information.
A reactive paradigm represents a management approach where events are dealt with as exceptions and upon occurrence. That is, the event is identified before an appropriate business process policy is applied.
A proactive paradigm represents an approach where an intelligent integrated or stand-alone application (usually knowledge-based or rules-based applications) can consume and process (correlate and/or infer) information to determine a course of action that may include the generation of events or the enforcement of previously defined policies such as, for example, a workflow, a notification or a record update.
A predictive paradigm represents an approach where an intelligent integrated or stand-alone application may consume and process information (analyzing patterns and relationships) that may conclude in the generation of events or predictions regarding possible events or situations that may arise. In a similar fashion, as the proactive paradigm, this event generation may trigger the application of any business process intended to deal with the business event.
In addition, the systems and methods according to the present application provide the ability to extend pure EAI environments or pure event management environments into a single seamless computing environment where all related and necessary components needed to deal with a particular business event are orchestrated together in such a way that no individual component needs to be aware of more information than necessary within its own native capabilities.
Further the present application provides an intelligent management methodology for responding to existing and future events. For example, in the business context, the intelligent management methodology for business events would be any combination of reactive, proactive, and predictive business process policies using inference, correlation, and rule-based and predictive technologies. This methodology also provides for the business process policies to reach out and gather more information, as appropriate, that is fed to a common computing environment by information providers via wrappers, business policies, workflow engines, and business events.
Referring now to FIG. 6, a schematic block diagram is presented depicting the operation of reactive, proactive and predictive business process policies within the business processing environment 100. As shown, the exemplary system includes reactive, proactive and predictive business process policies maintained within store 115. Each type of business process policy may be operative to initiate a response process associated with a business event.
Each of the different types of business process policies 610, 620 and 630 receive a notification of a relevant event from event delivery module 640. In some cases, such as with the illustrated proactive 620 and predictive 630 business process policies, additional information may be requested in order to process a response.
In reactive management paradigm, an event acts as a trigger for some management action that may need to be engaged. This management action can in turn be any type of finite or infinite sequence of steps. Accordingly, upon receiving an event notification from event delivery module 640, reactive business process policy 610 may respond, for example, by sending an e-mail message, updating a database or triggering a workflow process.
In a proactive management paradigm, an intelligent entity such as, but not limited to, a business process policy is continually consuming information and applying analysis methods without depending on the occurrence of a trigger event. If and when necessary, a proactive entity may engage the reactive or predictive paradigms to either trigger a sequence of actions (reactive) or perhaps consult and leverage additional analysis capabilities (predictive). Note that proactive entities may also be triggered and set off by the occurrence of an event. Upon receiving a triggering event notification from event delivery module 640, proactive business process policy 620 may respond, for example, by correlating data, drawing an inference or triggering a knowledge-based application.
A predictive paradigm is one where entity of more advanced intelligence than the proactive or reactive types is also consuming information or events. Similarly to the proactive paradigm, if and when necessary, the predictive paradigm may engage the reactive or proactive counterparts which will then have leveraged higher intelligence in order to perform their functions. Predictive business process policy 630 may from time to time employ pattern analysis, employ neural network or neural agents while processing business events.
As shown, any type of business process policy may generate a consultation trigger for another business process policy when processing and/or analyzing business events.
The system of FIG. 6 enables a management methodology that aggregates three different, and individually powerful, management paradigms. These reactive, proactive, and predictive paradigms are not mutually exclusive and can leverage power from each other to provide a capability that is not presently known. Accordingly, the present application provides any level of event management power necessary to deal with information.
For example, reactive management may be used as the initial trigger to a proactive or predictive process based on the occurrence of a single business event. Alternately, a proactive or predictive process may trigger a reactive process by generating a single business event which is the result of complex correlations and pattern analysis processes to arrive to a finite set of events that must be managed.
In this methodology, the collaboration and communication process is flexible to accommodate any type of management capability needed by a particular event or generated information that triggers the management services.
FIG. 6 illustrates that the three paradigms are engaged and integrated to collaborate. A business event can reach the management layer represented by the paradigm integration in different ways, as shown. For example, events can be derived from any data, event, services, or information sources.
Once an event is delivered, it may trigger any collaboration sequence (or multiple independent sequences) as defined by certain business process embodied in the individual or aggregated paradigms. That is, business process policies may, simultaneously or sequentially, trigger reactive, proactive, or predictive management process or any combination, of any length, between the three.
For example, detection and prevention of bank transaction fraud could be implemented as a collaboration of the three paradigms. An event representing a check deposit may be detected and forwarded to the reactive layer. The reactive layer may then communicate with the proactive components that in turn will consume additional information to determine whether this transaction may be a fraud risk. Different paradigms such as knowledge-based or rule-based approach may be used to apply heuristics to identify transaction patterns. If indeed, the proactive component is able to determine a pattern of fraud, it may return to the reactive layer in the form of a fraud alert event. However, if the proactive layer does not identify a fraud pattern, it may consult the predictive layer, which may in turn indeed find a fraud pattern that was not discernable to the proactive layer.
It should be noted that this embodiment of collaboration is just one example of how the paradigms may collaborate. A different management approach to the same event (check deposit) may choose to engage the three paradigms at the same time or allow the proactive or predictive paradigms to be continually consuming and revisiting deposit information through the day instead of on just every occurrence.
What has been described above includes several examples. It is, of course, not possible to describe every conceivable combination of components or methodologies for purposes of describing the systems, methods, and computer readable media associated with business process policy data. However, one of ordinary skill in the art may recognize that further combinations and permutations are possible. Accordingly, this application is intended to embrace such alterations, modifications, and variations that fall within the scope of the appended claims. Furthermore, to the extent that the term “includes” is employed in the detailed description or the claims, such term is intended to be inclusive in a manner similar to the term “comprising” as that term is interpreted when employed as a transitional word in a claim.
What is claimed is:
1. A computer-implemented method of identifying business events, comprising:
defining a plurality of reactive, proactive, and predictive business process policies for use in identifying one or more business events;
storing the one or more business process policies in a business process policy database;
registering a plurality of information providers as event sources;
receiving event-related and nonevent-related information from the event sources; and
identifying one or more business events from the event-related and nonevent-related information using an event manager comprising a rule-based application that employs one or more of the plurality of information providers to enable subscription to singular events and a predictive application that employs one or more pattern recognition technologies that access and implement the one or more business process policies stored in the business process policy database.
2. A computer-implemented method of identifying business events, comprising:
defining a plurality of reactive, proactive, and predictive business process policies for use in identifying one or more business events;
storing the one or more business process policies in a business process policy database;
receiving event-related and nonevent-related information from the event sources; and
identifying one or more business events from the event-related and nonevent-related information using an event manager comprising a rule-based application that employs one or more of the plurality of information providers to enable subscription to singular events and a predictive application that employs one or more pattern recognition technologies, the rule-based application and the predictive application operable to:
access and implement the one or more business process policies stored in the business process policy database; and
identify one or more business events from the event-related and nonevent-related information.
11. The system of claim 10, wherein the rule-based application employs an event listening application to detect activity associated with one or more business objects.
12. The system of claim 10, wherein the event manager further comprises a business event database operable to record the one or more identified business events.
13. The system of claim 10, wherein the business process policies comprise reactive, proactive, and predictive business process policies.
14. A computer-implemented method of identifying business events, comprising:
defining a plurality of reactive, proactive, and predictive business process policies for use in identifying one or more business events;
storing the one or more business process policies in a business process policy database;
registering a plurality of information providers as event sources;
receiving event-related and nonevent-related information from the event sources;
identifying one or more business events from the event-related and nonevent-related information using an event manager to access and implement the one or more business process policies stored in the business process policy database, the event manager comprising a rule-based application and a predictive application;
recording the one or more business events identified by the event manager in a business event database;
wherein the predictive application employs one or more pattern recognition technologies; and
wherein the rule-based application employs an event listening application to detect activity associated with one or more business objects and an information provider to enable subscription to singular events.
15. A system for identifying business events, comprising:
a processor operable to execute a business process manager, the business process manager operable to:
define a plurality of reactive, proactive, and predictive business process policies for use in identifying business events;
register a plurality of information providers as event sources;
receive event-related and nonevent-related information from the event sources;
a business process policy database coupled to the processor and operable to store the one or more business process policies;
wherein the processor is further operable to execute an event manager, the event manager operable to access and implement the one or more business process policies stored in the business process policy database and identify one or more business events from the event-related and nonevent-related information, the event manager comprising a rule-based application, a predictive application, and a business event database operable to record the one or more identified business events;
wherein the predictive application is operable to employ one or more pattern recognition technologies; and
wherein the rule-based application is operable to employ an event listening application to detect activity associated with one or more business objects and an information provider to enable subscription to singular events.
* * * * *
|
{"Source-Url": "https://patentimages.storage.googleapis.com/85/9e/13/0070cdc9fadd91/US7421704.pdf", "len_cl100k_base": 8537, "olmocr-version": "0.1.53", "pdf-total-pages": 15, "total-fallback-pages": 0, "total-input-tokens": 19869, "total-output-tokens": 10450, "length": "2e13", "weborganizer": {"__label__adult": 0.0006914138793945312, "__label__art_design": 0.0017242431640625, "__label__crime_law": 0.004108428955078125, "__label__education_jobs": 0.0026092529296875, "__label__entertainment": 0.0003235340118408203, "__label__fashion_beauty": 0.00037932395935058594, "__label__finance_business": 0.09765625, "__label__food_dining": 0.0005979537963867188, "__label__games": 0.001781463623046875, "__label__hardware": 0.004558563232421875, "__label__health": 0.0007219314575195312, "__label__history": 0.0005993843078613281, "__label__home_hobbies": 0.0002808570861816406, "__label__industrial": 0.002960205078125, "__label__literature": 0.0006074905395507812, "__label__politics": 0.0008153915405273438, "__label__religion": 0.0004818439483642578, "__label__science_tech": 0.1162109375, "__label__social_life": 0.00010758638381958008, "__label__software": 0.277587890625, "__label__software_dev": 0.4833984375, "__label__sports_fitness": 0.00025773048400878906, "__label__transportation": 0.0011625289916992188, "__label__travel": 0.0003523826599121094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48323, 0.06174]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48323, 0.19167]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48323, 0.91945]], "google_gemma-3-12b-it_contains_pii": [[0, 2660, false], [2660, 4497, null], [4497, 4804, null], [4804, 4919, null], [4919, 5272, null], [5272, 5272, null], [5272, 5272, null], [5272, 5272, null], [5272, 11408, null], [11408, 18624, null], [18624, 26015, null], [26015, 33467, null], [33467, 40823, null], [40823, 45091, null], [45091, 48323, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2660, true], [2660, 4497, null], [4497, 4804, null], [4804, 4919, null], [4919, 5272, null], [5272, 5272, null], [5272, 5272, null], [5272, 5272, null], [5272, 11408, null], [11408, 18624, null], [18624, 26015, null], [26015, 33467, null], [33467, 40823, null], [40823, 45091, null], [45091, 48323, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48323, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48323, null]], "pdf_page_numbers": [[0, 2660, 1], [2660, 4497, 2], [4497, 4804, 3], [4804, 4919, 4], [4919, 5272, 5], [5272, 5272, 6], [5272, 5272, 7], [5272, 5272, 8], [5272, 11408, 9], [11408, 18624, 10], [18624, 26015, 11], [26015, 33467, 12], [33467, 40823, 13], [40823, 45091, 14], [45091, 48323, 15]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48323, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
4032476f33ce9fb66850dee1a78ab5dd2864d1d5
|
University of Applied Sciences Ulm
Department of Computer Science
Master Course Information Systems
Collaborative Work on Distributed Models
Master Thesis
by
Ángel López Moya
Advisor: Prof. Dr. Christian Schlegel
Project-Advisor: Alex Lotz
Declaration of Originality
I hereby declare that this thesis is entirely the result of my own work except where otherwise indicated. I have only used the resources given in the list of references.
Ulm, den 20. Jun 2013
Ángel López Moya
Abstract
The collaborative work on distributed models is a big challenge in the robotic industry. To fragment the system into smaller components ease the software development because every agent can be specialized in a specific part, but the collaborative work of the different agents in the complete system present challenges such as to ensure consistency. A technology that provides support to establish remote repositories and the functionalities to work with them ensuring consistency and security is needed. The first goal of this thesis is to analyze the main challenges that occur in this kind of system. The next goal then is to choose which of the main tools that allow to work on remote repositories can cover these necessities and to show what approach can be followed to cover the different features with the chosen technology. In the end, the previous analysis is discussed to show which level of completion is reached.
I want to start by thanking everyone who directly or indirectly contributed to this work in some way or another.
First of all, I want to thank my project-advisor Alex Lotz who supported me along this thesis. He gives me lot of advices about how to focus on the work and he was very patient helping me with the document, giving me feedback and showing me other ways to improve the work.
I also want to thank everyone who work in ZAFH Servicerobotic Laboratory, specially to Matthias Lutz and Dennis Stampfer who accompanied my stay in Germany. Although I did not work with them directly, it was very interesting for me to see all the work that they made there.
I can not forget Christian Schlegel. He gave me the opportunity to make my thesis in his laboratory. In addition, he always kept me informed about the overall work that they were working on. It was interesting to learn the difficulties and challenges that a researching group has to face everyday.
Special thanks goes to Juanfran Ingles Romero who gives me his support from Cartagena and to Cristina Vicente-Chicote, without her I would not have chosen to come to Ulm.
Finally, my thanks to my family who always supported me during my studies and made it possible to I finish my master thesis in Ulm.
# Contents
1 Introduction .................................................. 1
1.1 Motivation ................................................. 1
1.2 Examples of Use ........................................... 1
1.3 Challenges .................................................. 2
1.4 Organization and Approach of this Thesis ..................... 3
2 Related Work .................................................. 5
2.1 Model-Driven Engineering (MDE) ............................ 5
2.1.1 Basic Concepts ....................................... 5
2.1.2 Eclipse Modeling Project (EMP) ......................... 7
2.1.3 Abstract Syntax of a Language with EMF ............... 8
2.2 Eclipse Modeling Framework Store (EMF Store) ............... 11
2.3 Connected Data Objects (CDO) ............................. 12
2.3.1 Functionality .......................................... 13
2.3.2 Architecture ........................................... 14
2.4 Comparative between CDO and EMF Store ..................... 15
3 The Robotics Case Study ....................................... 17
3.1 Introduction ............................................... 17
3.2 Use-cases .................................................. 20
4 Method .......................................................... 25
4.1 Analysis .................................................... 25
4.1.1 Features ............................................... 25
4.1.2 Requirements ........................................... 26
4.2 CDO Server .................................................. 27
4.2.1 Server Configuration ..................................... 27
4.2.2 Issues with the Server Connection ....................... 29
4.2.3 Integration of CDO with Other Tools ..................... 30
4.3 Administrator Role .......................................... 30
4.3.1 Security Management ..................................... 30
4.3.2 Repository Management ................................... 32
4.4 Designer Role ................................................ 33
Chapter 1
Introduction
Software complexity, particularly in robotics, is still the main barrier to introduce a successful robot market. Many companies develop robotic systems from scratch. Although, many algorithms are available, it is challenging to integrate them into a consistent system. One approach to cope with this problem is to use Component Based Software Engineering (CBSE). Thereby a system is fragmented into software parts of manageable complexity, according to their individual concerns. To be able to collaboratively work on components in different companies, which are specialized on particular domains (like navigation, human-robot-interaction, etc.), it is necessary to explicate relevant component properties in a consistent way. Model Driving Engineering (MDE) provides the means and tools for this purpose. However, it is still challenging to distribute the models, while ensuring consistency.
1.1 Motivation
Nowadays models are presented in the entire lifecycle of software engineering projects. Not only as an abstraction to software design but also for code generation. With this popular use of model-driven development in industry, the collaboration of multiples companies is an important necessity. The main goal of this thesis is to enable collaborative work on distributed model repositories with special focus on the robotic domain. Thus it is necessary to evaluate which requirements are needed (e.g. need for merging, conflict detection, versioning, etc.) and analyze different tools or projects which allow to work on distributed model repositories and then to choose the fittest one.
1.2 Examples of Use
This section shows some generic use-cases to demonstrate common situations with the purpose to show the challenges that have to be solved.
To explain this, it is better to imagine a big software which is being developed by several companies. Every company is in charge of a different parts of this software. All the companies use a standard way to define the structures, interfaces, etc. so the different pieces can fit together.
Each of these companies has to modify parts of the software and also needs access to other parts. For example, one company is a database expert and is responsible to create the database. Another company is the application domain expert and needs to modify some parts of the database to adapt it to the domain needs.
It is evident that there are different roles involved in the creation of the overall system. It has to be also some administrator who manage the infrastructure of the system. For example there are users who just need read access to some (or all) parts. Another users will need access right to write or modify specific parts of the model and all of this has to be managed.

Figure 1.1 shows the general idea for the previous example. The example shows one model server and different companies connected to it. Each company works in different parts and they make different actions in the system. In addition there is an administrator who will manage the features in the server.
### 1.3 Challenges
In order to cover the examples presented in the previous section, and having in mind the figure 1.1 the following challenges need to be addressed.
1.4. ORGANIZATION AND APPROACH OF THIS THESIS
- From the example, when a company wants to modify some parts of the software, it should be possible to restrict the access to only registered users from this company. Another feature is to have some kind of user interface to be able to work with the software. One of the challenges is to manage the way how different companies can save changes in the server as well as to control what kind of users can access to these models. In a company for example there are different departments and it is needed to have rights or permissions for access, modification, etc.
In this example, it is also evident that to achieve consistency some mechanism is required to avoid that various users could modify parts of the software at the same time and create a conflict (e.g. in figure 1.1 the Company A and B can modify the same part and it will provoke inconsistency). In addition, it would be necessary to have some kind of notification system, to advice the other users or companies that one specific part of the software is being modified at the moment.
- In the example, an interesting feature is to make references to parts of the software which is stored in a remote repository. The system has to support these remote references and to notify the changes in these parts to the users (e.g. in figure 1.1 Company C is referencing some part of the software in the server to extend new capabilities).
- As it has been commented in the example, it will be necessary to have an administrator who will be able to change passwords, access rights and other necessary actions for the server side. It is necessary to have an interface to manage all this features in an easy way.
1.4 Organization and Approach of this Thesis
The next chapters of this thesis are organized as follows:
1. **Chapter 2**, there will be an introduction to Model-Driven Engineering, to explain the basic concepts of this software development methodology. In addition the chapter will analyze two different Eclipse Tools which allow collaborative work on distributed model repositories. The last part will show a comparison between this two tools and to choose the most fitting for our case.
2. **Chapter 3** will analyze the specific case of communication objects.
3. **Chapter 4** will analyze specific the features and requirements to be solved. After that, with the chosen tool, the chapter will show how this tool can cover the requirements and to provide solutions for the missing features.
4. **Chapter 5** will summarize to what extent the objective of this thesis has been solved.
5. **Chapter 6** will show some conclusions and what are the next steps to improve the collaborative work on distributed model repositories.
CHAPTER 1. INTRODUCTION
Chapter 2
Related Work
The focus of this thesis is on the collaborative work on distributed model repositories. This chapter will introduce the basic knowledge about Model-Driven Engineering, an analysis of two Eclipse Tools which allow collaborative work on distributed model repositories and a comparative analysis between these two tools.
2.1 Model-Driven Engineering (MDE)
Model-Driven Engineering [Sch06] (MDE) is a software development methodology which is focused on increasing the level of abstraction and automation in program development. The approach is to simplify the design process, encouraging the collaboration between different teams or departments. Thereby the most effort goes to develop a concrete domain model that afterwards will produce working software. That will be possible with model to model transformations (M2M) and model to text transformations (M2T).
2.1.1 Basic Concepts
The model-driven software development (MDSD) [Gro09] comprise a set of tools and technologies which allow first to develop a specific model language to help on the design of whatever kind of systems and afterwards to use a set of automatic transformations to obtain a final code for the applications. MDSD works around the definition, the use of models and transformations along the entire life-cycle of software development.
A model is a representation of reality. A model represents structures, behaviours and features. A system can be built with one or more models which will represent different aspects of the system in different levels of abstraction. So it is possible to create analysis models, design models and models very close to the development platform. The high level models can evolve to low level models with M2M transformations until the model is enough detailed to be able to generate code with a M2T transformation. Thereby, the model or set of models which represent the system together with M2M and M2T transformations allow to automate the process of software development. It is noteworthy that the generation of the entire system is in many cases not
feasible and even not necessary. Instead it is more important to create models with the right abstraction level such that these models can be easily understood by corresponding designers.
Model languages define the syntax for models. Meta-models define the abstract syntax of model languages. They gather the concepts (words of the language) and rules that tell how to combine different concepts in order to create valid models. Figure 2.1 shows how a meta-meta-model allows to define a language that at the same time allows to define other languages. To avoid accumulation of too much “meta”, the same metalanguage defines itself on this level in a reflexive way. The pyramid of the figure 2.1 belongs to standard MOF (MetaObject Facility Specification)[mof05] of OMG (Object Management Group)[omg03].
Nowadays MDE is a paradigm of software development with a lot of popularity in the software engineering field. The recent popularity of this perspective in the last years has been pushed by OMG and their initiative MDA (Model-Driven Architecture)[omg03] and the release of tools which support this approach, this allows to exploit all the potential of MDE.
Some of the tools that nowadays support MDE are: DSL Tools (Microsoft)\(^2\), Meta-Edit\(^3\) (Meta-Case) and Eclipse\(^4\). The latter is an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the life-cycle. Furthermore Eclipse is a not-profit organization tool. In last years, Eclipse has become a de facto standard because it supports the main technologies from OMG.
---
\(^1\)MOF: Meta Object Facility (MOF) Specification Version 1.4.1
\(^2\)DSL Tools(Microsoft), currently Visual Studio Visualization and Modeling SDK: [http://archive.msdn.microsoft.com/vsvmsdk](http://archive.msdn.microsoft.com/vsvmsdk)
\(^3\)Meta-Edit+: [http://www.metacase.com/products.html](http://www.metacase.com/products.html)
2.1. MODEL-DRIVEN ENGINEERING (MDE)
2.1.2 Eclipse Modeling Project (EMP)
Eclipse Modeling Project is mainly a group of tools related to modeling and Model Driven Software Development (MDSD) [Gro09]. The purpose of creating this collection of tools is to coordinate MDSD technologies within Eclipse. The EMP is organized in projects which have to face the following capabilities: abstract syntax development, concrete syntax development, model-to-model transformation, and model-to-text transformation.
Figure 2.2 shows the structure of the EMP and also the features of the platform with Eclipse Modeling Framework (EMF) [FB03] as the core. The main purpose of EMF is to support abstract syntax development. The next layer, EMF Query, Validation and Transformation provides the management of model instances. Around these components are the model transformation technologies (M2M and M2T). In the last layer there are tools for concrete syntax development, GMF (Graphic Modeling Framework) for graphic model representation and TMF (Textual Modeling Framework) for textual model representation. Finally there are some elements orbiting around the core. These elements are projects which are focused on extending the capabilities of the platform.
Figure 2.2: Eclipse Modeling Project [Gro09]
---
5 Graphic Modeling Framework: http://www.eclipse.org/modeling/gmp/
6 Textual Modeling Framework: http://www.eclipse.org/modeling/tmf/
2.1.3 Abstract Syntax of a Language with EMF
This subsection describes the basics on developing the abstract syntax of a DSL (Domain Specific Language) using the EMF framework (e.g. remember that EMF is the core of MDSD in Eclipse). This process covers from the creation of the meta-model to the generation of its supporting code in Java.
EMF is a modeling framework which allows to generate code to build tools and model based applications. EMF unifies Java, XML and UML\[uml11\]. Imagine for example that an application to manage a specific structure of XML messages is needed. The process would be to create a UML diagram from the initial schema, to develop a set of Java classes to manipulate the XML implementation and finally to generate an editor to use these messages. All this is possible with EMF. In addition, the EMF model can be defined using any of these tools independent of the others.
Next, the main features of EMF are described.
![Figure 2.3: EMF unifies Java, XML and UML [FB03]](image)
1. **Ecore meta-model**
As a meta-model defines the abstract syntax of a language, providing the concepts of the language and the relationships between them, in EMF, meta-models are specified in terms of a simplified version of MOF (e.g. the meta-meta-model, see figure 2.1) called Ecore.
Figure 2.3 shows a diagram that defines the main parts to describe an Ecore model. These parts are:
- **EPackage**: Represents the package which contains the elements of the model (e.g. “box-arrow” in figure 2.4).
2.1. MODEL-DRIVEN ENGINEERING (MDE)
- **EClass**: Represents the modeled class. It has a name, zero or more attributes and zero or more interfaces (e.g. “Root”, “Box”, “Arrow” in figure 2.4).
- **EAttribute**: Represents the relationship between modeled attributes. Each attribute has a name and a type (e.g. the attribute “name” of the class “Box” in figure 2.4).
- **EReference**: Represents the relationship between classes. A reference has a name, a boolean flag to indicate if it is a container relation and a reference (target) to other class (e.g. attribute “target” of class “Arrow” in figure 2.4).
- **EDataType**: Represents the data type. A data type can be a primitive type such as: integer, float, etc. or an object like java.util.Date type.
2. Creating a meta-model

EMF allows creating a meta-model in several ways. First, one can use the EMF tree editor to manage the different elements of the meta-model (e.g. to insert a new EClass) and the properties view to configure their features (e.g. to name the new EClass). Moreover, EMF also provides the Ecore diagram editor to define meta-models graphically. Apart from editors, it is possible to specify a meta-model by importing a UML2 model or by annotating Java classes, such that, a user class may identify an EClass of the meta-model. Normally, the meta-model is saved in a file with extension *.ecore. This file can be opened with a text editor to show its XMI (XML Metadata Interchange) serialization (e.g., see Listing 2.1).
Following, we show an example of how to create a meta-model using the EMF tree editor. We use a primitive form of component model, thus, after generating the language infrastructure with EMF, users will be able to represent (in a tree editor) a set of named boxes interconnected with arrows. As shown in Figure 2.4, the meta-model has two main classes (EClass): "Box" and "Arrow". Each one with an attribute (EAttribute): "name".
In addition, Arrow has two references (EReference): "source" and "target", which allow connecting boxes. It is worth highlighting that we have included a base class, "Root", to contain the rest of the elements. As consequence of the serialization process in EMF, which is driven by containment relationships, there should be a (direct or indirect) containment between every EClass of the meta-model and the one rooting. Figure 2.5 shows the meta-model designed for the example in the Ecore diagram editor. Note that its appearance is similar to UML class diagrams.
Figure 2.5: Abstract syntax in the ecore diagram editor
Listing 2.1 shows the Ecore model represented as XMI code.
```xml
<?xml version="1.0" encoding="UTF-8"?>
xmns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmns:.ecore="http://www.eclipse.org/emf/2002/Ecore" name="box-arrow">
<eClassifiers xsi:type="ecore:EClass" name="Root">
<eStructuralFeatures xsi:type="ecore:EReference" name="boxes" upperBound="-1"
eType="#//Box" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Box">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Name" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Arrow">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
eType="#//Box"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
eType="#//Box"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Name" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore//EString"/>
</eClassifiers>
</ecore:EPackage>
```
Listing 2.1: XMI code from .ecore
2.2 Eclipse Modeling Framework Store (EMF Store)
EMF Store\(^7\) is a framework that enables the development of repositories to distribute, store and work collaboratively on models based on EMF. Different users can work offline, modify models and keep these copies locally in their workspace. When users want to send their changes to the
---
\(^7\)EMF Store: [http://eclipse.org/emfstore/](http://eclipse.org/emfstore/)
server, EMF Store will check that there are no conflicts between the different users in order to maintain consistency of the system. EMF Store provides a mechanism to allow users to solve conflicts interactively through an approach based on model merging for reconciling model versions. The server will keep a history of the different states of the models, so it is possible to change between different versions or to come back to a previous state. EMF Store provide features to merge, commit and update the models. It is possible to modify the behaviour of these features. EMF Store also provides a migration mechanism. In addition, EMF Store is easy to integrate in other Eclipse applications. In the following, the different features of EMF Store will be explained with more details.
The functionality of EMF Store can be summarized by the next points:
- **Automatic Persistence**: Every change performed in a model instance on the client side is directly persistent (without the need to have any contact with the server side).
- **Transparency on Model API**: EMF Store features can be integrated with EMF Client Platform. In addition it is possible to create user interfaces for modifying and viewing models and by default EMFStore provides user interfaces for essential options such as history browser, synchronize models and update state of models.
- **Offline Mode**: EMF Store allows clients to work disconnected. Users can work offline and only require a connection with the server to update or commit changes.
- **Interactive Model Merging**: As previously mentioned, when several users notify changes on the same model simultaneously, EMF Store will detect the conflicts and start an interactive process for the users to solve the model inconsistencies. This process is performed by selecting the different merging alternatives.
- **Model Migration**: When a user changes a model, EMF Store can generate a migrator to update existing model instances to conform to the new version. In order to accomplish the migration, EMF Store relies on the technology of the Edapt Eclipse Project (formally COPE).
- **Versioning**: Every time a user commits a change to the server, EMF Store will create a new version of the model. A user can recover an old version or just check the differences between versions. EMF Store provides a complete history of every change with user name, time and comments.
### 2.3 Connected Data Objects (CDO)
Connected Data Objects (CDO) is a framework to develop EMF model repositories. It allows to work online in a collaborative way, and offers a run-time persistence framework.
---
8EMF Client Platform: [http://eclipse.org/emfclient/](http://eclipse.org/emfclient/)
CDO supports many deployments such as embedded repositories, offline clones or replicated clusters.
2.3.1 Functionality
The functionality of CDO can be summarized by the following points:
- **Persistence**: CDO abstracts the database technology, which allows storing models without being coupled with a specific database interface.
- **CDO provides a mechanism for locking models in a repository. This prevent models from being corrupted or invalidated when multiple users try to write to the same model. Any user can modify those models to which they have applied a lock that gives them exclusive access until the lock is released.**
- **CDO offers a special view which enables users to see the history of changes in models. This view does not allow users to make modifications to the models. This feature can be enabled or disabled for each repository separately.**
- **CDO provides a very good scalability. It is achieved by loading just the objects on demand in the application. When objects are not being referenced by the application, they are removed by a garbage collector when the memory is low. In addition, there are some strategies about which fetch rules will be used.**
- **Collaborative work on models using CDO is transparent for the user, because the application is notified about remote changes in the model. Therefore, the users have the impression of working on the same instance of the object. The notification policies can be customized to obtain a specific behaviour, or even adding new handlers in the asynchronous CDO protocol.**
- **Fault tolerance is performed in different ways, using fail-over repositories controlled by a monitor or using offline branches and a session reconnection mechanism that allows user to keep working on models even when the connection fails or the server repository is down.**
- **Offline work with models is supported by two different mechanisms:**
1. By creating a local clone of a repository, including all history and branches. This repository is synchronized with the remote repository as soon as the connection is restored.
2. By using branch points of the repository when the connection between the user and the repository is lost. After reconnection, the different branches will have to be merged.
• An interesting feature is to integrate the functionalities of CDO with other editor tools (e.g. GMF or Xtext). Currently, there is an Eclipse project called Dawn\(^\text{11}\). This project is part of the CDO project and provides an API that allows building extensions to use your current editors with CDO. At first it was developed just for GMF editors but nowadays Dawn supports other EMF editors such as tree-editor or Graphiti\(^\text{12}\). The user can keep working with his editors as he was working in a local file system. It is transparent for the user. On the other hand, Dawn has as objective the integration with web components to be able to work using a web browser and access to the models from any part of the world. In addition, Dawn has the future objective to integrate textual editors with CDO like XText.
2.3.2 Architecture
The architecture of CDO comprises client applications and the repositories. These two entities communicate with each other using the application level CDO protocol which can be used over different physical transport layers. Although CDO is designed for being used with the OSGi platform\(^\text{13}\), it can work in stand-alone or even use other kind of containers, like application servers.

2.3.2.1 Client Architecture
The architecture of a CDO application has a strong dependency to EMF, because CDO model objects are EObjects. The basic functionality of CDO is integrated transparently with an EMF extension mechanism, but, in order to use advance functions, it is necessary to add dependencies into the CDO application.
\(^\text{11}\)CDO Dawn: http://wiki.eclipse.org/Dawn
\(^\text{12}\)Graphiti framework: http://www.eclipse.org/graphiti/
\(^\text{13}\)OSGi: http://www.eclipse.org/osgi/
2.4. COMPARATIVE BETWEEN CDO AND EMF STORE
Figure 2.7 shows the architecture of a CDO application. As can be seen, the OSGi block is optional. Therefore the core components do not require OSGi, they can work stand-alone but the configuration is a bit simpler with OSGi. The Net4j\textsuperscript{15} Core is a communication framework. It helps on the development of application protocols independent of the physical transport medium. Net4j supports TCP, SSL and HTTP transport protocols.
2.3.2.2 Repository Architecture
Figure 2.8 shows the architecture of the repository. There is a main block, the repository layer. The client application interacts with the repository using the transport block which has been commented in the previous subsection.
One of the interesting blocks of the architecture is the CDO Server Core. This is formed by the repositories where each one has various components such as revision manager, branch manager, package register, lock manager, session manager and commit info manager. Another interesting block is the CDO Store, which allows connecting to different kinds of databases such as JDBC databases, Hibernate\textsuperscript{16}, Objectivity/DB, MongoDB or DB4O.

2.4 Comparative between CDO and EMF Store
As CDO and EMF Store are the two technologies available in the context of distributed models, it is interesting to compare both and see which of them fits better for this thesis. The comparative is going to focus on different aspects or features that both technologies share or resolve in a different way.
\textsuperscript{15}Net4j Signalling Platform: http://wiki.eclipse.org/Net4j
\textsuperscript{16}Hibernate: http://www.hibernate.org/
\textsuperscript{17}CDO Architecture: http://www.eclipse.org/cdo/documentation/ last visited: 4/26/2013
• **Offline or online work**
As the name suggests (Connected Data Objects), CDO is oriented on connected operation between the clients and the server. In contrast to CDO EMFStore is targeted at offline operation. EMF Store works much like SVN\(^\text{18}\), one can checkout a model and commit and update changes of the model. The clients are not connected with the repository permanently, they just need connection to update the models or to commit changes. CDO offers a mechanism to work offline, which however was recently introduced and is not yet matured.
• **Branching and merging**
In EMF Store, users are able to create a branch with the current version of the model and evolve it independently. EMF Store offers a mechanism to merge the different branches with a visual tool. On the other hand, CDO supports branching using a specific API which is used specially combined with the offline capabilities.
• **Migration**
EMF Store has a complete mechanism for model migration. When a user changes something in a meta-model of the application, EMF Store provides support to migrate the instances of the meta-model. Several basic operations such as adding attributes or classes are handled automatically. For other functions, EMF Store helps to generate a migration code.
• **Scaling**
CDO has been designed for high scalability. CDO uses a mechanism which only loads required parts of a model into the memory. A garbage collector additionally frees the memory for not used objects.
On the other hand, EMF Store loads all models into the memory and does not have an own memory management. Thus, for large models it has high memory demands.
To sum up, both EMF Store and CDO provide the needed features and are thus valid alternatives for this thesis. However, CDO has a higher maturity compared with EMF Store, and is thus used from now in this thesis as the underlying technology. Both projects are starting to share technologies, for example, it is planned to implement a user interface for editing models to be used together with CDO and EMF Store, with the purpose to easily integrate applications. A lot of activities and discussions are going on in both communities. Some members claim that both projects will fuse into one shared project, but this is to be shown by the future.
\(^{18}\)Subversion SVN: http://subversion.apache.org/
Chapter 3
The Robotics Case Study
The problem of collaborative work on distributed models is generic and independent of any particular domain. However, in order to better understand the real challenges and requirements for a solution (as presented in chapter 4), a real world example from the robotics domain is presented. This chapter is structured as follows.
First, there is an introduction about communication objects. Second, the section shows some use-cases related to communication objects which help in understanding which requirements will be necessary.
3.1 Introduction

This thesis uses the robotic framework SMARTSOFT [SSL12] for the implementation. SMART-
SMARTSOFT defines the approach how to develop robotic software systems in a building blocks manner (using CBSE and MDE) [SSL12]. At the same time SMARTSOFT is an implementation of a robotics middleware\(^1\) which abstracts over vendor specific communication mechanism and provides a set of communication patterns. However the approach in this thesis is independent of SMARTSOFT and can be used with other frameworks.
SMARTSOFT defines a component model which is implemented as the SmartMARS [SSL12] UML profile. The relevant parts of the profile are the component definition and the service definition. Services are used to exchange data between components. In order to define a service for a component it is necessary to choose the message type which is provided/requested by the service. In SMARTSOFT such message type are called communication objects (see figure 3.1). Technically, a communication object is just a class that defines the data structure for communication as a set of parameters. Each parameter can be either a primitive type (like int, double, string) or a reference to another communication object (which allows to create nested communication objects). Communication objects are stored in communication object repositories.

| **Figure 3.2**: Communication Object Meta-model Example |
\(^1\)SMARTSOFT: [http://smart-robotics.sourceforge.net](http://smart-robotics.sourceforge.net)
3.1. INTRODUCTION
Figure 3.2 shows the Ecore meta-model of a communication objects repository. The root element is the repository (COReposiory) which contains communication objects (CO). Communication objects consist of Elements. An Element can be either a primitive type (integer, double, string, etc.) or a reference to another Communication Object. The referenced communication object can be either in the same repository or in a different repository.

Figure 3.3 shows the Ecore meta-model of a communication objects repository. The root element is the repository (COReposiory) which contains communication objects (CO). Communication objects consist of Elements. An Element can be either a primitive type (integer, double, string, etc.) or a reference to another Communication Object. The referenced communication object can be either in the same repository or in a different repository.

Figure 3.3 shows a simple example with two components. Between them, there is a communication based on the query communication pattern. A communication pattern will define the communication semantics. The semantics define the communication policy and how many communication objects are involved. In the case of communication pattern Query, the communication semantics is that each Query Client can send several Query Requests. For each Query Request the Query Server responds with a Query Answer. Thus the communication policy for a Query is request-response. There are two communication objects involved, the request and the answer. For these two communication objects any concrete communication object from a communication objects repository can be selected.
Now, with the focus on the communication objects, the different parts can be described. Figure 3.1 shows an example consisting of two communication object repositories, the “CommBasicObjects” and “CommNavigationObjects”. Both repositories contain simple communication objects like “CommPosition”, “CommOrientation” and “CommOdometry”. Simple communication objects just consist of primitive data types. Both repositories also have complex (e.g. nested) communication objects. Such objects nest other objects by referencing them. The referenced objects can be either in the same repository as with “CommBaseState” and “CommOdometry” or the referenced objects can be in a different repository as with “CommBaseState” and “Comm6DPose”.

3.2 Use-cases
Communication objects are part of service definition for software components. Thus the creation and definition of communication objects is typically a result of collaborative work or in other words, it is something that several involved parties (e.g. companies) must agree upon. An agreed set of communication objects can result in a standard which fosters reusability and exchangeability of software components in different scenarios and applications. In order to ease a coordinated creation of such communication objects, a tool support is required which helps to overcome the following situations:
1. Modification of existing communication objects in a remote repository.
**Preconditions:**
A communication object repository already exists.
**Tasks:**
Some of the communication objects in the repository must be modified (e.g. a new sensor type is invented that leads to new components with services which require to add new communication objects or to modify already existing communication objects).
**Constraints:**
- **Model Consistency:** A tool should prevent concurrent modification at the same time of one particular communication object by several users. This could otherwise lead to inconsistent models.
- **Download/upload models:** During the whole process of modifying a model by a user, we must guarantee that this user is working with the latest version of the model. As a consequence, the process of downloading the communication object from the repository, modifying the model and finally uploading it, must be considered as an atomic operation.
- **Notification and synchronization of models:** After a modification, all involved parties must be informed about the change and their local copies (if any) must be synchronized.
- **Security access:** In order to ensure the identity of each user it is necessary to have a log-in system.
In the following a practical example of how a user should proceed is shown.
This first situation takes place when a user is going to modify a communication object in the remote repository.
**Steps:**
(a) User connects to a remote repository.
(b) User has to log in with a name and password in the repository.
3.2. USE-CASES
(c) User has to access to the repository where the communication object is stored.
(d) User modifies the communication object.
(e) User commits changes to the server.
(f) User closes the connection with the server.
The second situation occurs when a user is going to upload a model that has been previously created.
**Steps:**
(a) User creates a communication object model locally.
(b) User connects to a server.
(c) User has to log in with a name and password in the repository.
(d) User imports the model in the server using an URI from the workspace or the file system.
(e) User commits changes to the server.
(f) User closes the connection with the server.
2. Nested communication objects crossing repository boundaries.
In a typical market several companies exist which focus on particular domains. In a potential robotics market, some companies could be experts on mobile manipulation, other companies could be experts on mobile navigation or human-robot-interaction. It is clear that it makes sense to reuse generic communication objects (e.g. Position) in all these companies in order to create more complex communication objects (e.g. a Person object including a position of this person). Thus a mechanism is required to compose complex (nested) communication objects using other communication objects, which could be either local or even imported from other remote repositories (different to the current one). An example of this is shown in figure 3.1.
**Preconditions:**
Different communication object repositories already exist.
**Tasks:**
A new more complex communication object is needed. Thus it is necessary to reuse a generic communication object to add new features.
**Constraints:**
- **Model Consistency:** It is the same situation that in the previous use-case.
- **Security access:** Like in the first use-case, in order to ensure the identity of each user it is necessary to provide a log-in system.
CHAPTER 3. THE ROBOTICS CASE STUDY
Steps:
(a) User connects to server.
(b) User has to log in with a name and password in the repository.
(c) User makes a reference to the other communication object.
(d) User adds the new features in the communication object.
(e) User commits changes to the server.
(f) User closes the connection with the server.
3. Repository management
As it is commented in the previous use-case, there are different companies, each company works on different communication objects but in some situations they have to access to another repositories to create more complex communication objects. To allow these situations, an administrator is needed who will create the repositories and will configure the different access right for each company.
Tasks:
To create and delete repositories and configure the kind of access that each company will have.
Constraints:
- Model Consistency: It is the same situation that in the previous use-case.
- Security access: Like in the first use-case, in order to ensure the identity of each user it is necessary to provide a log-in system.
In the following a practical example of how an administrator should proceed is shown.
This first situation takes place when an administrator is going to create a remote repository.
Steps:
(a) Administrator connects to server.
(b) Administrator has to log in with a name and password.
(c) Administrator creates the new repository.
(d) Administrator sets the access rights for the companies.
(e) Administrator logs out.
The second situation occurs when an administrator is going to modify access rights to a company.
Steps:
(a) Administrator connects to server.
(b) Administrator has to log in with a name and password.
(c) Administrator modifies rights of the company.
(d) Administrator saves changes and log out.
Figure 3.4: Use case diagram for managing models with a model server
Figure 3.4 summarizes the different actions that take place in the previous use-cases. The designer gather actions such as create, delete, import and load models. On the other hand the administrator can create and delete repositories and in addition manage the user rights.
Chapter 4
Method
This chapter explains how the requirements showed in the previous section are solved using CDO.
4.1 Analysis
This section synthesize different features extracted from the use-cases in the previous chapter. First defining which features are needed and second, describing which requirements to reach the features are needed.
4.1.1 Features
As have been stated in the introduction chapter, and with the previous knowledge about Communication Objects, now the specific features needed to reach the goal of this thesis are described. The features are the next ones:
1. **User Interface**: This part is the entry point for the communication object designer in the system. From the first and second use-cases a need arises to provide a user interface. This interface will support designers for working on communication object models using different actions such as to modify model remotely in the communication object repository and to download or upload models. In addition, the designer needs to be able to work with remote communication object repositories to extend models creating new complex ones.
2. **Security System**: Each use-case shows that a security system is needed. The first part is an access control to avoid the entry of unregistered users in the repository. The second part of the system is to distinguish between users who will have right to modify objects, and other users who will just have rights to use the models or reference them. Therefore, it will be necessary to have a role who will manage the different features required by the system such as to create or to delete repositories. This role is the administrator.
3. **Consistency**: From these use-cases where the objects are modified, it is a problem when these actions are happening with two or more users at the same time. One of the most important features that a system like this needs to have is the data consistency. To avoid possible problems, a mechanism to control or lock objects when one user is working on them is needed.
### 4.1.2 Requirements
Now that the different features have been described, it is necessary to explain the different details that are needed to cover the features.
- The first feature is the *User Interface*.
- Model editor: it is necessary to have a tool that enable users to create/delete/modify models in the remote repository.
- As it has been commented, it is common to extend communication objects to make new ones, with more complexity. This option has to be provided.
- Another important capability is to allow users to import/export communication objects.
- The second feature is the *Security System*. The security system can be divided into the following aspects:
- Security Access: This part will control which users have access to a repository. To achieve this, the next capabilities are required.
* User authentication: Users will need a password and a user name to prove their identity. Each user has to be registered in the system.
* In relation with the previous capability, an interesting feature for the user, would be a mechanism to change the password from the user tool or recover the password if the designer forgets it.
- User Rights: This part will define the capabilities for the designer role. In order to support the communication object repositories, it is necessary to create user individual rights and group rights. The rights can be either read or write permissions to modify each repository. A set of group permissions make sense because a company for example will have different departments and each one with a different level of access or rights.
- Repository Administrator: In order to manage the security system, an entity which will create user accounts, will change passwords and will set user rights is needed. The security manager needs to have a special account to log into the system. In addition, to manage the repositories, this role has to be in charge of to create and delete repositories.
4.2. CDO SERVER
- The last feature is Consistency: To avoid the problems explained in the previous section about consistency, it is necessary to implement some mechanism to avoid that various user can modify the same object at the same time. A locking mechanism could solve the problem.
From this analysis, it can be deduced that it is necessary to support two different roles, the model designer and the repository administrator. CDO has been selected as the most promising tool to be used in next sections.
4.2 CDO Server
This section describes features such as how to configure the server, how to solve possible problems with the server connection or how to integrate CDO with other tools.
4.2.1 Server Configuration
To start with a set of distributed model repositories the first step is to configure the server where the repositories are going to be deployed. So this section starts with the server configuration. CDO uses an XML file where all the properties have to be set (an example is shown in listing 4.1). It is possible to define several repositories in the same file and also to start repositories from different files. Some of the relevant properties to set in this file are divided into the next elements:
```
<?xml version="1.0" encoding="UTF-8"?>
<cdoserver>
<!-- ============================================================== -->
<!-- See http://wiki.eclipse.org/CDO/Server_Configuration_Reference -->
<!-- ============================================================== -->
<acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/>
<!-- Examples: -->
<!-- <acceptor type="ssl" listenAddr="0.0.0.0" port="2036"/> -->
<!-- <acceptor type="http"/> -->
<repository name="repo1">
<property name="overrideUUID" value=""/>
<property name="supportingAudits" value="true"/>
<property name="supportingBranches" value="true"/>
<property name="supportingEcore" value="false"/>
<property name="ensureReferentialIntegrity" value="false"/>
<property name="allowInterruptRunningQueries" value="true"/>
<property name="idGenerationLocation" value="CLIENT"/>
</repository>
<repository name="repo2">
<property name="overrideUUID" value=""/>
<property name="supportingAudits" value="true"/>
<property name="supportingBranches" value="true"/>
<property name="supportingEcore" value="false"/>
<property name="ensureReferentialIntegrity" value="false"/>
<property name="allowInterruptRunningQueries" value="true"/>
<property name="idGenerationLocation" value="CLIENT"/>
</repository>
...
</cdoserver>
```
CHAPTER 4. METHOD
Listing 4.1: CDO Configuration File Example
- **Acceptor element**: This element can configure the type of connection, such as TCP, SSL, HTTP and the IP address and port to receive connections.
- **Repository element**: This element sets the different properties related to the features that the repository will support. Some examples can be to support Audits, Branches, the storage of Ecore meta-models and also to activate the security system. Another important part inside the *Repository element* is the Store element that defines the type of store factory that will be used. The Store element has four main parts.
- **Type**: Among the different types of Store element, one can find: DBStore, Hibernate Store, DB40 Store or even a custom store. This Store Element, is an extra layer
4.2. CDO SERVER
on CDO, so it makes possible to connect many JDBC databases. There are three properties to set or leave by default, the time that a connection will be alive to execute an SQL sentence and limit of connections for writing/reading at the same time.
- **MappingStrategies**: Define the overall mapping strategy of the store element, elements settings like the size limit of elements in memory, how to handle the mapping of collection references or individual references.
- **dataSource**: this element has to match with the Store element.
Once the important parts of this file are described, the administrator, who at least initially, should be the entity who will manage the repositories is prepared to launch a CDO server. How to launch a CDO server is explained in different tutorials which can be found on the main website of CDO\(^1\).
This XML file works well and it does not cause problems. Although on the other hand it would be desirable and it is a goal for the future in the CDO Project to manage the server configuration using a EMF Model.
### 4.2.2 Issues with the Server Connection
An important desirable functionality comes from the nature of CDO. Since CDO is a project based on online collaboratively work, it is necessary to ensure that in the presence of connection failures CDO can continue working or at least the damage caused by the failure can be minimized.
CDO offers three ways to solve this.
- The first case takes place when one or more designers are working with the repository and suddenly the connection gets lost. Thereby, the designer will work online while the server is on, and when the server gets offline the designer will keep working creating a branch when he commits the changes. After recovery of the connection with the repository, the designer will be able to merge this branch to update the model in the repository.
This solution only helps up to a certain degree, because even though the designer can still work with the server, there is no real collaboration because each user will work independently from the other users and they will not be aware of changes in objects.
- The second way is to use a fail-over repository. This is a complex topology which has back-up repositories which are synchronized with the master repository. Thereby when the master fails one of the backup repositories becomes the new master. There is a separate entity, a monitor, which manages dynamically the set of repositories. In every moment the designers don’t know if they are working with one repository or another, the mechanism is completely transparent. This fail-over has been tested and it works well.
• The last one is to create a local clone of a repository, including full history and branches. This repository will be synchronized with the remote repository. This repository can also act like a local repository to solve some issues with the connection, for example, when there is a low latency between the remote repository and the designer.
With these mechanisms, CDO offers different ways to support connection problems.
4.2.3 Integration of CDO with Other Tools
The chapter Related Work showed that in CDO project there is also a project called Dawn which integrates CDO with other graphical tools like GMF and in addition it is planned to integrate CDO with Xtext.
There are other ways to integrate CDO with other tools like Xtext independently of Dawn. Although it is not part of this thesis to develop the integration of CDO with other tools, during the research of this thesis, some independent projects have been found which are able to gather Xtext with CDO. The key is the common work that these Eclipse tools have with EMF models and the easily customizable features of these tools. One of these projects is based on the modification of the Xtext component to use CDO Resource URIs. So with some modification it is possible to save some models in the CDO repository and see the Xtext code of this models directly.
4.3 Administrator Role
This section describes in detail which features are needed or would be desirable for this role. This role manages the access control and also the user rights for editing/creating/deleting models. In addition, this role has to manage the repositories.
4.3.1 Security Management
The first point to study is the security. As has been commented in the previous section for the security system it is necessary to cover features such as an access control for users and a permission system to limit different roles (e.g. like different departments in a company).
To reach these goals, CDO has an Ecore model implemented on the server side to provide the security. Figure 4.1 shows the model. The model has the realm as root element which contains the following elements:
• Role: describes the functions and their access rights.
• User: describes the access to the repositories. Users can have different roles and belong to different groups.
• Group: gathers users who share the same rights. Groups can have many roles.
4.3. ADMINISTRATOR ROLE
- Directory: gathers any number of these four elements. For the purpose of organizing the elements.
There are three different types of roles: NONE, READ and WRITE. These roles can be assigned to the following elements:
- ResourcePermission: specifies access right for any resource or folder.
- PackagePermission: specifies access right for all EClass included in this Package.
- ClassPermission: specifies access right for the EClass.
In order to activate this feature in CDO, it is necessary to add the line:
```xml
<securityManager type="default" realmPath="/security"/>
```
in the configuration file in the Repository Element and to restart the server. This configuration file has been explained in the previous subsection. The administrator will have to log in with the administrator password. By default the user name is “Administrator” and the password is “0000”.
When the administrator has logged in into the repository, after opening a transaction, the administrator will have access to the Security Realm. The administrator will be able to add new role profiles and set what kind of access this role will have to the different parts in the repository,
---
CHAPTER 4. METHOD
Figure 4.2: A view of the security realm interface
as shown in the figure 4.2 with the Administration role. The “Groups” branch is used to define user groups. In this part, the administrator will add users to each group and assign roles to the group. The last part, is where the administrator will add/delete users. The administrator also will change the password of the users or apply individual roles for each user.
From this security system model that CDO uses, there is a good base to implement one of the goals of this thesis namely to have an access system and a permission system to manage the users of the repository. Although it can be considered a beta version because currently it is not working completely. For example the WRITE access is only checked at commit time so the designer can create or modify objects with the editor but the changes will be rejected only when the user try to commit. Another aspect that doesn’t work correctly is that when there is a change in the security realm, these changes will not have any effect until the next restart of the server. These aspects and others more are addressed in a Bugzilla list of CDO where the developers work continuously.
An independent solution from CDO could be to create an external database of users which can manage different groups and set the different kind of permissions. Then modifying the CDO API code related to the access in the repository it should be possible to introduce the necessary SQL sentences to ask to the different users for their user-name and password, and when one designer is going to access to a repository, to check what kind of access the user has and then to show the content of the repository.
4.3.2 Repository Management
The second main objective of this tool is the management of repositories. CDO does not offer an administrator tool where one can add or delete repositories directly. In CDO the way to start
a repository is by using the XML configuration file. In this file one can set the different features as has been explained in the previous section. One server can have one or more repositories. CDO offers a functionality through the OSGi console to be able to add, delete repositories. This console can only be used from the server side. On the other hand, CDO provides an API (org.eclipse.emf.cdo.common.admin) to manage repositories remotely. Other option could be to exploit the API provided by CDO and integrate these functions with a graphical user interface to ease the repository management. Due to time reasons this interface is not yet evaluated.
Another possible solution could be to create an administrator tool with an interface where the administrator can set the different features that the repository is going to have. Afterwards this interface can generate the XML file, where there is a default schema and the different fields are filled with the features that the administrator has chosen with the graphical interface.
4.4 Designer Role
This section describes in more detail which features are needed or would be desirable for this tool. This tool provides all utilities that a designer will need to work with a repository like the possibility to create/delete/modify communication objects.
4.4.1 User Interface
As has been explained in the previous chapter, a user interface is needed to ease the designer work.
The user interface in CDO is based on Sessions and Views which offer the access to the different features of the server. The first one is the CDO Session view. It is the main access point of a client to a server repository. A designer can open an arbitrary number of sessions but each session maintain a revision cache, so it is not recommendable for the expensive use of memory. From each session a designer can open several CDO Views. In a sense, the CDO Views are light weight entities in comparison with a CDO Session.
There are three main views in CDO:
- **Transaction**: It is the only read-write view which CDO offers. From the transaction a designer can create resources and then open the CDO Editor to start working with the models.
- **Read-only View**: It is a read only access to the resource that shows the latest state of the repository.
- **Audit view**: It is a special read only view that allows to look at an old state of the models.
The CDO Editor allows designers to create models, or to add root objects from the packages which are registered. To register a model in CDO it is necessary to generate the Java classes of the model with a .genmodel as was explained in the Chapter 2: Related Work. For CDO there is a special .genmodel which prepares the Java code for CDO. During the process of creation of
Figure 4.3: Migration of generator model (.genmodel) to CDO
the .genmodel the designer has to choose “Ecore Model (CDO Native)”. After that it is possible either to import a created model in the repository and work with it or add the required plug-in in the Eclipse Run Configuration of the client application.
There is a second option if the model already has a .genmodel, then to migrate it to CDO. This option is very simple, the figure 4.3 shows the option in the contextual menu which allows to do the migration. In addition, the designer will be able to import models from other projects in the workspace or the filesystem and to export the models which are in that moment in the repository.

Figure 4.4: CDO State Machine
While a designer is working on a model, he will have information about the state of the objects. These states are:
- **New**: When a designer creates a new object, the object will have this state.
- **Clean**: Once the designer commits the changes, the state of the object will be “Clean”.
- **Dirty**: When a designer modifies an object, the state will be “dirty” before to commit changes.
- **Conflict**: When two or more designers are working on the same model, for example user A modifies an object, meanwhile user B, modifies the same object and commit the change. In this case, user A will be notified, and the state of the object will be “Conflict”.
- **Proxy**: It is an intermediate state. When the object is in “Conflict” state, if the state is reloaded, the object will pass to “Proxy”.
---
4CDO State Machine taken form the blog of an CDO core developer: [http://thegordian.blogspot.de](http://thegordian.blogspot.de)
CHAPTER 4. METHOD
Figure 4.4 shows the state machine of the states previously described.
Using the capabilities of Eclipse Client Platform, it is possible to use this framework for building applications where the different views can be integrated. This way it is possible to create a customized interface that gather the necessities of the company.
4.4.2 Consistency Mechanism
One of the most important features that a system of distributed repositories needs to have is consistency. Many users can work on different parts of a model and commit changes at the same time. CDO only accepts the first commit, so the second designer should receive a notification before to commit any changes. To avoid possible conflicts during a modification on an object CDO provides an explicit mechanism of locking objects. Therefore a designer can use this feature to lock one or more objects at once. The nested objects can be affected as well. Other designers will not be able to make changes in these objects until the locks are released. The objects will be unlocked automatically when the transaction is closed.
The default functionality of this feature is simple. When a designer locks an object or part of it, the rest of designers do not know that the object is blocked. When these other designers try to modify the object, at commit time, they will receive a message telling that they can not do modifications. Like a first approach, this feature achieve the goal, the other users can not modify the objects while the object is blocked. But it is not a comfortable behaviour. The optimal situation would be that the other designers are informed about that the object is blocked, with a message, or some kind of information in the CDO editor. It is possible to change this behaviour with the modification of the Java code of the classes that implement this feature. These Java code can be found in IStoreAccessor.DurableLocking in the \texttt{org.eclipse.emf.cdo.server} package in the server side and CDOLock in the package \texttt{org.eclipse.emf.cdo} package for the client side.
4.4.3 Download/Upload Communication Objects
As has been shown in the first use-case from the previous chapter it is necessary to have a mechanism to download/upload communication objects in the repository.
CDO allows to the designers export/import resources easily. In the case of exporting a resource, the designer just has to select the resource that he wants to export and select where to download the model.
Figure 4.5: Export resource window.
4.4. DESIGNER ROLE
The opposite case is very similar. In this case the designer will need to select the import option in the transaction view. Then, after providing the URI where the resource is located, the designer just needs to commit the changes. It is important to remember that the generator model (.genmodel) has to be migrated to work with CDO.
Another option that CDO offers is “Load Resource”. This option is necessary when one designer wants to work with communication objects in another repository. As it can be seen in figure 4.5 the designer will have to introduce the URI of the resource where the communication object is. To make reference to resources in another repository the designer has to introduce the URI like that: “cdo.net4j.tcp://IP:PORT/repository_name/resource_name” where IP is obviously the IP address of the repository and PORT is the port number. Again, this feature can be integrated in a customizable interface.
4.4.4 Access to the Repository
This subsection shows the security system from the side of a designer. To access to the repository in CDO, the designer has to justify that he is a registered user. In CDO the designer will have to connect to the server and then open a new session. After that, CDO will ask for the User ID and password. Previously the administrator must have created this User account. By default, CDO does not offer any features to allow the designer to change his own password or a mechanism to ask the administrator for a new password from the user interface. This would be a good feature to have. It could be implemented as a functionality in the designer tool interface, more specifically in the CDO Session view, to allow designers to change their own password introducing first the old password. On the other hand, it would be also necessary to add this feature in the security model, to allow the Administrator to change user password.
4.4.5 Versioning
About model versioning, the Related Work chapter does not show anything about this feature in CDO. Nevertheless CDO implements the Audit View which can offer a way to get versioning. Since it is possible with this CDO View to see previous versions of the models in the repository, it would be possible to use a previous version if it is necessary. Although currently there is no way to make a direct “rollback” with this view, it is possible to save or export an old state of the model in an XML file and load the model if it is necessary.
Chapter 5
Experiments and Results
This chapter summarizes the features that have been analyzed in previous chapter showing what level of completion have been reached.
As the chapter Method has shown, CDO offers a good base to build applications with a set of remote repositories to work collaboratively, although CDO has many features which are still under heavy development. First, CDO covers the main desirable features for the robotic case. Some of these features can be still considered like a “beta” version, because the default solution from CDO is not completely developed. Other features work with a behaviour that in the beginning can be sufficient. One of the advantages of CDO is that it is an open source project and this allows to adapt the different features to better fit with a concrete behaviour. Also it is possible to get these “green” functionalities and to implement a personal solution. As most of Eclipse projects, there is a good community support.
5.1 Analysis
This section shows up to which level the needed features are covered with CDO.
- **Server Configuration**: Although it would be better to use a model for the configuration, it is not a big deal to use an XML file because it is possible to prepare a script with a template to generate the file with the specific properties.
- **Issues with the Server Connection**: About the different options that CDO offers to solve the possible connection problems, the mechanism that works best is the fail-over repository. It has been tested without major problems. The offline-branch mechanism worked well at first, when only a couple of users were working and they needed to merge just once. However, after trying different iteration turning off the repository, some problems were found when the state of the objects are not uploaded. At first it could work like another layer to avoid connection mistakes but it requires further investigations for a proper use of the feature.
• **Integration of CDO with Other Tools**: It has not been tested because it is not relevant in this thesis but it has been shown in previous chapters that there are different ways to do it by e.g. using CDO Dawn or developing an own solution.
• **Security Management**: Regarding security in CDO, the Security Manager Model has been tested. The test showed that this model is still a beta. It has a good potential because the model covers almost all features that are desirable for the cases in this thesis. Nevertheless, it has many missing points that do not allow to use a default version to see at least how the different parts of the model work.
• **Repository Management**: The repository management is a feature that CDO provides but it is not yet matured. The effort in this part should be to develop a graphical interface which can gather the different actions to ease the administrator task.
• **User Interface**: CDO implements a complete system of views where the different features about the designer actions take place. An important part is that a designer can work directly with the default system that CDO provides. The other part has been commented in the previous chapter. All these views can be included in a customized interface.
• **Download/Upload Communication objects**: This feature can be considered as part of the user interface. This means that would be necessary to implement these features in the designer interface because the current way to work with these features is uncomfortable.
• **Access to the repository**: As it has been commented about the security system, using the Security Manager model, it needs further improvement to have a good working feature.
• **Versioning**: This is a good feature. To have a history of the models allow to access to different old versions. This is important if it is necessary to do a rollback or work in a parallel version of one model.
Chapter 6
Conclusion and Future Work
This thesis addressed the problem of collaborative work on distributed communication object repositories. To summarize, this document showed that it is possible to work collaboratively on communication object repositories using CDO. It started with the analysis of the problems and difficulties that are involved in this kind of work. For that the chapter Introduction showed a set of use-cases and from these use-cases a first overall idea of the different challenges was presented. After that, in chapter Related Work a basic knowledge about modeling was presented and also an introduction of two different tools which allow to collaboratively work on distributed repositories. In addition, the two tools were compared and CDO was finally chosen. Afterward the next chapter The Robotic Case Study introduced the specific focus on communication objects where the use-cases were analyzed again and the features were extracted with the specific focus on communication objects. Chapter Method showed how CDO can cover the different features. Chapter Results showed now far the goals have been solved.
CDO is a tool in constant development that improve the different features, add new ones and there are many groups using CDO as base for their own specific purpose. This is an important point. An open source project allows to extend features easily and to integrate CDO in other systems. Although this thesis only defines a solution in a conceptual way, it shows that it is possible to start collaborative work on distributed repositories. There are many features under development, it means that it is possible to start working with CDO and build an independent solution of the features that are not completely developed, but it is also possible that half year later some of these features are working completely.
6.1 Future Work
This thesis is an entry point to start with the implementation of a distributed system of repositories. The very first step has to be the implementation of a basic architecture that can consist of one repository and a group of designers. With this simple example it is possible to test the Security Manager, setting different user rights and adapt the security system to a concrete purpose. Another important part to test, is the user interface where different designers can start working with models in the repository and try the different features such as create, delete models and to see if
it is necessary to adapt the behaviour of these functionalities. Once this basic architecture works correctly one can add more complexity creating different groups with different rights, adding a second repository and try to create nested communication object using references to these different repositories. On the other hand, regarding designer and administrator interface, there is a new Eclipse project called EMF Client Platform which allows to integrate different EMF technologies such as CDO or EMF Store for building applications. It would be very interesting to study this project for building CDO applications for the designer and administrator interface. With these experiments, one can further refine the requirements and add further solutions to meet them.
Bibliography
|
{"Source-Url": "http://repositorio.upct.es/bitstream/handle/10317/3894/pfc5634.pdf;jsessionid=561CB64697888DC9267F71BEC45B2220?sequence=1", "len_cl100k_base": 15787, "olmocr-version": "0.1.53", "pdf-total-pages": 53, "total-fallback-pages": 0, "total-input-tokens": 91124, "total-output-tokens": 18663, "length": "2e13", "weborganizer": {"__label__adult": 0.00031685829162597656, "__label__art_design": 0.0006580352783203125, "__label__crime_law": 0.0002589225769042969, "__label__education_jobs": 0.0058441162109375, "__label__entertainment": 8.445978164672852e-05, "__label__fashion_beauty": 0.00017070770263671875, "__label__finance_business": 0.0002994537353515625, "__label__food_dining": 0.00022327899932861328, "__label__games": 0.0005884170532226562, "__label__hardware": 0.0006647109985351562, "__label__health": 0.00024271011352539065, "__label__history": 0.0003695487976074219, "__label__home_hobbies": 0.0001283884048461914, "__label__industrial": 0.0003437995910644531, "__label__literature": 0.0003578662872314453, "__label__politics": 0.0002110004425048828, "__label__religion": 0.0004193782806396485, "__label__science_tech": 0.0128631591796875, "__label__social_life": 0.00016617774963378906, "__label__software": 0.01139068603515625, "__label__software_dev": 0.96337890625, "__label__sports_fitness": 0.0002237558364868164, "__label__transportation": 0.0004625320434570313, "__label__travel": 0.00019466876983642575}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 78188, 0.02411]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 78188, 0.38792]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 78188, 0.90723]], "google_gemma-3-12b-it_contains_pii": [[0, 177, false], [177, 242, null], [242, 480, null], [480, 480, null], [480, 1414, null], [1414, 1414, null], [1414, 2680, null], [2680, 2680, null], [2680, 4838, null], [4838, 4838, null], [4838, 6913, null], [6913, 8127, null], [8127, 10874, null], [10874, 10898, null], [10898, 12983, null], [12983, 15004, null], [15004, 16437, null], [16437, 17955, null], [17955, 19946, null], [19946, 21789, null], [21789, 22212, null], [22212, 25097, null], [25097, 27374, null], [27374, 29288, null], [29288, 31157, null], [31157, 33512, null], [33512, 34237, null], [34237, 35724, null], [35724, 38321, null], [38321, 40539, null], [40539, 42487, null], [42487, 44119, null], [44119, 44655, null], [44655, 44655, null], [44655, 46317, null], [46317, 48650, null], [48650, 51236, null], [51236, 52048, null], [52048, 54871, null], [54871, 57345, null], [57345, 58646, null], [58646, 60585, null], [60585, 63352, null], [63352, 63412, null], [63412, 65069, null], [65069, 67601, null], [67601, 70070, null], [70070, 70070, null], [70070, 72030, null], [72030, 73947, null], [73947, 76412, null], [76412, 77183, null], [77183, 78188, null]], "google_gemma-3-12b-it_is_public_document": [[0, 177, true], [177, 242, null], [242, 480, null], [480, 480, null], [480, 1414, null], [1414, 1414, null], [1414, 2680, null], [2680, 2680, null], [2680, 4838, null], [4838, 4838, null], [4838, 6913, null], [6913, 8127, null], [8127, 10874, null], [10874, 10898, null], [10898, 12983, null], [12983, 15004, null], [15004, 16437, null], [16437, 17955, null], [17955, 19946, null], [19946, 21789, null], [21789, 22212, null], [22212, 25097, null], [25097, 27374, null], [27374, 29288, null], [29288, 31157, null], [31157, 33512, null], [33512, 34237, null], [34237, 35724, null], [35724, 38321, null], [38321, 40539, null], [40539, 42487, null], [42487, 44119, null], [44119, 44655, null], [44655, 44655, null], [44655, 46317, null], [46317, 48650, null], [48650, 51236, null], [51236, 52048, null], [52048, 54871, null], [54871, 57345, null], [57345, 58646, null], [58646, 60585, null], [60585, 63352, null], [63352, 63412, null], [63412, 65069, null], [65069, 67601, null], [67601, 70070, null], [70070, 70070, null], [70070, 72030, null], [72030, 73947, null], [73947, 76412, null], [76412, 77183, null], [77183, 78188, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 78188, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 78188, null]], "pdf_page_numbers": [[0, 177, 1], [177, 242, 2], [242, 480, 3], [480, 480, 4], [480, 1414, 5], [1414, 1414, 6], [1414, 2680, 7], [2680, 2680, 8], [2680, 4838, 9], [4838, 4838, 10], [4838, 6913, 11], [6913, 8127, 12], [8127, 10874, 13], [10874, 10898, 14], [10898, 12983, 15], [12983, 15004, 16], [15004, 16437, 17], [16437, 17955, 18], [17955, 19946, 19], [19946, 21789, 20], [21789, 22212, 21], [22212, 25097, 22], [25097, 27374, 23], [27374, 29288, 24], [29288, 31157, 25], [31157, 33512, 26], [33512, 34237, 27], [34237, 35724, 28], [35724, 38321, 29], [38321, 40539, 30], [40539, 42487, 31], [42487, 44119, 32], [44119, 44655, 33], [44655, 44655, 34], [44655, 46317, 35], [46317, 48650, 36], [48650, 51236, 37], [51236, 52048, 38], [52048, 54871, 39], [54871, 57345, 40], [57345, 58646, 41], [58646, 60585, 42], [60585, 63352, 43], [63352, 63412, 44], [63412, 65069, 45], [65069, 67601, 46], [67601, 70070, 47], [70070, 70070, 48], [70070, 72030, 49], [72030, 73947, 50], [73947, 76412, 51], [76412, 77183, 52], [77183, 78188, 53]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 78188, 0.00206]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
4f3ed9f0deb6122141e101e9a940f27b3e8a0a02
|
A compositional proof system for real-time systems based on explicit clock temporal logic
Hooman, J.J.M.; Kuiper, R.; Zhou, P.
Published in:
Proceedings Sixth International Workshop on Software Specification and Design (Como, Italy, October 25-26, 1991)
DOI:
10.1109/IWSSD.1991.213070
Published: 01/01/1991
Document Version
Publisher's PDF, also known as Version of Record (includes final page, issue and volume numbers)
Please check the document version of this publication:
• A submitted manuscript is the author's version of the article upon submission and before peer-review. There can be important differences between the submitted version and the official published version of record. People interested in the research are advised to contact the author for the final version of the publication, or visit the DOI to the publisher's website.
• The final author version and the galley proof are versions of the publication after peer review.
• The final published version features the final layout of the paper including the volume, issue and page numbers.
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
Take down 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.
Download date: 05. Nov. 2018
A Compositional Proof System for Real-Time Systems
Based on Explicit Clock Temporal Logic*
J. Hooman R. Kuiper P. Zhou
Dept. of Mathematics and Computing Science
Eindhoven University of Technology
P.O.Box 513
5600 MB Eindhoven, The Netherlands
Abstract
To specify timing properties of real-time systems, we consider Explicit Clock Temporal Logic. Programs are written in an Occam-like real-time language. A proof system is provided to formally verify that a program satisfies a specification expressed in our real-time version of temporal logic. The proof system is compositional, sound, and relatively complete.
1 Introduction
In this paper we investigate the formal specification and verification of real-time systems. One of our objectives was that the approach should be able to deal with a reasonably realistic language. Therefore, we consider an Occam-like real-time programming language [8] with synchronous message passing along unidirectional channels between concurrent processes. Another aim was to build on existing formalisms and enable easy future extension or adaptation. In general, to specify and verify real-time systems, an existing non-real-time method can be extended with some notion of time. Here we also follow this approach, and use an extension of linear time temporal logic [12, 10]. The standard logic enables the expression of safety properties (such as "non-termination", "no communication along channel c", and "program variable x is always greater than 5") as well as liveness properties (such as "termination", "eventually communicate along channel c", and "eventually x has the value 8"). To specify real-time properties (such as "termination within 7 time units", "communicate on channel c at time 4", and "during the next 3 time units x has a positive value") we have to extend temporal logic with a quantitative notion of time. As already observed in [4], one can distinguish two main approaches.
In one approach, new temporal operators are introduced by extending the standard ones with time bounds. A general discussion of this extension in the context of linear time, often called Metric Temporal Logic (MTL), can be found in [9]. In a similar way, branching time temporal logic, also called Computation Tree Logic (CTL), is extended to real-time by adding time bounds to the modal operators. See, for instance, [2] where also algorithms for model checking and satisfiability analysis are presented.
We investigate the alternative approach in which temporal logic is extended with a distinguished variable that explicitly refers to clock time. Such a logic has been used in [11] to reason about real-time discrete event systems. A similar real-time version can be found in [3]. This approach has the advantage of building upon a well-established classical temporal logic framework to which only axioms and rules for proving timing properties have to be added. Also, further extensions can be envisaged, like extra structure on the time domain, that leave the underlying logic unchanged. It is even possible to leave choices about the time domain, like this being discrete or dense, open till later. This allows for investigating the effect of different choices on, e.g., the possibilities for automatic verification without drastic changes to the formalism.
Given the choice of the programming language and the real-time version of temporal logic, the task is to develop a proof method to verify that a program satisfies a property expressed in this logic. In classical verification methods, such as [10] for temporal logic, the complete program text must be available. Global proof systems, based on the method of [10], and deci-
sion procedures for explicit clock versions of temporal logic can be found in [3, 11].
In contrast with these methods, we formulate a compositional proof system in which the specification of a compound programming language construct (such as sequential composition and parallel composition) can be deduced from specifications for its constituent parts without any further information about the internal structure of these parts. Compositionality can be considered as a prerequisite for hierarchical, structured, program derivation. By means of a compositional proof system the design steps can be verified during the process of top-down program construction.
To obtain a compositional proof system, our starting point is the compositional system for classical temporal logic as described in [1]. The present paper also builds on the approach to compositionality and real-time introduced in [7]. With respect to that paper, the main difference is that the emphasis there was on achieving compositionality in as simple a setting as possible. Therefore, a quite sparse model of computation was used. Furthermore, that paper forms a complement to the present one in the sense that the logic was MTL-styled rather than equipped with an extra time variable. Related compositional proof systems based on MTL for variations of the programming language have been formulated in [6].
This paper is structured as follows. In Section 2 we describe our programming language and the basic timing assumptions. An outline of the semantic model is given in Section 3. In Section 4 we define our version of explicit clock temporal logic. A compositional proof system is formulated in section 5. Finally, Section 6 contains concluding remarks. More technical details can be found in [13].
2 Real-Time Programming Language
2.1 Syntax and Informal Semantics
We consider a real-time programming language which is akin to Occam [8]. Concurrent processes communicate and by synchronous message passing via unidirectional channels which connect exactly two processes. Let \( VAR \) be a nonempty set of program variables, \( CHAN \) be a nonempty set of channel names, and \( VAL \) be the domain of values of program variables. In our real-time programming language we have the following statements, with \( c, c_i \in CHAN \) and \( x, x_i \in VAR \).
Atomic statements
- \( \text{skip} \) terminates immediately.
Non-atomic statements
\[ x := e \]
- \( x := e \) assigns the value of expression \( e \) to \( x \).
\[ \text{delay } e \]
- \( \text{delay } e \) suspends execution for (the value of expression) \( e \) time units.
\[ c!e \]
- \( c!e \) sends the value of expression \( e \) on channel \( c \) as soon as a corresponding input statement is available. Since we assume synchronous communication, such an output statement is suspended until a parallel process executes an input statement of the form \( c?z \).
\[ c?x \]
- \( c?x \) receives a value via channel \( c \) and assigns this value to the variable \( x \). Similar to the output statement, such an input statement has to wait for a corresponding output statement before a synchronous communication takes place.
Compound statements
- \( S_1; S_2 \) indicates sequential composition.
- \( \text{Guarded command } [[b_1; \ldots; b_i] \rightarrow S] \) is executed as follows. If none of the \( b_i \) evaluates to true then this command terminates after the evaluation of the booleans. Otherwise, non-deterministically select one of the \( b_i \)'s which evaluates to true and execute the corresponding statement \( S_i \).
- \( \text{Guarded command } [[b_1; \ldots; b_i] \rightarrow S] \) is executed as follows. A guard \( b_1; \ldots; b_i \) or \( b; \text{delay } e \rightarrow S \) is open if the boolean part evaluates to true. If none of the guards is open, the guarded command terminates after evaluation of the boolean expression \( S \). Otherwise, wait until an io-statement of the open io-guards can be executed and continue with the corresponding \( S_i \). If the delay guard is open \( b \) evaluates to true and no io-guard can be taken within \( e \) time units after the evaluation of the boolean expression \( S \), then \( S \) is executed. Boolean expressions equivalent to true are often omitted in guards.
Example 2.1 Observe that delay-values can be arbitrary expressions, for instance, \( d?x; \text{if } y \rightarrow S_1; c?x \rightarrow S_2; [[\text{delay } (x+6) \rightarrow S_3] \)
Example 2.2 By means of a guarded command, we can easily express a time-out. For instance, \( [x > 0; c?y \rightarrow x := y + x] \) \( \text{delay } 10 \rightarrow \text{skip} \) informally means that if \( x > 0 \) and the input communication can take place within 10 time units then the assignment is executed, otherwise after 10 time units there is a time-out and the skip-statement is executed.
- \( *G \) indicates repeated execution of guarded command \( G \) as long as one of the guards is open.
When none of the guards is open, \( *G \) terminates.
- \( S_1; *S_2 \) indicates parallel execution of \( S_1 \) and \( S_2 \). No program variable should occur in both \( S_1 \) and \( S_2 \).
Henceforth we use $\equiv$ to denote syntactic equality.
Define $\text{var}(S)$ as the set of variables occurring in statement $S$. The set of (directional) channels occurring in $S$, denoted by $\text{dch}(S)$, is defined as the set containing all channels occurring in $S$ together with all directional channels $c!$ and $c?$ occurring in $S$. For instance, $\text{dch}(c!5; d?y || c?z) = \{c, c!, c?, d, d?\}$.
2.2 Basic Timing Assumptions
In order to describe the real-time behavior of programs, we must make assumptions about the execution time of atomic statements and the extra time needed to execute compound constructs. In our proof system, the correctness of a program with respect to a specification, which may express timing properties, is verified relative to these assumptions. For simplicity, we assume in this paper that a guarded command takes exactly $e$ time units. Furthermore we assume given positive constants $K_a$, $K_c$, and $K_\eta$ such that every assignment takes $K_a$ time units, each communication takes $K_c$ time units, and the evaluation of the guards in a guarded command takes $K_\eta$ time units. There is no overhead for other compound statements.
The most important assumption involves parallel composition. Clearly, the execution time of a simple program $x := 0 || y := 1$ depends on the number of available processors. In general, we have to make an assumption about the assignment of processes to processors at parallel composition. In this paper we use the maximal parallelism model to represent the situation that each process has its own processor. Consequently any action is executed as soon as possible. Observe that maximal parallelism implies minimal waiting: a process only waits when it tries to execute an input or output statement and the communication partner is not available. This maximal parallelism assumption has been generalized in [5] to multiprogramming where several processes can be executed on a single processor and scheduling is based on priorities which can be assigned to statements in the program.
3 Denotational Semantics
A good starting point for the development of a compositional proof system is the formulation of a denotational, and hence compositional, semantics. In such a semantics the meaning of a statement must be defined without any information about the environment in which it will be placed. Hence, the semantics of a statement in isolation must characterize all potential computations of the statement. When composing this statement with (part of) its environment, the semantic operators must remove the computations that are no longer possible. To be able to select the correct computations from the semantics, any dependency of an execution on the environment must be made explicit in the semantic model.
In our semantics the timing behaviour of a program is expressed from the viewpoint of an external observer with his own clock. Let this clock range over a time domain $\text{TIME}$. Thus, although parallel components of a system might have their own, physical, local clock, the observable behaviour of a system is described in terms of a single, conceptual, global clock. Since this global notion of time is not incorporated in the distributed system itself, it does not impose any synchronization upon processes.
To define the timing behaviour of a statement delay $e$, we have to relate expressions in the programming language to our time domain. For simplicity we have assumed that delay $e$ takes $e$ time units and hence, implicitly, that $\text{VAL} \subseteq \text{TIME}$. Furthermore we assume that the standard operators $\text{+}, \text{-}, \text{x}$ and $\leq$ are defined on $\text{TIME}$. In examples we often assume that $\text{VAL}$ includes the natural numbers. Note that we allow our time domain to be dense (a domain is dense if between every two points there exists a third point).
Henceforth, we use $\tau, \tau_0, \tau_1, \ldots$ to denote values from $\text{TIME}$. For notational convenience, we use a special value $\infty$ with the usual properties, such as $\infty \notin \text{TIME}$, and for all $\tau \in \text{TIME} \cup \{\infty\}$: $\tau \leq \infty$, $\tau + \infty = \infty + \tau = \infty$, etc.
A computation of a program is represented by a mapping which assigns to each point of time during this computation a pair consisting of a state and a set of communication records. The state represents the values of the program variables at that point of time.
Definition 3.1 (States) The set of states $\text{STATE}$ is defined as the set of mappings from $\text{VAR}$ to $\text{VAL}$: $\text{STATE} = \{s | s : \text{VAR} \rightarrow \text{VAL} \}$.
Thus a state $s \in \text{STATE}$ assigns to each program variable $x$ a value $s(x)$.
Communication records denote the state of affairs on the channels of the program. To denote the real-time communication behaviour, we use records of the form $(c, \theta)$, indicating a communication along channel $c$ with value $\theta$.
Definition 3.2 (Communication Records) $\text{COMM} = \{(c, \theta) | c \in \text{CHAN}$ and $\theta \in \text{VAL} \}$.
In addition to the communications at any point of time, the model includes information about those processes waiting to send or waiting to receive messages.
on their channels at any given time. We use wait-records of the form $c!$ and $c?$ to indicate that a process is, respectively, waiting to send or waiting to receive a value on channel $c$. Using this information, the formalism enforces minimal waiting in our maximal parallelism model by requiring that no pair of processes is ever simultaneously waiting to send and waiting to receive.
Definition 3.3 (Wait Records)
$\text{WAIT} = \{c! \mid c \in \text{CHAN}\} \cup \{c? \mid c \in \text{CHAN}\}$.
Let $[\tau_0, \tau_1]$ denote a closed interval of time points; $[\tau_0, \tau_1] = \{\tau \in \text{TIME} \mid \tau_0 \leq \tau \leq \tau_1\}$. Then a model, representing a real-time computation of a program, is defined as follows:
Definition 3.4 (Model) Let $\tau_0 \in \text{TIME}$, $\tau_1 \in \text{TIME} \cup \{\infty\}$, and $\tau_1 \geq \tau_0$. A model $\sigma$ is a mapping $\sigma : [\tau_0, \tau_1] \rightarrow \text{STATE} \times \text{COMM} \cup \text{WAIT}$.
Definition 3.5 (Begin/End) For a model $\sigma$ with domain $[\tau_0, \tau_1]$, define $\text{begin}(\sigma) = \tau_0$ and $\text{end}(\sigma) = \tau_1$.
Consider a model $\sigma$ and a point $\tau$ with $\text{begin}(\sigma) \leq \tau \leq \text{end}(\sigma)$. Then $\sigma(\tau) = (\text{state}, \text{comm})$ with $\text{state} \in \text{STATE}$, and $\text{comm} \subseteq \text{COMM} \cup \text{WAIT}$. Henceforth we refer to the two fields of $\sigma(\tau)$ by $\sigma(\tau).\text{state}$ and $\sigma(\tau).\text{comm}$, respectively. Informally, if $\sigma$ models a computation of a program $S$, $\text{begin}(\sigma)$ and $\text{end}(\sigma)$ denote, respectively, the starting time and the termination time of this computation of $S$ ($\text{end}(\sigma) = \infty$ if $S$ does not terminate). Furthermore, $\sigma(\text{begin}(\sigma)).\text{state}$ specifies the initial state of the computation, and if $\text{end}(\sigma) < \infty$ then $\sigma(\text{end}(\sigma)).\text{state}$ gives the final state. In general, $\sigma(\tau).\text{state}$ represents the values of program variables at time $\tau$. For a channel name $c$, the set $\sigma(\tau).\text{comm}$ might contain a communication record $(c, \vartheta)$ or a wait record of the form $c!$ or $c?$ with the following meaning:
- $(c, \vartheta) \in \sigma(\tau).\text{comm}$ if the value $\vartheta$ is transmitted along channel $c$ at time $\tau$;
- $c! \in \sigma(\tau).\text{comm}$ if $S$ is waiting to send along channel $c$ at time $\tau$;
- $c? \in \sigma(\tau).\text{comm}$ if $S$ is waiting to receive along channel $c$ at time $\tau$.
The field $\sigma(\text{end}(\sigma)).\text{comm}$ will have arbitrary values in the definition of the semantics: the last pair $(\text{state}, \text{comm})$ is only used to denote the final state.
In [13] we define a semantic function $\mathcal{M}$ which assigns to each statement $S$ of the programming language a set of models $\mathcal{M}(S)$ such that each model $\sigma$ in $\mathcal{M}(S)$ represents a possible computation of $S$ starting at any arbitrary time. Here intuition about $\mathcal{M}$ should suffice to motivate the proof system in Section 5.
4 Specifications
To specify functional and timing properties of programs, we use an assertion language which is a real-time extension of temporal logic. In accordance with the semantic model from the previous section, one can refer in our logic at each point of time to the following primitives:
- $z$ to denote the value of program variable $z$.
- $\text{comm}(c, \text{exp})$ to express a communication with value $\text{exp}$ along channel $c$. We also use $\text{comm}(c)$ to abstract from the value communicated.
- $\text{wait}(c!)$ and $\text{wait}(c?)$ to denote that a process is, respectively, waiting to send and waiting to receive along channel $c$.
As already mentioned in the introduction, our assertion language is real-time version of temporal logic. Traditional linear time temporal logic [10] has been shown to be valuable in the specification and verification of non-real-time systems. It allows the expression of safety and liveness properties by means of a qualitative notion of time. For instance, for assertions $\varphi$, $\varphi_1$, and $\varphi_2$, this logic contains
- $\Box \varphi$: henceforth $\varphi$ will hold.
- $\Diamond \varphi$: eventually $\varphi$ will hold.
- $\varphi_1 \lor \varphi_2$ (strong until): eventually $\varphi_2$ will hold and until that point $\varphi_1$ holds continuously.
- $\varphi_1 \land \varphi_2$ (weak until or unless): either eventually $\varphi_2$ will hold and until that point $\varphi_1$ holds continuously, or $\varphi_1$ holds henceforth (in which case $\varphi_2$ need never hold).
Furthermore, we have the usual logical connectives such as $\varphi_1 \lor \varphi_2$, $\neg \varphi$, $\varphi_1 \land \varphi_2$, and $\varphi_1 \rightarrow \varphi_2$. To give compositional proof rules for sequential composition and iteration, we add the "chop" operator $\mathcal{C}$ and the "iterated chop" operator $\mathcal{C}^*$. Similar operators have been defined in [1] to give a compositional proof system for temporal logic specifications without real-time.
To specify real-time constraints a quantitative notion of time has to be introduced. In our approach the logic is extended with a special variable $T$ which explicitly refers to the value of a global clock. Intuitively, $T$ refers to the current point of time during execution. Furthermore, we use the special variables
- $\text{start}$ to express the starting time of a computation and
- $\text{term}$ to express the termination time of a computation ($\text{term} = \infty$ for a non-terminating computation).
In addition to program variables, specifications may also use so-called logical variables which are not affected by program execution. These logical variables can be used to "freeze" the value of a variable at a certain point. E.g., using logical variable \(v\), we can express that eventually \(x\) will be incremented by 1:
\[ x := x + 1 \text{ sat } x = v \rightarrow \Box (x = v + 1) \]
The interpretation of the logic is defined using the computational model of Section 3. To interpret logical variables we use a logical variable environment \(\gamma\), that is a mapping which assigns a value to each logical variable. First we define the value of an expression \(exp\) from the logic in a model \(\sigma\) at time \(\tau \geq \text{begin}(\sigma)\) and in an environment \(\gamma\), denoted by \(\forall(\exp)\gamma(\sigma, \tau)\).
A few cases from this definition:
- \(\forall(v)\gamma(\sigma, \tau) = \gamma(v)\)
- \(\forall(\log)\gamma(\sigma, \tau) = \begin{cases} \sigma(\tau).\text{state}(x) & \text{if } \tau \leq \text{end}(\sigma) \\ \sigma(\text{end}(\sigma)).\text{state}(x) & \text{if } \tau > \text{end}(\sigma) \end{cases}\)
- \(\forall(T)\gamma(\sigma, \tau) = \tau\)
- \(\forall(\text{start})\gamma(\sigma, \tau) = \text{begin}(\sigma)\)
- \(\forall(\text{term})\gamma(\sigma, \tau) = \text{end}(\sigma)\)
The interpretation of an assertion \(\varphi\) at time \(\tau \geq \text{begin}(\sigma)\) in a model \(\sigma\) and an environment \(\gamma\) is denoted by \((\sigma, \tau)\gamma \models \varphi\) and defined by induction on the structure of \(\varphi\). We give the main clauses:
- \((\sigma, \tau)\gamma \models \exp_1 = \exp_2\) iff \(\forall(\exp_1)\gamma(\sigma, \tau) = \forall(\exp_2)\gamma(\sigma, \tau)\)
- \((\sigma, \tau)\gamma \models \text{comm}(c, \exp)\) iff \(\tau < \text{end}(\sigma)\) and \((c, \forall(\exp)\gamma(\sigma, \tau)) \in \sigma(\tau).\text{comm}\)
- \((\sigma, \tau)\gamma \models \text{comm}(c)\) iff there exists a value \(d \in \text{VAL}\) such that \((\sigma, \tau)\gamma \models \text{comm}(c, d)\).
- \((\sigma, \tau)\gamma \models \text{wait}(c!c)\) iff \(\tau < \text{end}(\sigma)\) and \(c! \in \sigma(\tau).\text{comm}\)
- \((\sigma, \tau)\gamma \models \text{wait}(c?)\) iff \(\tau < \text{end}(\sigma)\) and \(c? \in \sigma(\tau).\text{comm}\)
- \((\sigma, \tau)\gamma \models \varphi_1 \lor \varphi_2\) iff there exists a \(\tau_1 \geq \tau\) such that \((\sigma, \tau_1)\gamma \models \varphi_2\), and for all \(\tau_1 \leq \tau \leq \tau_2: (\sigma, \tau)\gamma \models \varphi_1\)
- \((\sigma, \tau)\gamma \models \varphi_1 \land \varphi_2\) iff \(\sigma\) can be split into models \(\sigma_1\) and \(\sigma_2\) with \(\text{end}(\sigma_1) = \text{begin}(\sigma_2) \geq \tau\), \((\sigma_1, \tau)\gamma \models \varphi_1\), \((\sigma_2, \text{begin}(\sigma_2))\gamma \models \varphi_2\), and \(\sigma(\text{end}(\sigma_1)).\text{state} = \sigma_2(\text{begin}(\sigma_2)).\text{state}\).
- \((\sigma, \tau)\gamma \models \varphi_1 \implies \varphi_2\) iff either \(\sigma\) can be split up into a finite sequence of models such that the last one satisfies \(\varphi_2\), and all others satisfy \(\varphi_1\), or \(\sigma\) can be split up into an infinite sequence of models each satisfying \(\varphi_1\).
In the proof system we will frequently use the following abbreviation. For a finite set \(c\) set of channels and directional channels, define
\[
\text{empty}(c) \equiv \bigwedge_{c \in c\text{ set}} \neg\text{comm}(c) \land \\
\bigwedge_{c \in c\text{ set}} \neg\text{wait}(c)\]
As usual, we have \(\Box \varphi \equiv \text{true} \lor \varphi, \Box \varphi \equiv \neg \Box \neg \varphi\), and \(\varphi \cup \varphi_2 \equiv (\varphi_1 \cup \varphi_2) \lor \Box \varphi_1\).
Let \(\text{dch}(\varphi)\) denote the set of all \(c\), \(c!\), or \(c?\) occurring in \(\varphi\), and \(\text{var}(\varphi)\) denote the set of all program variables in \(\varphi\).
**Definition 4.1 (Valid Assertion)** An assertion \(\varphi\) is valid, denoted by \(\models \varphi\), iff \((\sigma, \text{begin}(\sigma))\gamma \models \varphi\) for any model \(\sigma\) and any environment \(\gamma\).
**Definition 4.2 (Satisfaction)** Program \(S\) satisfies assertion \(\varphi\), denoted by \(\models S \text{ sat } \varphi\), iff \((\sigma, \text{begin}(\sigma))\gamma \models \varphi\) for any \(\sigma \in \mathcal{M}(S)\) and \(\gamma\).
Finally we give a few simple examples to illustrate our assertion language. General safety properties can be specified, e.g.,
- Program \(S\) does not terminate: \(S\text{ sat term} = \infty\).
- \(S\) does not perform any communication along channel \(c\): \(S\text{ sat } \Box \neg \text{comm}(c)\).
A few examples of real-time safety properties:
- If \(S\) starts its execution with \(x = 3\) then \(S\) terminates within 6 time units in a state where \(x\) has the value 4:
\(S\text{ sat } x = 3 \rightarrow (\text{term} < 6 \land x = 4)\).
- If \(S\) communicates on \(c\) then \(S\) is waiting to receive or communicating on channel \(d\) within 25 time units:
\(S\text{ sat } \Box (T = t \land \text{comm}(c) \rightarrow (T \leq t + 5 \land (\text{wait}(d!c) \lor \text{comm}(d))))\).
Note that logical variable \(t\) is implicitly universally quantified.
- During the execution of \(S\), the program variable \(x\) has value 5 at 3 time units after the start of the execution, after 5 time units \(x\) has value 8 and \(y\) has value 9, and finally after 7 time units program \(S\) terminates with \(x = 10\) and \(y = 12\):
\(S\text{ sat } \Box (T = t + 3 \rightarrow x = 5) \land \\
(T = t + 5 \rightarrow x = 8 \land y = 9) \land \\
(T = t + 7 \rightarrow x = 10 \land y = 12) \land \\
\text{term} = \text{start} + 7)\).
Liveness properties can also be expressed:
- \(S\) terminates: \(S\text{ sat } \text{term} < \infty\).
- \(S\) has property \(T\): \(S\text{ sat } T = \text{term}\).
- \(S\) either communicates along channel \(c\) infinitely often or eventually it waits forever to send on \(c\):
\(S\text{ sat } \Box \Box \text{comm}(c) \lor (\Box \Box \text{wait}(c))\).
5 Proof System
In this section, we give a compositional proof system for our correctness formulas. General well-formedness properties of the semantic model are axiomatized by the following axiom, for any channel c,
Axiom 5.1 (Well-Formedness)
\[ S \text{ sat } \Box (MW_c \land Ezcl_c \land Uniq_c) \]
with
\[ MW_c \equiv \neg (\text{wait}(c) \land \text{wait}(c^!)) \]
(Minimal waiting: It is not possible to be simultaneously waiting to send and waiting to receive on c.)
\[ Ezcl_c \equiv \neg (\text{comm}(c) \land \text{wait}(c)) \land \neg (\text{comm}(c) \land \text{wait}(c^!)) \]
(Exclusion: It is not possible to be simultaneously transmitting and waiting to transmit on channel c.)
\[ Uniq_c \equiv \text{comm}(c, exp_1) \land \text{comm}(c, exp_2) \]
(Uniqueness: At most one value is transmitted on channel c at any point of time.)
The next general axiom expresses that a program does not (try to) communicate on channels that do not syntactically occur in the program.
Axiom 5.2 (Communication Invariance)
\[ S \text{ sat } \Box \text{empty}(cset) \]
provided \( cset \cap dch(S) = \emptyset. \)
Similarly, the proof system has an axiom to express that certain program variables are not changed by a program. Let \( wvar(S) \) be the set of all write-variables of \( S \), that is, the set of variables occurring in the left-hand side of an assignment or as a variable in an input statement. Obviously, \( wvar(S) \subseteq vvar(S). \)
Axiom 5.3 (Variable Invariance)
\[ S \text{ sat } x = v \rightarrow \Box x = v \]
provided \( x \notin wvar(S). \)
Rule 5.4 (Conjunction)
\[ S \text{ sat } \varphi_1, S \text{ sat } \varphi_2 \]
\[ S \text{ sat } \varphi_1 \land \varphi_2 \]
Rule 5.5 (Consequence)
\[ S \text{ sat } \varphi_1, \varphi_1 \rightarrow \varphi_2 \]
\[ S \text{ sat } \varphi_2 \]
Statement skip terminates immediately.
Axiom 5.6 (Skip)
\[ \text{skip sat term } = \text{start} \]
The assignment axiom expresses that \( z := e \) terminates after \( K_c \) time units and that the final value of \( z \) equals the value of \( e \) in the initial state. If \( z \) occurs in the expression \( e \), the initial value of \( z \) is needed to evaluate the value of \( e \). This value is recorded by a logical variable \( v \). We use \( e[v/z] \) to denote the substitution of each occurrence of \( z \) in \( e \) by \( v \).
Axiom 5.7 (Assignment)
\[ z := e \text{ sat } x = v \rightarrow \]
\[ (x = v \cup T = \text{term } = \text{start } + K_c \land z = e[v/z]) \]
Example 5.1 We show that we can derive
\[ x := y + 4 \text{ sat } \]
\[ y = 5 \rightarrow \diamond (z = 9 \land T = \text{term } = \text{start } + K_c). \]
By the Assignment Axiom and the Consequence Rule we obtain
\[ x := y + 4 \text{ sat } \]
\[ x = v \rightarrow \diamond (z = y + 4 \land T = \text{term } = \text{start } + K_c). \]
Since \( v \) does not occur in the consequence of this implication, we can substitute \( x \) for \( v \).
By the Consequence Rule, this leads to
\[ x := y + 4 \text{ sat } \]
\[ y = v \rightarrow \diamond (z = y + 4 \land T = \text{term } = \text{start } + K_c). \]
Since \( y \notin wvar(x := y + 4) \), we can derive from the Variable Invariance Axiom
\[ x := y + 4 \text{ sat } \]
\[ y = v \rightarrow \diamond y = v. \]
Hence, by Conjunction and Consequence,
\[ x := y + 4 \text{ sat } \]
\[ y = v \rightarrow \diamond (z = y + 4 \land T = \text{term } = \text{start } + K_c). \]
Statement delay \( e \) terminates after \( c \) time units.
Axiom 5.8 (Delay)
\[ \text{delay } e \text{ sat term } = \text{start } + e \]
An output statement starts waiting to send a message, and as soon as a communication partner is available the communication takes place during \( K_c \) time units.
Axiom 5.9 (Output)
\[ c!e \text{ sat } \text{wait}(c!) \cup \]
\[ (T = \text{term } = K_c \land (\text{comm}(c, e) \cup T = \text{term})) \]
An input statement \( c?!z \) waits to receive a value on the channel \( c \). When the communication takes place the value received is assigned to variable \( z \).
Axiom 5.10 (Input)
\[ c?!z \text{ sat } x = v \rightarrow [(x = v \land \text{wait}(c!)) \cup \]
\[ (T = \text{term } = K_c \land (\text{comm}(c, e) \cup T = \text{term}) \]
\[ \land (z = v_1 \rightarrow \Box (z = v_1)))] \]
115
Using the \( C \) operator we can easily formulate an inference rule for sequential composition.
**Rule 5.11 (Sequential Composition Rule)**
\[
\frac{S_1 \text{ sat } \varphi_1, S_2 \text{ sat } \varphi_2}{S_1 ; S_2 \text{ sat } \varphi_1 \land \varphi_2}
\]
**Example 5.2** Consider \( x := x + 1; \), \( z := x + 2 \). By the Assignment Axiom and Consequence we can derive:
\[
x := x + 1 \text{ sat } \text{term} = \text{start} + K_a \land \text{delay } e \rightarrow S \land z = v \rightarrow \text{term} = (\text{start} + K_a - x = v + 1) \land z = v \rightarrow \text{term}.
\]
Then the Sequential Composition Rule and the Consequence Rule lead to:
\[
x := x + 1; \text{sat } \text{term} = \text{start} + 2 \times K_a \land z = v \rightarrow \text{term} = (\text{start} + K_a - x = v + 1) \land z = v \rightarrow \text{term} = (\text{start} + 2 \times K_a - x = v + 3).
\]
Now consider a guarded command \( G \). Define \( b_G \) by
\[
b_G \equiv \bigvee_{i=1}^n b_i \text{ if } G \equiv \left[ \left[ \bigwedge_{i=1}^n b_i \right] \rightarrow S_i \right] \text{ and } n \geq 1
\]
\[
b_G \equiv \bigvee_{i=1}^n b_i \lor b \text{ if } G \equiv \left[ \left[ \bigwedge_{i=1}^n b_i \right] \lor b \rightarrow S_i \right] \text{ and } n \geq 1
\]
Define \( \text{Quiet} \equiv \bigwedge_{y \in \text{var}(G)} y = v \land \text{empty}(\text{dch}(G)) \).
First we give an axiom which expresses that there is no activity on the channels of \( G \) and no variable of \( G \) is changed during the evaluation of the guards. Furthermore we express that if none of the boolean evaluates to true then the guarded command terminates after \( K_a \) time units.
**Axiom 5.12 (Evaluation)**
\[
G \text{ sat } \bigwedge_{y \in \text{var}(G)} y = v \rightarrow
\]
\[
(\text{Quiet} \land (T = \text{start} + K_a \land \bigwedge_{y \in \text{var}(G)} y = v)) \land
\]
\[
(-b_G \rightarrow \text{term} = \text{start} + K_a)
\]
Consider \( G \equiv \left[ \left[ \bigwedge_{i=1}^n b_i \right] \rightarrow S_i \right] \). If at least one of the boolean yields true then after the evaluation of the boolean one of the statements \( S_i \) for which \( b_i \) evaluates to true is executed. In the rule we use
**Rule 5.13 (Purely Boolean Guards)**
\[
S_i \text{ sat } \varphi_i, \text{ for } i = 1, \ldots, n
\]
\[
\frac{\bigwedge_{i=1}^n b_i \rightarrow S_i \text{ sat } b_G \rightarrow \text{Choice}}{\bigwedge_{i=1}^n b_i \rightarrow S_i}
\]
Next we formulate a rule for
\[
G \equiv \left[ \left[ \bigwedge_{i=1}^n b_i \right] ; c_i := x_i \rightarrow S_i \right] \lor b \rightarrow S_i \text{ sat } b_G \rightarrow \text{Choice}
\]
\[
\text{Wait} \equiv \bigwedge_{y \in \text{var}(G)} y = v \land \text{empty}(\text{dch}(G) \lor (c_1, \ldots, c_n)) \land
\]
\[
(b \rightarrow T < \text{start} + e) \land \bigwedge_{i=1}^n (b_i \rightarrow \text{wait}(c_i))
\]
\[
\text{InTime} \equiv \bigwedge_{y \in \text{var}(G)} y = v \land T = \text{term} \land
\]
\[
(b \rightarrow T < \text{start} + e),
\]
\[
\text{EndTime} \equiv \bigwedge_{y \in \text{var}(G)} y = v \land b \land T = \text{term} = \text{start} + e,
\]
\[
\text{Eval} \equiv \text{term} = \text{start} + K_a,
\]
\[
\text{Comm} \equiv (\text{Wait} \lor \text{InTime}) \lor \bigwedge_{i=1}^n b_i \land \varphi_i \land \text{comm}(c_i),
\]
\[
\text{TimeOut} \equiv (\text{Wait} \lor \text{EndTime}) \lor \varphi.
\]
**Rule 5.14 (IO-guards)**
\[
c_i?x_i; S_i \text{ sat } \varphi_i, \text{ for } i = 1, \ldots, n, S \text{ sat } \varphi \]
\[
\frac{\bigwedge_{i=1}^n b_i; c_i?x_i \rightarrow S_i \lor b; \text{delay } e \rightarrow S \text{ sat }}{\bigwedge_{y \in \text{var}(G)} y = v \land b_G \rightarrow \text{Eval} \lor \text{Comm} \lor \text{TimeOut}}
\]
For an iterated guarded command we have
**Rule 5.15 (Iteration)**
\[
G \text{ sat } \varphi
\]
\[
\sum_{G} \text{ sat } (b_G \land \varphi) C \land \neg(b_G \land \varphi)
\]
For parallel composition, we first consider the following simple rule.
**Rule 5.16 (Simple Parallel Composition)**
\[
S_1 \text{ sat } \varphi_1, S_2 \text{ sat } \varphi_2
\]
\[
\frac{\text{neither } \varphi_1 \text{ nor } \varphi_2 \text{ contains term }}{S_1 \parallel S_2 \text{ sat } \varphi_1 \land \varphi_2}
\]
provided \( \text{dch}(\varphi_i) \subseteq \text{dch}(S_i) \) and \( \text{var}(\varphi_i) \subseteq \text{var}(S_i) \), for \( i = 1, 2 \).
If \( \text{term} \) occurs in the assertions then we have to take into account that the termination times of \( S_1 \) and \( S_2 \) are, in general, different. Observe that if \( S_1 \) terminates after (or at the same time as) \( S_2 \) then the model representing this computation satisfies \( \varphi_1 \land (\varphi_2 C \text{ (true U done)}) \). Furthermore we have to express that the variables of \( S_2 \) are not changed and there is no activity on the channels of \( S_2 \) after the termination of \( S_2 \). Similarly, for \( S_1 \) and \( S_2 \) interchanged.
Therefore, for \( \text{vset} \subseteq \text{VAR} \), define
\[
\text{inv} \left( \text{vset} \right) \equiv \bigwedge_{y \in \text{var}(G)} y = v \land T < \text{start} + e
\]
\[
\text{psi} \equiv \text{inv}(\text{var}(S_2)) \land \text{empty}(\text{dch}(S_2)) \lor (T = \text{term})
\]
\[
\text{psi} \equiv \text{inv}(\text{var}(S_1)) \land \text{empty}(\text{dch}(S_1)) \lor (T = \text{term})
\]
This leads to a general rule for parallel composition:
**Rule 5.17 (Parallel Composition)**
\[
S_1 \text{ sat } \varphi_1, S_2 \text{ sat } \varphi_2
\]
\[
\frac{S_1 \parallel S_2 \text{ sat } (\varphi_1 \land (\varphi_2 C \text{psi})) \lor (\varphi_2 \land (\varphi_1 C \text{psi}))}{S_1 \parallel S_2 \text{ sat } \varphi_1 \land \varphi_2}
\]
provided \( \text{dch}(\varphi_i) \subseteq \text{dch}(S_i) \) and \( \text{var}(\varphi_i) \subseteq \text{var}(S_i) \), for \( i = 1, 2 \).
In [13] we have proved the soundness of our proof system, that is, every formula \( S \text{ sat } \varphi \) which can be proved in our proof system is valid. Furthermore we have established relative completeness, that is, if valid formulas from our assertion language can be proved, then any valid formula \( S \text{ sat } \varphi \) can also be derived in our axiomatic system.
6 Conclusion
We have formulated a sound and relatively complete proof system to verify that a program satisfies a specification written in a version of explicit clock temporal logic. Important is that our axiomatization is compositional, and hence allows us to reduce the complexity of the verification problem. In contrast with for instance [11], we have not required a discrete time domain. Often a dense time domain is convenient, since it allows events to be arbitrary close to each other in time. This is important when reactive systems are modeled. Moreover, by having dense time we can easily reason about the timing of atomic actions on one level of abstraction and their refinement into several actions on a lower, more concrete, level.
A close look at the development of the theory reveals that this choice is orthogonal to the rest of the theory. Therefore, should for other reasons, e.g., efficient automatic verification, a discrete domain appear more attractive, then this can be substituted without causing changes to the theory elsewhere.
As mentioned in the introduction, the proof system from this paper is closely related to the compositional axiomatization given in [7]. We feel that after the present exposition we may expand a little more on the relation to that paper. Apart from the use of a simpler programming language without program variables, the main difference is that a quantitative treatment of time is obtained by the addition of explicit bounds to the modal operators. Observe that \( \varphi_1 \mathcal{U} \tau \varphi_2 \) in metric temporal logic is equivalent to \( T = t \land (\varphi_1 \mathcal{U}(T < t + \tau \land \varphi_2)) \) in explicit clock temporal logic. From this translation it becomes clear that in MTL all timing properties are specified relative to a starting point, whereas explicit clock temporal logic directly refers to the value of the clock. In future work we will address the precise relation between these two approaches and investigate, by means of examples, which version is most applicable for specific applications.
References
|
{"Source-Url": "https://pure.tue.nl/ws/files/1977242/42359470818579.pdf", "len_cl100k_base": 11398, "olmocr-version": "0.1.53", "pdf-total-pages": 9, "total-fallback-pages": 0, "total-input-tokens": 35260, "total-output-tokens": 13333, "length": "2e13", "weborganizer": {"__label__adult": 0.00043654441833496094, "__label__art_design": 0.0005216598510742188, "__label__crime_law": 0.0006318092346191406, "__label__education_jobs": 0.0010585784912109375, "__label__entertainment": 0.00011801719665527344, "__label__fashion_beauty": 0.00020372867584228516, "__label__finance_business": 0.00041961669921875, "__label__food_dining": 0.0005474090576171875, "__label__games": 0.0009131431579589844, "__label__hardware": 0.0014324188232421875, "__label__health": 0.001140594482421875, "__label__history": 0.00036406517028808594, "__label__home_hobbies": 0.00016760826110839844, "__label__industrial": 0.0007944107055664062, "__label__literature": 0.0004737377166748047, "__label__politics": 0.00044846534729003906, "__label__religion": 0.0007100105285644531, "__label__science_tech": 0.1575927734375, "__label__social_life": 0.00012433528900146484, "__label__software": 0.0074005126953125, "__label__software_dev": 0.82275390625, "__label__sports_fitness": 0.00037169456481933594, "__label__transportation": 0.00099945068359375, "__label__travel": 0.0002512931823730469}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42996, 0.02324]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42996, 0.47271]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42996, 0.81894]], "google_gemma-3-12b-it_contains_pii": [[0, 2326, false], [2326, 6003, null], [6003, 11185, null], [11185, 16481, null], [16481, 22187, null], [22187, 28321, null], [28321, 32638, null], [32638, 38493, null], [38493, 42996, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2326, true], [2326, 6003, null], [6003, 11185, null], [11185, 16481, null], [16481, 22187, null], [22187, 28321, null], [28321, 32638, null], [32638, 38493, null], [38493, 42996, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42996, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42996, null]], "pdf_page_numbers": [[0, 2326, 1], [2326, 6003, 2], [6003, 11185, 3], [11185, 16481, 4], [16481, 22187, 5], [22187, 28321, 6], [28321, 32638, 7], [32638, 38493, 8], [38493, 42996, 9]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42996, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
9eb2fc0544d5ce87b474ba1b6ecc71a3ed35b251
|
[REMOVED]
|
{"Source-Url": "https://www.mais.informatik.tu-darmstadt.de/WebBibPHP/papers/2018/2018-FPS-DantasHamannMantel.pdf", "len_cl100k_base": 8719, "olmocr-version": "0.1.53", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 39240, "total-output-tokens": 10268, "length": "2e13", "weborganizer": {"__label__adult": 0.0005369186401367188, "__label__art_design": 0.0003948211669921875, "__label__crime_law": 0.0014982223510742188, "__label__education_jobs": 0.0006093978881835938, "__label__entertainment": 0.00011473894119262697, "__label__fashion_beauty": 0.00020003318786621096, "__label__finance_business": 0.0002913475036621094, "__label__food_dining": 0.00041866302490234375, "__label__games": 0.0014734268188476562, "__label__hardware": 0.0017223358154296875, "__label__health": 0.0008444786071777344, "__label__history": 0.0003964900970458984, "__label__home_hobbies": 0.00010836124420166016, "__label__industrial": 0.0006785392761230469, "__label__literature": 0.0003693103790283203, "__label__politics": 0.0004854202270507813, "__label__religion": 0.0005431175231933594, "__label__science_tech": 0.12744140625, "__label__social_life": 0.00010728836059570312, "__label__software": 0.0128936767578125, "__label__software_dev": 0.84765625, "__label__sports_fitness": 0.0004193782806396485, "__label__transportation": 0.000652313232421875, "__label__travel": 0.0002334117889404297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 44820, 0.07267]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 44820, 0.15109]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 44820, 0.90451]], "google_gemma-3-12b-it_contains_pii": [[0, 2695, false], [2695, 6241, null], [6241, 8993, null], [8993, 12539, null], [12539, 15076, null], [15076, 18293, null], [18293, 20214, null], [20214, 23190, null], [23190, 26385, null], [26385, 28710, null], [28710, 31428, null], [31428, 33148, null], [33148, 36320, null], [36320, 38390, null], [38390, 41764, null], [41764, 44820, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2695, true], [2695, 6241, null], [6241, 8993, null], [8993, 12539, null], [12539, 15076, null], [15076, 18293, null], [18293, 20214, null], [20214, 23190, null], [23190, 26385, null], [26385, 28710, null], [28710, 31428, null], [31428, 33148, null], [33148, 36320, null], [36320, 38390, null], [38390, 41764, null], [41764, 44820, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 44820, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 44820, null]], "pdf_page_numbers": [[0, 2695, 1], [2695, 6241, 2], [6241, 8993, 3], [8993, 12539, 4], [12539, 15076, 5], [15076, 18293, 6], [18293, 20214, 7], [20214, 23190, 8], [23190, 26385, 9], [26385, 28710, 10], [28710, 31428, 11], [31428, 33148, 12], [33148, 36320, 13], [36320, 38390, 14], [38390, 41764, 15], [41764, 44820, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 44820, 0.04278]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
bcc034b32a57ed20ef5524417b4687b2f817e51b
|
[REMOVED]
|
{"Source-Url": "http://www.contrib.andrew.cmu.edu/~schaki/publications/NFM-2010.pdf", "len_cl100k_base": 13127, "olmocr-version": "0.1.53", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 51013, "total-output-tokens": 15499, "length": "2e13", "weborganizer": {"__label__adult": 0.0005168914794921875, "__label__art_design": 0.0007271766662597656, "__label__crime_law": 0.0006504058837890625, "__label__education_jobs": 0.005321502685546875, "__label__entertainment": 0.00020956993103027344, "__label__fashion_beauty": 0.00029349327087402344, "__label__finance_business": 0.0004825592041015625, "__label__food_dining": 0.0006136894226074219, "__label__games": 0.0019550323486328125, "__label__hardware": 0.0013751983642578125, "__label__health": 0.0011110305786132812, "__label__history": 0.0005211830139160156, "__label__home_hobbies": 0.0002264976501464844, "__label__industrial": 0.0009479522705078124, "__label__literature": 0.0012569427490234375, "__label__politics": 0.0005550384521484375, "__label__religion": 0.00080108642578125, "__label__science_tech": 0.245849609375, "__label__social_life": 0.0002081394195556641, "__label__software": 0.00962066650390625, "__label__software_dev": 0.72509765625, "__label__sports_fitness": 0.0003666877746582031, "__label__transportation": 0.000957489013671875, "__label__travel": 0.0002484321594238281}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 45628, 0.027]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 45628, 0.6463]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 45628, 0.7873]], "google_gemma-3-12b-it_contains_pii": [[0, 4388, false], [4388, 9972, null], [9972, 14336, null], [14336, 19092, null], [19092, 24650, null], [24650, 29655, null], [29655, 33828, null], [33828, 37728, null], [37728, 41239, null], [41239, 45628, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4388, true], [4388, 9972, null], [9972, 14336, null], [14336, 19092, null], [19092, 24650, null], [24650, 29655, null], [29655, 33828, null], [33828, 37728, null], [37728, 41239, null], [41239, 45628, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 45628, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 45628, null]], "pdf_page_numbers": [[0, 4388, 1], [4388, 9972, 2], [9972, 14336, 3], [14336, 19092, 4], [19092, 24650, 5], [24650, 29655, 6], [29655, 33828, 7], [33828, 37728, 8], [37728, 41239, 9], [41239, 45628, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 45628, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-10
|
2024-12-10
|
7782f39dba072323815bae672679422f24efa6cb
|
Adapting Golog for Composition of Semantic Web Services
Sheila McIlraith
Knowledge Systems Laboratory
Department of Computer Science
Stanford University
Stanford, CA 94305-9020
sam@ksl.stanford.edu
Tran Cao Son
Computer Science Department
New Mexico State University
PO Box 30001, MSC CS
Las Cruces, NM 88003, USA
tson@cs.nmsu.edu
Abstract
Motivated by the problem of automatically composing network accessible services, such as those on the World Wide Web, this paper proposes an approach to building agent technology based on the notion of generic procedures and customizing user constraint. We argue that an augmented version of the logic programming language Golog provides a natural formalism for automatically composing services on the Semantic Web. To this end, we adapt and extend the Golog language to enable programs that are generic, customizable and usable in the context of the Web. Further, we propose logical criteria for these generic procedures that define when they are knowledge self-sufficient and physically self-sufficient. To support information gathering combined with search, we propose a middle-ground Golog interpreter that operates under an assumption of reasonable persistence of certain information. These contributions are realized in our augmentation of a ConGolog interpreter that combines online execution of information-providing Web services with offline simulation of world-altering Web services, to determine a sequence of Web Services for subsequent execution. Our implemented system is currently interacting with services on the Web.
1 INTRODUCTION
Two important trends are emerging in the World Wide Web (WWW). The first is the proliferation of so-called Web Services – self-contained, Web-accessible programs and devices. Familiar examples of Web services include information-gathering services such as the map service at yahoo.com, and world-altering services such as the book-buying service at amazon.com. The second WWW trend is the emergence of the so-called Semantic Web. In contrast to today’s Web, which is designed primarily for human interpretation and use, the Semantic Web is a vision for a future Web that is unambiguously computer-interpretable [2]. This will be realized by marking up Web content, its properties, and its relations, in a reasonably expressive markup language with a well-defined semantics. DAML+OIL, a description-logic based Semantic Web markup language, is one such language [10, 11].
Our interest is in the confluence of Web Services and the Semantic Web. In early work, we outlined a semantic markup for describing the capabilities of Web services, initially in first-order logic and a predecessor to DAML+OIL [19]. This effort evolved into a coalition of researchers from BBN, CMU, Nokia, SRI, Stanford and Yale who are developing a DAML+OIL ontology for Web services, called DAML-S [4]. Several metaphors have proved useful in developing this markup, including viewing Web services as functions with inputs and outputs, and alternatively as primitive and complex actions with (knowledge) preconditions and (knowledge) effects. While DAML-S is not yet complete, two versions of the ontology have been released for public scrutiny [3]. We will return to DAML-S towards the end of the paper.
The provision of, effectively, a knowledge representation of the properties and capabilities of Web services enables the automation of many tasks, as outlined in [19]. In this paper we focus on the task of automated Web service composition (WSC): Given a set of Web services and a description of some task or goal to be achieved (e.g., “Make the travel arrangements for my KR2002 conference trip.”), find a composition of services that achieves the task. Disregarding network issues, WSC can be conceived as either a software synthesis problem, or as a planning and plan execution problem, depending upon how we represent our services. In either case, this application domain has many distinctive features that require and support tailoring. We identify and address many of these features in this paper.
In this paper we conceive WSC as a planning and execution task, where the actions (services) may be complex actions. In related work, we show how to compile service representations into operators that embody all the possible evolutions of a complex action, in order to treat complex actions as primitive action plan operators [18]. As a planning task, WSC is distinguished in that it is planning with very incomplete information. Several sequenced information-gathering services may be required, that culminate in the execution of only a few world-altering services. (Imagine making your travel plans on the Web.) Since our actions (services) are software programs, the input and output parameters of the program act as knowledge preconditions and knowledge effects in a planning context. Software programs can also have side-effects in the world (such as the purchase of a commodity), that are modeled as non-knowledge effects. Service preconditions are regularly limited to knowledge preconditions. Information-gathering services (aka sensors) don’t fail, network issues aside. Exogenous events affect the things being sensed. Persistence of knowledge has a temporal extent associated with it (contrast stock prices to the price of a shirt at the Gap), which affects the sequencing of services. Services often provide multiple outputs, a subset of which must be selected to act as input for a subsequent service (consider picking flights).
Many services perform similar functions, so WSC must choose between several services, each sharing some of the same effects. Also, plans (compositions of services) are often short, so the plan search space is short and broad. WSC tasks may or may not be described in terms of a goal state. In some instances they are described as a set of loosely coupled goals, or constraints. Many plans may satisfy the WSC task. User input and user constraints are key in pruning the space of plans (e.g., choosing from the multitude of available flights) and in distinguishing desirable plans.
The unique features of WSC serve to drive the work presented in this paper. Rather than realizing WSC simply as planning, we argue that a number of the activities a user may wish to perform on the (semantic) WWW or within some networked service environment, can be viewed as customizations of reusable, high-level generic procedures. For example, we all use approximately the same generic procedure to make our travel plans, and this procedure is easily described. Nevertheless, it is difficult to task another person, less a computer, to make your travel plans for you. The problem lies not in the complexity of the procedure, but rather in selecting services and options that meet your individual constraints and preferences. Our vision is to construct reusable, high-level generic procedures, and to archive them in sharable (DAML-S) generic-procedures ontologies so that multiple users can access them. A user could then select a task-specific generic procedure from the ontology and submit it to their agent for execution.
The agent would automatically customize the procedure with respect to the user’s personal or group-inherited constraints, the current state of the world, and available services, to generate and execute a sequence of requests to Web services to perform the task.
We realize this vision by adapting and extending the logic programming language Golog (e.g., [14, 22, 6]). The adaptations and extensions described in the sections to follow are designed to address the following desiderata of our WSC task. **Generic**: We want to build a class of programs that are sufficiently generic to meet the needs of a variety of different users. Thus programs will often have a high degree of nondeterminism to embody the variability desired by different users. **Customizable**: We want our programs to be easily customizable by individual users. **Usable**: We want our programs to be usable by different agents with different a priori knowledge. As a consequence, we need to ensure that the program accesses all the knowledge it needs, or that certain knowledge is stipulated as a prerequisite to executing the program. Similarly, the program ensures the actions it might use are Possible. The programs must be both knowledge and physically self-sufficient.
## 2 ADAPTING GOLOG
Golog (e.g., [14, 8, 6, 22]) is a high-level logic programming language, developed at the University of Toronto, for the specification and execution of complex actions in dynamical domains. It is built on top of the situation calculus (e.g.,[22]), a first-order logical language for reasoning about action and change. Golog was originally developed to operate without considering sensing (aka information-gathering) actions. For Web applications, we rely on a version of Golog built on top of the situation calculus with knowledge and sensing actions (e.g., [24, 22, 6]), which we henceforth refer to simply as the situation calculus.
In the situation calculus [6, 22], the state of the world is described by functions and relations (fluentks) relativized to a situation $s$, e.g., $f(x, s)$. To deal with sensing actions, a special knowledge fluent $K$, whose first argument is also a situation, is introduced. Informally, $K(s’, s)$ holds if the agent is in the situation $s$ but believes (she) might be in $s’$. The function $do(a, s)$ maps a situation $s$ and an action $a$ into a new situation. A situation $s$ is simply a history of the primitive actions performed from an initial, distinguished situation $S_0$. A situation calculus theory $D$ comprises the following sets of axioms (See [22] for details.):
- domain-independent foundational axioms of the situation calculus, $\Sigma$;
- accessibility axioms for $K, \kappa_{init}$.
$\kappa_{init}$
1At this stage, we do not impose any conditions on $K$ such as
successor state axioms, $\mathcal{D}_{SS}$, one for $K$ and one for every domain fluent $F$;
• action precondition axioms, $\mathcal{D}_{ap}$, one for every action $a$ in the domain, that serve to define $\text{Poss}(a, s)$;
• axioms describing the initial situation, $\mathcal{D}_{in}$ (including axioms about $K$);
• unique names axioms for actions, $\mathcal{D}_{una}$;
• domain closure axioms for actions, $\mathcal{D}_{dcA}$.
Golog builds on top of the situation calculus by providing a set of extralogical constructs for assembling primitive actions, defined in the situation calculus, into complex actions that collectively comprise a program, $\delta$. Constructs include the following.
- $a$ — primitive actions
- $\delta_1; \delta_2$ — sequences
- $\phi? - tests$
- $\delta_1 | \delta_2$ — nondeterministic choice of actions
- $(\pi x)\delta(x)$ — nondeterministic choice of arguments
- $\delta^*$ — nondeterministic iteration
- $\text{if } \phi \text{ then } \delta_1 \text{ else } \delta_2 \text{ endif}$ — conditionals
- $\text{while } \phi \text{ do } \delta \text{ endwhile}$ — while loops
Note that the conditional and while-loop constructs are actually defined in terms of other constructs.
$$\text{if } \phi \text{ then } \delta_1 \text{ else } \delta_2 \text{ endif} = [\phi?; \delta_1] \ | \ [\neg \phi?; \delta_2]$$
$$\text{while } \phi \text{ do } \delta \text{ endwhile} = [\phi?; \delta^*]; \neg \phi?$$
These constructs can be used to write programs in the language of a domain theory, e.g.,
\text{if } \text{far then } \text{rentCar}(\text{y}) \text{ else } \text{bookTaxi}(\text{y}) \text{ endif}.
Given a domain theory, $\mathcal{D}$ and Golog program $\delta$, program execution must find a sequence of actions $\alpha$ such that: $\mathcal{D} \models Do(\delta, S_0, \alpha(\bar{a}, S_0))$. $Do(\delta, S_0, \alpha(\bar{a}, S_0))$ denotes that the Golog program $\delta$, starting execution in $S_0$ will legally terminate in situation $\alpha(\bar{a}, S_0)$, where $\alpha(\bar{a}, S_0)$ abbreviates $do(a_n, do(a_{n-1}, \ldots, do(a_1, S_0)))$.
2.1 CUSTOMIZING GOLOG PROGRAMS
In this section we extend Golog to enable individuals to customize a Golog program by specifying personal constraints. To this end, we introduce a new distinguished fluent in the situation calculus called $Desirable(a, s)$, i.e., action $a$ is desirable in situation $s$. We contrast this with $\text{Poss}(a, s)$, i.e. action $a$ is physically possible in situation $s$. We further restrict the cases in which an action is executable by requiring not only that an action $a$ is $\text{Poss}(a, s)$ but further that it is $Desirable(a, s)$. This further constrains that $K$ to be reflexive, symmetric, transitive or Euclidean in the initial situation. (See [22, pg. 302-308].)
The search space for actions when realizing a Golog program. The set of $Desirable$ fluents, one for each action, is referred to as $\mathcal{D}_D$. $Desirable(a, s)$ if true unless otherwise noted.
An individual specifies her personal constraints in our Semantic Web markup language. The constraints are expressed in the situation calculus as necessary conditions for an action $a$ to be desirable, $\mathcal{D}_{PC}$ of the form:
$$Desirable(a, s) \supset \omega_k, \quad (1)$$
and personal constraints, $\mathcal{D}_{PC}$, which are situation calculus formulae, $C$.
For example, Marielle would like to buy an airline ticket from origin $o$ to destination $d$, if the driving time between these two locations is greater than 3 hours. Thus $Desirable(\text{buyAirTicket}(o, d, dt), s) \supset \text{gt(DriveTime(o, d), 3, s)}$ is included in $\mathcal{D}_{PC}$. Similarly, Marielle has specified dates she must be at home and her constraint is not to be away on those dates. Thus, $\mathcal{D}_{PC}$ includes: $\neg (\text{Away(dt, s)} \land \text{MustbeHome(dt, s)})$. Using $\mathcal{D}_{PC}$ and $\mathcal{D}_{DC}$, and exploiting our successor state axioms and domain closure axioms for actions, $\mathcal{D}_{SS}$ and $\mathcal{D}_{dcA}$, we define $Desirable(a, s)$ for every action $a$ as follows:
$$Desirable(A(x), s) \equiv \Omega A \land \bigwedge_{C \in \mathcal{D}_{PC}} \Omega C, \quad (2)$$
where $\Omega A = \omega_1 \lor \ldots \lor \omega_n$, for each $\omega_i$ of (1). E.g.,
$\Omega_{\text{buyAirTicket}} = \text{gt(DriveTime(o, d), 3, s)}$, and
$$\Omega_{PC} \equiv \mathcal{R}[C(do(A(x), s))]$$
where $\mathcal{R}$ is repeated regression rewriting (e.g., [22]) of $C(do(A(x), s))$, the constraints relativized to $do(A(x), s)$, using the successor state axioms, $\mathcal{D}_{SS}$ from $\mathcal{D}$. E.g.,
$$\Omega_{PC} \equiv \mathcal{R}[-(A(\text{Away(dt, do(\text{buyAirTicket}(o, d, dt)), s))) \land \text{MustbeHome(dt, do(\text{buyAirTicket}(o, d, dt), s))}]$$
We rewrite this expression using the successor state axioms for fluents $\text{Away(dt, s)}$ and $\text{MustbeHome(dt, s)}$. E.g.,
$$\text{Away(dt, do(a, s))} \equiv
\begin{align*}
[(a = \text{buyAirTicket}(o, d, dt) \land d \neq \text{Home}) \\
\lor (A(\text{Away(dt, s)} \land
\neg (a = \text{buyAirTicket}(o, d, dt) \land d = \text{Home}))]
\end{align*}$$
$$\text{MustbeHome(dt, do(a, s))} \equiv \text{MustbeHome(dt, s)}$$
From this we determine:
$$Desirable(\text{buyAirTicket}(o, d, dt), s) \equiv
\begin{align*}
\text{gt(DriveTime(o, d), 3, s)} \\
\land (d = \text{Home} \lor \neg \text{MustbeHome(dt, s))}
\end{align*} \quad (3)$$
Having computed $\mathcal{D}_D$, we include it in $\mathcal{D}_D^3$. In addition to computing $\mathcal{D}_D$, the set of $Desirable$ fluents, we also modify the computational semantics of our dialect of Golog.
Henceforth, all reference to $\mathcal{D}$ includes $\mathcal{D}_D$.\footnote{Henceforth, all reference to $\mathcal{D}$ includes $\mathcal{D}_D$.}
In particular, we adopt the computational semantics for Golog. (See [6] for details.) Two predicates are used to define the semantics. \( \text{Trans}(\delta, s, \delta', s') \) is intended to say that the program \( \delta \) in situation \( s \) may legally execute one step, ending in situation \( s' \) with the program \( \delta' \) remaining. \( \text{Final}(\delta, s) \) is intended to say that the program \( \delta \) may legally terminate in situation \( s \). We require one change in the definition to incorporate \( \text{Desirable} \). In particular, (4) is replaced by (5).
\[
\text{Trans}(a, s, \delta', s') \equiv \text{Poss}(a, s) \land \delta' = \text{nil} \land s' = \text{do}(a, s) \tag{4}
\]
\[
\text{Trans}(a, s, \delta', s') \equiv \text{Poss}(a, s) \land \text{Desirable}(a, s) \\
\land \delta' = \text{nil} \land s' = \text{do}(a, s) \tag{5}
\]
We can encode this more compactly by simply defining \( \text{Legal}(a, s) \equiv \text{Poss}(a, s) \land \text{Desirable}(a, s) \), and replacing \( \text{Poss} \) with \( \text{Legal} \) in (4). This approach has many advantages. First it is elaboration tolerant [17]. An individual’s customized \( D_D \) may simply be added to an existing situation calculus axiomatization. If an individual’s constraints change, the affected \( \text{Desirable} \) fluents in \( D_D \) may be elaborated by a simple local rewrite. Further, \( \text{Desirable} \) is easily implemented as an augmentation of most existing Golog interpreters. Finally, it reduces the search space for terminating situations, rather than pruning situations after they have been found. Thus, it has computational advantages over other approaches to determining preferred sequences of actions. Our approach is related to the approach to the qualification problem proposed by Lin and Reiter [15]. There are other types of customizing constraints which we do not address in this paper (e.g., soft and certain temporal constraints). We address these constraints in future work.
2.2 ADDING THE ORDER CONSTRUCT
In the previous subsection we described a way to customize Golog programs by incorporating user constraints. In order for Golog programs to be customizable and generic, they must have some nondeterminism to enable a variety of different choice points to incorporate user’s constraints. Golog’s nondeterministic choice of actions construct (\( \pi \)) and nondeterministic choice of arguments construct (\( \pi(a) \)) both provide for nondeterminism in Golog programs.
In contrast, the sequence construct (\( ; \)) provides no such flexibility, and can be overly constraining. Consider the program: \( \text{buyAirTicket}(\bar{x}); \text{rentCar}(\bar{y}) \). The “;” construct dictates that \( \text{rentCar}(\bar{y}) \) must be performed in the situation resulting from performing \( \text{buyAirTicket}(\bar{x}) \) and that \( \text{Poss}(\text{rentCar}(\bar{y}), \text{do}(\text{buyAirTicket}(\bar{x}), s)) \) must be true, otherwise the program will fail. Imagine that the precondition \( \text{Poss}(\text{rentCar}(\bar{y}), s) \) dictates that the user’s credit card not be over its limit. If \( \text{Poss} \) is not true, we would like for the agent executing the program to have the flexibility to perform a sequence of actions to reduce the credit card balance, in order to achieve this precondition, rather than having the program fail. The sequence construct “;” does not provide for this flexibility.
To enable the insertion of actions in between a sequence of actions, for the purposes of achieving preconditions, we define a new construct called \text{order}, designated by the “;” connective\(^4\). Informally, \( a_1 ; a_2 \) will perform the sequence of action \( a_1 ; a_2 \) whenever \( \text{Poss}(a_2, \text{do}(a_1, s)) \) is true. However, when it is false, the “;” construct dictates that Golog search for a sequence of actions \( \bar{a} \) that achieves \( \text{Poss}(a_2, \text{do}(\bar{a}, \text{do}(a_1, s))) \). This can be achieved by a planner that searches for a sequence of actions \( \bar{a} \) to achieve the goal \( \text{Poss}(a_2, \text{do}(\bar{a}, \text{do}(a_1, s))) \). To simplify this paper, we restrict \( a_2 \) to be a primitive action. The definition is easily extended to an order of complex actions \( \delta_1 ; \delta_2 \). Thus, \( a_1 ; a_2 \) is defined as:
\[
a_1; \text{while} (\neg \text{Poss}(a_2)) \text{ do } (\pi(a)) \text{Poss}(a_2)?; a \text{ endwhile}; a_2
\]
It is easy to see that the while loop will eventually achieve the precondition for \( a_2 \) if it can be achieved.
We extend the computational semantics to include “;”.
\[
\text{Trans}(\delta; a, s, \delta', s') \equiv \\
\text{Trans}(\delta ; \text{achieve}(\text{Poss}(a)); a, s, \delta', s') \tag{6}
\]
\[
\text{Final}(\delta; a, s) \equiv \\
\text{Final}(\delta ; \text{achieve}(\text{Poss}(a)); a, s) \tag{7}
\]
where \( \text{achieve}(G) = \text{while } (\neg G) \text{ do } (\pi(a)) \text{Poss}(a)?; a \text{ endwhile} \). Since \( \text{achieve} \) is defined in terms of existing Golog constructs, the definitions of \( \text{Trans} \) and \( \text{Final} \) follow from previous definitions.
Note that “;” introduces undirected search into the instantiation process of Golog programs and though well-motivated for many programs, should be used with some discretion because of the potential computational overhead. We can improve upon this simplistic specification by a more directed realization of the action selection mechanism used by \( \text{achieve} \) using various planning algorithms.
Also note that the order construct has been presented here independently of the notion of \( \text{Desirable} \), introduced in the previous subsection. It is easy to incorporate the contributions of Section 2.2 by replacing \( \text{achieve}(\text{Poss}(a)) \) with \( \text{achieve}(\text{Legal}(a)) \) in Axioms (6) and (7) above, plus any other deontic notions we may wish to include. Finally note that a variant of the order construct also has utility in expressing narrative as proposed in [21]. We can modify “;” to express that actions \( a_1 \) and \( a_2 \) are ordered, but that it is not necessarily the case that \( a_2 \) occurred in situation \( \text{do}(a_1, s) \).
\(^4\)Created from a combination of existing constructs.
2.3 SELF-SUFFICIENT PROGRAMS
Now that our Golog programs are customizable and can be encoded generically, we wish them to be usable. Sensing actions are used when the agent has incomplete knowledge of the initial state (often true for WSC), or when exogenous actions exist that change the world in ways the agent’s theory of the world does not predict. Web service compositions often have the characteristic of sequences of information-gathering services, performed to distinguish subsequent world-altering services. In our work, we need to define Golog programs that can be used by a variety of different agents without making assumptions about what the agent knows. As such, we want to ensure that our Golog programs are self-sufficient with respect to obtaining the knowledge that they require to execute the program. Further, we wish our programs to ensure that all preconditions for actions the program tries to execute are realized within the program, or are established as an explicit precondition of the program.
To make this concrete, we define the notion of a Golog program $\delta$ being self-sufficient with respect to an action theory $\mathcal{D}$ and kernel initial state, $Init_\delta$. $Init_\delta$ is a formula relativized to (suppressed) situation $s$, denoting the necessary preconditions for executing $\delta$. To characterize self-sufficiency, we introduce the predicate $ssf(\delta, s)$. $ssf(\delta, s)$ is defined inductively over the structure of $\delta$.
$$ssf(nil, s) \equiv true$$
$$ssf(\phi?; s) \equiv KwWhether(\phi, s)$$
$$ssf(a, s) \equiv KwWhether(poss(a, s)) \land KwWhether(Desirable(a, s))$$
$$ssf(\delta_1; \delta_2, s) \equiv ssf(\delta_1, s) \land \forall s'. [Do(\delta_1, s, s') \supset ssf(\delta_2, s')]$$
$$ssf(\forall x. \phi(x), s) \equiv \forall x. ssf(\phi(x), s)$$
$$ssf(\forall x. \phi(x), s) \equiv KwWhether(\phi, s) \land (\phi(s) \supset ssf(\delta_1, s)) \land (\neg \phi(s) \supset ssf(\delta_2, s))$$
$$ssf(\text{while } \phi \text{ do } \delta \text{ endwhile}, s) \equiv KwWhether(\phi, s) \land (\phi(s) \supset ssf(\delta, s) \land \forall s'. [Do(\delta, s, s') \supset ssf(\text{while } \phi \text{ do } \delta \text{ endwhile}, s')])$$
Since "::" is defined in terms of existing constructs, $ssf(\delta_1 : \delta_2, s)$ follows from (8)–(14) above.
---
**Definition 1 (KSSF: Knowledge Self-Sufficient Program)**
$KSSF(\delta, Init_\delta)$. Golog program $\delta$ is knowledge self-sufficient relative to action theory $\mathcal{D}$ and kernel initial state $Init_\delta$ iff $\mathcal{D} \models Init_\delta(S_0)$ and $\mathcal{D} \models ssf(\delta, S_0) \equiv true$.
$KSSF(\delta, Init_\delta)$ ensures that given $Init_\delta$, execution of the Golog program $\delta$ will not fail for lack of knowledge. However, the program may fail because it may be im-$Poss$-ible to perform an action. $KSSF$ ensures that the agent knows whether $Poss$ is true, but not that it actually is true. To further ensure that our generic procedures are physically self-sufficient, we define $PSSF(\delta, Init_\delta)$.
**Definition 2 (PSSF: Physically Self-Sufficient Program)**
$PSSF(\delta, Init_\delta)$. Golog program $\delta$ is physically self-sufficient relative to action theory $\mathcal{D}$ and kernel initial state $Init_\delta$ iff $KSSF(\delta, Init_\delta)$ and $\mathcal{D} \models \exists s'. Do(\delta, S_0, s')$.
**Proposition 1** For every Golog program $\delta$ and associate kernel initial state $Init_\delta$, $PSSF(\delta, Init_\delta) \supset KSSF(\delta, Init_\delta)$.
This follows directly from Definitions 1-2.
Next we discuss how to verify KSSF and PSSF for a common subset of Golog programs.
We call a Golog program $\delta$ loop-free if it does not contain the nondeterministic iteration and while-loop constructs. Note that we may preserve the loop-free nature of our programs, while using these programming constructs by defining a maximum iteration count, or time-out. It follows that.
**Proposition 2** For every loop-free Golog program $(\delta, Init_\delta)$ and associated situation calculus theory $\mathcal{D}$, there exist first-order situation calculus formulae $\phi_\forall$ and $\phi_K$ such that
$$KSSF(\delta, Init_\delta) \equiv \phi_K$$
and $\phi_\forall$ and $\phi_K$ do not mention $ssf$.
The proof is inductive over the structure of $\delta$.
From these propositions, it follows that $PSSF$ and $KSSF$ of loop-free programs, $(\delta, Init_\delta)$ can be verified using regression followed by theorem proving in the initial situation. For programs with potentially unlimited looping, $\phi_K(s)$ and $\phi_\forall(s)$ are not first-order definable, and hence are problematic.
**Proposition 3** Let $\delta$ be a loop-free Golog program, and let $\phi_K$ and $\phi_\forall$ be defined as in Proposition 2. Let $K_{init}$ consist of any subset of the accessibility relations Reflexive, Symmetric, Transitive, Euclidean, then
1. $KSSF(\delta, Init_\delta)$ iff $D_{\omega_\forall} \cup D_{\omega_K} \cup K_{init} \models R[\phi_K]$
2. $PSSF(\delta, Init_\delta)$ iff $D_{\omega_\forall} \cup D_{\omega_K} \cup K_{init} \models R[\phi_\forall]$.
---
$KwWhether(\phi, s)$ abbreviates a formula indicating that the truth value of $\phi$ is known in situation $s$ [24].
This follows directly from Reiter’s regression theorem with knowledge [22].
We wish to highlight the work of Ernie Davis on Knowledge Preconditions for Plans [5], which we became aware of when we first presented s$\phi$ [20]. There are many similarities to our work. One significant difference is that he makes no distinction between (what we distinguish as) knowledge sufficiency and physically sufficiency in his framework, i.e., for a plan to be executable, he requires that the agent has the knowledge to execute it and that it must be physically possible. Further, we construct the s$\phi$ condition from the situation calculus theory for primitive actions that can be regressed over situations and verified in the initial situation. He develops a set of rules that can be used to check for plan executability. The set of rules, is sufficient but not necessary.
3 EXECUTING GOLOG PROGRAMS
Now that we have defined customizable, generic and usable generic procedures for WSC, we must execute them. In building a Golog interpreter that incorporates sensing actions, the interplay between sensing and execution of world-altering actions can be complex and a number of different approaches have been discussed (e.g., [7, 13, 22]). While [7] and [22] advocate the use of an online interpreter to reason with sensing actions, [13] suggests the use of an offline interpreter with conditional plans. The trade-off is clear. An online interpreter is incomplete because no backtracking is allowed, while an offline interpreter is computationally expensive due to the much larger search space, and the need to generate conditional plans, if sensing actions are involved. The choice between an online and offline interpreter depends on properties of the domain, and in particular, since exogenous actions can affect the value of fluents, on the temporal extent of the persistence of the information being sensed. In a robotics domain, an online interpreter is often more appropriate, whereas an offline interpreter is more appropriate for contingency planning.
3.1 MIDDLE-GROUND EXECUTION
We define a middle ground between offline and online execution, which we argue is appropriate for a large class of Semantic Web WSC applications. Our middle-ground interpreter (MG) senses online to collect the relevant information needed in the Golog program, while only simulating the effects of world-altering actions. By executing sensing actions rather than branching and creating a conditional plan, MG reduces search space size, while maintaining the ability to backtrack by merely simulating world-altering actions, initially. The outcome is a sequence of world-altering actions that are subsequently executed.6. Humans often follow this approach, collecting information on the Web (e.g., flight schedules) while only simulating the world-altering actions (buying tickets, etc.) in their head until they have a completed plan to execute.
Of course, the veracity of MG is predicated on an important assumption – that the information being gathered, and upon which world-altering actions are being selected, persists. We assume that the fluents MG is sensing persist for a reasonable period of time, and that none of the actions in the program cause this assumption to be violated. This assumption is generally true of much of the information we access on the Web (e.g., flight schedules, store merchandise), but not all (e.g., stock prices). This assumption is much less pervasive in mobile robotic applications where we may assume persistence for milliseconds, rather than minutes or hours. We formalize this assumption as follows.
Definition 3 (Conditioned-on Fluent) Fluent C is a conditioned-on fluent in Golog program $\delta$ iff $\delta$ contains the Golog construct $\phi?$ and $C$ appears in formula $\phi$.
Recall that the $\phi?$ construct is used to define the conditional (if-then-else) and the while-loop constructs. It is also commonly used within the $\delta$ of $(\pi x)\delta(x)$.
Definition 4 (Invocation and Reasonable Persistence (IRP) Assumption) Golog program and kernel initial state $(\delta, Init_{S})$ adhere to the invocation and reasonable persistence assumption if
1. Non-knowledge preconditions for sensing actions are true in $D_{S_{0}} \cup Init_{S}(S_{0})$.
2. Knowledge of preconditions for actions and conditioned-on fluents $C$ in $\delta$, once established, persists7.
Condition 1 ensures that all sensing actions can be executed by the MG interpreter. Condition 2 ensures that decisions are predicated on correct information. Condition 1 may seem extreme, but, as we argued earlier in this paper, by their nature, Web services generally only have knowledge preconditions. The persistence of knowledge in Condition 2, trivially holds from the frame assumption for knowledge. This condition addresses change by subsequent or exogenous actions.
We claim that under the IRP assumption, MG does the right thing for programs that are physically self-sufficient.
Claim 1 (Veracity of MG) Given an action theory $D$ and
At this stage they can alternately be shown to a human for approval before execution. Our interpreter can also generate and present multiple alternate courses of action.
I.e., no subsequent actions inside or outside the program change the value of sensed fluents.
Golog program $\delta$ such that $\text{PSSF}(\delta, \text{Init}_\delta)$, and $(\delta, \text{Init}_\delta)$ adheres to IRP, let $\bar{\alpha}$ be the sequence of world-altering actions selected by the middle-ground interpreter, MG, for subsequent execution. Assuming no exogenous actions and no sensor errors, it follows that executing $\bar{\alpha}$ yields the same truth value for all fluents $F$ in $\mathcal{D}$ as an online interpreter with an oracle that chooses $\bar{\alpha}$ at the appropriate branch points in its interpretation of $\delta$.
Let $\text{do}(\bar{\alpha}, S_0)$ be the terminating situation, following execution of Golog program $\delta$ with theory $\mathcal{D}$, using the interpreter MG, starting in $S_0$. Then $\mathcal{D} \models \text{Do}(\bar{\alpha}, S_0, \text{do}(\bar{\alpha}, S_0))$, and we denote the sequence of actions $\bar{\alpha}$ by the relation $\text{MG}(\mathcal{D}, \delta, \text{Init}_\delta, \bar{\alpha})$.
$\bar{\alpha}$ is comprised of both sensing actions and world-altering actions (e.g., $[s_1, a_1, a_2, a_3, s_2, a_4]$). Let $\bar{\alpha}_s$ be the sequence of sensing actions in $\bar{\alpha}$ (i.e., $[s_1, s_2]$), and likewise let $\bar{\alpha}_w$ be the sequence of world-altering actions in $\bar{\alpha}$ (i.e., $[a_1, a_2, a_3, a_4]$). MG executes the sensing actions $\bar{\alpha}_s$, interleaved with the simulation of world-altering actions, searching to find the appropriate terminating situation, $\bar{\alpha}$. MG then outputs $\bar{\alpha}$. $\bar{\alpha}_w$, the subsequence of world-altering actions, are extracted from $\bar{\alpha}$ and executed in the world.
**Theorem 1** Given an action theory $\mathcal{D}$ and Golog program $\delta$ such that $\text{PSSF}(\delta, \text{Init}_\delta)$, and $(\delta, \text{Init}_\delta)$ adheres to IRP, suppose $\text{MG}(\mathcal{D}, \delta, \text{Init}_\delta, \bar{\alpha})$ holds for some $\bar{\alpha}$. Assume that there are no sensor errors, and that no exogenous actions affect fluents in $\mathcal{D}$, then for all fluents $F$ in $\mathcal{D}$
$$\mathcal{D} \models F(\bar{\alpha}, \text{do}(\bar{\alpha}_w), \text{do}(\bar{\alpha}_w), S_0) \equiv F(\bar{\alpha}, \text{do}(\bar{\alpha}, S_0)).$$
In cases where the IRP Assumption is at risk of being violated, the full sequence of sensing and world-altering actions generated by MG, $\bar{\alpha}$, could be re-executed with an online execution monitoring system. The system would re-perform sensing actions to verify that critical persistence assumptions were not violated. In the case where the IRP Assumption does not hold for some or all conditioned-on fluents in a Golog program, MG could be integrated with an interpreter that builds conditional plans for branch points that do not adhere to IRP, following the approach proposed in [13]. The explicit encoding of search areas in a program, as proposed by [7] through the addition of their $\Sigma$-search construct, can achieve some of the same functionality as our middle-ground interpreter. Indeed, the principle defined above, together with an annotation of the temporal extent of conditioned-on fluents within the action theory provides a means of automatically generating programs with embedded search operators $\Sigma$, as proposed in [7]. We leave a formal account of this to a future paper.
3.2 MIDDLE-GROUND PROLOG INTERPRETER
In Section 2, we proposed extensions to Golog to enable programs to be generic, customizable and self-sufficient. In Section 3, we proposed a strategy for middle-ground execution that enables an efficient and thorough combination of sensing and search. We have modified the ConGolog offline interpreter in [7, 6] to realize these enhancements. We describe the necessary code modifications in the subsections to follow, and prove the correctness of our implementation. We adopt notational conventions for Prolog code, that differ from those used for theories of action. To avoid confusion, all Prolog code is listed in courier font. Prolog variables are uppercase, and constants are lowercase, contradicting the situation calculus notational convention.
3.2.1 User customizing constraints
Personal constraints were added to the ConGolog interpreter by the following straightforward and elegant modification to the code, that accounts for the addition of the $\text{Desirable}$ predicate. We replaced the following code:
trans(A,S,R,S1) :- primAct(A),
(poss(A,S), R=nil, S1=do(A,S)); fail.
of the ConGolog interpreter with
trans(A,S,R,S1) :- primAct(A),
(poss(A,S), desirable(A,S),
R=nil, S1=do(A,S)); fail.
This ensures that every action selected by the interpreter is also a desirable one.
In Section 3.3, we will show how to encode the $\text{Desirable}(a, s)$ predicate in our Prolog action theory. The domain-independent Prolog rules for the MG interpreter include the following rule to ensure that actions are desirable unless proved otherwise.
$\text{desirable}(A,S):- !+ \text{not_desirable}(A,S)$.
3.2.2 Order Construct
To include the order construct “:”, we added the following rules to our interpreter:
final(P:A, S):-
action(A),
final([P, achieve(poss(A),0),A],S).
trans(P:A,S,R,S1):-
action(A),
trans([P, achieve(poss(A),0),A],S,R,S1).
where $\text{achieve(} ext{Goal,0})$ is an $A^*-$planner, adapted from the so-called World Simplest Breadth First Planner (wsbfp) developed by Reiter [22, pg. 234]. We appeal to its simplicity and the soundness and completeness of the $A^*$ algorithm. Obviously any planner can be used to accomplish this task. We are investigating the effectiveness of other planners.
---
Trivially true of virtually all current-day information-gathering Web services.
3.2.3 Sensing Actions
We incorporate sensing actions and their effects into our interpreter, using an approach that eliminates the need for the situation calculus $K$ fluent. Recently, Soutchanski [25] proposed a somewhat similar transformation, articulating conditions under which his representation was correct. This is also similar in spirit to the approach in [8].
To accommodate both backtracking and sensing, we assume that the truth value of a certain fluent, say $F(\bar{x}, s)$, can be determined by executing an external function call, $\text{exec}$. The call is denoted by $\text{exec}(A(\bar{x}), s)$. Whenever the execution succeeds, $F$ is true; otherwise, it is false. Note that because Prolog answers queries with free variables by returning possible values for these variables, this technique is equally suitable for sensed functional fluents. This is illustrated in Example 2. The use of external function calls, together with the IRP Assumption, allows us to write equations of the following form, which are embodied into the successor state axiom of a fluent $F(\bar{x})$:
$$F(\bar{x}, \text{do}(A(\bar{x}), s)) \equiv \text{exec}(A(\bar{x}), s) \quad (17)$$
Equation (17) is translated into Prolog as follows
holds($f(X, \text{do}(\text{a}(X), S))$ :- exec($\text{a}(X), S$).
In addition, we need to provide the set of rules that call the action $\text{a}$ externally.
exec($\text{a}(X), S$) :- $<$ external function call $>$
These rules are domain dependent and may be unique to the specific Prolog encoded situation calculus domain theory. In the following section, we discuss how to translate our situation calculus theories into Prolog, and illustrate how we make external function calls for WSC.
3.3 TRANSLATING SITCALC TO PROLOG
To translate a specific situation calculus theory, $\mathcal{D}$ into a set of Prolog rules, $\mathcal{D}^P$, we follow the description provided in [22], with the following additions, predominantly to accommodate sensing actions and the Desirable predicate.
- For each propositional fluent $F(\bar{x}, s)$, create a corresponding propositional fluent $f(X, S)$ in $\mathcal{D}^P$.
- For each functional fluent $F(\bar{x}, s) = \bar{g}$, create a corresponding propositional fluent $f(X, Y, S)$ in $\mathcal{D}^P$.
- Successor state axioms for non-sensed fluents are translated into Prolog following the description in [22]. For fluents whose truth value can change as the result of a sensing action, the normal successor state axiom encoding is augmented to include the suitable external function calls. Further, we add the necessary code to realize those calls.
- For each action $A(\bar{x})$ for which $\text{Desirable}(A(\bar{x}), s) \equiv \Omega(A(\bar{x}), s)$ is defined following Equation (2), create a Prolog rule $\text{not.}_{\text{Desirable}}(a(X), S) :- \backslash+ \omega_{a}(X), S)$. We use Prolog’s negation as failure to infer that by default an action is desirable in a situation, as per the MG code in Section 3.2.1.
We illustrate the points above with the following examples.
Example 1: We return to our simple travel theme. Many of the major airlines offer WWW programs that allow a user to buy an air ticket online. We conceive these services as world-altering actions in the situation calculus, e.g., $\text{buyAirTicket}(o, d, dt)$. To simplify the example, we disregard all parameters except origin, destination, and date $(o, d, dt)$, respectively. This service has a number of effects including asserting that the user will own a ticket after its execution. The successor state axiom for $\text{ownAirTicket}(o, d, dt, s)$ is as follows.
$$\text{ownAirTicket}(o, d, dt, s) \equiv \begin{cases} \text{buyAirTicket}(o, d, dt) \land \text{ticketAvail}(o, d, dt) \lor \\
\text{not.}_{\text{buyAirTicket}}(o, d, dt) \land \text{ownAirTicket}(o, d, dt, s) \end{cases}$$
which is encoded in Prolog as follow.
holds(\text{ownAirTicket}(O, D, DT, do(E,S)) :-
E = \text{buyAirTicket}(O, D, DT),
holds(\text{ticketAvail}(O, D, DT), S);
\backslash+ E = \text{buyAirTicket}(O, D, DT),
holds(\text{ownAirTicket}(O, D, DT), S).
Recall that MG does not execute world-altering actions. Hence there is no external function to execute $\text{buyAirTicket}$. To create an interpreter that executed (some) world-altering actions immediately, the Prolog code would be modified analogously to the sensing-action code below.
Example 2: Now consider the map service offered at www.yahoo.com. Simplified, this service takes as input the origin of a trip $o$, and the destination $d$, and returns, among other things, the driving time between $o$ and $d$. In the context of WSC, we view this service as the sensing action, $\text{getDrivingTime}(o, d)$ which, after its execution, tells us the value of the functional fluent $\text{driveTime}(o, d, s)$. In Prolog, we create a corresponding propositional fluent, $\text{driveTime}(O, D, T, S)$. For simplicity, we assume $\text{driveTime}(o, d, s)$ is only sensed by $\text{getDrivingTime}(o, d)$, but the extension to multiple actions is trivial.
The successor state axiom for $\text{driveTime}(O,D,T)$ is as follows. Note the call to execute $\text{getDrivingTime}(O, D, T)$.
holds(\text{driveTime}(O, D, T), do(E,S)) :-
E = \text{getDrivingTime}(O, D),
exec(ex_get_driving_time(O, D, T)) ;
+ E = getDrivingTime(O, D),
holds(driveTime(O, D, T), S).
To specify how the action ex_get_driving_time(O, D, T) is executed, we need additional code. In our implementation, our sensing actions are all calls to Web services. We do this via a call to the Open Agent Architecture (OAA) agent brokering system [16]. OAA in turn requests a service named get directions.
We first write a general rule for the generic exec call.
exec(A) :- A.
We also write a rule for the actual call.
ex_get_driving_time(O, D, T) :-
oaa_Solve(
get_directions(O, ' ', D, ' ', 0, X), []),
drvTime(X, T).
oaa_Solve(get_directions(...), []) requests the yahoo service that provides the driving time from O to D. As the information provided by the service (X) contains additional information including images and driving directions, we have written some additional code to extract what we need from what the service returns. The code extraction is performed by drvTime(X, T). We omit the details in the interest of space. As we will discuss in the following section, when our vision of semantic Web services is realized, such extra code will be unnecessary.
Example 3: In Section 2.1, we discussed Marielle’s personal preferences and showed how they translated into Equation (3). Here we show how we represent this axiom in our Prolog encoding of the domain theory.
not_desirable(buyAirTicket(O, D, DT), S) :-
holds(driveTime(O, D, T), S),
T =< 3 ;
+ D = ‘home’, holds(mustBeHome(DT, S)).
3.4 CORRECTNESS OF THE INTERPRETER
We complete Section 3 with a theorem that proves the correctness of our interpreter.
Theorem 2 Given an action theory \(\mathcal{D}\) and Golog program \(\delta\) such that \(\text{PSSF}(\delta, \text{Init}_{\delta})\), and \((\delta, \text{Init}_{\delta})\) adheres to IRP, if \(\mathcal{D}' \cup MGP \vdash \text{Do}(\delta, S_{0}, S)\) then there exists a model \(M\) of \(\mathcal{D}\) such that \(M \models \text{Do}(\delta, S_{0}, S)\), where \(\mathcal{D}'\) is the set of Prolog rules representing \(\mathcal{D}\), \(MGP\) is the set of Prolog rules representing our MG Golog interpreter, and \(\models\) is proof by our Prolog interpreter.
Following [22], the action theories in this paper are definitional theories when \(\mathcal{D}_{S_{0}}\) is complete, i.e., when \(\mathcal{D}_{S_{0}}\) contains a definition for each fluent in the theory. This can be achieved by making the closed-world assumption (CWA). Since our programs are self-sufficient, this seems less egregious. Proposition 4 follows immediately from the Implementation Theorem of [22].
Proposition 4 Given an action theory \(\mathcal{D}\) and Golog program \(\delta\) such that \(\text{PSSF}(\delta, \text{Init}_{\delta})\), and \((\delta, \text{Init}_{\delta})\) adheres to IRP. Then, for all situations \(S\),
\[
\mathcal{D}'_{\mathcal{W}A} \cup MGP \vdash \text{Do}(\delta, S_{0}, S) \iff \\
\mathcal{D} \cup \mathcal{CWA}(S_{0}) \models \text{Do}(\delta, S_{0}, S),
\]
where \(\mathcal{CWA}(S_{0})\) is the closed-world assumption on \(S_{0}\), defined as {\(F(S_{0}) \equiv \text{false} | \) there exists no definition of \(F \) in \(\mathcal{D}_{S_{0}}\)}.
4 COMPOSING WEB SERVICES
A significant aspect of our contribution is that the research described to this point is implemented and has been tested on a running system that interacts with services on the Web. In this section, we step back and situate the agent technology we’ve been describing in the context of our system architecture for Semantic Web Service Composition. We also discuss further details of our implementation. Finally, we conclude this section with an example generic procedure that illustrates the use of our work.
4.1 ARCHITECTURE
Figure 1 illustrates the key components of our semantic WSC architecture [19]. Of course, the Semantic Web does not exist yet – www.yahoo.com does not use semantic markup such as DAML+OIL to describe its services nor to disseminate information. We describe both the architecture for our system, and in the section to follow discuss how we’ve accommodated for the pieces of the architecture that are not yet realizable in an elegant way.
The key features of this architecture follow.
Semantic Markup of Web Services: Individual Web services are described in a semantic Web markup language. The programs, their control structure and data flow, are described using a declarative process modeling language. Processes are either atomic or composite. Each process has inputs, outputs, preconditions and effects. It also has a grounding that describes the communication-level properties of the service. A service profile is created for describing and locating the service. Collectively, this semantic markup provides a declarative API for the service so that programs/agents can read this markup and understand how to interact with a service.
Ontologies of Web Services: To encourage reuse of vocabulary, parsimony, and shared semantic understanding, individual Web service descriptions are organized into Web service ontologies. For example, an ontology might contain a service class called `buy`, with subclasses `buyTicket`, `buyBook`, etc. `buyTicket` might in turn be subclassed into `buyAirTicket`, etc. Thus, a Web service provider wishing to describe a new service can simply subclass an existing service, inheriting vocabulary, and ensuring some degree of integration with existing systems.
Semantic Markup and Ontologies of Generic Procedures: Generic procedures can be described using the same semantic markup constructs used to describe Web services. After all, they are just programs. Similarly, generic procedures are stored in ontologies to facilitate sharing and reuse. The ability to share generic procedures is what motivated our desire to make procedures knowledge and physically self-sufficient.
Semantic Markup of Personal/Company Constraints: In addition to semantic markup of services, people can archive their personal preferences and constraints as semantic markup. These profiles can likewise be stored in ontologies, so that users can inherit constraints from family, their place of work, or other affiliations.
Semantic-Markup-Enabled Agent Technology: The architecture also includes a variety of agent technologies that communicate with Web services through an Agent Broker. Our Golog interpreter is one such agent technology.
Agent Broker: The agent broker accepts requests for services from the agent technology or other services, selects an appropriate service and directs the request to that service. Likewise it relays responses back to the requester.
4.2 IMPLEMENTATION
To realize our agent technology, we started with a simple implementation of an offline ConGolog interpreter in Quintus Prolog 3.2. We have modified and extended this interpreter as described in Section 3. Agent brokering is performed using the Open Agent Architecture (OAA) agent brokering system [16]. We have modified our Golog interpreter to communicate with Web services via OAA. Unfortunately, commercial Web services currently do not utilize semantic markup. In order to provide a computer-interpretable API, and computer-interpretable output, we use an information extraction program, World Wide Web Wrapper Factory9 (W4). This program extracts the information we need from the HTML output of Web services. All information-gathering actions are performed this way. For obvious practical (and financial!) reasons, we are not actually executing world-altering services.
All the core infrastructure is working and our Golog interpreter is communicating with services on the Web via OAA. We first demoed our Golog-OAA-WWW system in August, 2000 [19]. Since then, we have been refining it and working on Semantic Web connections. Where our architecture has not been fully realized is with respect to full automation of semantic markup. We originally constructed rudimentary service and procedure ontologies in first-order logic. We are migrating these to DAML-S, as we complete our DAML-S specification. Eventually our Golog interpreter, will populate its KB from the DAML-S ontologies and from DAML+OIL ontologies of user’s customizing constraints. These declarative representations will be compiled into a situation calculus representation. We have constructed partial compilers for DAML-S to PDDL10, and for PDDL to the situation calculus, but we are still predominantly hand-coding situation calculus theories at this time.
4.3 EXAMPLE
We complete this section with an example generic procedure. Consider the example composition task given at the beginning of this paper, “Make the travel arrangements for my KR2002 conference trip.” If you were to perform this task yourself using services available on the Web, you might first find the KR2002 conference Web page and determine the location and dates of the conference. Based on the location, you would decide upon the most appropriate mode of transportation. If traveling by air, you might then check flight schedules with one or more Web services, book flights, and arrange transportation to the airport through another Web service. Otherwise, you might book a rental car. You would then need to arrange transportation and accom-
9db.cis.upenn.edu/W4/
10Plan Domain Definition Language.
moderations at the conference location, and so on.
We have created a generic procedure for arranging travel that captures many aspects of this example. Our generic procedure selects and books transportation (car/air), hotel, local transportation, emails the customer an itinerary, and updates an online expense claim. As noted previously, these generic procedures are not that complex – they are indeed generic. It is the interplay with user constraints that makes our approach powerful.
In what follows we provide Prolog code for a subset of our generic travel procedure. We have simplified the program slightly (particularly the number of parameters) for illustration purposes. We have also used informative constant and term names to avoid explanation. D1 and D2 are the departure and return dates of our trip. pi is the nondeterministic choice of action arguments construct, \( \pi \). Sensing actions, such as \( \text{searchForRFlight()} \) have associated execution code, not included here. Recall that to interpret this generic procedure, Golog will look for actions that are desirable as well as possible.
The following is a generic procedure for booking a return airline ticket.
\[
\text{proc (bookRAirTicket(O, D, D1, D2),}
\[
\text{\quad \text{pos (searchForRFlight(O, D, D1, D2)) ?},}
\[
\text{\quad \text{searchForRFlight(O, D, D1, D2),}
\[
\text{\quad \text{\quad \quad \quad pi (price,}
\[
\text{\quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \ quad
Much related work was identified in the body of this paper, with the work in [7, 22], and more recently, [23], being most closely related. Several other agent technologies deserve mention. The topic of agents on the internet has been popular over the years. Some of the first and most related work is the softbot work done at the University of Washington [9]. They also use action schemas to describe information-providing and world-altering actions that an agent can use to plan to achieve a goal on the internet. More recently, [26, 1, 12] have all developed some sort of agent technology that interacts with the Web.
ACKNOWLEDGEMENTS
We thank the Cognitive Robotics Group at the University of Toronto for providing an initial ConGolog interpreter that we have extended and augmented, and SRI for the use of the Open Agent Architecture software. We would also like to thank Honglei Zeng for his work on the OAA interface to our Golog code [19]. Finally, we gratefully acknowledge the financial support of the US Defense Advanced Research Projects Agency DAML Program grant number N00014-01-1-0680. The second author would also like to acknowledge the support of NSF grant NSF-EIA-F30602-00-2-0579-P00001. The second author would also like to acknowledge the support of NSF grant NSF-EIA-981072 and NASA grant NCC2-1232.
References
|
{"Source-Url": "http://semanticweb2002.aifb.uni-karlsruhe.de/proceedings/Position/sheila.pdf", "len_cl100k_base": 15608, "olmocr-version": "0.1.49", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 47570, "total-output-tokens": 18244, "length": "2e13", "weborganizer": {"__label__adult": 0.0003116130828857422, "__label__art_design": 0.0005311965942382812, "__label__crime_law": 0.00033974647521972656, "__label__education_jobs": 0.0012865066528320312, "__label__entertainment": 0.0001093745231628418, "__label__fashion_beauty": 0.0001633167266845703, "__label__finance_business": 0.0004668235778808594, "__label__food_dining": 0.0003314018249511719, "__label__games": 0.0006232261657714844, "__label__hardware": 0.0008449554443359375, "__label__health": 0.0005006790161132812, "__label__history": 0.000370025634765625, "__label__home_hobbies": 0.00012254714965820312, "__label__industrial": 0.00044417381286621094, "__label__literature": 0.0005011558532714844, "__label__politics": 0.00029778480529785156, "__label__religion": 0.0004377365112304687, "__label__science_tech": 0.08447265625, "__label__social_life": 0.00011295080184936523, "__label__software": 0.016143798828125, "__label__software_dev": 0.890625, "__label__sports_fitness": 0.0002187490463256836, "__label__transportation": 0.0007328987121582031, "__label__travel": 0.000209808349609375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 65334, 0.02045]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 65334, 0.27979]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 65334, 0.81233]], "google_gemma-3-12b-it_contains_pii": [[0, 4080, false], [4080, 9928, null], [9928, 15729, null], [15729, 22061, null], [22061, 27364, null], [27364, 32683, null], [32683, 38378, null], [38378, 43661, null], [43661, 48550, null], [48550, 52968, null], [52968, 59917, null], [59917, 65334, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4080, true], [4080, 9928, null], [9928, 15729, null], [15729, 22061, null], [22061, 27364, null], [27364, 32683, null], [32683, 38378, null], [38378, 43661, null], [43661, 48550, null], [48550, 52968, null], [52968, 59917, null], [59917, 65334, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 65334, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 65334, null]], "pdf_page_numbers": [[0, 4080, 1], [4080, 9928, 2], [9928, 15729, 3], [15729, 22061, 4], [22061, 27364, 5], [27364, 32683, 6], [32683, 38378, 7], [38378, 43661, 8], [43661, 48550, 9], [48550, 52968, 10], [52968, 59917, 11], [59917, 65334, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 65334, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-25
|
2024-11-25
|
986c278c564f21f967dfaae00143265f62e70794
|
Linked USDL Extension for Describing Business Services and Users’ Requirements in a Cloud Context
Hind Benfenatki, Catarina Ferreira da Silva, Aïcha-Nabila Benharkat, Parisa Ghodous, Zakaria Maamar
To cite this version:
HAL Id: hal-01643672
https://hal.archives-ouvertes.fr/hal-01643672
Submitted on 21 Feb 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.
Linked USDL Extension for Describing Business Services and Users’ Requirements in a Cloud Context
Hind Benfenatki1, Catarina Ferreira Da Silva1, Aïcha-Nabila Benharkat3, Parisa Ghodous1, and Zakaria Maamar4
1Univ Lyon, Université Claude Bernard Lyon 1, LIRIS UMR 5205 CNRS, 69621 Villeurbanne Cedex, France
3LIRIS, CNRS, UMR 5205, INSA - Lyon, 69621 Lyon, France
4Zayed University, Dubai, UAE
ABSTRACT
Linked Unified Service Description Language (Linked USDL) provides a comprehensive way for describing services from operational, technical, and business perspectives. However, this description treats services as isolated components that offer functionalities only without emphasis on how they are used. This paper discusses how to extend Linked USDL in a way that permits to describe the services of a marketplace in support of automating the provisioning of service-oriented cloud-based business applications along with satisfying users’ requirements. The marketplace consists of business services that can be composed and specialized services that act on behalf of the infrastructure upon which these applications are deployed. A set of experiments demonstrating the use of the extended Linked USDL are also presented in the paper.
Keywords: Linked USDL, service description, service composition, marketplace.
1 INTRODUCTION
There is a persistent trend of developing business applications using a set of loosely-coupled services that are selected with respect to their functionalities and then put together in response to specific users’ requirements. Web services usually exemplify these services although other types of services exist such as data services (Lagares Lemos, Daniel, & Benatallah, 2015), user interface services (Lagares Lemos, Daniel, & Benatallah, 2015), human services (Services), and business services (Lüftenegger, 2014). Service classification also exists based on their branches of activities, for instance transport and telecommunications (International classification of goods and services for the purposes of the registration of marks, 2001), tangibility (Bhasin, 2016), and deployability. In this paper, we target business services that are software packages providing business functionalities and subject to composition. For instance, Wiki engines and databases could be composed together in response to a request of making the Wiki content stored persistently.
Service description and composition are widely discussed at the operational level with focus on Input/Output (I/O) matching. However, I/O matching cannot be used to evaluate the composability of business services. Some languages like Linked Unified Service Description Language (USDL) (Cardoso & Pedrinaci, 2015) (Linked USDL, 2015) allow to describe (non-business) services at the business (e.g., price specification), technical (e.g., message protocol), and operational (e.g., service functionalities) levels. However, (i) these languages do not offer any support to business services composition which is quite different from Web services composition (they are not characterized by their I/O), and (ii) they describe what the services do with little regard to how they are used, i.e., environment in which they are deployed, with whom they can be used, etc.
To address the aforementioned two limitations, we build upon our MADONA project standing for Method for AutomateD provisioning (composition and deployment of services) of eLoUD-based service-oriented busiNess Applications (Benfenatki et al., 2016) to automate the provisioning of business service-oriented applications on cloud environment. Because compositability of business services cannot be evaluated using matching of services’ input/outputs, we consider service description languages that would allow to identify each service’s composition constraints and possibilities (the services with which the described service can be composed). In this paper, we analyse existing languages describing services and user requirements. We target Linked USDL for the description of services and user’s requirements. The choice of Linked USDL is guided by the fact that the latter allows a wide coverage of technical, business, and functional aspects when describing services. Moreover, it allows the description of various services for instance cloud, Web, and business services.
Existing user requirements description languages like Web Service Request Language (WSRL) (Mitra, Zhou, Bouguettaya, & Liu, 2013) and Service Requirement Modelling Ontology (SRMO) (Xiang, Liu, Qiao, & Yang, 2007) require that users are familiar with the underlying language’s notation, which is quite impossible for non-tech savvy users. Furthermore, these languages describe the requirements in the form of a control flow and/or a data flow. This requires a good knowledge of the business process of the future application to develop, which is quite impossible too when targeting such users. In this paper, we discuss how the necessary support is provided to users by extending Linked USDL.
The rest of this paper is organized as follows. Section 2 describes existing service and user’s requirements description languages. Sections 3 and 4 present respectively an overview of Linked USDL and of its extension. Section 5 evaluates our work. Section 6 draws final conclusions and perspectives.
2 RELATED WORK
This section presents 2 categories of languages for describing services and user requirements, respectively.
2.1 Service description languages
Our literature review resulted into classifying service description languages into two categories: (1) those that treat services as isolated components (Christensen, Curbera, Meredith, & Weerawarana, 2001), and (2) those that focus on relationships between services (Cardoso, 2013). Relationships could be either established or potential. The former describes current or past service’s composition forming for instance, a service offering. The latter describes with whom a service can or must be composed. Table 1 classifies these works categories of languages using 5 criteria: C1: type of service, C2: technical description, C3: semantic description, C4: description of Quality of Services (QoS), and C5: description of relationships of a service. These 5 criteria provide an exhaustive coverage of the issues to address, namely limited support to business services composition and limited description of how business services are used.
Out of Table 1, Linked USDL has a wide coverage of service types such as business, cloud, and Web. Furthermore, Linked USDL allows to describe various aspects including business, technical, and operational. Moreover, Linked USDL is based on Linked Data (Linked data, 2015) principles, so adding new concepts can extend it. We have therefore used this language to describe services. However, Linked USDL does not describe potential relationships of a service. Instead, it describes the established relationships between services constituting a service offering.
<table>
<thead>
<tr>
<th>Research work</th>
<th>C1</th>
<th>C2</th>
<th>C3</th>
<th>C4</th>
<th>C5</th>
</tr>
</thead>
<tbody>
<tr>
<td>Web Service Description Language (WSDL) (Christensen, Curbera, Meredith, & Weerawarana, 2001)</td>
<td>Web services</td>
<td>+(^1)</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>QoS for WSDL (D’Ambrogio, 2006)</td>
<td>Web services</td>
<td>+</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>(Becha & Amyot, 2014)</td>
<td>Web services</td>
<td>+</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>OWL-S (Martin et al., 2004)</td>
<td>Web services</td>
<td>+</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>SAWSDDL (Semantic annotations for WSDL and XML schema, 2007)</td>
<td>Web services</td>
<td>+</td>
<td>+</td>
<td></td>
<td>Can be done by the instantiation of an ontology describing the QoS</td>
</tr>
<tr>
<td>(Afify, Moawad, Badr, & Tolba, 2014)</td>
<td>Software as a Service (SaaS)</td>
<td>+</td>
<td>+</td>
<td>+</td>
<td></td>
</tr>
<tr>
<td>(Taekgyeong & Sim, 2010)</td>
<td>Cloud services</td>
<td>+</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>(Kan & Sim, 2011)</td>
<td>Cloud services</td>
<td>+</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>(Tahamtan, Beheshti, Anjomshoaa, & Tjoa, 2012)</td>
<td>Cloud services</td>
<td>+</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Cloud# (Liu & Zic, 2011)</td>
<td>Cloud services</td>
<td>+</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>BDL (Taher, Nguyen, Lelli, Heuvel, & Papazoglou, 2012)</td>
<td>Cloud services</td>
<td>+</td>
<td>+</td>
<td></td>
<td></td>
</tr>
<tr>
<td>SaaS DL (Sun, Zhang, Chen, Zhang, & Liang, 2007)</td>
<td>SaaS</td>
<td>+</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>CSMIC (Cloud service measurement index consortium)</td>
<td>Cloud services</td>
<td>+</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>WSMO (Web service modeling ontology (wsmo), 2008)</td>
<td>Web services</td>
<td>+</td>
<td>+</td>
<td>+</td>
<td>+</td>
</tr>
<tr>
<td>LinkedWS (Maamar et al., 2011)</td>
<td>Web services</td>
<td>+</td>
<td></td>
<td></td>
<td>+</td>
</tr>
<tr>
<td>Service network (Cardoso, 2013)</td>
<td>Web services</td>
<td>+</td>
<td>+</td>
<td></td>
<td>+</td>
</tr>
<tr>
<td>Blueprint (Nguyen, Lelli, Papazoglou, & Heuvel, 2012)</td>
<td>Cloud services</td>
<td>+</td>
<td>+</td>
<td>+</td>
<td>+</td>
</tr>
<tr>
<td>CoCoon (Zhang et al., 2012)</td>
<td>IaaS Services</td>
<td>+</td>
<td>+</td>
<td>+</td>
<td>+</td>
</tr>
<tr>
<td>Linked USDL (Linked USDL, 2015) (Cardoso & Business services,</td>
<td>+</td>
<td>+</td>
<td>+</td>
<td>+</td>
<td></td>
</tr>
</tbody>
</table>
\(^1\) Criterion met.
We depict in the following how the literature examines relationships of a service:
1. Association (Cardoso, 2013) and collaboration (Maamar et al., 2011) describe the established relationships of services with respect to previous compositions. The knowledge of these relationships is not exhaustive since it is built up as compositions occur. Moreover, these relationship descriptions do not distinguish between the services that have to be composed (composition constraints) and those that can be composed (composition possibilities). This does not allow to know the minimum necessary composition allowing the proper functioning of a given business service. In our work, we have therefore chosen to describe both composition constraints and composition possibilities of each business service.
2. Complementary and competitor relationships (Cardoso, 2013). Complementarity implies that it is possible to compose services. However, identifying a service’s complement relies on user’s evaluation of service relationships. This does not allow to describe all the composition possibilities of a service.
3. Service requirements defined by Nguyen et al., (Nguyen, Lelli, Papazoglou, & Heuvel, 2012) include in a single concept environment, resource, and service composition constraints. This does not allow to automate neither the composition nor the deployment of services. In fact, it is not possible to automatically identify the requirement type that is represented (composition or deployment constraint). We have therefore distinguished in the description of each service between the concepts describing the composition constraints, environment constraints, and resources constraints.
4. Service offerings (Cardoso & Pedrinaci, 2015) refer to combining services (composition relationships). In the literature, there are works that describe established relationships in service offerings (Cardoso & Pedrinaci, 2015), (Web service modeling ontology (wsmo), 2008), (Maamar et al., 2011), (Cardoso, 2013), (Zhang, Ranjan, Haller, Georgakopoulos, Menzel, & Nepal, 2012) and those describing potential relationships (Nguyen, Lelli, Papazoglou, & Heuvel, 2012), (Zhang et al., 2012). Established relationships do not describe all service’s compositions. Potential relationships described in (Zhang et al., 2012) are specific to Infrastructure as a Service (IaaS) services, linking storage to computing services, and network to computing services. This does not allow to describe composition constraints and possibilities.
<table>
<thead>
<tr>
<th>Research work</th>
<th>C1</th>
<th>C2</th>
<th>C3</th>
</tr>
</thead>
<tbody>
<tr>
<td>WSMO (Web service modeling ontology (wsmo), 2008)</td>
<td></td>
<td>+</td>
<td></td>
</tr>
<tr>
<td>LinkedWS (Maamar et al., 2011)</td>
<td></td>
<td>+</td>
<td></td>
</tr>
<tr>
<td>Linked services (Cardoso, 2013)</td>
<td></td>
<td>+</td>
<td></td>
</tr>
<tr>
<td>Blueprint (Nguyen, Lelli, Papazoglou, & Heuvel, 2012)</td>
<td></td>
<td></td>
<td>+</td>
</tr>
<tr>
<td>CoCoon (Zhang et al., 2012)</td>
<td></td>
<td>+</td>
<td>+</td>
</tr>
<tr>
<td>Linked USDL (Cardoso & Pedrinaci, 2015)</td>
<td></td>
<td></td>
<td>+</td>
</tr>
</tbody>
</table>
Table 2 classifies the works describing the relationships of a service based on the following classification criteria: C1: describes established relationships between services, C2: describes potential relationships between services, and C3: describes potential constraint relationships between services.
Unfortunately, not a single work allows to simultaneously describe a service’s composition possibilities and constraints. We describe in this work for each service its composition constraints and possibilities. We also define the concepts of environment, and resources constraints. To automate the configuration of business applications on cloud environments, we also describe the configurable parameters of each business service.
### 2.2 User Requirement Elicitation
Automating the management of cloud services greatly reduce the technical knowledge required for their use. In our previous work (Benfenatki et al., 2016), we automated the generation of service-oriented cloud applications based on non-technical user requirements expressed via a Web form. In order to select the requirements to consider while provisioning service-oriented business applications we have chosen the following criteria to compare in Table 3 the requirements description languages: C1: objective of the work and C2: requirement description abstraction-level. This describes the level of necessary details for the described requirements.
<table>
<thead>
<tr>
<th>Research works</th>
<th>C1: Objective of the work</th>
<th>C2: abstraction level</th>
</tr>
</thead>
<tbody>
<tr>
<td>BPMN (Business Process Model and Notation, 2011)</td>
<td>Business process description</td>
<td>Desired activities, expected events, control flow, several collaboration participants, message flow</td>
</tr>
<tr>
<td>WS-BPEL (Alves et al., 2007)</td>
<td>Description of service-oriented business process execution</td>
<td>Control flow, data flow</td>
</tr>
<tr>
<td>WS-CDL (WS-CDL, 2005)</td>
<td>Peer to peer choreography description</td>
<td>Control flow, data flow</td>
</tr>
<tr>
<td>SRMO (Xiang, Liu, Qiao, & Yang, 2007)</td>
<td>Requirements description ontology</td>
<td>Desired functionalities, functionalities relationships, quality attributes, control flow</td>
</tr>
<tr>
<td>(Yuan & Zhang, 2015) for the development of service-oriented Product Line Software (PLS)</td>
<td>Allows the identification of the specific requirements of a particular client</td>
<td>Desired functionalities, functioning environment, constraints associated to each functionality, requirement rank, requirements relationships (contradiction, quality, etc)</td>
</tr>
<tr>
<td>WSRL (Mitra, Zhou, Bouguettaya, & Liu, 2013)</td>
<td>Declarative description of service-oriented request</td>
<td>Desired functionalities, I/O, WSRL request</td>
</tr>
</tbody>
</table>
Works in Table 3 describe the requirements on service-oriented applications. They define a language, an ontology, or a notation for the description of the requirements. These works require from the user to know the defined languages so that she uses them. They can be distinguished by the abstraction level when describing application requirements (C2). In fact, the description of a control flow and/or a data flow requires a good knowledge of the business process to develop. Furthermore, this is not favourable when using business services because they are not defined by their Inputs/Outputs; business services have a higher abstraction level than Web services, and their composition does not consist in invoking service operations, but rather to adapt a business service so that it can cooperate with another.
### 3 LINKED UNIFIED SERVICE DESCRIPTION LANGUAGE OVERVIEW
USDL (Cardoso, Barros, May, & Kylau, 2010) (USDL, 2011) describes technical and business services to allow services to become usable. Attensity and SAP Research among others initiated this language that was submitted for standardization to the W3C. The description of services with USDL is
based on three perspectives: business (covers, among other things, quality of service, pricing models, and legal constraints), operational (concerns the operations of a service and its functionalities), and technical (includes transport, messages, metadata exchanges, and security protocols).
Linked USDL (Linked USDL, 2015), (Cardoso & Pedrinaci, 2015), (Linked USDL modules, 2015) is a semantic language based on USDL. It describes human services (e.g., consulting), business services (e.g., purchase requisitions), software services (e.g., RESTful services), infrastructure services (e.g., CPU and storage services), etc. The objective of Linked USDL is to allow an open, adaptable, and extensible description of services using decentralized management.
Figure 1. Macroscopic view of Linked USDL
Linked USDL is divided into five modules that have different levels of maturity. Each module is a set of concepts and properties. We illustrate in Figure 1 some Linked USDL classes. A detailed description of all modules is available at (Linked USDL modules, 2015). The five modules are the following:
- **USDL-core**: describes the operational aspects of a service.
- **USDL-price**: describes the price structure of a service.
- **USDL agreement**: describes the quality of the service provided, such as response time and availability.
- **USDL-sec**: describes the security properties of a service.
- **USDL-ipr**: describes the rights to use a service.
Despite Linked USDL advantages such as extensibility and coverage of business, operational, and technical aspects, it does not capture relationships among services. In fact, the type of service relationships described in Linked USDL is done with the class "usdl-core:ServiceOffering". The latter describes the combined services constituting a service offering. However, all possible compositions are not necessarily included in a service offering, since the latter is supplier dependent. Furthermore, Linked USDL describes services as isolated components, hence it has limitations regarding the description of the whole service-oriented application requirements. To overcome these shortcomings, we extend Linked USDL to describe a marketplace of services and requirements of users.
4 LINKED USDL EXTENSION
This section is composed of two parts describing Linked USDL extension. The first one concerns service description. The second one concerns the user’s requirements description. In the following we assume the existence of a marketplace of services (business and infrastructure). Each business service has deployment and configuration scripts, and an additional script that connects it to other business services. Juju store is an example of marketplace (Juju Charms, 2016). Service description using Linked USDL can be formatted using RDF (RDF, 2014), Turtle (Turtle recommandation, 2014), or JSON. In our case, we chose to use the turtle format because it allows a simple, concise, and human understandable description. Therefore, we are focusing in this paper on the definition of the new concepts of the extended Linked USDL instead of defining the syntax of the extended language.
4.1 Extending Linked USDL for service description
In Section 2, we analysed the works on a service’s established and potential relationships. None of those works allows to describe both composition constraints and possibilities exhaustively. Figure 2 illustrates the extended Linked USDL. We describe in the following the concepts that we have defined to extend the model.
The extension of Linked USDL consists of describing the composition relationships of a business service including its deployment constraints, configurable parameters, category, deployment state, technical characteristics of an IaaS (for business services deployment, only), and QoS description of a business and IaaS services. In the following, each new concept is motivated, defined, and exemplified with an example.
4.1.1 Composition relationships
A business service S1 can be linked to S2 thus creating a composition relationship. The latter includes the composition constraints and possibilities (Definitions 1 and 2).
Composition constraints
Some services need other services to function properly.
| Definition 1. Composition constraints link the described business service to another. Composition constraints are either hard or soft. |
| Hard constraints (property 11 of Figure 2) impose the services that must be composed to the one described. For example, MediaWiki must be composed with a MySQL database. |
| Soft constraints (property 12 in Figure 2) offer the choice of selecting one, and only one, service in a business service family providing the same functionality. For example, Joomla can be composed with a MSQL, PostgreSQL, or MySQL database. |
Composition possibilities
Service-Oriented Applications (SOA) relies on I/O matching during service composition. However, this does not apply to business services. Section 2 has shown the lack of representation of composition possibilities. In fact, studied work described the different past compositions of a service (Maamar et al., 2011) (Cardoso, 2013). The latter do not distinguish between composition constraints and possibilities neither allow an exhaustive description of the potential relationships of a service. To overcome these shortcomings, we describe for each business service its composition possibilities.
| Definition 2. Composition possibilities (property 13 of Figure 2) bind the described business service to other peers. A business service S1 is a composition possibility of S2 if and only if S1 can be composed with S2 and S2 works correctly if it is not composed with S1. For example, OpenStack |
works properly without a dashboard, but "Horizon" dashboard represents a composition possibility of the core components of OpenStack.
4.1.2 Deployment Constraints
Deployment constraints cover environment and resources constraints.
Environment constraints
Each business service requires a specific deployment environment. Environment constraints have been described in the work of (Nguyen, Lelli, Papazoglou, & Heuvel, 2012). However, the resource and composition constraints are grouped under the same concept, which is not useful when
automating the composition and the deployment of business services. For automation purposes, we define the environment and resource constraints’ concepts separately for each business service.
**Definition 3.** Environment constraints of a business service (property 7 in Figure 2) represent software that must be installed on the virtual machine hosting the business service described. Each environment constraint is described by a type (e.g., Web server) and name (e.g., Apache). We assume that environment constraints are automatically incorporated into the deployment scripts of a business service.
**Resource Constraints**
Each business service requires a minimum of resources to ensure its normal functioning.
**Definition 4.** Resource constraints (property 8 in Figure 2) of a business service represent the characteristics required for the virtual machine hosting this service in terms of CPU (property 19 in Figure 2), memory (Property 20 in Figure 2), and disk (Property 21 in Figure 2).
### 4.1.3 IaaS technical characteristics
To support the selection of an IaaS that satisfies the deployment constraints of a business service, we define for each IaaS (e.g., Amazon EC2) the technical characteristics of the instances it offers (property 9 of Figure 2). A cost plan is associated with technical characteristics (property 10 of Figure 2) describing the cost of virtual machine instance for a given supplier.
### 4.1.4 Configurable parameters
To automate the configuration of a business application we define the configurable parameters of each service.
**Definition 5.** Configurable parameters (property 3 in Figure 2) of a business service represent parameters that can be customized for the use of the service, such as application name, logo etc. Each configurable parameter is described by its name ("gr: name", property 4 in Figure 2) and by the type of the HTML component (property 18 in Figure 2) to be inserted into the configuration interface (e.g., a text box for the name of an application and a browse button for the logo of the application).
### 4.1.5 Business service category
For each business service, we define its category using "gr:category" property (property 6 in Figure 2). A category is the family of services to which a service belongs. For example, MediaWiki service belongs to "Wiki engine" family. This notion will be used to evaluate the quality of services with respect to other similar services.
### 4.1.6 Quality of service settings
We choose in this work to entrust the task of describing QoS parameters to a third-party service. Many third-party services for service evaluation and comparison are available on the Web such as Cloud Armor (Cloud Armor) and Clouadora (Clouadora). The former provides a dataset of QoS ranks (e.g., availability, response time, and ease of use) assigned by users to the cloud services used. The latter provides a comparison of cloud providers in terms of SLA level, price, and functionality. To illustrate the description of a service’s quality we consider four parameters namely respect of data confidentiality, preservation against data loss, availability of the service, and response time of the service. Listing 1 illustrates an example of a returned XML file, describing the QoS parameters of a given service.
```
1. <?xml version ="1.0" encoding="UTF-8" standalone="no"?>
2. <QoS>
3. <Availability />
```
4.1.7 Deployment state
The deployment state is modelled using property 25 in Figure 2. It concerns business services. Two deployment states are considered: deployed and deployable.
4.2 Extending Linked USDL for user’s requirements description
The requirements description implies the gathering, transformation, and treatment of the user’s needs for the desired business application. In our work, we allow the user to express her requirements via a Web form since we are interested in the type of considered requirements instead of how the requirements are collected. We have identified two major goals for requirements identification:
- **Goal 1**: Identify the minimum requirements for selecting and composing business services that satisfy the user's needs.
- **Goal 2**: Consider non-technical requirements that may be important to the user, and which may allow to select one service composition plan over another. Existing Linked USDL specification considers non-technical requirements, such as business ones, however it lacks the service user needs, like for example the required QoS characteristics.
To achieve these goals, we define the Requirements Vocabulary (RIVAL) as a new module of Linked USDL to formalize the functional and non-functional user’s requirements. RIVAL reuses existing concepts from the Good Relations vocabulary (GoodRelations: The professional Web vocabulary for e-commerce, 2008), RDFS (RDF Schema 1.1, 2014), and XSD (XML Schema, 2004). It also introduces new concepts allowing to select the services meeting the user’s functional requirements and their composition possibilities. Figure 3 illustrates RIVAL classes that describe the vocabulary’s concepts, and properties that describe relationships between classes. To reduce the technical knowledge required for the provisioning of cloud applications, no technical requirement is asked to the user.

**Listing 1. XML file describing the QoS parameters of a service**
```
4. <Response_Time>173.82358</Response_Time>
5. <Data_Privacy>8</Data_Privacy>
6. <Data_Loss>8.902313</Data_Loss>
7. </QoS>
```
4.2.1 Functional requirements
Functional requirements meet the primary objective of the required service. They represent the global functionalities that the business application must accomplish. These are described either by keywords describing the desired functionality or objective, or by the name of the business service that satisfies them. In this work, the description of functional requirements excludes any technical details such as deployment or composition constraints. We introduce a distinction between primary and secondary functionalities (Definitions 6 and 7) which guide respectively the selection of primary services and their composition possibilities (secondary services).
**Definition 6.** A primary functionality (property 1 in Figure 3) describes the overall functionality for a business application desired by the user. A primary functionality is independent from each other, and can be linked to secondary functionalities.
**Definition 7.** A secondary functionality (property 2 in Figure 3) is related to a primary functionality, and enhances the functionality of the latter, but it is not essential in the business application.
A functionality of a desired application is provided by a business service and is considered as primary, e.g., project management. Any additional functionality to this project management is considered as secondary, e.g., requiring a version management service with the project management one. Only one primary functionality is allowed in user’s requirements. Several secondary functionalities can be associated with it.
4.2.2 Non-functional requirements
Non-functional requirements satisfy the second objective and cover the requirements in terms of QoS as well as the user preferences with regard to the desired business application. It is difficult for a user to estimate acceptable tolerance thresholds for QoS parameters such as data availability or integrity. In fact, usually users always aim for maximum quality. For these reasons, we use weights (Definition 8) that the user assigns to the QoS parameters. The quality of service requirements for the desired application are therefore described in RIVAL by their names (property 7 in Figure 3) and their weights that are assigned by the user (property 8 in Figure 3).
**Definition 8.** The weight assigned to each quality of service parameter describes the priority that the user assigns to it. We decided to allow the user to distribute 10 points between the considered QoS parameters, so that the sum of all the assigned values is equal to 10 (the values can be integers or decimals). The choice of the sum equals to 10 is due to the simplicity, in our sense, to distribute 10 points rather than a percentage. These weights will be used to evaluate the quality of the discovered services.
The description of QoS weights is optional. In the case where the user does not determine her priorities for QoS parameters, the same weight will automatically be assigned by default to each of considered parameters.
User preferences are related to deployment and payment details, including:
- The deployment location (property 4 in Figure 3): the user can choose the continent where her application will be deployed. This requirement is optional, but may be important for the user when she values the sensitivity of her data or the privacy laws in different continents.
- The name of the IaaS provider which will host the desired application (property 3 in Figure 3). This preference is based on a previous experience of using an IaaS for hosting the application. This requirement is optional.
- Payment details are described by the "PriceSpecification" class of the "Good Relations" vocabulary (GoodRelations, 2008), which is associated with a currency (property 9 in
5 VALIDATION AND EVALUATION
The extended Linked USDL has been used with MADONA to describe respectively the marketplace’s services and a user’s requirements (Benfenatki et al., 2016). MADONA has been implemented and a video of the system is available at liris.cnrs.fr/hind.benfenatki/demo.mp4.
Let us consider the following scenario to illustrate the use and the benefit of the extended Linked USDL while provisioning cloud-based service-oriented business applications: A manager in a medical clinic (herein the user) wants to provision an application which is capable to manage patient records and medical procedures billing. In this scenario, a patient records management functionality represents the primary functionality and procedures billing functionality represents a secondary one. From these functional requirements, several composition plans are generated following the composition plans generation algorithm described in Listing 4 in (Benfenatki et al., 2016). Figure 4 illustrates the generated composition plans. Each composition plan bounds a set of relations. Each relation composes a business service with its composition constraints and/or composition possibilities. In fact, the first relation of each composition plan composes a service meeting the user’s primary functionality (herein after called a primary service), the services representing the composition constraints of the primary service, and the services meeting the user’s secondary functionalities and representing a composition possibility of the primary service. The other relations compose the composition plan’s services with their composition constraints. The generation of composition plans is done automatically and dynamically since composition constraints and possibilities are known from service’s description using extended Linked USDL.
The first composition plan in Figure 4 is composed of three relations. The first one composes PR1, a service meeting the patient records management functionality, BM1, a service meeting billing management functionality, and a MySQL database and SecureAuth that represent the composition constraints of the primary service, and allow respectively to store patient information and to guarantee a secure authentication to the generated application. The second and third relations compose BM1 and SecureAuth with their composition constraints.
The generated composition plans are completed with an IaaS meeting the user’s deployment preferences and QoS requirements. The cost of each composition plan is evaluated for the selected IaaS and the ones exceeding the user’s payment preferences are excluded. The remaining composition plans are evaluated according to the user’s QoS requirements and services’ QoS history. The composition plan with the highest QoS is selected for deployment. For the selected composition plan, several Web forms are displayed to the user so that she can personalize the generated
application. Configuration and deployment scripts are automatically generated and executed. More details on MADONA’s phases are reported in (Benfenatki et al., 2016).
We evaluate in Figure 5 the benefit of the extended Linked USDL on the provisioning of the running scenario’s generated application (corresponding to the first composition plan with two configurations). On the one hand considering composition constraints while describing a marketplace’s services allows to know the minimal composition permitting the normal functioning of a service. Moreover, it allows to automate the composition process, i.e., the generation of composition plans, thus reducing the necessary technical knowledge required from the user for provisioning service-oriented cloud applications. On the other hand, considering configurable parameters and deployment constraints for each business service allows to automate the configuration and the deployment respectively.

The number of invoked services is equal to the sum of the number of desired functionalities (primary and secondary) and the number of composition constraints associated to those functionalities. As shown in Figure 6, the number of services (or of functionalities) the user has to know remains fixed while the number of the associated composition constraints grows. In fact, composition constraints are taken into account automatically from the service’s description.
Furthermore, by describing composition possibilities, we reduce the number of generated composition plans. In fact, the generated composition plans compose only the services that can be composed.
CONCLUSION
We have defined an extension of Linked USDL for the description of the marketplace’s services (business and infrastructure) and for the service requirements of the user. New concepts have been added to describe the relationships that a business service must and can have with other peers in order to know the composability of a service. We also described for each business service its deployment constraints and configurable parameters, in order to automate the deployment and the configuration of a given business service. We have described the technical characteristics of an IaaS service in order to allow the selection of resources responding to the deployment constraints of each business service. We have described the quality of the marketplace’s services, which we entrust to third-party services in order to have an objective representation of the quality of the service.
We also have defined the RIVAL module to formalize the user's requirements, which are described through a Web form. RIVAL defines the minimal requirements, functional and non-functional, allowing an effective selection and composition of business services, and introduces the notion of primary and secondary functionalities. Non-functional requirements include user deployment and cost preferences, and QoS requirements. The requirements taken into account in RIVAL are expressed at a high level of abstraction of technical details. For example, QoS requirements are expressed in terms of weights symbolizing the importance the user assigns to each quality parameter instead of it being expressed in precise values.
We present, as well, the results of experiments demonstrating the use of our extension of Linked USDL with MADONA, a method for automated provisioning of cloud-based service-oriented business applications. We can conclude that Linked USDL extension allows to generate automatically and dynamically composition plans meeting user’s functional requirements and meeting services composition constraints and possibilities. In fact, each service of a composition plan is automatically composed with the services representing its composition constraints as the latter are known from service’s description. Furthermore, only composable services are composed and this is done automatically. In fact, composition possibilities of marketplace’s services are known from their descriptions. Thus, describing composition constraints and possibilities of each business service
allows (i) to automate the composition process, (ii) to consider the minimal composition allowing the good functioning of each service, and (iii) to compose only composable services.
Considering resource constraints while describing a business service allows to automate its deployment on sufficient resources allowing its good functioning. Considering configurable parameters of each marketplace’s business service allows to automate the configuration process. Hence, all the application provisioning process is automated.
As part of our ongoing work, we plan to consider a cost model which considers more relevant parameters when estimating the use of resources for deploying business services, for instance, the type of storage and bandwidth associated with the virtual machines deployed. We also plan to consider the cost of business services of the generated application.
REFERENCES
*RDF.* (2014). *Resource Description Framework (RDF).* From https://www.w3.org/RDF/
*USDL.* (2011). From Unified service description language: https://www.w3.org/2005/Incubator/usdl/
|
{"Source-Url": "https://hal.archives-ouvertes.fr/hal-01643672/file/IJSSOE%202017%20final%20correct-postprint.pdf", "len_cl100k_base": 8890, "olmocr-version": "0.1.50", "pdf-total-pages": 18, "total-fallback-pages": 0, "total-input-tokens": 58247, "total-output-tokens": 11804, "length": "2e13", "weborganizer": {"__label__adult": 0.0004119873046875, "__label__art_design": 0.0009603500366210938, "__label__crime_law": 0.0005178451538085938, "__label__education_jobs": 0.0025310516357421875, "__label__entertainment": 0.00028514862060546875, "__label__fashion_beauty": 0.00029397010803222656, "__label__finance_business": 0.007114410400390625, "__label__food_dining": 0.0004954338073730469, "__label__games": 0.0008864402770996094, "__label__hardware": 0.0010232925415039062, "__label__health": 0.0006985664367675781, "__label__history": 0.0006241798400878906, "__label__home_hobbies": 0.00017142295837402344, "__label__industrial": 0.0006976127624511719, "__label__literature": 0.00106048583984375, "__label__politics": 0.0005559921264648438, "__label__religion": 0.0005621910095214844, "__label__science_tech": 0.2215576171875, "__label__social_life": 0.00024580955505371094, "__label__software": 0.07568359375, "__label__software_dev": 0.68212890625, "__label__sports_fitness": 0.00023615360260009768, "__label__transportation": 0.0008034706115722656, "__label__travel": 0.0003409385681152344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 48398, 0.04113]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 48398, 0.1683]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 48398, 0.8644]], "google_gemma-3-12b-it_contains_pii": [[0, 1193, false], [1193, 4460, null], [4460, 8191, null], [8191, 9781, null], [9781, 12924, null], [12924, 16718, null], [16718, 18960, null], [18960, 22437, null], [22437, 22977, null], [22977, 26371, null], [26371, 28532, null], [28532, 32314, null], [32314, 35251, null], [35251, 36924, null], [36924, 39398, null], [39398, 42543, null], [42543, 45554, null], [45554, 48398, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1193, true], [1193, 4460, null], [4460, 8191, null], [8191, 9781, null], [9781, 12924, null], [12924, 16718, null], [16718, 18960, null], [18960, 22437, null], [22437, 22977, null], [22977, 26371, null], [26371, 28532, null], [28532, 32314, null], [32314, 35251, null], [35251, 36924, null], [36924, 39398, null], [39398, 42543, null], [42543, 45554, null], [45554, 48398, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 48398, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 48398, null]], "pdf_page_numbers": [[0, 1193, 1], [1193, 4460, 2], [4460, 8191, 3], [8191, 9781, 4], [9781, 12924, 5], [12924, 16718, 6], [16718, 18960, 7], [18960, 22437, 8], [22437, 22977, 9], [22977, 26371, 10], [26371, 28532, 11], [28532, 32314, 12], [32314, 35251, 13], [35251, 36924, 14], [36924, 39398, 15], [39398, 42543, 16], [42543, 45554, 17], [45554, 48398, 18]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 48398, 0.18142]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
b592c5299a6402f16f698955b05eb9a92e9c4739
|
# Contents
1. Overview ......................................................................................................................... 3
2. Methodology ................................................................................................................... 4
3. The language used to write business rules ...................................................................... 5
3.1 Structure of a function body. .................................................................................... 5
3.3 The assignment statement. ........................................................................................ 5
3.3 The IF-ELSE-ENDIF statement ............................................................................... 5
3.4 The WHILE-DO-LOOP statement ........................................................................... 6
3.4 The FOR-DO-LOOP statement ................................................................................ 6
3.5 The official syntax BNF ............................................................................................ 6
4. Local variables and argument names .............................................................................. 9
5. Comments ..................................................................................................................... 10
6. Built in “native” functions ............................................................................................ 11
7. Text ............................................................................................................................... 13
8. Programmer’s guide to SBR ..................................................................................... 14
8.1 Prototyping a business rule function ....................................................................... 14
8.2 Using the “load” method to read in the “.sbr” files. ............................................... 15
8.3 Passing data to and from the SBR functions .......................................................... 15
8.4 Invoking a function at runtime ............................................................................... 16
8.5 Application defined native functions ...................................................................... 17
8.6 Prototyping a native function .................................................................................. 18
8.7 Advanced text output .............................................................................................. 19
8.8 Complete Example ................................................................................................. 20
1. Overview
Interpreted business rules provides a mechanism for the users of a simulation model to modify some of the code in the model that is used at crucial decision points. This code can be modified without having to recompile the model. “Functions” are written in a simplified language called SBR or (SIMSCRIPT Business rules). Each interpreted SBR function is given a name and is called from within the SIMSCRIPT model using that name. The SBR function will accept a list of arguments and must return with an integer number, real number, text or pointer value. For example, the following SBR function will return a pointer to a supply site.
```plaintext
function getSupplySiteWithLowestShelfDays(site, part)
minDays = rinf_c
supplySite = getFirstSupplySite
while supplySite <> null
do
days = getShelfDays(site, part) + random_f(1, 0.0, 1.0)
if days < minDays
minDays = days
bestSite = supplySite
endif
supplySite = getNextSupplySite(supplySite)
loop
return bestSite
end
```
SBR functions can call each other, can make recursive calls, or can call native functions that are implemented within the SIMSCRIPT III model. “Built-in” native functions are provided (such as the call to “random_f” above).
2. Methodology
The SIMSCRIPT Business Rules Interpreter is written using a recursive descent parsing algorithm. The “code” for the business rules is kept in one or more flat (ascii) files and is loaded and parsed once on initialization.
The parsing algorithm will construct a hierarchical parse-tree data structure. This is essentially an intermediate representation of the code that can be “executed” at the time a business rule is invoked. Errors in syntax or semantics will be printed at the time the business rules are loaded. If a syntax error is detected, the SBR function being loaded cannot be executed. Runtime errors may also result during actual execution. For example, if an attempt is made to divide by zero, a runtime error will be printed and execution of the function will stop immediately.
3. The language used to write business rules
The language used for the SIMSCRIPT business rules will be subsequently referred to as SBR.
3.1 Structure of a function body
A function must begin with the “function” keyword and be terminated with the “end” keyword. The name of the function follows the “function” keyword. An argument list may be included after the name. Within the body of the function, there must be at least one “return” statement.
```plaintext
function getMax(i1, i2)
return imax_f(i1,i2)
end
```
All SBR functions must be explicitly prototyped in the SIMSCRIPT III source code. (Prototyping is described later). Function prototyping establishes the “mode” of all arguments to the function and the return mode itself. An error message will be generated on initialization if an unprototyped function is encountered as a result of the “load” statement.
3.3 The assignment statement
The “=” is used as an assignment operator. The name of a local variable must appear on the left, and an expression on the right. It is not legal to assign a pointer to anything else but another pointer. (To set the value of a pointer variable to zero the value “null” can be used.) Integers and real values are assignment compatible. When a real value is assigned to an integer variable, the value is rounded.
```plaintext
myValue = b + sqrt_f(b * b - 4 * a * c) / (2 * a)
```
Text can be assigned to another text variable or a quoted string. The “+” operator can be used to concatenate text strings.
```plaintext
myTextVariable = "hello" + " " + "world"
```
3.3 The IF-ELSE-ENDIF statement
Conditionals statements can be written in SBR. The “and”, “or” and “not” keywords are used as Boolean logic operators while the “=”, “<>”, “<”, “>” ”, “<=” and “>=” are used for comparison. When testing pointer variables for zero, the keyword “null” should be used instead of “0”.
```plaintext
myTextVariable = "hello" + " " + "world"
```
if batch > 0 and netRequisitions >= batch
batchCount = netRequisitions / batch
else
batchCount = 0
endif
3.4 The WHILE-DO-LOOP statement
Loops based on conditionals are implemented using the “WHILE” statement. Code to be executed must come between the “DO” and “LOOP” keywords. Nested loops are allowed.
supplySite = getFirstSupplySite
while supplySite <> 0
do
numSites = numSites + 1
supplySite = getNextSupplySite(supplySite)
loop
3.4 The FOR-DO-LOOP statement
The classic “for” loop is supported. An iterator is initially assigned to the given “low” value and incremented until it reaches the value specified after the “to” clause. An optional “by” clause allows you to specify a value to be added to the iterator at the top of the loop.
minHeight = rinf_c
for i = 1 to 100 by 4
do
let y = getHeight(getBoxIndex(box(i)))
minHeight = min_f(minHeight, y)
loop
3.5 The official syntax BNF
The following notation will be used:
The “<>” will be used to enclose a non-terminal. For example: < non-terminal >.
The quote marks will enclose a keyword that is part of the language. For example: “terminal”.
The braces “{“ and “}” will enclose optional syntax that can be repeated zero or more times. For example:
{ “,” <name> }
The brackets “[“ and “]” will enclose optional syntax that can be repeated only once. For example [ <namelist> ]
An identifier in the language can be any sequence of alphanumeric characters beginning with a letter. The underscore “_” can also be used in a name. Names can be upper, lower or mixed case, but the language is case-insensitive.
In the rules, the identifier is represented with “< name >”.
SBR is represented by the following syntax rules:
```
< business_rule > => < heading > { <statement> } “end”
< heading > => “function” < name > [ <namelist> ]
< namelist > => “(“ <name> { “,” <name> } “)“)
< statement > => < assignment_stmt >
=> < while_stmt >
=> < if_stmt >
< assignment_stmt > => <name> “=” < expression >
<while_stmt > => “while” <bool_expression> “do” { < statement >… } “loop”
<for_stmt > => “for” <name> “=” < expression > “to” < expression >
[ “by” < expression > ] “do” { < statement >… } “loop”
< if_stmt > => “if” <bool_expression> { <statement> … }
[ “else” { <statement> } ] “endif”
< return_stmt > => “return” <expression>
< expression > => [ < add_op > ] < term > { < add_op> < term >… }
< add_op > => “+”
=> “-”
< term > => < factor > { < mul_op > < factor > }
< factor > => < primary > [ <primary_op> < primary > ]
< primary > => < literal >
=> “(“ < expression > “)“
< mul_op > => “*”
=> “/”
< primary_op > => “%”
=> “**”
< literal > => < integer_constant >
=> < real_constant >
=> < string_constant >
=> “null”
=> < name > { <expression_list> }
< expression_list > => “(“ < expression > { “,” < expression > }… “)”
```
<bool_expression> => <relation> { <logical_op> <relation>… }
<logical_op> => “and”
=> “or”
<relation> => <expression> <rel_op> <expression>
=> “(<bool_expression> “)”
=> “not” “(<bool_expression> “)”
<rel_op> => “>”
=> “<”
=> “=”
=> “>=”
=> “<=”
4. Local variables and argument names
In SBR, locally used variables are not declared explicitly. The modes are determined empirically, during an assignment statement. It is therefore not allowed to use a local variable that has not been assigned a value. To determine the mode of an expression used on the right hand side of an expression, the modes of constants and native function calls are used.
5. Comments
Comments can be placed within the business rule code. They are delimited with the “/~” and “~/” sequences.
/~ Here is a comment on a
couple of lines ~/
function rTestFunction ( i1, i2 )
return with i2 ~/ here is another comment ~/
end
6. Built in native functions
A function written in SBR can directly invoke functions written in SIMSCRIPT III. These are called "native" functions. There are numerous "built in" native functions that are provided to perform mathematical or other operations. Some of the native functions will return SIMSCRIPT III predefined constants, or SIMSCRIPT global variables (like TIME.V). The following functions are provided:
<table>
<thead>
<tr>
<th>Name</th>
<th>Mode</th>
<th>Arguments</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>exp_c</td>
<td>real</td>
<td><none></td>
<td>Constant for "e".</td>
</tr>
<tr>
<td>inf_c</td>
<td>int</td>
<td><none></td>
<td>Maximum value for a 32-bit integer</td>
</tr>
<tr>
<td>rinf_c</td>
<td>real</td>
<td><none></td>
<td>Maximum value for a 64-bit real</td>
</tr>
<tr>
<td>pi_c</td>
<td>real</td>
<td><none></td>
<td>Pi constant.</td>
</tr>
<tr>
<td>radian_c</td>
<td>real</td>
<td><none></td>
<td>Converts degrees to radians 180 / pi</td>
</tr>
<tr>
<td>abs_f</td>
<td>real</td>
<td>r</td>
<td>Returns the absolute value of argument 1</td>
</tr>
<tr>
<td>iabs_f</td>
<td>int</td>
<td>i</td>
<td>Returns the absolute value of argument 1</td>
</tr>
<tr>
<td>arccos_f</td>
<td>real</td>
<td>r</td>
<td>Returns the arc cosine of argument 1</td>
</tr>
<tr>
<td>arcsin_f</td>
<td>real</td>
<td>r</td>
<td>Returns the arc sine of argument 1</td>
</tr>
<tr>
<td>arctan_f</td>
<td>real</td>
<td>r,r</td>
<td>Returns the arc tangent of arg2 / arg1</td>
</tr>
<tr>
<td>beta_f</td>
<td>real</td>
<td>r,r,i</td>
<td>Calls the SIMSCRIPT III beta.f function.</td>
</tr>
<tr>
<td>binomial_f</td>
<td>real</td>
<td>i,r,i</td>
<td>Calls the SIMSCRIPT III binomial.f function.</td>
</tr>
<tr>
<td>cos_f</td>
<td>real</td>
<td>r</td>
<td>Returns the cosine of argument 1</td>
</tr>
<tr>
<td>erlang_f</td>
<td>real</td>
<td>r,i,i</td>
<td>Calls the SIMSCRIPT III erlang_f function.</td>
</tr>
<tr>
<td>exp_f</td>
<td>real</td>
<td>r</td>
<td>"e" to the arg</td>
</tr>
<tr>
<td>exponential_f</td>
<td>real</td>
<td>r,i</td>
<td>Calls the SIMSCRIPT III exponential.f function.</td>
</tr>
<tr>
<td>frac_f</td>
<td>real</td>
<td>r</td>
<td>Returns the fractional part of a real number.</td>
</tr>
<tr>
<td>gamma_f</td>
<td>real</td>
<td>r,r,i</td>
<td>Calls the SIMSCRIPT III gamma.f function.</td>
</tr>
<tr>
<td>length_f</td>
<td>real</td>
<td>t</td>
<td>Returns the length of a text value.</td>
</tr>
<tr>
<td>itot_f</td>
<td>text</td>
<td>i</td>
<td>Returns the text representation of an integer.</td>
</tr>
<tr>
<td>log_e_f</td>
<td>real</td>
<td>r</td>
<td>Return the log base “e” of arg 1</td>
</tr>
<tr>
<td>log_normal_f</td>
<td>real</td>
<td>r,r,i</td>
<td>Calls the SIMSCRIPT III log.normal.f function.</td>
</tr>
<tr>
<td>log_10_f</td>
<td>real</td>
<td>r</td>
<td>Returns log base 10 of arg 1</td>
</tr>
<tr>
<td>lower_f</td>
<td>text</td>
<td>t</td>
<td>Converts the given text to lower case</td>
</tr>
<tr>
<td>match_f</td>
<td>text</td>
<td>t,t,i</td>
<td>Calls the SIMSCRIPT III match.f function</td>
</tr>
<tr>
<td>min_f</td>
<td>real</td>
<td>r,r,r,…</td>
<td>Returns the minimum of several arguments.</td>
</tr>
<tr>
<td>min_f</td>
<td>integer</td>
<td>i,i,…</td>
<td>Returns the minimum of several arguments.</td>
</tr>
<tr>
<td>imax_f</td>
<td>real</td>
<td>r,r,r,…</td>
<td>Returns the maximum of several arguments.</td>
</tr>
<tr>
<td>imax_f</td>
<td>integer</td>
<td>i,i,…</td>
<td>Returns the maximum of several arguments.</td>
</tr>
<tr>
<td>normal_f</td>
<td>real</td>
<td>r,r,i</td>
<td>Calls the SIMSCRIPT III normal.f function.</td>
</tr>
<tr>
<td>poisson_f</td>
<td>real</td>
<td>r,i</td>
<td>Calls the SIMSCRIPT III poisson function.</td>
</tr>
<tr>
<td>process_v</td>
<td>pointer</td>
<td><none></td>
<td>Returns the current process notice.</td>
</tr>
<tr>
<td>randi_f</td>
<td>integer</td>
<td>i,i,i</td>
<td>Calls the SIMSCRIPT III randi.f function.</td>
</tr>
<tr>
<td>random_f</td>
<td>real</td>
<td>i</td>
<td>Returns a random number between 0 and 1.</td>
</tr>
<tr>
<td>Function</td>
<td>Type</td>
<td>Arguments</td>
<td>Description</td>
</tr>
<tr>
<td>------------</td>
<td>--------</td>
<td>-----------</td>
<td>--------------------------------------</td>
</tr>
<tr>
<td><code>repeat_f</code></td>
<td>text</td>
<td>t,i</td>
<td>Repeats the given text string arg2 times</td>
</tr>
<tr>
<td><code>rtot_f</code></td>
<td>text</td>
<td>r,i,i,i</td>
<td>Real to text given fw, precision, use_exp</td>
</tr>
<tr>
<td><code>sign_f</code></td>
<td>integer</td>
<td>r</td>
<td>-1 for neg, 0 for zero, 1 for pos</td>
</tr>
<tr>
<td><code>rsin_f</code></td>
<td>real</td>
<td>r</td>
<td>Returns the sine of arg 1.</td>
</tr>
<tr>
<td><code>rsqrt_f</code></td>
<td>real</td>
<td>r</td>
<td>Returns the square root of arg1.</td>
</tr>
<tr>
<td><code>time_v</code></td>
<td>real</td>
<td><none></td>
<td>Returns time.v, the current simulation time.</td>
</tr>
<tr>
<td><code>triang_f</code></td>
<td>real</td>
<td>r,r,r,i</td>
<td>Calls the SIMSCRIPT III triang.f function</td>
</tr>
<tr>
<td><code>trim_f</code></td>
<td>text</td>
<td>t,i</td>
<td>Removes leading and/or trailing blanks.</td>
</tr>
<tr>
<td><code>trunc_f</code></td>
<td>integer</td>
<td>r</td>
<td>Returns the truncated value of arg 1</td>
</tr>
<tr>
<td><code>uniform_f</code></td>
<td>real</td>
<td>r,r,i</td>
<td>Calls the SIMSCRIPT III uniform.f function.</td>
</tr>
<tr>
<td><code>upper_f</code></td>
<td>text</td>
<td>t</td>
<td>Converts arg1 to upper case.</td>
</tr>
<tr>
<td><code>weibull_f</code></td>
<td>real</td>
<td>r,r,i</td>
<td>Calls the SIMSCRIPT III weibull.f function.</td>
</tr>
<tr>
<td><code>length_f</code></td>
<td>integer</td>
<td>t</td>
<td>Returns the length of a text value.</td>
</tr>
</tbody>
</table>
7. Text
In SBR text variables can be assigned and passed as arguments. If used in expressions where the operators are “+”, the text will be concatenated.
```plaintext
ts = " ";
t1 = "hello";
t2 = "there";
t3 = "world";
tMyText = t1 + ts + t2 + ts + t3
```
The following native functions can be used for text manipulation.
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
</tr>
</thead>
<tbody>
<tr>
<td>length_f(tval)</td>
<td>Returns the length of the text string</td>
</tr>
<tr>
<td>itot_f(ival)</td>
<td>Converts an integer to text</td>
</tr>
<tr>
<td>rtot_f(ival, field_width, precision, use_exp)</td>
<td>Convert real value to text representation.</td>
</tr>
<tr>
<td>tower_f(tval)</td>
<td>Convert to lower case</td>
</tr>
<tr>
<td>upper_f(tval)</td>
<td>Convert to upper case</td>
</tr>
<tr>
<td>tsubstr_f(tval, pos, length)</td>
<td>Returns the substring starting at position “pos”. “length” characters are copied.</td>
</tr>
<tr>
<td>match_f(tval, pattern)</td>
<td>Returns the position within tval of the first occurrence of “pattern”, or zero if there is no such occurrence; the search begins after skipping the first “offset” characters of tval.</td>
</tr>
<tr>
<td>trim_f(tval, flag)</td>
<td>Returns a copy of “tval” which has leading and/or trailing blanks removed; if “flag” 0, leading blanks are removed; if “flag” ≥ 0, trailing blanks are removed. To remove both leading and trailing blanks, use “flag” = 0.</td>
</tr>
</tbody>
</table>
8. Programmer’s guide to SBR
To implement a model using the SBR interpreter, the preamble must import from the sbr subsystem found in sbr.m.sim. The interpreter class provides the basis for using SBR. This class should be sub-classed if the existing native functionality is to be extended (which is usually the case).
Preamble for the my_model subsystem including the sbr.m subsystem
begin class my_interpreter
every my_interpreter is an interpreter and
overrides the native, "if SIMSCRIPT III fns defined
overrides the prototype "always needed
end
define the_interpreter as a my_interpreter reference variable
end
8.1 Prototyping a business rule function
In order to insure that the SBR interpreter can interact properly with the business rule code, all business rule functions must be prototyped by overriding the prototype method of the interpreter class in the public or private preamble.
define prototype as a text "virtual" method given
1 text argument "name of native function, or rule
"returns with a prototype text for the arguments of the
"named native function or business rule. The first char in the text
"represents the return mode while each subsequent char in the text
"represents the mode of an argument. The codes are:
""i" = integer, "r" = real, "p" = pointer and "t" = text.
"The "+" character can be used to indicate the previous arg
"repeats.
"If the function is not defined, return with "".
This method is called when the interpreter reads the heading for a business rule in the SBR code. The name of the function is passed to the prototype method. The code written for prototype can then compare the name with the list of known functions (using a “select case” statement). If the name is found, an encoded text string is returned by the prototype method which describes both the return type and given arguments. The interpreter will compare the number of arguments in the heading of the business rule with the number of characters in the prototype text.
Each character in the text string returned by the prototype method represents a “mode”. The first character is the return mode, followed by given argument modes. (Therefore the prototype text string for a business rule with “n” arguments will be “n+1” in length.) The character codes are shown below.
<table>
<thead>
<tr>
<th>Mode character</th>
<th>SIMSCRIPT III mode</th>
</tr>
</thead>
<tbody>
<tr>
<td>i</td>
<td>INTEGER</td>
</tr>
<tr>
<td>r</td>
<td>REAL</td>
</tr>
<tr>
<td>t</td>
<td>TEXT</td>
</tr>
<tr>
<td>p</td>
<td>POINTER</td>
</tr>
</tbody>
</table>
For example, the prototype text for a function that accepts an INTEGER, TEXT, and POINTER (in that order) and returns a REAL would be “ritp”.
NOTE: The prototype method should always return with “interpreter'prototype(name)” if the given name is not defined by the application. This will ensure that calls to built-in native functions will operate properly.
### 8.2 Using the load method to read in the .sbr files.
Reading in the file containing the SBR code is accomplished using the load method of the Interpreter class. This method takes the name of the code file as its argument and returns “1” if the compilation is successful, “0” otherwise. The load method can be called many times to load different file. For example, to load in the file “SEM.sbr”:
```python
create the_interpreter
call load(the_interpreter)("SEM.sbr")
```
The load method will parse the code in the “.sbr” file and build the intermediate (internal) representation. The method will return with “0” if any syntax or semantics errors are encountered in any of the functions.
### 8.3 Passing data to and from the SBR functions.
The SBR functions will usually be designed with arguments of various modes. Also, each function will return with a data value that must be read in by the calling code. The variable class found in the sbr.m subsystem is used to hold various representations of data values. Instances of variable objects are passed as arguments to SBR functions. Another variable instance is passed to the function to hold the return value.
The “data” being stored in the variable can have one of four modes. The following constants define the modes
<table>
<thead>
<tr>
<th>MODE</th>
<th>DATA</th>
<th>PROTOTYPE CHAR</th>
</tr>
</thead>
<tbody>
<tr>
<td>integer_mode</td>
<td>32-bit signed integer.</td>
<td>i</td>
</tr>
<tr>
<td>real_mode</td>
<td>64-bit floating point</td>
<td>r</td>
</tr>
<tr>
<td>text_mode</td>
<td>Text string.</td>
<td>t</td>
</tr>
<tr>
<td>pointer</td>
<td>32-bit pointer.</td>
<td>p</td>
</tr>
</tbody>
</table>
The following methods are used to “set” and “get” the values in a variable instance:
<table>
<thead>
<tr>
<th>Method name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>get_integer</td>
<td>returns the integer representation of the data. If the mode of the data is _real_mode, the value is rounded. Text data will be automatically converted for textual integers.</td>
</tr>
<tr>
<td>get_real</td>
<td>returns the real representation of the data.</td>
</tr>
<tr>
<td>get_text</td>
<td>returns the real representation of the data.</td>
</tr>
<tr>
<td>get_pointer</td>
<td>Return with the pointer.</td>
</tr>
<tr>
<td>set_integer</td>
<td>Sets the data given an integer.</td>
</tr>
<tr>
<td>set_real</td>
<td>Sets the data given a real.</td>
</tr>
<tr>
<td>set_text</td>
<td>Sets the data as text.</td>
</tr>
<tr>
<td>set_pointer</td>
<td>Set the data as a pointer.</td>
</tr>
</tbody>
</table>
### 8.4 Invoking a function at runtime.
Once functions in the file have been loaded they can be executed. The interpreter `evaluate` method will execute a business rule function:
```python
define evaluate as a integer method given 1 text argument, 1 variable reference argument, 1 1-dim variable reference argument
"Calls and evaluates an existing business rule."
```
The evaluate method returns “1” if the rule has been performed successfully, “0” otherwise. The name of the rule is given which must match the name used in the function heading in the SBR file. A variable reference must be allocated and passed as the second argument. The third argument is an array of variable references that contain the arguments to the function. If there are no arguments to the SBR function, this argument can be zero.
There are two variable class methods that can be used to reserve, allocate, and deallocate the argument list array: `create_args()` and `destroy_args()`. Once the argument list has been created, the elements of the array can be assigned by calling the “set_integer”, “set_real”, etc. methods.
For example, suppose we want to call the SBR function listed in (1) i.e:
```python
function pSupplySiteWithLowestShelfDays(pSite, pPart)
```
The function need two pointer variables as arguments and returns a pointer. We must first create the variable that is to contain the result, then reserve the array representing the argument list. The `evaluate` method is called to execute the rule. The `result` variable can
then be queried to get the data value returned from the SBR function. The argument list array and result variable can then be deallocated.
```plaintext
define arglist as a 1-dim Variable reference variable
define result_var as a Variable reference variable
create result_var
let arglist = variable'create_args(2)
call set_pointer(arglist(1))(theCurrentSite)
call set_pointer(arglist(2))(theCurrentPart)
if evaluate(the_interpreter)("pSupplySiteWithLowestShelfDays", result_var, arglist) <> 0
let theLowestShelfDaySite = get_pointer(result_var)
always
call Variable'destroy_args(arglist)
destroy this result_var
```
### 8.5 Application defined native functions
“Native” functions are written in SIMSCRIPT III and compiled with the rest of the model code. As was mentioned previously, there are many native “built in” SIMSCRIPT functions that can be called from the SBR code. When the interpreter reads a name that has not yet been assigned a value locally, it calls its own native method to see if the reference is to a SIMSCRIPT function. Internally the native method compares this name against the list of known names. If the name matches one of the built in functions, the function is executed, and “1” is returned. If no matching function is found, “0” is returned. The method is defined below:
```plaintext
define native as a integer method given
1 text argument, "name of native function
1 variable reference argument, "store the result here
1 1-dim variable reference argument "arguments will be here
"Override this method to allow the business rule to call a
"native simscript function. If zero is returned, the interpreter
"will assume the function is not-implemented and will try to invoke
"one of the built in native functions. If that fails a runtime
"error is generated.
```
The native method takes the same arguments as the evaluate method. These include the function name, a Variable reference that is to hold the return value, and an array of Variables for the argument list. The SIMSCRIPT application can override this method and compare the name against its own list of names. If a match is not found, the “inherited” native method can be called to try for a match. If a match is found, the array of Variable references (argument list) can be unpacked and the SIMSCRIPT function called. (There is no need to allocate the result variable or argument list array, they are allocated by the caller).
Additional native functions can be defined specifically for the SEM application. These “add on” function are necessary to provide a way for the implemented business rules to communicate with the simulation. For example, here are some possible SEM native functions that can be invoked in the business rule.
<table>
<thead>
<tr>
<th>Name</th>
<th>Arguments</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>getFirstSupplySite</td>
<td><none></td>
<td>Returns first site</td>
</tr>
<tr>
<td>getNextSupplySite</td>
<td>pSite</td>
<td>Returns the next site in the list.</td>
</tr>
<tr>
<td>backOrderDays</td>
<td>pSite, pPart</td>
<td>Returns # back order days for a given part at given site</td>
</tr>
<tr>
<td>globalCondemns</td>
<td>pPart</td>
<td>Returns the number of condemns for a part</td>
</tr>
<tr>
<td>globalBuildRequisitions</td>
<td>pPart</td>
<td>Returns # of build requisitions</td>
</tr>
</tbody>
</table>
Part of the SEM derived interpreter can be written as follows:
```plaintext
method sem_interpreter'native(name, result_var, arglist)
define partPtr as a PartObj reference variable
define sitePtr as a SiteObj reference variable
select case name
case "globalPartsBuilt" ''return the GlobalPartsBuilt attribute
partPtr = get_pointer(arglist(1))
call set_integer(result_var)(globalPartsBuilt(partPtr))
case "globalCondemns" ''return the GlobalCondemns attribute
partPtr = get_pointer(arglist(1))
call set_integer(result_var)(globalCondemns(partPtr))
case "shelfDays" ''computes the # shelf dat attribute
partPtr = get_pointer(arglist(1))
sitePtr = get_pointer(arglist(2))
call set_integer(result_var)(getShelfDays(partPtr)(sitePtr))
default
return with Interpreter'native(name, result_var, arglist)
endselect
return with 1
end
8.6 Prototyping a native function
In order to insure that the SBR interpreter can interact properly with the business rule code, all native functions must not only be implemented by overriding the ‘native’ method, and adding code to unpack arguments etc, .. but must also be prototyped via the prototype method described in Section 8.1.
When the interpreter reads a function call in the SBR code it will check to make sure that a prototype exists for the function. The name of the function is passed to the prototype
method. The code written for prototype can then compare the name with the list of known functions (using a “select case” statement). If the name is found, an encoded text string is returned which describes both the return type and given arguments.
Native functions can take repeat arguments, but must be prototyped as such. If the last argument is repeated, a “+” must be appended to the end of the prototype text. For example, the prototype text for a function that returns with an INTEGER but accepts one or more REAL arguments would be “ir+”.
### 8.7 Advanced text output
By default output from the write statement as well as error messages will be printed to “standard output” (console window, unit 6) while error messages are printed to “standard error” (console window, unit 98). There may be cases where text output needs to be specially handled. (For example, to have the message printed to a file or a popup dialog box.) This can be accomplished by overriding the output method of the Interpreter class.
```plaintext
define output as a method given
1 text argument, ''text to be printed out
1 integer argument ''reason:
''_output_write -> write statement
''_output_write_crlf->write with return
''_output_compile_error
''_output_runtime_error
''This method is called when the Interpreter needs to print text. This
''will occur if a "write" statement is executed or if an error is
''encountered while reading or executing SBR code. The reason for
''printing is passed as the second argument. By default the text
''message will printed to standard output. This can be overridden
''to provide customized printing of messages.
The output method is called by the interpreter whenever text is to be printed as the result of a read (compile) error, a runtime error or by executing a “print” statement. The first argument contains the text to print out while the second argument (cause) specifies why the message is being printed. This may be one of the following values:
- `_output_write` The flush character (+) was found in a write statement
- `_output_write_crlf` The carriage return character (/) was encountered while evaluating a write statement
- `_output_compile_error` Error message for a compile error discovered while loading SBR code.
- `_output_runtime_error` Error message for a runtime error.
If the output method is not overridden, error output will be printed to “standard error” and text output will go to “standard output”. Note that when using the “write” statement the output method is only called at the time a newline “/” or flush “+” is written.
The following example shows how to print text messages from the “write” statement to the file “sbr_output.txt” and error messages to the file “sbr_errors.txt”.
''example code: overriding the output method to handle text output differently
method my_interpreter'output(message, cause)
define files_opened as an integer saved variable
if files_opened = 0
let files_opened = 1
open unit 1 for output, name is "sbr_output.txt"
open unit 2 for output, name is "sbr_errors.txt"
always
select case cause
case _output_write
write message as T * using 1 ''print to file
case _output_write_crlf
write message as T *, / using 1 ''print to file
case _output_compile_error, _output_runtime_error
write message as T *, / using 2 ''print to file
endselect
end
8.8 Complete Example
A complete example of the SIMSCRIPT Business Rules Interpreter can be found in the SIMSCRIPT III examples folder distributed with the SIMSCRIPT III product at:
$SIMHOME/sim_examples/sim3_examples/_sbr_examples/job_shop
Documentation for this example is found at
$SIMHOME/sim_examples/sim3_examples/_sbr_examples/job_shop/SIMSCRIPT_BusinessRulesInterpreter_Example.pdf
|
{"Source-Url": "http://www.simscript.net/docs/SIMSCRIPTIII_Business_Rules_Manual.pdf", "len_cl100k_base": 8486, "olmocr-version": "0.1.53", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 36415, "total-output-tokens": 8400, "length": "2e13", "weborganizer": {"__label__adult": 0.0002639293670654297, "__label__art_design": 0.0002233982086181641, "__label__crime_law": 0.00020873546600341797, "__label__education_jobs": 0.0007929801940917969, "__label__entertainment": 7.05718994140625e-05, "__label__fashion_beauty": 0.00010567903518676758, "__label__finance_business": 0.0004198551177978515, "__label__food_dining": 0.00024020671844482425, "__label__games": 0.00098419189453125, "__label__hardware": 0.0012559890747070312, "__label__health": 0.00019121170043945312, "__label__history": 0.0001494884490966797, "__label__home_hobbies": 8.183717727661133e-05, "__label__industrial": 0.0007119178771972656, "__label__literature": 0.0001264810562133789, "__label__politics": 0.00016045570373535156, "__label__religion": 0.000270843505859375, "__label__science_tech": 0.0190277099609375, "__label__social_life": 4.696846008300781e-05, "__label__software": 0.020660400390625, "__label__software_dev": 0.953125, "__label__sports_fitness": 0.0002353191375732422, "__label__transportation": 0.0002989768981933594, "__label__travel": 0.00012153387069702148}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 34120, 0.01046]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 34120, 0.64494]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 34120, 0.73962]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 2752, false], [2752, 4071, null], [4071, 4880, null], [4880, 6824, null], [6824, 7958, null], [7958, 9886, null], [9886, 10135, null], [10135, 10536, null], [10536, 10791, null], [10791, 14250, null], [14250, 15428, null], [15428, 17058, null], [17058, 19369, null], [19369, 21603, null], [21603, 25255, null], [25255, 27722, null], [27722, 30298, null], [30298, 32924, null], [32924, 34120, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 2752, true], [2752, 4071, null], [4071, 4880, null], [4880, 6824, null], [6824, 7958, null], [7958, 9886, null], [9886, 10135, null], [10135, 10536, null], [10536, 10791, null], [10791, 14250, null], [14250, 15428, null], [15428, 17058, null], [17058, 19369, null], [19369, 21603, null], [21603, 25255, null], [25255, 27722, null], [27722, 30298, null], [30298, 32924, null], [32924, 34120, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 34120, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 34120, null]], "pdf_page_numbers": [[0, 0, 1], [0, 2752, 2], [2752, 4071, 3], [4071, 4880, 4], [4880, 6824, 5], [6824, 7958, 6], [7958, 9886, 7], [9886, 10135, 8], [10135, 10536, 9], [10536, 10791, 10], [10791, 14250, 11], [14250, 15428, 12], [15428, 17058, 13], [17058, 19369, 14], [19369, 21603, 15], [21603, 25255, 16], [25255, 27722, 17], [27722, 30298, 18], [30298, 32924, 19], [32924, 34120, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 34120, 0.22277]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
077637c6a2fc989129d3e52cf92960c967b514b1
|
[REMOVED]
|
{"len_cl100k_base": 10472, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 41976, "total-output-tokens": 11963, "length": "2e13", "weborganizer": {"__label__adult": 0.00032711029052734375, "__label__art_design": 0.0005621910095214844, "__label__crime_law": 0.0004813671112060547, "__label__education_jobs": 0.0024471282958984375, "__label__entertainment": 0.00015079975128173828, "__label__fashion_beauty": 0.0002186298370361328, "__label__finance_business": 0.0007734298706054688, "__label__food_dining": 0.00035381317138671875, "__label__games": 0.0007810592651367188, "__label__hardware": 0.0013303756713867188, "__label__health": 0.0005850791931152344, "__label__history": 0.0005021095275878906, "__label__home_hobbies": 0.00015997886657714844, "__label__industrial": 0.0009698867797851562, "__label__literature": 0.0003936290740966797, "__label__politics": 0.0004372596740722656, "__label__religion": 0.0005488395690917969, "__label__science_tech": 0.398681640625, "__label__social_life": 0.0001710653305053711, "__label__software": 0.03759765625, "__label__software_dev": 0.55126953125, "__label__sports_fitness": 0.0002589225769042969, "__label__transportation": 0.0005578994750976562, "__label__travel": 0.0002065896987915039}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 53179, 0.03959]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 53179, 0.21338]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 53179, 0.90518]], "google_gemma-3-12b-it_contains_pii": [[0, 3490, false], [3490, 8483, null], [8483, 11205, null], [11205, 16303, null], [16303, 20870, null], [20870, 25545, null], [25545, 30596, null], [30596, 37536, null], [37536, 42738, null], [42738, 42894, null], [42894, 48426, null], [48426, 52422, null], [52422, 53179, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3490, true], [3490, 8483, null], [8483, 11205, null], [11205, 16303, null], [16303, 20870, null], [20870, 25545, null], [25545, 30596, null], [30596, 37536, null], [37536, 42738, null], [42738, 42894, null], [42894, 48426, null], [48426, 52422, null], [52422, 53179, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 53179, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 53179, null]], "pdf_page_numbers": [[0, 3490, 1], [3490, 8483, 2], [8483, 11205, 3], [11205, 16303, 4], [16303, 20870, 5], [20870, 25545, 6], [25545, 30596, 7], [30596, 37536, 8], [37536, 42738, 9], [42738, 42894, 10], [42894, 48426, 11], [48426, 52422, 12], [52422, 53179, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 53179, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
8bc4bf7580aa8b1bb974c23535c96f725678db12
|
Proving Non-Deterministic Computations in Agda
Sergio Antoy
Computer Science Dept.
Portland State University
Oregon, U.S.A.
antoys@pdx.edu
Michael Hanus
Institut für Informatik
CAU Kiel
Germany
mh@informatik.uni-kiel.de
Steven Libby
Computer Science Dept.
Portland State University
Oregon, U.S.A.
slibby@pdx.edu
We investigate proving properties of Curry programs using Agda. First, we address the functional correctness of Curry functions that, apart from some syntactic and semantic differences, are in the intersection of the two languages. Second, we use Agda to model non-deterministic functions with two distinct and competitive approaches incorporating the non-determinism. The first approach eliminates non-determinism by considering the set of all non-deterministic values produced by an application. The second approach encodes every non-deterministic choice that the application could perform. We consider our initial experiment a success. Although proving properties of programs is a notoriously difficult task, the functional logic paradigm does not seem to add any significant layer of difficulty or complexity to the task.
1 Introduction
The growing interest in software correctness has led to a variety of approaches for proving, or increasing one’s confidence, that a program computes what is intended. Examples of this include formal verification [11], design by contract [22], program analysis [23] and model checking [21]. We are interested in the functional correctness of a program, i.e., the property that each input to the program produces the intended output. Agda [24], a language and system based on dependent types, is designed for this purpose.
Agda programs define types and functions. Types are seen as statements, and functions as constructive proofs of those statements according to the Curry-Howard isomorphism [15]. Agda functions resemble those of Haskell [26]. Agda types extend Haskell’s type system since definitions can be parameterized by (depend on) values of other types. We are interested in proving properties of Curry programs [18]. Curry programs define types and functions that resemble those of Haskell as well, but with a key difference: A “function” in Curry can be non-deterministic. Loosely speaking, this means that for the same input, the function can return one of a set of values. These non-deterministic functions are not functions in the mathematical sense, but using them as functions is convenient. In particular, functional application and functional nesting provide optimally lazy non-deterministic computations [1].
For example, the following Curry code defines a function \texttt{perm}, that takes a list of elements and returns any permutation of the list non-deterministically.
\begin{verbatim}
perm [] = []
perm (x:xs) = ndinsert x (perm xs)
ndinsert x [] = x:
ndinsert x (y:ys) = x:y:ys ? y:ndinsert x ys
\end{verbatim}
The question mark in the last rule denotes the choice operation defined by the rules:
\begin{itemize}
\item \texttt{perm} \texttt{[]} = \texttt{[]}
\item \texttt{perm} (\texttt{x:xs}) = \texttt{ndinsert x (perm xs)}
\item \texttt{ndinsert x []} = \texttt{x:[]}
\item \texttt{ndinsert x (y:ys) = x:y:ys} \texttt{? y:ndinsert x ys}
\end{itemize}
x ? y = x
x ? y = y
The semantics of this definition differs from Agda’s and Haskell’s. In the full spirit of declarative programming, there is no textual order among these rules. Thus, a value of t ? u is any value of t or any value of u. The choice is substantially equal to McCarthy’s amb operator [20].
Our goal is using Agda to prove the correctness of Curry programs. This must take into account where Curry differs from Adga, e.g., non-determinism, the order of evaluation, and non-termination. Non-determinism may cause some computations to fail, and non-termination is essential for Curry’s lazy evaluation. While all these differences are relevant, the crucial one to handle is non-determinism.
First, we discuss a class of programs that substantially is the same in Agda and Curry, hence proving the functional correctness of an Agda program in this class proves it for Curry as well. Then, we discuss two techniques to cast non-deterministic Curry programs into programs in the previous class, hence extending proofs to non-deterministic programs. The proofs and libraries discussed in this paper are available at github.com/mihanus/curry-agda.
2 Curry
Before discussing our techniques for proving properties of Curry programs, we briefly review some aspects of functional logic programming, and Curry, that are necessary to understand the content of this paper. More details can be found in recent surveys on functional logic programming [6, 17].
Curry [18] is a declarative, multi-paradigm language, intended to combine the most important features of functional and logic programming. The syntax of Curry is close to Haskell [26], only it is extended by allowing free (logic) variables in conditions and in right-hand sides of rules. Moreover, the patterns of a defining rule can be non-linear, i.e., they might contain multiple occurrences of a variable, which is an abbreviation for equalities between these occurrences.
The following simple program shows the functional and logic features of Curry. It defines an operation “++” to concatenate two lists, which is identical to the Haskell encoding. The second operation, ndins, shows an alternative definition of the non-deterministic list insertion shown in the introduction.
\[
\text{[]} ++ \text{ys} = \text{ys} \\
(x:xs) ++ \text{ys} = x : (xs ++ \text{ys}) = \text{ys} ++ [x] ++ \text{zs} \\
\]
Function calls can contain free variables. They are evaluated lazily where free variables, as demanded arguments, are non-deterministically instantiated. Since it is also known that free variables can be replaced by non-deterministic functions (value generators) [5], we mainly consider non-deterministic functions instead of free variables in this paper. Another major difference from Haskell is that the rules defining an operation are not applied in their textual order. Any rule which is applicable to some expression is applied non-deterministically to evaluate this expression. Thus, if Curry evaluates a call to the choice operation “?” defined in the introduction, both rules are applicable. Hence, the expression “0 ? 1” evaluates to 0 and 1 with the value non-deterministically chosen.
Although non-deterministic functions are a useful programming feature that leads to new design patterns [7], they also cause semantic subtleties that need to be clarified. For instance, consider the following function to double the value of an integer number:
\[
\text{double } x = x + x
\]
\(^1\)Note that Curry requires the explicit declaration of free variables, as \text{ys} and \text{zs} in the rule of ndins, to ensure checkable redundancy.
One would expect that the result of this operation is always an even number. Actually, we will show in Sect. 6 how to prove this property with Agda. However, it is not obvious that this property holds with respect to non-deterministic computations. For instance, one might consider the following derivation:
\[
\text{double } (0?1) \rightarrow (0?1) + (0?1) \rightarrow 0 + (0?1) \rightarrow 0 + 1 \rightarrow 1
\]
In this derivation, we use two different values for a single argument. Although one might consider such derivations as acceptable, which is known as a run-time choice semantics, they come with a potential problem. The result of such computations depends on the evaluation strategy—an aspect that should be avoided in a declarative language. For instance, 1 cannot be obtained as a result of double (0?1) with respect to an eager (innermost) evaluation. Therefore, Curry and similar functional logic languages adapt the call-time choice semantics [19] to obtain a strategy-independent combination of functional and non-deterministic programming. Intuitively, an argument passed to a function always has a unique value. This does not mean that one cannot use non-deterministic functions as arguments, but it implies that a call like double (0?1) is interpreted like two calls, double 0 and double 1. The details of this semantics, known as the CRWL rewriting logic, can be found in [16].
3 Agda
Agda is a dependently typed functional language, [9, 25] and is based on intuitionistic type theory. Similar to Curry, Agda datatypes are introduced by a data declaration, which gives the name and type of the datatype as well as the constructors and values in that type. Agda’s types are much more general than Curry’s, because type definitions may depend on values, e.g., the type of lists of a given length. Agda functions are also required to produce a result for every application. Thus, a function definition must cover a complete set of patterns and an application must terminate for every argument. The parameter passing mode of a function application is by-value, i.e., the arguments are normalized before the application. Very loosely speaking, Adga has a richer set of types, whereas Curry has a richer set of functions.
An Agda program typically defines some types, and functions over these types. A later example defines the functions “+”, which takes two natural numbers (in unary representation) and returns their sum, and even, which takes a natural number and returns a Boolean value telling whether the argument is an even number. A third function, whose identifier is even-x+x, takes a natural x, and has the return type even (x + x) \equiv \text{tt}, where \text{tt} is the Boolean value true, “\equiv” is the propositional equality, and “+” and even were previously defined. According to the Curry-Howard isomorphism [15], the existence of a function of this type, witnessed by its definition, proves the statement captured by the return type: for every natural x, x + x is even.
Our goal is to prove statements about Curry functions. Thus, we will define types that capture the statements we wish to prove, and encode, when we can, definitions of functions of these types. These will be the proofs of the statements. An obvious problem is that Curry allows us to encode functions that cannot be encoded in Agda, and even those that are syntactically similar in the two languages have significant semantic differences. Therefore, we will restrict the functions we consider, and discuss the validity of the statements that we prove despite the semantic differences.
4 Non-determinism
In this section we discuss two approaches to model non-deterministic computations in Agda. Consider the function perm defined in the introduction. The Curry evaluation of perm [1,2,3] may return...
or any of the six permutations of the argument. Suppose that we wish to prove that for any list \( L \), \( \text{perm} L \) has the same length as \( L \). A crucial task is modeling \( \text{perm} \) in Agda, which does not allow non-determinism. To understand our approaches, let us first develop a hypothetical computation of \( \text{perm} [1,2,3] \) in Curry. We take some liberties that will rectify shortly:
\[
\begin{align*}
\text{perm} [1,2,3] & \rightarrow \text{ndinsert} 1 (\text{perm} [2,3]) \quad (1) \\
& \rightarrow \text{ndinsert} 1 [2,3] \quad (2) \\
& \rightarrow [1,2,3] \ ? 2 : \text{ndinsert} 1 [3] \quad (3) \\
& \rightarrow 2 : \text{ndinsert} 1 [3] \quad (4) \\
& \rightarrow [2,1,3] \quad (5)
\end{align*}
\]
In line (1) we eagerly evaluate \( \text{perm} [2,3] \) and arbitrarily assume that it returns \([2,3]\). In line (3) we arbitrarily choose the right argument of “?” in line (4) we eagerly evaluate \( \text{ndinsert} 1 [3] \), and arbitrarily assume that it returns \([1,3]\).
Since we are going to code \( \text{perm} \) in Agda, we must adopt eager evaluation. In Curry the order of evaluation does not affect the result of a computation, as long as the result is obtained. Thus, for strongly terminating programs, the functional correctness of a program is independent of eager vs. lazy evaluation. The real problem is to model the somewhat arbitrary choices made by non-deterministic functions.
### 4.1 Set of values
Our first approach encodes a Curry non-deterministic function \( f \) into an Agda function \( f' \), which must be deterministic. For any given argument, \( f' \) returns the set of all the values that \( f \) could possibly return. To this aim, we declare a set-like structure as follows:
\[
\text{data \ ND (A : Set) : Set where}
\begin{align*}
\text{Val} & : A \rightarrow \text{ND A} \\
_??_ & : \text{ND A} \rightarrow \text{ND A} \rightarrow \text{ND A}
\end{align*}
\]
The constructor \( \text{Val} \) abstracts a deterministic value in the set. The constructor “??” makes a set out of two sets, and captures a non-deterministic choice.
For example, type \( \text{ND} \) is used to code an Agda function, \( \text{perm} \), that computes the set of all the permutations of its argument.
\[
\begin{align*}
\text{ndinsert} & : \{A : \text{Set}\} \rightarrow A \rightarrow L A \rightarrow \text{ND} (L A) \\
\text{ndinsert} x [] & = \text{Val} (x :: []) \\
\text{ndinsert} x (y :: ys) & = \text{Val} (x :: y :: ys) \\
& \quad ?? (_::_ y) \$* \ (\text{ndinsert} x ys) \\
\text{perm} & : \{A : \text{Set}\} \rightarrow L A \rightarrow \text{ND} (L A) \\
\text{perm} [] & = \text{Val} [] \\
\text{perm} (x :: xs) & = \text{ndinsert} x \*\$* \ (\text{perm} xs)
\end{align*}
\]
The functions “\$*” and “\*\$*” are defined in a library that we have developed for our purpose (see Sect. 5). Function “\$*” is a standard \( \text{map} \) function over the \( \text{ND} \) structure, i.e., it applies the first argument, a deterministic function, to every value of the second. Function “\*\$*” is also a \( \text{map} \), but its first argument is a non-deterministic function.
With this infrastructure, the statement that any permutation of a list \( L \) has the same length as \( L \) is formalized as follows:
\[
\begin{align*}
\text{perm-length} & : \{A : \text{Set}\} \rightarrow (xs : L A) \\
& \quad \rightarrow (\text{perm} xs) \text{ satisfy } (\lambda ys \rightarrow \text{length} ys = \text{N} \ \text{length} xs) \equiv \text{tt}
\end{align*}
\]
In the above statement, \texttt{satisfy} is another library function, which is infix, with the meaning intended by its name. The symbols "$\equiv$N" and "$\equiv$" stand for natural number equality and propositional equality, respectively. The value \texttt{tt} stands for the Boolean value \texttt{true}. Informally, the statement is read as “Given any list \texttt{xs} of elements in any set \texttt{a}, any value \texttt{ys} of \texttt{perm} \texttt{xs} satisfies the condition \texttt{length} \texttt{ys} = \texttt{length} \texttt{xs}, where \texttt{length} is the usual function that computes the length of a list.” The proof of this claim requires a few lemmas, and is approximately one page long.
### 4.2 Planned choices
Our second approach encodes a Curry non-deterministic function \texttt{f} into a deterministic Agda function \texttt{f'}, that takes an extra argument. This argument abstracts the non-deterministic choices made by \texttt{f} during the computation of a result. By passing these choices, \texttt{f'} becomes deterministic and executes the same steps, and produces the same result, as \texttt{f}.
Referring to our non-deterministic computation in the last section, the extra argument of \texttt{perm} will encode that, in line (3), the right argument of “?" has to be selected. Many proofs of non-deterministic computations involve statements that hold for each non-deterministic value, as in our previous example. Therefore, these statements are independent of the choices made during the computation. For this reason the extra argument that encodes the choices is abstract, i.e., never has a concrete value.
With this approach, we parameterize an Agda module with four abstractions:
1. \texttt{Choice : Set} – a type abstracting non-determinism. A value of this type plans the choices that will be made by a non-deterministic computation.
2. \texttt{choose : Choice \rightarrow B} – a function that returns whether the left or right argument of “?" should be selected.
3. \texttt{lchoice : Choice \rightarrow Choice} – a function that produces choices from choices. The intent is that the choices of the result are independent of the choices of the argument. The reason for this function will be discussed shortly.
4. \texttt{rchoice : Choice \rightarrow Choice} – a function like the previous one, but it produces other independent choices.
With this machinery, the function that computes a permutation of a list is defined as follows:
\begin{verbatim}
ndinsert : {A : Set} \rightarrow Choice \rightarrow A \rightarrow L A \rightarrow L A
ndinsert _ n [] = n :: []
ndinsert ch n (x :: xs) = if choose ch then n :: x :: xs
else x :: ndinsert (lchoice ch) n xs
perm : {A : Set} \rightarrow Choice \rightarrow L A \rightarrow L A
perm _ [] = []
perm ch (y :: ys) = ndinsert (lchoice ch) y (perm (rchoice ch) ys)
\end{verbatim}
The first required argument of these functions is the plan of the non-deterministic choices. For example, in the second rule of \texttt{ndinsert}, this argument determines whether or not argument \texttt{x} should be inserted at the front of the second argument.
The second rule of \texttt{perm} justifies the necessity of functions \texttt{lchoice} and \texttt{rchoice}. Both \texttt{perm} and \texttt{ndinsert} make non-deterministic choices. The choices made by one function must be independent of the other, otherwise some intended result could be lost. Hence we need to “fork” the choices encoded by argument \texttt{ch}.
With this infrastructure, the statement that any permutation of a list \texttt{L} is as long as \texttt{L} is formalized as follows:
\begin{verbatim}
perm-length : {A : Set} → (ch : Choice) → (xs : LL A)
→ length (perm ch xs) ≡ N length xs ≡ tt
\end{verbatim}
Informally, the statement is read as “Given any plan of non-deterministic choices \(\text{ch}\), and any list \(\text{xs}\) of elements in any set \(A\), the length of the permutation of \(\text{xs}\) according to \(\text{ch}\) is the same as the length of \(\text{xs}\).” The proof is only a few lines long.
\section{Libraries}
In order to support the direct translation of Curry programs to Agda, and to prove theorems about the translated programs, we developed Agda libraries containing some ubiquitous functions and theorems. In particular, the encoding presented in Sect. 4.1 demands such a support. Therefore, we consider only this encoding in this section.
Any Curry function can be non-deterministic. Hence, in our “set of values” encoding, any translated function has a result of type \(\text{ND}\) and must accept arguments of type \(\text{ND}\). Thus, a Curry function of type
\[
\tau_1 \rightarrow \cdots \rightarrow \tau_n \rightarrow \tau
\]
should be translated into an Agda function of type
\[
\text{ND} \tau_1 \rightarrow \cdots \rightarrow \text{ND} \tau_n \rightarrow \text{ND} \tau
\]
Since the type \(\text{ND}\) has two constructors, a direct definition of these Agda functions would be lengthy, and would also result in lengthy and tedious proofs. We can simplify the translation based on the following observations:
- Some definitional cases are identical for all functions. An argument of the form \(t_1 ?? t_2\) leads to a non-deterministic result. The function is applied to both alternatives \(t_1\) and \(t_2\) and their results are combined with “??” (this is also called a “pull-tab” step in [3]).
- Curry functions are defined with patterns in the left-hand side. It should be sufficient to define the translated Agda functions on patterns, and use the \(\text{ND}\) type only in the right-hand side.
Therefore, we translate a Curry function of the type shown above into an Agda function of type
\[
\tau_1 \rightarrow \cdots \rightarrow \tau_n \rightarrow \text{ND} \tau
\]
which allows a more direct translation. We can even improve this translation by analyzing the operation in more detail. If the function is deterministic, i.e., it does not execute non-deterministic choices and calls only deterministic functions, we can omit the \(\text{ND}\) type in the result. This gives us a one-to-one correspondence between deterministic Curry functions and their Agda translation.
However, if constructors or functions are applied to other non-deterministic functions in the right-hand side of a defining rule, this application is no longer directly possible, because they do not accept arguments of type \(\text{ND}\). Therefore, our Agda library provides two operations to extend such application into a non-deterministic context:
1. In order to apply a constructor or deterministic function to a non-deterministic expression, we define the application operator “\(\text{\$\$}\)”:
\[
\text{\$\$} : \{A B : \text{Set}\} → (A → B) → \text{ND} A → \text{ND} B
\]
\[
f \text{\$\$} (\text{Val} \ \text{xs}) = \text{Val} \ (f \ \text{xs})
\]
\[
f \text{\$\$} (t_1 ?? t_2) = f \text{\$\$} \ t_1 ?? f \text{\$\$} \ t_2
\]
Thus, “\(\text{\$\$}\)” applies a deterministic function to all values (first rule) and distributes a non-deterministic choice to non-deterministic results (second rule). An application of “\(\text{\$\$}\)” was shown in the translation of \text{ndinsert} in Sect. 4.1.
2. To apply a non-deterministic function to a non-deterministic expression, we define the function
\[ *\star \]
\[ \_ \star \star \_ : \{ A : \text{Set} \} \rightarrow (A \rightarrow \text{ND} B) \rightarrow \text{ND} A \rightarrow \text{ND} B \]
\[ f \star \star (\text{Val} x) = f \, x \]
\[ f \star \star (t_1 ?? t_2) = f \star \star t_1 ?? f \star \star t_2 \]
The behavior on choices is similar to \[ \$\star \]. However, for each value \( x \), the non-deterministic function \( f \) is applied to obtain a non-deterministic value (first rule). Therefore, \[ *\star \star \] is used to combine nested calls of non-deterministic functions. The extension to non-deterministic functions of arities greater than one can be obtained by nested applications of this operator. An example application was shown in the translation of \texttt{perm} in Sect. 4.1.
In addition to these functions that support the translation of Curry functions into Agda functions, our library also includes various operations on the \texttt{ND} type. These operations support the formulation of theorems about the translated Curry programs in Agda. In general, we are interested in proving properties that are satisfied by all computed values, like the length property of permutations shown in Sect. 4.1. For this purpose, we define a predicate \texttt{satisfy} (as an infix operator) which is true if all values in a set satisfy a given predicate:
\[ \_ \texttt{satisfy} \_ : \{ A : \text{Set} \} \rightarrow \text{ND} A \rightarrow (A \rightarrow \text{B}) \rightarrow \text{B} \]
\[ (\text{Val} \, n) \texttt{satisfy} \, p = p \, n \]
\[ (t_1 ?? t_2) \texttt{satisfy} \, p = t_1 \texttt{satisfy} \, p && t_2 \texttt{satisfy} \, p \]
The use of this predicate to formulate a property about the non-deterministic \texttt{perm} function was shown in the statement \texttt{perm-length} in Sect. 4.1.
When one tries to prove such statements, one often needs to prove lemmas about properties of the involved functions, like \[ \$\star \] and \[ *\star \star \]. In order to simplify these proofs, we also defined and proved a library of Agda theorems to relate these functions with predicates like \texttt{satisfy}. For instance, the following lemma relates \[ \$\star \] and the predicate \texttt{satisfy} (where \( \circ \) denotes function composition, i.e., \( (f \circ g) \, x \equiv f \, (g \, x) \)):
\[ \texttt{satisfy-\$\star} : \{ A : \text{Set} \} \rightarrow (f : A \rightarrow \text{B}) \rightarrow \text{ND} A \rightarrow (xs : \text{ND} A) \rightarrow (p : A \rightarrow \text{B}) \rightarrow \text{B} \]
\[ \rightarrow (f \, \circ \, \text{Val} \, n) \texttt{satisfy} \, p = p \, n \]
\[ (t_1 ?? t_2) \texttt{satisfy} \, p = t_1 \texttt{satisfy} \, p && t_2 \texttt{satisfy} \, p \]
This lemma allows us to eliminate a call to \[ \$\star \] by moving the applied function \( f \) inside the predicate. The proof of this lemma is easily done by induction on the tree structure \texttt{ND}.
The formulation of a similar lemma for \[ *\star \star \] is a bit more involved since the applied function is non-deterministic. However, if we assume the existence of a proof that this function already satisfies the predicate for all values (given as the last argument to this lemma), we can eliminate a call to \[ *\star \star \]:
\[ \texttt{satisfy-\star\star} : \{ A : \text{Set} \} \rightarrow (f : A \rightarrow \text{ND} B) \rightarrow (xs : \text{ND} A) \rightarrow (p : A \rightarrow \text{B}) \rightarrow (y : A) \rightarrow (f \, \circ \, \text{Val} \, n) \texttt{satisfy} \, p = p \, n \rightarrow \text{ND} A \rightarrow (xs : \text{ND} A) \rightarrow (p : A \rightarrow \text{B}) \rightarrow \text{B} \]
\[ \rightarrow (f \, \circ \, f \ast \star \star) \texttt{satisfy} \, p = p \, \circ \, (f \, \circ \, \text{Val} \, n) \texttt{satisfy} \, p \]
Our library contains more predicates and lemmas that are useful to state and prove specific properties of Curry programs. For instance, to show that some non-deterministic Boolean expression is always true, one can use the following predicate:
\[ \texttt{always} : \text{ND} \, \text{B} \rightarrow \text{B} \]
\[ \texttt{always} \, (\text{Val} \, b) = b \]
\[ \texttt{always} \, (t_1 ?? t_2) = \texttt{always} \, t_1 && \texttt{always} \, t_2 \]
A lemma to eliminate an occurrence of \[ \$\star \] in the context of \texttt{always} is the following:
\[ \texttt{always-\$\star} : \{ A : \text{Set} \} \rightarrow (p : A \rightarrow \text{B}) \rightarrow (xs : \text{ND} A) \rightarrow \text{B} \]
\[ \rightarrow (p \, \circ \, f \, \circ \, \text{Val} \, n) \texttt{satisfy} \, p = p \, \circ \, f \, \circ \, \text{Val} \, n \texttt{satisfy} \, p \rightarrow (p \, \circ \, \text{Val} \, n) \texttt{satisfy} \, p = p \, \circ \, \text{Val} \, n \texttt{satisfy} \, p \]
\[ \rightarrow (p \, \circ \, f \, \circ \, xs) = p \, \circ \, f \, \circ \, xs \]
It states that, if there is a proof that \( p \) is always true, the application of \( p \) to a non-deterministic value is also true. An application of this lemma is shown in the following section, where we discuss some examples to prove properties of Curry programs.
6 Examples
6.1 Example 1
In this example, we assume that natural numbers are defined in Peano representation as follows:
\[
data \text{Nat} = \mathbb{Z} | \text{S Nat}
\]
The following Curry function non-deterministically yields an even and an odd number close to its input value:
\[
eo :: \text{Nat} \rightarrow \text{Nat}
eo n = n \oplus (\text{S } n)
\]
To show some interesting property related to \( \text{eo} \), consider the function \( \text{double} \), shown in Sect. 2, and the predicate \( \text{even} \):
\[
even :: \text{Nat} \rightarrow \text{Bool}
even \text{Z} = \text{True}
even \text{(S Z)} = \text{False}
even \text{(S (S x))} = \text{even} x
\]
We want to prove that, for all natural numbers \( n \), \( \text{even} \ (\text{double} \ (\text{eo} \ n)) \) is always \text{True}. Note that this property holds only for the call-time choice semantics of Curry (see Sect. 2). In the run-time choice semantics, or term rewriting, this property does not hold.
To prove this property with Agda, we have to translate the program to Agda. Since \( \text{double} \) and \( \text{even} \) are deterministic functions, they can be directly translated into Agda functions, where the constructors of the Curry program are translated into corresponding constructors already defined in Agda:
\[
double : \text{N} \rightarrow \text{N}
double x = x + x
even : \text{N} \rightarrow \text{B}
even \text{zero} = \text{tt}
even \text{(suc 0)} = \text{ff}
even \text{(suc (suc x))} = \text{even} x
\]
Since non-determinism is not involved here, we can prove that \( \text{even} \ (\text{double} \ n) \) is always \text{true} by standard techniques. For this purpose, we state the lemma
\[
even-x+x : (x : \text{N}) \rightarrow \text{even} \ (x + x) \equiv \text{tt}
\]
which is immediately proved by induction on its argument. Exploiting this lemma, we can prove our intended property:
\[
even-double-true : (x : \text{N}) \rightarrow \text{even} \ (\text{double} x) \equiv \text{tt}
even-double-true \ x \ rewrite \ even-x+x \ x = \text{refl}
\]
In order to prove our initial property about the expression \( \text{even} \ (\text{double} \ (\text{eo} \ n)) \), we have to decide about the representation of non-determinism introduced in Sect. 4. If we choose the “set of values” representation, the function \( \text{eo} \) is defined as follows:
\[
eo : \text{N} \rightarrow \text{ND} \text{N}
eo n = \text{Val} n \oplus \text{Val} (\text{Suc} n)
\]
Using the library functions presented in the previous section, the Curry expression \( \text{even} \ (\text{double} \ (\text{eo} \ n)) \) is represented in Agda as:
The proof of our property is just an application of the lemma always-$*$ (see Sect. 5) to the previous lemma:
\[
\text{even-double-eo-true : } (n : \mathbb{N}) \rightarrow \text{always} \left( \text{always-$*$ (even } \circ \text{ double}) (\text{eo } n) \right) \equiv \text{tt}
\]
\[
\text{even-double-eo-true } n = \text{always-$*$ (even } \circ \text{ double}) (\text{eo } n) \text{ even-double-true}
\]
The second “choice” representation of non-determinism provides for a more direct proof. We pass the plan of non-deterministic choices as the first argument to eo:
\[
eo : \text{Choice } \rightarrow \mathbb{N} \rightarrow \mathbb{N}
\]
\[
eo n = \text{if choose } ch \text{ then } n \text{ else } \text{suc } n
\]
Then the proof is an immediate application of the lemma even-double-true:
\[
\text{even-double-eo-true : } (ch: \text{Choice}) (n : \mathbb{N}) \rightarrow \text{even} \left( \text{double } (\text{eo } ch \ n) \right) \equiv \text{tt}
\]
\[
\text{even-double-eo-true } ch \ n = \text{even-double-true } (\text{eo } ch \ n)
\]
As we can see, the proof with the “choice” representation is more direct, and shorter, than with the “set of values” representation, as already mentioned in Sect. 4 for the property of the length of permutations.
### 6.2 Example 2
So far we have proved properties about predicates, however, we have not discussed any notion of equality. In Agda, two terms are equal if their values are syntactically equal. This is denoted by the standard definition:
\[
data \_\equiv\_ \{A : \text{Set}\} (x : A) : A \rightarrow \text{Set} \text{ where}
\]
\[
\text{refl} : x \equiv x
\]
\[\text{e.g., } 1+1 \equiv 2.\]
However, we cannot apply this relation to non-deterministic values for the simple reason that deterministic values and non-deterministic values are structurally different. For example, given the non-deterministic value:
\[
\text{coin} = (\text{Val } tt) ?? (\text{Val } ff)
\]
it would seem reasonable to state that \( tt \equiv \text{coin} \), but \( \text{coin} \) reduces to \( (\text{Val } tt) ?? (\text{Val } ff) \) which is not the same value as \( tt \).
Instead, we must define a new notion of equality for non-deterministic values. We chose an existential interpretation of equality for our representation. If a value \( x \) exists inside the set of values of a non-deterministic expression \( nx \), then the two are considered equivalent (non-deterministically equal). A proof of equivalence is then reduced to finding a path through the tree representing \( nx \). This leads to the following structure for proofs of equivalence.
\[
data \_\in\_ \{A : \text{Set}\} (x : A) : (nx : \text{ND } A) \rightarrow \text{Set} \text{ where}
\]
\[
\text{ndrefl} : x \in (\text{Val } x)
\]
\[
\text{left} : (l : \text{ND } A) \rightarrow (r : \text{ND } A) \rightarrow x \in l \rightarrow x \in (l ?? r)
\]
\[
\text{right} : (l : \text{ND } A) \rightarrow (r : \text{ND } A) \rightarrow x \in r \rightarrow x \in (l ?? r)
\]
Now we can give a proof that \( tt \) is in \( \text{coin} \):
\[
hInCoin : tt \in \text{coin}
\]
\[
hInCoin = \text{left } (\text{Val } tt) (\text{Val } ff) \text{ ndrefl}
\]
This can be read as \( tt \) is on the left side of the tree \( (\text{Val } tt) ?? (\text{Val } ff) \).
Now that we have a notion of equivalence, we can prove some more interesting results. Recall that \( \text{"$*$"} \) applies a function \( f \) to every value of a non-deterministic expression \( nx \). For consistency, it would be good to prove that if \( x \in nx \) then \( f \ x \in f \ \text{* } nx \). This is a simple structural induction.
\[\neg\neg f x (\text{Val} \, x) \equiv \text{ndrefl} = \text{ndrefl}\]
\[\neg\neg f x (l ?\! r) (\text{left} \, l \, r \, k) = \text{left} \, (f \, \neg\neg l) \, (f \, \neg\neg r) \, (\neg\neg f x \, l \, k)\]
\[\neg\neg f x (l ?\! r) (\text{right} \, l \, r \, k) = \text{right} \, (f \, \neg\neg l) \, (f \, \neg\neg r) \, (\neg\neg f x \, r \, k)\]
We can prove a similar result for \(\neg\neg\). The proof is nearly identical to \(\neg\neg\), but it has the general type:
\[\neg\neg f x (\text{Val} \, x) \equiv \text{ndrefl} = \text{ndrefl}\]
\[\neg\neg f x (l ?\! r) (\text{left} \, l \, r \, k) = \text{left} \, (f \, \neg\neg l) \, (f \, \neg\neg r) \, (\neg\neg f x \, l \, k)\]
\[\neg\neg f x (l ?\! r) (\text{right} \, l \, r \, k) = \text{right} \, (f \, \neg\neg l) \, (f \, \neg\neg r) \, (\neg\neg f x \, r \, k)\]
For a more interesting example, consider the problem of sorting a list. The problem of determining if a list is sorted has been studied extensively, but we would like to look at a conceptually more difficult problem. How can we determine if a sorted list is actually a permutation of the original list?
This has also been studied before now, and the solutions tend to be long and difficult to follow. A search of “github,” “agda” and “sort” gives half a dozen independent efforts. Since we defined the non-deterministic permutation function above, it would be nice to have a theorem like (for the sake of simplicity, we consider sorting natural numbers):
\[
\text{sortPerm} : (xs : \text{L} N) \rightarrow \text{sort} \, xs \equiv \text{perm} \, xs
\]
This is short, simple, and obviously correct if we trust \text{perm} to produce only permutations of a list. For this proof we will be using the following simple insertion sort.
\[
\begin{align*}
\text{insert} & \, : N \rightarrow \text{L} N \rightarrow \text{L} N \\
\text{insert} \, x \, [] & \, = x :: [] \\
\text{insert} \, x \, (y :: ys) & \, = \text{if} \, x < y \, \text{then} \, x :: y :: ys \\
& \quad \text{else} \, (y :: \text{insert} \, x \, ys)
\end{align*}
\]
\[
\begin{align*}
\text{sort} & \, : \text{L} N \rightarrow \text{L} N \\
\text{sort} \, [] & \, = [] \\
\text{sort} \, (x :: xs) & \, = \text{insert} \, x \, (\text{sort} \, xs)
\end{align*}
\]
We only need two lemmas. The first states that non-deterministic equivalence holds over conditional statements. This result allows us to introduce conditional statements when talking about equivalence.
\[
\text{ifIntro} : \{A : \text{Set}\} \rightarrow (x : A) \rightarrow (y : A) \rightarrow (nx : \text{ND} A) \rightarrow x \in nx \rightarrow y \in nx \rightarrow (c : B) \rightarrow (\text{if} \, c \, \text{then} \, x \, \text{else} \, y) \in nx
\]
The second lemma is an equivalence between our \text{insert} function and the non-deterministic \text{ndinsert} defined above. This will give the intuitive result that, for any list \(xs\), inserting a new element does not violate our non-deterministic equivalence. The type of this lemma is given by:
\[
\text{insert=ndinsert} : (y : N) \rightarrow (xs : \text{L} N) \rightarrow \text{insert} \, y \, xs \in \text{ndinsert} \, y \, xs
\]
The proof of this lemma contains two trivial cases, but the final case gives some insight into working with non-deterministic values. The idea is straightforward. Either the value \(y\) is inserted at the front of the list, or it is inserted somewhere in the tail. Since our non-deterministic \text{ndinsert} covers both of those cases we do not need to know exactly where it is inserted. We just pick the correct case.
The full code is given below for completeness. Variables \(l\) and \(r\) represent the left and right branches in \text{insert} respectively, while \(nl\) and \(nr\) are the corresponding branches for \text{ndinsert}. Additionally, \(rec\) is a recursive case if \(y\) is inserted in the tail of the list. Finally \(l\in\text{step}\) and \(r\in\text{step}\) are proofs that \(l\) and \(r\) are somewhere in the result of inserting \(y\) into the list.
\[
\text{insert=ndinsert} \, y \, (x :: xs) = \text{ifIntro} \, l \, r \, \text{step} \, l \in \text{step} \, r \in \text{step} \, (y < x) \text{ where}
\]
\[
\text{step} \, = \text{ndinsert} \, y \, (x :: xs)
\]
\[
l \, = (y :: x :: xs)
\]
\[
r \, = x :: \text{insert} \, y \, xs
\]
Finally, we have the tools to prove our sorting theorem. After the previous result the theorem is remarkably simple.
\[
\text{sortPerm} : (xs : \text{L } \text{N}) \rightarrow \text{sort } xs \in \text{perm } xs
\]
\[
\text{sortPerm } [] = \text{ndrefl}
\]
\[
\text{sortPerm } (x :: xs) = \langle \text{-*} \rangle (\text{sort } xs) (\text{perm } xs) (\text{insert } x) (\text{ndinsert } x)
\]
\[
\text{sortPerm } (\text{sort } xs) (\text{insert=ndinsert } x (\text{sort } xs))
\]
7 Partial Functions
Up to now we have considered non-deterministic but totally defined functions in our examples. However, functions in Curry can also be partially defined, and failures caused by such partial definitions are not a run-time error as in purely functional programming but a desirable feature that frees the programmer from specifying all computation details in a program. For instance, consider the problem of selecting a minimum element in a list of numbers. Such a function is easily defined in Curry:
\[
\text{minND} :: \text{[Int]} \rightarrow \text{Int}
\]
\[
\text{minND } xs@(\_ ++ [x] ++ \_ ) | \text{all (x<=} xs } = x
\]
To specify the selection of an arbitrary element without a concrete strategy, we use a functional pattern \[\text{[]}\] in the left-hand side of \text{minND}. The condition restricts the application of the rule to all selected elements that are less than or equal to all other elements. Thus, the condition fails on elements that are not minimal.
Although computations with failing branches are an important feature of functional logic languages, the modeling of failures in Agda is not straightforward. First of all, Agda requires that all functions are totally defined. Typically, the application of partially defined functions, like \text{head} or \text{tail} on lists, is restricted by a refined type, e.g., by requiring a proof that the argument of \text{head} or \text{tail} is a non-empty list. In our case this is not a reasonable solution since a Curry program actually deals with failed computations.
Another alternative to deal with partially defined functions is to extend the result type to indicate a non-successful application of a function. For instance, one can use the \text{Maybe} type to define \text{head} as a total function in Agda:
\[
\text{head} : \{A : \text{Set}\} \rightarrow \text{L } A \rightarrow \text{maybe } A
\]
\[
\text{head } (x :: \_) = \text{just } x
\]
\[
\text{head } [] = \text{nothing}
\]
Unfortunately, this modeling is limited to “top-level” failures. For instance, doing the same for \text{tail} would inhibit nested applications of \text{tail} due to typing reasons.
Another, and more serious, problem is the fact that Curry, as a lazy language, can also ignore failures if they occur in arguments that are not demanded. For instance, the Curry expression
\[
\text{head } (0 : \text{tail } [])
\]
evaluates to 0 since the failure, which occurs if \text{tail } [] is evaluated, is ignored thanks to laziness. On the other hand, in Agda one cannot construct a list containing failures in the tail. To implement a similar expression in Agda, one has to evaluate, before constructing the list, the tail \text{tail } [], which returns
nothing, so that the entire computation fails. This has the consequence that, if we prove in Agda some
property about all successful computations, it might not be transferable to Curry, because Curry might
produce additional successful computations.
A possible solution to this problem could be a different modeling of Curry’s data structures in
Agda. For instance, instead of mapping Curry lists to Agda lists, one could include failures and non-
deterministic choices as list constructors:
```agda
data List (A : Set) : Set where
empty : List A
cons : A → List A → List A
Fail-List : List A
_??-List_ : List A → List A → List A
```
Then one can completely define tail on this structure:
```agda
tail : {A : Set } → List A → List A
tail (cons _ xs) = xs
tail empty = Fail-List
tail Fail-List = Fail-List
tail (l1 ??-List l2) = tail l1 ??-List tail l2
```
With such a representation, we can “totalize” all functions, and allow failures inside data structures.
Basically, it is quite similar to the translation of Curry programs into Haskell, which is the basis of the
Curry implementation KiCS2 [10]. However, it is also known that this translation models the run-time
choice semantics instead of the call-time choice semantics used in Curry (see Sect. 2). To obtain a call-
time choice semantics, one can attach unique identifiers to each choice constructor in order to make
consistent selections of computed values (see [10] for details). Although this is a systematic method to
translate Curry programs into purely functional programs, it does not seem adequate for Agda since the
generation of unique identifiers requires infinite data structures, and the resulting code is quite complex,
requiring more complex proofs.
Although the handling of partially defined functions is difficult in general, one can still use Agda
to prove properties of such functions, if the failures occur at the computation’s top-level so that one
can reason about their occurrences. For instance, consider the well-known functional logic definition of
computing the last element of a list by exploiting the list concatenation “++”:
```agda
last :: [a] → a
last xs | ys ++ [x] == xs = x where ys,x free
```
We want to show that last is a deterministic operation, i.e., for a fixed input list xs, the evaluation
of last xs cannot yield two different results. Although the definition of last is partial, and uses free
variables and non-determinism, the formulation and proof of this property is not difficult in Agda by
considering only the condition of last. We show that, if there are two pairs of values for ys and x that
satisfy the condition for some fixed xs, the two values for x are identical. This property can be expressed
(with some type specialization to increase readability) in Agda as follows:
```agda
last-det : (ys1 ys2 : L N) (x1 x2 : N) → =L _=N_ (ys1 ++ [ x1 ]) (ys2 ++ [ x2 ]) ≡ tt → x1 =N x2 ≡ tt
```
As a further example, consider again the non-deterministic and partial function minND from the beginning
of this section. We want to implement the same functionality in a deterministic manner by a list traversal:
```agda
minD :: [Int] → Int
minD [x] = x
minD (x:y:xs) = let z = minD (y:xs) in if x <= z then x else z
```
Since the correctness of this list traversal is not obvious, we take the definition of minND as the specification and prove that minD satisfies the specification, a typical task in (declarative) program development [8]. If we model minND with the “planned choices” translation, this property could be formulated in Agda as follows (the additional argument in the Agda function minD is a proof that the argument list is not empty; this is required since minD is partially defined but Agda accepts only total functions):
\[
\text{minlist-theorem : (ch \ : \ Choice) \ (x \ : \ N) \ (xs \ : \ L \ N) \ (z \ : \ N) \\
\quad \rightarrow \ \text{minND} \ ch \ (x :: xs) \equiv \text{just} \ z \rightarrow z =\ N \ \text{minD} \ (x :: xs) \ \text{refl} \equiv \ \text{tt}
\]
We use a maybe result type to express the partiality of the non-deterministic function minND and a proof of non-emptiness for the partiality of the deterministic function minD (as discussed above). Then the theorem states that, if \( z \) is a minimal value according to the specification, it will be computed by the deterministic implementation. The proof is non-trivial and requires various lemmas. In particular, the proof is split into showing that the non-deterministically selected element is smaller than, or equal to, than all other list elements, but it cannot be strictly smaller than all others since it is itself an element from the list.
### 8 Semantics
Since we prove properties of Agda functions, but are interested in properties of Curry functions, we discuss how to migrate from one environment to the other.
Initially, we consider datatypes, such as algebraically defined natural numbers, lists and trees, and functions operating on these types that have equal definitions, except for minor syntactic differences, in the two languages. We call the set of such types and functions the intersection of the two languages. For example, a function such as “length of a list”, returning a natural number, is in the intersection. Agda functions, including those in the intersection, are totally defined, terminating, and evaluated eagerly. The rules defining these functions are unconditional, deterministic, and without free variables. Any expression in the intersection has a value, because it is an Agda expression, and this value is the same in the two languages, because in this situation eager and lazy evaluations produce the same result. Thus, our first claim is that any statement about the input/output behavior of a function, i.e., its functional correctness, proved in Agda holds for Curry.
Then, we define Agda functions that simulate non-deterministic Curry functions. For example, a function such as “permutation of a list” simulates the corresponding non-deterministic Curry function. Regardless of the approach, either set of values or planned choices, these Agda functions are still in the intersection of the two languages. Thus, we can compare a simulated non-deterministic function (in Curry and Agda the behavior is the same) against the same native non-deterministic Curry function. Of course, the expectation is that the simulated and the native functions have the same behavior. Proving this fact would not involve Agda.
Curry has a rich syntax, and some high-level constructs that are convenient for programming, and are not in the intersection with Agda. These constructs can sometimes be mapped to more elementary Curry constructs that are in the intersection of the two languages, hence the set of Curry functions that we can reason about becomes larger. For example, Curry allows free variables in expressions that are instantiated by narrowing [27, 28]. Free variables are replaced by generators [5], non-deterministic functions, that are the focus of our work. Generators are typically non-terminating functions, shortly we will discuss a workaround. Curry also allows conditional rules. With some care, the conditions of conditional rules are moved to the right-hand sides [2]. Care is needed since Agda disallows incompletely defined functions. When there are conditions it may be difficult, or impossible, to tell whether a function is defined for all
inputs. Finally, Curry allows functions that do not terminate because of infinite recursion. When one such function is applied in a computation, the lazy evaluation strategy makes a recursive call only when the result of the call is demanded. To avoid non-termination in Agda, we add an additional argument that limits the number of recursive calls.
9 Related Work
There are only a few works on verifying properties of functional logic programs. One reason may be the fact that declarative programs are often considered as clear specifications so that there is nothing to prove about them. However, if one develops a more efficient version of a declarative program, because the initial version is not efficient enough in a particular application context, one wants to prove that the new version behaves like the initial version. This has been formalized in [8], where the notions of specifications and contracts for functional logic programs have been introduced together with some examples and proof obligations. Concrete methods to prove such obligations were not discussed. We have shown in this paper that it is possible to use Agda for this purpose, e.g., by proving that insertion sort computes a permutation of the input list, or that a non-deterministic selection of a minimum of a list is equivalent to a deterministic selection algorithm.
The use of proof assistants to verify functional logic programs has been pioneered in [12], where the call-time choice semantics has been formalized with different proof tools. Although the authors formally justified their translation by mapping the CRWL rewriting logic [16] into logic programs, only trivial properties, like $0 \in \text{double (0?1)}$, are proved. A similar approach is used in [14] where CRWL is translated into the specification language Maude, and some non-trivial but (compared to our approach) still simple properties are proved.
Since the formalization of the call-time choice semantics causes complex proofs, the proof method has been improved in [13] by a characterization of deterministic functions and expressions, and by using specific proof techniques for them. Although the authors were able to construct short proofs for deterministic properties inside functional logic programs, like the commutativity of addition, proofs for more complex properties have not been reported. These CRWL-translation based approaches can deal with the full class of functional logic programs, whereas our limited framework is able to verify non-trivial properties.
10 Conclusion
We have used the Agda system to verify the functional correctness of Curry functions. Our focus has been on Curry’s non-deterministic functions, a device akin to a function that returns one of many values for the same input. Such a device contributes the logic component of the language in a lazy functional setting.
We modeled non-determinism in two different ways. One considers at once all the non-deterministic values that a function may return. The other adds an argument to a function that encodes every non-deterministic choice that the function may make. Both models eliminate the non-determinism of a functions and enable us to use Agda, which is deterministic, to prove properties of non-deterministic functions.
We developed some libraries that define non-deterministic structures and prove generic lemmas about them. With the help of these libraries, we proved some interesting properties of Curry programs. We
highlighted the semantic differences between Agda and Curry, and discussed why, despite these differences, theorems proved in Agda migrate to Curry.
Proving properties of programs is a difficult task. Our effort shows that proving properties of Curry programs with Adga is possible, and that the logic component of Curry is not a major obstacle.
References
|
{"Source-Url": "https://www-ps.informatik.uni-kiel.de/~mh/papers/WFLP16_Agda.pdf", "len_cl100k_base": 13637, "olmocr-version": "0.1.50", "pdf-total-pages": 16, "total-fallback-pages": 0, "total-input-tokens": 47654, "total-output-tokens": 17188, "length": "2e13", "weborganizer": {"__label__adult": 0.0003821849822998047, "__label__art_design": 0.0003032684326171875, "__label__crime_law": 0.00037384033203125, "__label__education_jobs": 0.000774383544921875, "__label__entertainment": 7.295608520507812e-05, "__label__fashion_beauty": 0.0001659393310546875, "__label__finance_business": 0.00017595291137695312, "__label__food_dining": 0.0004820823669433594, "__label__games": 0.0006947517395019531, "__label__hardware": 0.0007338523864746094, "__label__health": 0.0005960464477539062, "__label__history": 0.00021982192993164065, "__label__home_hobbies": 0.00010019540786743164, "__label__industrial": 0.00041794776916503906, "__label__literature": 0.0003871917724609375, "__label__politics": 0.00030875205993652344, "__label__religion": 0.0005712509155273438, "__label__science_tech": 0.0205841064453125, "__label__social_life": 9.435415267944336e-05, "__label__software": 0.004154205322265625, "__label__software_dev": 0.96728515625, "__label__sports_fitness": 0.00031638145446777344, "__label__transportation": 0.0006265640258789062, "__label__travel": 0.00019752979278564453}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 57389, 0.01504]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 57389, 0.30397]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 57389, 0.82357]], "google_gemma-3-12b-it_contains_pii": [[0, 3282, false], [3282, 6903, null], [6903, 10720, null], [10720, 14244, null], [14244, 17868, null], [17868, 21452, null], [21452, 26378, null], [26378, 29279, null], [29279, 32912, null], [32912, 37223, null], [37223, 40444, null], [40444, 43686, null], [43686, 47859, null], [47859, 51333, null], [51333, 54998, null], [54998, 57389, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3282, true], [3282, 6903, null], [6903, 10720, null], [10720, 14244, null], [14244, 17868, null], [17868, 21452, null], [21452, 26378, null], [26378, 29279, null], [29279, 32912, null], [32912, 37223, null], [37223, 40444, null], [40444, 43686, null], [43686, 47859, null], [47859, 51333, null], [51333, 54998, null], [54998, 57389, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 57389, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 57389, null]], "pdf_page_numbers": [[0, 3282, 1], [3282, 6903, 2], [6903, 10720, 3], [10720, 14244, 4], [14244, 17868, 5], [17868, 21452, 6], [21452, 26378, 7], [26378, 29279, 8], [29279, 32912, 9], [32912, 37223, 10], [37223, 40444, 11], [40444, 43686, 12], [43686, 47859, 13], [47859, 51333, 14], [51333, 54998, 15], [54998, 57389, 16]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 57389, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
c0430a8a0d22de5e7a65d6541de50e1248793e2e
|
Toward Extracting $\pi$-calculus from UML Sequence and State Diagrams
Katerina Pokozy-Korenblat and Corrado Priami
Department of Informatics and Telecommunications
University of Trento
Povo, Italy
Abstract
We propose an automatic translation of UML specifications made up of sequence and state diagrams into $\pi$-calculus processes. The central point of the proposed translation is the coherence of the two types of diagrams. We show the feasibility of the approach on case studies.
Keywords: process algebras, $\pi$-calculus, UML, sequence diagram, state diagram, specification.
1 Introduction
The Unified Modelling Language (UML) [3] is a standard notation used to capture high-level design of software systems. It gives structured, semi-formal, graphical methods for specification which are however not strong enough for verification and validation of systems. UML provides the user with different kinds of diagrams, each of them is natural for describing different aspects of complex (software) systems. In this paper we restrict our attention on specifications including only sequence and state diagrams. Such a choice is often sufficient for specifying the communication level of systems and can be considered as a first step in handling multi-diagram UML specifications.
1 This work is partially supported by the DEGAS (Design Environment for Global Applications) project IST-2001-32072 funded by the FET Proactive Initiative on Global Computing
2 Email: pokozy@science.unitn.it
3 Email: priami@dit.unitn.it
To implement a formal analysis of a UML specification, we propose to translate it to the formal notation of process algebras \cite{13}. Process algebras are foundational calculi used to describe the concurrent and distributed structure of systems. They are made up of a few operators such as: i) $a \cdot -$ that describes sequential composition of actions, ii) $- | -$ that is the parallel composition of processes, iii) $- + -$ that denotes a nondeterministic choice.
We view here process algebras as an intermediate language into which UML specifications can be translated for the following analysis. Note that process algebras is a natural formalism for representing communications that is very important in a translation of sequence diagrams and also for composing independent parts of the model that is essential for translation of UML specifications contains several entities. Furthermore, process algebras gives wide possibilities for performance analysis that is critical for communication intensive part of a model that is usually specified by sequence diagrams.
A number of synthesis techniques for building models from interaction diagrams has been developed. In \cite{15} a way of representation of collaboration diagrams in terms of Colored Petri Nets was proposed. Considering a specification consisting of state and interaction diagrams, a state diagram based approach to translation was presented in \cite{5} and \cite{8}. In those works states are represented as processes and transitions are represented as actions along communication channels. However, when we focus on a communication level such an approach is not effective enough. It would be more natural to use messages as a basic element of translation since that better corresponds to the nature of process algebras. In this paper we focus on a sequence diagram based approach, where objects are considered as $\pi$-calculus processes and messages as communications between these processes. A state diagram of an object is used for choosing the feasible sequences of the messages occurring in the sequence diagram.
Note that an outcome of our proposal is also the definition of a formal semantics for UML sequence diagrams based on the structural operational semantics of the $\pi$-calculus. Many different approaches to define a formal semantics of UML, and in particular, of sequence diagrams and their counterpart from the telecommunication industry message sequence charts have been proposed. One of the approaches generates statechart model (e.g. \cite{19}, \cite{4}). In \cite{18} a semantics in terms of labelled transition systems and parallel composition is presented. A process algebras approach presented in \cite{12} permits to compose several message sequence charts. Alur et al. \cite{1} gives the semantics of message sequence charts in terms of partial order of events occurring in the system. A way of formalizing of collaboration diagrams by means of graph transformation rules and graph processes is presented in \cite{10}. An integrated
graph semantics given in [9] allows to specify interaction diagrams in a universal ways together with other types of diagrams. A trace-based semantics was proposed in [2]. In [17] a translation of sequence diagrams into process algebras where messages are represented as actions, is considered. The work focuses on a translation of a set of simple sequence diagrams which correspond to separate scenarios. In contrast we represent a message as a communication between processes and focus on translation of constructions (e.g. branching, assignment) allowing to express complicated behaviour in a single diagram. Specifics and strong side of our process algebra based semantics is that in obtained formal model messages between objects are presented in a natural for communications way that is essential, for example, for security analysis. Note however that defining of formal semantics is not our main concern.
We now briefly discuss the motivations for the present work. We rely on a standard Unified Modelling Language (UML) to use formal methods in the software production process. The challenges we approach in this task are the definition of techniques to extract specifications into process calculi from the possibly excessive or incomplete information in the UML description. The final goal is to have a design environment in which the user only interacts with UML in order to perform formal analysis of his/her applications.
The paper is structured as follows. In section 2 there is a description of those aspects of UML we are interested in. In section 3 an overview of the π-calculus is presented. A translation from sequence diagrams to π-calculus is given in section 4. In section 5 we discuss the joint translation of sequence and state diagrams. Finally, some remarks on the ways of using of the obtained π-calculus specification are given.
2 Brief UML description
UML is a semi-formal modelling language which is a standard for high-level specification of software systems. There are many different types of UML diagrams which are used to specify different aspects of software systems. In this short presentation we focus on sequence and state diagrams.
A sequence diagram shows how objects interact with one another by representing examples of executions. A sequence diagram has two dimensions: the vertical dimension represents time and the horizontal one represents different objects. Objects can communicate by exchanging messages represented by arrows. To show different kinds of communications the following variations of notation are considered in this paper.
- **Stick arrowhead** is used for synchronous communication. In the case of
nested control flow the entire nested sequence have to be completed before the outer level sequence resume.
- **Dashed arrow with stick arrowhead** is used for returning message.
A message is labelled at least with the message name; one can also include arguments and a condition which acts as a guard for sending the message. Furthermore a message can be associated with an assignment that associates with the assigned variable the value returned after the message.
Messages can be combined in a branching construction which is shown by multiple arrows leaving a single point and means alternative or concurrency of those messages depending of their conditions.
A **state diagram** describes the sequences of states and transitions through which the modelled element can proceed during its lifetime as a reaction to discrete events. A state diagram is a graph that represents a state machine.
The semantics of a state diagram can be defined in terms of a Kripke structure [11]. Given a state $s$ in a state diagram $S$, we denote as $(s^\bullet)^\ast$ a set of pairs of transitions $t_1 t_2$ such that there exists a sequence $s_1 [t_1] s_2 [t_2]$ of states ($s_i$) and transitions ($t_i$) in the Kripke structure of $S$.
### 3 The $\pi$-Calculus
In this section we briefly recall the $\pi$-calculus [13], a model of concurrent communicating processes providing the notion of **naming**.
Let $\mathcal{N}$ be a countable infinite set of *names* ranged over by $a, b, \ldots$ with $\mathcal{N} \cap \{\tau\} = \emptyset$. We also assume a set $\mathcal{A}$ of **agent identifiers** ranged over by $A, A_1, \ldots$. Processes (denoted by $P, Q, R, \ldots \in \mathcal{P}$) are built from names according to the
syntax
\[ P ::= 0 \mid \pi.P \mid P + P \mid P\mid (\nu x)P \mid [x = y]P \mid A(y_1, \ldots, y_n) \]
where \( \pi \) may be \( x(y) \) for \textit{input}, \( \pi(y) \) for \textit{output} (where \( x \) is the \textit{subject} and \( y \) the \textit{object}), \( \varepsilon \) for \textit{empty string}, or \( \tau \) for \textit{silent} moves. Hereafter, the trailing \( 0 \) will be omitted.
The prefix \( \pi \) is the first atomic action that the process \( \pi.P \) can perform. The input prefix binds the name \( y \) in the prefixed process. Intuitively, some name \( y \) is received along the link named \( x \). The output prefix does not bind the name \( y \) which is sent along \( x \). The silent prefix \( \tau \) denotes an action which is invisible to an external observer of the system. Summation denotes non-deterministic choice. The operator \( | \) describes parallel composition of processes. The operator \( (\nu x) \) acts as a static binder for the name \( x \) in the process \( P \) that it prefixes. In other words, \( x \) is a unique name in \( P \) which is different from all the external names. Finally, matching \( [x = y]P \) is an \textbf{if-then} operator: process \( P \) is activated if \( x = y \). \( A(y_1, \ldots, y_n) \) is the definition of constants (hereafter, \( \tilde{y} \) denotes \( y_1, \ldots, y_n \)). Each agent identifier \( A \) has a unique defining equation of the form \( A(y_1, \ldots, y_n) = P \), where the \( y_i \) are distinct and \( \text{fn}(P) \subseteq \{y_1, \ldots, y_n\} \) (see below for the definition of free names \( \text{fn} \)).
A parallel composition of processes \( P_1, \ldots, P_n \) is written as \( \prod_{i=1}^n P_i \). For a set of names \( V = \{v_1, \ldots v_n\} \) we use the notation \( (\nu V)P \) for \( (\nu v_1)\ldots(\nu v_n)P \) and \( (\nu v_1, v_2)P \) for \( (\nu v_1)(\nu v_2)P \).
We use here a late version of the \( \pi \)-calculus, although early semantics could apply as well. The late operational semantics for the \( \pi \)-calculus is defined in the \textit{SOS} style, and the labels of the transitions are \( \tau \) for silent actions, \( x(y) \) for input, \( \pi y \) for free output, and \( \pi(y) \) for bound output. We will use \( \mu \) as a metavariable for the labels of transitions (it is distinct from \( \pi \), the metavariable for prefixes, though it coincides in two cases). We recall the notion of free names \( \text{fn}(\mu) \), bound names \( \text{bn}(\mu) \), and names \( n(\mu) = \text{fn}(\mu) \cup \text{bn}(\mu) \) of a label \( \mu \).
<table>
<thead>
<tr>
<th>( \mu )</th>
<th>\textit{Kind}</th>
<th>( \text{fn}(\mu) )</th>
<th>( \text{bn}(\mu) )</th>
</tr>
</thead>
<tbody>
<tr>
<td>( \tau )</td>
<td>Silent</td>
<td>( \emptyset )</td>
<td>( \emptyset )</td>
</tr>
<tr>
<td>( \pi y )</td>
<td>Free Output</td>
<td>( {x, y} )</td>
<td>( \emptyset )</td>
</tr>
<tr>
<td>( x(y), \pi(y) )</td>
<td>Input and Bound Output</td>
<td>( {x} )</td>
<td>( {y} )</td>
</tr>
</tbody>
</table>
Functions \( \text{fn} \), \( \text{bn} \) and \( n \) are extended to processes in the obvious way. Below we assume that the \textit{structural congruence} \( \equiv \) on processes is defined as the least congruence satisfying the following clauses:
- \( P \) and \( Q \) \( \alpha \)-equivalent (they only differ in the choice of bound names) implies \( P \equiv Q \),
(\(P / \equiv, +, \mathbf{0}\)) and \((P / \equiv, |, \mathbf{0})\) are commutative monoids,
• \(\varepsilon.P \equiv P\),
• \([(x = x)]P \equiv P\),
• \(((\nu x)(\nu y)P \equiv (\nu y)(\nu x)P, (\nu x)(R | S) \equiv (\nu x)R | S\) if \(x \not\in \text{fn}(S)\), \((\nu x)(R | S) \equiv R | (\nu x)S\) if \(x \not\in \text{fn}(R)\), and \((\nu x)P \equiv P\) if \(x \not\in \text{fn}(P)\).
A variant of \(P \xrightarrow{\mu} Q\) is a transition which only differs in that \(P\) and \(Q\) have been replaced by structurally congruent processes, and \(\mu\) has been \(\alpha\)-converted, where a name bound in \(\mu\) includes \(Q\) in its scope.
We report the late transition system for the \(\pi\)-calculus in Tab. 2. The transition in the conclusion of each rule, as well as in the axiom, stands for all its variants.
## 4 Translation of Sequence Diagrams
In this section we restrict our attention to UML sequence diagrams. Note that the semantics of UML allows a message in a sequence diagram to be skipped. For simplicity in this section we consider the case of non-skipping messages as it is the common practice of designers (we will deal with skipping of messages later in the paper). Moreover we assume that names of messages are unique, otherwise we rename them before translation.
First we consider sequence diagrams without conditions on messages. We will represent an object from a sequence diagram as a process in the \(\pi\)-calculus and compose all processes arising from the given sequence diagram via parallel composition.
A message between two objects is represented as a communication between the corresponding processes. For each message we create a private channel in the \(\pi\)-calculus representation and translate the message as a synchronization on this channel. In our translation a self-call is represented by the silent action \(\tau\). Note that for an assignment construction associated to a self-call it can be essential to express the fact that we assign the variable (e.g. for analyzing of security properties). In such a case self-call can be translated as a communication with an additional internal object.
As far as sequence diagrams show how an object interacts with others, it is natural to consider an object as a sequence of sending and receiving of messages. To translate an object we produce sequentially for each of its sent/received message an input/output of a signal along the corresponding channel.
Given two objects connected by a message \(m\), we translate this message as
Consider now a message with a condition. The message is sent if its condition is satisfied, or it is skipped otherwise. Given a sending message $[x]m$, we obtain an output on the channel $m$ prefixed by the matching $[x = true]m$ if the condition is satisfied, or a skipping of the message prefixed by the matching $[x = false]m$ otherwise. For a receiving message $[x]m$ we obtain an input on $m$ or a skipping of it, depending on the value of $x$. Nested messages initialized by a message with a condition including its return will be discarded if the condition is not satisfied. To illustrate the translation of conditions, consider a simple sequence diagram with a single condition $x$ from Fig. 2. It is translated to a summation of two subprocesses representing two possible evaluations of $x$.
We translate an explicit return of the message as a usual message with the name $\text{return}^{\langle \text{message name} \rangle}$. For example, we translate a message $[x]m$ with an explicit return (Fig. 3) as a sequence of messages $\langle m, \text{return}^m \rangle$.
A branching of several messages is translated as a parallel composition of these messages synchronized before continuation because all of branched
messages have to be delivered. In more detail, for a sending object we introduce an input on the special channel \( syn \) after any branched messages. Then we construct a continuation process that is the translation of the remaining messages prefixed by sending of a \( syn \) signal for any message in the branching construction. Finally, we compose the translation of the branching structure and the continuation process by parallel composition. In the receiving process we have a parallel composition of branched messages and continuation without synchronization. We use the \( syn \) channel to force the continuation process starting after the delivery of all the branching messages. We illustrate our translation on a simple sequence diagram presenting two parallel messages followed by a reply (see Fig. 4). We use a channel \( syn \) to force \( m_3 \) occurring after \( m_1 \) and \( m_2 \).
An assignment construction is generally used for binding an identifier that stores the return value of a message. It can be translated as a message with an explicit return which transfers not a signal but a required variable (see Fig. 5). In other words, we use a real communication rather than a simple synchronization.
We now formally define a translation function from UML sequence diagrams to the \( \pi \)-calculus. Given a message \( m \), we define a set of nested messages \( nest(m) \) in case of an explicit return as the set of messages that become enabled by the sending of \( m \) before the return of \( m \) (including the return), or as an empty set, otherwise.
By abuse of notation we use the metavariable for processes \( \mathcal{P} \) to denote prefixes possibly prefixed by a matching.
Fix a sequence diagram \( SD \) with a set of objects \( \mathcal{O} \), a set of messages \( \mathcal{Mes} \) and a set of conditions \( \mathcal{C} \). Let \( \rho : \mathcal{C} \cup \{ \Lambda \} \rightarrow \text{Bool} \) be an evaluation function that returns \( \text{true} \) for the special condition \( \Lambda \). Given a message \( m \), we define \( c^m \) as a condition corresponding to \( m \), or as \( \Lambda \) if there is no condition on \( m \). Given an object \( O \) and a message \( m \) in \( O \), we define the function \( tr_\rho : \mathcal{O} \times \mathcal{Mes} \rightarrow \mathcal{P} \)
as
\[ tr_ρ(O, m) = \begin{cases}
[c^m = true] m, & \text{if } O \text{ sends } m \text{ and } ρ(c^m) = true; \\
[c^m = false] ε, & \text{if } O \text{ sends } m \text{ and } ρ(c^m) = false; \\
m, & \text{if } O \text{ receives } m \text{ and } ρ(c^m) = true; \\
ε, & \text{if } (O \text{ receives } m \text{ and } ρ(c^m) = false) \text{ or } \\
(\exists m' | m \in \text{nest}(m') \text{ and } ρ(c^{m'}) = false).
\end{cases} \]
For a given assignment construction \( x := m() \) we translate the return of \( m \) in a special way. We redefine the function \( tr_ρ(O, return^m) \) as of assignment as \( return^m(x) \) for a sending object, or as \( return^m⟨x⟩ \) for a receiving object.
Fix an evaluation \( ρ \) and an object \( O \) defined by a sequence of set of sent/received messages \( M^O = ⟨M_0, M_1, ..., M_n⟩ \), where a set \( M_i = \{m^i_1, ..., m^i_{k_i}\} \) represents branching messages and \( m^j_i \in Mes \) for each \( i \in \{1...n\} \) and \( j \in \{1...k_i\} \). We define the translation function \( seq_ρ : O × Mes^* × P → P \) as follows:
\[ seq_ρ(O, ⟨⟩, tail) = tail, \text{ and } seq_ρ(O, ⟨M_i, ..., M_n⟩, tail) = \]
\[ \prod_{j=1...k_i} tr_ρ(O, m^j_i).seq_ρ(O, ⟨M_{i+1}, ..., M_n⟩, tail), \text{ if } k_i = 1 \]
\[ \prod_{j=1...k_i} tr_ρ(O, m^j_i).seq_ρ(O, ⟨M_{i+1}, ..., M_n⟩|_{\text{nest}(m^j_i)}, \text{syn}^{M_i}.tail), \text{ if } k_i > 1 \]
where \( \text{rest}(⟨M_i, ..., M_n⟩) \) is a subsequence of \( ⟨M_i, ..., M_n⟩ \) starting after returns of all messages from \( M_i \).
Eventually, for a fixed evaluation \( ρ \) we obtain \( P_ρ = \prod_{O∈S} seq_ρ(O, M^O) \). And the overall translation of \( SD \) is \( P = (vV)(\sum_{ρ∈C∪{Λ}×\text{Bool}} P_ρ), \) where \( V = \{v | v \in M^O \text{ or } v = \text{syn}^{M_i}\} \).
As final remarks, we give some notes for simplifying the result of the translation.
- **Repeating conditions.** We leave in a process only the first instance of a repeating condition if these instances do not divided by an assignment that can change the condition value.
- **Empty branched subprocesses.** In a translation of branching construction because of the false value of a condition we can obtain a parallel subprocess containing only conditions and receiving of a synchronizing message. Such
processes are nonessential for the translation and can be skipped together
with a corresponding sending of the synchronizing message. In the case
of a single active branched message we can translate it as usual sequence
message. An illustration of this point you can see the end of the next
subsection.
4.1 An Example
To illustrate our translation consider the sequence diagram in Fig. 6 repre-
senting a slight variant of the Phone system in [8]. In this example we have two
conditions \( c_1 = \text{[busy]} \) and \( c_2 = \text{[not busy]} \). Thus we obtain two possible valuations \( \rho_1 : \rho_1(c_1) = \text{true}, \rho_1(c_2) = \text{false} \) and \( \rho_2 : \rho_2(c_1) = \text{false}, \rho_2(c_2) = \text{true} \). Obviously only these two valuation are available. The result of the translation
is shown below.
\[ \text{Caller}^{p_1} = \text{lift.dial} \cdot \text{tone.number} \cdot \text{connect} \cdot \text{busy.tone} \cdot \text{disconnect} \cdot \text{hangs} \cdot \text{up} \]
\[ \text{Caller}^{p_2} = \text{lift.dial} \cdot \text{tone.number} \cdot \text{connect} \cdot \text{tone} \cdot \text{ring} \cdot \text{tone} \cdot \text{talking}_1 \cdot \text{talking}_2 \cdot \text{disconnect} \cdot \text{hangs} \cdot \text{up} \]
\[ \text{Phone}^{p_1} = (\nu \text{syn}_1) \text{lift} \cdot \text{dial} \cdot \text{tone} \cdot \text{number} \cdot (\text{connect} \cdot \text{tone} \cdot \text{syn}_1) \cdot \text{connect} \cdot \text{return} \cdot \text{connect} \cdot (\text{busy}) \cdot \text{syn}_1 \cdot \text{syn}_1 \cdot \text{busy} = \text{true} \cdot \text{busy} \cdot \text{tone} \cdot \text{return} \cdot \text{hangs} \cdot \text{up} \]
\[ \text{Phone}^{p_2} = (\nu \text{syn}_1, \text{syn}_2) \text{lift} \cdot \text{dial} \cdot \text{tone} \cdot \text{number} \cdot (\text{connect} \cdot \text{tone} \cdot \text{syn}_1) \cdot \text{connect} \cdot \text{return} \cdot \text{connect} \cdot (\text{busy}) \cdot \text{syn}_1 \cdot \text{syn}_1 \cdot \text{Calling} \]
\[ \text{Calling} = [\text{busy} = \text{false}] \cdot \text{ring} \cdot \text{tone} \cdot \text{syn}_2 \cdot [\text{busy} = \text{false}] \cdot \text{call} \cdot \text{answer} \cdot \text{return} \cdot \text{call} \cdot \text{syn}_2 \cdot \text{syn}_2 \cdot \text{syn}_2 \cdot \text{disconnect} \cdot \text{hangs} \cdot \text{up} \]
\[ \text{Receiver}^{p_1} = \text{connect} \cdot \text{return} \cdot \text{connect} \cdot (\text{busy}) \cdot \varepsilon \]
\[ \text{Receiver}^{p_2} = \text{connect} \cdot \text{return} \cdot \text{connect} \cdot (\text{busy}) \cdot \text{call} \cdot \text{answer} \cdot \text{talking}_1 \cdot \text{talking}_2 \cdot \text{return} \cdot \text{call} \]
\[ \text{System} = (\nu V)(\text{Phone}^{p_1} \mid \text{Receiver}^{p_1} \mid \text{Caller}^{p_1}) + (\text{Phone}^{p_2} \mid \text{Receiver}^{p_2} \mid \text{Caller}^{p_2}) \] where \( V \) is the set of channels of \( \text{System} \).
Now we illustrate the simplification technique of empty branched subpro-
processes described in the previous section. In \( \text{Phone}^{p_1} \) we translate the branching
construction \{\text{busy.tone, ring.tone, call}\} as a single message \text{busy.tone}
because conditions on two other messages are false on a valuation \( \rho_1 \), and we
obtain its translation \[\text{busy} = \text{true}] \cdot \text{busy.tone} \] instead of \[\text{busy} = \text{true}] \cdot \text{syn}_2 \]
\[\text{busy} = \text{true}] \cdot \text{syn}_2 \mid \text{busy} = \text{true}] \cdot \text{busy.tone} \cdot \text{syn}_2 \mid \text{syn}_2 \cdot \text{syn}_2 \cdot \text{syn}_2 \] as it would
be done in the general case.
5 Joint Translation of Sequence and State Diagrams
Each type of UML diagrams has its own most natural way of translation to
the \( \pi \)-calculus. To translate a whole system composed of different diagrams
we choose a driving type of diagrams (here a sequence diagram), and we take necessary additional information about the system from other types of diagrams (here state diagrams). For a joint translation of sequence and state diagrams we have two different approaches which are distinguished in the choice of the driving type of diagrams:
- **Sequence diagram based translation.** According to our translation, each valuation is considered and translated separately so that the obtained π-calculus representation is a summation of subprocesses for all possible valuations. Additional information from state diagrams helps to determine feasible computations. The problem here is to represent more detailed information from state diagrams because it is not understandable how to translate internal actions of a state diagram not represented in the sequence diagram. It is possible to ignore this detailisation and obtain a translation at a communication level.
- **State diagram based translation.** A state diagram (for each object) is translated as a process parameterized by state name and representing a transition from state to state. Additional information from a sequence diagram is necessary for composing the processes corresponding to different state diagrams. Such approach was used in [5] for producing translation to Per-
formance Evaluation Process Algebra (PEPA).
The last approach requires a very detailed description of each object of a system. However, sometimes we would prefer to have a high-level specification which does not contain such a detailed specification of all objects. That's why we choose a sequence diagram based approach in our translation.
5.1 Sequence diagram based translation
In the previous section we considered the case of nonskipped messages. However, in a general case messages in a sequence diagram can be skipped. It can be useful, for example, to present alternative use cases in one sequence diagram. If we consider a separate sequence diagram in this paradigm we obtain all possible subsequences of a given sequence of messages. So, we can see only an order of messages but have no information which message has to be skipped in an allowed behaviour.
To illustrate such a situation we add to the Phone system on Fig. 6 a message \textit{timeout\_tone} from Caller to Phone between messages \textit{dial\_tone} and \textit{number}. It can be interpreted as follows. If a Caller does not dial a number, after some waiting period it receives a \textit{timeout\_tone} and finishes the call. After the \textit{timeout\_tone}, the Caller cannot dial a number, but a sequence diagram does not give us such information, and we have a sequence of messages \langle \ldots \textit{dial\_tone}, \textit{timeout\_tone}, \textit{number} \ldots \rangle besides the correct sequences \langle \ldots \textit{dial\_tone}, \textit{timeout\_tone}, \textit{hangs\_up} \rangle and \langle \ldots \textit{dial\_tone}, \textit{number} \ldots \rangle.
To consider only correct sequences of messages we need some additional information which can be taken from other types of diagrams. Namely we need an information about branching points in a behaviour model of the system. By default we consider messages in a sequence diagram sequentially and suppose that for each two sequential messages there is an execution way con-
cluding those two messages. In a point when we skip a message we have two alternatives: to execute messages of the sequence diagram one after another, or to jump to some other message of the diagram. We will call such a situation by a branching point.
In our translation information about branching points will be obtained from state diagrams which describe behaviour of single objects. We restrict a state diagram on a set of transitions representing communications and call it a restricted state diagram. We can talk about branching point for a restricted state diagram if for a given state we have outgoing transitions corresponding to more than one set of branching messages. A skeleton of a state diagram is a restriction of a restricted state diagram on a set of transitions which are belong to some branching point.
For sequence and state diagrams in isolation we can present semantics in terms of $\pi$-calculus or some other formalism. However, correlation between different diagrams is not specified formally in UML. So we have to make some assumptions on a relation between these diagrams to be correct in the translation of the whole specification. These assumptions are concern to an agreement on names presenting the same communications in different diagrams.
Given UML specification consisting of a sequence diagram $SD$ and state diagrams $OD_1, \ldots OD_k$ corresponding to objects $O_1, \ldots O_k$ of $SD$. We will say that a specification is coherent if there is the following relation between messages in sequence diagram and transitions in state diagrams:
(i) Names of messages in $SD$ are unique (it is necessary for correct correspondence between messages in the sequence diagram and transitions in the state diagrams).
(ii) A message $m$ in $SD$ relating objects $O_i$ and $O_j$ and a transition $m$ in $OD_i$ ($OD_j$) represent the same event in the specified system.
(iii) A message $m$ in $SD$ can be skipped iff there is a path in the corresponding state diagram in which a transition $m$ is skipped.
(iv) A message $m'$ follows $m$ iff there exists a pair of sequential transitions $m$, $m'$ in a skeleton of the corresponding state diagram.
The last point means that we don’t require all messages to be presented in a state diagram, and a message in a sequential part of the diagram can be skipped. Note that a state diagram can include more detailed information than a corresponding sequence diagram. But in this translation we use state diagrams only for additional information about available sequences of messages. So internal actions of a state diagram are nonessential to our translation.
For readability we present here a translation of a simplified version of sequence diagrams which do not contain a branching construction. Fix an
object \( O \) with a sequence of sent/received messages \( M^O = \langle m_1, \ldots, m_n \rangle \). The first step of the translation is to calculate branching points. We define a set of starting states of a message \( m_{i+1} \) recursively as a set of states obtained from starting messages of \( m_i \) after execution of a transition corresponding to \( m_i \). A branching point \( B(m_i) \) contains a pair \( (m_i, m_{i+1}) \) and further for each starting state \( s \) of \( m_i \) is constructed in the following way: \( \forall tt' \in (s^*)^* \)
\[
B(m_i) = \begin{cases}
B(m_i) \cup (m(t), m(t')), & \text{if } m(t) = m_i \text{ and } \exists t'' \neq t'. tt'' \in (s^*)^*; \\
B(m_i) \cup (\text{skip}, m_i, m(t)), & \text{if } m(t) \neq m_i.
\end{cases}
\]
Then we modify the translation of sequence diagrams proposed in section 4 by using information about branching points to single out correct execution sequences. The difference from the original algorithm is the definition of the function \( \text{seq}_\rho \). Given an evaluation \( \rho \), we calculate the translation function \( \text{seq}_\rho : \mathcal{O} \times \mathcal{M} \rightarrow \mathcal{P} \) as follows: \( \text{seq}_\rho(O, \langle \rangle) = 0 \), and
\[
\text{seq}_\rho(O, \langle m_i, \ldots, m_n \rangle) = \sum_{\{j \mid (m_j, m_j) \in B(m_i)\}} tr_\rho(O, m_i) \cdot \text{seq}_\rho(O, \langle m_j, \ldots, m_n \rangle) + \\
\sum_{\{j \mid \text{skip}, m_j, m_j) \in B(m_i)\}} \text{seq}_\rho(O, \langle m_j, \ldots, m_n \rangle).
\]
Let us illustrate this approach with the Phone System which was already considered in section 4. Now we represent it by the sequence diagram (Fig. 6) and the state diagram for the object Phone (Fig. 7). An assumption about skipping of messages intuitively means that the Caller can hang up after any of his actions. The result of the translation of an object Phone on the valuation \( \rho_1 \) is:
\[
\text{Phone}^{\rho_1} = \text{lift} \cdot \text{dia} \cdot \text{tone}. \cdot (\text{hangs} \cdot \text{up} + \text{number} \cdot \text{hangs} \cdot \text{up} + \text{number} \cdot \\
(\text{connect} \cdot \text{tone} \cdot \text{syn}_1 \mid \text{connect} \cdot \text{return} \cdot \text{connect} \cdot \text{busy} \cdot \text{syn}_1 \mid \text{syn}_1 \cdot \text{busy} = \text{true} \cdot \text{busy} \cdot \text{tone} \cdot \text{hangs} \cdot \text{up}))
\]
A separate problem is a translation of a part-described system. If one of the objects in a sequence diagram related by the message is not described by a state diagram, we can extract information from an existing state diagram. To illustrate this moment let us consider the translation of the object Caller from the Phone System based on the sequence diagram (Fig. 6) and the state diagram for the object Phone (Fig. 7):
\[
\text{Caller}^{\rho_1} = \text{lift} \cdot \text{di} \cdot \text{tone}. \cdot (\text{hangs} \cdot \text{up} + \text{number} \cdot \text{hangs} \cdot \text{up} + \text{number} \cdot \\
\text{connect} \cdot \text{tone} \cdot \text{busy} \cdot \text{tone} \cdot \text{hangs} \cdot \text{up})
\]
Here we suppose that for the receiving of a message number there are three cases: ”ignore the message and finish”, ”finish after the message” and ”continue after the message”, then we have the same cases for the sending of this message.
5.2 Compositional translation
To extract the case of one sequence diagram and a set of state diagrams for some of its objects, presented in section 4 we need a possibility to compose several sequence diagrams. We will do it by adding an abstract level state diagram which shows relations between different sequence diagrams.
This information can be obtained also from state diagrams of objects. We can construct an abstract level state diagram from the set of state diagrams of objects as follows. If in a state diagram of an object there are two sequential transitions corresponding to messages from different sequence diagrams, we produce a transition between states presenting those sequence diagrams in an abstract level state diagram.
In this section we propose a translation of a coherent specification consisting of an abstract level state diagram, a set of sequence diagrams corresponding to some of its states and a set of state diagrams corresponding to objects of sequence diagrams. The natural way of translation of an abstract state diagram is to correspond to each state an agent starting with an action which describes the state and prolonging as an agent for one of the states succeed to the considered one. If there is a sequence diagram corresponding to a given state, an action describing the state is a pair of control signals for initializing and finishing of the agent corresponding to the sequence diagram. Otherwise we suppose a silent action. A sequence diagram is translated as it was shown in section 4 except of the fact that the result of this translation has to be reexecutable because it can be used as a part of abstract state diagram translation. So we have to present a sequence diagram as a recursive agent that initializes a separate agent for each of its objects.
Fix an abstract level state diagram $AD$ with a set of states $S$, an initial state $s^{init}$ and a set of sequence diagrams $SD(s)$ for some of states $s$ from $S$. For each state $s$ of $AD$ we construct an agent $s()$ as follows:
$$s() = \begin{cases} \sum_{\{s'|s]\}} s', & \text{if } \exists SD(s) \text{ and } \exists \{s' | s]\} s' \}; \\
\text{init}.s.\text{end} \cdot s, & \text{if } \exists SD(s) \text{ and } \neg \exists \{s' | s]\} s' \}; \\
\sum_{\{s'|s]\}} \tau. s', & \text{if } \neg \exists SD(s) \text{ and } \exists \{s' | s]\} s' \}; \\
\tau, & \text{if } \neg \exists SD(s) \text{ and } \neg \exists \{s' | s]\} s' \}.
\end{cases}$$
Fix a sequence diagram $SD(s)$ with a set of objects $O_1, \ldots, O_k$ and an object
that receives the last message in \( SD(s) \). Given an evaluation \( \rho \) of conditions of \( SD(s) \), we translate a sequence diagram as follows:
\[
SD^s(\rho) = (\nu V') \sum_{\rho \in C \cup \{\lambda\} \times \text{Bool}} SD^s_\rho;
\]
\[
SD^s_\rho = (\nu V') ini_s, ini_{\bar{O}_1^\rho}, \ldots, ini_{\bar{O}_k^\rho}, end_{\bar{O}_j^\rho}, end_s SD^s_\rho;
\]
\[
O_i() = \prod_{\rho \in C \cup \{\lambda\} \times \text{Bool}} O_i^\rho();
\]
\[
O_i^\rho() = ini_{\bar{O}_i^\rho}, seq_\rho(O_i^\rho, M_i^\rho). O_i^\rho() \quad \forall i \in \{1 \ldots k\} \text{ & } i \neq j;
\]
\[
O_j^\rho() = ini_{\bar{O}_j^\rho}, seq_\rho(O_j^\rho, M_j^\rho). end_{\bar{O}_j^\rho}, O_j^\rho().
\]
The overall translation of the system is
\[
P = (\nu V'') s^{init()} \mid \prod_{\rho \in SD} O(\rho)
\]
Here \( V' = \{ ini_{\bar{O}_1^\rho}, \ldots, ini_{\bar{O}_k^\rho}, end_{\bar{O}_j^\rho} \} \), \( V'' = \{ ini_s, end_s \mid \exists SD(s) \} \)
and \( V \) is a set of internal variables of a given sequence diagram as it was defined in the translation of sequence diagrams in section 4.
As an example of the proposed compositional translation consider a system consisting of an abstract level state diagram in Fig. 8 and a sequence diagram in Fig. 1 corresponding to the state \( s_2 \). The result of the translation is:
\[
s_1() = \tau. s_2()
\]
\[
s_2() = ini_{\bar{s}_2}, end_{\bar{s}_2}, s_1() + ini_{\bar{s}_2}, end_{\bar{s}_2}, s_2()
\]
\[
SD^{s_2} = (\nu ini_{\bar{O}_1}, ini_{\bar{O}_2}, end_{\bar{O}_2}, m) ini_{\bar{s}_2}, ini_{\bar{O}_1}, ini_{\bar{O}_2}, end_{\bar{O}_2}.
\]
\[
end_{\bar{s}_2}. SD^{s_2}()
\]
\[
O_1^{s_2}() = ini_{\bar{O}_1}, m. end_{\bar{O}_1}, O_1^{s_2}()
\]
\[
O_2^{s_2}() = ini_{\bar{O}_2}, m. O_2^{s_2}()
\]
\[
P = (\nu ini_s, ini_{\bar{s}_2}, end_{\bar{s}_1}, end_{\bar{s}_2}) s_1() \mid SD^{s_2}() \mid O_1^{s_2}() \mid O_2^{s_2}()
\]
6 Using the translation
6.1 Analysis of process algebras specifications
The aim of the translation of UML specification to \( \pi \)-calculus
is applying analysis techniques available for process algebras to the UML specification. Here we describe how we can make a performance analysis of system specified in UML using the result of our translation. For this type of analysis we add to the messages in a sequence diagram rates yielding a translation in the stochastic \( \pi \)-calculus (see, e.g. [16]) to express those quantitative measures. Stochastic \( \pi \)-calculus differs from the classical \( \pi \)-calculus in section 3 only for the prefix that has the form \( \langle \pi, \lambda \rangle \), where \( \lambda \) is the unique parameter of an exponential distribution. In Fig. 9 you can see the translation of a message extended by rate to the stochastic \( \pi \)-calculus process. The exponential distribution enables us to recover a continuous time Markov chain from which performance measures are computed by using standard numerical techniques [14].
6.2 WEB based micro-business case study
Here we apply our translation to a real case study that was developed in the context of the DEGAS project [6]. This case study is a WEB based service that is distributed to the users of a community and that enables the realization of micro-business based on peer-to-peer authentication and communication paradigm. Sequence diagrams are used to detail communication intensive parts of the system.
We present here a translation of a part of the specification that describes the e-commerce process as it seen from a buyer. After a seller has been selected the buyer has to handshake with it, and to authenticate. Then the buyer will search the selling list to get the available items, with which he can prepare its basket to be bought and make an e-commerce transaction. The specification is composed from an e-commerce abstract level state diagram (Fig. 10) and sequence diagrams describing handshaking (Fig. 12, above), authentication (Fig. 12, below) and searching of the seller list (Fig. 11). The result of the translation is shown in Appendix.
For the given case study the performance aspect is critical. Performance issues arise because the communication links are subject to unpredictable throughput variations. Extending the sequence diagrams with quantitative measures on arrows, we can analyze, for example, dependency of request time from number of requests which can appear concurrently in the system as we present in [7].
7 Conclusion
In this paper we discussed a translation to the $\pi$-calculus of non homogeneous UML specifications. We proposed an approach based on sequence and state diagrams. As a prolongation of this investigation it would be interesting to extract this translation for other types of UML diagrams to present more complex software systems. Furthermore, we are currently implementing our translation and integrating it with open-source UML tools.
This paper is a step towards the use of formal methods in the current practice of software development. The main contribution of our extraction of process algebra specifications from UML diagrams is the hiding of formal details from the designers when performing analysis.
Finally, we have implicitly defined formal semantics of UML sequence di-
agrams based on the operational semantics of the \(\pi\)-calculus.
As a last remark, assuming the semantic model of sequence diagrams presented in [18], we claim that a sequence diagram is behaviourally equivalent to the \(\pi\)-calculus process obtained by our translation.
References
8 Appendix
Result of the translation of the UML case study specification. \( \textit{SelectSeller}() = \tau. \textit{Handshake}() \)
\[
\textit{Handshake}() = \text{ini}_\textit{Handshake}. \text{end}_\textit{Handshake}. \textit{SelectSeller}() + \\
\text{ini}_\textit{Handshake}. \text{end}_\textit{Handshake}. \textit{Authenticate}()
\]
\[
\textit{Authenticate}() = \text{ini}_\textit{Authenticate}. \text{end}_\textit{Authenticate}. \textit{SearchSellerList}()
\]
\[
\textit{SearchSellerList}() = \text{ini}_\textit{SearchSellerList}. \text{end}_\textit{SearchSellerList}. \textit{PrepareBasket}() + \\
\text{ini}_\textit{SearchSellerList}. \text{end}_\textit{SearchSellerList}. \textit{SelectSeller}()
\]
\[
\text{PrepareBasket}() = \tau. 0
\]
\[
\text{SD}_{\textit{SearchSellerList}}() = (\nuV_{\textit{SearchSellerList}}) \textit{ini}_\textit{SearchSellerList}. \text{ini}_DS. \\
\text{ini}_SM1. \\
\text{ini}_SM2. \\
\text{ini}_LM. \text{end}_DS. \\
\text{end}_\textit{SearchSellerList}. \text{SD}_{\textit{SearchSellerList}}()
\]
\[ DS_{\text{SearchSellerList}}(\text{SearchItem, info}) = \]
\[ \text{ini}_{DS}. \text{PutMes1}(\text{SearchItem}). return_{\text{PutMes1}}(\text{info}). \text{end}_{DS}. \]
\[ DS_{\text{SearchSellerList}}(\text{SearchItem, info}) \]
\[ SM_{1}\text{SearchSellerList}(\text{EncData}) = \]
\[ \text{ini}_{SM1}. \text{PutMes1}(\text{SearchItem}). \tau. \text{SecureSend1}(\text{EncData}). \]
\[ \text{SecureSend2}(\text{EncData}). \tau. return_{\text{PutMes1}}(\text{info}). \]
\[ SM_{1}\text{SearchSellerList}(\text{EncData}) \]
\[ SM_{2}\text{SearchSellerList}(\text{EncData, data, Result}) = \]
\[ \text{ini}_{SM2}. \text{SecureSend1}(\text{EncData, }). \tau. \text{SearchList}(\text{data}). \]
\[ \text{PutMes2}(\text{Result}). \tau. \text{SecureSend2}(\text{EncData, }). \]
\[ SM_{2}\text{SearchSellerList}(\text{EncData, data, Result}) \]
\[ LM\text{SearchSellerList}(\text{data, Result}) = \]
\[ \text{ini}_{LM}. \text{SearchList}(\text{data}). \text{PutMes2}(\text{Result}). \]
\[ LM\text{SearchSellerList}(\text{data, Result}) \]
\[ SD_{\text{Authenticate}}() = (\nu'\text{Authenticate}) \text{ini}_{\text{Authenticate}}. \text{ini}_{SM1}. \text{ini}_{SM2}. \]
\[ \text{ini}_{BM}. \text{end}_{SM1}. \]
\[ SD_{\text{Authenticate}}() \]
\[ SM_{1}\text{Authenticate}(\text{EncData, }) = \]
\[ \text{ini}_{SM1}. \tau. \text{SecureSend}(\text{EncData, }). return_{\text{SecureSend}}. \text{end}_{SM1}. \]
\[ SM_{1}\text{Authenticate}(\text{EncData, }) \]
\[ SM_{2}\text{Authenticate}(\text{Buyer, BuyerData}) = \]
\[ \text{ini}_{SM2}. \text{SecureSend1}(\text{EncData, }). \tau. \text{RetrieveLogPwd}(\text{Buyer}). \]
\[ return_{\text{RetrieveLogPwd}(\text{Buyer})}. \tau. return_{\text{SecureSend}}. \]
\[ SM_{2}\text{Authenticate}(\text{Buyer, BuyerData}) \]
\[ BM_{\text{Authenticate}(\text{Buyer, BuyerData}) = \]
\[ \text{ini}_{BM}. \text{RetrieveLogPwd}(\text{Buyer}). \tau. return_{\text{RetrieveLogPwd}}. \]
\[ BM_{\text{Authenticate}(\text{Buyer, BuyerData}) \]
\[ SD_{\text{Handshake}}() = (\nu'\text{Handshake}) \text{ini}_{\text{Handshake}}. \text{ini}_{SelM}. \]
\[ \text{ini}_{SM1}. \text{ini}_{SM2}. \]
\[ \text{ini}_{BM}. \text{end}_{SM1}. \]
\[ SD_{\text{Handshake}}() \]
\[ SelM_{\text{Handshake}}(...) = \]
\[ \text{ini}_{SelM}. \text{RetrieveURL}(\text{Seller}). return_{\text{RetrieveURL}(\text{SellerURL})}. \]
\[ \text{RetrieveKey1}(\text{Seller}). return_{\text{RetrieveKey1}(\text{LastSessionKey})}. \]
\[ \text{StoreKey}(\text{ThisSessionKey}). return_{\text{StoreKey}}. \text{SelMHandshake}(...) \]
\[ SM_{1}\text{Handshake}(...) = \]
\[ \text{ini}_{SM1}. \text{RetrieveURL}(\text{Seller}). return_{\text{RetrieveURL}(\text{SellerURL})}. \]
\[ \text{RetrieveKey1}(\text{Seller}). return_{\text{RetrieveKey1}(\text{LastSessionKey})}. \tau. \]
\[ \text{SecureSend1}(\text{EncData, }). \text{SecureSend2}(\text{EncData, }). \tau. \tau. \]
\[ \text{StoreKey}(\text{ThisSessionKey}). return_{\text{StoreKey}}. \text{end}_{SM1}. \text{SM1Handshake}(...) \]
\[ SM_{2}\text{Handshake}(...) = \]
\[ \text{ini}_{SM2}. \text{SecureSend1}(\text{EncData, }). \text{RetrieveKey2}(\text{Buyer}). \]
\[ return_{\text{RetrieveKey2}(\text{LastSessionKey})}. \tau. \tau. \text{StoreKey}(\text{ThisSessionKey}). \tau. \]
\[ \text{SecureSend2}(\text{EncData, }). \text{SM2Handshake}(...) \]
\[ BM_{\text{Handshake}(...) = \]
\[ \text{ini}_{BM}. \text{RetrieveKey2}(\text{Buyer}). return_{\text{RetrieveKey2}(\text{LastSessionKey})}. \]
\[ \text{StoreKey}(\text{ThisSessionKey}). \text{BMHandshake}(...) \]
\[ P = (\nu'')(\text{SelectSeller}()) \mid SD_{\text{Handshake}}() \mid \]
\[ SelM_{Handshake}(\text{Seller, SellerURL, LastSessionKey, ThisSessionKey, EncData},) | \]
\[ SM1_{Handshake}(\text{Seller, SellerURL, LastSessionKey, ThisSessionKey}) | \]
\[ SM2_{Handshake}(\text{LastSessionKey, ThisSessionKey, EncData, Buyer}) | \]
\[ BM_{Handshake}(\text{LastSessionKey, ThisSessionKey, Buyer}) | \]
\[ SD_{Authenticate}() | SM1_{Authenticate}(\text{EncData,}) | \]
\[ SM2_{Authenticate}(\text{Buyer, BuyerData}) | \]
\[ BM_{Authenticate}(\text{Buyer, BuyerData}) | \]
\[ SD_{SearchSellerList}() | DS_{SearchSellerList} (\text{EncData}) | \]
\[ SM1_{SearchSellerList} (\text{EncData, data, Result}) | \]
\[ SM2_{SearchSellerList} (\text{EncData, data, Result}) | \]
\[ LM_{SearchSellerList} (\text{data, Result}) \],
where \( V = \{ \text{ini}_{Handshake}, \text{end}_{Handshake}, \text{ini}_{SearchSellerList}, \)
\( \text{end}_{SearchSellerList}, \text{ini}_{Authenticate}, \text{end}_{Authenticate} \} \) and \( V^{(\text{name})} \) is defined as a set of all messages of the sequence diagram \( \langle \text{name} \rangle \); \( \text{ini}_O \) for each object \( \langle \text{name} \rangle \) and \( \text{end}_O \) for the object of \( \langle \text{name} \rangle \) receiving the last message.
Fig. 12. Handshake (above) and Authenticate (below) sequence diagrams.
|
{"Source-Url": "https://www.researchgate.net/profile/Katerina_Korenblat/publication/220370913_Toward_Extracting_-calculus_from_UML_Sequence_and_State_Diagrams/links/53e0aa0d0cf2d79877a4d94e.pdf", "len_cl100k_base": 13120, "olmocr-version": "0.1.50", "pdf-total-pages": 22, "total-fallback-pages": 0, "total-input-tokens": 70820, "total-output-tokens": 15381, "length": "2e13", "weborganizer": {"__label__adult": 0.00035500526428222656, "__label__art_design": 0.000774383544921875, "__label__crime_law": 0.0003151893615722656, "__label__education_jobs": 0.0014219284057617188, "__label__entertainment": 9.572505950927734e-05, "__label__fashion_beauty": 0.00016772747039794922, "__label__finance_business": 0.0004775524139404297, "__label__food_dining": 0.0003669261932373047, "__label__games": 0.0006184577941894531, "__label__hardware": 0.0009074211120605468, "__label__health": 0.0006127357482910156, "__label__history": 0.0003612041473388672, "__label__home_hobbies": 0.00012171268463134766, "__label__industrial": 0.0006227493286132812, "__label__literature": 0.00042366981506347656, "__label__politics": 0.0003292560577392578, "__label__religion": 0.0005536079406738281, "__label__science_tech": 0.07342529296875, "__label__social_life": 0.00011515617370605467, "__label__software": 0.0082244873046875, "__label__software_dev": 0.90869140625, "__label__sports_fitness": 0.0002880096435546875, "__label__transportation": 0.0005598068237304688, "__label__travel": 0.00022327899932861328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 50494, 0.01276]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 50494, 0.5999]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 50494, 0.78818]], "google_gemma-3-12b-it_contains_pii": [[0, 1524, false], [1524, 4561, null], [4561, 7226, null], [7226, 8944, null], [8944, 12241, null], [12241, 14773, null], [14773, 15998, null], [15998, 18333, null], [18333, 20619, null], [20619, 24468, null], [24468, 25801, null], [25801, 27816, null], [27816, 30597, null], [30597, 33955, null], [33955, 36503, null], [36503, 39466, null], [39466, 41741, null], [41741, 44551, null], [44551, 45595, null], [45595, 49197, null], [49197, 50424, null], [50424, 50494, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1524, true], [1524, 4561, null], [4561, 7226, null], [7226, 8944, null], [8944, 12241, null], [12241, 14773, null], [14773, 15998, null], [15998, 18333, null], [18333, 20619, null], [20619, 24468, null], [24468, 25801, null], [25801, 27816, null], [27816, 30597, null], [30597, 33955, null], [33955, 36503, null], [36503, 39466, null], [39466, 41741, null], [41741, 44551, null], [44551, 45595, null], [45595, 49197, null], [49197, 50424, null], [50424, 50494, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 50494, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 50494, null]], "pdf_page_numbers": [[0, 1524, 1], [1524, 4561, 2], [4561, 7226, 3], [7226, 8944, 4], [8944, 12241, 5], [12241, 14773, 6], [14773, 15998, 7], [15998, 18333, 8], [18333, 20619, 9], [20619, 24468, 10], [24468, 25801, 11], [25801, 27816, 12], [27816, 30597, 13], [30597, 33955, 14], [33955, 36503, 15], [36503, 39466, 16], [39466, 41741, 17], [41741, 44551, 18], [44551, 45595, 19], [45595, 49197, 20], [49197, 50424, 21], [50424, 50494, 22]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 50494, 0.01524]]}
|
olmocr_science_pdfs
|
2024-11-29
|
2024-11-29
|
1b5700835569e473fe83ebe8c030dc5c2d0a2f1e
|
Concurrency Control
Lock-Based Protocols
- A lock is a mechanism to control concurrent access to a data item
- Data items can be locked in two modes:
1. **exclusive (X) mode**: Data item can be both read as well as written.
- X-lock is requested using `lock-X` instruction.
2. **shared (S) mode**: Data item can only be read.
- S-lock is requested using `lock-S` instruction.
- Lock requests are made to concurrency-control manager
- Transaction can proceed **only after request is granted**
Lock-Based Protocols (Cont.)
- Lock-compatibility matrix
<table>
<thead>
<tr>
<th></th>
<th>S</th>
<th>X</th>
</tr>
</thead>
<tbody>
<tr>
<td>S</td>
<td>true</td>
<td>false</td>
</tr>
<tr>
<td>X</td>
<td>false</td>
<td>false</td>
</tr>
</tbody>
</table>
- A transaction may be granted a lock on an item if the requested lock is compatible with locks already held on the item by other transactions.
- Any number of transactions can hold shared locks on an item, but if any transaction holds an exclusive lock on the item no other transaction may hold any lock on the item.
- If a lock cannot be granted, the requesting transaction is made to wait till all incompatible locks held by other transactions have been released. The lock is then granted.
Lock-Based Protocols (Cont.)
- Example of a transaction performing locking:
\[ T_2: \text{lock-S}(A); \]
\[ \text{read } (A); \]
\[ \text{unlock}(A); \]
\[ \text{lock-S}(B); \]
\[ \text{read } (B); \]
\[ \text{unlock}(B); \]
\[ \text{display}(A+B) \]
- Locking as above is not sufficient to guarantee serializability — if \( A \) and \( B \) get updated in-between the read of \( A \) and \( B \), the displayed sum would be wrong.
- A **locking protocol** is a set of rules followed by all transactions while requesting and releasing locks.
- Locking protocols restrict the set of possible schedules.
- The locking protocol must ensure serializability.
Fig 16.4 Schedule for Transactions: non-serializable schedule
Sample Transactions with Locks
- **T1**: lock-X(B)
- read(B)
- B = B - 50;
- write(B);
- unlock(B);
- lock-X(A);
- unlock(B);
- read(A);
- display(A+B);
- A = A + 50;
- write(A);
- unlock(A);
- **T2**: lock-S(A)
- read(A)
- lock-S(B)
- unlock(A)
- read(B);
- unlock(B)
- display(A+B);
- **concurrency-control manager**
- lock-X(B)
- grant-X(B, T1)
- Read(B)
- B = B - 50;
- write(B);
- unlock(B);
- lock-S(A)
- grant-S(A, T2)
- read(A)
- lock-S(B)
- unlock(A)
- lock-S(B)
- grant-S(B, T2)
- read(B)
- unlock(B)
- display(A+B);
- lock-X(A)
- grant-X(A, T2)
- read(A)
- A = A + 50;
- write(A);
- unlock(A);
Pitfalls of Lock-Based Protocols
- Consider the partial schedule
- Neither $T_3$ nor $T_4$ can make progress
- Executing `lock-S(B)` causes $T_4$ to wait for $T_3$ to release its lock on $B$, while executing `lock-X(A)` causes $T_3$ to wait for $T_4$ to release its lock on $A$.
- Such a situation is called a **deadlock**.
- To handle a deadlock one of $T_3$ or $T_4$ must be rolled back and its locks must be released.
- The potential for deadlock exists in most locking protocols.
- **Starvation** is also possible if concurrency control manager is badly designed. For example:
- A transaction may be waiting for an X-lock on an item, while a sequence of other transactions request and are granted an S-lock on the same item.
- The same transaction is repeatedly rolled back due to deadlocks.
- Concurrency control manager can be designed to prevent starvation.
The Two-Phase Locking Protocol
- This is a protocol which ensures conflict-serializable schedules.
- **Phase 1: Growing Phase**
- transaction may obtain locks
- transaction may not release locks
- **Phase 2: Shrinking Phase**
- transaction may release locks
- transaction may not obtain locks
- The protocol assures serializability.
- It can be proved that the transactions can be serialized in the order of their **lock points** (i.e. the point where a transaction acquired its final lock).
The Two-Phase Locking Protocol
- Two-phase locking does not ensure freedom from deadlocks
- Cascading roll-back is possible under two-phase locking.
**Strict two-phase locking.**
- Here a transaction must hold *all its exclusive locks* till it commits/aborts.
- No cascading rollback
**Rigorous two-phase locking** is even stricter:
- Here *all locks (shared and exclusive)* are held till commit/abort.
- No cascading rollback (of course)
- In this protocol transactions can be serialized in the order in which they commit.
### Fig 16.8 Partial Schedule Under 2PL
<table>
<thead>
<tr>
<th>$T_5$</th>
<th>$T_6$</th>
<th>$T_7$</th>
</tr>
</thead>
<tbody>
<tr>
<td>lock-x($A$)</td>
<td></td>
<td></td>
</tr>
<tr>
<td>read($A$)</td>
<td>lock-x($A$)</td>
<td></td>
</tr>
<tr>
<td>lock-S($B$)</td>
<td>read($A$)</td>
<td></td>
</tr>
<tr>
<td>read($B$)</td>
<td>write($A$)</td>
<td></td>
</tr>
<tr>
<td>write($A$)</td>
<td>unlock($A$)</td>
<td>lock-S($A$)</td>
</tr>
<tr>
<td>unlock($A$)</td>
<td></td>
<td>read($A$)</td>
</tr>
</tbody>
</table>
The Two-Phase Locking Protocol
- There can be conflict serializable schedules that cannot be obtained if 2PL is used.
- However, in the absence of extra information (e.g., ordering of access to data), 2PL is needed for conflict serializability in the following sense: Given a transaction $T_i$ that does not follow 2PL, we can find a transaction $T_j$ that uses 2PL, and a schedule for $T_i$ and $T_j$ that is not conflict serializable.
2PL with Lock Conversions
- The original lock mode with (lock-X, lock-S)
- assign lock-X on a data D when D is both read and written
- Two-phase locking with lock conversions:
- **First Phase**:
- can acquire a lock-S on item
- can acquire a lock-X on item
- can convert a lock-S to a lock-X (upgrade)
- **Second Phase**:
- can release a lock-S
- can release a lock-X
- can convert a lock-X to a lock-S (downgrade)
- This protocol assures serializability.
- The refined 2PL gets more concurrency than the original 2PL
** Unless lock conversion, the first step “lock-S (a1)” in T8 should be “lock-X (a1)”, then T8 and T9 in the following schedule cannot be run concurrently in the original 2PL.
** However, T8 and T9 can run concurrently in the refined 2PL owing to the lock conversion
<table>
<thead>
<tr>
<th>T8</th>
<th>T9</th>
</tr>
</thead>
<tbody>
<tr>
<td>read (a1)</td>
<td>read (a1)</td>
</tr>
<tr>
<td>read (a2)</td>
<td>read (a2)</td>
</tr>
<tr>
<td>.....</td>
<td>.....</td>
</tr>
<tr>
<td>read (an)</td>
<td>read (an)</td>
</tr>
<tr>
<td>a1 = a1 + a2 ... an</td>
<td>a3 = a2 – a1</td>
</tr>
<tr>
<td>write(a1)</td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>T8</th>
<th>T9</th>
</tr>
</thead>
<tbody>
<tr>
<td>lock-X (a1)</td>
<td>lock-S (a1)</td>
</tr>
<tr>
<td>lock –S (a2)</td>
<td>lock-S (a2)</td>
</tr>
<tr>
<td>.....</td>
<td>lock-S (a3)</td>
</tr>
<tr>
<td>lock-S (an)</td>
<td>lock-S (a4)</td>
</tr>
<tr>
<td>unlock (a1)</td>
<td>unlock(a1)</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>T8</th>
<th>T9</th>
</tr>
</thead>
<tbody>
<tr>
<td>lock-S (a1)</td>
<td>lock-S (a1)</td>
</tr>
<tr>
<td>lock-S (a2)</td>
<td>lock-S (a2)</td>
</tr>
<tr>
<td>lock-S (a3)</td>
<td>lock-S (a3)</td>
</tr>
<tr>
<td>lock-S (a4)</td>
<td>unlock(a1)</td>
</tr>
<tr>
<td>lock-S (an)</td>
<td>unlock(a2)</td>
</tr>
<tr>
<td>upgrade (a1)</td>
<td></td>
</tr>
</tbody>
</table>
- **Strict 2PL (with Lock conversions) & Rigorous 2PL (with Lock conversions)** are used extensively in commercial DBMSs
Implementation of Locking
- A **Lock manager** can be implemented as a separate process to which transactions send lock and unlock requests.
- The lock manager replies to a lock request by sending a lock grant messages (or a message asking the transaction to roll back, in case of a deadlock).
- The requesting transaction waits until its request is answered.
- The lock manager maintains a data structure called a **lock table** to record granted locks and pending requests.
- The lock table is usually implemented as an in-memory hash table indexed on the name of the data item being locked.
- Hashing with overflow chaining
- Lock request on item I ➔ Hashing (I) & enqueue & wait
- Lock granted
- Unlock request ➔ dequeue
Lock Table
- Black rectangles indicate **granted locks**, white ones indicate **waiting requests**
- Lock table also records the type of lock granted or requested
- New request is added to the end of the queue of requests for the data item, and granted if it is compatible with all earlier locks
- Unlock requests result in the request being deleted, and later requests are checked to see if they can now be granted
- If transaction aborts, all waiting or granted requests of the transaction are deleted
- lock manager may keep a list of locks held by each transaction, to implement this efficiently
Graph-Based Protocols
- Graph-based protocols are an alternative to two-phase locking.
- Impose a partial ordering \( \rightarrow \) on the set \( D = \{d_1, d_2, ..., d_h\} \) of all data items.
- If \( d_i \rightarrow d_j \) then any transaction accessing both \( d_i \) and \( d_j \) must access \( d_i \) before accessing \( d_j \).
- Implies that the set \( D \) may now be viewed as a directed acyclic graph (DAG), called a database graph.
- The tree-protocol is a simple kind of graph protocol.
- Only exclusive locks are allowed.
- The first lock by \( T_i \) may be on any data item if there is no lock on the data item.
- Subsequently, a data \( Q \) can be locked by \( T_i \) only if the parent of \( Q \) is currently locked by \( T_i \).
- Data items may be unlocked at any time.
### Fig 16.12 Serializable Schedule Under the Tree Protocol
<table>
<thead>
<tr>
<th>$T_{10}$</th>
<th>$T_{11}$</th>
<th>$T_{12}$</th>
<th>$T_{13}$</th>
</tr>
</thead>
<tbody>
<tr>
<td>lock-$x(B)$</td>
<td>lock-$x(D)$</td>
<td>lock-$x(B)$</td>
<td>lock-$x(D)$</td>
</tr>
<tr>
<td>lock-$x(E)$</td>
<td>lock-$x(H)$</td>
<td>lock-$x(E)$</td>
<td>lock-$x(H)$</td>
</tr>
<tr>
<td>lock-$x(D)$</td>
<td>unlock($D$)</td>
<td>unlock($D$)</td>
<td>unlock($D$)</td>
</tr>
<tr>
<td>unlock($B$)</td>
<td>unlock($E$)</td>
<td>unlock($E$)</td>
<td>unlock($E$)</td>
</tr>
<tr>
<td>unlock($E$)</td>
<td>unlock($H$)</td>
<td>unlock($E$)</td>
<td>unlock($H$)</td>
</tr>
<tr>
<td>lock-$x(G)$</td>
<td>unlock($D$)</td>
<td>lock-$x(D)$</td>
<td>lock-$x(D)$</td>
</tr>
<tr>
<td>unlock($D$)</td>
<td>unlock($B$)</td>
<td>unlock($B$)</td>
<td>unlock($B$)</td>
</tr>
</tbody>
</table>
Graph-Based Protocols (Cont.)
- The tree protocol ensures conflict serializability as well as freedom from deadlock.
- Unlocking may occur earlier in the tree-locking protocol than in the two-phase locking protocol.
- shorter waiting times, and increase in concurrency
- protocol is deadlock-free, no rollbacks are required
- the abort of a transaction can still lead to cascading rollbacks.
(this correction has to be made in the book also.)
- However, in the tree-locking protocol, a transaction may have to lock data items that it does not access.
- increased locking overhead and additional waiting time
- potential decrease in concurrency
- Some schedules not possible under 2PL are possible under tree protocol, and vice versa.
Timestamp-Based Protocols
- Each transaction is issued a timestamp when it enters the system.
- If an old transaction $T_i$ has time-stamp $TS(T_i)$, a new transaction $T_j$ is assigned time-stamp $TS(T_j)$ such that $TS(T_i) < TS(T_j)$.
- The protocol manages concurrent execution such that the time-stamps determine the serializability order.
- In order to assure such behavior, the protocol maintains for each data $Q$ two timestamp values:
- **W-timestamp**($Q$) is the largest time-stamp of any transaction that executed **write**($Q$) successfully.
- **R-timestamp**($Q$) is the largest time-stamp of any transaction that executed **read**($Q$) successfully.
Timestamp-Based Protocols (Cont.)
- The timestamp ordering protocol ensures that any conflicting read and write operations are executed in timestamp order.
- Suppose a transaction $T_i$ issues a read($Q$)
1. If $TS(T_i) < W$-timestamp($Q$),
- $T_i$ needs to read a value of $Q$ that was already overwritten.
- Hence, the read operation is rejected, and $T_i$ is rolled back.
2. If $TS(T_i) \geq W$-timestamp($Q$),
- The read operation is executed, and R-timestamp($Q$) is set to the maximum of R-timestamp($Q$) and $TS(T_i)$.
Suppose that transaction $T_i$ issues a \texttt{write}(Q).
1. If $\text{TS}(T_i) < R$-timestamp(Q),
- The value of $Q$ that $T_i$ is producing was needed previously, and the system assumed that that value would never be produced.
- Hence, the \texttt{write} operation is rejected, and $T_i$ is rolled back.
2. If $\text{TS}(T_i) < W$-timestamp(Q),
- Then $T_i$ is attempting to write an obsolete value of $Q$.
- Hence, this \texttt{write} operation is rejected, and $T_i$ is rolled back.
3. Otherwise, ($\text{TS}(T_i) \geq R$-timestamp(Q) and $\text{TS}(T_i) \geq W$-timestamp(Q))
- The \texttt{write} operation is executed, and $W$-timestamp(Q) is set to $\text{TS}(T_i)$.
Example Use of the Timestamp Protocol
A partial schedule for several data items for transactions with timestamps 1, 2, 3, 4, 5
<table>
<thead>
<tr>
<th></th>
<th>$T_1$</th>
<th>$T_2$</th>
<th>$T_3$</th>
<th>$T_4$</th>
<th>$T_5$</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>read($Y$)</td>
<td>read($Y$)</td>
<td>write($Y$) write($Z$)</td>
<td>write($Y$)</td>
<td>read($X$)</td>
</tr>
<tr>
<td>$T_1$</td>
<td>read($X$)</td>
<td>abort</td>
<td>abort</td>
<td></td>
<td>write($Z$)</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>write($Y$) write($Z$)</td>
</tr>
</tbody>
</table>
Correctness of Timestamp-Ordering Protocol
- The timestamp-ordering protocol guarantees **serializability** since all the arcs in the precedence graph are of the form:
```
transaction with smaller timestamp transaction with larger timestamp
```
Thus, there will be **no cycles** in the precedence graph.
- Timestamp protocol ensures **freedom from deadlock** as no transaction ever waits.
- But the schedule may not be **cascade-free**, and may not even be **recoverable**.
Fig 16.13 Schedule 3: Not possible under 2PL, but possible under the time stamping protocol
<table>
<thead>
<tr>
<th>$T_{14}$</th>
<th>$T_{15}$</th>
</tr>
</thead>
<tbody>
<tr>
<td>read($B$)</td>
<td>read($B$)</td>
</tr>
<tr>
<td></td>
<td>$B := B - 50$</td>
</tr>
<tr>
<td>read($A$)</td>
<td>write($B$)</td>
</tr>
<tr>
<td>display($A + B$)</td>
<td>read($A$)</td>
</tr>
<tr>
<td></td>
<td>$A := A + 50$</td>
</tr>
<tr>
<td></td>
<td>write($A$)</td>
</tr>
<tr>
<td></td>
<td>display($A + B$)</td>
</tr>
</tbody>
</table>
Should wait in 2PL
Recoverability and Cascade Freedom
- Problem with timestamp-ordering protocol:
- Suppose $T_i$ aborts, but $T_j$ has read a data item written by $T_i$
- Then $T_j$ must abort; if $T_j$ had been allowed to commit earlier, the schedule is not recoverable.
- Further, any transaction that has read a data item written by $T_j$ must abort
- This can lead to cascading rollback --- that is, a chain of rollbacks
- Solution:
- A transaction is structured such that its writes are all performed at the end of its processing
- All writes of a transaction form an atomic action; no transaction may execute while a transaction is being written
- Starvation problem
- A transaction that aborts is restarted with a new timestamp
Time Stamping with Thomas’ Write Rule
- Modified version of the timestamp-ordering protocol in which obsolete write operations may be ignored under certain circumstances.
- When \( T_i \) attempts to write data item \( Q \), if \( TS(T_i) < W\text{-timestamp}(Q) \), then \( T_i \) is attempting to write an obsolete value of \( \{Q\} \).
- Hence, rather than rolling back \( T_i \) as the timestamp ordering protocol would have done, this “write” operation can be ignored.
- Otherwise this protocol is the same as the timestamp ordering protocol.
- Thomas' Write Rule allows greater potential concurrency.
- Unlike previous protocols, it allows some view-serializable schedules that are not conflict-serializable.
**Fig 16.14 Schedule 4:**
Not possible under 2PL, but possible in the timestamping with the Thomas’s write rule
<table>
<thead>
<tr>
<th></th>
<th>( T_{16} )</th>
<th>( T_{17} )</th>
</tr>
</thead>
<tbody>
<tr>
<td>read(( Q ))</td>
<td>write(( Q ))</td>
<td>write(( Q ))</td>
</tr>
</tbody>
</table>
**Validation-Based Protocol**
- Execution of transaction $T_i$ is done in three phases.
1. **Read and execution phase**
- Transaction $T_i$ writes only to temporary local variables
2. **Validation phase**
- Transaction $T_i$ performs a "validation test" to determine if local variables can be written without violating serializability.
3. **Write phase**
- If $T_i$ is validated, the updates are applied to the database; otherwise, $T_i$ is rolled back.
- The three phases of concurrently executing transactions can be interleaved, but each transaction must go through the three phases in that order.
- Also called as **optimistic concurrency control** since transaction executes fully in the hope that all will go well during validation.
Each transaction $T_i$ has 3 timestamps
- **Start**($T_i$): the time when $T_i$ started its execution
- **Validation**($T_i$): the time when $T_i$ entered its validation phase
- **Finish**($T_i$): the time when $T_i$ finished its write phase
Serializability order is determined by **timestamp given at validation time**, to increase concurrency.
- Thus $TS(T_i)$ is given the value of **Validation**($T_i$).
This protocol is useful and gives greater degree of concurrency if probability of conflicts is low.
- That is because the serializability order is not pre-decided and relatively less transactions will have to be rolled back.
Validation Test for Transaction $T_j$
- If for all $T_i$ with $TS(T_i) < TS(T_j)$ either one of the following conditions holds:
- $\text{finish}(T_i) < \text{start}(T_j)$
- $\text{start}(T_j) < \text{finish}(T_i) < \text{validation}(T_j)$ and the set of data items written by $T_i$ does not intersect with the set of data items read by $T_j$
then validation succeeds and $T_j$ can be committed.
Otherwise, validation fails and $T_j$ is aborted.
<table>
<thead>
<tr>
<th>Ti:</th>
<th>start $\rightarrow$ validation $\rightarrow$ finish</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tj:</td>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Ti:</th>
<th>start $\rightarrow$ validation $\rightarrow$ finish</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tj:</td>
<td>start $\rightarrow$ validation $\rightarrow$ finish</td>
</tr>
</tbody>
</table>
**Justification:** Either first condition is satisfied, and there is no overlapped execution, or second condition is satisfied and
1. the writes of $T_j$ do not affect reads of $T_i$ since they occur after $T_i$ has finished its reads.
2. the writes of $T_i$ do not affect reads of $T_j$ since $T_j$ does not read any item written by $T_i$.
**Schedule Produced by Validation**
- Example of schedule produced using validation
<table>
<thead>
<tr>
<th>$T_{14}$</th>
<th>$T_{15}$</th>
</tr>
</thead>
<tbody>
<tr>
<td>read($B$)</td>
<td>read($B$)</td>
</tr>
<tr>
<td>read($A$)</td>
<td>$B$: - $B$-50</td>
</tr>
<tr>
<td>(validate)</td>
<td>read($A$)</td>
</tr>
<tr>
<td>display ($A+B$)</td>
<td>$A$: - $A$+50</td>
</tr>
<tr>
<td>(validate)</td>
<td>write ($B$)</td>
</tr>
<tr>
<td></td>
<td>write ($A$)</td>
</tr>
</tbody>
</table>
NOT POSSIBLE IN 2PL
Multiple Granularity
- Allow data items to be of various sizes and define a hierarchy of data granularities, where the small granularities are nested within larger ones
- Can be represented graphically as a tree (but don't confuse with tree-locking protocol)
- When a transaction locks a node in the tree explicitly, it implicitly locks all the node's descendents in the same mode.
- Granularity of locking (level in tree where locking is done):
- fine granularity (lower in tree): high concurrency, high locking overhead
- coarse granularity (higher in tree): low locking overhead, low concurrency
The highest level is the entire database and then area, file and record.
In addition to S and X lock modes, there are three additional lock modes with multiple granularity:
- **intention-shared** (IS): indicates explicit locking at a lower level of the tree but only with shared locks.
- **intention-exclusive** (IX): indicates explicit locking at a lower level with exclusive or shared locks
- **shared and intention-exclusive** (SIX): the subtree rooted by that node is locked explicitly in shared mode and explicit locking is being done at a lower level with exclusive-mode locks.
Intention locks allow a higher level node to be locked in S or X mode without having to check all descendant nodes.
The compatibility matrix for all lock modes is:
<table>
<thead>
<tr>
<th></th>
<th>IS</th>
<th>IX</th>
<th>S</th>
<th>S IX</th>
<th>X</th>
</tr>
</thead>
<tbody>
<tr>
<td>IS</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>×</td>
</tr>
<tr>
<td>IX</td>
<td>✓</td>
<td>✓</td>
<td>×</td>
<td>×</td>
<td>×</td>
</tr>
<tr>
<td>S</td>
<td>✓</td>
<td>×</td>
<td>✓</td>
<td>×</td>
<td>×</td>
</tr>
<tr>
<td>S IX</td>
<td>✓</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
</tr>
<tr>
<td>X</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
</tr>
</tbody>
</table>
Multiple Granularity Locking Scheme
Transaction $T_i$ can lock a node $Q$, using the following rules:
1. The lock compatibility matrix must be observed.
2. The root of the tree must be locked first, and may be locked in any mode.
3. A node $Q$ can be locked by $T_i$ in S or IS mode only if the parent of $Q$ is currently locked by $T_i$ in either IX or IS mode.
4. A node $Q$ can be locked by $T_i$ in X, SIX, or IX mode only if the parent of $Q$ is currently locked by $T_i$ in either IX or SIX mode.
5. $T_i$ can lock a node only if it has not previously unlocked any node (that is, $T_i$ is two-phase).
6. $T_i$ can unlock a node $Q$ only if none of the children of $Q$ are currently locked by $T_i$.
Observe that locks are acquired in root-to-leaf order, whereas they are released in leaf-to-root order.
Multiversion Schemes
- Multiversion schemes keep old versions of data item to increase concurrency.
- Multiversion Timestamp Ordering
- Multiversion Two-Phase Locking
- Each successful write results in the creation of a new version of the data item written.
- Use timestamps to label versions.
- When a read(Q) operation is issued, select an appropriate version of Q based on the timestamp of the transaction, and return the value of the selected version.
- reads never have to wait as an appropriate version is returned immediately.
Multiversion Timestamp Ordering
- Each data item $Q$ has a sequence of versions $<Q_1, Q_2, \ldots, Q_m>$.
- Each version $Q_k$ contains three data fields:
- **Content** -- the value of version $Q_k$.
- **W-timestamp**($Q_k$) -- timestamp of the transaction that created (wrote) version $Q_k$
- **R-timestamp**($Q_k$) -- largest timestamp of a transaction that successfully read version $Q_k$
- When a transaction $T_i$ creates a new version $Q_k$ of $Q$, $Q_k$'s W-timestamp and R-timestamp are initialized to $TS(T_i)$.
- R-timestamp of $Q_k$ is updated whenever a transaction $T_j$ reads $Q_k$, and $TS(T_j) > R$-timestamp($Q_k$).
Multiversion Timestamp Ordering
- The multiversion timestamp scheme presented next ensures serializability.
- Suppose that transaction \( T_i \) issues a \textit{read}(Q) or \textit{write}(Q) operation.
- Let \( Q_k \) denote the version of Q whose write timestamp is the largest write timestamp less than or equal to \( TS(T_i) \).
1. If transaction \( T_i \) issues a \textit{read}(Q), then the value returned is the content of version \( Q_k \).
2. If transaction \( T_i \) issues a \textit{write}(Q),
- if \( TS(T_i) < R\text{-timestamp}(Q_k) \), then transaction \( T_i \) is rolled back.
- Otherwise if \( TS(T_i) = W\text{-timestamp}(Q_k) \), the contents of \( Q_k \) are overwritten, otherwise a new version of \( Q \) is created.
- Note that Reads always succeed
- But a write by \( T_i \) is rejected if some other transaction \( T_j \) that (in the serialization order defined by the timestamp values) should read \( T_i \)'s write, has already read a version created by a transaction older than \( T_i \).
Multiversion Two-Phase Locking
- Differentiates between read-only transactions and update transactions
- *Ts-counter* is a global time-stamp clock
- *Update transactions* acquire read and write locks, and hold all locks up to the end of the transaction.
- That is, update transactions follow rigorous two-phase locking.
- Each successful write results in the creation of a new version of the data item written.
- Each version of a data item has a single timestamp whose value is obtained from a counter *ts-counter* that is incremented during commit processing.
- *Read-only transactions* are assigned a timestamp by reading the current value of *ts-counter* before they start execution
- they follow the multiversion timestamp-ordering protocol for performing reads.
Multiversion Two-Phase Locking
- When an update transaction wants to read a data item,
- it obtains a shared lock on it,
- and reads the latest version.
- When an update transaction wants to write an item,
- it obtains X lock on;
- it then creates a new version of the item and sets this version's timestamp to $\infty$ (infinity).
- When an update transaction $T_i$ completes, commit processing occurs:
- $T_i$ sets timestamp on the versions it has created to $\text{ts-counter} + 1$
- $T_i$ increments $\text{ts-counter}$ by 1
- Read-only transactions that start after $T_i$ increments $\text{ts-counter}$ will see the values updated by $T_i$.
- Read-only transactions that start before $T_i$ increments the $\text{ts-counter}$ will see the value before the updates by $T_i$.
- Only serializable schedules are produced.
Deadlock Handling
- Consider the following two transactions:
\[ T_1: \quad \text{write}(X) \quad T_2: \quad \text{write}(Y) \]
\[ \text{write}(Y) \quad \text{write}(X) \]
- Schedule with deadlock
<table>
<thead>
<tr>
<th>( T_1 )</th>
<th>( T_2 )</th>
</tr>
</thead>
<tbody>
<tr>
<td>\textbf{lock-X} on ( X ) \text{ write } (X) \</td>
<td>\textbf{lock-X} on ( Y ) \text{ write } (Y) \text{ wait for } \textbf{lock-X} \text{ on } X \text{ write}(X)</td>
</tr>
<tr>
<td>\text{wait for } \textbf{lock-X} \text{ on } Y \text{ write}(Y)</td>
<td></td>
</tr>
</tbody>
</table>
Deadlock Handling
- System is deadlocked if there is a set of transactions such that every transaction in the set is waiting for another transaction in the set.
- **Deadlock prevention protocols** ensure that the system will *never* enter into a deadlock state.
- Some prevention strategies:
- Require that each transaction locks all its data items before it begins execution (predeclaration).
- Impose **partial ordering of all data items**
- require that a transaction can lock data items only in the order specified by the partial order (graph-based protocol).
- **Timeout-Based Schemes**:
- a transaction waits for a lock only for a specified amount of time.
- After the wait time is out and the transaction is rolled back. (No deadlock!)
- simple to implement; but **starvation is possible**
- Also difficult to determine good value of the timeout interval.
- Use **timestamping** (in the next slide)
Deadlock Prevention with Timestamps
- Following schemes use transaction timestamps for the sake of deadlock prevention alone.
- **Wait-die** scheme — non-preemptive
- Older transaction may wait for younger one to release data item.
- Younger transactions never wait for older ones; they are rolled back instead.
- A transaction may die several times before acquiring needed data item.
- **Wound-wait** scheme — preemptive
- Older transaction wounds (forces rollback of) younger transaction instead of waiting for it.
- Younger transactions may wait for older ones.
- May be fewer rollbacks than *wait-die* scheme.
- Both in *wait-die* and in *wound-wait* schemes, a rolled back transaction is restarted with its original timestamp.
- Older transactions thus have precedence over newer ones in these schemes, and starvation is hence avoided.
Deadlock Detection
- Deadlocks can be described as a *wait-for graph*, which consists of a pair $G = (V,E)$,
- $V$ is a set of vertices (all the transactions in the system)
- $E$ is a set of edges; each element is an ordered pair $T_i \rightarrow T_j$.
- If $T_i \rightarrow T_j$ is in $E$, then there is a directed edge from $T_i$ to $T_j$
- implying that $T_i$ is waiting for $T_j$ to release a data item.
- When $T_i$ requests a data item held by $T_j$, then $T_i \rightarrow T_j$ is inserted in the wait-for graph.
- This edge is removed only when $T_j$ is no longer holding a data item needed by $T_i$.
- The system is in a deadlock state if and only if the wait-for graph has a cycle.
- The system invokes a deadlock-detection algorithm *periodically* to look for cycles.
**Wait-for graph without a cycle**
**Wait-for graph with a cycle**
Deadlock Recovery
- When deadlock is detected:
- Some transaction will have to rolled back (made a victim) to break deadlock.
- Select that transaction as **victim that will incur minimum cost**.
- Rollback -- determine how far to roll back transaction
- **Total rollback**: Abort the transaction and then restart it.
- **Partial rollback**: More effective to roll back transaction only as far as necessary to break deadlock.
- Starvation happens if same transaction is always chosen as victim.
- The system may include the number of rollbacks in the cost factor to avoid starvation.
|
{"Source-Url": "https://web.cs.hacettepe.edu.tr/~ssen/teaching/vt/VTw9.pdf", "len_cl100k_base": 8516, "olmocr-version": "0.1.53", "pdf-total-pages": 43, "total-fallback-pages": 0, "total-input-tokens": 72348, "total-output-tokens": 9470, "length": "2e13", "weborganizer": {"__label__adult": 0.00033211708068847656, "__label__art_design": 0.00019359588623046875, "__label__crime_law": 0.0005769729614257812, "__label__education_jobs": 0.0008387565612792969, "__label__entertainment": 6.580352783203125e-05, "__label__fashion_beauty": 0.0001150369644165039, "__label__finance_business": 0.0005354881286621094, "__label__food_dining": 0.0003027915954589844, "__label__games": 0.00101470947265625, "__label__hardware": 0.001300811767578125, "__label__health": 0.0004220008850097656, "__label__history": 0.00024628639221191406, "__label__home_hobbies": 9.876489639282228e-05, "__label__industrial": 0.0006451606750488281, "__label__literature": 0.00021982192993164065, "__label__politics": 0.00027298927307128906, "__label__religion": 0.0003802776336669922, "__label__science_tech": 0.064697265625, "__label__social_life": 8.14199447631836e-05, "__label__software": 0.033935546875, "__label__software_dev": 0.89306640625, "__label__sports_fitness": 0.0002694129943847656, "__label__transportation": 0.0004646778106689453, "__label__travel": 0.00014722347259521484}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28551, 0.0111]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28551, 0.36427]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28551, 0.85956]], "google_gemma-3-12b-it_contains_pii": [[0, 20, false], [20, 510, null], [510, 1150, null], [1150, 1844, null], [1844, 2593, null], [2593, 3467, null], [3467, 3970, null], [3970, 4497, null], [4497, 4866, null], [4866, 5304, null], [5304, 5856, null], [5856, 6783, null], [6783, 7517, null], [7517, 8120, null], [8120, 8928, null], [8928, 9988, null], [9988, 10737, null], [10737, 11407, null], [11407, 11954, null], [11954, 12648, null], [12648, 13055, null], [13055, 13535, null], [13535, 13898, null], [13898, 14632, null], [14632, 15599, null], [15599, 16371, null], [16371, 17006, null], [17006, 18223, null], [18223, 18544, null], [18544, 19227, null], [19227, 19858, null], [19858, 20171, null], [20171, 20983, null], [20983, 21523, null], [21523, 22165, null], [22165, 23204, null], [23204, 23981, null], [23981, 24821, null], [24821, 25293, null], [25293, 26230, null], [26230, 27089, null], [27089, 27945, null], [27945, 28551, null]], "google_gemma-3-12b-it_is_public_document": [[0, 20, true], [20, 510, null], [510, 1150, null], [1150, 1844, null], [1844, 2593, null], [2593, 3467, null], [3467, 3970, null], [3970, 4497, null], [4497, 4866, null], [4866, 5304, null], [5304, 5856, null], [5856, 6783, null], [6783, 7517, null], [7517, 8120, null], [8120, 8928, null], [8928, 9988, null], [9988, 10737, null], [10737, 11407, null], [11407, 11954, null], [11954, 12648, null], [12648, 13055, null], [13055, 13535, null], [13535, 13898, null], [13898, 14632, null], [14632, 15599, null], [15599, 16371, null], [16371, 17006, null], [17006, 18223, null], [18223, 18544, null], [18544, 19227, null], [19227, 19858, null], [19858, 20171, null], [20171, 20983, null], [20983, 21523, null], [21523, 22165, null], [22165, 23204, null], [23204, 23981, null], [23981, 24821, null], [24821, 25293, null], [25293, 26230, null], [26230, 27089, null], [27089, 27945, null], [27945, 28551, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28551, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, true], [5000, 28551, null]], "pdf_page_numbers": [[0, 20, 1], [20, 510, 2], [510, 1150, 3], [1150, 1844, 4], [1844, 2593, 5], [2593, 3467, 6], [3467, 3970, 7], [3970, 4497, 8], [4497, 4866, 9], [4866, 5304, 10], [5304, 5856, 11], [5856, 6783, 12], [6783, 7517, 13], [7517, 8120, 14], [8120, 8928, 15], [8928, 9988, 16], [9988, 10737, 17], [10737, 11407, 18], [11407, 11954, 19], [11954, 12648, 20], [12648, 13055, 21], [13055, 13535, 22], [13535, 13898, 23], [13898, 14632, 24], [14632, 15599, 25], [15599, 16371, 26], [16371, 17006, 27], [17006, 18223, 28], [18223, 18544, 29], [18544, 19227, 30], [19227, 19858, 31], [19858, 20171, 32], [20171, 20983, 33], [20983, 21523, 34], [21523, 22165, 35], [22165, 23204, 36], [23204, 23981, 37], [23981, 24821, 38], [24821, 25293, 39], [25293, 26230, 40], [26230, 27089, 41], [27089, 27945, 42], [27945, 28551, 43]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28551, 0.18818]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
5444478d916b372576846c41b6536482080b1bd9
|
SOFIE - Secure Open Federation for Internet Everywhere
779984
DELIVERABLE D4.1
Validation and Evaluation Plan
<table>
<thead>
<tr>
<th>Project title</th>
<th>SOFIE – Secure Open Federation for Internet Everywhere</th>
</tr>
</thead>
<tbody>
<tr>
<td>Contract Number</td>
<td>H2020-IOT-2017-3 – 779984</td>
</tr>
<tr>
<td>Date of preparation</td>
<td>16.12.2019</td>
</tr>
<tr>
<td>Author(s)</td>
<td>Vasilios A. Siris (AUEB-RC), Mikael Jaatinen (LMF), Yiannis Oikonomidis (SYN), Santeri Paavolainen (AALTO), Tommi Elo (AALTO), Nikos Fotiou (AUEB-RC), Spyros Voulgaris (AUEB-RC), Dmitrij Lagutin (AALTO), Ektor Arzoglou (AALTO), Giuseppe Raveduto (ENG), Priit Anton (GT), George C. Polyzos (AUEB-RC), George Xylomenos (AUEB-RC)</td>
</tr>
</tbody>
</table>
| Responsible person | Vasilios A. Siris (AUEB-RC), vsiris@aueb.gr |
| Target Dissemination Level | Public |
| Status of the Document | Completed |
| Version | 1.10 |
| Project web-site | https://www.sofie-iot.eu/ |
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 779984.
Summary of changes compared to previous version
<table>
<thead>
<tr>
<th>Version</th>
<th>Major changes</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.10</td>
<td>Added detailed validation and evaluation planning that includes responsibilities, tools used, and method (how) in Table 1, Section 5</td>
</tr>
<tr>
<td></td>
<td>Table 1 includes planning for pilot scenario validation and evaluation, architecture features and KPIs, and framework component requirements validation</td>
</tr>
<tr>
<td></td>
<td>Added details of the validation plan and process in Section 5.1</td>
</tr>
<tr>
<td></td>
<td>Added testbed tool functionality and usage in Table 2, Section 5.2</td>
</tr>
</tbody>
</table>
Table of Contents
1. Introduction ..................................................................................................................6
2. Validation and Evaluation Methodology .................................................................7
2.1 Validation methodology and overall plan .................................................................7
2.2 Evaluation methodology and overall plan ...............................................................8
2.3 Joint analysis of testbed and pilot results ...............................................................9
2.4 Evaluation from a business perspective .................................................................9
2.5 Evaluation using a system dynamics approach .....................................................9
3. Validation and Evaluation Platforms .................................................................11
3.1 Local testbeds .........................................................................................................11
3.1.1 LMF Ericsson validation environment ............................................................11
3.1.2 AUEB testbed .................................................................................................11
3.1.3 Aalto testbed .................................................................................................11
3.2 Testbed interconnection ........................................................................................12
3.2.1 Description of KSI Blockchain access ............................................................12
3.2.2 Integration Resources ....................................................................................13
3.2.3 Try-out Servers .............................................................................................13
3.3 Pilots ....................................................................................................................13
3.3.1 Food Chain ..................................................................................................14
3.3.2 Energy (Estonia) ..........................................................................................14
3.3.3 Energy (Italy) ..............................................................................................15
3.3.4 Mobile Gaming ............................................................................................15
4. Tools ....................................................................................................................16
4.1 Validation tools .....................................................................................................16
4.1.1 Source control management ..........................................................................16
4.1.2 Continuous code quality inspection ...............................................................16
4.2 Verification tools ...................................................................................................17
4.3 Testbed tools .......................................................................................................17
4.3.1 Remix IDE ....................................................................................................17
4.3.2 MetaMask .....................................................................................................17
4.3.3 Ethereum Network Stats .............................................................................17
4.3.4 BlockScout ...................................................................................................18
4.3.5 Etherscan .....................................................................................................18
4.3.6 Solium ..........................................................................................................18
4.3.7 OpenZeppelin ..............................................................................................18
4.3.8 Fuzzing tools ...............................................................................................18
4.3.9 Hyperledger Explorer ...................................................................................18
4.3.10 Hyperledger network visualization ...............................................................18
4.3.11 Hyperledger Caliper ....................................................................................19
4.3.12 Hyperledger Cello ......................................................................................19
4.3.13 Hyperledger Composer ..............................................................................19
4.3.14 Tineola .......................................................................................................19
4.3.15 Project Things .............................................................................................19
4.4 Analytical evaluation tools ...................................................................................19
5. Validation and Evaluation Test Planning .................................................................21
5.1 Validation plan and process ..................................................................................22
5.2 Testbed tool functionality and usage ...................................................................23
6. Conclusions .............................................................................................................25
7. References ...............................................................................................................26
List of Figures
*Figure 1: Validation process* ................................................................. 23
List of Tables
Table 1: Validation and evaluation planning .................................................... 21
Table 2: Testbed tool functionality and usage.................................................... 23
1. Introduction
The main objective of the evaluation work package (WP4) is the qualitative and quantitative evaluation of the SOFIE architecture and framework. Key Performance Indicators (KPIs) and assessment criteria defined in WP2 (Federation Architecture & Framework) will be leveraged. Moreover, the results of the validation and evaluation work conducted in WP4 and recommendations based on these results will be fed into the architecture and framework design in WP2 and the business integration in WP3 (Business Platforms Integration). This feedback will be obtained in the two planned cycles of validation and evaluation activities, which correspond to an initial (first) and second report of findings and recommendations for the SOFIE architecture and framework, guiding the following SOFIE design and development activities. The cycles of validation and evaluation will map against the main releases of the SOFIE platform.
The cycles of validation and evaluation will map against the main releases of the SOFIE platform. The work in WP4 involves two distinct directions: validation and evaluation.
- **Validation** will focus on checking whether the SOFIE platform meets the requirements of the stakeholders that use the platform. Validation is distinct from integration and verification, which includes testing the behavior and interoperability of components, undertaken in WP3.
- **Evaluation** will focus on assessing and measuring the performance of the SOFIE architecture and platform, based on the KPIs and assessment criteria defined in WP2 and other more general systems metrics and goals. The evaluation will include both a quantitative and a qualitative component.
- The quantitative evaluation will focus on aspects such as response time, throughput, resource utilization, scalability, and availability. Some of these metrics can be assessed through measurements from testbed experiments with implementations of the SOFIE framework, while others, such as scalability and availability, will be assessed using analytical models and tools.
- The qualitative evaluation will focus on architectural aspects, such as the security and privacy features of the overall architecture and of a subset of the platform components, the ability to integrate different IoT platforms and provide services across domains, and the ability to support innovative applications.
Although validation and evaluation have different objectives, the same platforms will be used for both validation and evaluation.
This deliverable is structured as follows. In Section 2 we discuss the methodology for the validation and evaluation work, along with the corresponding time-plan. In Section 3 we describe the evaluation platforms, some of which have already been implemented at the time this deliverable was prepared. In Section 4 we discuss the tools that will be used in the validation and evaluation activities, which include both software and analytical tools. In Section 5 we conclude by summarizing the methodology and plan, emphasizing the goals and key directions for the validation and evaluation work.
2. Validation and Evaluation Methodology
This section gives a high-level description of our plan and methodology for validating and evaluating the SOFIE project outcomes. In SOFIE three levels of validation are identified: component validation, component integration validation, and pilot validation.
2.1 Validation methodology and overall plan
The purpose of software (SW) validation is to assure that the software does what the customer or end user wants. It is perfectly possible for a piece of software to pass a series of verification test cases, and still not fulfill customer expectations. This usually happens because requirements were not properly communicated or defined to the software developers. On the other hand, it is quite unlikely that software that fails verification testing will meet the customer's requirements. Validation is a wider concept than verification against defined test cases and requirements. The pilot validation, in addition to pure verification against requirements, will involve trial usage of the system with the customers and representative users, to ensure that any missing or misunderstood requirements are revealed and can be incorporated (typically) through a change management process.
Testing (i.e., verification) can be divided as follows:
- **Unit testing**: Verification of the correct behavior of single SW components or units. This phase is either within the WP2 scope or beyond SOFIE’s scope (e.g., for third-party or free and open-source SW).
- **Integration testing**: Verification of the start-up procedures and SW component interfaces. Typically, a major part, or even the full range of these tests are automated in a continuous integration process. Integration testing is within the scope of WP3.
- **Functional testing**: Verification of the correctness of the implementation of functional requirements. This activity is within the scope of WP4 validation work.
- **Interface testing**: Verification of the correctness of interfaces and interoperability between subsystems and systems against designated API specifications. This activity is within the scope of WP4 validation work.
- **System testing**: Verification of system-level functional and non-functional requirements (e.g., assessed via KPIs in SOFIE). This activity will take place in WP4 during validation and evaluation, with the majority of the activities being part of the evaluation.
- **Acceptance testing**: Formal process where the complete system is verified against customer/end user defined acceptance requirements. In SOFIE, this phase may not be required, but if it is, it will be shared between WP4 validation and evaluation.
Verification in a SW development project is primarily a risk mitigation function. The purpose of verification is to advise the project on the quality risks in the delivery, seeking to mitigate the greatest risks as early as possible and to provide information on the residual risks such that a rational judgment between cost, time, and quality of the delivery can be taken.
The trial usage part of validation will take place in SOFIE as part of the four pilots.
The SOFIE integration plan, D3.1 [SOFIE D3.1], describes the integration-related parts of the validation plan and the overall integration process. As a continuous integration methodology will be applied in WP3, not all versions of the SOFIE business platforms will be delivered to WP4 and WP5 (Pilots). The following main principles will apply:
- The SOFIE testbed release (version 0) will undergo a partial range of validation activities, focusing on functional testing, interface testing and SW quality controls.
- The SOFIE main SW releases version 1 and version 2 will undergo the full range of validation activities.
For intermediate SOFIE SW releases, WP4 will only validate SOFIE business platform versions with meaningful new content, such as new features, or important fault corrections.
Within WP4, validation and evaluation will be parallel activities, i.e., there will be no acceptance testing required by evaluation.
WP5 will only deploy SW that has undergone at least functional testing, interface testing, and partial system testing.
Acceptance testing and definition of acceptance test cases will be done jointly across WP4 and WP5 pilots.
The time plan for the validation work will proceed with the following milestones:
- CI/CD (Continuous Integration/Continuous Delivery) environment design and setup as per deliverable D3.1 [SOFIE D3.1] (October 2018 – June 2019), aligned to meet the needs of deliverable "D4.3 - First Architecture and System Evaluation Report" due in June 2019.
- First architecture and system validation (June 2019): this will define the test case baseline (passed / not passed) and the feedback from pilots.
- Second architecture and system validation (April 2020): this will define the test case baseline (passed / not passed) and the feedback from pilots.
- Final architecture, system, and pilot validation (December 2020): this will define the final test case baseline, feedback from pilots and the final test report.
2.2 Evaluation methodology and overall plan
The goal of evaluation is to assess the value of a software concept, system, and subsystems. Evaluation is a crucial stage in the software development process, both for commercial software and for software developed as part of an academic exercise. For commercial software, the customer will want to evaluate the software to determine how well it performs its advertised functions. Evaluation is split into qualitative and quantitative evaluation.
The qualitative evaluation will focus on the following aspects: security and privacy of the overall architecture and of individual platform components; ability to integrate different IoT platforms and federate services across domains; support for innovative applications built on top of SOFIE’s open federation platform and interworking with applications implemented directly on IoT platforms outside the federation; and deployment complexity.
The quantitative evaluation will include performance evaluation, e.g., system throughput and delay for various workloads and conditions, but also scalability and robustness. In addition, individual components of the SOFIE framework can be evaluated from such a perspective and their synthesis can be investigated (and whether properties and performance of the system can be deduced from those of the components). This is considered particularly important in the SOFIE case since the emphasis is on open federation of potentially not fully understood (with respect to their internal structure, behavior and performance) systems.
Two cycles of evaluation activities are planned, corresponding to the ‘cycle 1’ and ‘cycle 2’ implementations of the platform. The majority of the work in this task will focus on the ‘cycle 1’ prototype in order to provide feedback to WP2 and WP3 as early as possible. Following this, the ‘cycle 2’ prototype evaluation will ensure that the design and implementation refinements based on the first cycle feedback have improved the overall performance of the platform and its individual components, without introducing negative impacts or regressions.
The time plan for the evaluation work will proceed with the following milestones:
- Testbed environment design and setup, deliverable D4.2 (February 2019): this will include a detailed description of the testbed topology and the initial experience with its setup depending on the evaluation scenarios and targets, including a justification of the evaluation targets and Key Performance Indicators (KPIs) that are to be investigated.
First architecture and system evaluation, deliverable D4.3 (June 2019): this will include the initial evaluation scenarios and results of the SOFIE architecture and platform, from both a qualitative and a quantitative perspective.
Second architecture and system evaluation, deliverable D4.4 (April 2020): this will include the complete evaluation of the SOFIE architecture and platform.
Final architecture, system, and pilot evaluation, deliverable D4.5 (December 2020): this will include the evaluation of the SOFIE platform, combining results from the architecture evaluation, testbed evaluation, and results from the pilot experiments.
2.3 Joint analysis of testbed and pilot results
The results from the pilots will be analyzed jointly with WP5 and reported in conjunction with the final set of system-level testbed evaluation results from WP5. This joint analysis and comparison will verify the gains of the SOFIE platform in real conditions and validate its advantages. Moreover, it will ensure consistency in reporting and make the final evaluation results available in a single comprehensive document. This will also be useful for the overall evaluation of the SOFIE architecture and its federation framework and business platform.
2.4 Evaluation from a business perspective
Blockchain and interledger technologies can have a significant impact on business models due to the following key features: (i) they can provide integrity and trust while reducing the need for trusted third parties, (ii) they can provide product provenance and immutable tracking, and (iii) they can eliminate the need for intermediaries and can enable flexible peer-to-peer trading in a decentralized environment. These features can collectively enable the development of innovative applications, while reducing transaction costs and increasing efficiency.
These technologies can also lead towards open and decentralized platforms, where anyone can provide services with minimum barriers and even synthesize services from other existing services, perhaps without permission from the providers of the original services. Illustrating these properties and evaluating them from multiple, different perspectives would help their eventual realization and monetization. A Game Theoretic modelling of open platforms will be attempted, e.g., in the spirit of A. Salazar [Sal15], in order to better elucidate the interactions and dynamics among players and the role of open (digital) platforms, in particular compared to the more traditional (closed, owned, or monopolistic) digital platforms.
Related KPIs that have been identified in the Annex of D2.2 [SOFIE D2.2] include the ability to conduct transactions across multiple ledgers, the ability to develop applications on top of multiple ledgers, and the ability of data publishers to dynamically control who has access to their data.
2.5 Evaluation using a system dynamics approach
System dynamics is a field of study that perceives the world as a complex system where “everything is connected to everything else.” This connection is depicted with feedback loops that can be either positive (i.e., reinforcing) or negative (i.e., balancing). The feedback structure of a system is first illustrated with causal loop diagrams (CLDs). Causal loop diagrams capture the basic hypothesis about the causes and effects of dynamics and elicits mental models of researchers. This is the initial step to communicate and assemble important input and feedback from experts or the community. Finalized causal loop diagrams are then modelled into stock and flow diagrams [Ste00].
More generally, systems thinking refers to the ability to see the world as a complex system, in which we understand that “you can’t just do one thing” without affecting other things. If people had such a holistic worldview, it is argued, they would then act in consonance with the long-term best interests of the system as a whole, identify the high leverage points in the system,
and avoid policy resistance. System dynamics is a method to enhance learning in complex systems. It is, partly, a method for developing simulation models to help us learn about dynamic complexity, understand the sources of policy resistance, and design more effective policies [Ste00].
We are currently using the system dynamics methodology to create causal loop diagrams for the digital business platforms of iPhone and Android devices [AEM+18], with the intention of first understanding the smartphone industry in terms of value creation, market growth, and user’s and app developer’s incentives for participation. These causal loop diagrams will, in turn, be converted to stock and flow diagrams.
Once we have gained initial understanding of how digital business platforms work in general, through this initial study and perhaps other studies into existing systems, our plan is to adapt and use the results of our research on the SOFIE pilots. So far, there is scarce literature that applies system dynamics to digital business platforms [RCK17], and specifically to case studies concerned with the smartphone [DPR+17] or transportation [VB17] industry.
3. Validation and Evaluation Platforms
This section describes the platforms that will be used for validation and evaluation. These platforms include local testbeds, the interconnection of local testbeds, software platforms designed and implemented, and the pilots.
3.1 Local testbeds
3.1.1 LMF Ericsson validation environment
LMF Ericsson’s testbed for validation of the reference platform functionality, before delivery to evaluation and pilot deployment, logically consists of three different systems:
- Supporting components that are used to manage and monitor the validation environment (logging, monitoring, access control, backups, etc.).
- Development process support, e.g., (DevOps) Continuous Integration (CI) and Continuous Delivery (CD) systems.
- Staging and “production” environments, which consist of necessary pilot component deployments in both staging and “production”\(^1\) and any other static components supporting them, including Distributed Ledger Technology (DLT) setups (i.e., Ethereum, private Ethereum, Hyperledger Fabric etc.).
3.1.2 AUEB testbed
The AUEB local testbed is currently focused on experimentation with IoT device integration, and user authentication and authorization. It consists of the following elements:
- A private Ethereum chain implemented using:
- Two Virtual Machines (VMs) acting as miners and RPC servers.
- One VM that implements auxiliary functions (bootstrap node, monitoring tool).
- One Android smartphone running the Geth\(^2\) Ethereum client.
- An instance of the WS02 identity server\(^3\), which is based on open standards and open source principles and provides identity and access management functions.
- An instance of the OAuth2.0 server\(^4\), which implements an open authorization framework that provides delegated authorization to protected resources.
- A VM running Mozilla’s Thing Gateway\(^5\), which allows monitoring and controlling devices through a single secure web interface.
- A Hyperledger Fabric network.
- Hash-lock based interledger functionality between Ethereum and Hyperledger Fabric.
- Access to Guardtime’s KSI Blockchain.
AUEB is additionally planning to provide:
- A Hyperledger Indy deployment.
- A Hyperledger Quilt deployment.
3.1.3 Aalto testbed
Aalto’s testbed is mainly used for research and it may also be used for teaching in the future. It currently consists of:
---
\(^1\) “Production” in the sense of being in production for pilot testing and evaluation purposes, not in the general sense of being in “production” as generally available to entities outside the project members.
\(^2\) https://geth.ethereum.org/downloads/
\(^3\) https://wso2.com/identity-and-access-management/
\(^4\) https://github.com/bshaffer/oauth2-server-php
\(^5\) https://iot.mozilla.org/gateway/
- An Ethereum miner, which operates in the context of the Nanopool mining pool. Ether gained from mining can be used for smart contract experimentation on the real Ethereum network.
- An archival node on the main Ethereum network for research purposes. An archival node, in addition to storing the blockchain history, also stores additional information such as the blockchain state history information normally retained by full nodes only for a limited number of blocks. Such information is useful for analyzing the Ethereum network.
- Access to Guardtime’s KSI Blockchain.
In the future the testbed will be extended with:
- An Ethereum node on a SOFIE private Ethereum network (connected to AUEB and other partners).
- A Hyperledger Fabric network for interledger research and testing. If needed, multiple small-scale networks will be run, and/or connected to other partners’ networks.
### 3.2 Testbed interconnection
Below we describe the planned interconnections among the local SOFIE testbeds.
- **Interconnection of the AUEB, Aalto and LMF local testbeds**
This will involve the interconnection of the local Ethereum nodes that are part of SOFIE’s private Ethereum network. This interconnection will include two options. The first will have miners running in nodes located in different local networks to be part of the same private Ethereum network. The second option will involve interledger operations between nodes located in different local networks, which belong to different private blockchains; these blockchains can be of the same type (e.g., Ethereum) or of different types. The second option requires a module (gateway) outside the main nodes that handles the communication among the blockchains that are necessary for running the hash time-locked contracts on the two blockchains.
- **Interconnection of the AUEB testbed with the food chain pilot**
Synelixis has provided access to its SynField platform, where a device dedicated for experimentation provides various measurements including air temperature, solar radiation level, air humidity, device temperature, and device current. These measurements can also be accessed using a REST Web service. An application running at AUEB’s premises periodically uses the REST API provided by SynField and pulls measurements. Then, it records the hash of the measurements in an Ethereum smart contract located on AUEB’s private Ethereum network.
- **Interconnection of local testbeds with Guardtime’s KSI Blockchain**
Aalto and AUEB tested connections to Guardtime’s KSI Blockchain will be realized through try-out servers for both Catena and the KSI Gateway. Guardtime will take care of user management and of providing Aalto and AUEB with access credentials. In fact, AUEB has already been given access and has connected its local testbed to the KSI blockchain, using KSI’s try-out Catena API. The blockchain is hosted by KSI and it is accessible through a REST-based API.
### 3.2.1 Description of KSI Blockchain access
KSI signatures are server based, meaning that signing data requires online access to the KSI service. The verification of the signatures can be done both offline and online. There are two options for access to KSI:
- KSI Software Development Kit (SDK).
- Catena middleware.
The KSI SDK provides the lowest level of integration. It enables "full access" to the KSI functions (signing, extending, verifying) and lets the integrator fine-tune all possible options. As a consequence, it leaves many common challenges, such as signature storage and extension, to the integrator to solve.
Catena is middleware that is meant to address common integration challenges, such as asynchronous signing, signature persistence, and automatic extension. It provides the integrators with higher-level functionality, such as annotating signatures and linking signing events (data provenance), in order to reduce the effort for building a complete solution. Catena internally uses the aforementioned SDK to perform low-level KSI operations. The functionality of Catena is grouped and packaged into logical applications (Catena-KSI, Catena-DB, Catena-Prov) so that the integrator can choose which ones to deploy and use.
KSI SDK and Catena are not mutually exclusive: they can be used in combination if needed. This depends on the application type and the requirements for signing and verifying data.
### 3.2.2 Integration Resources
Depending on which integration option one wants to use, the following is needed to sign data, extend and verify signatures with KSI:
- access to KSI Gateway and KSI SDK to communicate with it; or
- access to Catena middleware and HTTP client library to communicate with it.
### 3.2.3 Try-out Servers
**Catena**
For the list of available API endpoints and reference documentation see [https://tryout.catena.guardtime.net](https://tryout.catena.guardtime.net). It is a Swagger UI that also allows direct execution of requests. This is the quickest option to get started with signing.
**KSI Gateway**
The KSI Gateway has two endpoints, one for aggregation/signing and one for signature extension. For tryout these are:
- [http://tryout.guardtime.net:8080/gt-signingservice](http://tryout.guardtime.net:8080/gt-signingservice)
The KSI Gateway uses HMAC-based authentication built in the KSI protocol. The KSI Gateway endpoints are expected to return "Bad URI" when just used in web browser.
In addition, the KSI publications file URL is needed for signature extension and verification with the KSI SDK. For Guardtime provided KSI services, this is [https://verify.guardtime.com/ksi-publications.bin](https://verify.guardtime.com/ksi-publications.bin).
**KSI SDK**
The SDK is available for Java, .NET and C. The description and documents on how to access are provided to the try-out user account.
### 3.3 Pilots
All SOFIE pilots will leverage the Business Platforms (BPs) that will be developed based on SOFIE's framework and reference platform. Data collected by the various IoT platforms that lie beneath the BP level will be available via the BP, hence, the availability of this data could serve as a means of validation for the system.
The following sections present the specific platforms developed in the context of each individual pilot.
### 3.3.1 Food Chain
In this pilot, we currently have three IoT platforms involved in the different segments of the supply chain path. Those platforms are either already commercially exploited by the partners they belong to, or they are extended versions of the outcomes of other H2020 EU projects. More specifically, we have the following IoT platforms (their details can be found in SOFIE Deliverable D5.1):
- **SynField IoT platform**, consisting of hardware components (deployed in the pilot’s field) and software components (in the form of a Cloud platform).
- **Aberon platform**, consisting of hardware components (deployed in the pilot’s warehouse) and software components (in the form of a Cloud platform).
- **Transportation IoT platform**, consisting of hardware components (deployed on the pilot’s transportation elements, e.g., vehicles and smart boxes) and software components (in the form of a Cloud server).
For the purposes of the pilot, the IoT platforms listed above will be enhanced with DLTs, such as Ethereum, Hyperledger Fabric, and KSI, based on their specific requirements. In addition, a Trace-History Marketplaces component will be developed, which will serve as the Business Platform for this specific pilot (as described in the SOFIE Deliverable D2.3 – Federation Framework, 1st version).
**User feedback:** In this pilot, the main user feedback consists of the user’s (i.e., end customer’s) reaction when she acquires information about a product. This information comes from the different DLTs via the pilot’s Business Platform. Hence, the success or failure of this process could be regarded an end-to-end evaluation of the whole system.
### 3.3.2 Energy (Estonia)
In this pilot, we have three environments that will be utilized: the smart-meters layer, the Elering Estfeed platform layer, and the smart-meter owners and data exchange (distribution) layer, using the KSI Blockchain API for integrity and security purposes.
The smart-meters layer provides input to the distribution layer and is the core for any data exchange demonstrated by the energy pilot. The smart-meters data input that will be used can be split into two categories: the data controlled by the grid operators (hence the pilot will only receive their input as provided) and the data managed by Guardtime in order to demonstrate the complete data provenance chain.
The Elering Estfeed platform connects all smart-meter data in Estonia and offers platform users the interfaces through which various data sources can be used in the desired applications.
The use of the KSI Blockchain via the respective API will guarantee the integrity of smart-meter data and authentication and support the agreements between parties.
**User feedback:** The evaluation in the Estonian energy pilot from a user perspective will target the following two aspects (and owner groups). First, given that it is an existing, deployed smart meter platform (Elering in Estonia and Energinet in Denmark) the expectation of the owners for the platform is that access among their systems will have enhanced security because of the SOFIE federated platform. Second, a small smart meter owner group has an interest in the SOFIE platform supporting the smart meter data exchange, including the requirements for integrity, authentication, and security aspects.
3.3.3 Energy (Italy)
The Energy pilot in Italy will leverage smart meters, electric-vehicle (EV) support equipment (e.g., charging stations), and electric vehicles (six of them). It is worth mentioning that this infrastructure is already deployed on the pilot site.
For the purposes of this pilot a software component will be developed for load and prediction forecasting that will utilize historical data collected from the aforementioned infrastructure. Additionally, a Flexibility Marketplace will be developed, which will serve as the Business Platform of this pilot. This marketplace will also leverage a blockchain infrastructure.
**User feedback:** During this pilot, a marketplace, implementing the SOFIE framework, will offer automated services to the involved actors (distribution system operator (DSO), Fleet manager, EV user). Those services will also leverage the interoperability offered by SOFIE, leading to a more efficient and secure flexibility management process. The “smooth” operation of the marketplace could serve as an indicator of SOFIE’s added value to a system that would otherwise be manually managed. Thus, feedback will be sought from the operator of the marketplace (and the marketplace itself) and the involved actors.
3.3.4 Mobile Gaming
The mobile gaming pilot will make use of an existing smartphone game platform and infrastructure that consists of a game development engine, servers, and services (owned by Rovio).
For the purposes of this pilot, the use of Ethereum will be investigated and particularly its ability to support a very large number of users.
**User feedback:** In the context of this pilot, a game will be developed. Due to the nature of this pilot, the evaluation of SOFIE could be linked to the feedback of users playing the game. If the game receives positive feedback (from many users, good reviews, etc.), we can use that fact as an indicator of SOFIE’s framework, which would have been leveraged during the development of the game and, hence, would have also played a role in the game’s positive feedback. More direct feedback for aspects related to the use of Ethereum will also be sought for evaluation, mostly through user feedback, such as the level of increased trust, usability etc.
4. Tools
This section describes the tools used for validation and evaluation. The first two sections focus on generic tools for validation and verification. Subsequently, the third section focuses on tools specific to our testbeds and to our analytic evaluation.
4.1 Validation tools
Note that a detailed description of the integration and validation environment can be found in the WP3 documentation. The subsections below are an overview of how the environment will support and will be used for validation.
4.1.1 Source control management
SOFIE will be using Git as the source control management technology. Git has become the de facto control management tool and is supported in all relevant development environments. It is supported also by so-called hosted repository services such as GitHub\(^6\) and GitLab\(^7\), which in turn have integrated auxiliary services such as code quality inspection services, continuous integration services etc.
The source code itself is managed by following a development model with a set of core developers who have write access to related SOFIE source code repositories. The detailed workflow of this is detailed in WP3 documentation, but the overview is that this set will follow a specific development methodology, including branches, code reviews, issue tracking, etc. The general community of open source developers can then participate in the development of SOFIE code by issuing pull requests, which are then reviewed and controlled by the core developers before being (or not) accepted into the main repository.
4.1.2 Continuous code quality inspection
The SOFIE project, especially the pilots, contain both proprietary and open source development. Similarly, some of the integration environment information needs to remain out of the public eye (deployment keys, etc.). This implies a two-fold approach to source code management and its associated tools:
- Open source portions of SOFIE development can use free-for-open-source-project services such as Travis CI, etc. See the next section on these.
- Proprietary or confidential source code relies on tools and services that can be operated for non-open-source projects, such as SonarQube Community Edition.
The detailed description of the integration environment and code quality automation is described in WP3 documentation, but the overview of the process is as follows:
1. All code changes are run through a continuous integration process. This process includes operations such as:
a. Compiling the source code.
b. Running unit tests.
c. Performing code quality analysis.
d. Archiving and marking artifacts of a successful CI run.
2. After a successful CI run, a continuous delivery process is performed. This includes:
a. Deploying the system into a Cloud or container environment.
b. Running integration tests against the deployment.
---
\(^6\) [https://github.com/]
\(^7\) [https://gitlab.com/]
4.2 Verification tools
While the code-level unit testing uses tools suitable for the particular language and framework, on the integration level, which is more focused on network APIs and user interfaces, the goals of integration, a.k.a. verification testing, is to ensure a deployed system, comprising of multiple components, operates as planned.
For integration testing, the suite of relevant tools contains:
- **User interface (UI) testing:** In the case of SOFIE, primarily Web UIs. This uses tools such as Selenium, Robot Framework, and SoapUI.
- **Network API testing:** There are a variety of tools, including SoapUI and various testing frameworks for different languages extending the unit-testing framework towards REST API testing.
Additionally, performance and stress testing can use tools such as JMeter, Siege etc.
Most of these tools would be integrated into the automated CI and CD workflow. Some tools may be run only manually, for example, to evaluate the performance of a deployment with a specific (exceptional) configuration.
4.3 Testbed tools
We now present some tools that can be used for testbed-based validation and evaluation.
4.3.1 Remix IDE
Remix⁸ is Ethereum’s official IDE. It is Web-based and it can be used for developing and debugging smart contracts. Furthermore, it can execute a smart contract using a JavaScript VM inside the browser, or it can deploy it to a testing network using tools such as MetaMask. It provides performance indicators, including cost and time required for a smart contract call.
4.3.2 MetaMask
MetaMask⁹ is an extension for the Chrome browser that acts as an Ethereum wallet. It allows the development of browser-based DApps for the Ethereum blockchain. In particular, it extends Chrome’s JVM to support Ethereum-specific operations, enabling Web pages to interact with an Ethereum network. Furthermore, MetaMask can act as a “proxy” and enable Remix to deploy and execute smart contracts to a testing network.
4.3.3 Ethereum Network Stats
Ethereum Network Stats¹⁰ is a network monitoring tool that can be used for monitoring the status of an Ethereum network, even for private deployments. It can be used to measure various network metrics, including block generation time, proof of work difficulty, block propagation time, gas price, and others.
---
⁸ [https://remix.ethereum.org](https://remix.ethereum.org)
⁹ [https://metamask.io/](https://metamask.io/)
¹⁰ [https://github.com/cubedro/eth-netstats](https://github.com/cubedro/eth-netstats)
4.3.4 BlockScout
BlockScout\textsuperscript{11} is a blockchain inspection tool that can be used with any Ethereum Virtual Machine compatible chain. It can be used for searching transactions, viewing accounts and balances, and verifying smart contracts.
4.3.5 Etherscan
Etherscan\textsuperscript{12} is a blockchain inspection tool similar to BlockScout.
4.3.6 Solium
Solium\textsuperscript{13} is an Ethereum smart contract analyzer. It can analyze smart contracts and propose fixes for style and security issues.
4.3.7 OpenZeppelin
OpenZeppelin\textsuperscript{14} is a library that can be used for developing secure smart contracts. It provides implementations of standards like ERC20 and ERC721, as well as Solidity components to build custom contracts and more complex decentralized systems.
4.3.8 Fuzzing tools
Fuzz testing or Fuzzing is a black box software testing technique used for finding implementation bugs, using malformed and semi-malformed data injection in an automated fashion.\textsuperscript{15} The project will use tools and libraries, such as Peach,\textsuperscript{16} to develop fuzzing tools in order to validate and evaluate the robustness of the developed communication protocols.
4.3.9 Hyperledger Explorer
Hyperledger Explorer\textsuperscript{17} acts as a feature-rich blockchain explorer for Hyperledger Fabric. Specifically, it enables inspection of the blockchain at both the block and transaction level, while also allowing users to interact with the blockchain via query and invocations directly through the dashboard. It is a powerful tool that also aggregates and produces useful statistics of the network such as the transaction throughput, transaction throttle and median processing time of a block.
4.3.10 Hyperledger network visualization
While no visual tools have been officially created by Hyperledger, there are ways one can visually represent a Hyperledger Fabric network. The easiest way would be to attach a network visualization program, such as Weave Scope on the Docker layer.\textsuperscript{18} Since the topology of a Hyperledger Fabric network can be visualized by observing the interactions that occur between the various Docker containers that run on each node, it is possible to visually represent the network by logging these interactions in a visual format. Another approach that can be used is to build the actual visualization engine by subscribing directly to an operating node in a similar fashion to Hyperledger Explorer. The EventHub channel provided by Hyperledger Fabric allows
\textsuperscript{11} https://github.com/poanetwork/blockscout
\textsuperscript{12} https://etherscan.io/
\textsuperscript{13} https://github.com/duaraghav8/Solium
\textsuperscript{14} https://github.com/OpenZeppelin/openzeppelin-solidity
\textsuperscript{15} https://www.owasp.org/index.php/Fuzzing
\textsuperscript{16} https://sourceforge.net/projects/peachfuzz/
\textsuperscript{17} https://www.hyperledger.org/projects/explorer
\textsuperscript{18} https://hub.docker.com/r/weaveworks/scope/
programs to listen to events from multiple channels and thus could be utilized to achieve the logging level required by a network visualizer.
4.3.11 Hyperledger Caliper
Hyperledger Caliper\(^\text{19}\) acts as a Command-Line Interface (CLI) tool for programmatically benchmarking the transactional throughput capabilities of a blockchain implementation in Hyperledger Fabric. The performance metrics that are calculated by Hyperledger Caliper include network transactions per second, resource utilization, and transaction latency.
4.3.12 Hyperledger Cello
Hyperledger Cello\(^\text{20}\) is a relatively new tool that is geared towards DevOps, enabling developers to frictionlessly manage the full lifecycle of a blockchain at scale. Hyperledger Cello, which is written in Python, is one of the crucial technologies that empower the Blockchain-as-a-Service model of IBM.
4.3.13 Hyperledger Composer
Hyperledger Composer\(^\text{21}\) is one of the most resilient and close to production Hyperledger tools. It is a high-level modelling language that enables the visual creation of entities within the Hyperledger Fabric network, enabling users to create complex networks easily without actually writing code. While still at an incubation state, it has seen rigorous development and has been extensively utilized because of its ease of use and developer friendliness.
4.3.14 Tineola
Tineola\(^\text{22}\) is an aggressive penetration testing tool for Hyperledger Fabric networks, including custom chaincode (Hyperledger’s term for smart contract -like functionality) that can be deployed and further test the security of the network.
4.3.15 Project Things
Project Things\(^\text{23}\) is a framework of software and services for connecting Things to the Web in a safe, secure and interoperable way. Project Things is composed of three major components. The first component is the Things Gateway, an open source implementation of a Web of Things (WoT) gateway which helps bridge existing IoT devices to the Web. The second one is the Things Framework, reusable software components to help create IoT devices which directly connect to the WoT. The third is Things Cloud, a collection of Mozilla-hosted Cloud services to help manage a large number of IoT devices over a wide geographic area.
4.4 Analytical evaluation tools
In addition to software evaluation tools, examining and modelling the technical specifications of the involved blockchains and overall systems can prove a valuable analytic tool for the evaluation and assessment of the proposed architecture and framework.
Blockchain properties that should be considered can be grouped into performance metrics and usability metrics.
\(^{19}\) [https://github.com/hyperledger/caliper](https://github.com/hyperledger/caliper)
\(^{20}\) [https://www.hyperledger.org/projects/cello](https://www.hyperledger.org/projects/cello)
\(^{21}\) [https://hyperledger.github.io/composer/latest/](https://hyperledger.github.io/composer/latest/)
\(^{22}\) [https://github.com/tineola/tineola](https://github.com/tineola/tineola)
\(^{23}\) [https://iot.mozilla.org](https://iot.mozilla.org)
The most obvious performance metrics are the blockchain's **throughput** and **latency**. Throughput refers to the number of transactions the blockchain can process per second, while latency refers to the expected time between the submission of a transaction and its inclusion in the blockchain. These metrics determine the blockchain's **scalability** with respect to the anticipated transaction load.
A third performance metric related to a blockchain's latency is the time it takes for a transaction to be considered "safe enough," i.e., the number of blocks that should succeed a given transaction's block to provide sufficient guarantees against the probability of a fork. This criterion is subjective and depends on the level of assurance a user desires for a given transaction.
Another performance metric is the amount of **resources** a blockchain uses to run. This is directly dependent on the consensus algorithm used. It is well known that Proof-of-Work uses significantly more resources than other consensus algorithms, like Proof-of-Stake, Proof-of-Authority, and Proof-of-Elapsed-Time. When IoT devices are at stake, the selection of an energy-friendly algorithm can prove vital to the feasibility of the system. By considering the number of transactions processed per second, we can estimate the **cost per transaction**, in terms of energy and resources.
In addition to the transaction cost in terms of energy, in most blockchains there is also a **monetary cost** associated with each transaction, typically paid in the blockchain's own currency. This cost is typically paid to miners and it serves as an incentive for miners to keep running the system. When the transaction rate exceeds the system's throughput, the monetary cost of each transaction increases as a result of competition among parties to give their transactions higher priority over others.
The second group of properties used to evaluate a blockchain concerns usability metrics. These are qualitative metrics that depict a blockchain's versatility in terms of functionality.
The most significant usability metric for blockchains is the language in which smart contracts are written. The language's expressiveness can range dramatically. For instance, Bitcoin only supports a simple language, called **Script**, which is not Turing-complete, and whose scope is limited to validating whether someone has the right to spend a given amount or not. Ethereum's smart-contract language, **Solidity**, is a Turing-complete language, allowing arbitrary computations as well as interaction among smart contracts. Finally, Hyperledger Fabric pushes smart contract flexibility even further, allowing smart contracts to run as fully-fledged VMs written in any language, as long as Hyperledger Fabric provides bindings for that language.
The blockchain's permission model constitutes a qualitative evaluation criterion that depends on which nodes are allowed to participate in a blockchain. Permissionless blockchains (e.g., Ethereum) allow arbitrary nodes to join and contribute to their network, just by downloading and executing their software. Permissioned blockchains (e.g., Hyperledger Fabric) are closed to the public. A node needs to have authorization to join such a blockchain's network.
Last but not least, a qualitative property that can play a significant role in complex systems hosting multiple different blockchains, is the blockchains' ability to interact with each other, such as through the Interledger Protocol (ILP). A blockchains' compliance to ILP is important for ensuring that systems relying on them can interact seamlessly within the reference architecture.
5. Validation and Evaluation Test Planning
Validation of the SOFIE framework is described in more detail in the next subsection. Evaluation of the SOFIE framework will be performed in WP4 according to scenarios that will be defined in D4.3.
The responsibilities, tools, and approaches for the validation and evaluation work are shown in the table below. The partners identified in the second column are those responsible for developing and executing the validation/evaluation tests. An initial version of the architecture KPIs have been defined in D2.4. The KPIs will be extended with the addition of system performance KPIs and pilot specific KPIs in D4.3.
Further details on the validation plan and process is presented in the next subsection.
Table 1: Validation and evaluation planning
<table>
<thead>
<tr>
<th>Objective</th>
<th>Who</th>
<th>Tools</th>
<th>How</th>
</tr>
</thead>
<tbody>
<tr>
<td>Food Chain Pilot</td>
<td>Evaluation: AUEB-RC Validation: Synelixis Joint Analysis: AUEB-RC</td>
<td>Evaluation: Tools in Table 2 Validation: Tools in Section 4.1/4.2 and platform tools defined in WP5</td>
<td>Evaluation: Emulated scenarios Validation: Coverage of pilot requirements (defined in D5.2)</td>
</tr>
<tr>
<td>Energy Pilot (Estonia)</td>
<td>Evaluation: AUEB-RC Validation: Guardtime Joint Analysis: AUEB-RC</td>
<td>Evaluation: Tools in Table 2 Validation: Tools in Section 4.1/4.2 and platform tools defined in WP5</td>
<td>Evaluation: Emulated scenarios Validation: Coverage of pilot requirements (defined in D5.2)</td>
</tr>
<tr>
<td>Energy Pilot (Italy)</td>
<td>Evaluation: AALTO Validation: ENGINEERING Joint Analysis: AUEB-RC</td>
<td>Evaluation: Tools in Table 2 Validation: Tools in Section 4.1/4.2 and platform tools defined in WP5</td>
<td>Evaluation: Emulated scenarios Validation: Coverage of pilot requirements (defined in D5.2)</td>
</tr>
<tr>
<td>Mobile Gaming Pilot</td>
<td>Evaluation: AUEB-RC Validation: Rovio Joint Analysis: AUEB-RC</td>
<td>Evaluation: Tools in Table 2 Validation: Tools in Section 4.1/4.2 and platform tools defined in WP5</td>
<td>Evaluation: Emulated scenarios Validation: Coverage of pilot requirements (defined in D5.2)</td>
</tr>
<tr>
<td>IoT Resource Access</td>
<td>AUEB-RC</td>
<td>Evaluation: Tools in Table 2 Validation: Tools and platform described in D4.3</td>
<td>Evaluation: Emulated scenarios Validation: Coverage of requirements (defined in D2.4)</td>
</tr>
</tbody>
</table>
### Framework Components
<table>
<thead>
<tr>
<th>Partners responsible for each Framework Component</th>
<th>Evaluation: Tools in Table 2 Validation: Tools identified in Sections 4.1/4.2</th>
<th>Evaluation: Emulated scenarios Validation: Coverage of requirements (defined in D2.4)</th>
</tr>
</thead>
</table>
### Architecture
<table>
<thead>
<tr>
<th>AUEB-RC + AALTO</th>
<th>Validation with tables/charts</th>
<th>Evaluation: Identifying feature fulfillment at the architecture level. Architecture KPIs initially defined in D2.2. Will be further specified in D4.3</th>
</tr>
</thead>
</table>
### KPIs
<table>
<thead>
<tr>
<th>Responsible partners identified above for each pilot and Framework Component</th>
<th>Evaluation: Tools in Table 2 Validation: Tools and platform described in D4.3 and D5.2</th>
<th>Initially identified in D2.2. Will be extended with the addition of system performance KPIs and pilot specific KPIs in D4.3</th>
</tr>
</thead>
</table>
## 5.1 Validation plan and process
The validation plan considers three levels of validation:
- **Component validation**: The correct behavior of the component is tested with Unit Tests and the correct implementation of the component is tested with functional tests.
- **Component integration validation**: The interfaces and the interoperability of the components are tested with integration tests.
- **Pilot validation**: The pilot components are tested with unit tests to check the correct behavior of the components, with functional tests to check their correct implementation and with integration tests to check the interfaces and the interoperability of the implemented components. In addition, the pilot involves a period of trial usage with the customer.
The work packages involved in the validation are WP2, WP3, WP4 and WP5. WP2 provides the unit tests, functional tests and integration tests for the component validation and component integration validation. WP4 validates the tests against the requirements of each component. WP3 implements these tests in the CI/CD environment. WP5 is responsible for providing the tests for the pilot validation, WP4 validates the tests and WP3 integrates them in the CI/CD environment. The validation process for the components and for the pilot is similar. The main differences are the responsible entities (WP5 for the pilot validation, WP2 for the component validation) and the pilot trial usage with the customer:
1. WP2/WP5 create unit tests, functional tests and integration tests for their component/pilot.
2. WP4 validates the tests against the requirement of the proper component/pilot
a. For functional tests and integration tests, WP4 creates a matrix where the test matches the requirements they have to satisfy.
3. WP3 integrates these tests in the CI/CD environment
4. When a component/pilot receive an update, the tests are automatically performed every time and the system is verified
5.2 Testbed tool functionality and usage
The following table summarizes the planned usage of the test tools discussed in Section 4.3.
<table>
<thead>
<tr>
<th>Tool</th>
<th>Functionality</th>
<th>Planned usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>Remix IDE</td>
<td>Used for developing smart contracts</td>
<td>Already used as the main tool for developing smart contracts.</td>
</tr>
<tr>
<td>MetaMask</td>
<td>Acts as a browser-based Ethereum wallet</td>
<td>Already used as the main tool for interacting with smart contracts deployed to the testbed, as well as to public Ethereum testnets.</td>
</tr>
<tr>
<td>Ethereum Network Stats</td>
<td>Monitors the status of an Ethereum network</td>
<td>Used for debugging network issues of the testbed.</td>
</tr>
<tr>
<td>BlockScout</td>
<td>Used for inspecting transactions.</td>
<td>Provides similar functionality with Etherscan, hence is not currently planned to be used in the evaluation activities. Its usage could be considered if it provides additional</td>
</tr>
<tr>
<td>Tool</td>
<td>Function Description</td>
<td>Status/Usage</td>
</tr>
<tr>
<td>----------------------</td>
<td>--------------------------------------------------------------------------------------</td>
<td>------------------------------------------------------------------------------</td>
</tr>
<tr>
<td>Etherscan</td>
<td>Used for inspecting transactions.</td>
<td>Already used for debugging purposes</td>
</tr>
<tr>
<td>Solium</td>
<td>Smart contract security analyzer.</td>
<td>Will be used for analyzing security sensitive smart contracts.</td>
</tr>
<tr>
<td>OpenZepellin</td>
<td>Provides an SDK for developing smart contracts, smart contracts that provide support for custom tokens (ERC20, ERC721, and ERC777), and smart contract that provide other auxiliary functionality.</td>
<td>Will be used for the development and evaluation of the marketplace component.</td>
</tr>
<tr>
<td>Peach fuzzing tool</td>
<td>Used for pen-testing applications and APIs by providing fuzzy input.</td>
<td>Will be used for security testing of the Framework Component APIs</td>
</tr>
<tr>
<td>Hyperledger Explorer</td>
<td>Acts as a feature-rich blockchain explorer for Hyperledger Fabric</td>
<td>Used for monitoring the Fabric testbed.</td>
</tr>
<tr>
<td>Hyperledger network visualization</td>
<td>Visually represents a Hyperledger Fabric network</td>
<td>Used for monitoring the Fabric testbed.</td>
</tr>
<tr>
<td>Hyperledger Caliper</td>
<td>Used for benchmarking Hyperledger fabric transactions</td>
<td>Used for evaluating functionality deployed on Hyperledger Fabric.</td>
</tr>
<tr>
<td>Hyperledger Cello</td>
<td>Enables developers to manage the full lifecycle of a blockchain and it enables Blockchain as a Service</td>
<td>The tool is currently not sufficiently mature. Its usage will depend on its future level of maturity. Moreover, SOFIE's testbed provides similar functionality (Blockchain as a service)</td>
</tr>
<tr>
<td>Hyperledger Composer</td>
<td>Enables the visual creation of entities within Hyperledger Fabric.</td>
<td>Used for testing and validating Fabric chaincode.</td>
</tr>
<tr>
<td>Tineola</td>
<td>Penetration testing tool for Hyperledger Fabric</td>
<td>Will be used for validating the security of SOFIE functionality built on Hyperledger Fabric</td>
</tr>
<tr>
<td>Project Things</td>
<td>Web of Things gateway</td>
<td>Included in the SOFIE testbed. It is used for validation purposes.</td>
</tr>
</tbody>
</table>
6. Conclusions
The main objective of WP4 is the validation and qualitative and quantitative evaluation of the SOFIE architecture and framework. The results of the validation and evaluation work and the recommendations generated will be fed to the architecture and framework design in WP2 and the business integration in WP3. This feedback will be performed in two planned cycles, which will result in an initial (first) and second report with validation and evaluation results and recommendations for the corresponding SOFIE architecture and framework cycles.
The work in WP4 involves two distinct directions: validation and evaluation.
Validation will focus on checking whether the SOFIE platform meets the requirements of the stakeholders that use the platform. Validation is distinct from verification (verifying that the platform meets design specifications) and from the integration and interoperability testing, which is the focus of WP3.
Evaluation will focus on assessing and measuring the performance of the SOFIE platform, based on the KPIs and assessment criteria defined in WP2, but also more general metrics and goals. The evaluation will include both a quantitative and a qualitative component.
Quantitative evaluation will focus on aspects such as response time, throughput, resource utilization, scalability, and availability. Some of these metrics can be assessed through measurements from testbed experiments with implementations of the SOFIE framework while others, such as scalability and availability, will be assessed using analytical models and tools.
Qualitative evaluation will focus on architectural aspects, such as the security and privacy features of the overall architecture and of a subset of the platform components, the ability to integrate different IoT platforms and provide services across domains, and the ability to support innovative applications.
Although validation and evaluation have different objectives, the same platforms will be used for both validation and evaluation. Many different relevant tools for the validation and evaluation processes have been selected and briefly described in this deliverable. The extent to which they will actually be useful and impactful for specific results and recommendations remains to be seen based on the actual attempts to apply them.
7. References
|
{"Source-Url": "https://media.voog.com/0000/0042/0957/files/SOFIE_D4.1-Validation_and_Evaluation_Plan-v1.10.pdf", "len_cl100k_base": 13030, "olmocr-version": "0.1.50", "pdf-total-pages": 26, "total-fallback-pages": 0, "total-input-tokens": 67668, "total-output-tokens": 14557, "length": "2e13", "weborganizer": {"__label__adult": 0.0004534721374511719, "__label__art_design": 0.0008139610290527344, "__label__crime_law": 0.00031447410583496094, "__label__education_jobs": 0.0009975433349609375, "__label__entertainment": 0.00021696090698242188, "__label__fashion_beauty": 0.00022017955780029297, "__label__finance_business": 0.0017337799072265625, "__label__food_dining": 0.00040340423583984375, "__label__games": 0.0014734268188476562, "__label__hardware": 0.00312042236328125, "__label__health": 0.0003952980041503906, "__label__history": 0.000774383544921875, "__label__home_hobbies": 0.00023734569549560547, "__label__industrial": 0.0009870529174804688, "__label__literature": 0.00044608116149902344, "__label__politics": 0.0004184246063232422, "__label__religion": 0.0005383491516113281, "__label__science_tech": 0.2086181640625, "__label__social_life": 0.00014352798461914062, "__label__software": 0.02203369140625, "__label__software_dev": 0.75390625, "__label__sports_fitness": 0.0003905296325683594, "__label__transportation": 0.0009393692016601562, "__label__travel": 0.00034046173095703125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 68131, 0.03039]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 68131, 0.30712]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 68131, 0.85985]], "google_gemma-3-12b-it_contains_pii": [[0, 1529, false], [1529, 2106, null], [2106, 7431, null], [7431, 7915, null], [7915, 8250, null], [8250, 11359, null], [11359, 15110, null], [15110, 19010, null], [19010, 22995, null], [22995, 24154, null], [24154, 26945, null], [26945, 30223, null], [30223, 33243, null], [33243, 36687, null], [36687, 38942, null], [38942, 41871, null], [41871, 44389, null], [44389, 47445, null], [47445, 50587, null], [50587, 54250, null], [54250, 56819, null], [56819, 60142, null], [60142, 61347, null], [61347, 64099, null], [64099, 66426, null], [66426, 68131, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1529, true], [1529, 2106, null], [2106, 7431, null], [7431, 7915, null], [7915, 8250, null], [8250, 11359, null], [11359, 15110, null], [15110, 19010, null], [19010, 22995, null], [22995, 24154, null], [24154, 26945, null], [26945, 30223, null], [30223, 33243, null], [33243, 36687, null], [36687, 38942, null], [38942, 41871, null], [41871, 44389, null], [44389, 47445, null], [47445, 50587, null], [50587, 54250, null], [54250, 56819, null], [56819, 60142, null], [60142, 61347, null], [61347, 64099, null], [64099, 66426, null], [66426, 68131, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 68131, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 68131, null]], "pdf_page_numbers": [[0, 1529, 1], [1529, 2106, 2], [2106, 7431, 3], [7431, 7915, 4], [7915, 8250, 5], [8250, 11359, 6], [11359, 15110, 7], [15110, 19010, 8], [19010, 22995, 9], [22995, 24154, 10], [24154, 26945, 11], [26945, 30223, 12], [30223, 33243, 13], [33243, 36687, 14], [36687, 38942, 15], [38942, 41871, 16], [41871, 44389, 17], [44389, 47445, 18], [47445, 50587, 19], [50587, 54250, 20], [54250, 56819, 21], [56819, 60142, 22], [60142, 61347, 23], [61347, 64099, 24], [64099, 66426, 25], [66426, 68131, 26]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 68131, 0.1276]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
d8a9e4e324235175dd6a4e55af9f00250a2be0d5
|
Optimizing Service Placement for Microservice Architecture in Clouds
Hu, Y.; de Laat, C.; Zhao, Z.
DOI
10.3390/app9214663
Publication date
2019
Document Version
Final published version
Published in
Applied Sciences
License
CC BY
Citation for published version (APA):
https://doi.org/10.3390/app9214663
Abstract: As microservice architecture is becoming more popular than ever, developers intend to transform traditional monolithic applications into service-based applications (composed by a number of services). To deploy a service-based application in clouds, besides the resource demands of each service, the traffic demands between collaborative services are crucial for the overall performance. Poor handling of the traffic demands can result in severe performance degradation, such as high response time and jitter. However, current cluster schedulers fail to place services at the best possible machine, since they only consider the resource constraints but ignore the traffic demands between services. To address this problem, we propose a new approach to optimize the placement of service-based applications in clouds. The approach first partitions the application into several parts while keeping overall traffic between different parts to a minimum and then carefully packs the different parts into machines with respect to their resource demands and traffic demands. We implement a prototype scheduler and evaluate it with extensive experiments on testbed clusters. The results show that our approach outperforms existing container cluster schedulers and representative heuristics, leading to much less overall inter-machine traffic.
Keywords: service placement; cluster scheduling; network optimization; resource management; microservice architecture; cloud computing
1. Introduction
Microservice architecture is a new trend rising fast for application development, as it enhances flexibility to incorporate different technologies, it reduces complexity by using lightweight and modular services, and it improves overall scalability and resilience of the system. In the definition (Microservices: https://martinfowler.com/tags/microservices.html), the microservice architectural style is an approach to develop a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms (e.g., HTTP resource API). The application then is composed of a number of services (service-based application) that work cohesively to provide complex functionalities. Due to the advantages of microservices architecture, many developers intend to transform traditional monolithic applications into service-based applications. For instance, an online shopping application could be basically divided into product service, cart service, and order service, which can greatly improve the productivity, agility, and resilience of the application. However, it also brings challenges. When deploying a service-based application in clouds, the scheduler has to carefully schedule each service, which may have diverse resource demands, on distributed compute clusters. Furthermore, the network communication between different services needs to be handled well, as the communication conditions significantly influence the quality of service (e.g., the response time of
a service). Ensuring the desired performance of service-based applications, especially the network performance between the involved services, becomes increasingly important.
In general, service-based applications involve numerous distributed and complex services which usually require more computing resources beyond single machine capability. Therefore, a cluster of networked machines or cloud computing platforms (e.g., Amazon EC2 (Amazon EC2: https://aws.amazon.com), Microsoft Azure (Microsoft Azure: https://azure.microsoft.com), or Google Cloud Platform (Google Cloud Platform: https://cloud.google.com)) are generally leveraged to run service-based applications. More importantly, containers are emerging as the disruptive technology for effectively encapsulating runtime contexts of software components and services, which significantly improves portability and efficiency of deploying applications in clouds. When deploying a service-based application in clouds, several essential aspects have to be taken into account. First, services involved in the application often have diverse resource demands, such as CPU, memory and disk. The underlying machine has to ensure sufficient resources to run each service and at the same time provide cohesive functionalities. Efficient resource allocation to each service is difficult, while it becomes more challenging when the cluster consists of heterogeneous machines. Second, services involved in the application often have traffic demands among them due to data communication, which require meticulous treatment. Poor handling of the traffic demands can result in severe performance degradation, as the response time of a service is directly affected by its traffic situation. Considering the traffic demands, an intuitive solution is to place the services that have large traffic demands among them on the same machine, which can achieve intra-machine communication and reduce inter-machine traffic. However, such services cannot all be co-located on one machine due to limited resource capacities. Hence, placement of service-based applications is quite complicated in clouds. In order to achieve a desired performance of a service-based application, cluster schedulers have to carefully place each service of the application with respect to the resource demands and traffic demands.
Recent cluster scheduling methods mainly focus on the cluster resource efficiency or job completion time of batch workloads [1–3]. For instance, Tetris [4], a multi-resource cluster scheduler, adapts heuristics for the multi-dimensional bin packing problem to efficiently pack tasks on multi-resource cluster. Firmament [5], a centralized cluster scheduler, can make high-quality placement decisions on large-scale clusters via a min-cost max-flow optimization. Unfortunately, these solutions would face difficulties for handling service-based applications, as they ignore the traffic demands when making placement decisions. Some other research works [6,7] concentrate on composite Software as a service (SaaS) placement problem, which try to minimize the total execution time for composite SaaS. However, they only focus on a set of predefined service components for the application placement. For traffic-aware scheduling, relevant research solutions [8,9] are proposed to handle virtual machine (VM) placement problem, which aims to optimize network resource usage over the cluster. However, these solutions rely on a certain network topology, while most of existing cluster schedulers are agnostic to network topology. In particular, it is hard to get the network topology information when deploying a service-based application on a virtual infrastructure.
In this paper, we propose a new approach to optimizing the placement of service-based applications in clouds. The objective is to minimize the inter-machine traffic while satisfying multi-resource demands for service-based applications. Our approach involves two key steps: (1) The requested application is partitioned into several parts while keeping overall traffic between different parts to a minimum. (2) The parts in the partition are packed into machines with multi-resource constraints. Typically, the partition can be abstracted as a minimum k-cut problem; the packing can be abstracted as a multi-dimensional bin packing problem. However, both are NP-hard problems [10,11]. To address these problems, we first propose two partition algorithms: Binary Partition and K Partition, which are based on a well designed randomized contraction algorithm [12], for finding a high quality application partition. Then, we propose a packing algorithm, which adopts an effective packing heuristic with traffic awareness, for efficiently packing each part of an application partition into machines. Finally, we combine the partition and packing algorithm with a resource demand threshold
to find an appropriate placement solution. We implement a prototype scheduler based on our proposed algorithms and evaluate it on testbed clusters. The results show that our scheduler outperforms existing container cluster schedulers and representative heuristics, leading to much less overall inter-machine traffic.
2. Problem Formulation
In this section, we formulate the placement problem of service-based application, and introduce the objective of this work. The notation used in the work is presented in Table 1.
<table>
<thead>
<tr>
<th>Notation</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>$\mathcal{M}$</td>
<td>Set of heterogeneous machines in the cluster: $\mathcal{M} = {m_1, m_2, ..., m_M}$</td>
</tr>
<tr>
<td>$M$</td>
<td>Number of the machines: $M =</td>
</tr>
<tr>
<td>$\mathcal{R}$</td>
<td>Set of resource types: $\mathcal{R} = {r_1, r_2, ..., r_R}$</td>
</tr>
<tr>
<td>$R$</td>
<td>Number of the resource types: $R =</td>
</tr>
<tr>
<td>$V_i$</td>
<td>Vector of available resources on machine $m_i$: $V_i = (v_{i1}, v_{i2}, ..., v_{iR})$</td>
</tr>
<tr>
<td>$v_{ij}$</td>
<td>Amount of resource $r_j$ available on machine $m_i$</td>
</tr>
<tr>
<td>$\mathcal{S}$</td>
<td>A service-based application which is composed by a set of services: $\mathcal{S} = {s_1, s_2, ..., s_N}$</td>
</tr>
<tr>
<td>$N$</td>
<td>Number of services in the application: $N =</td>
</tr>
<tr>
<td>$D_i$</td>
<td>Vector of resource demands of service $s_i$: $D_i = (d_{i1}, d_{i2}, ..., d_{iR})$</td>
</tr>
<tr>
<td>$d_{ij}$</td>
<td>Amount of resource $r_j$ that service $s_i$ demands</td>
</tr>
<tr>
<td>$T$</td>
<td>Matrix of communication traffic between services: $T = [t_{ij}]_{N \times N}$</td>
</tr>
<tr>
<td>$t_{ij}$</td>
<td>Traffic rate from service $s_i$ to service $s_j$</td>
</tr>
<tr>
<td>$X$</td>
<td>A placement solution: $X = [x_{ij}]<em>{N \times M}$, where $x</em>{ij} = 1$ if service $s_i$ is to be placed on machine $m_j$, otherwise $x_{ij} = 0$.</td>
</tr>
</tbody>
</table>
2.1. Model Description
We consider a cloud computer cluster is composed of a set of heterogeneous machines $\mathcal{M} = \{m_1, m_2, ..., m_M\}$, where $M = |\mathcal{M}|$ is the number of machines. We consider $R$ types of resources $\mathcal{R} = \{r_1, r_2, ..., r_R\}$ (e.g., CPU, memory, disk, etc.) in each machine. For machine $m_i$, let $V_i = (v_{i1}, v_{i2}, ..., v_{iR})$ be the vector of its available resources, where the element $v_{ij}$ denotes the amount of resource $r_j$ available on machine $m_j$.
In infrastructure as a service (IaaS) model or container as a service (e.g., Amazon ECS) model, users would specify the resource demands of VMs or containers (e.g., a combination of CPU, memory, and storage) when submitting deployment requests. Thus, the resource demands are known upon the arrival of service requests. We consider a service-based application is composed of a set of services $\mathcal{S} = \{s_1, s_2, ..., s_N\}$ that are to be deployed on the cluster, and $N = |\mathcal{S}|$ is the number of services. For service $s_i$, let $D_i = (d_{i1}, d_{i2}, ..., d_{iR})$ be the vector of its resource demands, where the element $d_{ij}$ denotes the amount of resource $r_j$ that the service $s_i$ demands. Let matrix $T = [t_{ij}]_{N \times N}$ denote the traffic between services, where $t_{ij}$ denotes the traffic rate from service $s_i$ to service $s_j$.
We model a placement solution as a 0–1 matrix $X = [x_{ij}]_{N \times M}$. if service $s_i$ is to be deployed on machine $m_j$, it is $x_{ij} = 1$. Otherwise, it is $x_{ij} = 0$.
2.2. Objective
To achieve a desired performance of service-based applications, a scheduler should not only consider the multi-resource demands of services but also the traffic situation between services.
As services, especially data-intensive services, often need to transfer data frequently, the network performance would directly influence the overall performance. Considering the network dynamics, the placement of different services of an application is crucial for maintaining the overall performance, particularly when unexpected network latency or congestion occurs in the cluster. Given the traffic situation, the most intuitive solution is to place the services that have high traffic rate among them on the same machine so that the co-located services can leverage the loopback interface to get a high network performance without consuming actual network resources of the cluster. However, such services cannot all be co-located on one machine due to limited resource capacities. Thus, with the resource constraints, we try to find a placement solution to minimize the overall traffic between services that are placed on different machines (inter-machine traffic) while satisfying multi-resource demands of services, so that the objective of this work can be formulated as:
\[
\text{Minimize} \quad \sum_{i=1}^{N} \sum_{p=1}^{M} \sum_{q=1}^{M} \sum_{q \neq p} I_{ij} \cdot x_{ip} \cdot x_{jq} \\
\text{Subject to:} \quad \sum_{j=1}^{M} x_{ij} = 1 \quad (\forall i \in \{1, 2, ..., N\}) \tag{1}
\]
\[
\sum_{i=1}^{N} x_{ij} \cdot d_{k}^{i} \leq v_{k}^{j} \quad (\forall j \in \{1, 2, ..., M\}, \forall k \in \{1, 2, ..., R\}) \tag{2}
\]
\[
x_{ij} \in \{0, 1\} \quad (\forall i \in \{1, 2, ..., N\}, \forall j \in \{1, 2, ..., M\}) \tag{3}
\]
Equation (2) guarantees that each service is placed on a machine. Equation (3) guarantees that resource demands on a machine do not exceed its resource capacities. Equation (1) expresses the goal of this work.
3. Minimum K-Cut Problem
As a service-based application typically cannot be placed on one machine, an effective partition of the set of services involved in the application is necessary during the deployment. After partition, each subset of the services should be able to be packed into a machine, which means the machine has sufficient resources to run all the services in the subset. Considering the traffic rate between different services, the quality of the partition is crucial for the application performance. To tackle this problem, we first discuss the minimum k-cut problem to understand the problem’s complexity.
Let \(G = (V, E)\) be an undirected graph, where \(V\) is the node set, and \(E\) is the edge set. In the graph, each edge \(e_{u,v} \in E\) has a non-negative weight \(w_{u,v}\). A k-cut in graph \(G\) is a set of edges, which when removed, partition the graph into \(k\) disjoint nonempty components \(G' = \{G_1, G_2, ..., G_k\}\). The minimum k-cut problem is to find a k-cut of minimum total weight of edges whose two ends are in different components, which can be computed as:
\[
\sum_{i=1}^{k-1} \sum_{j=i+1}^{k-1} \sum_{u \in G_i, v \in G_j} w_{u,v} \tag{4}
\]
A minimum cut is a simply minimum k-cut when \(k = 2\). Figure 1 shows an example of a minimum cut of a graph. There are 2 cuts shown in the figure, and the dash line is a minimum cut of the graph, as the total weight of edges cut by the dash line is the minimum of all cuts. Given a service-based application, we can represent it as a graph, where the nodes represent services and the weights of edges represent the traffic rate. Specifically, the traffic rate from service \(s_i\) to service \(s_j\) and the rate from service \(s_j\) to service \(s_i\) are represented as two edges respectively in the graph. Hence, finding a minimum k-cut of the graph is equivalent to partitioning the application into \(k\) parts while keeping
overall traffic between different parts to a minimum. However, for arbitrary $k$, the minimum $k$-cut problem is NP-hard [10].

Different from developing a deterministic algorithm, Karger’s algorithm [12] provides an efficient randomized approach to find a minimum cut of a graph. The basic idea of the Karger’s algorithm is to randomly choose an edge $e_{u,v}$ from the graph with probability proportional to the weight of edge $e_{u,v}$ and merge the node $u$ and node $v$ into one (called edge contraction). In order to find a minimum cut, the algorithm iteratively contracts the edge which are randomly chosen until two nodes remain. The edges that remain at last are then output by the algorithm. The pseudocode is shown in Algorithm 1.
**Algorithm 1: Contraction Algorithm ($k = 2$)**
```
Input: $G = (V, E)$
Output: A cut of $G$
while $|V| > 2$ do
choose an edge $e_{u,v}$ with probability proportional to its weight;
$G \leftarrow G/e_{u,v}$; // contract edge $e_{u,v}$
end
return the cut in $G$;
```
Figure 2 shows an example process of the contraction algorithm ($k = 2$). The algorithm iteratively merges two nodes of the chosen edge, and all other edges are reconnected to the merged node. For a graph $G = (V, E)$ with $n = |V|$ nodes and $m = |E|$ edges, Karger [12] argues that the contraction algorithm returns a minimum cut of the graph with probability $\Omega(1/n^2)$. Therefore, if we perform the contraction algorithm independently $n^2 \log n$ times, we can find a minimum cut with high probability; if we do not get a minimum cut, the probability is less than $\Omega(1/n)$. For minimum $k$-cut, the contraction algorithm is basically the same, except that it terminates when $k$ nodes remain (change $|V| > 2$ to $|V| > k$ in Algorithm 1) and returns all the edges left in the graph $G$. Similarly, the contraction algorithm returns a minimum $k$-cut of the graph with probability $\Omega(1/n^{2k-2})$. If we perform the algorithm independently $n^{2k-2} \log n$ times, we can obtain a minimum $k$-cut with high probability. Regarding the time complexity, the contraction algorithm can be implemented to run in strongly polynomial $O(m \log^2 n)$ time [12].
4. Placement Algorithm
In this section, we describe the algorithms we proposed in this work. The goal of our algorithms is to find a placement solution to minimize inter-machine traffic while satisfying multi-resource demands. The key design of our approach includes: (1) application partition based on contraction algorithms, (2) heuristic packing with traffic awareness, and (3) placement finding with threshold adjustment.
4.1. Application Partition
In order to make the values of different resources comparable to each other and easy to handle, we first normalize the amount of available resources on machines and the resources that services demands to be the fraction of the maximum ones. We define the term $v_{\text{max}-j}$ to be the maximum amount of available resources $r_j$ on a machine.
$$v_{\text{max}-j} = \max_{i \in \{1,2,\ldots,M\}} \left( v_i \right)$$ \hspace{1cm} (6)
Then the vector $V_i$ of available resources on machine $m_i$ and the vector $D_i$ of resource demands of service $s_i$ are normalized as:
$$V_i = (\frac{v_1^i}{v_{\text{max}-1}}, \frac{v_2^i}{v_{\text{max}-2}}, \ldots, \frac{v_R^i}{v_{\text{max}-R}})$$ \hspace{1cm} (7)
$$D_i = (\frac{d_1^i}{v_{\text{max}-1}}, \frac{d_2^i}{v_{\text{max}-2}}, \ldots, \frac{d_R^i}{v_{\text{max}-R}})$$ \hspace{1cm} (8)
After normalization, we start partitioning the service-based application. The key question we ask first is how many parts the application is partitioned into. Considering multi-resource demands of different services, we introduce a threshold $\alpha$ to determine the number of parts when performing partition algorithms. The threshold $\alpha$ denotes the upper bound of the resource demands of partitioned parts, which means we perform partition algorithms continuously until the total resource demands from each part do not exceed $\alpha$ or no part contains more than one service. With a threshold $\alpha \in [0, 1]$ (as the resource demands have been normalized), it assures that each part after partition can be packed into a machine. Figure 3 shows an example of an application partition with threshold $\alpha = 0.5$. In the figure, the total CPU demands and memory demands from each part do not exceed 0.5. Given a threshold $\alpha$, we propose two partition algorithms: binary partition and $k$ partition, which are based on the contraction algorithm.
4.1. Binary Partition
The idea of the binary partition algorithm is to continuously perform binary partition on the application until the resource demands from each part do not exceed a or no part contains more than one service. The pseudocode is shown in Algorithm 2. The basic process can be described as follows. The algorithm continuously checks the resource demands of each part in current application partition $P$. The initial partition is $P = \{S\}$ where the entire application is treated as one part. If the total resource demands of a part $S_i$ in $P$ exceeds the threshold $\alpha$ and part $S_i$ contains more than one service, the part is selected to be partitioned into 2 parts (binary partition). It first constructs a graph $G = (V, E)$ based on $S_i$, where the nodes represent services and the weights of edges represent the traffic rate. As mentioned in Section 3, if we repeatedly perform the contraction algorithm many times, we can obtain a minimum cut with high probability. Considering both the partition quality and the partition speed, we choose to perform the contraction algorithm $n$ times in our algorithm (in offline manner, it can be set to run $n \cdot 2 \log n$ times to get a minimum cut with high probability). Then, according to the minimum cut $G_{min}$, we get from the contraction algorithm, it partitions the $S_i$ into two parts $\{S_x, S_y\}$. This process would be repeatedly performed until the resource demands from each part do not exceed threshold $\alpha$ or no part contains more than one service.
4.1.2. K Partition
The idea of the k partition algorithm is to directly partition the application into k parts. By iteratively increasing $k$, it terminates when the resource demands from each part do not exceed a or no part contains more than one service. The pseudocode is shown in Algorithm 3. The basic process can be described as follows. The algorithm first constructs a graph $G = (V, E)$ based on the application $S$ and then continuously checks the resource demands of each part in current application partition $P$ where $P = \{S\}$ initially. If the total resource demands of a part $S_i$ in $P$ exceeds the threshold $\alpha$ and part $S_i$ contains more than one service, it increases $k$, which is the number of partitioned parts. As mentioned in Section 3, in order to obtain a minimum k-cut with high probability, we have to perform the contraction algorithm independently $n^{2k-2} \log n$ times. However, the time complexity increases exponentially with $k$, which is prohibitively high. Thus, we make the time complexity consistent with the binary partition algorithm by sacrificing some probability of finding a minimum k-cut. It also performs the contraction algorithm $n$ times. Then, according to the minimum k-cut $G_{min}$ we get from the contraction algorithm, it partitions the application into $k$ parts $P = \{S_1, S_2, ..., S_k\}$. Similarly, this process would be repeatedly performed until the resource demands from each part do not exceed threshold $\alpha$ or no part contains more than one service.
Algorithm 2: Binary Partition
**Input:** service-based application $S$, threshold $\alpha$
**Output:** a partition of the application $P = \{S_1, S_2, ..., S_{N'}\}$, $N'$ is number of parts after partition
1. $P \leftarrow \{S\}$;
2. while exists part $S_i$ in $P$ that the total resource demands exceed $\alpha$, and part $S_i$ contains more than one service do
3. $P \leftarrow P - \{S_i\}$;
4. Construct a graph $G = (V, E)$ based on $S_i$;
5. $n \leftarrow |V|$;
6. $G_{min} \leftarrow G$;
7. $t \leftarrow 0$;
8. repeat
9. Perform the contraction algorithm ($k = 2$) to get a cut $G'$;
10. $G_{min} \leftarrow \min(G_{min}, G')$; // Store the smaller cut in $G_{min}$
11. $t \leftarrow t + 1$;
12. until $t > n$;
13. Get a partition $\{S_x, S_y\}$ of part $S_i$ according to $G_{min}$;
14. $P \leftarrow P \cup \{S_x, S_y\}$;
end
15. return $P$;
Algorithm 3: K Partition
**Input:** service-based application $S$, threshold $\alpha$
**Output:** a partition of the application $P = \{S_1, S_2, ..., S_{N'}\}$, $N'$ is number of parts after partition
1. $P \leftarrow \{S\}$;
2. Construct a graph $G = (V, E)$ based on $S$;
3. $n \leftarrow |V|$;
4. $k \leftarrow 1$;
5. while exists part $S_i$ in $P$ that the total resource demands exceed $\alpha$ and part $S_i$ contains more than one service do
6. $G_{min} \leftarrow G$;
7. $k \leftarrow k + 1$;
8. $t \leftarrow 0$;
9. repeat
10. Perform the contraction algorithm until $k$ nodes remain to get a $k$-cut $G'$;
11. $G_{min} \leftarrow \min(G_{min}, G')$; // Store the smaller $k$-cut in $G_{min}$
12. $t \leftarrow t + 1$;
13. until $t > n$;
14. Get a partition $\{S_1, S_2, ..., S_k\}$ of the application $S$ according to $G_{min}$;
15. $P \leftarrow \{S_1, S_2, ..., S_k\}$;
end
16. return $P$;
### 4.2. Heuristic Packing
Given a partition of the application, the algorithm here is to pack each part into the heterogeneous machines. Without considering the traffic rate, the problem can be formulated as a classical...
multi-dimensional bin packing problem, which is known to be NP-hard [11]. When there are a large amount of services involved in the application, it is infeasible to find the optimal solution in polynomial time. Considering the time complexity and packing quality, we adopt two greedy heuristics in our packing algorithm: Traffic Awareness and Most-Loaded Heuristic. The algorithm is shown in Algorithm 4.
**Algorithm 4: Heuristic Packing**
- **Input:** partition of the application $P = \{S_1, S_2, ..., S_{N'}\}$, vectors of available resources on each machine $\{V_1, V_2, ..., V_M\}$
- **Output:** a placement solution $X$
1. Calculate vectors of resource demands of each part as: $\{D'_1, D'_2, ..., D'_{N'}\}$;
2. $X \leftarrow [x_{ij} = 0]_{N' \times M}$;
3. for $i \leftarrow 1; i \leq N'; i \leftarrow i + 1$ do
4. $tf \leftarrow 0; ml \leftarrow 0; y \leftarrow 0$;
5. for $j \leftarrow 1; j \leq M; j \leftarrow j + 1$ do
6. if part $S_i$ can be packed into machine $m_j$ then
7. $tf_j \leftarrow \sum t_{ui}$; /* Calculate the total traffic rates between part $S_i$ and machine $m_j$, for any service $s_u$ in $S_i$ and any service $s_u$ packed into machine $m_j$ before */
8. $ml_j \leftarrow \sum_{k=1}^{R} d^k_{ij}$; /* Calculate the load situation between the vector of resource demands from part $S_i$ and the vector of available resources on machine $m_j$ */
9. if $tf_j > tf$ then
10. $tf \leftarrow tf_j; ml \leftarrow ml_j; y \leftarrow j$;
11. end
12. else if $tf_j == tf$ and $ml_j > ml$ then
13. $tf \leftarrow tf_j; ml \leftarrow ml_j; y \leftarrow j$;
14. end
15. end
16. if $y == 0$ then
17. return null;
18. end
19. else
20. $V_y \leftarrow V_y - D'_i$;
21. $x_{iy} \leftarrow 1$;
22. end
23. end
24. return $X$;
In order to find a best possible machine for part $S_i$, the algorithm calculates two matching factors: $tf$ and $ml$. For machine $m_j$, the factor $tf$ is the sum of the traffic rate between the services in part $S_i$ and the services have been determined to be packed into machine $m_j$ before. The factor $ml$ is a scalar value of the load situation between the vector of resource demands from part $S_i$ and the vector of available resources on machine $m_j$. Assuming $D'_i$ is the resource demand vector of part $S_i$ and $d^k_{ij}$ is
the amount of resource \( r_k \) part \( S_i \) demands, it is \( ml = \sum_{k=1}^{R} \frac{d'_k}{v_k} \). The higher \( ml \) is, the more loaded the machine. The idea of this heuristic is to improve the resource efficiency by packing the part to the most loaded machine. As our main goal is to minimize the inter-machine traffic, the algorithm is designed to first prioritize the machines based on the factors of \( tf \). If the factors of \( tf \) are the same, it then prioritizes the machines based on the factors of \( ml \). Consequently, if all parts in the partition can be packed into machines, the algorithm returns the placement solution. Otherwise, it returns \textit{null}.
4.3. Placement Finding
As we discussed before, in order to partition the application, the threshold \( \alpha \) is required by the algorithm. However, giving an appropriate deterministic threshold \( \alpha \) is difficult, as it cannot guarantee that the algorithm can find a placement solution through the randomized partition and the heuristic packing under a certain threshold \( \alpha \). Intuitively, the higher threshold \( \alpha \) results in less parts in the partition, which leads to less traffic rate between different parts. Thus, we introduce a simple algorithm to find a better threshold \( \alpha \) by enumerating from large to small. The algorithm is shown in Algorithm 5.
At the beginning, the value of \( \alpha \) is 1.0. To adjust the thresholds, we set a step value \( \Delta \), and the default value is 0.1, which can be customized by users. In each iteration, with the threshold \( \alpha \), the algorithm first partitions the given application \( S \) based on the binary partition algorithm or \( k \) partition algorithm. Note that the algorithm records the latest partition results to avoid multiple repeated partition. It then tries to pack all parts in the partition into machines based on the heuristic packing algorithm to find a placement solution for the application.
**Algorithm 5: Placement Finding**
<p>| Input: service-based application ( S ), vectors of available resources on each machine ( {V_1, V_2, ..., V_M} ) |</p>
<table>
<thead>
<tr>
<th>Output: a placement solution ( X )</th>
</tr>
</thead>
<tbody>
<tr>
<td>1 ( X \leftarrow [x_{ij} = 0]_{N \times M}; )</td>
</tr>
<tr>
<td>2 ( \alpha \leftarrow 1.0; )</td>
</tr>
<tr>
<td>3 ( \Delta \leftarrow 0.1; )</td>
</tr>
<tr>
<td>4 \textbf{while} ( \alpha \geq 0.0 ) \textbf{do}</td>
</tr>
<tr>
<td>5 ( P \leftarrow \text{Binary_Partition}(S, \alpha); )</td>
</tr>
<tr>
<td>( /* \text{Or } P \leftarrow \text{K_Partition}(S, \alpha); */ )</td>
</tr>
<tr>
<td>6 ( X' \leftarrow \text{Heuristic_Packing}(P, {V_1, V_2, ..., V_M}); )</td>
</tr>
<tr>
<td>7 \textbf{if} ( X' \neq \text{null} ) \textbf{then}</td>
</tr>
<tr>
<td>8 ( \text{Calculate } X \text{ according to } X' \text{ and } P; )</td>
</tr>
<tr>
<td>9 ( \text{return } X; )</td>
</tr>
<tr>
<td>10 \textbf{end}</td>
</tr>
<tr>
<td>11 ( \alpha \leftarrow \alpha - \Delta; )</td>
</tr>
<tr>
<td>12 \textbf{end}</td>
</tr>
<tr>
<td>13 \textbf{return} \text{null};</td>
</tr>
</tbody>
</table>
Next, we discuss the time complexity of the algorithm we proposed. We assume the number of services is \( n \); the number of edges in the service graph is \( m \) (i.e., the number of the traffic rates \( t_{ij} > 0 \)); the number of machines is \( M \). For a service-based application, it can be partitioned up to \( n \) parts. For each partition, we perform the contraction algorithm \( n \) times, and the time complexity of the contraction algorithm is \( O(m \log^2 n) \). As we record the latest partition results to avoid multiple repeated partition, the time complexity of the overall partition is \( O(n^2 m \log^2 n) \). To the heuristic packing, the time complexity is \( O(nM + n^2) \) as the overall time complexity of calculating the factor \( tf \) is \( O(n^2) \). Let \( C = \frac{1}{2} \) denote the number of iterations. The overall time complexity of the proposed algorithm is \( (n^2 m \log^2 n + CnM + Cn^2) \).
5. Evaluation
We implement a prototype scheduler using python, which is based on our proposed algorithms, for deploying service-based applications on container clusters. In the experiments, we evaluate our scheduler in testbed clusters of ExoGENI [13] experimental environment.
5.1. Experimental Methodology
Cluster. We create two different testbed clusters in ExoGENI for experiments. For the first cluster, we use 30 homogeneous VMs with 2 CPU cores and 6 GB RAM. Considering the heterogeneity, we use 10 VMs with 2 CPU cores and 6 GB RAM and 10 VMs with 4 CPU cores and 12 GB RAM for the second cluster. The homogeneous cluster has 30 VMs, and the heterogeneous cluster has 20 VMs, but the total resource capacity is the same.
Workloads. In order to evaluate the proposed algorithms in different scenarios, we use synthetic applications in the experiments. Considering the scale of the testbed cluster, we yield service-based applications which are composed by 64, 96, and 128 services. For the size of 64, the CPU demand of each service is uniformly picked at random from [30,100] where 100 represents 1 CPU core, and the memory demand is picked at random from [100,300] where 100 represents 1 GB RAM. For the size of 96, the CPU demand is picked at random from [20,67], and the memory demand is picked at random from [67,200]. For the size of 128, the CPU demand is picked at random from [15,50], and the memory demand is picked at random from [50,150]. According to these ranges, the total resource demands of different application sizes are roughly the same. For each application size, we generate 10,000 instances for testing. As the work [14] shows that the log-normal distribution produces the best fit to the data center traffic, we choose to generate the traffic demands between services with the probability 0.05 (ensure that application graph is connected), and the traffic rate follows a log-normal distribution (mean = 5 Mbps, standard deviation = 1 Mbps).
Implementation. We implement all proposed algorithms in our prototype scheduler, where the contraction algorithm is based on the parallel implementation [12]. As we proposed two algorithms for application partition, there are two kinds of configuration. BP-HP is based on binary partition (BP) and heuristic packing (HP). KP-HP is based on k partition (KP) and heuristic packing.
Baselines. As we mentioned above, many research efforts have been devoted to the composite Software as a service (SaaS) placement problem [6,15]. However, they target at the placement for a certain set of predefined service components. More importantly, these metaheuristic based approaches often take minutes or even hours, particularly for large-scale clusters, to generate a placement solution, which would face difficulties for an online response. Another research work focuses on traffic-aware VM placement problem [16,17]. However, these solutions rely on a certain network topology, while our approach is agnostic to network topology. Thus, we choose to compare our scheduler with the following schemes:
- Kubernetes Scheduler (KS): the default scheduler in Kubernetes [18] container cluster tends to distribute containers evenly across the cluster to balance the overall cluster resource usage. Specifically, we add a soft affinity (i.e., pod affinity in Kubernetes) to the services that have traffic between them, as the scheduler would try to place the services which have affinity between them on the same machine.
- First-Fit Decreasing (FFD): it is a simple and commonly adopted algorithm for the multi-dimensional bin packing problem [19]. FFD operates by first sorting the services in decreasing order according to a certain resource demand and then packs each service into the first machine with sufficient resources.
- Best-Fit Decreasing (BFD): it places a service in the fullest machine that still has enough capacity. BFD operates by first sorting the machines in decreasing order according to a certain resource capacity and then packs each service into the first machine with sufficient resources.
- Multi-resource Packer (PACK): the idea of this heuristic [4] is that it schedules the services in increasing order of alignment between resource demands of services and resource availability of
machines (i.e., dot product between the vector of resource demands and the vector of available resources).
- Random (RAND): it randomly picks a service in the application and then packs it into the first machine with sufficient resources.
5.2. Comparison with Baselines
Figure 4 shows the successful placement ratio of different schemes over two clusters. The successful placement of an application is that the algorithm can find a placement solution to place all the involved services, so the ratio is the number of successfully placed applications to the number of all requested applications. We observe that RAND performs worst, as it has no heuristic to pack the services. FFD and BFD perform better than KS and PACK because KS mainly focuses on balancing the resource utilization over the cluster, and PACK focuses on the alignment between resource demands and resource availability. FFD and BFD have been demonstrated as effective algorithms for multi-dimensional bin packing problems [20]. BP-HP performs comparably to KP-HP, and they both slightly outperform other schemes in this evaluation. This is mainly because the iterative partition and packing with different thresholds improve the probability of finding a placement solution. Moreover, the packing algorithm can pack services tightly due to the most-loaded heuristic. The results of the homogeneous cluster also show that the successful placement ratio increases when the number of services increases. As the total resource demands of the applications in different sizes (different number of services) are roughly the same, the less number of services results in larger resource demands of each individual service, which easily causes the resource fragmentation problem in the placement. Compared to the homogeneous cluster, the successful placement ratio is much higher in the heterogeneous cluster. As the machines have larger resource capacity in the heterogeneous cluster, it is easier to pack services constrained by multiple resources.

Next, we evaluate the traffic situation of different schemes. In the evaluation, we only compare the applications whose all services are placed on the cluster by different algorithms. Figure 5 shows the average co-located traffic ratio of different schemes, and the error bars represent the maximum and minimum ratio. The co-located traffic is the traffic between the services that are placed on the same machine, so the ratio is the amount of co-located traffic to the amount of all traffic. For minimizing inter-machine traffic, the higher the co-located traffic ratio is, the better the placement solution is. To be specific, we present the co-located traffic ratio in Table 2. We observe that BP-HP and KP-HP significantly outperform the baselines. For the cluster with homogeneous machines, BP-HP improves average co-located traffic ratio by 24.8% to 38.1%; KP-HP improves the ratio by 22% to 35.3%. For the cluster with heterogeneous machines, BP-HP improves average co-located traffic ratio by 24.7% to 39.6%; KP-HP improves the ratio by 23.4% to 38.3%. FFD, BFD, PACK, and RAND perform poorly as they only focus on packing the services, without considering the traffic rate. As we set the affinity to the
services that have traffic between them in KS, KS tries to put the affinity services on the same machine. However, KS ignores the concrete traffic rate when making placement decisions. Regarding BP-HP and KP-HP, we find that BP-HP performs slightly better and more stable than KP-HP, but KP-HP may find a better solution in some cases (according to the error bars). In contrast, KP-HP also easily returns a worse solution. This is mainly because BP-HP performs the contraction algorithm to find a minimum cut with probability \( \Omega \left( \frac{1}{n^2} \right) \); KP-HP performs the contraction algorithm to find a minimum k-cut with probability \( \Omega \left( \frac{1}{n^{2k-2}} \right) \) which is much less than the BP-HP. Thus, the performance of KP-HP varies widely in the experiments. Nevertheless, benefiting from the partition that strives to co-locate the large traffic demands and the traffic-aware packing, BP-HP and KP-HP both can effectively reduce inter-machine traffic for deploying service-based applications on computer clusters.

**Figure 5.** Comparison of average co-located traffic ratio of different schemes.
**Table 2.** Co-located traffic ratio (%) of different schemes.
<table>
<thead>
<tr>
<th>Scheme</th>
<th>Homogeneous Cluster</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Heterogeneous Cluster</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>BP-HP</td>
<td>52.1</td>
<td>35.2</td>
<td>56.9</td>
<td>50.3</td>
<td>37.9</td>
<td>60.5</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>KP-HP</td>
<td>45.3</td>
<td>30.8</td>
<td>59.1</td>
<td>49.0</td>
<td>35.2</td>
<td>61.1</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>KS</td>
<td>23.3</td>
<td>17.1</td>
<td>31.4</td>
<td>25.6</td>
<td>20.4</td>
<td>32.8</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>FFD</td>
<td>10.0</td>
<td>6.5</td>
<td>15.8</td>
<td>10.9</td>
<td>6.2</td>
<td>17.1</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>BFD</td>
<td>10.9</td>
<td>6.4</td>
<td>17.2</td>
<td>11.1</td>
<td>7.3</td>
<td>16.6</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>PACK</td>
<td>10.5</td>
<td>6.1</td>
<td>16.3</td>
<td>10.7</td>
<td>6.1</td>
<td>16.5</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>RAND</td>
<td>10.6</td>
<td>6.2</td>
<td>16.7</td>
<td>11.0</td>
<td>6.8</td>
<td>16.8</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
5.3. Impact of Threshold \( \alpha \)
In this section, we discuss the impact of threshold \( \alpha \) on the service-based application placement. To illustrate, we fix the threshold \( \alpha \) by using BP-HP on the cluster with homogeneous machines. Figure 6 shows the successful placement ratio with different values of threshold \( \alpha \). For instance, BP-HP can find a placement solution for 77% of the applications with 64 services when \( \alpha = 0.5 \). We observe that the successful placement ratio decreases when the value of threshold \( \alpha \) increases in general, and few applications can be successfully placed when \( \alpha > 0.7 \). Higher threshold \( \alpha \) leads to less parts and larger average resource demands of parts in the partition, so it becomes harder to pack them into machines with multi-resource constraints. To understand the impact on the network traffic, Figure 7 shows the results of average co-located traffic ratio for each value of threshold \( \alpha \), and the error bars represent the maximum and minimum ratio. It explicitly demonstrates that the co-located traffic ratio increases more when \( \alpha \) is larger. However, larger threshold \( \alpha \) increases the difficulty of packing the applications. Thus, we try to find an appropriate threshold \( \alpha \) by enumerating from large to small in the proposed algorithms.
5.4. Overhead Evaluation
In this section, we evaluate the overhead by measuring the algorithm runtime and compare it with KS and RAND. In order to fairly compare the algorithm runtime, we also implement the scheduling algorithm of KS in Python, which is the same with other schemes. We conduct this experiment on a dedicated server with Intel Xeon E5-2630 2.4 GHz CPU and 64 GB memory. Figure 8 shows the results of the average algorithm runtime of different schemes for the heterogeneous cluster (the homogeneous cluster is similar), and the error bars represent the maximum and minimum algorithm runtime. RAND incurs little overhead, as it is a very simple algorithm. Compared with RAND, KS is a bit complex, as KS has multiple predicated policies and priorities policies to filter and score machines, such as handling the affinity between services. BP-HP and KP-HP are more complicated than the baselines, and have obviously higher overhead. We also observe that the difference between the maximum and minimum algorithm runtime is quite large, as the algorithm runtime heavily depends on the value of threshold $\alpha$. In the algorithm, higher threshold $\alpha$ results in less iterations, and lower threshold $\alpha$ causes more iterations. Nevertheless, BP-HP and KP-HP can respond in seconds for different application sizes. Especially, for the application with less than 100 services, BP-HP and KP-HP can respond in sub-second time, which is acceptable for online scheduling. Moreover, the most time consuming part of the proposed algorithms is application partition, which means there would be no big difference of the algorithm runtime for large-scale clusters with the same number of services. We believe that the proposed algorithms can also effectively handle the placement problem on large-scale clusters.
Figure 8. Average algorithm runtime of different schemes for the heterogeneous cluster.
6. Related Work
As the microservice architecture is emerging as a primary architectural style choice in the service-oriented software industry [21], many research efforts have been devoted to the analysis and modeling of microservice architecture [22–24]. Leitner et al. [25] proposed a graph-based cost model for deploying microservice-based applications on a public cloud. Balalaie et al. [26] presented their experience and lessons on migrating a monolithic software architecture to microservices. Amaral et al. [27] evaluated the performance of microservices architectures using containers. However, the performance of service placement schemes received little attention in these works.
Software as a Service (SaaS) is one of the most important services offered by cloud providers, and many works have been proposed for optimizing composite SaaS placement in cloud environments [15]. Yusoh et al. [6] propose a genetic algorithm for the composite SaaS placement problem, which considers both the placement of the software components of a SaaS and the placement of data of the SaaS. It tries to minimize the total execution time of a composite SaaS. Hajji et al. [7] adopt a new variation of PSO called Particle Swarm Optimization with Composite Particle (PSO-CP) to solve the composite SaaS placement problem. It considers not only the total execution time of the composite SaaS but also the performance of the underlying machines. Unfortunately, they target at the placement for a certain set of predefined service components, which has limitations to handle a large number of different services. In addition, plenty of research has been proposed to optimize service placement in edge and fog computing [28,29]. Mennan et al. [30] proposed a service placement heuristic to maximize the bandwidth allocation when deploying community networks micro-clouds. It uses the information of network bandwidth and node availability to optimize service placement. Different from it, we consider the constraints of multiple resources rather than just network bandwidth to minimize the inter-machine traffic while satisfying multi-resource demands of service-based applications. Carlos et al. [31] presented a decentralized algorithm for the placement problem to optimize the distance between the clients and the most requested services in fog computing. They assume there are unlimited resources in cloud computing and try to minimize the hop count by placing the most popular services as closer to the users as possible. In contrast, our work focuses on the overall network usage of the cloud underlying cluster, which is modeled as a set of heterogeneous machines.
In recent years, a number of research works have been proposed in the area of VM placement with traffic awareness for cloud data centers [16,17]. Meng et al. [8] analyze the impact of data center network architectures and traffic patterns and propose a heuristic approach to reduce the aggregate traffic when placing VM into the data center. Wang et al. [9] formulate the VM placement problem with dynamic bandwidth demands as a stochastic bin packing problem and propose an online packing algorithm to minimize the number of machines required. However, they only focus on optimizing the network traffic in the data center, without considering the highly diverse resources requirements of the virtual machines. Biran et al. [32] proposed a placement scheme to satisfy the traffic demands of the VMs while meeting the CPU and memory requirements. Dong et al. [33] introduced a
placement solution to improve network resource utilization in addition to meeting multiple resource constraints. They both rely on a certain network topology to make placement decisions. Besides, many research efforts have been devoted to the scheduling and partitioning on heterogeneous systems [34,35]. Different from them, our work is agnostic to the underlying network topology, which aims to minimize the overall inter-machine traffic on the cluster.
7. Conclusions
In this paper, we investigated service placement problem for microservice architecture in clouds. In order to find a high quality partition of service-based applications, we propose two partition algorithms: Binary Partition and K Partition, which are based on a well designed randomized contraction algorithm. For efficiently packing the application, we adopt most-loaded heuristic and traffic awareness in the packing algorithm. By adjusting the threshold \( \alpha \) which denotes the upper bound of the resource demands, we can find a better placement solution for service-based applications. We implement a prototype scheduler based on our proposed algorithms and evaluate it on testbed clusters. In the evaluation, we show that our algorithms can improve the ratio of successfully placing applications on the cluster while significantly increasing the ratio of co-located traffic (i.e., reducing the inter-machine traffic). In the overhead evaluation, the results show that our algorithms incur some overhead but in an acceptable time. We believe that the proposed algorithms are practical for realistic use cases. In the future, we will investigate problem-specific optimizations to improve our implementation and consider resource dynamics in the placement to adapt more sophisticated situations.
Author Contributions: Conceptualization, Y.H.; methodology, Y.H.; software, Y.H.; formal analysis, Y.H.; investigation, Y.H. and Z.Z.; resources, C.d.L.; writing—original draft preparation, Y.H. and Z.Z.; writing—review and editing, Y.H.; supervision, Z.Z. and C.d.L.
Funding: This research has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreements 643963 (SWITCH project), 654182 (ENVRIplus project), 676247 (VRE4EIC project), 824068 (ENVRI-FAIR project) and 825134 (ARTICONF project). The research is also supported by the Chinese Scholarship Council.
Acknowledgments: The authors thank the anonymous reviewers for their thoughtful comments on this paper.
Conflicts of Interest: The authors declare no conflict of interest.
Abbreviations
The following abbreviations are used in this manuscript:
SaaS Software as a Service
VM Virtual Machine
BP Binary Partition
KP K Partition
HP Heuristic Packing
KS Kubernetes Scheduler
FFD First-Fit Decreasing
RAND Random
References
15. Huang, K.C.; Shen, B.J. Service deployment strategies for efficient execution of composite SaaS applications on cloud platform. J. Syst. Softw. 2015, 107, 127–141. [CrossRef]
|
{"Source-Url": "https://pure.uva.nl/ws/files/47303111/applsci_09_04663.pdf", "len_cl100k_base": 12465, "olmocr-version": "0.1.50", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 61122, "total-output-tokens": 15691, "length": "2e13", "weborganizer": {"__label__adult": 0.00032401084899902344, "__label__art_design": 0.000732421875, "__label__crime_law": 0.00034356117248535156, "__label__education_jobs": 0.001544952392578125, "__label__entertainment": 0.0001621246337890625, "__label__fashion_beauty": 0.0002015829086303711, "__label__finance_business": 0.00115203857421875, "__label__food_dining": 0.0003788471221923828, "__label__games": 0.0008997917175292969, "__label__hardware": 0.0025119781494140625, "__label__health": 0.0007476806640625, "__label__history": 0.0005960464477539062, "__label__home_hobbies": 0.00015115737915039062, "__label__industrial": 0.0007276535034179688, "__label__literature": 0.00042510032653808594, "__label__politics": 0.0003063678741455078, "__label__religion": 0.0004291534423828125, "__label__science_tech": 0.46240234375, "__label__social_life": 0.0001017451286315918, "__label__software": 0.0263519287109375, "__label__software_dev": 0.498046875, "__label__sports_fitness": 0.0002417564392089844, "__label__transportation": 0.0007839202880859375, "__label__travel": 0.00028252601623535156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 58180, 0.05297]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 58180, 0.39307]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 58180, 0.87292]], "google_gemma-3-12b-it_contains_pii": [[0, 458, false], [458, 3470, null], [3470, 8359, null], [8359, 11845, null], [11845, 15534, null], [15534, 17776, null], [17776, 20142, null], [20142, 23230, null], [23230, 25302, null], [25302, 27712, null], [27712, 31533, null], [31533, 35809, null], [35809, 39119, null], [39119, 42337, null], [42337, 44161, null], [44161, 47789, null], [47789, 51210, null], [51210, 55465, null], [55465, 58180, null]], "google_gemma-3-12b-it_is_public_document": [[0, 458, true], [458, 3470, null], [3470, 8359, null], [8359, 11845, null], [11845, 15534, null], [15534, 17776, null], [17776, 20142, null], [20142, 23230, null], [23230, 25302, null], [25302, 27712, null], [27712, 31533, null], [31533, 35809, null], [35809, 39119, null], [39119, 42337, null], [42337, 44161, null], [44161, 47789, null], [47789, 51210, null], [51210, 55465, null], [55465, 58180, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 58180, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 58180, null]], "pdf_page_numbers": [[0, 458, 1], [458, 3470, 2], [3470, 8359, 3], [8359, 11845, 4], [11845, 15534, 5], [15534, 17776, 6], [17776, 20142, 7], [20142, 23230, 8], [23230, 25302, 9], [25302, 27712, 10], [27712, 31533, 11], [31533, 35809, 12], [35809, 39119, 13], [39119, 42337, 14], [42337, 44161, 15], [44161, 47789, 16], [47789, 51210, 17], [51210, 55465, 18], [55465, 58180, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 58180, 0.15054]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
010cdf3851a3cf7099371c034389fa1aaa97841c
|
Using meta-ethnography to synthesize research: A worked example of the relations between personality and software team processes
Fabio Q. B. da Silva, Shirley S. J. O. Cruz, Tatiana B. Gouveia
Centre for Informatics
Federal University of Pernambuco
Recife, Brazil
{fabio,ssj,tbg2}@cin.ufpe.br
Luiz Fernando Capretz
Department of Electrical & Computer Engineering
University of Western Ontario
London, Canada
lcapretz@uwo.ca
Abstract— Context: The increase in the number of qualitative and mixed-methods research published in software engineering has created an opportunity for further knowledge generation through the synthesis of studies with similar aims. This is particularly true in the research on human aspects because the phenomena of interest are often better understood using qualitative research. However, the use of qualitative synthesis methods is not widespread and worked examples of their consistent application in software engineering are needed. Objective: To explore the use of meta-ethnography in the synthesis of empirical studies in software engineering through an example using studies about the relations between personality and software team processes. Methods: We applied the seven phases of meta-ethnography on a set of articles selected from a previously developed systematic review, to assess the appropriateness of meta-ethnography in this domain with respect to ease of use, and usefulness and reliability of results. Results: Common concepts were identified through reading and interpreting the studies. Then, second order translations were built and used to synthesize a model of the relationships between personality and software team processes. Conclusions: Meta-ethnography is adequate in the synthesis of empirical studies even in the context of mixed-methods studies. However, we believe that the method should not be used to synthesize studies that are too disparate to avoid the development of gross generalizations, which tend to be fruitless and are contrary to the central tenets of interpretive research.
Keywords— research synthesis; meta-ethnography; personality; team processes; software engineering.
I. INTRODUCTION
In this article, we were primarily interested in demonstrating the use of meta-ethnography [31] in the synthesis of empirical studies in software engineering. Broadly, research synthesis is a term used to describe a family of methods for summarizing, integrating, combining, and comparing the results of different studies which are mainly interested in similar or related research questions or topics [9]. Meta-ethnography [31] is an interpretive approach to research synthesis in which the primary concern is "to achieve synthesis through subsuming the concepts identified in the primary studies into a higher-order theoretical structure" [9]. This approach to synthesis is in contrast with aggregative approaches, like meta-analysis [14], that aim at summarizing data for the purpose of achieving generalizations [6].
Our motivation stems from the necessity of useful and reliable methods of interpretive synthesis when dealing with evidence from qualitative or mixed-methods empirical studies, as discussed by Cruzes and Dybå [9]. Meta-ethnography has its roots in social sciences [35], and has been applied successfully in health science [3] and other areas [27]. In software engineering, there are only two uses of meta-ethnography in systematic literature reviews, according to recent tertiary studies [9][10]. As far as we are aware, there is no published work that attempts to provide a worked example of the use of meta-ethnography to synthesize studies of different nature (qualitative and quantitative) in software engineering.
Therefore, our main goal is to show the process and the artefacts deployed in the development a meta-ethnographic synthesis of studies that used different research methods (quasi-experiments and ethnographies). We hope that our example will be helpful to researchers that are attempting to build interpretive synthesis of empirical studies either as part of systematic reviews or in theory building from multiple qualitative studies.
According to Noblit and Hare, the starting point of a meta-ethnography “involves identifying an intellectual interest that qualitative research might inform” [31]. We were, therefore, also interested in finding a theme that was worthy the effort of building the synthesis, that is, that could be of interest to us as researchers and also relevant for other researchers and practitioners. Because one of our main research interests is on the study of the social and individual aspects of software development teams, we decided to use the following research question to guide our meta-ethnography:
How does individual personality of team members relate with team processes in software development teams?
This article is structured as follows. In Section II, we briefly provide the conceptual background that is important to understand the studies and their synthesis. In Section III, we describe the phases of meta-ethnography, detailing the procedures and the artefacts used in each phase. In Section IV, we present the results of the meta-ethnography. In Section V, we discuss our results regarding the use of meta-ethnography and the results of the synthesis. Finally, we present concluding remarks in Section VI.
II. BACKGROUND
Meta-ethnography is described in Section III. In this section, we briefly present the conceptual background about the themes addressed in our synthesis. In this respect, some authors tend to make distinctions between teams and groups [18] while others use team and group to refer to the same concept [5]. A deeper discussion about this issue is out of the scope of this study and we will use the term software team or simply team, as its use is more widespread in software engineering literature.
A. Personality and Personality Tests
The research about personality is built around a diversity of theoretical foundations in the field of psychology, including traits, types, behavioural, and psychoanalytic theories. Of those traditions, traits and types theories are among the most used in organizational psychology [2] and in the studies about personality in software engineering [8]. The studies used in this synthesis focused on the following two traditions.
Most of the studies about personality in software engineering use personality tests to identify differences among individuals [8]. In psychology there are two major categories of personality tests: projective and objective. Projective tests assess individual personality through responses from ambiguous stimulus with the assumption that personality is unconscious and the individual’s responses will reveal its inner characteristics. Objective tests measure personality by self-assessment questionnaires with the underlying assumption that personality is primarily conscious and can be directly accessed. All studies synthesized in this article use some form of objective tests.
B. Individual Personality and Team Composition
While personality tests have been used successfully with individuals, its power can be multiplied when applied to teams [30]. Each person’s personality traits can be used to help teams work more productively to accomplish common goals. Therefore, team composition has been studied in terms of diversity of the individual personalities within the team with at least the following three purposes: first, to help understanding how individual behaviour affect other within a team; second, to build highly productive team; and third to find ways to minimize conflict amongst team members. It is important to investigate how individuals prefer to respond to team challenges and the individual ways to interact with other on the team. Work on this field specifically aids team members by: identifying areas of strength and weakness for the team, clarifying team behaviour, helping to match specific tasks with individual skills, and providing a better framework to handle conflicts [20][30].
C. Team Processes
The term team process is broadly used to refer to what happens in the team or among teams, particularly in terms of the relationships between and amongst team members. According to Fuhriman et al. [12], team processes can be characterized and studied as phenomenon or as interaction. Seeing team process as phenomenon, or a composite of phenomena, is common in the research on teamwork. In this approach, processes, such as cohesion and conflict, are measure at certain points during the experimental period, averaged across subjects, and then presented statistically. Two studies in our synthesis used this approach [1][24].
A different approach is to view team processes as interactions, in which processes are analysed on both verbal and non-verbal content level. This approach leads to descriptively richer results with more explanatory power. However, measuring interactions is more time consuming and costly, and data analysis is more difficult. The preferred and most adequate form of data collection is through observations of team interactions, although some forms of questionnaires can also be used. This approach is not common in teamwork research, although it was the approach used to some extent in two studies in our synthesis [22][23].
The studies synthesized investigated cohesion and conflict as the main team processes of interest. Therefore, we briefly discuss these concepts below.
1) Cohesion
Cohesion can be defined as a dynamic process that reflects the willingness of group members to pull together and stay together as a unit to achieve their common goals and/or fulfill the affection needs of the individuals [4]. Carron and Brawley [4] put forward a model that identifies two dimensions to gauge cohesion (group integration and individual attraction to the group) that can be further divided into task and social orientation. According to their model, this measure of cohesiveness is neither evenly distributed across different teams nor with the same intensity along the teams existence. These authors assert that a team can be highly cohesive to accomplish a particular task despite conflicts among the members. Conversely, it is also possible that a socially cohesive team is unable to come together as a unit to get a job done. The complex relationships between cohesion and conflict and team performance were clearly observed in our synthesis.
We shall refer to these two orientations as task and social cohesion. Although none of the synthesized studies used a multidimensional measure of cohesion, we found that the distinction between task and social cohesion provides a better explanation of the interpretations and translations in our synthesis.
2) Conflict
Intra-group conflict is broadly understood as perceived incompatibilities or the perceptions by the team members that they have discrepant views or have interpersonal incompatibilities [19]. Acuña et al. [1] conceptualized conflict as “an opposition or discrepancy between the ideas, beliefs or interests of the team members”. Conflict can be classified in two types: task conflict and social conflict [19]. The task conflict occurs when members disagree about a decision or a task, presenting different ideas, opinions or points of view. Social conflict, in turn, happens when members exhibit incompatible values, tastes or ideas that generate wear personal between members [19].
The characterization of conflict in these two dimensions is important in the study of its relationships with other team processes, as cohesion, and how these relationships shape teamwork and determine some of its outcomes.
III. METHOD
We constructed our meta-ethnography using the seven phases suggested by Noblit and Hare [31]. In Section III.A, each phase is defined and the specific procedures we adopted are described in some detail. In Section III.B, we discuss threats to validity of our study and how we addressed them.
A. The Phases
1) Getting started
In this phase, the meta-ethnographer must look for a topic or problem that could be informed by an interpretive synthesis of a set of studies. The topic should be relevant to inform research and practice. Interpretive or qualitative approaches are the preferred research strategies when “how” and “why” questions are being asked [28]. Therefore, meta-ethnography aims at producing explanations, through the interpretation of findings from several studies, which were not evident in any of the individual studies. At this phase, a relevant topic of interest should be described by an adequate formulation of a research question.
As explained in the Introduction, our primary goal was to demonstrate the use of meta-ethnography as a method to synthesize empirical studies in software engineering. We also wanted to perform a synthesis that could be relevant and useful for researchers and practitioners interested in the study of software teams. Further, our own research interests are focused on understanding the role of individual and social factors in software development. Therefore, as a result of this phase, we proposed to answer the following research question: How does individual personality of team members relate with team processes in software development teams?
2) Deciding what is relevant to the initial interest
Noblit and Hare [31] emphasized that a meta-ethnography should not attempt to produce gross generalisations across studies with disparate goals and from too distinct contexts. In this sense, it goes in opposition to aggregative methods, such as meta-analysis or integrative reviews, which look for developing synthesis of an exhaustive list of studies, attempting to increase external validity of the results. In meta-ethnography, the translations and interpretations can be generalized, but as for all qualitative and interpretive studies, the context plays a central role in the generalization.
### TABLE I. INITIAL SET OF SELECTED STUDIES
<table>
<thead>
<tr>
<th>Id.</th>
<th>Research Method</th>
<th>Team Management</th>
<th>Ref.</th>
<th>Study Year</th>
<th>Quality (0 – 11)</th>
</tr>
</thead>
<tbody>
<tr>
<td>TP1</td>
<td>Quasi-experiment</td>
<td>XP teams</td>
<td>[1]</td>
<td>2004/5</td>
<td>9</td>
</tr>
<tr>
<td>TP3</td>
<td>Ethnography</td>
<td>XP teams</td>
<td>[22]</td>
<td>2004/5</td>
<td>6</td>
</tr>
<tr>
<td>TP4</td>
<td>Ethnography</td>
<td>XP teams</td>
<td>[23]</td>
<td>2004</td>
<td>7</td>
</tr>
<tr>
<td>TP5</td>
<td>Survey</td>
<td>N.I.</td>
<td>[33]</td>
<td>N.I.</td>
<td>4</td>
</tr>
</tbody>
</table>
N.I.: Not informed in the paper
We chose the studies of interest from the results of a previously developed systematic review [8] and its unpublished extension performed in 2011. In these reviews, we applied thematic analysis to classify 63 selected empirical studies into 6 themes. To find the themes, we coded the variables, factors, and concepts from the research questions, hypothesis, and goals of each study. Five studies were classified into the theme Team Process because they addressed the relations between personality and one or more team processes. They formed our initial set of studies, shown in TABLE I.
We performed an initial screening on these studies to check if they formed a coherent set. Three of the studies were performed in 2004/5, and all of them used students as subjects. The style of team management was autonomous or self-regulating in all studies in which this information was available, with three of the studies investigating eXtreme Programming (XP) teams. The research methods used were different (two quasi-experiments, two qualitative studies with ethnographic characteristics, and one survey) but the objectives and central concepts addressed were fairly similar.
We then assessed the quality of the studies using the same criteria used by Dybå and Dingsoyr [11]. Two researchers assessed each study and the few disagreements were resolved in a consensus meeting. The two quasi-experiments received the highest scores, the ethnographies scored just above the average, and the survey scored lower the average. We decided to exclude TP5 because of its low score in the quality assessment. After removing TP5, considering the similarities of the four remaining studies, we concluded that the studies formed a coherent set adequate for a meta-ethnography.
3) Reading the studies
This phase involved carefully reading the papers to gain a general view of the set of studies. Further, the goal was to identify the key concepts addressed in each individual study through repeated reading and noting of the main concepts. However, the name of this phase is perhaps misleading because we actually read the studies many times in the following phases as well. In each phase, the emphasis of the reading changed, as the researchers became more familiar with the studies and deeper understanding and interpretations were needed. Noblit and Hare admitted that, because in qualitative research the synthesis develops through the synthesis effort, “this phase is not so clear”[31].
In this phase, three important tasks must be performed. First, the careful reading of all studies to create an initial understanding of the whole. Second, the extraction of contextual information from each study that would be important in the interpretations and translations in future phases. For this, we contend that the type of contextual information must be defined a priori, depending on the information needed in the specific synthesis. Further, this extraction should be carried out by at least two researchers to increase reliability and disagreements should be noted and properly addressed. Third, relevant concepts associated with the research questions should be identified in each study.
In our study, we started by reading the four studies without considering data extraction. Then, we extracted contextual data in pairs. Disagreements in the extractions were resolved in consensus meetings. The result of this extraction is presented in TABLE II. Next, we read the studies for a third time looking for the main concepts that were related to our research question and this resulted in TABLE III.
4) Determining how the studies are related
In this phase, the relationships between the different studies were considered. It was the first phase in which we put the studies together and started making comparisons among them. Noblit and Hare [31] suggested juxtaposing the lists of key metaphors, ideas, and concepts occurring in each study as the initial step in relating the studies.
We identified three questions that guided our work in this phase:
- Are the studies addressing the same or similar concepts?
- Are the operational definitions of the concepts similar across studies?
- Are the studies addressing similar relationships among concepts?
To answer the first question, we used TABLE III and identified the concepts that were addressed by at least two studies. Six concepts from TABLE III fulfilled this criterion. We considered that it would only make sense to synthesize results related to concepts that were addressed by at least two studies; otherwise no synthesis would be made. Then, to address the second question, we looked for the conceptual and operational definitions of the six concepts: personality, cohesion, conflict, team composition, satisfaction, and team performance. These definitions can be found in TABLE IV.
We performed another reading of the studies looking for the relationships among concepts that were addressed in each study. We identified the relationships and extracted the results of the studies in TABLE V. Tables II, IV, and V express the similarities and differences among the studies, and are the result of this phase.
5) Translating the studies into one another
During this phase, we translated the concepts and relations from one study into the concepts and relations of the other studies. In meta-ethnography, we start by considering studies as analogies, that is, considering that findings in one study are like findings in the other studies, but also taking into account their non-similarities. However, translations go beyond simple analogies in that specific meanings from each study are preserved and compared across studies through the synthesis process. An adequate translation preserves the meanings of concepts and their relations in each study. It also compares the meanings of concepts and relations from on study with concepts and relations from the other accounts. In general, concepts and relations from the studies can compare with each other in three ways: they are directly comparable as reciprocal translations; they may contradict or stand in opposition to one another as refutational translations; or taken together they may represent a line-of-argument [3][31].
We used Table IV as the input to the translations. We also recurred to the studies whenever we needed to get a deeper understanding of the concepts and relations. We translated each row of Table IV into a first-order synthesis of the relations and used these translations as the input to phase 6.
6) Synthesizing translations
Noblit and Hare [31] discussed that, when the number of translations is large, it is desirable to synthesize them into another second-order of synthesis, “making a whole into something more than the parts alone imply” [31]. We produced the synthesis of the translations and put them together with the first-order translations in TABLE VI. We then created a diagram that summarizes this synthesis and a narrative that describes the its central story, in a similar way as a central story is developed in grounded theory (Fig. 1).
7) Expressing the synthesis
This article is one attempt to report the synthesis result. We used a structure similar to Britten et al. [3]. The primary audience is the research community interested in performing synthesis of empirical research using meta-ethnography. We also believe that our synthesis can inform researchers and practitioners interested in understanding how personality relates to team processes in software teams.
B. Threats to Validity
Because meta-ethnography is an interpretive approach to synthesis, we addressed validity and reliability of our synthesis from the three perspectives proposed by Merriam [28].
Credibility or Internal Validity: in interpretive accounts, internal validity is related to the issue of whether the research results consistently represent reality. In a synthesis, internal validity relies on the credibility and internal validity of the synthesized studies. We addressed this issue by carefully scrutinizing the quality of the primary studies in phase 2. We only chose studies that score above the average and also scored well on issues related to study design and development. This is an important because synthesizing low quality studies will inevitably result in a low quality synthesis no matter how carefully and consistently the synthesis was performed. This issue must be addressed mainly in phases 1 and 2, but also in phase 3 new problems can be found that affect internal validity.
Consistency or Reliability: An important question in qualitative research is whether the findings are consistent with the data collected. In a meta-ethnography, the question is whether the translations and the interpretations are consistent with the concepts, metaphors, and results in each study. Preservation of the meanings from each individual account is at the core of meta-ethnography [31]. As we progress from phase 3 to phase 6, our attention moved from the individual accounts to the translations between them. Therefore, the consistency of the data extracted in phase 3 and the relations between studies in phase 4 are very important because the translations in phase 5 are based on them. We performed phases 3 and 4 in pairs, discussing disagreements and reaching consensus after deep debate among researchers. The first author performed phases 5 and 6 and the other authors reviewed the results looking for potential inconsistencies in the higher-level interpretations and in the final synthesis.
Transferability or External Validity: It is a common understanding in qualitative research that it is the reader or user of the study that should primarily engage in the generalization of research findings [28]. In this sense, the reader or user can decide to what extent the findings can be applied to other situations. The researcher has to enhance the possibility of someone else “transferring” the results and this is accomplished by a rich description of the context in which the
research was carried out. In a meta-ethnographic synthesis, the contexts are those from the synthesized studies. In our synthesis, we worked to enhance transferability in two ways. First, we chose studies from similar or related contexts. Second, we extract and presented contextual information in TABLES I, II and IV so the readers can quickly assess and compare the contexts of the studies with their own context.
IV. RESULTS
This section is structured following the phases described in Section III. The results of phases 1 and 2 were presented before and, thus, in this section we describe the results of phases 3-6. In the tables that summarize the results, sentences between double quotes are literal transcriptions from each study.
A. Results from phase 3: Reading the studies
We collected data about study objective and aspects of the study design and development to enable comparisons and also to make sense of the translations and interpretations (TABLE II). Three studies used a test related to Myers-Briggs Type Indicator (MBTI) to access individual personality and only TP1 used a version of NEO-PI based on the Five Factor Model. TP1 and TP2 were quasi-experiments and TP3 and TP4 were meta-ethnographically informed qualitative researches. Consistently, data used in the quasi-experiments were quantitative and collected through the application of questionnaires in certain points during the experimentation process, whereas observation was used as the main data collection technique in the qualitative studies. In this sense, TP1 and TP2 used a process as phenomena approach, whereas the other studies employed an approach closer to process as interaction, as discussed in Section II.
Another important similarity among the studies is that all of them investigated teams of students in university level courses using some type of autonomous team (XP teams in three studies). Although this can apparently restrict generalizations to other contexts, from an interpretive stance this in fact produces a deeper understanding of the phenomena in this specific context. From this contextual information, we concluded the studies were sufficiently diverse in content and type of data to produce rich interpretations and yet were not so disparate to allow a consistent synthesis.
We then read each study again looking for the main concepts related to our research question. As the studies investigated several different aspects of teamwork, in particular, TP3 and TP4, it was important to use the research question to keep the focus of our readings. We extracted eight concepts related to teamwork and Table III shows in which study they were addressed. The contents of TABLES II and III summarize the results of phase 3.
| TABLE II. CONTEXTUAL INFORMATION ABOUT THE STUDIES |
|---------------------------------|---------------------------------|---------------------------------|---------------------------------|---------------------------------|
| Objective | "This article analyses the relationships between personality, team processes, task characteristics, product quality and satisfaction" | "We test the impact of problem solving preferences (a sub-set of the MBTI scale) on group conflict and performance". | "… investigate interactions of personalities in software engineering (SE) teams and how disruptions and lack of debate between individuals affected performance". | "… to gain a qualitative understanding of how cohesiveness relates to personality type, performance and adherence to a methodology (XP)." |
| Sample | Second-year computing undergraduate students (105 participants divided in 35 teams) | Undergraduate students, enrolled in two 15-week SE courses. (38 members in 9 teams) | Three teams (5-6 individuals each) of Master’s-level students. | Five teams (5-6 individuals each) of Master’s-level students. |
| Research Method | Quasi-experiment | Quasi-experiment | Ethnographically-informed | Ethnographically-informed |
| Design | "The students were divided into 35 three-member teams … formed at random and … blind to the quasi-experimental conditions and hypotheses." | "… students were assigned to 4-5 person teams: five control groups of numerical dominant problem solving style and four experimental groups of diverse styles." | Convenience sampling of the three teams participating in the "Maxi Project". | "The teams were selected on the basis of personality type, nationality and previous skills/experience". |
| Data Collection | "Measurements were taken before the project (NEO FFI personality test), during the project (conflict, cohesion) and after the project (autonomy, interdependence and satisfaction)." | "At the conclusion of every phase of the team project, peer evaluations were collected. Team members were asked five questions related to team dynamics". | Observations and online personality test based on the MBTI. | Observations, focus group interviews, document analysis, workgroup cohesion test, and online personality test based on the MBTI. |
| Setting | "Special-purpose project with non-professional participants (… students) undertaking a (toy) project using an adaptation of the agile XP method within a laboratory environment". | "The semester long projects were complex and ill-structured, requiring teams to consider the pros and cons of several design options". | "The teams … worked on real software development projects for real clients in the project “Maxi Project” (a two semester long project during 2004-2005)". | Teams of students participating in professional software house known as Genesys Solutions as part of the Software Engineering Observatory at the University of Sheffield. |
| Country | Spain | United States | England | England |
Different, the scale from Pershall and Ellis [32] has its theoretical basis on the work of Gladstein [13], suggesting similarities at the theoretical level. Finally, all studies considered the project or course grade as a measure of team performance. However, the operationalization of this measure was not clearly presented in any study.
Considering the differences of the operational definitions of personality, cohesion, conflict, and satisfaction, it would not be feasible to integrate the results at the operational level if we were using an aggregative synthesis approach. Using an interpretative approach we could compare the differences among studies at the conceptual or theoretical level and still arrive at consistent interpretations.
After comparing the concepts across the studies, we identified and compared the relationships between concepts (TABLE V). Team composition, defined in terms of the personality of team members, was the central antecedent factor addressed in all four studies. Relationships between composition and conflict were found in TP2, TP3, and TP4, which also found direct relationships between composition and team performance. TP1 and TP4 found relationships between composition and cohesion. In particular, TP1 found that teams with high levels of Extraversion and Agreeableness presented high levels of cohesion. TP1 and TP4 also found relationships between the team processes cohesion and conflict. In these studies, high cohesion in certain teams tend to reduce conflict, whereas other teams with high levels of social conflict showed low levels of cohesion.
No direct relationship between cohesion and outcomes such as performance and satisfaction was found in TP1, but TP4 found that cohesive teams tend to outperform teams with low cohesion. This suggests that other factors act as intermediates between cohesion and team outcomes, and we proposed to use Effort Applied to the Task as one such a factor as in Hackman’s theory [16]. Finally, social conflict was clearly related to low levels of performance and satisfaction in TP1 and TP2, and TP4 identified that certain levels of task conflict were favourable in forcing the teams to evaluate different alternatives to approach problems during the development of the projects. These results about conflict suggested that social and task conflict played distinct and potentially opposing effects in the results of teamwork.
### TABLE III. MAIN CONCEPTS FROM EACH STUDY
<table>
<thead>
<tr>
<th>Concepts</th>
<th>TP1</th>
<th>TP2</th>
<th>TP3</th>
<th>TP4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Task Characteristics</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Personality</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Conflict</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Cohesion</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Team Composition</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td></td>
</tr>
<tr>
<td>Performance</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td></td>
</tr>
<tr>
<td>Satisfaction</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Software Quality</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
### B. Results from phase 4: Determining how the studies are related
We looked for similarities and discrepancies among the studies to guide the construction of the translations in phase 5. As discussed above, task characteristics and software quality were not analyzed because they were addressed in a single study. Our next concern was to identify the theoretical and operational definition used in each study for the remaining six concepts (TABLE IV).
Personality was clearly defined both at the theoretical and operational levels in all four studies. Three studies used objective tests based on MBTI and TP1 used a version of NEO-FI test. MBTI [29] is based on the typological theory of personality developed by Carl G. Jung [21], but none of the studies in our synthesis used the official version of MBTI. NEO-FI test is based on the Five Factor Model of personality traits [7], and TP1 used the official Spanish version of the test.
Cohesion scales were used in two studies. TP1 used the Gross Cohesion Scale [15], which is self-report measure with 9 items considered to be one-dimensional. TP4 used the workgroup cohesion scale developed by Price and Mueller [34], which has 8 items and is also one-dimensional. TP1 applied the cohesion questionnaire in the middle of the project whereas in TP2 the questionnaire was applied at the beginning, middle, and end of the project and the average was used to determine the workgroup cohesion.
Operational definitions of conflict were used in TP1 and TP2 and both used Jehn’s definition of intra-group conflict [20], which is a two-dimensional scale that measures social and task conflicts. In TP4, task conflict was observed and analysed during the study, but no operationalization was used to achieve a quantitative measure of conflict.
Team composition was not directly defined in TP1, but the aggregation of individual personality traits to a “team personality” is close to notions of composition based on personality types that were used in the other studies. TP2 used team composition explicitly in the quasi-experimental design, considering homogeneous and heterogeneous teams with respect to the problem solving preferences, a sub-scale of MBTI. The remaining studies also considered composition diversity in terms of the personality types in the team, but did not address any particular type of composition.
Satisfaction was studied in TP1 and TP2 as a measure of outcome in the teamwork. TP1 used a three-item scale from Gladstein [13] and TP2 used a six-item scale from Pershall and Ellis [32]. Although both operationalizations are different, the scale from Pershall and Ellis [32] has its theoretical basis on the work of Gladstein [13], suggesting similarities at the theoretical level. Finally, all studies considered the project or course grade as a measure of team performance. However, the operationalization of this measure was not clearly presented in any study.
Considering the differences of the operational definitions of personality, cohesion, conflict, and satisfaction, it would not be feasible to integrate the results at the operational level if we were using an aggregative synthesis approach. Using an interpretative approach we could compare the differences among studies at the conceptual or theoretical level and still arrive at consistent interpretations.
After comparing the concepts across the studies, we identified and compared the relationships between concepts (TABLE V). Team composition, defined in terms of the personality of team members, was the central antecedent factor addressed in all four studies. Relationships between composition and conflict were found in TP2, TP3, and TP4, which also found direct relationships between composition and team performance. TP1 and TP4 found relationships between composition and cohesion. In particular, TP1 found that teams with high levels of Extraversion and Agreeableness presented high levels of cohesion. TP1 and TP4 also found relationships between the team processes cohesion and conflict. In these studies, high cohesion in certain teams tend to reduce conflict, whereas other teams with high levels of social conflict showed low levels of cohesion.
No direct relationship between cohesion and outcomes such as performance and satisfaction was found in TP1, but TP4 found that cohesive teams tend to outperform teams with low cohesion. This suggests that other factors act as intermediates between cohesion and team outcomes, and we proposed to use Effort Applied to the Task as one such a factor as in Hackman’s theory [16]. Finally, social conflict was clearly related to low levels of performance and satisfaction in TP1 and TP2, and TP4 identified that certain levels of task conflict were favourable in forcing the teams to evaluate different alternatives to approach problems during the development of the projects. These results about conflict suggested that social and task conflict played distinct and potentially opposing effects in the results of teamwork.
### C. Results from phase 5: Translating the studies into one another
We started the translation between studies when we identified the relationships between the main concepts and built TABLE V in phase 4. In phase 5, we built interpretations of all cells in a given row of TABLE V, and created first-order translations of them. In this process, we produced lines-of-argument consistent with the individual accounts, preserving the meanings of concepts from each study. These translations are presented in TABLE VI.
### D. Results from Phase 6: Synthesizing the translations
In phase 6, we synthesized the first-order translations produced in the previous phase, creating second-order translations with the goal of making a whole and coherent account of the synthesized studies.
### TABLE IV. CONCEPTS DEFINITIONS AND OPERATIONALIZATIONS
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Personality Theory</td>
<td>Five Personality Factor or Big Five</td>
<td>Myers-Briggs Type Indicator (MBTI)</td>
<td>Myers-Briggs Type Indicator (MBTI)</td>
<td>Myers-Briggs Type Indicator (MBTI)</td>
</tr>
<tr>
<td>Personality Test</td>
<td>Spanish version of the NEO FFI</td>
<td>Assessment to identify problem-solving style (inner-dimensions of the MBTI).</td>
<td>An online test based on MBTI developed by Human Metrics [17].</td>
<td>An online test based on MBTI developed by Human Metrics [17].</td>
</tr>
<tr>
<td>Cohesion - Definition</td>
<td>“A group property with individual manifestations of feelings of belongingness or attraction to the group”.</td>
<td>–</td>
<td>–</td>
<td>(The paper addresses cohesion, but does not provide a definition of the concept)</td>
</tr>
<tr>
<td>Cohesion - Operationalization</td>
<td>Gross Cohesion Questionnaire [36].</td>
<td>Intragroup conflict, which encompasses task and relationship conflict as defined by Jehn et al. [20].</td>
<td>Price and Mueller scale [34].</td>
<td></td>
</tr>
<tr>
<td>Conflict</td>
<td>“Conflict is an opposition or discrepancy between the ideas, beliefs or interests of the team members. … [19]”</td>
<td>Intragroup Conflict questionnaire from Jehn [19] measures both task conflict and social conflict,”</td>
<td>Task-related conflict refers to disagreement among the team members about task issues, including the nature and importance of task goal.</td>
<td></td>
</tr>
<tr>
<td>Conflict - Operationalization</td>
<td>“Intragroup Conflict questionnaire from Jehn [19] measures both task conflict and social conflict,”</td>
<td>Questionnaire with questions drawn from the intragroup conflict scale developed by Jehn [19].</td>
<td>(Conflict is not operationalized)</td>
<td></td>
</tr>
<tr>
<td>Team Composition</td>
<td>(It is not directly addressed, but the aggregation of individual scores to a “team personality” is close to a notion of composition based on personality types).</td>
<td>Composition diversity defined in terms of the dominance of problem-solving style.</td>
<td>Diversity of personality types and ethnicity in the teams.</td>
<td>Diversity of personality types in the team</td>
</tr>
<tr>
<td>Satisfaction</td>
<td>Gladstein [13].</td>
<td>Pershal and Ellis [32]</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Performance</td>
<td>Course grade</td>
<td>Team's grade</td>
<td>Not defined</td>
<td>Project Grade</td>
</tr>
</tbody>
</table>
### TABLE V. RELATIONSHIPS BETWEEN CONCEPTS
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Composition and Conflict</td>
<td>“Problem solving dominant groups showed higher levels of intra-group conflict.”</td>
<td>“This team work … well … despite great differences in both personality and ethnicity”.</td>
<td>“… agreement is straightforward if one has a team of almost homogenous personality types”.</td>
<td></td>
</tr>
<tr>
<td>Composition and Cohesion</td>
<td>Team Extraversion and Agreeableness relate positively with Cohesion.</td>
<td>–</td>
<td>–</td>
<td>The results indicate that certain teams … were found to be very cohesive due to a mixture of [personality] types.</td>
</tr>
<tr>
<td>Composition and performance</td>
<td>Diversity in problem solving style correlates positively with performance</td>
<td>“… it takes a variety of skills and personalities to solve the myriad of problems related to SE”.</td>
<td>“This range of personalities was a source of strength … because the different types came up with different ways of approaching the same problem”.</td>
<td></td>
</tr>
<tr>
<td>Cohesion and Conflict</td>
<td>“Level of cohesion drops the greater task and social conflict are among team members.”</td>
<td>–</td>
<td>–</td>
<td>“… there was almost too much emphasis on not offending people. This meant that work was sometimes not done and there were no recriminations”.</td>
</tr>
<tr>
<td>Cohesion and Performance</td>
<td>Cohesion is not related to Satisfaction and Performance</td>
<td>–</td>
<td>–</td>
<td>Teams with a high level of cohesion tend to outperform other team with lower levels”.</td>
</tr>
<tr>
<td>Conflict and Performance</td>
<td>“Significant negative relationship between the Intra-Group Conflict and Grade”.</td>
<td>–</td>
<td>“The task conflict in this case seems to have more favourable effect on the performance of the team”.</td>
<td></td>
</tr>
<tr>
<td>Conflict and Satisfaction</td>
<td>“Level of satisfaction drops the greater task conflict is among team members.”</td>
<td>–</td>
<td>“Homogeneous groups showed higher levels of intra-group conflict and lower satisfaction”.</td>
<td></td>
</tr>
</tbody>
</table>
We then created TABLE VI with three columns. The first summarized our interpretation of the main findings of each study that were directly related to our synthesis. The second and third rows present the first and second order translations of the studies. We used the translations to build a central narrative that represents our synthesis, illustrated in Fig. 1.
1) The Central Narrative of the Synthesis
Individual personalities in teams have an influence on its composition. Certain combinations of personality types will tend to favour certain types of interactions among team members, as also discussed by Nash [30]. Therefore, levels of cohesion and conflict will be related to the type of personality composition in the team. We found evidence of distinct influences of two (proposed) archetypical team compositions: one that favours social interactions and cohesion in the team (we called this composition as Pro-SCH, for pro-social cohesion), and another that is focused on getting the job done (we called it Pro-TSK, for pro-task).
The relationships between conflict and cohesion are complex, with mutual cycles of reinforcement. A team exhibiting high levels of social cohesion (Social-CH) will favour interactions that tend to decrease conflict. In such a situation, the social interactions will flourish and satisfaction tends to increase. On the other hand, a team exhibiting high levels of social conflict (Social-CF) will tend to enter in a pattern of behaviours that will decrease cohesion. From the accounts of the studies, it seems that which reinforcement cycle will prevail is mediated by the type of team composition. For instance, from TP1, it seems that a team with high concentration of Extraversion and Agreeableness will tend to favour the increase-cohesion-decrease-conflict cycle. From TP2, teams with dominant problem-solving styles will enter more easily on the increase-conflict-decrease-cohesion cycle.
Cohesion and conflict seems to have a moderating effect on the effort individual team members apply to the team tasks. This is consistent with Hackman’s theory of team effectiveness [16]. In our synthesis, we found that cohesion seems to positively affect task effort while social conflict will have the opposite effect. Task effort was not directly addressed in any study and we added this factor in our synthesis as a proposition that requires verifications.
However, these effects are not straightforward because highly cohesive teams can also tend to have sub-optimal performance because of conflicts, as well as certain types of interactions among team members that are necessary to avoid loafing and to reach better solutions through open assessment of alternatives (this effect is known as the Abilene paradox [25]). In such situations, teams can experience high satisfaction with their work, due to absence of conflict, and still perform poorly. Further, as found in TP4, certain levels of (task) conflict are important for performance because better solutions were found. We modelled this effect by showing that (social) cohesion is likely to reduce the strength positive relationship between task conflict and task effort.
V. DISCUSSION
A. About the use of meta-ethnography
Our main conclusion and warning is that meta-ethnography is not straightforward to use. The several readings of the studies, data extraction performed in pairs, reaching agreements, and checking potential inconsistencies in the interpretations and translations are time consuming and require maturity in the research team. Experience with the methodology itself and a deep understanding of the philosophical stances that form the cornerstones of interpretive research are required. Because the method requires the careful in preservation of the meanings of concepts and metaphors from the synthesized studies, reliability is dependent on the commitment of researchers to respect the findings of the individual accounts and not making generalizations that are not supported by them.
Scalability is also an important issue. We think that synthesizing too many studies is not practical due mainly to the amount of translations and interpretations. Other researchers (in personal communications) have proposed to perform incremental synthesis starting with two studies and then proceeding by adding the remaining studies to the previous synthesis. We believe this approach should be used with extra-caution because it would be very easy to forget the meanings of the previous synthesized studies as the synthesis proceeds, with the danger of subverting their meanings and resulting in syntheses with low reliability.
B. About the result of our synthesis
We believe that our model improved the understanding of the studied phenomena and provides a contribution mainly to researchers but also to practitioners interested in understanding the complex relationships in software teams. The resulting model of Fig. 1 and the corresponding narrative are propositions built from the evidence but that still require further verification. In particular, as part of our synthesis we proposed that certain relationships between factors are causal. However, all four studies only provided evidence of correlations between them. The causal relationships proposed still need empirical tests.
Further, our results are not transferable to any context. Our meta-ethnography is an account of the culture of software teams formed by students in the context of university courses. Maturity, and other factors not addressed in this context, will certainly influence the relations we described in our synthesis. It is, therefore, essential that studies in industrial settings with individuals with varying degrees of personal and professional maturity be performed to produce new evidences in contexts or to verify the applicability of the current propositions.
Finally, only TP1 explicitly used a theory to guide the definition of variables and hypotheses [26]. This made relating the studies and building the translations more difficult and more prone to inconsistencies. Further, the results have little explanatory power and consequently low reduced applicability. We strongly believe that a systematic research framework to investigate team process would be important to improve individual studies and support more useful and reliable synthesis, as suggested by Fuhriman [12].
Satisfaction and Conflict and Performance
Conflict and Cohesion
Cohesion and Performance
Conflict and Performance
Conflict and Satisfaction
**TABLE VI. SYNTHESIS: FIRST AND SECOND ORDER TRANSLATIONS**
<table>
<thead>
<tr>
<th>Relations</th>
<th>Hypothesis or Conclusions</th>
<th>First-order Translations</th>
<th>Second-order Translations</th>
</tr>
</thead>
<tbody>
<tr>
<td>Composition and Conflict</td>
<td>TP4 "combinations of personality types are important and they can have an effect both on performance and cohesion. ... a team whose members do not have very close friendly relationships with each other, can still be [task] cohesive and outperform others that enjoy more open relaxed relationships [social cohesion]."</td>
<td>The interplay of composition diversity, conflict, and cohesion is complex. On the one hand, agreement is easier to achieve and homogeneous groups. On the other hand, certain types of homogeneous groups tend to have higher levels of intra-group conflict. This suggests type of dominance in the group is a moderating factor on these relationships.</td>
<td>Certain compositions tend to favour group social cohesion (Pro-SCH) while others tend to have a greater focus on performing their tasks (Pro-TSK). Pro-SCH teams will avoid conflict (task and social), which may increase satisfaction but reduce task efforts through its effect on task conflict. Pro-TSK teams will be more prone to have intra-group social conflict and reduced social cohesion due to their focus on getting the job done at all costs, but this may increase task effort directly and also through levels of task conflict.</td>
</tr>
<tr>
<td>Composition and Cohesion</td>
<td>Such a team achieves this by virtue of concentrating on the task in hand and devoting all energies to completing a given project. TP2 "Teams with diverse problem-solving styles performed better ... and also displayed more creativity, which can be explained by low levels of social conflict in such teams". TP3 "... it takes a variety of skills and personalities to solve the myriad of problems related to SE".</td>
<td>A mixture of personality types that include extraversion and agreeableness seem to produce teams with higher cohesion and lower intra-group social conflict.</td>
<td>Certain homogeneous compositions (related to inner-dimensions of MBTI) create teams that are more likely to have high levels of social conflict.</td>
</tr>
<tr>
<td>Composition and performance</td>
<td>In task with high levels of problems to be solved diversity of personality types will produce more effective teams. Routine or non-problem-solving tasks seem to be better performed by homogeneous teams with traditional science/engineering personality.</td>
<td>Diversity in composition seems to indirectly be related with performance, through its relationship with cohesion and conflict, and task type has a moderating effect on these relationships.</td>
<td></td>
</tr>
<tr>
<td>Cohesion and Conflict</td>
<td>TP1- Cohesion is negatively correlated to task conflict and (social and task) conflict correlates negatively with satisfaction. However, cohesion is not correlated with satisfaction and both cohesion and conflict are not correlated with performance, defined as software quality.</td>
<td>Cohesion and conflict relate in a complex feedback loop. On one hand, a very cohesive team will under perform due to the need to avoid social or interpersonal conflict. On the other hand, high levels of (task or social) conflict will reduce the bonds in the team, reducing cohesion.</td>
<td>The type of team composition seems to influence the balance between cohesion and conflict, with Pro-SCH teams tending to shift the balance towards social cohesion and Pro-TSK teams tending to have more intra-group social conflict.</td>
</tr>
<tr>
<td>Cohesion and Performance</td>
<td>Cohesion does not seem to be directly related to effectiveness outcomes, but increases the likelihood of team effectiveness through other moderating effects on the effort the team puts on the tasks.</td>
<td>Task conflict is favourable in the analysis of multiple alternatives in performing a team task whereas social conflict relates negatively with performance.</td>
<td>Cohesion and conflict seem to have an indirect effect on performance through their effect on the effort the individuals in the team are willing to apply on the tasks. Cohesion and task conflict seem to have a positive effect on effort, whereas social conflict has a negative effect.</td>
</tr>
<tr>
<td>Conflict and Performance</td>
<td>Intra-group social-conflict reduces individual satisfaction with the team.</td>
<td>Satisfaction with the team and teamwork does not seem to be directly related to performance.</td>
<td></td>
</tr>
</tbody>
</table>
**Fig. 1. Synthesis of Translations: A model of the relationships between team composition and team factors in software teams**
VI. CONCLUSION
We presented a worked example of a meta-ethnography to synthesize four studies that addressed the relationships between team member personality, team processes and outcomes of teamwork. We hope to have demonstrated that meta-ethnography is an adequate method to produce synthesis of mixed-method empirical studies and that the results produced in the synthesis are more than just the sum of the individual studies, but still preserve their meanings. We also hope to have achieved a synthesis of the studies useful to guide future studies in the theme.
Researcher engaging in the use of meta-ethnography must be aware that the set of studies to synthesize greatly influences the consistency and reliability of the resulting synthesis. The synthesis of bad studies will inevitably lead to bad results. Further, studies that are too disparate in objectives and context would tend to produce gross generalizations with limited consistency and usefulness.
Therefore, our experience seem to indicate that meta-ethnography is better suited for the synthesis of a small set of consistently related studies with respect to objectives, conceptual background, and contexts. In this sense, its application in systematic reviews with large number and broad range of studies should only be performed in subsets of studies in similar themes, as we did in our example.
ACKNOWLEDGMENT
Fabio Q. B. da Silva holds a research grant from the Brazilian National Research Council (CNPq), process #314523/2009-0.
REFERENCES
|
{"Source-Url": "http://www.eng.uwo.ca/electrical/faculty/capretz_l/docs/publications/Fabio-ESEM-v2.pdf", "len_cl100k_base": 11472, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 34551, "total-output-tokens": 13643, "length": "2e13", "weborganizer": {"__label__adult": 0.0009307861328125, "__label__art_design": 0.002750396728515625, "__label__crime_law": 0.0008845329284667969, "__label__education_jobs": 0.1708984375, "__label__entertainment": 0.0003247261047363281, "__label__fashion_beauty": 0.0005435943603515625, "__label__finance_business": 0.003284454345703125, "__label__food_dining": 0.0007047653198242188, "__label__games": 0.0019121170043945312, "__label__hardware": 0.0010747909545898438, "__label__health": 0.0018939971923828125, "__label__history": 0.00127410888671875, "__label__home_hobbies": 0.0005393028259277344, "__label__industrial": 0.0008983612060546875, "__label__literature": 0.003757476806640625, "__label__politics": 0.0008006095886230469, "__label__religion": 0.0009074211120605468, "__label__science_tech": 0.1593017578125, "__label__social_life": 0.0015821456909179688, "__label__software": 0.0207672119140625, "__label__software_dev": 0.62255859375, "__label__sports_fitness": 0.0007305145263671875, "__label__transportation": 0.0010747909545898438, "__label__travel": 0.0004773139953613281}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 75210, 0.02272]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 75210, 0.40623]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 75210, 0.93256]], "google_gemma-3-12b-it_contains_pii": [[0, 5362, false], [5362, 11683, null], [11683, 18199, null], [18199, 24633, null], [24633, 30812, null], [30812, 39575, null], [39575, 56457, null], [56457, 62844, null], [62844, 67956, null], [67956, 75210, null]], "google_gemma-3-12b-it_is_public_document": [[0, 5362, true], [5362, 11683, null], [11683, 18199, null], [18199, 24633, null], [24633, 30812, null], [30812, 39575, null], [39575, 56457, null], [56457, 62844, null], [62844, 67956, null], [67956, 75210, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 75210, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 75210, null]], "pdf_page_numbers": [[0, 5362, 1], [5362, 11683, 2], [11683, 18199, 3], [18199, 24633, 4], [24633, 30812, 5], [30812, 39575, 6], [39575, 56457, 7], [56457, 62844, 8], [62844, 67956, 9], [67956, 75210, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 75210, 0.24887]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
8eea6c09bb240f9c4a8d8e88ca6f235f50486087
|
[REMOVED]
|
{"Source-Url": "http://www.cs.utexas.edu/users/vl/papers/yurifest.pdf", "len_cl100k_base": 13504, "olmocr-version": "0.1.50", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 80914, "total-output-tokens": 16089, "length": "2e13", "weborganizer": {"__label__adult": 0.0003609657287597656, "__label__art_design": 0.0004949569702148438, "__label__crime_law": 0.0005960464477539062, "__label__education_jobs": 0.0024471282958984375, "__label__entertainment": 0.00010406970977783204, "__label__fashion_beauty": 0.00018715858459472656, "__label__finance_business": 0.000415802001953125, "__label__food_dining": 0.0005850791931152344, "__label__games": 0.0012865066528320312, "__label__hardware": 0.00106048583984375, "__label__health": 0.000751495361328125, "__label__history": 0.0003345012664794922, "__label__home_hobbies": 0.0002053976058959961, "__label__industrial": 0.0007748603820800781, "__label__literature": 0.0005259513854980469, "__label__politics": 0.0003764629364013672, "__label__religion": 0.0006208419799804688, "__label__science_tech": 0.1265869140625, "__label__social_life": 0.00012803077697753906, "__label__software": 0.01251220703125, "__label__software_dev": 0.84814453125, "__label__sports_fitness": 0.00032639503479003906, "__label__transportation": 0.0007615089416503906, "__label__travel": 0.00019729137420654297}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 46127, 0.02445]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 46127, 0.70403]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 46127, 0.8269]], "google_gemma-3-12b-it_contains_pii": [[0, 2228, false], [2228, 5326, null], [5326, 7996, null], [7996, 10525, null], [10525, 13375, null], [13375, 15549, null], [15549, 18720, null], [18720, 20458, null], [20458, 23098, null], [23098, 25262, null], [25262, 27453, null], [27453, 29542, null], [29542, 31458, null], [31458, 33742, null], [33742, 35505, null], [35505, 37686, null], [37686, 39789, null], [39789, 41815, null], [41815, 44036, null], [44036, 46127, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2228, true], [2228, 5326, null], [5326, 7996, null], [7996, 10525, null], [10525, 13375, null], [13375, 15549, null], [15549, 18720, null], [18720, 20458, null], [20458, 23098, null], [23098, 25262, null], [25262, 27453, null], [27453, 29542, null], [29542, 31458, null], [31458, 33742, null], [33742, 35505, null], [35505, 37686, null], [37686, 39789, null], [39789, 41815, null], [41815, 44036, null], [44036, 46127, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 46127, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 46127, null]], "pdf_page_numbers": [[0, 2228, 1], [2228, 5326, 2], [5326, 7996, 3], [7996, 10525, 4], [10525, 13375, 5], [13375, 15549, 6], [15549, 18720, 7], [18720, 20458, 8], [20458, 23098, 9], [23098, 25262, 10], [25262, 27453, 11], [27453, 29542, 12], [29542, 31458, 13], [31458, 33742, 14], [33742, 35505, 15], [35505, 37686, 16], [37686, 39789, 17], [39789, 41815, 18], [41815, 44036, 19], [44036, 46127, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 46127, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
1a2a65ce20e1a985e0e1488e729a7dc6ada51503
|
License
Usage & Distribution
This work is FREE for educational and non-commercial use. Non-commercial redistribution of the work is permitted so long as all license and all copyright notices are retained and respected. Commercial redistribution of the work or derivative of the work in any form is prohibited unless prior permission is obtained from the copyright holder.
Trademarks
All uses of terms that are known trademarks or service marks have been appropriately capitalized. The Publisher cannot attest to the accuracy of this information. Use of terms within this work should not be regarded as affecting the validity of any trademark or service mark. All Trademarks are the property of their respective owners.
Disclaimer
The information provided is on an “As-Is” basis. The Author and Publisher shall have neither liability nor responsibility to any person or entity with respect to the loss or damages arising from the information contained in this work. This work may include inaccuracies or typographical errors and solely represent the opinions of the Author. Changes are periodically made to this document without notice.
Any action related to this work will be governed by Texas law and controlling U.S. federal law. No choice of law rules of any jurisdiction will apply.
The Author reserves the right to revise these terms at any time without notice.
Revision History
<table>
<thead>
<tr>
<th>Version</th>
<th>Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.0</td>
<td>03/01/2004</td>
<td>Created.</td>
</tr>
<tr>
<td>1.01</td>
<td>05/09/2004</td>
<td>Added more Language Usage.</td>
</tr>
<tr>
<td>1.02</td>
<td>05/09/2004</td>
<td>Added code examples.</td>
</tr>
<tr>
<td>1.03</td>
<td>05/09/2004</td>
<td>Changed formatting and organization.</td>
</tr>
<tr>
<td>1.04</td>
<td>05/09/2004</td>
<td>Misc. grammar and syntax changes.</td>
</tr>
<tr>
<td>1.05</td>
<td>05/10/2004</td>
<td>Updated Naming Conventions.</td>
</tr>
<tr>
<td>1.06</td>
<td>05/10/2004</td>
<td>Misc. adjustments to various rules.</td>
</tr>
<tr>
<td>1.08</td>
<td>05/20/2004</td>
<td>Split .NET guidelines into separate document.</td>
</tr>
<tr>
<td>1.10</td>
<td>05/25/2004</td>
<td>Modified naming conventions for Internal and Protected identifiers. Added, modified, & removed misc rules. Corrected grammar, code, and some verbiage.</td>
</tr>
</tbody>
</table>
Table of Contents
1. Introduction ....................................................................................................................................................... 1
1.1 Scope ......................................................................................................................................................... 1
1.2 Document Conventions .............................................................................................................................. 1
1.3 Terminology & Definitions .......................................................................................................................... 2
1.4 Quick Summary .......................................................................................................................................... 3
1.4.1 Naming Conventions ......................................................................................................................... 3
1.4.2 Coding Style ...................................................................................................................................... 3
1.4.3 Language Usage ............................................................................................................................... 4
2. Naming Conventions ........................................................................................................................................ 5
2.1 General Guidelines..................................................................................................................................... 5
2.2 Name Usage & Syntax ............................................................................................................................... 6
3. Coding Style ...................................................................................................................................................... 9
3.1 Formatting .................................................................................................................................................. 9
3.2 Code Commenting ................................................................................................................................... 10
4. Language Usage............................................................................................................................................. 11
4.1 General..................................................................................................................................................... 11
4.2 Variables & Types .................................................................................................................................... 11
4.3 Flow Control ............................................................................................................................................. 12
4.4 Exception Handling .................................................................................................................................. 13
4.5 Events, Delegates, & Threading .............................................................................................................. 14
4.6 Object Composition .................................................................................................................................. 15
5. Object Model Design ...................................................................................................................................... 17
6. References...................................................................................................................................................... 18
1. Introduction
This document describes rules and recommendations for developing applications and class libraries using the C# Language. The goal is to define guidelines to enforce consistent style and formatting and help developers avoid common pitfalls and mistakes.
Specifically, this document covers Naming Conventions, Coding Style, Language Usage, and Object Model Design.
1.1 Scope
This document only applies to the C# Language and the .NET Framework Common Type System (CTS) it implements. Although the C# language is implemented alongside the .NET Framework, this document does not address usage of .NET Framework class libraries. However, common patterns and problems related to C#'s usage of the .NET Framework are addressed in a limited fashion.
Even though standards for curly-braces ( { or } ) and white space (tabs vs. spaces) are always controversial, these topics are addressed here to ensure greater consistency and maintainability of source code.
1.2 Document Conventions
Much like the ensuing coding standards, this document requires standards in order to ensure clarity when stating the rules and guidelines. Certain conventions are used throughout this document to add emphasis.
Below are some of the common conventions used throughout this document.
Coloring & Emphasis:
Blue Text colored blue indicates a C# keyword or .NET type.
Bold Text with additional emphasis to make it stand-out.
Keywords:
Always Emphasizes this rule must be enforced.
Never Emphasizes this action must not happen.
Do Not Emphasizes this action must not happen.
Avoid Emphasizes that the action should be prevented, but some exceptions may exist.
Try Emphasizes that the rule should be attempted whenever possible and appropriate.
Example Precedes text used to illustrate a rule or recommendation.
Reason Explains the thoughts and purpose behind a rule or recommendation.
http://weblogs.asp.net/lhunt/
1.3 Terminology & Definitions
The following terminology is referenced throughout this document:
**Access Modifier**
C# keywords `public`, `protected`, `internal`, and `private` declare the allowed code-accessibility of types and their members. Although default access modifiers vary, classes and most other members use the default of `private`. Notable exceptions are interfaces and enums which both default to public.
**Camel Case**
A word with the first letter lowercase, and the first letter of each subsequent word-part capitalized.
Example: `customerName`
**Common Type System**
The .NET Framework common type system (CTS) defines how types are declared, used, and managed. All native C# types are based upon the CTS to ensure support for cross-language integration.
**Identifier**
A developer defined token used to uniquely name a declared object or object instance.
Example: `public class MyClassNameIdentifier { ... }`
**Magic Number**
Any numeric literal used within an expression (or to initialize a variable) that does not have an obvious or well-known meaning. This usually excludes the integers 0 or 1 and any other numeric equivalent precision that evaluates as zero.
**Pascal Case**
A word with the first letter capitalized, and the first letter of each subsequent word-part capitalized.
Example: `CustomerName`
**Premature Generalization**
As it applies to object model design; this is the act of creating abstractions within an object model not based upon concrete requirements or a known future need for the abstraction. In simplest terms: “Abstraction for the sake of Abstraction.”
1.4 Quick Summary
This section contains tables describing a high-level summary of the major standards covered in this document. These tables are not comprehensive, but give a quick glance at commonly referenced elements.
1.4.1 Naming Conventions
<table>
<thead>
<tr>
<th>Identifier</th>
<th>Public</th>
<th>Protected</th>
<th>Internal</th>
<th>Private</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>Project File</td>
<td>P</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>Match Assembly & Namespace.</td>
</tr>
<tr>
<td>Source File</td>
<td>P</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>Match contained class.</td>
</tr>
<tr>
<td>Other Files</td>
<td>P</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>Apply where possible.</td>
</tr>
<tr>
<td>Namespace</td>
<td>P</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>Partial Project/Assembly match.</td>
</tr>
<tr>
<td>Class or Struct</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>Add suffix of subclass.</td>
</tr>
<tr>
<td>Interface</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>Prefix with a capital I.</td>
</tr>
<tr>
<td>Generic Class</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>Use T or K as Type identifier.</td>
</tr>
<tr>
<td>Method</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>Use a Verb or Verb-Object pair.</td>
</tr>
<tr>
<td>Property</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>Do not prefix with Get or Set.</td>
</tr>
<tr>
<td>Field</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>_c</td>
<td>Only use Private fields. No Hungarian Notation!</td>
</tr>
<tr>
<td>Constant</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>_c</td>
<td>Only use Private fields.</td>
</tr>
<tr>
<td>Static Field</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>_c</td>
<td>Only use Private fields.</td>
</tr>
<tr>
<td>Enum</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>_c</td>
<td>Options are also PascalCase.</td>
</tr>
<tr>
<td>Delegate</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td></td>
</tr>
<tr>
<td>Event</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td>P</td>
<td></td>
</tr>
<tr>
<td>Inline Variable</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>c</td>
<td>Avoid single-character and enumerated names.</td>
</tr>
<tr>
<td>Parameter</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>c</td>
<td></td>
</tr>
</tbody>
</table>
1.4.2 Coding Style
<table>
<thead>
<tr>
<th>Code</th>
<th>Style</th>
</tr>
</thead>
<tbody>
<tr>
<td>Source Files</td>
<td>One Namespace per file and one class per file.</td>
</tr>
<tr>
<td>Curly Braces</td>
<td>On new line. Always use braces when optional.</td>
</tr>
<tr>
<td>Indentation</td>
<td>Use tabs with size of 4.</td>
</tr>
<tr>
<td>Comments</td>
<td>Use // or /// but not */ ... */ and do not flowerbox.</td>
</tr>
<tr>
<td>Variables</td>
<td>One variable per declaration.</td>
</tr>
</tbody>
</table>
1.4.3 Language Usage
<table>
<thead>
<tr>
<th>Code</th>
<th>Style</th>
</tr>
</thead>
<tbody>
<tr>
<td>Native Data Types</td>
<td>Use built-in C# native data types vs .NET CTS types. (Use <code>int</code> NOT <code>Int32</code>)</td>
</tr>
<tr>
<td>Enums</td>
<td>Avoid changing default type.</td>
</tr>
<tr>
<td>Generics</td>
<td>Prefer Generic Types over standard or strong-typed classes.</td>
</tr>
<tr>
<td>Properties</td>
<td>Never prefix with <code>Get</code> or <code>Set</code>.</td>
</tr>
<tr>
<td>Methods</td>
<td>Use a maximum of 7 parameters.</td>
</tr>
<tr>
<td>base and this</td>
<td>Use only in constructors or within an override.</td>
</tr>
<tr>
<td>Ternary conditions</td>
<td>Avoid complex conditions.</td>
</tr>
<tr>
<td>foreach statements</td>
<td>Do not modify enumerated items within a <code>foreach</code> statement.</td>
</tr>
<tr>
<td>Conditionals</td>
<td>Avoid evaluating Boolean conditions against <code>true</code> or <code>false</code>.</td>
</tr>
<tr>
<td></td>
<td>No embedded assignment.</td>
</tr>
<tr>
<td></td>
<td>Avoid embedded method invocation.</td>
</tr>
<tr>
<td>Exceptions</td>
<td>Do not use exceptions for flow control.</td>
</tr>
<tr>
<td></td>
<td>Use <code>throw;</code> not <code>throw e;</code> when re-throwing.</td>
</tr>
<tr>
<td></td>
<td>Only catch what you can handle.</td>
</tr>
<tr>
<td></td>
<td>Use validation to avoid exceptions.</td>
</tr>
<tr>
<td></td>
<td>Derive from <code>Exception</code> not <code>ApplicationException</code>.</td>
</tr>
<tr>
<td>Events</td>
<td>Always check for null before invoking.</td>
</tr>
<tr>
<td>Locking</td>
<td>Use <code>lock()</code> not <code>Monitor.Enter()</code>.</td>
</tr>
<tr>
<td></td>
<td>Do not lock on an object type or "this".</td>
</tr>
<tr>
<td></td>
<td>Do lock on private objects.</td>
</tr>
<tr>
<td>Dispose() & Close()</td>
<td>Always invoke them if offered, declare where needed.</td>
</tr>
<tr>
<td>Finalizers</td>
<td>Avoid.</td>
</tr>
<tr>
<td></td>
<td>Use the C# Destructors.</td>
</tr>
<tr>
<td></td>
<td>Do not create <code>Finalize()</code> method.</td>
</tr>
<tr>
<td>AssemblyVersion</td>
<td>Increment manually.</td>
</tr>
<tr>
<td>ComVisibleAttribute</td>
<td>Set to <code>false</code> for all assemblies.</td>
</tr>
</tbody>
</table>
http://weblogs.asp.net/lhunt/
2. Naming Conventions
Consistency is the key to maintainable code. This statement is most true for naming your projects, source files, and identifiers including Fields, Variables, Properties, Methods, Parameters, Classes, Interfaces, and Namespaces.
2.1 General Guidelines
1. Always use Camel Case or Pascal Case names.
2. Avoid ALL CAPS and all lowercase names. Single lowercase words or letters are acceptable.
3. Do not create namespaces, classes, methods, properties, fields, or parameters that vary only by capitalization.
4. Do not use names that begin with a numeric character.
5. Always choose meaningful and specific names.
6. Always err on the side of verbosity not terseness.
7. Variables and Properties should describe an entity not the type or size.
8. Do not use Hungarian Notation!
Example: strName or iCount
9. Avoid using abbreviations unless the full name is excessive.
10. Avoid abbreviations longer than 5 characters.
11. Any Abbreviations must be widely known and accepted.
12. Use uppercase for two-letter abbreviations, and Pascal Case for longer abbreviations.
13. Do not use C# reserved words as names.
14. Avoid naming conflicts with existing .NET Framework namespaces, or types.
15. Avoid adding redundant or meaningless prefixes and suffixes to identifiers
Example:
```
// Bad!
public enum ColorsEnum {...}
public class CVehicle {...}
public struct RectangleStruct {...}
```
16. Do not include the parent class name within a property name.
Example: Customer.Name NOT Customer.CustomerName
17. Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
18. Append computational qualifiers to variable names like Average, Count, Sum, Min, and Max where appropriate.
19. When defining a root namespace, use a Product, Company, or Developer Name as the root.
Example: LanceHunt.StringUtilities
# 2.2 Name Usage & Syntax
<table>
<thead>
<tr>
<th>Identifier</th>
<th>Naming Convention</th>
</tr>
</thead>
</table>
| Project File | **Pascal Case.**
| | Always match Assembly Name & Root Namespace. |
| | **Example:**
| | LanceHunt.web.csproj -> LanceHunt.web.dll -> `namespace LanceHunt` |
| Source File | **Pascal Case.**
| | Always match Class name and file name. |
| | Avoid including more than one `Class, Enum` (global), or `Delegate` (global) per file. Use a descriptive file name when containing multiple `Class, Enum,` or `Delegates.` |
| | **Example:**
| | `MyClass.cs` => `public class MyClass
| | `{...}` |
| Resource or Embedded File | Try to use Pascal Case. |
| | Use a name describing the file contents. |
| Namespace | **Pascal Case.**
| | Try to partially match `Project/Assembly Name`. |
| | **Example:**
| | `namespace LanceHunt.Web
| | `{...}` |
| Class or Struct | **Pascal Case.**
| | Use a noun or noun phrase for class name. |
| | Add an appropriate class-suffix when sub-classing another type when possible. |
| | **Examples:**
| | `private class MyClass
| | `{...}
| | `internal class SpecializedAttribute : Attribute
| | `{...}
| | `public class CustomerCollection : CollectionBase
| | `{...}
| | `public class CustomEventArgs : EventArgs
| | `{...}
| | `private struct ApplicationSettings
| | `{...}` |
| Interface | **Pascal Case.**
| | Always prefix interface name with capital “I”. |
| | **Example:**
| | `interface ICustomer
<p>| | <code>{...}</code> |</p>
<table>
<thead>
<tr>
<th>Generic Class & Generic Parameter Type</th>
<th>Always use a single capital letter, such as \text{T} or \text{K}.</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Example:</strong></td>
<td>public class FifoStack\text<T></td>
</tr>
<tr>
<td></td>
<td>{</td>
</tr>
<tr>
<td></td>
<td>public void Push\text<T> obj</td>
</tr>
<tr>
<td></td>
<td>{...}</td>
</tr>
<tr>
<td></td>
<td>public \text<T> Pop()</td>
</tr>
<tr>
<td></td>
<td>{...}</td>
</tr>
<tr>
<td></td>
<td>}</td>
</tr>
<tr>
<td>Method</td>
<td>Pascal Case.</td>
</tr>
<tr>
<td></td>
<td>Try to use a \text{Verb} or \text{Verb-Object} pair.</td>
</tr>
<tr>
<td><strong>Example:</strong></td>
<td>public void Execute() {...}</td>
</tr>
<tr>
<td></td>
<td>private string GetAssemblyVersion(Assembly target) {...}</td>
</tr>
<tr>
<td>Property</td>
<td>Pascal Case.</td>
</tr>
<tr>
<td></td>
<td>Property name should represent the entity it returns. Never prefix property names with “Get” or “Set”.</td>
</tr>
<tr>
<td><strong>Example:</strong></td>
<td>public string Name</td>
</tr>
<tr>
<td></td>
<td>{</td>
</tr>
<tr>
<td></td>
<td>get{...}</td>
</tr>
<tr>
<td></td>
<td>set{...}</td>
</tr>
<tr>
<td></td>
<td>}</td>
</tr>
<tr>
<td>Field (Public, Protected, or Internal)</td>
<td>Pascal Case.</td>
</tr>
<tr>
<td></td>
<td>Avoid using non-private Fields! Use Properties instead.</td>
</tr>
<tr>
<td><strong>Example:</strong></td>
<td>public string Name;</td>
</tr>
<tr>
<td></td>
<td>protected \text{IList} InnerList;</td>
</tr>
<tr>
<td>Field (Private)</td>
<td>Camel Case and prefix with a single underscore (_) character.</td>
</tr>
<tr>
<td><strong>Example:</strong></td>
<td>private string _name;</td>
</tr>
<tr>
<td>Constant or Static Field</td>
<td>Treat like a Field.</td>
</tr>
<tr>
<td></td>
<td>Choose appropriate Field access-modifier above.</td>
</tr>
<tr>
<td>Enum</td>
<td>Pascal Case (both the Type and the Options). Add the \text{FlagsAttribute} to bit-mask multiple options.</td>
</tr>
<tr>
<td><strong>Example:</strong></td>
<td>public enum CustomerTypes</td>
</tr>
<tr>
<td></td>
<td>{</td>
</tr>
<tr>
<td></td>
<td>Consumer,</td>
</tr>
<tr>
<td></td>
<td>Commercial</td>
</tr>
<tr>
<td></td>
<td>}</td>
</tr>
<tr>
<td>Delegate or Event</td>
<td>Treat as a Field. Choose appropriate Field access-modifier above.</td>
</tr>
<tr>
<td>--------------------</td>
<td>-------------------------------------------------------------</td>
</tr>
</tbody>
</table>
| | **Example:**
| | `public event EventHandler LoadPlugin;` |
| Variable (inline) | Camel Case. Avoid using single characters like “x” or “y” except in FOR loops. |
| | Avoid enumerating variable names like `text1, text2, text3` etc. |
| Parameter | Camel Case. |
| | **Example:**
| | `public void Execute(string commandText, int iterations) {...}` |
3. Coding Style
Coding style causes the most inconsistency and controversy between developers. Each developer has a preference, and rarely are two the same. However, consistent layout, format, and organization are key to creating maintainable code. The following sections describe the preferred way to implement C# source code in order to create readable, clear, and consistent code that is easy to understand and maintain.
3.1 Formatting
1. Never declare more than 1 namespace per file.
2. Avoid putting multiple classes in a single file.
3. Always place curly braces ({ and }) on a new line.
4. Always use curly braces ({ and }) in conditional statements.
5. Always use a Tab & Indention size of 4.
6. Declare each variable independently — not in the same statement.
7. Place namespace “using” statements together at the top of file. Group .NET namespaces above custom namespaces.
8. Group internal class implementation by type in the following order:
a. Member variables.
b. Constructors & Finalizers.
c. Nested Enums, Structs, and Classes.
d. Properties
e. Methods
9. Sequence declarations within type groups based upon access modifier and visibility:
a. Public
b. Protected
c. Internal
d. Private
10. Segregate interface implementation by using #region statements.
11. Append folder-name to namespace for source files within sub-folders.
12. Recursively indent all code blocks contained within braces.
13. Use white space (CR/LF, Tabs, etc) liberally to separate and organize code.
14. Avoid declaring multiple attribute declarations within a single line. Instead stack each attribute as a separate declaration.
Example:
```csharp
// Bad!
[Attribute1, Attribute2, Attribute3]
public class MyClass
{...}
// Good!
[Attribute1]
[Attribute2]
[Attribute3]
public class MyClass
{...}
```
15. Place Assembly scope attribute declarations on a separate line.
16. Place Type scope attribute declarations on a separate line.
17. Place Method scope attribute declarations on a separate line.
18. Place Member scope attribute declarations on a separate line.
19. Place Parameter attribute declarations inline with the parameter.
20. If in doubt, always err on the side of clarity and consistency.
3.2 Code Commenting
21. All comments should be written in U.S. English.
22. Use // or /// but never /* ... */
23. Do not “flowerbox” comment blocks.
**Example:**
```
// **************************************************************
// Comment block
// **************************************************************
```
24. Use inline-comments to explain assumptions, known issues, and algorithm insights.
25. Do not use inline-comments to explain obvious code. Well written code is self documenting.
26. Only insert inline-comments for Bad Code to say “fix this code” – otherwise, rewrite it!
27. Include Task-List keyword flags to enable comment-filtering.
**Example:**
```
// TODO: Place Database Code Here
// UNDONE: Removed P\Invoke Call due to errors
// HACK: Temporary fix until able to refactor
```
28. Always apply C# comment-blocks (///) to `public`, `protected`, and `internal` declarations.
29. Only use C# comment-blocks for documenting the API.
30. Always include `<summary>` comments. Include `<param>`, `<return>`, and `<exception>` comment sections where applicable.
31. Include `<see cref=""/>` and `<seealso cref=""/>` where possible.
32. Always add `CDATA` tags to comments containing code and other embedded markup in order to avoid encoding issues.
**Example:**
```
///</example>
/// Add the following key to the “appSettings” section of your config:
/// <code><![CDATA[
/// <configuration>
/// <appSettings>
/// <add key="mySetting" value="myValue"/>
/// </appSettings>
/// </configuration>
/// ]]></code>
///</example>
```
4. Language Usage
4.1 General
1. Do not omit access modifiers. Explicitly declare all identifiers with the appropriate access modifier instead of allowing the default.
Example:
```csharp
// Bad!
void WriteEvent(string message)
{
}
// Good!
private void WriteEvent(string message)
{
}
2. Do not use the default ("1.0.*") versioning scheme. Increment the AssemblyVersionAttribute value manually.
3. Set the ComVisibleAttribute to false for all assemblies. Afterwards, selectively enable the ComVisibleAttribute for individual classes as needed.
Example:
```csharp
[assembly: ComVisible(false)]
[ ComVisible(true)]
public MyClass
{
}
4. Consider factoring classes with unsafe code blocks into a separate assembly.
5. Avoid mutual references between assemblies.
4.2 Variables & Types
6. Try to initialize variables where you declare them.
7. Use the simplest data type, list, or object required. For example, use int over Long unless you know you need to store 64bit values.
8. Always use the built-in C# data type aliases, not the .NET common type system (CTS).
Example:
```csharp
short NOT System.Int16
int NOT System.Int32
long NOT System.Int64
string NOT System.String
9. Only declare member variables as private. Use properties to provide access to them with public, protected, or internal access modifiers.
10. Avoid specifying a type for an enum - use default of int unless you have an explicit need for long.
11. Avoid using inline numeric literals (magic numbers). Instead, use a Constant or Enum.
12. Avoid declaring inline string literals. Instead use Constants, Resources, Registry or other data sources.
13. Only declare constants for simple types.
14. Declare readonly or static readonly variables instead of constants for complex types.
15. Avoid direct casts. Instead, use the “as” operator and check for null.
Example:
```csharp
object dataObject = LoadData();
DataSet ds = dataObject as DataSet;
if (ds != null)
{
}
```
16. Always prefer C# Generic collection types over standard or strong-typed collections.
17. Always explicitly initialize arrays of reference types using a for loop.
18. Avoid boxing and unboxing value types.
Example:
```csharp
int count = 1;
object refCount = count; // Implicitly boxed.
int newCount = (int)refCount; // Explicitly unboxed.
```
19. Floating point values should include at least one digit before the decimal place and one after.
Example: totalPercent = 0.05;
20. Try to use the “@” prefix for string literals instead of escaped strings.
22. Never concatenate strings inside a loop.
23. Do not compare strings to String.Empty or “” to check for empty strings. Instead, check by using String.Length == 0.
Example: (ToLower() creates a temp string)
```csharp
// Bad!
int id = -1;
string name = “lance hunt”;
for (int i = 0; i < customerList.Count; i++)
{
if (customerList[i].Name.ToLower() == name)
{
id = customerList[i].ID;
}
}
// Good!
int id = -1;
string name = “lance hunt”;
for (int i = 0; i < customerList.Count; i++)
{
// The “ignoreCase = true” argument performs a case-insensitive compare without new allocation.
if (String.Compare(customerList[i].Name, name, true) == 0)
{
id = customerList[i].ID;
}
}
```
4.3 Flow Control
25. Avoid invoking methods within a conditional expression.
26. Avoid creating recursive methods. Use loops or nested loops instead.
27. Avoid using foreach to iterate over immutable value-type collections. E.g. String arrays.
28. Do not modify enumerated items within a foreach statement.
29. Use the ternary conditional operator only for trivial conditions. Avoid complex or compound ternary operations.
Example: int result = isValid ? 9 : 4;
30. Avoid evaluating Boolean conditions against true or false.
Example:
```csharp
// Bad!
if (isValid == true)
{ ... }
// Good!
if (isValid)
{ ... }
```
31. Avoid assignment within conditional statements.
Example: if((i==2)==2) {...}
32. Avoid compound conditional expressions – use Boolean variables to split parts into multiple manageable expressions.
Example:
```csharp
// Bad!
if (((value > _highScore) && (value != _highScore)) && (value < _maxScore))
{ ... }
// Good!
isHighScore = (value >= _highScore);
isTiedHigh = (value == _highScore);
isValid = (value < _maxValue);
if ((isHighScore && !isTiedHigh) && isValid)
{ ... }
```
33. Avoid explicit Boolean tests in conditionals.
Example:
```csharp
// Bad!
if(IsValid == true)
{ ... };
// Good!
if(IsValid)
{ ... }
```
34. Only use switch/case statements for simple operations with parallel conditional logic.
35. Prefer nested if/else over switch/case for short conditional sequences and complex conditions.
36. Prefer polymorphism over switch/case to encapsulate and delegate complex operations.
4.4 Exception Handling
37. Do not use try/catch blocks for flow-control.
38. Only catch exceptions that you can handle.
39. Never declare an empty catch block.
40. Avoid nesting a try/catch within a catch block.
41. Use exception filters where possible.
42. Order exception filters from most to least derived exception type.
43. Avoid re-throwing an exception. Allow it to bubble-up instead.
44. If re-throwing an exception, omit the exception argument from the throw statement so the original call stack is preserved.
**Example:**
```csharp
// Bad!
catch (Exception ex)
{
Log(ex);
throw ex;
}
// Good!
catch (Exception ex)
{
Log(ex);
throw;
}
```
45. Only use the finally block to release resources from a try statement.
46. Always use validation to avoid exceptions.
**Example:**
```csharp
// Bad!
try
{
conn.Close();
}
catch (Exception ex)
{
// handle exception if already closed!
}
// Good!
if (conn.State != ConnectionState.Closed)
{
conn.Close();
}
```
47. Avoid defining custom exception classes. Use existing exception classes instead.
48. When a custom exception is required:
a. Always derive from Exception not ApplicationException.
b. Always override the ToString() method and String implicit operator to provide serialization.
c. Always implement the Exception Constructor Pattern:
```csharp
public MyCustomException();
public MyCustomException(string message);
public MyCustomException(string message, Exception innerException);
```
49. When throwing a new Exception, always pass the innerException in order to maintain the exception tree & inner call stack.
### 4.5 Events, Delegates, & Threading
50. Always check Event & Delegate instances for null before invoking.
51. Use the default EventHandler and EventArgs for most simple events.
52. Always derive a custom EventArgs class to provide additional data.
53. Use the existing CancelEventArgs class to allow the event subscriber to control events.
54. Always use the “lock” keyword instead of the Monitor type.
55. Only lock on a private or private static object.
\textbf{Example: }\texttt{lock(myVariable);}
56. Avoid locking on a Type.
\textbf{Example: }\texttt{lock(typeof(MyClass));}
57. Avoid locking on the current object instance.
\textbf{Example: }\texttt{lock(this);}
4.6 \textbf{Object Composition}
58. Always declare types explicitly within a namespace. Do not use the default \texttt{"\{global\}" namespace.
59. Avoid declaring methods with more than 7 parameters. Refactor or consider passing a struct or class instead.
60. Do not use the \texttt{"new" keyword to hide members of a derived type.}
61. Only use the \texttt{"base" keyword when invoking a base class constructor or base implementation within an override.}
62. Do not use the \texttt{protected} access modifier in \texttt{sealed} classes.
63. Consider using method overloading instead of the \texttt{params} attribute.
64. Always validate an enumeration variable or parameter value before consuming it. They may contain any value that the underlying Enum type (default \texttt{int}) supports.
\textbf{Example: }\begin{verbatim}
public void Test(BookCategory cat)
{
if (Enum.isDefined(typeof(BookCategory), cat))
{
}
\end{verbatim}
65. Consider overriding \texttt{Equals()} on a \texttt{struct.}
66. Always override the \texttt{Equality Operator \(==\)} when overriding the \texttt{Equals()} method.
67. Always override the \texttt{String Implicit Operator} when overriding the \texttt{ToString()} method.
68. Always call \texttt{Close()} or \texttt{Dispose()} on classes that offer it.
69. Wrap instantiation of \texttt{IDisposable} objects with a \texttt{using} statement to ensure that \texttt{Dispose()} is automatically called.
\textbf{Example: }\begin{verbatim}
using(SqlConnection cn = new SqlConnection(_connectionString))
{
\end{verbatim}
Always implement the **IDisposable** interface & pattern on classes referencing external resources.
**Example:** *(shown with optional Finalizer)*
```csharp
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// Free other state (managed objects).
// Free your own state (unmanaged objects).
// Set large fields to null.
}
// C# finalizer. (optional)
~Base()
{
// Simply call Dispose(false).
Dispose(false);
}
}
```
Avoid implementing a Finalizer.
Never define a `Finalize()` method as a finalizer. Instead use the C# destructor syntax.
**Example**
```csharp
// Good
~MyClass {...}
// Bad
void Finalize(){...}
```
5. Object Model Design
1. Always prefer delegation over inheritance.
2. Avoid “Premature Generalization”. Create abstractions only when the intent is understood.
3. Do the simplest thing that works, then refactor as time permits.
4. Always make object-behavior transparent to API consumers.
5. Always separate presentation layer from business logic.
6. Always prefer interfaces over abstract classes.
7. Try to append the design-pattern name to class names where appropriate.
8. Make members virtual if they are designed and tested for extensibility.
9. Consider using the “sealed” keyword to break the inheritance chain.
10. Refactor! Refactor! Refactor!
6. References
“MSDN: C# Language Specification v1.5”, Scott Wiltamuth & Anders Hejlsberg, Microsoft Corporation, 2003,
“MSDN: Design Guidelines for Class Library Developers”, Microsoft Corporation, 2004,
ISBN: 0735614229
|
{"Source-Url": "http://matrix.umcs.lublin.pl/~pkukawsk/download/csharpstandards.pdf", "len_cl100k_base": 8585, "olmocr-version": "0.1.50", "pdf-total-pages": 21, "total-fallback-pages": 0, "total-input-tokens": 44715, "total-output-tokens": 9350, "length": "2e13", "weborganizer": {"__label__adult": 0.0005369186401367188, "__label__art_design": 0.00035643577575683594, "__label__crime_law": 0.0003426074981689453, "__label__education_jobs": 0.0011072158813476562, "__label__entertainment": 5.543231964111328e-05, "__label__fashion_beauty": 0.00015747547149658203, "__label__finance_business": 0.00030517578125, "__label__food_dining": 0.0003635883331298828, "__label__games": 0.0005249977111816406, "__label__hardware": 0.0004477500915527344, "__label__health": 0.0003261566162109375, "__label__history": 0.00015234947204589844, "__label__home_hobbies": 9.083747863769533e-05, "__label__industrial": 0.00022923946380615232, "__label__literature": 0.0002830028533935547, "__label__politics": 0.0002923011779785156, "__label__religion": 0.00040793418884277344, "__label__science_tech": 0.0006928443908691406, "__label__social_life": 0.00010055303573608398, "__label__software": 0.003559112548828125, "__label__software_dev": 0.98876953125, "__label__sports_fitness": 0.000331878662109375, "__label__transportation": 0.0003368854522705078, "__label__travel": 0.00022614002227783203}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 42670, 0.01515]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 42670, 0.34372]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 42670, 0.63174]], "google_gemma-3-12b-it_contains_pii": [[0, 0, null], [0, 3497, false], [3497, 7234, null], [7234, 9154, null], [9154, 10763, null], [10763, 13870, null], [13870, 16644, null], [16644, 18516, null], [18516, 23265, null], [23265, 26576, null], [26576, 27219, null], [27219, 29482, null], [29482, 31151, null], [31151, 33042, null], [33042, 35046, null], [35046, 36815, null], [36815, 38583, null], [38583, 40484, null], [40484, 41265, null], [41265, 41922, null], [41922, 42670, null]], "google_gemma-3-12b-it_is_public_document": [[0, 0, null], [0, 3497, true], [3497, 7234, null], [7234, 9154, null], [9154, 10763, null], [10763, 13870, null], [13870, 16644, null], [16644, 18516, null], [18516, 23265, null], [23265, 26576, null], [26576, 27219, null], [27219, 29482, null], [29482, 31151, null], [31151, 33042, null], [33042, 35046, null], [35046, 36815, null], [36815, 38583, null], [38583, 40484, null], [40484, 41265, null], [41265, 41922, null], [41922, 42670, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 42670, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 42670, null]], "pdf_page_numbers": [[0, 0, 1], [0, 3497, 2], [3497, 7234, 3], [7234, 9154, 4], [9154, 10763, 5], [10763, 13870, 6], [13870, 16644, 7], [16644, 18516, 8], [18516, 23265, 9], [23265, 26576, 10], [26576, 27219, 11], [27219, 29482, 12], [29482, 31151, 13], [31151, 33042, 14], [33042, 35046, 15], [35046, 36815, 16], [36815, 38583, 17], [38583, 40484, 18], [40484, 41265, 19], [41265, 41922, 20], [41922, 42670, 21]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 42670, 0.2048]]}
|
olmocr_science_pdfs
|
2024-12-02
|
2024-12-02
|
40639c4c3ff9c49cffa1cbb294ce53facd4a1024
|
Lecture 17
Undecidable languages
This lecture focuses on techniques for proving that certain languages are undecidable (or, in some cases, non-semidecidable). The lecture will be divided into two main parts: the first part focuses on undecidability proofs by contradiction, and the second part discusses the notion of a reduction and how undecidability results may be established through them. Along the way we will discuss some useful tricks that can be applied in both settings.
Before proceeding to the first part of the lecture, let us recall that we have fixed an encoding scheme for DSMs, whereby any given DSM $M$ is encoded as a binary string $\langle M \rangle$. In the previous lecture we proved that the language
$$\text{DIAG} = \{ \langle M \rangle : M \text{ is a DSM and } \langle M \rangle \notin L(M) \}$$
(17.1)
is non-semidecidable, and we then used this fact to conclude that the language
$$\text{A}_{\text{DSM}} = \{ \langle \langle M \rangle, \langle w \rangle \rangle : M \text{ is a DSM and } w \in L(M) \}$$
(17.2)
is undecidable (although it is semidecidable). All of the undecidability proofs that appear in this lecture are, in some sense, anchored by the diagonalization proof that DIAG is not semidecidable.
17.1 Undecidability proofs through contradiction
In this section we will see a few more examples of undecidability proofs that have a similar style to the proof we saw in at the end of the previous lecture, through which we concluded that $\text{A}_{\text{DSM}}$ is undecidable. More specifically, we assumed toward contradiction that $\text{A}_{\text{DSM}}$ is decidable, and based on that assumption we constructed a DSM that decided a language (specifically, the language DIAG) that we already knew to be undecidable.
This is the same general pattern that will be used in this section when we wish to prove that a chosen language $A$ is undecidable:
1. Assume toward contradiction that $A$ is decidable.
2. Use that assumption to construct a DSM that decides a language $B$ that we already know to be undecidable.
3. Having obtained a contradiction from the assumption that $A$ is decidable, we conclude that $A$ is undecidable.
A similar approach can sometimes be used to prove that a language $A$ is non-semidecidable, and in both cases we might potentially obtain a contradiction by using our assumption toward contradiction about $A$ to semidecide a language $B$ that we already know to be non-semidecidable (as opposed to deciding a language $B$ that we already know to be undecidable).
Here is an example. Define a language HALT as follows:
$$\text{HALT} = \{ \langle \langle M \rangle, \langle w \rangle \rangle : M \text{ is a DSM that halts on input } w \}.$$ (17.3)
To say that $M$ halts on input $w$ means that it stops, either by accepting or rejecting. Let us agree that the statement “$M$ halts on input $w$” is false in case $w$ contains symbols not in the input alphabet of $M$, just as a matter of terminology.
We will prove that HALT is undecidable, but before we do this let us observe that HALT is semidecidable (just like $A_{\text{DSM}}$). In particular, this language can be semi-decided by a modified version of the universal stack machine $U$ from the previous lecture; the modification is that it accepts both in the case that $M$ accepts $w$ and in the case that $M$ rejects $w$. Of course, when it is the case that $M$ runs forever on $w$, the same will be true of $U$ running on input $\langle \langle M \rangle, \langle w \rangle \rangle$.
**Proposition 17.1.** The language HALT is undecidable.
**Proof.** Assume toward contradiction that HALT is decidable, so that there exists a DSM $T$ that decides it. Define a new DSM $K$ as described in Figure 17.1.
We will conclude that $K$ decides $A_{\text{DSM}}$. Note first that if $K$ is given an input that is not of the form $\langle \langle M \rangle, \langle w \rangle \rangle$, for $M$ a DSM and $w$ a string over the input alphabet of $M$, then it rejects (as a DSM for $A_{\text{DSM}}$ should). Otherwise, when the input to $K$ does take the form $\langle \langle M \rangle, \langle w \rangle \rangle$, for $M$ a DSM and $w$ a string over the input alphabet of $M$, there are three possible cases:
1. If it is the case that $M$ accepts $w$, then $T$ will accept $\langle \langle M \rangle, \langle w \rangle \rangle$ (because $M$ halts on $w$), and the simulation of $M$ on input $w$ will result in acceptance.
2. If it is the case that $M$ rejects $w$, then $T$ will accept $\langle \langle M \rangle, \langle w \rangle \rangle$ (again because $M$ halts on $w$), and the simulation of $M$ on input $w$ will result in rejection.
The DSM $K$ operates as follows on input $x \in \{0, 1\}^*$:
1. If it is not the case that $x = \langle \langle M \rangle, \langle w \rangle \rangle$ for $M$ being a DSM and $w$ being a string over the alphabet of $M$, then reject.
2. Run $T$ on input $\langle \langle M \rangle, \langle w \rangle \rangle$ and reject if $T$ rejects. Otherwise, continue to the next step.
3. Simulate $M$ on input $w$; accept if $M$ accepts and reject if $M$ rejects.
Figure 17.1: A DSM $K$ that decides $A_{DSM}$, assuming that is a DSM that decides $HALT$.
3. If it is the case that $M$ runs forever on $w$, then $T$ will reject $\langle \langle M \rangle, \langle w \rangle \rangle$, and therefore $K$ rejects without running the simulation of $M$ on input $w$.
This, however, is in contradiction with the fact that $A_{DSM}$ is undecidable. Having obtained a contradiction, we conclude that $HALT$ is undecidable.
Next we will consider this language, which is a DSM variant of the languages $E_{DFA}$ and $E_{CFG}$ from Lecture 15:
$$E_{DSM} = \{ \langle M \rangle : M \text{ is a DSM with } L(M) = \emptyset \}. \quad (17.4)$$
We will prove that this language is undecidable, but in order to do this we need to make use of the very simple but remarkably useful trick of hard-coding inputs into DSMs.
Here is the idea. Suppose that we have a DSM $M$ along with a fixed string $w$ over the input alphabet of $M$. Consider a new DSM, which we will call $M_w$, that operates as described in Figure 17.2. (Figure 17.3 illustrates what a state diagram of $M_w$ might look like, assuming $w = a_1 \cdots a_n$.) This may seem like a curious way to define a DSM; the DSM $M_w$ runs the same way regardless of its actual input string $x$, as it always discards this string and runs $M$ on the string $w$, which is “hard-coded” directly into its description. We will see, however, that it is sometimes very useful to consider a DSM defined like this. Let us also note that given an encoding $\langle \langle M \rangle, \langle w \rangle \rangle$ of a DSM $M$ and a string $w$ over the input alphabet of $M$, it is possible to compute an encoding $\langle M_w \rangle$ of the DSM $M_w$ without difficulty.
**Proposition 17.2.** The language $E_{DSM}$ is undecidable.
The DSM $M_w$ operates as follows on input $x$:
1. Ignore the input string $x$ and run $M$ on $w$.
Figure 17.2: For any DSM $M$ and a fixed string $w$, the DSM $M_w$ ignores its input and runs $M$ on the string $w$ (which is hard-coded into $M_w$).
$\xrightarrow{} X \leftarrow \varepsilon$
$\xrightarrow{\text{push } X} a_n \xrightarrow{\text{push } X} a_{n-1} \cdots \xrightarrow{a_2} \text{push } X \xrightarrow{a_1} M$
Figure 17.3: An illustration of a state diagram for $M_w$, assuming $w = a_1 \cdots a_n$. We are also assuming that $X$ refers to the input stack of both $M_w$ and $M$, that the node labeled $X \leftarrow \varepsilon$ refers to the subroutine discussed in Lecture 12, and that the node labeled $M$ refers to the entire description of $M$. Thus, the action of this machine is to delete whatever input string it is given, replace this string with $w$, and allow control to pass to the start state of $M$.
The DSM $K$ operates as follows on input $x$:
1. If it is not the case that $x = \langle \langle M \rangle, \langle w \rangle \rangle$ for $M$ being a DSM and $w$ being a string over the alphabet of $M$, then reject.
2. Compute an encoding $\langle M_w \rangle$ of the DSM $M_w$ described in Figure 17.2.
3. Run $T$ on input $\langle M_w \rangle$. If $T$ accepts $\langle M_w \rangle$, then reject, and otherwise accept.
Figure 17.4: A high-level description of a DSM $K$ that decides $A_{\text{DSM}}$, assuming the existence of a DSM $T$ that decides $E_{\text{DSM}}$.
**Proof.** Assume toward contradiction that $E_{\text{DSM}}$ is decidable, so that there exists a DSM $T$ that decides this language. Define a new DSM $K$ as described in Figure 17.4. We can see from the description of $K$ that it will immediately reject when its input does not have the form $\langle \langle M \rangle, \langle w \rangle \rangle$, for $M$ a DSM and $w$ a string over the input alphabet of $M$. Let us consider what happens for inputs that are of the form
Lecture 17
⟨⟨M⟩, ⟨w⟩⟩, where M a DSM and w is a string over the input alphabet of M.
First, if w ∈ L(M), then the DSM M_w will accept every string over its alphabet; no matter what string it receives as an input, it just erases this string and runs M on w, leading to acceptance. It is therefore certainly not the case that L(M_w) = ∅. This implies that T must reject the string ⟨M_w⟩, and therefore K accepts ⟨⟨M⟩, ⟨w⟩⟩.
On the other hand, if w ∉ L(M), then M_w must either reject every string or run forever on every string for the same reason as before; M_w always discards its input and runs M on w, which either rejects or runs forever. It is therefore the case that L(M_w) = ∅. The DSM T therefore accepts ⟨M_w⟩, so K rejects ⟨⟨M⟩, ⟨w⟩⟩.
Considering the possibilities just analyzed, we find that K decides A_{DSM}, which contradicts the fact that this language is undecidable. We conclude that E_{DSM} is undecidable, as required.
17.2 Proving undecidability through reductions
The second method through which languages may be proved to be undecidable or non-semidecidable makes use of the notion of a reduction.
Reductions
The notion of a reduction is, in fact, very general, and many different types of reductions are considered in theoretical computer science—but for now we will consider just one type of reduction (sometimes called a mapping reduction or many-to-one reduction), which is defined as follows.
Definition 17.3. Let Σ and Γ be alphabets and let A ⊆ Σ^* and B ⊆ Γ^* be languages. It is said that A reduces to B if there exists a computable function f : Σ^* → Γ^* such that
\[ w \in A \iff f(w) \in B \]
for all w ∈ Σ^*. One writes
\[ A \leq_m B \]
to indicate that A reduces to B, and any function f that establishes that this is so may be called a reduction from A to B.
Figure 17.5 illustrates the action of a reduction. Intuitively speaking, a reduction is a way of transforming one computational decision problem into another. Imagine that you receive an input string w ∈ Σ^*, and you wish to determine whether or not w is contained in some language A. Perhaps you do not know how to make this determination, but you happen to have a friend who is able to tell you whether
or not a particular string $y \in \Gamma^*$ is contained in a different language $B$. If you have a reduction $f$ from $A$ to $B$, then you can determine whether or not $w \in A$ using your friend’s help: you compute $y = f(w)$, ask your friend whether or not $y \in B$, and take their answer as your answer to whether or not $w \in A$.
The following theorem has a simple and direct proof, but it will nevertheless have central importance with respect to the way that we use reductions to reason about decidability and semidecidability.
**Theorem 17.4.** Let $\Sigma$ and $\Gamma$ be alphabets, let $A \subseteq \Sigma^*$ and $B \subseteq \Gamma^*$ be languages, and assume $A \leq_m B$. The following two implications hold:
1. If $B$ is decidable, then $A$ is decidable.
2. If $B$ is semidecidable, then $A$ is semidecidable.
**Proof.** Let $f : \Sigma^* \rightarrow \Gamma^*$ be a reduction from $A$ to $B$. We know that such a function exists by the assumption $A \leq_m B$.
We will first prove the second implication. Because $B$ is semidecidable, there must exist a DSM $M_B$ such that $B = L(M_B)$. Define a new DSM $M_A$ as described in Figure 17.6. It is possible to define a DSM in this way because $f$ is a computable function.
For a given input string $w \in A$, we have that $y = f(w) \in B$, because this property is guaranteed by the reduction $f$. When $M_A$ is run on input $w$, it will therefore accept because $M_B$ accepts $y$. Along similar lines, if it is the case that $w \notin A$, then $y = f(w) \notin B$. When $M_A$ is run on input $w$, it will therefore not accept because $M_B$ does not accepts $y$. (It may be that these machines reject or run forever, but we do not care which.) It has been established that $A = L(M_A)$, and therefore $A$ is semidecidable.
Lecture 17
The DSM $M_A$ operates as follows on input $w \in \Sigma^*$:
1. Compute $y = f(w)$.
2. Run $M_B$ on input $y$.
Figure 17.6: Given a reduction $f$ from $A$ to $B$, and assuming the existence of a DSM $M_B$ that either decides or semidecides $B$, the DSM $M_A$ described either decides or semidecides $A$.
The proof for the first implication is almost identical, except that we take $M_B$ to be a DSM that decides $B$. The DSM $M_A$ defined in Figure 17.6 then decides $A$, and therefore $A$ is decidable.
We will soon use this theorem to prove that certain languages are undecidable (or non-semidecidable), but let us first take a moment to observe two useful facts about reductions.
**Proposition 17.5.** Let $\Sigma$, $\Gamma$, and $\Delta$ be alphabets and let $A \subseteq \Sigma^*$, $B \subseteq \Gamma^*$, and $C \subseteq \Delta^*$ be languages. If $A \leq_m B$ and $B \leq_m C$, then $A \leq_m C$. (In words, $\leq_m$ is a transitive relation among languages.)
**Proof.** As $A \leq_m B$ and $B \leq_m C$, there must exist computable functions $f : \Sigma^* \rightarrow \Gamma^*$ and $g : \Gamma^* \rightarrow \Delta^*$ such that
$$w \in A \iff f(w) \in B \quad \text{and} \quad y \in B \iff g(y) \in C \quad (17.7)$$
for all $w \in \Sigma^*$ and $y \in \Gamma^*$.
Define a function $h : \Sigma^* \rightarrow \Delta^*$ as $h(w) = g(f(w))$ for all $w \in \Sigma^*$. It is evident that $h$ is a computable function: if we have DSMs $M_f$ and $M_g$ that compute $f$ and $g$, respectively, then we can obtain a DSM $M_h$ that computes $h$ by first running $M_f$ and then running $M_g$.
It remains to observe that $h$ is a reduction from $A$ to $C$. If $w \in A$, then $f(w) \in B$, and therefore $h(w) = g(f(w)) \in C$; and if $w \notin A$, then $f(w) \notin B$, and therefore $h(w) = g(f(w)) \notin C$. \qed
**Proposition 17.6.** Let $\Sigma$ and $\Gamma$ be alphabets and let $A \subseteq \Sigma^*$ and $B \subseteq \Gamma^*$ be languages. It is the case that $A \leq_m B$ if and only if $\overline{A} \leq_m \overline{B}$.
**Proof.** For a given function $f : \Sigma^* \rightarrow \Gamma^*$ and a string $w \in \Sigma^*$, the statements $w \in A \iff f(w) \in B$ and $w \notin A \iff f(w) \notin B$ are logically equivalent. If we have a reduction $f$ from $A$ to $B$, then the same function also serves as a reduction from $\overline{A}$ to $\overline{B}$, and vice versa. \qed
The DSM $K_M$ operates as follows on input $w \in \Sigma^*$:
1. Run $M$ on input $w$.
1.1 If $M$ accepts $w$ then accept.
1.2 If $M$ rejects $w$, then run forever.
Figure 17.7: Given a DSM $M$, we can easily obtain a DSM $K_M$ that behaves as described by replacing any transitions to the accept state of $M$ with transitions to a state that intentionally causes an infinite loop.
Undecidability through reductions
It is possible to use Theorem 17.4 to prove that certain languages are either decidable or semidecidable, but we will focus mainly on using it to prove that languages are either undecidable or non-semidecidable. When using the theorem in this way, we consider the two implications in the contrapositive form. That is, if two languages $A \subseteq \Sigma^*$ and $B \subseteq \Gamma^*$ satisfy $A \leq_m B$, then the following two implications hold:
1. If $A$ is undecidable, then $B$ is undecidable.
2. If $A$ is non-semidecidable, then $B$ is non-semidecidable.
So, if we want to prove that a particular language $B$ is undecidable, then it suffices to pick any language $A$ that we already know to be undecidable, and then prove $A \leq_m B$. The situation is similar for proving languages to be non-semidecidable. The examples that follow illustrate how this may be done.
Example 17.7 ($A_{DSM} \leq_m \text{HALT}$). The first thing we will need to consider is a simple way of modifying an arbitrary DSM $M$ to obtain a slightly different one. In particular, for an arbitrary DSM $M$, let us define a new DSM $K_M$ as described in Figure 17.7. The idea behind the DSM $K_M$ is very simple: if $M$ accepts a string $w$, then so does $K_M$, if $M$ rejects $w$ then $K_M$ runs forever on $w$, and of course if $M$ runs forever on input $w$ then so does $K_M$. Thus, $K_M$ halts on input $w$ if and only if $M$ accepts $w$. Note that if you are given a description of a DSM $M$, it is very easy to come up with a description of a DSM $K_M$ that operates as suggested: just replace the reject state of $M$ with a new state that purposely causes an infinite loop (by repeatedly pushing a symbol onto some stack, for instance).
Now let us define a function $f : \{0, 1\}^* \rightarrow \{0, 1\}^*$ as follows:
$$f(x) = \begin{cases}
\langle\langle K_M \rangle, \langle w \rangle \rangle & \text{if } x = \langle\langle M \rangle, \langle w \rangle \rangle \text{ for a DSM } M \text{ and a string } w \\
\epsilon & \text{otherwise.}
\end{cases}$$
(17.8)
The function $f$ is computable: all it does is that it essentially looks at an input string, determines whether or not this string is an encoding $\langle\langle M \rangle, \langle w \rangle \rangle$ of a DSM $M$ and a string $w$ over the alphabet of $M$, and if so it replaces the encoding of $M$ with the encoding of the DSM $K_M$ suggested above.
Now let us check to see that $f$ is a reduction from $A_{DSM}$ to $HALT$. Suppose first that we have an input $\langle\langle M \rangle, \langle w \rangle \rangle \in A_{DSM}$. These implications hold:
$$\langle\langle M \rangle, \langle w \rangle \rangle \in A_{DSM} \Rightarrow M \text{ accepts } w \Rightarrow K_M \text{ halts on } w \Rightarrow \langle\langle K_M \rangle, \langle w \rangle \rangle \in HALT \Rightarrow f(\langle\langle M \rangle, \langle w \rangle \rangle) \in HALT.$$
(17.9)
We therefore have
$$\langle\langle M \rangle, \langle w \rangle \rangle \in A_{DSM} \Rightarrow f(\langle\langle M \rangle, \langle w \rangle \rangle) \in HALT,$$
(17.10)
which is half of what we need to verify that $f$ is indeed a reduction from $A_{DSM}$ to $HALT$. It remains to consider the output of the function $f$ on inputs that are not contained in $A_{DSM}$, and here there are two cases: one is that the input takes the form $\langle\langle M \rangle, \langle w \rangle \rangle$ for a DSM $M$ and a string $w$ over the alphabet of $M$, and the other is that it does not. For the first case, we have these implications:
$$\langle\langle M \rangle, \langle w \rangle \rangle \notin A_{DSM} \Rightarrow M \text{ does not accept } w \Rightarrow K_M \text{ runs forever on } w \Rightarrow \langle\langle K_M \rangle, \langle w \rangle \rangle \notin HALT \Rightarrow f(\langle\langle M \rangle, \langle w \rangle \rangle) \notin HALT.$$
(17.11)
The key here is that $K_M$ is defined so that it will definitely run forever in case $M$ does not accept (regardless of whether that happens by $M$ rejecting or running forever). The remaining case is that we have a string $x \in \Sigma^*$ that does not take the form $\langle\langle M \rangle, \langle w \rangle \rangle$ for a DSM $M$ and a string $w$ over the alphabet of $M$, and in this case it trivially holds that $f(x) = \epsilon \notin HALT$ (because $\epsilon$ does not encode any element of $HALT$). We have therefore proved that
$$x \in A_{DSM} \iff f(x) \in HALT,$$
(17.12)
and therefore $A_{DSM} \leq_m HALT$.
9
We already proved that \( \text{HALT} \) is undecidable, but the fact that \( A_{\text{DSM}} \leq_m \text{HALT} \) provides an alternative proof: because we already know that \( A_{\text{DSM}} \) is undecidable, it follows that \( \text{HALT} \) is also undecidable.
It might not seem that there is any advantage to this proof over the proof we saw in the previous lecture that \( \text{HALT} \) is undecidable (which wasn’t particularly difficult). We have, however, established a closer relationship between \( A_{\text{DSM}} \) and \( \text{HALT} \) than we did previously. In general, using a reduction is sometimes an easy shortcut to proving that a language is undecidable (or non-semidecidable).
**Example 17.8** (\( \text{DIAG} \leq_m E_{\text{DSM}} \)). Recall this language, which was defined earlier in the lecture:
\[
E_{\text{DSM}} = \{ \langle M \rangle : M \text{ is a DSM and } L(M) = \emptyset \}. \tag{17.13}
\]
We will now prove that \( \text{DIAG} \leq_m E_{\text{DSM}} \). Because we already know that \( \text{DIAG} \) is non-semidecidable, we conclude from this reduction that \( E_{\text{DSM}} \) is not just undecidable, but in fact it is also non-semidecidable.
For this one we will use the same hardcoding trick that we used earlier in the lecture: for a given DSM \( M \), let us define a new DSM \( M_{\langle M \rangle} \) just like in Figure 17.2, for the specific choice of the string \( w = \langle M \rangle \). This actually only makes sense if the input alphabet of \( M \) includes the symbols \{0, 1\} used in the encoding \( \langle M \rangle \), so let us agree that \( M_{\langle M \rangle} \) immediately rejects if this is not the case.
Now let us define a function \( f : \{0, 1\}^* \rightarrow \{0, 1\}^* \) as follows:
\[
f(x) = \begin{cases}
\langle M_{\langle M \rangle} \rangle & \text{if } x = \langle M \rangle \text{ for a DSM } M \\
\epsilon & \text{otherwise.}
\end{cases} \tag{17.14}
\]
If you think about it for a few moments, it should not be hard to convince yourself that \( f \) is computable. It remains to verify that \( f \) is a reduction from \( \text{DIAG} \) to \( E_{\text{DSM}} \).
For any string \( x \in \text{DIAG} \) we have that \( x = \langle M \rangle \) for some DSM \( M \) that satisfies \( \langle M \rangle \not\in L(M) \). In this case we have that \( f(x) = \langle M_{\langle M \rangle} \rangle \), and because \( \langle M \rangle \not\in L(M) \) it must therefore be that \( M_{\langle M \rangle} \) never accepts, and so \( f(x) = \langle M_{\langle M \rangle} \rangle \in E_{\text{DSM}} \).
Now suppose that \( x \not\in \text{DIAG} \). There are two cases: either \( x = \langle M \rangle \) for a DSM \( M \) such that \( \langle M \rangle \in L(M) \), or \( x \) does not encode a DSM at all. If it is the case that \( x = \langle M \rangle \) for a DSM \( M \) such that \( \langle M \rangle \in L(M) \), we have that \( M_{\langle M \rangle} \) accepts every string over its alphabet, and therefore \( f(x) = \langle M_{\langle M \rangle} \rangle \not\in E_{\text{DSM}} \). If it is the case that \( x \) does not encode a DSM, then it trivially holds that \( f(x) = \epsilon \not\in E_{\text{DSM}} \).
We have proved that
\[
x \in \text{DIAG} \iff f(x) \in E_{\text{DSM}}, \tag{17.15}
\]
so the proof that \( \text{DIAG} \leq_m E_{\text{DSM}} \) is complete.
Example 17.9 \((A_{DSM} \leq_m A_{E})\). Define a language
\[
A_{E} = \{ \langle M \rangle : M \text{ is a DSM that accepts } \varepsilon \}.
\] (17.16)
The name \(A_{E}\) stands for “accepts the empty string.”
To prove this reduction, we can use exactly the same hardcoding trick that we’ve now used twice already. For every DSM \(M\) and every string \(w\) over the alphabet of \(M\), define a new DSM \(M_w\) as in Figure 17.2, and define a function \(f : \{0, 1\}^* \rightarrow \{0, 1\}^*\) as follows:
\[
f(x) = \begin{cases}
\langle M_w \rangle & \text{if } x = \langle \langle M \rangle, \langle w \rangle \rangle \text{ for a DSM } M \text{ and a string } w \\
\varepsilon & \text{otherwise.}
\end{cases}
\] (17.17)
Now let us check that \(f\) is a valid reduction from \(A_{DSM}\) to \(A_{E}\).
First, for any string \(x \in A_{DSM}\) we have \(x = \langle \langle M \rangle, \langle w \rangle \rangle\) for a DSM \(M\) that accepts the string \(w\). In this case, \(f(x) = \langle M_w \rangle\). We have that \(M_w\) accepts every string, including the empty string, because \(M\) accepts \(w\). Therefore \(f(x) = \langle M_w \rangle \in A_{E}\).
Now consider any string \(x \notin A_{DSM}\). Again there are two cases: either \(x = \langle \langle M \rangle, \langle w \rangle \rangle\) for some DSM \(M\) and a string \(w\) over the alphabet of \(M\), or this is not the case. If it is the case that \(x = \langle \langle M \rangle, \langle w \rangle \rangle\) for a DSM \(M\) and \(w\) a string over the alphabet of \(M\), then \(x \notin A_{DSM}\) implies that \(M\) does not accept \(w\). In this case we have \(f(x) = \langle M_w \rangle \notin A_{E}\), because \(M_w\) does not accept any strings at all (including the empty string). If \(x \neq \langle \langle M \rangle, \langle w \rangle \rangle\) for a DSM \(M\) and string \(w\) over the alphabet of \(M\), then \(f(x) = \varepsilon \notin A_{E}\) (again because \(\varepsilon\) does not encode a DSM, and therefore cannot be included in the language \(A_{E}\)).
We have shown that \(x \in A_{DSM} \iff f(x) \in A_{E}\) holds for every string \(x \in \{0, 1\}^*\), and therefore \(A_{DSM} \leq_m A_{E}\), as required.
Example 17.10 \((E_{DSM} \leq_m R_{G})\). The last example for the lecture will be a tough one. Define a language as follows:
\[
R_{G} = \{ \langle M \rangle : M \text{ is a DSM such that } L(M) \text{ is regular} \}.
\] (17.18)
We will prove \(E_{DSM} \leq_m R_{G}\).
We will need to make use of a strange way to modify DSMs in order to do this one. Given an arbitrary DSM \(M\), let us define a new DSM \(K_M\) as in Figure 17.8. This is indeed a strange way to define a DSM, but there’s nothing wrong with strange DSMs—we’re just proving a reduction.
Now let us define a function \(f : \{0, 1\}^* \rightarrow \{0, 1\}^*\) as
\[
f(x) = \begin{cases}
\langle K_M \rangle & \text{if } x = \langle M \rangle \text{ for a DSM } M \\
\varepsilon & \text{otherwise.}
\end{cases}
\] (17.19)
The DSM $K_M$ operates as follows on input $x \in \{0, 1\}^*$:
1. Set $t \leftarrow 1$.
2. For every string $w$ over the input alphabet of $M$ satisfying $|w| \leq t$:
2.1 Run $M$ for $t$ steps on input $w$.
2.2 If $M$ accepts $w$ within $t$ steps, goto 4.
3. Set $t \leftarrow t + 1$ and goto 2.
4. Accept if $x \in \{0^n1^n : n \in \mathbb{N}\}$, reject otherwise.
Figure 17.8: The DSM $K_M$ in Example 17.10.
This is a computable function, and it remains to verify that it is a reduction from $E_{DSM}$ to $REG$.
Suppose $\langle M \rangle \in E_{DSM}$. We therefore have that $L(M) = \emptyset$; and by considering the way that $K_M$ behaves we see that $L(K_M) = \emptyset$ as well (because we never get to step 4 if $M$ never accepts). The empty language is regular, and therefore $f(\langle M \rangle) = \langle K_M \rangle \in REG$.
On the other hand, if $M$ is a DSM and $\langle M \rangle \not\in E_{DSM}$, then $M$ must accept at least one string. This means that $L(K_M) = \{0^n1^n : n \in \mathbb{N}\}$, because $K_M$ will eventually find a string accepted by $M$, reach step 4, and then accept or reject based on whether the input string $x$ is contained in the nonregular language
$$\{0^n1^n : n \in \mathbb{N}\}.$$ (17.20)
Therefore $f(\langle M \rangle) = \langle K_M \rangle \not\in REG$. The remaining case, in which $x$ does not encode a DSM, is straightforward as usual: we have $f(x) = \varepsilon \not\in REG$ in this case.
We have shown that $x \in E_{DSM} \iff f(x) \in REG$ holds for every string $x \in \{0, 1\}^*$, and therefore $E_{DSM} \leq_m REG$, as required. We conclude that the language $REG$ is non-semidecidable, as we already know that $E_{DSM}$ is non-semidecidable.
|
{"Source-Url": "https://cs.uwaterloo.ca/~watrous/CS360/Lectures/17.pdf", "len_cl100k_base": 8518, "olmocr-version": "0.1.53", "pdf-total-pages": 12, "total-fallback-pages": 0, "total-input-tokens": 44433, "total-output-tokens": 9336, "length": "2e13", "weborganizer": {"__label__adult": 0.0006060600280761719, "__label__art_design": 0.0005950927734375, "__label__crime_law": 0.0005826950073242188, "__label__education_jobs": 0.0027027130126953125, "__label__entertainment": 0.00024580955505371094, "__label__fashion_beauty": 0.0002751350402832031, "__label__finance_business": 0.0002918243408203125, "__label__food_dining": 0.0009174346923828124, "__label__games": 0.0017194747924804688, "__label__hardware": 0.0016069412231445312, "__label__health": 0.0011119842529296875, "__label__history": 0.0005550384521484375, "__label__home_hobbies": 0.0001875162124633789, "__label__industrial": 0.0009183883666992188, "__label__literature": 0.0017309188842773438, "__label__politics": 0.000514984130859375, "__label__religion": 0.0011892318725585938, "__label__science_tech": 0.17919921875, "__label__social_life": 0.00017702579498291016, "__label__software": 0.006336212158203125, "__label__software_dev": 0.796875, "__label__sports_fitness": 0.0004448890686035156, "__label__transportation": 0.0011148452758789062, "__label__travel": 0.00026297569274902344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28324, 0.04999]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28324, 0.63778]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28324, 0.81522]], "google_gemma-3-12b-it_contains_pii": [[0, 1769, false], [1769, 4674, null], [4674, 6926, null], [6926, 8906, null], [8906, 11124, null], [11124, 12918, null], [12918, 15327, null], [15327, 17479, null], [17479, 20251, null], [20251, 23618, null], [23618, 26605, null], [26605, 28324, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1769, true], [1769, 4674, null], [4674, 6926, null], [6926, 8906, null], [8906, 11124, null], [11124, 12918, null], [12918, 15327, null], [15327, 17479, null], [17479, 20251, null], [20251, 23618, null], [23618, 26605, null], [26605, 28324, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28324, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28324, null]], "pdf_page_numbers": [[0, 1769, 1], [1769, 4674, 2], [4674, 6926, 3], [6926, 8906, 4], [8906, 11124, 5], [11124, 12918, 6], [12918, 15327, 7], [15327, 17479, 8], [17479, 20251, 9], [20251, 23618, 10], [23618, 26605, 11], [26605, 28324, 12]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28324, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
a1fc79fc2097e55703f30a8e5a0f7807fa3bacbc
|
Systems and methods are provided for resource access control in computer systems. Our approach includes new techniques for composing and authenticating principals in an access control system. Our principals may comprise information that identifies the role of the user of a computer system, the mechanism by which the user was authenticated, and program execution history. Thus, when a principal makes a request, access control determinations can be made based on the principal's identity. Access control lists may provide patterns that are used to recognize principals, thereby ensuring a level of security without enumerating precise identifiers for all of the possible principals that may request a particular resource.
FIG. 1
FIG. 2
FIG. 3A
Access Control Information
FIG. 3B
FIG. 4
FIG. 6
FIG. 8
Receive Request to Invoke a Second Program
Determine Principal Name of Requesting Principal (Name Includes At Least One First Program Identifier)
Determine Name of Second Program From Naming Tree (Name Includes Second Program Identifier)
Combine Name of Requesting Principal and Name of Second Program to Get New Principal Name
Associate New Principal Name With Invoked Second Program Process and/or Context
FIG. 9
Receive Request to Assign a Newly Named Context
Determine Principal Name of Requesting Principal (Name Includes At Least One First Program Identifier)
Determine Name of New Context Role From Naming Tree
Combine Name of Requesting Principal and Name of New Context Role to Get New Principal Name
Associate New Principal Name With New Context
SYSTEMS AND METHODS FOR IDENTIFYING PRINCIPALS TO CONTROL ACCESS TO COMPUTING RESOURCES
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] This application is related to co-pending application Ser. No. [Attorney Docket No. MSFT-4890] filed concurrently herewith.
FIELD OF THE INVENTION
[0002] The invention pertains to access control in computer systems, and in particular to access control in computer operating systems.
BACKGROUND OF THE INVENTION
[0003] Access control is an important aspect of secure computing. In general, access control involves deciding whether to permit access to a resource. The entity that requests access is referred to as a principal. A resource may be anything that can be accessed from a computer: data, a database, objects, hardware, programs, and so on. Often, the access determination may go beyond simply granting or denying access by determining a form of access. Thus access may be restricted in various ways, so that some principals are granted only limited access.
[0004] The access permission logic that determines whether to grant access, and what form of access to grant to a particular principal is sometimes referred to as a “reference monitor.” The reference monitor is typically a trusted piece of code that makes all access decisions. The reference monitor is presented with the identity of a principal making a request, the identity of a resource, and the specific form of access desired. The reference monitor then makes the access control decision by deciding whether to accept the proffered identity, and by consulting access control information associated with the resource.
[0005] Present access control systems use an arrangement whereby each human user, after login, is identified by a small identifier. Such an identifier may be a Services Set Identifier (SSID) in WINDOWS®, or a User Identifier (User ID) in UNIX-based systems. The access control data for an operation is an access control list kept with a resource, and takes the form of a set whose members are either principals or identifiers for groups. A group, in turn, is a set whose members are either principals or identifiers for further groups. Access is permitted or denied based on the presence of the proffered principal in the closure of the access control list and its constituent groups.
[0006] Thus, a user directs an automated process, such as MICROSOFT WORD®, to access a resource, such as a document. The automated process makes such a request by passing the small identifier associated with the user to the reference monitor. Upon receiving the access request from an automated process initiated by a user, the reference monitor will consult the access control list associated with the resource. It will determine if the requesting user is identified. If the user’s small identifier can be found on the list—either directly or as part of a group—then the automated process initiated by the user may be allowed to access the requested resource.
[0007] The above described access control design unfortunately has many limitations and drawbacks. These have become increasingly critical in recent years as the diversity of the programs installed in computer systems, and the diversity of attacks on computer systems, have increased.
[0008] For example, the notion that the principal is identified solely with a logged-in user doesn’t allow for expression of important real-world security situations. The human user is not really the entity making an access request. The request is being made by a program. Present designs assume that every program executing in a user’s session is acting on the user’s behalf and with the user’s full trust. That might have been true historically, but it is certainly not true today. For example, while modern computer users most likely approve when MICROSOFT WORD® performs operations on resources that are WORD® documents, but would disapprove if some ad-ware program was doing so. Similarly, the modern user might reasonably object if WORD® was spontaneously accessing the user’s QUICKEN® database.
[0009] A second example of the limitations and drawbacks of the above-described access control systems stems from the fact that the classical notion of “logged-in” is inflexible. It is all or nothing, and implies that all mechanisms for authenticating a user are equally trusted. Equivalently, it requires that all authentication mechanisms are part of the trusted computing base. In reality, there may be various routes for logging into a computer system, and not all are created equal. Users who log in via a less secure path may not be trusted to access resources to which they might otherwise be entitled.
[0010] In view of these and other deficiencies in present access control technologies, the invention herein provides improved systems and methods for making access determinations in computer systems.
SUMMARY OF THE INVENTION
[0011] In light of the foregoing deficiencies in the art, we provide new systems and methods for resource access control in computer systems. Our approach includes new techniques for composing and authenticating principals in an access control system, and for granting them access to resources through new access control list variations. A naming tree comprising identifiers for the trusted entities in a computer system such as programs, users, and roles of both can be generated for use in identifying principals. Our principals may comprise information pulled from the naming tree, such as information regarding the role of the computer system user, information regarding the mechanism by which the user was authenticated, and information regarding program executions that preceded an access request—“execution history”. Thus, when a principal makes a request, the name of the principal can be used to make access control decisions. Access control lists may provide patterns that recognize principals, thereby ensuring a level of security without enumerating precise identifiers for all of the possible principals that may request a particular resource. We show how this supports a variety of access control scenarios. Further aspects and advantages of the invention are described in detail below.
BRIEF DESCRIPTION OF THE DRAWINGS
[0012] FIG. 1 illustrates a generalized standalone computer system 100 with processing unit 102, memory 103,
and other exemplary resources 104-108. Principals may comprise digitized instructions in memory 103A, 103B, 103C, which are executed by processing unit 102. Resources accessed using the techniques provided herein may be data, objects, programs and the like which are stored in system memory 103, as well as other memory and/or hardware such as 104-108.
[0013] FIG. 2 illustrates a network environment with communications network/bus 270, various computing devices 271, 272, 276, 277, objects 273, 274, 275, and database 278. The access control system and method provided herein may be implemented in the illustrated network environment. For example, a principal composed as provided herein may reside in a computing device, e.g., 271, while a requested resource may reside at some other location, e.g., 272, 273, or 278, and while a reference monitor for granting and denying access to the requesting principal may reside at yet another location, e.g., 277.
[0014] FIG. 3A illustrates a generalized view of a system that incorporates aspects of the invention. Principals 301-303 composed as described herein may access information 331, 335. Each resource 331-335 may have access control information 331a-335a, respectively, configured as described herein. Access permission logic 320 may grant principals 301-303 an appropriate form of access, as determined from the access control information 331a-335a.
[0015] FIG. 3B illustrates a system for naming principals such as 301-303 in FIG. 3A. A principal with a first principal name 350 may either assume a new role 361 or invoke a new program 371. In either case, a new principal is created, and the role information 362 or new program information 372 can be added to the original principal name to create the new principal name.
[0016] FIG. 4 illustrates a generalized view similar to that of FIG. 3A, and also including identifier (ID) generating logic 440 for creating the identifier 400a of a principal 400. ID generating logic 440 may draw upon a naming tree 450 in creating the identifier 400a.
[0017] FIG. 5 illustrates an exemplary singly rooted naming tree 560 in which each arc can be labeled with a simple string. Some of the nodes, e.g., 562, 580 in the tree 550 have attached to them a data structure called a manifest 563, 581, the function of which is described in detail herein.
[0018] FIG. 6 illustrates a generalized view similar to that of FIG. 3A, for the purpose of demonstrating pattern matching techniques. A specific principal name 600 may be compared against criteria specified in a generic 1D or set of generic 1Ds, e.g., 631a associated with a resource 631. If the specific principal name 600 meets the specified pattern criteria, then principal 600 may be granted an appropriate form of access to resource 631.
[0019] FIG. 7 illustrates an exemplary embodiment wherein an access control system as described herein is incorporated into an operating system 700. The exemplary operating system 700 may operate in conjunction with memory divided into a kernel mode 712 and user mode 711. A first principal can be assigned a first context 721 and name 722. Here, the first principal is a user login process. After the user logs in, a second principal may be launched in a second context 731 that represents the first process (the login process) after successful user login. This second process can be identified by a principal name 732 that incorporates the name from 722, as well as user role information. Any subsequently launched process can be launched in a next context 741, and assigned a name 742 that incorporates elements from 732, in addition to information relating to the newly launched program.
[0020] FIG. 8 illustrates a series of exemplary steps in assigning a new principal name to a process.
[0021] FIG. 9 illustrates a series of exemplary steps in assigning a new principal name to a process, where it is not desired to represent program execution history in the principal name, and it is instead desired to represent a context role, such as a user role, in the principal name.
DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS
[0022] Certain specific details are set forth in the following description and figures to provide a thorough understanding of various embodiments of the invention. Certain well-known details often associated with computing and software technology are not set forth in the following disclosure, however, to avoid unnecessarily obscuring the various embodiments of the invention. Further, those of ordinary skill in the relevant art will understand that they can practice other embodiments of the invention without one or more of the details described below. Finally, while various methods are described with reference to steps and sequences in the following disclosure, the description is such as is for providing a clear implementation of embodiments of the invention, and the steps and sequences of steps should not be taken as required to practice this invention.
[0023] Systems and methods for resource access control in computer systems can be improved using techniques for identifying principals with additional relevant information. The various contemplated types of relevant information provide unique advantages which are demonstrated below. Aspects of the invention also provide techniques for grouping of such information into a compound principal identifier comprising identifiers for one or more relevant information types and operators for separating the identifiers in a manner that reflects on the relationship between them. Other aspects relate to systems and methods for collecting information into a naming tree for use in identifying principals, among other potential uses and advantages of the naming tree described herein. Still further, embodiments of the invention may implement techniques provided here for utilizing the described principal identifiers in making access decisions. When principals are identified using some or all of the wide variety of relevant information provided here, a pattern matching method may be employed in access decisions.
[0024] For the purpose of clarity in the following detailed description, the invention will be described in the context of a single-host, non-distributed operating system such as a standalone computer running MICROSOFT WINDOWS®, APPLE OSX® or LINUX-based operating systems. Modern computing of course extends to networked and distributing computing environments in which access control systems may also be implemented.
[0025] With reference to FIG. 1, an exemplary computing system 100 suitable for use in connection with the access control system is broadly described. In a basic configuration,
computer system 100 typically includes a processing unit 102 and memory 103. Depending on the exact configuration and type of computing system, memory 103 may be volatile 103A (such as RAM), non-volatile 103B (such as ROM, flash memory, etc.) or some combination of the two. Additionally, system 100 may also have mass storage (removable 104 and/or non-removable 105) such as magnetic or optical disks or tape.
Similarly, system 100 may comprise input devices 107 such as a keyboard and mouse, and/or output devices 106 such as a display that presents a GUI as a graphical aid accessing the functions of the computing system 100. Other aspects of system 100 may include communication connections 108 to other devices, computers, networks, servers, and so forth using wired or wireless media.
Volatile memory 103A, non-volatile memory 103B, removable mass storage 104 and non-removable mass storage 105 are examples of computer readable media. Computer readable media may comprise communication media as well as computer storage media. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media.
Computer storage media may be implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium.
The invention may be implemented, at least in part, via computer-executable instructions, such as program modules, being executed by a computer 100. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
Computer executable instructions are generally embodied as digital information available to computer 100 on some form of computer readable media. In FIG. 1, for example, system memory 103 may store an operating system and application programs as well as other program modules and program data. Applications and such may be bundled with an operating system, and this arrangement is contemplated in exemplary embodiments of the invention, in which an access control system is included in an operating system. However, it should be noted that aspects of the functionality provided may exist separately and draw upon independent operating system services instead.
An operating system is responsible for initiating processes, and for managing memory for processes. Any process running on an operating system may comprise multiple threads. Typically, a process will be assigned a context, which is a portion of memory 103 which the process is free to use. A process corresponds to a program in that the instructions of the program, which may be stored in various executable files, are carried out by the process.
It should be understood that while embodiments of the invention described herein may be software implementations, the various techniques described herein may also be implemented by replacing hardware components for at least some program modules. Thus, while the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code in a high level procedural or object-oriented programming language, the program(s) can also be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language, and combined with hardware implementations.
The invention is operational with numerous general purposes or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
FIG. 2 provides an exemplary networked computing environment that may make use of access control systems and methods provided herein. The network comprises computing devices 271, 272, 276, and 277 as well as objects 273, 274, and 275, and database 278. Each of these entities 271, 272, 273, 274, 275, 276, 277, and 278 may comprise or make use of programs, methods, data stores, programmable logic, etc. The entities 271, 272, 273, 274, 275, 276, 277 and 278 may span portions of the same or different devices such as PDAs, audio/video devices, MP3 players, personal computers, etc. Each entity 271, 272, 273, 274, 275, 276, 277 and 278 may communicate with another entity 271, 272, 273, 274, 275, 276, 277 and 278 by way of the communications network 270.
Devices on a network communicate with one another utilizing the functionality provided by protocol layer(s). For example, Hyper Text Transfer Protocol (HTTP) is a common protocol that is used in conjunction with the World Wide Web (WWW), or “the Web.” Typically, a computer network address such as an Internet Protocol (IP) address or other reference such as a Universal Resource Locator (URL) can be used to identify the server or client computers to each other. The network address can be referred to as a URL address. Communication can be provided over a communications medium, e.g., client(s) and server(s) may be coupled to one another via TCP/IP connection(s) for high-capacity communication.
The network may itself comprise other computing entities that provide services to the system of FIG. 2, and may itself represent multiple interconnected networks. Each entity 271, 272, 273, 274, 275, 276, 277 and 278 may contain discrete functional program modules that might make use of an API, or other object, software, firmware and/or hardware, to request services of one or more of the other entities 271, 272, 273, 274, 275, 276, 277 and 278.
The "client" is a member of a class or group that uses the services of another class or group to which it is not related. In computing, a client may be a process, i.e., roughly a set of instructions or tasks, that requests a service provided by another program. Such service may be, for example, the issuing of a certificate by a certificate issuing system. The client process utilizes the requested service without having to "know" any working details about the other program or the service itself. In a client/server architecture, particularly a networked system, a client is usually a computer that accesses shared network resources provided by another computer, e.g., a server. In the example of FIG. 2, any entity 271, 272, 273, 274, 275, 276, 277 and 278 can be considered a client, a server, or both, depending on the circumstances.
A server is typically, though not necessarily, a remote computer system accessible over a remote or local network, such as the Internet. The client process may be active in a first computer system, and the server process may be active in a second computer system, communicating with one another over a communications medium, thus providing distributed functionality and allowing multiple clients to take advantage of the information-gathering capabilities of the server. Any software objects may be distributed across multiple computing devices or objects.
Embodiments of the invention may thus address a situation where a principal at a client entity, e.g. 277, requests access to a resource in a database 278, by sending a request to a server entity, e.g. 276. In this scenario, some aspects of the invention may reside on the client 277, while other aspects reside on the server 276 and the database 277. For example, a principal may be named by an operating system executing on client 277 which incorporates the naming tree and various other logic as provided herein. A reference monitor may be located at the server 276 which is configured to make access decisions based on a principal identified as described herein. A resource in the database 278 may bear access control information that specifies permissible identifier patterns in accordance with the techniques of the invention. In short, those of skill in the art will appreciate that the various components of the invention may be configured to reside at any location on the network.
FIG. 3A illustrates a schematic view of an access control system. Principals 301-303 composed as described herein can request access to resources 331-335. Each resource 331-335 may have access control information 331a-335a, respectively, configured as described herein. Access permission logic 320, sometimes referred to as a reference monitor, may grant principals 301-303 an appropriate form of access, as determined from the access control information 331a-335 and the names of principals 301-303.
FIG. 3B illustrates a system for naming principals such as 301-303 in FIG. 3A. A principal with a first principal name 350 may either assume a new role 361 or invoke a next program 371. In either case, a new principal is created, and the role information 362 or new program information 372 can be added to the original principal name to create the new principal name.
FIG. 3B is illustrated as cyclical because each principal may spawn new principals by assuming a new role and/or invoking a next program. Thus, principal names may become quite long if, for example, there is a long chain of invoking programs from a previously invoked principal. More likely, however, many new principals will be spawned from a limited number of principals that are generally responsible for invoking new programs, so principal names will not become excessively long.
The names of principals 301-303 may thus be composed of exemplary information that describes an initial program plus any roles and subsequent programs in the execution history. Embodiments of the invention may use any sequence of program/role information to name a principal. Information for principal names may be pulled from a naming tree, which is illustrated in FIG. 5.
The various exemplary information that may be used to name a principal, e.g. 301-303, will now be described. First, with reference to the particular program corresponding to the principal, because access requests are actually made by programs, not human users, the principal presented to a reference monitor can include some notion of the program that is executing.
Second, with reference to execution history, the principal presented to a reference monitor can include some notion of the program that provoked that execution, and so on back through the execution history. Information that identifies a program that provoked execution is referred to herein as program execution history information. Sufficient information about program execution history may be retained in a fashion that allows for finer grain access control decisions. For example, one might desire that file write access be granted only to a user when running a specific program. A script interpreter might only be given certain rights when invoked by a known trusted program. A user might have different rights when authenticated via a smart-card login program rather than a password-based login program.
In addition to information about a program that is executing, and program execution history, information pertaining to the circumstances of user login can also be reflected in a principal identifier. In a modern execution environment, principals such as 303 may arise from a console login, from a remote terminal login, from the creation of a background service, batch job or daemon, and so forth. Authentication might be by password, X.509 certificate, smart card, by an ad hoc decision by an application, or by some other authentication technique. These various login mechanisms provide varying degrees of security. These circumstances can be included as part of the identity of the principal 303 presented to the reference monitor 320. When this is done, the reference monitor 320 may base its decisions partly on how a principal 303 was authenticated.
Finally, some notion of the role or roles of a principal 302 can be included in a principal name. For example, a user may login as an administrator with many access privileges, or in some other capacity, such as "employee," "guest," "engineer," "manager," and so forth that may be entitled to some limited set of access privileges. The role can reflect the appropriate set of access privileges. Note that other entities, such as a process, may similarly assume a role, and that such role information may also be reflected in a principal name.
The invention is not limited to use of compound principal names in all situations, nor is it limited to a particular order of information in principal names. Rather,
each information type can be used in a principal name if it is desirable to do so under particular circumstances. When a principal makes a request, trust decisions can be made based on the principal’s identity. A form of permitted access to a requested resource may then be determined for the principal, or access may be denied.
[0049] In summary, one or more of the identity of the authenticated user, the identity of the agency that performed the authentication, and the identity of the program invocations that have brought the computation to its current point can be placed in principal names and considered in access control decisions. As will be seen below, access control lists may then be designed that allow for succinct expression of a wide variety of commonly useful access control decisions.
[0050] In some embodiments, an advantage of use of the information types described here is that it allows for separation of the creation of principal names from the policies and mechanisms that led us to trust those principals. Other advantages, discussed in more detail below, comprise the ability to create compound principals formed by two operators that represent authentication and program invocation; and an expressive but straightforward access control list mechanism.
[0051] FIG. 4 illustrates a generalized view similar to that of FIG. 3A, and also including principal name generating logic 440 for naming a principal 400. While aspects of the invention generally contemplate generation of principal names as contemplated in FIG. 3B, the role or next program information may be obtained from a variety of sources. The naming tree 450 provides one such source for the information, which provides certain advantages as described below. Thus, while any number of techniques may be used by name generating logic 440 to gather the information that is placed in the principal name, we propose a system involving a naming tree 450 which provides some unique advantages. The naming tree 450 is discussed in detail with reference to FIG. 5.
[0052] In some embodiments, name generating logic 440 may be bundled with logic for invoking processes and/or creating a new context for a particular process. The principal naming function is thus integrated into the core logic of an operating system responsible for launching processes and supporting them by providing them with resources they request. Where this is the case, the logic that invokes a process may also supply a principal name for the process. It is also possible for the invoking and the naming of processes to be independent.
[0053] FIG. 4 demonstrates two possible techniques/components for initiating and naming a process, InvokeProcess 441 and ForkRole 442. InvokeProcess 441 applies to situations where a new process is initiated, such as by launching a new application. ForkRole 442 provides a mechanism run the same program as calls the ForkRole 442 component in a new security context. Either or both of these components may be supplied in embodiments of the invention. There are several unique advantages to using them both, as will become apparent below.
[0054] To provide an example of the way in which InvokeProcess 441 can assign a principal identifier, assume a first principal identified by the identifier “A.” Principal A calls InvokeProcess 441 to initiate a process, for example, a MICROSOFT WORD® process. InvokeProcess can start the MICROSOFT WORD® process and assign a new principal identifier to the MICROSOFT WORD® process. Assume that MICROSOFT WORD® is identified by a string, “B,” that can be found in the naming tree. InvokeProcess may assign the identifier “A+"B” to the MICROSOFT WORD® process. If the MICROSOFT WORD® process (principal A+B) then initiates another process, identified by string “C” in the naming tree, InvokeProcess 441 can assign the principal identifier “A+B+C” to the new process.
[0055] To provide an example of the way in which ForkRole 442 can assign a principal identifier, again assume a first principal identified by the identifier “A.” Principal A calls ForkRole 442 to initiate a new instance of itself in a new security context. ForkRole 442 can assign the new process an identifier that incorporates the name of the original principal as well as any role associated with the new security context. For example, if the identifier for the new role is “RR,” then ForkRole may assign the identifier “A@RR” to the new principal. To demonstrate this, consider a scenario in which principal A is login process prior to user login. Upon user login, Principal A may call ForkRole to initiate the login process in a new security context associated with the role of the logged in user. To name the process in the new security context, ForkRole 442 can combine the principal identifier “A” with the new role identifier “RR,” to create an identifier for the new principal, “A@RR.”
[0056] The above general descriptions of InvokeProcess 441 and ForkRole 442 will be supplemented with more detailed embodiments below after a closer consideration of the naming tree 450 that may be used in conjunction with various embodiments of the invention.
[0057] FIG. 5 represents an exemplary naming tree for use in embodiments of the invention. Naming trees provide advantages in naming principals. In general, information for a principal identifier may be pulled from a naming tree. The information may be an arc in the naming tree. An arc is information that defines a path to a location in a tree. For example, in naming tree 550, an arc to manifest 591 might be 560/561/567/570/572/570office 572/word 590/manifest 591.
[0058] When a principal is to include information about a program, the arc to the program may be included in the principal name. When it is to include information about a user role, an arc to the user role can be included in the principal name. Similarly for any other information to be pulled from a naming tree for inclusion in a principal name. Thus, in some embodiments, program execution history information can be included in principal identifiers. Such principal identifiers may comprise a first arc to the first program in an execution history, then a second arc to a second program in the execution history, and so forth down the chain. When one of the programs authenticates a user, the arc to the authenticated user can be included in the principal identifier.
[0059] FIG. 5 illustrates an exemplary singly rooted naming tree 550 in which each arc may be labeled with a simple string. A tree, as that term is used here, refers to a hierarchical structure for organizing data. Thus, for example, in FIG. 5, ms 570 comprises office 572 and some other hypothetical branch 571, and office 572 in turn comprises excel 580 and word 590. This type of data structure is referred to herein as a tree. Note that decisions as to what
relatively higher or lower in the hierarchy are made according to some criteria. Embodiments illustrated in FIG. 5 demonstrate one exemplary criteria that may be used to make the invention, but other criteria choices are not ruled out.
[0060] Some of the nodes, e.g. 562, 580 in the tree 550 have attached to them a data structure called a manifest 563, 591. The naming tree 550 may represent all entities in a computer system. In some embodiments, the naming tree 550 may be limited to representation of the trusted entities in a system. “Trusted” implies some level of assurance that the entity is not malicious or otherwise undesirable. Programs, users, and roles of both may be listed in the naming tree 550. In some embodiments, cryptographic keys, certificating, and system policy that dictates what entities are trusted and why may be excluded from the naming tree 550 to clearly separate the dual concerns of access control and trust policy.
[0061] A manifest, e.g. 591, may specify a particular executable “program”, by providing the file names and/or cryptographically secure fingerprints of the constituent parts of the program—its executable, shared libraries, data resources, and so forth. Since the identity of an invoked program becomes part of a principal identifier, program invocation can be a security related operation, and to achieve this programs may be named by paths through the naming tree 550.
[0062] The naming tree may also be used to name users, and to name groups from within access control lists.
[0063] Among other advantages, use of this naming tree 550 allows separation of the mechanisms and policy for constructing the tree from the mechanisms and policy for running a reference monitor. Both are important parts of the overall security decision, but the separation greatly simplifies the authentication and access control mechanisms.
[0064] To construct the tree 550 in the context of a particular trust policy, the decision to install a program purporting to be, for example, MICROSOFT WORD® can entail verifying the identity of the entity with a trusted party such as an authenticated administrator. The authenticated administrator may inspect certificates (such as X.509) and agree that the proffered bits really deserve to be given such a trusted name. Once that decision has been made, WORD® can be included in the appropriate location 590 in the tree 550. Similarly, the presence of “ms” in the hierarchy might represent the publisher MICROSOFT® and dictate that certified MICROSOFT® applications can inhabit this part of the namespace. This is up to system policy.
[0065] The presence of the resulting manifest 591 at the node named, e.g., “bin/ms/office/word”590, makes the administrator’s decision clear, and we can use this in subsequent authentication and access control decisions.
[0066] Nodes in the tree can have content, and that a manifest, e.g. 563 may be viewed as part of the content of a node 562. Such a node can also have children 565, 566. Thus, in FIG. 5 the arc defined by 560/bin 561/login 562 has both a manifest 563 and a child 564 (“users”), “users” 564/ied 565 and “users/Andrew 566” are roles of “560/bin 561/login 562”. Similarly, “thesaurus 592” and “spellcheck 593” are roles of 560/bin 561/MS 570/office 572/word 590. The dotted lines signify a magnification of the node 591 under “word”590, which contains word’s manifest. The naming tree may itself be considered a resource, and therefore have its own access control lists attached to it, to specify which principals can modify which parts of the tree.
[0067] Once a naming tree such as that of FIG. 5 is constructed, it can be used to name principals, to invoke new processes, or both. Naming may entail obtaining information from the tree and combining it with other information, such as a name of a previously executing principal as described above with reference to operation of “InvokeProcess.” Note that there need not necessarily be an actual data structure in a computer system that represents the tree. In some embodiments, the tree is never actually fully constructed. Instead, names are organized into a tree, if one wishes, but they are never actually organized that way in memory.
[0068] The various identifiers that are conjoined in a principal identifier may be separated using operators. We provide a small set of exemplary operators that can be used to conjoin elements of the naming tree to form principal identifiers. In the embodiment provided here, operators may relate directly to security-sensitive system operations such as “fork process” and “fork role”. Additional operators, different operators, and different symbols for the operators described herein may be used in alternative embodiments of the invention.
[0069] In one embodiment, a principal name can be a string constructed from arcs in the naming tree 550 and operators “/”, “@”, and “+”, according to the following grammar—the example below uses standard BNF notation, plus the operators defined herein:
```
[0070] Manifest Name: MN=Arc/MN “/” Arc
[0071] Relative Role: RR=Arc/RR “/” Arc
[0072] Role: R=MN|R “@” RR
[0073] Principal: P=R|P “+” R
[0074] The system provides exactly two operations that affect principals:
[0075] InvokeProcess(MN)
[0076] ForkRole(RR)
[0077] In such an embodiment, when “InvokeProcess” runs a program, its argument “MN” is a manifest name, which is a path from the root 500 of the naming tree 550 to the manifest of the desired program, e.g. 520. The system finds the named manifest 520, loads the appropriate data into a new security context, and initiates its execution. When the principal that calls InvokeProcess is “P”, then the new security context may run as principal “P+MN”.
[0078] In other words, occurrences of the “+” operator within a principal name represents the history of program invocation that resulted in the currently executing program.
[0079] There may be variations of InvokeProcess. In one variation, when a manifest is marked as a “service”, or otherwise flagged, then the new security context may run as the principal “MN”, independently from the identifier of its invoker. This provides a technique for excluding program execution history from a principal identifier, which may prove useful in some situations.
As described generally above, “ForkRole’ may run the same program as calls it, but in a new security context. In this specific embodiment, its argument “RR” is a path relative to the program’s manifest name. When the principal that calls ForkRole is “Q”, then the new security context runs as principal “Q@RR”.
In other words, occurrences of the “@” operator within a principal name indicate where a program has decided to adopt a distinguished role, relative to its manifest. This indication says nothing about whether the role is more or less privileged—that has meaning only to the extent that access control lists grant more or less access to the new principal name.
One critical use of ForkRole is to indicate when a program makes an authentication decision. For example, the system might run a console login program by invoking the manifest “bin/login” as a service, thus executing as principal “bin/login”. When the console login program has received a satisfactory user name “andrew” and password from the console, it will use ForkRole to start running itself as “bin/login@andrew”, then use InvokeProcess to run Andrew’s initial command shell “bin/bash”, which will then be executing as the principal “bin/login@andrew+bin/bash”.
Similarly, we might run the manifest “bin/sshd” to listen for incoming Secure Shell (“SSH”) connections. After satisfactory authentication through the normal SSH public-key mechanisms it might adopt the role “bin/sshd@andrew” then run the command shell, which would execute as “bin/sshd@andrew+bin/bash”.
In these two scenarios, if “bash” decides to run “cat” (whose manifest is named “bin/cat”) and cat tries to open a file, this would result in an access request to the file system from either the principal “bin/login@andrew+bin/bash+bin/bash@cat” or the principal “bin/sshd@andrew+bin/bash+bin/bash@cat” respectively. The reference monitor for the file system would then consult the access control list on the requested file to decide whether the given principal should be granted access.
Note that nowhere in this scenario has the system trusted any of the programs involved: login, sshd, bash, or cat. All the system did was to certify the program invocations involved, and that bin/login and bin/sshd chose to adopt the role “andrew”. In this design trust need only occur in constructing the naming tree 550, i.e., trusting that the programs really deserve their given names, and as a result of the way in which we write access control lists, which embody our access control decisions.
FIG. 6 illustrates a generalized view similar to that of FIG. 3A, for the purpose of demonstrating pattern matching techniques. A specific principal name 600 may be compared against criteria specified in a generic ID 631a, or set of generic IDs associated with a resource 631. If the specific name 600 meets the specified pattern criteria in 631a, then principal 600 may be granted an appropriate form of access to resource 631.
Pattern matching is useful because embodiments of the invention may include significant extra information within the principal name 600, causing proliferation of the variety of principal names that may arise. It can become untenable to maintain lists of principal names that are permitted to access resources. To resolve this issue, we can express in the access control data 631a-635a a wide variety of constraints on the acceptable principals, based on the wider variety of information now included in our principal’s names. However, some embodiments may maintain security as well as usability by expressing the decisions that can be made by this more general mechanism in a sufficiently simple language so they make sense to the people who read and write the access control lists 631a-635a.
With compound principal names such as those we propose above, having an access control list (“ACL”) be merely a set of principal names may not provide sufficient expressive power. For example, we might want to permit access to a user while executing within a particular set of programs, or when authenticated by some particular set of programs (e.g., bin/login or bin/sshd, but not bin/fpd); or we might want to give access to a program regardless of its user. Embodiments of the invention may thus use an ACL design in 631a-635a that is no longer just a set of principal names. Instead it is a pattern, or a set of generic identifiers, that can be used by pattern matching logic 620 to recognize specific principal names such as 600.
The exact pattern recognition language used may vary. We present here a pattern recognizer that is a specialized subset of regular expressions. Obviously, more or less complex recognizers are possible, depending on your judgment about the range of decisions that you want to be able to express.
An ACL 631a may be a string constructed from arcs in the naming tree and operators as follows:
Atom=Arc("/");"@")"+"
Item=Atom"","|"|ACL "")|Item "*"|{ "GroupName" | }"
GroupName=Arc[GroupName """] Arc
Seq=Item|Seq Item
ACL=Seq|ACL ""
The matching rules are similar to those for conventional regular expressions, as follows:
Any Atom matches itself
"." matches any single Arc (explicitly excluding ":", ":", and ":")
“(ACL)” matches ACL
“Item” matches zero or more sequential occurrences of Item (greedily)
[GroupName]” matches whatever is matched by the contents of the node GroupName in the naming tree
“Seq Item” matches Seq followed immediately by Item
“ACL Seq” matches either ACL or Seq
A principal “P” matches an ACL “A” if the string P matches the regular expression that is the contents of A. The match must be complete—all of P, not just a sub-string of it.
“GroupName” provides a mechanism for sharing parts of the recognition machinery amongst multiple ACL’s.
We place groups within the same naming tree as manifests and role names, with the same assumption that their presence there reflects a trust decision made by a suitable administrator. Recursively defined groups are not permitted.
A reference monitor may grant P its requested access to an object if P matches the relevant ACL. In doing so, the reference monitor is just performing string manipulation on the principal name and the ACL contents—it doesn’t need to use the naming tree itself, except to read referenced groups.
FIG. 7 illustrates an exemplary embodiment wherein an access control system as described herein is incorporated into an operating system. The exemplary operating system may operate in conjunction with memory divided into a kernel mode and user mode. In the meantime, the operating system in the bottom half of the figure provides a set of fixed components that are drawn upon by the various processes in contexts. Each context may have a user mode portion in and a kernel mode portion in the kernel mode portion is under exclusive control of the operating system. The user mode portion is under control of the various processes.
A principal can be assigned a first context and principal name. The principal name is the information that would be passed to the reference monitor should the principal in context request a resource. Here, the first principal is a user login process, which provides for convenient explanation of this example. When a user logs in, the process may call a new process, referred to in the figure as “assign new context.” This component can both assign a new context and provide a principal name for the newly created principal. The second principal may be launched in a second context that represents the first process from context after successful user login. This second process can be identified by a principal name that incorporates the name as well as user role information. The ID from can be retrieved from the naming tree.
A next process may be launched, in context, using the exemplary InvokeProcess component as described above. InvokeProcess is described in the figure as “invoke process and assign new context-execution history naming.” Any subsequently launched process, for example a MICROSOFT WORD® process, can be launched in a next context, and assigned a name that incorporates elements from, in addition to information for the newly launched program. Again the elements from can be retrieved from, while the name for the newly launched program can be retrieved from the naming tree. As described above, the naming tree may also play a role in invoking this next process, in that the executable for the corresponding program is located via the naming tree.
“Invoke process and assign new context-no execution history naming” is the InvokeProcess variation described above. This variation, if called, could invoke a new process, such as a MICROSOFT WORD® process, but without including program execution history information in the corresponding principal name.
When a principal, such as the process in, requests a resource, it can pass a request along with its principal name to the reference monitor. The reference monitor can locate the requested resource from among all available system resources. The requested resource may be any resource available to the computer system, including but not limited to system data, an object, and hardware. The reference monitor can retrieve the ACL, e.g. , , , from the desired resource. If the ACL specifies a pattern for acceptable principal names, the reference monitor can perform a pattern matching operation to determine if the principal name matches pattern parameters in, for example, . In some embodiments, a number of patterns may be specified in which correspond to different access privileges. A level of access may be determined by logic for pattern matching as described above.
FIG. 8 illustrates a series of exemplary steps in assigning a new principal name to a process. The steps of FIG. 8 can be understood with reference to FIG. 7 and corresponding description above. First, an operating system may receive a request, e.g. a request from a first program or corresponding process, to invoke a second program. Next, the operating system may determine the principal name of the requesting principal. In many embodiments, the request may bear the identity of the requesting principal, making this determination a simple matter. Next, the name of the second program may be determined from a naming tree or other information source such as the information passed to an invocation process. The name of the second program maybe generated with reference to the naming tree as described above. The requesting principal and the name of second program may be combined to produce a new principal name. The identifiers may be combined using operators as described above. Finally, the operating system may associate a new principal name, namely the compound name generated by adding the naming tree information with information from the requesting principal, with the newly created principal.
FIG. 9 illustrates a series of exemplary steps in assigning a new principal name to a process, where it is not desired to represent program execution history in the principal name, and it is instead desired to represent a context role, such as a user role, in the principal name. First, an operating system may receive a request, e.g. a request from a first program or corresponding process, to assign a new context, e.g. a context associated with a new role. Next, the operating system may determine the principal name of the requesting principal. In many embodiments, the request may bear the identity of the requesting principal, making this determination a simple matter. Next, the name, or identifier, of the role to be associated with the new context may be determined from a naming tree. The name of the new role may be generated with reference to the naming tree as described above. The name of the requesting principal and the name of new role may be combined to produce a new principal name. The names may be combined using operators as described above. Finally, the operating system may associate a new principal name, namely the compound
name generated by adding the naming tree information with information from the requesting principal, with the newly created principal 905.
[0115] A number of usage examples are instructive in illustrating embodiments of the invention. To keep the examples legible, assume that a naming tree contains the following groups, named with single arcs:
[0116] path=.(./)*
[0117] role=(@[path])*
[0118] app={path}{role}
[0119] trusted=bin/login|ssh|d
[0120] authors=Andrew|Martin|Ted
[0121] office=bin/ms|office/
[0122] good=bin/cmd|exe|{office}
[0123] The following ACL is similar to the baseline semantics of existing systems: give access to an explicitly named user, if authenticated by a trusted program:
[0124] {trusted}@Ted +(app)*(office){role}
[0125] More precisely, the above ACL permits access from any program invoked (directly or indirectly) from one of our trusted authentication programs, provided that the authentication program has adopted the role “Ted”. In contrast with existing systems, however, the choice of which authentication programs should be trusted is made in the ACL. We could treat different sets of authentication programs for different objects or for different users.
[0126] Our next example gives access from any of a specific set of programs, regardless of the user who invoked them:
[0127] (app)*(office){role}
[0128] One might use such an ACL, for example, to allow MICROSOFT OFFICE® applications to access some auxiliary files, regardless of who is running the applications, while preventing users doing anything else with the auxiliary files.
[0129] Our final example gives access when authenticated by a trusted program as a member of “authors”, but only when the entire invocation chain of programs is acceptable:
[0130] {trusted}@{authors}+(good)*
[0131] The use of additional information in principal names as suggested herein, along with the naming tree and ACL pattern matching techniques, allows a number of auxiliary advantages for access control systems. Support for separation of the policy and mechanisms for certifying programs and groups from the day-to-day authentication and access control mechanisms is one important advantage that may be accomplished in some implementations of the invention. Second, some embodiments of the invention may consist of just two operators for composing principals, providing sufficient expressiveness while retaining simplicity. Third, the particular information incorporated into principals by embodiments of the invention can avoid requiring that the system trust particular authentication programs. Finally, when ACLs employ pattern recognition, compact expression of sophisticated access control decisions is supported, which simultaneously allows broad use of the expressive power expressiveness of our principals. The systems and methods provided here thus allow for authentication and access control in a modern operating system, suitable for the more stringent requirements of a modern security posture in a world with diverse software.
[0132] Finally, it should be emphasized once again that although exemplary embodiments refer to utilizing the present invention in the context of one or more stand-alone computer systems, the invention is not so limited, but rather may be implemented in connection with any computing environment, such as a network or distributed computing environment. Still further, the present invention may be implemented in or across a plurality of processing chips or devices, and storage may similarly be effected across a plurality of devices. Such devices might include personal computers, network servers, handheld devices, supercomputers, or computers integrated into other systems such as automobiles and airplanes. Therefore, the present invention should not be limited to any single embodiment, but rather should be construed in breadth and scope in accordance with the appended claims.
1-20. (canceled)
21. A computer operating system comprising:
a tree for assigning names to principals, said tree comprising at least one program name.
22. The operating system of claim 21 wherein said tree further comprises at least one user name.
23. The operating system of claim 21, further comprising a component for generating principal names at least in part by adding said at least one program name to an existing principal name.
24. The operating system of claim 23 wherein said component for generating principal names separates the existing principal name from said at least one program name with an operator.
25. The operating system of claim 21 wherein said tree further comprises at least one role name.
26. The operating system of claim 25 wherein said at least one role name represents a user.
27. The operating system of claim 26, further comprising a component for generating principal names at least in part by adding said at least one role name to an existing principal name when the user logs in.
28. The operating system of claim 21, further comprising a component for comparing a principal name generated using said tree with a generic name associated with a computing resource.
29. A system for naming principals that request access to computer resources, the system comprising:
a tree comprising one or more of a program name and a user name;
a component for naming a principal wherein said component generates a principal name at least in part by determining a path that locates one or more of the program name and the user name in the tree, and including at least a portion of said path in the principal name.
30. The system of claim 29, said tree further comprising one or more of a program role and a user role.
31. The system of claim 30 wherein said tree comprises the program role and wherein said component for naming a principal generates a principal name at least in part by
determining a second path that locates the program role in the tree, and including at least a portion of said second path in the principal name.
32. The system of claim 30 wherein said tree comprises the user role and wherein said component for naming a principal generates a principal name at least in part by including a second path that locates the user role in the tree, and including at least a portion of said second path in the principal name.
33. The system of claim 29 wherein said component for naming a principal generates a principal name at least in part by including at least a portion of a name of an invoking principal.
34. The system of claim 32 wherein said tree comprises the user name and wherein said component for naming a principal generates a principal name at least in part by adding the user name to the at least a portion of a name of an invoking principal.
35. The system of claim 29 wherein said component for naming the principal also invokes a program corresponding to said program name.
36. The system of claim 29, further comprising a component for comparing a principal name, generated using said component for naming a principal, with a generic name associated with a computing resource.
37. A method for controlling access to a resource on a computer system, comprising:
determining a portion of a principal name by referring to a naming tree comprising at least one program name and at least one user name;
combining said portion of a principal name with a name of an invoking principal to generate a new principal name; and
using said new principal name to determine if an associated principal may access the resource.
38. The method of claim 37 wherein said naming tree further comprises at least one role name.
39. The method of claim 37 wherein said combining combines the role name with the name of the invoking principal when a user logs in, and wherein the role name represents a user and the invoking principal is a login process.
40. The method of claim 37 wherein the resource is the naming tree.
* * * * *
|
{"Source-Url": "https://patentimages.storage.googleapis.com/ee/0b/96/b9d4a7bcdd0512/US20060265759A1.pdf", "len_cl100k_base": 12438, "olmocr-version": "0.1.53", "pdf-total-pages": 19, "total-fallback-pages": 0, "total-input-tokens": 25379, "total-output-tokens": 14073, "length": "2e13", "weborganizer": {"__label__adult": 0.0005340576171875, "__label__art_design": 0.0010471343994140625, "__label__crime_law": 0.004428863525390625, "__label__education_jobs": 0.001445770263671875, "__label__entertainment": 0.00017940998077392578, "__label__fashion_beauty": 0.0002512931823730469, "__label__finance_business": 0.0028667449951171875, "__label__food_dining": 0.00032591819763183594, "__label__games": 0.00128936767578125, "__label__hardware": 0.006053924560546875, "__label__health": 0.0006327629089355469, "__label__history": 0.0003345012664794922, "__label__home_hobbies": 0.00019490718841552737, "__label__industrial": 0.0009870529174804688, "__label__literature": 0.000522613525390625, "__label__politics": 0.0006151199340820312, "__label__religion": 0.0005331039428710938, "__label__science_tech": 0.1748046875, "__label__social_life": 0.00010269880294799803, "__label__software": 0.1942138671875, "__label__software_dev": 0.60791015625, "__label__sports_fitness": 0.0001550912857055664, "__label__transportation": 0.00043582916259765625, "__label__travel": 0.0001728534698486328}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 61330, 0.03688]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 61330, 0.60242]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 61330, 0.90953]], "google_gemma-3-12b-it_contains_pii": [[0, 723, false], [723, 730, null], [730, 737, null], [737, 782, null], [782, 789, null], [789, 789, null], [789, 796, null], [796, 796, null], [796, 1570, null], [1570, 7922, null], [7922, 14626, null], [14626, 21357, null], [21357, 28221, null], [28221, 35085, null], [35085, 41373, null], [41373, 47154, null], [47154, 53416, null], [53416, 59264, null], [59264, 61330, null]], "google_gemma-3-12b-it_is_public_document": [[0, 723, true], [723, 730, null], [730, 737, null], [737, 782, null], [782, 789, null], [789, 789, null], [789, 796, null], [796, 796, null], [796, 1570, null], [1570, 7922, null], [7922, 14626, null], [14626, 21357, null], [21357, 28221, null], [28221, 35085, null], [35085, 41373, null], [41373, 47154, null], [47154, 53416, null], [53416, 59264, null], [59264, 61330, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 61330, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 61330, null]], "pdf_page_numbers": [[0, 723, 1], [723, 730, 2], [730, 737, 3], [737, 782, 4], [782, 789, 5], [789, 789, 6], [789, 796, 7], [796, 796, 8], [796, 1570, 9], [1570, 7922, 10], [7922, 14626, 11], [14626, 21357, 12], [21357, 28221, 13], [28221, 35085, 14], [35085, 41373, 15], [41373, 47154, 16], [47154, 53416, 17], [53416, 59264, 18], [59264, 61330, 19]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 61330, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
e5e2fbfe4e30d12a6ca9c81336d7f35ecace8ae0
|
[REMOVED]
|
{"Source-Url": "https://pdfs.semanticscholar.org/dbfa/75d26521be1a6f6049a00aeb13ab3c3e2b55.pdf", "len_cl100k_base": 10352, "olmocr-version": "0.1.53", "pdf-total-pages": 20, "total-fallback-pages": 0, "total-input-tokens": 57928, "total-output-tokens": 12601, "length": "2e13", "weborganizer": {"__label__adult": 0.0003485679626464844, "__label__art_design": 0.0003960132598876953, "__label__crime_law": 0.0003235340118408203, "__label__education_jobs": 0.0010595321655273438, "__label__entertainment": 5.561113357543945e-05, "__label__fashion_beauty": 0.00016570091247558594, "__label__finance_business": 0.0002624988555908203, "__label__food_dining": 0.00030493736267089844, "__label__games": 0.0005011558532714844, "__label__hardware": 0.0007719993591308594, "__label__health": 0.00054168701171875, "__label__history": 0.0002932548522949219, "__label__home_hobbies": 0.00010502338409423828, "__label__industrial": 0.00047397613525390625, "__label__literature": 0.000335693359375, "__label__politics": 0.0002363920211791992, "__label__religion": 0.0004780292510986328, "__label__science_tech": 0.0273284912109375, "__label__social_life": 9.578466415405272e-05, "__label__software": 0.005584716796875, "__label__software_dev": 0.95947265625, "__label__sports_fitness": 0.00024771690368652344, "__label__transportation": 0.0005350112915039062, "__label__travel": 0.00020742416381835935}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 45054, 0.01176]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 45054, 0.38951]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 45054, 0.85113]], "google_gemma-3-12b-it_contains_pii": [[0, 2085, false], [2085, 5278, null], [5278, 8226, null], [8226, 11145, null], [11145, 13993, null], [13993, 16862, null], [16862, 18112, null], [18112, 19577, null], [19577, 20967, null], [20967, 22232, null], [22232, 25081, null], [25081, 26779, null], [26779, 29049, null], [29049, 32288, null], [32288, 34888, null], [34888, 37098, null], [37098, 40154, null], [40154, 41532, null], [41532, 43373, null], [43373, 45054, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2085, true], [2085, 5278, null], [5278, 8226, null], [8226, 11145, null], [11145, 13993, null], [13993, 16862, null], [16862, 18112, null], [18112, 19577, null], [19577, 20967, null], [20967, 22232, null], [22232, 25081, null], [25081, 26779, null], [26779, 29049, null], [29049, 32288, null], [32288, 34888, null], [34888, 37098, null], [37098, 40154, null], [40154, 41532, null], [41532, 43373, null], [43373, 45054, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 45054, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 45054, null]], "pdf_page_numbers": [[0, 2085, 1], [2085, 5278, 2], [5278, 8226, 3], [8226, 11145, 4], [11145, 13993, 5], [13993, 16862, 6], [16862, 18112, 7], [18112, 19577, 8], [19577, 20967, 9], [20967, 22232, 10], [22232, 25081, 11], [25081, 26779, 12], [26779, 29049, 13], [29049, 32288, 14], [32288, 34888, 15], [34888, 37098, 16], [37098, 40154, 17], [40154, 41532, 18], [41532, 43373, 19], [43373, 45054, 20]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 45054, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-06
|
2024-12-06
|
f0949685f09ad5d781205ded69d212b6fb86fc1e
|
CAMEO: a novel Context-Aware Middleware for Opportunistic Mobile Social Networks
V. Arnaboldi, M. Conti, F. Delmastro
IIT TR-02/2012
Technical report
Marzo 2012
CAMEO: a novel Context-Aware Middleware for Opportunistic Mobile Social Networks
[Technical Report]
Valerio Arnaboldi, Marco Conti, Franca Delmastro
IIT Institute, National Research Council of Italy
via G. Moruzzi, 1 - 56124 Pisa, Italy
email: firstname.lastname@iit.cnr.it
Abstract
Mobile systems are characterized by several dynamic components like users’ mobility, devices’ interoperability and interactions among users and their devices. In this scenario context-awareness and the emerging concept of social-awareness become a fundamental requirement to develop optimized systems and applications. In this paper we focus on a novel category of pervasive and mobile systems designed to implement new services and applications that improve users’ social interactions through the use of mobile devices. Specifically, we present CAMEO, a lightweight context-aware middleware platform designed to support the development of real-time Mobile Social Networks (MSN). MSN extend the paradigm of Online Social Networks with additional interaction opportunities generated by users’ mobility and opportunistic wireless communications. MSN are aimed at creating new and on-demand virtual social networks among mobile users which share interests, habits and needs by providing own-generated contents and without requiring a stable Internet connection. CAMEO provides to MSN applications a set of optimized services for the collection and elaboration of multidimensional context information in addition to efficient opportunistic communication protocols. A prototype of CAMEO has been implemented on Android platform.
Keywords: mobile social networks, middleware, context-aware, social-aware, opportunistic networks
1 Introduction
Context-awareness is a fundamental requirement in the design of mobile and pervasive computing systems. These systems are characterized by a high dynamism mainly due to users’ mobility, mobile devices’ interoperability, applications’ interaction with the external environment and, last but not least, interactions among users and devices. The system must be able to rapidly adapt to these changing conditions and satisfy as much as possible the user’s requirements. In
In this paper we focus on a novel category of pervasive and mobile systems designed to implement new services and applications that improve users’ social interactions through the use of mobile devices. Currently, with the increasing success of social networking applications and platforms, mobile users are looking for systems which are able to connect them with the others, in order to share user-generated contents to stimulate discussions on personal opinions or share experiences. They would like to be connected anywhere and anytime, through their personal mobile devices, as witnessed by the success of Online Social Network (OSN) applications and their mobile extensions (more than 100 million people actively using Facebook from their mobile devices\(^1\)). In OSN users’ interactions are generally based on existing social relationships, and they are mainly driven by common interests, creating thus virtual networks of known users (i.e., friends or friends of friends). In fact, in this case users’ interactions occur in the virtual world only.
In OSN, users’ interactions occur in the virtual world only. By extending this scenario with the interaction opportunities generated by users’ mobility and the emerging success of opportunistic wireless communications [9, 19], we can observe a convergence of virtual and physical social networks (i.e., network of contacts among users’ devices while users move in the physical space) [14]. In this case users and devices that occasionally encounter in a physical location can automatically discover their own common interests and directly generate and share content with a peer-to-peer communication, without accessing the Internet, creating thus a real-time mobile social network (MSN). In this way the network of devices becomes a proxy of the networks of their human owners. MSN are both people-centric, mapping human social interactions on the physical network of electronic devices, and content-centric, providing efficient services for content dissemination mainly following users’ interests. Figure 1 shows a representation of human, physical and virtual social networks.
\(^{1}\)http://blog.facebook.com/blog.php?post=297879717130
This scenario paves the way to the definition of a novel set of mobile applications designed to improve users’ social experiences by enlarging human interactions through the use of mobile devices.
Let’s show a practical example. Currently tourists are more and more autonomous in planning their trips and sharing their experiences through the Web, but they need to search in advance for general information on dedicated websites (e.g., www.tripadvisor.com) or through their social network, in case some of their friends has useful information on that topic. In this way they can access information that has been generated in the past and which is typically not tailored on the current user context. Simply moving around the city, they can encounter people that have just visited interesting attractions and that can provide them useful information not available on the Internet (e.g., “At 3PM there was 2 hours queue to visit Colosseum”, or “Yesterday dinner at that restaurant X was awful!”). A context-aware dissemination of this kind of information can help interested users to re-schedule their visit, further optimizing their time and avoiding unpleasant experiences.
Mobile Social Networks can also assume an important role in the definition of novel solutions for resource/information sharing in mobile systems. Let’s consider the emerging trend of Participatory Sensing applications [6]. Users generate contents related to air pollution, traffic monitoring, risky areas in a participatory fashion by exploiting their own resources (e.g., embedded sensors and camera) and then data is stored on a web server to be shared with others. These applications are typically web-based and exploit the single user with his smartphone as a sensor node to collect the data from the environment. In this way they neglect possibilities offered by the direct interactions among mobile users and their devices. Opportunistic communications and MSN can further enrich participatory sensing applications through the cooperative use of resources belonging to physically connected devices (i.e., devices that are within the same wireless communication range). For example, if node A measures a temperature of 30 °C but it is not able to measure the environmental humidity, it can ask this data to node B, which has the humidity sensor embedded in the smartphone. Then node A can locally correlate the collected information. In the same way a node can delegate to another node the computation of a complex operation or the collection and elaboration of data provided by external sources unreachable from the local device. In this case the MSN offers an opportunistic computing service [15].
Several other application domains can be improved by exploiting MSN: from environmental monitoring to personal safety by generating a real-time network of social support for risky situations (e.g., alert generated by a Personal Health System and forwarded to the MSN, advertisement of polluted city areas for asthmatic patients). In all these scenarios the main target is to improve users’ experiences encouraging users’ and devices’ interactions aimed at sharing useful information/resources for activities organization and life management in general. To this aim it is essential to exploit multi-dimensional context information (including users’ profile, generated contents, social interactions and information related to the surrounding environment) in order to provide highly personalized, efficient and effective services in a really dynamic environment.
In this paper we present CAMEO, a light-weight context-aware middleware platform designed to support the development of MSN applications on top of opportunistic networks. In Section 2 we provide a detailed definition of context
and context-awareness for MSN. Then, in Sections 3 we present CAMEO software architecture. Section 4 describes the main Android components used in the implementation and the description of the test application used to validate the prototype and its performances. The technical specification of CAMEO is presented in Section 5 with a detailed description of software packages and classes definition. Sections 6 and 7 describe the implementation of CAMEO MSN APIs, responsible for the management of the interactions between MSN applications and CAMEO. Finally, conclusions are presented in Section 8.
2 Context-awareness in opportunistic MSN
Currently the success of mobile applications and systems is directly tied to their potential impact on single individuals, groups of people sharing common interests and/or habits and, as a final goal, all the members of society. For this reason there are several application domains in which both research organizations and IT companies are investing by developing even more sophisticated mobile applications and systems, from personal health and family life to environment and social inclusion. Each of these areas contributes to improve the general well-being condition of people and their quality of life (see figure 2). The general paradigm of MSN can cover all these areas developing specific applications for each of them, but mobile systems’ features can be further optimized by a general platform able to integrate and correlate context information derived from different application domains. For this reason CAMEO introduces a general notion of context defined as well-being context, which provide a two-fold awareness to the mobile system, context- and social-awareness, by correlating local information of both user and his device (like user’s profile, interests, activities and local resources) with information derived from other users and devices, aimed at defining communication patterns among devices and social interactions among users. In this way, context information is used to optimize both lower-layer services, like networking and resources sharing, and upper-layer MSN applications.
It is worth noting that the ensemble of a user and his mobile devices represents the core entity of MSN to which we refer with the term “node”. We define the context of a node as the integration of three main components: the local context, the external context and the social context (see Figure 3).
The local context represents all the information related to the local user and

his mobile devices including:
- the user’s personal profile (i.e., all the information that describes interests and behavior of the user, like type and place of work, habits, life style, timetables). This information is generally provided directly by the user through dedicated interactions with the mobile device and its applications (e.g., through a digital agenda).
- the information collected by phone-embedded sensors (e.g., GPS, cameras, accelerometer, sound sensor), generally related to user’s activity recognition and sensing of the external environment;
- information related to the mobile device resource management (e.g., battery level, available storage capacity, CPU occupancy, tasks management);
- context information specified by each application running on the mobile device (e.g., attributes of contents generated by specific MSN applications, like comments in Tourist-MSN or physiological parameters of Personal Health Systems, interests of users in specific contents).
The external context represents the set of information derived by external sources with respect to the user’s mobile device. These sources are generally fixed or mobile stations aimed at monitoring specific parameters (e.g., air pollution, noise level, security cameras). This information can be integrated with participatory sensing data to improve the accuracy and fairness of detected information.
Finally, to better understand the definition of social context it is necessary to explain the reference scenario in terms of network of nodes. As previously cited, in MSN physical interactions among electronic devices within the same wireless transmission range (i.e., 1-hop wireless communications) reflect the physical proximity of users carrying the connected devices, creating thus (ephemeral) social physical communities. At the virtual layer, users are then grouped in virtual communities referring to their interests, habits or personal profiles. Due to users’ mobility, physical communities can be characterized by a high dynamism, causing temporary and partial overlaps between physical and virtual communities.
Connections among separate physical communities can be established through traveler nodes (i.e., nodes that while moving become members of multiple physical communities), which can be used as message ferries to disseminate content to interested users/devices that could never be directly connected with the source of that information. Figure 4 shows a simple example in which nodes belonging to the same physical community are characterized by different interests (highlighted with different colors), defining thus different virtual communities. Nodes moving between these physical communities can be used to carry data relevant to the different virtual communities they are in touch with.
The social context of a node represents the local view of the network obtained through 1-hop data exchange between nodes of the same social physical community. Specifically, by exchanging local context information among 1-hop neighbors, each node has a view of its current social context in terms of identification of its neighbors and their local context. In addition, since some nodes travel from a physical community to another, they collect social context information related to different physical communities. In our scenario, as it is generally assumed in the mobile social network literature [11], a home physical community is associated with each node, representing the community in which it spends more time and has stronger social links, while the traveling condition of a node is considered as a temporary visit to other communities driven by its social links.
The exchange of local context information allows also the local node to identify the virtual communities of its neighbors, grouping context information that identifies the same virtual community (e.g., tourists visiting Rome during Christmas holidays). In this way each node can maintain a map of encountered nodes belonging to different virtual and physical communities to develop optimized content dissemination protocols. To this aim, the social context of each node is composed of the social context related to its current physical community, and the historical social context related to nodes encountered in previously visited physical communities.
The aggregation and possible correlations of the three components of well-being context (local, external and social) allows the development of optimized MSN applications and services, making them able to identify the current situation the local node is immersed in and to take autonomous decisions for the
entire system optimization.
3 CAMEO Software Architecture
CAMERO is designed as a light-weight and modular software architecture able to manage the multidimensional notion of well-being context.
As shown in Figure 5, CAMEO architecture is represented by a single software package containing two subpackages: **Local Resource Management Framework (LRM-Fw)**, aimed at implementing features strictly related to the interaction with the local resources of the device, both hardware (e.g., embedded sensors, capacity, battery) and software (e.g., communication primitives and programming libraries), and **Context-Aware Framework (CA-Fw)**, aimed at storing, elaborating and disseminating all the context information. In addition, CAMEO provides an API toward MSN applications and it directly interacts with an external module for user profile definition called User Profile Module.
Figure 5: CAMEO software architecture.
3.1 Local Resource Management Framework
LRM-Fw is composed of three software modules:
**Network Manager.** In order to deploy real-time social networks, mobile devices must be able to exploit all the opportunities to communicate and exchange data through opportunistic communications. Therefore, the system must be able to interact with all the available wireless communication interfaces in order to decide the best communication medium under specific conditions. For this reason the Network Manager is responsible for the interaction of CAMEO with the wireless communication interfaces available on the mobile device (e.g., WiFi ad hoc, WiFi infrastructured, Bluetooth). It is also in charge of notifying other interested CAMEO components (specifically, the Transmission Manager) about the status of the connectivity between the local mobile device and his neighbors (e.g., wifi link status and quality information, Bluetooth active/not active status).
**Transmission Manager.** After the Network Manager has selected the wireless interface for the transmission of a specific message (both middleware or application messages), the Transmission Manager is in charge of establishing the communication channel between a source and a destination node through the use of standard communication primitives (e.g., socket, TCP/UDP protocols and related parameters). It also receives notification messages from the Network Manager in case of link errors or disconnection events toward the message destination node.
**Database Manager.** It is responsible for the interaction of LRM-Fw with the SQL database through operating system primitives. The database allows the permanent storage of selected context data to maintain the historical context profile and the definition of relationships among the context entities.
**Device Context Provider.** It is in charge of collecting context data derived from internal components of the mobile phone (e.g., embedded sensors, storage capacity level, battery level, resources consumption). Data specification and related parameters (e.g., sampling frequency for GPS or accelerometer, CPU occupancy threshold) are provided by the interaction of this module with the CA-Fw, following the directions provided by upper-layer applications or internal modules. Device Context Provider must be able to elaborate and combine data collected from multiple sources (either internal or external to the mobile device), generally characterized by proprietary data formats. In order to provide a uniform data format for sensors’ readings, CAMEO integrates Device Context Provider functionalities with SensorML standard [13]. SensorML defines a standard model (called Observations & Measurements) to express data observations collected from sensors, enabling interoperability between different components. In addition, SensorML enriches the information related to observations with performance characteristics (like accuracy, and threshold values) and information related to sensors’ discovery, location of sensor observations as well as processing of low-level sensor observations. SensorML is part of Sensor Web Enablement (SWE) framework [20], aimed at defining a standard model and encoding for the interoperability of sensor webs. Although SensorML is designed for the web, its extreme modularity makes it suitable also for mobile systems.
LRM-Fw directly interacts with operating system primitives and program-
ming libraries to access native functions like multi-thread and client-server communication protocols. For this reason, its implementation depends on the choice of the mobile device and its operating system. In CAMEO implementation we decided to use Google Nexus One smartphones running Android 2.2 due to the current success of this platform, but it can be easily adapted to other mobile platforms.
3.2 Context-Aware Framework
CA-Fw represents the core of CAMEO, being responsible for the collection and management of all the context information (local, external and social) and the development of internal context-based services (e.g., context aware forwarding protocols, context-based resource sharing services). It is composed of the following software modules:
- **Beaconing Module.** It is responsible for the neighbor-discovery procedure inside the current physical community and the periodical exchange of context information among 1-hop neighbors. It allows each node to build up and maintain its social context. In order to avoid the periodically sending of large quantity of data, the Beaconing Module implements an optimized procedure based on a consistency check of Context Manager data structures. This procedure will be explained in detail after the description of Context Manager functionalities.
- **Forwarding Manager.** It is responsible for the implementation of end-to-end communications. Specifically, it is designed to implement optimized forwarding protocols for opportunistic networks to successfully deliver a message to a multi-hop destination in case of intermittent connectivity (e.g., HiBOp forwarding protocol [10]).
- **Application Manager.** It is in charge of establishing a communication channel between each MSN application and CAMEO through MSN API (see Section 4.1).
- **Context Manager.** The main functionalities of Context Manager can be summarized in the following points: i) efficient storage and update of local, external and social components of well-being context; ii) elaboration of context information through the implementation of context-based utility functions. These features represent the core of context- and social-awareness implementation for both services and applications. Specifically, the result of an utility function can represent the utility degree of a content for a specific set of remote nodes, the ability of the local node to satisfy a remote request of resource sharing or the identification of the best next-hop neighbor to forward a message to a specific destination node. Currently, CAMEO prototype implements the utility function designed for content dissemination on opportunistic networks as detailed in Section 3.4.
For context storage and update, the Context Manager implements three separate data structures in order to provide efficient and reliable access methods to context information:
- **well-being Local Context table (wbLC):** it contains the context information related to local context components divided in the following subtables: User Profile derived from ContextManager interactions with the User Profile.
Module\textsuperscript{2} (see Figure 5): \textit{Application/Service Context} specified by each application developed on top of CAMEO and by single internal services; \textit{Device Context} derived from the interaction of ContextManager with DeviceContextProvider; \textit{External Context} as the set of information received from external sources, e.g., through sensing applications. This data structure encompasses the original notions of local and external context defined in Figure 3.
\textbf{current community Social Context table (ccSC)}: it contains the list of current 1-hop neighbors of the local node and their context information disseminated through periodic beaconing messages.
\textbf{historical Social Context table (hSC)}: it contains the list of communities previously visited by the local node associated with a timestamp as the temporal information of the last visit and a counter to maintain the number of visits in a predefined period of time. In addition, for each visited community hSC maintains the list of encountered nodes and their context. This information is essential to implement social-oriented policies (which will be described in more details in Section 3.4) for the evaluation of context-based utility functions. Due to its nature, this data structure needs non-volatile storage.
The content of ccSC represents thus a snapshot of the physical community of the local node in a specific instant. To collect this information, the beaconing procedure is in charge of efficiently exchanging relevant information of wbLC among the physical neighbors. Specifically, we assume that the Device context component of wbLC is not exchanged with other neighbors due to its real-time nature. In fact, Device context information is locally elaborated to evaluate the feasibility of specific actions (e.g., the local node receives a download request from a neighbor and it checks its local resources, like battery lifetime, before accepting and managing it), or represents information related to embedded sensors measurements, which generally has a limited temporal validity. Therefore, due to these strict time constraints, the validity of Device context is not compatible with the transmission over the network. Another component that does not necessarily require the periodical dissemination on the network is the External context. This information can be added to beaconing messages in case a service or an upper-layer application running on neighbors’ nodes is interested in it (e.g., participatory and urban sensing applications). In this case it is necessary an explicit request by the application.
As far as the remaining wbLC components, they are disseminated by the Beaconing module with the following optimized procedure. Each node maintains a data structure for each context, representing the history of the changes made to that specific context. Each entry of this history is associated with a version number. Each beacon message contains the node identifier and a set of these version numbers, one for each context component. Every beacon interval $T_b$ the Beaconing Module broadcasts a beacon message to 1-hop neighbors. Each neighbor checks in its data structures (ccSC and hSC) if it already has some information related to the sender node and, in case, if the stored context version corresponds to the version number embedded in the message. In case the neighbor has no context data related to the remote node, it directly sends a request
\textsuperscript{2}We decided to design this module externally to CAMEO since it can be implemented as a stand-alone application dedicated to the collection of user’s personal information independently of the running applications and services. However, the information provided by User Profile Module are integrated in wbLC with information provided by other services and applications that are mainly related to the user’s interests, habits and so on.
message for the entire context. Otherwise, in case one of more version numbers do not correspond with those embedded in the message, it sends a request to the remote node specifying the version numbers it owns. Then, the remote node replies with the only context updates made after the received version number. In this way, the contexts are synchronized incrementally, reducing the amount of data periodically exchanged and reducing network overhead. Moreover, to ensure the scalability of the system, when the versions’ history grows beyond a predefined limit, all the entries are collapsed into a unique version number, so that a limited amount of data is required to maintain an efficient context synchronization.
3.3 Community Detection
The dynamic identification of both current physical and virtual community of a node still represents an open research issue. In the last few years several algorithms for physical community detection have been presented in literature [16–18, 22] mainly based on the analysis of contact duration and number of contacts between pairs of users and their devices, assuming that individuals meet at a higher rate if they have one or more mutual friends. By correlating this information with the local context (and in particular with the personal user’s profile), we should be able to define cause-effect relationships for which a specific user is in a specific physical community for a specific period of time (e.g., Bob is in the gym community because on Friday, 2pm he attends a yoga lesson). As far as the virtual community detection, it mainly depends on context modeling and reasoning. In fact, assuming that each virtual community is identified by a specific set of context information shared by involved users, the current virtual community of a node can be identified analyzing the correspondence of context values of the local node with those of nodes stored to its social context. This is relatively easy in case of exact match of the values, but finding general expressions for the elaboration and correlation of multidimensional information is a complex research issue that will not be analyzed in this paper.
In order to validate CAMEO in real testbeds, we refer to the simplified scenario explained in Section 2. In this case most nodes are static and only a few of them sporadically travel from a community to another. Therefore, virtual and physical communities of static nodes do not change and only traveler nodes dynamically change their physical community. We assume that each node declares in the User Profile a home community and each traveler node dynamically detects its current physical community by analysing the home communities declared by its neighbors. The community detection algorithm is formalized in the next paragraphs.
Considering \( N \) as the set of nodes of the entire network, and \( C \) as the set of physical communities declared by nodes of \( N \), we can define the characteristic function \( I_c(n, c) \) to indicate the membership of node \( n \in N \) to physical community \( c \in C \), where \( c \subseteq N \) as:
\[
I_c(n, c) = \begin{cases}
1 & \text{if } n \in c \\
0 & \text{otherwise}
\end{cases}
\]
(1)
Assuming also that \( \text{Neigh}_{n,t} \) defines the neighbor set of node \( n \) at time \( t \) and that \( C_{\text{neigh}_{n,t}} \subseteq C \) is the set of communities declared by those neighbors at
time \( t \), we can define the current physical community of node \( n \) at time \( t \) as
\[
c_{cc}(n, t) = \underset{c_i \in C}{\text{argmax}} \sum_{n_j \in \text{Neigh}_{n,t}} I_{c_j}(n_j, c_i)
\]
(2)
Therefore, every time a node receives a beacon from a new neighbor, CAMEO computes (2) through optimized accesses to CA-Fw data structures to discover the current physical community it is immersed in. This approach to community detection works well whenever most nodes are static or spend a limited amount of time outside their home community.
This is a simplified solution for community detection problem that allows us to validate the efficiency of CAMEO in detecting a change of the social context of the local node. More advanced solutions are under investigation [12]. The most effective will be implemented in CAMEO.
### 3.4 Context-based utility function for content dissemination
Generally, context-based utility functions are designed to evaluate context information in order to optimize specific features of services or applications. Since content dissemination represents a common functionality of MSN applications, the definition of a context-based function to determine the utility of a content for a set of users is essential to optimize content distribution over an opportunistic network. In fact, the selection of content to be disseminated strictly depends on users’ interests and nodes’ resource capabilities. In CAMEO we have exploited the utility-based content-dissemination framework proposed in [8]. Specifically, the utility function can be defined as follows:
\[
U(c) = u_l(c) + \sum_{i \neq l} \omega_i u_i(c)
\]
(3)
where \( u_l(c) \) is the utility of a specific content for the local user, \( u_i(c) \) is the utility for the \( i^{th} \) community the user is in contact with, and \( \omega_i \) is a weight that defines the willingness of the user to cooperate with the \( i^{th} \) community (i.e., to spend its own resources to increase content availability for that community). In this way the local node offers its own resources to download contents available in its current physical community which can be useful for users belonging to previously encountered communities, assuming that in the next future the local node will visit again those communities.
The utility function \( u \) is defined by an application or an internal service and it is passed to the Context Manager through a dedicated interface by specifying the set of relevant context information and their evaluation algorithm. Every time a node changes its current physical community, the Context Manager uses the utility functions to evaluate the usefulness of the contents available in the new community for the node (or for the nodes it is in touch with).
A node can be characterized by different social behaviors by providing different weights to different communities. In [8] the authors have introduced and investigated a set of social-oriented policies describing 5 types of behaviors: i) Uniform Social (US), in which all the visited communities assume the same weight; ii) Present (P), which favours only the current community; iii) Most Frequently Visited (MFV), evaluating the frequency of community changes; iv)
Future (F) and Most Likely Next (MLN) which require a probabilistic prediction of future visited community. Currently CAMEO supports both US and MFV policies, leaving to upper-layer applications the evaluation of the utility of a content for the current physical community. In fact, the applications often require a direct interaction with the final user to select an interesting content available on 1-hop neighbors. Therefore, as far as US, all the $\omega$ weights are set to 1 and the Context Manager calculates the utility function for all the previously encountered communities. For MFV, the $\omega$ weights are set proportionally to the number of visits of the local node to each community. In this way US policy facilitates data dissemination, because each node picks up all the contents found to be interesting for any previously encountered communities. On the other hand MVF policy reduces the data dissemination rate optimizing the local resources dedicated to preventive download procedure.
Other utility functions can be implemented by CAMEO for the optimization of specific services and applications as further explained in section 6.
4 Android implementation
To validate CAMEO functionalities and evaluate its performances, we implemented it on Android 2.2 platform. We have chosen Android due to its constantly rising popularity and because it naturally supports Java-based distributed and concurrent applications in addition to an easy access to system information like those related to embedded devices (such as GPS, sensors, camera). To better understand our implementation choices, we briefly introduce the definition of basic Android software components provided to developers. For additional technical details we refer the reader to [1].
The Application Framework is the main component of Android provided to the external developer. On top of this framework, developers can design their own applications with the same full access to APIs used by the core applications. An Android application is composed of four components: (i) Activities, representing the Graphical User Interface of the related application; (iii) Services, which allow the background execution of independent tasks; (iii) Broadcast Receivers, which listen for broadcast event communications among different applications and the other Android modules; (iv) Content Providers, which make a specific set of application’s data available to other applications. The activation of the three first components and their following interactions are implemented through the intent mechanism: asynchronous messages exchanged between Application Framework components and containing the definition of the action to be performed.
Since CAMEO is a middleware platform supporting multiple concurrent applications, we decided to implement it as an Android Service. Thus, MSN applications, designed and developed to interact with CAMEO, are implemented as Android applications. A single instance of CAMEO, running on a separate process, is shared among all the applications. To support the communication between CAMEO and MSN applications, we exploit an Android technique based on the interprocess communication paradigm (IPC). Each application can define a set of special communication interfaces visible to the other applications by which they can exchange data. The interfaces are defined through a proprietary interface definition language called AIDL (Android Interface Definition
Language) similar to other popular languages based on CORBA or COM specifications (e.g., Java CORBA IDL [5] and C++ CORBA IDL [2]). The data that can be transferred through AIDL interfaces is limited to Parcelable objects, which are designed as a high-performance IPC transport objects. This mechanism allows fast data exchange to the detriment of limited design flexibility due to the lack of standard functions for the marshalling of Parcelable objects.
As far as the support for direct connection between devices, Android does not allow the activation of Wi-Fi ad hoc mode on its devices either through the standard graphical interface or programming libraries. Nevertheless, due to the open source nature of Android, it is quite simple to overcome this limitation. Specifically, in the last few years a lot of customized aftermarket firmwares based on Android Open Source Project (AOSP) were released by third parties. Some of these natively supports ad-hoc mode, avoiding the developer to be bound to the tedious work of building his own ad-hoc ready firmware. In order to have a stable development platform and to allow fast 1-hop opportunistic communications, we decided to install CyanogenMod 6.1.0-N1 firmware [3] on our smartphones. CyanogenMod 6 is based on Android 2.2 AOSP code and adds a lot of useful functionalities in addition to the ad-hoc mode support (see [3] for details). The devices equipped with the last version of Android (4.0) and some phones running Android 2.3 with proprietary operating system extensions support Wi-Fi Direct standard. This standard allows terminals to communicate directly with each other using Wi-Fi connectivity, in a way similar to ad hoc mode. Some research work has been done to support opportunistic networking over Wi-Fi Direct [21]. In future work we will assess the feasibility of adopting Wi-Fi Direct as the communication standard for CAMEO-enabled devices. At present, the pure Wi-Fi ad hoc mode provides more flexibility and a full support for opportunistic communication paradigms.
4.1 CAMEO APIs toward MSN applications
CAMEO defines two different APIs to provide social- and context-aware functionalities to MSN applications. The first one manages MSN applications requests toward CAMEO, while the second one handles CAMEO notifications toward the applications (e.g., messages, events, errors). In the following we summarize the features provided by the two APIs; the complete specification can be found in Sections 6 and 7.
- **Registration.** Each application must be registered to CAMEO in order to obtain the access to all the internal functionalities. During the registration a unique identifier is assigned to the application.
- **Application Context specification.** Each application specifies to CAMEO the set of context information relevant for its execution. This information is stored in wbLC table and disseminated over the network through the beaconing procedure as part of the local context of the node.
- **Utility function evaluation.** MSN applications can ask CAMEO to implement the algorithm for utility function evaluation. To this aim the
---
3This is still valid for the current version including the 2.2 stock firmware shipped with Google Nexus One
14
application must provide to CAMEO the algorithm and related parameters.
- **Message sending/receiving.** Applications can send/receive messages toward remote nodes. They are notified in case of failure during a message sending. Since Android launches an independent instance of Dalvik JVM [4] for each process with a predefined memory size (32MB), the system can present overload problems in case of exchange of big application contents. To avoid this situation, CAMEO implements a file segmentation procedure splitting the requested content into fixed length data chunks (512Kb each). The correct reception of each chunk is acknowledged, so that the sender node can manage automatic retransmissions of not acknowledged chunks.
CAMEO notifications toward MSN applications are implemented using callback interfaces created during the registration procedure. To manage different concurrent applications, CAMEO maintains the list of registered and currently active callback interfaces assigning a logical communication port to each of them. A special communication port is used by the Context Manager for context data exchange over the network and its interaction with the other internal modules of CAMEO. CAMEO notifications are related to the following events:
- **Application content discovery.** Every time CAMEO finds a new application content from a remote node it informs the interested application.
- **Neighbors discovery.** CAMEO informs the applications when a neighbor enters/exits the 1-hop area.
- **Community discovery.** CAMEO informs the applications when the current community changes.
### 4.2 Tourist-MSN Application
Tourist-MSN [7] is a real example of MSN application developed on top of CAMEO. It is aimed at improving people experience during tourist visits by allowing individuals to create, collect and share useful information related to geolocated points of interest (POIs) through opportunistic wireless communications among their mobile devices. Tourists can create multimedia contents denoted as posts. They are characterized by a title, a textual content (to comment or express impressions related to the POI), and optional information like audio files, images or videos. Posts are divided into categories (e.g., events, cultural visits, transportation) in which users can express their interests. Tourist-MSN implements also an opportunistic text chat that allows a limited group of users to communicate in a quasi real-time fashion. Each chat is identified by a title and a category.
Tourist-MSN specifies through MSN API the following information as Application Context to be disseminated over the network by CAMEO: (i) title and category for each post and chat generated by the local user; (ii) user’s interests in specific categories of posts and chats.
Therefore, through context dissemination each node becomes aware of the available contents in its current physical community. However, due to intermittent connectivity conditions characterizing opportunistic networks, the manage-
ment of a real-time chat can be developed only among 1-hop neighbors. Instead, posts’ distribution results in an asynchronous content exchange. Users can increase the content of a post/chat by adding their own comments. Subsequently, CAMEO distributes the updates on the network.

(a) List of posts. In green: posts already downloaded. In red: posts available for download
(b) Interface for the creation of new posts
(c) Post comments
(d) Realtime opportunistic chat
(e) Chat members
(f) Add a new comment to an existing post
Figure 6: Screenshots of Tourist-MSN Graphical User Interface
Every time a new post or a new chat matching the interests expressed by the user becomes available from a neighbor node, CAMEO notifies the application with an event message. The application then informs the user through the GUI about the availability of the new content and the user can decide whether to download the post (or join the chat room) or not. At the same time, CAMEO evaluates the utility function for contents available in the current physical community with respect to the interests of previously encountered users by implementing US and MFV social-oriented policies described in Section 3.4. Then,
the subset of contents that maximizes the utility satisfying local nodes’s require-
ments (e.g., memory availability, permanence time in the current community) are downloaded.
Figure 6 shows some screenshots of Tourist-MSN application running on Google Nexus One.
5 CAMEO Technical Specification
In this Section we give a detailed description of CAMEO software architecture, starting from software packages up to class definition. All the classes have been written in Java programming language for Android operating system.
CAMEO is composed of the following software packages:
- cnr.CAMEO
- cnr.CAMEO.CAFw
- cnr.CAMEO.CAFw.ContextManaging
- cnr.CAMEO.LRMFw
- cnr.Common
5.1 cnr.CAMEO
This package contains basic classes of CAMEO, such as the class of the main GUI launched when CAMEO starts running, some custom exceptions classes and the external module dedicated to user context management (User Profile Module). The package is composed of the following classes:
- **MainActivity**: extends Activity (Android). This class represents the main GUI of CAMEO and is the first class launched by CAMEO. The purpose of the MainActivity class is to provide a simple graphical interface by which the user can control the execution of CAMEO service (i.e., start and stop its execution). Moreover, the GUI contains a button by which the user can launch the UserProfileModule Activity.
- **RemoteListEntry**: This class defines an entry of the Android Callback-RemoteList, the structure where the applications callback interfaces are maintained. CAMEO uses these callback interfaces to communicate with the registered applications. When an application registers to CAMEO, a RemoteListEntry is added to the RemoteCallbackList. The entry is removed in case of application log out or crash.
- **ServiceManager**: extends Service (Android). It is the main component of CAMEO as the Android Service that, running in background, provides all context-aware and opportunistic features to the registered applications. The ServiceManager is launched by the MainActivity and is responsible for the creation of all the components of CAMEO CAV-Fw (i.e., the ContextManager, the Forwarding module, and the Beaconing module). The functionalities of the ApplicationManager (see Section 3.2) are implemented inside the ServiceManager, indeed the ServiceManager implements the AIDL interface PlatformInterface, which provides CAMEO
Figure 7: cnr.CAMEO package - UML class diagram
MSN APIs to the applications. The ServiceManager takes also care of the following tasks:
1. to register each application that wants to interact with CAMEO, setting a unique identifier (i.e., a port number) for it;
2. to receive and process requests coming from the registered applications (see Section 6 for further details);
3. to notify the applications when an event occurs or a message is received (using the identifier to select the right application). A detailed description of this notifications can be found in Section 7.
- **UserProfileModule**: extends Activity (Android). This class defines the module in charge of acquiring and managing the user profile (e.g., preferences, personal profile, ...). The UserProfileModule is a GUI component that allows the user to insert and successively modify his personal information into a set of pre-defined fields (e.g., name, gender, age, home community, preferences).
- **ReliableMessageNotSentException**: extends Exception. This class defines a custom exception used to handle the errors generated when CAMEO tries to send a message using the reliable transmission protocol (TCP), but the TransmissionManager (package cnr.CAMEO.LRMFw) has not been started yet or it is in idle state.
- **UnreliableMessageNotSentException**: extends Exception. This class defines a custom exception used to handle errors generated when CAMEO tries to send a message using unreliable transmission (UDP), but the TransmissionManager (package cnr.CAMEO.LRMFw) has not been started yet or it is in idle state.
### 5.2 cnr.CAMEO.CAFw
This package contains all the classes related to the Context-Aware Framework (CA-Fw, see Section 3.2 for further details on the services provided by this framework). The package is composed of the following classes:
- **Beaconing**: This class represents the BeaconingModule in charge of generating periodic messages, also known as beacons (defined by the BeaconMessage class), used by CAMEO to advertise the presence of a node towards the 1-hop neighbors in the network. Beaconing uses a Java Timer to generate the beacons periodically and passes them to the TransmissionManager, which is responsible for sending the messages over the network. Beacons are also used to disseminate the version numbers of the nodes’ contexts, informing the remote nodes of the presence of available contents.
- **BeaconMessage**: extends AbstractMessage. This class defines the structure of a beacon message. It contains a BeaconContent and a timestamp that reflects the beacon creation time. The timestamp is used in conjunction with the contexts’ version numbers. If CAMEO crashes or is restarted, the version numbers are reset to zero. The timestamp is thus used to identify contexts with the same version number, but with possibly different content.
Figure 8: cnr.CAMEO.CAFw package - UML class diagram
• **BeaconContent**: implements `Serializable`. This class defines the content of a beacon message. This content is formed of a set of version numbers related to the contexts of the user and of the applications running on CAMEO which a node wants to send over the network. The `BeaconContent` also contains the ip address of the sender, which is used as unique identifier for the nodes.
• **CALRMInterface**. This interface is used for the communication between the Local Resource Management Framework (LRMFw) and the Context-Aware Framework (CAFw). The modules of the LRMFw can send their notifications toward the CAFw using this interface, without knowing which module will elaborate the requests, ensuring the modularity of the system. It is implemented by `ServiceManager`.
• **Forwarding**. This class is designed to implement an opportunistic routing algorithm. Currently the class is empty and CAMEO uses only 1-hop communication. In future work we plan to implement a context-based forwarding protocol as HiBOp [10].
• **AbstractMessage**. implements `Serializable`. This is an abstract superclass defining a generic message, containing the properties and methods in common between the `BeaconMessage` class and the `Message` class.
• **Message**. extends `AbstractMessage`. This class defines a message to be exchanged over the network between applications through CAMEO. The message has a payload field, inherited from the superclass `AbstractMessage`. This generic payload represents the content of the message. To deliver the message to the right application at the destination node, CAMEO assign a port number to each registered application and each `Message` is marked with the respective port number.
### 5.3 cnr.CAMEO.CAFW.ContextManaging
This is a sub-package of `cnr.CAMEO.CAFW` containing all the classes related to the management of context information. The content of the package is the following:
• **AbstractContext**. implements `Serializable`. This is a superclass representing a generic context. The `AbstractContext` contains a version number and an `HashMap` representing the key-value pairs related to a context.
• **ContextManager**. implements `DeviceContextUpdater`. This is the main class for the management of context data. The `ContextManager` is responsible for the maintenance of context information related to the user, the device and the applications involving the local node and the remote nodes encountered in the network. It is in charge of exchanging `ContextMessages` between nodes in the network, performing the synchronization of context data between peers. The `ContextManager` manages the `ContextTable`, adding, updating or removing context information related to remote nodes when needed. Moreover, it maintains the `LocalContext`, containing the context data of the local node. Through the `DeviceContextUpdater` the `ContextManager` exposes the methods used by the applications to modify the local device context. The `ContextManager` checks
Figure 9: cnr.CAMEO.CAFw.ContextManaging package - UML class diagram (1)
Figure 10: cnr.CAMEO.CAFw.ContextManaging package - UML class diagram (2)
the beacons received from the Beaconing module to find if a neighbor has entered or quit the 1-hop area. When a new neighbor is detected, the ContextManager adds an entry to the ContextTable. Then, it periodically checks the ccSC table (see Section 3.2 for further details) to determine if a neighbor has left the 1-hop area. The ContextManager also evaluates, after an explicit request received from an application, the utility of one or more application content for one or more nodes of a community or a set of communities using the utility function provided by the application and adopting the social-oriented policies required by the application (see Section 3.4). The ContextManager is also responsible for the discovery of the current community of the local node.
• ContextMessage: implements Serializable. This class defines a special type of message used to exchange context information between nodes in the network. The Beaconing module advertises available context data inside the 1-hop neighborhood. If a node finds new available context information from a new neighbor, or a new version of a context from a known neighbor, it sends a request to the remote node through a ContextMessage, eventually indicating the version of the context it already has to perform an incremental synchronization. The node which receives a context request sends its whole context (or part of it with respect to the version number received from the other node) to the requester, using a ContextMessage. The ContextMessage is used both for user contexts and application contexts.
• ContextTable. This class represents the data structure holding the context information related to remote nodes. Specifically, this class implements both the data structures defined as ccSC and hSC (see Section 3.2). The ccSC table is implemented as a Java Map object, where the ip address of the remote nodes is used as index of the table and each entry contains the context data of the remote node. When a new neighbor is detected, the ContextManager notifies the ContextTable, which adds an entry to the ccSC table. If the beacons of a neighbor are not received for a certain period of time, the ContextManager asks the ContextTable to remove the respective entry from the ccSC table. In this case the ContextTable moves the information related to the node that has left the 1-hop area from the ccSC table to the hSC table. The hSC table is implemented as a SQLite database and accessed by CAMEO using the SQLite APIs offered by Android. The ccSC and the hSC are also accessed by the ContextManager during the evaluation of the utility function for a given application content.
• LocalContext: extends AbstractContext. The LocalContext represents the context information related to the local node, including the application contexts and the user context. It is the implementation of the well-being Local Context table (wbLC) (see Section 3.2 for further details). This data structure is implemented as a set of Java HashTable, each of which represents a context (i.e., user, device, external and application) and contains its key-value pairs. The information of the LocalContext is sent to the other nodes in the network using BeaconMessage and ContextMessage objects. When the ContextManager receives a ContextMessage with a
request for a certain context with a specified version number, the LocalContext checks if the version number and the timestamp provided by the remote node are valid, then it returns the subset of information required by the remote node to synchronize its context data with the local data. Each change related to the data of a certain local context is tracked within a Java TreeMap object called history, so that each entry of the history, indexed by a version number, points toward the key-value pairs modified during the update. Each application can provide multiple updates at the same time to avoid frequent context updates which can lead to network congestion due to the potentially large amount of data to be exchanged for the synchronization procedure. Subsequent updates of the same context key-value pairs are collapsed into the last version number of the history data structure to reduce the dimension of the TreeMap. If the number of updates of a context data exceeds a pre-defined threshold, all the versions are collapsed into the last version number of the history.
- **NodeContext**: implements Serializable. The NodeContext class defines a wrapper for all the context information related to a remote node and represents a generic entry for the hSC of the ContextTable object. The NodeContext object contains the user context and the list of application contexts related to a remote node.
- **RemoteContext**: extends AbstractContext. This class defines a generic context related to a remote node. A Remote context contains the key-value pairs that defines the context.
- **TableEntry**: implements Serializable. This class represents an entry of the ccSC table, indexed inside the ContextTable with the ip address of the respective remote node. Each TableEntry contains a NodeContext object and a timestamp, used to discover a neighbor put event (in case the beacons of a certain remote node are not received for a pre-defined period of time).
- **DeviceContextUpdater**. This interface allows the ContextManager to update the status of the local device context following the input of Local Resource Management Framework.
5.4 cnr.CAMEO.LRMFw
This package contains all the classes concerning the Local Resource Management Framework of CAMEO. This framework is in charge of performing all the lower level tasks, such as the exchange of messages over the network, the management of the wireless network interface, the management of the SQLite database and the access to the information related to the hardware sensors of the mobile device. The package is composed of the following classes:
- **ContextProvider**: extends Thread, implements DCPCtxManagerListener. The ContextProvider is in charge of acquiring information regarding the context of the device, including sensors data, battery status, memory usage, etc. The ContextProvider periodically checks the status.
Figure 11: cnr.CAMEO.LRMFw package - UML class diagram (1)
of different hardware components with different sample rates. These parameters are defined by the `ContextManager` class of the CA-Fw based also on applications’ requirements.
- **DBAdapter**: extends `SQLiteOpenHelper` (Android). This class contains all the methods used to access and manage the SQLite databases.
- **DCPContextManagerListener**: This interface allows the `ContextManager` to retrieve information concerning the device, gathered through the `ContextProvider`.
- **LRMCAMInterface**: This interface defines the methods to be used by the CAFw to communicate with the LRMFw.
- **NetworkManager**: It interacts with Android to manage the wireless network interface. It can request Android to activate/deactivate the network interface and it listens for status changes of the interface.
- **OutgoingReliableMsgInfo**: This class represents a generic message stored inside the outgoing queue of the `TransmissionManager`. Each of these messages has a destination address, a port (used by CAMEO to identify the destination application) and a payload containing the message itself. This class is related to a message to be sent using the reliable communication protocol (TCP).
• OutgoingUnreliableMsgInfo. This class represents a generic message stored inside the outgoing queue of the TransmissionManager. Compared with the OutgoingReliableMsgInfo, this class concerns unreliable communications (UDP).
• TransmissionManager: implements LRMCAInterface. The TransmissionManager is responsible for the data transmission over the network. It provides two different types of communication: reliable and unreliable. The former uses Java ServerSocket and Socket objects, while the latter uses DatagramSocket objects for data exchange. The TransmissionManager maintains two messages queues (for reliable and unreliable communication respectively).
5.5 cnr.CAMEO.LRMFw.Sensors
This package contains all the classes aimed at managing the collection of data coming from the different hardware sensors. The names of the classes are self-explanatory. The content of the package is the following:
• AccelerometerManager
• GyroscopeManager
• LightManager
• MagneticFieldManager
• OrientationManager
• ProximityManager
• PressureManager
• TemperatureManager
5.6 cnr.CAMEO.common
This package contains the classes shared between CAMEO and MSN applications, which must be imported by applications as external libraries to allow the application’s access to CAMEO functionalities.
• ApplicationContext: implements Serializable. This class represents the context related to a specific application as key-value pairs directly specified by the application. Each application can store or retrieve its own ApplicationContext object using CAMEO MSN API.
• ContentEvaluator: implements Serializable. This class is aimed at giving a simple way to define a set of criteria to be used by the ContextManager during the evaluation of the utility function. Each application can create its own ContentEvaluator, defining a list of fields (called evaluators) which represents the tags of the application contents to be matched with the respective preferences of the user. The application can weight the different evaluators with a value between 0 and 1. The utility function is computed as the weighted sum of the binary results of the matches of
Figure 13: cnr.CAMEO.Common package - UML class diagram
the fields defined by the evaluators. For example, an hypothetical application exchanging music content over the network defines two evaluators, named “genre” and “format” respectively, the former mapping the musical genre of an audio file with the preference of the user regarding musical genres and the latter identifying a link between the file format of the application content (e.g., mp3, wav, ...) and the preferred format of the user. The ContextManager matches the values mapped by the evaluators, returning 1 if the value related to the content and the preference of the user match, and 0 otherwise. The utility function calculated by the ContextManager for this application would be the sum of the values returned by the match of the two evaluators multiplied by their respective evaluator weights, then multiplied by the weight given to the community to which the involved nodes belong to, defined by the chosen social-oriented policy (see Section 3.4).
• LocalMessage: implements Parcelable (Android). This class defines the format of the messages exchanged between the applications and CAMEO. A LocalMessage can be an application request sent by the applications toward CAMEO or a CAMEO event sent toward the applications. A LocalMessage contains a TYPE field, which determines the type of request or notification. It contains also additional information (e.g., an application message to be sent over the network or additional parameters required by some requests) placed in two different optional fields. The first field is called content and is used for local communication, while the second field is called payload and it is used for remote communication. The different types of LocalMessage are explained in more details in Section 6.
In addition, CAMEO provides two AIDL interfaces to manage the communication between the middleware platform and each MSN application. Specifically:
• MSNInterface (AIDL). This interface contains the methods offered by CAMEO to the applications. The application directly uses MSNInterface object to call CAMEO methods.
• CallbackInterface (AIDL). This interface defines the methods called by CAMEO to send various notifications to the applications. The application must implement this interface and pass the instantiated object to CAMEO, which uses it to send each notification to the application.
These interfaces are detailed in the following Sections.
6 MSN Interface
MSN interface provides the following functionalities to MSN applications.
6.1 Register with CAMEO
• Name of the service primitive: RegisterClient
• Description: This method allows an application to register with CAMEO. CAMEO approves the registration if the port specified by the
application is not yet in use, otherwise it denies the registration. If the registration is approved, CAMEO adds the interface provided by the application during the registration to the callback interface list and uses it to communicate back to the application. A registered application can access the services provided by CAMEO, using all the other methods described in this Section. If an application is not registered, it can only use the RegisterClient primitive. A call to any other method will cause CAMEO to reply with an error message.
- **Type:** Confirmed, Synchronous, Local
- **Semantics:** The primitive shall provide the following parameters:
1. **Port** (input)
- Type: integer
- Accepted values: a valid integer
- Description: The port number used as unique ID to redirect the notifications and the messages received by CAMEO over the network to the right application.
2. **Callback** (input)
- Type: CallbackInterface
- Accepted values: a valid CallbackInterface object
- Description: This is the interface that the application must provide to CAMEO in order to register. CAMEO uses these interfaces to communicate back with the applications.
3. **LocalMessage** (output)
- Description: This is the returned value containing the result of the registration procedure.
- Returned value: FAILED if the registration procedure has failed or SUCCESS otherwise.
- **When generated:** This primitive is generated when an application wants to register with CAMEO.
- **Effects of receipt:** The receipt of this primitive by the ServiceManager (which implements the PlatformInterface interface) causes CAMEO to start the registration process. The ServiceManager checks if the port provided by the application is already in use. If this is the case it denies the registration, otherwise it accepts it.
### 6.2 Send a Generic Local Request
- **Name of the service primitive:** SendLocalRequest
- **Description:** This is a generic primitive provided by CAMEO to allow the applications to request various types of services.
- **Type:** Confirmed, Local
- **Semantics:** The primitive shall provide the following parameters:
1. **request** (input)
- **Type:** LocalMessage
- **Accepted values:** a valid LocalMessage object
- **Description:** This parameter contains the specification of the request that the application wants to send to CAMEO. The request type is specified inside the field `TYPE` of the LocalMessage object. Additional content required by some requests can be placed inside the field `Content` of the LocalMessage object.
2. **LocalMessage** (output)
- **Description:** This is the returned value containing the result of the request.
- **Returned value:** FAILED if the request has failed or SUCCESS otherwise.
- **When generated:** This primitive is generated when an application wants to request a service to CAMEO.
- **Effects of receipt:** The receipt of this primitive by the ServiceManager (which implements the PlatformInterface interface) causes CAMEO to evaluate and perform the actions required by the application, depending on the type of request the application has made. The different types of requests that the application can send to CAMEO are listed below:
### 6.2.1 Unregister with CAMEO
- **TYPE of LocalMessage:** UNREGISTER_APP
- **Description:** This type of local request is used by the applications that want to cancel their registration with CAMEO.
- **Additional parameters:** none
- **When generated:** This local request is generated when an application wants to unregister with CAMEO.
- **Effects of receipt:** The receipt of this primitive by the ServiceManager causes CAMEO to unregister the application and return a LocalMessage object with the TYPE field set to SUCCESS.
### 6.2.2 Update Application Context
- **TYPE of LocalMessage:** UPDATE_APP_CONTEXT
- **Description:** This type of local request is used by the applications that want to update their application context (i.e., add, modify or delete the key-value pairs of the context data).
- **Additional parameters:** The application context that the application wants to store instead of the original one, saved into an ApplicationContext object.
- **When generated:** This local request is generated when an application wants to update its application context stored inside CAMEO.
• **Effects of receipt:** The receipt of this primitive by the ServiceManager causes CAMEO to update the context information related to the application that called the primitive. CAMEO distributes the new application context over the network, adding a new version number and performing the operations described in Section 5.3 regarding the LocalContext class. The request always returns a LocalMessage with the field TYPE set to SUCCESS.
### 6.2.3 Get User Context
- **TYPE of LocalMessage:** GET_USR_CONTEXT
- **Description:** This type of local request is used by the applications that want to retrieve the user context information.
- **Additional parameters:** none
- **When generated:** This local request is generated when an application wants to read the user context information.
- **Effects of receipt:** If the user context has been set, the ServiceManager returns it to the application inside the field CONTENT of a LocalMessage object with the TYPE field set to SUCCESS. If the user context does not exist the ServiceManager replies to the application with a LocalMessage with the field TYPE set to FAILED.
### 6.2.4 Get Device Context
- **TYPE of LocalMessage:** GET_DEV_CONTEXT
- **Description:** This type of local request is used by the applications that want to retrieve the device context information.
- **Additional parameters:** none
- **When generated:** This local request is generated when an application wants to read the device context information.
- **Effects of receipt:** If the device context has been set, the ServiceManager returns it to the application inside the field CONTENT of a LocalMessage object with the TYPE field set to SUCCESS. If the device context does not exist the ServiceManager replies to the application with a LocalMessage with the field TYPE set to FAILED.
### 6.2.5 Get Application Context
- **TYPE of LocalMessage:** GET_APP_CONTEXT
- **Description:** This type of local request is used by the applications that want to retrieve its own context information.
- **Additional parameters:** none
- **When generated:** This local request is generated when an application wants to read its own context information.
• **Effects of receipt:** If the application context has been set, the ServiceManager returns it to the application inside the field `CONTENT` of a `LocalMessage` object with the `TYPE` field set to `SUCCESS`. If the application context does not exist, the ServiceManager replies to the application with a `LocalMessage` with the field `TYPE` set to `FAILED`.
6.2.6 Get Remote Application Context
- **TYPE of LocalMessage:** `GET_REMOTE_APP_CONTEXT`
- **Description:** This type of local request is used by the applications that want to retrieve the application context information of a remote node.
- **Additional parameters:** The IP address of the remote node of which the application wants to retrieve the application context.
- **When generated:** This local request is generated when an application wants to read an application context of a remote node.
- **Effects of receipt:** If the application context has been set for the given IP address, the ServiceManager returns it to the application inside the field `CONTENT` of a `LocalMessage` object with the `TYPE` field set to `SUCCESS`. If the application context does not exist for the specified IP address, the ServiceManager replies to the application with a `LocalMessage` with the field `TYPE` set to `FAILED`.
6.2.7 Get Remote Contexts For a Given Community
- **TYPE of LocalMessage:** `GET_CONTEXTS_OF_COMMUNITY`
- **Description:** This type of local request is used by the applications that want to retrieve the context information of all the nodes belonging to a selected community.
- **Additional parameters:** A string representing the unique identifier of the community for which the application wants to retrieve the context information.
- **When generated:** This local request is generated when an application wants to read the context data related to all the nodes of a given community. This situation usually occurs when the application wants to evaluate the utility function for a given application content with respect to the interests of the nodes of a specific community.
- **Effects of receipt:** If the given community identifier is valid and the set of contexts related to that community inside CAMEO is not empty, the ServiceManager returns the related context information to the application in the field `CONTENT` of a `LocalMessage` object with the `TYPE` field set to `SUCCESS`. If there is no information inside CAMEO regarding the given community, the ServiceManager replies to the application with a `LocalMessage` with the field `TYPE` set to `FAILED`.
34
6.2.8 Evaluate The Utility For One or More Application Contents
- **TYPE of LocalMessage:** EVALUATE
- **Description:** This type of local request is used by the applications that want to obtain an evaluation of the utility function for one or more application contents with respect to the interests of the nodes of a previously encountered community.
- **Additional parameters:** A List of ids related to the application contents for which the application wants to evaluate the utility, a utility function expressed by a list of `ContentEvaluator` and an integer specifying the preferred social-oriented policy.
- **When generated:** This local request is generated when an application wants to obtain an evaluation of the utility function for one or more application content.
- **Effects of receipt:** The `ServiceManager` asks the `ContextManager` to calculate the result of the utility function for the given content ids. The content properties are retrieved from the remote contexts stored inside CAMEO. The `ContentEvaluator` is used to match the properties of the given contents with the preferences of the user, found inside the local user context. To better understand how the `ContextManager` calculates the utility of the given contents see Section 5.6. If the contents ids passed by the requester application are valid and are known to CAMEO, the `ServiceManager` replies to the application with a list containing the results of the utility function evaluations indexed by the content id. The result is placed in the field `CONTENT` of a `LocalMessage` object with the `TYPE` field to SUCCESS. If the content ids are not valid or unknown to CAMEO, the `ServiceManager` replies to the application with a `LocalMessage` with the field `TYPE` set to FAILED.
6.3 Send a Message Over The Network
- **Name of the service primitive:** SendMessage
- **Description:** This method allows an application to send a customized message over the network to another node running an application using the same communication port as the sender.
- **Type:** Confirmed, Asynchronous, Remote
- **Semantics:** The primitive shall provide the following parameters:
1. `packet` (input)
- Type: `LocalMessage`
- Accepted values: a valid `LocalMessage` with the boolean field `NET_MESSAGE` set to `TRUE` and the field `PAYLOAD` set with the content which the application wants to send over the network.
- Description: This is the content of the message to be sent over the network.
2. dest (input)
- Type: ip address
- Accepted values: any valid ip addresses
- Description: This is the ip address of the destination.
3. broadcast (input)
- Type: boolean
- Accepted values: { true, false }
- Description: Whether or not the packet must be sent to all the
nodes in the 1-hop area (like a beacon)
4. result (output)
- Type: boolean
- Accepted values: { true, false }
- Description: True if the message is successfully processed by the
TransmissionManager. False in case of errors.
- **When generated**: This primitive is generated when an application wants
to send a message to one or more nodes in the network. It is typically
used to exchange application contexts.
- **Effects of receipt**: The receipt of this primitive by the ServiceManager
causes CAMEO to pass the message to the ForwardingManager, which cal-
culates the best next hop for the delivery of the message and then passes
the message to the TransmissionManager, which sends the message over
the network toward the destination. If the TransmissionManager has
not been started yet or is in idle state, a ReliableMessageNotSentExcep-
tion (or a UnreliableMessageNotSentException in case of a broadcast
message) is thrown.
7 Callback Interface
Each application must extend CallbackInterface, implementing the methods
called by CAMEO to notify events. During the registration procedure each
application passes its custom CallbackInterface to CAMEO. CAMEO main-
tains a list of CallbackInterface in a dedicated data structure. An entry of
this list is removed when the respective application logs out or crashes. The list
is indexed by the application identifier. CAMEO sends two different types of no-
tifications: (i) broadcast notifications (i.e., events to be sent to all the registered
applications); (ii) direct notifications (i.e., events, errors or messages destined to
a specific application). When CAMEO sends a notification, it passes to the ap-
plications a LocalMessage object, containing the details of the occurred event.
In the following we provide a detailed description of the methods defined by the
CallbackInterface.
7.1 Receive a Generic Asynchronous Event
- **Name of the method**: onNewEvent
• **Description:** This is a generic method used by CAMEO to notify different types of events.
• **When generated:** This method is invoked by CAMEO to notify the applications about an event occurred.
• **Parameters returned by CAMEO:** a `LocalMessage` containing the details of the notification. The different types of notifications are identified by the field `TYPE` of the returned `LocalMessage`. The types of event defined by CAMEO are the following:
- `LINK_LOSS`: Generated by the `NetworkManager` when the status of the network interface changes from `CONNECTED` to `DISCONNECTED`. No extra parameters.
- `LINK_RESUME`: Generated by the `NetworkManager` when the status of the network interface changes from `DISCONNECTED` to `CONNECTED`. No extra parameters.
- `NEIGHBOR_IN`: Generated by the `ContextManager` when a new neighbor joins the 1-hop area. The ip address of the new neighbor is passed inside the `payload`.
- `NEIGHBOR_OUT`: Generated by the `ContextManager` when a known neighbor leaves the 1-hop area. The ip address of the neighbor is passed inside the `payload`.
- `COMMUNITY_CHANGED`: Generated by the `ContextManager` when the actual community changes. The unique identifier of the new community is passed inside the `payload`.
- `NEIGHBOR_CONTEXT_UPDATED`: Generated by the `ContextManager` when new information regarding a neighbor context is available. This information can refer to both user and application contexts. Thanks to this notification the applications can discover new contents available for downloading from remote nodes. The ip address of the neighbor and the version numbers related to its contexts, received from the `Beaconing` module, are passed to the application inside the `payload` object.
7.2 Receive a Message From a Remote Node
• **Name of the method:** onReceivedMessage
• **Description:** This notification informs the applications about the presence of an incoming message from a remote node.
• **When generated:** This method is invoked by CAMEO when it receives a message for a specific application from a remote node.
• **Parameters returned by CAMEO:** a `LocalMessage` containing the content of the message and the ip address of the sender.
8 Conclusions
The main novelty of CAMEO is a light-weight context-aware middleware platform to allow easy and efficient development of MSN applications in opportunistic networks. In this paper we provided a detailed description of CAMEO architecture and the technical specification of its software components. The prototype has been tested and evaluated through an experimental testbed. Performance results showed the efficiency of CAMEO in collecting and managing a multidimensional context and supporting the development of a real example of MSN applications dedicated to tourists. Currently we are extending CAMEO in several directions. We are analyzing the applicability of a context model based on CML language to improve reasoning capabilities of CAMEO and identify possible extensions in the context definition. Concurrently, we are integrating SensorML standard in the Device Context Provider module in order to implement a uniform data format for sensors’ readings. This will allow CAMEO to provide additional functionalities for the automatic characterization of a node context based on sensor readings.
References
|
{"Source-Url": "http://cnd.iit.cnr.it/fdelmastro/pub/techrep/cameo_tr.pdf", "len_cl100k_base": 16207, "olmocr-version": "0.1.53", "pdf-total-pages": 40, "total-fallback-pages": 0, "total-input-tokens": 83625, "total-output-tokens": 19126, "length": "2e13", "weborganizer": {"__label__adult": 0.0004239082336425781, "__label__art_design": 0.0004856586456298828, "__label__crime_law": 0.0002689361572265625, "__label__education_jobs": 0.0006957054138183594, "__label__entertainment": 0.00018656253814697263, "__label__fashion_beauty": 0.0002058744430541992, "__label__finance_business": 0.0002911090850830078, "__label__food_dining": 0.0003838539123535156, "__label__games": 0.0014886856079101562, "__label__hardware": 0.003875732421875, "__label__health": 0.0004429817199707031, "__label__history": 0.0005445480346679688, "__label__home_hobbies": 9.608268737792967e-05, "__label__industrial": 0.0003864765167236328, "__label__literature": 0.0003237724304199219, "__label__politics": 0.00027751922607421875, "__label__religion": 0.0004410743713378906, "__label__science_tech": 0.1314697265625, "__label__social_life": 0.0001614093780517578, "__label__software": 0.054351806640625, "__label__software_dev": 0.8017578125, "__label__sports_fitness": 0.00031256675720214844, "__label__transportation": 0.0006918907165527344, "__label__travel": 0.00039076805114746094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 86331, 0.02358]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 86331, 0.28376]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 86331, 0.87691]], "google_gemma-3-12b-it_contains_pii": [[0, 165, false], [165, 2362, null], [2362, 4558, null], [4558, 8328, null], [8328, 10911, null], [10911, 13028, null], [13028, 15553, null], [15553, 16475, null], [16475, 19916, null], [19916, 23022, null], [23022, 26958, null], [26958, 30375, null], [30375, 33620, null], [33620, 37084, null], [37084, 40332, null], [40332, 43356, null], [43356, 44627, null], [44627, 47042, null], [47042, 47090, null], [47090, 49901, null], [49901, 49954, null], [49954, 52956, null], [52956, 53029, null], [53029, 53103, null], [53103, 56406, null], [56406, 59294, null], [59294, 59353, null], [59353, 60545, null], [60545, 62687, null], [62687, 62743, null], [62743, 65455, null], [65455, 67641, null], [67641, 69835, null], [69835, 72003, null], [72003, 74554, null], [74554, 77043, null], [77043, 79297, null], [79297, 81537, null], [81537, 83952, null], [83952, 86331, null]], "google_gemma-3-12b-it_is_public_document": [[0, 165, true], [165, 2362, null], [2362, 4558, null], [4558, 8328, null], [8328, 10911, null], [10911, 13028, null], [13028, 15553, null], [15553, 16475, null], [16475, 19916, null], [19916, 23022, null], [23022, 26958, null], [26958, 30375, null], [30375, 33620, null], [33620, 37084, null], [37084, 40332, null], [40332, 43356, null], [43356, 44627, null], [44627, 47042, null], [47042, 47090, null], [47090, 49901, null], [49901, 49954, null], [49954, 52956, null], [52956, 53029, null], [53029, 53103, null], [53103, 56406, null], [56406, 59294, null], [59294, 59353, null], [59353, 60545, null], [60545, 62687, null], [62687, 62743, null], [62743, 65455, null], [65455, 67641, null], [67641, 69835, null], [69835, 72003, null], [72003, 74554, null], [74554, 77043, null], [77043, 79297, null], [79297, 81537, null], [81537, 83952, null], [83952, 86331, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 86331, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 86331, null]], "pdf_page_numbers": [[0, 165, 1], [165, 2362, 2], [2362, 4558, 3], [4558, 8328, 4], [8328, 10911, 5], [10911, 13028, 6], [13028, 15553, 7], [15553, 16475, 8], [16475, 19916, 9], [19916, 23022, 10], [23022, 26958, 11], [26958, 30375, 12], [30375, 33620, 13], [33620, 37084, 14], [37084, 40332, 15], [40332, 43356, 16], [43356, 44627, 17], [44627, 47042, 18], [47042, 47090, 19], [47090, 49901, 20], [49901, 49954, 21], [49954, 52956, 22], [52956, 53029, 23], [53029, 53103, 24], [53103, 56406, 25], [56406, 59294, 26], [59294, 59353, 27], [59353, 60545, 28], [60545, 62687, 29], [62687, 62743, 30], [62743, 65455, 31], [65455, 67641, 32], [67641, 69835, 33], [69835, 72003, 34], [72003, 74554, 35], [74554, 77043, 36], [77043, 79297, 37], [79297, 81537, 38], [81537, 83952, 39], [83952, 86331, 40]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 86331, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
0aea6a66fcdbcd0d90e908e9105ec3f5944f4a35
|
Abstract
The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document defines HTTP/1.1 conditional requests, including metadata header fields for indicating state changes, request header fields for making preconditions on such state, and rules for constructing the responses to a conditional request when one or more preconditions evaluate to false.
Status of This Memo
This is an Internet Standards Track document.
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). Further information on Internet Standards is available in 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/rfc7232.
Copyright Notice
Copyright (c) 2014 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.
This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.
# Table of Contents
1. Introduction ...................................................... 4
1.1. Conformance and Error Handling ............................ 4
1.2. Syntax Notation ........................................... 4
2. Validators ....................................................... 5
2.1. Weak versus Strong ....................................... 5
2.2. Last-Modified .............................................. 7
2.2.1. Generation ........................................... 7
2.2.2. Comparison ........................................... 8
2.3. ETag ........................................................ 9
2.3.1. Generation ........................................... 10
2.3.2. Comparison ........................................... 10
2.3.3. Example: Entity-Tags Varying on Content-Negotiated Resources ............. 11
2.4. When to Use Entity-Tags and Last-Modified Dates ............ 12
3. Precondition Header Fields .................................... 13
3.1. If-Match ................................................. 13
3.2. If-None-Match ........................................... 14
3.3. If-Modified-Since ....................................... 16
3.4. If-Unmodified-Since .................................... 17
3.5. If-Range ............................................... 18
4. Status Code Definitions ........................................ 18
4.1. 304 Not Modified ....................................... 18
4.2. 412 Precondition Failed ................................ 19
5. Evaluation ....................................................... 19
6. Precedence ....................................................... 20
7. IANA Considerations ........................................... 22
7.1. Status Code Registration ................................ 22
7.2. Header Field Registration ................................ 22
8. Security Considerations ........................................ 22
9. Acknowledgments ................................................ 23
10. References .................................................... 24
10.1. Normative References .................................. 24
10.2. Informative References ................................ 24
Appendix A. Changes from RFC 2616 ................................ 25
Appendix B. Imported ABNF ...................................... 25
Appendix C. Collected ABNF ...................................... 26
Index ........................................................................ 27
1. Introduction
Conditional requests are HTTP requests [RFC7231] that include one or more header fields indicating a precondition to be tested before applying the method semantics to the target resource. This document defines the HTTP/1.1 conditional request mechanisms in terms of the architecture, syntax notation, and conformance criteria defined in [RFC7230].
Conditional GET requests are the most efficient mechanism for HTTP cache updates [RFC7234]. Conditionals can also be applied to state-changing methods, such as PUT and DELETE, to prevent the "lost update" problem: one client accidentally overwriting the work of another client that has been acting in parallel.
Conditional request preconditions are based on the state of the target resource as a whole (its current value set) or the state as observed in a previously obtained representation (one value in that set). A resource might have multiple current representations, each with its own observable state. The conditional request mechanisms assume that the mapping of requests to a "selected representation" (Section 3 of [RFC7231]) will be consistent over time if the server intends to take advantage of conditionals. Regardless, if the mapping is inconsistent and the server is unable to select the appropriate representation, then no harm will result when the precondition evaluates to false.
The conditional request preconditions defined by this specification (Section 3) are evaluated when applicable to the recipient (Section 5) according to their order of precedence (Section 6).
1.1. Conformance and Error Handling
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].
Conformance criteria and considerations regarding error handling are defined in Section 2.5 of [RFC7230].
1.2. Syntax Notation
This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC5234] with a list extension, defined in Section 7 of [RFC7230], that allows for compact definition of comma-separated lists using a '#' operator (similar to how the '*' operator indicates
replication). Appendix B describes rules imported from other documents. Appendix C shows the collected grammar with all list operators expanded to standard ABNF notation.
2. Validators
This specification defines two forms of metadata that are commonly used to observe resource state and test for preconditions: modification dates (Section 2.2) and opaque entity tags (Section 2.3). Additional metadata that reflects resource state has been defined by various extensions of HTTP, such as Web Distributed Authoring and Versioning (WebDAV, [RFC4918]), that are beyond the scope of this specification. A resource metadata value is referred to as a "validator" when it is used within a precondition.
2.1. Weak versus Strong
Validators come in two flavors: strong or weak. Weak validators are easy to generate but are far less useful for comparisons. Strong validators are ideal for comparisons but can be very difficult (and occasionally impossible) to generate efficiently. Rather than impose that all forms of resource adhere to the same strength of validator, HTTP exposes the type of validator in use and imposes restrictions on when weak validators can be used as preconditions.
A "strong validator" is representation metadata that changes value whenever a change occurs to the representation data that would be observable in the payload body of a 200 (OK) response to GET.
A strong validator might change for reasons other than a change to the representation data, such as when a semantically significant part of the representation metadata is changed (e.g., Content-Type), but it is in the best interests of the origin server to only change the value when it is necessary to invalidate the stored responses held by remote caches and authoring tools.
Cache entries might persist for arbitrarily long periods, regardless of expiration times. Thus, a cache might attempt to validate an entry using a validator that it obtained in the distant past. A strong validator is unique across all versions of all representations associated with a particular resource over time. However, there is no implication of uniqueness across representations of different resources (i.e., the same strong validator might be in use for representations of multiple resources at the same time and does not imply that those representations are equivalent).
There are a variety of strong validators used in practice. The best are based on strict revision control, wherein each change to a representation always results in a unique node name and revision identifier being assigned before the representation is made accessible to GET. A collision-resistant hash function applied to the representation data is also sufficient if the data is available prior to the response header fields being sent and the digest does not need to be recalculated every time a validation request is received. However, if a resource has distinct representations that differ only in their metadata, such as might occur with content negotiation over media types that happen to share the same data format, then the origin server needs to incorporate additional information in the validator to distinguish those representations.
In contrast, a "weak validator" is representation metadata that might not change for every change to the representation data. This weakness might be due to limitations in how the value is calculated, such as clock resolution, an inability to ensure uniqueness for all possible representations of the resource, or a desire of the resource owner to group representations by some self-determined set of equivalency rather than unique sequences of data. An origin server SHOULD change a weak entity-tag whenever it considers prior representations to be unacceptable as a substitute for the current representation. In other words, a weak entity-tag ought to change whenever the origin server wants caches to invalidate old responses.
For example, the representation of a weather report that changes in content every second, based on dynamic measurements, might be grouped into sets of equivalent representations (from the origin server’s perspective) with the same weak validator in order to allow cached representations to be valid for a reasonable period of time (perhaps adjusted dynamically based on server load or weather quality). Likewise, a representation’s modification time, if defined with only one-second resolution, might be a weak validator if it is possible for the representation to be modified twice during a single second and retrieved between those modifications.
Likewise, a validator is weak if it is shared by two or more representations of a given resource at the same time, unless those representations have identical representation data. For example, if the origin server sends the same validator for a representation with a gzip content coding applied as it does for a representation with no content coding, then that validator is weak. However, two simultaneous representations might share the same strong validator if they differ only in the representation metadata, such as when two different media types are available for the same representation data.
Strong validators are usable for all conditional requests, including cache validation, partial content ranges, and "lost update" avoidance. Weak validators are only usable when the client does not require exact equality with previously obtained representation data, such as when validating a cache entry or limiting a web traversal to recent changes.
2.2. Last-Modified
The "Last-Modified" header field in a response provides a timestamp indicating the date and time at which the origin server believes the selected representation was last modified, as determined at the conclusion of handling the request.
Last-Modified = HTTP-date
An example of its use is
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
2.2.1. Generation
An origin server SHOULD send Last-Modified for any selected representation for which a last modification date can be reasonably and consistently determined, since its use in conditional requests and evaluating cache freshness ([RFC7234]) results in a substantial reduction of HTTP traffic on the Internet and can be a significant factor in improving service scalability and reliability.
A representation is typically the sum of many parts behind the resource interface. The last-modified time would usually be the most recent time that any of those parts were changed. How that value is determined for any given resource is an implementation detail beyond the scope of this specification. What matters to HTTP is how recipients of the Last-Modified header field can use its value to make conditional requests and test the validity of locally cached responses.
An origin server SHOULD obtain the Last-Modified value of the representation as close as possible to the time that it generates the Date field value for its response. This allows a recipient to make an accurate assessment of the representation’s modification time, especially if the representation changes near the time that the response is generated.
An origin server with a clock MUST NOT send a Last-Modified date that is later than the server’s time of message origination (Date). If the last modification time is derived from implementation-specific
metadata that evaluates to some time in the future, according to the origin server’s clock, then the origin server MUST replace that value with the message origination date. This prevents a future modification date from having an adverse impact on cache validation.
An origin server without a clock MUST NOT assign Last-Modified values to a response unless these values were associated with the resource by some other system or user with a reliable clock.
2.2.2. Comparison
A Last-Modified time, when used as a validator in a request, is implicitly weak unless it is possible to deduce that it is strong, using the following rules:
- The validator is being compared by an origin server to the actual current validator for the representation and,
- That origin server reliably knows that the associated representation did not change twice during the second covered by the presented validator.
or
- The validator is about to be used by a client in an If-Modified-Since, If-Unmodified-Since, or If-Range header field, because the client has a cache entry for the associated representation, and
- That cache entry includes a Date value, which gives the time when the origin server sent the original response, and
- The presented Last-Modified time is at least 60 seconds before the Date value.
or
- The validator is being compared by an intermediate cache to the validator stored in its cache entry for the representation, and
- That cache entry includes a Date value, which gives the time when the origin server sent the original response, and
- The presented Last-Modified time is at least 60 seconds before the Date value.
This method relies on the fact that if two different responses were sent by the origin server during the same second, but both had the same Last-Modified time, then at least one of those responses would have a Date value equal to its Last-Modified time. The arbitrary 60-second limit guards against the possibility that the Date and Last-Modified values are generated from different clocks or at somewhat different times during the preparation of the response. An implementation MAY use a value larger than 60 seconds, if it is believed that 60 seconds is too short.
2.3. ETag
The "ETag" header field in a response provides the current entity-tag for the selected representation, as determined at the conclusion of handling the request. An entity-tag is an opaque validator for differentiating between multiple representations of the same resource, regardless of whether those multiple representations are due to resource state changes over time, content negotiation resulting in multiple representations being valid at the same time, or both. An entity-tag consists of an opaque quoted string, possibly prefixed by a weakness indicator.
```
ETag = entity-tag
entity-tag = [ weak ] opaque-tag
weak = %x57.2F ; "W/", case-sensitive
opaque-tag = DQUOTE *etagc DQUOTE
etagc = %x21 / %x23-7E / obs-text
; VCHAR except double quotes, plus obs-text
```
Note: Previously, opaque-tag was defined to be a quoted-string ([RFC2616], Section 3.11); thus, some recipients might perform backslash unescaping. Servers therefore ought to avoid backslash characters in entity tags.
An entity-tag can be more reliable for validation than a modification date in situations where it is inconvenient to store modification dates, where the one-second resolution of HTTP date values is not sufficient, or where modification dates are not consistently maintained.
Examples:
```
ETag: "xyzzy"
ETag: W/"xyzzy"
ETag: ""
```
An entity-tag can be either a weak or strong validator, with strong being the default. If an origin server provides an entity-tag for a representation and the generation of that entity-tag does not satisfy all of the characteristics of a strong validator (Section 2.1), then the origin server MUST mark the entity-tag as weak by prefixing its opaque value with "W/" (case-sensitive).
2.3.1. Generation
The principle behind entity-tags is that only the service author knows the implementation of a resource well enough to select the most accurate and efficient validation mechanism for that resource, and that any such mechanism can be mapped to a simple sequence of octets for easy comparison. Since the value is opaque, there is no need for the client to be aware of how each entity-tag is constructed.
For example, a resource that has implementation-specific versioning applied to all changes might use an internal revision number, perhaps combined with a variance identifier for content negotiation, to accurately differentiate between representations. Other implementations might use a collision-resistant hash of representation content, a combination of various file attributes, or a modification timestamp that has sub-second resolution.
An origin server SHOULD send an ETag for any selected representation for which detection of changes can be reasonably and consistently determined, since the entity-tag’s use in conditional requests and evaluating cache freshness ([RFC7234]) can result in a substantial reduction of HTTP network traffic and can be a significant factor in improving service scalability and reliability.
2.3.2. Comparison
There are two entity-tag comparison functions, depending on whether or not the comparison context allows the use of weak validators:
- Strong comparison: two entity-tags are equivalent if both are not weak and their opaque-tags match character-by-character.
- Weak comparison: two entity-tags are equivalent if their opaque-tags match character-by-character, regardless of either or both being tagged as "weak".
The example below shows the results for a set of entity-tag pairs and both the weak and strong comparison function results:
<table>
<thead>
<tr>
<th>ETag 1</th>
<th>ETag 2</th>
<th>Strong Comparison</th>
<th>Weak Comparison</th>
</tr>
</thead>
<tbody>
<tr>
<td>W/"1"</td>
<td>W/"1"</td>
<td>no match</td>
<td>match</td>
</tr>
<tr>
<td>W/"1"</td>
<td>W/"2"</td>
<td>no match</td>
<td>no match</td>
</tr>
<tr>
<td>W/"1"</td>
<td>"1"</td>
<td>no match</td>
<td>match</td>
</tr>
<tr>
<td>"1"</td>
<td>"1"</td>
<td>match</td>
<td>match</td>
</tr>
</tbody>
</table>
2.3.3. Example: Entity-Tags Varying on Content-Negotiated Resources
Consider a resource that is subject to content negotiation ([Section 3.4 of [RFC7231]](https://tools.ietf.org/html/rfc7231)), and where the representations sent in response to a GET request vary based on the Accept-Encoding request header field ([Section 5.3.4 of [RFC7231]](https://tools.ietf.org/html/rfc7231)):
>> Request:
```
GET /index HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip
```
In this case, the response might or might not use the gzip content coding. If it does not, the response might look like:
>> Response:
```
HTTP/1.1 200 OK
Date: Fri, 26 Mar 2010 00:05:00 GMT
ETag: "123-a"
Content-Length: 70
Vary: Accept-Encoding
Content-Type: text/plain
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
```
An alternative representation that does use gzip content coding would be:
>> Response:
HTTP/1.1 200 OK
Date: Fri, 26 Mar 2010 00:05:00 GMT
ETag: "123-b"
Content-Length: 43
Vary: Accept-Encoding
Content-Type: text/plain
Content-Encoding: gzip
...binary data...
Note: Content codings are a property of the representation data, so a strong entity-tag for a content-encoded representation has to be distinct from the entity tag of an unencoded representation to prevent potential conflicts during cache updates and range requests. In contrast, transfer codings (Section 4 of [RFC7230]) apply only during message transfer and do not result in distinct entity-tags.
2.4. When to Use Entity-Tags and Last-Modified Dates
In 200 (OK) responses to GET or HEAD, an origin server:
- SHOULD send an entity-tag validator unless it is not feasible to generate one.
- MAY send a weak entity-tag instead of a strong entity-tag, if performance considerations support the use of weak entity-tags, or if it is unfeasible to send a strong entity-tag.
- SHOULD send a Last-Modified value if it is feasible to send one.
In other words, the preferred behavior for an origin server is to send both a strong entity-tag and a Last-Modified value in successful responses to a retrieval request.
A client:
- MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server.
3. Precondition Header Fields
This section defines the syntax and semantics of HTTP/1.1 header fields for applying preconditions on requests. Section 5 defines when the preconditions are applied. Section 6 defines the order of evaluation when more than one precondition is present.
3.1. If-Match
The "If-Match" header field makes the request method conditional on the recipient origin server either having at least one current representation of the target resource, when the field-value is "*", or having a current representation of the target resource that has an entity-tag matching a member of the list of entity-tags provided in the field-value.
An origin server MUST use the strong comparison function when comparing entity-tags for If-Match (Section 2.3.2), since the client intends this precondition to prevent the method from being applied if there have been any changes to the representation data.
If-Match = "*" / 1#entity-tag
Examples:
If-Match: "xyzzy"
If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
If-Match: *
If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource (i.e., to
prevent the "lost update" problem). It can also be used with safe methods to abort a request if the selected representation does not match one already stored (or partially stored) from a prior request.
An origin server that receives an If-Match header field MUST evaluate the condition prior to performing the method (Section 5). If the field-value is "*", the condition is false if the origin server does not have a current representation for the target resource. If the field-value is a list of entity-tags, the condition is false if none of the listed tags match the entity-tag of the selected representation.
An origin server MUST NOT perform the requested method if a received If-Match condition evaluates to false; instead, the origin server MUST respond with either a) the 412 (Precondition Failed) status code or b) one of the 2xx (Successful) status codes if the origin server has verified that a state change is being requested and the final state is already reflected in the current state of the target resource (i.e., the change requested by the user agent has already succeeded, but the user agent might not be aware of it, perhaps because the prior response was lost or a compatible change was made by some other user agent). In the latter case, the origin server MUST NOT send a validator header field in the response unless it can verify that the request is a duplicate of an immediately prior change made by the same user agent.
The If-Match header field can be ignored by caches and intermediaries because it is not applicable to a stored response.
3.2. If-None-Match
The "If-None-Match" header field makes the request method conditional on a recipient cache or origin server either not having any current representation of the target resource, when the field-value is "*", or having a selected representation with an entity-tag that does not match any of those listed in the field-value.
A recipient MUST use the weak comparison function when comparing entity-tags for If-None-Match (Section 2.3.2), since weak entity-tags can be used for cache validation even if there have been changes to the representation data.
If-None-Match = "*" / 1#entity-tag
Examples:
If-None-Match: "xyzzy"
If-None-Match: W/"xyzzy"
If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
If-None-Match: *
If-None-Match is primarily used in conditional GET requests to enable efficient updates of cached information with a minimum amount of transaction overhead. When a client desires to update one or more stored responses that have entity-tags, the client SHOULD generate an If-None-Match header field containing a list of those entity-tags when making a GET request; this allows recipient servers to send a 304 (Not Modified) response to indicate when one of those stored responses matches the selected representation.
If-None-Match can also be used with a value of "*" to prevent an unsafe request method (e.g., PUT) from inadvertently modifying an existing representation of the target resource when the client believes that the resource does not have a current representation (Section 4.2.1 of [RFC7231]). This is a variation on the "lost update" problem that might arise if more than one client attempts to create an initial representation for the target resource.
An origin server that receives an If-None-Match header field MUST evaluate the condition prior to performing the method (Section 5). If the field-value is "*", the condition is false if the origin server has a current representation for the target resource. If the field-value is a list of entity-tags, the condition is false if one of the listed tags match the entity-tag of the selected representation.
An origin server MUST NOT perform the requested method if the condition evaluates to false; instead, the origin server MUST respond with either a) the 304 (Not Modified) status code if the request method is GET or HEAD or b) the 412 (Precondition Failed) status code for all other request methods.
Requirements on cache handling of a received If-None-Match header field are defined in Section 4.3.2 of [RFC7234].
3.3. If-Modified-Since
The "If-Modified-Since" header field makes a GET or HEAD request method conditional on the selected representation’s modification date being more recent than the date provided in the field-value. Transfer of the selected representation’s data is avoided if that data has not changed.
If-Modified-Since = HTTP-date
An example of the field is:
A recipient MUST ignore If-Modified-Since if the request contains an If-None-Match header field; the condition in If-None-Match is considered to be a more accurate replacement for the condition in If-Modified-Since, and the two are only combined for the sake of interoperating with older intermediaries that might not implement If-None-Match.
A recipient MUST ignore the If-Modified-Since header field if the received field-value is not a valid HTTP-date, or if the request method is neither GET nor HEAD.
A recipient MUST interpret an If-Modified-Since field-value’s timestamp in terms of the origin server’s clock.
If-Modified-Since is typically used for two distinct purposes: 1) to allow efficient updates of a cached representation that does not have an entity-tag and 2) to limit the scope of a web traversal to resources that have recently changed.
When used for cache updates, a cache will typically use the value of the cached message’s Last-Modified field to generate the field value of If-Modified-Since. This behavior is most interoperable for cases where clocks are poorly synchronized or when the server has chosen to only honor exact timestamp matches (due to a problem with Last-Modified dates that appear to go "back in time" when the origin server’s clock is corrected or a representation is restored from an archived backup). However, caches occasionally generate the field value based on other data, such as the Date header field of the cached message or the local clock time that the message was received, particularly when the cached message does not contain a Last-Modified field.
When used for limiting the scope of retrieval to a recent time window, a user agent will generate an If-Modified-Since field value based on either its own local clock or a Date header field received from the server in a prior response. Origin servers that choose an exact timestamp match based on the selected representation’s Last-Modified field will not be able to help the user agent limit its data transfers to only those changed during the specified window.
An origin server that receives an If-Modified-Since header field SHOULD evaluate the condition prior to performing the method (Section 5). The origin server SHOULD NOT perform the requested method if the selected representation’s last modification date is earlier than or equal to the date provided in the field-value; instead, the origin server SHOULD generate a 304 (Not Modified) response, including only those metadata that are useful for identifying or updating a previously cached response.
Requirements on cache handling of a received If-Modified-Since header field are defined in Section 4.3.2 of [RFC7234].
3.4. If-Unmodified-Since
The "If-Unmodified-Since" header field makes the request method conditional on the selected representation’s last modification date being earlier than or equal to the date provided in the field-value. This field accomplishes the same purpose as If-Match for cases where the user agent does not have an entity-tag for the representation.
If-Unmodified-Since = HTTP-date
An example of the field is:
A recipient MUST ignore If-Unmodified-Since if the request contains an If-Match header field; the condition in If-Match is considered to be a more accurate replacement for the condition in If-Unmodified-Since, and the two are only combined for the sake of interoperating with older intermediaries that might not implement If-Match.
A recipient MUST ignore the If-Unmodified-Since header field if the received field-value is not a valid HTTP-date.
A recipient MUST interpret an If-Unmodified-Since field-value’s timestamp in terms of the origin server’s clock.
If-Unmodified-Since is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agents might be acting in parallel on a resource that does not supply entity-tags with its representations (i.e., to prevent the "lost update" problem). It can also be used with safe methods to abort a request if the selected representation does not match one already stored (or partially stored) from a prior request.
An origin server that receives an If-Unmodified-Since header field MUST evaluate the condition prior to performing the method (Section 5). The origin server MUST NOT perform the requested method if the selected representation’s last modification date is more recent than the date provided in the field-value; instead the origin server MUST respond with either a) the 412 (Precondition Failed) status code or b) one of the 2xx (Successful) status codes if the origin server has verified that a state change is being requested and the final state is already reflected in the current state of the target resource (i.e., the change requested by the user agent has already succeeded, but the user agent might not be aware of that because the prior response message was lost or a compatible change was made by some other user agent). In the latter case, the origin server MUST NOT send a validator header field in the response unless it can verify that the request is a duplicate of an immediately prior change made by the same user agent.
The If-Unmodified-Since header field can be ignored by caches and intermediaries because it is not applicable to a stored response.
3.5. If-Range
The "If-Range" header field provides a special conditional request mechanism that is similar to the If-Match and If-Unmodified-Since header fields but that instructs the recipient to ignore the Range header field if the validator doesn’t match, resulting in transfer of the new selected representation instead of a 412 (Precondition Failed) response. If-Range is defined in Section 3.2 of [RFC7233].
4. Status Code Definitions
4.1. 304 Not Modified
The 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition evaluated to false. In other words, there is no need for the server to transfer a representation of the target resource because the request indicates that the client, which made the request
conditional, already has a valid representation; the server is therefore redirecting the client to make use of that stored representation as if it were the payload of a 200 (OK) response.
The server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 (OK) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary.
Since the goal of a 304 response is to minimize information transfer when the recipient already has one or more cached representations, a sender SHOULD NOT generate representation metadata other than the above listed fields unless said metadata exists for the purpose of guiding cache updates (e.g., Last-Modified might be useful if the response does not have an ETag field).
Requirements on a cache that receives a 304 response are defined in Section 4.3.4 of [RFC7234]. If the conditional request originated with an outbound client, such as a user agent with its own cache sending a conditional GET to a shared proxy, then the proxy SHOULD forward the 304 response to that client.
A 304 response cannot contain a message-body; it is always terminated by the first empty line after the header fields.
4.2. 412 Precondition Failed
The 412 (Precondition Failed) status code indicates that one or more conditions given in the request header fields evaluated to false when tested on the server. This response code allows the client to place preconditions on the current resource state (its current representations and metadata) and, thus, prevent the request method from being applied if the target resource is in an unexpected state.
5. Evaluation
Except when excluded below, a recipient cache or origin server MUST evaluate received request preconditions after it has successfully performed its normal request checks and just before it would perform the action associated with the request method. A server MUST ignore all received preconditions if its response to the same request without those conditions would have been a status code other than a 2xx (Successful) or 412 (Precondition Failed). In other words, redirects and failures take precedence over the evaluation of preconditions in conditional requests.
A server that is not the origin server for the target resource and cannot act as a cache for requests on the target resource MUST NOT evaluate the conditional request header fields defined by this specification, and it MUST forward them if the request is forwarded, since the generating client intends that they be evaluated by a server that can provide a current representation. Likewise, a server MUST ignore the conditional request header fields defined by this specification when received with a request method that does not involve the selection or modification of a selected representation, such as CONNECT, OPTIONS, or TRACE.
Conditional request header fields that are defined by extensions to HTTP might place conditions on all recipients, on the state of the target resource in general, or on a group of resources. For instance, the "If" header field in WebDAV can make a request conditional on various aspects of multiple resources, such as locks, if the recipient understands and implements that field ([RFC4918], Section 10.4).
Although conditional request header fields are defined as being usable with the HEAD method (to keep HEAD’s semantics consistent with those of GET), there is no point in sending a conditional HEAD because a successful response is around the same size as a 304 (Not Modified) response and more useful than a 412 (Precondition Failed) response.
6. Precedence
When more than one conditional request header field is present in a request, the order in which the fields are evaluated becomes important. In practice, the fields defined in this document are consistently implemented in a single, logical order, since "lost update" preconditions have more strict requirements than cache validation, a validated cache is more efficient than a partial response, and entity tags are presumed to be more accurate than date validators.
A recipient cache or origin server MUST evaluate the request preconditions defined by this specification in the following order:
1. When recipient is the origin server and If-Match is present, evaluate the If-Match precondition:
* if true, continue to step 3
* if false, respond 412 (Precondition Failed) unless it can be determined that the state-changing request has already succeeded (see Section 3.1)
2. When recipient is the origin server, If-Match is not present, and If-Unmodified-Since is present, evaluate the If-Unmodified-Since precondition:
* if true, continue to step 3
* if false, respond 412 (Precondition Failed) unless it can be determined that the state-changing request has already succeeded (see Section 3.4)
3. When If-None-Match is present, evaluate the If-None-Match precondition:
* if true, continue to step 5
* if false for GET/HEAD, respond 304 (Not Modified)
* if false for other methods, respond 412 (Precondition Failed)
4. When the method is GET or HEAD, If-None-Match is not present, and If-Modified-Since is present, evaluate the If-Modified-Since precondition:
* if true, continue to step 5
* if false, respond 304 (Not Modified)
5. When the method is GET and both Range and If-Range are present, evaluate the If-Range precondition:
* if the validator matches and the Range specification is applicable to the selected representation, respond 206 (Partial Content) [RFC7233]
6. Otherwise,
* all conditions are met, so perform the requested action and respond according to its success or failure.
Any extension to HTTP/1.1 that defines additional conditional request header fields ought to define its own expectations regarding the order for evaluating such fields in relation to those defined in this document and other conditionals that might be found in practice.
7. IANA Considerations
7.1. Status Code Registration
The "Hypertext Transfer Protocol (HTTP) Status Code Registry" located at <http://www.iana.org/assignments/http-status-codes> has been updated with the registrations below:
<table>
<thead>
<tr>
<th>Value</th>
<th>Description</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>304</td>
<td>Not Modified</td>
<td>Section 4.1</td>
</tr>
<tr>
<td>412</td>
<td>Precondition Failed</td>
<td>Section 4.2</td>
</tr>
</tbody>
</table>
7.2. Header Field Registration
HTTP header fields are registered within the "Message Headers" registry maintained at <http://www.iana.org/assignments/message-headers/>.
This document defines the following HTTP header fields, so their associated registry entries have been updated according to the permanent registrations below (see [BCP90]):
<table>
<thead>
<tr>
<th>Header Field Name</th>
<th>Protocol</th>
<th>Status</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td>ETag</td>
<td>http</td>
<td>standard</td>
<td>Section 2.3</td>
</tr>
<tr>
<td>If-Match</td>
<td>http</td>
<td>standard</td>
<td>Section 3.1</td>
</tr>
<tr>
<td>If-Modified-Since</td>
<td>http</td>
<td>standard</td>
<td>Section 3.3</td>
</tr>
<tr>
<td>If-None-Match</td>
<td>http</td>
<td>standard</td>
<td>Section 3.2</td>
</tr>
<tr>
<td>If-Unmodified-Since</td>
<td>http</td>
<td>standard</td>
<td>Section 3.4</td>
</tr>
<tr>
<td>Last-Modified</td>
<td>http</td>
<td>standard</td>
<td>Section 2.2</td>
</tr>
</tbody>
</table>
The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
8. Security Considerations
This section is meant to inform developers, information providers, and users of known security concerns specific to the HTTP conditional request mechanisms. More general security considerations are addressed in HTTP "Message Syntax and Routing" [RFC7230] and "Semantics and Content" [RFC7231].
The validators defined by this specification are not intended to ensure the validity of a representation, guard against malicious changes, or detect man-in-the-middle attacks. At best, they enable more efficient cache updates and optimistic concurrent writes when all participants are behaving nicely. At worst, the conditions will fail and the client will receive a response that is no more harmful than an HTTP exchange without conditional requests.
An entity-tag can be abused in ways that create privacy risks. For example, a site might deliberately construct a semantically invalid entity-tag that is unique to the user or user agent, send it in a cacheable response with a long freshness time, and then read that entity-tag in later conditional requests as a means of re-identifying that user or user agent. Such an identifying tag would become a persistent identifier for as long as the user agent retained the original cache entry. User agents that cache representations ought to ensure that the cache is cleared or replaced whenever the user performs privacy-maintaining actions, such as clearing stored cookies or changing to a private browsing mode.
9. Acknowledgments
See Section 10 of [RFC7230].
10. References
10.1. Normative References
10.2. Informative References
Appendix A. Changes from RFC 2616
The definition of validator weakness has been expanded and clarified. (Section 2.1)
Weak entity-tags are now allowed in all requests except range requests. (Sections 2.1 and 3.2)
The ETag header field ABNF has been changed to not use quoted-string, thus avoiding escaping issues. (Section 2.3)
ETag is defined to provide an entity tag for the selected representation, thereby clarifying what it applies to in various situations (such as a PUT response). (Section 2.3)
The precedence for evaluation of conditional requests has been defined. (Section 6)
Appendix B. Imported ABNF
The following core rules are included by reference, as defined in Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR (any visible US-ASCII character).
The rules below are defined in [RFC7230]:
- OWS = <OWS, see [RFC7230], Section 3.2.3>
- obs-text = <obs-text, see [RFC7230], Section 3.2.6>
The rules below are defined in other parts:
- HTTP-date = <HTTP-date, see [RFC7231], Section 7.1.1.1>
Appendix C. Collected ABNF
In the collected ABNF below, list rules are expanded as per Section 1.2 of [RFC7230].
ETag = entity-tag
HTTP-date = <HTTP-date, see [RFC7231], Section 7.1.1.1>
If-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
entity-tag ] ) )
If-Modified-Since = HTTP-date
If-None-Match = "*" / ( *( "," OWS ) entity-tag *( OWS "," [ OWS
entity-tag ] ) )
If-Unmodified-Since = HTTP-date
Last-Modified = HTTP-date
OWS = <OWS, see [RFC7230], Section 3.2.3>
entity-tag = [ weak ] opaque-tag
etagc = "!" / %x23-7E ; '#'-'~'
/ obs-text
obs-text = <obs-text, see [RFC7230], Section 3.2.6>
opaque-tag = DQUOTE *etagc DQUOTE
weak = %x57.2F ; W/
Index
3
304 Not Modified (status code) 19
4
412 Precondition Failed (status code) 18
E
ETag header field 9
G
Grammar
entity-tag 9
ETag 9
etagc 9
If-Match 13
If-Modified-Since 15
If-None-Match 14
If-Unmodified-Since 17
Last-Modified 7
opaque-tag 9
weak 9
I
If-Match header field 13
If-Modified-Since header field 16
If-None-Match header field 14
If-Unmodified-Since header field 17
L
Last-Modified header field 7
M
metadata 5
S
selected representation 4
V
validator 5
strong 5
weak 5
Authors’ Addresses
Roy T. Fielding (editor)
Adobe Systems Incorporated
345 Park Ave
San Jose, CA 95110
USA
EMail: fielding@gbiv.com
URI: http://roy.gbiv.com/
Julian F. Reschke (editor)
greenbytes GmbH
Hafenweg 16
Muenster, NW 48155
Germany
EMail: julian.reschke@greenbytes.de
URI: http://greenbytes.de/tech/webdav/
|
{"Source-Url": "https://tools.ietf.org/pdf/rfc7232.pdf", "len_cl100k_base": 10078, "olmocr-version": "0.1.49", "pdf-total-pages": 28, "total-fallback-pages": 0, "total-input-tokens": 52285, "total-output-tokens": 11926, "length": "2e13", "weborganizer": {"__label__adult": 0.0003266334533691406, "__label__art_design": 0.0004444122314453125, "__label__crime_law": 0.0010423660278320312, "__label__education_jobs": 0.0010480880737304688, "__label__entertainment": 0.0002034902572631836, "__label__fashion_beauty": 0.00017142295837402344, "__label__finance_business": 0.0007596015930175781, "__label__food_dining": 0.0003075599670410156, "__label__games": 0.0006337165832519531, "__label__hardware": 0.001743316650390625, "__label__health": 0.00034999847412109375, "__label__history": 0.0004038810729980469, "__label__home_hobbies": 7.015466690063477e-05, "__label__industrial": 0.0004503726959228515, "__label__literature": 0.0005717277526855469, "__label__politics": 0.0005054473876953125, "__label__religion": 0.0004525184631347656, "__label__science_tech": 0.1044921875, "__label__social_life": 0.0001131892204284668, "__label__software": 0.12457275390625, "__label__software_dev": 0.76025390625, "__label__sports_fitness": 0.00025725364685058594, "__label__transportation": 0.0004830360412597656, "__label__travel": 0.0002715587615966797}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 47650, 0.0496]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 47650, 0.40978]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 47650, 0.86262]], "google_gemma-3-12b-it_contains_pii": [[0, 1003, false], [1003, 2341, null], [2341, 4961, null], [4961, 7147, null], [7147, 9486, null], [9486, 12311, null], [12311, 14457, null], [14457, 16092, null], [16092, 18031, null], [18031, 20098, null], [20098, 21384, null], [21384, 22822, null], [22822, 24050, null], [24050, 26227, null], [26227, 28194, null], [28194, 30221, null], [30221, 32343, null], [32343, 34829, null], [34829, 37057, null], [37057, 39336, null], [39336, 40761, null], [40761, 42407, null], [42407, 43619, null], [43619, 44948, null], [44948, 46161, null], [46161, 46830, null], [46830, 47332, null], [47332, 47650, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1003, true], [1003, 2341, null], [2341, 4961, null], [4961, 7147, null], [7147, 9486, null], [9486, 12311, null], [12311, 14457, null], [14457, 16092, null], [16092, 18031, null], [18031, 20098, null], [20098, 21384, null], [21384, 22822, null], [22822, 24050, null], [24050, 26227, null], [26227, 28194, null], [28194, 30221, null], [30221, 32343, null], [32343, 34829, null], [34829, 37057, null], [37057, 39336, null], [39336, 40761, null], [40761, 42407, null], [42407, 43619, null], [43619, 44948, null], [44948, 46161, null], [46161, 46830, null], [46830, 47332, null], [47332, 47650, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 47650, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 47650, null]], "pdf_page_numbers": [[0, 1003, 1], [1003, 2341, 2], [2341, 4961, 3], [4961, 7147, 4], [7147, 9486, 5], [9486, 12311, 6], [12311, 14457, 7], [14457, 16092, 8], [16092, 18031, 9], [18031, 20098, 10], [20098, 21384, 11], [21384, 22822, 12], [22822, 24050, 13], [24050, 26227, 14], [26227, 28194, 15], [28194, 30221, 16], [30221, 32343, 17], [32343, 34829, 18], [34829, 37057, 19], [37057, 39336, 20], [39336, 40761, 21], [40761, 42407, 22], [42407, 43619, 23], [43619, 44948, 24], [44948, 46161, 25], [46161, 46830, 26], [46830, 47332, 27], [47332, 47650, 28]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 47650, 0.04737]]}
|
olmocr_science_pdfs
|
2024-11-26
|
2024-11-26
|
68aad107a1048380c5db511b47244bd3d5923af3
|
SYSTEM AND METHOD FOR IMPLEMENTING DYNAMIC ACCESS CONTROL RULES TO PERSONAL CLOUD INFORMATION
Inventor: Xavier Quintuna, San Francisco, CA (US)
Assignee: France Telecom, Paris (FR)
Appl. No.: 13/307,164
Filed: Nov. 30, 2011
Related U.S. Application Data
Provisional application No. 61/418,070, filed on Nov. 30, 2010.
ABSTRACT
A system and method are provided for sharing data of a user with contacts, the method comprising collecting the contacts from the user, collecting data related to the communications between the user and his contacts, and automatically grouping the contacts into different groups based on a level of communications between the user and the user’s contacts, defining an access level for each group, with each access level granting access to some part of the user’s data based on the access level. Advantageously, this permits a dynamic assignment of authority to access content that does not have to be actively managed by the user.
FIG. 6
Token exchange
Communication module
OAuth libraries
Identity Manager manages user credentials
OAuth Module
Storage consolidation
Use token to retrieve content
Store token for 3rd party services
Social Graph DB:
Friends
HOME
OFFICE
System info
Access content store in FB and Graph API
Easy to expand to other services
User
Y! Twitter
Facebook
Google
Amazon
SYSTEM AND METHOD FOR IMPLEMENTING DYNAMIC ACCESS CONTROL RULES TO PERSONAL CLOUD INFORMATION
CROSS REFERENCE TO RELATED APPLICATIONS
BACKGROUND
[0002] A system and method are provided that allow access control rules relating to personal cloud information to be determined dynamically, resulting in group memberships that change over time based on criteria that incorporates communications between the user and his or her contacts.
[0003] Social networks, such as Facebook, LinkedIn, and others, have become popular in the past several years. In these networks, users are permitted to store and share information in a controlled manner, so that only those individuals with whom the user wishes to share certain information can actually access it.
[0004] In these networks, a user may designate different groups, or classes, of individuals, and then may define access permissions based on these defined groups. Therefore, only members of a particular group may be authorized to access a particular piece of information. By way of example, a user may designate a group called “real friends”, then assign Bob to the group of good friends. The user can then designate his cell phone number as only viewable by good friends, and Bob (but not others who are not members of the “real friends” group) will subsequently have access to the user’s cell phone number.
[0005] In addition to having a user manually define such groups and then subsequently define group membership, it is also possible to have group membership in predefined groups allocated based on some criteria that can be determined automatically.
[0006] For example, it is known to utilize social network thresholds that can be determined automatically with regard to access control decisions. If a second user does not have an appropriate privilege level to access a particular piece of information, then a statistical threshold for access can be determined based on social networking statistics, such as a number or percentage of users listed as friends by a content owner.
SUMMARY
[0007] A method is herein provided for sharing data of a user with contacts, the method comprising collecting the contacts from the user, collecting data related to the communications between the user and his contacts, automatically grouping the contacts into different groups based on a level of communications between the user and the user’s contacts, defining an access level for each group, with each access level granting access to some part of the user’s data based on the access level, and notifying each member of each group of contacts having been granted access to that part of the user’s data based on the access level when that data has become accessible or has changed. Advantageously, this permits a dynamic assignment of authority to access content that does not have to be actively managed by the user.
[0008] A non-transitory computer program product is also provided, comprising a computer usable medium having a computer readable program code embodied therein, said computer readable program code adapted to be executed to implement the method.
[0009] A server device is also provided for sharing data of a user with contacts, the server device comprising: a storage element configured to store contacts collected from said user; a storage element configured to store data related to communications between the user and his contacts; and a processor configured to run: an algorithm that automatically groups the contacts into different groups based on a level of communications between the user and the user’s contacts; and an algorithm that defines an access level for each group, with each access level granting access to some part of the user’s data based on the access level.
[0010] A system is also provided comprising the server device, a client device comprising a render configured to read the part of the user’s data; and a network that connects the client device to the server device.
[0011] Various embodiments of the invention involve automatically generating access control rules (ACL rules) based on a user’s true connection to his friends. The contacts are collected over the different sources provided by the user, such as emails, phone contacts, and SN friends. Based on the number of emails, phone calls, interactions over the SN, contacts are divided into a number of groups, e.g., from real friend, to occasional friend, and temporary friend. Different access rights are defined for each of these groups. The user simply has to drag his content to folders associated with each of the generated access rights. The corresponding users are notified and they can access to these folders by virtue of the access rights (using, e.g., a universal ID, or OpenID).
DEFINITIONS
[0012] The following definitions are used for the discussion below:
[0013] API, Application Programming Interface
[0014] SN, Social Network
[0015] ACL, Access Control List
[0016] OpenID, OpenID is an open, decentralized standard for authenticating users
[0017] DyACL, Dynamic Access Control List
[0018] UI, User Interface
[0019] DLNA, Digital Living Network Alliance. A standard used to allow entertainment devices within the home to share their content with each other across a home network
[0020] NAS, Network Attached storage
[0021] SNG, Social Network Gateway. Orange’s service platform offering API translation and interconnection services with a selection of Internet Social Networks
[0022] STB, Set Top Box. Device connected to a TV set and offering TV services through a broadband connection.
[0023] Third-Party Internet service supplied by third party (e.g. Picasa, Facebook . . .)
[0024] online
[0025] service
PC Personal Cloud
OAuth Open Authorization is an open standard that allows users to share their private resources stored on one site with another site without having to hand out their credentials
UGC user generated content
SLA service layer agreement
The system described below, herein referred to as “Personal Cloud”, is a trusted and secure user-centric platform providing a trusted environment for users to consolidate and manage their personal data. Personal Cloud allows users to regain access and control over their personal user generated content, including their personal preferences, internet clickstreams, as well as digital artifacts like photos, videos and music. Further, users are able to apply only the relevant aspects of their personal profile data towards personalized services, ensuring the ownership of the data is maintained and services are only being provided this data in exchange for highly personalized experiences they provide.
By way of example only, the system is described in an architecture that is based on the Tonido (CodeLathe) platform, however the scope of the invention extends beyond this embodiment, and can extend across the web, including social networks, e-commerce sites and any other online services available today. The system provided, as described below, enables users to greatly simplify their online experience. The system may utilize OpenID, which is a significant factor in enabling Personal Clouds for users.
BRIEF DESCRIPTION OF THE DRAWINGS
The invention is illustrated by reference to various embodiments illustrated in the drawings and described in more detail below.
FIG. 1 is a block diagram illustrating the personal cloud architecture;
FIG. 2 is a block diagram illustrating the Tonido core components;
FIG. 3 is a block diagram illustrating access to a Tonido Domain Server;
FIG. 4 is a block diagram illustrating storage consolidation according to an embodiment;
FIG. 5A is a block diagram illustrating the access control functions;
FIG. 5B is a flow diagram illustrating the access control functions according to an exemplary embodiment;
FIG. 6 is a block diagram illustrating the OAuth architecture;
FIG. 7 is a flowchart that illustrates the creation of pre-defined groups based on social network activity;
FIG. 8 is a block diagram illustrating a personal cloud SLA;
FIG. 9 is a flowchart for notification;
FIGS. 10A & B constitute a block diagram illustrating the dynamic ACL components; and
FIG. 11 is a block diagram illustrating OpenID.
DETAILED DESCRIPTION
The Personal Cloud (PC) architecture is illustrated at a high level in FIG. 1. The PC 100 is a service running at user premises that provides a secure and trusted environment for user generated content. It manages user content generated, identities and personalized services. The PC 100 is thus becomes a user content broker between user and content associated with the user 450, 500, 550, and third party online services 400.
At a high level the PC 100 provides a user experience to sharing online data by implementing a Distributed Social Network (DiSo) function 110, a Distributed Search (DiSe) function 115, and other user services 117 through an application program interface (API) 120. A media delivery optimization module 140 may be provided to optimize transcoding and improve the quality of service of streaming media. Security 142 may be provided by way of OpenID and OAuth. The sharing function may be implemented via Data Management (D.M) 146 and utilize DyACL. A search function 148 to search for content in the cloud may be provided. An Identity Management (I.M) 150 may also be provided. The PC 100 may also include a mechanism for device discovery and may provide for some form of rule-based content notification. Storage consolidation 170 is also provided to aggregate user information.
Communication access is provided to specific cloud service providers 300, to other personal cloud members 350, and a simple integration is provided to on-line third party service providers 400, such as Facebook, Flickr, and YouTube.
The PC 100 provides access to user content 450, which can include any content generated by users that can be stored in any device compatible with the Digital Living Network Alliance (DLNA) (www.dlna.org) or that may plug to the network. It may also provide access to imported online content 500, which can include any content that has been uploaded to third party on-line services. The user can import this content from the third party and either move it back to the personal cloud or provide only indexed access. Finally, the PC 100 can provide access to a local index 550 comprising metadata related to all the information, location, and access control lists (ACL) of content.
Tonido™ System
The present system can be based on a platform provided by CodeLathe called Tonido™ of which the basic components are illustrated in FIG. 2. The Tonido system 1000 is a person-to-person (P2P) personal web application platform that allows a user to access and share all of the user’s desktop files, documents, photos, music and videos from anywhere.
Tonido offers the following features: P2P support for communication between Tonido instances, access to content from anywhere, available anytime access to the Tonido application online or offline, secure communication-encrypted data transfer, support to multiple operative systems, and an API and software development kit (SDK) to build applications on top of the platform.
There are two main software components in Tonido: the first is the Tonido Runtime platform, which is installed on the end user device destination; and the second is the Tonido Domain Server (TDS), which is responsible for managing authentication, custom URL to IP address mapping and connection brokering.
The Tonido runtime platform is installed on the end user machine. It consists of two components: the first is the Tonido Core, which is the primary software component that provides programmable APIs and manages and provides HTTP and P2P connectivity. The second is Tonido applications—those are shared libraries/dlls that are loaded/unloaded dynamically.
[0054] Tonido has two primary interfaces to the outside world: the first is the HTTP interface (which is the user interface), and the second is the Tonido network interface, which is used to connect to other Tonido instances.
[0055] FIG. 3 is a block diagram illustrating the Tonido Domain Server (TDS) 1010. The TDS 1010 is designed to be an open system similar to email. Users can create accounts in any TDS run by anyone and communicate and collaborate with any other Tondio instance running on a different TDS. A user can remotely access 1060 a desktop withTonido 1050, and these can communicate with the TDS 1010.
[0056] TDS operates on well-known Internet Engineering Task Force (IETF) approved ports 24465 for user datagram protocol (UDP) (which may be used as the control link 1040 and data link 1045) and 24465 for transmission control protocol (TCP) (HTTPS).
[0057] The TDS 1010 has the following functions. First it performs authentication, which includes: 1) Identifying a Tonido instance (or a device or user) uniquely; 2) creating a Tonido ID (this is done via an HTTPS connection to the TDS; and 3) assigning a unique secret key to the Tonido Runtime. Second, it performs URL to IP address mapping, with a custom URL being based on the domain the TDS 1010 is running on (dynamic DNS). Third, it performs connection brokering. The TDS 1010 serves as an intermediary to broker P2P connection setup between two Tonido instances. The TDS allows two instances to establish a direct P2P connection (network address translator (NAT) punching).
Personal Cloud
[0058] One aspect of the Personal Cloud is the User Experience. The Distributed Social Networks element DSo 110 is decentralized and distributed across different providers, that emphasizes portability and interoperability. Currently there are multiples open standards associated with the distributed social networks. In a preferred embodiment, OpenID and OAuth are the standards utilized, although other open standards may be utilized as well.
[0059] With this element, personal cloud members 350 are able to share and access content from other members without downloading the content based on some kind of ACL. Although the Personal Cloud could search content from the user’s friends and itself, there is no anonymous search—thus, the content is always attached to some personal cloud members 350.
[0060] It is possible for the PC member to set up notification rules for sending automatic notifications to other members of the PC regarding any new content associated with the member. Also, the PC member can publish to his/her favorite social network an indication of the existence of new media content. When a member of the social network (SN) tries to access the PC content, the member will be redirected to the user’s Personal Cloud where the new media content is hosted. Also, PC members can subscribe to have a feed of their friends activities.
[0061] The storage consolidation 170 has two parts to it. First, there are physical storage devices that include all content stores in any device with local storage. Using P2P technology a user could map the personal cloud identity with multiple devices. Such devices send a representation of their file system. This permits the user to be able to navigate all the content store in the different file system with one unified view. Second, there are online data stores, which include all of the different online data stores (social network, photo sharing, video sharing, etc.) that the users upload content to. FIG. 4 illustrates the use of the Tonido system 1000 with the present storage consolidation 170 to which clients can push content.
[0062] As to physical storage devices, for DLNA universal plug and play (UPnP) devices, personal cloud members can have an aggregated view of the content stored in any device compatible with DLNA/UPnP. For a non-DLNA device, personal cloud members can have an aggregate view of all the content stored in devices that are running a Tonido instance.
[0063] With regard to online data stores, personal cloud members can aggregate different online data stores (social networks, photo sharing, video sharing, etc.). A personal cloud member can import and log their content generated from different online data stores (e.g., twitter, posts, comments, photos, videos, etc.) to their personal cloud.
[0064] This system thus provides the following beneficial functionality: access from/to any file located in the personal cloud; storage of any file from any device to the personal cloud; deletion of any file stored at the personal cloud; moving content between devices; adding or removing a device from the storage consolidation; and some form of authentication between the device and the personal cloud.
User Experience/User Interface
[0065] An important part of the user experience involves the user interface. The service that manages and orchestrates private user content is referred to herein as the Personal Assistant. Preferably, the Personal Assistant provides access, preferably via a web browser interface, to the exemplary user experiences/functions illustrated in the table below.
[0066] The user interface may be implemented as series of folders that are shown to the user, each of which is associated to a group of contacts. By way of example for associating contacts with folders, an associating function, a list of folders can be shown in one window and a list of contacts can be provided to the user in another window. The user can then select one or more contacts and simply drag them to a particular folder, thereby associating that folder with the selected users. Similarly, the user can select one or more folders and drag them to a particular user, thereby associating that user with the selected folder. Any mechanism can be used to associate the users with the folders.
[0067] Advantageously, in a content updating process, when the user updates content in a folder (e.g., by dragging and dropping content into the folder), the users associated with the folder are notified of the content update in a manner described in more detail below.
<table>
<thead>
<tr>
<th>TABLE 1</th>
</tr>
</thead>
<tbody>
<tr>
<td>User Experience/Functions</td>
</tr>
<tr>
<td>---</td>
</tr>
<tr>
<td>Home</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
**TABLE 1-continued**
<table>
<thead>
<tr>
<th>User Experience</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Identity Manager</td>
<td>Manages user online identity: Email accounts, Social network, Personal cloud ID (openID). Mobile platform. Cloud devices. Dynamic ACL.</td>
</tr>
<tr>
<td>Device Source</td>
<td>Shows original devices or location of the content, and shared content by others.</td>
</tr>
<tr>
<td>Device destination</td>
<td>Shows the final destination where the content will be consumed or moved.</td>
</tr>
<tr>
<td>Authentication</td>
<td>Allows a user to provide openID accounts to other users that are not members of the personal cloud.</td>
</tr>
<tr>
<td>Content</td>
<td>Shows the content based on some data representation.</td>
</tr>
<tr>
<td>Files</td>
<td>Shows all of the content from different devices. This is the representation of the storage consolidation and the content that has been shared.</td>
</tr>
<tr>
<td>Views</td>
<td>User may have different ways to visualize the content, that differential between format and layout of content.</td>
</tr>
<tr>
<td>Media/music/Recommendations</td>
<td>Music recommendations can be extracted using, e.g., Freebase (<a href="http://www.freebase.com">www.freebase.com</a>), which is a REST/JSON service that provides free information.</td>
</tr>
<tr>
<td>Media/music/Media Content Information</td>
<td>Display information related to a track of music, e.g., album, track name, length, album art.</td>
</tr>
<tr>
<td>Media/music/Play list</td>
<td>Shows different playlists from all the content store in the storage consolidation, such as iTunes, Windows Media Player, and others. This also allows the user to do the following: create a new playlist, delete music, play a playlist in a destination device, and share the playlist with other friends.</td>
</tr>
<tr>
<td>Media/Video/Horizontal video content browsing</td>
<td>Helps the user to browse media content and select the content to play.</td>
</tr>
<tr>
<td>Media/Video</td>
<td>User can share one or more videos (stream content), perform transcoding, and send media to an other device destination.</td>
</tr>
<tr>
<td>Media/Photos/Album</td>
<td>User can create albums with photos located from different devices.</td>
</tr>
<tr>
<td>Media/Photos</td>
<td>Users can share albums, send albums to different device destinations, play a slide show from different content located in different sources. The sharing may be performed utilizing DyACL.</td>
</tr>
<tr>
<td>MyPeople (DyACL)/MyPeople</td>
<td>This window can allow the user to specify different policies related to: notification, backup, accessibility, download/upload, and expiration. The user can check if there will be a trigger for a notification when there is new content in the folder. The trigger options can be, e.g., never, once, and always.</td>
</tr>
<tr>
<td>MyPeople/new or edit (policy manager)</td>
<td>The user can select if the content will be backed up in My cloud; the backup is composed of the different source storage devices Cloud service provider or 3rd party service.</td>
</tr>
<tr>
<td>MyPeople/policy manager/notification</td>
<td>The user can select if the content will be accessible:</td>
</tr>
<tr>
<td>MyPeople/policy manager/Backup</td>
<td>Content Notification</td>
</tr>
</tbody>
</table>
**TABLE 2**
<table>
<thead>
<tr>
<th>Name</th>
<th>Storage Consolidation Functions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Discovery and aggregation agent-less process</td>
<td>Identify and discovery of any source of storage at home. The discovery process supports: Ability to add/remove devices</td>
</tr>
<tr>
<td>DLNA support (agent-less approach)</td>
<td>Discovery and aggregation agent process</td>
</tr>
<tr>
<td>IDR = field</td>
<td>Identify and discovery of any source of storage at home.</td>
</tr>
<tr>
<td>Support for any OS</td>
<td>Simple or minimal work to install it Using P2P Toadino technology</td>
</tr>
<tr>
<td>Data Stores</td>
<td>Users can add data stores to their Personal Cloud. Users have the option to import or log their content from those data stores, such as Facebook.</td>
</tr>
<tr>
<td>General view of the content</td>
<td>Users have a complete view of the user generated content (UGC) store in the PC, if the devices are on.</td>
</tr>
</tbody>
</table>
**[0068]** The Personal Cloud system 100 provides the following features that are described in more details below. The features may be implemented through an API 120 call.
**[0069]** The following table illustrates features for the storage consolidation 170. The following table illustrates features for the storage consolidation 170.
**[0070]** Global indexing functions may be provided in the system. Each of the personal cloud members generates a local index 550 of their content. This local index 550 provides support for a local search 148. In addition, in one embodiment, at every predefined amount of time or event, this local index 550 is merged with a global index located in the cloud. The global index allows users execute queries to identify data that they can access from any device. These functions are identified in the table below.
TABLE 3 Global Index Functions
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Index</td>
<td>Index is a metadata representation of an object. It preferably contains the following fields: Owner, ACL, Expiration date, Resource location, Backup options, Shared-with (representation of social graph to whom the user has shared their content). Type, Cashed, Updated.</td>
</tr>
<tr>
<td>Local Index</td>
<td>Local index preferably keeps an up to date index representation of all the user content generated from anywhere. Users can execute local search of their content.</td>
</tr>
<tr>
<td>Global Index</td>
<td>Global Index is located in the cloud. It is a compound of multiple local indexes. Global index scales and merges multiple local indexes.</td>
</tr>
<tr>
<td>Search</td>
<td>User can execute queries to lock for content from members of its social graph. The search will be executed at the cloud.</td>
</tr>
<tr>
<td>Search Filters</td>
<td>Based on ACL, users can execute queries only in a subset group.</td>
</tr>
</tbody>
</table>
Security functions **142** may be provided in the system. The security functions **142** control access to a user's data. These functions are identified in the table below.
TABLE 4 Security Functions
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>OpenID</td>
<td>Personal Cloud may use OpenID as an authentication mechanism.</td>
</tr>
<tr>
<td>Federation</td>
<td>OpenID Federation across multiple PC accounts. Running an identity server allows users to act as an OpenID provider. Each sub account may have an OpenID and maps to some storage resource. This sub account can map to the main OpenID account.</td>
</tr>
<tr>
<td>Data portability</td>
<td>If the sub account wants to move or migrate to a main account, the sub account user can remap the storage resource to any other main personal cloud account.</td>
</tr>
<tr>
<td>OAuth</td>
<td>The personal cloud is preferably able to access content store in Facebook, gMail and other 3rd party web services that support OAuth.</td>
</tr>
</tbody>
</table>
[0071] The Online Service section has two components: third party online services **400** and Cloud Service Provider online services **300**. The platform may provide support to add any online service from these two.
TABLE 5 On-Line Service Functions
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Social Networks</td>
<td>The system may publish status updates/twitter status updates/twitter</td>
</tr>
<tr>
<td>Social Network</td>
<td>The system can publish a link where the user content generated data will be</td>
</tr>
</tbody>
</table>
TABLE 5-continued
On-Line Service Functions
**User downloading content to the ACL folder:**
- The group members get a notification in their SN;
- The content (e.g., photos, videos) are displayed in the SN but not uploaded; and
- Other members click in the link and they are redirected to the PC.
**Name:** Social Networks integration
**Description:** The system has a clear and good integration with SN without breaking the current experiences.
**Name:** Social Graph
**Description:** The system may import his/her social graph to the system.
**Cloud Services Provider**
- **Social Network Gateway**
- **Description:** The system will have to support the integration of our Social Network Gateway.
- **Cloud services**
- **Description:** Easy integration of all Cloud Server-provided cloud solutions.
[0074] The distributed social networks section (DiSo) provides the following functions:
**TABLE 7**
**DiSo Functions**
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Publishing new content to other members PC</td>
<td>ogg Users can publish the existence of new content to other members based on the DyACL. The notification of the new content is routed to the right group.</td>
</tr>
<tr>
<td>Accessing content</td>
<td>Users can search the content of other members of the personal cloud.</td>
</tr>
<tr>
<td>Publishing new content to other members PC</td>
<td>Users can publish the existence of new content to other members.</td>
</tr>
</tbody>
</table>
[0075] The system may provide a web UI. The Web UI can provide administrative functions, account management, data management, DyACL management. In addition, the system may provide a web UI to display content, such as: Photos, Videos, Chat with other members, Status updates, content navigation and device navigation.
[0076] The web UI will preferably be able to support HTML 5 and Flash 10. In addition, the web UI should support any device (e.g., IPTV, Mobile, PC, Tablets, and IPad).
**TABLE 6**
**API Functions**
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Storage Consolidation API</td>
<td>All the metadata regarding the storage consolidation, including, e.g.: Location, ACL, Ownership. Data Management: shared with, expiration date. Cache, Backup policies.</td>
</tr>
<tr>
<td>Sharing API</td>
<td>API to share content between members of a SN or PC.</td>
</tr>
<tr>
<td>Data Management API</td>
<td>API that exposes all the features of D.M</td>
</tr>
<tr>
<td>Search API</td>
<td>API to expose local search and distributed search.</td>
</tr>
<tr>
<td>ACL API</td>
<td>API that allows modification of ACL groups.</td>
</tr>
<tr>
<td>Personal Cloud Development SDK</td>
<td>API that allows modification of ACL groups.</td>
</tr>
</tbody>
</table>
**TABLE 8**
**User Interface Functions**
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Admin</td>
<td>Admin web UI helps the user to add, edit and create new rules. General Admin: a web page may show general details about the behavior of the system.</td>
</tr>
<tr>
<td>Account Management</td>
<td>Account Management: shows the current accounts from the system: Main PC account with his/her SN accounts and subaccounts with their SN accounts.</td>
</tr>
<tr>
<td>DyACL</td>
<td>DyACL: Based on some analysis, the system may provide some ACL groups that the user could modify based on his/her needs. In addition, the user could create, add or delete new groups of users.</td>
</tr>
<tr>
<td>Data Management</td>
<td>Data Management: User may create folders, which one of the attributes may be some group from the DyACL. Once the user pushes some content to this folder, the system automatically publishes the existence of the new content.</td>
</tr>
<tr>
<td>Device Management</td>
<td>Device Management: user can add or remove devices that have been discovered using DLNA. In addition, it is possible, with proper authentication, to remove or add new devices, if it is possible.</td>
</tr>
</tbody>
</table>
TABLE 8-continued
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content navigation</td>
<td>User based on his/her account can browse his/her global content. The content preferably has metadata attached with information about ACL.</td>
</tr>
<tr>
<td>Social Network activities</td>
<td>User could have the view of all his/her social graph. This includes: Social Network members, Personal Cloud members. The content display will be the status updates, messages, notes, post, and emails.</td>
</tr>
</tbody>
</table>
[0077] The system may be implemented on the following exemplary hardware.
TABLE 9
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>STB CE4100 Development Platform</td>
<td>Personal assistant will run in the STB. The type of STB has to be defined. But for testing purposes, here are some general considerations: Intel Atom CE4100 Processor, 1 GB SDRAM, 10 GB IDE, 1 GB NAND Flash, 2 HDMI.</td>
</tr>
<tr>
<td>Plug Computing</td>
<td>Small energy efficient plug computing device. It has the following specifications: ARM-Based processor (2 GHz), 512 MB DDR2 Ram, 512 MB Flash memory, No Hard drive, Wi-fi, Support for various Linux 2.6, Kernel.</td>
</tr>
</tbody>
</table>
[0078] The following section, and referencing FIGS. 5A and B, describes an exemplary user flow of Dynamic Access Control (DYACL) to distribute UGC between members of the personal cloud or third party online services.
[0079] Referring to FIG. 5A, the user content may be represented by a series of folders. Based on predefined access levels, the user can associate the various access levels to each of the folders. However, the association of each of the user’s contacts to a particular access level is automatically performed by an algorithm described in more detail below. When access to a particular folder is established for a user, based on the automatic assignment to an access level, the contacts associated with that access level are notified in a manner described below. Similarly, when content of a folder is changed, the users having proper access are similarly notified.
[0080] Referring to FIG. 5B, User A is a personal cloud member from an ISP who provides the services. User A has submitted all of the details regarding email, social network, and mobile accounts to the identity manager. Personal Cloud provides to the user a set of ACL rules that represent groups of users based on real communication activities. In addition, those rules are mapped to virtual drives from the personal cloud storage.
Flow: User A Distributed UGC to User B
[0081] A) User A uses the personal cloud user interface to drag and drop UGC to the virtual drive call “ACL Group C”.
[0082] a. Personal Cloud client executes beforehand the dynamic access control module to analyze, classify, and provide the set of rules attached to the different virtual drives.
[0083] B) The existence of new UGC in this virtual drive triggers the system to publish a notification of the existence of new content to other personal cloud members that are part of that group.
[0084] a. The notification is composed of metadata that represent, e.g., access rights, expiration date, location of content, transcoding metadata and other content attributes.
[0085] C) Personal Cloud routes the notification to only members of the group. This notification will be show:
[0086] a. Facebook message (email)
[0087] b. Posted in the wall of the user who is part of the group
[0088] c. Send by email
[0089] d. Send by Personal Cloud notification system
[0090] D) Based on the notification metadata, other members of the group are able to access the content located at user premises at the personal cloud infrastructure.
[0091] B) The existence of new UGC in this virtual drive triggers the system to publish a notification to members of this group. However, if the members are not part of the personal cloud service, the system will publish a “post” notification to the third party service using the API provided by them.
[0092] C) The members of the group can access the UGC through a URL with the address of the web interface from where the content is hosted.
[0093] D) The UGC is hosted at the user premises at the personal cloud.
[0094] In a preferred embodiment, the Personal Cloud 100 is a service with multiple components that run at a user’s premises in hardware that the user gets, e.g., once the user signs a contract with the ISP.
[0095] The Identity Manager (IM) 150 manages the user identity and services such as: email, social network, and mobile accounts. Using the Personal Cloud communication API, the IM retrieves and stores all of the UGC from the different online third party services 400. The UGC is stored in the Personal Cloud storage 170. Multiple third party online services 400 use OAuth to allow other services to access content that has been stored in their services. OAuth (Open Authorization) is an open standard that allows users to share their private resources stored on one site with another site without having to hand out their credentials.
[0096] Facebook (http://developers.facebook.com/docs/authentication/) provides multiple examples and libraries how to use OAuth. OAuth is important for a user centric platform because it: allows the user to access content or let other 3rd party services to access content; provides data portability; and it integrates other 3rd party services using a common authorization protocol. FIG. 6 illustrates the OAuth architecture.
[0097] An exemplary flow of the Identity Manager 150 is provided as follows. The user can add/remove or edit its information (credentials) regarding social network and email.
The system can use the OAuth module to start the exchanging token process with, e.g., Facebook to be able to authorize and authenticate personal cloud to access content from the user. Once the personal cloud has been validated, the Identity Manager extracts, using the graph API, the following exemplary information: Friends, Feed, Home, Photos, Album, Videos, and Events. The content can be stored in the storage consolidation. The friends list may be stored in some kind of light/small database for future usage of other modules. The same process could be apply to GMAIL and other 3rd party services that support OAuth.
The Dynamic Access Control Classification is provided as follows. Based on some scheduler, DyACL triggers the Dynamic ACL processing module. The processing module analyzes different data stores (Facebook only for this phase) and content located in the personal cloud storage. It generates a taxonomy and cluster of users based on real human interactions. Once this process is done, the new rules are mapped to current or new virtual drives. The rules are stored in a database.
FIG. 7 is a flowchart that illustrates the creation of predefined groups based on social network activity.
Based on a Facebook social graph API, it is possible to retrieve information from the user, such as friends, home (news feed), and feed (profile feed, also known as a “wall”). This information can be used to identify the user activity centered around Facebook. The classification algorithm is provided below.
The counter of comments in a post provide an important part to measure the activity in the social graph. As can be seen, in the feed S110, users can be identified who have a strong or weak interaction. One possible way of classifying the strength of the interaction is to use the following empirical equation based on term frequency-inverse document frequency (TF-IDF):
\[
F = \log \left( \frac{\sum_{m=1}^{n} (c_1, c_2, \ldots, c_m)}{\max_{m=1}^{n} (c_1, c_2, \ldots, c_m)} \right)
\]
where:
- \(c\): comments; and
- Document: a message that a user publishes in his/her Facebook wall or feed
This equation provides a factor (F) which defines in a statistical fashion the level of communication between the user who posts a message in his/her Facebook wall or feed and the total number of posted comments that his/her friends submitted related to that message. This is calculated as a sum of all messages published on the users wall. Restated linguistically, this factor is defined as:
\[
\log \left( \frac{\text{Sum of all the comments from one Document}}{\text{Max number of comments for that Document}/\text{Sum of all the Documents}} \right)
\]
This equation could be further defined as a function that considers data source material such as, e.g., call log records and email. Significantly, by utilizing this (or similar) equation in an ongoing manner, the group assignments occur continuously (or at discrete points in time, periodically or based on some other timing criteria, such as an event), thereby reflecting a dynamic nature to group membership.
The groups may be classified in the following way:
1. Based on feed (Wall) S110: if there are multiple users that post S112 multiple times in the user wall, it means that they have a direct communication. However, it may be necessary to filter spam.
2. Based on feed (Wall): if the user posts something, all the comments to that post will be counted S114 to define a direct communication.
3. From the Wall, the following groups are defined S116: Strong S120, and weak S122. The feed (wall) in terms of Facebook becomes the home page. If User A post something in his/her wall and his/her friend comments about that post, it means that his/her friends are following all of the social activities from User A. Thus, from the feed (wall), it is possible to define a strong and weak relationships in terms that User A’s friends are attending to any message from User A
3. Based on the home feed S140, it will be possible to determine temporary groups. For instance, if a friend posts something S142 and the user commented S144, this implies that the user and friend have some kind of relationship. The difference between blocks S116 and S146 is that, in S146, the system uses the home feed which, in Facebook, is the news feed. In other words, if User A comments on something in User B’s page, the system determines that User A is following User B. Thus some temporary relationship can be extracted from this home feed. In block S116, User A posts a message in his/her wall and his/her friends comment about it. In S146, User A posts a comment from somebody else’s message.
4. Once the groups (Strong S120, Weak S122, and Temp S148) are created, the system filters S150 against the entire friends database to identify the no-communication friends.
5. No-communication friends may be used to populate the Source friend list so that the user will be able to create new groups with that information.
In order to perform data management S146, a DyACL rules verification module may be activated to verify the new rules and compare them with the existent ones. If the new rules are the same, the verification module does nothing. If they are new, but the user invalidated them before, the verification module does nothing. If they are new and they have not been produced before, or if the members of the group have changed by some percentage, the validation module can display the new groups to the user through some kind of user interface.
The DyACL manager is in charge to interact with the user to modify the rules. In addition, it provides an API to control the access of the content store in the personal cloud storage.
Exemplary rules are illustrated below, and reference is made to FIG. 8.
Members of the group (Name, ID, location, OpenID);
Notification: Once the folder is updated with new content, the following notification may be performed:
Never notify (manual notification);
Once: notify only once to the members of the group;
Always: notify all the time to the other members;
All of these notifications may be automatic, with some type of acknowledgement.
Backup: a user could have the choice to do the following:
Never backup;
My Cloud: the content is distributed in the devices that are part of the personal cloud using P2P technology;
Cloud services provider: the content will be backed up at the cloud services provider storage cloud. The content is preferably encrypted.
Accessibility: a user can have the choice to select the content SLA
Device: Other users can access the content only if the source device is on;
My Cloud: The content is available only if any of the devices are available;
Cloud services provider: The content is always available. The content could be moved to a local storage S202, or it could be moved to the cloud S204 (storage consolidation 170).
Download/upload: the user can define read and write permissions.
Expiration: the user can define if the content store in the folder will expire or not.
The following describes rule-based content notification. One of the important features of the personal cloud is for a user to distribute to and notify of personal content with other members without breaking the current social network experience. As shown in Fig. 9, when content associated with a user is added or changed S302, the notification process S304 is initiated. A check is made to determine if various individuals to notify are P.C members S308, and if so, notification is sent to them S310 via an appropriate communications channel associated with the P.C.
If they are not P.C. members, if the members are of a social network, e.g., Facebook, the system will check the rules (from S306) and it will extract the Facebook information from its local database to send the notification either by posting it on the wall S312 or sending a direct message to the group S314.
If the member friends are not members of a social network, the system can use some other source of information previously extracted from email sources or address book to deliver the notification.
This exemplary architecture diagram illustrating various components of the system.
The Personal Cloud Communication API interfaces 120 are a set of API’s that allow the communication with other online services or personal cloud services. They include: 1) on-line third-party services communication API 122, which is a set of API’s from third party online services that allow user publish and retrieve UGC; and 2) Personal Cloud communication module API 124, which is a set of API that allow communication with other personal cloud clients.
An Identity Manager 150 is a module that is in charge of managing user credentials from a third party online service. The user provides usernames and passwords to access the online services. Using the online third party API 122 and OAuth, the UGC manager downloads the content and stores it at the personal cloud.
The dynamic ACL module 180 comprises a dynamic ACL processing module 185, a dynamic ACL rules verification module 190, and a dynamic ACL manager module 195.
In the dynamic ACL processing module 185, a data pre-processing module 186 normalizes the content and generates a schema that represents the following fields:
Facebook friends: Facebook ID, Facebook: Name;
Feed (Wall): Facebook: name, Facebook ID, Created time, Comments {name, ID}, and Count;
Home (News): From Name, ID, Comments {from {name, id}}, and Count;
Devices: Storage device source name, and device type {mobile, PC, STB}
In the analysis and classification module 187, based on data mining and other algorithms, this module analyzes the schema and generates a taxonomy and clusters of contacts based on real human activities producing access controls that are more closely related to the user. This module 187 implements Equation 1 and generates a representation of each group. In addition, this module 187 can edit and create new groups.
The rules generation module 188 generates DyACL metadata that maps groups with the on-line third-party service 400 and personal cloud users 350. The rules mapping module 189 maps ACL rules to the current or new virtual drives. The DyACL metadata is stored in the rules database.
The DyACL rules verification module 190 is in charge of managing the DyACL metadata store in the rules database.
The DyACL manager 195 provides an API 199 to access and manage the dynamic access control rules. It comprises: 1) a DyACL editor 196 that provides a set of APIs that help the user add, edit or remove the generated rules; 2) a data management module 197 that provides a set of API that allow the user add, edit or remove virtual drives attached to the rules; and 3) a DyACL controller 198 that provides a set of APIs that verify each of the rules to access any kind of content.
The personal cloud storage 200 is a component that represents the storage consolidation from different storage sources. In addition, it provides API to access the content and stores it. The personal cloud storage 200 is considered as an abstraction layer where metadata related to the system is stored and the user does not have direct access to this. It includes groups metadata representation, data sources representation used by the system (but not by the user), and personal cloud metadata. Note that this is distinguished from the storage consolidation that represents an aggregation of all the content storage in any device (which a user has access to).
A UGC Storage Communication API 210 comprises a set of APIs that allow other personal cloud components access the UGC. It includes: 1) a local UGC storage API 212, which is a set of APIs that allow accessing the local UGC storage; and 2) a distributed UGC storage API 214, which is a set of APIs that allow other modules to access the content store in different physical storage sources.
The personal cloud data abstraction 220, 250 layer represent the virtual drives for both the local and distributed UGC storage. The local UGC storage 230 is the physical storage attached to the personal cloud hardware, and the distributed UGC storage 260 is the storage consolidation
from different sources. The view of all the content may be based on DLNA technology or P2P technology.
0152 FIG. 11 provides an illustration of the OpenID authentication mechanism. Open ID allows users to use an existing account to sign in to multiple websites without needing to create new passwords.
0153 There are two main components. First the personal cloud OpenID consumer 190 represents users that are current using an OpenID provided by a cloud services provider 300 and can use the Open ID to enable a new personal cloud service. Once the user authenticates with the cloud services provider 300, personal cloud will be able to create a profile to map between the cloud services provider 300 Open ID and a Ténoi Unique identifier in the TDS.
0154 Second, the personal cloud OpenID provider 295 represents users that can provide an Open ID to other users so that the other users can access the user’s personal cloud. These features might include: 1) multi tenant, which provides that multiple members of a house could have their own open ID to access the content. However, access rights are not available once implemented in this case. All the users can see and access all of the content store in the cloud; and 2) security access, which provides that, when a user shares or enables the access to others for some time, the system can provide a temporary Open ID to control the access.
0155 The system or systems described herein may be implemented on any form of computer or computers and the components may be implemented as dedicated applications or in client-server architectures, including a web-based architecture, and can include functional programs, codes, and code segments. Any of the computers may comprise a processor, a memory for storing program data and executing it, a permanent storage such as a disk drive, a communications port for handling communications with external devices, and user interface devices, including a display, keyboard, mouse, etc. When software modules are involved, these software modules may be stored as program instructions or computer readable codes executable on the processor on a computer-readable media such as read-only memory (ROM), random-access memory (RAM), CD-ROMs, magnetic tapes, floppy disks, and optical data storage devices. The computer readable recording medium can also be distributed over network coupled computer systems so that the computer readable code is stored and/or executed in a distributed fashion. This media is readable by the computer, stored in the memory, and executed by the processor.
0156 All references, including publications, patent applications, and patents, cited herein are hereby incorporated by reference to the same extent as if each reference were individually and specifically indicated as incorporated by reference and were set forth in its entirety herein.
0157 For the purposes of promoting an understanding of the principles of the invention, reference has been made to the preferred embodiments illustrated in the drawings, and specific language has been used to describe these embodiments. However, no limitation of the scope of the invention is intended by this specific language, and the invention should be construed to encompass all embodiments that would normally occur to one of ordinary skill in the art.
0158 The present invention may be described in terms of functional block components and various processing steps. Such functional blocks may be realized by any number of hardware and/or software components that perform the specified functions. For example, the present invention may employ various integrated circuit components, e.g., memory elements, processing elements, logic elements, look-up tables, and the like, which may carry out a variety of functions under the control of one or more microprocessors or other control devices. Similarly, where the elements of the present invention are implemented using software programming or software elements the invention may be implemented with any programming or scripting language such as C, C++, Java, assembler, or the like, with the various algorithms being implemented with any combination of data structures, objects, processes, routines or other programming elements. Functional aspects may be implemented in algorithms that execute on one or more processors. Furthermore, the present invention could employ any number of conventional techniques for electronics configuration, signal processing and/or control, data processing and the like. The words “mechanism” and “element” are used broadly and are not limited to mechanical or physical embodiments, but can include software routines in conjunction with processors, etc.
0159 The particular implementations shown and described herein are illustrative examples of the invention and are not intended to otherwise limit the scope of the invention in any way. For the sake of brevity, conventional electronics, control systems, software development and other functional aspects of the systems (and components of the individual operating components of the systems) may not be described in detail. Furthermore, the connecting lines, or connectors shown in the various figures presented are intended to represent exemplary functional relationships and/or physical or logical couplings between the various elements. It should be noted that many alternative or additional functional relationships, physical connections or logical connections may be present in a practical device. Moreover, no item or component is essential to the practice of the invention unless the element is specifically described as “essential” or “critical.”
0160 The use of “including,” “comprising,” or “having” and variations thereof herein is meant to encompass the items listed thereafter and equivalents thereof as well as additional items. Unless specified or limited otherwise, the terms “mounted,” “connected,” “supported,” and “coupled” and variations thereof are used broadly and encompass both direct and indirect mountings, connections, supports and couplings. Further, “connected” and “coupled” are not restricted to physical or mechanical connections or couplings.
0161 The use of the terms “a” and “an” and “the” and similar referents in the context of describing the invention (especially in the context of the following claims) should be construed to cover both the singular and the plural. Furthermore, recitation of ranges of values herein is merely intended to serve as a shorthand method of referring individually to each separate value falling within the range, unless otherwise indicated herein, and each separate value is incorporated into the specification as if it were individually recited herein. Finally, the steps of all methods described herein are performable in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The use of any and all examples, or exemplary language (e.g., “such as”) provided herein, is intended merely to better illuminate the invention and does not pose a limitation on the scope of the invention unless otherwise claimed. Numerous modifications and adaptations will be readily apparent to those skilled in this art without departing from the spirit and scope of the present invention.
TABLE OF REFERENCE CHARACTERS
0162 100 Personal Cloud (PC)
0163 110 Distributed Social Network (DiSo)
3. The method according to claim 1, wherein the access level comprises real friends, occasional friends, and temporary friends.
4. The method according to claim 1, wherein the automatically grouping is based on social network activity.
5. The method according to claim 4, wherein the automatically grouping is based on Facebook information, including friends, news feed, and profile feed.
6. The method according to claim 5, wherein the automatically grouping is based on a classification algorithm that incorporates a counter of comments in a post.
7. The method according to claim 6, wherein the classification algorithm follows the equation:
\[ F = \log \left( \frac{\sum_{i=1}^{n} \text{comments} \times \text{Documents}}{\text{max(1, c, c^2, ..., c^n)}} \right) \]
\[ c: \text{comments and} \]
8. The method according to claim 1, wherein the user’s data is stored in a personal cloud.
9. The method according to claim 8, further comprising: retrieving the user’s data with an identity manager that retrieves information from multiple on-line sources.
10. The method according to claim 9, wherein access to the user’s data is provided using the Open Authorization OAuth standard.
11. The method according to claim 9, wherein the user’s data acquired with the identity manager comprises at least one of Facebook friend information, feed information, home information, photo information, album information video information, and event information.
12. The method according to claim 1, further comprising: backing up the user content to a cloud services provider.
13. The method according to claim 1, further comprising: notifying each member of each group of contacts having been granted access to that part of the user’s data based on the access level when that data has become accessible or has changed.
14. The method according to claim 13, wherein the notifying of each member of each group is based on a notify attribute selected from the group consisting of never notify, which may include manual notification, notify once, and notify all of the time.
15. A non-transitory computer program product, comprising a computer usable medium having a computer readable program code embodied therein, said computer readable program code adapted to be executed to implement a method for sharing data of a user with contacts, said method comprising: collecting the contacts from said user; collecting data related to communications between the user and his contacts; automatically grouping the contacts into different groups based on a level of communications between the user and the user’s contacts; and defining an access level for each group, with each access level granting access to some part of the user’s data based on the access level.
16. A server device for sharing data of a user with contacts, the server device comprising:
a storage element configured to store contacts collected from said user;
a storage element configured to store data related to communications between the user and his contacts; and
a processor configured to run:
an algorithm that automatically groups the contacts into different groups based on a level of communications between the user and the user's contacts; and
an algorithm that defines an access level for each group, with each access level granting access to some part of the user's data based on the access level.
17. A system for sharing data of a user with contacts, the system comprising:
the server device according to claim 16;
a client device comprising a reader configured to read the part of the user's data; and
a network that connects the client device to the server device.
* * * * *
|
{"Source-Url": "https://patentimages.storage.googleapis.com/b5/46/51/eba31a6af072c6/US20120136936A1.pdf", "len_cl100k_base": 12951, "olmocr-version": "0.1.50", "pdf-total-pages": 26, "total-fallback-pages": 0, "total-input-tokens": 34261, "total-output-tokens": 14036, "length": "2e13", "weborganizer": {"__label__adult": 0.0005369186401367188, "__label__art_design": 0.0007662773132324219, "__label__crime_law": 0.0012521743774414062, "__label__education_jobs": 0.000835418701171875, "__label__entertainment": 0.00019979476928710935, "__label__fashion_beauty": 0.0002467632293701172, "__label__finance_business": 0.003429412841796875, "__label__food_dining": 0.0003173351287841797, "__label__games": 0.0013284683227539062, "__label__hardware": 0.00826263427734375, "__label__health": 0.0004177093505859375, "__label__history": 0.0002639293670654297, "__label__home_hobbies": 0.00030422210693359375, "__label__industrial": 0.0004405975341796875, "__label__literature": 0.0003211498260498047, "__label__politics": 0.0002841949462890625, "__label__religion": 0.000396728515625, "__label__science_tech": 0.057708740234375, "__label__social_life": 0.00034546852111816406, "__label__software": 0.4052734375, "__label__software_dev": 0.5166015625, "__label__sports_fitness": 0.00010776519775390624, "__label__transportation": 0.0003268718719482422, "__label__travel": 0.00017261505126953125}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 61824, 0.0214]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 61824, 0.14659]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 61824, 0.90489]], "google_gemma-3-12b-it_contains_pii": [[0, 961, false], [961, 961, null], [961, 961, null], [961, 961, null], [961, 961, null], [961, 961, null], [961, 961, null], [961, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 7412, null], [7412, 13583, null], [13583, 20118, null], [20118, 24875, null], [24875, 28405, null], [28405, 32715, null], [32715, 38584, null], [38584, 44663, null], [44663, 50777, null], [50777, 58169, null], [58169, 61019, null], [61019, 61824, null]], "google_gemma-3-12b-it_is_public_document": [[0, 961, true], [961, 961, null], [961, 961, null], [961, 961, null], [961, 961, null], [961, 961, null], [961, 961, null], [961, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 1343, null], [1343, 7412, null], [7412, 13583, null], [13583, 20118, null], [20118, 24875, null], [24875, 28405, null], [28405, 32715, null], [32715, 38584, null], [38584, 44663, null], [44663, 50777, null], [50777, 58169, null], [58169, 61019, null], [61019, 61824, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 61824, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 61824, null]], "pdf_page_numbers": [[0, 961, 1], [961, 961, 2], [961, 961, 3], [961, 961, 4], [961, 961, 5], [961, 961, 6], [961, 961, 7], [961, 1343, 8], [1343, 1343, 9], [1343, 1343, 10], [1343, 1343, 11], [1343, 1343, 12], [1343, 1343, 13], [1343, 1343, 14], [1343, 7412, 15], [7412, 13583, 16], [13583, 20118, 17], [20118, 24875, 18], [24875, 28405, 19], [28405, 32715, 20], [32715, 38584, 21], [38584, 44663, 22], [44663, 50777, 23], [50777, 58169, 24], [58169, 61019, 25], [61019, 61824, 26]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 61824, 0.24]]}
|
olmocr_science_pdfs
|
2024-12-03
|
2024-12-03
|
f521f85260f1e4479a83dbdedf025f25b5f63afb
|
Chapter 14
Creating New Model Objects
This chapter is designed to guide those who are programming new model objects for ViSta (version B 1.0r1, Oct. 1992). While the chapter has not been updated to correspond to newer releases, the general outline and most of the details still apply. We discuss ViSta’s data and model object systems, and how to develop new ViSta model objects. This chapter assumes the developer is familiar with Lisp-Stat (Tierney, 1990).
14.1 Data Objects
Data objects are used to define data used by ViSta. In Chapter 3 we discussed the function which defines a data object, and the keywords which can be used with the function. In this section we discuss the data object prototype inheritance structure, the concept of the current data object, and we present messages which can be send to a data object which has already been defined.
14.1.1 Inheritance Structure
Note that there are three prototype data objects, one for multivariate data, one for dissimilarity data, and one for tabular data. The multivariate data object is named \texttt{mv-data-object-proto}; the dissimilarity data object, which inherits from \texttt{mv-data-object-proto} is named \texttt{diss-data-object-proto}; the tabular data object, which inherits from \texttt{mv-data-object-proto}, is named \texttt{table-data-object-proto}. The \texttt{data} function creates a data object which is an instance of one of these three data object prototypes. If the \texttt{:matrices}, and \texttt{:classes} keywords are not used in the \texttt{data} function when the data object is defined, then the data object is a multivariate data object and is an instance of \texttt{mv-data-object-proto}. If the \texttt{:matrices} keyword is used in the \texttt{data} function when the data object is defined, then the data object is a dissimilarity data object and is an instance of \texttt{diss-data-object-proto}. If the \texttt{:classes} keyword is used in the \texttt{data} function when the data object is defined, then the data object is a tabular data object and is an instance of \texttt{table-data-object-proto}.
14.1.2 Current Data and Data Object Names
One of the data objects is always the “current” data. The current data is indicated in the data menu by the checked menu item. It is also indicated in the workmap as the highlighted data icon. The data’s object identification can be found in the global variable \texttt{current-data}, to which messages can always be sent. The current data can be changed by clicking on a new data icon, by choosing a new item of the data menu.
When a data object is defined by the \texttt{data} function, the function also defines a variable whose name is the name of the data object, and whose value is the object’s identification information. Using this name, the current data can be changed from the keyboard by using the \texttt{setcd} (set current-data) function. For example, if there is a data object named \texttt{crime}, you can make it the current data by typing \texttt{(setcd crime)}.
14.1.3 Data Object Messages and Methods
Once a data object has been created it can be sent messages. The messages can be sent either to current-data or to a specific data object by using the name of the data object. For example, the message (send current-data :data) returns the list of data values for the current-data. If there is a data object named crime, you could type (send crime :data) to see a listing of its data values.
There is a group of messages which can be used to either obtain information about the data object or to store information in the data object. You obtain information about the object by using the message without an argument, while you can store information in the object by following the message with an argument that is the information. For example (send crime :title) causes the data-object to tell you its title, whereas (send crime :title “Crime 1992”) allows you to send a title to the object. In addition to the :title message, messages in this group are :nobs, which returns or sets the number of observations in the data object; :nvar, which returns or sets the number of variables in the object; :variables, which returns or sets the names of the variables; :labels, which returns or sets the labels of observations; :menu-length, which returns or sets the position of the object’s name in the data menu; :types, which returns or sets the type of each variable; :data, which returns or sets the data-object data list; and :name which returns or sets the name of the data object. Also, :obs-states, :var-states and :mat-states return or set the state of each observation, variable or matrix (the states can be normal, selected or invisible); :obs-window, :var-window and :mat-window return or set a logical value of t or nil indicating whether or not the window that lists observations, variables or matrices should be open when the data object is the current object; and :obs-window-object, :var-window-object and :mat-window-object return or set the object identification information for each window. The message :matrices can be used with dissimilarity data to obtain the names of matrices for dissimilarity data. With the optional list of character strings, the message specifies that the data are dissimilarity data and specifies the number the matrices and their names.
There is another group of messages which are sent to the current-data by the menu items in the data menu and in the workmap and data icon popup menus. Each message corresponds to the menu item having the same name. For example, the message (send current-data :save-data) is used by the save data menu item of the data menu and workmap popup menu. Each message has a short form: (save-data) is the short form of the message given above. By using the long form, the programmer may also send these messages to a specifically named data object. The messages include :save-data, which saves data into a ViSta datafile specified in a dialog-box (the message can be followed by a string argument to name the file, if desired); :create-data, which creates a new data object from the active portion of the current data; :visualize to see a visualization of the
data; :report to see a report (listing) of the data; :datasheet to obtain a datasheet containing the data (this message is not yet implemented); :list-variables which lists the variables in the current data (you can also use :list-vars or :list-var); :list-observations (or :list-obs) which lists the observations in the current data; :list-matrices (or :list-mats or :list-mat) which lists the matrices in dissimilarity data; :merge-variables, which merges the active variables in the current data with the active variables in the previously current data; and :merge-observations, which merges the active observations in the current data with the active observations in the previously current data. The last two messages take an optional argument which is a character string that is used to name the new data object. If no character string is present, a dialog box is presented to obtain the name. Finally, you can type :summary to see a summary report (listing of summary statistics) of the data. The :summary message has five keyword arguments, each of which must be followed with t or nil (the default). These arguments include :moments, :quartiles, :ranges, and :covariances, which determine what type of summary statistics are reported, and :dialog, which determines whether or not a dialog box is presented to obtain the desired types of statistics.
There is a group of messages which take an argument that is a list that specifies the "type" of the variable. The elements of the list must be one of the character strings "labels" "category" "ordinal" "numeric" or "all" (in upper-case, lower-case or mixed-case). These messages return information about "active" variables (variables which appear in the "Variables" window and are selected, if any are selected) whose types match the specified value of ok-types. The messages are :active-data (to get the active portion of the data) :active-data-matrix (to get the active portion of the data in matrix form), :active-nvar (to find out how many active variables there are) :active-variables (to obtain a list of the names of the active variables) :active-types (to obtain a list of the types of the active variables), and :active-matrices (to obtain a list of the names of the active matrices for dissimilarity data).
Other data object messages include :variable which reports a list of values for the variable whose name is specified by the string argument of the message. Various simple statistics of the active variables in the data can be obtained with the messages :covariance-matrix, :interquartile-ranges, :kurtoses, :maximums, :means, :medians, :mid-ranges, :minimums, :ranges, :skewnesses, :standard-deviations, and :variances. None of these messages take an argument. The message :close-windows closes any windows that are open for the current object.
14.2 Model Objects
There are three classes of prototype model objects, each of which inherits from a prototype data object, as shown in Figure 2. One class of prototype model objects inherits from `mv-model-object,proto` which in turn inherits from `mv-data-object,proto`. The second class of prototype model objects inherit from `tab-model-objectPROTO`, which itself inherits from the `tab-data-object,proto`, which in turn inherits from the `mv-data-objectPROTO`. The third class of prototype model objects inherit from the `diss-model-objectPROTO` which in turn inherits from the `diss-data-objectPROTO`. Within each of these classes of prototype model objects there are prototype model objects that are specialized to a specific analysis method that is appropriate for the particular type of data from which the prototype objects inherit.
The prototype model objects which inherit from `mv-model-objectPROTO` are for analysis methods that are appropriate to multivariate data. Currently, these model object prototypes include `standardize-object-proto` (for standardizing multivariate data), `pca-model-object-proto` (for principal components), `mmr-model-object-proto` (for multivariate multiple regression) and `crs-model-object-proto` (for correspondence analysis). The prototype model objects which inherit from `tab-model-object-proto` are appropriate for analysis of data tables. Currently, there is no tabular model objects, but in the future the `anova-model-object-proto` (for analysis of variance) and `discrim-model-object-proto` (for discriminant analysis) will appear here in the hierarchy. The model objects which inherit from `diss-model-object-proto` are for analysis methods which are appropriate to dissimilarity data. Currently there is
---
**Figure 2: Data and Model Object Inheritance Structure**

one such model object prototype, mds-model-object-proto for multidimensional scaling\(^1\). In the future, cls-model-object-proto (for cluster analysis) will appear here. Since every model prototype ultimately inherits from the multivariate data prototype, all messages and methods given in Section 14.1 can be used with any model.
### 14.2.1 Current Model and Model Object Names
One of the models is always the “current” model. The model’s object identification is in the global variable current-model, to which messages can always be sent. The current model is indicated in the model menu by the checked menu item, and in the workmap by the high-lighted model icon. The current model can be changed by clicking on a new model icon or choosing a new menu item in the model menu. Every model has a name which appears below the model’s icon and in the model menu. The name can be used in the setcm function to change the current model from the keyboard. If there is a model named pca-crime, you can type (setcm pca-crime) to change the current model to pca-crime. You can also send messages to any model by typing, for example (send pca-crime :title).
### 14.2.2 Multivariate Model Object Messages and Methods
In this section we overview the sequence of actions that occurs when the user creates a new instance of a model, noting the methods that are used to create the instance. We then we outline the methods that every model prototype must have, so that you will know how to write a new model prototype.\(^2\)
All multivariate model objects have many methods. Since model prototypes inherit from data prototypes, the model objects inherit all of the data object methods. In addition, there are some methods which are shared by all multivariate model objects. These methods have already been written as methods of mv-model-object-proto, and, due to the inheritance structure, are inherited by all model prototypes. However, some of the methods that are shared by all multivariate model objects must be uniquely redefined for individual model objects so that their actions are appropriate to the particular model. You will have to write these methods.
---
1. Currently, the multidimensional scaling object does not inherit from other objects as described here, nor does its code structure conform to the code structure given in this section.
2. To understand this and the next section, you should look at the code for one or more model objects as you read the section. The correspondence analysis or principal components model objects may be the best to follow. In addition, the code for mv-model-object-proto should be consulted (see the file modelobj.lsp). The code structure of the multidimensional scaling model object does not correspond to the description given in this section. It should not be reviewed at this point.
Finally, some methods are unique to an individual model object. You will also have to be write these methods.
When the user requests a data analysis (by using, for example, a menu item of the method menu) a new instance of a model prototype is created by the model’s constructor function. This function is used by the method menu and can be typed at the keyboard by the user. As an example, the constructor function for principal components analysis is simply (principal-components). Constructor functions usually take arguments. For example (principal-components :covariances t), when the user wishes to analyze covariances. As another example, the principal components menu item issues the statement (principal-components :dialog t), so that a dialog box is presented to obtain the argument values.
The model’s constructor function first checks on the validity of the argument values, and then issues the :new message followed by a set of arguments. The arguments must be as follows: The first several arguments are the parameters specific to the particular model (such as covariances for the principal components model). Then, there are five arguments: 1) an integer which specifies the number of the model’s method-button; 2) the data list for the analysis; 3) the model’s title; 4) the model’s name; and 5) a logical value indicating whether a dialog box is to be presented to obtain parameter values.
The constructor function’s :new message invokes the model’s :isnew method. This method creates a new instance of the model, saves the parameters of the model in the instance’s slots, and then uses call-next-method to call the mv-model-object-proto’s :isnew method. This method takes a series of actions: (1) the mv-data-object-proto’s :isnew method is called by call-next-method with arguments that are the model’s data, variable list, title, observation labels, variable types and object name; (2) the model’s method icon is added to the workmap; (3) the model’s option dialog box is presented; then, if the dialog is successful, (4) the object identification information about the data that are being analyzed is saved in a slot of the model; (5) the analysis takes place; (6) any open data object windows are closed; and (7) the model icon is added to the workmap.
The mv-model-object-proto’s :isnew method takes the actions outlined in the previous paragraph by sending messages to various objects. The messages, in order, are :copy-tool-icon (sent to the toolbox), :dialog, :options, :data-object, :analysis, (all sent to the model), :close-windows (send to the data), and :new-model (sent to the model). Note that when dialog is t and when :options returns a value of nil (for example, when the option dialog’s cancel button is pressed, or when the dialog is incorrectly used) the remaining messages are not sent.
The :dialog method sets the model’s dialog slot to t or nil, depending on the value of dialog, whereas the :options method presents the model’s options dialog. The :data-object method save the object identification information about the data that are being analyzed in a model slot. The :analysis method performs the analysis. Once the analysis has successfully completed, the :new-model method updates the system to recognize the new model object. This method assigns the current-model and current-object global variables a value equal to the object identifier of the model and whose value is the model’s object identification information; append a new item to the bottom of the model menu; and create an action for the menu item which is to perform the setcm function. Thus, whenever the new menu item is chosen (and, indirectly, whenever the model icon is selected), the actions contained in setcm take place.
All models have the ability to create a copy of the data that was input to them. This is done by the :create-input-data-object method which creates a new data object that contains the data input to the model. Finally, the abbreviation for the model can be obtained from the model by the message (send current-model :model-abbrev). This message takes an optional argument that sets the model abbreviation.
All models must have six additional methods. The specific details of these methods depends on the specific model - each of the methods must be uniquely defined for each model, thus, when you develop a new model object you must define methods for each of these messages. Two of these methods have already been discussed above. These are the :options method, which presents a dialog that allows setting options for models, and the :analysis method, which performs the analysis that fits the model to the current-data. The other methods are used by the model menu. These are :save-model-template, which saves a copy of the model; :create-data, which creates one or more data objects of the results of the model; :visualize, which returns a visualization of the model; and :report, which returns a report of the results of the analysis. In addition to these methods, you may need to define additional methods that are used by specific models.
14.2.3 Control-Flow when Model Objects are Constructed
(These are notes that need to be added somewhere in this chapter - FWY).
The default (or user specified) values in the model constructor function are put into the model slots by the :isnew method. Then the :options method is called by the ancestors of your object (you don’t call it yourself). If :dialog is true, the :options method is used to show the dialog to get values for the options, which may or may
not be different than those gotten from the constructor function. The :options method then puts these values, whatever they are, in the slots, ignoring any values that may already be in them.
The :options method returns nil when it is not used right, or when it is canceled. Otherwise, it returns the list of dialog item values, tho this list isn't used. If the dialog is used correctly, the :options method should stuff the values gotten from the dialog items into the appropriate slots.
Then the ancestors of your method determine when the :analysis method should be used (depending on the outcome of the :options method). If so, the :analysis method gets called by the ancestors of your object, no matter what :dialog is. The :analysis method then uses whatever is in the slots.
The :analysis method doesn't use the list of dialog results (in fact, nobody uses this list), rather, it uses the information that has been put into the slots. More generally, no method uses the results of any other method directly. All communication between methods is done via slots.
14.3 An Example: The Principal Components Model Object
In this section we show the steps taken to write a model object for Principal Components model analysis. This example can be followed by the developer who wishes to develop a new model object, as the steps are the same for all objects. The code shown here is from the `PCAMOB.LSP` file.
**Step 1: Define the model prototype:** The first step in defining a new model object is to define the model’s prototype object. The `defproto` statement for the Principal Components model object is:
```
(defproto pca-model-object-proto
'(scores coefs eigenvalues svd corr) ()
mv-model-object-proto)
```
The slots `scores coefs eigenvalues svd` and `corr` will hold information specific to this model. The prototype inherits from `mv-model-object-proto`.
**Step 2: Define slot-accessor methods.** There must be a slot accessor method for each slot specified in the `defproto` function. For principal components these methods are:
```
(defmeth pca-model-object-proto :scores
(optional (values nil set))
(if set (setf (slot-value 'scores) values))
(slot-value 'scores))
(defmeth pca-model-object-proto :coefs
(optional (values nil set))
(if set (setf (slot-value 'coefs) values))
(slot-value 'coefs))
(defmeth pca-model-object-proto :eigenvalues
(optional (values nil set))
(if set (setf (slot-value 'eigenvalues) values))
(slot-value 'eigenvalues))
(defmeth pca-model-object-proto :svd
(optional (structure nil set))
(if set (setf (slot-value 'svd) structure))
(slot-value 'svd))
(defmeth pca-model-object-proto :corr
(optional (val nil set))
(if set (setf (slot-value 'corr) val))
(slot-value 'corr))
```
The :scores and :coefs slots will contain matrices, and the :eigenvalues a vector of the principal component scores, coefficients and eigenvalues. The :svd slot will contain the structure resulting from the sv-decomp function (which is redundant with the information in the first three slots, but which facilitates retrieving the information). The corr slot will contain t or nil to indicate whether correlations or covariances are to be computed from the multivariate data.
**Step 3: Define ViSta system methods.** As indicated in section 14.2.2, each model prototype must contain certain methods for ViSta to work properly. These methods must be named options and analysis (which are used by the isnew method of mv-model-object-proto), and save-model-template, create-data, report and visualize (all used by the menu system). We discuss these methods here, and indicate how similar methods would be defined for other model objects.
**Options:** The options method for the principal components proto is:
```lisp
(defmeth pca-model-object-proto :options ()
(when (send self :dialog)
(let ((result nil)
(dialog-value (choose-item-dialog
"Analysis Options:"
'("Analyze Covariances"
"Analyze Correlations") :initial 1)))
(when dialog-value
(when (= 1 dialog-value) (def result t))
(send self :corr result))
dialog-value)))
```
This method first checks the value of the dialog slot to see if a dialog is to be presented. This action should always be taken first since when a script file job is in progress, or when a model is being loaded, the dialog should not be presented. The model’s constructor function should set the value of dialog properly, as it does in this example. When appropriate, the dialog is then presented to see if the analysis is to be performed on correlations or covariances. The dialog sets the value of the corr slot for later use by the :analysis method. Note that the results of the dialog are communicated to the analysis method through the slot. This should always be this way for all model prototypes. Then, the value that is returned by choose-item-dialog (which is nil when the dialog is canceled) is used as the value returned by :options, so that the analysis can be canceled when the dialog has been canceled. The :options method should always return nil in this situation for all models. Indeed, it should return nil whenever the options dialog is not properly used (see the multivariate multiple regression options dialog for a good example of this).
Analysis: The analysis method for the principal components proto is:
```
(defmeth pca-model-object-proto :analysis ()
(let* ((left-alpha 1)
(data (send self :data-matrix))
(prepped-data
(if (send self :corr)
(/ (normalize (center data) 1)
(sqrt (1- (select (array-dimensions data) 0))))
(/ (center data)
(sqrt (1- (select (array-dimensions data) 0)))))
)
(svd (sv-decomp2 prepped-data))
(svd (if (< (sum (col (select svd 2) 0)) 0)
(list (* -1 (select svd 0))
(select svd 1)
(* -1 (select svd 2))
(select svd 3))
svd))
(scores (matmult (select svd 0)
(diagonal (* (select svd 1) left-alpha))))
(eigenvalues (* (select svd 1) 2))
(coefs (matmult (select svd 2)
(diagonal (* (select svd 1)
(1- left-alpha)))))))
(send self :svd svd)
(send self :coefs coefs)
(send self :scores scores)
(send self :eigenvalues eigenvalues)))
```
The details of this method are not important for this example, other than to note that all values (i.e., svd, coefs, scores and eigenvalues) are computed inside a let* statement (so that they are only locally defined) and then saved for later use by placing them in appropriate slots.
Save-Model-Template: Every model object needs to have a method named save-model-template, a method which is used by the model menu's save-model method. The method contains a template of the code that creates the model object. The method must always have as an argument the object identification information for the data object used by the model, since the data must be saved along with the model. For principal components, the method is:
```
ViSta: The Visual Statistics System
```
```lisp
(defmeth pca-model-object-proto :save-model-template
(data-object)
`(principal-components
:title ,(send self :title)
:name ,(send self :name)
:dialog nil
:covariances ,(not (send self :corr))
:data (data ,(send data-object :name)
:title ,(send data-object :title)
:variables ',(send self :variables)
:types ',(send self :types)
:labels ',(send self :labels)
:data ',(send self :data))))
Note the unusual backquote syntax (which is explained briefly by Tierney on pp. 98 and 120, as well as on page 197 in the discussion of saving objects). To be clear, the character in front of `(principal-components is a backquote. This character in front of a list causes all elements of the list to be quoted, except those preceded by commas, which are treated in the normal fashion. Note that the data for the principal components function come from the model object via the various (send self functions. However, the data’s name and title must come from the original data object that was analyzed.
The mv-model-object-proto’s :save-model method takes the quoted function and places it in a file, with the functions following commas being replaced with their results. When the file is loaded back into ViSta by (load-data), a principal components analysis is performed on the data that were also saved in the file.
ViSta: The Visual Statistics System
Create-Data: For principal components, just as for any other model object, the method which creates output data objects must work in such a way that it can be used by the menus, can be typed at the keyboard, or can be contained in a script file. The method is:
```lisp
(defun pca-model-object-proto :create-data
(&key (dialog nil) (scores t) (coefs t) (input nil))
(if (not (eq current-object self)) (setcm self))
(let ((creator (send *desktop* :selected-icon))
(desires (list (list (if scores 0)
(if coefs 1)
(if input 2))))
(if dialog
(setf desires
(choose-subset-dialog
"Choose Desired Data Objects"
'("Component Scores"
"Component Coefficients"
"Analyzed Input Data")
:initial (select desires 0)))))
(when desires
(when (member '0 (select desires 0))
(send current-model
:pca-scores-data-object creator))
(when (member '1 (select desires 0))
(send current-model
:pca-coefs-data-object creator))
(when (member '2 (select desires 0))
(send current-model
:create-input-data-object "PCA" creator)))
)
)
```
First, note the statement
```
(if (not (eq current-object self))
(setcm self))
```
This statement must be used at the beginning of the method to assure that the current model icon is properly selected. Also, note that the method has optional key-word arguments which determine whether the dialog box is displayed, and which determine which output data objects will be created when the dialog box is not displayed. These optional argument permit keyboard entry of the statement
```
(send current-model :create-data :dialog t)
```
which presents the user with the dialog box. This is the statement which is generated by the menu system. On the other hand, these arguments permit the statement:
```
(send current-model :create-data
:scores t :coefs nil)
```
which creates one output data object of scores without the user having to intervene by responding to a dialog box. Thus, this statement can appear in a script file. A create-data method for another model object must have a similar construction if it is to work in all of these ways.
This method calls three other methods to create the data objects. One of these methods (the :create-input-data-object method) is already defined by mv-model-object-proto, and is a method which creates a copy of the input data, taking into consideration which variables are selected and active. The other two methods are specific to the principal components model, but it is instructive to show one of these here (they are both nearly identical). The :pca-scores-data-object method is:
```
(defun pca-model-object-proto
:pca-scores-data-object (creator)
(data (concatenate 'string "Scores-"
(send self :name))
:created creator
:title (concatenate 'string "PCA Scores for "
(send self :title))
:data (combine (send self :scores))
:variables
(mapcar #'(lambda (x) (format nil "PC~a" x))
(iseq (min (send self :nvar) (send self :nobs)))))
:labels (send self :labels)
:types (repeat "Numeric"
(min (send self :nvar) (send self :nobs)))
)
```
Note that the method consists entirely of a data function to create a new data object (this is the same data function used in data files). Various functions are used to create the value for the arguments of the function. The name is created by concatenating a meaningful prefix (in this case “scores”) with the model object’s name. The title is created by concatenating a similar prefix with the model object’s title. The data consist of a list of scores, the combine function being used to convert the scores matrix to a list. The variable names are a combination of the string “PC” and a sequence number. The labels and types are self-explanatory. If this method is copied for new model objects, then these new model objects will produce data objects that conform with other ViSta data objects.
Report: The report method for the principal components prototype is:
```lisp
(defun pca-model-object-proto :report
&optional (stream t)
(let* ((w nil)
(labels (send self :labels))
(vars (send self :variables))
(scores (send self :scores))
(coefs (transpose (send self :coefs)))
(eigenvalues (send self :eigenvalues))
(proportions (/ eigenvalues (sum eigenvalues)))
(fitmat (transpose
(matrix (list 3 (min (send self :nobs)
(send self :nvar)))
(combine eigenvalues proportions
(cumsum proportions)))))))
(lc-names
(mapcar #'(lambda (x) (format nil "PC~a" x))
(iseq (send current-model :nvar))))
(+macintosh(def w (send display-window-proto :new :title
"ViSta Report")))
(-macintosh(display-string (format nil "ViSta Report
****************~2%"))
(display-string
(format nil "~2%Principal Components Analysis~2%") w)
(display-string
(format nil "~2%Model: ~a~2%" (send self :name ) ) w)
(display-string
(format nil "~2%Variable Names: ~a~2%" vars) w)
(display-string
(format nil "~2%Fit Indices for each Component:~%Eigenvalue (amount of total data variance fit by each component)~%Proportion (of total data variance fit by each component)~%Cumulative Proportion (of total data variance fit by the components)~2% Eigenvalue Proportion Cum Propor Component~%") w)
(print-matrix-to-window fitmat w :labels lc-names)
(display-string
(format nil "~2%Coefficients (EigenVectors):~%") w)
(print-matrix-to-window
(fuzz coefs) w :labels lc-names)
(display-string
(format nil "~2%Component Scores:~%") w)
(print-matrix-to-window
(fuzz scores) w :labels labels) w))
```
This function is used by the menu-system, as well as by the user from either the keyboard or from script files, by the statement: (send current-model :report). Note that the method contains the statement (if (not (eq current-object self)) (setcm self)) which is used for the same reason that it was used in the create-data-objects method. The let* statement is used to locally define those values which are to be reported. Then, the #+macintosh(def w ...) statement is used to define, for only the Macintosh, the window w in which the report appears. This is defined only for the Macintosh because other systems, including MS-Windows and X-Windows do not have display windows. For those systems a heading is printed on the standard output by the statement that begins #+macintosh. In constructing other reporting methods, you should use these exactly these same statements so that the report’s appearance is consistent across methods. Next, a series of display-string and print-matrix-to-window functions are used to report the desired information. These functions should be used in place of standard printing functions since they write to the Macintosh display window or the MS-Windows or X-Windows standard output.
**Visualize:** We do not present the visualize method here because it is too long. The important aspect of it for those constructing the method for other models is that it has no arguments, and is used by the menu-system and from the keyboard by the statement (send current-model :visualize).
**Step 4: Define the Model’s Constructor function:** You must create a constructor function to construct an instance of the model object prototype. This is the function that is actually used to analyze data. It is used by the menu system or by the data analyst via the keyboard or from script files to construct an instance of the model object. The constructor function for principal components is:
```lisp
(defun principal-components
(&key
(data current-data)
(title "Principal Components")
(name (concatenate 'string "PCA-" (send current-data :name)))
(dialog nil)
(covariances nil))
(if (not (eq current-object data)) (setcd data))
(send pca-model-object-proto :new (not covariances) 6 data title name dialog))
```
This function uses keyword arguments. The defaults are such that if the analyst types the statement (principal-components) the analysis will be performed on correlations computed from the active numeric variables in the current data object. The dialog box will not be presented. The methods menu generates the statement (principal-components :dialog t), so that the dialog box is presented to see if the user wishes to perform the analysis on correlations or covariances.
ViSta: The Visual Statistics System
The constructor functions for other models should be similar to this one. Since all other constructor functions in ViSta use keyword arguments, it is recommended that new models also have keyword arguments. The first four keywords must be used with all models as they appear in the example since they are processed by the underlying data object prototype. Of course, the values of the title and name keywords should be replaced with appropriate strings to identify the model. The dialog keyword should also be used as is, with the default value nil. The covariances keyword is specific to the components model. For other models it would be replaced with other keywords specific to the other models.
The send statement at the end of the constructor function should appear as it does here for other models, except for the presence of (not covariances), which must be replaced by arguments corresponding to the keywords which are specific to the model. The value 6 corresponds to the number of the tool icon. Consult the author for how this is changed for other models.
**Step 5: Define the :isnew method:** The next step is to define the model’s :isnew method, the method which is invoked by the :new message in the model’s constructor function. For principal components this method is:
```lisp
(defmeth pca-model-object-proto :isnew (corr &rest args)
(cond
((> (send current-data :active-nvar '(numeric))
(send current-data :nobs))
(error-message "Note: Cannot analyze data with fewer observations than variables."
(send *toolbox* :reset-button 6))
(t
(send self :model-abbrev "PCA")
(send self :corr corr)
(apply #'call-next-method args))))
```
First, the :isnew method creates a new instance of the model. This is done by the Lisp-Stat object system; there are no statements in the :isnew method that correspond to this action. The first thing that explicitly takes places in the :isnew method is that the data are checked to see if there are more active variables than observations. If so, an error message is issued, the appropriate method button (number 6) is reset, and the analysis is terminated. If there are at least as many observations as variables, the model abbreviation is set to PCA, and the value (t or nil) of the corr argument is stored in the corr slot. Then call-next-method is applied to each of the remaining arguments, calling the isnew method for mv-model-object-proto.
This general flow should be followed in any other model’s :isnew method: First, check on the validity of argument values. If they are not valid, report an error and
reset the button. If they are valid, store the model abbreviation and argument values in their slots. Then, apply call-next-method to the remaining arguments.
**Step 6: Define the Method Menu Item and Button:** Code to create a new item for the method menu must be added to the menus.lsp file. See how this is done for existing menu items in that file to determine how a new item is created. For principal components the statement is:
```
(setf prin-model-menu-item
(send menu-item-proto :new "Principal Components"
:action #'(lambda ()
(principal-components :dialog t))
:enabled nil))
```
You must then add the name of the model item (prin-model-menu-item, in this case) to the list of menu item names associated with the (send *tools-menu* :append items) statement that appears in the middle of the menus.lsp file.
In order to have the menu item enable and disable according to the type of the current data object, you must modify the setcd function in the dataobj.lsp file. For principal components, which is appropriate to multivariate data, but not to dissimilarity and table data, the statement (send prin-model-menu-item :enabled t) was added to the portion of setcd’s cond function that is true for multivariate data, and (send prin-model-menu-item :enabled nil) was added to the portions that are nil for multivariate data.
In order to have the method’s tool-bar button enable and disable according to the type of the current data object, you must further modify the setcd function in the dataobj.lsp file. For principal components (whose button is number 6) the statement (send (select tools 6) :icon-state "normal") was added to the portion of setcd’s cond function that is true for multivariate data, and (send (select tools 6) :icon-state "gray") was added to the portions that are nil for multivariate data. A method for adding new method buttons has not yet been developed, thus, if your new method does not correspond to an unused button, it cannot yet be represented by a button.
Step 7: On Demand Code Loading Feature. The code for a model-object is not loaded until the first time that an instance of the object prototype needs to be constructed. Usually, this is when the object’s method menu or method button is used. This delayed, on demand, code loading feature is created by the loading functions that appear at the end of the modelobj.lsp file. The loading function for principal components is:
```
(defun principal-components
(&key
(data current-data)
(title "Principal Components")
(name (concatenate 'string "PCA-
(send current-data :name)))
(dialog nil)
(covariances nil))
(load (concatenate 'string *vista-dir-name*
"pcamob")
(principal-components
:data data
:title title
:name name
:dialog dialog
:covariances covariances))
```
Notice that the loading function has exactly the same name, argument list and default values as the constructor function. This must be true for the loading function for every model. The body of the loading function must always consist of two statements. The first uses the load function to load the desired model object file. This file should be located with all other ViSta files, and is accessed by concatenating *vista-dir-name* (whose value is the directory path) with the name of the file (pcamob, in this case). The second statement is the constructor function which constructs the model object. All options must be explicitly specified, and they must be given values obtained from the argument list of the loading function.
Creating New Model Objects
|
{"Source-Url": "http://math.furman.edu:80/ps/chap14.pdf", "len_cl100k_base": 9605, "olmocr-version": "0.1.50", "pdf-total-pages": 21, "total-fallback-pages": 0, "total-input-tokens": 45361, "total-output-tokens": 10718, "length": "2e13", "weborganizer": {"__label__adult": 0.000194549560546875, "__label__art_design": 0.0002892017364501953, "__label__crime_law": 0.00015652179718017578, "__label__education_jobs": 0.0008563995361328125, "__label__entertainment": 4.214048385620117e-05, "__label__fashion_beauty": 8.052587509155273e-05, "__label__finance_business": 0.0001437664031982422, "__label__food_dining": 0.00018012523651123047, "__label__games": 0.0003960132598876953, "__label__hardware": 0.00048470497131347656, "__label__health": 0.00013911724090576172, "__label__history": 0.00013172626495361328, "__label__home_hobbies": 6.949901580810547e-05, "__label__industrial": 0.0002224445343017578, "__label__literature": 0.00011861324310302734, "__label__politics": 0.00012612342834472656, "__label__religion": 0.0002498626708984375, "__label__science_tech": 0.0053253173828125, "__label__social_life": 5.924701690673828e-05, "__label__software": 0.012481689453125, "__label__software_dev": 0.9775390625, "__label__sports_fitness": 0.00014126300811767578, "__label__transportation": 0.00021064281463623047, "__label__travel": 0.0001220107078552246}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 43679, 0.00709]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 43679, 0.58704]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 43679, 0.83495]], "google_gemma-3-12b-it_contains_pii": [[0, 459, false], [459, 3030, null], [3030, 6199, null], [6199, 9019, null], [9019, 10929, null], [10929, 13762, null], [13762, 16593, null], [16593, 19319, null], [19319, 20390, null], [20390, 22081, null], [22081, 24690, null], [24690, 26658, null], [26658, 28148, null], [28148, 30141, null], [30141, 32207, null], [32207, 34557, null], [34557, 37349, null], [37349, 39962, null], [39962, 42002, null], [42002, 43653, null], [43653, 43679, null]], "google_gemma-3-12b-it_is_public_document": [[0, 459, true], [459, 3030, null], [3030, 6199, null], [6199, 9019, null], [9019, 10929, null], [10929, 13762, null], [13762, 16593, null], [16593, 19319, null], [19319, 20390, null], [20390, 22081, null], [22081, 24690, null], [24690, 26658, null], [26658, 28148, null], [28148, 30141, null], [30141, 32207, null], [32207, 34557, null], [34557, 37349, null], [37349, 39962, null], [39962, 42002, null], [42002, 43653, null], [43653, 43679, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 43679, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 43679, null]], "pdf_page_numbers": [[0, 459, 1], [459, 3030, 2], [3030, 6199, 3], [6199, 9019, 4], [9019, 10929, 5], [10929, 13762, 6], [13762, 16593, 7], [16593, 19319, 8], [19319, 20390, 9], [20390, 22081, 10], [22081, 24690, 11], [24690, 26658, 12], [26658, 28148, 13], [28148, 30141, 14], [30141, 32207, 15], [32207, 34557, 16], [34557, 37349, 17], [37349, 39962, 18], [39962, 42002, 19], [42002, 43653, 20], [43653, 43679, 21]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 43679, 0.0]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
d34949778e4395f01f6545c19762b82bb04cbf47
|
Note 5. Testing
Yan Shi
Lecture Notes for SE 3730 / CS 5730
Outline
- Formal and Informal Reviews
- Levels of Testing
- Unit,
- Structural Coverage Analysis
- Input Coverage Testing:
- Equivalence class testing
- Boundary value analysis testing
- CRUD testing
- All pairs
- integration,
- system,
- acceptance
- Regression Testing
Static and Dynamic Testing
- Static testing: the software is not actually executed.
- Generally not detailed testing
- Reviews, inspections, walkthrough
- Dynamic testing: test the dynamic behavior of the software
- Usually need to run the software.
Black, White and Grey Box Testing
- **Black box testing**: assume no knowledge about the code, structure or implementation.
- **White box testing**: fully based on knowledge of the code, structure or implementation.
- **Grey box testing**: test with only partial knowledge of implementation.
- E.g., algorithm review.
Reviews
- Static analysis and dynamic analysis
- Black-box testing and white-box testing
Reviews are **static white-box (?)** testing.
- Formal design reviews: DR / FDR
- Peer reviews: inspections and walkthrough
Formal Design Review
- The only reviews that are necessary for approval of the design product.
- The development team cannot continue to the next stage without this approval.
- Maybe conducted at any development milestone:
- Requirement, system design, unit/detailed design, test plan, code, support manual, product release, installation plan, etc.
FDR Procedure
- **Preparation:**
- find review members (5-10),
- review in advance: could use the help of checklist.
- A short presentation of the document.
- Comments by the review team.
- Verification and validation based on comments.
- **Decision:**
- Full approval: immediate continuation to the next phase.
- Partial approval: immediate continuation for some part, major action items for the remainder.
- Denial of approval: repeat FDR after action items.
- Generate FDR report.
- Follow up.
Inspections and Walkthrough
- **Inspection**: a step-by-step peer group review of a work product, with each step checked against predetermined criteria.
- **Roles:**
- Moderator: the entire inspection procedure
- Recorder: document defects found
- Reviewer: everyone in the inspection team
- Reader: read aloud small logical units
- Producer: author of the work product.
- **Walkthrough**: the author leads the team through a manual execution of the product using predefined scenarios.
Requirement Reviews
- **Participants**: customers, system analysts, designers, developers, QAs.
- **Review leader**: project manager
- **Objectives**:
- Check for accuracy and completeness of requirements and use cases.
- Help designers, developers and QA understand the specifications and remove ambiguity.
- Customers can start acceptance test plan once this review is complete.
System Design Reviews
- **Participants**: system analysts, designers, developers and QAs.
- **Review leader**: system architect?
- **Objectives**:
- Check the design against the requirements
- System test plan is generally reviewed in conjunction with the system design and its requirements.
Detailed Design Reviews
- **Participants**: designers and developers
- **Review leader**: subsystem team leader?
- **Objectives**:
- Make sure that detailed design of modules, classes and functions is consistent with system design.
- This usually includes a unit test plan and mapping of functions to requirements.
Test Plan Reviews
- **Participants:** QAs, development team
- **Review leader:** QA manager
- **Objectives:**
- Everyone has the same interpretation on how the product will be tested.
- Quality check on the test plan.
- Final check on the requirements.
Code Inspections
- Participants: programmers
- When: unit testing has had at least one pass.
- Line by line, function by function code review against coding standards for
- Efficiency
- Coverage of requirements
- Robustness against exceptions
- Etc.
- Moderator’s job:
- Organize and keep them on a positive note
- Do not degenerate it into arguments on what is the best way to do something.
Unit Testing
- Test program units in **isolation**.
- Errors found can be attributed to a specific unit ➔ easy to fix.
- Verify that each distinct execution of a unit produces expected result.
- Often is part of the detailed design documents.
- Static unit testing: code inspections/walkthroughs
- Dynamic unit testing
- Test driven development
Dynamic Unit Test Environment
Test Driver
Unit under test
Results
Call and pass
Input parameters
Output parameters
Call
Acknowledge
Call
Acknowledge
Stub
Stub
Test Drivers and Stubs
- The driver and the stubs are never discarded after the unit test because they may need to be reused for regression test.
- Update the driver and stubs if the unit is updated.
- Put them under CM.
- Each unit should have its own test driver and stubs, Otherwise:
- The driver may be too complicated
- Side effects
- Each driver should have its own segregated input data set.
- Test drivers should automatically determine fail/pass.
Select Test Data for Unit Testing
- Control flow testing
- Data flow testing
- Domain testing
- Functional Program Testing
Control Flow Testing
- Draw a control flow graph from the unit under test
- Select a few control flow testing criteria
- Identify paths in the graph to satisfy the selected criteria
- Derive path predicate expressions from the selected paths
- Generate test inputs by solving the predicate expressions
Control Flow Graph (CFG): Symbols
- Computation
- Decision
- True
- False
- Sequential computation
- Decision point
- Merge point
A basic block in a program $P$ is a sequence of consecutive statements with a single entry and a single exit point.
- it is impossible to exit or halt at any point inside a basic block except at its exit point.
- when the block contains only one statement, the entry and exit points coincide.
```cpp
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
z = z / x;
if ( z == 2 || y > 1 )
z = z + 1;
return z;
```
OR
```cpp
cin >> x >> y << z;
if ( x > 1 && y == 0 )
start
z = z / x;
true
if ( z == 2 || y > 1 )
true
false
return z;
end```
CFG: Example
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
z = z / x;
if ( z == 2 || y > 1 )
z = z + 1;
return z;
it considers the short-circuit evaluation!
But for most coverage criteria, we still use the previous one!
This one is only used for condition coverage.
begin
int x, y, power;
float z;
input (x, y);
if (y<0)
power=-y;
else
power=y;
z=1:
while (power! =0){
z=z*x;
power=power−1;
}
if (y<0)
z=1/z;
output(z);
end
CFG Exercise:
```c
1 begin
2 int x, y, power;
3 float z;
4 input (x, y);
5 if (y<0)
6 power=-y;
7 else
8 power=y;
9 z=1:
10 while (power!=0){
11 z=z*x;
12 power=power-1;
13 }
14 if (y<0)
15 z=1/z;
16 output(z);
17 end
```
Control Flow Coverage Criteria
- Function coverage: make sure all functions in a module are executed. (easy)
- Statement coverage
- Decision coverage
- Condition coverage
- Condition/Decision coverage (C/DC)
- Modified Condition/Multiple Decision coverage (MC/DC)
- All-path coverage
cin >> x >> y >> z;
if (x > 1 && y == 0)
z = z / x;
if (z == 2 || y > 1)
z = z + 1;
return z;
Input | Output | Path
--- | --- | ---
2 0 4 3 1,2,3,4,5
predicate: (x>1&&y==0)&&(z/x==2||y>1)
Statement coverage exercise
Path1: 1 2 4 5 6 5 7 8 9
Predicate1:
\[ y < 0 \land -y \neq 0 \land -y - 1 = 0 \]
solution: \( y = -1 \)
Path2: 1 3 4 5 7 9
Predicate2:
\[ y \geq 0 \land y = 0 \]
solution: \( y = 0 \)
<table>
<thead>
<tr>
<th>Input</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
<td>y</td>
</tr>
<tr>
<td>1</td>
<td>-1</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>-1</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
</tr>
</tbody>
</table>
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
z = z / x;
if ( z == 2 || y > 1 )
z = z + 1;
return z;
Each branching point has two decisions:
True or False!
A.K.A. Branch coverage
<table>
<thead>
<tr>
<th>Input</th>
<th>Output</th>
<th>Path</th>
</tr>
</thead>
<tbody>
<tr>
<td>x y z</td>
<td></td>
<td></td>
</tr>
<tr>
<td>2 0 4</td>
<td>3</td>
<td>1,2,3,4,5</td>
</tr>
<tr>
<td>2 -1 4</td>
<td>4</td>
<td>1,3,5</td>
</tr>
</tbody>
</table>
predicates:
1: (x>1&&y==0) && (z/x==2 || y>1)
2: !(x>1&&y==0) && !(z==2 || y>1)
**Decision coverage exercise**
Path1: 1 2 4 5 6 5 7 8 9
Predicate1:
\[ y < 0 \land -y \neq 0 \land -y - 1 = 0 \]
solution: \( y = -1 \)
Path2: 1 3 4 5 7 9
Predicate2:
\[ y \geq 0 \land y = 0 \]
solution: \( y = 0 \)
Input | Output
--- | ---
x | y | z
1 | -1 | 1
1 | 0 | 1
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
z = z / x;
if ( z == 2 || y > 1 )
z = z + 1;
return z;
Each condition need to be tested for both True and False!
A.K.A. Predicate coverage
cin >> x >> y >> z;
if (x > 1 && y == 0)
z = z / x;
if (z == 2 || y > 1)
z = z + 1;
return z;
Each condition need to be tested for both True and False!
A.K.A. Predicate coverage
<table>
<thead>
<tr>
<th>Input</th>
<th>Path</th>
</tr>
</thead>
<tbody>
<tr>
<td>x y z</td>
<td></td>
</tr>
<tr>
<td>2 0 4</td>
<td>1,2,3,4,5,7,8</td>
</tr>
<tr>
<td>2 -1 4</td>
<td>1,2,3,5,6,8</td>
</tr>
<tr>
<td>-1 2 4</td>
<td>1,2,5,6,7,8</td>
</tr>
</tbody>
</table>
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
z = z / x;
if ( z == 2 || y > 1 )
z = z + 1;
return z;
Each condition need to be tested for both True and False!
A.K.A. Predicate coverage
- **Condition coverage cannot guarantee decision coverage!**
- e.g., if ( A && B )
- All leaf-level Boolean expressions are considered as conditions.
### Condition/Decision Coverage
- Combines the requirements of both Condition and Decision coverage.
<table>
<thead>
<tr>
<th></th>
<th>A v B</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>A v B == True</td>
<td>// true decisions</td>
</tr>
<tr>
<td>2</td>
<td>A v B == False</td>
<td>// false decisions</td>
</tr>
<tr>
<td>3</td>
<td>A == True</td>
<td>// condition</td>
</tr>
<tr>
<td>4</td>
<td>A == False</td>
<td>// condition</td>
</tr>
<tr>
<td>5</td>
<td>B == True</td>
<td>// condition</td>
</tr>
<tr>
<td>6</td>
<td>B == False</td>
<td>// condition</td>
</tr>
</tbody>
</table>
Modified Condition/Multiple Decision coverage
- **MC/DC** enhances the Condition/Decision Coverage testing by requiring each Condition (A, B) to independently influence the Decision (True or False).
- There are eight conditions that must be met to ensure MC/DC.
<table>
<thead>
<tr>
<th>A v B</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>A v B == True // true decisions</td>
</tr>
<tr>
<td>2</td>
<td>A v B == False // false decisions</td>
</tr>
<tr>
<td>3</td>
<td>A == True // condition</td>
</tr>
<tr>
<td>4</td>
<td>A == False // condition</td>
</tr>
<tr>
<td>5</td>
<td>B == True // condition</td>
</tr>
<tr>
<td>6</td>
<td>B == False // condition</td>
</tr>
<tr>
<td>7</td>
<td>There is a B value such that A v False == A v B</td>
</tr>
<tr>
<td>8</td>
<td>There is an A value such that B v False == A v B</td>
</tr>
</tbody>
</table>
Modified Condition/Multiple Decision coverage
- **MC/DC** enhances the Condition/Decision Coverage testing by requiring each Condition (A, B) to independently influence the Decision (True or False).
- There are eight conditions that must be met to ensure MC/DC.
<table>
<thead>
<tr>
<th></th>
<th>A (\land) B</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>A (\land) B == True // true decisions</td>
</tr>
<tr>
<td>2</td>
<td>A (\land) B == False // false decisions</td>
</tr>
<tr>
<td>3</td>
<td>A == True // condition</td>
</tr>
<tr>
<td>4</td>
<td>A == False // condition</td>
</tr>
<tr>
<td>5</td>
<td>B == True // condition</td>
</tr>
<tr>
<td>6</td>
<td>B == False // condition</td>
</tr>
</tbody>
</table>
*Show that each condition independently affect the decision*
7. There is a B value such that \(A \land \text{True} == A \land B\)
8. There is an A value such that \(B \land \text{True} == A \land B\)
### MC/DC Example
- Just for the “**independent affect the decision**”:
\[ A \land B \land C \]
<table>
<thead>
<tr>
<th>Test Case</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>result</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</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>F</td>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>4</td>
<td>T</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>5</td>
<td>F</td>
<td>T</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>7</td>
<td>F</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>F</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
</tbody>
</table>
MC/DC Example
- Just for the “independent affect the decision”: $A \land B \land C$
<table>
<thead>
<tr>
<th>Test Case</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>result</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</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>F</td>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>4</td>
<td>T</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>5</td>
<td>F</td>
<td>T</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>7</td>
<td>F</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>F</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
</tbody>
</table>
MC/DC Example
- Just for the "independent affect the decision":
\[ A \land B \land C \]
<table>
<thead>
<tr>
<th>Test Case</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>result</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</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>F</td>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>4</td>
<td>T</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>5</td>
<td>F</td>
<td>T</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>7</td>
<td>F</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>F</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
</tbody>
</table>
### MC/DC Example
- Just for the “**independent affect the decision**”:
\[ A \land B \land C \]
<table>
<thead>
<tr>
<th>Test Case</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>result</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</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>F</td>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>4</td>
<td>T</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>5</td>
<td>F</td>
<td>T</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>7</td>
<td>F</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>F</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
</tbody>
</table>
## MC/DC Example
### A ^ B ^ C
<table>
<thead>
<tr>
<th>Test Case</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>result</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</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>F</td>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>5</td>
<td>F</td>
<td>T</td>
<td>T</td>
<td>F</td>
</tr>
</tbody>
</table>
MC/DC Exercise 1
- Generate a set of test cases of the following code to satisfy MC/DC coverage:
if (A || B && C) then do something
<table>
<thead>
<tr>
<th>Test Case</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>result</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</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>
</tr>
<tr>
<td>3</td>
<td>T</td>
<td>F</td>
<td>T</td>
<td>T</td>
</tr>
<tr>
<td>4</td>
<td>T</td>
<td>F</td>
<td>F</td>
<td>T</td>
</tr>
<tr>
<td>5</td>
<td>F</td>
<td>T</td>
<td>T</td>
<td>T</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>T</td>
<td>F</td>
<td>F</td>
</tr>
<tr>
<td>7</td>
<td>F</td>
<td>F</td>
<td>T</td>
<td>F</td>
</tr>
<tr>
<td>8</td>
<td>F</td>
<td>F</td>
<td>F</td>
<td>F</td>
</tr>
</tbody>
</table>
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
z = z / x;
if ( z == 2 || y > 1 )
z = z + 1;
return z;
<table>
<thead>
<tr>
<th>Input</th>
<th>MC/DC?</th>
</tr>
</thead>
<tbody>
<tr>
<td>x y z</td>
<td></td>
</tr>
<tr>
<td>2 0 4</td>
<td>False</td>
</tr>
<tr>
<td>1 0 4</td>
<td>True</td>
</tr>
<tr>
<td>2 2 4</td>
<td>False</td>
</tr>
</tbody>
</table>
All-Path Coverage
- Only possible for extremely small programs.
- In most cases, not feasible because of the large number of possible paths.
— consider a program with a while loop.
— how many possible path for the following code:
if(a &&b&&c) then ...
if(a||b||c) then ...
if(a&&d||e) then ...
Data Flow Testing
1. Draw a data flow graph from the unit under test
2. Select a few data flow testing criteria
3. Identify paths in the graph to satisfy the selected criteria
4. Derive path predicate expressions from the selected paths
5. Generate test inputs by solving the predicate expressions
Data Flow Coverage Motivations
```
int xValue, yValue, zValue;
int count = 0;
cin >> xValue >> yValue;
xValue = 10;
yValue *= xValue;
if ( yValue < zValue )
yValue = zValue;
```
- A variable is defined but never used! \texttt{count}
- A variable is used before defined! \texttt{zValue}
- A variable is defined twice before used! \texttt{xValue}
Data Flow Graph
- **Objective:** identify data definitions and their uses.
- **Definition** of a variable: when a value is moved into the memory location of that variable.
e.g. `cin >> x; i = x;
- **Use** of a variable: when the value is fetched from the memory location of the variable.
— **c-use** (computation use): `i++;`
— **p-use** (predicate use): `while (i < 100)`
- a **def-clear subpath** for a definition `d` of `v` and a use `u` of `v` is a subpath in the DFG between `d` and `u` on which `v` is not redefined
Exercise
- How many def, c-uses and p-uses?
```plaintext
input(x);
z=x+1;
func(x*x*x);
if(A[x+1]>0)
output(x);
for( i=0; i<z; i++)
A[i] = B[i]+1;
```
Data Flow Graph
- DFG is a directed graph constructed as follows:
- a sequence of definitions and c-uses is associated with each node
- a set of p-uses is associated with each edge
DFG: def-c-use table
<table>
<thead>
<tr>
<th>Node i</th>
<th>def(i)</th>
<th>c-use</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>{x, y, z}</td>
<td>{}</td>
</tr>
<tr>
<td>2</td>
<td>{z}</td>
<td>{x, z}</td>
</tr>
<tr>
<td>3</td>
<td>{}</td>
<td>{}</td>
</tr>
<tr>
<td>4</td>
<td>{z}</td>
<td>{z}</td>
</tr>
<tr>
<td>5</td>
<td>{}</td>
<td>{z}</td>
</tr>
</tbody>
</table>
```cpp
cin >> x >> y << z;
if (x > 1 && y == 0)
z = z / x;
if (z == 2 || y > 1)
z = z + 1;
return z;
end
```
DFG: predicate-p-use table
<table>
<thead>
<tr>
<th>edge (i,j)</th>
<th>predicate</th>
<th>p-use</th>
</tr>
</thead>
<tbody>
<tr>
<td>(1,2)</td>
<td>x>1&& y==0</td>
<td>{x,y}</td>
</tr>
<tr>
<td>(1,3)</td>
<td>!(x>1&&y==0)</td>
<td>{x,y}</td>
</tr>
<tr>
<td>(2,3)</td>
<td>true</td>
<td>{}</td>
</tr>
<tr>
<td>(3,4)</td>
<td>z==2</td>
<td></td>
</tr>
<tr>
<td>(3,5)</td>
<td>!(z==2</td>
<td></td>
</tr>
<tr>
<td>(4,5)</td>
<td>true</td>
<td>{}</td>
</tr>
</tbody>
</table>
```c++
cin >> x >> y << z;
if ( x > 1 && y == 0 )
start
z = z/x;
true
z = z + 1;
false
return z;
end
```
DFG: labels on nodes
1. {d1(x), d1(y), d1(z)}
cin >> x >> y << z;
if ( x > 1 && y == 0 )
start
true
false
2. {d2(z), c2(x), c2(z)}
z = z/x;
true
false
3. {p3(z), p3(y)}
if( z == 2 || y > 1 )
true
false
4. {d4(z), c4(z)}
z = z + 1;
true
5. {c5(z)}
return z;
end
Exercise
- Construct DFG based on the given CFG.
Rapps and Weyuker’s Data Flow Criteria
- All-defs
- All-p-uses
- All-c-uses
- All-p-uses/Some-c-uses
- All-c-uses/Some-p-uses
- All-uses
- All-du-pairs
All-defs coverage
- Some **definition-clear subpath** from **each definition** to some use reached by that definition.
```c
cin >> x >> y >> z;
if ( x > 1 && y == 0 )
start
z = z/x;
if ( z == 2 || y > 1 )
if ( false )
z = z + 1;
return z;
else
return z;
end
```
Exercise: All-def coverage
\{d_1(x), d_1(y), p_1(y)\}
\{d_2(\text{power}), c_2(y)\}
\{d_3(\text{power}), c_3(y)\}
\{d_4(z)\}
\{p_5(\text{power})\}
\{d_6(z), d_6(\text{power}), c_6(x), c_6(z), c_6(\text{power})\}
\{p_7(y)\}
\{d_8(z), c_8(z)\}
\{c_9(z)\}
Some **definition-clear subpath** for each variable from each definition to each c-use reached by that definition.
- `d1(x)-c2(x)`
- `d1(z)-c2(z)`
- `d1(z)-c4(z)`
- `d1(z)-c5(z)`
- `d2(z)-c4(z)`
- `d2(z)-c5(z)`
- `d4(z)-c5(z)`
Variables and their definitions:
<table>
<thead>
<tr>
<th>Variable</th>
<th>Definition</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>d1(x)</code></td>
<td><code>{d1(x), d1(y), d1(z)}</code></td>
</tr>
<tr>
<td><code>d1(y)</code></td>
<td><code>{p1(x), p1(y)}</code></td>
</tr>
<tr>
<td><code>d1(z)</code></td>
<td><code>{d2(z), c2(x), c2(z)}</code></td>
</tr>
<tr>
<td><code>d2(z)</code></td>
<td><code>{p3(z), p3(y)}</code></td>
</tr>
<tr>
<td><code>d4(z)</code></td>
<td><code>{d4(z), c4(z)}</code></td>
</tr>
<tr>
<td><code>c5(z)</code></td>
<td><code>{c5(z)}</code></td>
</tr>
</tbody>
</table>
Code snippet:
```
cin >> x >> y << z;
if ( x > 1 && y == 0 )
start
true
z = z/x;
true
if( z == 2 || y > 1 )
false
z = z + 1;
true
return z;
false
end
```
Exercise: All-c-use coverage
\{d_1(x), d_1(y), \ p_1(y)\}
\{d_2(\text{power}), \ c_2(y)\}
\{d_3(\text{power}), \ c_3(y)\}
\{d_4(z)\}
\{d_5(\text{power})\}
\{d_6(z), \ d_6(\text{power}), \ c_6(x), \ c_6(z), \ c_6(\text{power})\}
\{p_7(y)\}
\{d_8(z), \ c_8(z)\}
\{c_9(z)\}
Some **definition-clear subpath** for each **variable** from each **definition** to each **p-use** reached by that definition and each successor node of the use.
- `d1(x)` to `p1(x)`: (1,2) (1,3)
- `d1(y)` to `p1(y)`: (1,2) (1,3)
- `d1(y)` to `p3(y)`: (1,3,4) (1,3,5)
- `d1(z)` to `p3(z)`: (1,3,4) (1,3,5)
- `d2(z)` to `p3(z)`: (2,3,4) (2,3,5)
The code snippet is:
```cpp
cin >> x >> y << z;
if ( x > 1 && y == 0 )
start
true
false
z = z/x;
if( z == 2 || y > 1 )
2
false
true
false
if( z == 2 || y > 1 )
3
true
false
true
false
z = z + 1;
return z;
end
```
Exercise: All-p-use coverage
{d1(x), d1(y), p1(y)}
{d2(power), c2(y)}
{d3(power), c3(y)}
{d4(z)}
{p5(power)}
{d6(z), d6(power),
c6(x), c6(z), c6(power)}
{p7(y)}
{d8(z), c8(z)}
{c9(z)}
Other coverage criteria
- **All-p-uses/Some-c-uses** is identical to all-p-use except when a variable doesn’t have any p-use:
- in that case, use the c-use of that variable instead.
- **All-c-uses/Some-p-uses** is the same: when a variable doesn’t have any c-use, use its p-use instead.
- **All-uses**: combination of all-c-uses and all-p-uses.
- **All-du-paths**: for each definition of each variable, all def-clear paths that are cycle-free or simple-cycles to each use of the variable.
Relationship Among Coverage Criteria
Domain Testing
- Two classes of errors [Howden]:
- **computation error**: a specific input data causes the program to execute the desired path but wrong output.
e.g. result = f(b,a); where actually it should be f(a,b).
- **domain error**: a specific input data causes the program to execute the wrong path.
e.g. faults in the conditions. if(x>0) instead of if(x<0)
- **Domain Testing** aims at selecting test data to detect domain errors.
- Equivalence class partitioning
- Boundary value analysis
Functional Testing
- Black box testing
- Derive test cases from the software specifications.
- Each program is treated as a function
- three core elements: input, output, and transformation.
- Key questions:
- How to identify the input domain and output domain?
- How to select test data from the huge pool of input domain?
- Random testing
- Boundary value analysis
- Equivalence class partitioning
- All-pairs
**Oracles – Truth Teller**
- **What is the expected output?**
An oracle is a mechanism for determining whether a test has passed or failed.
- specifications
- previous version of a system
- other similar products
- domain experts
- etc...
Random Testing
- Profile the inputs that users actually make.
- Randomly generate test inputs based on this profile.
- Pros:
- inputs are not biased by testers/developers.
- no need to design test cases.
- quick and easy.
- Cons:
- oracles are difficult to identify.
- not efficient in detecting defects.
Equivalence Class Partitioning (EC)
- **Equivalence class:**
- Two input values are in the same equivalence class if they are treated in the same way according to the specification, i.e. they cause the same path to be executed.
- **Idea:**
- Partition the entire input domain into a finite number of subdomains (equivalence classes).
- At least one test input from one EC.
- **Key question: how to define EC?**
- requirement specifications
Equivalence Class Testing
- EC testing objectives:
- To tell how many tests are necessary to test a given piece of software to a known level
- To spot and eliminate redundant tests
- Ensure **completeness** and **non-redundancy**
**Completeness:**
\[ A = A_1 \cup A_2 \cup \ldots \cup A_7 \]
**Non-redundancy:**
\[ i \neq j \Rightarrow A_i \cap A_j = \emptyset \]
Define Equivalence Classes
- Myers guidelines for an individual input:
1. An input condition specifies range \([a, b]\):
- one EC for \(X < a\), one EC for \(a \leq X \leq b\), one EC for \(X > b\).
2. An input condition specifies a set of values:
- one EC for each value and one EC for an invalid value.
3. An input condition specifies a “must-be” value:
- one EC for the “must-be” value and one EC for other values.
How about multiple inputs?
A car insurance company provides insurance cover for motor vehicles.
When a customer applies for a quote on insurance, the agent requests the following information:
1. Vehicle type
2. Age of the driver
The system outputs a quote for insurance.
As a potential customer, aren’t you curious about how the quote is calculated?
Q: "Do you treat all types of vehicles alike?"
A: "No. We insure sport cars, trucks, sedans/vans, and motorcycles. We have a different way of getting a quote for each type."
Q: "Do you treat all ages the same way?"
A: "Well, not exactly. There are three classes of age: the under 21 kids, the great middle aged group from 21 to 65, and the Golden Oldies who are over 65. We do it differently for each group."
# Care Insurance Example
<table>
<thead>
<tr>
<th>Vehicle Type</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sport Cars</td>
<td>< 21</td>
</tr>
<tr>
<td>Trucks</td>
<td>21 - 65</td>
</tr>
<tr>
<td>Sedans/Vans</td>
<td>> 65</td>
</tr>
<tr>
<td>Motorcycles</td>
<td></td>
</tr>
</tbody>
</table>
These are only normal ECs.
How many test cases should we generate?
EC Testing for Multiple Inputs
- Weak Normal EC
- Strong Normal EC
- Weak Robust EC
- Strong Robust EC
Weak Normal EC Testing
- **Single Fault Assumption:**
- Failures are *rarely* the result of the simultaneous occurrence of two (or more) faults
- Define normal ECs for each input variable
- Cover ECs for each variable
How many test-cases are needed?
What is the minimal number of tokens that are needed to be put in an $m \times n$ grid such that each row and column contains at least one token?
$\max(m,n)$
How many test cases should we generate?
4 = max (4, 3) for weak normal EC testing.
Strong Normal EC Testing
- Cover the all combinations of equivalence classes for the domain of all variables
- Multiple fault assumption
How many test-cases are needed?
\[ m \times n \]
Vehicle Type | Age
---|---
Sport Cars | < 21
Trucks | 21 - 65
Sedans/Vans | > 65
Motorcycles | > 65
How many test cases should we generate?
**12 for strong normal EC testing.**
Weak Robust EC Testing
- Include weak normal;
- Add one test case from each abnormal EC for each variable
Care Insurance Example
Vehicle Type Age
Sport Cars < 21
Trucks 21 - 65
Sedans/Vans > 65
Motorcycles > 65
How many test cases should we generate?
7 = max (4, 3) + 3 for weak robust EC testing.
Strong Robust EC Testing
- Similar as strong normal;
- Include all abnormal ECs
Care Insurance Example
Vehicle Type Age
Sport Cars < 21
Trucks 21 - 65
Sedans/Vans > 65
Motorcycles
How many test cases should we generate?
25 for robust normal EC testing.
Exercise: NextDate()
- Given a date: Month/Day/Year, decide the next date.
- Variables:
- Month(M): 1-12
- Year(Y): 1-3000
- Day(D): 1-31
- How many ECs for each variable?
- Generate test case using strong normal EC.
Boundary Value Analysis (BVA)
- **Idea:**
- select test data near the boundary of a data domain so that data both within and outside an EC are selected.
- single fault assumption.
- **Goal:**
- detect failures caused by incorrect implementation of boundaries.
Robust Worst Case BVA
Guidelines For Robust/Standard BVA
- For each input variable, select 7/5 values:
1. Just below the minimum
2. Minimum
3. Just above the minimum
4. Normal
5. Just below the maximum
6. Maximum
7. Just above the maximum
Other input variables should use normal values.
Can we apply BVA to the car insurance example?
BVA Limitations
- Does not work well for Boolean variables
- Does not work well for logical variables
- PIN, transaction type, vehicle type
Worst Case BVA Testing
- Disregard the single fault assumption.
- Consider all possible combinations.
- Cartesian product of the 5-tuple set (min, min+, nom, max-, max)
\[ X \times Y = \{ (x, y) \mid x \in X \land y \in Y \} \]
- If N independant input variables, then \(5^N\) tests
- Robust Worst Case BVA Testing:
- Cartesian product of the 7-tuple set.
Triangle Example
inputs: integer a, b, c in the range [1,200]; output: triangle type
Standard BVA:
\[
\begin{align*}
\text{min} & = 1 \\
\text{min}+ & = 2 \\
\text{nom} & = 100 \\
\text{max}^- & = 199 \\
\text{max} & = 200 \\
\end{align*}
\]
How many test cases for the worst-case BVA?
For the robust worst-case BVA?
<table>
<thead>
<tr>
<th>Case</th>
<th>a</th>
<th>b</th>
<th>c</th>
<th>Expected Output</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>100</td>
<td>100</td>
<td>1</td>
<td>Isosceles</td>
</tr>
<tr>
<td>2</td>
<td>100</td>
<td>100</td>
<td>2</td>
<td>Isosceles</td>
</tr>
<tr>
<td>3</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>Equilateral</td>
</tr>
<tr>
<td>4</td>
<td>100</td>
<td>100</td>
<td>199</td>
<td>Isosceles</td>
</tr>
<tr>
<td>5</td>
<td>100</td>
<td>100</td>
<td>200</td>
<td>Not a Triangle</td>
</tr>
<tr>
<td>6</td>
<td>100</td>
<td>1</td>
<td>100</td>
<td>Isosceles</td>
</tr>
<tr>
<td>7</td>
<td>100</td>
<td>2</td>
<td>100</td>
<td>Isosceles</td>
</tr>
<tr>
<td>8</td>
<td>100</td>
<td>199</td>
<td>100</td>
<td>Isosceles</td>
</tr>
<tr>
<td>9</td>
<td>100</td>
<td>200</td>
<td>100</td>
<td>Not a Triangle</td>
</tr>
<tr>
<td>10</td>
<td>1</td>
<td>100</td>
<td>100</td>
<td>Isosceles</td>
</tr>
<tr>
<td>11</td>
<td>2</td>
<td>100</td>
<td>100</td>
<td>Isosceles</td>
</tr>
<tr>
<td>12</td>
<td>199</td>
<td>100</td>
<td>100</td>
<td>Isosceles</td>
</tr>
<tr>
<td>13</td>
<td>200</td>
<td>100</td>
<td>100</td>
<td>Not a Triangle</td>
</tr>
</tbody>
</table>
When an EC is based on ranges of a variable, we can combine BVA with EC testing.
How?
Exercise
- Consider a program that accepts the name of a grocery item and a list of the different sizes the item comes in, specified in ounces.
- The specifications state that the item name is to be alphabetic characters 2 to 15 characters in length.
- Each size may be a value in the range of 1 to 99, integer numbers only. The sizes are to be entered in ascending order (smaller sizes first). A maximum of five sizes may be entered for each item.
- The item name is to be entered first, followed by a comma, then followed by a list of sizes. A comma will be used to separate each size. Spaces (blanks) are to be ignored anywhere in the input.
List all ECs you can detect.
Apply equivalence class partitioning and boundary value analysis.
The Bitter Fact:
- There’s too much to do in too little time.
Question:
- How can we “test everything” without really testing everything?
All-Pair Testing / Pairwise Testing / Combinatorial Method
- maximizing coverage of input combinations while minimizing the number of tests performed.
All Combinations – Strong EC
- Assume 2 input variables A and B; each has 5 equivalence classes of inputs:
- \{a1,a2,a3,a4,a5\}, \{b1,b2,b3,b4,b5\},...
- How many test cases to cover all combinations?
- 25 (Cartesian Product!)
<table>
<thead>
<tr>
<th>Variable A</th>
<th>a1</th>
<th>a2</th>
<th>a3</th>
<th>a4</th>
<th>a5</th>
</tr>
</thead>
<tbody>
<tr>
<td>Variable B</td>
<td>a1 x b1</td>
<td>a2 x b1</td>
<td>a3 x b1</td>
<td>a4 x b1</td>
<td>a5 x b1</td>
</tr>
<tr>
<td>b1</td>
<td>a1 x b1</td>
<td>a2 x b1</td>
<td>a3 x b1</td>
<td>a4 x b1</td>
<td>a5 x b1</td>
</tr>
<tr>
<td>b2</td>
<td>a1 x b2</td>
<td>a2 x b2</td>
<td>a3 x b2</td>
<td>a4 x b2</td>
<td>a5 x b2</td>
</tr>
<tr>
<td>b3</td>
<td>a1 x b3</td>
<td>a2 x b3</td>
<td>a3 x b3</td>
<td>a4 x b3</td>
<td>a5 x b3</td>
</tr>
<tr>
<td>b4</td>
<td>a1 x b4</td>
<td>a2 x b4</td>
<td>a3 x b4</td>
<td>a4 x b4</td>
<td>a5 x b4</td>
</tr>
<tr>
<td>b5</td>
<td>a1 x b5</td>
<td>a2 x b5</td>
<td>a3 x b5</td>
<td>a4 x b5</td>
<td>a5 x b5</td>
</tr>
</tbody>
</table>
- How about 3 input variables? 125 = 5^3
- How about 5 input variables? 3125 = 5^5
All-Pair Strategy
- If there are 5 inputs and \textbf{a1} and \textbf{b2} will result in a failure, how many test cases will fail with all-combination testing? \(125 = 5^3\)
- Fact: Very few failures are caused by a combination of more than 2 input variables!
- 3 / 109 in a medical software device failure study (Wallace 2000)
- Idea: Tests all possible discrete combinations for \textit{each pair} of input variables.
- How many test cases if there are 5 input variables? \(250 = \binom{5}{2} \times 25\)
\[
\binom{n}{k} = \frac{n(n-1) \ldots (n-k+1)}{k(k-1) \ldots 1},
\]
Savings with All-Pair Strategy
- The larger the number of input variables, the larger the savings in using All Pairs Testing.
<table>
<thead>
<tr>
<th>Number of Input Variables</th>
<th>Equivalence Classes per input</th>
<th>Total Combinations</th>
<th>All Pairs Combinations</th>
<th>% of tests savings</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>5</td>
<td>25</td>
<td>25</td>
<td>0%</td>
</tr>
<tr>
<td>3</td>
<td>5</td>
<td>125</td>
<td>3 * 25 = 75</td>
<td>40%</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
<td>3125</td>
<td>10 * 25 = 250</td>
<td>92%</td>
</tr>
<tr>
<td>10</td>
<td>5</td>
<td>9,765,625</td>
<td>45 * 25 = 1,125</td>
<td>1-0.01152%</td>
</tr>
<tr>
<td>20</td>
<td>5</td>
<td>95,367,431,640,625</td>
<td>190 * 25 = 4,750</td>
<td>1-0.0000000004980736%</td>
</tr>
</tbody>
</table>
Probability of Catching a Failure
- Assume we have 10 input variables A, B, C, D, E, F, G, H, I and J each with 5 ECs.
- Assume there is one defect in the system and it occurs when we have both i5 and j5.
What is the probability of detecting this defect if we only have time to run one random combination of inputs?
- Each combination of A, B, C, D, E, F, G, and H with the combination of i5 and j5 will fail: \( 390625 = 5^8 \)
- The probability of catching a failure is \( \frac{5^8}{5^{10}} = 4\% \)
What would be the probability of detecting a defect if we only have time to run one random all-pair combination?
\[ \frac{1}{1125} = 0.089\% \]
CRUD Testing
- Create, Read, Update and Delete
- Often used to test database system and UI
- Use CRUD matrix to trace testing of object usage
Order Processing System CRUD Diagram 1
<table>
<thead>
<tr>
<th>Action</th>
<th>Customer</th>
<th>Customer Order</th>
<th>Customer Account</th>
<th>Customer Invoice</th>
<th>Vendor Invoice</th>
<th>Product</th>
</tr>
</thead>
<tbody>
<tr>
<td>Receive Customer Order</td>
<td>R</td>
<td>C</td>
<td>CR</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Process Customer Order</td>
<td>CRU</td>
<td></td>
<td></td>
<td>RU</td>
<td></td>
<td>R</td>
</tr>
<tr>
<td>Maintain Customer Order</td>
<td>U</td>
<td></td>
<td>U</td>
<td></td>
<td>RU</td>
<td></td>
</tr>
<tr>
<td>Terminate Customer Order</td>
<td>U</td>
<td></td>
<td>U</td>
<td></td>
<td>RU</td>
<td></td>
</tr>
<tr>
<td>Fill Customer Order</td>
<td>RU</td>
<td>RU</td>
<td></td>
<td>RU</td>
<td></td>
<td>RU</td>
</tr>
<tr>
<td>Ship Customer Order</td>
<td>U</td>
<td></td>
<td>C</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Validate Vendor Invoice</td>
<td></td>
<td></td>
<td></td>
<td>R</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Pay Vendor Invoice</td>
<td>RU</td>
<td></td>
<td></td>
<td>RU</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Invoice Customer</td>
<td>RU</td>
<td>RU</td>
<td></td>
<td>C</td>
<td></td>
<td>CRUD</td>
</tr>
<tr>
<td>Maintain Inventory</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
CRUD Testing
- **Create**
- Creating a brand **new** item one at a time
- Creating a **duplicate** item
- Creating **more than one** items in a single shot (if applicable)
- **Read**
- Reading an **existing** item one at a time
- Reading **more than one** existing items at a time
- Reading a **non-existing** item
- Reading in a **sorted** order (such as sort a grid in ascending or descending order)
- Read an item based on **wild cards** (such as search or filter items)
- **Update**
- Update an **existing** item one at a time
- Update **more than one** existing items
- Update a **non-existing** item
- **Delete**
- Delete an **existing** item one at a time
- Delete **more than one** existing items
- Delete a **non-existing** item
Broken Box Testing
- A form of “gray-box” testing: with knowledge of algorithms, but not necessarily the exact implementation.
- Select input values to test different conditions of the algorithms.
- Why?
- Some algorithms have known weaknesses: accuracy, performance, exceptions, etc.
Integration Testing
- tests integration or interfaces between components, interactions to different parts of the system such as an operating system, file system and hardware or interfaces between systems.
- Big bang
- Top-down
- Bottom-up
- Functional Incremental
Big Bang Integration Testing
- Test when all components or modules are integrated simultaneously
http://istqbexamcertification.com/what-is-integration-testing/
Top-Down Integration Testing
- Testing takes place from top to bottom, following the control flow or architectural structure (e.g. starting from the GUI or main menu).
- Components or systems are substituted by stubs.
http://istqbexamcertification.com/what-is-integration-testing/
Botton-Up Integration Testing
- Testing takes place from the bottom of the control flow upwards.
- Components or systems are substituted by drivers.
http://istqbexamcertification.com/what-is-integration-testing/
Incremental Integration Testing
- All components are integrated one by one, as developed.
- A test is carried out after each integration.
System Testing
- functionality testing
- security testing
- robustness testing
- compatibility testing
- load testing
- stability testing
- performance testing
- reliability testing
- ...
Security Testing
- **Objective:** to verify whether the system meets the security requirements
<table>
<thead>
<tr>
<th>Security Requirement</th>
<th>Data and processes are protected from</th>
</tr>
</thead>
<tbody>
<tr>
<td>confidentiality</td>
<td>unauthorized disclosure</td>
</tr>
<tr>
<td>integrity</td>
<td>unauthorized modification</td>
</tr>
<tr>
<td>availability</td>
<td>the denial of service to authorized users</td>
</tr>
</tbody>
</table>
- **Real story:**
- *Excuse me while I turn off your pacemaker*
Robustness Testing
- Robustness: how sensitive a system is to erroneous input and changes in its operational environment.
- Approach: deliberately break the system/environment and see how it works.
- Boundary value analysis
- Power cycling test: create a power glitch
- Online insertion and removal (OIR) test: of modules in both idle and heavy load operations
- Fault tolerance test: can switch to standby modules
A program must run on a wide range of computers.
Even on the same brand of computer there may be different configurations of memory, printers, bios, dlls, or other peripherals.
A program should work well on common configurations of computers.
Compatibility Testing
- **Compatibility** – checks the way one product works with another.
- They may both use the *same file* or *communicate* with each other.
- **Forward compatibility** – old products can handle newer files/program versions; this is generally NOT expected.
- **Backward compatibility** – newer products can work with older files/program versions; this is very desirable.
- **Multiplatform** – programs that run on multiple OS, DBs, hardware, etc. should be compatible to the degree advertised. *(Port Testing)*
- **Conversion Tests**
- if a program is not directly compatible, is there an intermediate program available to convert data into a form that can work?
- This happens when database scheme or file formats change between versions.
Performance Testing
- To verify whether the performance of the actual system meets the performance requirement.
- Performance metrics depend on specific application types.
- response time
- memory
Load Testing
- **Volume Tests**: study the largest and smallest tasks the program can handle. For example,
- feed a compiler a huge program
- feed empty input files to a system
- **Soak Tests**: run a system at normal load for a long time;
- monitor system resources, e.g., memory, disk, queue length, overheating, bandwidth...
- **Stress Tests**: burst rate activity
- start with small load and ramp it up till the program fails.
Background Testing
- Programs that run on multitasking environments need to be tested while other typical programs are active.
- Need to make sure the program is not starved for memory, CPU, disk or communications.
Reliability Testing
- To measure the ability of the system to remain operational for long periods of time.
- **MTTF (mean time to failure)**
- difference of time in two consecutive failures
- recorded during system testing process.
- often use random testing for measurement.
- **MTTR (mean time to repair/recovery)**: the average time required to fix a failure
Installation Testing
- Installation is the users’ first exposure to a software product.
- Does the install program configure the program for software end hardware environment?
- Can experienced user customize the installation?
- Grandma Test: how long does it take for an inexperienced user to install the system?
Alpha and Beta Testing
- Both are considered as acceptance testing.
- **Alpha test:**
- At least one system-level test is done.
- There may be known critical defects in the system, but all major features are working.
- The code is sent to a very limit number of “friendly” users to test under real-world conditions.
- **Beta test:**
- All features are working.
- Very few (if known) defects still exist.
- Real world users test the system in real world conditions.
- **Apple:** very little and private beta testing.
- iphone antenna problem
- **Microsoft:** very huge and public beta testing
- windows developer preview
Summary
Testing
Static
- formal reviews
- peer reviews
Dynamic
- white box
- control flow coverage
- data flow coverage
- black box
- function testing
- domain testing
unit test
integration test
system test
acceptance test
regression test
EC
BVA
All-pair
CRUD
int someFunction(int a, int b) {
int result = 0;
if (a < b)
system.exit(0);
else {
int c = a + b;
int I = 0;
while (i < c) {
result = (result + a) / b;
i++;
}
}
return result;
}
|
{"Source-Url": "http://people.uwplatt.edu/~shiy/courses/se373/notes/Note5-Testing.pdf", "len_cl100k_base": 14216, "olmocr-version": "0.1.50", "pdf-total-pages": 117, "total-fallback-pages": 0, "total-input-tokens": 164710, "total-output-tokens": 16794, "length": "2e13", "weborganizer": {"__label__adult": 0.00043129920959472656, "__label__art_design": 0.0004534721374511719, "__label__crime_law": 0.0002143383026123047, "__label__education_jobs": 0.0032405853271484375, "__label__entertainment": 8.040666580200195e-05, "__label__fashion_beauty": 0.0001646280288696289, "__label__finance_business": 0.00025653839111328125, "__label__food_dining": 0.0003368854522705078, "__label__games": 0.0011625289916992188, "__label__hardware": 0.0011377334594726562, "__label__health": 0.00031876564025878906, "__label__history": 0.00027751922607421875, "__label__home_hobbies": 0.0001480579376220703, "__label__industrial": 0.00035309791564941406, "__label__literature": 0.00035691261291503906, "__label__politics": 0.00019693374633789065, "__label__religion": 0.0004525184631347656, "__label__science_tech": 0.007904052734375, "__label__social_life": 0.00013375282287597656, "__label__software": 0.004955291748046875, "__label__software_dev": 0.97607421875, "__label__sports_fitness": 0.0003924369812011719, "__label__transportation": 0.0005021095275878906, "__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, 41495, 0.03048]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 41495, 0.1538]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 41495, 0.75183]], "google_gemma-3-12b-it_contains_pii": [[0, 62, false], [62, 382, null], [382, 640, null], [640, 963, null], [963, 1182, null], [1182, 1534, null], [1534, 2042, null], [2042, 2541, null], [2541, 2927, null], [2927, 3224, null], [3224, 3542, null], [3542, 3802, null], [3802, 4207, null], [4207, 4207, null], [4207, 4558, null], [4558, 4728, null], [4728, 5195, null], [5195, 5319, null], [5319, 5622, null], [5622, 5753, null], [5753, 6047, null], [6047, 6318, null], [6318, 6578, null], [6578, 6776, null], [6776, 7104, null], [7104, 7389, null], [7389, 7587, null], [7587, 7936, null], [7936, 8342, null], [8342, 8621, null], [8621, 8812, null], [8812, 9127, null], [9127, 9472, null], [9472, 10030, null], [10030, 11092, null], [11092, 11827, null], [11827, 12278, null], [12278, 12714, null], [12714, 13155, null], [13155, 13604, null], [13604, 13859, null], [13859, 14346, null], [14346, 14572, null], [14572, 14890, null], [14890, 15189, null], [15189, 15540, null], [15540, 16081, null], [16081, 16241, null], [16241, 16427, null], [16427, 16772, null], [16772, 17250, null], [17250, 17562, null], [17562, 17612, null], [17612, 17765, null], [17765, 18073, null], [18073, 18335, null], [18335, 18998, null], [18998, 19278, null], [19278, 19852, null], [19852, 20045, null], [20045, 20540, null], [20540, 20577, null], [20577, 21103, null], [21103, 21524, null], [21524, 21782, null], [21782, 22100, null], [22100, 22551, null], [22551, 22923, null], [22923, 23391, null], [23391, 23718, null], [23718, 24128, null], [24128, 24382, null], [24382, 24486, null], [24486, 24742, null], [24742, 24901, null], [24901, 24985, null], [24985, 25174, null], [25174, 25353, null], [25353, 25460, null], [25460, 25694, null], [25694, 25775, null], [25775, 25967, null], [25967, 26192, null], [26192, 26483, null], [26483, 26812, null], [26812, 26955, null], [26955, 27316, null], [27316, 28359, null], [28359, 28446, null], [28446, 29188, null], [29188, 29485, null], [29485, 30362, null], [30362, 30944, null], [30944, 31978, null], [31978, 32633, null], [32633, 34362, null], [34362, 35132, null], [35132, 35422, null], [35422, 35695, null], [35695, 35857, null], [35857, 36140, null], [36140, 36354, null], [36354, 36493, null], [36493, 36683, null], [36683, 37326, null], [37326, 37751, null], [37751, 37996, null], [37996, 38769, null], [38769, 38972, null], [38972, 39414, null], [39414, 39631, null], [39631, 40002, null], [40002, 40323, null], [40323, 40961, null], [40961, 41234, null], [41234, 41234, null], [41234, 41495, null]], "google_gemma-3-12b-it_is_public_document": [[0, 62, true], [62, 382, null], [382, 640, null], [640, 963, null], [963, 1182, null], [1182, 1534, null], [1534, 2042, null], [2042, 2541, null], [2541, 2927, null], [2927, 3224, null], [3224, 3542, null], [3542, 3802, null], [3802, 4207, null], [4207, 4207, null], [4207, 4558, null], [4558, 4728, null], [4728, 5195, null], [5195, 5319, null], [5319, 5622, null], [5622, 5753, null], [5753, 6047, null], [6047, 6318, null], [6318, 6578, null], [6578, 6776, null], [6776, 7104, null], [7104, 7389, null], [7389, 7587, null], [7587, 7936, null], [7936, 8342, null], [8342, 8621, null], [8621, 8812, null], [8812, 9127, null], [9127, 9472, null], [9472, 10030, null], [10030, 11092, null], [11092, 11827, null], [11827, 12278, null], [12278, 12714, null], [12714, 13155, null], [13155, 13604, null], [13604, 13859, null], [13859, 14346, null], [14346, 14572, null], [14572, 14890, null], [14890, 15189, null], [15189, 15540, null], [15540, 16081, null], [16081, 16241, null], [16241, 16427, null], [16427, 16772, null], [16772, 17250, null], [17250, 17562, null], [17562, 17612, null], [17612, 17765, null], [17765, 18073, null], [18073, 18335, null], [18335, 18998, null], [18998, 19278, null], [19278, 19852, null], [19852, 20045, null], [20045, 20540, null], [20540, 20577, null], [20577, 21103, null], [21103, 21524, null], [21524, 21782, null], [21782, 22100, null], [22100, 22551, null], [22551, 22923, null], [22923, 23391, null], [23391, 23718, null], [23718, 24128, null], [24128, 24382, null], [24382, 24486, null], [24486, 24742, null], [24742, 24901, null], [24901, 24985, null], [24985, 25174, null], [25174, 25353, null], [25353, 25460, null], [25460, 25694, null], [25694, 25775, null], [25775, 25967, null], [25967, 26192, null], [26192, 26483, null], [26483, 26812, null], [26812, 26955, null], [26955, 27316, null], [27316, 28359, null], [28359, 28446, null], [28446, 29188, null], [29188, 29485, null], [29485, 30362, null], [30362, 30944, null], [30944, 31978, null], [31978, 32633, null], [32633, 34362, null], [34362, 35132, null], [35132, 35422, null], [35422, 35695, null], [35695, 35857, null], [35857, 36140, null], [36140, 36354, null], [36354, 36493, null], [36493, 36683, null], [36683, 37326, null], [37326, 37751, null], [37751, 37996, null], [37996, 38769, null], [38769, 38972, null], [38972, 39414, null], [39414, 39631, null], [39631, 40002, null], [40002, 40323, null], [40323, 40961, null], [40961, 41234, null], [41234, 41234, null], [41234, 41495, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 41495, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 41495, null]], "pdf_page_numbers": [[0, 62, 1], [62, 382, 2], [382, 640, 3], [640, 963, 4], [963, 1182, 5], [1182, 1534, 6], [1534, 2042, 7], [2042, 2541, 8], [2541, 2927, 9], [2927, 3224, 10], [3224, 3542, 11], [3542, 3802, 12], [3802, 4207, 13], [4207, 4207, 14], [4207, 4558, 15], [4558, 4728, 16], [4728, 5195, 17], [5195, 5319, 18], [5319, 5622, 19], [5622, 5753, 20], [5753, 6047, 21], [6047, 6318, 22], [6318, 6578, 23], [6578, 6776, 24], [6776, 7104, 25], [7104, 7389, 26], [7389, 7587, 27], [7587, 7936, 28], [7936, 8342, 29], [8342, 8621, 30], [8621, 8812, 31], [8812, 9127, 32], [9127, 9472, 33], [9472, 10030, 34], [10030, 11092, 35], [11092, 11827, 36], [11827, 12278, 37], [12278, 12714, 38], [12714, 13155, 39], [13155, 13604, 40], [13604, 13859, 41], [13859, 14346, 42], [14346, 14572, 43], [14572, 14890, 44], [14890, 15189, 45], [15189, 15540, 46], [15540, 16081, 47], [16081, 16241, 48], [16241, 16427, 49], [16427, 16772, 50], [16772, 17250, 51], [17250, 17562, 52], [17562, 17612, 53], [17612, 17765, 54], [17765, 18073, 55], [18073, 18335, 56], [18335, 18998, 57], [18998, 19278, 58], [19278, 19852, 59], [19852, 20045, 60], [20045, 20540, 61], [20540, 20577, 62], [20577, 21103, 63], [21103, 21524, 64], [21524, 21782, 65], [21782, 22100, 66], [22100, 22551, 67], [22551, 22923, 68], [22923, 23391, 69], [23391, 23718, 70], [23718, 24128, 71], [24128, 24382, 72], [24382, 24486, 73], [24486, 24742, 74], [24742, 24901, 75], [24901, 24985, 76], [24985, 25174, 77], [25174, 25353, 78], [25353, 25460, 79], [25460, 25694, 80], [25694, 25775, 81], [25775, 25967, 82], [25967, 26192, 83], [26192, 26483, 84], [26483, 26812, 85], [26812, 26955, 86], [26955, 27316, 87], [27316, 28359, 88], [28359, 28446, 89], [28446, 29188, 90], [29188, 29485, 91], [29485, 30362, 92], [30362, 30944, 93], [30944, 31978, 94], [31978, 32633, 95], [32633, 34362, 96], [34362, 35132, 97], [35132, 35422, 98], [35422, 35695, 99], [35695, 35857, 100], [35857, 36140, 101], [36140, 36354, 102], [36354, 36493, 103], [36493, 36683, 104], [36683, 37326, 105], [37326, 37751, 106], [37751, 37996, 107], [37996, 38769, 108], [38769, 38972, 109], [38972, 39414, 110], [39414, 39631, 111], [39631, 40002, 112], [40002, 40323, 113], [40323, 40961, 114], [40961, 41234, 115], [41234, 41234, 116], [41234, 41495, 117]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 41495, 0.165]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
1c74da6e48210870e4112eec29e4caf5c4ce6b30
|
Towards an Authorization Model for Distributed Systems based on the Semantic Web
Jose M. Alcaraz Calero\textsuperscript{a,b}, Gregorio Martinez Perez\textsuperscript{b,*}, Antonio F. Gomez Skarmeta\textsuperscript{b}
\textsuperscript{a}Automated Infrastructure Lab
Hewlett Packard Laboratories Bristol
Filton Rd, Stoke Gifford
BS34 8QZ Bristol, UK
\textsuperscript{b}Department of Communications and Information Engineering
University of Murcia
Computer Science Faculty, Espinardo
30011, Murcia Spain
Abstract
Authorization is a crucial process in current information systems. Nowadays, many of the current authorization systems do not provide methods to describe the semantics of the underlying information model which they are protecting. This fact can lead to mismatch problems between the semantics of the authorization model and the semantics of the underlying data and resources being protected. In order to solve this problem, this paper describes an authorization model based on Semantic Web technologies. This authorization model uses the Common Information Model (CIM) to represent the underlying information model. For this reason, a new conversion process of CIM into the Semantic Web languages has been proposed converting properly the semantics available in the CIM model. This representation provides a suitable information model based on a well-known logic formalism for implementing the authorization model and a formal language for describing concisely the semantic of the information models being protected. The formal authorization model supports role-based access control (RBAC), hierarchical RBAC, conditional RBAC and object hierarchies, among other features. Moreover, this paper describes an authorization architecture for distributed systems taking into account aspects such as privacy among parties and trust management. Finally, some implementation aspects of this system have been also described.
Key words: Authorization Model, Distributed System, Semantic Web, Authorization Architecture, Formal Methods
1. Introduction
Nowadays, there exist many authorization systems for distributed environments. There are authorization systems for Multi-agent systems [1], GRID structures [2], P2P systems [3], federated scenarios [4], Cloud Computing [5] and in general terms, any relevant technology associated to distributed architectures. However, some of the current
authorization systems do not provide methods to describe the semantics of the underlying information model which they are protecting. This fact can lead to mismatch problems between the semantics of the authorization model and the semantics of the underlying data and resources being protected. For example, to express an authorization for a file path, the semantics associated to the file system structure have to be coded or declared. Analogously, this happens in distributed systems when the resource can be a whole computer and the semantics require that all the logical and physical services are affected by this decision. Thus, when any of these semantics is not implemented in the authorization system, this system lacks enough information for managing this kind of resource correctly.
Hence, the main aim of this paper is to foster an approach based on the usage of the Semantic Web technologies to provide the description of information systems in an accurate, formal and highly expressive manner and to describe a formal authorization model suitable for this description. This authorization model uses the Common Information Model (CIM) to represent the underlying information model. For this reason, a new conversion process of CIM into the Semantic Web languages has been proposed converting properly the semantics available in the CIM model. This representation provides a suitable information model based on a well-known logic formalism for implementing the authorization model and a formal language for describing concisely the semantic of the information models being protected. The idea behind this approach is to match the semantics of the authorization framework and the semantics of the underlying data being protected in order to avoid mismatch problems related to the semantics of these protected objects. The formal authorization model supports role-based access control (RBAC), hierarchical RBAC, conditional RBAC and object hierarchies, among other features. An authorization architecture for distributed systems is also tackled in this paper in order to validate the authorization model proposed taking into account aspects such as privacy among parties and trust management.
In order to explain the authorization model promoted, the paper has been structured as follows: section 2 describes the languages and logic formalisms used as foundation for the authorization model. The information model used for representing the information system and its conversion to the Semantic Web languages are described in section 3. Section 4 describes the underlying authorization model. After that, the authorization architecture for distributed environment is explained in section 5. Section 6 provides some implementation aspects related to the authorization systems. Finally, some conclusions and future works are provided in section 7.
2. Languages and Logic Formalism
The RDF [6], RDFS [7], OWL 2 [8] and SWRL [9] languages designed for the Semantic Web [10] are formal languages for representing knowledge. While RDF is intended as a general-propose language for describing resources in the Web, RDFS, OWL 2 and SWRL are general-purpose languages for describing semantics associated to these resources. These languages have a common basic well-known logic formalism called Description Logic [11]. This formalism provides a highly expressive language for describing conditional knowledge (SWRL), simple semantic features such as inheritance among concepts and properties (RDFS) and advanced semantic features such as transi-
tiveness and reflexiveness in properties or disjointness of concepts (OWL 2). At same time, the formalism is kept within decidability bounds, so that the inference processes are performed in a finite time. This set of languages and inference processes provides a suitable framework for defining an authorization model and an information model using semantic associated to them. Notice that, Semantic Web technologies [8], [9] allow any element to be extended in the architecture including the authorization model, the information model and the semantics of these, since they provide languages to express knowledge and semantics.
There is some basic notation related to these languages that will be used in the rest of this paper. RDF/OWL 2 manages concepts (or classes) and properties (or attributes). Thus, if \( A \) is a concept then \( A.p \) denotes the property \( p \) belonging to the concept \( A \). In the same way, \( A \sqsubseteq B \) defines \( A \) as subclass of \( B \) and \( A.p \sqsubseteq B.q \) defines \( p \) as subproperty of \( q \). On the other hand, an SWRL rule is an implication relationship between the antecedent terms and consequent terms and its semantics define that if all the antecedent terms hold then all the consequent terms also should hold. Thus, the term \( C(\mathit{x}) \) represents any instance \( x \) of the concept \( C \), the term \( p(\mathit{x}, \mathit{y}) \) represents a property \( p \) belonging to the instance \( x \) and having the value \( y \), and the term \( f : a(\mathit{x}, \mathit{y}, ..., \mathit{z}) \) represents the function \( a \) having as parameters \( x, y, ..., z \). These built-in functions are used to carry out mathematical, logical and string calculations and the variables \( \mathit{x}, \mathit{y}, \mathit{z} \) will be bound to the instances and values available in the domain. Additionally, there are another two special terms denoted as sameAs(\( \mathit{x}, \mathit{y} \)) and DifferentFrom(\( \mathit{x}, \mathit{y} \)) for comparing the equality and difference of the variables \( \mathit{x}, \mathit{y} \). In order to clarify the SWRL notation, let's suppose the following rule: \( \text{File}(\mathit{x}) \land \text{name}(\mathit{x}, \mathit{y}) \land f : \text{endWith}(\mathit{y}, ")") \rightarrow \text{Directory}(\mathit{x}) \). This rule expresses that for all instances \( x \) of the domain, if \( x \) is a File, this file has a name \( y \), and this name ends with "/", then the instance \( x \) is also a Directory.
3. Information Model
There are several industrial standards for modelling information systems like CIM [12] and OIM [13]. In fact, CIM is being used in a wide variety of large systems such as SAP, Windows XP/2000 and VMWare. It has been chosen in our paper as base model for the representation of the information system. This model allows the representation of almost all the physically and logically elements available in a computer including devices, services, databases, applications, networks, security, users, policies, events and etcetera. CIM provides a wide variety of concepts and associations to represent the information systems. In particular, CIM is composed of more than 1600 concepts and associations in its latest version.
Figure 1 shows a brief summary of some important CIM concepts and their hierarchical structures. Each node in a branch represents an inheritance relationship to its parent. Thus, for example, Role can be interpreted as Role \( \sqsubseteq \) Collection \( \sqsubseteq \) ManagedElement \( \sqsubseteq \) Thing, and so on. In the context, Thing is a super class that all the others classes inherit, implicitly. Each of these concepts have associated properties but for simplicity they are not shown.
Regarding CIM hierarchical structure, all the concepts managed are under the ManagedElement branch whereas the associations are represented under the Association branch. In the ManagedElement branch there are useful
concepts for authorization purposes like Identity, Privilege, Group and Role lately described in section 4. There are also all the concepts related to the ManagedSystemElement which in turn, represents the logical and physical description of the elements present in the information system like Printer, Software, Services and Files. A notable feature of this structure is raised when an instance i belongs to any concept, for example PrinterElement, denoted as PrinterElement(i). Then as a result, the inference processes of the Description Logic will apply the inheritance semantics inferring that i is also an instance of LogicalElement, ManagedSystemElement, ManagedElement and Thing denoted as LogicalElement(i), ManagedSystemElement(i), ManagedElement(i) and Thing(i), respectively. Notice the added-value provided by all the information automatically generated by the underlying model from only a simple instance.
CIM is usually distributed in MOF and XML syntaxes. Thus, a conversion from MOF/XML to RDF/OWL 2 might be done in order to get a model suitable for our purposes. Actually, some research works [14], [15] have focused on carrying out this conversion process. This paper provides a new conversion process based on this earlier research. The main contribution of this new process resides in the new method for converting the CIM associations. While previous works map these CIM associations to OWL properties, this paper promotes the mapping of CIM association to OWL concepts. In fact, figure 1 represents a summary of the real RDF/OWL 2 hierarchy achieved. Notice that there is an Association branch not present in the previous works which is part of the original CIM. The previous works model this branch as properties of other classes. This new conversion process contains all the associations as concepts which in turn, due to their nature always contain at least two properties in order to spec-
ify the two different sides of the association (many of these properties have not been shown for simplicity). This branch is important in this paper for enabling the differentiation of the different kinds of associations available in the model. This cannot be done using previous models. In fact, it is worth mentioning the inheritance available among the properties available in the CIM associations. Thus, any property belonging to an association inherits the properties of the parent of this association. For example, just following the tree structure depicted in figure 1, the property MemberOfCollection.Collection could be defined as MemberOfCollection.Collection $\sqsubseteq$ Aggregation.-Collection $\sqsubseteq$ Association.Antecedent and analogously, MemberOfCollection.Member could be defined as Member-OfCollection.Member $\sqsubseteq$ Aggregation.Member $\sqsubseteq$ Association.Consequent, and so on. By applying these semantics, the inference processes of the Description Logic will infer from an instance $i$ belonging to the concept the MemberOf-Collection, not only that this instance is also belonging to Aggregation, Associations and Thing concepts but also that MemberOfCollection.Member and MemberOfCollection.Collection properties are also instances of the properties Aggregation.Member, Association.Antecedent and Aggregation.Collection, Association.Consequent, respectively.
Notice that most of the current CIM provider implementations (software that provides CIM representation of the current state of the managed system) such as OpenPegasus, OpenWBEM, WBEMSService and several commercial solutions do not provide inference processes in the CIM representation. However, the added value provided by the Description Logic inference process can be applied by doing the conversion of the CIM instances from XML to RDF/OWL 2.
4. Authorization Model
This section provides the formal model to control the access to resources in a distributed system. This model is based in the information model previously described in section 3. Figure 2 represents all the concepts of this information model related to the authorization model. Thus, in essence, an authorization model has to determine if a subject has the privilege to perform a given action over the controlled object. This fact can be represented by a 3-tuple (Subject, Privilege, Object). Thus, these concepts can be directly associated with the information model depicted in figure 1, Subject being directly mapped to the Identity CIM concept and Privilege to the Privilege CIM concept. Any CIM concept inheriting from ManagedElement can be mapped to an Object and this enables access control of any concept represented in CIM. Moreover, each privilege asserted in the system, i.e. each instance of this 3-tuple, is represented in CIM by means of the instantiation of two different associations, AuthorizationSubject and AuthorizationTarget. These associations represent the authorization relationship between (Subject and Privilege) and (Privilege and Object), respectively.
Then, when the authorization system has to prove if a given 3-tuple has access or not, the system will try to find the authorization proof in the underlying knowledge base. This search for a formal proof can be done with the SPARQL language [16], a language of the Semantic Web intended for this purpose. Essentially, the code depicted in figure 3 represents the query in SPARQL syntax, an SQL-like syntax and this query can be used to find the authorization
proof. This query receives as parameter the 3-tuple to check, then tries to find the evidence of the authorization proof by means of the criteria specified in the WHERE clause. This clause is used to search for the proof of authorization checking the existence of both associations AuthorizationSubject and AuthorizationTarget applied over the 3-tuple specified as parameter. Actually, lines 3-4 search for any identity ?s where a privilege ?p is assigned through the association ?ac, where ?p and ?ac are the name of the identity and the privilege specified as parameters. Lines 5-6 search for any managed element ?o associated to the previous privilege ?p through the association ?at where instanceID property of this element matches with the parameter provided. Notice that the authorization model is based in a discretionary access control and therefore a deny by default policy can be applied. As a result of execution of this SPARQL query, if there is not evidence of authorization (0 rows returned), the request will be denied (deny by default) and otherwise it will be accepted.
To support the authorization model a role-based access control (RBAC) [17] is incorporated. The authorization model relies on the usage of roles as a set of privileges that could be assigned to a subject, and groups as a set of users. The CIM association MemberOfCollection is used to assert that any identity is belonging to a collection, either Role or Group concepts. Moreover, a Privilege can be associated to either Identity, Group or Role by means of the previously mentioned AuthorizationSubject association. As a result, the privileges granted to either Group or Role have to be applied to the users belonging to these collections. This is a transitiveness relationship between Group/Role and Identity extended by means of the AuthorizationSubject associations. This transitiveness can be incorporated by
means of the inclusion of the semantic rule depicted in figure 4 to the authorization model.
1. \( \text{Collection}(?c) \land \text{AuthorizedSubject}(?as) \land \text{privilegedElement}(?as, ?c) \land \text{privilege}(?as, ?p) \)
2. \( \text{Identity}(?i) \land \text{MemberOfCollection}(?mc) \land \text{collection}(?mc, ?c) \land \text{member}(?mc, ?i) \)
3. \( \rightarrow \)
4. \( \text{AuthorizedSubject}(?newas) \land \text{privilege}(?newas, ?p) \land \text{privilegedElement}(?newas, ?i) \)
Figure 4: SWRL rule for supporting role-based access control
Lines 1-2 of the rule of the figure 4, it retrieves any privilege association ?as applied over a collection ?c (role or group) and any identity ?i belonging to this collection (by means of the ?mc association) and produce the transitivity of the privilege creating a new grant directly applied to the identities ?i. Notice that the association MemberOfCollection have two sides: property member denotes the object which is part of the collection defined in the property collection. Then, the authorization proof previously described in figure 3 can also manage these privileges.
Additionally, hierarchical role based access control (hRBAC) [17] enables a hierarchical subject grouping and it has been incorporated to the authorization model. This kind of access control allows the definition of hierarchies of collections, roles and groups. A collection can be defined as a specialization of another more generic collection. For example, the role DatabaseAdmin could be defined as a specification of the Admin role, and therefore, all the privileges defined over Admin also apply for DatabaseAdmin. This transitivity among collections could be defined by the rule given in figure 5.
1. \( \text{Collection}(?ca) \land \text{AuthorizedSubject}(?as) \land \text{privilegedElement}(?as, ?ca) \land \text{privilege}(?as, ?p) \)
2. \( \text{Collection}(?cb) \land \text{MemberOfCollection}(?mc) \land \text{collection}(?mc, ?ca) \land \text{member}(?mc, ?cb) \)
3. \( \rightarrow \)
4. \( \text{AuthorizedSubject}(?newas) \land \text{privilege}(?newas, ?p) \land \text{privilegedElement}(?newas, ?cb) \)
Figure 5: SWRL rule for supporting hierarchical role-based access control and hierarchical subjects grouping
Line 1 of the rule given in figure 5 retrieves any authorization association ?as between a collection ?ca and a privilege ?p. Line 2 retrieves any collection ?cb belonging to the previously obtained collections ?ca. As a result, the most specific collections ?cb receive all the privileges directly associated to their parent by the direct association of these privileges using the new association ?newas. Thus, combining rules given in figures 4 and 5, subjects have assigned all the privileges directly and indirectly inferred, and the authorization proof given in the figure 3 is able to manage hRBAC.
To support an object hierarchy [18] provides a powerful expressiveness in the authorization model. This feature allows the scope of a privilege applied to a given object to be extended to other objects. For example, let’s suppose a FileSystem concept is composed of a Directory which in turn, it is composed of a File. A privilege could be granted
to a File System. The object hierarchy will enable to infer automatically the extension of the scope of this privilege to the elements composing the file system, i.e. Directory and Files. Analogously, a privilege at the level of Computer System means that all the elements related to this computer receive this privilege. Notice the added value of this feature for administration tasks, in which there are formal methods to validate this process using the underlying logic. CIM provides two different kind of concepts to define aggregation and dependence associations, the CIM Aggregation and Dependency associations. Thus, the transitiveness of the privileges applied to an object can be incorporated by the rules depicts in figure 6.
1. ManagedElement(?mea) ∧ AuthorizedTarget(?at) ∧ targetElement(?at, ?mea) ∧ privilege(?at, ?p)
2. ManagedElement(?meb) ∧ Aggregation(?ag) ∧ collection(?ag, ?mea) ∧ member(?mc, ?meb)
3. →
4. AuthorizedTarget(?newat) ∧ privilege(?newat, ?p) ∧ privilegedElement(?newat, ?meb)
Figure 6: SWRL rules for supporting hierarchical object access control
The two rules given in figure 6 are analogous, and the main difference between them is the association used in line 2. The first rule uses the aggregation association whereas the second rule uses the dependency association. Line 1 of both these rules retrieves any managed element ?mea which has a privilege associated. Line 2 retrieves any managed element ?meb which has an aggregation (first rule) or dependency (second rule) association with the previous managed element ?mea. As a result, the transitiveness infers a new privilege associated to the dependent or aggregated component ?meb.
Conditional RBAC [18] enables the assignment of roles and groups, and the granting of privileges, according to some conditions defined by the system administrator. This is the foundation of the so-called authorization policies [19], [20]. The expressiveness provided by the SWRL language has been used to provide a basic support for this kind of policies in this authorization model. This language allows the definition of conditional knowledge and for this reason, just by enabling the system administrator to insert her own SWRL rules in the authorization system, these rules can express the conditional nature of the authorization policies. This expressiveness in the authorization model enables it also to support constrained RBAC [21]. Constrained RBAC allows the expression of a condition that two incompatible roles cannot be assign to the same subject (separation of duties). This incompatibility can also be expressed in SWRL rules like any other policy according to the specific domain constraints. For example, a domain in which a separation of duties between Role(DatabaseAdmin) and Role(WebAdmin) has to be enforced can
use the SWRL rule depicted in figure 7 to control this separation. The rule retrieves all the identities belonging to the role DatabaseAdmin (lines 1-2) and all the identities belonging to the role WebAdmin (lines 3-4) and if there is any instance belonging to both roles at same time (line 5) a new instance of the Conflict concept will be inferred. The Conflict concept has been defined semantically in OWL 2 to create an inconsistency in the inference process when any instance of this concept is created. Then, when the separation of duties constraint is violated an inconsistency arises and it causes the throwing of an exception which can be caught by the system administrator [22].
```
1 Identity(?ia) ∧ Role(?ra) ∧ name(?ra, "DatabaseAdmin") ∧
2 MemberOfCollection(?mca) ∧ member(?mca, ?ia) ∧ collection(?mca, ?ra)
3 Identity(?ib) ∧ Role(?rb) ∧ name(?rb, "WebAdmin") ∧
4 MemberOfCollection(?mcb) ∧ member(?mcb, ?ib) ∧ collection(?mca, ?rb)
5 sameAs(?ia, ?ib)
6 →
7 Conflict(?n) ∧ antecedent(?n, ?ra) ∧ consequent(?n, ?rb)
```
Figure 7: Example of SWRL rule for defining a separation of duties between DatabaseAdmin and WebAdmin roles
Finally, it is worth remarking the universality provided by the SWRL rules due to the semantics applied to the SWRL variables. These semantics produce the binding of the SWRL variables to all the instances available in the domain model; for example, the term Identity(?x) is referred to all the identities available. Thus, if the domain is extended by other sources of information, the rule will change its scope and it will continue being applied to all the instances of the new domain.
As a result, a formal authorization model with support for RBAC, hierarchical RBAC, conditional RBAC, constrained RBAC, object hierarchy, subject hierarchy and separation of duties has been achieved by means of the usage of Semantic Web technologies.
5. Authorization Architecture for Distributed Systems
This section describes the architecture designed to apply the authorization model explained in section 4 on a distributed environment. A feature associated to the services of distributed systems is support for multi-tenancy [23]. This feature is defined as the ability to provide services to several Parties, simultaneously. In fact, figure 8 shows a distributed architecture with a multi-tenancy authorization system providing service to three different Issuers. An issuer is defined as the identity associated to a party and henceforth, both terms will be used indistinctly to refer to an independent information system which has its own Users, Groups, Roles, Objects and Privileges, that is, its own information model.
Regarding the different components available in the architecture, each issuer has two different components to
interact with the authorization system: Policy Information Point (PIP) and Policy Enforcement Point (PEP). On the one hand, the Policy Information Point (PIP) component is in charge of providing all the issuer’s information to the authorization system. This component provides an important added value in our system because it not only provides the current description of the information system (users, groups, privileges, resources) but also it is able to provide semantic information about this system. This fact enables the extension of the semantics of the resources being protected in the authorization system because the authorization system knows how to interpret this semantics and there is not a mismatch between the systems. Notice that this component provides all the information using the OWL 2 / SWRL languages. On the other hand, the Policy Enforcement Point (PEP) component is in charge of asking the authorization system about any authorization proof and it is also in charge of applying the result provided by the authorization system to the requesting issuer.
The authorization system is composed of two different modules. On the one hand, the Policy Decision Point (PDP) component where the authorization proof is created by applying the authorization model previously explained. This module receives an information model and it applies all the set of rules described in the section 4 to this model in order to determine the authorization statement. On the other hand, the authorization system provides a Trust Management (TM) component where all the trust relationships among the parties are managed. All the services of the authorization system are exposed to their users by means of an API which provides methods to use and manage the authorization system, the information used therein and the trust management.
Regarding security issues, the PIP-Authorization System and PEP-Authorization System communications may ensure the integrity, confidentiality and privacy of the data by means of the usage of digital signature and encryption methods such as XML-DS and XML-ENC, or by means of end-to-end encryption protocols like SSL and TLS. Moreover, all the issuers may be authenticated and the authorization system may control the access of the issuer to use the authorization system. This feature protects the authorization system against unauthorized issuers and it protects
against denial of service (DoS) attacks. Notice that there is a loose coupling between authentication and authorization systems and both Users and Issuers could be authenticated by any authentication mechanism, for example OpenID, X.509, SPKI/SDSI or Kerberos, among others.
5.1. Trust Management
The trust model of the proposed authorization architecture relies on the implicit trust of all the parties in the authorization system. Hence, the results provided by the authorization system, which in turn, might be authenticated for the parties, are trusted values. Moreover, the different issuers available in the distributed system can establish trust relationships among each other. In this context, a trust relationship, denoted as \( A \preceq B \) (A trust B), represents a collaboration agreement for which issuer B is able to access to some knowledge of the information model of the issuer A. The negotiation protocols among the parties to establish the collaboration agreements, such as federation or coalition agreements, are carried out by external methods which will not be explained because they are out the scope of this paper. However, the authorization system might store individually the information models of each party in order to perform a dynamic management of the trust relationships and to be able to adapt the authorization system to changes in the trust relationships in run-time. In fact, by default no-one trust anyone else unless a trust proof is available in the authorization system, and only an issuer A can insert in or remove from the authorization system that \( A \preceq \text{someone} \). All the stored information is depicted in the figure 8 as the knowledge base component. The trust manager is in charge of controlling the privacy of the entire information stored and selecting the information model to be used in the PDP component according to the trust relationships established.
The authorization system can offer two kinds of authorization processes. On the one hand, it can provide a regular authorization process to apply the authorization model by just taking into account the authorization information of the user who uses the system and ignoring the trust model. This case is used to provide a system that provides an authorization system that is totally independent for each party. On the other hand, a more interesting approach is to take into account the trust model. In this case, when an issuer asks about an authorization proof, the authorization system will compute the trust relationships of this issuer in order to generate the proper information model containing all the authorization information of those that trust this issuer. Then, this information will be used in the inference process of the authorization model. As a result, this process provides an authorization proof according to the information provided by the issuer and all those who trust this issuer, enabling a real collaboration among the issuers involved. Notice that authorization information is shared among issuers that establish trust relationships. Then, an issuer A could use the authorization information specified by another issuer B (assuming that B trust A) to carry out the authorization process. As a result, a distributed authorization model is defined among all the issuers that have established trust relationships.
5.2. Authorization Process
In order to explain the authorization process, let’s suppose an authorization request in which an user belonging to an organization A in trying to access to a resource belonging to an organization B. Moreover, the organization A trusts
the organization $B$ and vice versa ($A \leq B$, $B \leq A$). The sequence diagram for carrying out the authorization request is depicted in figure 9.

Firstly, the user $A$ tries to access to a protected resource controlled by the PEP of the organization $B$. Then, the PEP of the $B$ organization establishes a secure communication with the authorization system using the AuthorizationAPI. This API exposes the authorization services to all the issuers. This API redirects the authorization request to the PDP component. The PDP component asks the Trust Manager (TM) for the information model to be used in the authorization process. The TM retrieves from the Knowledge Base Manager the information models involved in the authorization request. These models are: i) the information model of the organization associated to the protected resource; ii) the information model of all the organizations who trust this organization. In our example, the information of organization $B$ and those who trust $B$ are retrieved, which includes information of organization $A$. The Knowledge Base Manager is in charge of maintaining up-to-date the information model of all the parties in the architecture. To this end, either the Knowledge Base Manager periodically asks all the PIP components for updates in the information model (pull method) or the PIP component sends updates when there are changes in the system (push method). Once the Trust Manager has generated the proper information model according to the trust relationships established this information is sent to the PDP component. Then, the PDP provides an authorization statement applying the authorization model described in section 4. Finally, this response is sent to the PEP which is in charge of granting or denying the access to the resource according to this statement.
5.3. Privacy Management
To carry out the authorization process in a multi-tenancy environment will require the extension of the 3-tuple previously introduced in section 4 in order to take into account the different Issuers. The new 3-tuple can be represented as (⟨Issuer, Subject⟩, ⟨Issuer, Privilege⟩, ⟨Issuer, Object⟩) where Subject, Privilege and Object are now scoped by an Issuer in order to identify the source of information of each element in the tuple. For example, the 3-tuple (⟨A, userA⟩, ⟨B, privilegeB⟩, ⟨C, objectC⟩) is interpreted as: B says that the subject userA belonging to the party A has the privilege to carry out the action privilegeB over the object objectC belonging to the party C. Actually, this example entails that A ≤ B and C ≤ B because otherwise B will not be able to access the information model of A and C to establish the privilege using instances userA and objectC, respectively. Moreover, the example also illustrates the privacy issues related to the visibility of the information to external issuers. The information shared with external issuers might be also negotiated in the collaboration agreement previously introduced in subsection 5.1. The previous example requires that the userA and objectC instances might be shared to create the 3-tuple. As a trivial solution, issuers can decide to share the whole information model related to the authorization information (in a glass box approach). However, in the practice, this model is not suitable in many scenarios in which the issuers try to keep to a minimum the information shared.
In order to minimize the information shared, the universality of SWRL rules can be exploited. Notice that a SWRL rule is applied to the overall information model. For example, the SWRL rule depicted in figure 10 produces that all the identities have the access privilege to all the objects of the information model of the issuer issuerA.
```
1 Identity(?i) ∧ ManagedElement(?o) ∧ issuer(?o, ”issuerA”)
2 →
3 AuthorizedSubject(?as) ∧ privilegedElement(?as, ?i) ∧ privilege(?as, ?p)∧
4 Privilege(?p) ∧ name(?p, ”access”)∧
5 AuthorizedTarget(?at) ∧ targetElement(?at, ?o) ∧ privilege(?p)
```
Figure 10: Example of rule for explaining the exploitation of the universality of SWRL rule
There is implicitly a natural extension of all the concepts unless some scope restrictions are done, such as the restriction of the ManagedElement concept by means of the use of the issuer property depicted in figure 10. This natural extension will be managed by the trust relationships established. Hence, let’s suppose that the rule of the figure 10 is defined by the issuer issuerA. Let’s also suppose that A ≤ B. Notice that while the ManagedElement is restricted only to the issuerA information system, the identities are not. Thus, when B asks for an authorization proof, the server will compute the information model according to the trust relationship and it will also take into account this rule provided by A. As a result, due to the universality of the rule and the non-restriction in the scope of the identities, all the identities belonging to both issuerA and issuerB will receive the privilege. Notice the suitability of this rule; it has produced effects on the identities of other parties, avoiding the necessity of sharing knowledge of the information.
model related to these identities. This added value keeps to a minimum the information shared between the parties and helps to keep the privacy of the information.
6. Implementation
A prototype implementation of the CIM converter producing the OWL 2 representation of the information model described in the section 3 has been implemented as a proof of concept. In essence, it is a MOF-OWL converter based on a transform sheet using the extensible stylesheet language (XSL) to drive the process. The conversion process receives the MOF specification of the CIM schema and it produces an OWL 2 representation of this information model containing all the semantic features described in section 3.
The authorization system has been implemented as a prototype in order to validate both the authorization model described in section 4 and the authorization architecture suggested in section 5. This authorization system provides the authorization methods to be used for the different entities in the architecture by means of a REST [24] interface. Each PIP and PEP components provided by the different parties can use the authorization system by using the methods provided in the REST client. These methods enable the parties to access all the services of the authorization system remotely and securely.
The Trust Manager module has been implemented using the Jena [25] framework, which is a software able to manage knowledge bases of Semantic Web languages. Thus, the Trust Manager module stores individually the information of the all parties in the Knowledge Base. This information is provided by the PIP component. Then, the Trust Manager generates the proper information model to be used in the PDP component according to the trust information provided.
The PDP module which it is the core of the authorization system has been implemented using the Semantic Web reasoner Pellet [26]. This reasoner is able to deal with the semantic of RDF, RDFS, OWL 2 and SWRL languages. For this reason both the information model and semantics can be inserted therein to carry out the authorization and inference processes. This PDP component uses a configuration file which contains all the rules exposed in the section 4 to carry out this process. Moreover, Pellet also offers support to SPARQL queries used to generate the authorization proof.
As regard to the implementation of the PEP component, this is an API which each party has to use in order to protect their resources with our authorization system. In particular, this is a secure REST client to access to the methods provided by the authorization system.
The implementation of the PIP component of each party involved in the architecture relies on a CIM monitoring provider such as OpenPegasus or OpenWBEN together with a simple converter from the XML syntax they provide to the OWL representation of the current state of the system. Notice that the information provided by the CIM monitoring provider are only instances of the different concepts available in CIM schema and it does not provide additional semantic information like inheritance among concepts, inheritance among properties, restrictions, and etcetera. For
this reason, the PIP component also provides the semantic information associated to the resources to be protected in each the party, i.e. the information schema described in section 3. Indeed, it is important to remark that this information can be extended by the parties in order to insert semantic about the resources they are protecting. This enables to define any additional semantic information about the resources as well as to define any authorization policy associated to the conditional RBAC model. To this end, a SWRL/OWL 2 editor such as Protege [27] and Ontology Rule Editor (ORE) [28] can be used to define easily this semantics which it is inserted in the PIP component to be part of the information model. Notice the added value of providing methods to insert semantic information in the PIP component. At the end, each party is able to provide the current information model and the semantics in CIM-OWL 2/SWRL representation. All of this information is automatically processed by the Pellet reasoner inside of the PDP component. This provides as added value the capability to manage high level policies in the managed system whereas the semantic mismatch of the protected resources has been avoided.
As a result, the authorization system for distributed environment implemented is able to manage trust relationship in a multi-tenancy scenario and to use a formal authorization model with support for RBAC, hierarchical RBAC, conditional RBAC, constrained RBAC, object hierarchy, subject hierarchy and separation of duties. And it also is able to extend the semantic of the resources being protected and to manage high level authorization policies.
This authorization system has been successfully deployed in an intelligent building scenario. This is a pervasive environment in which there is monitoring devices in charge of the localization of users across the building as well as services provided by the building, such as projection services, room access, multimedia services, etcetera. Each of these devices runs an agent in a secure JADE [29] multi-agent platform which is in charge of the control of this device. Each agent uses a PIP component and a PEP component. Each agent represents a party of our authorization architecture. They provide the current status and the semantics of the resources to be protected in CIM-OWL 2/SWRL language by means of their PIP component. Additionally, there is an authorization agent in the multi-agent platform in which the authorization system is running. The authorization agent is in charge of providing an authorization service for the building services. Then, once a building user has requested to perform an action on a particular device, the PEP component that controls this device uses the REST API client to ask to the authorization agent about the access control statement. As a result, the PEP receives the answer from the authorization agent and enforces the resulting decisions, thus controlling the access to the resource. The answer is inferred using the authorization system described in this paper. Notice the added-value of the trust management in this scenario, since any device can specify that it trusts in other devices in order to share authorization information with them. As a consequence, all the resources available in the multi-agent platform of the building are protected by this authorization system.
7. Conclusions and Future Work
Semantic Web technologies have been identified as useful for authorization. A formal authorization model suitable for distributed system based on these technologies has been provided and validated by means of a prototype...
implementation. The authorization model supports correctly some advanced features such as hierarchical RBAC, conditional RBAC, object hierarchies and separation of duties. A new conversion process of the CIM model to the Semantic Web languages has also been provided. As a result, a formal and highly expressive authorization system has been designed and validated as useful for distributed systems.
As future steps, it is expected to extend the authorization model with new features such as: the imperative aspects of the authorization policies; the capability to combine this authorization model with mandatory access control in order to create a formal hybrid authorization model; the ability to manage negative privileges; and the ability to incorporate PRBAC [18] features. Another excepted step is to classify and analyze the different syntactic and semantic conflicts that could arise in this authorization model and to provide formal methods for detecting and resolving them.
Acknowledgement
Thanks to the Funding Program for Research Groups of Excellence with code 04552/GERM/06 granted by the Fundacion Seneca. The authors would also like to thank the Spanish Ministerio de Educacion y Ciencia for sponsoring the research activities under the grant AP2006-4150 of the FPU program and for partial support of this research under the research project ”Seiscientos. Infraestructura de Servicios Ubicuos y de Comunicaciones en Redes Vehiculares” with reference TIN2008-06441-C02-02. Finally, the authors would like to thank personally Nigel Edwards and Miranda Mowbray, researchers at Automated Infrastructure Labs, HP Labs for their valued comments on this research.
References
|
{"Source-Url": "http://jmalcaraz.com/wp-content/uploads/papers/AlcarazCalero-2010-IFS-Preprint.pdf", "len_cl100k_base": 9188, "olmocr-version": "0.1.53", "pdf-total-pages": 17, "total-fallback-pages": 0, "total-input-tokens": 46224, "total-output-tokens": 11736, "length": "2e13", "weborganizer": {"__label__adult": 0.0003535747528076172, "__label__art_design": 0.0007081031799316406, "__label__crime_law": 0.000934600830078125, "__label__education_jobs": 0.0011873245239257812, "__label__entertainment": 0.0001437664031982422, "__label__fashion_beauty": 0.00021851062774658203, "__label__finance_business": 0.0007548332214355469, "__label__food_dining": 0.0003876686096191406, "__label__games": 0.0006761550903320312, "__label__hardware": 0.0010786056518554688, "__label__health": 0.0007052421569824219, "__label__history": 0.00044846534729003906, "__label__home_hobbies": 0.00012743473052978516, "__label__industrial": 0.0006699562072753906, "__label__literature": 0.0005993843078613281, "__label__politics": 0.0006008148193359375, "__label__religion": 0.0005125999450683594, "__label__science_tech": 0.26904296875, "__label__social_life": 0.00014412403106689453, "__label__software": 0.038299560546875, "__label__software_dev": 0.681640625, "__label__sports_fitness": 0.00020933151245117188, "__label__transportation": 0.0006151199340820312, "__label__travel": 0.00024068355560302737}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 51106, 0.029]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 51106, 0.47089]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 51106, 0.8874]], "google_gemma-3-12b-it_contains_pii": [[0, 2398, false], [2398, 5946, null], [5946, 9932, null], [9932, 11851, null], [11851, 15367, null], [15367, 17268, null], [17268, 20499, null], [20499, 23310, null], [23310, 26084, null], [26084, 28483, null], [28483, 32109, null], [32109, 33995, null], [33995, 37338, null], [37338, 40513, null], [40513, 44161, null], [44161, 47473, null], [47473, 51106, null]], "google_gemma-3-12b-it_is_public_document": [[0, 2398, true], [2398, 5946, null], [5946, 9932, null], [9932, 11851, null], [11851, 15367, null], [15367, 17268, null], [17268, 20499, null], [20499, 23310, null], [23310, 26084, null], [26084, 28483, null], [28483, 32109, null], [32109, 33995, null], [33995, 37338, null], [37338, 40513, null], [40513, 44161, null], [44161, 47473, null], [47473, 51106, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 51106, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 51106, null]], "pdf_page_numbers": [[0, 2398, 1], [2398, 5946, 2], [5946, 9932, 3], [9932, 11851, 4], [11851, 15367, 5], [15367, 17268, 6], [17268, 20499, 7], [20499, 23310, 8], [23310, 26084, 9], [26084, 28483, 10], [28483, 32109, 11], [32109, 33995, 12], [33995, 37338, 13], [37338, 40513, 14], [40513, 44161, 15], [44161, 47473, 16], [47473, 51106, 17]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 51106, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
83c29565b0f98b004ed7de0555d526ef73fca0ca
|
GroverCode: Code Canonicalization and Clustering
Applied to Grading
by
Stacey Terman
Submitted to the Department of Electrical Engineering and Computer Science
in partial fulfillment of the requirements for the degree of
Master of Engineering in Electrical Engineering and Computer Science
at the
MASSACHUSETTS INSTITUTE OF TECHNOLOGY
June 2016
© Stacey Terman, MMXVI. All rights reserved.
The author hereby grants to MIT permission to reproduce and to distribute publicly paper and electronic copies of this thesis document in whole or in part in any medium now known or hereafter created.
Author ................................................................
Department of Electrical Engineering and Computer Science
May 20, 2016
Certified by ............................................................
Robert C. Miller
Professor of Computer Science and Engineering
Thesis Supervisor
Accepted by ...........................................................
Christopher J. Terman
Chairman, Masters of Engineering Thesis Committee
Abstract
Teachers of MOOCs need to analyze large quantities of student submissions. There are a few systems designed to provide feedback at scale. Adapting these systems for residential courses would provide a substantial benefit for instructors, as a large residential course might still have several hundred students. OverCode, one such system, clusters and canonicalizes student submissions that have been marked correct by an autograder. We present GroverCode, an expanded version of OverCode that canonicalizes incorrect student submissions as well, and includes interface features for assigning grades to submissions. GroverCode was deployed in 6.0001, an introductory Python programming course, to assist teaching staff in grading exams. Overall reactions to the system were very positive.
Acknowledgments
This thesis would not exist without all the support I’ve received from the people around me.
First, a huge thank-you to Elena Glassman. Elena, without you I would not have a project to work on in the first place. More important than your (not inconsiderable!) technical expertise, however, is your continuing guidance and encouragement. I’ve lost track of the number of times I’ve thought to myself, “I’m so glad Elena is here” over the course of this project. If your future advisees appreciate your mentorship as much as I do, you are going to make an incredible adviser. Best of luck!
Second, many, many thanks to my parents. Dad, thank you for your practical advice and ready supply of hugs, and for occasionally prying into my business enough to keep me on track. Mom, thank you for your emotional support and copy editing, and for occasionally nagging me until I actually got work done. Also for having had already will have helped me with my mixed-up tenses. And, of course, thank you both for raising me with the curiosity, enthusiasm, and determination necessary to not merely succeed, but to thrive here at MIT. Now I am all set for life!
Third, thanks to the staff of 6.0001, especially Ana, for letting me use them as guinea pigs! I really appreciate everyone’s willingness to try out GroverCode and provide feedback. I hope the system continues to help out the course in the future.
Fourth, my gratitude to the members of Rob Miller’s research group for providing a steady stream of tips and suggestions. Further thanks for all the daily standup meetings that started the mornings with laughter.
Finally, a last thank-you to everyone who’s given me a hug in the past year, especially when I was stressed. <3
## Contents
1. Introduction ....................................................... 9
2. Related Work ....................................................... 11
2.1 OverCode ...................................................... 11
2.2 Cluster Assisted Grading ................................. 12
2.3 Hint generation ............................................. 13
3. Dictionary of Terms ............................................. 14
4. Design ........................................................... 16
4.1 Stacks ......................................................... 18
4.2 Filtering ...................................................... 18
4.3 Ordering ....................................................... 18
4.4 Highlighting Differences Between Stacks ............... 19
4.5 Grading ....................................................... 19
5. Implementation ................................................... 20
6. Dataset .......................................................... 26
6.1 Midterm Problems .......................................... 26
6.2 Final Exam Problems ...................................... 28
7. Pipeline Evaluation ............................................. 30
7.1 Limitations .................................................. 33
8. Field Deployments .............................................. 33
8.1 Usual Grading Method ..................................... 33
8.2 First Field Deployment: Midterm exam .................. 34
8.3 Second Field Deployment: Final Exam .................... 36
9. User Feedback .................................................... 38
<table>
<thead>
<tr>
<th>Section</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>9.1 Responses to specific features</td>
<td>38</td>
</tr>
<tr>
<td>9.2 Frustrations</td>
<td>46</td>
</tr>
<tr>
<td>9.3 Comparison to Previous Grading Tools</td>
<td>46</td>
</tr>
<tr>
<td>9.4 Suggestions</td>
<td>47</td>
</tr>
<tr>
<td>10 Discussion</td>
<td>47</td>
</tr>
<tr>
<td>11 Future Work</td>
<td>48</td>
</tr>
<tr>
<td>12 Conclusion</td>
<td>49</td>
</tr>
</tbody>
</table>
1 Introduction
Interactive online learning experiences such as Intelligent Tutoring Systems (ITS) and MOOCs are becoming increasingly popular and produce vast numbers of beginner-level programs. A MOOC can have hundreds or thousands of students, and the analyzing and grading of every submission individually would require an infeasible amount of instructor time and effort. Consequently, there are a few systems designed to help teachers analyze student submissions and provide feedback at scale. Instructors of a residential course, unlike MOOC instructors, are expected to provide feedback and assign grades to every student. Residential courses are generally much smaller than online courses. However, a large residential programming course can still be as large as several hundred students. Residential teaching staff invest a great deal of time into grading and providing feedback to students. Adapting tools designed for large-scale online classes for residential courses would provide a substantial benefit for these instructors.
This thesis focuses specifically on grading exams in 6.0001, an introductory Python programming course. In this course, a portion of each exam involves submitting code online via the MITx platform. In the past, the MITx platform assigned a grade automatically based on a suite of unit tests. However, basing scores solely on unit test results can unfairly penalize some students while rewarding others. For example, a student might write a function that performs the correct logic, but makes a small error such as returning a floating point number instead of the required integer. This student receives no credit from an autograder, despite showing an understanding of programming concepts. Conversely, a different student might write a function that always returns the same answer, and receive partial credit, despite showing no such understanding. For this reason, the teaching staff of 6.0001 now grade by looking at each student’s code and adjusting the output of the autograder as necessary. This grading process is long and exhausting, often taking upwards of five hours per exam.
To ease this process, we present GroverCode, an expanded version of the OverCode system [3]. As originally designed, OverCode allows teachers to visualize clusters of
correct solutions that behave equivalently. It also renames variables to increase consistency between solutions. With this system, a teacher can get a sense of the space of student programming solutions and tailor feedback to reach as many students as possible. Originally evaluated on MOOC data, this tool has great potential for residential environments. The enhancements to GroverCode include handling incorrect submissions as well as correct ones, and applying the system to the task of grading. When grading, the staff must first understand what a student’s code does and locate any mistakes in order to deduct points or provide feedback. Increasing the similarity between incorrect solutions, to simplify the understanding step, was a primary goal of this system.
In the GroverCode pipeline, we process incorrect solutions, that is, solutions which have been marked as incorrect by an autograder for failing one or more test cases. The original OverCode pipeline clustered correct solutions based on variable behavior and renamed common variables so that all correct solutions shared a namespace. The modified pipeline also analyzes the behavior of variables in incorrect solutions by extracting the sequence of values these variables take on and the structure of the lines of code in which they appear. Using this information, GroverCode can rename these variables as well. The system then displays all solutions within a consistent namespace, regardless of correctness. The GroverCode user interface includes features for assigning scores and comments to solutions. This combines viewing code and assigning grades into one interface.
We deployed the GroverCode system as a grading tool in the Spring 2016 semester of 6.0001. Approximately 200 students enrolled in this course. Nine instructors, consisting of a professor and eight Teaching Assistants (TAs), including the author, used GroverCode to help grade both the midterm and the final exam, which together contained seven programming problems. They used GroverCode to grade most, though not all, student submissions. The number of GroverCode-graded submissions per problem ranged from 133 to 189. Overall reactions to the system were very positive, especially when applied to simple problems.
The main contributions of this thesis are:
- An updated pipeline for the GroverCode system that analyzes the behavior of variables in correct and incorrect solutions and renames them into a common namespace
- An interface for displaying and grading canonicalized code
- Two field deployments in which instructors of an introductory Python course used GroverCode to grade student exams and provided positive feedback about the system
2 Related Work
2.1 OverCode
The original OverCode [3] helps teachers and other graders explore variation in student submissions in large-scale programming classes such as MOOCs. It analyzes only submissions marked as correct by an autograder, and clusters hundreds or thousands of submissions by analyzing variable behavior on a single test case. It also canonicalizes student submissions by renaming variables to increase the similarity between submissions and to improve human readability. Glassman et al. tested OverCode with a group of Teaching Assistant (TA) graders and found that the interface helped them quickly assess students’ understanding. Modifications and expansions to GroverCode described in this paper support the specific task of exam grading in a residential introductory Python course, 6.0001. GroverCode adds the ability to run student submissions on multiple test cases, rather than limiting to a single test case. It augments the pipeline to handle submissions that are marked as incorrect by an autograder. GroverCode does not cluster incorrect submissions; however, it renames the variables in incorrect submissions to share names with the variables in correct submissions. Finally, it adds interface support for assigning grades and adding comments to submissions.
2.2 Cluster Assisted Grading
Basu et. al [1] use clustering to explore the idea of “grading on a budget,” i.e., maximizing the impact of a small number of human actions when grading short answer questions. They train a classifier to label pairs of submissions as similar or different, then break the set of submissions into a fixed number of clusters and subclusters, automatically marking clusters and subclusters as correct by clustering answer key items with student submissions. Teachers can flip the labels of clusters, subclusters, and individual submissions as appropriate. This approach of assigning grades to whole groups of submissions at one time amplifies the teacher’s effort. It can also reveal common modes of misunderstanding, because submissions within incorrect subclusters often contain similar mistakes.
GroverCode uses a suite of grader-supplied unit tests to initially mark submissions as correct or incorrect, rather than training a classifier. It clusters submissions marked as correct into stacks, based on variable behavior and syntax. It calculates a metric of similarity between submissions, but does not use that metric to cluster, only to change the order in which it displays submissions. It groups submissions according to the number of test cases they pass. Often these groups display similar mistakes, as with the subclusters in the system described by Basu et al.
Brooks et al. [2] build on the work of Basu et al. presenting a web interface for displaying clusters and subclusters, and assigning grades and feedback to them. They evaluate this interface with a group of expert graders, who report that the clustered interface is faster, easier to use, and more enjoyable than a flat interface for grading the same problems.
The GroverCode interface focuses on displaying student code in a human-friendly fashion, while Brooks et al. focus on displaying clusters and subclusters in a meaningful way. GroverCode only clusters submissions that behave identically, so there is no need to visualize variation within a cluster. Both interfaces aim to facilitate hand-grading of student answers.
Gross et al. [4] use prototype-based clustering and examine the effectiveness of comparing student submissions to the prototype submissions. They use the Relational Neural Gas technique (RNG) to cluster graded submissions and find prototypes. They provide feedback on each new submission by highlighting the differences between that submission and the closest prototype submission. Expert graders determined that seeing these differences can help students debug their code.
Unlike GroverCode, Gross et al. focus on providing feedback to a single student at a time. They cluster submissions already graded by experts, and use these clusters and their prototypes to help identify problems in a new submission. In contrast, GroverCode processes ungraded submissions and helps staff assign grades to a whole body of submissions at one time. However, GroverCode does highlight differences between submissions to help pinpoint problems, although it is staff, rather than students, who view these differences.
2.3 Hint generation
Singh et al. [7] use program synthesis techniques to attempt to automatically correct student code. Given a specification and an error model, their system can correct a large fraction of incorrect submissions. They use the Sketch synthesizer to apply the changes suggested by the error model to a student submission and generate a set of candidate programs. Of all these candidate programs, they consider those that match a provided reference implementation and pick the one that requires the minimum number of corrections. Singh et al. find that a single addition to the error model could enable correcting hundreds of additional submissions, indicating that students often make overlapping mistakes. One benchmark error model corrected 65% of student submissions to a particular problem. However, this system requires teachers to define an error model specific to each problem, and only supports a subset of Python.
GroverCode does not attempt to fix students’ bugs automatically, but instead aims to support teaching staff as they grade code manually. It considers the fact
that students make overlapping errors, by grouping submissions based on test case output, since submissions which pass the same set of test cases often include the same mistake. In addition, the task of generating a rubric to grade a particular problem is similar to that of generating an error model.
Rivers & Koedinger [6] generate hints by locating incorrect student submissions in a space of possible submissions to a given problem. They generate this submission space from previous student submissions by extracting the Abstract Syntax Tree (AST) for each submission, and normalizing it using semantics-preserving operations, including anonymizing variable names. Rivers & Koedinger generate feedback for an incorrect student submission by finding the closest correct submission using string edit distance, and then determining the necessary changes to convert the student’s submission into a correct submission.
Like GroverCode, Rivers & Koedinger rename variables to increase the similarity of submissions. However, GroverCode also attempts to increase the human readability of submissions by renaming variables based on common names chosen by students. Rather than automatically generating hints based on similar submissions to a student submission, GroverCode orders submissions based on similarity and displays them to teaching staff to assist them in assigning grades.
3 Dictionary of Terms
We define several terms below, used throughout Sections 4 and 5.
**Test Case** A single Python function call designed to test some aspect of a student’s code. This may be a call to a student-defined function, or a call to a grader-defined function that calls a student’s function and performs computation on the results.
**Error Signature** A particular pattern of passes and failures on a set of test cases.
**Submission** A single student’s answer to a particular coding problem.
Correct Submission A submission that has been marked correct by an autograder, i.e., a submission that passes every test case in a set of test cases.
Incorrect Submission A submission that has been marked incorrect by an autograder, i.e., a submission that fails at least one test case in a set of test cases.
Variable Instance A single global or local variable within a submission.
Abstract Variable A collection of one or more equivalent variable instances. Variable instances are considered equivalent if they take on an identical sequence of values.
Cleaning Removing comments from a submission and reformating it to ensure consistent line indentation and spacing.
Canonicalizing Renaming the variable instances within a submission such that the submission shares a namespace with all other submissions.
Stack A collection of one or more cleaned and canonicalized submissions. A correct stack contains one or more equivalent correct submissions. See Section 5 for an explanation of which submissions are considered equivalent. An incorrect stack contains a single incorrect submission.
4 Design
The GroverCode user interface is the result of several iterations of prototypes. At each stage in the design process, members of our research group and members of the teaching staff of 6.0001, the introductory Python course, tested the interface during intermediate design stages. The final design, shown in Figure 1, incorporates their feedback. The GroverCode user interface includes two sections: a filter panel on the left and a stack display on the right. The filter panel contains one row for each observed error signature, which is a particular pattern of test case passes and failures. Each row lists the number of passed test cases in the error signature, a visual representation of the error signature, the total number of stacks exhibiting that error signature, the number and percentage of graded stacks exhibiting that error signature, and a progress bar for that error signature. An additional row at the bottom displays the total number of stacks, the total number of graded stacks, and an overall progress bar.
The stack display contains one column per stack, arranged horizontally. The horizontal alignment facilitates comparing code and test case results between stacks. Each column features a large center panel containing the code of the stack. A red panel means that the stack failed one or more test cases. Above the code panel is the interface for entering grades, with two textboxes for entering a score and a comment, respectively, and a dropdown menu to show the rubric for the current problem. There is also a numeric identifier for the stack, and an indication of whether the stack has been graded. Test case information appears below the code panel. This information includes a description of each test case and a green checkmark or red X to denote a passed or failed test case, respectively. Failed test cases also include
the expected output and the actual output produced by the stack. Finally, a link beneath the code panel on the right toggles the display of raw submissions, that is, the uncleaned and uncanonicalized code of each submission associated with the stack. Raw submissions include some small amount of metadata, but are otherwise unmodified from the student’s original submission (See Figure 2).
Figure 2: A correct stack with the corresponding raw submission displayed. The top panel, with syntax highlighting, is the code panel. The bottom panel is the raw submission. The dimmed lines of code in the code panel are shared between this stack and the previous stack, not shown here. The three comments at the top of the raw submission contain metadata added by the script that parses the CSV file of all student submissions. The rest of the raw submission is exactly as submitted by the student. The third line of metadata, grade, is the score that the student sees after clicking “Submit” on the MITx platform while taking the exam. In the residential course, the score is always 1.0, regardless of the correctness of a student’s code.
4.1 Stacks
A stack contains at least one cleaned and canonicalized student submission. An incorrect stack, indicated by code with a red background, always represents a single submission. A correct stack may represent multiple similar submissions grouped together. The process of cleaning, canonicalizing, and grouping submissions is described in Section 5. The number of submissions a stack contains appears beneath the code panel, in the link to toggle the display of raw submissions. If a stack contains multiple submissions, clicking this link causes all the associated raw submissions to appear, listed vertically. Grading a stack assigns the same score and comment to every submission contained in the stack.
4.2 Filtering
With the left-hand panel, graders can filter the displayed stacks based on error signature by selecting the checkboxes next to the desired rows. The additional checkbox next to the headings is a “select all” checkbox: selecting or clearing this checkbox automatically selects or clears the checkboxes for all error signatures. Another option allows toggling the display of previously graded stacks. The displayed stacks appear in an order that maximizes similarity between adjacent stacks, as described below.
4.3 Ordering
The display order of the stacks depends on a pairwise metric of similarity, described in Section 5. GroverCode finds the pair of stacks with the largest similarity and displays these as the first two stacks, arbitrarily selecting one of these as the first stack. It selects the third and all subsequent stacks by finding the remaining stack that is most similar to the previously chosen stack. Ordering stacks so that neighboring stacks are similar minimizes the cognitive load of moving between stacks.
4.4 Highlighting Differences Between Stacks
Similar to [3], GroverCode uses dimming to highlight differences between stacks. It compares each stack to its previous neighbor, unlike [3], which compares every stack to a single reference stack. Lines of code shared with the previous stack become dim, making differences between neighboring stacks more apparent (See Figure 2).

4.5 Grading
Each column in the stack display has space to enter a score and a comment for the stack. After a grader enters a score, the status of the stack changes to graded. GroverCode removes the label “Not Yet Graded” and updates the appropriate progress
bar in the filter pane. A grader can also enter a comment explaining the score. In addition to or instead of typing a comment manually, a grader can select items from the rubric dropdown menu (see Figure 3) to apply to the stack. A rubric item consists of a score delta and a description, e.g., “-1, does not handle empty lists.” In the dropdown menu, a checkbox appears next to each item. Selecting a checkbox adds text to the comment textbox.
A grader can also add new items to the rubric via a set of textboxes at the bottom of the dropdown menu. After entering a score delta and a description, clicking “Add” or pressing Enter adds the new item. New rubric items are immediately visible to all staff grading a particular problem. To delete a rubric item, a grader can click the X next to the item in the dropdown. This does not change the comments on previously graded stacks.
5 Implementation
GroverCode processes student submissions with a multi-stage pipeline. The system first cleans each submission, and executes it on a series of grader-supplied test cases using the Python execution logger described in [5]. GroverCode then canonicalizes these submissions using the results of the execution, and groups submissions into stacks. Each step of the pipeline is described in detail below.
1. Preprocess submissions. In the first stage of the pipeline, GroverCode cleans and executes student submissions as described below. Executing student submissions requires one or more test cases. Test cases must be supplied by the human grader in the form of a file with one test case per line. A test case consists most often of a single call to a student-defined function. However, it is not necessary to limit test cases to this format. To introduce more complicated test cases, a grader can define a set of test functions in a separate file.
a. Clean submissions. As in the original OverCode [3], GroverCode reformats submissions to ensure consistent line indentation and token spacing, and removes
comments. Although students often use comments to clarify their intent, in 6.0001, graders ignore such additional notes. Analyzing comments remains future work.
b. **Augment submissions.** GroverCode automatically appends any test case definitions that appear in a separate file to each student’s submission. The system also appends any additional code that a student’s submission relies on, such as the definition of a Python class of which the student created a subclass.
c. **Execute submissions.** GroverCode runs each submission through the Python execution logger described in [5], one time per test case. The names and values of each variable instance at every step in the execution are recorded in a data structure called a program trace, as in [3]. The execution logger generates one program trace for each test case. It also intercepts the submission’s `stdout` and records the submission’s output instead of printing it. Next, GroverCode serializes each program trace and intercepted output and writes it out to a pickle file. Because of this serialization step, analyzing additional submissions does not require rerunning any previously analyzed submission. This is particularly useful when applied to exam grading, where a small number of students could take a makeup exam at a later date.
2. **Extract variable sequences.** As in [3], for every submission, GroverCode extracts the sequence of values each variable instance takes on. A separate sequence of values is extracted for each test case. Additionally, in this step, GroverCode separates correct and incorrect submissions by comparing the intercepted output from each test case to the output of a supplied correct answer.
3. **Identify abstract variables in correct submissions.** GroverCode next analyzes the extracted sequences of values for each variable instance in every correct submission, and identifies all distinct abstract variables. Incorrect submissions are not considered here, because the values of variable instances in an incorrect submission are unreliable. For example, a submission may raise an exception after initializing
a local variable. The sequence of values of the variable instance in this case would contain just a single value.
4. **Rename abstract variables in correct submissions.** GroverCode assigns each abstract variable the name that it takes on most often across all program traces. If there is more than one abstract variable that takes on the same name, GroverCode adds a modifier to the variable that appears less frequently. This is what [3] calls a Common/Common collision. Instead of using letters as modifiers as in [3], GroverCode appends three underscores and a number; for example, changing the name of the second-most-common variable called `i` to `i___2` instead of `iB`. In the UI, these modifiers appear as subscripts, so `i___2` appears as `i_2`. Unlike in [3], abstract variables that appear in only a single submission are not treated as a special case.
5. **Analyze behavior of individual lines.** Next, GroverCode considers the behavior of both correct and incorrect submissions at the level of lines rather than variables. By analyzing the program trace and the AST, each line of code is split into three components:
1. A *template*, a string consisting of the text of the line of code with the variable names replaced with blanks.
2. An ordered list of variables, one per blank in the template. These may be either abstract variables or variable instances. The first variable belongs in the first blank in the template, the second variable in the second blank, etc.
3. An ordered list of the sequences of values that appear in each blank.
6. **Stack correct submissions.** GroverCode gathers together correct submissions into stacks as in [3], placing submissions into the same stack if they share a set of lines of code. Rather than comparing the literal string representation of each line, however, the system compares the line templates and the sequences of values each blank in the template takes on. GroverCode chooses one submission arbitrarily to represent the stack.
7. **Rename variable instances in incorrect submissions.** The next step canonicalizes incorrect submissions. GroverCode attempts to rename the variable instances in incorrect submissions so that they share the same namespace as correct submissions. In step 3, when the system identifies abstract variables, it is clear that all submissions in which those variables appear are functionally correct. However, when choosing names for incorrect variable instances, that assumption no longer holds, so name choice cannot depend solely on the values a variable instance takes on. There are several steps of the renaming process.
a. **Characterize behavior of variable instances and abstract variables.**
Step 5 identifies where variables appear in each line of code in each submission. For each abstract variable identified in step 3, GroverCode assembles a set of template-location pairs, that is, the set of templates in which the abstract variable appears and the location of that abstract variable in each template. The location is represented as the index or indices of the blank(s) occupied by that variable instance, as illustrated in the example below. The system repeats this process for each variable instance in each incorrect submission as well. This information about variable behavior is important for determining which abstract variable is the best match for each incorrect variable instance.
b. **Assign scores to template-location pairs.** GroverCode assigns to each template-location pair a score inversely proportional to the frequency with which it appears among abstract variables in correct submissions. This score calculation is $\log_2(1/p)$, where $p$ is the probability of a given template-location pair, i.e., the number of times that particular template-location pair appears across all abstract variables in correct submissions, divided by the total number of template-location pairs. A threshold calculation separates template-location pairs that appear in only one abstract variable from template-location pairs that appear in multiple abstract variables.
Example: All templates and locations in which the abstract variable `exp`, the second argument to a recursive `power` function, appears. A location represents the index or indices of the blanks that the abstract variable occupies, where the first blank is index 0, the second is index 1, and so on. The second and third columns together form a template-location pair.
<table>
<thead>
<tr>
<th>Example line of code</th>
<th>Template</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>def power(base, exp):</code></td>
<td><code>def power(_,__):</code></td>
<td>1</td>
</tr>
<tr>
<td><code>while index <= exp:</code></td>
<td><code>while ___<___:</code></td>
<td>1</td>
</tr>
<tr>
<td><code>return 1.0*base*power(base, exp-1)</code></td>
<td><code>return 1.0*___*power(__,___-1)</code></td>
<td>3</td>
</tr>
<tr>
<td><code>return base*power(base, exp-1)</code></td>
<td><code>return __*power(__,___-1)</code></td>
<td>2</td>
</tr>
<tr>
<td><code>return power(base, exp-1)*base</code></td>
<td><code>return power(__,___-1)*__</code></td>
<td>1</td>
</tr>
<tr>
<td><code>ans = base*power(base, exp-1)</code></td>
<td><code>__=__*power(__,___-1)</code></td>
<td>3</td>
</tr>
<tr>
<td><code>if exp <= 0:</code></td>
<td><code>if ___<=0:</code></td>
<td>0</td>
</tr>
<tr>
<td><code>if exp == 0:</code></td>
<td><code>if ___==0:</code></td>
<td>0</td>
</tr>
<tr>
<td><code>if exp >= 1:</code></td>
<td><code>if ___ >= 1:</code></td>
<td>0</td>
</tr>
<tr>
<td><code>assert type(exp) is int and exp >= 0</code></td>
<td><code>assert type(__) is int and __>=0</code></td>
<td>0, 1</td>
</tr>
</tbody>
</table>
c. Match incorrect variable instances to abstract variables. GroverCode then attempts to match each variable instance in an incorrect submission with an abstract variable. For each such variable instance, GroverCode searches for an abstract variable that fulfills one of two criteria. The system begins by looking for an abstract variable that fulfills the first criterion, and only moves on to the second if no such abstract variable is found. The criteria are as follows:
1. The abstract variable takes on an identical sequence of values to the variable instance in question. It is possible for parts of a program to be correct even if the overall output is incorrect, so it is important to consider this criterion first.
2. The abstract variable appears in an identical set of template-location pairs to the variable instance in question.
If such an abstract variable is found, GroverCode assigns the name of that abstract variable to the variable instance in question. Otherwise, GroverCode uses the scores
calculated in the previous step to estimate which abstract variable is the closest match for that variable instance. The overall score of the match between an abstract variable and a variable instance is defined as the sum of the individual scores of each template-location pair that is shared between the abstract variable and the variable instance. The closest match for the variable instance in question is the match that yields the highest overall score, with ties resolved arbitrarily. Another method of resolving ties, such as minimizing the string edit distance between the original name and the possible matches, could yield better results. This remains future work. If the overall score of the closest match is below the threshold found in the previous step, then it is not possible to unambiguously map the variable instance to a single abstract variable (see example below); in that case, GroverCode does not rename the variable instance, instead using the student’s original name. Otherwise, GroverCode assigns the name of the abstract variable in the closest match.
In all cases, if multiple variable instances in a single submission would be assigned the same name, the system appends a capital letter modifier to distinguish them.
**Example:** This is the recursive **power** problem. One submission includes a variable instance `ans`, shown in the table below. The first template-location pair does not appear in any abstract variables, so contributes nothing to the overall score. The second template-location pair, however, appears in two different abstract variables, so there is not enough information to determine which abstract variable name more closely matches the student’s intent. Do not rename this variable, but use the student’s original variable name.
<table>
<thead>
<tr>
<th>Line of code</th>
<th>Template</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ans = base**exp</code></td>
<td>___ ___</td>
<td>0</td>
</tr>
<tr>
<td><code>return ans</code></td>
<td><code>return _</code></td>
<td>0</td>
</tr>
</tbody>
</table>
8. **Find pairwise similarity between stacks.** Relevant submissions include the subset of correct submissions that are representatives of the stacks found in step 6, and every incorrect submission. These are the submissions that the view renders. For each relevant submission, GroverCode calculates a metric of similarity with each
other relevant submission, as follows:
\[
\frac{\text{# of shared phrases}}{\text{total number of phrases}} + \frac{\text{# of shared variable names}}{\text{total number of names}}
\]
Here, “shared phrases” and “shared variable names” mean phrases or variable names contained in both submissions, and “total” means the total across both submissions. A phrase is a line of code with all variables renamed as described above in step 4 or 7 as appropriate. Two identical submissions have a similarity metric of 1.0, while two submissions which share no variables or lines of code have a metric of 0.
6 Dataset
We evaluated the pipeline using data from the two field deployments (see Section 8). We obtained data from the spring 2016 semester of 6.0001, a residential introductory Python course, from both the midterm and the final exam for the course. Students submitted answers to three coding problems on the midterm and four on the final, described below. The number of submissions submitted for each problem appears in Figure 4. An example staff-written correct solution for each problem appears after its description.
6.1 Midterm Problems
- Question 4: power. Write a recursive function to calculate the exponential base to the power exp.
```python
def power(base, exp):
"""
base: int or float.
exp: int >= 0
returns: int or float, base^exp
"""
if exp <= 0:
return 1
return base * power(base, exp - 1)
```
• Question 5: give_and_take. Given a dictionary d and a list L, return a new dictionary that contains the keys of d. Map each key to its value in d plus one if the key is contained in L, and its value in d minus one if the key is not contained in L.
```python
def give_and_take(d, L):
for key in d:
if key in L:
new_dict[key] = d[key] + 1
else:
new_dict[key] = d[key] - 1
return new_dict
```
• Question 6: closest_power. Given an integer base and a target integer num, find the integer exponent that minimizes the difference between num and base to the power of exponent, choosing the smaller exponent in the case of a tie.
```python
def closest_power(base, n):
exp = 0
while True:
if base**exp >= n:
break
exp += 1
if abs(n - base**exp) >= abs(n - base**(exp - 1)):
return exp - 1
elif abs(n - base**exp) < abs(n - base**(exp - 1)):
return exp
```
6.2 Final Exam Problems
- Question 4: `deep_reverse`. Write a function that takes a list of lists of integers L, and reverses L and each element of L in place.
```python
def deep_reverse(L):
""" Assumes L is a list of lists whose elements are ints
Mutates L such that it reverses its elements and also
reverses the order of the int elements in every element of L.
It does not return anything.
""
L.reverse()
for subL in L:
subL.reverse()
```
- Question 5: `applyF_filterG`. Write a function that takes three arguments: a list of integers L, a function f that takes an integer and returns an integer, and a function g that takes an integer and returns a boolean. Remove elements from L such that for each remaining element i, \( f(g(i)) \) returns True. Return the largest element of the mutated list, or -1 if the list is empty after mutation.
```python
def applyF_filterG(L, f, g):
"""
Assumes L is a list of integers
Assume functions f and g are defined for you.
f takes an integer, applies a function, returns another integer
g takes an integer, applies a Boolean function,
returns either True or False
Mutates L such that, for each element i originally in L, L contains
i if g(f(i)) returns True, and no other elements
Returns the largest element in the mutated L or -1 if the list is empty
""
to_remove = []
for s in L:
if not g(f(s)):
to_remove.append(s)
for s in to_remove:
L.remove(s)
return max(L) if L != [] else -1
```
Question 6: MITCampus. Given the definitions of two classes: Location, which represents a two-dimensional coordinate point, and Campus, which represents a college campus centered at a particular Location, fill in several methods in the MITCampus class, a subclass of Campus that represents a college campus with tents at various Locations.
class MITCampus(Campus):
""" A MITCampus is a Campus that contains tents """
def __init__(self, center_loc, tent_loc = Location(0,0)):
""" Assumes center_loc and tent_loc are Location objects
Initializes a new Campus centered at location center_loc
with a tent at location tent_loc """
Campus.__init__(self, center_loc)
self.tents = [tent_loc]
def add_tent(self, new_tent_loc):
""" Assumes new_tent_loc is a Location
Adds new_tent_loc to the campus only if the tent is at least 0.5
distance away from all other tents already there. Campus is
unchanged otherwise. Returns True if it could add the tent, False
otherwise. """
for t in self.tents:
if t.dist_from(new_tent_loc) < 0.5:
return False
self.tents.append(new_tent_loc)
return True
def remove_tent(self, tent_loc):
""" Assumes tent_loc is a Location
Removes tent_loc from the campus.
Raises a ValueError if there is not a tent at tent_loc.
Does not return anything """
try:
self.tents.remove(tent_loc)
raise ValueError
def get_tents(self):
""" Returns a list of all tents on the campus. The list should contain
the string representation of the Location of a tent. The list should
be sorted by the x coordinate of the location. """
res = []
for t in self.tents:
res.append((t.getX(), t.getY()))
res.sort()
ans = []
for t in res:
ans.append(str( Location(t[0], t[1]) ))
return ans
• Question 7: `longest_run`. Write a function that takes a list of integers \( L \), finds the longest run of either monotonically increasing or monotonically decreasing integers in \( L \), and returns the sum of this run.
```python
def longest_run(L):
"""
Assumes \( L \) is a list of integers containing at least 2 elements.
Finds the longest run of numbers in \( L \), where the longest run can
either be monotonically increasing or monotonically decreasing.
In case of a tie for the longest run, choose the longest run
that occurs first.
Does not modify the list.
Returns the sum of the longest run.
"""
def get_sublists(L, n):
result = []
for i in range(len(L)-n+1):
result.append(L[i:i+n])
return result
for i in range(len(L), 0, -1):
possibles = get_sublists(L, i)
for p in possibles:
if p == sorted(p) or p == sorted(p, reverse=True):
return sum(p)
```
<table>
<thead>
<tr>
<th>Problem</th>
<th>Number of submissions</th>
</tr>
</thead>
<tbody>
<tr>
<td>power</td>
<td>193</td>
</tr>
<tr>
<td>give_and_take</td>
<td>193</td>
</tr>
<tr>
<td>closest_power</td>
<td>193</td>
</tr>
<tr>
<td>deep_reverse</td>
<td>175</td>
</tr>
<tr>
<td>applyF_filterG</td>
<td>173</td>
</tr>
<tr>
<td>MITCampus</td>
<td>170</td>
</tr>
<tr>
<td>longest_run</td>
<td>165</td>
</tr>
</tbody>
</table>
Figure 4: Number of submissions for each problem in the dataset. Several students dropped the course between the midterm and the final exam. The decreasing number of submissions for each final exam question occurred because some students ran out of time before they could submit answers to the later problems.
7 Pipeline Evaluation
The GroverCode pipeline cannot process every student submission. The execution logger cannot handle submissions that contain syntax errors or that use too much memory, for example by calling `range` with a very large value. As shown below, the
pipeline does process most student submissions, although longer submissions are less likely to succeed.
<table>
<thead>
<tr>
<th>Quiz</th>
<th>Final</th>
</tr>
</thead>
<tbody>
<tr>
<td>q4</td>
<td>q5</td>
</tr>
<tr>
<td>193</td>
<td>193</td>
</tr>
<tr>
<td>9.9</td>
<td>16.9</td>
</tr>
<tr>
<td>186</td>
<td>189</td>
</tr>
<tr>
<td>(96%)</td>
<td>(98%)</td>
</tr>
</tbody>
</table>
Exam questions increased in difficulty between the midterm and the final and between the beginning and end of each exam. With an increase in difficulty, the number of correct submissions that can be grouped together in stacks decreases. The pipeline’s ability to analyze incorrect submissions thus becomes more important for harder problems. The table below shows the number and percentage of submissions marked correct by the autograder, that is, submissions that pass every test case. It also shows the number of test cases, and the number of distinct error signatures, where an error signature is the number and order of test cases passed for a particular submission. The last row of the table displays the number of submissions that are grouped into stacks containing more than one submission.
<table>
<thead>
<tr>
<th>Quiz</th>
<th>Final</th>
</tr>
</thead>
<tbody>
<tr>
<td>q4</td>
<td>q5</td>
</tr>
<tr>
<td>182</td>
<td>160</td>
</tr>
<tr>
<td>(94%)</td>
<td>(82%)</td>
</tr>
<tr>
<td>4</td>
<td>29</td>
</tr>
<tr>
<td>10</td>
<td>15</td>
</tr>
<tr>
<td>6</td>
<td>16</td>
</tr>
<tr>
<td>40</td>
<td>84</td>
</tr>
<tr>
<td>13</td>
<td>18</td>
</tr>
<tr>
<td>151</td>
<td>94</td>
</tr>
</tbody>
</table>
GroverCode identifies abstract variables in correct submissions by comparing the
sequences of values they take on, as described in Section 5. The number of variable instances across all submissions and the number of abstract variables across correct submissions appear below.
<table>
<thead>
<tr>
<th></th>
<th>Quiz</th>
<th>Final</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>q4</td>
<td>q5</td>
</tr>
<tr>
<td>Total number of variable instances</td>
<td>388</td>
<td>857</td>
</tr>
<tr>
<td>Number of variable instances in correct solutions</td>
<td>373</td>
<td>708</td>
</tr>
<tr>
<td>Number abstract variables</td>
<td>21</td>
<td>36</td>
</tr>
<tr>
<td>Number of name clashes resolved when renaming abstract variables</td>
<td>11</td>
<td>9</td>
</tr>
</tbody>
</table>
GroverCode manages to rename many of the variable instances in incorrect solutions. See Section 5 for more detail about this renaming process. The table below shows the number of variables renamed in this fashion as well.
<table>
<thead>
<tr>
<th></th>
<th>Quiz</th>
<th>Final</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>q4</td>
<td>q5</td>
</tr>
<tr>
<td>Number of variable instances in incorrect submissions</td>
<td>15</td>
<td>149</td>
</tr>
<tr>
<td>Number of variable instances renamed based on values</td>
<td>14</td>
<td>84</td>
</tr>
<tr>
<td>Number of variable instances renamed based on templates</td>
<td>0</td>
<td>58</td>
</tr>
<tr>
<td>Number of variable instances not renamed</td>
<td>1</td>
<td>7</td>
</tr>
<tr>
<td>Number of name clashes resolved when renaming variable instances</td>
<td>0</td>
<td>13</td>
</tr>
</tbody>
</table>
7.1 Limitations
The GroverCode pipeline handles simple Python programs. Stacking correct submissions becomes much less effective on more complicated problems, as shown by the small number of stacked submissions in the later problems. Python classes pose additional problems. The execution logger [5] does not include information about instance variables in the generated trace, which makes renaming these variables impossible within the current pipeline architecture. Although Question 6 on the final exam involves classes, exploring how non-primitive variable values affect the renaming process remains future work.
8 Field Deployments
The teaching staff of 6.0001, an introductory residential Python programming class, used GroverCode as a tool to help with grading the course’s two exams: midterm and final. Approximately 100-200 students take this course each semester. Each exam has two components: a paper portion with multiple choice and short answer questions, and an online portion where students submit code via the MITx platform. GroverCode deals only with the online portion. The online portion of the midterm has three problems, and the final exam has four (see Section 6). After each exam, an instructor extracts all student submissions in CSV format. Course staff grade student submissions by hand, assisted by a set of unit tests for each problem. The 6.0001 members of the teaching staff who participated in the field deployments included one professor, seven graduate student Teaching Assistants (TAs) including the author, and one undergraduate TA. The goal was to reduce the burden of hand-grading student code submissions.
8.1 Usual Grading Method
Course staff gather together in a conference room several days after an exam to assign grades. One staff member grades the paper component, while the remaining
staff grade the online component. The staff grading the online portion split into small groups of two or three, and each group chooses a problem to grade. Staff use a Google spreadsheet to record grades. They assign grades by examining the the CSV of all student submissions in a text editor such as Sublime Text, and by copying and pasting individual students’ submissions into MITx to view unit test output. A rubric for each problem, recorded either at the top of the spreadsheet of grades or in a separate document, builds up incrementally. Assigning grades to all of the submissions is a long and exhausting process, often taking from five to eight hours.
8.2 First Field Deployment: Midterm exam
193 students submitted code for the online portion of the midterm, which consisted of three problems.
Preparation. The day after the exam, an instructor exported student submissions in CSV format from MITx. In preparation for the field deployment, we parsed the CSV and ran the resulting submissions through the GroverCode pipeline, and created three instances of GroverCode, one for each question. This allowed setting of question-specific parameters, such as the location from which to read submission data.
Interface. This field deployment used a prototype interface which more closely resembles the original OverCode interface described in [3] (see Figure 5). In this interface, stacks display in two columns, with correct stacks on the right and incorrect stacks on the left. Users can designate a single stack as the pinned stack. All other stacks display in order of decreasing similarity with the pinned stack. For each other stack, lines of code that share stacks with the pinned stack become dim to highlight differences between them. It is possible to change the pinned stack any time.
Training. Course staff received an overview of the GroverCode user interface the week before the field deployment, including the concepts of stacks, raw submissions, and pinning, followed by a brief refresher on the morning of the field deployment.
Process. At the start of the grading process, staff divided into groups of two or three, and each group claimed a problem to grade (see Section 6 for problem descriptions). All groups assigned to a particular problem began by looking at submissions
together and reaching a consensus on what score to assign. Staff began by examining the submissions marked as correct by an autograder. Most submissions that passed every test case received full credit; however, in some cases points were deducted. For example, for midterm Question 4, students needed to implement a recursive function; however, some students submitted iterative solutions. For each error, staff discussed how many points to deduct, and added a new item to the built-in rubric. After grading a few submissions, groups divided up the remaining submissions and began working independently. To avoid duplicating work, groups either pinned different submissions, or pinned the same submission and had one group grade starting from the top and another starting from the bottom. Some groups used the pinning function often; however, several staff expressed displeasure with the amount of time it took the interface to update after pinning a new submission. Staff members also requested the ability to see specific tests cases and their output within the GroverCode interface, instead of relying on the MITx platform for test results. Extensive interface updates made between the first and second field deployments addressed these concerns.
GroverCode writes a log entry after each change to a grade or comment. The entry includes a timestamp, the ID of the associated submission, and the contents of the grade and comment fields for that submission. Each question has a separate log. The amount of time spent grading each question is shown in Figure 6. Very early in the process of grading Question 6, after grading only two submissions, staff discovered a discrepancy between the number of failed test cases reported by GroverCode and by MITx. Staff eventually found the problem: an error in the test suite used by MITx. However, while resolving the discrepancy, no grading took place for Question 6. After applying a fix, staff regraded the two early submissions.
<table>
<thead>
<tr>
<th>Problem</th>
<th>Timestamp of first logged event</th>
<th>Timestamp of last logged event</th>
<th>Approximate time to grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>Question 4: power</td>
<td>9:21</td>
<td>9:45</td>
<td>0h 24m</td>
</tr>
<tr>
<td>Question 5: give_and_take</td>
<td>9:46</td>
<td>11:05</td>
<td>1h 19m</td>
</tr>
<tr>
<td>Question 6: closest_power</td>
<td>10:35 *</td>
<td>13:52</td>
<td>3h 17m</td>
</tr>
</tbody>
</table>
Figure 6: Approximate time to grade each of the three midterm questions. Currently, GroverCode does not log the time when staff begin looking at a particular problem, so there is no record of the length of discussion time before the first logged event. The cell marked with an asterisk indicates the timestamp of the first event after the discrepancy between GroverCode and MITx was resolved.
8.3 Second Field Deployment: Final Exam
175 students submitted submissions to the coding portion of the final exam, which consisted of four problems. Preparation for this field deployment was the same as for the first field deployment (see Section 8.2).
*Interface.* Between the two field deployments, there was significant overhaul to the GroverCode interface. For a description of the final interface, see Section 4.
*Training.* On the morning of the field deployment, staff received a brief explanation of the differences between the old user interface and the new user interface.
*Process.* As in the first field deployment, grading staff divided into small groups. Question 4 was set aside for an absent staff member, but picked up later in the day by a different TA. Again, each group independently decided to start by grading submissions.
that passed every test case. Figure 7 shows a scatterplot of each logged event versus the number of test cases the associated submission passed. The grading staff used the filters extensively. Each small group selected a single error signature to view and graded every submission with that error signature before selecting a new signature. When viewing an error signature with many submissions, groups often graded the first few submissions together, then split up to grade the rest individually. A common approach involved one staff member starting from the first displayed submission while another started from the last displayed submission, consulting each other as necessary if they encountered a novel error.
The method of choosing the next error signature to grade varied from group to group. The staff grading Question 5, for example, graded error signatures with the most submissions first, then worked in descending order ending with submissions with unique error signatures (see Figure 8). In contrast, the staff grading Question 4 proceeded in order of most test cases passed to fewest test cases passed. In addition, some staff members switched from grading submissions which passed few test cases to submissions which passed many submissions to reduce the monotony of grading. Staff also made heavy use of the built-in rubric, adding deductions whenever they encountered a new mistake. Unfortunately, they encountered a bug in the rubric infrastructure for Question 7 which caused previously-added deductions to sometimes disappear.
When staff finished grading all submissions for a particular question, they switched to a different question. For example, staff finished grading Question 5 at approximately 12:30, and then moved to Question 7. This led to many staff members working on a single question. As Question 7 was the hardest to grade, most staff members ended up working on this question. To split up the work, some staff members graded error signatures in ascending order of number of test cases passed while others graded in descending order. This can be seen by the triangular structure of the plot in Figure 7.
These results show two styles of grading supported by the GroverCode interface: grading in order of number of test cases passed and grading in order of number of
submissions that passed the same test cases.
9 User Feedback
We interviewed six of the eight grading staff (not including the author) to get their high-level opinions about GroverCode and its features. Questions to staff included what they liked about using GroverCode, what they did not like, and what suggestions or feature requests, if any, they had for the future. Staff also answered questions about several specific features of the GroverCode interface: variable renaming, highlighting differences between neighboring stacks, filtering stacks by error signature, and displaying test case results underneath the associated code. Finally, staff members with prior grading experience commented on the differences between grading using GroverCode and the old method of grading using a CSV and a spreadsheet. Responses were very positive overall, with mixed reactions to various features. In general, staff thought that GroverCode gave them more control over the grading process and increased consistency while grading. Staff found GroverCode most useful when grading simple problems. Three of the six respondents remarked that they would like to continue using GroverCode in the future.
9.1 Responses to specific features
*Horizontal alignment.* Four of the six respondents offered positive opinions, without prompting, about the horizontal alignment of submissions. They found that comparing submissions and test case output was easier in the horizontal display than the vertical display.
*Built-in rubric.* Similarly, five of the six respondents mentioned that they liked the rubric feature, despite some confusion over the bug described in Section 8. One respondent remarked that it increased her self-consistency. Another found it useful for double-checking scores before entering them. However, a third respondent mentioned that although she found the rubric useful at the beginning of grading a particular problem, eventually the rubric became so full that it was easier to simply
Figure 7: Grading events versus test cases passed. In each plot, the scatterplot on the left plots the time when grade or comment changed versus the number of test cases the associated stack passed. The bar chart on the right shows the number of stacks that passed that many test cases. The plots make no distinction between different error signatures that passed the same number of test cases.
(a) Question 4. The TA assigned to this question stopped working at about 12:40 because of another commitment, and resumed grading at about 15:15. The densely clustered group of points from 15:15 to about 15:30 shows the relative ease of grading submissions marked correct compared to those marked incorrect. Additional staff members began grading at approximately 17:30, which explains the increased density after that point.
(b) Question 5. These results show an alternate grading strategy. Rather than choosing a group of submissions to grade based on the number of test cases passed, staff members chose the group containing the most submissions. See Figure 8b.
(c) Question 6.
(d) Question 7. A large number of submissions fail every test case. Many such submissions nevertheless show a minimal understanding of the material and so deserve a non-zero score. See Figure 9.
Figure 8: Grading events versus size of group. In each plot, the scatterplot on the left plots the time at which a grade or comment changed versus the number of stacks sharing an error signature with the associated stack. The bar chart on the right shows the number of stacks in groups of that size.
Figure 9: These plots graph the number of test cases each stack passed versus the score assigned by teaching staff. An autograder would assign the same score to every submission that passed the same number of test cases. These plots illustrate the importance of manually grading submissions.
Question 6
Assigned grade vs. Number of test cases passed
(c)
Question 7
Assigned grade vs. Number of test cases passed
(d)
type comments manually rather than searching for particular items in the rubric.
**Progress bars.** Three of the six respondents expressed appreciation for the progress bars. One called this feature a “motivating factor.”
**Filtering stacks by error signature.** This feature was absent during the first field deployment, but added by request for the second field deployment. After the second field deployment, three of the six respondents found the ability to filter by error signature helpful. The other three thought that this ability was useful in theory, but did not help them during grading because there were too many submissions with unique error signatures. However, all six respondents remarked that grouping together stacks with the same error signature made grading the whole group relatively easy, since such stacks often made the same mistake. One respondent cited this feature as a major advantage over the old method of grading submissions in a CSV file and a spreadsheet, saying that it “gave grading structure.” Additionally, she reported that it eliminated a common source of frustration, where a grader encountered a submission similar to a previously graded one but could not remember what deductions applied to the previous submission. Interestingly, one respondent remarked that he associated certain failed test cases with specific mistakes, and could therefore use the error signature as “a sort of visual hash.” Another respondent said exactly the opposite: she did not associate particular error signatures with specific mistakes, so the visual representation of error signatures was not especially helpful.
**Renaming variables.** Respondents had mixed reactions to this feature. Five of the six respondents expressed frustration with certain variable names chosen by GroverCode, particularly names featuring subscripts. They reported that submissions with several renamed variables became less readable. Some respondents resorted to looking at the raw submissions rather than the canonicalized code for such examples. However, one of these respondents also said that she found variable renaming useful when the names were not confusing, since it increased consistency across submissions. A different respondent remarked that he initially forgot about the variable renaming and consequently wondered why all students seemed to choose the same names for their variables. He reported that after he remembered, he did not notice the vari-
able renaming while grading unless a name was particularly confusing. However, in retrospect, he thinks the feature was helpful.
*Difference highlighting.* One respondent said that he found this feature very helpful because it was easier to compare submissions. The other respondents reported that they either did not notice this feature or were indifferent to it.
### 9.2 Frustrations
Each respondent expressed frustration with one or two aspects of GroverCode, although there were several overlapping opinions. As mentioned in Section 9.1, respondents did not like grading submissions that contained several variable names with subscripts. An additional unpopular aspect of variable renaming was GroverCode’s occasional renaming of the arguments of a function. Finally, four of the six respondents remarked that loading submissions and scrolling the view was occasionally too slow.
### 9.3 Comparison to Previous Grading Tools
Three of the six respondents had previous grading experience. All three preferred GroverCode to grading with a CSV file and a spreadsheet. These respondents all commented that they appreciated the ability to look at student code and test case results as well as enter grades via one unified interface. One respondent remarked that despite the frustrations mentioned in Section 9.2, “[Gr]overCode is already a huge improvement over the primitive tools [we used before].”
Two of the remaining respondents had no prior experience grading, but graded a small number of submissions using a CSV file during the field deployments, since GroverCode could not run every student’s code. One of these respondents remarked that based on this small experience, he thought that the old method of grading would be “much more time consuming.” The other respondent expressed concern about the prospect of grading using a CSV file and a spreadsheet in the future, and remarked, “I’ve never graded the old way, but I like [Gr]overCode.”
9.4 Suggestions
Respondents offered several suggestions for features they would like to see in the future. These include activity indicators that show when a submission is being actively graded, automatic calculation of a submission’s score based on the associated rubric items, the ability to add test cases on the fly, an integrated console for rerunning submissions on user-specified inputs, the ability to reorder rubric items, the ability to filter submissions based on particular rubric items, and syntax highlighting that more closely resembles other familiar tools such as IDLE or the Sublime Text editor.
10 Discussion
The two field deployments described in Section 8 demonstrate GroverCode’s usefulness in a residential course. In general, the staff of 6.0001 found GroverCode helpful during the grading process. However, GroverCode is more useful when grading simple problems than when grading complex problems. As shown in Section 7, as problems get more complex, fewer students submit correct answers, and fewer submissions are grouped together into stacks. Staff found grading incorrect submissions, especially submissions that failed every test case, much more difficult than grading correct submissions. The canonicalization of incorrect submissions sometimes contributed to this difficulty, as staff often had trouble reading code that contained subscripts. Future work to increase the readability of such submissions would be very beneficial.
Staff also expressed frustration with the speed and responsiveness of the GroverCode user interface. We did not focus on these aspects in our implementation, however they are both important considerations that should not be neglected in future work. One staff member remarked, “I get impatient when grading,” illustrating that speed is indeed a concern.
During the second field deployment in particular (see Section 8.3), a great deal of time was spent grading the last, most complex question. Although the increased readability mentioned above would be helpful, more investigation may suggest further ways to reduce the time required to grade such questions. Improving GroverCode’s
usefulness for complex problems would be a worthwhile effort. A staff member expressed a similar sentiment, saying, “If you can perfect the more complicated problems it would be a really awesome tool, and it was a really awesome tool for more simple things.”
11 Future Work
The goal of GroverCode was assisting graders of coding questions in an introductory programming course. Although course staff found GroverCode helpful, further iteration of the user interface would improve the grader experience. Features that improve the efficiency of grading would be especially helpful, such as the ability to assign a grade to multiple similar submissions simultaneously, or the ability to copy-and-paste a comment from a previously graded submission.
The problems tested with GroverCode ranged from simple to complex. Teaching staff found that for hard problems, GroverCode’s attempts to increase the similarity of submissions did not reduce the cognitive load of debugging as much as they had hoped. The GroverCode pipeline would benefit from additional support for complex problems, especially problems involving classes.
GroverCode could make use of more advanced clustering algorithms and other methods from the Machine Learning domain. The ability to learn metrics of similarity between submissions rather than using empirically determined heuristics could be very powerful for clustering submissions. This ability could also be helpful for finding correct submissions that resemble incorrect submissions to help graders pinpoint errors. If GroverCode could learn which rubric items are associated with certain lines of code or other program features, it could suggest rubric items during grading.
GroverCode could also benefit from integrating with automated hint generation tools, such as those discussed in Section 2. Currently, graders find debugging incorrect student submissions the most time-consuming and difficult part of grading exams. Offloading at least some of the burden of debugging to automated tools would save teaching staff a great deal of time and effort.
Finally, several possible avenues of future work suggested in [3] but not yet implemented could be explored. These include expanding OverCode to other programming languages besides Python, integrating OverCode with an autograder such as that used by the MITx platform, and adjusting the OverCode interface to provide benefit to students as well as staff.
12 Conclusion
The original OverCode system described in [3] is novel because it canonicalizes student code to increase human readability. We expand GroverCode to accommodate submissions marked incorrect by an autograder, and to canonicalize such submissions in a similar fashion. We also add interface features for grading submissions. A group of residential instructors found GroverCode a helpful tool for grading exams. We hope GroverCode will continue to provide benefit to residential course staff in the future.
Bibliography
|
{"Source-Url": "http://dspace.mit.edu/bitstream/handle/1721.1/106381/967657961-MIT.pdf?sequence=1", "len_cl100k_base": 15111, "olmocr-version": "0.1.50", "pdf-total-pages": 51, "total-fallback-pages": 0, "total-input-tokens": 85178, "total-output-tokens": 17491, "length": "2e13", "weborganizer": {"__label__adult": 0.000568389892578125, "__label__art_design": 0.0013294219970703125, "__label__crime_law": 0.0003769397735595703, "__label__education_jobs": 0.0980224609375, "__label__entertainment": 0.00022077560424804688, "__label__fashion_beauty": 0.0003669261932373047, "__label__finance_business": 0.000972270965576172, "__label__food_dining": 0.0007309913635253906, "__label__games": 0.0010786056518554688, "__label__hardware": 0.0011358261108398438, "__label__health": 0.0005850791931152344, "__label__history": 0.0006389617919921875, "__label__home_hobbies": 0.00030350685119628906, "__label__industrial": 0.0007309913635253906, "__label__literature": 0.0007991790771484375, "__label__politics": 0.000530242919921875, "__label__religion": 0.0008368492126464844, "__label__science_tech": 0.0219573974609375, "__label__social_life": 0.0004911422729492188, "__label__software": 0.0200347900390625, "__label__software_dev": 0.8466796875, "__label__sports_fitness": 0.0004143714904785156, "__label__transportation": 0.0008420944213867188, "__label__travel": 0.0004432201385498047}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 74214, 0.03309]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 74214, 0.46088]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 74214, 0.91315]], "google_gemma-3-12b-it_contains_pii": [[0, 1044, false], [1044, 1044, null], [1044, 1842, null], [1842, 1842, null], [1842, 3585, null], [3585, 3585, null], [3585, 5248, null], [5248, 5750, null], [5750, 8045, null], [8045, 10304, null], [10304, 12033, null], [12033, 14162, null], [14162, 16266, null], [16266, 18157, null], [18157, 18970, null], [18970, 21117, null], [21117, 22250, null], [22250, 24010, null], [24010, 24862, null], [24862, 26869, null], [26869, 28987, null], [28987, 30992, null], [30992, 33086, null], [33086, 35157, null], [35157, 37459, null], [37459, 38910, null], [38910, 39870, null], [39870, 41424, null], [41424, 43414, null], [43414, 45405, null], [45405, 47244, null], [47244, 48965, null], [48965, 50799, null], [50799, 53102, null], [53102, 54352, null], [54352, 56940, null], [56940, 59243, null], [59243, 61237, null], [61237, 62300, null], [62300, 62512, null], [62512, 62812, null], [62812, 62812, null], [62812, 63104, null], [63104, 63233, null], [63233, 65700, null], [65700, 67653, null], [67653, 69802, null], [69802, 71883, null], [71883, 72757, null], [72757, 72757, null], [72757, 74214, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1044, true], [1044, 1044, null], [1044, 1842, null], [1842, 1842, null], [1842, 3585, null], [3585, 3585, null], [3585, 5248, null], [5248, 5750, null], [5750, 8045, null], [8045, 10304, null], [10304, 12033, null], [12033, 14162, null], [14162, 16266, null], [16266, 18157, null], [18157, 18970, null], [18970, 21117, null], [21117, 22250, null], [22250, 24010, null], [24010, 24862, null], [24862, 26869, null], [26869, 28987, null], [28987, 30992, null], [30992, 33086, null], [33086, 35157, null], [35157, 37459, null], [37459, 38910, null], [38910, 39870, null], [39870, 41424, null], [41424, 43414, null], [43414, 45405, null], [45405, 47244, null], [47244, 48965, null], [48965, 50799, null], [50799, 53102, null], [53102, 54352, null], [54352, 56940, null], [56940, 59243, null], [59243, 61237, null], [61237, 62300, null], [62300, 62512, null], [62512, 62812, null], [62812, 62812, null], [62812, 63104, null], [63104, 63233, null], [63233, 65700, null], [65700, 67653, null], [67653, 69802, null], [69802, 71883, null], [71883, 72757, null], [72757, 72757, null], [72757, 74214, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 74214, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 74214, null]], "pdf_page_numbers": [[0, 1044, 1], [1044, 1044, 2], [1044, 1842, 3], [1842, 1842, 4], [1842, 3585, 5], [3585, 3585, 6], [3585, 5248, 7], [5248, 5750, 8], [5750, 8045, 9], [8045, 10304, 10], [10304, 12033, 11], [12033, 14162, 12], [14162, 16266, 13], [16266, 18157, 14], [18157, 18970, 15], [18970, 21117, 16], [21117, 22250, 17], [22250, 24010, 18], [24010, 24862, 19], [24862, 26869, 20], [26869, 28987, 21], [28987, 30992, 22], [30992, 33086, 23], [33086, 35157, 24], [35157, 37459, 25], [37459, 38910, 26], [38910, 39870, 27], [39870, 41424, 28], [41424, 43414, 29], [43414, 45405, 30], [45405, 47244, 31], [47244, 48965, 32], [48965, 50799, 33], [50799, 53102, 34], [53102, 54352, 35], [54352, 56940, 36], [56940, 59243, 37], [59243, 61237, 38], [61237, 62300, 39], [62300, 62512, 40], [62512, 62812, 41], [62812, 62812, 42], [62812, 63104, 43], [63104, 63233, 44], [63233, 65700, 45], [65700, 67653, 46], [67653, 69802, 47], [69802, 71883, 48], [71883, 72757, 49], [72757, 72757, 50], [72757, 74214, 51]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 74214, 0.16401]]}
|
olmocr_science_pdfs
|
2024-11-28
|
2024-11-28
|
11c6c98c8f07026d11053fe7e7ee3819e23dd0e8
|
INFORMIX-4GL
Quick Syntax
INFORMIX-4GL
Quick Syntax
Introduction 5
Syntax Conventions 6
Basics 9
Data Types 10
4GL Arithmetic Operators 10
Boolean Operators 10
4GL Relational Operators 10
Global Constants and Variables 11
Built-In Functions 11
Operators 11
Library Functions 12
Display Attributes 15
Command-Line Syntax 16
4GL Statements 19
Types of SQL Statements 20
Other Types of 4GL Statements 21
4GL Statement Segments 37
4GL Forms 47
Form Specification Syntax 48
Attributes 50
Reports 55
Report Specification Syntax 56
Report Execution Statements 59
SQL Statements 61
SQL Segments 91
Stored Procedure Language Statements 105
<table>
<thead>
<tr>
<th>Section</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>SQLCA Record</td>
<td>113</td>
</tr>
<tr>
<td>Interactive Debugger Commands</td>
<td>117</td>
</tr>
<tr>
<td>Command-Line Syntax</td>
<td>119</td>
</tr>
<tr>
<td>4GL Interactive Debugger Command Segments</td>
<td>126</td>
</tr>
<tr>
<td>Environment Variables</td>
<td>129</td>
</tr>
<tr>
<td>Default Key Assignments</td>
<td>133</td>
</tr>
</tbody>
</table>
Introduction
This Guide presents a quick reference to the material listed in the following table. For a full discussion of each topic, refer to the corresponding documentation.
<table>
<thead>
<tr>
<th>Topic</th>
<th>Reference Documentation</th>
<th>Section</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data types</td>
<td>INFORMIX-4GL Reference</td>
<td>Chapter 3</td>
</tr>
<tr>
<td>Built-in functions and operators</td>
<td>INFORMIX-4GL Reference</td>
<td>Chapter 4</td>
</tr>
<tr>
<td>4GL statements</td>
<td>INFORMIX-4GL Reference</td>
<td>Chapter 3</td>
</tr>
<tr>
<td>SQL statements</td>
<td>Informix Guide to SQL: Reference</td>
<td>Chapter 6</td>
</tr>
<tr>
<td></td>
<td>Informix Guide to SQL: Syntax, Version 6.0</td>
<td></td>
</tr>
<tr>
<td>4.1 servers:</td>
<td></td>
<td></td>
</tr>
<tr>
<td>6.0 servers:</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Stored Procedure Language (SPL)</td>
<td>Informix Guide to SQL: Syntax, Version 6.0</td>
<td>Chapter 2</td>
</tr>
<tr>
<td>6.0 servers:</td>
<td></td>
<td></td>
</tr>
<tr>
<td>4GL forms</td>
<td>INFORMIX-4GL Reference</td>
<td>Chapter 5</td>
</tr>
<tr>
<td>Reports</td>
<td>INFORMIX-4GL Reference</td>
<td>Chapter 6</td>
</tr>
<tr>
<td>SQLCA record structure</td>
<td>INFORMIX-4GL Reference</td>
<td>Chapter 2</td>
</tr>
<tr>
<td>NewEra Debugger commands</td>
<td>Guide to the INFORMIX-4GL Interactive Debugger</td>
<td>Chapter 9</td>
</tr>
<tr>
<td>Environment variables</td>
<td>INFORMIX-4GL Reference</td>
<td>Appendix D</td>
</tr>
</tbody>
</table>
This Guide shows syntax that must be prepared before you can include it in a 4GL program. You must prepare any SQL statement introduced later than the 4.1 server release. These statements are indicated in this manual by the following icon:
6.0
To use these statements, such as CREATE TRIGGER, you must:
1. Store the SQL statement as a character string.
2. Set up the statement for execution by means of the PREPARE statement (see page 79).
3. Process the statement by means of the EXECUTE statement (see page 75).
Syntax diagrams describe the format of SQL, SPL, and 4GL statements and Debugger commands, including alternative forms of them, required and optional parts of them, and so forth. Syntax diagrams have their own conventions, which are defined in detail and illustrated in this section.
Each syntax diagram displays the sequences of required and optional elements that are valid in a statement or command. Briefly:
- All keywords are shown in uppercase letters for ease of identification, though you need not enter them that way.
- Words for which you must supply values are in italics.
- All boldface characters are literals.
Each diagram begins at the upper left with a keyword and ends at the upper right with a vertical line. Between these points, you can trace any path that does not stop or back up. Each path describes a valid form of the statement. Except for separators in loops (see page 8), which the path approaches counterclockwise from the right, the path always approaches elements from the left and continues to the right.
Along a path, you may encounter the following elements:
**KEYWORD** You must spell a word in uppercase letters exactly as shown; however, you can use either uppercase or lowercase letters when you enter it.
`(;+)` All other characters are literal symbols that you must enter exactly as shown.
' ' Single and double quotes are literal symbols that you must enter as shown.
**variable** A word in italics represents a value that you must supply. The nature of the value is explained fully in the appropriate reference manual.
A reference in a box represents a subdiagram on the same page (if no page number is supplied) or on a specified page. Imagine that the subdiagram is spliced into the diagram at this point. (A synonym for “subdiagram” is “segment.”)
If the term “(subset)” appears in the box below the name of the segment being referenced, you should refer to the appropriate reference manual for further clarification.
The aspect ratio of the box is not significant. That is, the same segment can be represented by boxes of different shapes, as in these symbols for the Named Value segment.
A code in an icon is a signal warning you that this path is valid only for certain database servers or under certain conditions. The codes indicate the products or conditions that support the path. The following codes are used:
- **6.0** Path requires the statement to be prepared (by using PREPARE).
- **SE** Path is valid only for INFORMIX-SE.
- **OL** Path is valid only for INFORMIX-OnLine Dynamic Server.
- **+** Path is an Informix extension to ANSI standard SQL.
- **NLS** Path is valid only if you are using NLS.
Syntax Conventions
A shaded option is the default. Even if you do not explicitly type the option, it will be in effect unless you choose another option.
Syntax enclosed in a pair of arrows indicates that this is a subdiagram.
The vertical line is a terminator and indicates that the statement is complete.
A branch below the main line indicates an optional path.
A loop indicates a path that can be repeated. Punctuation included in the loop indicates the separator symbol for items in a list; when no symbol is shown in the loop, as in the example below, a blank space or LINEFEED is the separator.
A gate (__) in an option indicates that you can only use that option the number of times indicated, even though it is within a larger loop.
The grey labels and arrows in the following illustration identify the elements of a syntax diagram for the INITIALIZE statement of 4GL.
---
Elements of a syntax diagram
Basics
Data Types
<table>
<thead>
<tr>
<th>Data Type</th>
<th>Kind of Values Stored</th>
</tr>
</thead>
<tbody>
<tr>
<td>ARRAY OF type</td>
<td>Arrays of values of any other single data type.</td>
</tr>
<tr>
<td>^BYTE</td>
<td>Any kind of binary data.</td>
</tr>
<tr>
<td>CHAR</td>
<td>Character strings of up to 32,767 ASCII characters.</td>
</tr>
<tr>
<td>CHARACTER</td>
<td>(This keyword is a synonym for CHAR.)</td>
</tr>
<tr>
<td>DATE</td>
<td>Points in time, specified as calendar dates.</td>
</tr>
<tr>
<td>DATETIME</td>
<td>Points in time, specified as calendar dates and time-of-day.</td>
</tr>
<tr>
<td>DEC</td>
<td>(This keyword is a synonym for DECIMAL.)</td>
</tr>
<tr>
<td>DECIMAL</td>
<td>Fixed point numbers, of a specified scale and precision.</td>
</tr>
<tr>
<td>DOUBLE PRECISION</td>
<td>(These keywords are a synonym for FLOAT.)</td>
</tr>
<tr>
<td>FLOAT</td>
<td>Floating-point numbers, of up to 32-digit precision.</td>
</tr>
<tr>
<td>INT</td>
<td>(This keyword is a synonym for INTEGER.)</td>
</tr>
<tr>
<td>INTEGER</td>
<td>Whole numbers, from -2,147,483,647 to +2,147,483,647.</td>
</tr>
<tr>
<td>INTERVAL</td>
<td>Spans of time in years and months, or else in smaller time units.</td>
</tr>
<tr>
<td>MONEY</td>
<td>Currency amounts, with definable scale and precision.</td>
</tr>
<tr>
<td>NUMERIC</td>
<td>(This keyword is a synonym for DECIMAL.)</td>
</tr>
<tr>
<td>REAL</td>
<td>(This keyword is a synonym for SMALLFLOAT.)</td>
</tr>
<tr>
<td>RECORD</td>
<td>Ordered sets of values, of any combination of 4GL data types.</td>
</tr>
<tr>
<td>SERIAL</td>
<td>Same as INTEGER. Automatically assigned by the engine.</td>
</tr>
<tr>
<td>SMALLFLOAT</td>
<td>Floating-point numbers, of up to 16-digit precision.</td>
</tr>
<tr>
<td>SMALLINT</td>
<td>Whole numbers, from -32,767 to +32,767.</td>
</tr>
<tr>
<td>TEXT</td>
<td>Character strings of any length.</td>
</tr>
<tr>
<td>VARCHAR</td>
<td>Character strings of varying length, no greater than 255.</td>
</tr>
</tbody>
</table>
^INFORMIX-OnLine Dynamic Server or other 4GL statements only. SQL only.
4GL Arithmetic Operators
<table>
<thead>
<tr>
<th>Operator Symbol</th>
<th>Operator Name</th>
<th>Name of Result</th>
<th>Precedence</th>
</tr>
</thead>
<tbody>
<tr>
<td>**</td>
<td>exponentiation</td>
<td>power</td>
<td>12</td>
</tr>
<tr>
<td>mod</td>
<td>modulus</td>
<td>integer remainder</td>
<td>12</td>
</tr>
<tr>
<td>*</td>
<td>multiplication</td>
<td>product</td>
<td>11</td>
</tr>
<tr>
<td>/</td>
<td>division</td>
<td>quotient</td>
<td>11</td>
</tr>
<tr>
<td>+</td>
<td>addition</td>
<td>sum</td>
<td>10</td>
</tr>
<tr>
<td>-</td>
<td>subtraction</td>
<td>difference</td>
<td>10</td>
</tr>
</tbody>
</table>
4GL Boolean Operators
AND
OR
NOT
4GL Relational Operators
<table>
<thead>
<tr>
<th>Operator Symbol</th>
<th>Operator Name</th>
<th>Operator Symbol</th>
<th>Operator Name</th>
</tr>
</thead>
<tbody>
<tr>
<td><</td>
<td>Less than</td>
<td>!= or <></td>
<td>Not equal to</td>
</tr>
<tr>
<td><=</td>
<td>Not greater than</td>
<td>>=</td>
<td>Not less than</td>
</tr>
<tr>
<td>= or ==</td>
<td>Equal to</td>
<td>></td>
<td>Greater than</td>
</tr>
</tbody>
</table>
Global Constants and Variables
**Global Constants and Variables**
- FALSE
- INT_FLAG
- NOTFOUND
- NULL
- SQLCODE
- STATUS
- TRUE
- QUIT_FLAG
**Built-In Functions**
- ARG_VAL(int-expr)
- ARR_COUNT()
- ARR_CURR()
- †AVG(int-field)
- †COUNT(*)
- DOWNSHIFT(char-expr)
- ERR_GET(int-expr)
- ERR_PRINT(int-expr)
- ERR.Quit(int-expr)
- ARG_VAL(int-expr)
- ERRORLOG(char-expr)
- NUM_ARGS()
- FGL_DRAWBOX(height, width, line, left-offset, color)
- SCR_LINE()
- FGL_GETENV(char-expr)
- SET_COUNT(int-expr)
- FGL_KEYVAL(char-expr)
- SHOWHELP(int-expr)
- FGL_LASTKEY()
- SQLEXIT()
- LENGTH(char-expr)
- STARTLOG(char-expr)
- MAX(int-field)
- SUM(int-field)
- MIN(int-field)
- UPSHIFT(char-expr)
†Valid only in REPORT blocks or in some SQL statements. Also, may be preceded by GROUP.
**Color numbers and their meanings that can be used in FGL_DRAWBOX( ) are:**
<table>
<thead>
<tr>
<th>Number</th>
<th>Color</th>
<th>Number</th>
<th>Color</th>
<th>Number</th>
<th>Color</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>White</td>
<td>3</td>
<td>Red</td>
<td>6</td>
<td>Blue</td>
</tr>
<tr>
<td>1</td>
<td>Yellow</td>
<td>4</td>
<td>Cyan</td>
<td>7</td>
<td>Black</td>
</tr>
<tr>
<td>2</td>
<td>Magenta</td>
<td>5</td>
<td>Green</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
**Operators**
- ASCII int-expr
- char-expr CLIPPED
- COLUMN integer
- CURRENT
- CURRENT qualifier
- DATE
- DATE (date-expression)
- DAY(date-expression)
- EXTEND(time-value)
- EXTEND(time-value, qualifier)
- FIELD_TOUCHED(field-list)
- GET_FLDBUF(field-list)
- expression IS NOT NULL
- expression IS NULL
- INFIELD(field)
- LENGTH(char-expr)
- †LINENO
- MDY(int-expr, int-expr, int-expr)
- MONTH(date-expression)
- ORD(string-expr)
- †PAGENO
- DATE
- TIME
- TODAY
- int-expr SPACE
- int-expr SPACES
- int-expr UNITS time-keyword
- expression USING format-string
- WEEKDAY (date-expression)
- †char-expr WORDWRAP
- YEAR (date-expression)
- †Valid only in REPORT blocks.
Library Functions
Calling C Functions from 4GL
Popping Numbers
extern void popint(int *iv)
extern void popshort(short *siv)
extern void poplong(long *liv)
extern void popflo(float *fv)
extern void popdub(double *dfv)
extern void popdec(dec_t *decv)
Popping Characters
extern void popquote(char *qv, int len)
extern void popvchar(char *qv, int len)
Popping Dates and Times
extern void popdate(long *datv)
extern void popdtime(dtime_t *dtv, int qual)
extern void popinv(intrvl_t *iv, int qual)
Popping BYTE and TEXT
extern void poplocator(loc_t **blob)
Returning Values
extern void retint(int iv)
extern void retshort(short siv)
extern void retlong(long lv)
extern void retflo(float fv)
extern void retdub(double dfv)
extern void retdec(dec_t *decv)
extern void retquote(char *str0)
extern void retvchar(char *vc)
extern void retdate(long date)
extern void retdtime(dtime_t *dtv)
extern void retinv(intrvl_t *inv)
Pushing Values
extern void pushint(int iv)
extern void pushshort(short siv)
extern void pushlong(long liv)
extern void pushflo(float fv)
extern void pushdub(double dfv)
extern void pushdec(dec_t *decv, unsigned decp)
Calling 4GL Functions from C
fgl_start(filename, argc, argv)
char *filename;
int argc;
char *argv[];
initialize resources for the 4GL environment
fgl_call(funcname, nparams)
char *funcname;
int nparams;
call the 4GL function
fgl_exitfm()
reset terminal to character mode
fgl_end()
free 4GL resources
decvasc(cp, len, np)
char *cp;
int len;
dec_t *np;
convert C char type to DECIMAL type
dectoasc(np, cp, len, right)
dec_t *np;
char *cp;
int len;
int right;
convert DECIMAL type to C char type
decvint(integer, np)
int integer;
dec_t *np;
convert C int type to DECIMAL type
dectoint(np, ip)
dec_t *np;
int *ip;
convert DECIMAL type to C int type
decvlong(lng, np)
long lng;
dec_t *np;
convert C long type to DECIMAL type
dectolong(np, lngp)
dec_t *np;
long *lngp;
convert DECIMAL type to C long type
decvflt(flt, np)
float flt;
dec_t *np;
convert C float type to DECIMAL type
dectoflt(np, fltp)
dec_t *np;
float *fltp;
convert DECIMAL type to C float type
Decimal Functions
Decimal Functions
```c
deccvdbl(dbl, np)
convert C double type to DECIMAL type
double dbl;
dec_t *np;
dectodb(np, dblp)
convert DECIMAL type to C double type
dec_t *np;
double *dblp;
decadd(n1, n2, result)
add two decimal numbers
(result = n1 + n2)
dec_t *n1;
dec_t *n2;
dec_t *result;
decsub(n1, n2, result)
subtract two decimal numbers
(result = n1 - n2)
dec_t *n1;
dec_t *n2;
dec_t *result;
decmul(n1, n2, result)
multiply two decimal numbers
(result = n1 * n2)
dec_t *n1;
dec_t *n2;
dec_t *result;
decdiv(n1, n2, result)
divide two decimal numbers
(result = n1 / n2)
dec_t *n1;
dec_t *n2;
dec_t *result;
int deccmp(n1, n2)
compare two decimal numbers
dec_t *n1;
dec_t *n2;
deccopy(n1, n2)
copy a decimal number
dec_t *n1;
dec_t *n2;
char *dececvt(np, ndigit, decpt, sign)
convert decimal value to ASCII string
dec_t *np;
int ndigit;
int *decpt;
int *sign;
char *decfcvt(np, ndigit, decpt, sign)
convert decimal value to ASCII string
dec_t *np;
int ndigit;
int *decpt;
int *sign;
```
The ATTRIBUTE clause is used in these 4GL statements:
<table>
<thead>
<tr>
<th>Construct</th>
<th>Display Form</th>
<th>Input Array</th>
</tr>
</thead>
<tbody>
<tr>
<td>CONSTRUCT</td>
<td>DISPLAY</td>
<td>INPUT ARRAY</td>
</tr>
<tr>
<td>DISPLAY</td>
<td>ERROR</td>
<td>MESSAGE</td>
</tr>
<tr>
<td>DISPLAY ARRAY</td>
<td>INPUT</td>
<td>PROMPT</td>
</tr>
</tbody>
</table>
For all ATTRIBUTE clauses and field attributes the following table shows the effects of the color attributes on a monochrome monitor, as well as the effects of the intensity attributes on a color monitor:
<table>
<thead>
<tr>
<th>Color Attribute</th>
<th>Monochrome Display</th>
<th>Intensity Attribute</th>
<th>Color Display</th>
</tr>
</thead>
<tbody>
<tr>
<td>WHITE</td>
<td>NORMAL</td>
<td>NORMAL</td>
<td>WHITE</td>
</tr>
<tr>
<td>YELLOW</td>
<td>BOLD</td>
<td>BOLD</td>
<td>RED</td>
</tr>
<tr>
<td>MAGENTA</td>
<td>BOLD</td>
<td>DIM</td>
<td>BLUE</td>
</tr>
<tr>
<td>RED</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>CYAN</td>
<td>DIM</td>
<td>DIM</td>
<td></td>
</tr>
<tr>
<td>GREEN</td>
<td>DIM</td>
<td></td>
<td></td>
</tr>
<tr>
<td>BLUE</td>
<td>DIM</td>
<td></td>
<td></td>
</tr>
<tr>
<td>BLACK</td>
<td>DIM</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Command-Line Syntax
```
-ansi -e -a -anyerr
-source.4gl
-esqlc.ec
-source.c
-obj.o
-yourlib
-o outfile
-args
-V
-c4gl
-fgioso.c
-cfile
-ec
-o newfglgo
-V cfile
-V
-fglgo
-a -anyerr
-argument
-fglio
-V
-fglpc
-ansi -a -anyerr
-p pathname
-V
-finderr
-msg_num
-V
-fglio
-c4gl
```
16 Command-Line Syntax
form4gl
-m lines -c characters
-V
-d form-name
database-name
table-name
.mkmessage in file out file
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
4GL Statements
INFORMIX-4GL supports the SQL language, but it is sometimes convenient to distinguish between SQL statements and other 4GL statements:
- SQL statements operate on tables in the database.
- Other 4GL statements operate on variables in memory.
The SQL statements of 4GL can be divided into these functional categories.
**Note:** Not all of these SQL statements listed on this and the next page are directly supported by 4GL. If the statement or any part of its syntax is preceded by a 6.0 icon in its syntax diagram later in this chapter, the statement must be prepared (by using the PREPARE statement). Preparing SQL statements is described in Chapter 3 of the INFORMIX-4GL Reference.
### Types of SQL Statements
#### SQL Data Definition Statements
- ALTER INDEX
- CREATE TABLE
- DROP TABLE
- ALTER TABLE
- CREATE VIEW
- DROP VIEW
- CLOSE DATABASE
- DATABASE
- RENAME COLUMN
- CREATE DATABASE
- DROP DATABASE
- RENAME TABLE
- CREATE INDEX
- DROP INDEX
- CREATE SYNONYM
- DROP SYNONYM
#### SQL Data Manipulation Statements
- INSERT
- LOAD
- UNLOAD
- DELETE
- SELECT
- UPDATE
#### SQL Cursor Manipulation Statements
- CLOSE
- FETCH
- OPEN
- DECLARE
- FLUSH
- PUT
#### SQL Query Optimization Information Statements
- SET EXPLAIN
- SET OPTIMIZATION
- UPDATE STATISTICS
#### SQL Data Access Statements
- GRANT
- REVOKE
- SET LOCK MODE
- LOCK TABLE
- SET ISOLATION
- UNLOCK TABLE
- START DATABASE
#### SQL Data Integrity Statements
- BEGIN WORK
- DROP AUDIT
- ROLLFORWARD DATABASE
- COMMIT WORK
- RECOVER TABLE
- SET CONSTRAINTS
- CREATE AUDIT
- REPAIR TABLE
- SET LOG
- ROLLBACK WORK
- START DATABASE
**Note:** The data integrity statements marked with the symbol are supported only by the INFORMIX-SE engine. Statements marked can only be used with the INFORMIX-OnLine Dynamic Server engine.
Other Types of 4GL Statements
SQL Dynamic Management Statements
EXECUTE PREPARE
FREE
4GL Definition and Declaration Statements
DEFINE MAIN
FUNCTION REPORT
4GL Program Flow Control Statements
CALL FINISH REPORT OUTPUT TO REPORT
CASE FOR RETURN
CONTINUE FOREACH START REPORT
DATABASE GOTO WHILE
END IF
EXIT LABEL
4GL Compiler Directives
DATABASE GLOBALS
DEFER WHENEVER
4GL Storage Manipulation Statements
INITIALIZE LOCATE
LET VALIDATE
4GL Screen Interaction Statements
CLEAR DISPLAY FORM OPEN WINDOW
CLOSE FORM ERROR OPTIONS
CLOSE WINDOW INPUT PROMPT
CONSTRUCT INPUT ARRAY SCROLL
CURRENT WINDOW MENU SLEEP
DISPLAY MESSAGE
DISPLAY ARRAY OPEN FORM
4GL Report Execution Statements
NEED PRINT
PAUSE SKIP
Most 4GL statements are not sensitive to whether the SE or the OnLine engine supports the application. Only the OnLine engine, however, can store values in BYTE, TEXT, or VARCHAR columns, or can accept database: or database@system: as qualifiers to names of tables, views, or synonyms.
CALL
CALL function, returning
RETURNING Receiving Variable
4GL Expression
p. 39
Case I: (single criterion)
CASE
WHEN 4GL Expression (subset) p. 39
statement
EXIT CASE
END CASE
Case II: (multiple criteria)
WHEN 4GL Boolean Expression p. 40
statement
EXIT CASE
OTHERWISE Block
OTHERWISE
statement
EXIT CASE
CLEAR
FORM
WINDOW
window
SCREEN
Field Clause p. 46
CLOSE FORM form
CLOSE WINDOW window
CONSTRUCT
ATTRIBUTE Clause p. 37
HELP number
END CONSTRUCT
CONSTRUCT Variable Clause
variable ON
Column List FROM
Field Clause p. 46
BY NAME variable ON
Column List
Column List
Table Qualifier p. 46
table.
Table Qualifier p. 46
table.
CONSTRUCT Form Management Block
BEFORE CONSTRUCT
statement
NEXT FIELD
PREVIOUS
NEXT
CONTINUE CONSTRUCT
EXIT CONSTRUCT
CONTINUE keyword
CURRENT WINDOW IS
window
SCREEN
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
Case I: (output in the Line mode overlay)
Case II: (in a specified line of the current window)
Case III: (in a screen form)
DISPLAY ARRAY record array TO screen array.
CLIPPED USING "format string" ASCII number
ATTRIBUTE Clause p. 37 ON KEY Block p. 25 END DISPLAY
DISPLAY Value BY NAME variable COLUMN left-offset
DISPLAY Value AT line, left-offset
DISPLAY Value TO Field Clause p. 46 ATTRIBUTE Clause p. 37
DISPLAY Value
Data Type Declaration p. 37
These are valid keywords in the END statement:
- CASE
- CONSTRUCT
- DISPLAY
- FOR
- IF
- FOREACH
- FUNCTION
- INPUT
- PROMPT
- REPORT
- MAIN
- MENU
- WHILE
Case I: (terminating a program)
Case II: (terminating a statement)
These are valid keywords in Case II of the EXIT statement:
- CASE
- CONSTRUCT
- DISPLAY
- FOR
- IF
- FOREACH
- FUNCTION
- INPUT
- PROMPT
- MENU
- Reports
- SQL
- SQLCA
- Debugger
- Variables
- Keys
FOR counter = start TO finish
STEP increment
CONTINUE FOR
EXIT FOR
END FOR
FOREACH cursor
INTO Variable List
CONTINUE FOREACH
EXIT FOREACH
END FOREACH
Variable List
FUNCTION function
( argument )
DEFINE Statement p. 24
RETURN Statement p. 35
END FUNCTION
Case I: (declaring and exporting variables)
Case II: (importing variables)
"filename"
GOTO label name
IF 4GL Boolean Expression p. 40 THEN statement END IF
ELSE statement
INITIALIZE Variable List LIKE table column TO NULL
Variable List
variable
record first THROUGH last
THRU
Array [Integer Expression p. 41]
INPUT Binding Clause p. 28 ATTRIBUTE Clause p. 37 HELP number INPUT Form Management Block END INPUT
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
Acceptable values of key (in lowercase or uppercase letters) for the ON KEY block are:
- ACCEPT
- DELETE
- DOWN
- ESC or ESCAPE
- Fi through F64
- CONTROL-char (except A, D, H, I, J, L, M, R, or X)
- NEXT or NEXTPAGE
- RIGHT
- INTERRUPT
- PREVIOUS or PREVPAGE
- TAB
- F1 through F64
- INPUT
- CONTINUE
- EXIT
- NEXT
- PREVIOUS
- RIGHT
- LEFT
- UP
- F1 through F64
- CONTROL-char (except A, D, H, I, J, L, M, R, or X)
Built-in functions that access field buffers and keystroke buffers:
**Built-In Function**
FIELD_TOUCHED(field) Returns TRUE when the user has made a change to screen field.
GET_FLDBUF(field-list) Returns the character values of the contents of one or more fields.
FGL_LASTKEY() Returns an INTEGER value corresponding to the most recent keystroke.
INFIELD(field) Returns TRUE if field is the name of the current screen field.
For acceptable values of `key`, see p. 28. For built-in functions that access field buffers and keystroke buffers, see p. 28.
Built-in functions that keep track of the relative states of the screen cursor, the program array, and the screen array:
<table>
<thead>
<tr>
<th>Function</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ARR_CURR( )</td>
<td>Returns the number of the current record of the program array.</td>
</tr>
<tr>
<td>ARR_COUNT( )</td>
<td>Returns the current number of records in the program array.</td>
</tr>
<tr>
<td>SCR_LINE( )</td>
<td>Returns the number of the current line within the screen array.</td>
</tr>
<tr>
<td>SET_COUNT(filled-rows)</td>
<td>Sets the initial value of ARR_COUNT( ) to filled-rows.</td>
</tr>
</tbody>
</table>
For acceptable values of `key`, see p. 28. For built-in functions that access field buffers and keystroke buffers, see p. 28.
Attribute Default Setting
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Default Setting</th>
</tr>
</thead>
<tbody>
<tr>
<td>color</td>
<td>Default foreground color on your terminal</td>
</tr>
<tr>
<td>REVERSE</td>
<td>No reverse video</td>
</tr>
<tr>
<td>BORDER</td>
<td>No border</td>
</tr>
<tr>
<td>PROMPT LINE line value</td>
<td>FIRST (=1)</td>
</tr>
<tr>
<td>MESSAGE LINE line value</td>
<td>FIRST + 1 (=2)</td>
</tr>
<tr>
<td>MENU LINE line value</td>
<td>FIRST (=1)</td>
</tr>
<tr>
<td>FORM LINE line value</td>
<td>FIRST + 2 (=3)</td>
</tr>
<tr>
<td>COMMENT LINE line value</td>
<td>LAST - 1 (for the 4GL screen)</td>
</tr>
<tr>
<td></td>
<td>LAST (for all other 4GL windows)</td>
</tr>
</tbody>
</table>
Reserved Line Position
```
FIRST + integer
```
```
LAST - integer
```
Clause | Default
---|---
COMMENT | LAST - 1 for the 4GL screen
LINE | LAST for all other 4GL windows
ERROR LINE | LAST line of the 4GL screen
FORM LINE | FIRST + 2 or line 3 of the current 4GL window
MENU LINE | FIRST line of the 4GL window
MESSAGE LINE | FIRST + 1 or line 2 of the current 4GL window
PROMPT LINE | FIRST line of the 4GL window
ACCEPT KEY | ESCAPE
DELETE KEY | F2
INSERT KEY | F1
NEXT KEY | F3
PREVIOUS KEY | F4
HELP KEY | CONTROL-W
HELP FILE | None
For values for `key`, see p. 28.
ATTRIBUTE Clause
4GL Statement Segments
ATTRIBUTE Clause
ATTRIBUTE
REVERSE
BLACK
BLUE
CYAN
GREEN
MAGENTA
RED
WHITE
YELLOW
BLINK
UNDERLINE
4GL Data Type
LIKE
table . column
Table Qualifier
p. 46
4GL Data Type
4GL Simple Data Type
p. 38
ARRAY Data Type
p. 38
RECORD Data Type
p. 39
TEXT
BYTE
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
4GL Simple Data Type
**Integer (Int)**
- `INTEGER`
- `INT`
**Second Level Subtypes**
- `SMALLINT`
- `DECIMAL` with `precision` and `scale`
- `NUMERIC` with `precision` and `scale`
- `MONEY`
- `FLOAT`
- `DOUBLE PRECISION`
- `REAL`
- `DATE`
- `DATETIME`
- `INTERVAL`
**Third Level Subtypes**
- `CHARACTER` with `size`
- `VARCHAR` with `maximum size` and `reserve size`
- `MONEY` with `size`, `precision`, and `scale`
- `SMALLFLOAT`
- `REAL`
- `DATE`
- `DATETIME`
- `INTERVAL`
**Array Data Type**
- `ARRAY` with `size`
**Fourth Level Subtypes**
- `4GL Simple Data Type`
**Record Data Type**
- `RECORD`
- `BYTE`
- `TEXT`
4GL Boolean Expression
- AND
- OR
- NOT
4GL Expression
Boolean Comparison
Function Call
TRUE
FALSE
String Comparison
Set Membership Test
NULL Test
Relational Comparison
4GL Expression
Relational Comparison:
- <
- >=
- <=
- >=
- !=
4GL Expression
String Comparison
Character Expression
M A T C H E S criterion
ESCAPE "char"
NOT
LIKE
MATCHES
Wildcard Effect
* Matches a string of zero or more characters.
? Matches any single character.
[ ] Matches any of the enclosed characters.
- Between characters in brackets means a range in the ASCII collating sequence.
^ As the first character in the brackets, matches any character that is not listed.
\ Treats the next character as a literal.
LIKE
Wildcard Effect
% Matches a string of zero or more characters.
_ Matches any single character.
\ Treats the next character as a literal.
Case I: Time units smaller than MONTH
- DAY
- HOUR
- MINUTE
- SECOND
- FRACTION
Case II: Time units greater than DAY
- YEAR
- MONTH
Interval (Numeric Time Interval p. 46) INTERVAL Qualifier
Case I: Time units smaller than MONTH
Case II: Time units greater than DAY
Field Clause
Table Qualifier
THRU Notation
Numeric Time Interval
4GL Forms
Form Specification Syntax
DATABASE Section
DATABASE
SCREEN
TABLES Section p. 49
ATTRIBUTES Section p. 49
INSTRUCTIONS Section p. 49
DATABASE Section
Database Reference
FORMONLY
WITHOUT NULL INPUT
database
database @server
"///server/database"
"pathname/database@server"
"///server/pathname/database"
SCREEN Section
SCREEN
Screen Layout
SIZE lines
BY characters
END
Screen Layout
[ field-tag ]
[ field-tag | field-tag ]
character
Values for display mode consists of zero or one color and zero or more intensities:
<table>
<thead>
<tr>
<th>Color Keywords</th>
<th>Intensity Keywords</th>
</tr>
</thead>
<tbody>
<tr>
<td>BLACK</td>
<td>MAGENTA</td>
</tr>
<tr>
<td>BLUE</td>
<td>RED</td>
</tr>
<tr>
<td>CYAN</td>
<td>WHITE</td>
</tr>
<tr>
<td>GREEN</td>
<td>YELLOW</td>
</tr>
<tr>
<td></td>
<td>REVERSE</td>
</tr>
<tr>
<td></td>
<td>LEFT</td>
</tr>
<tr>
<td></td>
<td>BLINK</td>
</tr>
<tr>
<td></td>
<td>UNDERLINE</td>
</tr>
</tbody>
</table>
For DATE data types, \textit{format-string} consists of:
<table>
<thead>
<tr>
<th>Special Characters</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>mm</td>
<td>2-digit representation of the month</td>
</tr>
<tr>
<td>mmm</td>
<td>3-letter abbreviation of the month</td>
</tr>
<tr>
<td>dd</td>
<td>2-digit representation of the day of the month</td>
</tr>
<tr>
<td>ddd</td>
<td>3-letter abbreviation of the day of the week</td>
</tr>
<tr>
<td>yy</td>
<td>2-digit representation of the year, discarding the leading digits</td>
</tr>
<tr>
<td>yyyy</td>
<td>4-digit representation of the year</td>
</tr>
</tbody>
</table>
All other characters are literals.
For DECIMAL, SMALLFLOAT, or FLOAT data types, \textit{format-string} consists of pound signs (\#) to represent digits and a decimal point. If you are using NLS, the period is a placeholder for the decimal separator and the comma is a placeholder for the thousands separator.
A format-string can include these three special symbols:
<table>
<thead>
<tr>
<th>Symbol</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>Any letter</td>
</tr>
<tr>
<td>#</td>
<td>Any digit</td>
</tr>
<tr>
<td>X</td>
<td>Any character</td>
</tr>
</tbody>
</table>
PICTURE Attribute
\[ \text{PICTURE} = "\text{format-string}" \]
PROGRAM Attribute
\[ \text{PROGRAM} = "\text{command}" \]
REQUIRED Attribute
\[ \text{REQUIRED} \]
REVERSE Attribute
\[ \text{REVERSE} \]
UPSHIFT Attribute
\[ \text{UPSHIFT} \]
VALIDATE LIKE Attribute
\[ \text{VALIDATE LIKE} \quad \text{table} . \quad \text{column} \]
VERIFY Attribute
\[ \text{VERIFY} \]
WORDWRAP Attribute
WORDWRAP
COMPRESS
NONCOMPRESS
ORDER BY Section
LEFT MARGIN size (default = 5 characters)
TOP MARGIN size (default = 3 lines)
PAGE LENGTH size (default = 66 lines)
BOTTOM MARGIN size (default = 3 lines)
RIGHT MARGIN size (default = 132 lines)
(for default reports or PRINT WORDWRAP only)
ORDER BY Section
ORDER
EXTERNAL
BY
argument
ASC
DESC
ORDER BY Section
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
Following is the execution sequence of report control blocks.
BEFORE GROUP OF a {1}
BEFORE GROUP OF b {2}
BEFORE GROUP OF c {3}
ON EVERY ROW {4}
AFTER GROUP OF c {3}
AFTER GROUP OF b {2}
AFTER GROUP OF a {1}
Report Execution Statements
NEED lines LINES
PAUSE "string"
SQL Statements
The 4GL source compiler does not recognize SQL statements identified in this Guide by the icon nor SQL statements containing a clause identified by the icon. To compile 4GL source code containing such statements, you must do the following:
1. Store the 6.0 SQL statement as a character string.
2. Set up the statement for execution by means of the PREPARE statement (see p. 79).
3. Process the statement by means of the EXECUTE statement (see p. 75).
BEGIN WORK
ADD CONSTRAINT Clause
ADD CONSTRAINT
Constraint Definition p. 68
DROP CONSTRAINT
DROP CONSTRAINT
Constraint Name p. 92
MODIFY NEXT SIZE kbytes
MODIFY NEXT SIZE
LOCK MODE
LOCK MODE
PAGE
ROW
BEGIN WORK
CLOSE
Cursor Name p. 92
CREATE INDEX
CREATE
UNIQUE
DISTINCT
CLUSTER
INDEX
ON Clause
ON
Table Name
p. 92
Synonym Name
p. 92
ON Clause
column name
ASC
DESC
FILLFACTOR
percent
CREATE PROCEDURE FROM
" filename "
Named Value
p. 103
CREATE
SYNONYM
FOR
Table Name
p. 92
Synonym Name
p. 92
View Name
p. 92
PUBLIC
PRIVATE
CREATE TABLE
**Column-Level Constraint Definition**
- **UNIQUE**
- **DISTINCT**
- **PRIMARY KEY**
- **REFERENCES**
- Clause p. 69
- **CHECK**
- Clause p. 69
**Temp-Table Column Constraint**
- **UNIQUE**
- **DISTINCT**
- **PRIMARY KEY**
- **CHECK**
- Clause p. 69
**Constraint Definition**
- **UNIQUE**
- **DISTINCT**
- **PRIMARY KEY**
- **FOREIGN KEY**
- column
- **REFERENCES**
- Clause p. 69
- **CHECK**
- Clause p. 69
**Constraint Name** p. 92
CREATE TRIGGER
LOCK MODE Clause
LOCK MODE
PAGE
ROW
6.0
CREATE TRIGGER
Trigger Name
INSERT — ON
Table Name p. 92
Action Clause p. 71
Insert REFERENCING Clause p. 71
Action Clause Referencing p. 72
DELETE — ON
Table Name p. 92
Action Clause p. 71
Delete REFERENCING Clause p. 71
Action Clause Referencing p. 72
UPDATE Clause p. 71
Table Name p. 92
Action Clause p. 71
Update REFERENCING Clause p. 72
Action Clause Referencing p. 72
Trigger Name
owner.
Identifier p. 100
CREATE TRIGGER
UPDATE Clause
UPDATE
OF column name
Action Clause
BEFORE Triggered Action List p. 72
FOR EACH ROW Triggered Action List p. 72
FOR EACH ROW Triggered Action List p. 72
AFTER Triggered Action List p. 72
AFTER Triggered Action List p. 72
AFTER Triggered Action List p. 72
INSERT REFERENCING Clause
REFERENCING NEW correlation name AS
DELETE REFERENCING Clause
REFERENCING OLD correlation name AS
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
A procedure that returns no values must be executed by using PREPARE and EXECUTE. A procedure that returns values must be handled by using PREPARE and DECLARE, and then either a FOREACH loop or OPEN, FETCH, or CLOSE.
The 4GL compiler treats the name of the object to be freed in the order shown in the diagram. In other words, the compiler looks first for a TEXT or BYTE variable having the given name; if one exists, that is the object that is freed. If no TEXT or BYTE variable having that name exists, the compiler then looks for a prepared statement or a cursor having that name and frees that.
When a TEXT or BYTE variable has the same name as a prepared statement or cursor, you cannot free resources allocated to the prepared statement or to the cursor.
Table-Level Privileges
INSERT INTO
VALUES Clause
VALUES Clause
SELECT Statement (Subset)
EXECUTE PROCEDURE
VALUES Clause
SELECT Statement (Subset)
EXECUTE PROCEDURE
Table-Name p. 92
Table-Name p. 92
View Name p. 92
View Name p. 92
Synonym Name p. 92
Synonym Name p. 92
Procedure Name p. 92
Procedure Name p. 92
Argument p. 78
Argument p. 78
INSERT INTO
- Argument
- SPL parameter name =
- SELECT Statement (singleton)
- VALUES Clause
- VALUES ( Named Value
- Constant Expression
- Record Reference
- Record Reference
- Record Reference
- NULL
- Record Reference
- Record Reference
- Record Reference
- Record Reference
- THRU
- member
- member
- member
- member
- member
- SPL Expression
- p. 112
- p. 97
- p. 104
- p. 103
- p. 82
Table-Level Privileges
- ALL
- PRIVILEGES
- INSERT
- DELETE
- SELECT
- UPDATE
- INDEX
- ALTER
- REFERENCES
Database-Level Privileges
- CONNECT
- RESOURCE
- DBA
ROLLBACK WORK
SE
+
ROLLFORWARD DATABASE
Database Name p. 93
SELECT
FROM Clause p. 83
UNION
UNION ALL
SELECT
INTO TEMP Clause p. 86
INTO Clause p. 83
GROUP BY Clause p. 85
HAVING Clause p. 85
WHERE Clause p. 84
ORDER BY Clause p. 86
SELECT Clause
SELECT Item p. 83
DISTINCT
ALL
UNIQUE
SELECT
Join
Relational Operator
column name
column name
Table Name p. 92
View Name p. 92
Synonym Name p. 92
Table Name p. 92
View Name p. 92
Synonym Name p. 92
GROUP BY
GROUP BY
Table Name p. 92
View Name p. 92
Synonym Name p. 92
HAVING
Condition p. 91
HAVING Clause
GROUP BY Clause
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
ORDER BY Clause
ORDER BY
column name
ASC
DESC
Table Name
p. 92
table alias
View Name
p. 92
Synonym Name
p. 92
select number
display label
rowid
INTO TEMP Clause
INTO TEMP temp table name
WITH NO LOG
6.0
SET CONSTRAINTS
ALL
IMMEDIATE
DEFERRED
Constraint Name
p. 92
6.0
SET DEBUG FILE TO
" filename "
Named Value
p. 103
character expression
WITH APPEND
UPDATE STATISTICS
FOR PROCEDURE
Procedure Name
FOR TABLE
Table Specification
DROP DISTRIBUTIONS
LOW
FOR TABLE
Table Specification
MEDIUM
FOR TABLE
Table Specification
RESOLUTION percent
HIGH
FOR TABLE
Table Specification
RESOLUTION percent
Table Specification
Table Name
p. 92
Synonym Name
p. 92
WHENEVER
NOT FOUND
SQLERROR
ERROR
ANY
WARNING
SQLWARNING
CONTINUE
GOTO
label
GO TO
'label'
STOP
CALL function name
6.0
SQL Segments
Condition
AND
OR
NOT
Comparison Condition
IN Subquery p. 92
EXISTS Subquery p. 92
ALL/ANY/SOME Subquery p. 92
Comparison Condition
SQL Expression p. 96
Relational Operator p. 104
SQL Expression p. 96
SQL Expression p. 96
BETWEEN
NOT
SQL Expression p. 96
AND
SQL Expression p. 96
NOT
SQL Expression p. 96
IN
Constant Expression p. 97
NOT
NULL
IS
NOT
Column Expression p. 96
LIKE
ESCAPE "character"
Quoted String p. 104
Named Value p. 103
Column Expression p. 96
Basics
4GL
Forms
Reports
SQL
SQLCA
Debugger
Variables
Keys
For SE engines, database identifiers can have up to ten characters in UNIX.
When the identifier for a database is also the name of a 4GL variable, the compiler uses the variable. To override this compiler action, quote the database identifier.
Character Data Type
CHAR
- CHARACTER
- NCHAR
- VARCHAR
- NLS
- 6.0
- OL
- +
- 6.0
- NLS
Number Data Type
INTEGER
- INT
- SERIAL
- +
- ( start )
- ( size )
- ( precision )
- ( float precision )
- SMALLINT
- FLOOR
- DOUBLE PRECISION
- SMALLFLOAT
- REAL
- DECIMAL
- DEC
- NUMERIC
- +
- ( precision )
- ( scale )
- MONEY
- +
- ( precision )
- ( scale )
When you refer to a column whose name is identical to that of a variable, you must prefix the column name with an @ symbol; otherwise the 4GL compiler treats it as a variable.
Algebraic Functions
**ROUND**
- **SQL Expression**
- p. 96
- Rounding factor
**TRUNC**
- **SQL Expression**
- p. 96
- Truncating factor
**ABS**
- Numeric expression
**MOD**
- Dividend, divisor
**POW**
- Base, exponent
**ROOT**
- Radicand
**SQRT**
- Integer expression
---
**DBINFO Function**
**DBINFO**
- **SQL**
- 'DBSPACE'
- Tblspace num
- Expression
- 'sqlca.sqlerrd1'
- 'sqlca.sqlerrd2'
---
**Exponential and Logarithmic Functions**
**EXP**
- Float expression
**LOGN**
- Float expression
**LOG10**
- Float expression
It is important to recognize that Stored Procedure Language (SPL) statements are not part of 4GL. This means that you cannot include these statements within a 4GL program. Doing so causes compile errors.
To create a stored procedure from a 4GL program, do the following:
1. Put the text of the CREATE PROCEDURE statement in a file.
2. Use a PREPARE statement to prepare a CREATE PROCEDURE FROM statement that refers to the text file created in Step 1.
3. Use an EXECUTE statement to execute the prepared statement, which then compiles the stored procedure.
Refer to the Informix Guide to SQL: Reference, Version 6.0 for a full description of the CREATE PROCEDURE statement.
You may explicitly invoke stored procedures from within your 4GL program by preparing and executing the following SQL statements:
- CREATE PROCEDURE FROM
- DROP PROCEDURE
- EXECUTE PROCEDURE
- GRANT
- INSERT INTO
- REVOKE
- SET DEBUG FILE TO
- UPDATE STATISTICS
Refer to the Informix Guide to SQL: Reference, Version 6.0 for a description of working with dynamic SQL.
Also, you may implicitly invoke a stored procedure through a reference to that procedure within the context of an SQL expression. For example, the reference to `avg_price()` in the following SELECT statement implicitly invokes the stored procedure having the name `avg_price`:
```sql
select
manu_code, unit_price,
(avg_price(1) - unit_price) variance
from stock
where stock_num = 1
```
Such implicit references to stored procedures do not require the statement to be prepared.
LET
variable name = Procedure Name p. 92
, called variable = SPL Expression p. 112
SPL Expression p. 112
ON EXCEPTION
IN (error number)
SET SQL error variable, ISAM error variable, error data variable
Statement Block p. 108
END EXCEPTION
WITH RESUME
RAISE EXCEPTION SQL error
, ISAM error, error text
RETURN
SPL Expression p. 112
WITH RESUME
SYSTEM "character expression" "character variable"
SQLCA Record
DEFINE SQLCA RECORD
SQLCODE INTEGER,
SQLERRM CHAR(71),
SQLERRP CHAR(8),
SQLERRD ARRAY [6] OF INTEGER,
SQLAWARN CHAR (8)
END RECORD
Summary of fields:
<table>
<thead>
<tr>
<th>Result Code</th>
<th>Details of Statement Execution</th>
<th>Special Conditions</th>
</tr>
</thead>
</table>
SQLCODE indicates the result of executing an SQL statement. It is set as follows:
- To zero for a successful execution of most statements.
- To NOTFOUND (defined as 100) for a successfully executed query that returns zero rows or for a FETCH that seeks beyond the end of an active set. (However, in an ANSI-compliant database, when an INSERT INTO/SELECT statement or a DELETE, UPDATE, or SELECT INTO TEMP statement fails to access any rows, the value of SQLCA.SQLCODE is set to NOTFOUND rather than 0.)
- To a negative value for an unsuccessful execution.
INFORMIX-4GL sets the global variable STATUS equal to SQLCODE after each SQL statement. However, any subsequent 4GL statement can reset STATUS.
SQLERRM contains parameters for the error message.
SQLERRP is reserved for future use.
SQLERRD is an array of six integers:
- SQLERRD[1] is the estimated number of rows returned.
- SQLERRD[2] is the SERIAL value returned or an error code.
- SQLERRD[3] is the number of rows processed.
- SQLERRD[4] is a weighted sum of disk accesses and total rows processed, the estimated CPU cost of the query.
- SQLERRD[5] is the offset of error into the SQL statement.
- SQLERRD[6] is the rowid of the last row processed.
SQLWARN is a character string of length eight whose individual characters signal various warning conditions (as opposed to errors) following the execution of an SQL statement. The characters are blank if no problems or exceptional conditions are detected.
SQLWARN[1] is set to W if one or more of the other warning characters has been set to W. If SQLWARN[1] is blank, you do not have to check the remaining warning characters.
SQLWARN[2] is set to W if one or more data items were truncated to fit into a character variable or if a DATABASE statement selected a database with transactions.
SQLWARN[3] is set to W if an aggregate function (SUM, AVG, MAX, or MIN) encountered a null value in its evaluation or if a DATABASE statement selected an ANSI-compliant database.
SQLWARN[4] is set to W if a DATABASE statement selected an INFORMIX-OnLine Dynamic Server<Default ¶ Fo> database or when the number of items in the select-list of a SELECT clause is not the same as the number of program variables in the INTO clause. In the latter case, the number of values INFORMIX-4GL returns is the smaller of these two numbers.
SQLWARN[5] is set to W if float-to-decimal conversion is used.
SQLWARN[6] is set to W when your program executes an Informix extension to ANSI-compliant standard syntax and the DBANSIWARN environment variable is set or the -ansi option is specified.
SQLWARN[7] is reserved for future use.
SQLWARN[8] is reserved for future use.
Interactive Debugger Commands
The following table lists the **Debugger** commands, options, and accelerators.
<table>
<thead>
<tr>
<th>Command</th>
<th>Option</th>
<th>Shortest Form</th>
</tr>
</thead>
<tbody>
<tr>
<td>?</td>
<td>?</td>
<td></td>
</tr>
<tr>
<td>/</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>ALIAS</td>
<td>al</td>
<td></td>
</tr>
<tr>
<td>APPLICATION</td>
<td>DEVICE</td>
<td>ap</td>
</tr>
<tr>
<td>BREAK</td>
<td>b</td>
<td></td>
</tr>
<tr>
<td>CALL</td>
<td>ca</td>
<td></td>
</tr>
<tr>
<td>CLEANUP</td>
<td>cl</td>
<td></td>
</tr>
<tr>
<td>CONTINUE</td>
<td>co</td>
<td></td>
</tr>
<tr>
<td>DATABASE</td>
<td>da</td>
<td></td>
</tr>
<tr>
<td>DISABLE</td>
<td>di</td>
<td></td>
</tr>
<tr>
<td>DUMP</td>
<td>du</td>
<td></td>
</tr>
<tr>
<td>ENABLE</td>
<td>en</td>
<td></td>
</tr>
<tr>
<td>EXIT</td>
<td>ex</td>
<td></td>
</tr>
<tr>
<td>FUNCTIONS</td>
<td>f</td>
<td></td>
</tr>
<tr>
<td>GROW</td>
<td>g</td>
<td></td>
</tr>
<tr>
<td>HELP</td>
<td>h</td>
<td></td>
</tr>
<tr>
<td>LET</td>
<td>le</td>
<td></td>
</tr>
<tr>
<td>LIST</td>
<td>li</td>
<td></td>
</tr>
<tr>
<td>NOBREAK</td>
<td>nob</td>
<td></td>
</tr>
<tr>
<td>NOTRACE</td>
<td>not</td>
<td></td>
</tr>
<tr>
<td>PRINT</td>
<td>p</td>
<td></td>
</tr>
<tr>
<td>READ</td>
<td>re</td>
<td></td>
</tr>
<tr>
<td>RUN</td>
<td>ru</td>
<td></td>
</tr>
<tr>
<td>STEP</td>
<td>s</td>
<td></td>
</tr>
<tr>
<td>TIME DELAY</td>
<td>SOURCE COMMAND</td>
<td>ti</td>
</tr>
<tr>
<td></td>
<td></td>
<td>ti s</td>
</tr>
<tr>
<td></td>
<td></td>
<td>ti c</td>
</tr>
</tbody>
</table>
After setting a breakpoint (or tracepoint), the Output text region displays:
```
(2) break show_menu:91 [customer.4gl]
scope function: show_menu
checkpoint scope
```
To: Type:
- Escape ! command
- Interrupt CONTROL-D or Del key
- Redraw CONTROL-R
- Screen CONTROL-P
- Toggle CONTROL-T
- Search for characters / pattern
- ? pattern
These built-in operators can be used in a boolean expression:
- CURRENT
- DATE()
- DATETIME()
- DAY()
- ENTEND()
- INTERVAL()
- MDY()
- MONTH()
- TODAY
- UNITS
- WEEKDAY()
- YEAR()
To select a remote database, use one of the following formats:
Remote Database Engine Format of database name
INFORMIX-OnLine Dynamic Server database@servername
or //servername/database
INFORMIX-SE //servername/path/database
Checkpoint Identification p. 126
Scope List p. 128
Output Redirection p. 127
Checkpoint Identification p. 126
CLEANUP 121
A pattern is a string of no more than 50 characters and blanks or up to 80 characters if enclosed in quotation marks.
You can use the following wildcard characters within the pattern:
<table>
<thead>
<tr>
<th>Pattern</th>
<th>Matches</th>
</tr>
</thead>
<tbody>
<tr>
<td>?</td>
<td>any single character</td>
</tr>
<tr>
<td>*</td>
<td>zero or more characters</td>
</tr>
<tr>
<td>[characters]</td>
<td>one or more unseparated characters</td>
</tr>
<tr>
<td>[character-character]</td>
<td>characters within the range in ASCII collating sequence</td>
</tr>
</tbody>
</table>
These built-in operators can be used within a 4GL expression:
- `CURRENT`
- `DATE()`
- `DATETIME()`
- `DAY()`
- `MONTH()`
- `YEAR()`
- `ENTEND()`
- `INTERVAL()`
- `MDY()`
- `MONTH()`
- `WEEKDAY()`
To pass arguments to the p-code runner, include them on the Debugger command line.
Example:
```
PROGRAM = "program"
```
Filename:
```
filename.4db
```
Argument:
```
number INTO NOBREAK
```
A reference name must:
- Be unique among other checkpoint names.
- Begin with an alphabetic character.
- Contain only letters, numbers, or the underscore ( _) character.
<table>
<thead>
<tr>
<th>Type</th>
<th>Valid Entities</th>
<th>Triggered When</th>
</tr>
</thead>
<tbody>
<tr>
<td>statement</td>
<td>executable statements within 4GL functions</td>
<td>Execution completes previous statement.</td>
</tr>
<tr>
<td>variable</td>
<td>†active variables</td>
<td>Variable is assigned a different value.</td>
</tr>
<tr>
<td>function</td>
<td>4GL functions (including MAIN), 4GL reports, ESQL/C functions, C functions</td>
<td>Function is called.</td>
</tr>
</tbody>
</table>
†You cannot set a checkpoint on an entire array or record structure.
Environment
Variables
### Environment Variables
<table>
<thead>
<tr>
<th>Environment Variable</th>
<th>Restrictions</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>DBANSIWARN</td>
<td></td>
<td>D-8</td>
</tr>
<tr>
<td>DBDATE</td>
<td></td>
<td>D-9</td>
</tr>
<tr>
<td>DBDELCOMMITER</td>
<td></td>
<td>D-11</td>
</tr>
<tr>
<td>DBEDIT</td>
<td></td>
<td>D-11</td>
</tr>
<tr>
<td>DBFORMAT</td>
<td></td>
<td>D-14</td>
</tr>
<tr>
<td>DLANGLES</td>
<td></td>
<td>D-18</td>
</tr>
<tr>
<td>DBMONEY</td>
<td></td>
<td>D-21</td>
</tr>
<tr>
<td>DBPATH</td>
<td></td>
<td>D-23</td>
</tr>
<tr>
<td>DBPRINT</td>
<td></td>
<td>D-26</td>
</tr>
<tr>
<td>DBREMOTEEXEC</td>
<td><strong>OnLine only</strong></td>
<td>D-27</td>
</tr>
<tr>
<td>DBSPACEEXEC</td>
<td><strong>OnLine only</strong></td>
<td>D-28</td>
</tr>
<tr>
<td>DBEXEC</td>
<td><strong>SE only</strong></td>
<td>D-29</td>
</tr>
<tr>
<td>DBUPSPACE</td>
<td></td>
<td>D-29</td>
</tr>
<tr>
<td>ENVIRORE</td>
<td></td>
<td>D-30</td>
</tr>
<tr>
<td>INFORMIXCONRETRY</td>
<td></td>
<td>D-30</td>
</tr>
<tr>
<td>INFORMIXCONTIME</td>
<td></td>
<td>D-31</td>
</tr>
<tr>
<td>INFORMIXDIR</td>
<td></td>
<td>D-32</td>
</tr>
<tr>
<td>INFORMIXSERVER</td>
<td></td>
<td>D-33</td>
</tr>
<tr>
<td>INFORMIXSHMBASE</td>
<td><strong>OnLine only</strong></td>
<td>D-33</td>
</tr>
<tr>
<td>INFORMIXSTACKSIZE</td>
<td><strong>OnLine only</strong></td>
<td>D-34</td>
</tr>
<tr>
<td>INFORMIXTERM</td>
<td></td>
<td>D-34</td>
</tr>
<tr>
<td>ONCONFIG</td>
<td><strong>OnLine only</strong></td>
<td>D-36</td>
</tr>
<tr>
<td>PSORT_DBTEMP</td>
<td><strong>OnLine only</strong></td>
<td>D-36</td>
</tr>
<tr>
<td>PSORT_NPROCS</td>
<td><strong>OnLine only</strong></td>
<td>D-37</td>
</tr>
<tr>
<td>SQLEXEC</td>
<td></td>
<td>D-38</td>
</tr>
<tr>
<td>SQLRM</td>
<td></td>
<td>D-38</td>
</tr>
<tr>
<td>SQLRMDIR</td>
<td>SQL APIs only</td>
<td>D-39</td>
</tr>
</tbody>
</table>
### NLS Environment Variable
<table>
<thead>
<tr>
<th>Variable</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>COLLCHAR</td>
<td>E-18</td>
</tr>
<tr>
<td>DBAPICODE</td>
<td>E-23</td>
</tr>
<tr>
<td>DBNLS</td>
<td>E-16</td>
</tr>
<tr>
<td>LANG</td>
<td>E-25</td>
</tr>
<tr>
<td>LC_COLLATE</td>
<td>E-27</td>
</tr>
<tr>
<td>LC_CTYPE</td>
<td>E-29</td>
</tr>
<tr>
<td>LC_MONETARY</td>
<td>E-31</td>
</tr>
<tr>
<td>LC_NUMERIC</td>
<td>E-35</td>
</tr>
</tbody>
</table>
### UNIX Environment Variable
<table>
<thead>
<tr>
<th>Variable</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>PATH</td>
<td>D-40</td>
</tr>
<tr>
<td>TERM</td>
<td>D-41</td>
</tr>
<tr>
<td>TERMCAP</td>
<td>D-41</td>
</tr>
<tr>
<td>TERMINFO</td>
<td>D-42</td>
</tr>
</tbody>
</table>
Default Key Assignments
Logical command keys at runtime and their default assignments:
<table>
<thead>
<tr>
<th>Key Name</th>
<th>Purpose of Key</th>
<th>Default Keystroke</th>
</tr>
</thead>
<tbody>
<tr>
<td>Accept</td>
<td>Selects the current menu option in a MENU statement; terminates input during</td>
<td>Escape</td>
</tr>
<tr>
<td></td>
<td>CONSTRUCT, INPUT and INPUT ARRAY; terminates DISPLAY ARRAY.</td>
<td></td>
</tr>
<tr>
<td>Interrupt</td>
<td>Represents the external interrupt signal; available when interrupts are</td>
<td>CONTROL-C</td>
</tr>
<tr>
<td></td>
<td>deferred with the DEFER statement.</td>
<td></td>
</tr>
<tr>
<td>Insert</td>
<td>Requests insertion of a new line during INPUT ARRAY, starting execution of a</td>
<td>F1</td>
</tr>
<tr>
<td></td>
<td>BEFORE INSERT block.</td>
<td></td>
</tr>
<tr>
<td>Delete</td>
<td>Requests deletion of the current line during INPUT ARRAY, starting execution</td>
<td>F2</td>
</tr>
<tr>
<td></td>
<td>of a BEFORE DELETE block.</td>
<td></td>
</tr>
<tr>
<td>Next</td>
<td>Causes scrolling to the next page (group of lines) during DISPLAY ARRAY and</td>
<td>F3</td>
</tr>
<tr>
<td></td>
<td>INPUT ARRAY.</td>
<td></td>
</tr>
<tr>
<td>Previous</td>
<td>Causes scrolling to the previous page (group of lines) during DISPLAY ARRAY</td>
<td>F4</td>
</tr>
<tr>
<td></td>
<td>and INPUT ARRAY.</td>
<td></td>
</tr>
<tr>
<td>Help</td>
<td>Starts the display of the specified HELP message from the current help file.</td>
<td>CONTROL-W</td>
</tr>
<tr>
<td>Quit</td>
<td>Terminates the program unless DEFER QUIT is specified.</td>
<td>CONTROL-\</td>
</tr>
</tbody>
</table>
Effect of special keys on interactive 4GL statements and within 4GL menus:
<table>
<thead>
<tr>
<th>Key Name</th>
<th>Use in CONSTRUCT, INPUT, and INPUT ARRAY</th>
<th>Use in MENU</th>
</tr>
</thead>
<tbody>
<tr>
<td>CONTROL-A</td>
<td>Switches between overtype and insert</td>
<td>None.</td>
</tr>
<tr>
<td></td>
<td>modes.</td>
<td></td>
</tr>
<tr>
<td>CONTROL-D</td>
<td>Deletes from the cursor to the end of</td>
<td>None.</td>
</tr>
<tr>
<td></td>
<td>the field.</td>
<td></td>
</tr>
<tr>
<td>CONTROL-H</td>
<td>During text entry, moves the cursor left</td>
<td>Moves highlight to next</td>
</tr>
<tr>
<td>(backspace)</td>
<td>one position (nondestructive backspace).</td>
<td>option left.</td>
</tr>
<tr>
<td>CONTROL-I</td>
<td>Cursor moves to next field; except in a</td>
<td>None.</td>
</tr>
<tr>
<td>or TAB</td>
<td>WORDWRAP field, inserts a tab or skips to</td>
<td></td>
</tr>
<tr>
<td></td>
<td>a tab depending on mode.</td>
<td></td>
</tr>
<tr>
<td>CONTROL-J</td>
<td>Cursor moves to next field; except in a</td>
<td>Moves the highlight to the</td>
</tr>
<tr>
<td>(Linefeed)</td>
<td>WORDWRAP field, inserts a newline or</td>
<td>next option right.</td>
</tr>
<tr>
<td></td>
<td>moves down one line depending on mode.</td>
<td></td>
</tr>
<tr>
<td>CONTROL-L</td>
<td>During text entry, moves the cursor right</td>
<td>Moves the highlight to the</td>
</tr>
<tr>
<td></td>
<td>one position.</td>
<td>next option right.</td>
</tr>
</tbody>
</table>
Default Key Assignments
<table>
<thead>
<tr>
<th>Key Name</th>
<th>Use in CONSTRUCT, INPUT, and INPUT ARRAY</th>
<th>Use in MENU</th>
</tr>
</thead>
<tbody>
<tr>
<td>CONTROL-M or RETURN</td>
<td>Completes entry of the current field. Cursor moves to next field if any; else same as Accept.</td>
<td>Accepts the option that is currently highlighted.</td>
</tr>
<tr>
<td>CONTROL-N</td>
<td>Cursor moves to beginning of current field.</td>
<td>None.</td>
</tr>
<tr>
<td>CONTROL-R</td>
<td>Causes the screen to be redrawn.</td>
<td>Causes the screen to be redrawn.</td>
</tr>
<tr>
<td>CONTROL-X</td>
<td>Deletes the character under the cursor.</td>
<td>None.</td>
</tr>
<tr>
<td>Left Arrow</td>
<td>Same as Backspace.</td>
<td>Same as CONTROL-L.</td>
</tr>
<tr>
<td>Right Arrow</td>
<td>Same as CONTROL-L.</td>
<td>Moves the highlight to the next option left.</td>
</tr>
<tr>
<td>Up Arrow</td>
<td>Moves to previous field; except in a WORDWRAP field moves up one line in field and in an INPUT ARRAY moves to the corresponding field in the previous row.</td>
<td>Moves the highlight to the next option right.</td>
</tr>
<tr>
<td>Down Arrow</td>
<td>Moves to next field; except in a WORDWRAP field moves down one line in field and in an INPUT ARRAY moves to the corresponding field in the next row.</td>
<td></td>
</tr>
</tbody>
</table>
|
{"Source-Url": "http://www.oninit.com/manual/informix/english/docs/4gl/7609.pdf", "len_cl100k_base": 16231, "olmocr-version": "0.1.53", "pdf-total-pages": 136, "total-fallback-pages": 0, "total-input-tokens": 238320, "total-output-tokens": 19481, "length": "2e13", "weborganizer": {"__label__adult": 0.0002474784851074219, "__label__art_design": 0.00031638145446777344, "__label__crime_law": 0.00017142295837402344, "__label__education_jobs": 0.0009822845458984375, "__label__entertainment": 8.678436279296875e-05, "__label__fashion_beauty": 8.314847946166992e-05, "__label__finance_business": 0.00021326541900634768, "__label__food_dining": 0.00017595291137695312, "__label__games": 0.00101470947265625, "__label__hardware": 0.0006289482116699219, "__label__health": 0.0001595020294189453, "__label__history": 0.00016248226165771484, "__label__home_hobbies": 6.973743438720703e-05, "__label__industrial": 0.00022530555725097656, "__label__literature": 0.00021755695343017575, "__label__politics": 0.00011849403381347656, "__label__religion": 0.0002608299255371094, "__label__science_tech": 0.004787445068359375, "__label__social_life": 4.374980926513672e-05, "__label__software": 0.027618408203125, "__label__software_dev": 0.9619140625, "__label__sports_fitness": 0.00016558170318603516, "__label__transportation": 0.000148773193359375, "__label__travel": 0.00012922286987304688}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 54708, 0.02415]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 54708, 0.32196]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 54708, 0.66388]], "google_gemma-3-12b-it_contains_pii": [[0, 27, false], [27, 27, null], [27, 664, null], [664, 1104, null], [1104, 1117, null], [1117, 4260, null], [4260, 6318, null], [6318, 7236, null], [7236, 7243, null], [7243, 10297, null], [10297, 12098, null], [12098, 13236, null], [13236, 14222, null], [14222, 15345, null], [15345, 16638, null], [16638, 16970, null], [16970, 17135, null], [17135, 17135, null], [17135, 17150, null], [17150, 18948, null], [18948, 19941, null], [19941, 20359, null], [20359, 20847, null], [20847, 21308, null], [21308, 21734, null], [21734, 22099, null], [22099, 22490, null], [22490, 23339, null], [23339, 24318, null], [24318, 24318, null], [24318, 24318, null], [24318, 25276, null], [25276, 25743, null], [25743, 25776, null], [25776, 25776, null], [25776, 25776, null], [25776, 26141, null], [26141, 26764, null], [26764, 26764, null], [26764, 27113, null], [27113, 27616, null], [27616, 27616, null], [27616, 27616, null], [27616, 27616, null], [27616, 27810, null], [27810, 27955, null], [27955, 27965, null], [27965, 28419, null], [28419, 28419, null], [28419, 28895, null], [28895, 28895, null], [28895, 29745, null], [29745, 30303, null], [30303, 30355, null], [30355, 30355, null], [30355, 30355, null], [30355, 30763, null], [30763, 30979, null], [30979, 31041, null], [31041, 31041, null], [31041, 31056, null], [31056, 31508, null], [31508, 31508, null], [31508, 31758, null], [31758, 31758, null], [31758, 32069, null], [32069, 32069, null], [32069, 32532, null], [32532, 32532, null], [32532, 33025, null], [33025, 33507, null], [33507, 33507, null], [33507, 33507, null], [33507, 33507, null], [33507, 33724, null], [33724, 34269, null], [34269, 34628, null], [34628, 35050, null], [35050, 35050, null], [35050, 35050, null], [35050, 35292, null], [35292, 35531, null], [35531, 35531, null], [35531, 35531, null], [35531, 35887, null], [35887, 36269, null], [36269, 36269, null], [36269, 36269, null], [36269, 36269, null], [36269, 36720, null], [36720, 37301, null], [37301, 37301, null], [37301, 37546, null], [37546, 37964, null], [37964, 37964, null], [37964, 38140, null], [38140, 38140, null], [38140, 38140, null], [38140, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40643, null], [40643, 40643, null], [40643, 40656, null], [40656, 42279, null], [42279, 43734, null], [43734, 43734, null], [43734, 43764, null], [43764, 45097, null], [45097, 45430, null], [45430, 45612, null], [45612, 46146, null], [46146, 46771, null], [46771, 47165, null], [47165, 47165, null], [47165, 47165, null], [47165, 47336, null], [47336, 48086, null], [48086, 48086, null], [48086, 48108, null], [48108, 49518, null], [49518, 49996, null], [49996, 49996, null], [49996, 50020, null], [50020, 53457, null], [53457, 54708, null], [54708, 54708, null]], "google_gemma-3-12b-it_is_public_document": [[0, 27, true], [27, 27, null], [27, 664, null], [664, 1104, null], [1104, 1117, null], [1117, 4260, null], [4260, 6318, null], [6318, 7236, null], [7236, 7243, null], [7243, 10297, null], [10297, 12098, null], [12098, 13236, null], [13236, 14222, null], [14222, 15345, null], [15345, 16638, null], [16638, 16970, null], [16970, 17135, null], [17135, 17135, null], [17135, 17150, null], [17150, 18948, null], [18948, 19941, null], [19941, 20359, null], [20359, 20847, null], [20847, 21308, null], [21308, 21734, null], [21734, 22099, null], [22099, 22490, null], [22490, 23339, null], [23339, 24318, null], [24318, 24318, null], [24318, 24318, null], [24318, 25276, null], [25276, 25743, null], [25743, 25776, null], [25776, 25776, null], [25776, 25776, null], [25776, 26141, null], [26141, 26764, null], [26764, 26764, null], [26764, 27113, null], [27113, 27616, null], [27616, 27616, null], [27616, 27616, null], [27616, 27616, null], [27616, 27810, null], [27810, 27955, null], [27955, 27965, null], [27965, 28419, null], [28419, 28419, null], [28419, 28895, null], [28895, 28895, null], [28895, 29745, null], [29745, 30303, null], [30303, 30355, null], [30355, 30355, null], [30355, 30355, null], [30355, 30763, null], [30763, 30979, null], [30979, 31041, null], [31041, 31041, null], [31041, 31056, null], [31056, 31508, null], [31508, 31508, null], [31508, 31758, null], [31758, 31758, null], [31758, 32069, null], [32069, 32069, null], [32069, 32532, null], [32532, 32532, null], [32532, 33025, null], [33025, 33507, null], [33507, 33507, null], [33507, 33507, null], [33507, 33507, null], [33507, 33724, null], [33724, 34269, null], [34269, 34628, null], [34628, 35050, null], [35050, 35050, null], [35050, 35050, null], [35050, 35292, null], [35292, 35531, null], [35531, 35531, null], [35531, 35531, null], [35531, 35887, null], [35887, 36269, null], [36269, 36269, null], [36269, 36269, null], [36269, 36269, null], [36269, 36720, null], [36720, 37301, null], [37301, 37301, null], [37301, 37546, null], [37546, 37964, null], [37964, 37964, null], [37964, 38140, null], [38140, 38140, null], [38140, 38140, null], [38140, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 38699, null], [38699, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40235, null], [40235, 40643, null], [40643, 40643, null], [40643, 40656, null], [40656, 42279, null], [42279, 43734, null], [43734, 43734, null], [43734, 43764, null], [43764, 45097, null], [45097, 45430, null], [45430, 45612, null], [45612, 46146, null], [46146, 46771, null], [46771, 47165, null], [47165, 47165, null], [47165, 47165, null], [47165, 47336, null], [47336, 48086, null], [48086, 48086, null], [48086, 48108, null], [48108, 49518, null], [49518, 49996, null], [49996, 49996, null], [49996, 50020, null], [50020, 53457, null], [53457, 54708, null], [54708, 54708, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 54708, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 54708, null]], "pdf_page_numbers": [[0, 27, 1], [27, 27, 2], [27, 664, 3], [664, 1104, 4], [1104, 1117, 5], [1117, 4260, 6], [4260, 6318, 7], [6318, 7236, 8], [7236, 7243, 9], [7243, 10297, 10], [10297, 12098, 11], [12098, 13236, 12], [13236, 14222, 13], [14222, 15345, 14], [15345, 16638, 15], [16638, 16970, 16], [16970, 17135, 17], [17135, 17135, 18], [17135, 17150, 19], [17150, 18948, 20], [18948, 19941, 21], [19941, 20359, 22], [20359, 20847, 23], [20847, 21308, 24], [21308, 21734, 25], [21734, 22099, 26], [22099, 22490, 27], [22490, 23339, 28], [23339, 24318, 29], [24318, 24318, 30], [24318, 24318, 31], [24318, 25276, 32], [25276, 25743, 33], [25743, 25776, 34], [25776, 25776, 35], [25776, 25776, 36], [25776, 26141, 37], [26141, 26764, 38], [26764, 26764, 39], [26764, 27113, 40], [27113, 27616, 41], [27616, 27616, 42], [27616, 27616, 43], [27616, 27616, 44], [27616, 27810, 45], [27810, 27955, 46], [27955, 27965, 47], [27965, 28419, 48], [28419, 28419, 49], [28419, 28895, 50], [28895, 28895, 51], [28895, 29745, 52], [29745, 30303, 53], [30303, 30355, 54], [30355, 30355, 55], [30355, 30355, 56], [30355, 30763, 57], [30763, 30979, 58], [30979, 31041, 59], [31041, 31041, 60], [31041, 31056, 61], [31056, 31508, 62], [31508, 31508, 63], [31508, 31758, 64], [31758, 31758, 65], [31758, 32069, 66], [32069, 32069, 67], [32069, 32532, 68], [32532, 32532, 69], [32532, 33025, 70], [33025, 33507, 71], [33507, 33507, 72], [33507, 33507, 73], [33507, 33507, 74], [33507, 33724, 75], [33724, 34269, 76], [34269, 34628, 77], [34628, 35050, 78], [35050, 35050, 79], [35050, 35050, 80], [35050, 35292, 81], [35292, 35531, 82], [35531, 35531, 83], [35531, 35531, 84], [35531, 35887, 85], [35887, 36269, 86], [36269, 36269, 87], [36269, 36269, 88], [36269, 36269, 89], [36269, 36720, 90], [36720, 37301, 91], [37301, 37301, 92], [37301, 37546, 93], [37546, 37964, 94], [37964, 37964, 95], [37964, 38140, 96], [38140, 38140, 97], [38140, 38140, 98], [38140, 38699, 99], [38699, 38699, 100], [38699, 38699, 101], [38699, 38699, 102], [38699, 38699, 103], [38699, 38699, 104], [38699, 40235, 105], [40235, 40235, 106], [40235, 40235, 107], [40235, 40235, 108], [40235, 40235, 109], [40235, 40235, 110], [40235, 40643, 111], [40643, 40643, 112], [40643, 40656, 113], [40656, 42279, 114], [42279, 43734, 115], [43734, 43734, 116], [43734, 43764, 117], [43764, 45097, 118], [45097, 45430, 119], [45430, 45612, 120], [45612, 46146, 121], [46146, 46771, 122], [46771, 47165, 123], [47165, 47165, 124], [47165, 47165, 125], [47165, 47336, 126], [47336, 48086, 127], [48086, 48086, 128], [48086, 48108, 129], [48108, 49518, 130], [49518, 49996, 131], [49996, 49996, 132], [49996, 50020, 133], [50020, 53457, 134], [53457, 54708, 135], [54708, 54708, 136]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 54708, 0.14914]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
e61621a3c4063192cdb36b453bd6f99a1108f94b
|
Test-Case Prioritization for Configuration Testing
Runxiang Cheng
University of Illinois
Urbana-Champaign, IL, USA
rcheng12@illinois.edu
Darko Marinov
University of Illinois
Urbana-Champaign, IL, USA
marinov@illinois.edu
Lingming Zhang
University of Illinois
Urbana-Champaign, IL, USA
lingming@illinois.edu
Tianyin Xu
University of Illinois
Urbana-Champaign, IL, USA
tyxu@illinois.edu
ABSTRACT
Configuration changes are among the dominant causes of failures of large-scale software system deployment. Given the velocity of configuration changes, typically at the scale of hundreds to thousands of times daily in modern cloud systems, checking these configuration changes is critical to prevent failures due to misconfigurations. Recent work has proposed configuration testing, Ctest, a technique that tests configuration changes together with the code that uses the changed configurations. Ctest can automatically generate a large number of ctests that can effectively detect misconfigurations, including those that are hard to detect by traditional techniques. However, running ctests can take a long time to detect misconfigurations. Inspired by traditional test-case prioritization (TCP) that aims to reorder test executions to speed up detection of regression code faults, we propose to apply TCP to reorder ctests to speed up detection of misconfigurations. We extensively evaluate a total of 84 traditional and novel ctest-specific TCP techniques. The experimental results on five widely used cloud projects demonstrate that TCP can substantially speed up misconfiguration detection. Our study provides guidelines for applying TCP to configuration testing in practice.
CCS CONCEPTS
- Software and its engineering → Software testing and debugging → Software reliability.
KEYWORDS
Test prioritization, configuration, software testing, reliability
1 INTRODUCTION
Besides source-code changes, configuration changes are among the dominant causes of failures in large-scale software system deployments. In fact, configuration changes can be much more frequent than code changes. Many companies are deploying configuration changes to production systems hundreds to thousands of times a day [31, 33, 55, 64], hence misconfigurations become inevitable. For example, 16% of the service-level incidents at Facebook are induced by configuration changes [60], including major outages that turn down the entire service [21, 56], and misconfigurations were reported as the second largest cause of service disruptions in a main Google service [3]. The prevalence and severity of misconfigurations have been repeatedly reported by many failure studies [14, 23, 35, 37, 46, 68, 69, 73, 74].
Recently, Ctest has been proposed as a promising technique for configuration testing, i.e., testing a configuration before deployment [59, 70]. Ctest can effectively detect misconfigurations. The key idea of configuration testing is to connect configuration changes to software tests, so that configuration changes can be tested in the context of code affected by the changes. In this way, configuration testing can reason about the program behavior under the actual configuration values to be deployed and detect sophisticated misconfigurations that can hardly be detected by rule-based validation [4, 7, 17, 42, 60] or data-driven approaches [33, 38, 53, 54, 62, 66, 67, 76, 78]. Attractively, our prior work [59] shows that configuration test cases, or ctests, can be generated by parameterizing existing software tests abundant in mature software projects—up to 83.2% of existing tests can be transformed into ctests.
At a high level, a ctest is a software test parameterized by a set of configuration parameters. Running a ctest instantiates each parameter with a concrete value (e.g., the default value, the current value in production, or a new value to be deployed to production). Given a configuration change, all the ctests which are parameterized by at least one of the changed parameters are selected to run. Because one configuration parameter can parameterize many ctests, a configuration change can require running a large number of ctests. For example, some configuration changes from the HDFS project require running more than 2,000 ctests on average, which is over half of the total number of tests in that project [59]. Overall, in the Ctest dataset of five open-source projects (HCommon, HDFS, HBase, ZooKeeper, and Alluxio) [59], the number of ctests per configuration parameter is 1–3,069 (average 821), and a configuration change modifies 1–29 (average 6) parameters.
One main challenge in adopting configuration testing in continuous deployment is the time required to detect misconfigurations. This test-running time is on the critical path from the point where configuration changes are made to the point where they are deployed to production. For example, in the Ctest dataset, the time to run all ctests ranges from 20 minutes to 230 minutes (with an average of 97 minutes) per project. Given the velocity of configuration changes in modern deployment cycles [33, 60, 68], misconfigurations inevitably happen. With the large number of ctests to run before deployment, the time to detect the misconfiguration is crucial, because developers cannot start troubleshooting until the misconfiguration is detected. The time to detect the misconfiguration can greatly affect configuration deployment.
We are the first to address the cost of configuration testing using test-case prioritization (TCP). Traditionally, TCP aims to order regression tests to expose code bugs faster during software evolution. TCP has been extensively studied for over two decades [10, 48, 75]. For example, widely studied are the total TCP strategy [48] that favors tests covering more code elements and the additional TCP strategy [49] that favors tests covering more code elements not yet covered by already prioritized tests. Inspired by traditional TCP, we aim to leverage TCP techniques to order ctests to substantially speed up misconfiguration detection for configuration changes.
We extensively evaluate 84 TCP techniques on the large Ctest dataset [59], with 7,974 ctests for five open-source projects and 66 real-world configuration change files collected from public Docker images that have some misconfigured parameter values. Our experiments with configuration changes do not involve code changes, matching realistic scenarios where only a new configuration is about to be deployed. We start with 16 basic TCP techniques: (1) randomized as the baseline, (2) traditional techniques based on code coverage, (3) quick-time-first (QTF) technique, (4) recently proposed techniques based on information retrieval (IR), and (5) our novel configuration-specific TCP techniques.
We next enhance the basic TCP techniques using two sources of inspiration. First, using the idea of cost-cognizant TCP [9, 30], we enhance basic TCP techniques with the test execution time to design hybrid TCP techniques. Second, inspired by cross-checking configurations of multiple system instances used in troubleshooting systems such as the Microsoft PSS [18, 63, 64], we design a new family of peer-based TCP techniques that consider the test outcomes of ctests on related configuration changes. The insight is to prioritize earlier ctests that detected misconfigurations of a parameter in peer deployments, because these ctests are likely effective for the parameter change regardless of the value. Following Microsoft PSS, our peer-based TCP techniques are privacy preserving and do not use potentially sensitive value information of peer deployments but use only parameter names.
Our study leads to the following key findings:
- Among basic techniques, QTF yields competitive performance and often outperforms sophisticated techniques (e.g., based on code coverage or IR) and even some configuration-specific techniques (e.g., based on parameter-coverage and stack traces) by up to 22% (using an APFDc-like metric, §4.2).
- Hybrid TCP techniques that enhance basic techniques with the test execution time improve the performance of basic techniques by up to 27%. Our results confirm that hybrid, cost-cognizant TCP techniques are effective, even in the new domain of configuration testing.
- Peer-based TCP techniques can outperform other techniques and improve the performance of TCP even further by 15%. The results encourage sharing configuration test outcomes for the same project: “make friends and don’t test alone!”
Our paper makes the following contributions:
- Our work reduces the time to find misconfigurations, one of the main challenges of adopting configuration testing in real-world continuous deployment process.
- We evaluate 84 traditional and ctest-specific TCP techniques for configuration testing, and we have released our code and data at https://github.com/xlab-uiuc/ctest_prio_art.
- We analyze the effectiveness of TCP for ctests and find highly promising results for reducing the time to find test failures and thus detecting misconfigurations early.
2 BACKGROUND
Configuration testing is a testing technique for detecting misconfigurations (manifesting as failing tests) to prevent them from being deployed to production systems. The basic idea is to connect software tests with the specific configuration to be deployed. In this way, configuration testing can test configuration changes in the context of code that is affected by the changed configuration. A configuration test case (ctest) is parameterized by a set of configuration parameters. Running a ctest instantiates each of its input parameters with an actual configuration value to be deployed to production. Like regular software tests, ctests exercise the program and check (via assertions) that program behavior satisfies certain properties (e.g., correctness, performance, security). Figure 1 illustrates an example ctest from prior work [59].
Ctest (configuration testing) differs from approaches that explore multiple configurations, e.g., configuration-aware testing, combinatorial testing, or misconfiguration-injection testing [16, 22, 24, 32, 34, 44, 57, 72], which sample representative configurations or misconfigurations through systematic or random exploration of the enormous space of value combinations. Systematic exploration can be prohibitively expensive due to combinatorial explosion [34], while random exploration can have a low probability of covering all the values that will be deployed [32]. Ctest has neither the cost of systematic exploration nor the low coverage of random exploration. Ctest focuses on testing only one specific configuration that is to be deployed to the production system.
A ctest $\hat{h}(\hat{P})$ is parameterized by a set of configuration parameters $\hat{P}$. Running a ctest instantiates each parameter $p \in \hat{P}$ with a concrete value as an argument. $\hat{P}$ is typically a small subset of all the configuration parameters (denoted as $P$).
A system configuration is defined as the values of all the configuration parameters, denoted as $C = \bigcup_{i=1}^{m} P_i \{ (p_i \mapsto v_i) \}$, i.e., it assigns a value $v_i$ to every parameter $p_i \in P$. Running a ctest instantiates each parameter $p_i \in \hat{P}$ with its value in the system configuration $v_i$ such that $(p_i \mapsto v_i) \in C$.
A configuration change updates the values of a subset of the configuration parameters. A configuration change is in the form of a configuration file diff $D$. To test a given $D$, not all available ctests are run. A ctest $\hat{h}(\hat{P})$ is selected to test a given $D$ if at least...
one configuration parameter in \( D \) is in the input parameter set \( \hat{P} \). A configuration diff, \( D \), passes if all selected ctests pass, and it fails if any selected ctest fails. Figure 2 gives an example of configuration testing for a given configuration file diff.
Overall, ctests check whether the configuration to be deployed has some misconfigurations, which will manifest as ctest failure. TCP for ctests pushes this further by trying to detect these misconfigurations, if any, as soon as possible by first running ctests that are more likely to fail for the new configuration.
3 TCP TECHNIQUES
We next present all the TCP techniques we study for reducing the cost of detecting misconfigurations in configuration testing. §3.1 presents basic TCP techniques that do not require peer configuration changes, while §3.2 presents basic TCP techniques that analyze the correlation between peer configuration changes and test failures to achieve more precise test prioritization. Lastly, §3.3 further introduces hybrid TCP techniques that combine basic peer-based or non-peer-based techniques with test execution time. Table 1 summarizes the notation for all evaluated TCP techniques.
3.1 Non-peer-Based TCP
The non-peer-based TCP techniques include both traditional TCP techniques widely studied for regression testing (§3.1.1) and new TCP techniques we design for configuration testing (§3.1.2).
3.1.1 Traditional TCP Techniques. We study the following traditional TCP techniques:
**Code-Coverage-Based TCP.** TCP techniques based on code coverage have been extensively evaluated [28, 48, 75] and are still widely used for comparisons against newly proposed techniques [40, 41]. Code-coverage-based TCP techniques determine the test execution order based on the code coverage of each test. For example, the total technique sorts tests in the descending order of the number of code elements (e.g., methods or statements) covered by each test, while the additional technique sorts tests in the descending order of the number of code elements covered by each test but uncovered by the already prioritized tests [49]. In the literature, code-coverage-based TCP has been widely studied at both the method and statement granularities [28]. Thus, we also evaluate total and additional code-coverage-based TCP at both method (denoted as \( CC^m_{\text{tot}} \) and \( CC^m_{\text{add}} \)) and statement granularity (denoted as \( CC^s_{\text{tot}} \) and \( CC^s_{\text{add}} \)).
**Parameter-Coverage-Based TCP.** Inspired by traditional TCP techniques based on code coverage, we propose novel TCP techniques based on parameter coverage. Following the definition of ctest (§2), each ctest \( t_i \) can test a non-empty set of input configuration parameters \( \hat{P} \). We treat \( \hat{P} \) as the parameters covered by \( t \). We propose total and additional TCP techniques based on such parameter coverage, denoted as \( PC^\text{tot} \) and \( PC^\text{add} \), respectively.
We also consider the parameter change information to design change-aware, parameter-coverage-based TCP. For each configuration change \( D \), the set of changed parameters is denoted \( \hat{P} \). For each ctest \( t_i \), we determine its priority based on the set of covered changed parameters, i.e., \( t_i \cap \hat{P} \). Change-aware parameter coverage prioritizes ctests that are more relevant to the configuration change, thus can potentially detect misconfigurations earlier. We evaluate both total and additional techniques based on change-aware parameter coverage, denoted as \( PC^D_{\text{tot}} \) and \( PC^D_{\text{add}} \), respectively.
**Stack-Trace-Based TCP.** Different ctests may read and test the same parameter in different invocation contexts and thus may have different capabilities in detecting problematic parameter changes. For example, two ctests \( t_1(\hat{P}_1) \) and \( t_2(\hat{P}_2) \) may read \( p \in \hat{P}_1 \cap \hat{P}_2 \) in

We now present a family of new ctest TCP techniques, termed peer-based TCP, that consider the test outcomes of ctests from related, peer configurations. Data from peer systems have been used in troubleshooting systems such as the Microsoft PSS [18, 63, 64], e.g., PeerPressure utilizes configuration data from peer machines to infer root causes of misbehavior [64]. Inspired by this idea, peer-based TCP prioritizes ctests that detected misconfigurations of a parameter in peer deployments, as these ctests are likely to be effective for the parameter change regardless of the value.
Deploying peer-based TCP can be done via a server/database that receives, anonymizes, and stores failed configurations and ctest outcomes from internal or community sources, to be used for future prioritization, e.g., PeerPressure utilized the GeneBank database to troubleshoot misconfigurations at Microsoft [64]. Specifically, our peer-based TCP are privacy preserving and do not use potentially sensitive values of peer deployments.
The general definition of peer-based TCP is simple. Let \( D \) be a configuration change to be tested by a ctest suite \( T \), and \( S \) be a set of peer configuration changes \( (D \notin S) \) that have been tested. A peer-based TCP technique orders \( T \) based on various statistics collected from \( S \). Depending on the granularity of the peer analysis, we propose two categories of peer-based techniques, at the configuration granularity (3.2.1) and the parameter granularity (3.2.2). Given a ctest \( t \), \( D \), and information from \( S \), each technique computes a set of elements \( X(t, D, S) \) for the ctest; these sets can be ordered using a total \( (X_{\text{tot}}) \) or additional \( (X_{\text{add}}) \) approach, and we evaluate both on all categories of peer-based techniques.
We illustrate all our proposed techniques using the example shown in Figure 3. It contains a configuration change \( D_0 \), its ctest suite \( T \), and a set of peer configuration changes \( S \). Note that each change is with respect to some default configuration and lists parameters whose values changed. The root-cause information specifies the misconfigured parameter(s) that caused a ctest to fail on a configuration change (e.g., only p3 caused t1 to fail on D1). Empty cells indicate that the test passed. Thus, \( T \) has three types of orders for \( D \): optimal (run passing t3 last), sub-optimal (run t3 second), and worst-case (run t3 first).
### 3.2.1 Techniques at the Configuration Granularity
We now discuss TCP techniques based on peer configuration changes at different granularity levels:
#### All Configurations (Confull)
The Confull set of each ctest \( \hat{t}(\hat{P}) \) is simply the set of all peer configuration changes where \( \hat{t} \) failed:
\[
\text{Confull}(\hat{t}, D, S) = \{D' \in S \mid \text{Fail}(\hat{t}, D')\}
\]
(1)
where Fail(\( \hat{t}, D' \)) indicates \( \hat{t} \) failed on a peer configuration change \( D' \). For the example in Figure 3, Confull \((t1, D, S) = \{D1, D2, D3, D4\} \), Confull \((t2, D, S) = \{D1, D2, D3\} \), and Confull \((t3, D, S) = \{D1, D2, D3, D4, D5\} \). Thus, Confull orders \( T \) as t3-t1-t2, and Confull can order \( T \) as t3-t2-t1 or t3-t1-t2. According to the root causes of \( D \), both techniques only produce worst-case orders of \( T \).
Confull is change-unaware and can prioritize earlier a ctest that failed many peer configuration changes even if they share no changed parameter(s) with \( D \), degrading \( T \)’s performance in detecting the misconfigurations in the parameters changed in \( D \). Thus, all the following peer-based TCP techniques are change-aware and consider which parameters have changed for better prioritization.
#### Configurations Sharing Parameter Changes (ConDP)
The ConDP set of each ctest \( \hat{t}(\hat{P}) \) restricts the set to peer configuration changes sharing parameter changes:
\[
\text{ConDP}(\hat{t}, D, S) = \{D' \in S \mid \hat{t} \text{ failed on } D' \} \cap \{\text{Confull}(\hat{t}, D', S) \}
\]
(2)
As ConDP only prioritizes ctests that changed the same parameters as \( D \), we refer to it as a change-aware variant of Confull.
#### Change-unaware stack-trace-based
Change-unaware stack-trace-based TCP techniques order the peer configuration changes based on the stack trace of each API invocation during generation of ctests from configuration management class(es) in the system. The ctest infrastructure \([36, 59]\) intercepts the configuration APIs and logs the stack trace of each API invocation. The peer-based TCP techniques consider all the methods from all stack traces where \( \hat{t} \) reads only the parameters from \( \hat{P} \). Thus, ConDP can order \( T \) as t3-t2-t1 or t3-t1-t2. According to the root causes of \( D \), both techniques only produce worst-case orders of \( T \).
Figure 3: An example to illustrate peer-based TCP changes that have changed parameters in common\(^1\) with D:
\[
\text{Conf}^{DP}(i, D, S) = \{D' \in S \mid P_{D'} \cap P_D \neq \emptyset \} \land \text{Fail}(\hat{i}, D') \]
(2)
For our example, Conf\(^{DP}\)(t1, D, D3) because P3 \(\cap\) P0 = \{p1, p2, p3\}, P0 \cap P2 = \{p1, p2\}, and P0 \cap P3 = \{p1\}. Similarly, Conf\(^{DP}\)(t2, D, S) = \{D1, D2, D3\} and Conf\(^{DP}\)(t3, D, S) = \{D1, D2, D3\}. Both Conf\(^{DP}_t\) and Conf\(^{DP}_t\) can produce all 6 permutations of T because all 3 ctests have the same priority.
While more precise than Conf\(^{DP}\), Conf\(^{DP}\) could include D' when changed parameters in common between D' and D are not even read by \(\hat{i}\). In this way, a larger set for Conf\(^{DP}\) may not indicate that \(\hat{i}\) is more effective in detecting misconfigurations on the current changed parameters read by \(\hat{i}\). Therefore, we next consider parameter coverage information for more precise TCP.
**Configurations Sharing Parameter Coverage (Conf\(^{PC}\)).** The Conf\(^{PC}\) set of each ctest \(\hat{i}(\hat{P})\) further restricts the set to peer configuration changes that have changed parameters in common with D and also some parameter(s) in common read by \(\hat{i}\):
\[
\text{Conf}^{PC}(i, D, S) = \{D' \in S \mid P_{D'} \cap P_D \neq \emptyset \} \land \text{Fail}(\hat{i}, D') \land \text{Fail}(\hat{i}, D') \]
(3)
For our example, Conf\(^{PC}\)(t1, D, S) = \{D1, D2\} because P0 \cap P0 \cap P1 = \{p2, p3\} and P0 \cap P2 \cap P1 = \{p2\}, while P0 \cap P3 \cap P1 = \{\}. Similarly, Conf\(^{PC}\)(t2, D, S) = \{D1, D2, D3\} and Conf\(^{PC}\)(t3, D, S) = \{D1, D2, D3\}. Both Conf\(^{PC}_t\) or Conf\(^{PC}_t\) can order T as t1-t2-t3 or t2-t3-t1. Either technique has 50% probability of producing an optimal or sub-optimal order of T, and produces no worst-case order.
Conf\(^{PC}\) may still be imprecise when the exact parameter(s) that caused \(\hat{i}\) to fail on D' are not in P_{D'} \cap P_D \cap \hat{P}, which happens when the root-cause parameter(s) of \(\hat{i}\) on D' are not in P_{D'} but not in P_{D'} \cap P_D. In such a scenario, even if the technique prioritizes ctests with larger Conf\(^{PC}\), the misconfiguration detection efficiency on D may not improve simply because the root-cause parameter(s) of the peer configuration changes are not in P_{D'}. Therefore, we next consider the root-cause parameter information.
**Configurations Sharing Root Causes (Conf\(^{RC}\)).** The Conf\(^{RC}\) set of each ctest \(\hat{i}(\hat{P})\) further restricts the set to peer configuration changes whose root-cause misconfigured parameters are also changed in D:
\[
\text{Conf}^{RC}(i, D, S) = \{D' \in S \mid \text{RC}(\hat{i}, D') \cap P_D \neq \emptyset \} \land \text{Fail}(\hat{i}, D') \land \text{Fail}(\hat{i}, D') \]
(4)
RC(\(i, D'\)) is the set of root-cause misconfigured parameter(s) that actually caused the failure of \(\hat{i}\) in configuration change D'. Note that RC(\(i, D'\)) \(\subseteq \hat{P}\) because a parameter must be read by \(\hat{i}\) (i.e., in \(\hat{P}\)) to be a root cause of the failure of \(\hat{i}\).
In Figure 3, Conf\(^{RC}(t1, D, S) = \{D\} \) because only RC(t1, D1) \(\cap\) P0 = \{p3\} is non-empty. Similarly, Conf\(^{RC}(t2, D, S) = \{D1, D2, D3\}\) and Conf\(^{RC}(t3, D, S) = \{\}\). Conf\(^{RC}_t\) orders T as t2-t1-t3, and Conf\(^{RC}_t\) can order T as t2-t1-t3 or t2-t3-t1. The probability of producing an optimal order of T is 50–100%, and no worst-case order is produced.
While Conf\(^{RC}\) is more precise than the earlier peer-based techniques, it requires to maintain the root-cause information for all failed peer configuration changes. Developers could record such information while debugging misconfigurations, but such information may not always be available (§4.3).
### 3.2.2 Techniques at the Parameter Granularity
We now discuss our peer-based techniques based on individual parameters in peer configurations at different precision levels. Conf\(^{PC}\) and Conf\(^{DP}\) techniques do not consider parameter coverage and thus have no parameter-granularity counterparts.
**Shared Parameter Coverage with Peers (Para\(^{PC}\)).** The Para\(^{PC}\) set of each ctest \(\hat{i}(\hat{P})\) is the set of parameters from peer configuration changes in Conf\(^{PC}\)(i, D, S) described in §3.2.1:
\[
\text{Para}^{PC}(i, D, S) = \bigcup_{D' \in S, \text{Fail}(\hat{i}, D')} P_{D'} \cap P_D \cap \hat{P} \]
(5)
Collecting for each ctest the parameters instead of failed peer configuration changes explores another possibility where peer-based TCP could prioritize earlier ctests that failed on a relatively smaller number of peer configuration changes but a larger set of configuration parameters from the changes.
For our example, Para\(^{PC}(t1, D, S) = \{p2, p3\}\), Para\(^{PC}(t2, D, S) = \{p1\}\), and Para\(^{PC}(t3, D, S) = \{p2\}\). Para\(^{PC}_t\) orders T as t1-t2-t3 or t1-t3-t2. Para\(^{PC}_t\) orders T as t1-t2-t3. The probability of producing optimal orders of T is 50–100%, with no worst-case order produced, which is an overall improvement to the counterpart (Conf\(^{PC}\)) from §3.2.1.
**Shared Root Causes with Peers (Para\(^{RC}\)).** The Para\(^{RC}\) set of each test \(\hat{i}(\hat{P})\) is the set of parameters from peer configuration changes in Conf\(^{RC}\)(i, D, S) described in §3.2.1:
\[
\text{Para}^{RC}(i, D, S) = \bigcup_{D' \in S, \text{Fail}(\hat{i}, D')} \text{RC}(\hat{i}, D') \cap P_D \]
(6)
For our example, Para\(^{RC}(t1, D, S) = \{p3\}\), Para\(^{RC}(t2, D, S) = \{p1\}\), and Para\(^{RC}(t3, D, S) = \{\}\). Both Para\(^{RC}_t\) and Para\(^{RC}_t\) can order T as t1-t2-t3 or t2-t1-t3. The probability of producing optimal orders of T is thus 100%, which improves over the counterpart (Conf\(^{RC}\)) from §3.2.1.
### 3.3 Hybrid TCP
Various TCP techniques have been reported to benefit by additionally considering test execution time [9, 30, 41, 50]. For example, the cost-cognizant additional code-coverage-based technique [30], which considers the additional code coverage per time unit for each test, can substantially improve the additional technique in terms of the time for detecting regression faults. Therefore, besides all the basic TCP techniques introduced in §3.1–3.2, we introduce hybrid techniques that combine the basic techniques with test execution time. Inspired by the prior work in cost-cognizant TCP [30, 41, 50],
\^[1\]Note that it considers only parameter names and not values.
we define and implement two generic cost-cognizant hybrid TCP models. We apply both models to all aforementioned TCP techniques to construct hybrid TCP techniques, and evaluate their prioritization effectiveness for tests.
3.3.1 Divide-by-Time. Following the traditional cost-cognizant TCP techniques, the Divide-by-time (T\textsubscript{div}) model constructs hybrid TCP techniques that prioritize tests in the descending order of the input tests’ priority values per time unit, i.e., the original priority values divided by the test execution time. For example, a hybrid additional code-coverage TCP technique with T\textsubscript{div} model (CC\textsubscript{adm} + T\textsubscript{div}) prioritizes the test with the largest value of the number of uncovered methods divided by the test execution time.
3.3.2 Break-Tie-by-Time. We further study how to use time information in the Break-tie-by-time (T\textsubscript{tie}) model. It constructs hybrid TCP techniques that order tests that are “tied” by the basic TCP technique (i.e., multiple tests have the same priority score) in the ascending order of their test execution time (as QTF). For example, hybrid technique CC\textsubscript{adm} + T\textsubscript{tie} orders the tied tests with QTF when multiple tests have the same amount of covered methods.
4 EXPERIMENTAL SETUP
4.1 Research Questions
In this study, we aim to answer the following research questions:
- **RQ1:** How do basic non-peer-based TCP techniques perform in detecting real-world misconfigurations?
- **RQ2:** How do hybrid non-peer-based TCP techniques perform compared with the basic non-peer-based techniques?
- **RQ3:** How do peer-based TCP techniques perform compared to non-peer-based TCP techniques?
4.2 Metrics
Common metrics to evaluate traditional TCP techniques are Average Percentage of Faults Detected (APFD) and Average Percentage of Faults Detected per Cost (APFDc) \cite{1}. APFDc is a cost-aware variant of APFD that considers the cost of test executions \cite{2, 3}. In the context of configuration testing, however, test failures are caused by misconfigurations and not (code) regression faults. Thus, we adapted the definition of APFD and APFDc to derive two new metrics for evaluating TCP techniques for configuration testing:
$$APFD = 1 - \frac{\sum_{i=1}^{n} TF_i}{n \times m} + \frac{1}{2n}$$
APM computes the area under the curve between the percentage of detected misconfigurations in a configuration change and the percentage of the test suite executed, as illustrated in Figure 4. Note that a larger area always implies faster overall detection for all misconfigurations in the current configuration change. For example, O1 detects 50% of the misconfigurations in D (i.e., p1) after executing 33.3% of T (i.e., t1), and O1 detects 100% of the misconfigurations in D (i.e., p1, p2) after executing 66.7% of T (i.e., t1, t2). Thus, the APMD value of O1 is 67% as 1 – \frac{\frac{1}{2} + \frac{1}{2}}{2} = 0.67 using Formula 7. However, like APFD, APM is cost-unaware. Although O1 and O2 have the same APMD value, O1 is actually more cost-effective than O2 because O1 halves the cost to detect the first misconfiguration compared to O2.
Average Percentage of Misconfigurations Detected per Cost (APMDc). APMDc considers the cost, as in APFDc, which commonly uses test execution time \cite{4, 5}. Let \( n \), \( m \), and \( TF_i \) be the same...
as for APMD, and $t_j$ be the execution time of the $j^{th}$ configuration test in the prioritized order:
$$\text{APMDc} = \frac{\sum_{i=1}^{m}(\sum_{j=1}^{n} t_j \cdot m)}{\sum_{j=1}^{n} t_j} - \frac{1}{2}t_F(\text{IR})$$
(8)
Similar to APMD, APMDc computes the area under the curve between the percentage of detected misconfigurations in a configuration change and the percentage of its test suite cost incurred, as illustrated in Figure 4. For example, the total cost of T is 6 seconds; 01 detects 50% of the misconfigurations in D after incurring 17% of the total cost (i.e., 1 second from t1), and 01 detects 100% of the misconfigurations in D after incurring 50% of the total cost (i.e., 1 second from t1 and 2 seconds from t2). Thus, the APMDc value of 01 is 79% as $\frac{14+2+3-1+1+2}{14+2+3-1+1+2} = 0.79$ using Formula 8. The APMDc value of 02 is lower than that of 01, showing that APMDc can properly distinguish the more cost-effective order.
APMDc, like APFDc, more precisely captures the cost/time that developers would actually experience to detect all misconfigurations. Prior studies [6, 30] show that APFD can rank TCP techniques for regression faults differently than APFDc, and thus APFDc is less reliable. We still evaluate both APMD and APMDc to check if the same holds for TCP techniques in the new application domain of configuration testing.
### 4.3 Dataset Collection
We build our evaluation dataset from the Ctest dataset [59], which contains 66 configuration changes with misconfigurations collected from real-world Docker images on Docker Hub [8, 71] for five widely-used projects: HCommon, HDFS, HBase, ZooKeeper, and Alluxio. The dataset also includes ctests for these projects. To compute APMD and APMDc, we ran ctests on all configuration changes and collected test outcomes and execution time.
We also identified the root-cause misconfigured parameter(s) for each test failure. Root-cause information is necessary to precisely compute APMD and APMDc for any TCP technique. Prior research on regression testing has had to map each test failure to the code fault(s) to compute APFD and APFDc [9, 30]. It is also necessary for constructing peer information for some peer-based TCP techniques (§4.2). Automated root-cause localization such as delta debugging [77] is not applicable because misconfigurations are not monotone due to configuration dependencies [7].While several advanced misconfiguration-diagnosis techniques exist [1, 2, 45, 65, 82, 83], we manually localized the root causes to ensure the precision; most failure-inducing misconfigured parameters can be easily identified as root causes by inspecting failure logs. Besides the techniques that need root causes, all others are fully automatic. We excluded flaky tests from the dataset using best-effort reruns [5]. Table 2 shows the version, number of configuration changes, and average numbers of parameters, misconfigured parameters, and ctests per change of each project.
### 4.4 Implementation
We implemented the main logic of all the studied TCP techniques in Python 3. Our infrastructure for test information collection and test prioritization is written in Java and Python.
#### 4.4.1 Test Information Collection
We next discuss how we collected the necessary test information required by the studied TCP techniques. We used OpenClover [39] to collect code coverage at statement and method granularity (§3.1.1). To collect ctest execution time (§3.1.1, §3.3), we ran each ctest 5 times prior to configuration changes on the same machine, and used the averages as the time for prioritization. Execution times reported as 0.000 by Maven are changed to 0.001 because Maven rounds off time to 3 decimal places. For IR data (§3.1.1), we implemented a parser in Java 8 with JavaParser 3.18.0 [38] to collect tokens from test class files for all evaluated projects. We also performed an automated step of ctest generation with the open-sourced Ctest prototype [36] to collect invocation contexts for stack-trace-based TCP techniques (§3.1.2). We directly collected parameter coverage (§3.1.2) from open-sourced ctests [36]. Inspired by cross validation [58], for each configuration change in the dataset, we treated the other configuration changes from the same project as its peer configuration changes (§3.2).
#### 4.4.2 Test Prioritization
Because most of the studied TCP techniques are built based on the traditional total and additional techniques, we implemented generic total and additional TCP functions following the traditional definitions. We also implemented the QTF TCP technique according to the traditional definition. For IR-based techniques (§3.1.1), the choice of retrieval model and the approach to construct data objects can substantially affect the performance [41, 51]. Our IR-based TCP techniques used the BM25 retrieval model [47], as well as $\text{High}_{\text{token}}$ and $\text{Low}_{\text{token}}$ for data-object construction, which have been demonstrated to achieve state-of-the-art performance by Peng et al. [41]. Specifically, our $\text{IR}_{\text{high}}$ TCP technique used the $\text{High}_{\text{token}}$ construction, where a document only contains identifiers from a test file. Similarly, our $\text{IR}_{\text{low}}$ TCP technique used the $\text{Low}_{\text{token}}$ construction, where a document contains identifiers, comments, and string literals from a test file. We collected documents at test-case level utilizing Saha et al.’s approach [51], treating each test method as a test case, as common in JUnit. We processed documents following standard tokenization steps [41]. Unlike code changes, which can contain a variety of elements, a configuration change only contains names and values of the changed parameters. To construct query for each configuration change, we only use tokenized names of the changed parameters, because actual configuration values are often too specific to be found in the test code.
### Table 2: Configuration Change Dataset
<table>
<thead>
<tr>
<th>Project</th>
<th>Ver.</th>
<th>#Changes</th>
<th>Avg #Params</th>
<th>Avg #CTests</th>
</tr>
</thead>
<tbody>
<tr>
<td>HCommon</td>
<td>2.8.5</td>
<td>20</td>
<td>3.75</td>
<td>1.05</td>
</tr>
<tr>
<td>HDFS</td>
<td>2.8.5</td>
<td>16</td>
<td>5.19</td>
<td>1.31</td>
</tr>
<tr>
<td>HBase</td>
<td>2.2.2</td>
<td>12</td>
<td>8.33</td>
<td>1.92</td>
</tr>
<tr>
<td>ZooKeeper</td>
<td>3.5.6</td>
<td>14</td>
<td>6.57</td>
<td>1.71</td>
</tr>
<tr>
<td>Alluxio</td>
<td>2.1.0</td>
<td>4</td>
<td>13.75</td>
<td>1.25</td>
</tr>
</tbody>
</table>
Note that the time for APMDc is measured when running tests on the changed configuration, while the time used to prioritize tests (in QTF and hybrid techniques) is from running tests prior to the change.
4.5 Experimental Procedure
To compare all the studied TCP techniques, we also implemented a randomized TCP technique (denoted as Rand) to serve as baseline, which shuffles cests with a random seed. For all studied TCP techniques with no break-tie strategy specified, ties are also broken with random seeds. Thus, to amount for different results from randomization, we ran each TCP technique on every configuration change 100 times, each time with a different seed. Specifically, for each TCP technique, we did the following: (1) load the collected configuration change dataset, i.e., cest outcome, execution time, root-cause analysis results under configuration changes, etc. (§4.3); (2) load the test information for the current technique (§4.4); (3) select a configuration change D that has not been run under the current technique; (4) initialize a random seed; (5) apply current technique to order the cest suite of D; (6) compute APMD and APMDc of the cest suite order based on the collected cest outcome, execution time, and root causes; (7) repeat steps (4)–(6) 100 times; (8) repeat steps (3)–(7) on all 66 configuration changes.
In total, we evaluated 84 TCP techniques for configuration testing: 16 basic non-peer-based techniques, of which 15 are described in §3.1 and 1 is randomized baseline; 12 basic peer-based techniques described in §3.2; 32 hybrid non-peer-based techniques, of which 16 each use $\chi_{A_\text{add}}$ and $\chi_{R_\text{add}}$ models (§3.3); and 24 hybrid peer-based ones. In total, we performed 554,400 (84*66*100) unique TCP executions.
5 RESULTS AND ANALYSIS
5.1 RQ1: Basic Non-peer-Based TCP
This RQ compares non-peer-based traditional and configuration-specific TCP techniques on APMD and APMDc. In Figure 5, each violin plot and its embedded box plot show the distribution of APMD or APMDc values per project per run for each TCP technique. Each violin/box plot represents 500 (5*100) data points, for five projects and 100 random seeds. The white bar in each box plot shows the median, while the dot shows the (arithmetic) mean over all the data points for each TCP technique.
We further show the Tukey HSD test [61] results in Table 3. Tukey HSD is a post-hoc test based on the studentized range distribution; it compares all possible pairs of means to find out which specific groups’ means (compared with each other) are significantly different. We performed this test on APMD and APMDc values to check for statistically significant differences among the studied TCP techniques [41]. In the table, Column “Average” shows the mean APMDc (“A. c”) and APMD (“A.”) values per technique (same as the dots in Figure 5). Importantly, Column “Group” presents the results of the Tukey HSD test. Tukey HSD puts techniques into different groups if they have statistically significant differences. Groups are named by capital letters, where “A” denotes the best group, and the performance degrades in alphabetical order. A technique having multiple letters has performance between these letter groups. From the results, we make the following observations.
Table 3: Results for basic non-peer-based TCP
<table>
<thead>
<tr>
<th>TCP</th>
<th>Average A.c</th>
<th>A.</th>
<th>Group</th>
<th>Average A.</th>
<th>A.</th>
</tr>
</thead>
<tbody>
<tr>
<td>ST$_{add}$</td>
<td>.895 .917</td>
<td>A</td>
<td>AB</td>
<td>.890 .768</td>
<td>AB G</td>
</tr>
<tr>
<td>QTF</td>
<td>.877 .898</td>
<td>ABC</td>
<td>BCD</td>
<td>.875 .934</td>
<td>ABC</td>
</tr>
<tr>
<td>PC$_{add}$</td>
<td>.870 .883</td>
<td>ABC</td>
<td>CDE</td>
<td>.870 .873</td>
<td>ABC CDE</td>
</tr>
<tr>
<td>CC$_{add}$</td>
<td>.865 .898</td>
<td>ABC</td>
<td>ABC</td>
<td>.859 .904</td>
<td>ABC</td>
</tr>
<tr>
<td>IR$_{high}$</td>
<td>.856 .924</td>
<td>BC</td>
<td>AB</td>
<td>.856 .855</td>
<td>BC E</td>
</tr>
<tr>
<td>CC$_{m}$</td>
<td>.841 .869</td>
<td>C</td>
<td>DE</td>
<td>.803 .811</td>
<td>D F</td>
</tr>
<tr>
<td>PC$_{tot}$</td>
<td>.798 .869</td>
<td>D</td>
<td>DE</td>
<td>.785 .865</td>
<td>D E</td>
</tr>
<tr>
<td>ST$_{tot}$</td>
<td>.743 .786</td>
<td>E</td>
<td>FG</td>
<td>.728 .777</td>
<td>E G</td>
</tr>
</tbody>
</table>
5.1.1 Total vs. Additional. We can observe that additional techniques tend to outperform total ones on APMD and APMDc. For example, stack-trace-based TCP has the highest average APMDc value (0.895) among all studied techniques when using the additional strategy, but it has one of the lowest average APMDc values (0.743) when using the total strategy. Similar findings can be observed for code-coverage-based TCP on the APMD values, as well as other studied techniques. The Tukey HSD test results also confirm our observation, e.g., for APMDc, almost all additional techniques are in worse Tukey HSD groups than Rand, while all total techniques are in worse groups. The key reason is that the additional strategy considers the impact of already prioritized tests and tends to execute more diverse tests, which can expose misconfigurations earlier. This finding is consistent with prior studies on traditional regression testing, which showed that additional techniques generally perform better than total techniques in TCP [20, 48, 51, 79]. In summary, we are the first to find that the additional strategy is preferred over the total strategy even for configuration testing.
5.1.2 Comparing Coverage Criteria. From Table 3, we can observe that traditional code coverage at method granularity is still effective in test-case prioritization for configuration testing. For example, the additional code-coverage-based TCP techniques outperformed others in APMD, in which CC$_{m_{add}}$ has the best performance. The reason is that a cest with higher code coverage is more likely to exercise its covered configuration parameters in more project
components, and thus has a higher chance to detect potential misconfiguration(s). Moreover, configuration-specific coverage criteria can outperform traditional code coverage on APMDc. For example, the additional stack-trace-based TCP (ST_add) is in a statistically better group than CC_add in APMDc. The potential reason is that ctests with larger traditional code coverage also tend to run slower; in contrast, configuration-specific coverage can also effectively guide misconfiguration detection, but ctests with higher configuration-specific coverage do not necessarily run slower.
Among the configuration-specific coverage criteria, the best stack-trace-based TCP technique (ST_add) usually performs better than the best parameter-code coverage-based TCP techniques (PC_add) on APMD and APMDc. The reason is that different ctests reading the same parameters may have greatly different invocation contexts and thus may have different capabilities in detecting misconfigurations. Another interesting finding is that both the best stack-trace-based and parameter-code coverage-based techniques tend to outperform their change-aware counterparts. For example, ST_add achieves 0.895 (0.917) in APMDc (APMD), while ST_add has 0.877 (0.898). The reason is that majority of configuration changes are relatively small. Thus, the additional techniques cannot easily prioritize ctests with new change-aware configuration-specific coverage, and behave as random baseline when no ctests have new coverage.
5.1.3 IR-Based TCP. Although IR-based techniques (§3.1.1) have been recently claimed to be the state-of-the-art in test-case prioritization and unsafe selection for traditional regression testing [41, 51], they never perform the best in configuration testing on APMD and APMDc. There are several potential reasons. First, configuration changes are usually small and less informative than code changes. Second, unlike code changes, configuration changes have no surrounding context [41]. Thus, each change query is built simply from tokenized names of changed parameters (¨4.4), which can often be too ambiguous. For example, the query built from changed parameters (data, dir) is a bag of words (data, dir, data, log, dir), which can be common in test files. Another interesting finding is that IR-based techniques never perform the worst in configuration testing. In fact, IR-based techniques are the most stable ones: in Figure 5, the plots for IR-based techniques are more concentrated near the median for both APMD and APMDc. The stability across runs for each project comes from test documents being large and diverse, so few ties are produced. Also, IR-based techniques prioritize ctests whose documents are more related to the names of changed parameters.
5.1.4 QTF-Based TCP. QTF has the highest average APMDc, but the absolutely lowest average APMD across all projects. The reason is that a considerable portion of ctests are transformed from unit tests that have rather short execution time. Thus, QTF prioritizes these faster ctests first and can end up running many more ctests than other TCP techniques before detecting the misconfigurations, leading to low APMD values. However, when considering the test cost for APMDc, QTF is much more cost-effective, because the ctests prioritized earlier have short execution time. For example, on HDF, many ctests prioritized earlier cost less than 0.1 second.
5.1.5 APMD vs. APMDc. While the rankings of many TCP techniques are similar by both APMD and APMDc, the diametrically opposite ranking of QTF when using APMD and APMDc indicates that APMD is not appropriate and can be misleading for configuration testing. This finding is consistent with prior work on traditional regression testing: APFD has been shown to be misleading in comparing TCP techniques because it does not consider test execution time [6, 30]. Therefore, in the following sections, we only focus on the APMDc results. Moreover, the high effectiveness of QTF in APMDc also inspired us to combine the basic techniques with test execution time information for hybrid techniques (§3.3).
5.1.6 Per-Project Results. Table 4 further presents the detailed average results for each studied project. The main findings—such as additional is better than total, and QTF is competitive—from the overall distribution of APMD/APMDc across all projects are also similar for individual projects. Thus, we do not show per-project results in the other RQs due to space limit and results being similar.
5.2 RQ2: Hybrid Non-peer-Based TCP
This RQ evaluates the effectiveness of hybrid non-peer-based TCP techniques with two hybrid models discussed in §3.3. Figure 6 shows the distribution of APMDc values for each hybrid non-peer-based technique: the names of corresponding basic non-peer-based techniques are shown on the x-axis, while the green/orange violin plots show the distribution of APMDc values for Divide-by-time (T_div) hybrid non-peer-based TCP techniques. Table 5 shows the overall average APMDc values and Tukey HSD groups for each TCP technique under the two hybrid models. Note that QTF+T_div serves as a baseline for T_div hybrid techniques—it is effectively Rand—while Rand+T_tie serves as a baseline for T_tie hybrid techniques—it is literally Rand.
5.2.1 Hybrid vs. Basic Non-peer-Based TCP. Both hybrid models improved the average APMDc values across projects on most of the basic non-peer-based techniques. For example, excluding the baselines, the average APMDc values over all basic non-peer-based techniques is 0.838 (Table 3), while the same values for T_tie and
Table 5: Results for hybrid non-peer-based TCP
<table>
<thead>
<tr>
<th>TCP</th>
<th>Average T_div</th>
<th>T_tie</th>
<th>Group T_div</th>
<th>T_tie</th>
</tr>
</thead>
<tbody>
<tr>
<td>CC_m</td>
<td>961.990</td>
<td>A</td>
<td>BC</td>
<td></td>
</tr>
<tr>
<td>CC_s</td>
<td>958.858</td>
<td>A</td>
<td>CD</td>
<td></td>
</tr>
<tr>
<td>ST_tot</td>
<td>924.723</td>
<td>B</td>
<td>G</td>
<td></td>
</tr>
<tr>
<td>CC_tot</td>
<td>920.798</td>
<td>BC</td>
<td>F</td>
<td></td>
</tr>
<tr>
<td>PC_tot</td>
<td>919.813</td>
<td>BC</td>
<td>EF</td>
<td></td>
</tr>
<tr>
<td>ST_add</td>
<td>915.743</td>
<td>BCD</td>
<td>G</td>
<td></td>
</tr>
<tr>
<td>ST_add</td>
<td>908.928</td>
<td>BCDE</td>
<td>A</td>
<td></td>
</tr>
<tr>
<td>ST_add</td>
<td>908.922</td>
<td>BCDE</td>
<td>AB</td>
<td></td>
</tr>
<tr>
<td>PC_tot</td>
<td>907.833</td>
<td>BCDE</td>
<td>DE</td>
<td></td>
</tr>
<tr>
<td>CC_s</td>
<td>898.785</td>
<td>CDEF</td>
<td>F</td>
<td></td>
</tr>
<tr>
<td>IR_high</td>
<td>893.865</td>
<td>DEF</td>
<td>CD</td>
<td></td>
</tr>
<tr>
<td>IR_low</td>
<td>893.859</td>
<td>DEF</td>
<td>CD</td>
<td></td>
</tr>
<tr>
<td>Rand</td>
<td>886.856</td>
<td>EFG</td>
<td>CD</td>
<td></td>
</tr>
<tr>
<td>PC_add</td>
<td>876.909</td>
<td>FG</td>
<td>AB</td>
<td></td>
</tr>
<tr>
<td>PC_add</td>
<td>865.889</td>
<td>GH</td>
<td>BC</td>
<td></td>
</tr>
<tr>
<td>QTF</td>
<td>850.890</td>
<td>H</td>
<td>BC</td>
<td></td>
</tr>
</tbody>
</table>
5.2.2 Divide- vs. Break-Tie-by-Time. Table 5 shows that T_div hybrid techniques overall perform better than T_tie hybrid techniques. The average APMDc values range from 0.850 to 0.961 for T_div, while they range from 0.723 to 0.928 for T_tie. Interestingly, the additional TCP techniques with configuration-specific code coverage tend to perform better with T_tie than with T_div, opposite to our overall finding. However, the basic TCP models do not read as many (changed) configuration parameters as they cover traditional methods or statements; when using the additional strategy on configuration-specific coverage, the basic priority scores of ctests quickly become 0 (already prioritized ctests cover all parameters, and yet-to-prioritize ctests cannot cover any more parameters), thus making T_div effectively become random. For example, on HDF5, PC_tot cannot provide additional coverage after prioritizing 2–4 ctests. Instead, the T_tie hybrid model can break such ties by ordering the tied tests in the ascending order of their execution time (§3.3), thus outperforming T_div in such cases.
5.2.3 Total vs. Additional. With the T_tie model, the additional hybrid techniques outperform all the total ones on average APMDc values. This finding is consistent with our finding for the basic non-peer-based techniques in §5.1.1. Interestingly, this no longer holds for the T_div model. Although the very best T_div hybrid techniques (CC_m^add + T_div and CC_s^add + T_div) are additional, all other additional techniques under-perform their total counterparts with the T_div hybrid model. The reason is that the priority of ctests can easily become 0 when using the additional strategy, making T_div behave as random (§5.2.2), while the total strategy can still effectively prioritize different ctests. Thus, the T_div model is more effective for total TCP techniques than T_tie when encountering 0 priority scores. Also, T_div can be more effective for basic criteria that include more elements and are more diverse, such as traditional code coverage.
5.3 RQ3: Peer-Based TCP
This RQ evaluates the effectiveness of both basic (§3.2) and hybrid (§3.3) peer-based TCP techniques for configuration testing. Figure 7 shows the distribution of APMDc values for all the evaluated peer-based techniques. Table 6 further shows the average APMDc values and the Tukey HSD groups for these techniques.
5.3.1 Peer-Based vs. Non-Peer-Based TCP. According to Table 6, 7 of the 12 basic peer-based techniques outperform the best non-peer-based technique (CC_m^add + T_div) by average APMDc. Moreover, as seen in Figure 7, all APMDc values for all peer-based techniques are well above 0.65, while multiple basic and hybrid non-peer-based techniques have APMDc values well below 0.65 even up to 0.2 (Figure 5 and Figure 6), indicating the effectiveness and stability of the basic peer-based techniques for configuration testing.
Para^add and Para^RC^add are statistically significantly better than other basic peer-based techniques, as they are both within the best Tukey HSD group ’A’. These two techniques are not statistically different, although Para^PC^add has a slightly higher average APMDc. This finding is surprising as Para^PC^add requires no root-cause information, but still performs as well as Para^RC^add, which requires such information (§3.2). The reason is that on some projects (e.g., ZooKeeper), many ctests have similar Para^RC^, so the additional strategy suffers the same problem as in §5.2.3. Meanwhile, Para^PC^add values of these ctests are more diverse (and larger than their Para^RC^add values).
Different from the results for the non-peer-based techniques, the hybrid models have only limited effectiveness for the peer-based techniques. The T_div model can only improve the effectiveness for the inferior peer-based techniques. For example, Conf^add^ tot has the worst basic technique, is improved from 0.899 to 0.945, while the two best basic techniques (Para^PC^add and Para^RC^add) have almost no change.
The \( T_{tie} \) model can only slightly improve the effectiveness of the superior peer-based techniques. For example, Para\(_{add}^{PC} \) changes from 0.985 to 0.991, while the inferior techniques (such as Conf\(_{add}^{all} \)) do not change at all. The reason is that total techniques usually have fewer ties, making \( T_{div} \) more effective than \( T_{tie} \).
### 5.3.2 Configuration vs. Parameter Granularity
Using both additional and total strategies, techniques at the parameter granularity have mostly outperformed techniques at the configuration granularity. For example, as seen from Table 6, with the additional strategy, the basic techniques at the parameter granularity (Para\(_{PC}^{T} \), Para\(_{RC}^{T} \)) are both in group ‘A’, while all basic techniques at the configuration granularity (Conf\(_{add}^{all} \), Conf\(_{add}^{DP} \), Conf\(_{add}^{PC} \), Conf\(_{add}^{RC} \)) are in group ‘B’. Similarly, with the total strategy, the basic Para\(_{RC}^{T} \) and Para\(_{PC}^{T} \) are in groups "AB" and "C", respectively, while all basic techniques at configuration granularity are within groups "C" or "D". This result is expected as the parameter granularity captures parameter-level information from other failed peer configuration changes, while the configuration granularity is more coarse-grained (§3.2.2).
### 5.3.3 Total vs. Additional
Similar to the results for the non-peer-based techniques, the additional strategy generally performs better than the total strategy for the basic and \( T_{tie} \) peer-based techniques. Except that Table 6 shows the basic Para\(_{RC}^{T} \) is a total technique at the parameter granularity that performed slightly better than basic additional techniques at the configuration granularity, because Para\(_{RC}^{T} \) leverages more fine-grained information about peer misconfigured parameters to guide more effective prioritization.
### 5.4 Summary
We compare the best techniques from each of the basic/hybrid peer-based/non-peer-based categories, i.e., \( ST_{add} \) (basic non-peer-based), CC\(_{add}^{m} + T_{div} \) (hybrid non-peer-based), Para\(_{add}^{PC} \) (basic peer-based), and Para\(_{add}^{RC} + T_{tie} \) (hybrid peer-based). We also include Rand and QTF as the baselines. Note that the QTF technique is rather competitive as it outperforms almost all the basic non-peer-based TCP techniques (Table 3). Table 7 presents the main comparison results. We can observe that all four techniques significantly outperform the Rand baseline, and three of them significantly outperform the QTF baseline. In summary: (1) CC\(_{add}^{m} + T_{div} \) is the best non-peer-based technique and recommended when no peer configuration information is available, (2) Para\(_{add}^{PC} \) and its \( T_{tie} \) counterpart are the best techniques (i.e., both in group ‘A’) and recommended when peer configuration information is available.
### 5.5 Threats to Validity
**External validity.** The threats to external validity mainly lie in projects and dataset used in this work. To reduce such threats, we directly use all the real-world projects and configuration changes from the Ctest dataset [36]. However, our evaluation is only based on tests, which cannot represent all possible types of configuration tests. Future work should consider more diverse datasets and other types of configuration tests.
**Internal validity.** The threats to internal validity mainly lie in the potential bugs in our techniques and experimental scripts. To reduce such threats, the authors regularly check the results and
code to eliminate potential bugs. Furthermore, we released all our dataset and code to benefit the community.
**Construct validity.** The threats to construct validity mainly lie in the metrics used in our study. To reduce such threats, we adapt two widely-used metrics for evaluating TCP techniques (APFD and its cost-aware variant APFDc) and propose new metrics (APMD and its cost-aware variant APMDc) for configuration testing.
6 DISCUSSION AND FUTURE WORK
To better measure the overall detection time for all the misconfigured parameters within each configuration change, we introduced APMDc (together with APMD) as our main evaluation metric. However, APMDc may not be preferred for practitioners with more interest in how TCP affects the time to detect misconfigurations. Thus, we also relate changes to APMDc with changes to the total test time. APMDc captures time to detect all misconfigured parameters in a configuration change. If there is only one misconfigured parameter, then 0.1 increase in APMDc maps to exactly 10% reduction of total time. If there are more misconfigured parameters, 0.1 may map to less or more than 10% time reduction to detect either the first misconfigured parameter or all misconfigured parameters. For our studied projects, 0.1 increase in APMDc maps to 7.86% (HCommon) to 21.93% (HBase) average time reduction to detect all misconfigured parameters. The reduction can be even larger to find the first misconfigured parameter, e.g., 0.1 increase in APMDc maps to 53.38% (Alluxio) average time reduction.
Our study also points to several directions for future work. Since historical data were reported to be useful in traditional test-case prioritization [10, 25, 41, 50], we could leverage historical configuration change test results from earlier code versions to develop history-based TCP techniques for configuration testing. We also consider improving the current configuration-specific TCP techniques and evaluating them on larger datasets. For example, we can fuse deeper context information (e.g., how ctests use their parameters acquired from configuration taint analysis) into stack-trace-based TCP techniques, or improve peer-based TCP techniques by combining more data from peer configurations (e.g., test time, failure stack traces).
Furthermore, we plan to understand the impact of software evolution on the performance of our evaluated TCP techniques for configuration testing. Although prior work has shown that the traditional prioritization techniques remain robust over multiple system releases [15], this conclusion may not hold in the context of configuration testing. Configurations and configuration-related code are updated frequently [60, 84], so certain types of test information may be more sensitive to software evolution. For example, data from old peer configuration changes could be less accurate in guiding peer-based TCP techniques on recent system releases.
We only evaluate the performance of TCP techniques on configuration changes. However, sometimes software developers may change both configuration and code in the same commit. In such context, a TCP technique should consider both configuration and code information, and balance the effectiveness in speeding up both misconfiguration and code fault detection. We plan to study how the mixture of configuration and code testing can shift the performance of our evaluated TCP techniques, and understand how to develop competitive TCP techniques in such context.
7 RELATED WORK
We have already introduced the background on configuration testing (§2) and discussed the related test-case prioritization (TCP) techniques (§3), so this section briefly discusses the basics and applications of TCP. TCP techniques were initially proposed to reorder test executions for traditional software systems (e.g., common C and Java applications) to speed up detection of regression faults during software evolution. To date, a large number of code-coverage-based TCP techniques have been proposed for such purpose, including techniques based on traditional total/additional heuristics [28], adaptive random testing [20], genetic algorithms [26], and constraint solving [99]. More recently, researchers have also looked into TCP techniques that do not require code-coverage information, e.g., techniques based on information retrieval [41] or static program analysis [29]. Interestingly, although more and more TCP techniques have been proposed, the traditional additional technique and its cost-cognizant variant (e.g., hybrid with Divide-by-time) have still remained among the most effective TCP techniques [6].
Besides the traditional application scenarios, TCP has also been applied to various other scenarios, e.g., mutation testing [81], fault localization [13], and automated program repair [12, 27, 43]. Moreover, researchers have applied TCP techniques for testing configurable systems [44, 57]. However, they still target the traditional regression testing problem, i.e., detecting regression faults caused by code changes, while also considering prioritizing the potential configurations that may likely expose regression faults. In contrast, this paper makes the first attempt to apply TCP for speeding up misconfiguration detection for configuration testing.
8 CONCLUSION
We have performed the first extensive study of TCP for configuration testing. We have implemented 84 traditional and novel ctest-specific TCP techniques. The experimental results on five popular cloud projects demonstrate that TCP can substantially speed up misconfiguration detection. We have also analyzed the impact of various controllable factors for applying TCP in configuration testing, including coverage criteria, hybrid models, total/additional strategies, peer-data granularities, and study metrics. In sum, our study reveals various practical guidelines for applying TCP in configuration testing, including: (1) among the basic TCP techniques, QTF is surprisingly competitive and often outperforms sophisticated techniques (based on code coverage or IR) and even some ctest-specific techniques (based on parameter coverage or stack traces), (2) hybrid TCP techniques (which enhance basic techniques with text execution cost information) can boost the performance of most basic techniques, and (3) peer-based TCP techniques (which leverage peer configuration data for better prioritization) can substantially outperform all other studied TCP techniques.
ACKNOWLEDGMENTS
We thank the anonymous reviewers for their valuable feedback. This work was partially supported by NSF grants CCF-1763788, 1763906, 1816615, 1942430, 2029049, and CNS-1740916, 1956007. We also acknowledge support for research on regression testing from Facebook, Futurewei, and Google; a Facebook Distributed Systems Research award; Microsoft Azure credits; and Google Cloud credits.
Ding Yuan, Yingliang Xie, Rina Panigrahy, Junfeng Yang, Chad Verbowski, and Arunvijay Kumar. 2011. Context-based Online Configuration Error Detection. In USENIX ATC.
Lingming Zhang, Dan Hao, Lu Zhang, Gregg Rothermel, and Hong Mei. 2013. Bridging the Gap between the Total and Additional Test-Case Prioritization Strategies. In ICSE. https://doi.org/10.1145/2660655
Sai Zhang and Michael D. Ernst. 2014. Which Configuration Option Should I Change?. In ICSE. https://doi.org/10.1145/2568225.2568251
|
{"Source-Url": "http://mir.cs.illinois.edu/~marinov/publications/ChengETAL21PrioritizingConfigurationTesting.pdf", "len_cl100k_base": 15983, "olmocr-version": "0.1.50", "pdf-total-pages": 14, "total-fallback-pages": 0, "total-input-tokens": 58403, "total-output-tokens": 18521, "length": "2e13", "weborganizer": {"__label__adult": 0.0003077983856201172, "__label__art_design": 0.0003197193145751953, "__label__crime_law": 0.00025272369384765625, "__label__education_jobs": 0.0012054443359375, "__label__entertainment": 7.009506225585938e-05, "__label__fashion_beauty": 0.00013911724090576172, "__label__finance_business": 0.00028252601623535156, "__label__food_dining": 0.00020372867584228516, "__label__games": 0.0006670951843261719, "__label__hardware": 0.0008492469787597656, "__label__health": 0.00035643577575683594, "__label__history": 0.00022470951080322263, "__label__home_hobbies": 8.052587509155273e-05, "__label__industrial": 0.0002343654632568359, "__label__literature": 0.0002722740173339844, "__label__politics": 0.00017690658569335938, "__label__religion": 0.00029158592224121094, "__label__science_tech": 0.019927978515625, "__label__social_life": 9.262561798095704e-05, "__label__software": 0.01355743408203125, "__label__software_dev": 0.9599609375, "__label__sports_fitness": 0.00017881393432617188, "__label__transportation": 0.0002963542938232422, "__label__travel": 0.00016188621520996094}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 69258, 0.05471]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 69258, 0.42552]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 69258, 0.85788]], "google_gemma-3-12b-it_contains_pii": [[0, 4584, false], [4584, 11635, null], [11635, 15733, null], [15733, 20638, null], [20638, 27209, null], [27209, 30618, null], [30618, 37313, null], [37313, 42706, null], [42706, 48306, null], [48306, 53388, null], [53388, 56973, null], [56973, 63846, null], [63846, 63846, null], [63846, 69258, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4584, true], [4584, 11635, null], [11635, 15733, null], [15733, 20638, null], [20638, 27209, null], [27209, 30618, null], [30618, 37313, null], [37313, 42706, null], [42706, 48306, null], [48306, 53388, null], [53388, 56973, null], [56973, 63846, null], [63846, 63846, null], [63846, 69258, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 69258, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 69258, null]], "pdf_page_numbers": [[0, 4584, 1], [4584, 11635, 2], [11635, 15733, 3], [15733, 20638, 4], [20638, 27209, 5], [27209, 30618, 6], [30618, 37313, 7], [37313, 42706, 8], [42706, 48306, 9], [48306, 53388, 10], [53388, 56973, 11], [56973, 63846, 12], [63846, 63846, 13], [63846, 69258, 14]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 69258, 0.13462]]}
|
olmocr_science_pdfs
|
2024-11-30
|
2024-11-30
|
6c9463bea735d58223a4eb5a41ce573a6d5d5675
|
# Non-proprietary Security Policy for FIPS 140-2 Validation
Boot Manager in
Microsoft Windows 10
Windows 10 Pro
Windows 10 Enterprise
Windows 10 Mobile
Windows 10 for Surface Hub
## DOCUMENT INFORMATION
<table>
<thead>
<tr>
<th>Version Number</th>
<th>1.3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Updated On</td>
<td>August 16, 2016</td>
</tr>
</tbody>
</table>
## Change History
<table>
<thead>
<tr>
<th>Date</th>
<th>Version</th>
<th>Updated By</th>
<th>Change</th>
</tr>
</thead>
<tbody>
<tr>
<td>7 OCT 2015</td>
<td>1.0</td>
<td>Tim Myers</td>
<td>First release to validators</td>
</tr>
<tr>
<td>04 APR 2016</td>
<td>1.1</td>
<td>Tim Myers</td>
<td>Updates in response to comments</td>
</tr>
<tr>
<td>28 APR 2016</td>
<td>1.2</td>
<td>Tim Myers</td>
<td>Updates in response to comments</td>
</tr>
<tr>
<td>16 AUG 2016</td>
<td>1.3</td>
<td>Tim Myers</td>
<td>Added Windows 10 November 2015 Update and new platforms to OE</td>
</tr>
</tbody>
</table>
# TABLE OF CONTENTS
<table>
<thead>
<tr>
<th>Section</th>
<th>Title</th>
<th>Page</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>INTRODUCTION</td>
<td>6</td>
</tr>
<tr>
<td>1.1</td>
<td>LIST OF CRYPTOGRAPHIC MODULE BINARY EXECUTABLES</td>
<td>7</td>
</tr>
<tr>
<td>1.2</td>
<td>BRIEF MODULE DESCRIPTION</td>
<td>7</td>
</tr>
<tr>
<td>1.3</td>
<td>VALIDATED PLATFORMS</td>
<td>7</td>
</tr>
<tr>
<td>1.4</td>
<td>CRYPTOGRAPHIC BOUNDARY</td>
<td>8</td>
</tr>
<tr>
<td>2</td>
<td>SECURITY POLICY</td>
<td>8</td>
</tr>
<tr>
<td>2.1</td>
<td>FIPS 140-2 APPROVED ALGORITHMS</td>
<td>11</td>
</tr>
<tr>
<td>2.2</td>
<td>NON-APPROVED ALGORITHMS</td>
<td>11</td>
</tr>
<tr>
<td>2.3</td>
<td>CRYPTOGRAPHIC BYPASS</td>
<td>11</td>
</tr>
<tr>
<td>2.4</td>
<td>MACHINE CONFIGURATIONS</td>
<td>11</td>
</tr>
<tr>
<td>2.5</td>
<td>NIST SP 800-132 PASSWORD BASED KEY DERIVATION FUNCTION (PBKDF) USAGE</td>
<td>11</td>
</tr>
<tr>
<td>3</td>
<td>OPERATIONAL ENVIRONMENT</td>
<td>12</td>
</tr>
<tr>
<td>4</td>
<td>INTEGRITY CHAIN OF TRUST</td>
<td>12</td>
</tr>
<tr>
<td>5</td>
<td>PORTS AND INTERFACES</td>
<td>12</td>
</tr>
<tr>
<td>5.1</td>
<td>CONTROL INPUT INTERFACE</td>
<td>12</td>
</tr>
<tr>
<td>5.2</td>
<td>STATUS OUTPUT INTERFACE</td>
<td>12</td>
</tr>
<tr>
<td>5.3</td>
<td>DATA OUTPUT INTERFACE</td>
<td>13</td>
</tr>
<tr>
<td>5.4</td>
<td>DATA INPUT INTERFACE</td>
<td>13</td>
</tr>
<tr>
<td>6</td>
<td>SPECIFICATION OF ROLES</td>
<td>13</td>
</tr>
<tr>
<td>6.1</td>
<td>MAINTENANCE ROLES</td>
<td>13</td>
</tr>
<tr>
<td>6.2</td>
<td>MULTIPLE CONCURRENT INTERACTIVE OPERATORS</td>
<td>13</td>
</tr>
<tr>
<td>7</td>
<td>SERVICES</td>
<td>13</td>
</tr>
<tr>
<td>7.1</td>
<td>SHOW STATUS SERVICES</td>
<td>15</td>
</tr>
<tr>
<td>7.2</td>
<td>SELF-TEST SERVICES</td>
<td>15</td>
</tr>
<tr>
<td>7.3</td>
<td>SERVICE INPUTS / OUTPUTS</td>
<td>16</td>
</tr>
<tr>
<td>Chapter</td>
<td>Title</td>
<td>Page</td>
</tr>
<tr>
<td>---------</td>
<td>----------------------------------------------------------------------</td>
<td>------</td>
</tr>
<tr>
<td>8</td>
<td>CRYPTOGRAPHIC KEY MANAGEMENT</td>
<td>16</td>
</tr>
<tr>
<td>8.1</td>
<td>CRITICAL SECURITY PARAMETERS</td>
<td>16</td>
</tr>
<tr>
<td>8.2</td>
<td>ZEROIZATION PROCEDURES</td>
<td>20</td>
</tr>
<tr>
<td>8.2.1</td>
<td>EPHEMERAL KEYS</td>
<td>20</td>
</tr>
<tr>
<td>8.2.2</td>
<td>PERSISTENT KEYS</td>
<td>20</td>
</tr>
<tr>
<td>8.3</td>
<td>ACCESS CONTROL POLICY</td>
<td>20</td>
</tr>
<tr>
<td>9</td>
<td>AUTHENTICATION</td>
<td>20</td>
</tr>
<tr>
<td>10</td>
<td>SELF-TESTS</td>
<td>20</td>
</tr>
<tr>
<td>10.1</td>
<td>POWER-ON SELF-TESTS</td>
<td>20</td>
</tr>
<tr>
<td>11</td>
<td>DESIGN ASSURANCE</td>
<td>21</td>
</tr>
<tr>
<td>12</td>
<td>MITIGATION OF OTHER ATTACKS</td>
<td>22</td>
</tr>
<tr>
<td>13</td>
<td>SECURITY LEVELS</td>
<td>22</td>
</tr>
<tr>
<td>14</td>
<td>ADDITIONAL DETAILS</td>
<td>23</td>
</tr>
<tr>
<td>15</td>
<td>APPENDIX A – HOW TO VERIFY WINDOWS VERSIONS AND DIGITAL SIGNATURES</td>
<td>24</td>
</tr>
<tr>
<td>15.1</td>
<td>HOW TO VERIFY WINDOWS VERSIONS</td>
<td>24</td>
</tr>
<tr>
<td>15.2</td>
<td>HOW TO VERIFY WINDOWS DIGITAL SIGNATURES</td>
<td>24</td>
</tr>
</tbody>
</table>
1 Introduction
The Windows Boot Manager is the system boot manager, called by the bootstrapping code that resides in the boot sector. Boot Manager is responsible for capturing the credentials required to unlock the OS volume and for loading and verifying the integrity of the Windows OS Loader, Winload.exe, and Windows OS Resume, winresume.exe. The Boot Manager consists of these binary executables and the Certificate Directory containing the root public key certificate issued by Microsoft.
Note: credentials only pertain to unlocking the OS volumes. Credentials are not used for authentication to control access to cryptographic module ports and services.
The Operational Environments (OEs) are:
- Windows 10 Enterprise (x64) running on a Microsoft Surface Pro with AES-NI
- Windows 10 Enterprise (x64) running on a Microsoft Surface Pro 2 with AES-NI
- Windows 10 Enterprise (x64) running on a Microsoft Surface Pro 3 with AES-NI
- Windows 10 Pro (x64) running on a Microsoft Surface Pro with AES-NI
- Windows 10 Pro (x64) running on a Microsoft Surface Pro 2 with AES-NI
- Windows 10 Pro (x64) running on a Microsoft Surface Pro 3 with AES-NI
- Windows 10 Enterprise (x64) running on a Microsoft Surface 3 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Enterprise (x86) running on a Dell Inspiron 660s without AES-NI or PCLMULQDQ or SSSE 3
- Windows 10 Pro (x86) running on a Dell Inspiron 660s without AES-NI or PCLMULQDQ or SSSE 3
- Windows 10 (x86) running on a Dell Inspiron 660s without AES-NI or PCLMULQDQ or SSSE 3
- Windows 10 Enterprise (x64) running on a HP Compaq Pro 6305 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Pro (x64) running on a HP Compaq Pro 6305 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 (x64) running on a HP Compaq Pro 6305 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Enterprise (x64) running on a Microsoft Surface Book with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Pro (x64) running on a Microsoft Surface Book with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Enterprise (x64) running on a Microsoft Surface Pro 4 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Pro (x64) running on a Microsoft Surface Pro 4 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 for Surface Hub (x64) running on a Microsoft Surface Hub 84" with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 for Surface Hub (x64) running on a Microsoft Surface Hub 55" with AES-NI and PCLMULQDQ and SSSE 3
herein referred to as Windows 10 OEs.
Boot Manager
In the Windows 10 OEs, the credentials supported for unlocking the OS volumes are:
- A startup key (stored on a USB flash drive; also known as an External key)
- A recovery key (stored on a USB flash drive; also known as an External key)
- An alpha-numeric PIN for Trusted Platform Module (TPM) + PIN or TPM + PIN + USB scenarios
- A password
- A key provided over a network by a trusted server
1.1 List of Cryptographic Module Binary Executables
Boot Manager crypto module consists of the following binaries:
- **BOOTMGR**
- `bootmgr.exe`
- `bootmgfw.efi`
- `bootmgr.efi`
The version numbers are:
Version 10.0.10586 for Windows 10 OEs
1.2 Brief Module Description
Both the older PC/AT BIOS and the newer Unified Extensible Firmware Interface (UEFI) boot methods are supported.
**BOOTMGR** and `bootmgr.exe` are the binary executables for booting PC/AT BIOS systems. **BOOTMGR** logically encapsulates `bootmgr.exe`.
**Bootmgfw.efi** and `bootmgr.efi` are the binary executables for booting Unified Extensible Firmware Interface (UEFI) systems. **Bootmgfw.efi** logically encapsulates `bootmgr.efi`.
1.3 Validated Platforms
The Boot Manager components listed in Section 1.1 were validated using the following machine configurations:
- Windows 10 Enterprise (x64) - **Microsoft Surface Pro** - Intel x64 Processor with AES-NI
- Windows 10 Enterprise (x64) - **Microsoft Surface Pro 2** - Intel Core i5 with AES-NI
- Windows 10 Enterprise (x64) - **Microsoft Surface Pro 3** - Intel Core i7 with AES-NI
- Windows 10 Pro (x64) - **Microsoft Surface Pro** - Intel x64 Processor with AES-NI
- Windows 10 Pro (x64) - **Microsoft Surface Pro 2** - Intel Core i5 with AES-NI
- Windows 10 Pro (x64) - **Microsoft Surface Pro 3** - Intel Core i7 with AES-NI
- Windows 10 Enterprise (x64) - **Microsoft Surface 3** - Intel Atom x7 with AES-NI and PCLMULQDQ and SSSE 3
- Windows 10 Enterprise (x64) - Dell Inspiron 660s - Intel Core i3 without AES-NI or PCLMULQDQ or SSSE 3
- Windows 10 Pro (x86) - Dell Inspiron 660s - Intel Core i3 without AES-NI or PCLMULQDQ or SSSE 3
© 2016 Microsoft. All Rights Reserved
This Security Policy is non-proprietary and may be reproduced only in its original entirety (without revision).
1.4 Cryptographic Boundary
The software cryptographic boundary for Boot Manager is defined as the binaries BOOTMGR, bootmgr.exe, bootmgfw.efi, and bootmgr.efi. The physical configuration of Boot Manager, as defined in FIPS-140-2, is multi-chip standalone.
2 Security Policy
Boot Manager operates under several rules that encapsulate its security policy.
- Boot Manager is validated on the platforms listed in Section 1.3.
- Windows 10 OEs are operating systems supporting a “single user” mode where there is only one interactive user during a logon session. During the booting process, the OS is effectively in “single user” mode because there are not any logon sessions available yet.
- The system must be configured such that the Approved SP 800-132 PBKDF is used for key derivation, rather than one of the non-Approved KDFs. This is done by enabling the System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing setting in Group Policy or Local Policy.
- Boot Manager is only in its Approved mode of operation when Windows is booted normally, meaning Debug mode is disabled and Driver Signing enforcement is enabled.
- The Debug mode status and Driver Signing enforcement status can be viewed by using the bcdedit tool.
The following diagram illustrates the master components of the Boot Manager module:
Figure 1 Master Components
The following diagram illustrates Boot Manager module interaction with the cryptographic module:
- Boot Manager loads the Windows 10 OEs operating system loader (Winload.exe) or winresume.exe, after it determines component’s integrity using its cryptographic algorithm implementations using the FIPS 140-2 Approved algorithms mentioned below. After the verified binary image file is loaded, Boot Manager passes the execution control to it and no longer executes until the next reboot. The Crypto officer and User have access to the services Boot Manager supports.
- If the integrity of components being loaded is not verified, Boot Manager does not transfer the execution from itself.
- Boot Manager has a service for the encryption and decryption functionality used with BitLocker® Drive Encryption\(^1\) operations related to bootstrapping the Windows 10 OEs operating system.
- The module provides a power-up self-tests service that is automatically executed when the module is loaded into memory, as well as, a show status service, that is automatically executed by the module to provide the status response of the module either via output to the general purpose computer (GPC) monitor or to log files.
- Boot Manager implements a self-integrity check using an RSA digital signature during its initialization process. Boot Manager will not complete its initialization if the signature is invalid.
---
\(^1\) BitLocker is a registered trademark for the full volume encryption functionality in Windows. BitLocker is not a separate binary executable.
2.1 FIPS 140-2 Approved Algorithms
- Boot Manager implements the following FIPS-140-2 Approved algorithms. Note that not all algorithms/modes verified through the CAVP certificates listed are implemented by the Boot Manager module.
- FIPS 186-4 RSA PKCS#1 (v1.5) digital signature verification with 1024, 2048, and 3072 modulus; supporting SHA-1, SHA-256, SHA-384, and SHA-512 (Cert. #1871)
- FIPS 180-4 SHS SHA-1, SHA-256, SHA-384, and SHA-512 (Certs. #3047 and #3048)
- AES CBC 128 and 256, AES XTS2 128 and 256 (Cert. #3629); AES CCM 256 (Cert. #3653)
- HMAC-SHA-1 and HMAC-SHA-256 (Cert. #2381)
- SP 800-132 PBKDF (vendor affirmed)
2.2 Non-Approved Algorithms
- Boot Manager implements the following non-Approved algorithms:
- MD5 – used for legacy certificate chain authentication
- An algorithm for VMK key derivation (KDF)
- An algorithm for legacy password-based key derivation (PBKDF)
The non-Approved algorithms for VMK key derivation and legacy PBKDF cannot be used when the module is configured in the Approved mode of operation because the keys derived from them cannot be used in the Approved mode of operation.
When MD5 is used in legacy certificate chain authentication, this is considered a non-FIPS Approved service. This legacy implementation of MD5 is not used for checking the integrity of this cryptographic module nor any other Windows 10 cryptographic modules.
2.3 Cryptographic Bypass
Cryptographic bypass is not supported by Boot Manager.
2.4 Machine Configurations
Boot Manager was tested using the machine configurations listed in Section 1.3 - Validated Platforms.
2.5 NIST SP 800-132 Password Based Key Derivation Function (PBKDF) Usage
Keys derived from passwords, as shown in SP 800-132, may only be used in storage applications. In order to run in a FIPS Approved manner, strong passwords must be used and they may only be used for storage applications. The password/passphrase length is enforced by the caller of the PBKDF interfaces at the time the password/passphrase is created and not by this cryptographic module. (This module is not involved in the creation of any password/passphrase.)
---
2 For XTS-AES the length of the data unit does not exceed $2^{20}$ blocks. XTS-AES mode is only used by the module for the cryptographic protection of data on storage devices.
3 For HMAC, only key sizes that are $\geq 112$ bits in length are used by the module in FIPS mode.
4 MD5 is not allowed for usage in FIPS mode.
For the password that is used in key derivation, 128 bits of entropy are generated from the system DRBG, then converted into 40 digits (3.2 bits of entropy per digit), which are then broken into groups of five digits that are each multiplied by 11 to create six digit groupings for parity/correctness checking on user entry. This password has 128-bit security. The upper bound for the probability of having this parameter guessed at random is $1/(2^{128})$. This probability is not only based on the length of the password, but also the difficulty of guessing it.
SP 800-132 Section 5.4 presents two options for protecting data using a Master Key (MK). Boot Manager uses Option 2 in which the MK produced by the PBKDF is used to decrypt a Data Protection Key (DPK). The DPK logically is the Volume Master Key (VMK), though it is further used to decrypt the Full Volume Encryption Key (FVEK) which is used for actual data encryption/decryption. The details about the VMK and FVEK are described later in this document.
3 Operational Environment
The operational environment for Boot Manager is the Windows 10 OEs running on the software and hardware configurations listed in Section 1.3 - Validated Platforms.
4 Integrity Chain of Trust
Boot Manager is the very start of the chain of trust. It cryptographically checks its own integrity during its startup. It then cryptographically checks the integrity of the Windows OS Loader (Winload.exe) or Windows OS Resume (Winresume.exe) before starting it.
5 Ports and Interfaces
5.1 Control Input Interface
The Boot Manager Control Input Interface is the set of internal functions responsible for reading control input. These input signals are read from various system locations and are not directly provided by the operator. Examples of the internal function calls include:
- `BlBdDebuggerEnabled` – Reads the system flag to determine if the boot debugger is enabled.
- `BlXmiRead` – Reads the operator selection from the Boot Selection menu.
- `BlGetBootOptionBoolean` – Reads control input from a protected area of the Boot Configuration Data registry.
The GPC’s keyboard can also be used as control input when it is necessary for an operator to provide a response to a prompt for input or in response to an error indicator.
5.2 Status Output Interface
The Status Output Interface is the `BlStatusPrint` function that is responsible for displaying the integrity verification errors to the screen. The Status Output Interface is also defined as the `BsdpWriteAtLogOffset` responsible for writing the name of the corrupt driver to the boot log.
5.3 Data Output Interface
The Data Output Interface includes two different kinds of functions: initialization and transfer.
The initialization function `ImgpInitializeBootApplicationParameters` is providing output in the form of input parameters for the boot application. This function is called before transferring execution to the boot application.
The following functions are transfer functions: `Archx86TransferTo32BitApplicationAsm`, `Archx86TransferTo64BitApplicationAsm`, and `Archpx64TransferTo64BitApplicationAsm`. These functions are responsible for transferring the execution from Boot Manager to the initial execution point of the Windows OS Loader or Windows OS Resume. Data exits the module in the form of the initial instruction address of `Winload.exe` or `Winresume.exe`.
5.4 Data Input Interface
The Data Input Interface includes the `BFileReadEx` function. `BFileReadEx` is responsible for reading the binary data of unverified components from the computer hard drive.
Additionally, the GPC’s USB port also forms a part of the Data Input interface. This interface is used to enter the Startup key or Recovery Key used by the BitLocker® Drive Encryption in Windows 10 OEs. The GPC’s keyboard can also serve as a Data Input Interface when the method to protect the Volume Master Key (VMK) value relies on an operator supplied PIN.
6 Specification of Roles
Boot Manager supports both User and Cryptographic Officer roles (as defined in FIPS 140-2). Both roles have access to services implemented in Boot Manager. (See Section 7 Services for details.) Therefore, roles are assumed implicitly by booting the Windows 10 OEs operating system.
6.1 Maintenance Roles
Maintenance roles are not supported.
6.2 Multiple Concurrent Interactive Operators
There is only one interactive operator in Single User Mode. When run in this configuration, multiple concurrent interactive operators are not supported.
7 Services
Boot Manager services are:
1. Configuration of BitLocker into FIPS mode
2. The encryption and decryption functionality used with BitLocker Drive Encryption for file I/O that supports the bootstrapping of the Windows 10 OEs operating system
3. Unlocking the operating system volume
4. Loading and verifying the integrity of the Windows 10 OEs operating system loader (winload.exe or winresume.exe)
5. Booting the Windows operating system
6. Zeroization (see Section 8 Cryptographic Key Management)
7. Legacy certificate chain authentication (non-FIPS Approved service)
The User and Cryptographic Officer roles have the same use of the encryption, decryption, unlocking, OS loading, and booting services. Boot Manager does not export any cryptographic functions that can be called or externally invoked.
Boot Manager has a service of unlocking the operating system volume with methods that are Approved and non-Approved.
**Always Approved**
- Clear Key
- External Key (TPM-less startup key scenario)
- External Key (i.e. USB startup key or USB recovery key)
- TPM
- Recovery password
**Configurable to be Approved**
- TPM + USB (with system configured to use Approved SP 800-132 PBKDF)
**Non-Approved**
- TPM + Network unlock
- TPM + PIN
- TPM + PIN + USB
The Non-Approved methods of the service of unlocking the operating system volume are equivalent to storing the VMK in plaintext.
Boot Manager also has a Non-Approved service of legacy certificate chain authentication using the MD5 algorithm. See Section 2.2 non-Approved Algorithms.
The following table maps the services to their corresponding algorithms and critical security parameters (CSPs).
Table 1
<table>
<thead>
<tr>
<th>Service</th>
<th>Algorithms</th>
<th>CSPs</th>
<th>Invocation</th>
</tr>
</thead>
<tbody>
<tr>
<td>Configuration of BitLocker into FIPS mode</td>
<td>None</td>
<td>None</td>
<td>See section 2.</td>
</tr>
<tr>
<td>The encryption and decryption functionality used with BitLocker Drive Encryption for file I/O that supports the bootstrapping of the Windows 10 OEs operating system</td>
<td>AES CBC (128 and 256 bit) AES XTS (128 and 256 bit)</td>
<td>FVEK</td>
<td>This service is fully automatic. The User / Cryptographic Officer do not take any actions to start this service.</td>
</tr>
<tr>
<td>Unlocking the operating system volume</td>
<td>HMAC-SHA-256 SP 800-132 PBKDF AES in CCM mode (128 and 256 bit)</td>
<td>PIN, Password, DK, ExK, CC, IK, SK, NK, VMK</td>
<td>See figure 3 for the actions that the User / Crypto Officer must take to reach the “UNLOCK & BOOT” stage. This service is executed automatically once this stage has been reached.</td>
</tr>
<tr>
<td>Loading and verifying the integrity of the Windows 10 OEs operating system loader (winload.exe or winresume.exe)</td>
<td>RSA PKCS#1 (v1.5) verify with public key SHA-1 hash SHA-256 hash SHA-384 hash SHA-512 hash</td>
<td>Microsoft Root Certificate Authority (CA) Public Key</td>
<td>This service is fully automatic. The User / Cryptographic Officer do not take any actions to start this service.</td>
</tr>
<tr>
<td>Booting the Windows operating system</td>
<td>None</td>
<td>None</td>
<td>The User / Crypto Officer must power up the device to start this service.</td>
</tr>
<tr>
<td>Zeroization</td>
<td>None</td>
<td>All CSPs</td>
<td>See section 8.2.</td>
</tr>
<tr>
<td>Legacy certificate chain authentication (non-FIPS Approved service)</td>
<td>MD5 (non-FIPS Approved algorithm)</td>
<td>None</td>
<td>This service is fully automatic. The User / Cryptographic Officer do not take any actions to start this service.</td>
</tr>
</tbody>
</table>
7.1 Show Status Services
The User and Cryptographic Officer roles have the same Show Status functionality, which is described in Section 5 Ports and Interfaces.
7.2 Self-Test Services
The User and Cryptographic Officer roles have the same Self-Test functionality, which is described in Section 10 Self-Tests.
7.3 Service Inputs / Outputs
The User and Cryptographic Officer roles have service inputs and outputs as specified in Section 5 Ports and Interfaces.
8 Cryptographic Key Management
Note: authentication in the FIPS 140-2 standard pertains exclusively to controlling access to cryptographic module ports and services. That particular use of the word “authentication” is different than how it is used in a broader information security sense. The keys described here are credentials used to unlock Windows OS volumes.
8.1 Critical Security Parameters
Boot Manager does not store any secret or private cryptographic keys across power-cycles. However, it does use certain AES keys in support of the BitLocker feature in FIPS mode. Boot Manager uses the following critical security parameters (CSPs), which include cryptographic keys, in FIPS mode:
**Table 2**
<table>
<thead>
<tr>
<th>Critical Security Parameters</th>
<th>CSP / Key Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>External Key (ExK) or Clear Key (CC)</strong></td>
<td>256-bit AES key stored outside the cryptographic boundary (for example a USB device). This key is entered into the module via the USB port. It is the only method used to decrypt the VMK for which the VMK could be considered as having been encrypted to start with because other methods rely upon non-FIPS Approved key derivation methods. Logically, the external key represents either a startup key or a recovery key. Key used for AES decryption of the VMK.</td>
</tr>
<tr>
<td><strong>Intermediate Key (IK)</strong></td>
<td>256-bit AES key value that is stored encrypted and forms the basis of another AES key, such as the NK or VMK, by combining with another 256-bit AES key via key derivation or XOR. When a non-Approved KDF or XOR is used to derive this key, the VMK is considered to be stored in plaintext.</td>
</tr>
<tr>
<td><strong>Session Key (SK)</strong></td>
<td>256-bit AES key value that is stored in plaintext on disk and used to decrypt an IK transported over a trusted network to Boot Manager during Network Unlock authentication. Boot Manager does the actual decryption of the IK using AES-CCM.</td>
</tr>
<tr>
<td><strong>Network Key (NK)</strong></td>
<td>256-bit key used for AES decryption of the VMK in Network Unlock authentication. Composed by XOR of an IK protected by the TPM and another IK delivered over a trusted network. A KDF is not used. Because an XOR is used to derive this key, the VMK is considered to be stored in plaintext.</td>
</tr>
<tr>
<td><strong>Volume Master Key (VMK)</strong></td>
<td>256-bit AES key used for AES-CCM decryption of the FVEK</td>
</tr>
<tr>
<td><strong>Full Volume Encryption Key (FVEK)</strong></td>
<td>128 or 256-bit AES key used for AES encryption/decryption of data on disk sectors. This key is stored persistently. It is encrypted by the VMK using AES-CCM.</td>
</tr>
<tr>
<td><strong>Derived Key (DK)</strong></td>
<td>256-bit AES key value used for AES decryption of the VMK. The value is not stored long-term and is derived using a method defined by the system configuration. Derived Keys are used in Password and Recovery Password authentication.</td>
</tr>
<tr>
<td><strong>Microsoft Root Certificate Authority (CA) Public Key</strong></td>
<td>Key used for RSA PKCS#1 (v1.5) verification of digital signatures</td>
</tr>
<tr>
<td><strong>PIN</strong></td>
<td>An alpha-numeric PIN for Trusted Platform Module (TPM) + PIN or TPM + PIN + USB scenarios</td>
</tr>
</tbody>
</table>
---
5 Network Unlock authentication concerns BitLocker functionality. It is not referring to FIPS 140-2 standard authentication used to control access to the ports and services of the cryptographic module.
The VMK is always stored in encrypted form for volumes encrypted in FIPS mode. Based on system configuration, the method used to perform the encryption may use an Approved password-based key derivation method (SP 800-132 PBKDF). (Volumes created by systems not in FIPS mode may have performed the VMK encryption with an older, non-Approved key derivation method, which cannot be used while operating in FIPS mode.) The VMK may alternately or additionally be stored encrypted with the ExK/CC (identified above). The VMK value can be zeroized by following the guidance for zeroization of persistent keys in section 8.2.2 below.
Note that the FVEK is stored in encrypted form across power cycles, and thus is not subject to the zeroization requirements, but can be zeroized in the same manner as the VMK. The ExK/CC, is stored only in memory and is zeroized by following the guidance for zeroization of ephemeral keys in section 8.2.1 below.
Boot Manager also uses the Microsoft root CA public key certificate stored on the computer hard disk to verify digital signatures using its implementation of RSA PKCS#1 (v1.5) verify. This public key is available to both roles. Zeroization is performed by following the guidance for zeroization of persistent keys in section 8.2.2 below.
Boot Manager will seek appropriate keys to decrypt the encrypted (i.e. “BitLocker® protected”) volume at boot time and waking up from hibernation, in the following sequence:
1. Clear Key
2. No-TPM required and no user input required
a. ExK (TPM-less startup key scenario)
3. TPM system and no user input required
a. TPM
b. TPM + Network unlock
c. TPM + USB
4. UI Required (TPM system or no-TPM system)
a. TPM + PIN
b. TPM + PIN + USB
c. ExK (i.e. USB startup key or USB recovery key)
d. Recovery password
The TPM + Network unlock, TPM + PIN, and TPM + PIN + USB scenarios use a method of key derivation that cannot be used while operating in FIPS mode. If these methods of unlocking are used, the VMK is considered to be stored in plaintext.
The following diagram illustrates the flow logic in the system.
Figure 3 Flow Logic
Details about the keys and network protocol used for Network Unlock authentication are in the Network Key Protector Unlock Protocol Specification [MS-NKPU], which is available at:
## 8.2 Zeroization Procedures
### 8.2.1 Ephemeral Keys
Procedural zeroization of ephemeral keys (RAM only) for this software cryptographic module consists of rebooting the operating system.
### 8.2.2 Persistent Keys
Procedural zeroization of persistent keys for this software cryptographic module consists of uninstallation of the cryptographic module and reformatting and overwriting, at least once, the hard drive or other permanent storage media upon which the operating system was installed.
## 8.3 Access Control Policy
The Boot Manager crypto module does not allow access to the cryptographic keys contained within it. For this reason, an access control table is not included in this document. Boot Manager receives keys from outside and then manages them appropriately once received. Boot Manager prevents access to its keys by zeroizing them.
## 9 Authentication
Boot Manager does not implement any authentication services as defined by the FIPS 140-2 standard, which is concerned exclusively with controlling access to cryptographic module ports and services. The User and Cryptographic Officer roles are assumed implicitly by booting the Windows operating system.
## 10 Self-Tests
### 10.1 Power-On Self-Tests
Boot Manager performs the following power-on (startup) self-tests.
- RSA PKCS#1 (v1.5) signature verification Known Answer Test
- Software Integrity Test – RSA PKCS#1 (v1.5) verify with public key (RSA 2048 w/ SHA-256)
- SHA-1 Known Answer Test
- SHA-256 Known Answer Test
- SHA-512 Known Answer Test
- AES-CBC - Encrypt/Decrypt Known Answer Tests
- AES-CCM - Encrypt/Decrypt Known Answer Tests
- HMAC-SHA-1 Known Answer Test
- HMAC-SHA-256 Known Answer Test
- SP 800-132 PBKDF Known Answer Test
Boot Manager
If the self-test fails, the module will not load, the system will not boot, and status will be returned. If the status is not STATUS_SUCCESS, then that is the indicator a self-test failed.
11 Design Assurance
The secure installation, generation, and startup procedures of this cryptographic module are part of the overall operating system secure installation, configuration, and startup procedures for the Windows 10 OEs. The various methods of delivery and installation for each product are listed in the following table.
Table 3
<table>
<thead>
<tr>
<th>Product</th>
<th>Delivery and Installation Method</th>
</tr>
</thead>
</table>
| Windows 10, Windows 10 Pro, Windows 10 Enterprise | • Pre-installed on the computer by OEM
• Download that updates to Windows 10 |
| Surface Book, Surface Pro 4, Surface Pro 3, Surface 3, Surface Pro 2, Surface Pro, Surface Hub 84", Surface Hub 55", Lumia 950, Lumia 635 | • Pre-installed by the OEM (Microsoft) |
After the operating system has been installed, it must be configured by enabling the "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" policy setting followed by restarting the system. This procedure is all the crypto officer and user behavior necessary for the secure operation of this cryptographic module.
An inspection of authenticity of the physical medium can be made by following the guidance at this Microsoft web site: https://www.microsoft.com/en-us/howtotell/default.aspx
The installed version of Windows 10 OEs must be verified to match the version that was validated. See Appendix A for details on how to do this.
For Windows Updates, the client only accepts binaries signed by Microsoft certificates. The Windows Update client only accepts content whose SHA-2 hash matches the SHA-2 hash specified in the metadata. All metadata communication is done over a Secure Sockets Layer (SSL) port. Using SSL ensures that the client is communicating with the real server and so prevents a spoof server from sending the client harmful requests. The version and digital signature of new cryptographic module releases must be verified to match the version that was validated. See Appendix A for details on how to do this.
12 Mitigation of Other Attacks
The following table lists the mitigations of other attacks for this cryptographic module:
Table 4
<table>
<thead>
<tr>
<th>Algorithm</th>
<th>Protected Against</th>
<th>Mitigation</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>SHA1</td>
<td>Timing Analysis</td>
<td>Constant Time Implementation</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Attack Cache</td>
<td>Memory Access pattern independent</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>of any confidential data</td>
<td></td>
</tr>
<tr>
<td>SHA2</td>
<td>Timing Analysis</td>
<td>Constant Time Implementation</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Attack Cache</td>
<td>Memory Access pattern independent</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>of any confidential data</td>
<td></td>
</tr>
<tr>
<td>AES</td>
<td>Timing Analysis</td>
<td>Constant Time Implementation</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Attack Cache</td>
<td>Memory Access pattern independent</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>of any confidential data</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>Protected Against Cache attacks only</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>when used with AES NI</td>
<td></td>
</tr>
</tbody>
</table>
13 Security Levels
The security level for each FIPS 140-2 security requirement is given in the following table:
Table 5
<table>
<thead>
<tr>
<th>Security Requirement</th>
<th>Security Level</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cryptographic Module</td>
<td>1</td>
</tr>
<tr>
<td>Specification</td>
<td></td>
</tr>
<tr>
<td>Cryptographic Module Ports</td>
<td>1</td>
</tr>
<tr>
<td>and Interfaces</td>
<td></td>
</tr>
<tr>
<td>Roles, Services,</td>
<td>1</td>
</tr>
<tr>
<td>and Authentication</td>
<td></td>
</tr>
<tr>
<td>Finite State Model</td>
<td>1</td>
</tr>
<tr>
<td>Physical Security</td>
<td>NA</td>
</tr>
</tbody>
</table>
14 Additional Details
For the latest information on Microsoft Windows, check out the Microsoft web site at:
http://windows.microsoft.com
For more information about FIPS 140 validations of Microsoft products, please see:
15 Appendix A – How to Verify Windows Versions and Digital Signatures
15.1 How to Verify Windows Versions
The installed version of Windows 10 OEs must be verified to match the version that was validated using the following method:
1. In the Search box type "cmd" and open the Command Prompt desktop app.
2. The command window will open.
3. At the prompt, enter “ver”.
4. The version information will be displayed in a format like this:
Microsoft Windows [Version 10.0.xxxxx]
If the version number reported by the utility matches the expected output, then the installed version has been validated to be correct.
15.2 How to Verify Windows Digital Signatures
After performing a Windows Update that includes changes to a cryptographic module, the digital signature and file version of the binary executable file must be verified. This is done like so:
1. Open a new window in Windows Explorer.
2. Type “C:\Windows\” in the file path field at the top of the window.
3. Type the cryptographic module binary executable file name (for example, “CNG.SYS”) in the search field at the top right of the window, then press the Enter key.
4. The file will appear in the window.
5. Right click on the file’s icon.
6. Select Properties from the menu and the Properties window opens.
7. Select the Details tab.
8. Note the File version Property and its value, which has a number in this format: xx.x.xxxxx.xxxx.
9. If the file version number matches one of the version numbers that appear at the start of this security policy document, then the version number has been verified.
10. Select the Digital Signatures tab.
11. In the Signature list, select the Microsoft Windows signer.
12. Click the Details button.
13. Under the Digital Signature Information, you should see: “This digital signature is OK.” If that condition is true, then the digital signature has been verified.
|
{"Source-Url": "http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp2700.pdf", "len_cl100k_base": 9422, "olmocr-version": "0.1.53", "pdf-total-pages": 24, "total-fallback-pages": 0, "total-input-tokens": 49003, "total-output-tokens": 9734, "length": "2e13", "weborganizer": {"__label__adult": 0.0005106925964355469, "__label__art_design": 0.0004532337188720703, "__label__crime_law": 0.0016880035400390625, "__label__education_jobs": 0.0007920265197753906, "__label__entertainment": 0.00017058849334716797, "__label__fashion_beauty": 0.00023567676544189453, "__label__finance_business": 0.0013217926025390625, "__label__food_dining": 0.00021255016326904297, "__label__games": 0.002475738525390625, "__label__hardware": 0.033050537109375, "__label__health": 0.0003893375396728515, "__label__history": 0.00034689903259277344, "__label__home_hobbies": 0.00019979476928710935, "__label__industrial": 0.0007581710815429688, "__label__literature": 0.00029349327087402344, "__label__politics": 0.0003788471221923828, "__label__religion": 0.0005602836608886719, "__label__science_tech": 0.1607666015625, "__label__social_life": 8.571147918701172e-05, "__label__software": 0.3623046875, "__label__software_dev": 0.431884765625, "__label__sports_fitness": 0.00026416778564453125, "__label__transportation": 0.0005507469177246094, "__label__travel": 0.000179290771484375}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 38283, 0.03748]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 38283, 0.11668]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 38283, 0.83042]], "google_gemma-3-12b-it_contains_pii": [[0, 293, false], [293, 293, null], [293, 930, null], [930, 3407, null], [3407, 5030, null], [5030, 7505, null], [7505, 9744, null], [9744, 11086, null], [11086, 11113, null], [11113, 12668, null], [12668, 15150, null], [15150, 17745, null], [17745, 19959, null], [19959, 21339, null], [21339, 24104, null], [24104, 24949, null], [24949, 27468, null], [27468, 29581, null], [29581, 29601, null], [29601, 31561, null], [31561, 33789, null], [33789, 36137, null], [36137, 36414, null], [36414, 38283, null]], "google_gemma-3-12b-it_is_public_document": [[0, 293, true], [293, 293, null], [293, 930, null], [930, 3407, null], [3407, 5030, null], [5030, 7505, null], [7505, 9744, null], [9744, 11086, null], [11086, 11113, null], [11113, 12668, null], [12668, 15150, null], [15150, 17745, null], [17745, 19959, null], [19959, 21339, null], [21339, 24104, null], [24104, 24949, null], [24949, 27468, null], [27468, 29581, null], [29581, 29601, null], [29601, 31561, null], [31561, 33789, null], [33789, 36137, null], [36137, 36414, null], [36414, 38283, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 38283, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 38283, null]], "pdf_page_numbers": [[0, 293, 1], [293, 293, 2], [293, 930, 3], [930, 3407, 4], [3407, 5030, 5], [5030, 7505, 6], [7505, 9744, 7], [9744, 11086, 8], [11086, 11113, 9], [11113, 12668, 10], [12668, 15150, 11], [15150, 17745, 12], [17745, 19959, 13], [19959, 21339, 14], [21339, 24104, 15], [24104, 24949, 16], [24949, 27468, 17], [27468, 29581, 18], [29581, 29601, 19], [29601, 31561, 20], [31561, 33789, 21], [33789, 36137, 22], [36137, 36414, 23], [36414, 38283, 24]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 38283, 0.27322]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
3446195ead26d4aec9d0b3c40d885ece172ae547
|
Development of secured systems by mixing programs, specifications and proofs in an object-oriented programming environment. A case study within the FoCaLiZe environment
Damien Doligez, Mathieu Jaume, Renaud Rioboo
To cite this version:
Damien Doligez, Mathieu Jaume, Renaud Rioboo. Development of secured systems by mixing programs, specifications and proofs in an object-oriented programming environment. A case study within the FoCaLiZe environment. PLAS - Seventh Workshop on Programming Languages and Analysis for Security, Jun 2012, Beijing, China. 10.1145/2336717.2336726. hal-00773654
HAL Id: hal-00773654
https://inria.hal.science/hal-00773654
Submitted on 14 Jan 2013
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.
Abstract
FoCaLiZe is an object-oriented programming environment that combines specifications, programs and proofs in the same language. This paper describes how its features can be used to formally express specifications and to develop by stepwise refinement the design and implementation of secured systems, while proving that the implementation meets its specification or design requirements. We thus obtain a modular implementation of a generic framework for the definition of security policies together with certified enforcement mechanism for these policies.
Categories and Subject Descriptors D.3.3 [Programming Languages]: Language Constructs and Features—Frameworks, Inheritance; D.2.4 [Software/Program Verification]: Correctness proofs, Formal methods; D.2.6 [Programming Environments]
General Terms Security, Languages, Verification
Keywords FoCaLiZe, security policies, enforcement mechanisms
1. Introduction
There is now a large collection of literature on security policies and secured systems: many policies and operational mechanisms have been proposed to ensure security in a system, each of them describing in a more or less formal way, within a particular specification language, a notion of information system suitable in a particular context together with some security requirements. Because of the variety of formalisms, it is rather difficult to reuse, refine, compare and compose these developments, for example when defining a variant of an existing development. To ease these tasks, it seems desirable to express such developments in a common framework and within a language that enables the development of modular programs and provides refinement mechanisms that allow working at different levels of abstraction in the same framework. Furthermore, the separation between the security policies and the operational mechanisms that are used to enforce them is now considered a main security design requirement: policies have to be specified independently of such mechanisms. In [19], a formal framework was introduced to deal with some of these issues; it is briefly described in section 3. The aim of the work presented in this paper is to implement a large part of this framework within a programming environment in order to obtain a development that allows defining security policies together with the operational mechanism that enforce them over transition systems and a formal certification of these mechanisms.
Nowadays, critical systems are evaluated according to some standards like the Common Criteria [12] or according to standards dedicated to particular domains (like the FIPS-140-3 specifying security requirements for cryptographic modules [16]). These standards often require the use of formal methods in order to ensure some safety and security properties needed of the systems in question. However, developing and evaluating such critical systems is a difficult task that requires advanced technical knowledge and large amounts of time. To make the task easier, we use the FoCaLiZe [17] integrated development environment (IDE), which was conceived from the beginning to help build systems with high safety and security assurances, and which eases (and partially automates) the application of formal methods during the development cycle.
FoCaLiZe [17] provides an object-oriented functional language that allows writing specifications, programs, and
the formal proofs that the programs meet their specifications. The object-oriented features of this language enable the development of an implementation by iterative refinement of its specification. Moreover, FoCaLiZe provides several automatic tools to ease the generation of programs from specifications [15], the generation of proofs [5], the generation of documentation, and the production of test suites [9, 10]. Using these tools together with an adequate methodology of development (as the one introduced in [3]) also makes the developments easier to formally evaluate according to the aforementioned standards. In the domains of safety and security, two main developments have been already done within FoCaLiZe: a full formalization of airport security regulations [14], and the implementation of a generic voter [2], which is a central equipment of all fault tolerant architectures, widely used for safety related systems.
2. FoCaLiZe
FoCaLiZe [17] is a programming environment that includes a language based on firm theoretical results [23], with a clear semantics and provides an efficient implementation via translation to OCaml [22]. It has functional and object-oriented features and provides means for the programmers to write formal proofs of their code in a more or less detailed way within a declarative proof language based on the Zenon automatic theorem prover [5]. Zenon eases the task of writing formal proofs and translates them into Coq [13] for high-assurance checking. FoCaLiZe also provides powerful features (such as inheritance, parameterization and late-binding) that enable a stepwise refinement methodology to go from specification all the way down to executable code. Thus, FoCaLiZe unifies within the same language the formal modeling work, the development of the code, and the certification proofs.
2.1 Species
In FoCaLiZe, the primitive entity of a development is the species. Species are the nodes of the hierarchy of structures that makes up a development. A species can be seen as a set of methods grouping “things” related to the same concept. As in most modular design systems (i.e. object-oriented, abstract data types, etc.) the idea is to group a data structure with the operations on the data structure, the specification of these operations (in the form of properties), the representation requirements, and the proofs of the properties. Each method is identified by its name and can be either declared (primitive constants, operations and properties) or defined (implementation of operations, definition of properties and proofs of theorem). Moreover, we can distinguish three kinds of “methods”: the carrier type, the programming methods and the logical methods (all the fields of our objects are called methods, be they types, data or code).
Carrier type The carrier, or representation type, is the concrete representation of the elements of the set underlying the structure defined by the species. The carrier is represented by the keyword $\texttt{Self}$ inside the species and outside, by the name of the species itself, so that we identify the set with the structure, as usual in mathematics. Each species must have one unique carrier, but like all the other methods, it can be either declared or defined. A declared carrier is simply an abstract data type, while a defined one is a binding to a concrete type.
Programming methods These methods represent the constants and the operators of the structure. Declared methods are introduced by the keyword $\texttt{signature}$, defined methods are introduced by $\texttt{let}$ and recursive definitions must be explicitly flagged with the keyword $\texttt{rec}$. The language used for the definitions is similar to the functional core of OCaml [22] (let-binding, pattern matching, conditional, higher order functions, etc), with the addition of a construction to call a method from a given structure. More precisely, the main syntactic constructions of the language are the following:
- abstraction with respect to a variable: $\texttt{fun} \ x \to \ldots$
- application of a function: $f(x)$
- call of a method $m$ from a structure $c : c\!\!m$
- call of a method $m$ of the structure we are currently building: $\texttt{Self}\!\!m$ or just $m$
Logical methods These methods represent the properties of programming methods. In this context, the declaration of a logical method is simply the statement of a property, while the definition is a proof of this statement. In the first case, we speak of properties ($\texttt{property}$) that are still to be proved later in the development, while in the second case we speak of theorems ($\texttt{theorem}$). The language also allows logical definitions ($\texttt{logical \ let}$) to bind names to logical statements. The language used for the statements is composed of the basic logical connectors and, or, $\to$, $\leftrightarrow$, not, and universal (all) and existential (ex) quantification over a FoCaLiZe type. Proofs in FoCaLiZe are written in a declarative format inspired by Lamport’s work [11, 21]. A proof is a tree where the programmer introduces names ($\texttt{assume}$) and hypotheses ($\texttt{hypothesis}$), gives a statement to prove ($\texttt{prove}$) and then provides justification for the statement. This justification can be: (1) a “conclude” clause for fully automatic proof; (2) a “by” clause with a list of definitions, properties, hypotheses, previous theorems, and previous steps (subject to some scoping conditions) for use by the automatic prover; (3) a sequence of proofs (with their own assumptions, statements, and proofs) whose statements will be used by the automatic prover to prove the current statement. Hence, each step of a proof is independent of the others and can be reused in a similar context (this eases the maintenance of proofs and allows, for example, using exactly the same proof for a statement based on an hypothesis $A$ and for the same statement...
based on a stronger hypothesis $B$, provided the automatic prover can make the inference from $B$ to $A$).
### 2.2 Combining species
The main (object-oriented) features of FoCaLiZe are illustrated in Figure 1: a FoCaLiZe development is organized as a hierarchy which may have several roots. The upper levels of the hierarchy are built during the specification stage while the lower ones correspond to implementations.
**Inheritance** Using inheritance in FoCaLiZe, one can enrich a species with additional operations (methods) and redefine some methods of the parent species, but one can also get closer to a runnable implementation by providing explicit definitions to methods that were only declared in the parent. Note that the inheritance framework requires to perform static analysis in order to check coherence properties (inheritance lookup, resolution of multiple-inheritance conflicts, dependency analysis, type-checking, etc.). In FoCaLiZe, classical object-oriented features have been restricted in order to avoid unsound constructions that can lead to inconsistencies when used carelessly. A species can inherit the declarations and definitions of one or several already defined species and is free to define or redefine any inherited method as long as such (re)definition does not change the type of the method.
**Collections** A collection is built upon a completely defined species. This means that every method must be defined. In other words, in a collection, every operation has an implementation, and every theorem is formally proved. In addition, a collection is “frozen”; it cannot be used as a parent of a species in the inheritance graph. Moreover, to ensure modularity and abstraction, the carrier of a collection is hidden: seen from the outside, it becomes an abstract type. This means that any software component dealing with a collection will only be able to manipulate it through the operations it provides (i.e. its methods). This point is especially important since it prevents other software components from breaking representation invariants required by the internals of the collection.
**Parameterization** Besides inheritance, another important feature of FoCaLiZe is the ability to parameterize a species by collections parameters (whose “types” are given species). This mechanism allows using a species, not to embed its methods, but rather to use it as an “ingredient” to build a new structure by calling its methods explicitly.
### 2.3 Programming with FoCaLiZe
The computational part of FoCaLiZe is validated by its computer algebra library, mostly developed by R. Rioboo [6, 25] which implements mathematical structures up to multivariate polynomial rings and includes complex algorithms with performance comparable to the best computer algebra systems in existence. Furthermore, as we will see, this library is very useful when formalizing some security models based on partial orders, lattices or boolean algebras. Of course, nowadays, proof assistants provide some features for structuring code (module systems, type classes, etc), but most of them still cannot be used to obtain efficient programs. Compilation of FoCaLiZe developments leads to efficient OCaml programs (which are not obtained by extracting computational contents of proofs). It is this focus on efficiency that makes FoCaLiZe a real programming language. Hence, the main originality of FoCaLiZe is to provide an object-oriented programming language that allows mixing specifications, programs and proofs. To our knowledge, only the Agda [8] programming language, based on dependent types and compiling via Haskell, has a comparable mix of features. Note that the FoCaLiZe language is also based on a dependent type language, but with some restrictions on dependencies: for instance, a function cannot depend on a proof. By allowing such dependencies, we might get a better treatment of partial functions, but function redefinition would get trickier to handle because of logical clashes. In practice, this seems too difficult and we have rejected this possibility.
### 3. Security policies and secured systems
Several points of view exist on security policies, among which two main approaches can be distinguished: the rule-based approach (which consists in specifying the conditions under which an action is granted) and the property-based approach (which consists in specifying the security properties the policy aims to enforce). These two approaches are formally specified and compared in [19], and an operational mechanism for enforcing such policies over transition systems is defined together with the proof of its soundness. In this framework, one can characterize the various entities involved in the definition of a security policy together with their roles, thus providing a semantic specification of security policies. Several developments on access control poli-
cies and flow policies have been done within this framework: an operational mechanism that detects illegal information flows according to the flow policy induced by an access control policy is defined in [20], and the rule-based approach is considered in [7] by using rewrite systems. In this paper, we focus on the property-based approach, which provides for a clear distinction between a policy and its enforcement mechanism.
3.1 Security policies
Defining a security policy by following the property-based approach consists in characterizing secure elements of a set according to some security information. Thus, specifying a policy \( \mathcal{P} \) first consists in defining a set \( \mathcal{T} \) of “things” that the policy aims at controlling, called the security targets. These “things” can be the actions simultaneously done in the system, or some information about the entities of the system. Then a set \( \mathcal{C} \) of security configurations is introduced: configurations correspond to the information needed to characterize secure elements of \( \mathcal{T} \) according to the policy. Finally, the policy is specified by a binary relation \( \sqsubseteq \) between targets and configurations: \( c \sqsubseteq t \) means that the target \( t \) is secure according to the configuration \( c \). Hence, a security policy is a triple:
\[
\mathcal{P} = (\mathcal{T}, \mathcal{C}, \sqsubseteq)
\]
where \( \mathcal{T} \) is a set of security targets, \( \mathcal{C} \) is a set of security configurations and \( \sqsubseteq \subseteq \mathcal{C} \times \mathcal{T} \) is a relation specifying secure targets according to configurations.
For example, when dealing with access control policies, targets are sets of accesses simultaneously done in the system and we can represent accesses as triples \( (s, o, a) \) expressing that a subject \( s \in \mathcal{S} \) has an access over an object \( o \in \mathcal{O} \) according to an access mode \( a \in \mathcal{A} \). Hence, in this context, the set \( \mathcal{T}_A \) of targets is the powerset of the cartesian product \( \mathcal{S} \times \mathcal{O} \times \mathcal{A} \). In this paper, we illustrate our development with two classical access control policies.
The HRU policy [18] is a discretionary access control policy whose configurations are sets of authorized accesses, thus targets and configurations both specify sets of accesses and we have \( \mathcal{T}_A = \mathcal{C}_{HRU} \). Hence, secure targets are defined as sets of accesses which are granted:
\[
c \sqsubseteq_{HRU} t \Leftrightarrow t \subseteq c
\]
We also consider the mandatory part of the Bell & LaPadula policy [4], whose configurations are tuples:
\[
(\mathcal{L}, \preceq, f_o, f_s) \in \mathcal{C}_{BLP}
\]
where \( (\mathcal{L}, \preceq) \) is a partially ordered set of security levels (or sensitivities), and where \( f_o : \mathcal{O} \rightarrow \mathcal{L} \) (resp. \( f_s : \mathcal{S} \rightarrow \mathcal{L} \)) associates a security level with each object (resp. each subject). Then, secure targets are sets of accesses such that the following two properties hold.
- (MAC property) Each read access over an object \( o \) is done by a subject whose security level is greater than or equal to \( f_o(o) \) (in order to ensure a confidentiality policy).
\[
\forall (s, o, \text{read}) \in t, f_o(o) \preceq f_s(s)
\]
- (MAC property) Each write access over an object \( o_1 \) is done by a subject whose read accesses are only done over objects \( o_2 \) such that \( f_o(o_2) \preceq f_o(o_1) \) (in order to avoid information flows from high levels to low levels):
\[
\forall (s, o_1, \text{write}) \in t, \forall (s, o_2, \text{read}) \in t, f_o(o_2) \preceq f_o(o_1)
\]
3.2 Enforcement mechanism of security policies
Property-based policies can be used to ensure some security properties over reachable states of labelled transition systems (LTSs). We now define such an enforcement mechanism by showing how to “apply” a policy \( \mathcal{P} = (\mathcal{T}, \mathcal{C}, \sqsubseteq) \) “over” a LTS \( \mathcal{S} = (\Sigma, \Sigma^0, L, \delta) \) (where \( \Sigma \) is the set of states, \( \Sigma^0 \subseteq \Sigma \) is the set of initial states, \( L \) is the set of labels (or actions) and \( \delta \subseteq \Sigma \times L \times \Sigma \) is the transition relation). Features of the system we want to obtain are described by \( \mathcal{S} \) while security requirements of this system are specified by \( \mathcal{P} \).
First, in order to define a secured system from \( \mathcal{S} \) and \( \mathcal{P} \), we have to define an interface between the system and the policy. This can be done by considering an interpretation:
\[
I : \Sigma \rightarrow \mathcal{T}
\]
mapping states of the system to targets of the policy. Then, according to this interpretation, a secured system can be defined by:
\[
\mathcal{S}_P = (\Sigma^0, \Sigma^0_P, L, \delta_P)
\]
where
- \( \Sigma^0_P = \Sigma \times \mathcal{C} \) (configurations are used to monitor the system and a state of the secured system corresponds to a state of the initial system and a configuration of the policy),
- \( \Sigma^0_P \) is the set of secure initial states:
\[
\Sigma^0_P = \{ (\sigma, c) \mid \sigma \in \Sigma^0 \land c \sqsubseteq I(\sigma) \}
\]
- \( \delta_P \) is the transition relation obtained from \( \delta \) by removing transitions from secure states to non-secure states:
\[
\delta_P = \left\{ (\sigma_1, c) \xrightarrow{\delta_P} (\sigma_2, c) \mid \begin{array}{l}
\sigma_1 \xrightarrow{l} \sigma_2 \land c \sqsubseteq I(\sigma_1) \Rightarrow c \sqsubseteq I(\sigma_2) \\
\sigma_1 \xrightarrow{r} \sigma_2 \land c \sqsubseteq I(\sigma_1) \Rightarrow c \sqsubseteq I(\sigma_2)
\end{array} \right\}
\]
Of course, it is easy to prove (by induction) that every reachable state \( (\sigma, c) \) of \( \mathcal{S}_P \) is secure according to \( \mathcal{P} \) (i.e. is such that \( c \sqsubseteq I(\sigma) \)). Hence, by following such an approach, the initial system is designed to ensure some features (for example, an access system allows opening and to closing accesses over objects) without taking into account security, while the
policy is intended to specify the desired security properties, which generally depend on external information about the configurations (for example, a policy specifying secure sets of opened accesses according to authorized accesses). Therefore, the definition of $\delta_p$ provides a generic method to automatically enforce an abstract security policy on a system.
4. Development of secured systems within FoCaLiZe
This section describes the implementation within FoCaLiZe of the framework presented in section 3. More precisely, we show here how to take advantage of the features provided by FoCaLiZe to easily produce a modular, certified and efficient implementation of a secured system. As we said, none of these features are new, but it is their combination within the same programming language that is original. Throughout this section, only the most significant parts of the code will be shown (technical details will be replaced with “...”).
4.1 Transition systems
We first briefly describe the implementation of LTSs from which secured systems will be defined. In Table 1, we introduce the species $\text{Trans}_\text{sys}$ that describes a transition system parameterized by a set $S$ of states (species $\text{State}$ containing the declaration of a predicate characterizing initial states), a set $L$ of labels (species $\text{Label}$), and an abstract notion SLS of triples (species $\text{Abstract}_\text{triple}$ providing generic methods over triples). These species inherit from the species $\text{Setoid}$ (non-empty set with an equivalence relation).
```plaintext
species State =
inherit Setoid;
signature is_initial : Self -> bool;
end;;
species Label = inherit Setoid; end;;
```
The parameter SLS can be viewed as a simple data structure, provided to methods of the species $\text{Trans}_\text{sys}$ to manipulate triples. This is needed when defining sequences of transitions of a LTS (which are lists of triples, each triple $(\sigma_1, l, \sigma_2)$ denoting a transition, labeled $l$, from state $\sigma_1$ to state $\sigma_2$). Since a transition system can be completely defined by the parameters and the methods introduced by the species $\text{Trans}_\text{sys}$, we use $\text{unit}$ as its carrier type. Note that this species describes a single transition system, not a collection of transition systems. The (declared) method $\delta$ corresponds to the transition relation of the system; it is used to define the logical methods that specify determinism and completeness of this transition relation. The logical method $\text{is_reachable}$ specifies the set of reachable states of this transition system: a state $x$ is reachable iff there exists a sequence of transitions starting from an initial state and ending by $x$. This method is based on the recursive boolean function $\text{is_path_from_init_to}$ that characterizes sequences of transitions starting from an initial state and leading to a given state:
- $\text{is_path_from_init_to}([], x) = true$ means that the empty sequence of transition leads to the state $x$ (i.e. $x$ is an initial state).
- $\text{is_path_from_init_to}(h::l, x) = true$ means that $h$ is a triple $(y, l, x) \in \delta$ and $l$ is a sequence of transitions starting from an initial state and leading to the state $y$.
These two properties are introduced as theorems (automatically proved from the definition of $\text{is_path_from_init_to}$ and are our specification of the $\text{is_path_from_init_to}$ method. Of course, introducing theorems corresponding to these properties (which are very similar to the definition) may seem redundant. However, if the $\text{is_path_from_init_to}$ method is redefined through inheritance, proofs of these theorems will be erased by the FoCaLiZe compiler and will have to be re-done with the new definition. Therefore, these theorems can be used during the proofs of other results, which avoids depending on the definition of $\text{is_path_from_init_to}$ and thus allows redefining it without invalidating these proofs (only the proofs of the specification of $\text{is_path_from_init_to}$ have to be done again). Remark that the inheritance mechanisms of object-oriented programming are not harmless when dealing with theorems: the main point here is that the redefinition of a function during inheritance may invalidate some proofs which are then erased and must be redone in the new context. In [24], such issues are discussed and a methodology is proposed to minimize the impact of redefinitions on proofs.
In practice, transition systems are often defined by a transition function $\tau : \Sigma \times L \rightarrow \Sigma$. Hence, we also introduce the species $\text{Op}_\text{trans}_\text{sys}$ that inherits from $\text{Trans}_\text{sys}$ and adds the declaration of a transition function from which the declared method $\delta$ can now be defined:
$$((\sigma_1, l, \sigma_2) \in \delta \leftrightarrow \tau(\sigma_1, l) = \sigma_2)$$
The definition of $\text{Op}_\text{trans}_\text{sys}$ also gives the properties (deterministic and complete) that this definition leads to a deterministic and complete transition relation, along with the proofs of these properties.
**Example: access system** Based on the specification of LTSs within FoCaLiZe, we now build an implementation of access systems. An access system provides a way for users of a system (the subjects in $S$) to access sets of services or resources (the objects in $O$) according to some access modes (in $A$). Subjects, objects and access modes are specified by finite sets:
```plaintext
species Subject = inherit Finite_set; end;;
species Object = inherit Finite_set; end;;
species Access_mode = inherit Finite_set; end;;
```
and states are represented by finite parts of the cartesian product $S \times O \times A$. Hence, the species $\text{State}$ is parameterized by the subjects, the objects and the access modes, but also by the implementations of triples and finite subsets:
species Trans_syst (S is State, L is Label, SLS is Abstract.triple(S, L, S)) =
inherit Basic.object;
representation = unit;
signature delta : S -> L -> S -> bool;
logical let is_deterministic =
all x y z : S, all l : L, ( delta (x, l, y) \ delta (x, l, z) ) -> S!equal (y, z);
logical let is_complete = all x : S, all l : L, ex y : S, delta (x, l, y);
let rec is_path_from_init_to(p, x) = match p with
| [] -> S!is_initial (x)
| h :: q -> S!equal (LS!third(h), x) \&\& delta (LS!first(h), LS!second(h), x)
\&\& is_path_from_init_to(q, SLS!first(h));
theorem is_path_from_init_to_base: all x : S, is_path_from_init_to([], x) <-> S!is_initial(x)
proof = by definition of is_path_from_init_to;
theorem is_path_from_init_to_ind: all x : S, all h : SLS, all q : list(LSL),
is_path_from_init_to(h :: q), x)
<-> S!equal (LSL!third(h), x) \ delta (LSL!first(h), LSL!second(h), x)
\ is_path_from_init_to (q, LSL!first(h))
proof = by definition of is_path_from_init_to;
logical let is_reachable (x) = ex p : list (SLSL), is_path_from_init_to (p, x);
... end;;
species Op_trans_syst (S is State, L is Label, SLS is Abstract.triple(S, L, S)) =
inherit Trans_syst (S, L, SLS);
signature transition : S -> L -> S;
let delta(s1, l, s2) = S!equal(transition(s1, l), s2);
theorem deterministic : is_deterministic proof = ...
theorem complete : is_complete proof = ...
... end;;
Table 1. Transition systems
species State_ac(
S is Subject, O is Object, A is Access_mode,
SOA is Abstract.triple(S, O, A),
PSOA is Finite_parts(SOA)) ...
This species inherits from the species State, defines one initial state (the empty set) and specifies the carrier type as the representation of finite subsets of the set of triples (obtained from the parameter PSOA). Labels of access systems are just pairs \(\langle \text{+}, (s, o, a) \rangle\) and \(\langle \text{-}, (s, o, a) \rangle\) expressing that a subject \(s\) is going to to access \(\text{+}\) or to release its access \(\text{-}\) to the object \(o\) according to the mode \(a\). This is specified by the species:
species Label_ac(
S is Subject, O is Object, A is Access_mode,
SOA is Abstract.triple(S, O, A)) ...
inheriting from Label. Now, from the following definition of the transition function:
\[
\tau_{ac}(A, l) = \begin{cases}
A \cup \{(s, o, a)\} & \text{if } l = \langle \text{+}, (s, o, a) \rangle \\
A \setminus \{(s, o, a)\} & \text{if } l = \langle \text{-}, (s, o, a) \rangle
\end{cases}
\]
obtained by using operations over finite subsets, it becomes possible to define a species:
species Op_trans_syst_ac(
S is Subject, O is Object, A is Access_mode,
SOA is Abstract.triple(S, O, A),
L is Label_ac(S, O, A, SOA),
PSOA is Finite_parts(SOA),
St is State_ac(S, O, A, SOA, PSOA),
SLS is Abstract.triple(St, L, SLS)) ...
that inherits from Op_trans_syst(St, L, SLS) and implements a complete and deterministic access system.
4.2 Secured systems
4.2.1 Secure states and Secured systems
Formalizing the framework introduced in section 3 within FoCaLiZe has led us to generalize it in order to obtain a generic and modular implementation. Indeed, the definition of a secured system is strongly related to the notion of secure state. We reuse here the notations of section 3, where the notion of secure state is defined by considering security policies and the states of a secured system are defined as the product \(\Sigma \times C\) (where \(C\) corresponds to the set of configurations of the policy), thus only secured systems obtained from a system and a policy can be described by following this approach. However, the construction of a secured system is independent of the way secure states are defined. Hence, we introduce here a more abstract notion of secure state that specifies what are states of secured systems (this abstract notion will be instantiated by \(\Sigma \times C\) when considering policies).
This allows using our development with other approaches that define a notion of secure state.
From an abstract point of view, the set $\Sigma'$ of states of a secured system is obtained from the set $\Sigma$ of states of the system we want to make secure and a predicate $\Omega$ over $\Sigma$ that characterizes which states are secure. In fact, the set $\Sigma'$ can be viewed as a structure over $\Sigma$. Hence, we define the species $\text{Sec}_\text{state}$ deriving from $\Sigma'$ from the parameter $\Sigma$. This species contains the declaration of the method $\text{state}$ that maps back to the state $\sigma \in \Sigma$ from which a state $\sigma' \in \Sigma'$ was obtained: $\text{state}$ corresponds to a projection function $I_S : \Sigma' \rightarrow \Sigma$. The converse method $\text{make}$ is also declared to characterize the “decoration” that was added to a state $\sigma \in \Sigma$ to obtain a state $\sigma' \in \Sigma'$; if $\sigma' \in \Sigma'$ has been obtained from $\sigma_0 \in \Sigma$, then $\text{make}(\sigma', \sigma) = \sigma''$ means that the “decoration” which has been added when transforming $\sigma_0$ into $\sigma'$ is the same as the one used to transform $\sigma$ into $\sigma''$. Finally, we declare the method $\text{is_secure}$ (corresponding to our $\Omega$ predicate) that characterizes the secure states of $\Sigma'$. It allows us to define the initial states of $\Sigma'$ (method $\text{is_initial}$ inherited from the species State) as the set:
$$\{\sigma' \in \Sigma' \mid I_S(\sigma') \in \Sigma^0 \land \Omega(\sigma')\}$$
Therefore, $\sigma'$ is initial iff it is secure according to $\Omega$ and it has been obtained from an initial state $\sigma \in \Sigma^0$.
species $\text{Sec}_\text{state}$ (S is State) =
inhibit State;
signature state : Self -> S;
signature make : Self -> S -> Self;
signature $\text{is_secure}$ : Self -> bool;
property make_spec : all x : Self,
\[ \text{equal} (\text{make} (x, \text{state} (x)), x) \];
let $\text{is_initial}$ (x : Self) =
$\text{S!is_initial} (\text{state} (x)) \& \& \text{is_secure} (x);
... end;;
From this abstract notion of secure state, it becomes possible to implement secured systems (see table 2). First the species $\text{Sec}_\text{trans_syst}$ is defined: it is parameterized by a transition system $\text{Sys}$ (obtained from a set $\text{St}$ of states and a set $\text{L}$ of labels) and a notion of secure states $\text{Ss}$ (obtained from $\text{St}$), and specifies (by inheritance) a transition system whose states are in $\text{Ss}$ and whose labels are in $\text{L}$. The transition relation $\delta_\Omega$ of this system is defined from the transition relation $\delta$ of $\text{Sys}$ as follows:
$$\delta_\Omega = \left\{ \begin{array}{ll} \sigma_1 \xymatrix{ \ar@{->}[r]^-{\delta_\Omega} & } \sigma_2 & \\
I_S(\sigma_1) \xymatrix{ \ar@{->}[r]^-{\delta_\Omega} & } I_S(\sigma_2) \land \Omega(\sigma_1) \Rightarrow \Omega(\sigma_2) \end{array} \right\}$$
This definition allows us to prove the theorem asserting that each reachable state of this system is secure: the proof of the theorem $\text{reachable_is_secure}$ is obtained by telling the Zenon automatic theorem prover to use the definition of reachable states (based on the method $\text{is_path_from_init_to}$), and the theorem $\text{all_secure}$ (which asserts that if $\ell$ is a list representing a sequence of transitions that starts with an initial state and ends with a state $x$, then $x$ is secure). As we can see in table 2, the proof of $\text{all_secure}$ is obtained by induction over $\ell$:
- $\langle 1 \rangle 1$ is the proof of the base case obtained when $\ell$ is the empty list $\emptyset$ by telling Zenon to use the theorem $\text{is_path_from_init_to_base}$ (which is part of the specification of $\text{is_path_from_init_to}$ and entails that $x$ is an initial state), and the property $\text{Ss!is_initial_spec}$, proved in the species $\text{Sec_state}$, which specifies that initial states are secure (here again, the proof does not depend on the definition of $\text{is_initial}$ but only on its specification).
- $\langle 1 \rangle 2$ is the proof of the inductive step obtained when $\ell$ is non-empty by telling Zenon to use the definition of $\delta_\Omega$ (the method $\text{delta}$ of the species $\text{Sec_trans_syst}$), the theorem $\text{is_path_from_init_to_ind}$ (which is part of the specification of the method $\text{is_path_from_init_to}$, as described on page 5), the specification of projection operators and equality over triples, the reflexivity property of equality over labels, and a property on the equality defined over states (expressing that this relation is a congruence for the transition relation).
As we can see, proving a property within FoCaLiZe can usually be done just by identifying the definitions that must be unfolded and the properties from which Zenon can automatically build the proof.
Intuitively, $\delta_\Omega$ is obtained by removing from $\delta$ all the “non-secure” transitions. Hence, even if $\delta$ is complete, $\delta_\Omega$ is not necessarily complete and we have to refine this definition in order to obtain a complete and deterministic transition system. This can be done by replacing “non-secure” transitions from a state $\sigma$ with the “identity” transition from $\sigma$ (other approaches can be defined: for example, in some cases, it may be useful to introduce an element $\bot$ denoting an error state obtained when trying to perform a forbidden action in a system). Thus, we define the transition function $\tau_\Omega : \Sigma' \times L \rightarrow \Sigma'$ from the transition function $\tau : \Sigma \times L \rightarrow \Sigma$ (of the initial system) as follows:
$$\tau_\Omega(\sigma_1, \ell) = \left\{ \begin{array}{ll} \text{make}(\sigma_1, \tau(I_S(\sigma_1), l)) & \text{if } \Omega(\sigma_1) \Rightarrow \Omega(\text{make}(\sigma_1, \tau(I_S(\sigma_1), l))) \\
\sigma_1 & \text{otherwise} \end{array} \right\}$$
By following such an approach, we define the species $\text{Sec_op_trans_syst}$, which implements a complete and deterministic transition system parameterized by the complete and deterministic system $\text{Sys}$ that we want to make secure, and a notion $\text{Ss}$ of secure states, and which implements (by inheritance) both a secured system and a deterministic and complete system. However, since the transition relation of the complete and deterministic system is defined from $\tau_\Omega$,
this transition relation corresponds now to the relation:
\[ \delta_1' = \left\{ \sigma_1 \xrightarrow{\sigma_1'} \sigma_2 \mid \sigma_1 \xrightarrow{\sigma_1} \sigma_2 \right\} \cup \left\{ \sigma_1 \xrightarrow{\sigma_1'} \sigma_1' \xrightarrow{\sigma_2} \sigma_2 \right\} \]
which does not coincide with the definition of \( \delta_1 \). In fact, the method delta of the species Sec_trans_syst is redefined here. Therefore, the proof of all_secure (which depends on the definition of the transition relation) from the species Sec_trans_syst is erased by FoCaLiZe, and we have to give another proof to take the new definition into account.
### 4.2.2 Secured systems and Policies
We show how to instantiate our generic notion of secured system by considering security policies as introduced in section 3.
**Security policies** We first introduce the species implementing a policy, parameterized by a setoid of targets and a setoid of configurations. It inherits from the species of binary relations. We declare the method secure to characterize secure targets according to configurations. It is used to define the relation method inherited from the binary relation species.
```plaintext
species Target = inherit Setoid; end;;
species Configuration = inherit Setoid; end;;
species P_policy
(A is Target, C is Configuration)=
inherit Relation (A, C);
signature secure: A -> C -> bool;
let relation(a, c) = secure(a, c);
end;;
```
**Example: Access control policies** As illustrated by figure 2, the species P_policy is the root of a hierarchy of security policies. For example, the species P_policy_ac implements access control policies and can be defined by simply specifying targets as an abstract ternary relation between subjects, objects and access modes:
```plaintext
species P_policy_ac
(S is Subject, O is Object, A is Access_mode, R is Ternary_relations(S, O, A),
T is Target_ac(S, O, A, R),
C is Configuration)=
inherit P_policy (T, C);
end;;
```
Hence, at this level, nothing is assumed on the representation of sets of accesses and this species can be instantiated with any implementation of sets of accesses that inherits from Ternary_relations(S, O, A). Then, the HRU policy (introduced in section 3) can be specified as follows:
```plaintext
species P_policy_hru
(S is Subject, O is Object, A is Access_mode, R is Ternary_relations(S, O, A),
T is Target_ac (S, O, A, R),
C is Configuration_ac (S, O, A, R)) =
inherit P_policy_ac (S, O, A, R, T, C);
let secure (t, c) =
R!is_contained(T!as_relation(t),C!as_relation(c));
... end;;
```
Configurations of this policy are also sets of (authorized) accesses represented by the same abstract notion of ternary relation than targets (specified by the parameter R), and from which the method secure can be defined: \( t \) is secure according to \( c \) iff \( t \), viewed as a relation, is contained in \( c \), also viewed as a relation (species Target_ac and Configuration_ac both contain the method as_relation:Self -> R).
We can also refine the definition of \( P_{policy\_ac} \) by considering a particular set of access modes: for example \( A = \{\text{read}, \text{write}\} \).
```plaintext
species Access_mode_rw =
inherit Access_mode;
signature read: Self;
signature write: Self;
end;;
```
```plaintext
species P_policy_ac_rw
(S is Subject, O is Object, A is Access_mode, R is Ternary_relations(S, O, A),
T is Target_ac (S, O, A, R),
C is Configuration)=
inherit P_policy_ac (S, O, A, R, T, C);
end;;
```
Now, we can refine again the definition of the HRU policy by using multiple inheritance as follows:
```plaintext
species P_policy_hru_rw
(S is Subject, O is Object, A is Access_mode, R is Ternary_relations(S, O, A),
T is Target_ac (S, O, A, R),
C is Configuration_ac (S, O, A, R)) =
inherit P_policy_ac_rw(S, O, A, R, T, C),
P_policy_hru(S, O, A, R, T, C);
end;;
```
As we can see here, parameterization and inheritance are powerful mechanisms for building new components from existing components.
The species P_policy_ac_rw can also be refined by considering the Bell & LaPadula policy (introduced in section 3). Security levels are obtained by inheritance from the species Partial_order of the FoCaLiZe library, and are used to define the species of configurations:
```plaintext
species Security_level=inherit Partial_order; end;;
```
```plaintext
species Configuration_BLP
(S is Subject, O is Object, L is Security_level)=
inherit Configuration;
signature fo: Self -> O -> L;
signature fs: Self -> S -> L;
end;;
```
The Bell & LaPadula policy can now be implemented:
species Sec_trans_syst (St is State, L is Label, SLT is Abstract.triple(St, L, St),
Sys is Trans_syst (St, L, SLT), Ss is Sec_state (St), SLS is Abstract.triple(Ss, L, Ss)) =
inherit Trans_syst (Ss, L, SLS);
let delta (x : Ss, l : L, y : Ss) =
Sys!delta (Ss!state (x), l, Ss!state (y)) && ( ~~ Ss!is_secure (x) || Ss!is_secure (y) );
theorem all_secure: all l: list(SLS), all x: Ss, is_path_from_init_to(l, x) -> Ss!is_secure (x)
proof =
<1>1 prove all x: Ss, is_path_from_init_to([], x) -> Ss!is_secure (x)
by property is_path_from_init_to_base, Ss!is_initial specified
<1>2 prove all l: list(SLS),
(all z: Ss, is_path_from_init_to(l, z) -> Ss!is_secure(z))
-> all x: Ss, all t: SLS, is_path_from_init_to((t :: l), x) -> Ss!is_secure(x)
by definition of delta
property is_path_from_init_to_ind, L!equal_reflexive, SLS!is_first, SLS!is_second,
SLS!is_third, SLS!equal_spec, delta!equal_compatible
<1>3 conclude ;
theorem reachable_is_secure: all x: Ss, is_reachable(x) -> Ss!is_secure(x)
proof = by definition of is_reachable property all_secure;
... end;;
species Sec_op_trans_syst(St is State, L is Label, SLT is Abstract.triple(St, L, St),
Sys is Op_trans_syst(St, L, SLT), Ss is Sec_state (St), SLS is Abstract.triple(Ss, L, Ss) ) =
inherit Sec_trans_syst (St, L, SLT, Sys, Ss, SLS), Op_trans_syst (Ss, L, SLS);
let transition(x, l) = let s = Sys!transition(Ss!state(x), l) in let y = Ss!make(x, s) in
if (( ~~ Ss!is_secure(x)) || Ss!is_secure(y)) then y else x;
proof of all_secure = ...
... end;;
Note that while the HRU policy can be specified with a very abstract notion of set of accesses (only an inclusion test is needed), the BLP policy needs a more concrete specification of sets of accesses because we have to be able to consider each access and to use projection functions to specify properties on subjects, objects and access modes occurring in accesses. This is obtained by taking as parameters ternary relations represented as finite sets of triples (species Relations_by_sets_of_triples). This makes a difference when comparing policies “on paper” and implementations of these policies within FoCaLiZe. The species P_policy_BLP defines two predicates (mac and mac_star) that correspond exactly to the properties introduced in section 3; they characterize secure targets according to configurations: they are expressed by considering targets as ternary relations. However, the method secure declared in the species P_policy (from which P_policy_BLP inherits) is a boolean function and needs an operational definition. Hence, we define the methods mac_secure and mac_star_secure which are functions, where targets are considered as finite sets represented by lists. Of course, we prove the equivalence between each predicate and its corresponding function.
Secure states and security policies We show here how to refine the species of states of a secured system by considering a security policy. As we said in section 3, states of the secured system are pairs belonging to the cartesian product \( \Sigma_P = \Sigma \times C \) and we introduce the species Sec_state_pol (specifying a set \( \Sigma' \) of states) parameterized by a policy \( \mathcal{P} \) and the set of states \( \Sigma \) of the system we want to make secure. It inherits from the species of cartesian products (instantiated with \( \Sigma \) and \( C \)) and from the species Sec_state(\( \Sigma \)). In this context the method state can be defined by the function \( I_S : \Sigma_P \rightarrow \Sigma \) such that:
\[
\forall (\sigma, c) \in \Sigma_P, I_S((\sigma, c)) = \sigma
\]
Conversely, the method make is defined by:
\[
\text{make}(\sigma_1, c), \sigma_2 = (\sigma_2, c)
\]
Finally, secure states of \( \Sigma' \) are characterized by introducing an interpretation \( I : \Sigma \rightarrow T \) as explained in section 3. This leads us to define the predicate \( \Omega \) by:
\[
\Omega((\sigma, c)) \iff c \vdash I(\sigma)
\]
Hence, the transition relation of such a system is defined by:
\[
\delta'_p = \left\{ \begin{array}{l}
(\sigma_1, c) \xrightarrow{I} (\sigma_2, c) \\
\sigma_1 \xrightarrow{I} \sigma_2 \land c \models I(\sigma_1) \Rightarrow c \models I(\sigma_2)
\end{array} \right\}
\cup \left\{ \begin{array}{l}
(\sigma_1, c) \xrightarrow{\delta'} (\sigma_1, c) \\
\sigma_1 \xrightarrow{\delta'} \sigma_2 \land c \models I(\sigma_1) \land \neg c \models I(\sigma_2)
\end{array} \right\}
\]
and, as we said, does not exactly correspond to \(\delta_p\).
**Example: Secured access system** We can now obtain a secured access system from the species introduced above. For example, we can build the following deterministic and complete system from the species \(\text{Op}_\text{trans_syst_ac}\) (specifying what is an access system) and \(\text{P}_\text{policy_BLP}\) (specifying the Bell & LaPadula policy) as follows:
species Sec_syst_blp(
S is Subject,
O is Object,
Le is Security_level,
A is Access_mode_rw,
SOA is Triples_by_pairs(S, O, A),
PSOA is Finite_parts(SOA),
St is State_ac(S, O, A, SOA, PSOA),
La is Label_ac(S, O, A, SOA),
SLS is Abstract_triple(St, La, SLS),
Sys is Op_trans_syst_ac(S, O, A, SOA, La, PPOA, St, SLS),
Sa is Sec_state_pol(T, C, P, St),
SaLS is Abstract_triple(Ss, La, Sa)) =
inherit Sec_op_trans_syst_pol
(T, C, P, St, La, SLS, Sys, Ss, SaLS);
end;;
Here again, parameters both specify the “ingredients” needed to define the species and the way these “ingredients” are combined at several levels of abstraction (for example, triples built from subjects, objects and access modes are here represented by pairs of the form \((s, (o, a))\) which is a very concrete representation, while triples built from states, labels and states are just specified at a higher level of abstraction.
5. Conclusion
Many developments have been done on security policies and enforcement mechanisms but few of them are formalized within a generic framework that allows reusing, comparing and composing such developments. Furthermore, operational mechanisms used to enforce policies are usually not designed independently of the policy they are intended to enforce, which does not lead to a clear separation between the specification of the desired security properties and the mechanisms (i.e. the method used to implement the policy) that enforce these properties. In [26], by using the B refinement process [1], an enforcement mechanism of a policy in a TCP/IP network is obtained from an abstract specification of this policy. Our approach is similar: in this paper, we have both introduced an abstract framework for specifying security policies and a sound generic operational mechanism to enforce such policies over transition systems.
In order to formally certify our enforcement mechanism, our implementation is done within the FoCaLiZe programming environment, and yields modular programs. Indeed, thanks to its object-oriented features, FoCaLiZe allows us to describe the same notion at several levels of abstraction (at each level, we focus on the main operations we want to specify or to define). Moreover, many software components implemented within FoCaLiZe (i.e. species or collections) can be directly built by inheritance and parameterization from already defined components. Hence, such developments can easily be reused in different contexts. Last but not least, it should be noted that the proofs were easy to do, thanks to the Zenon automatic theorem prover.
Of course, all these features facilitate the development of certified programs and therefore FoCaLiZe is particularly well-suited to develop libraries for secure applications. In fact, the claim behind FoCaLiZe is that formal developments increase confidence in the final code. One of the main characteristics of critical software is that it is subject to the approval of a safety/security authority before its commissioning. These authorities have defined requirements explaining what should be an acceptable software and its related life cycle process for their own domain. For this reason, getting a high confidence in produced code, and making it possible for the safety/security authority to acquire this confidence is an important task, for which FoCaLiZe brings solutions. Very important is the possibility in FoCaLiZe to have specification, implementation and proofs *within the same language*, since it eliminates the errors introduced between layers, at each switch between languages, during the development cycle. Other frameworks like Atelier B [1] also aims to implement tools for making formal development a reality. FoCaLiZe doesn’t follow the same path, trying to keep the means of expression close to what engineers usually know: a programming language. Moreover, instead of having its own system for proofs validation, FoCaLiZe makes use of external tools, leaving the task of handling proof automation and verification outside its scope and reaping the benefits of research performed by others in these specific domains.
As future work, we plan to implement some comparison mechanisms between security policies in order to formalize within FoCaLiZe the flow-based interpretation of access control policies, as defined in [20]. Indeed, we are currently formalizing software requirements expressed in the standard FIPS 140-3, which specifies security requirements of a cryptographic module. This leads us to structure these requirements and to express them as security policies. Our aim is
to formally prove some abstract confinement, confidentiality and integrity properties induced by these concrete requirements.
Acknowledgments
Many thanks to Thérèse Hardin and François Pessaux for enlightening discussions about this work.
References
|
{"Source-Url": "https://inria.hal.science/hal-00773654/file/DJR.pdf", "len_cl100k_base": 12517, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 47028, "total-output-tokens": 15379, "length": "2e13", "weborganizer": {"__label__adult": 0.0003097057342529297, "__label__art_design": 0.00033283233642578125, "__label__crime_law": 0.0004534721374511719, "__label__education_jobs": 0.0005140304565429688, "__label__entertainment": 4.839897155761719e-05, "__label__fashion_beauty": 0.00012671947479248047, "__label__finance_business": 0.0002701282501220703, "__label__food_dining": 0.00029921531677246094, "__label__games": 0.0004291534423828125, "__label__hardware": 0.0008525848388671875, "__label__health": 0.0004277229309082031, "__label__history": 0.00022041797637939453, "__label__home_hobbies": 0.00010901689529418944, "__label__industrial": 0.00046896934509277344, "__label__literature": 0.00019109249114990232, "__label__politics": 0.0002512931823730469, "__label__religion": 0.00041365623474121094, "__label__science_tech": 0.0290069580078125, "__label__social_life": 7.790327072143555e-05, "__label__software": 0.0072784423828125, "__label__software_dev": 0.95703125, "__label__sports_fitness": 0.00023496150970458984, "__label__transportation": 0.0004298686981201172, "__label__travel": 0.00016748905181884766}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 57279, 0.01424]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 57279, 0.68827]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 57279, 0.86351]], "google_gemma-3-12b-it_contains_pii": [[0, 1223, false], [1223, 4622, null], [4622, 10576, null], [10576, 15474, null], [15474, 21704, null], [21704, 27694, null], [27694, 31661, null], [31661, 38186, null], [38186, 42866, null], [42866, 44378, null], [44378, 46806, null], [46806, 52318, null], [52318, 57279, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1223, true], [1223, 4622, null], [4622, 10576, null], [10576, 15474, null], [15474, 21704, null], [21704, 27694, null], [27694, 31661, null], [31661, 38186, null], [38186, 42866, null], [42866, 44378, null], [44378, 46806, null], [46806, 52318, null], [52318, 57279, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 57279, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 57279, null]], "pdf_page_numbers": [[0, 1223, 1], [1223, 4622, 2], [4622, 10576, 3], [10576, 15474, 4], [15474, 21704, 5], [21704, 27694, 6], [27694, 31661, 7], [31661, 38186, 8], [38186, 42866, 9], [42866, 44378, 10], [44378, 46806, 11], [46806, 52318, 12], [52318, 57279, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 57279, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-08
|
2024-12-08
|
e6bf0a358568bfe02ea088a8129997cd05b86a25
|
NSEC5, DNSSEC Authenticated Denial of Existence
draft-vcelak-nsec5-08
Abstract
The Domain Name System Security Extensions (DNSSEC) introduced two resource records (RR) for authenticated denial of existence: the NSEC RR and the NSEC3 RR. This document introduces NSEC5 as an alternative mechanism for DNSSEC authenticated denial of existence. NSEC5 uses verifiable random functions (VRFs) to prevent offline enumeration of zone contents. NSEC5 also protects the integrity of the zone contents even if an adversary compromises one of the authoritative servers for the zone. Integrity is preserved because NSEC5 does not require private zone-signing keys to be present on all authoritative servers for the zone, in contrast to DNSSEC online signing schemes like NSEC3 White Lies.
Ed note
Text inside square brackets ([ ]) is additional background information, answers to frequently asked questions, general musings, etc. They will be removed before publication. This document is being collaborated on in GitHub at <https://github.com/fcelda/nsec5-draft>. The most recent version of the document, open issues, etc should all be available there. The authors gratefully accept pull requests.
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 https://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 July 2, 2019.
Copyright Notice
Copyright (c) 2018 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
(https://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
1.1. Rationale ........................................... 3
1.2. Requirements ....................................... 6
1.3. Terminology ....................................... 6
2. Backward Compatibility ................................. 6
3. How NSEC5 Works ...................................... 7
4. NSEC5 Algorithms ..................................... 8
5. The NSEC5KEY Resource Record ........................ 9
5.1. NSEC5KEY RDATA Wire Format ....................... 9
5.2. NSEC5KEY RDATA Presentation Format ............. 9
6. The NSEC5 Resource Record ............................. 9
6.1. NSEC5 RDATA Wire Format ............................ 10
6.2. NSEC5 Flags Field ................................ 10
6.3. NSEC5 RDATA Presentation Format ................. 11
7. The NSEC5PROOF Resource Record .................... 11
7.1. NSEC5PROOF RDATA Wire Format .................... 11
7.2. NSEC5PROOF RDATA Presentation Format .......... 12
8. Types of Authenticated Denial of Existence with NSEC5 ... 12
8.1. Name Error Responses .............................. 12
8.2. No Data Responses .................................. 13
8.2.1. No Data Response, Opt-Out Not In Effect .... 13
1. Introduction
1.1. Rationale
NSEC5 provides an alternative mechanism for authenticated denial of existence for the DNS Security Extensions (DNSSEC). NSEC5 has two key security properties. First, NSEC5 protects the integrity of the
zone contents even if an adversary compromises one of the authoritative servers for the zone. Second, NSEC5 prevents offline zone enumeration, where an adversary makes a small number of online DNS queries and then processes them offline in order to learn all of the names in a zone. Zone enumeration can be used to identify routers, servers or other "things" that could then be targeted in more complex attacks. An enumerated zone can also be a source of probable email addresses for spam, or as a "key for multiple WHOIS queries to reveal registrant data that many registries may have legal obligations to protect" [RFC5155].
All other DNSSEC mechanisms for authenticated denial of existence either fail to preserve integrity against a compromised server, or fail to prevent offline zone enumeration.
When offline signing with NSEC is used [RFC4034], an NSEC chain of all existing domain names in the zone is constructed and signed offline. The chain is made of resource records (RRs), where each RR represents two consecutive domain names in canonical order present in the zone. The authoritative server proves the non-existence of a name by presenting a signed NSEC RR which covers the name. Because the authoritative server does not need to know the private zone-signing key, the integrity of the zone is protected even if the server is compromised. However, the NSEC chain allows for easy zone enumeration: N queries to the server suffice to learn all N names in the zone (see e.g., [nmap-nsec-enum], [nsec3map], and [ldns-walk]).
When offline signing with NSEC3 is used [RFC5155], the original names in the NSEC chain are replaced by their cryptographic hashes. Offline signing ensures that NSEC3 preserves integrity even if an authoritative server is compromised. However, offline zone enumeration is still possible with NSEC3 (see e.g., [nsec3walker], [nsec3gpu]), and is part of standard network reconnaissance tools (e.g., [nmap-nsec3-enum], [nsec3map]).
When online signing is used, the authoritative server holds the private zone-signing key and uses this key to synthesize NSEC or NSEC3 responses on the fly (e.g. NSEC3 White Lies (NSEC3-WL) or Minimally-Covering NSEC, both described in [RFC7129]). Because the synthesized response only contains information about the queried name (but not about any other name in the zone), offline zone enumeration is not possible. However, because the authoritative server holds the private zone-signing key, integrity is lost if the authoritative server is compromised.
NSEC5 prevents offline zone enumeration and also protects integrity even if a zone’s authoritative server is compromised. To do this, NSEC5 replaces the unkeyed cryptographic hash function used in NSEC3 with a verifiable random function (VRF) [I-D.irtf-cfrg-vrf] [MRV99]. A VRF is the public-key version of a keyed cryptographic hash. Only the holder of the private VRF key can compute the hash, but anyone with public VRF key can verify the correctness of the hash.
The public VRF key is distributed in an NSEC5KEY RR, similar to a DNSKEY RR, and is used to verify NSEC5 hash values. The private VRF key is present on all authoritative servers for the zone, and is used to compute hash values. For every query that elicits a negative response, the authoritative server hashes the query on the fly using the private VRF key, and also returns the corresponding precomputed NSEC5 record(s). In contrast to the online signing approach [RFC7129], the private key that is present on all authoritative servers for NSEC5 cannot be used to modify the zone contents.
Like online signing approaches, NSEC5 requires the authoritative server to perform online public key cryptographic operations for every query eliciting a denying response. This is necessary; [nsec5] proved that online cryptography is required to prevent offline zone enumeration while still protecting the integrity of zone contents against network attacks.
NSEC5 is not intended to replace NSEC or NSEC3. It is an alternative mechanism for authenticated denial of existence. This document specifies NSEC5 based on the VRFs in [I-D.irtf-cfrg-vrf] over the FIPS 186-3 P-256 elliptic curve and over the the Ed25519 elliptic curve. A formal cryptographic proof of security for NSEC5 is in [nsec5ecc].
1.2. Requirements
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].
1.3. Terminology
The reader is assumed to be familiar with the basic DNS and DNSSEC concepts described in [RFC1034], [RFC1035], [RFC4033], and [RFC4034]; subsequent RFCs that update them in [RFC2136], [RFC2181], [RFC2308], [RFC5155], and [RFC7129]; and DNS terms in [RFC7719].
The reader should also be familiar with verifiable random functions (VRFs) as defined in [I-D.irtf-cfrg-vrf].
The following terminology is used through this document:
Base32hex: The "Base 32 Encoding with Extended Hex Alphabet" as specified in [RFC4648]. The padding characters ("=") are not used in the NSEC5 specification.
Base64: The "Base 64 Encoding" as specified in [RFC4648].
QNAME: The domain name being queried (query name).
Private NSEC5 key: The private key for the verifiable random function (VRF).
Public NSEC5 key: The public key for the VRF.
NSEC5 proof: A VRF proof. The holder of the private NSEC5 key (e.g., authoritative server) can compute the NSEC5 proof for an input domain name. Anyone who knows the public VRF key can verify that the NSEC5 proof corresponds to the input domain name.
NSEC5 hash: A cryptographic digest of an NSEC5 proof. If the NSEC5 proof is known, anyone can compute its corresponding NSEC5 hash.
NSEC5 algorithm: A triple of VRF algorithms that compute an NSEC5 proof (VRF_prove), verify an NSEC5 proof (VRF_verify), and process an NSEC5 proof to obtain its NSEC5 hash (VRF_proof2hash).
2. Backward Compatibility
The specification describes a protocol change that is not backward compatible with [RFC4035] and [RFC5155]. An NSEC5-unaware resolver will fail to validate responses introduced by this document.
To prevent NSEC5-unaware resolvers from attempting to validate the responses, new DNSSEC algorithms identifiers are introduced in Section 16 which alias existing algorithm numbers. The zones signed according to this specification MUST use only these algorithm identifiers, thus NSEC5-unaware resolvers will treat the zone as insecure.
3. How NSEC5 Works
With NSEC5, the original domain name is hashed using a VRF [I-D.irtf-cfrg-vrf] using the following steps:
1. The domain name is processed using a VRF keyed with the private NSEC5 key to obtain the NSEC5 proof. Anyone who knows the public NSEC5 key, normally acquired via an NSEC5KEY RR, can verify that a given NSEC5 proof corresponds to a given domain name.
2. The NSEC5 proof is then processed using a publicly-computable VRF proof2hash function to obtain the NSEC5 hash. The NSEC5 hash can be computed by anyone who knows the input NSEC5 proof.
The NSEC5 hash determines the position of a domain name in an NSEC5 chain.
To sign a zone, the private NSEC5 key is used to compute the NSEC5 hashes for each name in the zone. These NSEC5 hashes are sorted in canonical order [RFC4034], and each consecutive pair forms an NSEC5 RR. Each NSEC5 RR is signed offline using the private zone-signing key. The resulting signed chain of NSEC5 RRs is provided to all authoritative servers for the zone, along with the private NSEC5 key.
To prove non-existence of a particular domain name in response to a query, the server uses the private NSEC5 key to compute the NSEC5 proof and NSEC5 hash corresponding to the queried name. The server then identifies the NSEC5 RR that covers the NSEC5 hash, and responds with this NSEC5 RR and its corresponding RRSIG signature RRset, as well as a synthesized NSEC5PROOF RR that contains the NSEC5 proof corresponding to the queried name.
To validate the response, the client verifies the following items:
- The client uses the public NSEC5 key, normally acquired from the NSEC5KEY RR, to verify that the NSEC5 proof in the NSEC5PROOF RR corresponds to the queried name.
- The client uses the VRF proof2hash function to compute the NSEC5 hash from the NSEC5 proof in the NSEC5PROOF RR. The client verifies that the NSEC5 hash is covered by the NSEC5 RR.
4. NSEC5 Algorithms
The algorithms used for NSEC5 authenticated denial are independent of the algorithms used for DNSSEC signing. An NSEC5 algorithm defines how the NSEC5 proof and the NSEC5 hash are computed and validated.
The NSEC5 proof corresponding to a name is computed using ECVRF_prove(), as specified in [I-D.irtf-cfrg-vrf]. The input to ECVRF_prove() is a public NSEC5 key followed by a private NSEC5 key followed by an RR owner name in [RFC4034] canonical wire format. The output NSEC5 proof is an octet string.
An NSEC5 hash corresponding to a name is computed from its NSEC5 proof using ECVRF_proof2hash(), as specified in [I-D.irtf-cfrg-vrf]. The input to VRF_proof2hash() is an NSEC5 proof as an octet string. The output NSEC5 hash is either an octet string, or INVALID.
An NSEC5 proof for a name is verified using ECVRF_verify(), as specified in [I-D.irtf-cfrg-vrf]. The input is the NSEC5 public key, followed by an NSEC5 proof as an octet string, followed by an RR owner name in [RFC4034] canonical wire format. The output is either VALID or INVALID.
This document defines the EC-P256-SHA256 NSEC5 algorithm as follows:
- The VRF is the ECVRF algorithm using the ECVRF-P256-SHA256 ciphersuite specified in [I-D.irtf-cfrg-vrf].
- The public key format to be used in the NSEC5KEY RR is defined in Section 4 of [RFC6605] and thus is the same as the format used to store ECDSA public keys in DNSKEY RRs.
[NOTE: This specification does not compress the elliptic curve point used for the public key, but we do compress curve points in every other place we use them. The NSEC5KEY record can be shrunk by 31 additional octets by encoding the public key with point compression.]
This document defines the EC-ED25519-SHA512 NSEC5 algorithm as follows:
- The VRF is the EC-VRF algorithm using the ECVRF-ED25519-SHA512 ciphersuite specified in [I-D.irtf-cfrg-vrf].
5. The NSEC5KEY Resource Record
The NSEC5KEY RR stores a public NSEC5 key. The key allows clients to validate an NSEC5 proof sent by a server.
5.1. NSEC5KEY RDATA Wire Format
The RDATA for the NSEC5KEY RR is as shown below:
```
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Algorithm | Public Key |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```
Algorithm is a single octet identifying the NSEC5 algorithm.
Public Key is a variable-sized field holding public key material for NSEC5 proof verification.
5.2. NSEC5KEY RDATA Presentation Format
The presentation format of the NSEC5KEY RDATA is as follows:
- The Algorithm field is represented as an unsigned decimal integer.
- The Public Key field is represented in Base64 encoding. Whitespace is allowed within the Base64 text.
6. The NSEC5 Resource Record
The NSEC5 RR provides authenticated denial of existence for an RRset or domain name. One NSEC5 RR represents one piece of an NSEC5 chain, proving existence of the owner name and non-existence of other domain names in the part of the hashed domain space that is covered until the next owner name hashed in the RDATA.
6.1. NSEC5 RDATA Wire Format
The RDATA for the NSEC5 RR is as shown below:
```
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Key Tag | Flags | Next Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Hashed Owner Name |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type Bit Maps |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```
The Key Tag field contains the key tag value of the NSEC5KEY RR that validates the NSEC5 RR, in network byte order. The value is computed from the NSEC5KEY RDATA using the same algorithm used to compute key tag values for DNSKEY RRs. This algorithm is defined in [RFC4034].
The Flags field is a single octet. The meaning of individual bits of the field is defined in Section 6.2.
The Next Length field is an unsigned single octet specifying the length of the Next Hashed Owner Name field in octets.
The Next Hashed Owner Name field is a sequence of binary octets. It contains an NSEC5 hash of the next domain name in the NSEC5 chain.
Type Bit Maps is a variable-sized field encoding RR types present at the original owner name matching the NSEC5 RR. The format of the field is equivalent to the format used in the NSEC3 RR, described in [RFC5155].
6.2. NSEC5 Flags Field
The following one-bit NSEC5 flags are defined:
```
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-
| |W|O|
+-+-+-+-+-+-+-+-+-
```
O - Opt-Out flag
W - Wildcard flag
All the other flags are reserved for future use and MUST be zero.
The Opt-Out flag has the same semantics as in NSEC3. The definition and considerations in [RFC5155] are valid, except that NSEC3 is replaced by NSEC5.
The Wildcard flag indicates that a wildcard synthesis is possible at the original domain name level (i.e., there is a wildcard node immediately descending from the immediate ancestor of the original domain name). The purpose of the Wildcard flag is to reduce the maximum number of RRs required for an authenticated denial of existence proof from (at most) three to (at most) two, as originally described in [I-D.gieben-nsec4] Section 7.2.1.
6.3. NSEC5 RDATA Presentation Format
The presentation format of the NSEC5 RDATA is as follows:
The Key Tag field is represented as an unsigned decimal integer.
The Flags field is represented as an unsigned decimal integer.
The Next Length field is not represented.
The Next Hashed Owner Name field is represented as a sequence of case-insensitive Base32hex digits without any whitespace and without padding.
The Type Bit Maps representation is equivalent to the representation used in NSEC3 RR, described in [RFC5155].
7. The NSEC5PROOF Resource Record
The NSEC5PROOF record is not to be included in the zone file. The NSEC5PROOF record contains the NSEC5 proof, proving the position of the owner name in an NSEC5 chain.
7.1. NSEC5PROOF RDATA Wire Format
The RDATA for the NSEC5PROOF RR is shown below:
```
1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Key Tag | Owner Name Hash |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```
Key Tag field contains the key tag value of the NSEC5KEY RR that validates the NSEC5PROOF RR, in network byte order.
Owner Name Hash is a variable-sized sequence of binary octets encoding the NSEC5 proof of the owner name of the RR.
7.2. NSEC5PROOF RDATA Presentation Format
The presentation format of the NSEC5PROOF RDATA is as follows:
The Key Tag field is represented as an unsigned decimal integer.
The Owner Name Hash is represented in Base64 encoding. Whitespace is allowed within the Base64 text.
8. Types of Authenticated Denial of Existence with NSEC5
This section summarizes all possible types of authenticated denial of existence. For each type the following lists are included:
1. Facts to prove: the minimum amount of information that an authoritative server must provide to a client to assure the client that the response content is valid.
2. Authoritative server proofs: the names for which the NSEC5PROOF RRs are synthesized and added into the response along with the NSEC5 RRs matching or covering each such name. These records together prove the listed facts.
3. Validator checks: the individual checks that a validating server is required to perform on a response. The response content is considered valid only if all of the checks pass.
If NSEC5 is said to match a domain name, the owner name of the NSEC5 RR has to be equivalent to an NSEC5 hash of that domain name. If an NSEC5 RR is said to cover a domain name, the NSEC5 hash of the domain name must sort in canonical order between that NSEC5 RR’s Owner Name and Next Hashed Owner Name.
8.1. Name Error Responses
Facts to prove:
Non-existence of the domain name that explicitly matches the QNAME.
Non-existence of the wildcard that matches the QNAME.
Authoritative server proofs:
NSEC5PROOF for closest encloser and matching NSEC5 RR.
NSEC5PROOF for next closer name and covering NSEC5 RR.
Validator checks:
Closest encloser is in the zone.
The NSEC5 RR matching the closest encloser has its Wildcard flag cleared.
The NSEC5 RR matching the closest encloser does not have NS without SOA in the Type Bit Map.
The NSEC5 RR matching the closest encloser does not have DNAME in the Type Bit Map.
Next closer name is not in the zone.
8.2. No Data Responses
The processing of a No Data response for DS QTYPE differs if the Opt-Out is in effect. For DS QTYPE queries, the validator has two possible checking paths. The correct path can be simply decided by inspecting if the NSEC5 RR in the response matches the QNAME.
Note that the Opt-Out is valid only for DS QTYPE queries.
8.2.1. No Data Response, Opt-Out Not In Effect
Facts to prove:
Existence of an RRset explicitly matching the QNAME.
Non-existence of QTYPE RRset matching the QNAME.
Non-existence of CNAME RRset matching the QNAME.
Authoritative server proofs:
NSEC5PROOF for the QNAME and matching NSEC5 RR.
Validator checks:
QNAME is in the zone.
NSEC5 RR matching the QNAME does not have QTYPE in Type Bit Map.
NSEC5 RR matching the QNAME does not have CNAME in Type Bit Map.
8.2.2. No Data Response, Opt-Out In Effect
Facts to prove:
The delegation is not covered by the NSEC5 chain.
Authoritative server proofs:
NSEC5PROOF for closest provable encloser and matching NSEC5 RR.
Validator checks:
Closest provable encloser is in zone.
Closest provable encloser covers (not matches) the QNAME.
NSEC5 RR matching the closest provable encloser has Opt-Out flag set.
8.3. Wildcard Responses
Facts to prove:
A signed positive response to the QNAME demonstrating the existence of the wildcard (label count in RRSIG is less than in QNAME), and also providing closest encloser name.
Non-existence of the domain name matching the QNAME.
Authoritative server proofs:
A signed positive response for the wildcard expansion of the QNAME.
NSEC5PROOF for next closer name and covering NSEC5 RR.
Validator checks:
Next closer name is not in the zone.
8.4. Wildcard No Data Responses
Facts to prove:
The existence of the wildcard at the closest encloser to the QNAME.
Non-existence of both the QTYPE and of the CNAME type that matches QNAME via wildcard expansion.
Authoritative server proofs:
NSEC5PROOF for source of synthesis (i.e., wildcard at closest encloser) and matching NSEC5 RR.
NSEC5PROOF for next closer name and covering NSEC5 RR.
Validator checks:
Closest encloser to the QNAME exists.
NSEC5 RR matching the wildcard label prepended to the closest encloser, and which does not have the bits corresponding to the QTYPE and CNAME types set in the type bitmap.
9. Authoritative Server Considerations
9.1. Zone Signing
Zones using NSEC5 MUST satisfy the same properties as described in Section 7.1 of [RFC5155], with NSEC3 replaced by NSEC5. In addition, the following conditions MUST be satisfied as well:
- If the original owner name has a wildcard label immediately descending from the original owner name, the corresponding NSEC5 RR MUST have the Wildcard flag set in the Flags field. Otherwise, the flag MUST be cleared.
- The zone apex MUST include an NSEC5KEY RRset containing a NSEC5 public key allowing verification of the current NSEC5 chain.
The following steps describe one possible method to properly add required NSEC5 related records into a zone. This is not the only such existing method.
1. Select an algorithm for NSEC5 and generate the public and private NSEC5 keys.
2. Add an NSEC5KEY RR into the zone apex containing the public NSEC5 key.
3. For each unique original domain name in the zone and each empty non-terminal, add an NSEC5 RR. If Opt-Out is used, owner names of unsigned delegations MAY be excluded.
A. The owner name of the NSEC5 RR is the NSEC5 hash of the original owner name encoded in Base32hex without padding, prepended as a single label to the zone name.
B. Set the Key Tag field to be the key tag corresponding to the public NSEC5 key.
C. Clear the Flags field. If Opt-Out is being used, set the Opt-Out flag. If there is a wildcard label directly descending from the original domain name, set the Wildcard flag. Note that the wildcard can be an empty non-terminal (i.e., the wildcard synthesis does not take effect and therefore the flag is not to be set).
D. Set the Next Length field to a value determined by the used NSEC5 algorithm. Leave the Next Hashed Owner Name field blank.
E. Set the Type Bit Maps field based on the RRsets present at the original owner name.
4. Sort the set of NSEC5 RRs into canonical order.
5. For each NSEC5 RR, set the Next Hashed Owner Name field by using the owner name of the next NSEC5 RR in the canonical order. If the updated NSEC5 is the last NSEC5 RR in the chain, the owner name of the first NSEC5 RR in the chain is used instead.
The NSEC5KEY and NSEC5 RRs MUST have the same class as the zone SOA RR. Also the NSEC5 RRs SHOULD have the same TTL value as the SOA minimum TTL field.
Notice that a use of Opt-Out is not indicated in the zone. This does not affect the ability of a server to prove insecure delegations. The Opt-Out MAY be part of the zone-signing tool configuration.
9.1.1. Precomputing Closest Provable Encloser Proofs
Per Section 8, the worst-case scenario when answering a negative query with NSEC5 requires the authoritative server to respond with two NSEC5PROOF RRs and two NSEC5 RRs. One pair of NSEC5PROOF and NSEC5 RRs corresponds to the closest provable encloser, and the other pair corresponds to the next closer name. The NSEC5PROOF corresponding to the next closer name MUST be computed on the fly by the authoritative server when responding to the query. However, the NSEC5PROOF corresponding to the closest provable encloser MAY be precomputed and stored as part of zone signing.
Precomputing NSEC5PROOF RRs can halve the number of online cryptographic computations required when responding to a negative query. NSEC5PROOF RRs MAY be precomputed as part of zone signing as follows: For each NSEC5 RR, compute an NSEC5PROOF RR corresponding to the original owner name of the NSEC5 RR. The content of the precomputed NSEC5PROOF record MUST be the same as if the record was computed on the fly when serving the zone. NSEC5PROOF records are not part of the zone and SHOULD be stored separately from the zone file.
9.2. Zone Serving
This specification modifies DNSSEC-enabled DNS responses generated by authoritative servers. In particular, it replaces use of NSEC or NSEC3 RRs in such responses with NSEC5 RRs and adds NSEC5PROOF RRs.
According to the type of a response, an authoritative server MUST include NSEC5 RRs in the response, as defined in Section 8. For each NSEC5 RR in the response, a corresponding RRSIG RRset and an NSEC5PROOF MUST be added as well. The NSEC5PROOF RR has its owner name set to the domain name required according to the description in Section 8. The class and TTL of the NSEC5PROOF RR MUST be the same as the class and TTL value of the corresponding NSEC5 RR. The RDATA payload of the NSEC5PROOF is set according to the description in Section 7.1.
Notice that the NSEC5PROOF owner name can be a wildcard (e.g., source of synthesis proof in wildcard No Data responses). The name also always matches the domain name required for the proof while the NSEC5 RR may only cover (not match) the name in the proof (e.g., closest encloser in Name Error responses).
If NSEC5 is used, an answering server MUST use exactly one NSEC5 chain for one signed zone.
NSEC5 MUST NOT be used in parallel with NSEC, NSEC3, or any other authenticated denial of existence mechanism that allows for enumeration of zone contents, as this would defeat a principal security goal of NSEC5.
Similarly to NSEC3, the owner names of NSEC5 RRs are not represented in the NSEC5 chain and therefore NSEC5 records deny their own existence. The desired behavior caused by this paradox is the same as described in Section 7.2.8 of [RFC5155].
9.3. NSEC5KEY Rollover Mechanism
Replacement of the NSEC5 key implies generating a new NSEC5 chain. The NSEC5KEY rollover mechanism is similar to "Pre-Publish Zone Signing Key Rollover" as specified in [RFC6781]. The NSEC5KEY rollover MUST be performed as a sequence of the following steps:
1. A new public NSEC5 key is added into the NSEC5KEY RRset in the zone apex.
2. The old NSEC5 chain is replaced by a new NSEC5 chain constructed using the new key. This replacement MUST happen as a single atomic operation; the server MUST NOT be responding with RRs from both the new and old chain at the same time.
3. The old public key is removed from the NSEC5KEY RRset in the zone apex.
The minimum delay between steps 1 and 2 MUST be the time it takes for the data to propagate to the authoritative servers, plus the TTL value of the old NSEC5KEY RRset.
The minimum delay between steps 2 and 3 MUST be the time it takes for the data to propagate to the authoritative servers, plus the maximum zone TTL value of any of the data in the previous version of the zone.
9.4. Secondary Servers
This document does not define mechanism to distribute private NSEC5 keys. See Section 15.2 for security considerations for private NSEC5 keys.
9.5. Zones Using Unknown NSEC5 Algorithms
Zones that are signed with an unknown NSEC5 algorithm or with an unavailable private NSEC5 key cannot be effectively served. Such zones SHOULD be rejected when loading and servers SHOULD respond with RCODE=2 (Server failure) when handling queries that would fall under such zones.
9.6. Dynamic Updates
A zone signed using NSEC5 MAY accept dynamic updates [RFC2136]. The changes to the zone MUST be performed in a way that ensures that the zone satisfies the properties specified in Section 9.1 at any time. The process described in [RFC5155] Section 7.5 describes how to
handle the issues surrounding the handling of empty non-terminals as well as Opt-Out.
It is RECOMMENDED that the server rejects all updates containing changes to the NSEC5 chain and its related RRSIG RRs, and performs itself any required alternations of the NSEC5 chain induced by the update. Alternatively, the server MUST verify that all the properties are satisfied prior to performing the update atomically.
10. Resolver Considerations
The same considerations as described in Section 9 of [RFC5155] for NSEC3 apply to NSEC5. In addition, as NSEC5 RRs can be validated only with appropriate NSEC5PROOF RRs, the NSEC5PROOF RRs MUST be all together cached and included in responses with NSEC5 RRs.
11. Validator Considerations
11.1. Validating Responses
The validator MUST ignore NSEC5 RRs with Flags field values other than the ones defined in Section 6.2.
The validator MAY treat responses as bogus if the response contains NSEC5 RRs that refer to a different NSEC5KEY.
According to a type of a response, the validator MUST verify all conditions defined in Section 8. Prior to making decision based on the content of NSEC5 RRs in a response, the NSEC5 RRs MUST be validated.
To validate a denial of existence, public NSEC5 keys for the zone are required in addition to DNSSEC public keys. Similarly to DNSKEY RRs, the NSEC5KEY RRs are present at the zone apex.
The NSEC5 RR is validated as follows:
1. Select a correct public NSEC5 key to validate the NSEC5 proof. The Key Tag value of the NSEC5PROOF RR must match with the key tag value computed from the NSEC5KEY RDATA.
2. Validate the NSEC5 proof present in the NSEC5PROOF Owner Name Hash field using the public NSEC5 key. If there are multiple NSEC5KEY RRs matching the key tag, at least one of the keys must validate the NSEC5 proof.
3. Compute the NSEC5 hash value from the NSEC5 proof and check if the response contains NSEC5 RR matching or covering the computed...
NSEC5 hash. The TTL values of the NSEC5 and NSEC5PROOF RRs must be the same.
4. Validate the signature on the NSEC5 RR.
If the NSEC5 RR fails to validate, it MUST be ignored. If some of the conditions required for an NSEC5 proof are not satisfied, the response MUST be treated as bogus.
Notice that determining the closest encloser and next closer name in NSEC5 is easier than in NSEC3. NSEC5 and NSEC5PROOF RRs are always present in pairs in responses and the original owner name of the NSEC5 RR matches the owner name of the NSEC5PROOF RR.
11.2. Validating Referrals to Unsigned Subzones
The same considerations as defined in Section 8.9 of [RFC5155] for NSEC3 apply to NSEC5.
11.3. Responses With Unknown NSEC5 Algorithms
A validator MUST ignore NSEC5KEY RRs with unknown NSEC5 algorithms. The practical result of this is that zones signed with unknown algorithms will be considered bogus.
12. Special Considerations
12.1. Transition Mechanism
[TODO: The following information will be covered.]
- Transition to NSEC5 from NSEC/NSEC3
- Transition from NSEC5 to NSEC/NSEC3
- Transition to new NSEC5 algorithms
12.2. Private NSEC5 keys
This document does not define a format to store private NSEC5 keys. Use of a standardized and adopted format is RECOMMENDED.
The private NSEC5 key MAY be shared between multiple zones, however a separate key is RECOMMENDED for each zone.
12.3. Domain Name Length Restrictions
NSEC5 creates additional restrictions on domain name lengths. In particular, zones with names that, when converted into hashed owner names, exceed the 255 octet length limit imposed by [RFC1035] cannot use this specification.
The actual maximum length of a domain name depends on the length of the zone name and the NSEC5 algorithm used.
All NSEC5 algorithms defined in this document use 256-bit NSEC5 hash values. Such a value can be encoded in 52 characters in Base32hex without padding. When constructing the NSEC5 RR owner name, the encoded hash is prepended to the name of the zone as a single label which includes the length field of a single octet. The maximum length of the zone name in wire format using the 256-bit hash is therefore 202 octets (255 - 53).
13. Implementation Status
NSEC5 has been implemented for the Knot DNS authoritative server (version 1.6.4) and the Unbound recursive server (version 1.5.9). The implementations did not introduce additional library dependencies; all cryptographic primitives are already present in OpenSSL v1.0.2j, which is used by both implementations. The implementations support the full spectrum of negative responses, (i.e., NXDOMAIN, NODATA, Wildcard, Wildcard NODATA, and unsigned delegation) using the EC-P256-SHA256 algorithm. The code is deliberately modular, so that the EC-ED25519-SHA256 algorithm could be implemented by using the Ed25519 elliptic curve [RFC8080] as a drop-in replacement for the P256 elliptic curve. The authoritative server implements the optimization from Section 9.1.1 to precompute the NSEC5PROOF RRs matching each NSEC5 record.
14. Performance Considerations
The performance of NSEC5 has been evaluated in [nsec5ecc].
15. Security Considerations
15.1. Zone Enumeration Attacks
NSEC5 is robust to zone enumeration via offline dictionary attacks by any attacker that does not know the private NSEC5 key. Without the private NSEC5 key, that attacker cannot compute the NSEC5 proof that corresponds to a given domain name. The only way it can learn the NSEC5 proof value for a domain name is by querying the authoritative server for that name. Without the NSEC5 proof value, the attacker
cannot learn the NSEC5 hash value. Thus, even an attacker that
collects the entire chain of NSEC5 RR for a zone cannot use offline
attacks to "reverse" that NSEC5 hash values in these NSEC5 RR and
thus learn which names are present in the zone. A formal
cryptographic proof of this property is in \[\text{nsec5}\] and \[\text{nsec5ecc}\].
15.2. Compromise of the Private NSEC5 Key
NSEC5 requires authoritative servers to hold the private NSEC5 key,
but not the private zone-signing keys or the private key-signing keys
for the zone.
The private NSEC5 key cannot be used to modify zone contents, because
zone contents are signed using the private zone-signing key. As
such, a compromise of the private NSEC5 key does not compromise the
integrity of the zone. An adversary that learns the private NSEC5
key can, however, perform offline zone-enumeration attacks. For this
reason, the private NSEC5 key need only be as secure as the DNSSEC
records whose privacy (against zone enumeration) is being protected
by NSEC5. A formal cryptographic proof of this property is in
\[\text{nsec5}\] and \[\text{nsec5ecc}\].
To preserve this property of NSEC5, the private NSEC5 key MUST be
different from the private zone-signing keys or key-signing keys for
the zone.
15.3. Key Length Considerations
The NSEC5 key must be long enough to withstand attacks for as long as
the privacy of the zone contents is important. Even if the NSEC5 key
is rolled frequently, its length cannot be too short, because zone
privacy may be important for a period of time longer than the
lifetime of the key. For example, an attacker might collect the
entire chain of NSEC5 RR for the zone over one short period, and
then, later (even after the NSEC5 key expires) perform an offline
dictionary attack that attempts to reverse the NSEC5 hash values
present in the NSEC5 RRs. This is in contrast to zone-signing and
key-signing keys used in DNSSEC; these keys, which ensure the
authenticity and integrity of the zone contents, need to remain
secure only during their lifetime.
15.4. NSEC5 Hash Collisions
If the NSEC5 hash of a QNAME collides with the NSEC5 hash of the
owner name of an NSEC5 RR, it will be impossible to prove the non-
existence of the colliding QNAME. However, the NSEC5 VRFs ensure
that obtaining such a collision is as difficult as obtaining a
collision in the SHA-256 hash function, requiring approximately \(2^{128}\)
effort. Note that DNSSEC already relies on the assumption that a cryptographic hash function is collision-resistant, since these hash functions are used for generating and validating signatures and DS RRs. See also the discussion on key lengths in [nsec5].
16. IANA Considerations
This document updates the IANA registry "Domain Name System (DNS) Parameters" in subregistry "Resource Record (RR) TYPEs", by defining the following new RR types:
- NSEC5KEY value TBD.
- NSEC5 value TBD.
- NSEC5PROOF value TBD.
This document creates a new IANA registry for NSEC5 algorithms. This registry is named "DNSSEC NSEC5 Algorithms". The initial content of the registry is:
- 0 is Reserved.
- 1 is EC-P256-SHA256.
- 2 is EC-ED25519-SHA256.
- 3-255 is Available for assignment.
This document updates the IANA registry "DNS Security Algorithm Numbers" by defining following aliases:
- TBD is NSEC5-ECDSAP256SHA256 alias for ECDSAP256SHA256 (13).
- TBD is NSEC5-ED25519, alias for ED25519 (15).
17. Contributors
This document would not be possible without help of Moni Naor (Weizmann Institute), Sachin Vasant (Cisco Systems), Leonid Reyzin (Boston University), and Asaf Ziv (Weizmann Institute) who contributed to the design of NSEC5. Ondrej Sury (CZ.NIC Labs), and Duane Wessels (Verisign Labs) provided advice on the implementation of NSEC5, and assisted with evaluating its performance.
18. References
18.1. Normative References
18.2. Informative References
[I-D.gieben-nsec4]
[ldns-walk]
Vcelak, et al. Expires July 2, 2019
Appendix A. Examples
We use a small DNS zone to illustrate how negative responses are handled with NSEC5. For brevity, the class is not shown (defaults to IN) and the SOA record is shortened, resulting in the following zone file:
```
example.org. SOA ( ... )
example.org. NS a.example.org
a.example.org. A 192.0.2.1
```
```
c.example.org. A 192.0.2.2
c.example.org. TXT "c record"
d.example.org. NS ns1.d.example.org
```
```
nsl.d.example.org. A 192.0.2.4
g.example.org. A 192.0.2.1
g.example.org. TXT "g record"
```
```
*.a.example.org. TXT "wildcard record"
```
Notice the delegation to an unsigned zone d.example.org served by nsl.d.example.org. (Note: if the d.example.org zone was signed, then the example.org zone have a DS record for d.example.org.)
Next we present example responses. All cryptographic values are shortened as indicated by "..." and ADDITIONAL sections have been removed.
A.1. Name Error Example
Consider a query for a type A record for a.b.c.example.org.
The server must prove the following facts:
- Existence of closest encloser c.example.org.
- Non-existence of wildcard at closest encloser *.c.example.org.
- Non-existence of next closer b.c.example.org.
To do this, the server returns:
This is an NSEC5PROOF RR for c.example.com. It’s RDATA is the NSEC5 proof corresponding to c.example.com. (NSEC5 proofs are randomized values, because NSEC5 proof values are computed uses the EC-VRF from [I-D.irtf-cfrg-vrf].) Per Section 9.1.1, this NSEC5PROOF RR may be precomputed.
c.example.org. 86400 IN NSEC5PROOF 48566 Amgn22zU1Z9JVyaT...
This is a signed NSEC5 RR "matching" c.example.org, which proves the existence of closest encloser c.example.org. The NSEC5 RR has its owner name equal to the NSEC5 hash of c.example.org, which is O4K89V. (NSEC5 hash values are deterministic given the public NSEC5 key.) The NSEC5 RR also has its Wildcard flag cleared (see the "0" after the key ID 48566). This proves the non-existence of the wildcard at the closest encloser *.c.example.com. NSEC5 RRs are precomputed.
o4k89v.example.org. 86400 IN NSEC5 48566 0049PI A TXT RRSIG
o4k89v.example.org. 86400 IN RRSIG NSEC5 16 3 86400
20170412024301 20170313024301 5137 example.org. zDNTSMQNlz...
This is an NSEC5PROOF RR for b.c.example.org. It’s RDATA is the NSEC5 proof corresponding to b.c.example.com. This NSEC5PROOF RR must be computed on the fly.
b.c.example.org. 86400 IN NSEC5PROOF 48566 AuvvJqbUcEs8sCpY...
This is a signed NSEC5 RR "covering" b.c.example.org, which proves the non-existence of the next closer name b.c.example.org. The NSEC5 hash of b.c.example.org, which is A05OF, sorts in canonical order between the "covering" NSEC5 RR’s Owner Name (which is 0049PI) and Next Hashed Owner Name (which is BAPROH).
A.2. No Data Example
Consider a query for a type MX record for c.example.org.
The server must prove the following facts:
- Existence of c.example.org. for any type other than MX or CNAME
To do this, the server returns:
;; ->>>HEADER<<- opcode: QUERY; status: NOERROR; id: 38781
;; QUESTION SECTION:
;; c.example.org. IN MX
;; AUTHORITY SECTION:
example.org. 3600 IN SOA a.example.org. hostmaster.example.org. (2010111214 21600 3600 604800 86400 )
example.org. 3600 IN RRSIG SOA 16 2 3600 20170412024301 20170313024301 5137 example.org. /rT231b1rH/p
This is an NSEC5RR RR for c.example.com. Its RDATA corresponds to the NSEC5 proof for c.example.com. which is a randomized value. Per Section 9.1.1, this NSEC5RR RR may be precomputed.
c.example.org. 86400 IN NSEC5PROOF 48566 Amsgn22zUiZ9YyaT
This is a signed NSEC5 RR "matching" c.example.org. with CNAME and MX Type Bits cleared and its TXT Type Bit set. This NSEC5 RR has its owner name equal to the NSEC5 hash of c.example.org. This proves the existence of c.example.org. for a type other than MX and CNAME. NSEC5 RR are precomputed.
Todo: Add discussion of CNAME and DNAME to the example?
A.3. Delegation to an Unsigned Zone in an Opt-Out span Example
Consider a query for a type A record for foo.d.example.org.
Here, d.example.org is a delegation to an unsigned zone, which lies within an Opt-Out span.
The server must prove the following facts:
- Non-existence of signature on next closer name d.example.org.
- Opt-out bit is set in NSEC5 record covering next closer name d.example.org.
- Existence of closest provable encloser example.org
To do this, the server returns:
```
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 45866
;; QUESTION SECTION:
;; foo.d.example.org. IN A
;; AUTHORITY SECTION:
d.example.org. 3600 IN NS ns1.d.example.org.
```
This is an NSEC5PROOF RR for d.example.org. Its RDATA is the NSEC5 proof corresponding to d.example.org. This NSEC5PROOF RR is computed on the fly.
```
d.example.org. 86400 IN NSEC5PROOF 48566 A9FpmeH79q7g6VNW
```
This is a signed NSEC5 RR "covering" d.example.org with its Opt-out bit set (see the "1" after the key ID 48566). The NSEC5 hash of d.example.org (which is BLE8LR) sorts in canonical order between the "covering" NSEC5 RR’s Owner Name (BAPROH) and Next Hashed Owner Name (JQBMG4). This proves that no signed RR exists for d.example.org, but that the zone might contain a unsigned RR for a name whose NSEC5 hash sorts in canonical order between BAPROH and JQBMG4.
```
baploh.example.org. 86400 IN NSEC5 48566 1 JQBMG4 A TXT RRSIG
```
```
baploh.example.org. 86400 IN RRSIG NSEC5 16 3 86400 (20170412024301 20170313024301 5137 example.org. fjTcoRKgdML1)
```
This is an NSEC5PROOF RR for example.com. It’s RDATA is the NSEC5 proof corresponding to example.com. Per Section 9.1.1, this NSEC5PROOF RR may be precomputed.
example.org. 86400 IN NSEC5PROOF 48566 AjwsPCJZ8zH/D0Tr
This is a signed NSEC5 RR "matching" example.org which proves the existence of a signed RRs for example.org. This NSEC5 RR has its owner name equal to the NSEC5 hash of example.org which is 0O49PI. NSEC5 RR are precomputed.
0o49pi.example.org. 86400 IN NSEC5 48566 0 BAPROH (NS SOA RRSIG DNSKEY NSEC5KEY)
0o49pi.example.org. 86400 IN RRSIG NSEC5 16 3 86400 (20170412034216 20170313034216 5137 example.org. 4HT1uj1YlMzO)
A.4. Wildcard Example
Consider a query for a type TXT record for foo.a.example.org.
The server must prove the following facts:
- Existence of the TXT record for the wildcard *.a.example.org
- Non-existence of the next closer name foo.a.example.org.
To do this, the server returns:
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 53731
;; QUESTION SECTION:
foo.a.example.org. IN TXT
This is a signed TXT record for the wildcard at a.example.org (number of labels is set to 3 in the RRSIG record).
;; ANSWER SECTION:
foo.a.example.org. 3600 IN TXT "wildcard record"
foo.a.example.org. 3600 IN RRSIG TXT 16 3 3600 (20170412024301 20170313024301 5137 example.org. aeaLh2x5WyF)
;; AUTHORITY SECTION:
example.org. 3600 IN NS a.example.org.
example.org. 3600 IN RRSIG NS 16 2 3600 (20170412024301 20170313024301 5137 example.org. 8zuN0h2x5WyF)
This is an NSEC5PROOF RR for foo.a.example.org. This NSEC5PROOF RR must be computed on-the-fly.
This is a signed NSEC5 RR "covering" foo.a.example.org. The NSEC5 hash of foo.a.example.org is FORDMO and sorts in canonical order between the NSEC5 RR’s Owner Name (which is BAPROH) and Next Hashed Owner Name (which is JQBMG4). This proves the non-existence of the next closer name foo.a.example.com. NSEC5 RRs are precomputed.
baproh.example.org. 86400 IN NSEC5 48566 1 JQBMG4 A TXT RRSIG
baproh.example.org. 86400 IN RRSIG NSEC5 16 3 86400 ( 20170412024301 20170313024301 5137 example.org. fjTcoRKgdML1
A.5. Wildcard No Data Example
Consider a query for a type MX record for foo.a.example.org.
The server must prove the following facts:
- Existence of wildcard at closest encloser *.a.example.org. for any type other than MX or CNAME.
- Non-existence of the next closer name foo.a.example.org.
To do this, the server returns:
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 17332
;; QUESTION SECTION:
;; foo.a.example.org. IN MX
;; AUTHORITY SECTION:
example.org. 3600 IN SOA a.example.org. hostmaster.example.org. ( 2010111214 21600 3600 604800 86400 )
This is an NSEC5PROOF RR for *.a.example.com, with RDATA equal to the NSEC5 proof for *.a.example.com. Per Section 9.1.1, this NSEC5PROOF RR may be precomputed.
*.a.example.org. 86400 IN NSEC5PROOF 48566 Aq38RWPhbs/vtih
This is a signed NSEC5 RR "matching" *.a.example.org with its CNAME and MX Type Bits cleared and its TXT Type Bit set. This NSEC5 RR has its owner name equal to the NSEC5 hash of *.a.example.org. NSEC5 RRs are precomputed.
mpu6c4.example.org. 86400 IN NSEC5 48566 0 O4K89V TXT RRSIG
mpu6c4.example.org. 86400 IN RRSIG NSEC5 16 3 86400 ( 20170412024301 20170313024301 5137 example.org. m3I75ttcWwVC )
This is an NSEC5PROOF RR for foo.a.example.com. This NSEC5PROOF RR must be computed on-the-fly.
foo.a.example.org. 86400 IN NSEC5PROOF 48566 AjqF5FggVso40Lda
This is a signed NSEC5 RR "covering" foo.a.example.org. The NSEC5 hash of foo.a.example.org is FORDMO, and sorts in canonical order between this covering NSEC5 RR’s Owner Name (which is BAPROH) and Next Hashed Owner Name (which is JQBMG4). This proves the existence of the wildcard at closest encloser *.a.example.org. for any type other than MX or CNAME. NSEC5 RRs are precomputed.
baproh.example.org. 86400 IN NSEC5 48566 1 JQBMG4 A TXT RRSIG
baproh.example.org. 86400 IN RRSIG NSEC5 16 3 86400 ( 20170412024301 20170313024301 5137 example.org. fjTcoRKgdML1 )
Appendix B. Change Log
Note to RFC Editor: if this document does not obsolete an existing RFC, please remove this appendix before publication as an RFC.
pre 00 - initial version of the document submitted to mailing list only
00 - fix NSEC5KEY rollover mechanism, clarify NSEC5PROOF RDATA, clarify inputs and outputs for NSEC5 proof and NSEC5 hash computation.
01 - Add Performance Considerations section.
02 - Add elliptic curve based VRF. Add measurement of response sizes based on empirical data.
03 - Mention precomputed NSEC5PROOF Values in Performance Considerations section.
05 - Remove appendix specifying VRFs and add reference to draft-goldebe-vrf. Add Appendix A.
06 - Editorial changes. Minor updates to Section 8.1.
07 - Updated reference to [I-D.irtf-cfrg-vrf], updated VRF ciphersuites.
Authors’ Addresses
Jan Vcelák
CZ.NIC
Milesovska 1136/5
Praha 130 00
CZ
EMail: jan.vcelak@nic.cz
Sharon Goldberg
Boston University
111 Cummington St, MCS135
Boston, MA 02215
USA
EMail: goldbe@cs.bu.edu
Dimitrios Papadopoulos
HKUST
Clearwater Bay
Hong Kong
EMail: dipapado@ust.hk
Shumon Huque
Salesforce
2550 Wasser Terr
Herndon, VA 20171
USA
EMail: shuque@gmail.com
|
{"Source-Url": "https://tools.ietf.org/pdf/draft-vcelak-nsec5-08.pdf", "len_cl100k_base": 13280, "olmocr-version": "0.1.53", "pdf-total-pages": 35, "total-fallback-pages": 0, "total-input-tokens": 71100, "total-output-tokens": 17138, "length": "2e13", "weborganizer": {"__label__adult": 0.00048160552978515625, "__label__art_design": 0.00047707557678222656, "__label__crime_law": 0.0032787322998046875, "__label__education_jobs": 0.0013875961303710938, "__label__entertainment": 0.0001995563507080078, "__label__fashion_beauty": 0.0002791881561279297, "__label__finance_business": 0.00174713134765625, "__label__food_dining": 0.000339508056640625, "__label__games": 0.0013427734375, "__label__hardware": 0.0022106170654296875, "__label__health": 0.00054931640625, "__label__history": 0.0007429122924804688, "__label__home_hobbies": 0.00012421607971191406, "__label__industrial": 0.0008401870727539062, "__label__literature": 0.0006651878356933594, "__label__politics": 0.0011243820190429688, "__label__religion": 0.0006694793701171875, "__label__science_tech": 0.445068359375, "__label__social_life": 0.00017499923706054688, "__label__software": 0.09039306640625, "__label__software_dev": 0.44677734375, "__label__sports_fitness": 0.00034236907958984375, "__label__transportation": 0.0005860328674316406, "__label__travel": 0.0002465248107910156}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 54788, 0.05414]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 54788, 0.30533]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 54788, 0.81582]], "google_gemma-3-12b-it_contains_pii": [[0, 1436, false], [1436, 3845, null], [3845, 4080, null], [4080, 6605, null], [6605, 8364, null], [8364, 10221, null], [10221, 12465, null], [12465, 14348, null], [14348, 15644, null], [15644, 17276, null], [17276, 19094, null], [19094, 20802, null], [20802, 22018, null], [22018, 23012, null], [23012, 24600, null], [24600, 26670, null], [26670, 28826, null], [28826, 30677, null], [30677, 32616, null], [32616, 34004, null], [34004, 36220, null], [36220, 38633, null], [38633, 40019, null], [40019, 41839, null], [41839, 42123, null], [42123, 43834, null], [43834, 45107, null], [45107, 46638, null], [46638, 47793, null], [47793, 49501, null], [49501, 50929, null], [50929, 52443, null], [52443, 54196, null], [54196, 54788, null], [54788, 54788, null]], "google_gemma-3-12b-it_is_public_document": [[0, 1436, true], [1436, 3845, null], [3845, 4080, null], [4080, 6605, null], [6605, 8364, null], [8364, 10221, null], [10221, 12465, null], [12465, 14348, null], [14348, 15644, null], [15644, 17276, null], [17276, 19094, null], [19094, 20802, null], [20802, 22018, null], [22018, 23012, null], [23012, 24600, null], [24600, 26670, null], [26670, 28826, null], [28826, 30677, null], [30677, 32616, null], [32616, 34004, null], [34004, 36220, null], [36220, 38633, null], [38633, 40019, null], [40019, 41839, null], [41839, 42123, null], [42123, 43834, null], [43834, 45107, null], [45107, 46638, null], [46638, 47793, null], [47793, 49501, null], [49501, 50929, null], [50929, 52443, null], [52443, 54196, null], [54196, 54788, null], [54788, 54788, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 54788, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 54788, null]], "pdf_page_numbers": [[0, 1436, 1], [1436, 3845, 2], [3845, 4080, 3], [4080, 6605, 4], [6605, 8364, 5], [8364, 10221, 6], [10221, 12465, 7], [12465, 14348, 8], [14348, 15644, 9], [15644, 17276, 10], [17276, 19094, 11], [19094, 20802, 12], [20802, 22018, 13], [22018, 23012, 14], [23012, 24600, 15], [24600, 26670, 16], [26670, 28826, 17], [28826, 30677, 18], [30677, 32616, 19], [32616, 34004, 20], [34004, 36220, 21], [36220, 38633, 22], [38633, 40019, 23], [40019, 41839, 24], [41839, 42123, 25], [42123, 43834, 26], [43834, 45107, 27], [45107, 46638, 28], [46638, 47793, 29], [47793, 49501, 30], [49501, 50929, 31], [50929, 52443, 32], [52443, 54196, 33], [54196, 54788, 34], [54788, 54788, 35]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 54788, 0.01068]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
d48efb68f81795ade4d1b1451abe6452d6ff12d1
|
SAT-based Unbounded Model Checking of Timed Automata
Wojciech Penczek Maciej Szreter
Institute of Computer Science, PAS
Ordona 21, 01-237 Warsaw, Poland
{penczek, mszreter}@ipipan.waw.pl
Abstract
We present an improvement of the SAT-based Unbounded Model Checking (UMC) algorithm. UMC, a symbolic approach introduced in [7], uses propositional formulas in conjunctive normal form (CNF) instead of binary decision diagrams (BDD). The key part of the method consists in elimination of universal quantifiers, where the assignments making a formula non-valid are blocked by blocking clauses. The algorithm suffers from an exponential number of such clauses. Our idea is to allow in blocking clauses literals corresponding not only to variables encoding states, but also to more general subformulas over these variables, thus describing sets of states. A hybrid algorithm is proposed for computing timed part of these clauses, based on the well-known Difference Bound Matrices. The optimization results in a considerable reduction in the size and the number of generated blocking clauses, thus improving the overall performance. This is shown on the standard benchmark of Fischer’s Mutual Exclusion protocol.
1 Introduction
Nowadays, model checking is becoming an acknowledged method supporting the design of complex systems, with many successful applications around. However, the combinatorial explosion is one of its major problems. Since the limitations of the algorithms representing state spaces explicitly are well known, the search for new techniques is mostly focused on symbolic methods, working with sets of states rather than with separate states only.
The advances in this area are closely related to the theory and practical methods for propositional logic. The problem of checking satisfiability for propositional formulas (SAT) is known to be NP-complete. However, in the last decade many very efficient algorithms testing satisfiability have been designed. Several verification problems can be translated to checking satisfiability of propositional formulas. Bounded Model Checking (BMC) seems to be the state-of-the-art SAT-based model checking method. This field has seen a rapid development recently [10]. Some types of errors can be easily found in surprisingly large systems. Despite of these undoubtful advantages, BMC has a few weak points. It is still rather a method of falsification than validation. Moreover, BMC is restricted to the universal or the existential fragment of a specification logic. Given these facts, one can ask whether SAT could be used in model checking in a different way. The verification based on Binary Decision Diagrams (BDD) [6] is an obvious analogue. BDD-based model checking constitutes a well developed branch of symbolic methods in automated verification. Unbounded Model Checking (UMC) [7] emerged as a SAT-based counterpart of BDD in 2002. However, the method has not achieved a wide popularity since then, and although some extensions were reported [5], it seems that the performance of the algorithm is still inferior to other symbolic approaches based on BDDs. In the conclusions of [7], two major problems are stated:
- although CNF formulas are used in the scope of a single fixpoint iteration, the formulas encoding the whole state space are represented by semi-canonical Directed Acyclic Graphs. This representation can be much less concise than BDD, because it often distinguishes between equivalent but syntactically different formulas,
- blocking clauses are built over the set of state variables only. This level is too detailed and it often leads to generating exponentially many clauses.
In this paper we propose a solution to the second problem. In [7], it is stated: “If a solution can be found to this problem, a dramatic improvement in performance might result”.
Our modification consists in generating blocking clauses over an extended set of variables, including the variables encoding subformulas over propositions.
1.1 Related Work
As we have already mentioned the idea of UMC was introduced in [7] and extended into epistemic logics and
2 Quantified Propositional Logic
In this section we introduce the preliminary notions concerning Propositional Logic, a conversion of propositional formulas to CNF, and an elimination of universal quantifiers from quantified propositional formulas.
Let \( PV \) be a finite set of (propositional) variables. The formulas of Propositional Logic are built from variables of \( PV \) in the standard way using boolean operators: \( \land \) - conjunction, \( \lor \) - disjunction, \( \neg \) - negation, and \( \Rightarrow \) - implication. Let \( \mathcal{F} \) denote a set of all the propositional formulas. For each propositional formula \( \alpha \) a set of its subformulas \( \text{Subform}(\alpha) \) is defined in the usual way. A literal \( l \) is a variable of \( PV \), or its negation. A clause \( c \) is a disjunction of zero or more literals \( l_1 \lor \cdots \lor l_m \). By \( \mathcal{C} \) we denote a set of the clauses. A formula is in conjunctive normal form (CNF) if it is a conjunction of zero or more clauses \( c_1 \land \cdots \land c_k \).
An assignment \( A \) is a partial function \( A: PV \rightarrow \{0, 1\} \), where 1 stands for \( \text{true} \) and 0 stands for \( \text{false} \). An assignment is said to be \textit{total} when its domain equals to \( PV \). A total assignment is said to be \textit{satisfying} for a formula \( \alpha \) when the value of \( \alpha \) for the assignment \( A \) under the usual interpretation of the Boolean connectives is 1, denoted by \( A(\alpha) = 1 \). We will equate an assignment \( A \) with a conjunction of a set of literals, specifically the set containing \( \neg p \) for all \( p \in \text{dom}(A) \) such that \( A(p) = \text{false} \) and \( p \) for all \( p \in \text{dom}(A) \) such that \( A(p) = 1 \).
Following [1], we represent propositional formulas by directed acyclic graphs (DAGs), with the graph \( \text{DAG}(\alpha) \) representing a formula \( \alpha \). Contrary to semantic representations like BDD, our representation encodes explicitly the syntax instead of the truth table of a propositional formula.
In this paper we make an extensive use of efficient SAT-solvers, i.e., algorithms checking satisfiability of propositional formulas. Let \( \text{SAT}(\cdot) \) refer to a generic SAT-solver, which given a formula either returns its satisfying assignment or diagnoses that no such assignment exists.
2.1 Conversion to CNF
Most of the SAT-solvers accept formulas in CNF, what is motivated mostly by efficient data structures and operations exploiting CNF. For \( \alpha \in \mathcal{F} \), let \( PV(\alpha) \subseteq PV \) denote the set of variables used in \( \alpha \) and \( PV^C(\alpha) = \{l_\beta \in PV \mid \beta \in \text{Subform}(\alpha)\} \) denote a set of the literals corresponding to the subformulas of \( \alpha \).
The standard translation of propositional formulas to CNF is called \( \text{toCNF}(\cdot) \) [9]. For each formula \( \alpha \), \( \text{toCNF}(\alpha) \) returns the formula in CNF defined over variables of \( PV^C(\alpha) \). Every subformula \( \beta \) of \( \alpha \) is represented by the literal \( l_\beta \in PV^C(\alpha) \), and for every assignment \( A \) such that \( A(\text{toCNF}(\alpha)) = 1 \), we have \( A(l_\beta) = A(\beta) \). Consequently, the CNF formula \( \text{toCNF}(\alpha) \lor l_0 \) is satisfiable iff \( \alpha \) is satisfiable. This fact is commonly exploited for testing satisfiability. Moreover, the formula \( \alpha \) is valid when the CNF formula \( \beta = \text{toCNF}(\alpha) \land l_\alpha \) is unsatisfiable, which is used for translating \( \alpha \) to an equivalent CNF formula. More details can be found in [9].
2.2 Elimination of universal quantifiers
Quantified Boolean Formulas (QBF, for short) constitute a fragment of the first-order logic extending propositional logic with quantifiers ranging over propositions. The syntax of QBF is defined in BNF as follows:
\[
\alpha := p \mid \neg \alpha \mid \alpha \land \alpha \mid \exists p.\alpha \mid \forall p.\alpha.
\]
The semantics of the quantifiers is as follows: \( \exists p.\alpha \equiv \alpha(p \leftarrow \text{true}) \lor \alpha(p \leftarrow \text{false}) \) and \( \forall p.\alpha \equiv \alpha(p \leftarrow \text{true}) \land \alpha(p \leftarrow \text{false}) \). According to this semantics, we use the notation \( \forall p.\alpha \) to denote \( \forall v[1], \forall v[2], \ldots, \forall v[m].\alpha \), and for a set of variables \( U \subseteq PV \), by \( \forall U.\alpha \) we mean the universal quantification of \( \alpha \) over all the elements of \( U \).
The algorithm \( \text{SAT}(\cdot) \) can be used for removing universal quantifiers [7] from a QBF formula. This is applied in order to compute a propositional formula in CNF equivalent to \( \forall U.\alpha \). In Fig. 1 a pseudo-code of the algorithm \( \text{forall}(\cdot) \) is shown; \( \text{forall}(\alpha, U) \) returns a propositional formula equivalent to \( \forall U.\alpha \). The algorithm exploits the fact that each clause in a CNF formula equivalent to the input formula must be satisfied for any assignment of the quantified variables. Moreover, the satisfying assignments for \( \beta \), i.e., those which falsify \( \alpha \), are excluded by means of blocking clauses. These clauses produce the resulting CNF formula \( \chi \). The algorithm works on-the-fly removing quantified variables as soon as a new blocking clause is generated.
**Definition 1 (Blocking assignment, blocking clause)**
Consider the algorithm \( \text{forall}(\cdot) \) (Alg. 1). A satisfying assignment \( A_\alpha \) for \( \beta \), found by the algorithm, is called a blocking assignment. A blocking clause \( c_b \) for \( A_\alpha \) is a clause over the set of variables \( PV(\alpha) \) satisfying the following two properties: (i) \( A_\alpha(c_b) = 0 \), and (ii) \( \alpha \Rightarrow c_b \).
Algorithm 1 procedure forall(α, U)
1: χ = ∅, β = toCNF(F(α)) ∨ l_α
2: while A_α = SAT(β) ≠ ∅ do
3: compute the blocking clause cb
4: for each p ∈ U, remove literals p and ¬p from cb
5: χ = χ ∧ cb, β = β ∧ cb
6: return χ
Theorem 2.1 [7] In Algorithm 1, when the formula β becomes unsatisfiable (the condition in line 2 is false), χ is a propositional formula in CNF equivalent to ∀U.ϕ.
2.3 Quantifier elimination under ∪
It is typical in the symbolic model checking that some operations are considered under a restriction, i.e., a propositional formula β describing a restriction is given and the valuations satisfying the resulting formula should also satisfy β. In the case of elimination of universal quantifiers we would like to evaluate (∀U.α) ∪ β. This can be introduced into the algorithm forall() by substituting CNF(F(α)) with CNF(α) ∧ CNF(β) ∧ l_β in line 1. Thanks to that, the algorithm will consider only assignments that make α false but β true. The assignments making both α and β false will not be obtained at all, reducing the computational cost.
In the case of UMC, the restriction is used to simplify the fixpoint computations, what is explained later.
3 Timed automata and model checking
In this section we define timed automata, their discretizations, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
In timed automata, the flow of time is modeled by means of clocks. From a semantic viewpoint the duration of actions, and models generated. We start with some preliminary notions. In what follows, let \( \mathbb{N} (\mathbb{R}_+) \) denote the set of natural (non-negative real numbers, respectively).
model concurrent system by networks of progressive timed automata.
For an action \( a \in \Sigma \), we define the set of the indices of all components including \( a \): \( \Sigma(a) = \{i \in \{1, \ldots, n\} \mid a \in \Sigma_i\} \).
**Definition 3 (Network and product of timed automata)**
A network of timed automata \( \mathcal{T} \mathcal{A} \) is a set of \( n \) timed automata (called components) \( \mathcal{T} \mathcal{A} = \{ \mathcal{T} \mathcal{A}_i \mid i \in \{1, \ldots, n\}\} \), where \( \mathcal{T} \mathcal{A}_i = (\Sigma_i, L_i, l_0^i, E_i, \mathcal{X}_i, I_i) \). The product of \( \mathcal{T} \mathcal{A} \) is the timed automaton \( \mathcal{T} \mathcal{A} = (\Sigma, L, l^\prime, E, \mathcal{X}, I) \), where \( \Sigma = \bigcup_{i \in \{1, \ldots, n\}} \Sigma_i \), \( L = \prod_{i \in \{1, \ldots, n\}} L_i \), \( l^i = (l_1^i, \ldots, l_n^i) \), \( \mathcal{X} = \bigcup_{i \in \{1, \ldots, n\}} \mathcal{X}_i \), \( I((l_1, \ldots, l_n)) = \bigwedge_{i \in \{1, \ldots, n\}} I_i(l_i) \), and the transition relation is given by:
\[
((l_1, \ldots, l_n), a, \bigwedge_{i \in \Sigma(a)} c_{i}, \bigcup_{i \in \Sigma(a)} Y_i, (l_1', \ldots, l_n')) \in E
\\iff
(V_{i} \in \Sigma(a)) \ (l_i, a, c_{i}, Y_i, l_i') \in E_i \ and \ \forall i \in \{1, \ldots, n\} \Sigma(a) \ l_i' = l_i.
\]
For the reasons to be explained later, in this paper we consider only automata without upper invariants, i.e., those of the form \( x \sim c \) for \( \sim \in \{<, \leq\} \). We also assume that the sets of clocks of each two components are disjoint.
### 3.2 Abstract Discretized Models
In this section we define an equivalence on clocks and abstract discretized models. Because the concrete space is infinite, an abstraction must be introduced in order to identify the equivalent clock valuations:
**Definition 4 (Equivalence of clock valuations)** For two clock valuations \( v, v' \in \mathbb{R}^{n_\Sigma} \), \( v \sim v' \iff \) for all \( x, x' \in \mathcal{X} \) the following conditions are met:
1. \( v(x) > c_{max} \iff v'(x) > c_{max} \).
2. If \( v(x) \leq c_{max} \ and \ v(x') \leq c_{max} \) then
a) \( |v(x)| = |v'(x)| \).
b) \( \text{frac}(v(x)) = 0 \iff \text{frac}(v'(x)) = 0 \), and
c) \( \text{frac}(v(x)) \leq \text{frac}(v'(x)) \iff \text{frac}(v'(x)) \leq \text{frac}(v(x)) \).
Let \( \mathcal{T} \mathcal{A} = (\Sigma, L, l^\prime, E, \mathcal{X}, I) \) be a diagonal-free timed automaton with \( n_\Sigma \) clocks and \( V_{\mathcal{T} \mathcal{A}} \) be a valuation function. Next, let \( \mathcal{M}(\mathcal{T} \mathcal{A}) = (C(\mathcal{T} \mathcal{A}), V_{\mathcal{T} \mathcal{A}}^\Delta) \) be the concrete model for \( \mathcal{T} \mathcal{A} \), where \( V_{\mathcal{T} \mathcal{A}}^\Delta(l, v) = V_{\mathcal{T} \mathcal{A}}(l) \). We choose the discretization step \( \Delta = 1/d \), where \( d \) is a fixed even number greater than \( 2n_\Sigma \). The discretized clock space is defined as \( \mathbb{D}^{n_\Sigma}, \) where \( \mathbb{D} = \{ k \Delta \mid 0 \leq k \leq 2c_{max} + 2 \} \) for \( k \in \mathbb{N} \).
\(^1\) A good choice for \( d \) is the minimal such a number, which equals to \( 2^d \) for some \( d' \).
**Definition 5** The (abstract) discretized model of a timed automaton \( \mathcal{T} \mathcal{A} \) is a finite structure \( \mathcal{M}(\mathcal{T} \mathcal{A}) = (Q, q^i, \rightarrow, a) \), where \( Q = \mathbb{L} \times \mathbb{D}^{n_\Sigma}, q^i = (l^i, Z^i) \) and \( \rightarrow, a \subseteq Q \times \Sigma \times Q \) is defined as follows:
1. \( (l, v) \xrightarrow{a} (l, w) \iff (l, v') \xrightarrow{\delta} (l, w') \) for some \( \delta \in \mathbb{R}^+ \) and some \( v', w' \in \mathbb{D}^{n_\Sigma} \) such that \( v \sim v' \) and \( w \sim w' \).
(\text{action transition combined with future projection transition})
We use the logic \( CTL \) having the syntax as follows:
\[
\varphi ::= p \mid \neg \varphi \mid \varphi \lor \varphi \mid EX \varphi \mid EG \varphi \mid E(\varphi U \varphi).
\]
\( CTL \) is interpreted in the standard way over \( \mathcal{M}(\mathcal{T} \mathcal{A}) \).
### 3.3 Encoding of the transition relation
For the encoding we require that every component \( \mathcal{T} \mathcal{A}_i = (\Sigma_i, L_i, l_0^i, E_i, \mathcal{X}_i, I_i) \) of the network \( \mathcal{T} \mathcal{A} \) satisfies the following two conditions: (i) each pair of local locations is connected with at most one transition labelled with an action \( a \in \Sigma_i \), (ii) all the local transitions of \( \mathcal{T} \mathcal{A}_i \) labelled with an action \( a \in \Sigma_i \), reset the same clocks. Notice that each automaton can be translated to the above form by adding fresh transition labels.
Now we give details of this translation. We begin with the encoding of the states in the model under consideration. Since the set of states \( Q \) of our model is finite, every element of \( Q \) can be represented as a bit vector \( (s[1], \ldots, s[b_i]) \) of length \( b_i \) depending on the number of locations in \( L \), the size of the set \( D \) and the number of clocks. The bit vector consists of two parts, the first of which is used to represent the location of a state of the automaton, whereas the second represents the timed part of that state (i.e., the clock valuation)\(^2\).
Each state \( s \) (given as a bit vector) can be encoded by a valuation of a vector \( w = (w[1], \ldots, w[b_i]) \) (called a \emph{global state variable}), where \( w[i] \), for \( i = 1, \ldots, b_i \) is a propositional variable (called \emph{state variable}). Notice that we distinguish between states of \( Q \) represented as sequences of 0’s and 1’s (we refer to these as valuations of \( w \)) and their encodings in terms of propositional variables \( w[i] \).
Now, we give more details of this encoding. Every state \( (l, u) \in Q \) of \( \mathcal{M}(\mathcal{T} \mathcal{A}) \) is represented by a bit vector \( s = (s_C, s^C) \), composed of two subvectors encoding respectively \( l \) and \( u \). Let \( \text{lit} : \{0, 1\} \times PV \rightarrow \mathcal{F} \) be a function defined as follows: \( \text{lit}(0, p) = \neg p \) and \( \text{lit}(1, p) = p \).
\(^2\) If the system considered consists of \( n \) automata, each part of the vector can be divided into \( n \) subvectors, each of which represents respectively the location and the valuation of the local clocks for the \( i \)-th component, for \( i = 1, \ldots, n \).
Locations: if $|L_i|$ is the number of locations in $T_A$, then $m_i = \lceil \log_2(|L_i|) \rceil$ state variables suffice to encode every location. The subvector $w^C_i = (w^C_1[i], \ldots, w^C_m[i])$ encodes the locations of the $i$-th component. The vector $w^C = (w^C_1, \ldots, w^C_m)$ is of length $m = \sum_{i=1}^n m_i$. We define by $w^C(a)$ the subvector composed of variables $\bigcup_{i \in \Sigma(a)} w^C_i$.
Clocks: a valuation $v \in D$ of a clock $x \in X$ is represented by a pair of natural numbers $(I_x, F_x)$, such that $v = I_x + F_x/\Delta$. It is sufficient to encode $I_x$ and $F_x$ only, such that $w^f$ consists of $n_X$ subvectors $w^f_1$ and $n_X$ subvectors $w^f_2$ having $r^f = \lceil \log_2(2c_{\text{max}} + 2) \rceil$ and $r^F = \lceil \log_2(2n_X) \rceil$ each, and representing $I_x$ and $F_x$, respectively. Thus, each clock is encoded by $r^f + r^F$ state variables, and thus $w^f$ consists of $r = n_X \cdot r_X$ state variables. A discretized clock valuation $(v_1, \ldots, v_{n_X})$ is encoded by $w^f = (w^f_1, w^f_{F_1}, \ldots, w^f_{I_{n_X}}, w^f_{F_{n_X}})$
Next, we introduce the propositional formulas $I_q(w)$ and $T(w, v)$ encoding a discretized state $q$ and the transition relation of $\mathcal{M}(T_A)$ (see [13] for the details).
The formula $I_q(w) = 1 \iff A_q(w[i]) = q$. The formula $T(w, v)$ is such that for each two states $q, q' \in (L \times \mathbb{N}^n)$ and for every assignment $A$ encoding them over $w$ and $v$ (i.e., $A_q(w) = A(w)$ and $A_{\neg q}(v) = A(v)$) we have $q \implies q' \iff A(T(w, v)) = 1$. In order to implement $T(w, v)$ the clock constraints of $T_A$ are encoded over $w^f$. For each constraint $c$, we use $\text{Book}(cc)$ to denote the encoding of $cc$ over the vector $w^f$.
3.4 Characterizing temporal formulas
The standard fixpoint characterisation [4] of $\mathcal{CTL}$ is used. Given a $\mathcal{CTL}$ formula $\varphi$, we compute a corresponding propositional formula $[\varphi](w)$ which encodes the states of the system that satisfy $\varphi$.
Definition 6 (Translation) Given a $\mathcal{CTL}$ formula $\varphi$, the translation $[\varphi](w)$ is inductively defined as follows:
- $[p](w)$ is a formula such that we have $q \models p \iff A_q([p](w)) = 1$, for every $q \in Q$.
- $[\neg \varphi](w) := \neg [\varphi](w)$.
- $[\varphi \lor \psi](w) := [\varphi](w) \lor [\psi](w)$.
- $[AX\varphi](w) := \forall v. (T(w, v) \implies [\varphi](w \leftarrow v))$.
- $[AG\varphi](w) := f_{ssm_AG}([\varphi](w))$.
The formula $\varphi$ is satisfied in the initial state of $\mathcal{M}$ iff the propositional formula $[\varphi](w) \land I_{q_1}(w)$ is satisfiable.
For the sake of brevity, we do not present the algorithm $f_{ssm_AG}([\varphi](w))$. Notice the usage of the restriction in $f_{ssm_AG}([\varphi](w))$, where it ensures that in every fixpoint iteration, it suffices to consider transitions from states not computed in the previous iterations.
4 Generalized blocked clauses in forall()
We have implemented the original algorithm $forall(\alpha, U)$ of [7], where the blocking clauses are built over propositions of the formula $\alpha$. Our experiments show that the problems mentioned in [7] concerning efficiency actually happen. The major problem diagnosed concerns the number of blocking clauses, which are generated by exploring an Alternative Implication Graph. It seems that this approach usually works for simple formulas, but in the case of these resulting from UMC it leads to generating clauses of the maximal length – what means that the cost spent for constructing and maintaining this graph does not improve the overall performance.
Consider the formula $[\forall U, \alpha](w)$ to be computed by calling $forall(\alpha, U)$. The main idea of our paper, based on [12], consists in constructing blocking clauses not only over the propositions from $PV(\alpha)$, but over an extended set of literals $PV^C(\alpha)$ corresponding to all the subformulas of $\alpha$. Next, we give more details of our solution. After Algorithm 1 has reached a satisfying assignment $A_\alpha$, the procedure $DFS_{forall-opt}(\alpha, U, A_\alpha)$ is executed (Algorithm 3) and performs the depth-first-search through $DA(\alpha)$. It begins with the root $\alpha_0$ and returns a set of literals $L \subseteq PV^C(\alpha)$. The resulting clause $c_\alpha$ is a disjunction of the literals from $L$ negated with respect to the current assignment $A_\alpha$. Notice that the smaller the set $U$, the shorter $c_\alpha$ is. In case $U = PV(\alpha)$, no optimization is achieved. Formally, $c_\alpha = genBlockingCl(L, A_\alpha)$, where
$$genBlockingCl(L, A_\alpha) = \bigvee_{\beta \in L} l_{\beta}^l,$$
with $l_{\beta}^l = \neg l_{\beta}$ if $A_\alpha(\beta) = 1$ and $l_{\beta}^l = l_{\beta}$ if $A_\alpha(\beta) = 0$. It is shown in [12] that $c_\alpha$ is a blocking clause.
code the locations of the components not participating in the blocked transition (to be defined below). The second optimization is based on the explicit computation of the time zones generalizing the single valuation of the clocks of the blocked transition. These two methods are orthogonal and for the clarity of the presentation are presented separately, applied one by one. However, the algorithm implemented uses both at the same time for the efficiency reasons.
Let \( A_\alpha(w, v) \) be a blocking assignment, i.e., an assignment for which \( \alpha AX[w, v] \) evaluates to 0. Since \( \alpha AX((\alpha AX)[w, v]) = 0 \) and \( \alpha AX[w, v] \) is an implication, the formula \( T[w, v] \) is true in \( A_\alpha \) and it determines a transition in the model. Recall that \( A_\alpha(T[w, v]) = 1 \) implies that for the states \( q_a \) and \( q'_a \) such that \( A_q_a(w) = A_\alpha(w) \) and \( A_{q'_a}(v) = A_\alpha(v) \) there is a transition \( t = q_a \overset{a}{\longrightarrow} q'_a \) for some \( a \in \Sigma \). The transition \( t \) is called the blocked transition whereas \( a \) - the blocking action (for \( A_\alpha \)).
In order to show correctness of our optimizations we formulate two conditions \( C1 \) and \( C2 \) (below), which if satisfied by the clauses of \( \chi(w) \) returned by the optimized forall(\( C \)), then they guarantee the clauses to be blocking clauses and this way \( \chi(w) \) to properly characterize \( [AX\varphi](w) \).
Definition 7 Consider an optimized algorithm forall() called for the formula \( \alpha AX[w, v] \) and the variables of \( v \). For the clause \( c_b \) generated by the algorithm for a blocking assignment \( A_\alpha(w, v) \), define the following two conditions:
\( C1: \) for each state \( q \) such that \( A_q(c_b(w)) = 0 \), there is a state \( q' \) such that \( q \overset{a}{\longrightarrow} q' \) and \( A_{q'}([\varphi](w)) = 0 \).
\( C2: \) \( A_{q_a}(c_b(w)) = 0 \).
The following theorem shows that \( C1 \) and \( C2 \) guarantee that each clause \( c_b(w) \) is a blocking clause and thus taking into account that the algorithm terminates when there are no more blocking assignments, the formula \( \chi(w) \) correctly characterizes \( AX\varphi \).
Theorem 5.1 Given is a network of timed automata and a temporal formula \( \varphi \) characterized by \([\varphi](w) \). Let \( \chi(w) \) be the result formula computed by forall(\( \alpha AX(w, v) \), \( v \)) and composed of the generalized blocking clauses. If each clause \( c_b \) of \( \chi(w) \) satisfies the condition \( C1 \) and \( C2 \), then \( A_q(\chi(w)) = 0 \) iff \( q \not\models AX\varphi \), for each state \( q \) of the model \( M(TA) \).
Proof 1 \((\Rightarrow)\) If \( A_q(\chi(w)) = 0 \), then there is \( c_b \) in \( \chi \) such that \( A_q(c_b(w)) = 0 \). Then, by \( C1 \) there is \( q' \) such that \( q \overset{a}{\longrightarrow} q' \) and \( A_{q'}([\varphi](w)) = 0 \). This implies that \( q \not\models \varphi \).
\((\Leftarrow)\) Assume that \( q \not\models AX\varphi \). Since the algorithm has terminated, there are two cases to consider.
Case 1. A blocking assignment \( A_\alpha(w, v) \) was found such that it agrees with \( A_q(w) \) on \( w \). Then, \( \chi \) contains a
clause \( c_b \) such that \( A_q(c_b) = 0 \) (due to C2). So, we have \( A_q(\chi(w)) = 0 \) (because \( \chi \) is the conjunction of the blocking clauses).
Case 2. No blocking assignment \( A_a(w, v) \) was found such that it agrees with \( A_q(w) \) on \( w \). Then, since the algorithm has terminated (which follows from C2), it must have been generated a blocking clause \( c_q'(w) \) such that \( A_q(c_q'(w)) = 0 \) as otherwise there would be another blocking assignment found (for example such that it agrees with \( A_q(w) \) on \( w )\). If \( A_q(c_q'(w)) = 0 \), then, clearly, we have \( A_q(\chi(w)) = 0 \).
Notice that for the simplest blocking clause composed of all the state variables of \( w \) (i.e., \( c_b = genBlockingCl(w, A_a) \)), both the conditions C1 and C2 are satisfied. Now we give our optimized algorithms.
The general framework for optimizations is the procedure \( blocking_timed_clause() \), which consists of five major steps executed consecutively in \( forall() \) after finding a blocking assignment \( A_a \). First, the blocking action is identified. Then, the input formula is searched (Alg. \( DFSforall_time_opt() \)). The search identifies the sets \( L_0, L_1, \) and \( L_2 \) of subformulas over the subvectors \( vC(a), vC \backslash vC(a) \), and \( v^t \), respectively. Finally, the location sub-clause is calculated on the basis of the set \( L_1 \), and the timed subclause is computed using the set \( L_2 \). More details of the construction are given below.
Algorithm 4 \( blocking_timed_clause(\alpha_{\chi}(w, v), v, A_a) \)
1. Determine a blocking transition \( t = q_0 \xrightarrow{a} q_0' \) and a blocked action \( a \), where \( q_0 = (l_a, v_{\alpha}) \) and \( q_0' = (l_a', v_{\alpha}') \).
2. Search the formula \( \chi[w \leftarrow v] \); \( (L_0, L_1, L_2) = DFSforall_time_opt(\chi[w \leftarrow v], v, A_a) \).
3. Compute the control part \( c_b^{CONTR}(w^C) \) using \( a \) and \( L_1 \).
4. Compute the timed part \( c_b^{DBM}(w^t) \) using \( a \) and \( L_2 \).
5. Return \( c_b(w) = c_b^{CONTR}(w^C) \lor c_b^{DBM}(w^t) \).
5.1 Restricting the range of quantification
The first optimization generalizes the location part of each blocking clause. As networks of timed automata use the asynchronous semantics determining the behavior with respect to action transitions, the optimization introduced in [12] for untimed systems can be applied here. The idea consists in restricting the range of quantification to a subvector encoding the location part.
Algorithm 5 \( DFSforall_time_opt(\alpha, v(a), A_a) \)
1. s.push( \( q_0 \) )
while s not empty do
\( v_B = s.pop(); \)
if ( \( \beta \) encodes a constr. \( cc \in \mathcal{C}_X \), i.e., \( \beta = \text{Bool}(cc) \) ) then
\( A_\alpha(\beta) = 0 \)
\( L_2 = L_2 \cup \{ l_{cc} \} \)
else
\( L_2 = L_2 \cup \{ l_{\sim cc} \} \)
\( \) if \( PV(\beta) \lor v(a) = \emptyset \) then
\( L_1 = L_1 \cup \{ l_{\beta} \} \)
else if \( PV(\beta) \subseteq v(a) \) then
\( L_0 = L_0 \cup \{ l_{\beta} \} \)
else if \( (\beta = \beta_1 \land \beta_2) \land A_\alpha(\beta) = 0 \) /* the optimisations */ do
s.push(\( v_B \))
return (\( L_0, L_1, L_2 \))
Thus, for each action we restrict the range of quantification in order to exclude the variables unchanged by this action. The set \( L_{\text{pre}} \) contains the literals of \( I_{q_0}(w) \) (recall that this formula is a conjunction) occurring in the set \( \bigcup_{l \in \Sigma(a)} \mathcal{W}_l \) (thus it decodes the location predecessor of \( a \)). As before, the clock part encodes \( v_{\gamma} \); \( c_b^{DBM}(w^t) = genBlockingCl(w^t, A_a) \). Let denote by \( L_1(v \leftarrow w) \) the set of formulas such that for every \( \alpha \in L_1 \), it contains \( \alpha(v \leftarrow w) \). The location part is built of the formulas in \( L_1 \) and \( L_{\text{pre}} \); \( c_b^{CONTR}(w^C) = genBlockingCl(L_1(v \leftarrow w) \cup L_{\text{pre}}, A_a) \).
Lemma 5.2 Each blocking clause \( c_b(w) \) generated by the optimized algorithm \( forall() \) satisfies the conditions C1 and C2.
Proof 2 C1: Consider a state \( q = (l, v) \) blocked by \( c_b \). First we prove that there is a transition enabled in \( q \). Let \( A_a(w, v) \) be the blocking assignment for \( c_b(w) \), and \( t = q_0 \xrightarrow{a} q_0' \) be the blocking transition for \( A_a(w, v) \). Note that the locations of \( l \) in the components of \( \Sigma(a) \) are the same as in \( l_{q_0} \) (as they are explicitly encoded in \( c_b \)). Moreover, \( v = v_{q_0} \) as this clock valuation is also encoded in \( c_b \). This guarantees that \( a \) is enabled in the components of \( \Sigma(a) \). Concerning the remaining components, because no upper invariants are present, nothing can prevent time flowing in their locations. Thus we have that \( (l, v) \xrightarrow{a} (l', v') \) for some \( l' \in L \) and \( v' = v_{q_0}' \).
Next, we prove that \( A_q(\chi[w]) = 0 \). Recall that the variables in the sets \( L_0, L_1, \) and \( L_2 \) assigned as in \( A_a \) imply
that $A_\alpha([\varphi])(v) = 0$ (because the formula search of $[\varphi]$ identified these sets to ensure this). The assignments of the corresponding variables over $w$ and $v$ in $L_2$ are the same in $A_\alpha(v)$ and $A_q(w)$, and the same holds true also for $L_1$ but with possibly different locations encoded over $w$ and $v$ (these encodings imply however the same values of the variables in $L_1$). Because $v' = v'_{\alpha}$, the variables in $L_2$ have the same values in $A_\alpha(v)$ and $A_q(w)$ as well.
$\mathbf{C2:}$ As every literal of $c_0(w)$ is false in $A_\alpha$, we have $A_{\alpha_0}(c_0(w)) = A_\alpha(c_0(w)) = 0$.
5.2 Efficient predecessor calculation
We have described sets of locations by single blocking clauses, but still only one clock valuation is encoded in every clause. Now, we show how to compute timed subclauses by operating on time constraints. Our approach is based on Difference Bound Matrices (DBMs), which are an efficient representation of time constraints. The search for generalized subformulas is extended to subformulas encoding constraints over clock variables; these constraints are then transformed to a zone and the computations are performed using DBMs. Finally, the resulting constraints are encoded in the propositional logic and added directly to the blocking clause.
First, we define the operations on zones that we use later. Let $v, v' \in \mathbb{R}_{\mathbb{N}}^n$ and $Z, Z' \in (\mathbb{N}_\mathbb{Z})$. Let $v \preceq v'$ iff $\exists 0 \in \mathbb{R}_+$ s.t. $v' = v + \delta$. The following operations are defined:
1. $Z \cap Z' = \{ v \in Z \mid v \in Z' \}$ (intersection of zones),
2. $Z \not\subset \{ v' \in \mathbb{R}_{\mathbb{N}}^n \mid (\exists v \in Z) v' \leq v \}$ (time predecessor),
3. $[X = 0]Z = \{ v \mid v[X = 0] \in Z \}$ (clock reset inverse).
All the above operations preserve zones [9].
We use the standard form of normalized constraints. The set $X$ is extended with an additional ficticious clock $x_0 \notin X$, which represents the constant 0. The set $X \cup \{x_0\}$ is denoted with $X^+$. Then, each constraint $cc'$ over $X^+$ can be generated by the following grammar: $cc' = x_i \leq x_j \sim c \mid x_i \leq x_j \sim \infty \mid x_i \leq x_j \sim \infty \mid cc' \wedge cc'$, where $x_i, x_j \in X^+$, and $\sim \in \{<, \leq\}$. The standard conversion of the constraints in $C_\mathbb{Z}$ to the normalized form is described in [9]. Now, we formally introduce DBMs:
Definition 8 (Difference Bounds Matrix) A difference bounds matrix (DBM) in $\mathbb{R}_{\mathbb{N}}^n$ is a $(n, n + 1) \times (n, n + 1)$ matrix of bounds, with rows and columns indexed from 0 to $n$. The DBM $D = (d_{ij})$, where for each $i, j \in \{0, \ldots, n\}, d_{ij} = (d_{ij}, \sim_{ij})$, represents the zone $Z = \{x \in \mathbb{R}_{\mathbb{N}}^n \mid x_i \sim_{ij} d_{ij}\}$. The zone represented by $D$ is denoted by $[D]$.
It is easy to see that for each zone $Z$ there exists a DBM $D$ such that $Z = [D]$. In general, the space requirements for representing a zone with $n \cdot \mathbb{N}$ clocks is $O(n \cdot \mathbb{N})$, but for some zones not all the constraints must be present. Some zones can be represented by more than one DBM, but the canonical representations are provided by canonical DBMs. It is assumed that an implementation of DBMs is available together with the algorithms to calculate union, clock resets, time precondition, and the canonical form. The details can be found in [9].
Now, we are ready to define generalized timed subclauses. Recall that $i$ is a blocked transition, $a$ - the blocked action (labelling the blocking transition), and $L_2$ - the subformulas of $\alpha_{AX}(w, v)$ over $v^i$. Next, let $L'$ be a set of the constraints encoded by the literals in $L_2$, defined as $L' = \{cc \mid l_{\mathbb{B}oot(cc)} \in L_2\}$. Then, we build the zone $Z'$ which is constructed from the tightestest constraints of $L'$. Formally, we introduce the ordering $\preceq$ on the constraints as follows: $\preceq$ is strictly less than $\not\subset$ and for $cc = x_i \preceq x_j \sim c$ and $cc' = x_i \preceq x_j \sim c'$ we have $cc \preceq cc'$ if either $c < c'$ or $c = c'$ and $\preceq \leq c'$. We define $Z'$ to contain all the minimal constraints from $L'$. Then, let $D'$ be the canonical DBM for $Z'$. Next, we calculate the zone $Z$ being the predecessor of $Z'$ with respect to the action $a$:
$$Z = (\bigcap_{i \in \Sigma(a)} [I(i,l)]) \cap ([cc_0 \cap] Y = 0)(Z' \cap (\bigcap_{i \in \Sigma(a)} [I(i,l)])) \not\subset$$
The timed subclause encodes the constraints of $Z$: $L_Z = \{cc \mid cc \in Z' \}$ and $c_{DBM}(w) = genBlockingCl(L_Z, A_\alpha)$, and the location subclause is the same as the first optimization: $c^{CONTR}(w^{c}) = genBlockingCl(L_1(w^{c} \rightarrow w) \cup L_{pre}, A_\alpha)$.
Lemma 5.3 The blocking clause $c_0$ generated by the above algorithm satisfies the conditions $C1$ and $C2$.
Proof 3 $C1$: Consider a state $q = (l, v)$ blocked by $c_0$. First we prove that there is a transition enabled in $q$. Let $A_\alpha(w, v)$ be the blocking assignment for $c_0(w)$, and $t = q_a \preceq q_{\alpha_0} q_0'$, where $q_0 = (l_0, v_0)$ and $q_{\alpha_0} = (l_0, v_{\alpha_0})$, be the blocking transition for $A_\alpha(w, v)$. Note that the locations of $l$ in the components of $\Sigma(a)$ are the same as in $l_0$ (as they are encoded in $c_0$). Moreover, recall that the zone $Z$ is encoded in $c_{DBM}(w)$, and $c_0(w)$ is false both in $A_\alpha$ and $A_{DBM}$ is also false in these assignments and we have $v, v_{\alpha} \in Z$. The zone $Z$ was calculated so that for every $v_\alpha \in Z$ there was some $v'_{\alpha} \in Z'$ such that $(l_0, v_\alpha) \preceq q^\rightarrow (l', v'_\alpha)$. So we have $q_a \preceq q'_{\alpha_0} q' = (l', v')$ and some $v' \in Z'$.
Next, we prove that $A_{\alpha_0}([\varphi](w)) = 0$. Recall that the variables in the sets $L_0, L_1, L_2$ assigned as in $A_\alpha$ imply that $A_\alpha([\varphi](v)) = 0$ (the formula search of $[\varphi]$ identified
6 Case study: Fischer’s mutual exclusion
The optimized algorithm has been implemented using the representation of the propositional formulas and the encoding of the transition relation of the module BMC of VerICS [9], and the SAT solver ZChaff. In order to evaluate the performance, we examine the well-known Fischer’s Mutual Exclusion protocol in its standard formulation. The example models a system consisting of \( n \) independent processes \((1, \ldots, n)\) and a controlling process. The processes indexed with 1, \ldots, \( n \) compete for an access to the shared resource (indexed with 0), which can be used by a single process at the same time.
The experimental results comparing VerICS UMC to RED and UPPAAL are shown in Table 1. Notice that UMC clearly performs best when \( \delta > \Delta \). This can be briefly explained as follows with the help of Fig. 2. The tested property consists in reachability of a state where two processes are in their critical sections. Let’s consider a pair of the processes \((1, 2)\), but all the pairs are processed in the same way. In the first iteration, \((l_1^1, l_2^1)\) is the blocking transition (the case of \( enter_2 \) is symmetric). In the second iteration, the instances of the action \( set_1 \) are blocked, for each location of \( TA_0 \). Then, in the third iteration, there are two blocking transitions: in the first one \( TA_1 \) still remains in its critical section while \( TA_1 \) executes \( try_1 \) – notice that \( exit_1 \) will not become enabled because it leads from the state in which the property is false. Consider the second transition \( enter_2 \). Note that no clock valuation with \( v_2 = 0 \) belongs to the corresponding zone \( Z \). This means that the action \( set_2 \) will not become enabled and the computation halts.
Notice that the performance of our tool degrades with the increase of the parameter values, what can be explained by our inefficient and preliminary implementation where all the possible constraints are first generated. In a lazy implementation only necessary constraints, currently present in the working formula, would be generated on-the-fly. Notice also that our method performs worst when the mutual exclusion is violated. However, then a counterexample exists, and all the methods presented would be outperformed by the BMC algorithm of VerICS.
7 Future work
Our experimental results are promising, but a lot of work is still necessary to get a reliable tool. The major problem concerns the representation of propositional formulas, which is not canonical. It should be possible to optionally use BDD graphs as a formula representation, what would significantly improve the performance. Contrary to the current representation, adding blocking clauses would reduce
\[ \phi^+ = EF \left( \bigvee_{1 \leq i, j \leq n, i \neq j} crit_i \land crit_j \right) \]
**Table 1. The results of checking \( \phi^+ \) for Fischer’s mutual exclusion.**
<table>
<thead>
<tr>
<th>System</th>
<th>Uppaal</th>
<th>RED</th>
<th>VerICS</th>
</tr>
</thead>
<tbody>
<tr>
<td>( n = 12, \Delta = 1, \delta = 2 ) (true)</td>
<td>580</td>
<td>304</td>
<td>59</td>
</tr>
<tr>
<td>( n = 13, \Delta = 1, \delta = 2 ) (true)</td>
<td>-</td>
<td>657</td>
<td>88</td>
</tr>
<tr>
<td>( n = 15, \Delta = 1, \delta = 2 ) (true)</td>
<td>-</td>
<td>-</td>
<td>154</td>
</tr>
<tr>
<td>( n = 18, \Delta = 1, \delta = 2 ) (true)</td>
<td>-</td>
<td>-</td>
<td>376</td>
</tr>
<tr>
<td>( n = 20, \Delta = 1, \delta = 2 ) (true)</td>
<td>-</td>
<td>-</td>
<td>491</td>
</tr>
<tr>
<td>( n = 10, \Delta = 3, \delta = 4 ) (true)</td>
<td>33</td>
<td>53</td>
<td>50</td>
</tr>
<tr>
<td>( n = 11, \Delta = 3, \delta = 4 ) (true)</td>
<td>125</td>
<td>133</td>
<td>71</td>
</tr>
<tr>
<td>( n = 10, \Delta = 2, \delta = 1 ) (false)</td>
<td>7</td>
<td>49</td>
<td>97</td>
</tr>
</tbody>
</table>
\( ^9 \)The site of VerICS is verics.ipipan.waw.pl
the formula size. Another important aim is to relax the restriction of the upper invariants. This is easy provided an efficient representation is available. Tuning the SAT algorithm would result in a faster search.
We conjecture that after adding the features described above, the algorithm would become a part of a standard model-checking toolset, complementary to other symbolic methods.
References
8 Appendix
8.1 Example
A simple calculation is shown for the system given in Fig. 3, composed of two timed automata TA1 and TA2. The verified property is AG(p1 ∨ p2). There are two clocks x and y, and clock valuations are of the form u = (x, y).
The computation consists of the two fixpoint iterations, and during every computation a single blocking clause is generated:
1. The blocking assignment A1 = {x < 1} is found which determines the states q0 = ((1, 1), u) and q′ 0 = ((1, 1), u′), with v = (1, 4) and v′ = (0, 6). The algorithm DFSf or all_time_opt() finds the following sets: L0 = {[p2](v)}; L1 = {[p1](v)}, L2 = ∅. Thus Z′ = true and we compute Z = x < 3. Finally, c3 = ¬pre(a1)(wC) ∨ ¬[p1](wC) ∨ ¬l_{x<3}(w′).
2. The second blocking assignment, A2 = {x < 3} determines the states q′ 0 = ((1, 2), v) and q′ 0 = ((1, 2), v′), with v = (1, 2) and v′ = (4, 5). The algorithm DFSf or all_time_opt() finds the following sets: L0 = {¬pre(a1)(v)}, L1 = {[p1](v)}, L2 = {x < 3}. The searched formula is shown in Fig. 3, notice that the subformula [v] is skipped as the another one argument of the conjunction suffices to imply the false value. Finally, we get c3 = ¬pre(a2)(wC) ∨ ¬[p1](wC) ∨ ¬l_{x<1}(w′).
The result of the computation is [AG(p1 ∨ p2)](w) = αQ = [p1 ∨ p2] ∧ c3 ∧ c′ 3. This formula conjuncted with Ip_q (w) is not satisfiable, what means that the verified property is not true in the model.
|
{"Source-Url": "http://www.ipipan.waw.pl/~penczek/WPenczek/papersPS/2007/PS-ACSD07.pdf", "len_cl100k_base": 14634, "olmocr-version": "0.1.50", "pdf-total-pages": 10, "total-fallback-pages": 0, "total-input-tokens": 50333, "total-output-tokens": 16505, "length": "2e13", "weborganizer": {"__label__adult": 0.0004420280456542969, "__label__art_design": 0.0006613731384277344, "__label__crime_law": 0.0006494522094726562, "__label__education_jobs": 0.001682281494140625, "__label__entertainment": 0.0001659393310546875, "__label__fashion_beauty": 0.0002460479736328125, "__label__finance_business": 0.0006008148193359375, "__label__food_dining": 0.0006799697875976562, "__label__games": 0.0016527175903320312, "__label__hardware": 0.0017995834350585938, "__label__health": 0.001277923583984375, "__label__history": 0.0006504058837890625, "__label__home_hobbies": 0.00022685527801513672, "__label__industrial": 0.0013036727905273438, "__label__literature": 0.0005702972412109375, "__label__politics": 0.0006003379821777344, "__label__religion": 0.0008678436279296875, "__label__science_tech": 0.455810546875, "__label__social_life": 0.00014162063598632812, "__label__software": 0.007518768310546875, "__label__software_dev": 0.5205078125, "__label__sports_fitness": 0.00043582916259765625, "__label__transportation": 0.0013990402221679688, "__label__travel": 0.00030112266540527344}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 52853, 0.0234]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 52853, 0.7927]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 52853, 0.84938]], "google_gemma-3-12b-it_contains_pii": [[0, 4127, false], [4127, 10081, null], [10081, 19118, null], [19118, 25606, null], [25606, 30499, null], [30499, 33790, null], [33790, 38898, null], [38898, 44966, null], [44966, 48653, null], [48653, 52853, null]], "google_gemma-3-12b-it_is_public_document": [[0, 4127, true], [4127, 10081, null], [10081, 19118, null], [19118, 25606, null], [25606, 30499, null], [30499, 33790, null], [33790, 38898, null], [38898, 44966, null], [44966, 48653, null], [48653, 52853, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 52853, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 52853, null]], "pdf_page_numbers": [[0, 4127, 1], [4127, 10081, 2], [10081, 19118, 3], [19118, 25606, 4], [25606, 30499, 5], [30499, 33790, 6], [33790, 38898, 7], [38898, 44966, 8], [44966, 48653, 9], [48653, 52853, 10]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 52853, 0.04405]]}
|
olmocr_science_pdfs
|
2024-12-01
|
2024-12-01
|
5ec8cf1811eb9d6090e2306e60011f5e74c4c608
|
CGraph: A Correlations-aware Approach for Efficient Concurrent Iterative Graph Processing
Yu Zhang, Xiaofei Liao, Hai Jin, and Lin Gu, Huazhong University of Science and Technology; Ligang He, University of Warwick; Bingsheng He, National University of Singapore; Haikun Liu, Huazhong University of Science and Technology
https://www.usenix.org/conference/atc18/presentation/zhang-yu
This paper is included in the Proceedings of the 2018 USENIX Annual Technical Conference (USENIX ATC ’18).
July 11–13, 2018 • Boston, MA, USA
ISBN 978-1-939133-02-1
Open access to the Proceedings of the 2018 USENIX Annual Technical Conference is sponsored by USENIX.
CGraph: A Correlations-aware Approach for Efficient Concurrent Iterative Graph Processing
Yu Zhang† Xiaofei Liao†* Hai Jin† Lin Gu† Ligang He§ Bingsheng He‡ Haikun Liu†
† Services Computing Technology and System Lab, Big Data Technology and System Lab, Cluster and Grid Computing Lab, School of Computer Science and Technology, Huazhong University of Science and Technology, China
‡ Department of Computer Science, National University of Singapore, Singapore
§ Department of Computer Science, University of Warwick, UK
{zhyu, xfliao, hjin, lingu, hkliu}@hust.edu.cn ligang.he@warwick.ac.uk hebs@comp.nus.edu.sg
Abstract
With the fast growing of iterative graph analysis applications, the graph processing platform has to efficiently handle massive Concurrent iterative Graph Processing (CGP) jobs. Although it has been extensively studied to optimize the execution of a single job, existing solutions face high ratio of data access cost to computation for the CGP jobs due to significant cache interference and memory wall, which incurs low throughput. In this work, we observed that there are strong spatial and temporal correlations among the data accesses issued by different CGP jobs because these concurrently running jobs usually need to repeatedly traverse the shared graph structure for the iterative processing of each vertex. Based on this observation, this paper proposes a correlations-aware execution model, together with a core-subgraph based scheduling algorithm, to enable these CGP jobs to efficiently share the graph structure data in cache/memory and their accesses by fully exploiting such correlations. It is able to achieve the efficient execution of the CGP jobs by effectively reducing their average ratio of data access cost to computation and therefore delivers a much higher throughput. In order to demonstrate the efficiency of the proposed approaches, a system called CGraph is developed and extensive experiments have been conducted. The experimental results show that CGraph improves the throughput of the CGP jobs by up to 2.31 times in comparison with the existing solutions.
1 Introduction
In the past decade, iterative graph analysis has become increasingly important in a large variety of domains [7, 26], which need to iteratively handle the graph round by round until convergence. Due to the increasing need of analyzing graph-structured data (e.g., social networks and web graphs), many iterative graph algorithms run as concurrent services on a common platform. These
*Corresponding Author: Xiaofei Liao
access overhead due to the factors such as serious cache interference and limited bandwidth. As the result of high ratio of data access cost to computation in graph algorithm, the current graph processing systems experience low throughput. This paper investigates whether and how we can improve the throughput of the CGP jobs.
In practice, the CGP jobs usually need to repeatedly traverse the shared graph and iteratively process each vertex for their own purpose. It suggests that there are a large number of intersections among the graph structure data being accessed by these jobs in each iteration, which we call the spatial correlation of data accesses. In addition, the partition of the shared graph structure may need to be accessed by multiple jobs within a short time interval, which we call the temporal correlation of data accesses. These two correlations indicate that there exist significant redundant data storing and accessing cost in the jobs, which leaves us good opportunities to reduce these unnecessary costs and improve the throughput.
Based on the observation, we propose a data-centric Load-Trigger-Pushing (denoted by LTP) model to improve the throughput of CGP jobs by fully exploiting the correlations of their data accesses. It decouples the graph structure data from the vertex state associated with each job. Within each iteration, the graph structure partitions shared by multiple CGP jobs are streamed into the cache and trigger the related jobs to concurrently process the data, followed by vertex state pushing for convergence. In this way, many accesses to the shared graph partitions can be amortized by multiple CGP jobs through handling them along a common order. The consumption of cache/memory is also reduced since a single copy of the graph structure data is used to serve multiple jobs at the same time. It indicates higher throughput thanks to much lower data access cost. To further improve the throughput, a core-subgraph based scheduling algorithm is designed to maximize cache utilization by judiciously arranging the loading order of the partitions.
We conducted the extensive experiments with our system CGraph and compared its performance with those of three cutting-edge graph processing systems, i.e., CLIP [6], Nxgraph [11], and Seraph [29, 30]. Experimental results show that CGraph improves the throughput of the CGP jobs by up to 3.29 times, 4.32 times, and 2.31 times over CLIP, Nxgraph, and Seraph, respectively.
The remainder of this paper is organized as follows. Section 2 discusses the motivation of this work. Section 3 outlines our approach, followed by experimental evaluation in Section 4. Section 5 gives a survey of related work. Finally, we conclude this paper in Section 6.
2 Problem Presentation and Motivation
A common characteristic of an iterative graph processing job is that the operations are usually operated on two types of data: graph structure data and vertex state data. The graph structure data contains the edges between vertices and the information associated with each edge, whereas the vertex state data (e.g., ranking scores for PageRank [21], the distances from the source vertex for SSSP [20]) is computed by its tasks in a parallel way within each iteration and typically consumed in the next iteration. The graph structure data always occupies a majority of the memory, as compared with the vertex state data (i.e., job-specific data), and its proportion varies from 71% to 83% for different datasets [30]. As evaluated in Figure 1, the graph structure data is usually shared by multiple CGP jobs. However, in existing graph processing systems, these CGP jobs handle the shared graph in an individual manner along different graph paths, incurring low throughput for many redundant accesses to the shared graph and cache interference.
2.1 Data Access Problems of the CGP Jobs
In order to investigate the level of the inefficiency of the individual data accessing manner of the CGP jobs, we conducted the benchmark experiments to evaluate the execution time of different number of CGP jobs over Seraph [29, 30] on uk-union [3]. The hardware platform and benchmarks are the same as those described in Section 4.
From Figure 2(a), we made two observations. First, the concurrent way performs better than the sequential way of executing the jobs one by one. As observed in the experiments, it is because that the execution time of graph processing job is dominated by the data access cost and the CPU is always underutilized. Seraph is able to utilize the CPU in a better way by concurrently executing the jobs and also allowing them to share the in-memory graph structure data for less average data access cost. When there are eight jobs, the total execution time of the concurrent execution way is about 60% of the sequential way. Note that the total execution time of the concurrent way is the maximum value of these jobs' execution time, while it is the sum of those of all jobs for the sequential way. Second, the average execution time of each job, however, is significantly prolonged as the number of jobs increases. It is almost doubled when the number of jobs increases from four to eight, because of higher data access cost for each vertex processing.
Figure 2(b) shows the average data access time of the jobs over Seraph when the number of jobs increases. We can observe that the increment of the number of jobs leads to the significant rise of data access cost. It is because that the shared graph partitions are handled by the CGP jobs in an individual manner along different graph paths. As the number of the CGP jobs increases, more copies of the same data need to be created and loaded into the cache by the jobs at different time. Thus, more redundant data accesses are issued by the CGP jobs and
it also incurs more serious cache interference due to the fact that more redundant data are stored into the cache for different jobs at different time. It eventually leads to low system throughput, since the data accessing cost typically represents a major proportion of the total execution time for an iterative graph algorithm.
Take Figure 3 as an example and assume that the cache can only store a partition for the CGP jobs. With the existing solutions, the SSSP job may firstly access partition 1 and then partition 2, whereas the PageRank job may firstly access partition 2 and then partition 1. Besides, the processing of each partition is various for different jobs, making their accesses more irregular. As a result, the partition 1 and partition 2 need to be repeatedly loaded into the cache. It leads to serious contention among the jobs for the data access channel, the cache and so on.
2.2 Correlations between the CGP Jobs
It is common that a set of CGP jobs involve in the analysis of the same graph. Figure 1(b) shows the ratios of a graph shared by different number of CGP jobs at various time sampled from the real trace. We discover that there are strong temporal and spatial correlations between the data accesses of the CGP jobs due to the repeated traverse of the graph shared by them. It indicates that many redundant accesses are issued by the CGP jobs and much cache space is also wasted to store several copies of the same graph structure data for the jobs at different time.
As described in Figure 1(b), the intersections of the set of graph partitions to be handled by different CGP jobs in each iteration are large (more than 75% of all active partitions on average). This is called the spatial correlation. However, the CGP jobs in existing systems access the shared graph partitions in different order individually, inducing much redundant overhead. Ideally, these CGP jobs should consolidate the accesses to the shared graph structure and store a single copy of the shared data in the cache to serve multiple CGP jobs at the same time.
In addition, some graph partitions may be accessed by multiple CGP jobs (may be more than 16 jobs) within a short time duration. This is called the temporal correlation. The traced results show that the number of CGP jobs to access each partition is skewed at any time. The current solutions, e.g., Least Recently Used (LRU) algorithm, may load the infrequently-used data into the cache when it is needed. It not only incurs the cost to load the data, but also swaps out the frequently-used data. A better solution should take into account the temporal correlations, e.g., the usage frequency of the graph partitions, when loading them into the cache.
These observations motivate us to develop a solution for efficient use of cache/memory and the data access channel to achieve a higher throughput by fully exploiting the spatial/temporal correlations discussed above.
3 Our Proposed Approach
Although we have identified the correlations between the CGP jobs, there are still several challenges that need to be tackled in order to exploit them. First, the shared vertices and edges may be individually handled by different jobs along different graph paths. Second, the CGP jobs have different properties (e.g., the rounds for convergence and the submission time), which reduce the chance of sharing the accesses to the graph structure data within a short time interval. For example, some graph structure partitions may be accessed by some jobs (e.g., PageRank) much more frequently than the others (e.g., BFS). Besides, the CGP jobs that share the same graph structure may be put into execution at different time. Third, it is a non-trivial task to design an efficient partition-loading order that can achieve a high cache utilization ratio.
Thus, we propose a data-centric Loading-Trigger-Pushing (LTP) model to fully exploit the spatial/temporal correlations between the CGP jobs, aiming to minimize the redundant accessing and storing cost of the shared graph structure data. In our LTP model, the shared graph is divided into a set of partitions. These partitions are loaded into the cache in sequence and in the same order for all jobs, where each partition is concurrently handled by the related CGP jobs. By such means, the accessing and storing of most graph structure partitions can be shared by multiple CGP jobs, thus significantly reducing the data access cost. When loading the graph partitions, a scheduling algorithm is further developed to specify the loading order of graph partitions (as well as the related job-specific data). The scheduler aims to maximize the cache utilization by fully exploiting the temporal correlations among the jobs’ data accesses.
3.1 Data-centric LTP Execution Model
Assume that the data for an iterative graph algorithm is expressed as \( D = (V,S,E,W) \), where \( V \) is the set of vertices, \( S \) is the set of states for the vertices, \( E \) is the set of edges, \( W \) is the set of weights associated with the edges. In our LTP model, the data of each job is decoupled as the graph structure data, i.e., \( G = (V,E,W) \), and job-specific vertex states, i.e., \( S_i \), where \( G = \cup G_i \) is shared by different jobs and \( G_i \) is the \( i \)th partition of the graph \( G \). Each
job has its own $S_i$ and repeatedly updates its $S_i$ through its processing iterations until the calculated results converge. The processing of each iteration is divided into three stages: graph loading, parallel trigger, and pushing stage, which are formalized as follows.
**Graph Loading.** In each iteration, the shared graph structure partitions, e.g., $G_i$, are sequentially loaded for the CGP jobs along an order. It performs the following operation to load a graph partition: $\bar{L} \leftarrow L(G_i, \cup_{j \in J} S_j^i)$, where $L(\ast)$ denotes an operator that loads the data specified in the parameter list “$\ast$” into the cache. $J$ is the job set, $S_j^i$ denotes the states of the vertices in $G_i$ associated with the $j^{th}$ job, and $\bar{L}$ is the data loaded into the cache. $S_{i} = \cup_{j \in J} S_{i}^j$ is the set of vertex states related to the $j^{th}$ job. In this way, it only needs to load a copy of each shared graph partition, e.g., $G_i$, for multiple CGP jobs and the partitions are also loaded for these jobs along a common order to provide opportunity to sparing the redundant accesses by fully utilizing the correlations of these jobs.
**Trigger and Parallel Execution.** For each loaded graph partition $G_i$, the related CGP jobs, which are the jobs that need to process the vertices in the partition $G_i$ and have not yet obtained the convergent results, are triggered to concurrently execute the following operator: $S_{new} \leftarrow \cup_{j \in J} T_j(G_i, S_j^i)$. The function $T_j(G_i, S_j^i)$ denotes the specific graph processing operations performed by the activated job $j$ on the loaded data (i.e., $G_i$ and $S_j^i$) towards its own objectives. Its outputs (denoted by $S_{new}^i$) are the new states related to the vertices in $G_i$ and are associated with the $j^{th}$ job. $S_{new}^i = \cup_{j \in J} S_{new}^i$ is the new vertex states that are related to the vertices in $G_i$ for all CGP jobs. When the processing of $G_i$ is finished for all related jobs, the next partition can be loaded. By such means, it enables multiple jobs to regularly and concurrently process the set of shared graph partitions for their own goals along the same order and efficiently share the accesses to them for lower overhead.
**State Pushing.** If a job, e.g., $j$, has processed all its active partitions in an iteration, its new calculated results, i.e., $S_{j}^{new} = \cup_{j \in J} S_{j}^{new}$, at this iteration are pushed for the state synchronization between the vertices of its different partitions (stored in its own job-specific space) for convergence. Then, the job starts a new iteration. Note that a CGP job will move to the next iteration once it has processed all active partitions in its current iteration and therefore different CGP jobs may be in different iterations of their graph processing. For example, BFS [10] may only need to handle a few active partitions in each iteration, while other algorithms, e.g., PageRank [21], may have to go through all partitions to complete an iteration.
Figure 3 gives an example to illustrate the LTP model. In this example, the graph in Figure 4(a) is divided into two partitions, which need to be handled by two jobs, i.e., a PageRank job and a SSSP job. The graph structure data is stored in the global space and is shared by these two CGP jobs, while the job-specific space is provided for each CGP job to store its own vertex states. It can load the two partitions along the order of partition 1 then 2. When the partition 1 and the related job-specific data are loaded into the cache, the related jobs (i.e., the PageRank job and the SSSP job) are triggered to concurrently handle it and update their own vertex states. When the two jobs have handled the partition 1, the partition 2 can be loaded for processing. When both the two partitions are handled by the jobs, the new iteration of each job begins.
### 3.2 Correlations-aware Execution of Jobs
This section discusses how to efficiently implement our LTP model for the execution of multiple CGP jobs.
#### 3.2.1 Graph Storage for Multiple CGP Jobs
We first show how to efficiently store the graph for the CGP jobs in our approach.
**Data Structure of Graph Partition.** For parallel processing, large-scale graph needs to be divided into partitions. However, the real-world graph usually has highly skewed power-law degree distributions [12], incurring imbalanced load among the partitions. Thus, our system also uses existing vertex-cut partitioning method [31], and evenly divides the edges of the graph into same-sized partitions in terms of the number of edges. Note that a vertex may have multiple replicas (e.g., $v_3$ in Figure 4(b)), where one of the replicas is nominated as the master vertex and the others are regarded as the mirror vertices. In this way, it not only gets balanced load for the partitions, but also does not incur communication cost when handling each partition. The communication only occurs when the replicas of the same vertex in different
Figure 4: An example to show how to store data for multiple jobs, where the graph is divided into two partitions. Each global table entry represents a graph structure partition indexed by its key and with three other fields to describe corresponding information. The first two fields indicate the location of this graph structure partition and the number of its vertices, respectively. The third field stores the IDs of the jobs to process it at the next iteration (along with the locations of the related private tables associated with these jobs). The information of each graph structure partition is also stored in a key-value table and associated with these jobs). The information of each graph structure partition, i.e., \( g \), is stored in the global table for each partition. The jobs to process it within the next iteration through tracing the partitions activated within the current iteration. This series of snapshots can be stored in an incremental way for low overhead. For each snapshot, it creates a new global table and labels it with a timestamp, where this table only stores the new version of the partition with changes. The newly submitted job handles the graph partitions with the highest timestamp yet less than its arrival time. Figure 5 gives an example to illustrate it. Note that most graph structure partitions, e.g., the partitions 1 and 3, are usually shared by the jobs when they handle different snapshots, respectively.
### Suitable Size of Graph Partition
In order to efficiently use the parallelism of CPU and ensure good cache locality, the cache is expected to be just fully loaded when each core has data to handle. Therefore, the suitable size of each graph structure partition, i.e., \( P_g \), is determined by the number of CPU cores, i.e., \( N \), and the size of the cache, i.e., \( C \). The value of \( P_g \) is expected to be the maximum integer such that \( P_g + \frac{P_g}{s_g} \times s_p \times N + b \leq C \), where \( s_g \) is the average size of each graph structure partition’s item, \( s_p \) is the size of each private table’s item, and \( b \) is the size of reserved buffer.
### Details to Store Evolving Graph Structure
In practice, the graph structure may evolve with time. Thus, we also maintain a series of snapshots for it, where the graph updates, e.g., the adding/deleting of vertices and edges, are only visible to the jobs submitted later than the updates. In this way, different jobs are able to correctly handle the related snapshots of the graph, respectively. Because the changes of graph structure are usually very small at each time, the most part of these snapshots is the same. Thus, the series of snapshots can be stored in an incremental way for low overhead. For each snapshot, it creates a new global table and labels it with a timestamp, where this table only stores the new version of the partition with changes. The newly submitted job handles the graph partitions with the highest timestamp yet less than its arrival time. Figure 5 gives an example to illustrate it. Note that most graph structure partitions, e.g., the partitions 1 and 3, are usually shared by the jobs when they handle different snapshots, respectively.
#### 3.2.2 Loading of Graph Partition
In practice, a partition is to be handled by a job in the next iteration only when its vertices are activated by the other ones of this job at the current iteration. Therefore, it is easy for each partition to identify the set of CGP jobs to process it within the next iteration through tracing the partitions activated within the current iteration. This profiled information, i.e., the temporal correlations of the jobs, is stored in the global table for each partition. The spatial correlations between the data accesses issued by the CGP jobs can be gotten by calculating the intersection of the set of graph partitions to be processed by different jobs. After that, it is able to load the shared graph partitions for exactly once along a common order to serve multiple CGP jobs within each iteration, amortizing the data access cost. Note that the correctness will not be affected by any loading order and the runtime loads the partitions in a round-robin way by default.
For each job, the states of most vertices may have converged at the early iterations, although some vertices
need hundreds of iterations for convergence. The loading and processing of the inactive vertices can be skipped for the related job for low overhead. In detail, when a graph structure partition $G^j$ is loaded into the cache, it only loads the related job-specific private partitions, e.g., $S^j_i$, of the CGP jobs which need to process $G^j$. It does not load $G^j$ when there is no job to handle $G^j$, i.e., the states of the vertices in $G^j$ are inactive for all jobs. Specifically, when a graph structure partition is not used by any job at the next iteration, this graph structure partition is labeled as an inactive one so as to skip its loading. Similarly, it is relabeled as an active one when it needs to be processed by some jobs at the next iteration.
### 3.2.3 Parallel Processing of Graph Partition
After loading a graph partition $G^j$ into the cache, it triggers the related CGP jobs (e.g., $j$) to concurrently handle their private vertex states (e.g., $S^j_i$) associated with this partition, respectively. Note that any newly submitted job only needs to register the partitions to be processed by it at its first iteration and waits to be triggered to handle them. It is possible that the number of CGP jobs is more than the number of CPU cores, i.e., $N$. Assume a partition is shared by $|J|$ number of jobs. When the value of $|J|$ is larger than $N$, these CGP jobs are assigned to be processed as different batches, where the shared graph structure partition is fixed in the cache and only the job-specific partitions are replaced. A graph structure partition is swapped out of the cache only when it has been processed by the related jobs within the current iteration. Otherwise, the unprocessed jobs need to load it again.
For the processing of each partition, the computation load of different CGP jobs is usually skewed, leading to low utilization ratio of hardware. In order to tackle this problem, it identifies the straggler, i.e., the job with the most number of unprocessed vertices in its private table for this partition. Note that the number of unprocessed vertices can be easily gotten, because the number of active vertices for each job in each partition is known as this partition is handled by the jobs at the previous iteration. Then, as described in Figure 6, it logically divides the unprocessed vertices in the private partition of the straggler into pieces and assigns them to the free cores to assist its processing.
The processing details for a job are given in Algorithm 1, where each job only computes the new state for its vertices in $S^j_i$ according to their local neighbors recorded in the graph structure partition $G^j$ (See Lines 2-8). Therefore, there is no cache miss when handling a partition, because no communication occurs between the vertices on different partitions. Obviously, the vertex with replicas on different partitions needs to synchronize their states. The mirror vertex needs to push its new state to its master vertex to get this vertex’s final state at the current iteration. The new calculated state on the master vertex needs to be pushed to its mirrors. As a result, for such a vertex state synchronization, many partitions of private table are frequently loaded into the cache and incur high cache miss rate. In order to tackle this problem, for each mirror vertex, its new state is directly buffered in $S^j_{new}$ (See Line 6), which will be implicitly sent to the master replica for batched vertex state synchronization at the data synchronization stage.
### 3.2.4 Data Synchronization
When there are multiple CGP jobs to synchronize vertex state, it is done for the jobs one by one to reduce resource contention, because there is no data sharing between the jobs. For efficient vertex state synchronization among replicas, as depicted in Algorithm 2, they are done together in batches at this stage for each job, aiming to avoid the frequent load of private table’s partitions at runtime. The items buffered in the queue $S^j_{new}$ (with the new states of the mirror vertices, e.g., $v_h$) are firstly sorted according to the IDs (e.g., $v_h$,$MasterLocation$, which is described in Figure 4(b)) of the partitions with the related master vertices (See Line 2), before pushing them.
By such means, it only needs to load fewer partitions of private table for the state updates of master vertices, since many updates become successive accesses to the same partition. Besides, when the successive updates for a master vertex are done (See Line 7), the final state of this vertex for the current iteration is gotten. Then, such a new value can be directly buffered for batched state updating of mirror vertices as well (See Lines 10-12). Note that, with the traditional solutions, it is impossible to
---
**Algorithm 1** Details of each trigger
1: **procedure** TRIGGER($G^j, S^j_i$)
2: **for** each $v_h \in S^j_i$ \& IsNotConvergent($v_h$) **do**
3: Compute($G^j, v_h$)
4: **if** $v_h$ is a mirror vertex **then**
5: $D \leftarrow v_h$.MasterLocation
6: $S^j_{new}$.Insert($v_h$, $i$, $D$, $v_h$.DeltaValue)
7: **end if**
8: **end for**
9: **end procedure**
---
Figure 6: An example to illustrate how to get balanced load, where the core 1 and the core 2 are handling the partition 1 of the private table of the job 1 together.
Algorithm 2 Details of data synchronization
1: procedure PUSH($i, S_{\text{new}}^j$)
2: SortD($S_{\text{new}}^j$) /*Sort the items recorded in $S_{\text{new}}^j$*/
3: for $<v_h, i, \text{MasterLocation}, \Delta\text{value}> \in S_{\text{new}}^j$ do
4: $D \leftarrow S_{\text{new}}^j[v_h].\text{MasterLocation}$
5: value $\leftarrow S_{\text{new}}^j[v_h].\Delta\text{value}$
6: $S_{\text{new}}^j[v_h].\Delta\text{value} \leftarrow \text{Acc}(S_{\text{new}}^j[v_h].\Delta\text{value}, \text{value})$
7: if Last update of $S_{\text{new}}^j[v_h].\Delta\text{value}$ is end then
8: val $\leftarrow S_{\text{new}}^j[v_h].\text{value}$
9: $S_{\text{new}}^j[v_h].\text{value} \leftarrow \text{Acc}(\text{val}, S_{\text{new}}^j[v_h].\Delta\text{value})$
10: for each $S_{\text{new}}^j[v_h].\text{MasterLocation}=D$ do
11: $S_{\text{new}}^j[v_h].\Delta\text{value} \leftarrow S_{\text{new}}^j[v_h].\Delta\text{value}$
12: end for
13: end if
14: end for
15: SortS($S_{\text{new}}^j$) /*Sort the items recorded in $S_{\text{new}}^j$*/
16: for $<v_h, i, \text{MasterLocation}, \Delta\text{value}> \in S_{\text{new}}^j$ do
17: $i \leftarrow S_{\text{new}}^j[v_h].i$
18: $S_{\text{new}}^j[v_h].\Delta\text{value} \leftarrow S_{\text{new}}^j[v_h].\Delta\text{value}$
19: end for
20: end procedure
know whether the final state is gotten for a master vertex until all updates are done. Then, the master vertex needs overhead to be reloaded for accessing, because it may have been swapped out of the cache. After that, it is done in a similar way to update mirror vertices’ states according to the related master vertices’ states (See Lines 15-19), where the items are sorted according to the IDs of the partitions with the mirror vertices (See Line 15).
3.3 Scheduling Based on Core-subgraph
With existing solutions, the partitions loaded into the cache may be underutilized. First, some vertices need more iterations to converge than the others for much higher degree. They make the partitions containing them repeatedly loaded into the cache and incur high overhead to load and store the early convergent vertices in the same partition. Second, the usage frequency of different partitions is also skewed and also evolving with time. In detail, the same partition of different jobs and different partitions in the same job all may need various iterations to converge. Besides, a graph partition is only visible to the jobs with the arrival time later than its timestamp. As a result, a loaded partition may need to be processed by very few (even one) jobs when the partition is arbitrarily loaded into the cache, inducing poor performance.
In order to maximize the utilization ratio of each partition loaded into the cache, we propose a scheduling algorithm based on core-subgraph partitioning. The key idea is to firstly put the core vertices (with degree higher than a given threshold) together and then make the loaded partition shared by as many jobs as possible on average via arranging the loading order of graph partitions. In detail, it firstly identifies a core subgraph, consisting of the core vertices and the edges on the paths between them, from the graph. Then it evenly divides the graph based on such a subgraph, where the edges of this subgraph are put together into several same-sized partitions and the remaining edges are divided into the other same-sized partitions. By such means, the frequently loading and processing of core vertices incur less cost to load the early convergent vertices in the same partition, sparing the consumption of bandwidth and the cache space.
After that, it gives each partition $P$ a priority $\text{Pri}(P)$ and schedules the loading order of them based on the dynamically profiled priorities of them. The partition with the highest priority is firstly loaded into cache for the CGP jobs to handle, so as to improve the cache utilization ratio. The basic scheduling rules are as follows:
- First, a partition should be given the highest priority and be firstly loaded into the cache when it is needed by the most number of jobs for processing.
- Second, a partition should be set with a higher priority when it has a higher average vertex degree or a larger average vertex state changes, because more vertex states will be propagated to others through them. Then, most vertices need less iterations (also less consumption of the cache) to absorb other vertices’ states for convergence.
The above rules are captured by such an equation:
$$\text{Pri}(P) = N(P) + \theta \cdot \bar{D}(P) \cdot C(P)$$
(1)
where $N(P)$ is the number of jobs to process $P$ and is used to capture the temporal correlations for the CGP jobs. $\bar{D}(P)$ is the average degree of the vertices in $P$, and $C(P)$ is the average state changes of the vertices in $P$ for all its jobs at the previous iteration. The initial values of $N(P)$ and $C(P)$ and the value of $\bar{D}(P)$ are gotten at preprocessing time, while $N(P)$ and $C(P)$ are incrementally updated at the execution time. There, $0 \leq \theta < \frac{1}{\bar{D}_{\text{max}} C_{\text{max}}}$ is the scaling factor set by the runtime system at preprocessing time to ensure that a partition with the highest value of $N(P)$ is firstly processed, where $\bar{D}_{\text{max}}$ and $C_{\text{max}}$ are the maximum values of any partition’s $D(P)$ and $C(P)$, respectively. By such means, the partition loaded into the cache can serve as many jobs as possible, while the other partitions have more opportunity to be needed by more jobs after a time interval, further improving the throughput via reducing the average data access cost.
3.4 Implementation and Interfaces
The implementation details of CGraph are described in Algorithm 3. It repeatedly loads the unprocessed partitions, e.g., $G'$, of the global table into the cache according to the scheduling algorithm (See Line 4). For each $G'$,
Figure 7: Instantiation of graph algorithms on CGraph
Table 1: Properties of data sets
<table>
<thead>
<tr>
<th>Data sets</th>
<th>Vertices</th>
<th>Edges</th>
<th>Sizes</th>
</tr>
</thead>
<tbody>
<tr>
<td>Twitter [3]</td>
<td>41.7 M</td>
<td>1.4 B</td>
<td>17.5 GB</td>
</tr>
<tr>
<td>Friendster [4]</td>
<td>65 M</td>
<td>1.8 B</td>
<td>22.7 GB</td>
</tr>
<tr>
<td>uk2007 [3]</td>
<td>105.9 M</td>
<td>3.7 B</td>
<td>46.2 GB</td>
</tr>
<tr>
<td>uk-union [3]</td>
<td>133.6 M</td>
<td>5.5 B</td>
<td>68.3 GB</td>
</tr>
<tr>
<td>hyperlink14 [5]</td>
<td>1.7 B</td>
<td>64.4 B</td>
<td>480.0 GB</td>
</tr>
</tbody>
</table>
running a Linux operation system with kernel version 2.6.32. Its memory is 64 GB and the secondary storage for it is a disk with 1TB. It spawns a worker for each core to run benchmarks. The program is compiled with cmake version 2.6.4 and gcc version 4.7.2.
In experiments, four popular iterative graph algorithms from web applications and data mining are employed as benchmarks: (1) PageRank [21]; (2) single-source shortest path (SSSP) [20]; (3) strongly connected component (SCC) [14]; (4) breadth-first search (BFS) [10]. The datasets used for these graph algorithms are real-world graphs existing on the websites [3, 4, 5] as described in Table 1. The performance of CGraph is compared with three cutting-edge graph processing solutions, i.e., CLIP [6], Nxgraph [11], and Seraph [29, 30], implemented by us on GridGraph [32]. Seraph is the state-of-the-art system optimized to support the efficient execution of multiple CGP jobs. Note that the jobs (e.g., PageRank, SSSP, SCC, and BFS) in the experiments are submitted to each system simultaneously.
4.1 Performance of Scheduling Strategy
First, we discuss the contributions of our scheduling algorithm on the performance of CGraph. In order to get this goal, PageRank, SSSP, SCC and BFS are executed as four CGP jobs to evaluate the total execution time of them over CGraph (with our scheduler described in Section 3.3) and CGGraph-without (without our scheduler), respectively. Note that the graph partitions in CGGraph-without are loaded in a round-robin way. As shown in Figure 8, the execution time of CGGraph-without is more than that of CGGraph under any circumstances. The execution time of CGGraph is even only 60.5% of CGGraph-without hyperlink14. It is because that the scheduling scheme is able to maximize the utilization ratio of each partition in the cache via firstly loading the most important partition for the jobs.
**Algorithm 3 Executor for CGGraph**
```
1: procedure EXECUTOR(G, SJobs)
2: while the set SJobs is not empty do
3: while G has unprocessed Gi for some jobs do
4: Gi ← LoadPartition(G) /*Load Gi*/
5: /*Get the set of jobs to handle Gi*/
6: J ← GetJobs(Gi, SJobs)
7: for each j ∈ J do
8: /*Trigger the job j to handle Gi*/
9: ParallelTrigger(j, Gi, S[j])
10: end for
11: end while
12: end procedure
```
the job-specific partitions, e.g., $S[j]$, of the related CGP jobs are also loaded and these jobs are triggered to concurrently handle the loaded data (See Lines 5-8), where each job calculates the new states of its vertices according to the states of its local neighbors. When all active partitions of $G$ have been handled for a job, e.g., $j$, at the current iteration (See Line 9), this job synchronizes the states of the vertices with several replicas distributed over different partitions (See Line 10). Then, its new iteration begins. Each job is repeatedly triggered until all its vertex states are inactive (See Lines 11-13). Note that it allows to add new jobs into $S[j]$ at runtime.
For programming, a user only needs to instantiate three functions, i.e., IsNotConvergent(), Compute(), and Acc(), which are used in existing systems [23, 30, 31]. The first one indicates whether a vertex is convergent. Compute() is employed to update a vertex state and calculate the contributions of a vertex for the new states of its neighbors, and Acc() is utilized for a vertex to accumulate the contributions of its neighbors. Figure 7 gives two examples to show how to implement iterative graph algorithm on CGraph. Within each iteration, each vertex updates its state according to the accumulated contributions of its neighbors. After that, it calculates and sends its contributions to its neighbors for their state updates.
4 Experimental Evaluation
The hardware platform used in our experiments is a server containing 4-way 8-core 2.60 GHz Intel Xeon CPU E5-2670 and each CPU has 20 MB last-level cache,
4.2 Overall Performance Comparison
To compare CLIP, Nxgraph, Seraph, and CGraph, we simultaneously submit PageRank, SSSP, SCC, and BFS as four jobs to each of these systems. Figure 9 shows the total execution time of the four jobs over different systems. We find that the four jobs over CGraph are able to converge with less time, which indicates higher throughput than the other systems. For example, over hyperlink14, CGraph can improve the throughput by 2.31 times, 3.29 times, and 4.32 times in comparison with Seraph, CLIP, and Nxgraph, respectively. We identify that the highest throughput of CGraph mainly comes from much lower average data access cost to computation ratio than them.
Figure 10 depicts the execution time breakdown of different jobs evaluated on hyperlink14 with different solutions. We can observe that the pure vertex processing time of the job over CGraph occupies the most ratio of its total execution time, while the ratio is very low in CLIP, Nxgraph, and Seraph. There are two reasons leading to lower average data access cost to computation ratio for CGraph than the other solutions. First, through efficiently exploiting the data access correlations between the CGP jobs, CGraph needs to store less data into the cache, getting a lower cache miss rate. Second, CGraph needs to access less volume of data due to efficient share of data accesses for the jobs, which means less consumption of bandwidth for main memory and the disk.
In order to demonstrate it, we firstly evaluate the last-level cache miss rates of CLIP, Nxgraph, Seraph, and CGraph using CacheGrind [1]. The miss rates of the above four jobs over them are given in Figure 11. As described, the cache miss rate of CLIP is larger than that of Nxgraph, because CLIP tries to trade off locality for the reduction of the total amount of data accesses while Nxgraph uses destination-sorted sub-shard structure to store a graph for better locality. However, the cache miss rate of Nxgraph is still more than that of CGraph. For example, the cache miss rate of Nxgraph is 89.5% for hyperlink14, while the rate is only 29.6% for CGraph. It is mainly because that a single copy of graph structure data in the cache is able to serve multiple jobs of CGraph.
Next, we evaluate the total volume of data swapped into the cache for the above four jobs over different systems. The normalized results of them against CLIP are depicted in Figure 12. We can find that CLIP needs to swap much smaller volume of data into the cache than Nxgraph and Seraph, because it is able to reduce the number of iterations for convergence via reentry of loaded data and beyond-neighborhood accesses. Note that the method employed by CLIP can also be used in Seraph as well as CGraph, rather than Nxgraph.
Besides, from Figure 12, we can observe that the volume of CGraph is much less than those of the other solutions. For example, the value of CGraph is only 47.1% of CLIP over hyperlink14, because CGraph does not need to load and to store the shared graph structure data for each job, separately. However, CLIP suffers from many redundant data accesses due to ignoring the data access correlations between the CGP jobs. Although Seraph can spare some data accesses from the disk to the main memory via sharing in-memory data, each job loads data into the cache in an individual way, incurring high data access overhead as well. It also means that Seraph is only suitable to out-of-core computation.
Finally, the I/O overhead of the above four jobs is also evaluated over different systems. As shown in Figure 13, the jobs on the first three graphs almost not incur I/O overhead for both CGraph and Seraph, because they only need to store one copy of the graph structure data in the main memory and these graphs can be totally loaded. When the graph size is larger than the memory size, CGraph needs less I/O overhead than Seraph through consolidating data accesses for the jobs. It also indicates a better performance of CGraph for out-of-core computation, because the data access time dominates the total execution time under such circumstances.
4.3 Scalability of CGraph
The scalability of CGraph is evaluated via executing the above four jobs on hyperlink14 and increasing the number of workers. Figure 14 gives the results relative to that of CLIP with only one worker. We can observe that CGraph has much better scalability than the other ones. The best scalability of CGraph mainly comes from efficient share of data accesses, while the other systems suffer from limited bandwidth for main memory and magnetic disk. Meanwhile, such a limited bandwidth also induces low utilization ratio of CPU for them.
In Figure 15, we evaluate the average utilization ratio of CPU for the vertex processing of the four jobs over different systems. As observed, existing systems suffer from low CPU utilization ratio, because the long data access time leads to the waste of CPU for them. Besides, from Figure 14 and Figure 15, we can find that the CPU cores of CGraph are almost fully utilized due to balanced load and low data access cost to computation ratio. It indicates that the limited computation ability of the CPU cores becomes the bottleneck of CGraph. GPGPU may be a suitable accelerator to help CGraph to process the CGP jobs for its powerful computing ability.
4.4 Performance on Graph with Changes
In real-world applications, several snapshots may be created for the graph with changes, and multiple CGP jobs are generated to handle them, respectively. In this part, we evaluate CGraph for the graph with structure changes. In the following experiments, we repeatedly generate the CGP jobs in the order of PageRank, SSSP, SCC, and BFS until a given number of jobs are created, where the CGP jobs are executed over a series of snapshots, respectively. Note that Seraph-VT is the version of Seraph incorporating multi-version switching approach [15].
First, we evaluate the total execution time of eight CGP jobs over different systems for hyperlink14 with the graph change ratio ranging from 0.005% to 5%. In detail, the change on the successive two snapshots ranges from 0.005% to 5%. Figure 16 gives the results relative to the execution time of Seraph-VT when the ratio of changed edges is 0.005%. We can observe that CGraph always gets the best performance under different graph change ratios. It is because CGraph still gets a low average data access cost to computation ratio, although the snapshots have differences in graph structure. Besides, we can also find that CGraph needs longer execution time to handle the graph when the graph change ratio is larger, because of less data access correlations between the jobs.
In the following experiments, we take a series of snapshots of hyperlink14 as datasets, where the change ratio between any successive two snapshots is 5% and each job handles a snapshot. Figure 17 depicts the execution time breakdown of the jobs over different systems on hyperlink14 when the number of jobs increases. We can find that the jobs over CGraph have a lower average data access cost to computation ratio with the increase of the number of jobs, because there are more jobs to amortize the data access cost. However, for Seraph-VT and Seraph, the condition with more jobs leads to much more volume of data loaded into the cache and makes them suffer from serious cache interference and limited bandwidth. Thus, CGraph performs much better than Seraph-VT and Seraph when the number of jobs is larger.
The last-level cache miss rate is also evaluated for them on hyperlink14. As depicted in Figure 18, the cache miss rate of CGraph is significantly reduced when the number of jobs is increased, because the data in the cache can be repeatedly used by different CGP jobs. For example, in CGraph, the cache miss rate of the condition with eight jobs is even only 32.8% of the condition with one job. However, in the other solutions, the cache miss rate is significantly increased when the number of jobs is more, because of serious cache interference.
Figure 5 gives the ratio of the total accessed data (including the data from the disk to the main memory and the main memory to the cache) spared by different solutions on hyperlink14 in comparison with the way sequentially executing the jobs over Seraph. As expected, the number of data accesses spared by CGraph is much more than the other solutions. For example, when the number of jobs is eight, the ratio is even up to 65.9% for CGraph, while the ratios of Seraph-VT and Seraph are only 39.5% and 31.3%, respectively. Besides, as observed, CGraph spares much more data accesses when the number of jobs increases, due to more opportunity to share data accesses between different jobs.
5 Related Work
With the explosion of graph scale, many systems [18, 19, 27] have focused on achieving high efficiency for iterative graph analysis. However, most of them focus on supporting single graph processing job. They improve the efficiency either by fully utilizing the sequential usage of memory bandwidth, or by achieving a better data locality and less redundant data accesses, which consequently reduces the volume of the accessed data.
GraphChi [17] achieves sequential storage access by employing parallel sliding windows. X-Stream [23] and Chaos [22] improve GraphChi by using streaming partitions for better sequential access of out-of-core data. Xie et al. [28] propose a novel block-oriented computation model, in which computation is iterated locally over blocks of highly connected nodes, which improves the amount of computation per cache miss. PathGraph [31] models a large graph using a collection of tree-based partitions for better locality. GridGraph [32] proposes 2-level hierarchical partitioning scheme to improve the locality and reduce the amount of I/Os. NXGraph [11] uses destination-sorted sub-shard structure to store graph for better locality and adaptively chooses the fastest strategy to fully utilize memory and reduce data transfer. Instead of targeting a better locality, CLIP [6] proposes to reduce the total data access cost through the reentry of the loaded data and beyond-neighborhood accesses.
Although these systems can support efficient execution of a single iterative graph processing job, multiple separate copies of the same graph need to be created in the main memory by them for the CGP jobs. Following on this direction, Seraph [29, 30] is designed to allow multiple jobs to correctly share one copy of the in-memory graph structure data. However, in Seraph, the accesses to the same graph partitions are performed separately by the jobs along different graph paths, incurring redundant accesses and wasting the cache as well. Note that graph databases [8] are recently proposed to support concurrent queries over a graph. For example, TAO [9] provides a simple data model and APIs to store and query graph data. Wukong [24] uses a RDMA-based approach to provide low-latency concurrent queries over large graph-based RDF datasets. However, these graph database solutions cannot efficiently support the execution of the CGP jobs because they are dedicated to graph queries which usually only touch different small subsets of a graph for exactly once, instead of iteratively processing the entire graph for many rounds.
6 Conclusion
This paper discovers that many redundant data accesses exist in the CGP jobs for their strong temporal and spatial correlations. A novel data-centric LTP model and an efficient scheduling algorithm is then proposed to exploit our observed data access correlations in these jobs and allows multiple CGP jobs to efficiently amortize the data access cost for higher throughput. Experimental results show that our approach significantly improves the throughput for the CGP jobs against the state-of-the-art solutions. This work mainly focuses on static graph processing. In the future, we will research how to further optimize our approach for evolving graph analysis and also extend it to distributed platform and also heterogeneous platform consisting of GPUs so as to get higher throughput for the CGP jobs.
Acknowledgments
This paper is supported by National Key Research and Development Program of China under grant No. 2018YFB1003500, National Natural Science Foundation of China under grant No. 61702202 and 61628204, China Postdoctoral Science Foundation Funded Project under grant No. 2017M610477 and 2017T100555.
References
|
{"Source-Url": "https://www.usenix.org/system/files/conference/atc18/atc18-zhang-yu.pdf", "len_cl100k_base": 11616, "olmocr-version": "0.1.53", "pdf-total-pages": 13, "total-fallback-pages": 0, "total-input-tokens": 48518, "total-output-tokens": 14562, "length": "2e13", "weborganizer": {"__label__adult": 0.0003809928894042969, "__label__art_design": 0.0006127357482910156, "__label__crime_law": 0.00036072731018066406, "__label__education_jobs": 0.0015239715576171875, "__label__entertainment": 0.00017821788787841797, "__label__fashion_beauty": 0.0002377033233642578, "__label__finance_business": 0.0005340576171875, "__label__food_dining": 0.0004165172576904297, "__label__games": 0.0009093284606933594, "__label__hardware": 0.0029697418212890625, "__label__health": 0.00078582763671875, "__label__history": 0.0005698204040527344, "__label__home_hobbies": 0.00014495849609375, "__label__industrial": 0.0007867813110351562, "__label__literature": 0.00040650367736816406, "__label__politics": 0.0003788471221923828, "__label__religion": 0.0006890296936035156, "__label__science_tech": 0.44384765625, "__label__social_life": 0.0001266002655029297, "__label__software": 0.0158538818359375, "__label__software_dev": 0.52685546875, "__label__sports_fitness": 0.00028896331787109375, "__label__transportation": 0.000843048095703125, "__label__travel": 0.0002512931823730469}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 58410, 0.04189]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 58410, 0.40919]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 58410, 0.91787]], "google_gemma-3-12b-it_contains_pii": [[0, 657, false], [657, 3208, null], [3208, 9020, null], [9020, 14347, null], [14347, 19401, null], [19401, 23743, null], [23743, 29074, null], [29074, 35030, null], [35030, 39459, null], [39459, 42931, null], [42931, 47530, null], [47530, 51931, null], [51931, 58410, null]], "google_gemma-3-12b-it_is_public_document": [[0, 657, true], [657, 3208, null], [3208, 9020, null], [9020, 14347, null], [14347, 19401, null], [19401, 23743, null], [23743, 29074, null], [29074, 35030, null], [35030, 39459, null], [39459, 42931, null], [42931, 47530, null], [47530, 51931, null], [51931, 58410, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 58410, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 58410, null]], "pdf_page_numbers": [[0, 657, 1], [657, 3208, 2], [3208, 9020, 3], [9020, 14347, 4], [14347, 19401, 5], [19401, 23743, 6], [23743, 29074, 7], [29074, 35030, 8], [35030, 39459, 9], [39459, 42931, 10], [42931, 47530, 11], [47530, 51931, 12], [51931, 58410, 13]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 58410, 0.03448]]}
|
olmocr_science_pdfs
|
2024-12-07
|
2024-12-07
|
74a3164c996eb14c4a6f78b344e43acae7693352
|
Reinforcement Learning
Spring 2019
Defining MDPs, Planning
Markov Process
- Where you will go depends only on where you are
The information state of a Markov process may be different from its physical state.
Markov Reward Process
- Random wandering through states will occasionally win you a reward
The Fly Markov Reward Process
• There are, in fact, only four states, not eight
– Manhattan distance between fly and spider = 0 (s_0)
– Distance between fly and spider = 1 (s_1)
– Distance between fly and spider = 2 (s_2)
– Distance between fly and spider = 3 (s_3)
• Can, in fact, redefine the MRP entirely in terms of these 4 states
The discounted return
\[ G_t = r_{t+1} + \gamma r_{t+2} + \gamma^2 r_{t+3} + \cdots = \sum_{k=0}^{\infty} \gamma^k r_{t+k} \]
• Total future reward all the way to the end
Markov Decision Process
- Markov Reward Process with following change:
- Agent has real agency
- Agent’s actions modify environment’s behavior
The Fly Markov Decision Process
$S_0$ Process ends
$s_2$ $a_+$ $s_1$
$s_2$ $a_-$ $s_1$
$s_3$ $a_-$ $s_2$
$s_3$ $a_-$ $s_1$
$s_1$ $a_+$ $s_1$
$s_1$ $a_-$ $s_1$
$s_0$ $a_-$ $s_2$
$1/3$ $2/3$
$1/3$ $2/3$
• **The policy** is the agent’s choice of action in each state
– May be stochastic
The Bellman Expectation Equations
- The Bellman expectation equation for state value function
\[ \nu_\pi(s) = \sum_{a \in \mathcal{A}} \pi(a|s) \left( R_s^a + \gamma \sum_{s'} P_{s,s'}^a \nu_\pi(s') \right) \]
- The Bellman expectation equation for action value function
\[ q_\pi(s, a) = R_s^a + \gamma \sum_{s'} \sum_{a \in \mathcal{A}} \pi(a|s') q_\pi(s', a) \]
Optimal Policies
• The optimal policy is the policy that will maximize the expected total discounted reward at every state: \( E[G_t | S_t = s] \)
\[
= E \left[ \sum_{k=0}^{\infty} \gamma^k r_{t+k} | S_t = s \right]
\]
• **Optimal Policy Theorem**: For any MDP there exist optimal policies \( \pi_* \) that is better than or equal to every other policy:
\[
\pi_* \geq \pi \quad \forall \pi
\]
\[
v_* (s) \geq v_\pi (s) \quad \forall s
\]
\[
q_* (s, a) \geq q_\pi (s, a) \quad \forall s, a
\]
The optimal value function
\[ \pi_*(a|s) = \begin{cases}
1 & \text{for } \argmax_{a'} q_*(s, a') \\
0 & \text{otherwise}
\end{cases} \]
\[ v_*(s) = \max_a q_*(s, a) \]
Bellman Optimality Equations
- Optimal value function equation
\[ v_*(s) = \max_a R_s^a + \gamma \sum_{s'} P_{s',s}^a v_*(s') \]
- Optimal action value equation
\[ q_*(s, a) = R_s^a + \gamma \sum_{s'} P_{s',s}^a \max_{a'} q_*(s', a') \]
Planning with an MDP
• Problem:
– **Given:** an MDP \( (S, P, A, R, \gamma) \)
– **Find:** Optimal policy \( \pi_\star \)
• Can either
– **Value-based Solution:** Find optimal value (or action value) function, and derive policy from it OR
– **Policy-based Solution:** Find optimal policy directly
Value-based Planning
• “Value”-based solution
• Breakdown:
– **Prediction:** Given *any* policy $\pi$ find value function $v_\pi(s)$
– **Control:** Find the optimal policy
Prediction DP
• Iterate
\[ \nu^{(k+1)}_{\pi}(s) = \sum_{a \in A} \pi(a \mid s) \left( R_s^a + \gamma \sum_{s'} P_{s',s}^a \nu^{(k)}_{\pi}(s') \right) \]
Policy Iteration
• Start with any policy \( \pi^{(0)} \)
• Iterate \((k = 0 \ldots \) convergence\):
– Use prediction DP to find the value function \( \nu_{\pi^{(k)}}(s) \)
– Find the greedy policy
\[
\pi^{(k+1)}(s) = \text{greedy} \left( \nu_{\pi^{(k)}}(s) \right)
\]
Value iteration
\[ \nu^{(k)}_*(s) = \max_a R_a^s + \gamma \sum_{s'} P_{s,s'}^a \nu^{(k-1)}_*(s') \]
- Each state simply inherits the cost of its best neighbour state
- Cost of neighbour is the value of the neighbour plus cost of getting there
Problem so far
• *Given all details of the MDP*
– Compute optimal value function
– Compute optimal action value function
– *Compute optimal policy*
• This is the problem of *planning*
• **Problem:** In real life, nobody gives you the MDP
– How do we plan???
Model-Free Methods
• AKA model-free reinforcement learning
• How do you find the value of a policy, without knowing the underlying MDP?
– Model-free prediction
• How do you find the optimal policy, without knowing the underlying MDP?
– Model-free control
Model-Free Methods
• AKA model-free reinforcement learning
• How do you find the value of a policy, without knowing the underlying MDP?
– Model-free prediction
• How do you find the optimal policy, without knowing the underlying MDP?
– Model-free control
• Assumption: We can identify the states, know the actions, and measure rewards, but have no knowledge of the system dynamics
– The key knowledge required to “solve” for the best policy
– A reasonable assumption in many discrete-state scenarios
– Can be generalized to other scenarios with infinite or unknowable state
Model-Free Assumption
• Can see the fly
• Know the distance to the fly
• Know possible actions (get closer/farther)
• But have no idea of how the fly will respond
– Will it move, and if so, to what corner
Model-Free Methods
• AKA model-free reinforcement learning
• How do you find the value of a policy, without knowing the underlying MDP?
– Model-free *prediction*
• How do you find the optimal policy, without knowing the underlying MDP?
– Model-free *control*
Model-Free Assumption
- Can see the fly and distance to the fly
- But have no idea of how the fly will respond to actions
- Will it move, and if so, to what corner
- But will always try to reduce distance to fly (have a known, fixed, policy)
- What is the value of being a distance D from the fly?
Methods
• *Monte-Carlo* Learning
• *Temporal-Difference* Learning
– $TD(1)$
– $TD(K)$
– $TD(\lambda)$
Monte-Carlo learning to learn the value of a policy $\pi$
• Just “let the system run” while following the policy $\pi$ and learn the value of different states
• Procedure: Record several episodes of the following
– Take actions according to policy $\pi$
– Note states visited and rewards obtained as a result
– Record entire sequence:
– $S_1, A_1, R_2, S_2, A_2, R_3, \ldots, S_T$
– Assumption: Each “episode” ends at some time
• Estimate value functions based on observations by counting
Monte-Carlo Value Estimation
• Objective: Estimate value function $v_\pi(s)$ for every state $s$, given recordings of the kind:
$$S_1, A_1, R_2, S_2, A_2, R_3, \ldots, S_T$$
• Recall, the value function is the expected return:
$$v_\pi(s) = E[G_t|S_t = s]$$
$$= E[R_{t+1} + \gamma R_{t+2} + \cdots + \gamma^{T-t-1}R_T|S_t = s]$$
• To estimate this, we replace the statistical expectation $E[G_t|S_t = s]$ by the empirical average $avg[G_t|S_t = s]$
A bit of notation
• We actually record many episodes
– \(\text{episode}(1) = S_{11}, A_{11}, R_{12}, S_{12}, A_{12}, R_{13}, \ldots, S_{1T_1}\)
– \(\text{episode}(2) = S_{21}, A_{21}, R_{22}, S_{22}, A_{22}, R_{23}, \ldots, S_{2T_2}\)
– ...
– Different episodes may be different lengths
Counting Returns
• For each episode, we count the returns at all times:
\[ S_{11}, A_{11}, R_{12}, S_{12}, A_{12}, R_{13}, S_{13}, A_{13}, R_{14}, \ldots, S_{1T_1} \]
• Return at time \( t \)
\[ G_{1,1} = R_{12} + \gamma R_{13} + \cdots + \gamma^{T_1-2} R_{1T_1} \]
Counting Returns
- For each episode, we count the returns at all times:
- $S_{11}, A_{11}, R_{12}, S_{12}, A_{12}, R_{13}, S_{13}, A_{13}, R_{14}, \ldots, S_{1T_1}$
- Return at time $t$
- $G_{1,1} = R_{12} + \gamma R_{13} + \cdots + \gamma^{T_1-2} R_{1T_1}$
- $G_{1,2} = R_{13} + \gamma R_{14} + \cdots + \gamma^{T_1-3} R_{1T_1}$
Counting Returns
- For each episode, we count the returns at all times:
- $S_{11}, A_{11}, R_{12}, S_{12}, A_{12}, R_{13}, S_{13}, A_{13}, R_{14}, ..., S_{1T_1}$
- Return at time $t$
- $G_{1,1} = R_{12} + \gamma R_{13} + \cdots + \gamma^{T_1-2} R_{1T_1}$
- $G_{1,2} = R_{13} + \gamma R_{14} + \cdots + \gamma^{T_1-3} R_{1T_1}$
- $...$
- $G_{1,t} = R_{1,t+1} + \gamma R_{1,t+2} + \cdots + \gamma^{T_1-t-1} R_{1T_1}$
Estimating the Value of a State
- To estimate the value of any state, identify the instances of that state in the episodes:
$\{S_{11}, A_{11}, R_{12}, S_{12}, A_{12}, R_{13}, S_{13}, A_{13}, R_{14}, \ldots, S_{1T_1}\}
$s_a$ $s_b$ $s_a$ ...
- Compute the average return from those instances
$\nu_\pi(s_a) = \text{avg}(G_{1,1}, G_{1,3}, \ldots)$
Estimating the Value of a State
• For every state $s$
– Initialize: Count $N(s) = 0$, Total return $v_\pi(s) = 0$
– For every episode $e$
• For every time $t = 1 \ldots T_e$
– Compute $G_t$
– If ($S_t == s$)
» $N(s) = N(s) + 1$
» $v_\pi(s) = v_\pi(s) + G_t$
– $v_\pi(s) = v_\pi(s) / N(s)$
• Can be done more efficiently..
Online Version
- For all $s$ Initialize: Count $N(s) = 0$, Total return $\text{tot}v_\pi(s) = 0$
- For every episode $e$
- For every time $t = 1 \ldots T_e$
- Compute $G_t$
- $N(S_t) = N(S_t) + 1$
- $\text{tot}v_\pi(S_t) = \text{tot}v_\pi(S_t) + G_t$
- For every state $s$ : $v_\pi(s) = \text{tot}v_\pi(s)/N(s)$
- Updating values at the end of each episode
- Can be done more efficiently.
Monte Carlo estimation
- Learning from experience explicitly
- After a sufficiently large number of episodes, in which all states have been visited a sufficiently large number of times, we will obtain good estimates of the value functions of all states
- Easily extended to evaluating action value functions
Estimating the Action Value function
• To estimate the value of any state-action pair, identify the instances of that state-action pair in the episodes:
\[ S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, \ldots, S_T \]
\[ s_a \ a_x \quad s_b \ a_y \quad s_a \ a_y \ \ldots \]
• Compute the average return from those instances
\[ q_\pi(s_a, a_x) = \text{avg}(G_{1,1}, \ldots) \]
Online Version
- For all $s, a$ Initialize: Count $N(s, a) = 0$, Total value $totq_{\pi}(s, a) = 0$
- For every episode $e$
- For every time $t = 1 \ldots T_e$
- Compute $G_t$
- $N(S_t, A_t) = N(S_t, A_t) + 1$
- $totq_{\pi}(S_t, A_t) = totq_{\pi}(S_t, A_t) + G_t$
- For every $s, a : q(s, a) = totq_{\pi}(s, a)/N(s, a)$
- Updating values at the end of each episode
Monte Carlo: Good and Bad
• Good:
– Will eventually get to the right answer
– *Unbiased* estimate
• Bad:
– Cannot update anything until the end of an episode
• Which may last for ever
– High variance! Each return adds many random values
– Slow to converge
Online methods for estimating the value of a policy: Temporal Difference Leaning (TD)
- Idea: Update your value estimates after every observation
\[ S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, \ldots, S_T \]
- Update for \( S_1 \)
- Update for \( S_2 \)
- Update for \( S_3 \)
- Do not actually wait until the end of the episode
Incremental Update of Averages
• Given a sequence $x_1, x_2, x_3, \ldots$ a running estimate of their average can be computed as
$$\mu_k = \frac{1}{k} \sum_{i=1}^{k} x_i$$
• This can be rewritten as:
$$\mu_k = \frac{(k - 1)\mu_{k-1} + x_k}{k}$$
• And further refined to
$$\mu_k = \mu_{k-1} + \frac{1}{k} (x_k - \mu_{k-1})$$
Incremental Update of Averages
• Given a sequence \(x_1, x_2, x_3, \ldots\) a running estimate of their average can be computed as
\[
\mu_k = \mu_{k-1} + \frac{1}{k} (x_k - \mu_{k-1})
\]
• Or more generally as
\[
\mu_k = \mu_{k-1} + \alpha (x_k - \mu_{k-1})
\]
• The latter is particularly useful for non-stationary environments
• For stationary environments \(\alpha\) must shrink with iterations, but not too fast
\[
- \sum_k \alpha_k^2 < C, \quad \sum_k \alpha_k = \infty, \quad \alpha_k \geq 0
\]
Incremental Updates
\[ \mu_k = \mu_{k-1} + \frac{1}{k} (x_k - \mu_{k-1}) \]
• Example of running average of a uniform random variable
Incremental Updates
\[ \mu_k = \mu_{k-1} + \frac{1}{k}(x_k - \mu_{k-1}) \]
- Correct equation is unbiased and converges to true value
- Equation with \( \alpha \) is biased (early estimates can be expected to be wrong) but converges to true value
Updating Value Function Incrementally
- Actual update
\[ v_\pi(s) = \frac{1}{N(s)} \sum_{i=1}^{N(s)} G_{t(i)} \]
- \( N(s) \) is the total number of visits to state \( s \) across all episodes
- \( G_{t(i)} \) is the discounted return at the time instant of the \( i \)-th visit to state \( s \)
Online update
• Given any episode
\[ S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, ..., S_T \]
• Update the value of each state visited
\[ N(S_t) = N(S_t) + 1 \]
\[ v_\pi(S_t) = v_\pi(S_t) + \frac{1}{N(S_t)} (G_t - v_\pi(S_t)) \]
• Incremental version
\[ v_\pi(S_t) = v_\pi(S_t) + \alpha (G_t - v_\pi(S_t)) \]
• Still an unrealistic rule
• Requires the entire track until the end of the episode to compute G_t
Online update
• Given any episode
\[ S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, ..., S_T \]
• Update the value of each state visited
\[ N(S_t) = N(S_t) + 1 \]
\[ \nu_\pi(S_t) = \nu_\pi(S_t) + \frac{1}{N(S_t)}(G_t - \nu_\pi(S_t)) \]
• Incremental version
\[ \nu_\pi(S_t) = \nu_\pi(S_t) + \alpha(G_t - \nu_\pi(S_t)) \]
• Still an unrealistic rule
• Requires the entire track until the end of the episode to compute Gt
**TD solution**
\[ \nu_\pi(S_t) = \nu_\pi(S_t) + \alpha (G_t - \nu_\pi(S_t)) \]
- But
\[ G_t = R_{t+1} + \gamma G_{t+1} \]
- We can approximate \( G_{t+1} \) by the *expected* return at the next state \( S_{t+1} \)
Counting Returns
• For each episode, we count the returns at all times:
– $S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, \ldots, S_T$
• Return at time $t$
– $G_1 = R_2 + \gamma R_3 + \cdots + \gamma^{T-2} R_T$
– $G_2 = R_3 + \gamma R_4 + \cdots + \gamma^{T-3} R_T$
– $\ldots$
– $G_t = R_{t+1} + \gamma R_{t+2} + \cdots + \gamma^{T-t-2} R_T$
• Can rewrite as
– $G_1 = R_2 + \gamma G_2$
• Or
– $G_1 = R_2 + \gamma R_3 + \gamma^2 G_3$
– $\ldots$
– $G_t = R_{t+1} + \sum_{i=1}^{N} \gamma^i R_{t+1+i} + \gamma^{N+1} G_{t+1+N}$
TD solution
\[ v_\pi(S_t) = v_\pi(S_t) + \alpha(G_t - v_\pi(S_t)) \]
• But
\[ G_t = R_{t+1} + \gamma G_{t+1} \]
• We can approximate \( G_{t+1} \) by the expected return at the next state \( S_{t+1} \approx v_\pi(S_{t+1}) \)
\[ G_t \approx R_{t+1} + \gamma v_\pi(S_{t+1}) \]
• We don’t know the real value of \( v_\pi(S_{t+1}) \) but we can “bootstrap” it by its current estimate
TD(1) true online update
$$v_\pi(S_t) = v_\pi(S_t) + \alpha(G_t - v_\pi(S_t))$$
• Where
$$G_t \approx R_{t+1} + \gamma v_\pi(S_{t+1})$$
• Giving us
$$-v_\pi(S_t) = v_\pi(S_t) + \alpha(R_{t+1} + \gamma v_\pi(S_{t+1}) - v_\pi(S_t))$$
TD(1) true online update
\[ \nu_\pi(S_t) = \nu_\pi(S_t) + \alpha \delta_t \]
• Where
\[ \delta_t = R_{t+1} + \gamma \nu_\pi(S_{t+1}) - \nu_\pi(S_t) \]
• \( \delta_t \) is the TD error
– The error between an (estimated) observation of \( G_t \) and the current estimate \( \nu_\pi(S_t) \)
TD(1) true online update
- For all $s$ Initialize: $v_\pi(s) = 0$
- For every episode $e$
- For every time $t = 1 \ldots T_e$
- $v_\pi(S_t) = v_\pi(S_t) + \alpha(R_{t+1} + \gamma v_\pi(S_{t+1}) - v_\pi(S_t))$
- There’s a “lookahead” of one state, to know which state the process arrives at at the next time
- But is otherwise online, with continuous updates
TD(1)
• Updates continuously – improve estimates as soon as you observe a state (and its successor)
• Can work even with *infinitely long* processes that never terminate
• Guaranteed to converge to the true values eventually
– Although initial values will be biased as seen before
– Is actually lower variance than MC!!
• Only incorporates one RV at any time
• TD can give correct answers when MC goes wrong
– Particularly when TD is allowed to *loop* over all learning episodes
• What are \( v(A) \) and \( v(B) \)
– Using MC
– Using TD(1), where you are allowed to repeatedly go over the data
TD – look ahead further?
• TD(1) has a look ahead of 1 time step
\[ G_t \approx R_{t+1} + \gamma v_\pi(S_{t+1}) \]
• But we can look ahead further out
\[ G_t(2) = R_{t+1} + \gamma R_{t+2} + \gamma^2 v_\pi(S_{t+2}) \]
\[ \ldots \]
\[ G_t(N) = R_{t+1} \sum_{i=1}^{N} \gamma^i R_{t+1+i} + \gamma^{N+1} v_\pi(S_{t+N}) \]
**TD(N) with lookahead**
\[ \nu_\pi(S_t) = \nu_\pi(S_t) + \alpha \delta_t(N) \]
- Where
\[ \delta_t(N) = R_{t+1} + \sum_{i=1}^{N} \gamma^i R_{t+1+i} + \gamma^{N+1} \nu_\pi(S_{t+N}) - \nu_\pi(S_t) \]
- \( \delta_t(N) \) is the TD error with \( N \) step lookahead
Lookahead is good
• Good: The further you look ahead, the better your estimates get
• Problems:
– But you also get more variance
– At infinite lookahead, you’re back at MC
• Also, you have to wait to update your estimates
– A lag between observation and estimate
• So how much lookahead must you use
Looking Into The Future
- Let TD target look $n$ steps into the future
- How much various TDs look into the future
- Which do we use?
Solution: Why choose?
- Each lookahead provides an estimate of $G_t$
- Why not just combine the lot with discounting?
\[ G_t^\lambda = (1 - \lambda) \sum_{n=1}^{\infty} \lambda^{n-1} G_t(n) \]
• Combine the predictions from all lookaheads with an exponentially falling weight
– Weights sum to 1.0
\[ V(S_t) \leftarrow V(S_t) + \alpha \left( G_t^\lambda - V(S_t) \right) \]
Something magical just happened
• TD(\(\lambda\)) looks into the infinite future
– I.e. we must have all the rewards of the future to compute our updates
– How does that help?
The contribution of future rewards to the present update
- All future rewards contribute to the update of the value of the current state
The contribution of current reward to \textit{past} states
- All current reward contributes to the update of the value of all past states!
• The *Eligibility* trace:
— Keeps track of *total* weight for any state
• Which may have occurred at multiple times in the past
**TD(λ)**
- Maintain an eligibility trace for *every* state
\[
E_0(s) = 0
\]
\[
E_t(s) = \lambda \gamma E_{t-1}(s) + 1(S_t = s)
\]
- Computes total weight for the state until the present time
**TD(λ)**
- At every time, update the value of *every state* according to its eligibility trace
\[
\delta_t = R_{t+1} + \gamma V(S_{t+1}) - V(S_t)
\]
\[
V(s) \leftarrow V(s) + \alpha \delta_t E_t(s)
\]
- Any state that was visited will be updated
- Those that were not will not be, though
The magic of TD($\lambda$)
• Managed to get the effect of infinite lookahead, by performing infinite lookbehind
– Or at least look behind to the beginning
• Every reward updates the value of all states leading to the reward!
– E.g., in a chess game, if we win, we want to increase the value of all game states we visited, not just the final move
– But early states/moves must gain much less than later moves
• When $\lambda = 1$ this is exactly equivalent to MC
Story so far
• Want to compute the values of all states, given a policy, but no knowledge of dynamics
• Have seen monte-carlo and temporal difference solutions
– TD is quicker to update, and in many situations the better solution
– TD(\(\lambda\)) actually emulates an infinite lookahead
• But we must choose good values of \(\alpha\) and \(\lambda\)
Optimal Policy: Control
• We learned how to estimate the state value functions for an MDP whose transition probabilities are unknown for a given policy
• How do we find the optimal policy?
Value vs. Action Value
• The solution we saw so far only computes the value functions of states.
• Not sufficient – to compute the optimal policy from value functions alone, we will need extra information, namely transition probabilities.
- Which we do not have.
• Instead, we can use the same method to compute action value functions.
- Optimal policy in any state: Choose the action that has the largest optimal action value.
Value vs. Action value
• Given only value functions, the optimal policy must be estimated as:
$$\pi'(s) = \arg \max_{a \in A} R_s^a + P_{ss'}^a V(s')$$
– Needs knowledge of transition probabilities
• Given action value functions, we can find it as:
$$\pi'(s) = \arg \max_{a \in A} Q(s, a)$$
• This is model free (no need for knowledge of model parameters)
Problem of optimal control
- From a series of episodes of the kind:
\[ S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, \ldots, S_T \]
- Find the optimal action value function \( q_*(s, a) \)
- The optimal policy can be found from it
- Ideally do this *online*
- So that we can continuously improve our policy from *ongoing experience*
Exploration vs. Exploitation
• Optimal policy search happens while gathering experience *while following a policy*
• For fastest learning, we will follow an estimate of the optimal policy
• Risk: We run the risk of positive feedback
– Only learn to evaluate our current policy
– Will never learn about alternate policies that may turn out to be better
• Solution: We will follow our current optimal policy $1 - \epsilon$ of the time
– But choose a random action $\epsilon$ of the time
– The “epsilon-greedy” policy
GLIE Monte Carlo
- **Greedy in the limit with infinite exploration**
- Start with some random initial policy $\pi$
- Start the process at the initial state, and follow an action according to initial policy $\pi$
- Produce the episode $S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, \ldots, S_T$
- Process the episode using the following online update rules:
\[ N(S_t, A_t) \leftarrow N(S_t, A_t) + 1 \]
\[ Q(S_t, A_t) \leftarrow Q(S_t, A_t) + \frac{1}{N(S_t, A_t)} (G_t - Q(S_t, A_t)) \]
- Compute the $\epsilon$-greedy policy for each state
\[ \pi(a|s) = \begin{cases}
1 - \epsilon & \text{for } a = \arg\max_{a'} Q(s, a') \\
\frac{\epsilon}{N_a - 1} & \text{otherwise}
\end{cases} \]
- Repeat
GLIE Monte Carlo
- **Greedy in the limit with infinite exploration**
- Start with some random initial policy $\pi$
- Start the process at the initial state, and follow an action according to initial policy $\pi$
- Produce the episode $S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, ..., S_T$
- Process the episode using the following online update rules:
\[
N(S_t, A_t) \leftarrow N(S_t, A_t) + 1
\]
\[
Q(S_t, A_t) \leftarrow Q(S_t, A_t) + \frac{1}{N(S_t, A_t)} (G_t - Q(S_t, A_t))
\]
- Compute the $\epsilon$-greedy policy for each state
\[
\pi(a|s) = \begin{cases}
1 - \epsilon & \text{for } a = \arg\max_{a'} Q(s, a') \\
\epsilon & \text{ otherwise} \\
\frac{1}{N_a - 1} & \text{ otherwise}
\end{cases}
\]
- Repeat
On-line version of GLIE: SARSA
• Replace $G_t$ with an estimate
• TD(1) or TD($\lambda$)
– Just as in the prediction problem
• TD(1) $\rightarrow$ SARSA
$$Q(S, A) \leftarrow Q(S, A) + \alpha (R + \gamma Q(S', A') - Q(S, A))$$
SARSA
- Initialize $Q(s, a)$ for all $s, a$
- Start at initial state $S_1$
- Select an initial action $A_1$
- For $t = 1..$ Terminate
- Get reward $R_t$
- Let system transition to new state $S_{t+1}$
- Draw $A_{t+1}$ according to $\epsilon$-greedy policy
$$
\pi(a|s) = \begin{cases}
1 - \epsilon & \text{for } a = \arg\max_{a'} Q(s, a') \\
\frac{\epsilon}{N_a - 1} & \text{otherwise}
\end{cases}
$$
- Update
$$
Q(S_t, A_t) = Q(S_t, A_t) + \alpha \left( R_t + \gamma Q(S_{t+1}, A_{t+1}) - Q(S_t, A_t) \right)
$$
**SARSA(\(\lambda\))**
- Again, the TD(1) estimate can be replaced by a TD(\(\lambda\)) estimate.
- Maintain an eligibility trace for every state-action pair:
\[ E_0(s, a) = 0 \]
\[ E_t(s, a) = \lambda \gamma E_{t-1}(s, a) + 1(S_t = s, A_t = a) \]
- Update every state-action pair visited so far
\[ \delta_t = R_{t+1} + \gamma Q(S_{t+1}, A_{t+1}) - Q(S_t, A_t) \]
\[ Q(s, a) \leftarrow Q(s, a) + \alpha \delta_t E_t(s, a) \]
SARSA(\(\lambda\))
- For all \(s, a\) initialize \(Q(s, a)\)
- For each episode \(e\)
- For all \(s, a\) initialize \(E(s, a) = 0\)
- Initialize \(S_1, A_1\)
- For \(t = 1 \ldots\) Termination
- Observe \(R_{t+1}, S_{t+1}\)
- Choose action \(A_{t+1}\) using policy obtained from \(Q\)
- \(\delta = R_{t+1} + \gamma Q(S_{t+1}, A_{t+1}) - Q(S_t, A_t)\)
- \(E(S_t, A_t) += 1\)
- For all \(s, a\)
- \(Q(s, a) = Q(s, a) + \alpha \delta E(s, a)\)
- \(E(s, a) = \gamma \lambda E(s, a)\)
On-policy vs. Off-policy
- SARSA assumes you’re following the same policy that you’re learning.
- It’s possible to follow one policy, while learning from others.
- E.g. learning by observation.
- The policy for learning is the whatif policy.
\[
S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, ..., S_T
\]
\[
\hat{A}_2 \quad \hat{A}_3 \quad \text{hypothetical}
\]
- Modifies learning rule
\[
Q(S_t, A_t) = Q(S_t, A_t) + \alpha (R_{t+1} + \gamma Q(S_{t+1}, A_{t+1}) - Q(S_t, A_t))
\]
- to
\[
Q(S_t, A_t) = Q(S_t, A_t) + \alpha \left( R_{t+1} + \gamma Q(S_{t+1}, \hat{A}_{t+1}) - Q(S_t, A_t) \right)
\]
- Q will actually represent the action value function of the hypothetical policy.
SARSA: Suboptimality
• SARSA: From any state-action \((S, A)\), accept reward \((R)\), transition to next state \((S')\), choose next action \((A')\)
• Use TD rules to update:
\[
\delta = R + \gamma Q(S', A') - Q(S, A)
\]
• Problem: which policy do we use to choose \(A'\)
SARSA: Suboptimality
• SARSA: From any state-action \((S, A)\), accept reward \((R)\), transition to next state \((S')\), choose next action \((A')\)
• Problem: which policy do we use to choose \(A'\)
• If we choose the *current judgment of the best action* at \(S'\) we will become too greedy
– Never explore
• If we choose a *sub-optimal* policy to follow, we will never find the best policy
Solution: Off-policy learning
• The policy for learning is the whatif policy
\[ S_1, A_1, R_2, S_2, A_2, R_3, S_3, A_3, R_4, \ldots, S_T \]
\[ \hat{A}_2 \quad \hat{A}_3 \] hypothetical
• Use the best action for \( S_{t+1} \) as your hypothetical off-policy action
• But actually follow an epsilon-greedy action
– The hypothetical action is guaranteed to be better than the one you actually took
– But you still explore (non-greedy)
Q-Learning
- From any state-action pair $S, A$
- Accept reward $R$
- Transition to $S'$
- Find the best action $A'$ for $S'$
- Use it to update $Q(S, A)$
- But then actually perform an epsilon-greedy action $A''$ from $S'$
Q-Learning (TD(1) version)
- For all \( s, a \) initialize \( Q(s, a) \)
- For each episode \( e \)
- Initialize \( S_1, A_1 \)
- For \( t = 1 \) ... *Termination*
- Observe \( R_{t+1}, S_{t+1} \)
- Choose action \( A_{t+1} \) at \( S_{t+1} \) using epsilon-greedy policy obtained from \( Q \)
- Choose action \( \hat{A}_{t+1} \) at \( S_{t+1} \) as \( \hat{A}_{t+1} = \arg\max_a Q(S_{t+1}, a) \)
- \( \delta = R_{t+1} + \gamma Q(S_{t+1}, \hat{A}_{t+1}) - Q(S_t, A_t) \)
- \( Q(S_t, A_t) = Q(S_t, A_t) + \alpha \delta \)
Q-Learning (TD(\(\lambda\)) version)
• For all \(s, a\) initialize \(Q(s, a)\)
• For each episode \(e\)
– For all \(s, a\) initialize \(E(s, a) = 0\)
– Initialize \(S_1, A_1\)
– For \(t = 1 \ldots\) Termination
• Observe \(R_{t+1}, S_{t+1}\)
• Choose action \(A_{t+1}\) at \(S_{t+1}\) using epsilon-greedy policy obtained from \(Q\)
• Choose action \(\hat{A}_{t+1}\) at \(S_{t+1}\) as \(\hat{A}_{t+1} = \underset{a}{\arg\max} Q(S_{t+1}, a)\)
• \(\delta = R_{t+1} + \gamma Q(S_{t+1}, \hat{A}_{t+1}) - Q(S_t, A_t)\)
• \(E(S_t, A_t) := 1\)
• For all \(s, a\)
– \(Q(s, a) = Q(s, a) + \alpha \delta E(s, a)\)
– \(E(s, a) = \gamma \lambda E(s, a)\)
What about the actual policy?
• Optimal greedy policy:
\[
\pi(a|s) = \begin{cases}
1 & \text{for } a = \arg\max_{a'} Q(s, a') \\
0 & \text{otherwise}
\end{cases}
\]
• Exploration policy
\[
\pi(a|s) = \begin{cases}
1 - \epsilon & \text{for } a = \arg\max_{a'} Q(s, a') \\
\frac{\epsilon}{N_a - 1} & \text{otherwise}
\end{cases}
\]
• Ideally $\epsilon$ should decrease with time
Q-Learning
• Currently most-popular RL algorithm
• Topics not covered:
– Value function approximation
– Continuous state spaces
– Deep-Q learning
– Action replay
– Application to real problem..
|
{"Source-Url": "http://deeplearning.cs.cmu.edu/slides.spring19/RL_4.pdf", "len_cl100k_base": 9854, "olmocr-version": "0.1.53", "pdf-total-pages": 89, "total-fallback-pages": 0, "total-input-tokens": 122085, "total-output-tokens": 13571, "length": "2e13", "weborganizer": {"__label__adult": 0.0005745887756347656, "__label__art_design": 0.0014934539794921875, "__label__crime_law": 0.0006623268127441406, "__label__education_jobs": 0.003709793090820313, "__label__entertainment": 0.000507354736328125, "__label__fashion_beauty": 0.0003387928009033203, "__label__finance_business": 0.0006575584411621094, "__label__food_dining": 0.00072479248046875, "__label__games": 0.01128387451171875, "__label__hardware": 0.0017271041870117188, "__label__health": 0.0009241104125976562, "__label__history": 0.0007600784301757812, "__label__home_hobbies": 0.0003006458282470703, "__label__industrial": 0.0011644363403320312, "__label__literature": 0.0011196136474609375, "__label__politics": 0.0006656646728515625, "__label__religion": 0.001033782958984375, "__label__science_tech": 0.43310546875, "__label__social_life": 0.0002498626708984375, "__label__software": 0.01666259765625, "__label__software_dev": 0.5205078125, "__label__sports_fitness": 0.0008044242858886719, "__label__transportation": 0.0009431838989257812, "__label__travel": 0.0003902912139892578}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 28084, 0.0172]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 28084, 0.41896]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 28084, 0.73345]], "google_gemma-3-12b-it_contains_pii": [[0, 60, false], [60, 60, null], [60, 126, null], [126, 210, null], [210, 302, null], [302, 646, null], [646, 819, null], [819, 967, null], [967, 1178, null], [1178, 1263, null], [1263, 1631, null], [1631, 2129, null], [2129, 2300, null], [2300, 2541, null], [2541, 2849, null], [2849, 3027, null], [3027, 3182, null], [3182, 3468, null], [3468, 3715, null], [3715, 3984, null], [3984, 4246, null], [4246, 4834, null], [4834, 5042, null], [5042, 5316, null], [5316, 5617, null], [5617, 5727, null], [5727, 6231, null], [6231, 6688, null], [6688, 6986, null], [6986, 7258, null], [7258, 7596, null], [7596, 8023, null], [8023, 8381, null], [8381, 8747, null], [8747, 9155, null], [9155, 9466, null], [9466, 9846, null], [9846, 10230, null], [10230, 10502, null], [10502, 10840, null], [10840, 11170, null], [11170, 11678, null], [11678, 11814, null], [11814, 12063, null], [12063, 12363, null], [12363, 12786, null], [12786, 13214, null], [13214, 13433, null], [13433, 13976, null], [13976, 14362, null], [14362, 14599, null], [14599, 14893, null], [14893, 15259, null], [15259, 15752, null], [15752, 15878, null], [15878, 16205, null], [16205, 16472, null], [16472, 16782, null], [16782, 16918, null], [16918, 17037, null], [17037, 17298, null], [17298, 17479, null], [17479, 17617, null], [17617, 17757, null], [17757, 17890, null], [17890, 18086, null], [18086, 18381, null], [18381, 18852, null], [18852, 19213, null], [19213, 19404, null], [19404, 19839, null], [19839, 20203, null], [20203, 20544, null], [20544, 21071, null], [21071, 21789, null], [21789, 22512, null], [22512, 22743, null], [22743, 23264, null], [23264, 23699, null], [23699, 24218, null], [24218, 24907, null], [24907, 25189, null], [25189, 25589, null], [25589, 26030, null], [26030, 26264, null], [26264, 26810, null], [26810, 27496, null], [27496, 27880, null], [27880, 28084, null]], "google_gemma-3-12b-it_is_public_document": [[0, 60, true], [60, 60, null], [60, 126, null], [126, 210, null], [210, 302, null], [302, 646, null], [646, 819, null], [819, 967, null], [967, 1178, null], [1178, 1263, null], [1263, 1631, null], [1631, 2129, null], [2129, 2300, null], [2300, 2541, null], [2541, 2849, null], [2849, 3027, null], [3027, 3182, null], [3182, 3468, null], [3468, 3715, null], [3715, 3984, null], [3984, 4246, null], [4246, 4834, null], [4834, 5042, null], [5042, 5316, null], [5316, 5617, null], [5617, 5727, null], [5727, 6231, null], [6231, 6688, null], [6688, 6986, null], [6986, 7258, null], [7258, 7596, null], [7596, 8023, null], [8023, 8381, null], [8381, 8747, null], [8747, 9155, null], [9155, 9466, null], [9466, 9846, null], [9846, 10230, null], [10230, 10502, null], [10502, 10840, null], [10840, 11170, null], [11170, 11678, null], [11678, 11814, null], [11814, 12063, null], [12063, 12363, null], [12363, 12786, null], [12786, 13214, null], [13214, 13433, null], [13433, 13976, null], [13976, 14362, null], [14362, 14599, null], [14599, 14893, null], [14893, 15259, null], [15259, 15752, null], [15752, 15878, null], [15878, 16205, null], [16205, 16472, null], [16472, 16782, null], [16782, 16918, null], [16918, 17037, null], [17037, 17298, null], [17298, 17479, null], [17479, 17617, null], [17617, 17757, null], [17757, 17890, null], [17890, 18086, null], [18086, 18381, null], [18381, 18852, null], [18852, 19213, null], [19213, 19404, null], [19404, 19839, null], [19839, 20203, null], [20203, 20544, null], [20544, 21071, null], [21071, 21789, null], [21789, 22512, null], [22512, 22743, null], [22743, 23264, null], [23264, 23699, null], [23699, 24218, null], [24218, 24907, null], [24907, 25189, null], [25189, 25589, null], [25589, 26030, null], [26030, 26264, null], [26264, 26810, null], [26810, 27496, null], [27496, 27880, null], [27880, 28084, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, true], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 28084, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 28084, null]], "pdf_page_numbers": [[0, 60, 1], [60, 60, 2], [60, 126, 3], [126, 210, 4], [210, 302, 5], [302, 646, 6], [646, 819, 7], [819, 967, 8], [967, 1178, 9], [1178, 1263, 10], [1263, 1631, 11], [1631, 2129, 12], [2129, 2300, 13], [2300, 2541, 14], [2541, 2849, 15], [2849, 3027, 16], [3027, 3182, 17], [3182, 3468, 18], [3468, 3715, 19], [3715, 3984, 20], [3984, 4246, 21], [4246, 4834, 22], [4834, 5042, 23], [5042, 5316, 24], [5316, 5617, 25], [5617, 5727, 26], [5727, 6231, 27], [6231, 6688, 28], [6688, 6986, 29], [6986, 7258, 30], [7258, 7596, 31], [7596, 8023, 32], [8023, 8381, 33], [8381, 8747, 34], [8747, 9155, 35], [9155, 9466, 36], [9466, 9846, 37], [9846, 10230, 38], [10230, 10502, 39], [10502, 10840, 40], [10840, 11170, 41], [11170, 11678, 42], [11678, 11814, 43], [11814, 12063, 44], [12063, 12363, 45], [12363, 12786, 46], [12786, 13214, 47], [13214, 13433, 48], [13433, 13976, 49], [13976, 14362, 50], [14362, 14599, 51], [14599, 14893, 52], [14893, 15259, 53], [15259, 15752, 54], [15752, 15878, 55], [15878, 16205, 56], [16205, 16472, 57], [16472, 16782, 58], [16782, 16918, 59], [16918, 17037, 60], [17037, 17298, 61], [17298, 17479, 62], [17479, 17617, 63], [17617, 17757, 64], [17757, 17890, 65], [17890, 18086, 66], [18086, 18381, 67], [18381, 18852, 68], [18852, 19213, 69], [19213, 19404, 70], [19404, 19839, 71], [19839, 20203, 72], [20203, 20544, 73], [20544, 21071, 74], [21071, 21789, 75], [21789, 22512, 76], [22512, 22743, 77], [22743, 23264, 78], [23264, 23699, 79], [23699, 24218, 80], [24218, 24907, 81], [24907, 25189, 82], [25189, 25589, 83], [25589, 26030, 84], [26030, 26264, 85], [26264, 26810, 86], [26810, 27496, 87], [27496, 27880, 88], [27880, 28084, 89]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 28084, 0.0]]}
|
olmocr_science_pdfs
|
2024-12-09
|
2024-12-09
|
fe33d7659a018bbb70c1e2af6537d9f6c73bfa50
|
Enhance Virtual-Machine-Based Code Obfuscation Security Through Dynamic Bytecode Scheduling
Kaiyuan Kuang\textsuperscript{a}, Zhanyong Tang\textsuperscript{a}, Xiaoqing Gong\textsuperscript{a}, Dingyi Fang\textsuperscript{a}, Xiaojiang Chen\textsuperscript{a}, Zheng Wang\textsuperscript{b}.
\textsuperscript{a}School of Information Science and Technology, Northwest University, China.
\textsuperscript{b}School of Computing and Communications, Lancaster University, UK
Abstract
Code virtualization builds upon virtual machine (VM) technologies is emerging as a viable method for implementing code obfuscation to protect programs against unauthorized analysis. State-of-the-art VM-based protection approaches use a fixed scheduling structure where the program always follows a single, deterministic execution path for the same input. Such approaches, however, are vulnerable in certain scenarios where the attacker can reuse knowledge extracted from previously seen software to crack applications protected with the same obfuscation scheme. This paper presents Dsvmp, a novel VM-based code obfuscation approach for software protection. Dsvmp brings together two techniques to provide stronger code protection than prior VM-based approaches. Firstly, it uses a dynamic instruction scheduler to randomly direct the program to execute different paths without violating the correctness across different runs. By randomly choosing the program execution path, the application exposes diverse behavior, making it much more difficult for an attacker to reuse the knowledge collected from previous runs or similar applications to launch an attack. Secondly, it employs multiple VMs to further obfuscate the mapping from VM opcode to native machine instructions, so that the same opcode could be mapped to different native instructions at runtime, making code analysis even harder. We have implemented Dsvmp in a prototype system and evaluated it using a set of widely used applications. Experimental results show that Dsvmp provides stronger protection with comparable runtime overhead and code size, when it is compared to two commercial VM-based code obfuscation tools.
Keywords: Code virtualization, Code Obfuscation, Reverse Engineering
\textsuperscript{1}Extension of Conference Paper: a preliminary version of this article entitled “Exploiting Dynamic Scheduling for VM-Based Code Obfuscation” by K. Kuang et al. appeared in the 15th IEEE International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom), 2016 [1]. The extended version makes the following additional contributions over the conference paper: (1) it provides a more detailed description of the background and threat model (Sections 2 and 3); (2) it describes how the virtual interpreter dynamically changes the execution path at runtime using an algorithmic model (Section 6.2 and Algorithm 1); (3) it provides new experimental results to evaluate the overhead of the proposed technique, providing new insights of the approach (Section 9.2); (4) it adds a new experiment to evaluate the diversity of the protected structure at runtime (Section 9.3); (5) it includes new results to compare the proposed approach against two commercial VM protection systems, Code Virtualizer and VMProtect (Section 9.4).
1. Introduction
Unauthorized code analysis and modification based on reverse engineering is a major concern for the software industry. Such attacks can lead to a number of undesired outcomes, including cheating in online games, unauthorized use of software, pirated pay-tv etc. Industry is looking for solutions for this issue to deter reverse engineering of software systems. By making sensitive code difficult to be traced or analyzed, code obfuscation is a potential solution for the problem.
Code virtualization based on a virtual machine (VM) is emerging as a promising way for implementing code obfuscation [2, 3, 4, 5, 6, 7, 8]. The underlying principal of VM-based protection is to replace the program instructions with virtual instructions which attackers are unfamiliar with. These virtual instructions will then be translated into native machine code at runtime to be executed on the underlying hardware platform. Using a VM-based scheme, the execution path of the obfuscated code is controlled by a virtual instruction scheduler. A typical scheduler consists of two components: a dispatcher that determines which instruction is ready for execution, and a set of bytecode handlers that first decode the bytecode\(^2\) and then translate it into native machine code. This process replaces the original program instructions with bespoke bytecode, allowing developers to conceal the purpose or logic of sensitive code regions.
Prior work on VM-based software protection primarily focuses on making a single set of bytecodes more complicate, and uses one single virtual instruction scheduler. This is based on the assumption that the scheduler and the bytecode instruction set are difficult to be analyzed in most practical runtime environments. However, research has shown that this is an unreliable assumption [9] in certain scenarios where an adversary can easily reuse knowledge obtained from other applications protected with the same scheme to perform reverse engineering (termed cumulative attacks in this work). To protect software against cumulative attacks, it is important to have a certain degree of non-determinism and diversity during program execution [10].
This paper presents Dsvmp (dynamic scheduling for VM-based code protection), a novel VM-based code protection scheme to address the problem of cumulative attacks. Our key insight is that it will be more difficult for the attacker to track the application logic if sensitive code regions behave differently in different runs. Dsvmp achieves this by introducing rich non-determinism and diversity to program execution. To do so, it exploits a flexible, multi-dispatched scheme for code scheduling and interpretation. Unlike prior work where a program always follows a single, fixed execution path for the same input across different runs, the Dsvmp scheduler directs the program to execute a randomly selected path for each
\(^2\)A bytecode is the binary form of a virtual instruction.
Email addresses: kky@stumail.nwu.edu.cn (Kaiyuan Kuang), zytang@nwu.edu.cn (Zhanyong Tang), gxq@nwu.edu.cn (Xiaoqing Gong), dyf@nwu.edu.cn (Dingyi Fang), xjchen@nwu.edu.cn (Xiaojiang Chen), z.wang@lancaster.ac.uk (Zheng Wang)
protected code region. As a result, the program follows different execution paths in different runs and exposes an non-deterministic behavior. Our carefully designed scheme ensures that the program will produces a consistent output for the same input despite the execution paths might look differently from the attacker’s perspective. To analyze software protected under Dsvmp, the adversary is forced to use a large number of trail runs to understand the logic of the program. This significantly increases the cost of code reverse-engineering.
Dynamic instruction scheduling in Dsvmp is achieved through a combination of two techniques. Firstly, Dsvmp provides a rich set of bytecode handlers, each of which has a unique control flow, to translate a bytecode instruction to native code. Handlers for a particular bytecode opcode all generate identical native machine instructions for the same input, but their execution paths and data accessing patterns are different from each other. During runtime, our VM instruction scheduler randomly selects a bytecode handler to translate a bytecode to the corresponding native machine code. Since the choice of handlers is randomly determined at runtime for each bytecode instruction and the implementation of different handlers are different, the dynamic program execution path is likely to be different across different executions. Secondly, Dsvmp employs a multi-VM scheme so that various code regions can be protected using different bytecode instruction sets and VM implementations. This further increases the diversity of the program, making it even harder for an adversary to analyze the software behavior or to reuse knowledge extracted from other software products. This is because different products are likely to be protected using different bytecode forms and VM implementations.
The whole is greater than the sum of the parts. These techniques, putting together, enable Dsvmp to provide stronger code protection than any of the VM-based techniques seen so far. We have evaluated Dsvmp on four applications that implement some of the widely used algorithms: “md5”, “aescrypt”, “bcrypt” and “gzip”. Experimental results show that Dsvmp provides stronger protection with comparable runtime overhead and code size when compared to two commercial VM-based code obfuscation tools: Code Virtualizer [3] and VMProtect [4].
This paper makes the following contributions:
- It presents a dynamic scheduling structure for VM-based code obfuscation to protect software against dynamic cumulative attacks.
- It is the first to apply multiple VMs to enhance diversity of code obfuscation.
- It demonstrates that the proposed scheme is effective in protecting real-world software applications.
The rest of this paper is organized as follows. Section 2 introduces the principle of classical VM-based code obfuscation techniques and cumulative attacks scenario. Section 3 describes the VM reverse attacking approach. Section 4 gives an overview of Dsvmp, which is followed by a detailed description of the design in Section 5 and 6. Section 7 uses a case study to demonstrate protection scheme provided by Dsvmp. Evaluation results are presented in Sections 8 and 9 before we discuss the related work in Section 10. Finally, Section 11 presents our work conclusions.
2. Background
2.1. VM-based Code Obfuscation
VM-based code obfuscation often performs at the binary level for an already compiled program. As shown in Figure 1, the obfuscation process typically follows a number of steps. Firstly, the critical code segment to be protected will be extracted from the compiled binary, which will be disassembled into assembly code. Next, the native assembly code will be translated into virtual instructions, i.e. a machine-independent intermediate representation used by our VMs. The translated virtual instructions are functional equivalent to original native code. Then, the generated virtual instructions will be encoded into the bespoke bytecode format. Finally, a new VM section will be linked (or inserted) into the target program where the entry point of the protected code region will be redirected to a function call to invoke the VM to translate the bytecode instructions to native machine code at runtime.
The idea of VM-based code obfuscation is to force the attacker to move from a familiar instruction set (e.g. x86) to an unfamiliar bespoke virtual instruction set, which hopefully will significantly increase the time and efforts for reverse-engineering.
2.2. VM Components.
Our approach follows a classic VM implementation, consisting of a number of components that are shown in step 4 at Figure 1. The context of the native program, which includes information such as local variables, function arguments, the return address etc., will be stored in a register-based VM memory space called VMContext. When entering the VM, the VMinit component saves the native program context and initializes the VMContext. After executing the protected code segment, VMExit restores the native program context, and then returns the program control back to the original program to continue executing native machine code.
At the heart of the VM is an interpreter consisting of a dispatcher and a handler set described as follows. The dispatcher fetches a bytecode that is ready to be executed, decoding the fetched bytecode (by parsing the opcode and the operand), and then assigning a handler
Figure 2: Diversity affects the attack effectiveness. In this example, a dark small square represents reusable attacking knowledge. Diverse program execution increases the difficulty for performing reverse-engineering based attacks.
(from a collection of handlers that can be used to interpret the bytecode) to translate the fetched bytecode to native machine code. This process iterates until all the bytecode of the target protected code region are executed. For the attacker’s perspective, the key to understand the logic of the protected code region is to find out how bytecode or virtual instructions are mapped into native machine code.
### 2.3. The Design Goal
Figure 2 gives a high-level abstraction on how an attacker can reuse knowledge extracted from the previous runs of the same application or other applications protected under the same VM scheme to perform reverse-engineering. This kind of attacks is referred as cumulative attacks in this paper.
In the first scenario, the software always follows the same execution path across multiple runs. Under this setting, the attacker may be able to obtain sufficient knowledge on the program behavior in a few trial runs. In the second scenario, the program execution path changes across different runs. As such, it will take longer and many more runs to gather enough information to perform the attack. As can be seen from this simple illustration, diversity is key for us to protect software against dynamic cumulative attacks. This is the aim of this work, to improve the diversity of program executions for code obfuscation. It is to note that like any other code protection techniques, our approach could also be exploited by malware. How to prevent this is out of the scope of this work.
### 3. The Attack Model
#### 3.1. Attacking methods
The classical approach to reverse engineer a VM-protected program typically follows three steps [9, 11], described as follows. The first step is to understand how each components of a VM interpreter works. To do so, the attacker needs to locate these components and analyze how the dispatcher schedules bytecode instructions for interpretation. The second step is to understand how each bytecode is mapped to machine code and work out the
semantics of the bytecode instructions, i.e. how will a bytecode opcode be translated into a native machine instruction. The third step is to use knowledge obtained in the first two steps to recover the logic of the target code region, through e.g. removing the redundant information and generating a simplified program that is equivalent to the original program.
To perform such an attack, a significant portion of the time will have to spend in analyzing the working mechanism of the VM. The problem is that a skilled attacker could reuse knowledge gathered from parts of the program to analyze other protected code regions of the same program, or other applications protected using the same VM scheme and bytecode instructions.
3.2. The Threat model
Our attack model assumes that the attacker has the necessary tools and skills to implement the above reverse-engineering based attacks. We assume that the adversary holds an executable binary of the target software and can run the program in a control environment [12]. We also assume that the adversary can access content stored in memory and registers, trace and modify program instructions and control flows. All these can be achieved using sophisticated profiling and analysis tools like “IDA” [13], “Ollydbg” [14] and “Sysinternals suite” [15]. The aim of the adversary is to completely reverse the internal implementation of the target program. Our goal is to increase the difficulties in terms of time and efforts for an adversary to reverse the target program implementation protected using VM-based code obfuscation.
4. Overview of Our Approach
To address the problem of cumulative attacks, we want to introduce a certain degree of diversity and non-determinism to the program execution. This is achieved through using a diversified scheduling structure (Section 5) and multiple VMs (Section 6). Like any VM-based protection schemes, Dsvmp should be used to protect the most critical code regions but not the entire program, in order to minimize the runtime overhead. Our current implementation targets the Intel x86 instruction set but the methodology itself can be applied to other instruction sets and hardware architectures. Figure 3 depicts the system architecture of Dsvmp. Code protection of Dsvmp follows several steps described as follows.
**Code translation.** Dsvmp takes in a compiled program binary. It does not require having access to the source code. Code segments need to be protected are given by providing the symbolic name of the target functions or the start and end addresses of a code block. The code segments are firstly converted into native machine assembly code (e.g. x86 instructions) using a disassembler (Step 1). The assembly code will then be mapped into a set of virtual instructions, i.e. the intermediate language used by the VM (Step 2). The virtual instructions will then be stored in a bytecode format.
**Diversifying.** As a departure from prior work on VM-based code obfuscation, Dsvmp employs multiple VM instruction scheduling policies. Each virtual instruction scheduler can have multiple dispatchers and bytecode handlers. Dsvmp provides a set of handlers that are semantically equivalent but are implemented in different ways for a single virtual instruction. Thus, the scheduler can dynamically determine at runtime which of the handlers is used to decode a bytecode (i.e., the encoding scheme of the virtual instruction which includes the opcode and operand) and to interpret a virtual instruction. Multiple handlers are generated by applying obfuscation to a set of seed handlers (Step 5). The way the handlers are obfuscated could be different for different code regions. Dsvmp also employs a multi-VM scheme by providing more than one VM implementation. Therefore, each handler will be obfuscated for each VM by using the deformation engine (i.e., a obfuscation toolkit), resulting in \( n \) (i.e., the number of VMs) sets of semantically equivalent handlers with different implementations and control flows (Step 4). Next, the virtual instructions will be encoded into an unique bytecode form for each VM, so that the same opcode from different VMs will be mapped into different native machine instructions to protect against static analysis. Our preliminary implementation provides two sets of bytecode in a VM. Therefore, each virtual instruction can be encoded into two different sets of bytecode forms in a VM (Step 5). After these steps, Dsvmp essentially provides multiple VMs, where each VM contains one set of bytecode handlers (so that a virtual instruction can be interpreted by multiple handlers), while the instructions of the protected code regions are stored in different bytecode forms (Step 6).
**Code generation.** Finally, a new section will be inserted into the program binary, which contains \( n \) VMs and their components such as dispatchers, VMContext etc. Because the size of the generated VM code and virtual instructions is typically larger than the protected code region, and a PE file on disk, each section follow a certain file alignment value (512...
Figure 4: The execution flow of the new handler, each bytecode handler has a control unit that randomly determines whether the control after exiting the handler should be given to a dispatcher or an alternative bytecode handler.
5. Dsvmp Scheduling Structure
The Dsvmp VM scheduler uses multiple dispatchers to determine which bytecode instruction should be interpreted at given time. A unique design of Dsvmp is that the dispatcher used to schedule bytecode handlers is dynamically changed at execution time. To further increase the diversity of the program’s behaviour, Dsvmp also uses multiple bytecode instruction sets and bytecode handlers.
5.1. Multiple Bytecode Handlers
In classical VM-based code obfuscation, a single dispatcher is responsible for fetching a bytecode instruction, and then determining which bytecode handler to use by examining the opcode of the bytecode instruction. Because each bytecode instruction is decoded by a fixed handler set, an adversary can easily work out the mapping from an opcode to its handler. From the mapping, the adversary can correlate the native machine code to each bytecode to analyze the program behavior and the logic structure.
To address this issue, for each bytecode handler, we use obfuscation techniques to automatically generate a number of alternative implementations which all produce an equivalent output for the same input instruction. Different implementations, however, are programmed in different ways using e.g. different control flows, data structures or obfuscation methods.
To control the program execution path, we insert a control unit at the end of each bytecode handler. Before exiting a bytecode handler, the control unit randomly determines whether the control should be given back to a dispatcher or another handler. Figure 4 shows an example of the control unit of a Dsvmp bytecode handler. When the main function of the handler is finished, the control unit randomly switches to one of the branches. At the first branch, the “lods” (a load operand in the x86 assembly) instruction first fetches an offset value from Offset Bytecode to calculate the address of the nest bytecode handler, and
Figure 5: Our approach employs multiple dispatchers together with a control unit to schedule the handlers. In this example, the type of handlers and the order for invoking the handlers could be different across execution runs. The “XX” in bytecode refers to the parameters. Underlined two bytecodes is handler43 encoding results in two types of Bytecode respectively.
then jump to execute it. By contrast, the instruction at another branch will return to a dispatcher. Figure 5 shows two different dynamic scheduling results. Under the instruction of the control unit, a handler can either be invoked by a dispatcher or a handler. The Offset Bytecode here is different from the usual standard bytecode, which is designed to drive the handler’s dispatch function, and we will describe it in detail in the next section.
5.2. Multiple Bytecode Formats and Dispatchers
Bytecode Formats. Using VM-based obfuscation, native machine code of the protected code regions will be translated into virtual instructions and stored in a bytecode format. A handler will be chosen to decode the bytecode instruction to translate it back to native machine code at runtime. In classical VM-based code obfuscation approaches, there is one-one mapping from a bytecode opcode to a handler, i.e. the bytecode opcode determines which handler to be used. Having multiple bytecode instruction sets for different code regions of a target program can provide stronger protection. By doing so, the same opcode from different code region will have different semantic meanings. This is because the same opcode from different regions can be mapped to different handlers (and hence different native machine code implementations). For this reason, the virtual instructions of different code regions will be stored in different bytecode formats.
Our current implementation uses two bytecode formats for each VM, namely Standard Bytecode and Offset Bytecode. Additional bytecode formats can be easily added to our system. Here, Standard Bytecode is a standard bytecode format where each bytecode consists of the virtual instruction’s opcode and their operands. Instructions encoded as Standard Bytecode will be fetched and executed by the dispatcher. Offset Bytecode uses a different encoding scheme, which is fetched by the handler’s control unit. Each Offset Bytecode
\[ \text{Standard Bytecode: } 02 \ XX 01 \ 21 \ XX 43 \ 20 \ldots \]
\[ \text{Offset Bytecode: } 02 \ XX 93 \ 20 \ XX 22 \ 71 \ldots \]
consists of the offset IDs of two handlers (e.g. handler21 and handler43 in Figure 5 has an offset ID of 22) and their operands respectively. Recall that a control unit is inserted to the end of each handler to determine whether the control should be given back to the dispatcher or another handler. Before exiting the current handler, if the control unit chooses to execute the next handler, it will fetch the corresponding offset ID from Offset Bytecode. The offset ID will then be used to calculate the id of the next handler to execute.
**Dispatchers.** Dsvmp also provides multiple dispatchers to further increase the diversity of program execution. As an example, considering Figure 5 which shows two possible program execution paths using three dispatchers within a single VM. As can be seen from the diagram, each time when a different dispatcher is chosen, a handler can either be invoked by a dispatcher or another handler; and the type of handlers to be invoked could be different in two different execution runs. As a result, knowledge about the program control flow extracted from the first run does not apply to the second one.
6. Multiple VMs
In contrast to classical VM-based obfuscation approaches that uses a single VM (termed SVM), Dsvmp uses multiple VMs. Multiple VMs offer different sets handlers and bytecode instruction sets. Under such settings, bytecode instructions can be scheduled from different VMs and a virtual instruction can be interpreted by more than one handler. Therefore, there will be more than one possible mapping from a bytecode instruction to a handler. Together with the multiple scheduling approach described above, Dsvmp can further increase the diversity and uncertainly of program execution.
6.1. Switching between Multiple VMs
The number of VMs to use is a parameter provided by Dsvmp. This can be configured by the user. This number can vary depending on the target program to be protected, and the trade-off between the protection strength and runtime overhead. As described in Section 5.2, we generate a set of handlers for each VM so that we have \( n \) different sets of handlers for \( n \) VMs. Our current implementation also translates the virtual instructions of each handler set to stored as two different sets of bytecode. Different bytecodes will have different semantics in different VMs. Therefore, there are more than a bytecode that can be translated by different handlers in different VMs.
Our system dynamically determines which VM to use at runtime. This is done through altering the structure of the instruction dispatcher that decides which VM to use at runtime. Figure 6 shows an example of the new dispatcher structure, which has a VM switch unit that can randomly select one of the multiple VMs to use. To do so, The switching unit first randomly selects one VM among the multiple VMs (lines 1-7), and then modifies the virtual program counter (VM PC) to point to the target VM (lines 8-10). Our implementation uses the x86 ESI register as a VM PC to store the address of the next bytecode instruction. Other registers can also be used for this purpose. Finally, the dispatcher fetches a bytecode according to the modified VM PC and dispatches the handler to interpret it in the corresponding
VM (lines 11-16). The VM, the set of bytecode handlers and bytecode instructions will be randomly switched across different code regions in both a single execution and across different program runs.
6.2. The VM Scheduling Process
Our dynamic scheduling is achieved through two control units: (1) a structure control unit to randomly determine whether the execution control should be given to a dispatcher or another bytecode handler, (2) a VM switching unit to randomly select a VM to use. Having these two control units to switch the execution path of virtual instruction interpretation can greatly increase the diversity of the program behavior when compared to existing approaches that have a single, fixed scheduling structure.
Our dynamic scheduling scheme is described in Algorithm 1. Bytecodes of a code region will be executed one after one in sequential order. The virtual interpreter fetchs a bytecode from Standard Bytecode and dispatchs a handler to interpret the bytecode (lines 5-6). After executing the bytecode, the control unit will randomly decide whether the control should be given back to a bytecode dispatcher or a VM handler (line 7). If the control is given back to a bytecode dispatcher (lines 8-11), a dispatcher and a VM will be randomly chosen to execute a bytecode from Standard Bytecode. If the control is directed to another bytecode handler (lines 12-13), the program will execute the next bytecode from Offset Bytecode . The process continues until all the virtual instructions of the protected code region have been executed.
7. An Example
We use a short x86 code snippet shown in Figure 7 as an example to illustrate how Dsvmp operates. In this example, “STARTSDK” and “ENDSK” are used to mark the begin
Algorithm 1 Virtual Interpreter’s Work Flow
1: VMInit
2: Switcher selects a VM randomly
3: Fetch a bytecode from Standard Bytecode in current VM
4: while bytecode ≠ ∅ do
5: Decode the bytecode
6: Select a handler to interpret the bytecode
7: i = handler_exit_address
8: if i == dispatcher then
9: Select a dispatcher randomly
10: Switching unit selects a VM randomly
11: Fetch the next bytecode from Standard Bytecode from the selected VM
12: else {i == handler}
13: Fetch the next bytecode from Offset Bytecode in the current VM
14: end if
15: end while
16: VMExit
Figure 7: Example assembly code snippet for a code region to be protected.
and end of the code region respectively, and “00401036” and “00401038” are the address of two assembly instructions.
7.1. Code obfuscation
Table 1 shows the resulted obfuscated code for the code example given in Figure 7. Firstly, Dsvmp extracts the target code region and disassemble it into native instructions. Dsvmp inserts two additional instructions (“push 0x40103b” and “ret”) at the end of the protected code region, in order to jump back to execute the native code. It then converts the native instructions to virtual instructions based on a translation convention. Dsvmp’s bytecode instructions are based on a stack machine model. Here the load instruction is used to push operands into the stack, and the store instruction is used to pop results out from the stack and store the result to the virtual context (VMContext).
After translating the native code to virtual instructions, we use the deformation engine to transform the initial bytecode handlers set. For this example, our implementation provides two VM configurations, so we generate two sets of bytecode handlers which are semantically equivalent but are implemented in different ways. Then, we randomly shuffle the serial numbers of these handlers, resulting in two new sets of handlers: HAS1 and HAS2. Each set of bytecode handlers is associated with two bytecode instruction sets: Standard Bytecode
Table 1: Generated virtual instructions for the example shown in Figure 7
<table>
<thead>
<tr>
<th>Instr.1</th>
<th>Instr.2</th>
<th>Instr.3</th>
<th>Instr.4</th>
</tr>
</thead>
<tbody>
<tr>
<td>NI</td>
<td>mov eax, ebx</td>
<td>sub eax, 0x03</td>
<td>push 0x40103b</td>
</tr>
<tr>
<td></td>
<td>move 0x08</td>
<td>load</td>
<td></td>
</tr>
<tr>
<td></td>
<td>move 0x04</td>
<td>store</td>
<td></td>
</tr>
<tr>
<td>VI</td>
<td>load 0x03</td>
<td>sub</td>
<td>move 0x04</td>
</tr>
<tr>
<td></td>
<td>store</td>
<td></td>
<td>store</td>
</tr>
</tbody>
</table>
Notes: In the table, “NI” indicates the native x86 instructions, and “VI” donates the virtual instructions. Here, our system inserts “Instr.3” and “Instr.4” in order to jump back to execute the native code after returning from the protected code region.
(Set11) and Offset Bytecode (Set12) for HSA1 and Standard Bytecode (Set21) and Offset Bytecode (Set22) for HSA2. The resulted program is illustrated in Figure 8. We store the virtual instructions as bytecode. Because the resulted code size is larger than the original code and hence cannot simply be used to replace the original instructions. For this reason, we simply fill the original code region with junk instructions.
Finally, Dsvmp creates a new code section attached to the end of the target program. The new code section contains the implementation of the handlers, different sets of bytecode instructions, dispatchers and other VM components such VMContext and routines such as VMInit (used to initialize the VM) and VMExit (use for cleaning up the context before exiting the VM).
7.2. Runtime execution
Runtime execution of the protected code region is illustrated in Figure 8, which follows a number of steps:
- **Step 1:** The entry of the protected code segment contains an “jmp VMInit” instruction. This transfers the control to the VM initialization routine, VMInit, which saves the native host context and initializes the virtual context, VMContext.
- **Step 2:** Next, a dispatcher is used to schedule the virtual instructions. It randomly selects a VM (the example shown in Figure 8 assumes that VM2 is chosen at beginning) and then it fetches a bytecode from the Standard Bytecode, Set21. After decoding the bytecode, the dispatcher gets an operand, “6a”, which directs the dispatch to jump to execute another handler, “0x6aHandler”.
- **Step 3:** A control unit is executed (see Section 5.1) before exiting the “0x6aHandler” handler. The control unit determines at runtime whether to execute another handler or to return the control to the dispatcher. If it chooses to return the control to the dispatcher, the program execution moves to Step 5.
- **Step 4:** Assume that the control unit decides to execute the next handler. It will fetch a bytecode from Offset Bytecode, Set22. Adding the offset of 22 to the current handler “0x6aHandler” gives the address (0x85) of the next handler “0x85Handler”. The
control unit will then jump to execute "0x85Handler". After executing this handler, the program execution loops back to Step 3.
- **Step 5:** If the control unit chooses to return the control to a dispatcher, it will randomly select a dispatcher to continue the execution. Then, the program moves to Step 6.
- **Step 6:** The selected dispatcher randomly selects one of the VMs to use. The dispatcher fetches a bytecode from the selected VM, decoding it to get the handler's address. It then jumps to execute the handler. After executing the handler, the program goes back to Step 3.
- **Step 7:** Steps 3 and 4 are iterated until all the virtual instructions get executed. The finally step is to invoke the VMExit procedure to restore the native execution context to continue executing the rest native code of the program.
8. Security Strength Analysis
In this section, we evaluate the security strength of Dsvmp. We first analyze the number of possible execution paths, showing that Dsvmp can significantly increase the diversity and non-determinism of program execution. Then, we discuss how Dsvmp can enhance the diversity of code structures.
8.1. Program execution paths
Recall that our design goal is to increase the diversity of program execution, so that in different runs the protected region does not follow a single execution path across runs. To make the analysis concrete, we assume that there are 10 different dispatchers, which is the standard setting in the current implementation of Dsvmp. We use the example presented in Section 7 as a case study. In this example, Standard Bytecode has 103 bytes of data. They contain a total of 78 handler serial numbers. In this analysis, we exclude the last handler because of it is used to exit the VM and will always get executed. This leave us 77 handlers
where each handler can lead to 11 different execution paths. This is because at the end of executing each handler, a control unit will determine whether the control should be given to another handler or one of the 10 dispatchers (see Section 5.1) – 11 possibilities in total.
In combination, these options give \(11^{77}\) possible execution paths for each protected code region. Therefore, the probability, \(p\), for a protected code region to follow the same execution path across different runs is \(p = \frac{1}{11^{77}}\), a small possibility. It is to note that so far we have assumed that the protection scheme uses just one VM. The multi-VM strategy employed by Dsvmp can further increase the number of possible execution paths. This is because the more dispatchers and VMs are, the greater number of possible execution paths will be. For example, if the Dsvmp implementation provides five different VMs, then each dispatcher can randomly select one VM among the 5 VMs; as a result, each handler can lead to 51 (= 10 * 5 + 1) different execution paths. Together with multiple dispatchers and bytecode instruction strategies, for the setting used in this discussion, Dsvmp gives a single code region 51^{77} possible execution paths.
In summary, we can conclude that for a single code region protected by Dsvmp, its possible execution path number, \(m\), and the probability of its execution of the same execution path across different runs, \(p\), respectively are:
\[
m = (N_D \times N_{VM} + 1)^n, \quad p = 1/m.
\]
where \(N_D\) represents the number of dispatcher, \(N_{VM}\) is the number of VMs, and \(n\) is the number of handler scheduling options. Given the massive number of choices, it will be unlikely for a protected code region to follow the same execution path across different runs.
8.2. Code structures
Having a diverse code structure is key to prevent an adversary from reusing knowledge obtained from other software to launch a new attack. In other words, we would like the code structures of the obfuscated program’s to be as dissimilar from the original program’s as possible.
Blietz et al. [17] proposed a method to measure the similarity of program structures. Their method is based on the control flow information such as the number of branches and back blocks, the nesting level of the code etc. We adopt the metrics from [17] to analyze code structures for programs protected using Dsvmp. We use a number of metrics to quantity the code structure. These metrics are:
- **NodeNum**: the number of basic blocks of the protected region.
- **BranchNum**: the number of basic blocks where the last instruction is a conditional jump instruction.
- **\(DR(Vi)\)**: the number of in and out instructions for the basic block, \(Vi\). This metric is defined as \(DR(Vi) = D_{in}(Vi) + D_{out}(Vi)\) where \(D_{out}(Vi)\) refers to the out-degree and \(D_{in}(Vi)\) refers to the in-degree and they mean the number of arcs that start or end at \(Vi\).
Table 2: The relevant information about the program
<table>
<thead>
<tr>
<th>Basic info of program</th>
<th>Info of protected-software</th>
</tr>
</thead>
<tbody>
<tr>
<td>program</td>
<td>program key code segment</td>
</tr>
<tr>
<td>A</td>
<td>mov eax, ebx</td>
</tr>
<tr>
<td>B</td>
<td>pop eax, ebx3</td>
</tr>
</tbody>
</table>
Notes: In the table, the number of \( n \) which in \( \sum_{i=0}^{n} DR(i) \) and \( \sum_{i=0}^{n} DF(i) \) are equal to the NodeNum.
- \( DF(Vi) \): the data flow relationship of basic block, \( Vi \). This is used to measure the frequency of \( Vi \)’s information exchange. It is defined as \( DF(Vi) = Flow_{in}(Vi) + Flow_{out}(Vi) \), where \( Flow_{in} \) is the number of reading instruction in \( Vi \) and \( Flow_{out} \) is the number of writing instruction in \( Vi \).
8.2.1. Example
Table 2 illustrates two code segments to be protected. These two code snippets have very similar structures because they both have one basic block and there is no branch within the basic block. As can be seen from the table, the code transformation applied by Dsvmp leads to significant variances in the metric values. This indicates that the transformed code segments have distinct code structures. The metric value calculation is described as follows.
We use the following formula to quantify the code structure information, \( SInfor_X \), for a given piece of code, \( X \), after code obfuscation.
\[
SInfor_X = NodeNum_X + BranchNum_X + \sum_{i=0}^{i<n} (DR(i) + DF(i))
\]
Applying this formula to the transformed code segments, \( A' \) and \( B' \), listed in Table 2, we get:
\[
SInfor_{A'} = NodeNum_{A'} + BranchNum_{A'} + \sum_{i=0}^{i<n} (DR(i) + DF(i))
= 23 + 5 + (46 + 18)
= 92
\]
\[
SInfor_{B'} = NodeNum_{B'} + BranchNum_{B'} + \sum_{i=0}^{i<m} (DR(i) + DF(i))
= 48 + 9 + (96 + 36)
= 189
\]
From \( SInfor_{A'} \) and \( SInfor_{B'} \), we can calculate the similarity \( SDiff \), for the two piece of code, \( A' \) and \( B' \), as:
\[
SDiff = \frac{|SInfor_{A'} - SInfor_{B'}|}{SInfor_{A'} + SInfor_{B'}} = \frac{97}{281} = 34.5\%
\]
### Table 3: Information of the benchmarks
<table>
<thead>
<tr>
<th>program</th>
<th>Size(KB)</th>
<th>Instr. Total</th>
<th>Function to protect</th>
<th>Instr. Protect</th>
<th>Instr. Executed</th>
</tr>
</thead>
<tbody>
<tr>
<td>md5</td>
<td>11</td>
<td>1357</td>
<td>Transform()</td>
<td>563</td>
<td>229141</td>
</tr>
<tr>
<td>aescrypt</td>
<td>142</td>
<td>9788</td>
<td>encrypt-stream()</td>
<td>1045</td>
<td>478297</td>
</tr>
<tr>
<td>bcrypt</td>
<td>68</td>
<td>3081</td>
<td>Blowfish-Encrypt()</td>
<td>54</td>
<td>1050003</td>
</tr>
<tr>
<td>gzip</td>
<td>56</td>
<td>9837</td>
<td>deflate()</td>
<td>154</td>
<td>680037</td>
</tr>
<tr>
<td>astar</td>
<td>281</td>
<td>29036</td>
<td>SearchPath()</td>
<td>156</td>
<td>19589</td>
</tr>
<tr>
<td>tetris</td>
<td>37</td>
<td>4386</td>
<td>ClearRow()</td>
<td>73</td>
<td>10942</td>
</tr>
</tbody>
</table>
Notes: The 3rd column shown the total number of target program instructions. The 4th column of the table gives the function to be projected and the 5th column shows the number of instructions of the function. The number of instructions got executed with the critical functions while processing the test file, and shown in the last column of the table.
Therefore, the quantified code structure similarity between \( A' \) and \( B' \) is 34.5%. This example shows that DSVMP can significantly increase the dissimilarity of code structures even for simple code segments.
9. Performance Evaluation
We now evaluate the performance of DSVMP using six applications and compare it with two commercial VM-based protection systems.
9.1. Evaluation Platform and Benchmarks
We evaluated DSVMP on a PC with an 3.0 GHz Intel Core-i3 Duo processor and 8GB of RAM. The PC runs the Windows 10 operating system.
We evaluated our approach using four widely use applications, md5, aescrypt, bcrypt, gzip. We used these applications to process a test text file. The size of the file is 26 KB. In addition to the four applications, we also evaluate our approach on two interactive gaming applications: “AStar”, a maze pathfinding game using the A* algorithm, and “Tetris”, a classic graphics combination game [18]. Figure 9 shows the “AStar” maze barrier setting and route finding results, and the clear row operations of “Tetris”. Table 3 gives some information of the protected code regions for each benchmark. The total number of target program instructions are shown in the 3rd column in Table 3. The 4th column of the table gives the function to be projected and the 5th column shows the number of instructions of the function. Finally, we use the Intel Pin tools [19] to calculate the number of instructions get executed within the protected functions while processing the test file. The result is shown in the last column of the table.
9.2. Code Size and Runtime Overhead
9.2.1. Code size
For each target benchmark, we will choose a core function to protect. We do so by inserting a set of specific SDK (“STARTSDK” and “ENDSDK”) at the beginning and end of the target function in the compiled program binary. We applied Dsvmp to the target function and repeated the process for 10 times. For each protection run, we used a different number of VM configurations.
Figure 10 shows how the Dsvmp multi-VM scheme affects the code size. As described before, each VM has two bytecode instruction sets and one set of handlers; therefore, it is
Figure 9: The interaction interface of the “AStar” and “Tetris”.
Figure 10: The impact of code sizes for DSVMP configurations with a different number of VMs. The number of horizontal axis is the configuration of the VMs, “0” is the original program.
not supervising that the code size of the protected program grows as the number of VM increases. In general, the code size grows as the number of VMs increases, because the block of PE executables are usually follow a certain alignment value (such as, 4096 or 512 byte) [16]. Moreover, we can see that there is a strong correlation between the code size and the number of protected instructions. This is why the code size of “aescript” grows fastest than others – as it has the largest number of protected instructions (see Table 3). For the same reason, the code size of “bcrypt” grows slower than other programs, as this benchmark has the least number of protected instructions. Overall, the code size growth (a few hundreds KB in our experiments) is modest as typically we only need to protect the core function or a core algorithm of an application.
9.2.2. Runtime overhead
To evaluate the runtime overhead of DSVMP, we used benchmark to process the test file. For each protected benchmark we repeated the process for 10 times and report the average runtime per benchmark. For “AStar” and “Tetris”, in order to eliminate the user
Figure 11: The average runtime of target benchmark when protected with different VMs. The number of horizontal axis is the configuration of the VMs, “0” is the original program. Because the runtime overhead of “AStar” and “Tetris” is much smaller than the other four benchmarks, in particular, their experimental data are shown separately in (b) in order to observe their variation.
### Table 4: Possible execution path statistics
<table>
<thead>
<tr>
<th>Basic configuration</th>
<th>$N_D$</th>
<th>$N_{VM}$</th>
<th>$m_1$</th>
<th>$m_2$</th>
<th>$m_3$</th>
<th>$m_4$</th>
<th>$m_5$</th>
<th>$m_6$</th>
<th>$m_7$</th>
<th>$m_8$</th>
</tr>
</thead>
<tbody>
<tr>
<td>md5</td>
<td>5</td>
<td>6175</td>
<td>$6^{175}$</td>
<td>$11^{6175}$</td>
<td>$16^{6175}$</td>
<td>$21^{6175}$</td>
<td>$26^{6175}$</td>
<td>$31^{6175}$</td>
<td>$36^{6175}$</td>
<td>$41^{6175}$</td>
</tr>
<tr>
<td>aescrypt</td>
<td>5</td>
<td>8014</td>
<td>$6^{8014}$</td>
<td>$11^{8014}$</td>
<td>$16^{8014}$</td>
<td>$21^{8014}$</td>
<td>$26^{8014}$</td>
<td>$31^{8014}$</td>
<td>$36^{8014}$</td>
<td>$41^{8014}$</td>
</tr>
<tr>
<td>bcrypt</td>
<td>5</td>
<td>585</td>
<td>$6^{585}$</td>
<td>$11^{585}$</td>
<td>$16^{585}$</td>
<td>$21^{585}$</td>
<td>$26^{585}$</td>
<td>$31^{585}$</td>
<td>$36^{585}$</td>
<td>$41^{585}$</td>
</tr>
<tr>
<td>gzip</td>
<td>5</td>
<td>1271</td>
<td>$6^{1271}$</td>
<td>$11^{1271}$</td>
<td>$16^{1271}$</td>
<td>$21^{1271}$</td>
<td>$26^{1271}$</td>
<td>$31^{1271}$</td>
<td>$36^{1271}$</td>
<td>$41^{1271}$</td>
</tr>
<tr>
<td>astar</td>
<td>5</td>
<td>1502</td>
<td>$6^{1502}$</td>
<td>$11^{1502}$</td>
<td>$16^{1502}$</td>
<td>$21^{1502}$</td>
<td>$26^{1502}$</td>
<td>$31^{1502}$</td>
<td>$36^{1502}$</td>
<td>$41^{1502}$</td>
</tr>
<tr>
<td>tetris</td>
<td>5</td>
<td>606</td>
<td>$6^{606}$</td>
<td>$11^{606}$</td>
<td>$16^{606}$</td>
<td>$21^{606}$</td>
<td>$26^{606}$</td>
<td>$31^{606}$</td>
<td>$36^{606}$</td>
<td>$41^{606}$</td>
</tr>
</tbody>
</table>
Notes: The specific calculation process is described in section 8. Where $N_D$ is the number of dispatcher, $N_{VM}$ is the number of VMs, and $n$ is the number of handler scheduling.
interaction delay, we only calculate and collect the average runtime of the target operations (pathfinding and row clear).
The results are depicted in Figure 11. We see an increase on the runtime overhead when using multiple VMs but the overhead becomes stable from 3 VMs onward. which shows that the majority of average runtime. Except for the handler’s normal interpretation of the time spent on the execution, the main runtime overhead comes from the the switch time between different VMs. The overhead of VM switch is stable so that it does not significantly increase when using 3 or more VMs. We notice that the overhead of VM switch for using two VMs is not significant. This is because our scheme does not frequently switch the VM under a 2-VM configuration. Besides, we found that the greater the number of protected instructions get executed at runtime the greater the runtime overhead will be. This explains why “bcrypt” has a much higher runtime overhead than other benchmarks.
9.3. Structural diversity
9.3.1. Possible execution path statistics
In the previous section, we have discussed how to calculate the number of optional execution paths for a code region protected by DSVMP (see Section 8.1). We adjust the output of the protection system to collect the number of handlers that need to be scheduled
for different benchmarks. We then calculate the values of $m$ under different configurations for these benchmarks, based on the formula presented at Section 8.1. Detailed experimental data are shown in Table 4. From the experimental data, we can clearly see that the number of optional paths for each benchmark is a huge number, and the program protected by Dsvmp rarely follows the same execution path across different runs. At the same time, through the previous experimental data we found that the number of runtime instructions for the target code is much larger than the number of its original instructions (see Table 3). This is because the critical method is executed multiple times at runtime. Therefore, even in a single run for a program protected by Dsvmp, calls to the critical function is likely to follow different execution paths during a single run.
9.3.2. Multi-VM switching experiment
In order to evaluate the impact of multi-VM switching on program execution, we conduct experiments on using a micro-benchmark, test.exe. Here we only protect one instruction “mov eax, 1234567” of the application, in order to isolating other scheduling effects. In this experiment, we do not perform handler obfuscation and used only one dispatcher in the protection process. This can minimize the impact of irrelevant factors. We use three VM configurations, 2-VM, 3-VM and 4-VM, to protect the target program. For each configuration, we run the program execution 5 times to collect the relevant information.
Figure 12 (a) shows the VM switching frequency information of test.exe for the five runs. We observe that the frequency of VM switching is low when 2 VMs are use. However, the frequency increases by 75% when 3 or 4 VMs are used. Through the experiment we found that the impact of 2-VM on the number of instructions gets executed at runtime is less than 3-VM and 4-VM. This is depicted in Figure 12 (b). Essentially, the number of instructions gets executed can reflect the runtime overhead. This explains why the 2-VM configuration has a smaller effect on runtime overhead in Figure 11.
4 A 3KB application that pops up a confirmation box.
---
Figure 12: (a) is the probability distribution of multiple VMs switching for multiple runs. The legend “switch” donates the number of times a VM has been switched to another, and the “no switch” means the VM remains unchanged. (b) is the number of instructions changes across runs due to the VM switch.
9.3.3. Perform path runtime diversity
In the course of the above experiment, we also collected the ID of the VM where the handler was executed each time. Figure 13 shows the switching of the VM for three runs. The data in (a) and (b) are from the test program with 3-VM and 4-VM configurations, respectively.
As can be clearly seen in the figure, VMs are randomly selected across different runs, and the execution path of the 3 runs is not the identical. For each dispatch loop, the dispatcher will randomly selects a VM to enter and schedules the corresponding handler. As mentioned before, the handlers set in each VM is obfuscated with different obfuscation schemes. Thus, the internal structure of the handler dispatched from different VMs during each run is different. The experimental results show that the execution path of a protected program exhibit strong diversity. Combined with various handler sets, the target program protected by Dsvmp will have temporal diversity [10].
9.4. Comparisons with state-of-the-arts
We also compared Dsvmp against two commercial VM protection systems, Code Virtualizer (CV) [3] and VMProtect (VMP) [4], in terms of code sizes and runtime overhead. We adopt a customized protection scheme when using CV to protect the target program. Specifically, this scheme uses the Medium opcodes obfuscation options, and does not use the “Strip Relocation”, “Re-Virtualization” and other additional code obfuscation schemes. Doing so allow us to keep the runtime and code-size overhead of the CV scheme at a moderate level, in order to provide a fair comparison. For VMP, we use two types of schemes to protect the target program, Maximum-protection which provides the strongest protection (noted as VMProtect-Maximum-protection), and Maximum-speed (noted as VMProtect-Maximum-speed), which aims to reduce the overhead. For Dsvmp, We use a configuration of 5 VMs, Dsvmp-5VM, in this experiment. This is because the code-size overhead of 5-VM configuration is moderate.
9.4.1. Code size
Figure 14 shows the impact on code size of several VM-based protection systems. From the figure we can see that Dsvmp has a similar code-size overhead, if not smaller, when compared with CV and VMP. For example, for the least affected program bcrypt, the code sizes of the target function is around 120% for all schemes. For aescrypt, the code-size overhead of Dsvmp-5VM and CV is around 177%. This is significantly smaller than the
overhead of 252% for VMProtect. We also observed that the code size is mainly determined by the size of the protected code region. The larger the target code to be protected, the large the code size will be. Among all the evaluation benchmarks, the aescrypt has a greater code bloat when it is obfuscated by VMProtect-Maximum-protection. Overall, our approach does not significantly the code size of the protected code segments when compared to the commercial counterparts.
Table 5: The average runtime overhead (ms)
<table>
<thead>
<tr>
<th>program</th>
<th>Original</th>
<th>DSVMP-5VM</th>
<th>VMProtect-Max-Speed</th>
<th>VMProtect-Max-Protect</th>
<th>Code Virtualizer</th>
</tr>
</thead>
<tbody>
<tr>
<td>md5</td>
<td>1.603</td>
<td>64.229</td>
<td>73.660</td>
<td>141.179</td>
<td>803.302</td>
</tr>
<tr>
<td>aescrypt</td>
<td>6.550</td>
<td>154.720</td>
<td>257.718</td>
<td>1903.458</td>
<td>623.452</td>
</tr>
<tr>
<td>bcrpyt</td>
<td>4.544</td>
<td>298.415</td>
<td>252.655</td>
<td>1899.968</td>
<td>2051.708</td>
</tr>
<tr>
<td>gzip</td>
<td>3.963</td>
<td>169.107</td>
<td>368.599</td>
<td>1923.022</td>
<td>1110.598</td>
</tr>
<tr>
<td>astart</td>
<td>8.806</td>
<td>16.992</td>
<td>18.210</td>
<td>91.691</td>
<td>58.705</td>
</tr>
<tr>
<td>tetris</td>
<td>0.668</td>
<td>1.565</td>
<td>4.811</td>
<td>13.393</td>
<td>12.012</td>
</tr>
<tr>
<td>Average</td>
<td>4.357</td>
<td>117.505</td>
<td>162.609</td>
<td>995.452</td>
<td>776.630</td>
</tr>
</tbody>
</table>
Notes: The average data for the last row is the average runtime for 6 benchmarks for each protection scheme.
Figure 16: Calling frequencies for handlers across runs per scheme for \texttt{md5}. The x-axis shows the number of handlers observed, and the y-axis represents three individual runs.
9.4.2. Runtime overhead
The average runtime overhead of the three schemes is given in Figure 15. This diagram shows that the runtime overhead of Dsvmp and VMProtect-Maximum-speed are comparable, which is smaller than CV and VMProtect-Maximum-protection. Code protected under CV and VMProtect-Maximum-protection has the most expensive runtime overhead, which on average is higher than Dsvmp and VMProtect-Maximum-speed. Detailed experimental data are shown in Table 5. Specifically, the average runtime overhead brings by CV and VMProtect-Maximum-protection are 7 and 9 times larger than Dsvmp-5VM respectively.
9.4.3. Diversity evaluation
Recall that one of the design goals of Dsvmp is to increase the diversity of program execution. To evaluate this design goal, we record how frequent a handler is called across different runs per protection scheme. This experiment was performed on the \texttt{md5} application. We ran the obfuscated program three times and used a 5-VM configuration for Dsvmp. The results are shown in Figure 16. As can be seen from the heat maps, CV and VMP use fewer handlers than Dsvmp; and the calling frequency of each handler remains unchanged across different runs. By contrast, when using Dsvmp, the handler frequency changes across runs, resulting in different ‘hot’ handlers across runs. This example shows that Dsvmp can increase the diversity of program execution when compared to CV and VMP, because it uses more handlers and the calling frequency of handlers varies across runs.
Intuitively, the stronger the variation of the handler address offsets across runs, the stronger the non-deterministic behavior the program will exhibit across runs. To collect the dynamic addresses information, we used the Intel Pin [19] binary instrumentation tool instrument the code to gather the handler addresses during runtime. This experiment was performed on the \texttt{md5} application and we ran the obfuscated application three times.
Figure 17 (a) shows that the handler address offsets change across runs when using Dsvmp. By contrast, CV and VMP (Figure 17 (b)) use a static set of handlers, and the handler address offsets remain unchanged across runs. This experiment shows that code protected by Dsvmp exhibits stronger non-deterministic runtime behavior when compared to CV and VMP. This is because the set of handlers used to interpret the virtual instructions can change across difficult runs. This dynamic feature makes it harder for an attacker to use
9.4.4 User study
We follow a similar evaluation methodology described in [20] to conduct a small scale user study to evaluate the strengthen of our protection scheme. Our user study involved 15 students from the host institution. Among the 15 students, there are 2 senior PhD students and 13 postgraduate (Master) students, of which 7 students are female and 8 are males. The students were studying a computer science degree in cyber security at the time this experiment was conducted. Our participants all have hands-on experience on software reverse engineering. This experiment was approved by the research ethics board (REB) of the host institution.
In this experiment, all participants acted as an attacker. They were asked to reverse engineer the md5 application, which has been obfuscated by three code protection schemes: DSVMP, CV and VMP. In this experiment, we use a 5-VM configuration for DSVMP. The participants tried to accomplish three tasks described as follows. Each participant was given 72 hours to accomplish a task.
- Task 1: Find the entry point address of the VM interpreter;
Figure 17: The address offset of the scheduled handlers in time order during different runs for md5 protected under different schemes. The x-axis shows the part of the handler’s scheduling at different times. Where applications protected by Code Virtualizer and VMProtect, always follows a single and fixed handlers execution sequence during different runs, so there's only one curve.
the knowledge gathered during the previous runs to perform reverse engineering, because the handler sets to use may change in future runs.
To sum up, compared with two commercial tools protection programs, which always follow a fixed execution path for the same input across different runs, the program protected by DSVMP follows dynamically changing execution paths in different runs.
Table 6: The number of participants who have successfully accomplished a task.
<table>
<thead>
<tr>
<th>Code Obfuscation Schemes</th>
<th>Task 1</th>
<th>Task 2</th>
<th>Task 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>DSVMP-5VM</td>
<td>11</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>CV</td>
<td>11</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>VMP</td>
<td>11</td>
<td>8</td>
<td>8</td>
</tr>
</tbody>
</table>
- Task 2: Given the entry point address of the VM interpreter, find the address of the dispatcher;
- Task 3: Given the address of the dispatcher, find out what handlers have been executed during runtime; and record the handler addresses.
It is to note that these tasks represent the essential steps that an attacker must perform in order to reverse engineer a code region protected under a VM-based code obfuscated scheme. Therefore, the fewer people success in a task, the stronger the protection a scheme will provide. We also remark that these tasks are relatively simple, because the protected code region only contains a handful number of native instructions; and accomplish these tasks may not lead to a successful attack, because an attacker still needs to recover the functionalities of the target code. Nonetheless, this experiment allows us to compare the protection strengthen of our approach against commercial counterparts.
Table 6 shows how many participants have successfully accomplished a task. Intuitively, the fewer participants could accomplish a task under a protection scheme, the stronger the protection has provided. Task 1, finding the entry point address of the VM interpreter, is trivial to our participants (who already have hands-on experience on VM-based code obfuscation). Most of our participants could do so for all schemes. Tasks 2 and 3 appear to be harder. When using DSVMP, there are only three participants managed to accomplish them. This is because the dynamic scheduling structure employed by DSVMP makes it difficult to trace the addresses of the dispatcher and the handlers. To perform tasks 2 and 3 on CV and VMP seems to be easier. As we can see from the table, 10 participants could successfully finish these tasks when using CV, and 8 participants were able to do so when using VMP. This experiment confirms that DSVMP indeed increases the cost of reverse engineering when compared to CV and VMP.
To investigate these results further we recorded the correct dispatcher and handler addresses collected by the different participants in task 2 and 3, respectively. The results are shown in Table 7. Each data item of this table is a two-tuple, \((N_D, n)\), where \(N_D\) is the number of the correct dispatcher addresses obtained in task 2, and \(n\) represents the number of the handler addresses recorded in task 3. Experimental results show that CV and VMP only have a single dispatcher, i.e. the tuple for CV and VMP in Table 7 is \((1, 14630429)\) and \((1, 2143262)\). This means that once the dispatcher address is located, it would be easy to extract the entire handler set. For DSVMP, however, there can be multiple dispatchers (5 in this example). Because our participants had not been told that there may be multiple dispatchers, most of the them thought they had completed the task when locating the first dispatcher address. As a result, only 3 participants have successfully located all the dispatch-
This table shows the data of the 11 participants (P1-P11) who have successfully found the VM entry address in task 1. Each data item of this table is a two-tuple, \((N_D, n)\), where \(N_D\) is the number of the correct dispatcher addresses obtained in task 2, and \(n\) represents the number of the handler addresses recorded in task 3. Number "0" in a tuple means that the participant did not get the data or got the wrong data.
### 10. Related Work
Early work on the binary code protection relies on simple encryption and obfuscation methods, but they are vulnerable to the sophisticated, diversified attacks developed over the past years. Traditionally, techniques like junk instructions [21], packers [22, 23], are used to protect software against attacks based on disassembly and static analysis. There are also other code protection techniques like code obfuscation [24], control flow and data flow obfuscation [25, 26, 27], all aim to obfuscate the semantic and logical information of the target program. In practice, these approaches are often used in combination to provide stronger protection. DSVMP also leverages some of the code obfuscation techniques developed in the past for code protection. In recent years, there are many different code protection programs has been constantly put forward. Some research is devoted to CFI (Control Flow Integrity) protection, for example, Zhang et al. [28] and van der Veen et al. [29] provide fine-grained CFI systems against modern control flow hijacking attacks based on ROP (Return-Oriented Programming) and more advanced code reuse attacks [30]. And some studies consider Code Randomization protection, such as Stephen et al. presents a practical, fine-grained code randomization defense, called Readactor, resilient to both static and dynamic ROP attacks [31].
This paper focus on researching the code virtualization protection, and there is a growing interest in using it to protect software from malicious reverse engineering. Similar to our code virtualization approach is the work conducted by the following studies.
Fang et al. [5] proposed an algorithm of multi-stage software obfuscation method. Their approach iteratively transforms the critical code region several times with different interpretation methods to improve security. Adversaries will need to crack all intermediate results to figure out the structure of original code. A similar, Yang et al. [6] presented a nested virtual machine for code protection. Using their approach, an adversary would have to fully...
reverse engineer a layer of the interpreter before moving to the next layer, which increases the cost of attacks. The multi-stage and nested interpretation process, however, is bound to bring expensive time overhead.
Averbuch et al. [32, 33] introduces an encryption and decryption technology on the basis of VM-based protection. This approach uses the AES algorithm and a customize encryption key to encrypt the virtual instructions. During runtime, the VM will decrypt the virtual instruction and then dispatch a handler to interpret the virtual instructions. But it requires hardware support, and the decryption key is stored in the CPU and the attacker cannot get it, so it can effectively hinder the attacker’s reverse analysis.
Wang et al. [7] proposed a protection scheme to increase the time diversity of protected code regions to resist dynamic analysis. This is achieved by constructing several equivalent but different forms of sub program execution paths, from which a path will be randomly selected to execute at runtime. However, once generated, these sub paths are determined and the number is limited, so this approach only provides limited time diversity.
In the meantime, code analysis and deobfuscation techniques are constantly being introduced. Representative techniques such as Symbolic and concolic execution and taint analysis [34, 35, 36]. And Shoshitaishvili et al. [37] presents a binary analysis framework angr. Their work presents a systematized implementation of analysis techniques that proposed in the past, which allows other researchers to compose them and develop new approaches. Some of the common methods for analysing VM-based protection are as follows, Coogan et al. [38] puts forward a behavior based analysis method to analyze the important behavior of code, but it does not pay attention to how to restore the original code structure. It is often used to analyze Malware, due to the malicious code will inevitably interact with the system. Sharif et al. [39] used dynamic data-flow and taint analysis to identify data and extract the syntactic and semantic information about the bytecode instructions. Yadegari et al. [40], by tracking the flow of inputs values, and then use semantics-preserving code transformations to simplify the logic of the instructions. These approaches, however, cannot restore the structure of the original code completely, because the analysis process is only for a dynamically executed sequence of instructions and does not cover all branches, and it depends on the results of the taint analysis. Therefore, they are usually performed and analyzed several times with different input to obtain a better structure information.
As a departure from prior work, DSVMP presents a dynamic scheduling structure to improve security for software. DSVMP has integrated several novel techniques to increase the diversity and uncertainly of program execution. These include using a control unit to diversify the execution path of bytecode handlers and using multiple VMs and dispatchers to randomly schedule instructions from multiple bytecode instruction sets. Integrating these techniques allows DSVMP to provide a more diverse program execution structure compared to prior work in the area. This richer set of diversity can better protect software against code reverse engineering [41].
11. Conclusions
This paper has presented Dsvmp, a novel VM-based code protection scheme. Dsvmp uses a dynamic scheduling structure and multiple VMs to increase diversity of program execution. We have shown that code segments protected by Dsvmp rarely follow the same execution path across different runs. The dynamic program execution brought by Dsvmp forces the attacker to have to use many trail runs to uncover the implementation of the protected code region. As such, Dsvmp significantly increases the overhead and effort involved in code reverse engineering. We have evaluated Dsvmp using six real world applications and compared it to two state-of-the-art VM-based code protection schemes. Our experimental results show that Dsvmp provide stronger protection with comparable overhead of runtime and code size.
Acknowledgment
This work was partially supported by projects of the National Natural Science Foundation of China (No. 61373177, No. 61572402, No. 61672427), the Key Project of Chinese Ministry of Education (No. 211181); the International Cooperation Foundation of Shaanxi Province, China (No. 2013KW01-02, No. 2015KW-003, No. 2016KW-034); the China Postdoctoral Science Foundation (grant No. 2012M521797); the Research Project of Shaanxi Province Department of Education (No. 15JK1734); the Research Project of NWU, China (No. 14NW28); the UK Engineering and Physical Sciences Research Council under grants EP/M01567X/1 (SANDeRs) and EP/M015793/1 (DIVIDEND); and a Royal Society International Collaboration Grant (IE161012).
References
pp. 1080–1091.
|
{"Source-Url": "http://eprints.lancs.ac.uk/89498/1/DSVMP_C_S.pdf", "len_cl100k_base": 15920, "olmocr-version": "0.1.53", "pdf-total-pages": 30, "total-fallback-pages": 0, "total-input-tokens": 76142, "total-output-tokens": 19434, "length": "2e13", "weborganizer": {"__label__adult": 0.0004115104675292969, "__label__art_design": 0.00022029876708984375, "__label__crime_law": 0.0008416175842285156, "__label__education_jobs": 0.00042891502380371094, "__label__entertainment": 6.097555160522461e-05, "__label__fashion_beauty": 0.0001418590545654297, "__label__finance_business": 0.0001931190490722656, "__label__food_dining": 0.00026726722717285156, "__label__games": 0.0012102127075195312, "__label__hardware": 0.0016307830810546875, "__label__health": 0.00038814544677734375, "__label__history": 0.00019931793212890625, "__label__home_hobbies": 8.344650268554688e-05, "__label__industrial": 0.0003790855407714844, "__label__literature": 0.0001959800720214844, "__label__politics": 0.0002419948577880859, "__label__religion": 0.0003516674041748047, "__label__science_tech": 0.0244598388671875, "__label__social_life": 6.556510925292969e-05, "__label__software": 0.01123809814453125, "__label__software_dev": 0.9560546875, "__label__sports_fitness": 0.000263214111328125, "__label__transportation": 0.0004107952117919922, "__label__travel": 0.00015687942504882812}, "weborganizer_max": "__label__software_dev", "avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_v1__avg_fraction_numbers_in_line_ratio": [[0, 77252, 0.05453]], "fineweb_edu_fasttext_gt2__fineweb_edu_fasttext_gt2__score": [[0, 77252, 0.65618]], "ft_lang_id_en_doc_v2__ft_lang_id_en_doc_v2__en": [[0, 77252, 0.86757]], "google_gemma-3-12b-it_contains_pii": [[0, 3307, false], [3307, 6503, null], [6503, 9812, null], [9812, 11944, null], [11944, 14195, null], [14195, 17104, null], [17104, 19298, null], [19298, 21475, null], [21475, 23951, null], [23951, 27226, null], [27226, 28970, null], [28970, 30990, null], [30990, 33874, null], [33874, 35695, null], [35695, 38679, null], [38679, 40991, null], [40991, 44336, null], [44336, 45724, null], [45724, 48786, null], [48786, 51251, null], [51251, 53706, null], [53706, 55235, null], [55235, 57916, null], [57916, 59792, null], [59792, 63116, null], [63116, 65660, null], [65660, 69011, null], [69011, 72070, null], [72070, 76039, null], [76039, 77252, null]], "google_gemma-3-12b-it_is_public_document": [[0, 3307, true], [3307, 6503, null], [6503, 9812, null], [9812, 11944, null], [11944, 14195, null], [14195, 17104, null], [17104, 19298, null], [19298, 21475, null], [21475, 23951, null], [23951, 27226, null], [27226, 28970, null], [28970, 30990, null], [30990, 33874, null], [33874, 35695, null], [35695, 38679, null], [38679, 40991, null], [40991, 44336, null], [44336, 45724, null], [45724, 48786, null], [48786, 51251, null], [51251, 53706, null], [53706, 55235, null], [55235, 57916, null], [57916, 59792, null], [59792, 63116, null], [63116, 65660, null], [65660, 69011, null], [69011, 72070, null], [72070, 76039, null], [76039, 77252, null]], "google_gemma-3-4b-it_v2tag__is_academic_paper": [[0, 5000, true], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_class_syllabus": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_completion_certificate": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_court_notice": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_homework_assignment": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_news_article": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_public_order": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_resume_cv": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_test_or_quiz": [[0, 5000, false], [5000, 77252, null]], "google_gemma-3-4b-it_v2tag__is_textbook": [[0, 5000, false], [5000, 77252, null]], "pdf_page_numbers": [[0, 3307, 1], [3307, 6503, 2], [6503, 9812, 3], [9812, 11944, 4], [11944, 14195, 5], [14195, 17104, 6], [17104, 19298, 7], [19298, 21475, 8], [21475, 23951, 9], [23951, 27226, 10], [27226, 28970, 11], [28970, 30990, 12], [30990, 33874, 13], [33874, 35695, 14], [35695, 38679, 15], [38679, 40991, 16], [40991, 44336, 17], [44336, 45724, 18], [45724, 48786, 19], [48786, 51251, 20], [51251, 53706, 21], [53706, 55235, 22], [55235, 57916, 23], [57916, 59792, 24], [59792, 63116, 25], [63116, 65660, 26], [65660, 69011, 27], [69011, 72070, 28], [72070, 76039, 29], [76039, 77252, 30]], "pipe_delimited_lines_v1__pipe_delimited_lines_v1__pipe_delimited_lines_ratio": [[0, 77252, 0.13462]]}
|
olmocr_science_pdfs
|
2024-12-11
|
2024-12-11
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.