In this session we cover the variety of garbage collection algorithms, with a strong focus on tracing garbage collectors. We discuss concurrent and parallel GC, and novel approaches such as Azul's Completely Concurrent Compacting Collector (C4) and IBM's Metronome real-time GC.
GARBAGE COLLECTOR Automatic garbage collection is the process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects. An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object. An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed. In a programming language like C, allocating and deallocating memory is a manual process. In Java, process of deallocating memory is handled automatically by the garbage collector.
Garbage collection is the most famous (infamous) JVM mechanism and it dates back to Java 1.0. Every Java developer knows about its existence yet most of the time we wish we can ignore its behavior and assume it works perfectly. Unfortunately this is not the case and if you are ignoring it, GC may hit you really hard.... in production. Furthermore the information that you may find on the web can be a lot of times misleading. In this event we will try to demystify some of the misconceptions around GC by understanding how different GC mechanisms work and how to make the right decisions in order to make them work for you.
GARBAGE COLLECTOR Automatic garbage collection is the process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects. An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object. An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed. In a programming language like C, allocating and deallocating memory is a manual process. In Java, process of deallocating memory is handled automatically by the garbage collector.
Garbage collection is the most famous (infamous) JVM mechanism and it dates back to Java 1.0. Every Java developer knows about its existence yet most of the time we wish we can ignore its behavior and assume it works perfectly. Unfortunately this is not the case and if you are ignoring it, GC may hit you really hard.... in production. Furthermore the information that you may find on the web can be a lot of times misleading. In this event we will try to demystify some of the misconceptions around GC by understanding how different GC mechanisms work and how to make the right decisions in order to make them work for you.
This session is all about - the mechanism provided by Java Virtual Machine to reclaim heap space from objects which are eligible for Garbage collection.
Understanding Java Garbage Collection - And What You Can Do About ItAzul Systems Inc.
Garbage collection is an integral but often misunderstood part of application behavior on Java platforms. As such, it is important for Java developers to understand how collector mechanisms work. This presentation reviews and classifies the major garbage collectors available in JVMs today. Following an overview of common garbage collection techniques such as generational, parallel, stop-the-world, incremental, and concurrent algorithms, it defines terms and metrics common to all collectors. It also discusses trade-offs in balancing requirements for responsiveness, throughput, space, and available memory and covers some pitfalls, common misconceptions, and garbage collection behavior myths.
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...Maarten Balliauw
The .NET Garbage Collector (GC) helps provide our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Can we do without allocations? Are strings evil? It still matters to understand when and where memory is allocated.
In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Learn C# basics with slides and code based on the Apress "Pro C# 5.0 and the .NET 4.5 Framework" book contents and source code
http://www.apress.com/9781430242338
http://www.apress.com/downloadable/download/sample/sample_id/1328/
Garbage Collection is an integral part of application behavior on Java platforms, yet it is often misunderstood. As such, it is important for Java developers to understand the actions you can take in selecting and tuning collector mechanisms, as well as in your application architecture choices. Azul Product Manager Matt Schuetze describes the different collectors available and how to choose.
Best Hadoop Institutes : kelly tecnologies is the best Hadoop training Institute in Bangalore.Providing hadoop courses by realtime faculty in Bangalore.
By Han Nim Jang, Casper Hsieh, Jun Li
Course code: RSM450 Judgment and Decisions
Professor Nina Mazar
This powerpoint talks about ways to nudge people to recycle using judgment and decision tools learned in class.
This session is all about - the mechanism provided by Java Virtual Machine to reclaim heap space from objects which are eligible for Garbage collection.
Understanding Java Garbage Collection - And What You Can Do About ItAzul Systems Inc.
Garbage collection is an integral but often misunderstood part of application behavior on Java platforms. As such, it is important for Java developers to understand how collector mechanisms work. This presentation reviews and classifies the major garbage collectors available in JVMs today. Following an overview of common garbage collection techniques such as generational, parallel, stop-the-world, incremental, and concurrent algorithms, it defines terms and metrics common to all collectors. It also discusses trade-offs in balancing requirements for responsiveness, throughput, space, and available memory and covers some pitfalls, common misconceptions, and garbage collection behavior myths.
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...Maarten Balliauw
The .NET Garbage Collector (GC) helps provide our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Can we do without allocations? Are strings evil? It still matters to understand when and where memory is allocated.
In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Learn C# basics with slides and code based on the Apress "Pro C# 5.0 and the .NET 4.5 Framework" book contents and source code
http://www.apress.com/9781430242338
http://www.apress.com/downloadable/download/sample/sample_id/1328/
Garbage Collection is an integral part of application behavior on Java platforms, yet it is often misunderstood. As such, it is important for Java developers to understand the actions you can take in selecting and tuning collector mechanisms, as well as in your application architecture choices. Azul Product Manager Matt Schuetze describes the different collectors available and how to choose.
Best Hadoop Institutes : kelly tecnologies is the best Hadoop training Institute in Bangalore.Providing hadoop courses by realtime faculty in Bangalore.
By Han Nim Jang, Casper Hsieh, Jun Li
Course code: RSM450 Judgment and Decisions
Professor Nina Mazar
This powerpoint talks about ways to nudge people to recycle using judgment and decision tools learned in class.
This presentation begins by reviewing the Task Parallel Library APIs, introduced in .NET 4.0 and expanded in .NET 4.5 -- the Task class, Parallel.For and Parallel.ForEach, and even Parallel LINQ. Then, we look at patterns and practices for extracting concurrency and managing dependencies, with real examples like Levenstein's edit distance algorithm, Fast Fourier Transform, and others.
Plastic roads mainly use plastic carry bags, disposable cups and bottles that are collected from garbage dumps.
plastic waste is increasing due to increase in population, urbanization and development
Plastics can be divided in to two major categories: thermoset and thermoplastics.
The disposal of waste plastic has become a serious problem globally due to their non-biodegradability.
Comparing research designs fw 2013 handout versionPat Barlow
This is an updated version of my Comparing Research Designs lecture, which now includes discussions on: (1) common considerations with research design such as bias, reliability, validity, and confounding; and (2) expanded discussion of RCT designs including factorial and cross-over designs.
Garbage First Garbage Collector (G1 GC) - Migration to, Expectations and Adva...Monica Beckwith
Learn what you need to know to experience nirvana in the evaluation of G1 GC even if your are migrating from Parallel GC to G1, or CMS GC to G1 GC
You also get a walk through of some case study data
G1 GC
“Show Me the Garbage!”, Understanding Garbage CollectionHaim Yadid
“Just leave the garbage outside and we will take care of it for you”. This is the panacea promised by garbage collection mechanisms built into most software stacks available today. So, we don’t need to think about it anymore, right? Wrong! When misused, garbage collectors can fail miserably. When this happens they slow down your application and lead to unacceptable pauses. In this talk we will go over different garbage collectors approaches in different software runtimes and what are the conditions which enable them to function well.
Presented on Reversim summit 2019
https://summit2019.reversim.com/session/5c754052d0e22f001706cbd8
Whippet: A new production embeddable garbage collector for GuileIgalia
Guile has a new garbage collector coming! The Whippet collector improve
throughput and scalability of Guile programs, and is built in such a way that
it can be swapped into most any language runtime that uses that BDW-GC. With
minimal adaptations in user code, you get a collector that's competitive with
the industry-standard Boehm-Demers-Weiser conservative collector, but which
scales better for multiple allocation threads. As incremental changes are made
in Guile to integrate Whippet, we will also gain the ability to compact the
heap, even while keeping conservative scanning of the C stack. This talk
presents the structure of whippet and some performance numbers for how it
improves Guile program behavior.
The Whippet garbage collector provides an abstract interface that user programs
(like Guile) can use to allocate memory, and also provides a number of
collectors that implement that API. One of them is the BDW-GC collector: this
will be the first step in Guile's switch to Whippet, to change to use the
Whippet API but keep the same GC implementation. Compile-time flags choose the
collector implementation, and in the next step, Guile will switch over to
Whippet's main collector, an Immix-derived mark-region collector. This
collector has a few modes, including a heap-conservative mode that mimics
BDW-GC, as well as a stack-conservative mode that allows evacuation and
compaction of objects that aren't referenced by conservative roots.
The talk will include a quick overview of Immix-style collectors, for context.
Whippet scales: it has been carefully designed to avoid contention during
allocation, and avoid locking except during collection. Collection is
optionally parallel and optionally generational. We'll examine the performance
and practical impacts of these choices, in synthetic test harnesses and in real
Guile programs.
Whippet is designed to be included into a user's C source code, as it needs
compile-time configuration. The talk will show examples of the size of the
collector and its memory efficiency when compared to BDW-GC and to a semispace
collector.
(c) FOSDEM 2023
4 & 5 February 2023
https://fosdem.org/2023/schedule/event/whippet/
Writing a TSDB from scratch_ performance optimizations.pdfRomanKhavronenko
I'm one of maintainers of the open source TimeSeries database VictoriaMetrics, written in Go. It is used for APM or Kubernetes monitoring. The average VictoriaMetrics installation is processing 2-4 million samples/s on the ingestion path, 20-40 million samples/s on the read path. The biggest installations have more than 100 million samples/s on the ingestion path for a single cluster. This requires being clever with data processing to keep it efficient and scalable. In the talk, I'll cover the following optimizations for keeping the database fast:
1. String interning for lowering GC pressure. We use string interning for storing time series metadata (aka labels). However, this approach has downside of increased memory usage. When it is worth it to use string interning?
2. Metadata processing may require many regular expression matching and strings modification operations. Caching results of such operations helps to save CPU. But the downside could be increased memory usage. Which operations should be cached and which are not?
3. Limiting the number of concurrently running goroutines with CPU-bound load by the number of available CPU cores. This helps to control the memory usage on load spikes (which is a frequent event in monitoring). The limit also improves the processing speed of each goroutine, since it reduces the number of context switches. The downside of the approach is its complexity - it is easy to make a mistake and end up with a deadlock or inefficient resource utilization.
4. The better understanding of `sync.Pool`. For us, `sync.Pool` shows itself the best when used in CPU-bound code, while in IO-bound code it leads to excessive memory usage. The CPU-bound code has short ownership over the objects retrieved from the pool. In combination with p.3 (limited number of goroutines processing CPU-bound code) it gives the most efficient processing speed and memory usage since the chance to get a "hot" object from the pool is much higher.
NET Systems Programming Learned the Hard Way.pptxpetabridge
What is a thread quantum and why is it different on Windows Desktop and Windows Server? What's the difference between a blocking call and a blocking flow? Why did our remoting benchmarks suddenly drop when we moved to .NET 6? When should I try to write lock-free code? What does the `volatile` keyword mean?
Welcome to the types of questions my team and I are asked, or ask ourselves, on a regular basis - we're the makers of Akka.NET, a high performance distributed actor system library and these are the sorts of low-level questions we need to answer in order to build great experiences for our own users.
In this talk we're going to learn about .NET systems programming, the low level components we hope we can take for granted, but sometimes can't. In particular:
- The `ThreadPool` and how work queues operate in practice;
- Synchronization mechanisms - including `lock`-less ones;
- Memory management, `Span<T>`, and garbage collection;
- `await`, `Task`, and the synchronization contexts; and
- Crossing user-code and system boundaries in areas such as sockets.
This talk will help .NET developers understand why their code works the way it does and what to do in scenarios that demand high performance.
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...apidays
Apidays Paris 2023 - Software and APIs for Smart, Sustainable and Sovereign Societies
December 6, 7 & 8, 2023
Forget TypeScript, Choose Rust to build Robust, Fast and Cheap APIs
Zacaria Chtatar, Backend Software Engineer at HaveSomeCode
------
Check out our conferences at https://www.apidays.global/
Do you want to sponsor or talk at one of our conferences?
https://apidays.typeform.com/to/ILJeAaV8
Learn more on APIscene, the global media made by the community for the community:
https://www.apiscene.io
Explore the API ecosystem with the API Landscape:
https://apilandscape.apiscene.io/
ECMAScript 6: A Better JavaScript for the Ambient Computing EraAllen Wirfs-Brock
We've entered the Ambient Computing Era and JavaScript is its dominant programing language, But a new computing era needs a new and better JavaScript. It's called ECMAScript 6 and it's about to become the new JavaScript standard. Why do we need it? Why did it take so long? What's in it? When can you use it? Answers will be given.
Here I am giving the explanation about memory management in C#.
For learning more about c# you can refer this
http://skillgun.com/csharp/interview-questions-and-answers
O'Reilly Velocity New York 2016 presentation on modern Linux tracing tools and technology. Highlights the available tracing data sources on Linux (ftrace, perf_events, BPF) and demonstrates some tools that can be used to obtain traces, including DebugFS, the perf front-end, and most importantly, the BCC/BPF tool collection.
Imagine you're tackling one of these evasive performance issues in the field, and your go-to monitoring checklist doesn't seem to cut it. There are plenty of suspects, but they are moving around rapidly and you need more logs, more data, more in-depth information to make a diagnosis. Maybe you've heard about DTrace, or even used it, and are yearning for a similar toolkit, which can plug dynamic tracing into a system that wasn't prepared or instrumented in any way.
Hopefully, you won't have to yearn for a lot longer. eBPF (extended Berkeley Packet Filters) is a kernel technology that enables a plethora of diagnostic scenarios by introducing dynamic, safe, low-overhead, efficient programs that run in the context of your live kernel. Sure, BPF programs can attach to sockets; but more interestingly, they can attach to kprobes and uprobes, static kernel tracepoints, and even user-mode static probes. And modern BPF programs have access to a wide set of instructions and data structures, which means you can collect valuable information and analyze it on-the-fly, without spilling it to huge files and reading them from user space.
In this talk, we will introduce BCC, the BPF Compiler Collection, which is an open set of tools and libraries for dynamic tracing on Linux. Some tools are easy and ready to use, such as execsnoop, fileslower, and memleak. Other tools such as trace and argdist require more sophistication and can be used as a Swiss Army knife for a variety of scenarios. We will spend most of the time demonstrating the power of modern dynamic tracing -- from memory leaks to static probes in Ruby, Node, and Java programs, from slow file I/O to monitoring network traffic. Finally, we will discuss building our own tools using the Python and Lua bindings to BCC, and its LLVM backend.
eBPF (extended Berkeley Packet Filters) is a modern kernel technology that can be used to introduce dynamic tracing into a system that wasn't prepared or instrumented in any way. The tracing programs run in the kernel, are guaranteed to never crash or hang your system, and can probe every module and function -- from the kernel to user-space frameworks such as Node and Ruby.
In this workshop, you will experiment with Linux dynamic tracing first-hand. First, you will explore BCC, the BPF Compiler Collection, which is a set of tools and libraries for dynamic tracing. Many of your tracing needs will be answered by BCC, and you will experiment with memory leak analysis, generic function tracing, kernel tracepoints, static tracepoints in user-space programs, and the "baked" tools for file I/O, network, and CPU analysis. You'll be able to choose between working on a set of hands-on labs prepared by the instructors, or trying the tools out on your own test system.
Next, you will hack on some of the bleeding edge tools in the BCC toolkit, and build a couple of simple tools of your own. You'll be able to pick from a curated list of GitHub issues for the BCC project, a set of hands-on labs with known "school solutions", and an open-ended list of problems that need tools for effective analysis. At the end of this workshop, you will be equipped with a toolbox for diagnosing issues in the field, as well as a framework for building your own tools when the generic ones do not suffice.
Swift: Apple's New Programming Language for iOS and OS XSasha Goldshtein
Presentation from Software Architect 2014, covering Swift -- Apple's new programming language for iOS and OS X. The presentation focuses on Swift's language features, which make it so different from mainstream programming languages. Towards the end of the live talk, we also built an iOS app using Swift.
C# Everywhere: Cross-Platform Mobile Apps with XamarinSasha Goldshtein
Presentation from Software Architect 2014, covering Xamarin's offering for building cross-platform mobile applications in C# while using the native platform APIs. The live talk also covered Xamarin.Forms.
Presentation from Software Architect 2014, covering modern cloud backends for mobile apps with a focus on Microsoft Azure Mobile Services and Facebook Parse.
Delivering Millions of Push Notifications in MinutesSasha Goldshtein
Presentation from TechDays Netherlands 2014 on using Azure Notification Hubs to deliver millions of push notifications - through a Mobile Services backend or through an arbitrary backend including Node.js or .NET console apps.
Building Mobile Apps with a Mobile Services .NET BackendSasha Goldshtein
Presentation from TechDays Netherlands 2014 on using the newly announced .NET backend for Azure Mobile Services to build mobile applications, and on using the Offline Sync preview in Windows Store apps.
Presentation from DevWeek 2014 on task and data parallelism. This session explains the TPL APIs and then covers various scenarios for extracting concurrency, reducing synchronization, putting thresholds on parallelization, and other topics.
O'Reilly Fluent 2014 talk on attacking web applications. Showing practical demos of attacking web assets, including XSS, CSRF, insecure cookie placement, traffic manipulation, and other tactics.
Presentation from ConFoo 2014 on Windows Azure Mobile Services. Introducing the platform, building out an application that uses data storage, server-side scripts, custom API endpoints, push notifications, and client authentication. Source code is available on GitHub at http://github.com/goldshtn/rentahome
Presentation from ConFoo 2014 on Android development. Introducing the Android platform, discussing the major components in the ecosystem, and building a basic todo list manager app with Eclipse.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
10. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Problems with Reference Counting
Performance overhead and contention
associated with modifying the reference count
Particularly bad for multi-core cache lines
Particularly bad for short-lived local variables
Cyclic structures cannot be released
Python provides an additional GC for reclaiming
cycles
Objective C provides a __weak keyword for
declaring pointers without retain
Memory reclamation is proportional to the
number of objects allocated by the program
13. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
How Are We Doing?
This notion of reachability allows us to reclaim
more memory and do it faster than reference
counting!
// C++
void f()
{
auto a = make_shared<A>(...);
a->work();
// 100 lines that
// don’t use a
}
a dies here
// C#
void f()
{
var a = new A(...);
a.Work();
// 100 lines that
// don’t use a
}
a can be
collected here
14. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Side Effect
In some situations, an object may be collected
while a method on it is still executing
class A {
public void foo() {
Thread.Sleep(1000); // does not use this
}
~A() {
// called to reclaim unmanaged resources held by A
// only after the object is deemed unreachable
}
}
16. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Finding Unused Objects
“Two-Color” Mark
Begin from the set of roots and traverse the
heap graph recursively
Naïve, two-phase memory traversal
TRAVERSE(o)
if marked(o) = TRUE return
marked(o) ← TRUE
for v in o’s fields do TRAVERSE(v) end
end
for r in ROOTS do TRAVERSE(*r) end
walk the heap linearly and reclaim all objects not marked
Miscellanea
17. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Finding Unused Objects
Tri-Color Mark
White objects are candidates for collection
Black objects were proven to be reachable
Grey objects have not been traversed yet
GREY ← { g : ∃r ∈ ROOTS, r → g }
WHITE ← all objects GREY
BLACK ← ∅
for g ∈ GREY do
BLACK ← BLACK ∪ * g +
GREY ← GREY ∪ * w ∈ WHITE : g → w + { g }
end
reclaim all WHITE objects
Miscellanea
18. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Stop The World?
Naïve garbage collectors suspend all mutator
threads during a collection
With multi-gigabyte heaps this creates
unacceptable multi-second pauses
Modern tracing collectors suspend mutator
threads selectively, only when necessary
Importantly, threads executing code outside the
runtime don’t need to be suspended as long as
it’s the case
20. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
How To Suspend Threads Safely?
(2) GlobalExceptionHandler(PEXCEPTION_POINTERS exc)
LONG
{
if (exc->ExceptionRecord->ExceptionCode ==
EXCEPTION_ACCESS_VIOLATION &&
exc->ExceptionRecord->Parameters[0] == pGuardPage)
{
SetEvent(hThreadEvents[nThisThread]);
WaitForSingleObject(hResumeEvent, ...);
return EXCEPTION_CONTINUE_EXECUTION;
}
return EXCEPTION_CONTINUE_SEARCH;
}
21. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
How To Suspend Threads Safely?
(3)
To suspend all threads safely, mark the page
as read-only and wait for all threads to pause
when they hit the exception
void SuspendAllThreads()
{
ResetEvent(hResumeEvent);
VirtualProtect(pGuardPage, PAGE_READONLY, ...);
WaitForMultipleObjects(..., hThreadEvents, ...);
VirtualProtect(pGuardPage, PAGE_READWRITE, ...);
SetEvent(hResumeEvent);
}
22. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
On The Fly Updates?
The tri-color states can be updated on-the-fly,
without pausing the mutator threads
Newly allocated objects are marked black*
When a.f = b executes (write barrier):
If b is white and a is black, mark b as grey
Otherwise, do nothing
Occasional short pauses still necessary to clear
the grey set and reach a consistent state
* Strictly speaking, this is optional, because a new object should survive
only if it assigned to some field/root in a black/grey object
24. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Baker’s Implicit Collection
Objects have two linked list fields and a color
bit
To allocate, take an object from the free list
When the free list is empty, move all live objects
to a separate list and make all other objects
free implicitly
Doesn’t handle fragmentation but very cheap
for large objects (no copying) and doesn’t
require reference updates
0/1
0/1
0/1
25. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Compaction
Perfect compaction: requires multiple heap
traversals, expensive
Two-pointer compaction: cheaper, imperfect
ptr2
ptr1
ptr1 ← beginning of heap
ptr2 ← end of heap
while ptr1 ≠ ptr2 do
repeat ptr2 ← next(ptr2) until ptr2 ∊ BLACK
repeat ptr1 ← next(ptr1) until ptr1 ∊ WHITE
if size(*ptr2) ≤ size(*ptr1) then copy(ptr1, ptr2) end
end
Miscellanea
27. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Compaction Procedure
Compaction requires updating references
Can be combined with stop-the-world and
marking
stack ← ROOTS
for g in stack do
place forwarding pointer in g’s old location
move g to new location
for v in g’s fields do
if v was forwarded then update g.v else push v to stack end
end
end
Miscellanea
28. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Two-Finger Copy (Cheney)
copyptr
scanptr
copyptr, scanptr ← start of TO
for r in ROOTS do
if *r was forwarded then r ← (*r).fwdptr else copy(r) end
end
while scanptr < copyptr do
for v in FIELDS(scanptr) do
if v is in FROM and v was not forwarded then copy(v) end
end
procedure copy(p)
scanptr ← scanptr + size(*scanptr)
memcpy(copyptr, p, size(*p))
p, (*p).fwdptr ← copyptr
end
copyptr ← copyptr + size(*p)
end
FREE
29. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Concurrent Copying Compaction
Allow mutators to operate during the combined
mark-and-compact phase:
1. New objects are allocated in TO space
2. When a pointer to FROM space is read (read
barrier), it is immediately copied to TO space
before returning to the mutator
Per-pointer read barriers are super-expensive,
but can be approximated at VM page level
30. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Mostly Concurrent Compaction
After copying objects, resume application
threads without fixing up all references but
mark all heap pages as inaccessible
When a thread accesses an inaccessible page, it
traps and fixes up all references in that page
Additionally, a background fixer slowly fixes up
pages
Not
fixed up
Fixed
up
Free
32. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Field Copy in CoCo
Each field is copied and its status field is then
updated in a lock-free CAS operation on both
the field status and the field
RETRY: // attempt to copy field i to TOSPACE
field_value = *((unsigned*)wide_object) + 2*i + 1);
*((unsigned*)to_object) + i) = field_value;
if (!CAS(
((unsigned*)wide_object) + 2*i,
MAKE64FROM32S(STATUS_COPIED, field_value),
MAKE64FROM32S(STATUS_COPYPENDING, field_value)
)) goto RETRY;
33. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Azul Systems: Phase 1
Vega (2005): a custom chip and OS to run JVM
with a fully concurrent collector
1-cycle hardware instruction for read barrier
Fast user-mode traps for GC-protected pages (enter
and exit in 4-10 cycles)
Some instructions are marked as safepoints and
check a per-CPU safepoint interrupt flag
Azul Vega 3
Up to 864 cores and 768GB of RAM
34. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Azul Systems: Phase 2
Zing (2010): an enhanced Linux kernel to run
JVM with a fully concurrent collector on x86-64
hardware
Software LVB (Loaded Value Barrier) + self-healing
Old and young gen collections are concurrent and
simultaneous with special “remembered sets” for
both old-to-young and young-to-old refs
New virtual memory subsystem to support superhigh memory remapping rates
35. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Azul’s Pauseless GC
Mark phase:
Parallel mark that sets a bit on each object reference
to indicate it was marked through
Gathers liveness total for each 1MB page
New objects are created in untouchable pages
Relocate phase:
Sparse pages are protected from mutator access
Objects from sparse pages are moved, forwarding
information maintained outside the page
The physical page is immediately recycled, the
virtual page remains protected until the remap phase
37. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Azul’s Pauseless GC
Remap phase:
Touches each live ref with a read barrier
Virtual memory for the previously protected pages is
freed
Folded together with the next Mark phase!
Self-healing:
The read barrier fixes the reference (with a CAS) if
the target has moved
The read barrier takes an NMT-trap if the NMT bit for
a ref is wrong, makes sure the Mark phase is aware
of that ref, and uses a CAS to replace the object ref
38. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
What’s The Biggest Innovation
Here?
The page remap/protection logic!
Compaction does not require an additional semispace unlike classic copying collectors
Uses physical memory released by a compacted
page as the compaction target for the next page
The very rapid remap/protection rates require
either custom hardware or memory mapping
extensions
Jumping the gap from ~5GB remaps/sec to ~5TB
remaps/sec
40. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Parallel Work Distribution
Mark
Overpartition the roots into more chunks than
threads
Threads push new outgoing references to their local
queues, other threads can help by stealing
Copy/Compact
Each thread has a copy finger pointing to a relatively
large private area in TOSPACE to reduce contention
Forwarding pointer updated using a CAS operation
while multiple threads speculatively allocate space
for it in their private areas
41. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Generations
When measuring GC efficiency, we look at the
ratio Bytes Freed/Time Elapsed
In a multi-gigabyte stable heap, this metric can
be very bad, e.g. 1MB/5sec
80-98% of new objects die within 1M
instructions or 1MB of allocations
A large fraction of the ones that survive 1-2
collections survive many collections
42. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Dividing The Heap
Introduce multiple memory region for
generations of objects
.NET currently uses three generations
Gen 0 for the newest objects, gen 2 for the oldest
Typical .NET gen 0 budget: 1MB-16MB
Gen 2
On most GC runs, consider only gen 0 objects
Gen 1
for the white set and do not traverse grey
objects from higher generations
Typical stats: 1GB small allocs/sec, 0.5% GC time,
average gen 0 GC latency: 200μs
Gen 0
43. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Additional Tuning
Small allocations from the younger
generation(s) can be performed from threadlocal areas (TLAs) to reduce contention
Large allocations that don’t fit or deemed too
expensive to copy can be satisfied directly from
the older generation
.NET will never compact the large object heap
without explicit instruction
44. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Inter-Generational Relations
This design breaks if objects from gen 1/2
reference objects from gen 0
Write barrier to perform a.f = b:
// assume that a is in ECX, b is in EBX
cmp
ecx, dword ptr [gEndOfGeneration0]
jg
SKIP
mov
edx, ecx
shr
edx, 10
xor
eax, eax
cmpxchg
1, byte ptr [pCardTable + edx]
SKIP:
mov
dword ptr [ecx + OFFSET(f)], ebx
Range
Has ref to
gen 0?
0 – 1023
No
1024 – 2047
Yes
…
No
…
Yes
…
No
45. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Young and Old Collections
Gen 0/gen 1 collections are too short to make
concurrent, and involve copying
In gen 2 we can now make a tradeoff and
occasionally do a blocking compacting GC
We can even allow quick blocking gen 0/gen 1
collections during a gen 2 concurrent collection
Microsoft calls this “background” vs. “foreground” GC
46. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Modern Performance Problems
Excessive paging when doing full GC
Occasional long and unpredictable pauses
In a game, you usually have 16-33ms/frame
Steep performance decline when most of the
available memory is live
“We feel so strongly about ARC being the right
approach to memory management that we have
decided to deprecate Garbage Collection in OS
X.”
[Apple, WWDC 2012]
48. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Real-Time Garbage Collectors
Primary property: guarantee a certain %
utilization for your application in each time
period
Java Metronome (IBM WebSphere Real Time)
% java -Xgcpolicy:metronome -Xgc:targetUtilization=80
-Xgc:targetPauseTime=10 realtime_app
Uses a GC thread per processor, running in short
quanta based on utilization constraints and available
heap space
49. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Java Metronome
Usually acts like a concurrent mark/sweep
collector, no copying
Occasionally performs defragmentation with
copying in small, time-constrained units
Move is concurrent and relies on a read barrier
Super-optimized with resulting ~4% perf. hit
Arraylets: breaking large arrays into fixed-size
non-consecutive pieces to reduce scan and
copy overhead and fragmentation
50. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Miscellanea
Miscellaneous Optimizations
Value/primitive types (stack allocations)
Custom memory pools for specific uses (e.g.,
Android bitmap pool)
Escape analysis: compile-time transformation
from heap allocations to stack allocations
Partial compaction based on information from
sweep phase on heap segment utilization
Switching between expensive and cheap
read/write barriers depending on GC stage
51. Taxonomy
RC
M/S/C
Concurrent
Parallel
Comparing Some Modern
Collectors Nursery
Runtime
Collector
Old Gen
JVM
ParallelGC
STW Copy
Concurrent
STW Copy
Miscellanea
Remarks
Par. STW
M/S/C
JVM
Generations
Conc. Mark
STW Cmpct
JVM
optthruput
STW Copy
Conc. Par.
Mark
STW Cmpct
CLR
Conc. WKS
STW Copy
Conc. Mark
STW Cmpct
CLR
Server
STW Copy
Conc. Par.
Mark
STW Cmpct
JVM
C4 (Azul)
Conc. Cmpct
Conc. Cmpct
Ruby
Rubinius
STW Copy
Conc. M/S
No Cmpct
JVM
G1
STW Copy
Conc. Mark
Takes pause
52. Taxonomy
RC
M/S/C
Concurrent
Parallel
Generations
Finalization
Automatic reclamation of unmanaged
resources is somewhat of an afterthought
Associate an object with a finalizer:
class File
{
Guaranteed to be called
private IntPtr handle;
at some point after the
File object is no longer
// ...
reachable by the program
~File()
{
NativeMethods.CloseHandle(handle);
}
}
Miscellanea
58. References
Uniprocessor Garbage Collection Techniques [Wilson]
Mostly Concurrent Compaction for Mark-Sweep GC [Ossia et al.]
Concurrent Garbage Collection in Rubinius [Bussink]
Parallel Garbage Collection for Shared Memory Multiprocessors
[Flood et al.]
Qualifying the Performance of Garbage Collection vs. Explicit
Memory Management [Hertz et al.]
Why mobile web apps are slow [Crawford]
STOPLESS: A Real-Time Garbage Collector for Multiprocessors
[Pizlo et al.]
A real-time garbage collector with low overhead and consistent
utilization [Bacon et al.]
C4: The Continuously Concurrent Compacting Collector [Tene et
al.]
The Pauseless GC Algorithm [Click et al.]