Runtime monitoring
CO444H
Ben Livshits
1
CO444H Ben Livshits 1 Basic Instrumentation Insert additional - - PowerPoint PPT Presentation
Runtime monitoring CO444H Ben Livshits 1 Basic Instrumentation Insert additional code into the program This code is designed to record important events as they occur at runtime Some examples A particular function is being hit or
1
they occur at runtime
hit
2
Levels of Instrumentation
general
statements
3
monitoring
4
5
safety
data structures
6
7
8
zones
memory
an array hits unallocated memory
9
immediately
the malloc library
10
11
12
Data Races
13
Not All Races Are Made Equal
don’t lead to anything particularly bad
to execute first
14
15
16
instrumentation:
shared variables
points
fundamentally unsound, i.e. prone to false negatives
many execution schedules
17
18
programming discipline?
guard access to shared variables with locks
variable is protected by at least one lock
protected by locks is an error
19
lock protects a variable?
many unrelated locks
variables and locks may not be very clear
want to do extensive analysis because of
locks that is held at the time of accessing the variable
all locks in the program
𝑚𝑝𝑑𝑙𝑡_ℎ𝑓𝑚𝑒(𝑢)
error
20
before initialization
happen?
runtime
21
about shared reads
locksets until
the value
the value
as before but only infer locksets for shared- modified state locations
22
but multiple readers
either in write mode or read mode for all accesses of a shared location
read and write mode locks
𝑚𝑝𝑑𝑙𝑡_ℎ𝑓𝑚𝑒(𝑢)
𝑥𝑠𝑗𝑢𝑓_𝑚𝑝𝑑𝑙𝑡_ℎ𝑓𝑚𝑒(𝑢)
23
program at the binary level
the level of the source
shadow word (32 bits)
lockset key
encoded using an integer key in a hashtable
many distinct sets of locks
24
This is the Basis for a Tool Called Eraser
25
26
program to find a slow memory leak
not found in testing
27
techniques that are borrowed from garbage collection
has no more pointers to it is considered to be a leak
collector, don’t free any garbage, just detect it and report
in Java?
been accessed for a long time
allocation, track the last access time, periodically report unused objects
28
the heap are accessible, in C and C++ that is a difficult task
garbage
29