2401.01782v1
2401.01782v1
1st Iztok Fister Jr. 2nd Dušan Fister 3th Vili Podgorelec 4th Iztok Fister
University of Maribor University of Maribor University of Maribor University of Maribor
Maribor, Slovenia Maribor, Slovenia Maribor, Slovenia Maribor, Slovenia
[email protected] [email protected] [email protected] [email protected]
Abstract—Much debate nowadays is devoted to the impacts The task of Green ICT is to mitigate the carbon emissions
of modern information and communication technology on global of ICT production, applications, and services [12]. It holds
arXiv:2401.01782v1 [cs.SE] 3 Jan 2024
carbon emissions. Green information and communication tech- that the ICT systems nowadays produce even 2 % of global
nology is a paradigm creating a sustainable and environmentally
friendly computing field that tries to minimize the adverse effects emissions [6]. The reduction of carbon emissions comes out
on the environment. Green information and communication either directly from the hardware, or directly and indirectly
technology are under constant development nowadays. Thus, in from the software. Indeed, the carbon emission is measured
this paper, we undertake the problem of performance bugs that, as a Carbon Footprint (CF) that is proportional to the amount
until recently, have never been studied so profoundly. We assume of trees needed to absorb the emitted carbon dioxide in a
that inappropriate software implementations can have a crucial
influence on global carbon emissions. Here, we classify those year [12].
performance bugs and develop inappropriate implementations Several publications have tackled the challenge of enhancing
of four programs written in C++. To mitigate these simulated the sustainability of ICT and its associated processes. In
performance bugs, measuring software and hardware methods a paper authored by Taina [12], a comprehensive approach
that can estimate the increased carbon footprint properly were was presented for analyzing the carbon footprint associated
proposed.
Index Terms—carbon footprint, green computing, performance
with software. This study examined each phase of a typical
bugs, software engineering software lifecycle meticulously, quantifying the carbon emis-
sions generated at each step. Additionally, the author shared
insightful strategies aimed at minimizing this carbon footprint.
I. I NTRODUCTION
Conversely, in paper [6], the authors introduced a systematic
We find ourselves in an era marked by turbulence, where methodology for quantifying the carbon footprint of a soft-
the ominous specters of global warming and excessive carbon ware product throughout its entire lifecycle. Furthermore, they
emissions loom large in our collective consciousness [8]. Many proposed a method for incorporating certain facets of carbon
scientists have long sounded the alarm about the urgent need footprint assessment seamlessly into the software development
to curb these emissions to avert catastrophic consequences. process. The paper also delves into the implications and tools
However, despite the multitude of dire projections, political associated with this innovative calculation approach. Thus, this
movements worldwide often fall short in their efforts to work underscores the significance of energy metrics, and the
mitigate the impact of global warming effectively [9]. consideration of carbon footprint implications within the realm
Modern humans and novel economic systems play a pivotal of Green Software Engineering.
role in exacerbating the carbon footprint. On one hand, we Performance bugs are unnecessarily inefficient code chunks
engage in activities such as deforestation, construction on in software that can cause prolonged execution times and
valuable land, the proliferation of supermarkets, while, on the degraded resource utilization [3]. For instance, an execution
other, in the extensive use of automobiles and airplanes [1], time of a program calling a function each time it needs in
[10]. Moreover, it has become increasingly evident that In- place of referencing the variable storing the result of the
formation and Communication Technology (ICT), which we calling function can increase its execution time substantially.
rely upon heavily, contributes significantly in increasing the The execution time is increased proportionally to the number
carbon emissions. Considering the vast number of data centers of function calls.
scattered across the globe [7], as well as the multitude of The impact of the unnecessary inefficient code chunks has
machine learning models running incessantly [5], it becomes rarely been taken into consideration, especially in the sense
clear just how profound our environmental impact can be. In of Green ICT. The purpose of the study is to observe the
addition to all these examples, the personal computers are well known performance bug in C++ referring to a vector
using electricity, and potentially contribute in increasing the class, and to show how its inefficient usage can increase the
carbon emissions [11]. energy consumption (indirectly also carbon emission) of the
corresponding algorithm. Vector in C++ reallocates memory
Corresponding author: Iztok Fister Jr. (e-mail: [email protected]). when the new elements are added, and no memory is avail-
TABLE I
consists of two pointers prev and next, and the long integer L APTOP BATTERY CHARACTERISTICS .
variable num.
Specification Description
The pseudo-code of the algorithm List is presented in Type HP ProBook 470 G3
Algorithm 5, from which it can be considered that the elements Amp-hour capacity 3 Ah
are entered into the double linked list by calling the function Watt-hour capacity 44 Wh
Voltage 14.8 V
add new. The implementation of the function is straightfor- Cell type 4 cell Lithium-Ion
ward, and demands only to allocate the new item in the heap,
initialize it, and ensure the proper forward and backward capacity before each start of the particular experiment.
linking. Therefore, the pseudo-code of the function is not The results of the experiments are depicted in Table II
presented in the paper. Interestingly, the effect of element that is divided into the following columns: the ”Init DR”
temptation is achieved by putting the current iteration number represents the average initial Discharging Rate (DR) before
into the first element and tying the other 99 elements for one. and after running the algorithm, the ”Running DR” is the
This whole task can be performed simply by modifying the DR under the strain, the ”Alg. DR” refers to the DR caused
value of the pointers first and last (i.e., no reallocation is
needed). 1 https://codeberg.org/firefly-cpp/green-ict-benchmarks
by the running algorithm, the ”Time” measures the average C. Measuring the carbon footprint with a power meter on an
execution time of the algorithm, the ”Energy” denotes the Apple iPad
energy used as a product of algorithm DR by the time, and the The Apple iPad prefers the foreground applications in order
”Carbon footprint” estimates the carbon footprint as a product to ensure users the online response. Therefore, terminations are
of CO2 per unit emitted by one kWh (i.e., 0.65 CO2 e/kWh). part of the application life-cycle, when the system terminates
As indicated from the table, the Raw algorithm produced the long-term running process. In the case of running the
the higher carbon footprint among the four algorithms. As C++ application, this termination is followed with issuing
expected, the List algorithm was the most green in the sense the message ”Too much resources...” by the iOS after ap-
of Green ITC. proximately 20 sec. Although the iPad allows running a
long-term application in the background asynchronously, our
B. Measuring the carbon footprint with a power-meter on a goal was to indicate the carbon footprint of the foreground
Raspberry Pi 3 processes running on the iPad. In line with this, the maximum
number of iterations need to be reduced significantly to
Raspberry Pi is a series of small single-board computers
MAX ITER = 107 . The specifications of the iPad were as
(SBCs) based on an ARM processor that represents an all in
follow: model number MYLA2HC/A, iPad OS version 16.7,
one computer. Due to its affordability, it is suitable for using
processor 2 × Vortex, 3 GB operating memory, and 32 GB
in teaching basic computer science in schools. In our study,
built-in memory.
the Raspberry Pi was used that was equipped with a 32-bit The measuring protocol obtained by the Array algorithm
ARM processor, 1 GB memory, 256 GB SSD, DVI video port, strain on the iPad using the power-meter AVHzY CT-3 was
Ethernet and Wireless LAN. The Raspbian OS was installed presented in Fig. 3, from which it can be concluded that
on the device. The main advantage of this all in one computer the supplement of the Array algorithm to the total power
represents its power supply over a USB-C port. This means consumption (i.e., the VBUS ripple) was not easy to observe.
that it is able to be monitored using the already mentioned Therefore, this supplement of 6.135 seconds is denoted in the
AVHzY CT-3 power-meter. Let us mention that the maximum figure by arrows. When one compares the curve with those
number of iterations was set to MAX ITER = 108 . presented in Fig. 2 obtained on the Raspberry Pi, he/she can
An example of the measuring protocol obtained by measur- conclude that the iPad system is very agile when handling
ing the power consumption by executing the Array algorithm a lot of active processes simultaneously. Although frequent
by the PC is illustrated in Fig. 2. The curve in the figure withdrawal of voltage can be indicated in the figure, the
illustrates the VBUS ripple that reflects a reaction of the running application left its carbon footprint clearly.
Raspberry Pi in the strain caused by executing the Array The measured carbon footprint is depicted in Table IV, from
algorithm. As can be observed, the strain is demonstrated which it is evident that the carbon footprint by the algorithms
as a step function denoting the increasing of the voltage. in test was lower due to the lower execution time, but the
Interestingly, the sudden withdrawal of voltage is a typical relations between the algorithms remained the same as in the
consequence of some interrupts caused by the algorithm itself last experiment, i.e., the double linked list left the lesser carbon
(e.g., by the output of control messages), different I/O actions footprint, while the Raw algorithm was distinguished as the
(e.g., moving the mouse) or system actions. Let us mention worst environment pollutant.
that no other programs were active during the experimental
work. D. Discussion
The results of measuring the carbon footprint are depicted As evident from the performed experimental work, mea-
in Table III. Actually, all the experiments consisted of three suring the power consumption is more accurate using the
phases: (1) measuring the inactivity before the strain, (2) hardware device (i.e., the power-meter) than with software
measuring the strain activity, and (3) measuring the inactivity tools (i.e., the powertop). Although the measurements using
after the strain. Typically, the duration of both inactivity phases powertop were taken at 1 second intervals, less than one-third
was approximately one minute, while the strain activity phase could be captured in one minute (i.e., 16/60). The reason
denotes the effective power obtained during executing the behind the behavior needs to be searched for in the slow
particular algorithm. In the table, the row ”Average inactivity” communication of the tool with the power engine. On the
denotes the average carbon footprint in CO2 /Wh measured other hand, the communication of the control PC with the
during both inactivity phases, the row ”Total strain” is the power-meter was very fast and accurate. The hardware device
total carbon footprint measured during the strain phase, while is able to transmit up to 100 measurements in one second. This
the row ”Algorithm strain” refers to the foot print caused by means that even small changes of power consumption can be
executing the algorithm (i.e., simply the difference between sensed by the power-meter. However, the basic problem which
the total and the average strain). As evident from the table, the arose by using the AVHzY CT-3 device with the laptop was
double linked list implementation is the most environmentally that the power-meter device was able to support only devices
sustainable in the sense of emitting the lowest carbon footprint. connected to the power source with the USB port. This means
The Vector implementation of the algorithm was better than that for measuring power consumption on laptops the more
the rest of the algorithms in the tests. professional equipment is necessary.
TABLE II
C ARBON FOOTPRINT OBTAINED ON THE LAPTOP BY DIFFERENT C++ ALGORITHMS .
TABLE III measured explicitly. Obviously, the best solution is to put the
R ESULTS OF MEASURING THE CARBON FOOTPRINT. computer in single-user mode, but this option is unfortunately
Carbon footprint Vector Raw Array List not available to all computers (e.g., an iPad).
Average inactivity 3.299 3.242 3.273 3.637 It turns out, that the vector in C++ is sensitive on perfor-
Total strain 12.860 63.659 27.496 8.211
Algorithm strain 9.561 60.417 24.223 4.574
mance problem only, when the data class is used a lot of the
time. Interestingly, sequential usage of the array data structure
by the algorithm Array was even more efficient than using the
TABLE IV built-in functions by the algorithm Vector, when the enormous
A PPLE I PAD
actions were applied on the class. As expected, the algorithm
Carbon footprint Vector Raw Array List List, using the classical implementation of double linked list,
Average inactivity 6.087 6.121 5.808 5.975 outperformed all the other algorithms.
Total strain 0.855 1.289 0.637 0.824
Algorithm strain 0.123 0.516 0.317 0.075
V. C ONCLUSION
The paper tries to achieve three goals: (1) to estimate
In first sight, it seems that measuring the carbon footprint how the performance bugs in software influence increasing
was measured incorrectly, because the measured algorithm was the carbon footprint, (2) to focus primarily on the iteration
executed on an operating system that handles a lot of the other performance bugs, and (3) to find methods for measuring the
programs simultaneously and also affected the increased power carbon footprint caused by the performance bugs properly.
consumption. However, the number of these processes (e.g., In line with this, four algorithms simulating the iterative
internet explorer, e-mail client, etc.) was minimized during the performance bugs were considered and run on three platforms
measuring, while the average of both the so-called inactivity (i.e., a laptop, a micro-computer Raspberry Pi, and an Apple
phases (i.e., before and after executing the algorithm) were iPad). Two methods for measuring the carbon footprint were
Fig. 3. Measuring protocol on AVHzY CT-3 by Array algorithm strain on iPad.
examined, i.e., using the software tool powertop on Linux and [6] Eva Kern, Markus Dick, Stefan Naumann, and Tim Hiller. Impacts of
the power meter AVHzY CT-3. The experiments revealed that software and its engineering on the carbon footprint of ict. Environmen-
tal Impact Assessment Review, 52:53–61, 2015.
the hardware measurement using the power meter was more [7] Jonathan Koomey et al. Growth in data center electricity use 2005 to
accurate than those using the software tools. However, both 2010. A report by Analytical Press, completed at the request of The
can adequately identify the increased carbon footprint caused New York Times, 9(2011):161, 2011.
[8] Zhu Liu, Zhu Deng, Steven J Davis, Clement Giron, and Philippe Ciais.
by the simulation. Monitoring global carbon emissions in 2021. Nature Reviews Earth &
In summary, the study integrates two domains, i.e., software Environment, 3(4):217–219, 2022.
engineering and green computing. The former can identify [9] Leonardo Nascimento and Niklas Höhne. Expanding climate policy
adoption improves national mitigation efforts. npj Climate Action,
the software bugs, while the latter deals with the effects of 2(1):12, 2023.
computing on global warming. In line with this, this study [10] Ambuj D Sagar. Automobiles and global warming: Alternative fuels and
warns of harmful effects caused by performance bugs in the other options for carbon dioxide emissions reduction. Environmental
Impact Assessment Review, 15(3):241–274, 1995.
sense of the increased carbon footprint. [11] Pavel Somavat, Vinod Namboodiri, et al. Energy consumption of
As potential directions for the future, searching for cheaper personal computing including portable communication devices. Journal
and more accurate solutions should be made for measuring of Green Engineering, 1(4):447–475, 2011.
[12] Juha Taina. How green is your software? In International Conference
power consumption on computers connected to the 230 V of Software Business, pages 151–162. Springer, 2010.
electricity network(e.g., AVHzY AC WiFi Watt Meter). Also,
widening the study to include all performance bugs would be
welcome.
R EFERENCES
[1] Clare Balboni, Aaron Berman, Robin Burgess, and Benjamin A Olken.
The economics of tropical deforestation. Annual Review of Economics,
15:723–754, 2023.
[2] M. Berners-Lee. The Carbon Footprint of Everything. Greystone Books,
2022.
[3] Yiqun Chen, Oliver Schwahn, Roberto Natella, Matthew Bradbury, and
Neeraj Suri. Slowcoach: Mutating code to simulate performance bugs.
In 2022 IEEE 33rd International Symposium on Software Reliability
Engineering (ISSRE), pages 274–285, 2022.
[4] The Nature Conservancy. Calculate your carbon footprint, 2023. Last
accessed 25 Octobre 2023.
[5] Payal Dhar. The carbon impact of artificial intelligence. Nat. Mach.
Intell., 2(8):423–425, 2020.