Parallel GC. (Chapter 14) Eleanor Ainy December 16 th 2014

Size: px
Start display at page:

Download "Parallel GC. (Chapter 14) Eleanor Ainy December 16 th 2014"

Transcription

1 GC (Chapter 14) Eleanor Ainy December 16 th

2 Outline of Today s Talk How to use parallelism in each of the 4 components of tracing GC: Marking Copying Sweeping Compaction 2

3 Introduction Till now Multiple mutator threads But only 1 collector thread Poor use of resources! Assumption remains: No mutators run in parallel to the collector! 3

4 Introduction vs. Non- Collection Mutator Collection Cycle 1 Collection Cycle 2 4

5 Introduction The Goal To reduce: Time overhead of garbage collection Pause times in case of stop-the-world collection 5

6 Introduction GC Challenges Ensure there is sufficient work to be done. Otherwise it s not worth it! Load balancing distribute work & other resources in a way that minimizes the coordination needed. Synchronization needed for both correctness and to avoid repeating work. 6

7 Introduction More on Load Balancing Static Partitioning Some processors will probably have more work to do compared to others. Some processors will exhaust their resources before others do. 7

8 Introduction More on Load Balancing Dynamic Load Balancing Sometimes it s possible to obtain a good estimate of the amount of work to be done in advance More often it s not possible to estimate that Solution: (1) Over-partition the work into more tasks (2) Have each thread compete to claim one task at a time to execute. Advantages: (1) More resilient to changes in the number of processors available (2) If one task takes longer to execute other threads can execute any further work 8

9 Introduction More on Load Balancing Why not divide the work to the smallest possible independent tasks? The coordination cost is too expensive! Synchronization guarantees correctness and avoids unnecessary work, but has time & space overheads! Algorithms try to minimize the synchronization needed by using thread-local data structures, for instance. 9

10 Introduction Processor-centric VS. Memory-centric Processor-centric algorithms: threads acquire work that vary in size. threads steal work from other threads little regard to the location of the objects Memory-centric algorithms: take location into greater account operate on continuous blocks of heap memory acquire/release work from/to shared pools of fixed-size buffers of work 10

11 Introduction Algorithms Abstraction Assumption: Each collector thread executes the following loop (*): while not terminated() acquirework() performwork() generatework() (*) in most cases. 11

12 Outline of Today s Talk How to use parallelism in each of the 4 components of tracing GC: Marking Copying Sweeping Compaction 12

13 Marking Marking comprises of 1) Acquisition of an object from a work list 2) Testing & setting marks 3) Generating further marking work by adding the object s children to the work list 13

14 Marking Important Note All known parallel marking algorithms are processor-centric! 14

15 Marking When is Synchronization Required? No synchronization: If the work list is thread-local. Example: when an object s mark is represented by a bit in its header. Synchronization needed: Otherwise the thread must acquire work atomically from some other thread s work list or from some global list. Example: when marks are stored in a shared bitmap. 15

16 Marking Endo et al [1997] Mark Sweep Algorithm N total number of threads Each marker thread has its own: local mark stack a stealable work queue. shared stealableworkqueue[n] me mythreadid acquirework(): if not isempty(mymarkstack) return stealfrommyself() if isempty(mymarkstack) stealfromothers() 16

17 Marking Endo et al [1997] Mark Sweep Algorithm An idle thread acquires work by first examining its own queue and then other threads queues. stealfrommyself(): lock(stealableworkqueue[me]) n size(stealableworkqueue[me]) / 2 transfer(stealableworkqueue[me], n, mymarkstack) unlock(stealableworkqueue[me]) 17

18 Marking Endo et al [1997] Mark Sweep Algorithm An idle thread acquires work by first examining its own queue and then other threads queues. stealfromothers(): for each j in Threads if not locked(stealableworkqueue[j] ) if lock(stealableworkqueue[j]) n size(stealableworkqueue[j]) / 2 transfer(stealableworkqueue[j], n, mymarkstack) unlock(stealableworkqueue[j]) return 18

19 Marking Endo et al [1997] Mark Sweep Algorithm performwork(): while pop(mymarkstack, ref) for each fld in Pointers(ref) child *fld if child null && not ismarked(child) setmarked(child) push(mymarkstack, child) 19

20 Marking Endo et al [1997] Mark Sweep Algorithm Notice: it is possible for threads to mark the same child object. P 2 P 1 Stack A C 1 Stack B Queue A Queue B 20 Thread A Thread B

21 Marking Endo et al [1997] Mark Sweep Algorithm Each thread checks its own mark queue. If it s empty it transfers all its mark stack (apart from local roots) to the queue. generatework(): if isempty(stealableworkqueue[me]) n size(mymarkstack) lock(stealableworkqueue[me]) transfer(mymarkstack, n, stealableworkqueue[me]) unlock(stealableworkqueue[me]) 21

22 Marking Endo et al [1997] Mark Sweep Algorithm Marking With a Bitmap The collector tests the bit and only if it isn t set, attempts to set it atomically, retrying if the set fails. setmarked(ref): 22 oldbyte markbyte(ref) bitposition markbit(ref) loop if ismarked(oldbyte, bitposition) return newbyte mark(oldbyte, bitposition) if (CompareAndSet(&markByte(ref), oldbyte, newbyte) return CompareAndSet(x,old,new): atomic curr *x if curr = old *x new return true return false

23 Marking Endo et al [1997] Mark Sweep Algorithm Termination Detection Reminder From Previous Lecture: Separate thread for termination detection. Symmetric detection every thread can play the role of the detector. 23

24 Marking Endo et al [1997] Mark Sweep Algorithm Termination Detection Reminder From Previous Lecture: shared jobs[n] initial work assignments shared busy[n] [true, ] shared jobsmoved false shared alldone false me mythreadid 24

25 Marking Endo et al [1997] Mark Sweep Algorithm Termination Detection Reminder From Previous Lecture: worker(): 25 loop while not isempty(jobs[me]) job dequeue(jobs[me]) perform job if another thread j exists whose jobs set appears relatively large some stealjobs(j) enqueue(jobs[me], some) continue busy[me] false while no thread has jobs to steal && not alldone /* do nothing: wait for work or termination*/ if alldone return busy[me] true

26 Marking Endo et al [1997] Mark Sweep Algorithm Termination Detection Reminder From Previous Lecture: stealjobs(j): some atomicallyremovejobs(jobs[j]) if not isempty(some) jobsmoved true return some 26

27 Marking Endo et al [1997] Mark Sweep Algorithm Termination Detection Reminder From Previous Lecture: detect(): anyactive true while anyactive anyactive ( i) (busy[i]) anyactive anyactive jobsmoved jobsmoved false alldone true 27

28 Marking Endo et al [1997] Mark Sweep Algorithm Running Example Initially: queues are empty! acquirework if stack is non-empty returns. Stack A Stack B Queue A Queue B 28 Thread A Thread B

29 Marking Endo et al [1997] Mark Sweep Algorithm Running Example performwork pops, marks and pushes children. O 34 O 1 2 O 4 Stack B O 1 O 2 O 3 Queue B 29

30 Marking Endo et al [1997] Mark Sweep Algorithm Running Example generatework moves all the objects from the stack to the queue! O 3 O 2 Stack B O 2 O 3 Queue B 30

31 Marking Endo et al [1997] Mark Sweep Algorithm Running Example acquirework if stack is empty moves half the queue to the stack. Stack B Queue B Queue B 31

32 Marking Endo et al [1997] Mark Sweep Algorithm Running Example Stack A acquirework if queue is also empty, steals from other queues. This continues until there is no more work (the detector will detect this!). Stack B Queue A Queue B 32

33 Marking Flood et al [2001] Mark Sweep Algorithm N total number of threads Each thread has its own stealable deque (double-ended queue). The deques are fixed size to avoid allocation during collection causes overflow. All threads share a global overflow set implemented as a list of list. shared overflowset shared deque[n] me mythreadid 33 acquirework(): if not isempty(deque[me]) return n dequefixedsize/2 if extractfromoverflowset(n) return stealfromothers()

34 Marking Flood et al [2001] Mark Sweep Algorithm The Java class structure holds the head of a list of overflow objects of that type, linked through the class pointer field in their header. An object s type field can be restored on remove from overflow set (stop-the-world enables the type field to be used here). 34

35 Marking Flood et al [2001] Mark Sweep Algorithm Idle threads acquire work by trying to fill half their deque from the overflow set before stealing from other deques. extractfromoverflowset(n): transfer(overflowset, n, deque[me]) 35

36 Marking Flood et al [2001] Mark Sweep Algorithm Idle threads steal work from the top of others deques using remove. stealfromothers(): for each j in Threads ref remove(deque[j]) if ref null push(deque[me], ref) return remove: requires synchronization! 36

37 Marking Flood et al [2001] Mark Sweep Algorithm performwork(): loop ref pop(deque[me]) if ref = null return for each fld in Pointers(ref) child *fld if (child null && not ismarked(child) setmarked(child) if not push(deque[me], child) n size(deque[me]) / 2 transfer(deque[me], n, overflowset) pop: requires synchronization only to claim the last element of the deque. push: does not require synchronization. 37

38 Marking Flood et al [2001] Mark Sweep Algorithm Work is generated inside peformwork by pushing to the deque or transferring to the overflow set. generatework(): /* nop */ 38

39 Marking Flood et al [2001] Mark Sweep Algorithm Termination Detection Variation of symmetric detection that we saw in previous lecture. Status word one bit per thread (active/inactive). 39

40 Marking Flood et al [2001] Mark Sweep Algorithm Running Example Initially: deques are non-empty! acquirework if deque is non-empty return. Deque A Thread A Deque B Thread B 40

41 Marking Flood et al [2001] Mark Sweep Algorithm Running Example O 2 O 3 performwork pop, mark and push children. O 1 O 4 O 5 O 6 41 O 7

42 Marking Flood et al [2001] Mark Sweep Algorithm Running Example O 2 O 3 performwork if push causes overflow copies half the queue to the overflow set. O 1 O 4 O 7 O 5 A O1 O 2 Deque B O 3 O 4 O 5 O 6 O 6 A Thread B 42 O 7 B

43 Marking Flood et al [2001] Mark Sweep Algorithm Running Example O 2 O 3 performwork the overflow set in this case: O 1 O 4 Class A Structure Class B Structure O 5 A O 5 O 7 O 6 A 43 O 7 B O 6

44 Marking Flood et al [2001] Mark Sweep Algorithm Running Example acquirework if deque is empty, takes work from overflow set. If fails, removes from other deques. Deque A Deque B O 9 O 9 Thread A Thread B 44

45 Marking Mark Stacks With Work Stealing - Disadvantages This technique is best employed when the number of threads is known in advance. May be difficult for a thread: To choose the best queue from which to steal. To detect termination. 45

46 Marking Wu and Li [2007] Tracing With Channels Threads exchange marking tasks through single writer, single reader channels. In a system of N threads, each thread has an array of N-1 queues. Annotation for input channel from thread i to thread j i j. This is also an output channel of thread i. shared channel[n,n] me mythreadid 46

47 Marking Wu and Li [2007] Tracing With Channels If the thread s stack is empty, it takes a task from some input channel k me. acquirework(): if not isempty(mymarkstack) return for each k in Threads if not isempty(channel[k, me]) ref remove(channel[k, me]) push(mymarkstack, ref) return 47

48 Marking Wu and Li [2007] Tracing With Channels Threads first try to add new tasks (marking children) to other threads input channels (their output channels). performwork(): loop if isempty(mymarkstack) return ref pop(mymarkstack) for each fld in Pointers(ref) child *fld if child null && not ismarked(child) if not generatework(child) push(mymarkstack, child) 48

49 Marking Wu and Li [2007] Tracing With Channels When a thread generates a new task, it first checks whether any other thread k needs work. If so, adds the task to the output channel me k. Otherwise, pushes the task to its own stack. generatework(ref): for each k in Threads if needswork(k) && not isfull(channel[me,k]) add(channel[me,k], ref) return true return false 49

50 Marking Wu and Li [2007] Tracing With Channels Advantages: No expensive atomic operations! Performs better on servers with many processors. Keeps all threads busy. (*) On a machine with 16 Intel Xeon processors queues of size one or two were found to scale best. 50

51 Outline of Today s Talk How to use parallelism in each of the 4 components of tracing GC: Marking Copying Sweeping Compaction 51

52 Copying Copying is Different From Marking It s essential that an object be copied only once! If an object is marked twice it usually does not affect the correctness of the program. 52

53 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying Each copying thread is given its own stack and transfers work between its local stack and a shared stack. k size of a local stack shared sharedstack mycopystack[k] sp 0 /* local stack pointer */ 53

54 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying Using rooms, they allow multiple threads to: pop elements from the shared stack in parallel push elements to the shared stack in parallel But not pop and push in parallel! shared gate open shared popclients /* number of clients in the pop room */ shared pushclients /* number of clients in the push room */ 54

55 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying while not terminated() enterroom() /* enter pop room */ for i 1 to k if islocalstackempty() acquirework() if islocalstackempty() break performwork() transitionrooms() generatework() if exitroom() /* exit push room */ terminate() 55 islocalstackempty(): return sp = 0 acquirework(): sharedpop() performwork(): ref localpop() scan(ref) generatework(): sharedpush()

56 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying localpush(ref): mycopystack[sp++] ref localpop(): return mycopystack[--sp] SP ref Local Stack 1. localpop() 2. localpush(ref) 56

57 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying sharedpop(): cursor FetchAndAdd(&sharedStack, 1) if cursor stacklimit FetchAndAdd(&sharedStack, -1) else mycopystack[sp++] cursor[0] FetchAndAdd(x, v): atomic old *x *x old + v return old 57

58 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying sharedpush(): cursor FetchAndAdd(&sharedStack, -sp) - sp for i 0 to sp-1 cursor[i] mycopystack[i] sp 0 FetchAndAdd(x, v): atomic old *x *x old + v return old 58

59 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying enterroom(): while gate OPEN /* do nothing: wait */ FetchAndAdd(&popClients, 1) while gate OPEN FetchAndAdd(&popClients, -1) /* failure - return to previous state*/ while gate OPEN /* do nothing: wait */ FetchAndAdd(&popClients, 1) /* try again */ 59

60 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying transitionrooms(): /* move from pop room to push room */ gate CLOSED /* close gate to pop room */ FetchAndAdd(&pushClients, 1) FetchAndAdd(&popClients, -1) while popclients > 0 /* do nothing: wait till none popping */ 60

61 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying exitroom(): pushers FetchAndAdd(&pushClients, -1) - 1 if pushers = 0 /* last in push room */ gate OPEN if isempty(sharedstack) /* no work left */ return true else return false 61

62 Copying Processor-Centric Techniques: Cheng and Blelloch [2001] Copying Problem: Any processor waiting to enter the push room must wait until all processors in the pop room have finished their work! Possible Solution: The work can be done outside the rooms! It increases the likelihood that the pop room is empty threads will be able to enter the push room more quickly 62

63 Copying Memory-Centric Techniques: Block-Structured Heaps Divide the heap into small, fixed-size chunks. Each thread receives its own chunks to scan and into which to copy survivors. Once a thread chunk copy is full it s transferred to a global pool where idle threads compete to scan it and a new empty chunk is obtained for the thread itself. 63

64 Copying Memory-Centric Techniques: Block-Structured Heaps Mechanisms Used To Ensure Good Load Balancing: Chunks acquired were small (256 words). To avoid fragmentation, they used big bag of pages allocation for small objects Larger objects and chunks were allocated from the shared heap using a lock. 64

65 Copying Memory-Centric Techniques: Block-Structured Heaps Mechanisms Used To Ensure Good Load Balancing: Balanced load in finer granularity. Each chunk was divided into smaller blocks (32 words). 65

66 Copying Memory-Centric Techniques: Block-Structured Heaps Mechanisms Used To Ensure Good Load Balancing: After scanning a slot, the thread checks whether it reached the block boundary. If so and the next object was smaller than a block: the thread advanced its scan pointer to the start of its current copy block. It reduced contention the thread did not have to compete to acquire a new scan block. Un-scanned blocks in that area are given to the global pool. If the object was larger than a block but smaller than a chunk, the scan pointer was advanced to the start of its current copy chunk. If the object was large, the thread continued to scan it. 66

67 Copying Memory-Centric Techniques: Block-Structured Heaps Mechanisms Used To Ensure Good Load Balancing: 67

68 Copying Memory-Centric Techniques: Block-Structured Heaps Block States and Transitions: 68

69 Copying Memory-Centric Techniques: Block-Structured Heaps State Transition Logic: 69

70 Outline of Today s Talk How to use parallelism in each of the 4 components of tracing GC: Marking Copying Sweeping Compaction 70

71 Sweeping Simple Strategies 1) Statically partition the heap into contiguous blocks for threads to sweep. 2) Over-partition the heap and have threads compete for a block to sweep to a free-list. Problem The free-list becomes a bottleneck! Solution Processors will have their own free-lists. 71

72 Sweeping Endo et al [1997] Lazy Sweeping A naturally parallel solution to sweeping partially full blocks. In the sweep phase, we need to identify empty blocks and return them to the block allocator. Need to reduce contention. Gave each thread several consecutive blocks to process locally. They used bitmap marking with bitmaps held in block headers (used to determine whether a block is empty or not). Empty blocks are added to a local free-block list. Partially full blocks are added to local reclaim list for subsequent lazy sweeping. Once a processor finishes with its sweep set it merges its local list with the global free-block list. 72

73 Outline of Today s Talk How to use parallelism in each of the 4 components of tracing GC: Marking Copying Sweeping Compaction 73

74 Compaction Flood et al [2001] Mark-Compact Observation: Uniprocessor compaction algorithms typically slide all live data to one end of the heap space. If multiple threads do so in parallel one thread can overwrite live data before another thread has moved it! A C B C D Thread 1 compaction data. Thread 2 compaction data. 74

75 Compaction Flood et al [2001] Mark-Compact Suggested Solution: Divide the heap space into several regions, one for each compacting thread. To reduce fragmentation, they also have threads alternate the direction in which they move objects in even and odd numbered regions. 75

76 Compaction Flood et al [2001] Mark-Compact 4 Phases: 1) marking. 2) Calculate forwarding addresses. 3) Update references. 4) Move objects. 76

77 Compaction Flood et al [2001] Mark-Compact Phase 2 - Calculating Forwarding Addresses: Over-partition the space into M = 4N (N- number of threads) units of roughly the same size. Threads compete to claim units. Each thread counts the volume of live data in its unit. According to these volumes, they partition the space into N regions that contain approximately the same amount of live data. Threads compete to claim units and install forwarding addresses of each live object of their units. M = 12 units, N = 3 regions/threads

78 Compaction Flood et al [2001] Mark-Compact Phase 3 - Updating References: Updating references to point to objects new locations requires scanning: Objects stored in mutator threads stacks that might contain references to objects in the heap space (young generation). Live objects in the heap space (old generation). Threads compete to claim old generation units to scan and a single thread scans the young generation. Phase 4 Moving Objects: Each thread is in charge of a region. Good load balancing is guaranteed because the regions contain roughly equal volumes of live data. 78

79 Compaction Flood et al [2001] Mark-Compact Disadvantages: 1) The algorithm makes 3 passes over the heap while other compacting algorithms make fewer passes. 2) Rather than compacting all live data to one end of the heap, the algorithm compacts into N regions, leaving (N +1)/2 gaps for allocation. If a large number of threads in used, it s difficult for mutators to allocate very large objects. 79

80 Compaction Abuaiadh et al [2004] Mark-Compact 1) Address the 3 passes problem: Calculate rather than store forwarding addresses using the mark bitmap and an offset vector that holds the new address of the first live object in each block. To construct the offset vector one pass over the mark-bit vector is needed. Only a single pass over the heap is needed to move objects and update references using these vectors. 80

81 Compaction Abuaiadh et al [2004] Mark-Compact 1) Address the 3 passes problem: Bits in the mark-bit vector indicate the start and end of each live object. Words in the offset vector hold the address to which the first live object in their corresponding block will be moved. Forwarding addresses are not stored but are calculated when needed from the offset and mark-bit vectors. 81

82 Compaction Abuaiadh et al [2004] Mark-Compact 2) Address the small gaps problem: Over-partition the heap into fairly large areas. Threads race to claim the next area to compact, using an atomic operation to increment a global area index. If the thread succeeds, it has obtained an area to compact. If it fails, it tries to claim the next area. 82

83 Compaction Abuaiadh et al [2004] Mark-Compact 2) Address the small gaps problem: A table holds pointers to the beginning of the free space for each area. After winning an area to compact, a thread races to obtain an area into which it can move objects. It claims an area by trying to write null into its corresponding table slot. Threads never try to compact from or into an area whose table entry is null. Objects are never moved from a lower to a higher numbered area. Progress is guaranteed since a thread can always compact an area into itself. Once a thread has finished with an area, it updates the area s free pointer. If an area is full, its free space pointer will remain null. 83

84 Compaction Abuaiadh et al [2004] Mark-Compact 2) Address the small gaps problem: A A B C D E B C D E Area Index: 01 2 Free pointers table NULL

85 Compaction Abuaiadh et al [2004] Mark-Compact 2) Address the small gaps problem: Explored two ways in which objects can be moved: a. Slide object by object. b. To reduce compaction time, slide only complete blocks (256 bytes). Free space in each block is not squeezed out. 85

86 Discussion What is the tradeoff in the choice of the chunk size in parallel copying? copying with no synchronization can cause issues? For example if an object is copied twice by two different threads, what can be the consequence? FA X A A A B B 86

87 Something Extra 87

88 Conclusions & Summary There should be enough work for parallel collection Need to take into account synchronization costs Need to balance loads between the multiple threads Learned different algorithms for marking, sweeping, copying and compaction that take all this challenges into account. Difference between marking and copying marking an object twice is not so bad. Copying an object twice can harm the correctness. 88

Mark-Sweep and Mark-Compact GC

Mark-Sweep and Mark-Compact GC Mark-Sweep and Mark-Compact GC Richard Jones Anthony Hoskins Eliot Moss Presented by Pavel Brodsky 04/11/14 Our topics today Two basic garbage collection paradigms: Mark-Sweep GC Mark-Compact GC Definitions

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #6: Memory Management CS 61C L06 Memory Management (1) 2006-07-05 Andy Carle Memory Management (1/2) Variable declaration allocates

More information

Garbage Collection. Hwansoo Han

Garbage Collection. Hwansoo Han Garbage Collection Hwansoo Han Heap Memory Garbage collection Automatically reclaim the space that the running program can never access again Performed by the runtime system Two parts of a garbage collector

More information

Run-Time Environments/Garbage Collection

Run-Time Environments/Garbage Collection Run-Time Environments/Garbage Collection Department of Computer Science, Faculty of ICT January 5, 2014 Introduction Compilers need to be aware of the run-time environment in which their compiled programs

More information

Garbage Collection Algorithms. Ganesh Bikshandi

Garbage Collection Algorithms. Ganesh Bikshandi Garbage Collection Algorithms Ganesh Bikshandi Announcement MP4 posted Term paper posted Introduction Garbage : discarded or useless material Collection : the act or process of collecting Garbage collection

More information

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)

Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) COMP 412 FALL 2017 Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) Copyright 2017, Keith D. Cooper & Zoran Budimlić, all rights reserved. Students enrolled in Comp 412 at Rice

More information

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35

Garbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35 Garbage Collection Akim Demaille, Etienne Renault, Roland Levillain May 15, 2017 CCMP2 Garbage Collection May 15, 2017 1 / 35 Table of contents 1 Motivations and Definitions 2 Reference Counting Garbage

More information

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime Runtime The optimized program is ready to run What sorts of facilities are available at runtime Compiler Passes Analysis of input program (front-end) character stream Lexical Analysis token stream Syntactic

More information

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs Performance of Non-Moving Garbage Collectors Hans-J. Boehm HP Labs Why Use (Tracing) Garbage Collection to Reclaim Program Memory? Increasingly common Java, C#, Scheme, Python, ML,... gcc, w3m, emacs,

More information

Implementation Garbage Collection

Implementation Garbage Collection CITS 3242 Programming Paradigms Part IV: Advanced Topics Topic 19: Implementation Garbage Collection Most languages in the functional, logic, and object-oriented paradigms include some form of automatic

More information

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018 Memory: Overview CS439: Principles of Computer Systems February 26, 2018 Where We Are In the Course Just finished: Processes & Threads CPU Scheduling Synchronization Next: Memory Management Virtual Memory

More information

Concurrent Preliminaries

Concurrent Preliminaries Concurrent Preliminaries Sagi Katorza Tel Aviv University 09/12/2014 1 Outline Hardware infrastructure Hardware primitives Mutual exclusion Work sharing and termination detection Concurrent data structures

More information

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley Managed runtimes & garbage collection CSE 6341 Some slides by Kathryn McKinley 1 Managed runtimes Advantages? Disadvantages? 2 Managed runtimes Advantages? Reliability Security Portability Performance?

More information

Lecture 15 Garbage Collection

Lecture 15 Garbage Collection Lecture 15 Garbage Collection I. Introduction to GC -- Reference Counting -- Basic Trace-Based GC II. Copying Collectors III. Break Up GC in Time (Incremental) IV. Break Up GC in Space (Partial) Readings:

More information

Shenandoah: An ultra-low pause time garbage collector for OpenJDK. Christine Flood Roman Kennke Principal Software Engineers Red Hat

Shenandoah: An ultra-low pause time garbage collector for OpenJDK. Christine Flood Roman Kennke Principal Software Engineers Red Hat Shenandoah: An ultra-low pause time garbage collector for OpenJDK Christine Flood Roman Kennke Principal Software Engineers Red Hat 1 Shenandoah Why do we need it? What does it do? How does it work? What's

More information

Garbage Collection. Steven R. Bagley

Garbage Collection. Steven R. Bagley Garbage Collection Steven R. Bagley Reference Counting Counts number of pointers to an Object deleted when the count hits zero Eager deleted as soon as it is finished with Problem: Circular references

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 - Spring 2013 1 Memory Attributes! Memory to store data in programming languages has the following lifecycle

More information

ECE 598 Advanced Operating Systems Lecture 10

ECE 598 Advanced Operating Systems Lecture 10 ECE 598 Advanced Operating Systems Lecture 10 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 17 February 2015 Announcements Homework #1 and #2 grades, HW#3 Coming soon 1 Various

More information

Managed runtimes & garbage collection

Managed runtimes & garbage collection Managed runtimes Advantages? Managed runtimes & garbage collection CSE 631 Some slides by Kathryn McKinley Disadvantages? 1 2 Managed runtimes Portability (& performance) Advantages? Reliability Security

More information

Run-time Environments -Part 3

Run-time Environments -Part 3 Run-time Environments -Part 3 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Compiler Design Outline of the Lecture Part 3 What is run-time support?

More information

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008 Dynamic Storage Allocation CS 44: Operating Systems Spring 2 Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need to grow or shrink. Dynamic

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 More Memory Management CS 61C L07 More Memory Management (1) 2004-09-15 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Star Wars

More information

Exploiting the Behavior of Generational Garbage Collector

Exploiting the Behavior of Generational Garbage Collector Exploiting the Behavior of Generational Garbage Collector I. Introduction Zhe Xu, Jia Zhao Garbage collection is a form of automatic memory management. The garbage collector, attempts to reclaim garbage,

More information

The SURE Architecture

The SURE Architecture The SURE Architecture David May: December 11, 2016 Background Computer programming is changing. Object-oriented languages, functional languages and others have accelerated software development. But these

More information

Robust Memory Management Schemes

Robust Memory Management Schemes Robust Memory Management Schemes Prepared by : Fadi Sbahi & Ali Bsoul Supervised By: Dr. Lo ai Tawalbeh Jordan University of Science and Technology Robust Memory Management Schemes Introduction. Memory

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 C Memory Management 2007-02-06 Hello to Said S. from Columbus, OH CS61C L07 More Memory Management (1) Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia

More information

Tick: Concurrent GC in Apache Harmony

Tick: Concurrent GC in Apache Harmony Tick: Concurrent GC in Apache Harmony Xiao-Feng Li 2009-4-12 Acknowledgement: Yunan He, Simon Zhou Agenda Concurrent GC phases and transition Concurrent marking scheduling Concurrent GC algorithms Tick

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 Spring 2017 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

Lecture 7 More Memory Management Slab Allocator. Slab Allocator

Lecture 7 More Memory Management Slab Allocator. Slab Allocator CS61C L07 More Memory Management (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 More Memory Management 2006-09-13 Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Unbox problems

More information

Java Performance Tuning

Java Performance Tuning 443 North Clark St, Suite 350 Chicago, IL 60654 Phone: (312) 229-1727 Java Performance Tuning This white paper presents the basics of Java Performance Tuning and its preferred values for large deployments

More information

Shenandoah An ultra-low pause time Garbage Collector for OpenJDK. Christine H. Flood Roman Kennke

Shenandoah An ultra-low pause time Garbage Collector for OpenJDK. Christine H. Flood Roman Kennke Shenandoah An ultra-low pause time Garbage Collector for OpenJDK Christine H. Flood Roman Kennke 1 What does ultra-low pause time mean? It means that the pause time is proportional to the size of the root

More information

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank

Algorithms for Dynamic Memory Management (236780) Lecture 4. Lecturer: Erez Petrank Algorithms for Dynamic Memory Management (236780) Lecture 4 Lecturer: Erez Petrank!1 March 24, 2014 Topics last week The Copying Garbage Collector algorithm: Basics Cheney s collector Additional issues:

More information

Memory Management. Didactic Module 14 Programming Languages - EEL670 1

Memory Management. Didactic Module 14 Programming Languages - EEL670 1 Memory Management Didactic Module 14 Programming Languages - EEL670 1 Dynamic Memory Allocation Lots of things need memory at runtime: Activation records Objects Explicit allocations: new, malloc, etc.

More information

Memory Management. Chapter Fourteen Modern Programming Languages, 2nd ed. 1

Memory Management. Chapter Fourteen Modern Programming Languages, 2nd ed. 1 Memory Management Chapter Fourteen Modern Programming Languages, 2nd ed. 1 Dynamic Memory Allocation Lots of things need memory at runtime: Activation records Objects Explicit allocations: new, malloc,

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 C Memory Management!!Lecturer SOE Dan Garcia!!!www.cs.berkeley.edu/~ddgarcia CS61C L07 More Memory Management (1)! 2010-02-03! Flexible

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Garbage Collection Zoran Budimlić (Rice University) Adapted from Keith Cooper s 2014 lecture in COMP 215. Garbage Collection In Beverly Hills...

More information

Garbage Collection. Weiyuan Li

Garbage Collection. Weiyuan Li Garbage Collection Weiyuan Li Why GC exactly? - Laziness - Performance - free is not free - combats memory fragmentation - More flame wars Basic concepts - Type Safety - Safe: ML, Java (not really) - Unsafe:

More information

Hazard Pointers. Number of threads unbounded time to check hazard pointers also unbounded! difficult dynamic bookkeeping! thread B - hp1 - hp2

Hazard Pointers. Number of threads unbounded time to check hazard pointers also unbounded! difficult dynamic bookkeeping! thread B - hp1 - hp2 Hazard Pointers Store pointers of memory references about to be accessed by a thread Memory allocation checks all hazard pointers to avoid the ABA problem thread A - hp1 - hp2 thread B - hp1 - hp2 thread

More information

Announcements. Reading Material. Recap. Today 9/17/17. Storage (contd. from Lecture 6)

Announcements. Reading Material. Recap. Today 9/17/17. Storage (contd. from Lecture 6) CompSci 16 Intensive Computing Systems Lecture 7 Storage and Index Instructor: Sudeepa Roy Announcements HW1 deadline this week: Due on 09/21 (Thurs), 11: pm, no late days Project proposal deadline: Preliminary

More information

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC330 Fall 2018 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

Name, Scope, and Binding. Outline [1]

Name, Scope, and Binding. Outline [1] Name, Scope, and Binding In Text: Chapter 3 Outline [1] Variable Binding Storage bindings and lifetime Type bindings Type Checking Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur 2

More information

CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 11

CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 11 CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 11 CS 536 Spring 2015 1 Handling Overloaded Declarations Two approaches are popular: 1. Create a single symbol table

More information

Packer: Parallel Garbage Collection Based on Virtual Spaces

Packer: Parallel Garbage Collection Based on Virtual Spaces IEEE TRANSACTIONS ON COMPUTERS, MANUSCRIPT ID 1 Packer: Parallel Garbage Collection Based on Virtual Spaces Shaoshan Liu, Jie Tang, Ligang Wang, Xiao-Feng Li, and Jean-Luc Gaudiot, Fellow, IEEE Abstract

More information

One-Slide Summary. Lecture Outine. Automatic Memory Management #1. Why Automatic Memory Management? Garbage Collection.

One-Slide Summary. Lecture Outine. Automatic Memory Management #1. Why Automatic Memory Management? Garbage Collection. Automatic Memory Management #1 One-Slide Summary An automatic memory management system deallocates objects when they are no longer used and reclaims their storage space. We must be conservative and only

More information

CS 241 Honors Memory

CS 241 Honors Memory CS 241 Honors Memory Ben Kurtovic Atul Sandur Bhuvan Venkatesh Brian Zhou Kevin Hong University of Illinois Urbana Champaign February 20, 2018 CS 241 Course Staff (UIUC) Memory February 20, 2018 1 / 35

More information

CS842: Automatic Memory Management and Garbage Collection. Mark and sweep

CS842: Automatic Memory Management and Garbage Collection. Mark and sweep CS842: Automatic Memory Management and Garbage Collection Mark and sweep 1 Schedule M W Sept 14 Intro/Background Basics/ideas Sept 21 Allocation/layout GGGGC Sept 28 Mark/Sweep Mark/Sweep cto 5 Copying

More information

Lecture 13: Garbage Collection

Lecture 13: Garbage Collection Lecture 13: Garbage Collection COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer/Mikkel Kringelbach 1 Garbage Collection Every modern programming language allows programmers

More information

Review. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young

Review. Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young Generational GC 1 Review Partitioning: Divide heap, use different strategies per heap Generational GC: Partition by age Most objects die young 2 Single-partition scanning Stack Heap Partition #1 Partition

More information

A new Mono GC. Paolo Molaro October 25, 2006

A new Mono GC. Paolo Molaro October 25, 2006 A new Mono GC Paolo Molaro lupus@novell.com October 25, 2006 Current GC: why Boehm Ported to the major architectures and systems Featurefull Very easy to integrate Handles managed pointers in unmanaged

More information

CPS 310 first midterm exam, 10/6/2014

CPS 310 first midterm exam, 10/6/2014 CPS 310 first midterm exam, 10/6/2014 Your name please: Part 1. More fun with fork and exec* What is the output generated by this program? Please assume that each executed print statement completes, e.g.,

More information

Cycle Tracing. Presented by: Siddharth Tiwary

Cycle Tracing. Presented by: Siddharth Tiwary Cycle Tracing Chapter 4, pages 41--56, 2010. From: "Garbage Collection and the Case for High-level Low-level Programming," Daniel Frampton, Doctoral Dissertation, Australian National University. Presented

More information

A.Arpaci-Dusseau. Mapping from logical address space to physical address space. CS 537:Operating Systems lecture12.fm.2

A.Arpaci-Dusseau. Mapping from logical address space to physical address space. CS 537:Operating Systems lecture12.fm.2 UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 537 A. Arpaci-Dusseau Intro to Operating Systems Spring 2000 Dynamic Memory Allocation Questions answered in these notes When is a stack

More information

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++

More information

Lecture 15 Advanced Garbage Collection

Lecture 15 Advanced Garbage Collection Lecture 15 Advanced Garbage Collection I. Break Up GC in Time (Incremental) II. Break Up GC in Space (Partial) Readings: Ch. 7.6.4-7.7.4 CS243: Advanced Garbage Collection 1 Trace-Based GC: Memory Life-Cycle

More information

How do we mark reachable objects?

How do we mark reachable objects? How do we mark reachable objects? Disadvantages of mark-sweep GC Stop-the-world algorithm Computation suspended while GC runs Pause time may be high Not practical for real-time, interactive applications,

More information

Operating Systems. Week 9 Recitation: Exam 2 Preview Review of Exam 2, Spring Paul Krzyzanowski. Rutgers University.

Operating Systems. Week 9 Recitation: Exam 2 Preview Review of Exam 2, Spring Paul Krzyzanowski. Rutgers University. Operating Systems Week 9 Recitation: Exam 2 Preview Review of Exam 2, Spring 2014 Paul Krzyzanowski Rutgers University Spring 2015 March 27, 2015 2015 Paul Krzyzanowski 1 Exam 2 2012 Question 2a One of

More information

Garbage Collection (1)

Garbage Collection (1) Garbage Collection (1) Advanced Operating Systems Lecture 7 This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/

More information

Garbage Collection Techniques

Garbage Collection Techniques Garbage Collection Techniques Michael Jantz COSC 340: Software Engineering 1 Memory Management Memory Management Recognizing when allocated objects are no longer needed Deallocating (freeing) the memory

More information

Proceedings of the Java Virtual Machine Research and Technology Symposium (JVM '01)

Proceedings of the Java Virtual Machine Research and Technology Symposium (JVM '01) USENIX Association Proceedings of the Java Virtual Machine Research and Technology Symposium (JVM '1) Monterey, California, USA April 3, 1 THE ADVANCED COMPUTING SYSTEMS ASSOCIATION 1 by The USENIX Association

More information

CS 345. Garbage Collection. Vitaly Shmatikov. slide 1

CS 345. Garbage Collection. Vitaly Shmatikov. slide 1 CS 345 Garbage Collection Vitaly Shmatikov slide 1 Major Areas of Memory Static area Fixed size, fixed content, allocated at compile time Run-time stack Variable size, variable content (activation records)

More information

Garbage Collection. Vyacheslav Egorov

Garbage Collection. Vyacheslav Egorov Garbage Collection Vyacheslav Egorov 28.02.2012 class Heap { public: void* Allocate(size_t sz); }; class Heap { public: void* Allocate(size_t sz); void Deallocate(void* ptr); }; class Heap { public: void*

More information

HOT-Compilation: Garbage Collection

HOT-Compilation: Garbage Collection HOT-Compilation: Garbage Collection TA: Akiva Leffert aleffert@andrew.cmu.edu Out: Saturday, December 9th In: Tuesday, December 9th (Before midnight) Introduction It s time to take a step back and congratulate

More information

Memory Management Basics

Memory Management Basics Memory Management Basics 1 Basic Memory Management Concepts Address spaces! Physical address space The address space supported by the hardware Ø Starting at address 0, going to address MAX sys! MAX sys!!

More information

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019 CS 31: Introduction to Computer Systems 22-23: Threads & Synchronization April 16-18, 2019 Making Programs Run Faster We all like how fast computers are In the old days (1980 s - 2005): Algorithm too slow?

More information

Memory management has always involved tradeoffs between numerous optimization possibilities: Schemes to manage problem fall into roughly two camps

Memory management has always involved tradeoffs between numerous optimization possibilities: Schemes to manage problem fall into roughly two camps Garbage Collection Garbage collection makes memory management easier for programmers by automatically reclaiming unused memory. The garbage collector in the CLR makes tradeoffs to assure reasonable performance

More information

Advance Operating Systems (CS202) Locks Discussion

Advance Operating Systems (CS202) Locks Discussion Advance Operating Systems (CS202) Locks Discussion Threads Locks Spin Locks Array-based Locks MCS Locks Sequential Locks Road Map Threads Global variables and static objects are shared Stored in the static

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #5 Memory Management; Intro MIPS 2007-7-2 Scott Beamer, Instructor iphone Draws Crowds www.sfgate.com CS61C L5 Memory Management; Intro

More information

Dynamic Storage Allocation

Dynamic Storage Allocation 6.172 Performance Engineering of Software Systems LECTURE 10 Dynamic Storage Allocation Charles E. Leiserson October 12, 2010 2010 Charles E. Leiserson 1 Stack Allocation Array and pointer A un Allocate

More information

The Google File System

The Google File System October 13, 2010 Based on: S. Ghemawat, H. Gobioff, and S.-T. Leung: The Google file system, in Proceedings ACM SOSP 2003, Lake George, NY, USA, October 2003. 1 Assumptions Interface Architecture Single

More information

Parallel Memory Defragmentation on a GPU

Parallel Memory Defragmentation on a GPU Parallel Memory Defragmentation on a GPU Ronald Veldema, Michael Philippsen University of Erlangen-Nuremberg Germany Informatik 2 Programmiersysteme Martensstraße 3 91058 Erlangen Motivation Application

More information

ECE 598 Advanced Operating Systems Lecture 12

ECE 598 Advanced Operating Systems Lecture 12 ECE 598 Advanced Operating Systems Lecture 12 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 1 March 2018 Announcements Next homework will be due after break. Midterm next Thursday

More information

Programming Language Implementation

Programming Language Implementation A Practical Introduction to Programming Language Implementation 2014: Week 10 Garbage Collection College of Information Science and Engineering Ritsumeikan University 1 review of last week s topics dynamic

More information

Automatic Memory Management

Automatic Memory Management Automatic Memory Management Why Automatic Memory Management? Storage management is still a hard problem in modern programming Why Automatic Memory Management? Storage management is still a hard problem

More information

ACM Trivia Bowl. Thursday April 3 rd (two days from now) 7pm OLS 001 Snacks and drinks provided All are welcome! I will be there.

ACM Trivia Bowl. Thursday April 3 rd (two days from now) 7pm OLS 001 Snacks and drinks provided All are welcome! I will be there. #1 ACM Trivia Bowl Thursday April 3 rd (two days from now) 7pm OLS 001 Snacks and drinks provided All are welcome! I will be there. If you are in one of the top three teams, I will give you one point of

More information

Lecture Notes on Priority Queues

Lecture Notes on Priority Queues Lecture Notes on Priority Queues 15-122: Principles of Imperative Computation Frank Pfenning Lecture 16 October 18, 2012 1 Introduction In this lecture we will look at priority queues as an abstract type

More information

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction

MultiJav: A Distributed Shared Memory System Based on Multiple Java Virtual Machines. MultiJav: Introduction : A Distributed Shared Memory System Based on Multiple Java Virtual Machines X. Chen and V.H. Allan Computer Science Department, Utah State University 1998 : Introduction Built on concurrency supported

More information

Wednesday, May 3, Several RAID "levels" have been defined. Some are more commercially viable than others.

Wednesday, May 3, Several RAID levels have been defined. Some are more commercially viable than others. Wednesday, May 3, 2017 Topics for today RAID: Level 0 Level 1 Level 3 Level 4 Level 5 Beyond RAID 5 File systems RAID revisited Several RAID "levels" have been defined. Some are more commercially viable

More information

Heap Compression for Memory-Constrained Java

Heap Compression for Memory-Constrained Java Heap Compression for Memory-Constrained Java CSE Department, PSU G. Chen M. Kandemir N. Vijaykrishnan M. J. Irwin Sun Microsystems B. Mathiske M. Wolczko OOPSLA 03 October 26-30 2003 Overview PROBLEM:

More information

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Processes and Non-Preemptive Scheduling. Otto J. Anshus Processes and Non-Preemptive Scheduling Otto J. Anshus Threads Processes Processes Kernel An aside on concurrency Timing and sequence of events are key concurrency issues We will study classical OS concurrency

More information

Heap Management. Heap Allocation

Heap Management. Heap Allocation Heap Management Heap Allocation A very flexible storage allocation mechanism is heap allocation. Any number of data objects can be allocated and freed in a memory pool, called a heap. Heap allocation is

More information

Final Exam. 12 December 2018, 120 minutes, 26 questions, 100 points

Final Exam. 12 December 2018, 120 minutes, 26 questions, 100 points Name: CS520 Final Exam 12 December 2018, 120 minutes, 26 questions, 100 points The exam is closed book and notes. Please keep all electronic devices turned off and out of reach. Note that a question may

More information

CILK/CILK++ AND REDUCERS YUNMING ZHANG RICE UNIVERSITY

CILK/CILK++ AND REDUCERS YUNMING ZHANG RICE UNIVERSITY CILK/CILK++ AND REDUCERS YUNMING ZHANG RICE UNIVERSITY 1 OUTLINE CILK and CILK++ Language Features and Usages Work stealing runtime CILK++ Reducers Conclusions 2 IDEALIZED SHARED MEMORY ARCHITECTURE Hardware

More information

CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers

CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers Heap allocation is a necessity for modern programming tasks, and so is automatic reclamation of heapallocated memory. However,

More information

CS577 Modern Language Processors. Spring 2018 Lecture Garbage Collection

CS577 Modern Language Processors. Spring 2018 Lecture Garbage Collection CS577 Modern Language Processors Spring 2018 Lecture Garbage Collection 1 BASIC GARBAGE COLLECTION Garbage Collection (GC) is the automatic reclamation of heap records that will never again be accessed

More information

Hard Real-Time Garbage Collection in Java Virtual Machines

Hard Real-Time Garbage Collection in Java Virtual Machines Hard Real-Time Garbage Collection in Java Virtual Machines... towards unrestricted real-time programming in Java Fridtjof Siebert, IPD, University of Karlsruhe 1 Jamaica Systems Structure Exisiting GC

More information

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers)

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers) Comp 104:Operating Systems Concepts Revision Lectures (separate questions and answers) Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects

More information

Automatic Garbage Collection

Automatic Garbage Collection Automatic Garbage Collection Announcements: PS6 due Monday 12/6 at 11:59PM Final exam on Thursday 12/16 o PS6 tournament and review session that week Garbage In OCaml programs (and in most other programming

More information

Lecture Notes on Garbage Collection

Lecture Notes on Garbage Collection Lecture Notes on Garbage Collection 15-411: Compiler Design Frank Pfenning Lecture 21 November 4, 2014 These brief notes only contain a short overview, a few pointers to the literature with detailed descriptions,

More information

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei Non-blocking Array-based Algorithms for Stacks and Queues Niloufar Shafiei Outline Introduction Concurrent stacks and queues Contributions New algorithms New algorithms using bounded counter values Correctness

More information

The Art and Science of Memory Allocation

The Art and Science of Memory Allocation Logical Diagram The Art and Science of Memory Allocation Don Porter CSE 506 Binary Formats RCU Memory Management Memory Allocators CPU Scheduler User System Calls Kernel Today s Lecture File System Networking

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [MEMORY MANAGEMENT] Shrideep Pallickara Computer Science Colorado State University L20.1 Frequently asked questions from the previous class survey Virtual addresses L20.2 SLIDES

More information

Reference Counting. Reference counting: a way to know whether a record has other users

Reference Counting. Reference counting: a way to know whether a record has other users Garbage Collection Today: various garbage collection strategies; basic ideas: Allocate until we run out of space; then try to free stuff Invariant: only the PL implementation (runtime system) knows about

More information

Reference Counting. Reference counting: a way to know whether a record has other users

Reference Counting. Reference counting: a way to know whether a record has other users Garbage Collection Today: various garbage collection strategies; basic ideas: Allocate until we run out of space; then try to free stuff Invariant: only the PL implementation (runtime system) knows about

More information

VMem. By Stewart Lynch.

VMem. By Stewart Lynch. VMem By Stewart Lynch. 1 Contents Introduction... 3 Overview... 4 Getting started... 6 Fragmentation... 7 Virtual Regions... 8 The FSA... 9 Biasing... 10 The Coalesce allocator... 11 Skewing indices...

More information

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers)

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers) Comp 204: Computer Systems and Their Implementation Lecture 25a: Revision Lectures (separate questions and answers) 1 Today Here are a sample of questions that could appear in the exam Please LET ME KNOW

More information

Parallel Garbage Collection

Parallel Garbage Collection Parallel Garbage Collection Xiao-Feng Li Shanghai Many-core Workshop 2008-3-28 Agenda Quick overview on Garbage Collection Parallelization topics Traversal of object connection graph Order of object copying

More information

Fall 2015 COMP Operating Systems. Lab 06

Fall 2015 COMP Operating Systems. Lab 06 Fall 2015 COMP 3511 Operating Systems Lab 06 Outline Monitor Deadlocks Logical vs. Physical Address Space Segmentation Example of segmentation scheme Paging Example of paging scheme Paging-Segmentation

More information

6.033 Computer System Engineering

6.033 Computer System Engineering MIT OpenCourseWare http://ocw.mit.edu 6.033 Computer System Engineering Spring 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 6.003 Lecture 7: Threads

More information

Concurrent Garbage Collection

Concurrent Garbage Collection Concurrent Garbage Collection Deepak Sreedhar JVM engineer, Azul Systems Java User Group Bangalore 1 @azulsystems azulsystems.com About me: Deepak Sreedhar JVM student at Azul Systems Currently working

More information