Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
A Study of Variability Spaces in Open Source Software
1. A Study of Variability Spaces
in Open Source Software
Sarah Nadi
University of Waterloo, Canada
PhD Advisor: Richard C. Holt
ICSE ’13 Doctoral Symposium – May 21st 2013
San Francisco, USA
2. Variability in Real Life
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 2
• Integrated Garage Door Opener
• Electronic Compass
Command navigation package
• Heated Front Seats
• Exterior Power Folding Mirrors
Premium Package
3. Example of Software Variability
The Linux kernel
I want usb
support on
ARM
architecture!
User 1
I want sound
support on
x86
architecture!
User 2
Variant 2 Variant 1
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 3
4. What functionality
will each choice
provide?
Code Space
Supporting Variability
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 4
What can I
configure?
How will my choices
select the right
implementation
parts?
Configuration
Space
Build Space
[Czarnecki & Eisenecker., 2000] [Svahnberg et al., 2005] [Tartler et al., 2011]
Feature1 -> Feature2
Block1 -> Feature2
File1 -> Feature1
(e.g., Kconfig files)
(e.g., C code files) (e.g., Makefiles)
5. Build Space
Code Space
Configuration
Space
Previous Work
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 5
Change evolution
[Adams et al.
2008, McIntosh et al.
2011]
Feasibility of mapping
extraction [Berger et
al., 2010]
Change evolution (Lotufo et
al. 2009 & 2011)
Use of feature modeling
concepts [She et al.,
2010][Berger et al., 2010]
Consistency with code
space
[Tartler et al. 2011]
Studying & extracting
implemented variability
[Liebig et al., 2010, Sincero et
al, 2010]
Variability aware parsing
[Kaestner et al.,2011]
Consistency with
configuration space [Tartler et
al. 2011]
6. What is the origin of these
anomalies? How are they
fixed?
What variability constraints
does each space provide?
So, What’s the Problem?
?
??
?
?
? Are the spaces consistent?
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 6
?
What role does the Build
Space play?
7. Examples of Systems Supporting Build-
time Variability
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 7
BusyBoxLinux kernel
> 12,000 features > 1,000 features > 800 features
8. RQ1: Variability Constraints in 3 Spaces?
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 8
Build SpaceCode Space
Configuration
Space
= ?
• Identify overlap in constraints
• Identify constraints that are only
in one side
Challenges
• Accurately extract code constraints
• Meaningfully compare constraints
Benefits
• Uncover limits of static analysis
• Accurate reverse engineering
• Better maintenance
BusyBox
9. RQ2: Role of Build System in Variability?
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 9
Makefile
Constraint
Extractor
Build Space
Constraints
≈ 50% of configuration space features are only
used in the build space!
[Nadi & Holt, JSEP ‘13]
[Liebig et al., 2010]
Limitations
• Extractor specific to Kbuild
• Relies on text parsing of Makefiles
Benefits
• Show which parts of the system
control most of variability
10. RQ3: Is Variability Consistent?
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 10
Code Space
Configuration
Space
Build Space
[Tartler et al., 2011]
Syntactic Anomalies
• Don’t deal with constraints
• Related to the setup of conditional
compilation in Kbuild
Semantic Anomalies
• Conflicts between constraints
• Requires a SAT solver
• Dead (never selected) &
undead (always selected) code
blocks and files
11. RQ3 Cont’d: Detecting Syntactic Anomalies
X
XX
X
X
Variable Not
Used anomaly
X
File Not Used
anomaly
Feature Not
Defined anomaly
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 11
[Nadi & Holt, WCRE ‘11]
12. RQ3 Cont’d: Detecting Semantic Variability
Anomalies
• '
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 12
[Nadi&Holt, CSMR ‘12]
More anomalies detected when build space
constraints are considered!
13. #ifdef X
//B1
#else
//B2
#endif
foo.c
(Code Space)
RQ3 Cont’d: Example of a Code Block
Anomaly
Undead block!
Dead block!
foo.c => X
Build Space
foo.c will be
compiled
only if X is
selected“Testing X inside foo.c is a waste
of text, since foo.c is built only
when X is selected”
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 13
14. RQ4: Intro. & Fix of Variability Anomalies?
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 14
1 Exploratory study with existing patches
2 Mine git repository across
several releases to confirm patterns
Variability Anomalies
[Nadi et al., MSR ’13]
Incomplete
configuration
patches
Code patches
Time
cause fix
14% 26%
Avoid future anomalies & provide automatic fix solutions!
15. Limitations & Future Work
• Build time variability
• External validity
• Focused on certain types of anomalies
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 15
Future Work
• Study other systems
• Analyze other types of anomalies
16. Overall Contributions & Benefits
• Contributions
• Established the importance of build system variability
• Quantified build system variability
• Detected variability anomalies in the Linux kernel
• Studied causes and fixes of variability anomalies
• Benefits
• Guide future variability analysis by determining overlaps between
variability spaces
• Decrease variability anomalies in software systems
• Improve maintainability of variable software
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 16
17. Acknowledgements
• University of Waterloo
• Ric Holt (Supervisor)
• Krzysztof Czarnecki
• Mike Godfrey
• Friedrich-Alexander-Universität Erlangen-Nürnberg
• Christian Dietrich
• Reinhard Tartler
• Daniel Lohmann
• Leipzig University
• Thorsten Berger
• Carnegie Mellon University
• Christian Kästner
Sarah Nadi Study of Variability Spaces - ICSE DS 2013 17
18. Sarah Nadi Study of Variability Spaces - ICSE DS 2013 18
Time2011
WCRE ‘11
CSMR ‘12
2012 2013 2014
MSR ‘13
In progress
JSEP ‘13
BusyBox
Other anomalies
Questions?
snadi@uwaterloo.ca
http://swag.uwaterloo.ca/~snadi
Editor's Notes
Different choices u can make: heated leather seats, integrated garage opener etc.Mixture of software and hardware.. We focus on software
Example of SW variability.. User chooses the options…Different variants can be generated…Ability to be extended, changed and customized
Configuration space: what you can configure, the dependencies between features, represented in some format (Kconfig)Code space: implement functionality, certain blocks can be conditionalBuild Space: Files are conditionally compiled.. E.g., Kbuild
Busybox: UNIX utilities into a single small executableeCos: OS for embedded applications
Scattering degree (in how many constraints does a feature appear)Tangling degree (how many features in a constraint)