Digging Down Into Perl Hood with the Debugger DIGGING DOWN INTO PERL

Total Page:16

File Type:pdf, Size:1020Kb

Digging Down Into Perl Hood with the Debugger DIGGING DOWN INTO PERL @SW:Perl Debugger PROGRAMMING Perl: Perl Debugger Digging down into Perl hood with the debugger DIGGING DOWN INTO PERL www.sxc.hu The Perl interpreter, perl, doesn’t often crash, but if it happens, not even the excellent Perl debugger will be able to help you. To allow the debugger to map the BY MICHAEL SCHILLI functions to lines in the C source code, you need to compile Perl with the -g compiler flag for troubleshooting sup- f you program in Perl rather than in beds it dynamically in the script. The C port. When the Configure script prompts C or C++, you will probably be code after the __END__ tag sets a pointer you to decide which optimizer/debugger Igrateful for a few things that Perl to an address of 0xcba00000, and then flag should be used, say -g in response, takes off your hands: memory allocation, it tells the strcpy C function to overwrite or use the following Configure command counting references, watching out for the protected kernel address on ma- line: ./Configure -D optimize=-g -d. rogue pointers, freeing up memory – chines that use the 32-bit x86 architec- these labors of Sisyphus are offloaded ture. The CPU notices what happened Listing 1: crash from the developer's desk by Perl’s vir- to the script and triggers an interrupt, at 01 #!/usr/bin/perl -w tual machine, helping developers to keep which point the Linux kernel pulls the focused on the implementation. rug out from underneath the offending 02 use strict; Down below in the engine room, program’s feet. 03 use Inline "C"; things can start to go awry. Although Figure 1 shows you how to call the 04 use Inline Config => you will rarely make the acquaintance of Perl script to reproduce the error in the 05 CLEAN_AFTER_BUILD => 0; a bug in a Perl release that actually takes GNU debugger, gdb. The calling binary down the C-based virtual machine, add- is the Perl interpreter, so the debugger 06 ins programmed by unwary C/ C++ will launch with gdb perl. To allow the 07 c_crash(43); developers can trip you up. interpreter to process the Perl crash 08 script, just call the run crash command 09 __END__ Linux Pulling the Rug in the debugger. After the crash, gdb will 10 __C__ Out from Under Your Feet give you the C code for the line that The script in Listing 1 uses a C extension caused the crash. The debugger bt (for 11 int c_crash( int num ) { to deliberately take down the interpreter backtrace) command (you could use 12 char *cp = 0xcba00000; with a segmentation fault. To do so, it where as an alternative) also shows the 13 strcpy(cp, "Ouch!"); uses the Inline CPAN module, which hierarchy of the calling C function as a 14 } compiles the attached C code and em- stack trace. 72 ISSUE 75 FEBRUARY 2007 WWW.LINUX - MAGAZINE.COM Perl: Perl Debugger PROGRAMMING You can extract in- $ ls -l core.* formation from Perl -rw------- 1 mschilli mschilli U compiled in the nor- 1658880 Nov 3 21:30 core.1234 mal way. Although the post-mortem is The core dump is normally stored in the slightly more difficult, directory where the program was called, a trick, which I will unless /proc/sys/kernel/core_pattern says explain later, can help to do otherwise. If you want to find out you avoid excessive what caused the crash, run the debugger hex juggling. against the executable and the core file (as in gdb perl core.1234). Your debugger Post-Mortem session should look something like Fig- of a Script ure 1, and you will be able to do a stack If a crash occurs in a trace at a point just before the crash oc- running program, the curred. What you can’t do, however, is Linux kernel will nor- actually execute this memory snapshot. mally create a core The stacktrace in Figure 1 tells us that file. If not, you may perl crashed in a file called crash_3e35.xs Figure 1: A gdb session showing the stack trace. find that bash is pre- (Line 7) inside a C function called venting core dumps c_crash() while trying to executed the C If you fail to do this, analysis becomes due to the default setting of ulimit -c 0. strcpy() function. If you now use the de- tricky due to the lack of references to If you change this to ulimit -c unlimited bugger’s print cp command to check the the C source code, and if the executable instead, you will find a core file (core or target address, a value of 0xcba00000 is has been stripped, you have little to even core.xxxx with the pid attached): returned. This explains the crash to the work with; let’s leave this interpretation investigating detective. of disassembled assembler code in the $ ./crash However, gdb only tells you about the hands of long-bearded gurus! Segmentation fault (core dumped) goings on at C level. How can you find advertisement WWW.LINUX - MAGAZINE.COM ISSUE 75 FEBRUARY 2007 73 PROGRAMMING Perl: Perl Debugger argument stack, and These opcode structures are the building this is also where the blocks that Perl programs are built with, value of 43 is repre- after the compiler has read the source sented as one of Perl’s code from the script. SV (Scalar Value) Let’s try to find out what type the structures. To extract global PL_op variable, which you can the integer value, you see here, is. Considering the excessive must cast PL_stack_ use of macros in the Perl kernel, this can sp->sv_any to be quite difficult to do. gdb can help: (XPVIV*); it will return the numeric (gdb) whatis PL_op value of the argument type = OP * passed in to c_crash() in its xiv_iv member: A print *PL_op command in the lower gdb window shows the content of the (gdb) p ((XPVIV*)U data structure. PL_op is a pointer to a PL_stack_sp-> structure, and the asterisk * tells gdb not sv_any)->xiv_iv to display the address, but rather the $1 = 43 content of the data structure. For a per- manent graphic display of the opcode Cheers! data in Figure 2 in the top window of Figure 2: The GUI debugger, ddd, has latched onto a Perl process, The gdb debugger can ddd, you need to enter graph display and is now outputing the opcodes that Perl’s virtual machine is also notch into an ac- `p PL_op` in the gdb window, and then currently performing. tive process. In this double-click the hex address (it’s under- case, it automatically lined in blue) in the top display of the out which Perl script and which line the stops the process for a short time, and opcode box that appears. This tells ddd crash occurred in? To do so, you will then steps through it when requested to. to expand the data structure hiding be- need to analyze Perl’s C data structures, This is particularly useful when a Perl hind this address, and display its attri- which will give you some insight into process hangs, and you have not imple- butes in the new, larger box on the right. the status of the virtual machine at the mented logging. The output for the OP node reveals time of the crash. The Perl program in Listing spinner more than just pointers to following How can you ascertain that c_crash only calls an infinite sleep() loop and OPs and an address for the code to be was called with an argument of 43? To outputs its process ID and the time in executed; there is also a op_type field, do so, you need some knowledge of the seconds since the epoch. If the process which tells us the opcode type. internal workings of Perl, which you can ID is 1234, calling gdb perl -p 1234 will glean from the perlguts and perlhack latch onto the active process. Instead of Opcode Parade manpages. Perl’s virtual machine pushes the command-line debugger, we will use To display the opcodes for an active Perl function arguments onto the stack, in a the GUI-based version, ddd. You can see program, you must define the following similar style to a C compiler, before they the debugger in Figure 2, and your distri- are called by a Perl function. The PL_ bution should include it. ddd under- Listing 4: perl_compile stack_sp variable points to the tip of the stands gdb command-line options, so 01 #!/usr/bin/perl -w you can replace gdb with ddd in the pre- 02 use strict; Listing 2: spinner vious command line. You are likely to 03 use Config; catch the Perl process sleep()ing. #!/usr/bin/perl -w The up tells the debugger to jump up 04 02 use strict; to the next highest layer of stackframes, 05 my($file) = @ARGV; 03 that is, to move up in the function call 06 die "usage $0 file.c" unless 04 while(1) { hierarchy. Four levels further up, the defined $file; 05 function(time); source code window shows the short 07 (my $solib = $file) =~ /\ 06 sleep(1); while loop running the opcodes for a s.c/.so/; script in the Perl interpreter (Figure 2). 08 07 } 09 my $cmd = /\ 08 Listing 3: optest.c "gcc -shared -o $solib " . 09 sub function { 01 #include "EXTERN.h" 10 "$Config{ccflags} -g -fpic " . 10 my($time) = @_; 02 #include "perl.h" 11 "-I$Config{archlibexp}/CORE 11 03 #include "XSUB.h" $file"; 12 print "$$: $time\n"; 04 struct op **my_special_op = 12 13 } NULL; 13 system $cmd; 74 ISSUE 75 FEBRUARY 2007 WWW.LINUX - MAGAZINE.COM advertisement PROGRAMMING Perl: Perl Debugger code the virtual ma- shared library based on the optest.c list- chine is running.
Recommended publications
  • Awstats Logfile Analyzer Documentation
    AWStats logfile analyzer 7.4 Documentation Table of contents Release Notes Reference manual What is AWStats / Features Install, Setup and Use AWStats New Features / Changelog Configuration Directives/Options Upgrade Configuration for Extra Sections feature Contribs, plugins and resources Other provided utilities Glossary of terms Other Topics Comparison with other log analyzers FAQ and Troubleshooting Benchmarks AWStats License Plugin Developement AWStats modules for third tools AWStats module for Webmin AWStats module for Dolibarr ERP & CRM Table of contents 1/103 14/07/2015 AWStats logfile analyzer 7.4 Documentation What is AWStats / Features Overview AWStats is short for Advanced Web Statistics. AWStats is powerful log analyzer which creates advanced web, ftp, mail and streaming server statistics reports based on the rich data contained in server logs. Data is graphically presented in easy to read web pages. AWStats development started in 1997 and is still developed today by same author (Laurent Destailleur). However, development is now done on "maintenance fixes" or small new features. Reason is that author spend, since July 2008, most of his time as project leader on another major OpenSource projet called Dolibarr ERP & CRM and works also at full time for TecLib, a french Open Source company. A lot of other developers maintains the software, providing patches, or packages, above all for Linux distributions (fedora, debian, ubuntu...). Designed with flexibility in mind, AWStats can be run through a web browser CGI (common gateway interface) or directly from the operating system command line. Through the use of intermediary data base files, AWStats is able to quickly process large log files, as often desired.
    [Show full text]
  • Modern Perl, Fourth Edition
    Prepared exclusively for none ofyourbusiness Prepared exclusively for none ofyourbusiness Early Praise for Modern Perl, Fourth Edition A dozen years ago I was sure I knew what Perl looked like: unreadable and obscure. chromatic showed me beautiful, structured expressive code then. He’s the right guy to teach Modern Perl. He was writing it before it existed. ➤ Daniel Steinberg President, DimSumThinking, Inc. A tour de force of idiomatic code, Modern Perl teaches you not just “how” but also “why.” ➤ David Farrell Editor, PerlTricks.com If I had to pick a single book to teach Perl 5, this is the one I’d choose. As I read it, I was reminded of the first time I read K&R. It will teach everything that one needs to know to write Perl 5 well. ➤ David Golden Member, Perl 5 Porters, Autopragmatic, LLC I’m about to teach a new hire Perl using the first edition of Modern Perl. I’d much rather use the updated copy! ➤ Belden Lyman Principal Software Engineer, MediaMath It’s not the Perl book you deserve. It’s the Perl book you need. ➤ Gizmo Mathboy Co-founder, Greater Lafayette Open Source Symposium (GLOSSY) Prepared exclusively for none ofyourbusiness We've left this page blank to make the page numbers the same in the electronic and paper books. We tried just leaving it out, but then people wrote us to ask about the missing pages. Anyway, Eddy the Gerbil wanted to say “hello.” Prepared exclusively for none ofyourbusiness Modern Perl, Fourth Edition chromatic The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina Prepared exclusively for none ofyourbusiness Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks.
    [Show full text]
  • Considerations on Porting Perl to the Java Virtual Machine
    UNIVERSITY OF CINCINNATI 22 January, 2001 I, Bradley M. Kuhn, hereby submit this as part of the requirements for the degree of: Master of Science in: Dept. of Elec. and Comp. Eng. and Comp. Science It is entitled: Considerations on Porting Perl to the Java Virtual Machine Approved by: Fred Annexstein John Franco Larry Wall Hongwei Xi Considerations on Porting Perl to the Java Virtual Machine A thesis submitted to the Division of Research and Advanced Studies of the University of Cincinnati in partial fulfillment of the requirements for the degree of Master of Science in the Department of Electrical and Computer Engineering and Computer Science of the College of Engineering 2001 by Bradley M. Kuhn B.S., Loyola College In Maryland, 1995 Committee Chair: John Franco, PhD. Abstract The Java Virtual Machine (JVM) is perhaps the most interesting aspect of the Java programming environment. Much attention has been placed on porting non-Java languages to the JVM. Such ports are useful since JVMs are now embedded in hardware devices, as well as in software applications such as web browsers. In addition, well designed JVM ports can utilize the JVM as a common object model for multiple languages, allowing larger applications to easily be written in and scripted with multiple programming languages. This thesis presents a survey of possible approaches for porting non-Java languages to the JVM. The advantages and disadvantages of each approach are considered. Examples of JVM ports of other programming languages, such as Python, Scheme, and Tcl are presented and considered. The focus, however, is a port of Perl to the JVM.
    [Show full text]
  • Ubuntu:Precise Ubuntu 12.04 LTS (Precise Pangolin)
    Ubuntu:Precise - http://ubuntuguide.org/index.php?title=Ubuntu:Precise&prin... Ubuntu:Precise From Ubuntu 12.04 LTS (Precise Pangolin) Introduction On April 26, 2012, Ubuntu (http://www.ubuntu.com/) 12.04 LTS was released. It is codenamed Precise Pangolin and is the successor to Oneiric Ocelot 11.10 (http://ubuntuguide.org/wiki/Ubuntu_Oneiric) (Oneiric+1). Precise Pangolin is an LTS (Long Term Support) release. It will be supported with security updates for both the desktop and server versions until April 2017. Contents 1 Ubuntu 12.04 LTS (Precise Pangolin) 1.1 Introduction 1.2 General Notes 1.2.1 General Notes 1.3 Other versions 1.3.1 How to find out which version of Ubuntu you're using 1.3.2 How to find out which kernel you are using 1.3.3 Newer Versions of Ubuntu 1.3.4 Older Versions of Ubuntu 1.4 Other Resources 1.4.1 Ubuntu Resources 1.4.1.1 Unity Desktop 1.4.1.2 Gnome Project 1.4.1.3 Ubuntu Screenshots and Screencasts 1.4.1.4 New Applications Resources 1.4.2 Other *buntu guides and help manuals 2 Installing Ubuntu 2.1 Hardware requirements 2.2 Fresh Installation 2.3 Install a classic Gnome-appearing User Interface 2.4 Dual-Booting Windows and Ubuntu 1 of 212 05/24/2012 07:12 AM Ubuntu:Precise - http://ubuntuguide.org/index.php?title=Ubuntu:Precise&prin... 2.5 Installing multiple OS on a single computer 2.6 Use Startup Manager to change Grub settings 2.7 Dual-Booting Mac OS X and Ubuntu 2.7.1 Installing Mac OS X after Ubuntu 2.7.2 Installing Ubuntu after Mac OS X 2.7.3 Upgrading from older versions 2.7.4 Reinstalling applications after
    [Show full text]
  • Free and Open Source Software
    Free and open source software Copyleft ·Events and Awards ·Free software ·Free Software Definition ·Gratis versus General Libre ·List of free and open source software packages ·Open-source software Operating system AROS ·BSD ·Darwin ·FreeDOS ·GNU ·Haiku ·Inferno ·Linux ·Mach ·MINIX ·OpenSolaris ·Sym families bian ·Plan 9 ·ReactOS Eclipse ·Free Development Pascal ·GCC ·Java ·LLVM ·Lua ·NetBeans ·Open64 ·Perl ·PHP ·Python ·ROSE ·Ruby ·Tcl History GNU ·Haiku ·Linux ·Mozilla (Application Suite ·Firefox ·Thunderbird ) Apache Software Foundation ·Blender Foundation ·Eclipse Foundation ·freedesktop.org ·Free Software Foundation (Europe ·India ·Latin America ) ·FSMI ·GNOME Foundation ·GNU Project ·Google Code ·KDE e.V. ·Linux Organizations Foundation ·Mozilla Foundation ·Open Source Geospatial Foundation ·Open Source Initiative ·SourceForge ·Symbian Foundation ·Xiph.Org Foundation ·XMPP Standards Foundation ·X.Org Foundation Apache ·Artistic ·BSD ·GNU GPL ·GNU LGPL ·ISC ·MIT ·MPL ·Ms-PL/RL ·zlib ·FSF approved Licences licenses License standards Open Source Definition ·The Free Software Definition ·Debian Free Software Guidelines Binary blob ·Digital rights management ·Graphics hardware compatibility ·License proliferation ·Mozilla software rebranding ·Proprietary software ·SCO-Linux Challenges controversies ·Security ·Software patents ·Hardware restrictions ·Trusted Computing ·Viral license Alternative terms ·Community ·Linux distribution ·Forking ·Movement ·Microsoft Open Other topics Specification Promise ·Revolution OS ·Comparison with closed
    [Show full text]
  • Perl 5 Internals
    Perl 5 Internals Simon Cozens Perl 5 Internals by Simon Cozens Copyright © 2001 by NetThink Open Publications License 1.0 Copyright (c) 2001 by NetThink. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). This series contains material adopted from the Netizen Perl Training Fork (http://spork.sourceforge.net/), by kind permission of Kirrily Robert. Table of Contents 1. Preliminaries ..............................................................................................................1 1.1. Course Outline ..................................................................................................1 1.2. Assumed Knowledge ........................................................................................1 1.3. Objectives..........................................................................................................2 1.4. The course notes ...............................................................................................2 2. Perl Development Structure......................................................................................1 2.1. Perl Versioning..................................................................................................1 2.2. The Development Tracks ..................................................................................1 2.3. Perl 5 Porters.....................................................................................................2
    [Show full text]
  • Awstats Logfile Analyzer Documentation
    AWStats logfile analyzer 7.0 Documentation Table of contents Enter your search terms Submit search form AWStats web and documentation Web Release Notes Reference manual What is AWStats / Features Install, Setup and Use AWStats New Features / Changelog Configuration Directives/Options Upgrade Configuration for Extra Sections feature Contribs, plugins and resources Other provided utilities AWStats Webmin admin module Glossary of terms Other Topics Comparison with other log analyzers FAQ and Troubleshooting Benchmarks AWStats License Plugin Developement Table of contents 1/96 22/06/2010 AWStats logfile analyzer 7.0 Documentation What is AWStats / Features Overview AWStats is short for Advanced Web Statistics. AWStats is powerful log analyzer which creates advanced web, ftp, mail and streaming server statistics reports based on the rich data contained in server logs. Data is graphically presented in easy to read web pages. Designed with flexibility in mind, AWStats can be run through a web browser CGI (common gateway interface) or directly from the operating system command line. Through the use of intermediary data base files, AWStats is able to quickly process large log files, as often desired. With support for both standard and custom log format definitions, AWStats can analyze log files from Apache (NCSA combined/XLF/ELF or common/CLF log format), Microsoft's IIS (W3C log format), WebStar and most web, proxy, wap and streaming media servers as well as ftp and mail server logs. See how the most famous open source statistics tools (AWStats, Analog, Webalizer) stack up feature by feature in this comparison table. AWStats is free software distributed under the GNU General Public License.
    [Show full text]
  • Advanced Design and Implementation of Virtual Machines
    Advanced Design and Implementation of Virtual Machines Advanced Design and Implementation of Virtual Machines Xiao-Feng Li CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2017 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Printed on acid-free paper Version Date: 20160714 International Standard Book Number-13: 978-1-4665-8260-6 (Hardback) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid- ity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or uti- lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy- ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http:// www.copyright.com/) or contact the Copyright Clearance Center, Inc.
    [Show full text]
  • First Steps in Perl
    First Steps In Perl Vitually all programming languages have certain things in common. The fundamental concepts of programming are the same, no matter what language you do them in. In this chapter, we'll investigate what you need to know before you start writing any programs at all. For instance: ❑ What is programming anyway? What does it mean to program? ❑ What happens to the program that we write? ❑ How do we structure programs and make them easy to understand? ❑ How do computers see numbers and letters? ❑ How do we find and eliminate errors in our programs? Of course, we'll be looking at these from a Perl perspective, and we'll look at a couple of basic Perl programs, and see how they're constructed and what they do. At the end of this chapter, I'm going to ask you to write a couple of simple Perl programs of your own. Programming Languages The first question I suppose we really should ask ourselves when we're learning programming is, 'What is programming?' That may sound particularly philosophical, but the answer is easy. Programming is telling a computer what you want it to do. The only trick, then, is to make sure that the program is written in a way the computer can understand. and to do this, we need to write it in a language that it can comprehend – a programming language, such as Perl. Writing a program does not require special skills, but it does call for a particular way of thinking. When giving instructions to humans, you take certain things for granted.
    [Show full text]
  • Java Bytecode Obfuscation
    JAVA BYTECODE OBFUSCATION by Michael R. Batchelder School of Computer Science McGill University, Montreal´ January 2007 A THESIS SUBMITTED TO THE FACULTY OF GRADUATE STUDIES AND RESEARCH IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE Copyright c 2007 by Michael R. Batchelder Abstract Programs written for machine execution will always be susceptible to information theft. This information can include trademarked algorithms, data embedded in the program, or even data the program accesses. As technology advances computer scientists are building more and more powerful tools for reverse-engineering such as decompilers. The Java programming language is particularly open to reverse-engineering attacks because of its well-defined, open, and portable binary format. We examine one area of better-securing the intellectual property of a Java program; obfuscation. Obfuscation of a program involves transforming the code of the program into a more complex, but semanti- cally equivalent representation. This can include the addition of confusing control flow, the removal of certain information embedded in the program which is not explicitly required for execution, or the cloaking of data. Obfuscation is one of the only techniques available other than cryptological options. While many approaches to obfuscation are ultimately reversible, it nevertheless seriously hinders those attempting to steal information by increasing the computing time and power required by software to reverse-engineer the program and also severely increases the com- plexity of any source code that is recovered by the reverse-engineering. In this thesis we present a number of obfuscating transformations implemented within a new automatic tool we name the Java Bytecode Obfuscator (JBCO).
    [Show full text]
  • Perljvm: Using B to Facilitate a Perl Port to the Java Virtual Machine
    perljvm: Using B to Facilitate a Perl Port To the Java Virtual Machine Bradley M. Kuhn Department of Electrical and Computer Engineering and Computer Science University of Cincinnati Cincinnati, OH 45219 [email protected] http://www.ebb.org/bkuhn Abstract perljvm is poised to be a functional JVM port of Perl. In designing perljvm, various ports of other languages to the JVM were studied and classified. Using this data, it was determined that Perl’s B (back-end) compiler modules provided the best path to accomplish a JVM port of Perl. Since the B modules provide access to to the internal representation (IR) used by the perl back-end, perljvm concerns itself only with translating that IR into JVM assembler, using the Jasmin assembler syntax. A JVM assembler code emitter module was developed to minimize perljvm’s dependence on Jasmin. To support Perl’s native data types on the JVM, equivalents for native Perl data structures must be designed and built in Java. Once perljvm is stable and most common Perl features are supported, work can begin on using the JVM as an object model to integrate Perl and Java objects seamlessly. At that time, integration with the JPL will be feasible. Introduction Perl is one of the most ported languages available for modern computing. However, Perl has yet to be ported to the Java Virtual Machine (JVM) architecture. Such a port of Perl is useful for the following reasons: • Many other very high level languages, including Ada, Eiffel, Java, Python, Scheme, and Tcl have working JVM ports. Perl must keep pace with its peers.
    [Show full text]
  • Introduction to Computational Techniques
    Chapter 2 Introduction to Computational Techniques Computational techniques are fast, easier, reliable and efficient way or method for solving mathematical, scientific, engineering, geometrical, geographical and statis- tical problems via the aid of computers. Hence, the processes of resolving problems in computational technique are most time step-wise. The step-wise procedure may entail the use of iterative, looping, stereotyped or modified processes which are incomparably less stressful than solving problems-manually. Sometimes, compu- tational techniques may also focus on resolving computation challenges or issues through the use of algorithm, codes or command-line. Computational technique may contain several parameters or variables that characterize the system or model being studied. The inter-dependency of the variables is tested with the system in form of simulation or animation to observe how the changes in one or more parameters affect the outcomes. The results of the simulations, animation or arrays of numbers are used to make predictions about what will happen in the real system that is being studied in response to changing conditions. Due to the adoption of computers into everyday task, computational techniques are redefined in various disciplines to accommodate specific challenges and how they can be resolved. Fortunately, computational technique encourages multi-tasking and interdisciplinary research. Since computational technique is used to study a wide range of complex systems, its importance in environmental disciplines is to aid the interpretation of field measurements with the main focus of protecting life, prop- erty, and crops. Also, power-generating companies that rely on solar, wind or hydro sources make use of computational techniques to optimize energy production when extreme climate shifts are expected.
    [Show full text]