El centro funcionará con normalidad, promoviendo el uso de recursos digitales, a través del correo electrónico y Classroom, dependiendo de la etapa
RESPONSABL E DEL
To analyze overheads in the presence of multiple speci cations, an experiment us- ing JMOP 2.3 was conducted. At the time of writing this thesis, JMOP 2.3 is the most efficient system, according to Jin et al. [44], that does not have any known major problem. For the experiment, the and benchmarks of Da-
GC time (sec) Total time (sec) Benchmark Memory (KB) Minor Major Runnable Blocked
† 13,191 0.1 0.1 22.5 0.0
‡ 104,749 2.1 0.9 108.1 37.9
† 30,720 0.2 0.2 21.6 14.7
‡ 926,729 9.5 9.3 162.0 113.0
Table 6.1: Peak memory, and GC time and total execution time with (‡) and without (†) the 179 speci cations.
Capo 9.12 [12] were executed with and without all the 179 speci cations from Chap- ter 5, because they showed large overheads in an exploratory testing. To measure overhead, VisualVM [69] was attached to the JVM.
JMOP 3.0, which incorporated all the optimizations in Jin [43], is available, but it has a fault that is non-trivial to x. It uses 𝔻⟨𝑋⟩, a monitoring algorithm introduced in Chen et al. [22], which should separately keep a timestamp for each monitor instance. As part of intensive optimizations, however, JMOP 3.0 moves the timestamp information to the weak reference, which can be shared among mul- tiple monitor instances. Consequently, timestamps of different monitor instances can wrongly affect each other, causing some monitor instances to ignore events. For example, suppose that JMOP 3.0 is handling an event that carries ⟨P↦ 𝑝,
Q↦ 𝑞⟩ and creating the weak reference for 𝑞. en, the timestamp, which records
the time this event is handled, is stored at the weak reference for 𝑞.4 When an
event that carries ⟨P↦ 𝑝,Q↦ 𝑞⟩ occurs later, the timestamp stored at the time
of handling the previous event will be retrieved, and this causes JMOP 3.0 to undesirably skip this event. In contrast, in the correct implementation, the stored timestamp would not be used because the previous event and the later one do not share the same monitor instance. is fault was validated by a concrete example and con rmed by the author of Jin [43].
It was meaningless to analyze the overhead of JMOP 3.0 and compare the performance of it with the new one, because it is faulty. Also, it seemed that writing a xed JMOP 3.0 unfortunately requires signi cant amount of work because it was caused not by a trivial mistake but by a wrong assumption, and it was revealed only aer signi cant modi cations for the separation of concerns (Section 6.1) and performance improvement have been started. For these reasons, overhead analysis and performance comparison were made using JMOP 2.3.
e results, summarized in Table 6.1, show that monitoring imposes signi cant
4JMOP 3.0 keeps the timestamp in one of parameters. Here we assume that JMOP 3.0 kept timestamps in weak references of 𝑄.
overhead on memory and, consequently, increases both minor and major garbage collection time.5 Jin [43] presents a few techniques for reducing the memory over- head of JMOP: avoiding creating multiple weak references for the same object, and combining indexing trees (Section 3.2) that share the same pre x.
Table 6.1 also shows that threads under monitored executions spent signi cant time in the “blocked” state; in particular, monitoring hindered and ’s concurrent execution. is is mainly because JMOP 2.3 uses one global lock in a coarse manner; if multiple events happen to occur in different threads at the same time, all the other threads should wait until the rst arriving thread nishes handling the event. is thesis proposes ne-grained locking to reduce such hindrance, as explained in Section 6.2.2.
In addition to the “blocked” state, the total time in the “runnable” state increased 5–7 times—this overhead includes the cost of the monitoring procedure, explained in Sections 2.3 and 2.4. Jin [43] suggests that invokingSystem.identityHashCode()6 is surprisingly expensive and the return value should be cached, instead of invok- ing it frequently; more speci cally, whenever JMOP 2.3 retrieves monitor in- stance(s) for a parameter binding.
e statistics on hot spots showed that an event that updates a set of monitor instances is expensive. To investigate the cause, we ran in DaCapo 9.12, which also showed large overhead, against theCollection_UnsafeIteratorspeci ca- tion, shown in Figure 2.2. e resulting statistics showed that 4% of entire CPU time is spent on handlingmodifyCollectionevents, and this is the second most time- consuming spot in the execution, preceded by an internally used method in RV- M. is result is surprising, considering that themodifyCollectionevent oc- curred fewer than the other two events by an order of magnitude; the number of occurrences ofcreateIterator,modifyCollectionanduseIteratorwere 6.3M, 0.7M and 10M, respectively.
e main reason for the large overhead of handlingmodifyCollectionevents is that there were numerous7monitor instances that transition upon an occurrence of that event. is can happen when there is a long-livedCollectionobject that has created manyIteratorobjects—recall that, according to De nition 4, amodifyCol- lection⟨Collection↦ 𝑐⟩ event should be dispatched to all the trace slices that cor-
respond to ⟨Collection↦ 𝑐,Iterator↦ 𝑖⟩, ⟨Collection↦ 𝑐,Iterator↦ 𝑖⟩,
…, ⟨Collection↦ 𝑐,Iterator↦ 𝑖𝑛⟩, where 𝑖, …, 𝑖𝑛are theIteratorobjects that
𝑐has created, using theiterator()method.
5Information on minor and major collections can be found in Java SE 6 HotSpot Virtual Machine Garbage Collection Tuning [40].
6is method returns the hash code based on the object’s identity, not class-speci c hash function. 7In an extreme case, there were about 300,000 monitor instances for a singleCollectionobject. is number may differ according to the heap size or the threshold for triggering the garbage collector.
In this case, terminating monitor instances that would never violate the prop- erty, proposed in Jin et al. [44], is not useful becauseuseIterator⟨Iterator↦ 𝑖𝑗⟩,
where 1 ≤ 𝑗 ≤ 𝑛, causes any of the above trace slices to reach the violation state. e number of monitor instances for thatCollectionobject, 𝑛, continues to grow until memory pressure reaches a certain threshold and, consequently, the JVM trig- gers a garbage collection.
When amodifyCollection⟨Collection↦ 𝑐⟩ event occurs, JMOP rst nds
the corresponding set of monitors by looking up the middle tree of Figure 3.1 or the le tree of Figure 3.2. en, it sequentially sends this event to each monitor instance in the set. Although this behavior is correct and looks normal, it turned out that only a small number of monitor instances8are actually affected by such an event; all other monitor instances stay at the same state due to the self-loop. is thesis addresses such overhead by introducing a new implementation for a set of monitor instances, as explained in Section 6.2.3.