Pin (computer program): Difference between revisions

Content deleted Content added
Nitzanms (talk | contribs)
OAbot (talk | contribs)
m Open access bot: url-access updated in citation with #oabot.
 
(89 intermediate revisions by 69 users not shown)
Line 1:
{{Infobox software
| developer = [[Intel]]
| latest release version = 23.831
| latest release date = {{release date|032024|1106|2010 30}}
| operating_system = [[Linux]] and, [[Windows]]., [[macOS]]
| platform = [[IA32IA-32]], [[Intel64x86-64]] and, [[IA64Intel Xeon Phi]]
| genre = [[instrumentation_Instrumentation (computer_programmingcomputer programming)|Instrumentation Frameworkframework]], [[Profiler_Profiling (computer_sciencecomputer programming)|Profiler]]
| license = [[Proprietary software|Proprietary]], Pin is given free of charge for non-commercialany use under the '''[https://software.intel.com/sites/landingpage/pintool/intel-simplified-software-license.txt Intel Simplified Software License]'''.
| website = {{URL|http://www.pintoolintel.orgcom/software/pintool}}
}}
'''Pin''' is a platform for the creation ofcreating analysis tools. A pin tool comprises instrumentation, analysis and callback [[routineSubroutine|routines]]. Instrumentation routines are called when code that has not yet been recompiled is about to be run, and enable the insertion of analysis routines. Analysis routines are called when the code they are associated with them is run. Callback routines are only called when specific conditions are met, or when a certain event has occurred. Pin provides an extensive [[Applicationapplication Programmingprogramming Interface|APIinterface]] (API) for instrumentation at manydifferent abstraction levels, from a singleone instruction to an entire binary module. It also supports callbacks for many events such as library loads, system calls, signals/exceptions and thread creation events.
 
In 2020, it received the ''Programming Languages Software Award'' from [[Association for Computing Machinery|ACM]] [[SIGPLAN]].<ref>{{Cite web|url=http://www.sigplan.org/Awards/Software/|title=Programming Languages Software Award|website=www.sigplan.org}}</ref>
'''[http://www.pintool.org Pin]''' is a dynamic binary [[instrumentation_(computer_programming)|instrumentation]] framework for the [[IA32]], [[Intel64]] and [[IA64]] [[instruction set|instruction set architectures]] that enables the creation of [[dynamic program analysis]] tools. Some tools built with Pin are [[Intel Parallel Inspector]], [[Intel Parallel Amplifier]] and [[Intel Parallel Advisor]].
 
Pin performs instrumentation by taking control of the program just after it loads into the memory. It thenThen [[justJust-in-time compilation|just-in-time re-compilesrecompiles]] (JIT) small sections of the binary code using pin just before theyit areis run. New instructions, whichto perform the analysis, are added to the re-compiledrecompiled code. These new instructions come from the Pintool. A large array of optimization techniques are used to obtain the lowest possible running time and memory consumptionuse overhead. As of June 2010, Pin's average base overhead is 30 per centpercent (without running a pintool).<ref>[http://www.csjaleels.virginia.eduorg/kimajaleel/docspublications/ieeeComputer10.pdf Analyzing Parallel Programs with Pin]</ref>.
The tools created using Pin, called Pintools, can be used to perform program analysis on [[user space]] applications in [[Windows]]<ref>[http://www.cs.virginia.edu/kim/docs/ispass10.pdf Dynamic Program Analysis of Microsoft Windows Applications]</ref> and [[Linux]]. Since Pin is a dynamic binary instrumentation tool, the instrumentation is performed at [[run time]] on the compiled binary files. It therefore does not require re-compilation of the source code and can support the instrumentation of programs that dynamically generate code.
 
== Features ==
Pin was originally created as a tool for computer architecture analysis, but its flexible API and an active community (called "Pinheads") have created a diverse set of tools for security, emulation and parallel program analysis.
 
=== Instrumentation Modesmodes ===
Pin is developed and supported by Intel, and is supplied free of charge for non-commercial use together with a kit of reference tools.
Pin supports two modes of instrumentation called JIT mode and Probe mode. JIT mode supports all the features of Pin, while Probe mode supports a limited feature set but is muchfar faster, adding almost no overhead to program's running time. JIT mode uses a just-in-time compiler to recompile all program code and insert instrumentation, while Probe mode uses [[Trampoline_Trampoline (computers)|code trampolines]] for instrumentation.
 
==Overview==
Pin performs instrumentation by taking control of the program just after it loads into memory. It then [[just-in-time compilation|just-in-time re-compiles]] small sections of binary code just before they are run. New instructions, which perform the analysis, are added to the re-compiled code. These new instructions come from the Pintool. A large array of optimization techniques are used to obtain the lowest possible running time and memory consumption overhead. As of June 2010, Pin's average base overhead is 30 per cent (without running a pintool)<ref>[http://www.cs.virginia.edu/kim/docs/ieeeComputer10.pdf Analyzing Parallel Programs with Pin]</ref>.
 
Pin is a platform for the creation of analysis tools. A pin tool comprises instrumentation, analysis and callback [[routine|routines]]. Instrumentation routines are called when code that has not yet been recompiled is about to be run, and enable the insertion of analysis routines. Analysis routines are called when the code they are associated with is run. Callback routines are called when specific conditions are met, or when a certain event has occurred. Pin provides an extensive [[Application Programming Interface|API]] for instrumentation at many abstraction levels, from a single instruction to an entire binary module. It also supports callbacks for many events such as library loads, system calls, signals/exceptions and thread creation events.
 
 
== Features ==
=== Instrumentation Modes ===
Pin supports two modes of instrumentation called JIT mode and Probe mode. JIT mode supports all the features of Pin, while Probe mode supports a limited feature set but is much faster, adding almost no overhead to program running time. JIT mode uses a just-in-time compiler to recompile all program code and insert instrumentation, while Probe mode uses [[Trampoline_(computers)|code trampolines]] for instrumentation.
 
=== Platform independence ===
Pin was designed withfor tool [[Cross-platform|portability in mind]], and despite JIT compiling from one ISA to the same ISA (and not using a single [[intermediate representation]] for all code), most of its APIs are architecture independent and [[Operatingoperating Systemsystem]] independent. It was also designed to be portable itself, carefully isolating platform-specific code from generic code, allowing the fast adaptation of Pin to new platforms. Approximately half of the code is generic and the rest is either architecture or OS dependent.<ref>[http://wwwursuletz.cs.virginia.educom/people/faculty/paperspdfs/p190-luk.pdf Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation]</ref>
 
=== Optimizations ===
Pin uses many techniques to optimize instrumentation and analysis code, using techniques such as [[Inline function|inlining]], [[liveness analysis]] and smart [[register spilling]]. Pin performs these optimizations automatically whenever possible, without needing users to insert any extra code to allow inlining. Naturally, some optimizations still require user hints, and some code structures are easier to inline than others. Direct linking of jitted code sections, a technique called ''trace linking'', and ''register binding reconciliation'', which minimizes register spilling and remapping, are also used.
, [[liveness analysis]] and smart [[register spilling]]. Pin performs these optimizations automatically whenever possible, without requiring the user to insert any extra code to allow inlining. Naturally, some optimizations still require user hints, and some code structures are easier to inline than others. Direct linking of jitted code sections, a technique called ''trace linking'', and ''register binding reconciliation'', which minimizes register spilling and remapping, are also used.
 
=== Ease of Useuse ===
Pin’s API and implementation are focused on making pin tools easy to write. Pin takes full responsibility for assuring that the instrumentation code from the pin tool does not affect the application state. Also, the API enables the instrumentation code to request many pieces of information from Pin. For example, the instrumentation code in the pin tool can use the Pin API to get the memory address being accessed by an instruction, without having to examine the instruction in detail.
 
== Tools ==
There are many Pintools that are used for varying tasks.
* Components of '''[[Intel Parallel Studio]]''' make heavy use of pintools for memory debugging, performance analysis, [[Thread (computer science)|multithreading]] correctness analysis and parallelization preparation.
* '''[http://software.intel.com/en-us/articles/intel-software-development-emulator/| Intel Software Development Emulator]''' is a pintool that enables the development of applications using instruction set extensions that are not currently implemented in hardware.
* '''CMP$IM''' is a cache profiler built using pin. <ref>[http://www.ece.umd.edu/~blj/papers/mobs2008.pdf CMP$im: A Pin-Based On-The-Fly Multi-Core Cache Simulator]</ref>
*'''[http://www.pinplay.org PinPlay]''' enables the capture and deterministic replay of the running of multithreaded programs under pin. Capturing the running of a program enables the developerhelps todevelopers overcome the non-determinism inherent toin multithreading.<ref>[http://delivery.acm.org/10.1145/1780000/1772958/p2-patil.pdf PinPlay: a framework for deterministic replay and reproducible analysis of parallel programs]</ref>
* Pin itself comes with many example tools that make use of its capabilitiesabilities. These tools are licensed under a BSD-like license.
 
== Alternatives to Pin Tool ==
There are many other tools available to collect resource usage of running programs on the system such as [[Bell Lab]]’s strapon tool and [[Dyninst]] tool etc. [[Bell Lab]]’s tool uses the strap on technology which runs a tool to collect resources simultaneously with the program but this tool is only compatible with the programs which allow other programs to run simultaneously with them.<ref>{{Cite journal|title = Building secure products and solutions|journal = Bell Labs Technical Journal|volume = 12|issue = 3|page = 21-38|last = Gupta|first = Chandrashekhar|date = 2007|doi = 10.1002/bltj.20247| s2cid=30412754 }}</ref> Furthermore, Dyninst tool uses [[binary rewriting]] of the program’s executable and implementable commands inside the program to check for resource usage and is very efficient. However, it is very unstable as it is a relatively new tool and crashes on large scale programs.<ref>{{Cite journal|title = Dynamic binary instrumentation and data aggregation on large scale systems|last = Lee|first = Schulz|date = 2007|journal = International Journal of Parallel Programming| volume=35 | issue=3 | pages=207–232 | doi=10.1007/s10766-007-0036-3 | s2cid=6653468 }}</ref> Lastly, [[Intel]] Pin tool uses static binary instrumentation and runs the program as a part of itself while keeping track of all its resources.<ref>{{Cite journal|title = Analyzing Parallel Programs with PIN|journal = Computer|date = March 2010|issn = 0018-9162|pages = 34–41|volume = 43|issue = 3|doi = 10.1109/MC.2010.60|first1 = M.|last1 = Bach|first2 = M.|last2 = Charney|first3 = R.|last3 = Cohn|first4 = E.|last4 = Demikhovsky|first5 = T.|last5 = Devor|first6 = K.|last6 = Hazelwood|first7 = A.|last7 = Jaleel|first8 = Chi-Keung|last8 = Luk|first9 = G.|last9 = Lyons| s2cid=15155077 }}</ref> This approach is more suitable for an antivirus as it can easily run all the processes under itself and can kill programs if they reach a maximum allocated limit as defined by the antivirus.
 
== See also ==
* [[Dynamic program analysis]]
* [[Valgrind]]
* [[DynamoRIO]]
 
== Notes ==
 
{{Reflist|2reflist}}
 
== References ==
 
{{refbegin}}
* {{ cite journal | title = Analyzing Parallel Programs With Pin | author author1= Moshe Bach, |author2=Mark Charney, |author3=Robert Cohn, |author4=Elena Demikhovsky, |author5=Tevi Devor, |author6=Kim Hazelwood, |author7=Aamer Jaleel, |author8=Chi-Keung Luk, |author9=Gail Lyons, |author10=Harish Patil, and |author11=Ady Tal | work name-list-style=amp |journal=Computer, vol. |volume=43, no. |number=3, pp.|pages=34–41 34-41, Mar.|date=March 2010 | publisher=IEEE |url=http://www.computer.org/portal/web/csdl/magazines/computer#4 IEEE|doi=10.1109/mc.2010.60 url|s2cid=15155077 |access-date=2010-07-05 |archive-url=https://web.archive.org/web/20101229163736/http://www.computer.org/portal/web/csdl/magazines/computer#4 |archive-date=2010-12-29 |url-status=dead |url-access=subscription }}
* {{ cite journalconference | title = Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation | authorurl = https://www.cs.tufts.edu/comp/150IPL/papers/luk05pin.pdf |author1=Chi-Keung Luk, |author2=Robert Cohn, |author3=Robert Muth, |author4=Harish Patil, |author5=Artur Klauser, |author6=Geoff Lowney, |author7=Steven Wallace, |author8=Vijay Janapa Reddi, and |author9=Kim Hazelwood |name-list-style=amp work| book-title = Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation, pp.| 190-120,pages = 190–120 | date = June 2005 | publisher = ACM | url___location = http://www.cs.virginia.edu/papers/p190-luk.pdf Chicago, Illinois, USA }}
* {{ cite conference | title = Dynamic Program Analysis of Microsoft Windows Applications | authorurl = http://www.cs.virginia.edu/kim/docs/ispass10.pdf |author1=Alex Skaletsky, |author2=Tevi Devor, |author3=Nadav Chachmon, |author4=Robert Cohn, |author5=Kim Hazelwood, |author6=Vladimir Vladimirov, |author7=Moshe Bach | ___locationbook-title = International Symposium on Performance Analysis of Software and Systems (ISPASS) | pages = 2–12 | date = April 2010 | ___location = White Plains, NY | archive-url = https://web.archive.org/web/20160918102825/http://www.cs.virginia.edu/kim/docs/ispass10.pdf | archive-date = 2016-09-18 }}
{{refend}}
* {{ cite conference | title = Dynamic Program Analysis of Microsoft Windows Applications | author = Alex Skaletsky, Tevi Devor, Nadav Chachmon, Robert Cohn, Kim Hazelwood, Vladimir Vladimirov, Moshe Bach | ___location = International Symposium on Performance Analysis of Software and Systems (ISPASS) | url = http://www.cs.virginia.edu/kim/docs/ispass10.pdf }}
{{refend}}
 
== External Linkslinks ==
* [http://pintool.intel.com/ Pin: a dynamic binary instrumentation tool] home page
* [httphttps://tech.groups.yahoo.comio/groupg/pinheads/ Pinheads], a mailing list for the Pin users community.
* [http://jbremer.org/detecting-uninitialized-memory-read-access-bugs-using-pin-a-la-valgrind/ Detecting Read-Before-Write Bugs (a la Valgrind)]
* [https://github.com/SEDS/PinPP Pin++], a framework for authoring Pintools
 
[[Category:Profilers]]
* [http://www.pintool.org/ Pin's home page].
* [http://tech.groups.yahoo.com/group/pinheads/ Pinheads], a mailing list for the Pin users community.