SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Core Java
Revisiting

JVM Architecture
Class Loader subsystem
Execution Engine
Garbage Collector
Selection
Serial Collector
The serial collector uses a single thread to perform all
garbage collection work.
Efficient because there is no communication overhead
between threads.
It is best-suited to single/multi processor machines with
data sets (up to approximately 100 MB)
The serial collector is selected by default on certain
hardware and operating system configurations,
or can be explicitly enabled with the option -
XX:+UseSerialGC.
Parallel Collector
The parallel collector (throughput collector) performs minor
collections in parallel, which can significantly reduce garbage
collection overhead.
It is intended for applications with medium-sized to large-sized
data sets that are run on multiprocessor or multithreaded
hardware.
The parallel collector is selected by default on certain hardware
and operating system configurations, or can be explicitly
enabled with the option -XX:+UseParallelGC.
This is the default GC in Java8
Concurrent Collectors
The mostly concurrent collector performs most of its work
concurrently (for example, while the application is still
running) to keep garbage collection pauses short.
‱ CMS : This collector is for applications that prefer shorter
garbage collection pauses and can afford to share processor
resources with the garbage collection.
‱ G1: This server-style collector is for multiprocessor machines
with large memories. It meets garbage collection pause time
goals with high probability while achieving high throughput.
Use the option -XX:+UseConcMarkSweepGC to enable
the CMS collector or -XX:+UseG1GC to enable the G1
collector.
Selecting GC
If the application has a small data set (up to approximately 100
MB), then select the serial collector with the option -
XX:+UseSerialGC.
If (a) peak application performance is the first priority and (b)
there are no pause time requirements or pauses of 1 second or
longer are acceptable, then let the VM select the collector, or
select the parallel collector with -XX:+UseParallelGC.
If response time is more important than overall throughput and
garbage collection pauses must be kept shorter than approximately
1 second, then select the concurrent collector with -
XX:+UseConcMarkSweepGC or -XX:+UseG1GC.
If the recommended collector does not achieve the desired
performance, first attempt to adjust the heap and generation sizes
to meet the desired goals.
Reference:
https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctun
ing/toc.html
Young Generation GC
Copy (enabled with -XX:+UseSerialGC) - the serial copy collector,
uses one thread to copy surviving objects from Eden to Survivor
spaces and between Survivor spaces until it decides they've been
there long enough, at which point it copies them into the old
generation.
PS Scavenge (enabled with -XX:+UseParallelGC) -the parallel
scavenge collector, like the Copy collector, but uses multiple
threads in parallel and has some knowledge of how the old
generation is collected (essentially written to work with the serial
and PS old gen collectors).
ParNew (enabled with -XX:+UseParNewGC) -the parallel copy
collector, like the Copy collector, but uses multiple threads in
parallel and has an internal 'callback' that allows an old generation
collector to operate on the objects it collects (really written to work
with the concurrent collector).
G1 Young Generation (enabled with -XX:+UseG1GC) -the
garbage first collector, uses the 'Garbage First' algorithm which
splits up the heap into lots of smaller spaces, but these are still
separated into Eden and Survivor spaces in the young generation
for G1.
Old generation GC
MarkSweepCompact (enabled with -XX:+UseSerialGC) -The serial mark-
sweep collector, the daddy of them all, uses a serial (one thread) full mark-
sweep garbage collection algorithm, with optional compaction.
PS MarkSweep (enabled with -XX:+UseParallelOldGC) -The parallel
scavenge mark-sweep collector, parallelised version (i.e. uses multiple
threads) of the MarkSweepCompact.
ConcurrentMarkSweep (enabled with -XX:+UseConcMarkSweepGC) -The
concurrent collector, a garbage collection algorithm that attempts to do
most of the garbage collection work in the background without stopping
application threads while it works (there are still phases where it has to stop
application threads, but these phases are attempted to be kept to a
minimum). Note if the concurrent collector fails to keep up with the garbage,
it fails over to the serial MarkSweepCompact collector for (just) the next
GC.
G1 Mixed Generation (enabled with -XX:+UseG1GC) -The garbage first
collector, uses the 'Garbage First' algorithm which splits up the heap into
lots of smaller spaces.
Reference : http://www.fasterj.com/articles/oraclecollectors1.shtml
Static method design
when to choose static methods
Static methods have following advantages
If a class is having multiple constructors then it is difficult to choose
which constructor to use unless we have good idea on API
documentation. Static method have names which is more readable.
 Builder design pattern recommends this approach
http.getInmemoryManager().withUsername().password().havin
gRole().build();
If the object states are limited it is good to use static methods and
ENUMs to create objects. Flyweight Design pattern follows this.
Boolean.valueOf() example of this
SOLID Principles
Single Responsibility Principle: Class should have only
one reason to change. design for one specific purpose
Open Close Principle: Open for extension and closed for
modification. (interface and inheritance ; encapsulation)
Liskov Substitution Principle: Derived class should be
substituted with their parent class (inheritance).
Interface Segregation Principle: Client should not
depend on interface members that are not required.(split
into multiple interface) (write adapters )
Dependency Inversion Principle: High level modules
should not depend on low-level classes. And abstract
classes shouldn’t refer concrete classes. (Bridge Design
Pattern)
Path and Paths
Path is an interface where as Paths is a class with some
static methods.
Path path=Paths.get( URI);
Path path=Paths.get( “”, “” , 
..);
Stream<String> stream=Files.lines(path);
Files.lines(path);
Files.write(path, bytes);
Files.readAllBytes(path)
Files.delete();
Files.deleteIfExists(path);
Files.move(srcPath, dstPath);
Files.copy(srcPath,dstPath,
StandardCopyOption.REPLACE_EXISTING);

Weitere Àhnliche Inhalte

Was ist angesagt?

Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 

Was ist angesagt? (20)

Java program structure
Java program structure Java program structure
Java program structure
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
History of java'
History of java'History of java'
History of java'
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 
QSpiders - Memory (JVM architecture)
QSpiders - Memory (JVM architecture)QSpiders - Memory (JVM architecture)
QSpiders - Memory (JVM architecture)
 
Java swing
Java swingJava swing
Java swing
 
QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Lecture - 2 Environment setup & JDK, JRE, JVM
Lecture - 2 Environment setup & JDK, JRE, JVMLecture - 2 Environment setup & JDK, JRE, JVM
Lecture - 2 Environment setup & JDK, JRE, JVM
 
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
 
java token
java tokenjava token
java token
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecture
 
Multiple inheritance possible in Java
Multiple inheritance possible in JavaMultiple inheritance possible in Java
Multiple inheritance possible in Java
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Java architecture
Java architectureJava architecture
Java architecture
 
Mutual exclusion and sync
Mutual exclusion and syncMutual exclusion and sync
Mutual exclusion and sync
 
JVM
JVMJVM
JVM
 

Andere mochten auch

JVM- Java Virtual Machine
JVM- Java Virtual MachineJVM- Java Virtual Machine
JVM- Java Virtual Machine
Manasvi Mehta
 
802.11 wireless lan
802.11 wireless lan802.11 wireless lan
802.11 wireless lan
Mohd Arif
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
parag
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Raghu nath
 
Wireless Local Area Networks
Wireless Local Area NetworksWireless Local Area Networks
Wireless Local Area Networks
Don Norwood
 

Andere mochten auch (17)

Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
JVM- Java Virtual Machine
JVM- Java Virtual MachineJVM- Java Virtual Machine
JVM- Java Virtual Machine
 
JVM
JVMJVM
JVM
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
Understanding JVM
Understanding JVMUnderstanding JVM
Understanding JVM
 
Inside the jvm
Inside the jvmInside the jvm
Inside the jvm
 
Java Multi Thead Programming
Java Multi Thead ProgrammingJava Multi Thead Programming
Java Multi Thead Programming
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
 
802.11 wireless lan
802.11 wireless lan802.11 wireless lan
802.11 wireless lan
 
Multithread Programing in Java
Multithread Programing in JavaMultithread Programing in Java
Multithread Programing in Java
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Inheritance
InheritanceInheritance
Inheritance
 
Java multi threading
Java multi threadingJava multi threading
Java multi threading
 
Wireless Local Area Networks
Wireless Local Area NetworksWireless Local Area Networks
Wireless Local Area Networks
 

Ähnlich wie Jvm Architecture

Quick introduction to Java Garbage Collector (JVM GC)
Quick introduction to Java Garbage Collector (JVM GC)Quick introduction to Java Garbage Collector (JVM GC)
Quick introduction to Java Garbage Collector (JVM GC)
Marcos GarcĂ­a
 
Garbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVMGarbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVM
jaganmohanreddyk
 
OpenDS_Jazoon2010
OpenDS_Jazoon2010OpenDS_Jazoon2010
OpenDS_Jazoon2010
Ludovic Poitou
 

Ähnlich wie Jvm Architecture (20)

Đ’ŃŃ‡Đ”ŃĐ»Đ°ĐČ Đ‘Đ»ĐžĐœĐŸĐČ Â«Java Garbage Collection: A Performance Impact»
Đ’ŃŃ‡Đ”ŃĐ»Đ°ĐČ Đ‘Đ»ĐžĐœĐŸĐČ Â«Java Garbage Collection: A Performance ImpactÂ»Đ’ŃŃ‡Đ”ŃĐ»Đ°ĐČ Đ‘Đ»ĐžĐœĐŸĐČ Â«Java Garbage Collection: A Performance Impact»
Đ’ŃŃ‡Đ”ŃĐ»Đ°ĐČ Đ‘Đ»ĐžĐœĐŸĐČ Â«Java Garbage Collection: A Performance Impact»
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
 
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory UsageChoosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
Choosing Right Garbage Collector to Increase Efficiency of Java Memory Usage
 
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...Elastic JVM  for Scalable Java EE Applications  Running in Containers #Jakart...
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
An introduction to G1 collector for busy developers
An introduction to G1 collector for busy developersAn introduction to G1 collector for busy developers
An introduction to G1 collector for busy developers
 
Java gc and JVM optimization
Java gc  and JVM optimizationJava gc  and JVM optimization
Java gc and JVM optimization
 
Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage Collection
 
Mastering java in containers - MadridJUG
Mastering java in containers - MadridJUGMastering java in containers - MadridJUG
Mastering java in containers - MadridJUG
 
Java ì–Ží”ŒëŠŹìŒ€ìŽì…˜ 성늄튜닝 Part1
Java ì–Ží”ŒëŠŹìŒ€ìŽì…˜ 성늄튜닝 Part1Java ì–Ží”ŒëŠŹìŒ€ìŽì…˜ 성늄튜닝 Part1
Java ì–Ží”ŒëŠŹìŒ€ìŽì…˜ 성늄튜닝 Part1
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performance
 
Memory Management in the Java Virtual Machine(Garbage collection)
Memory Management in the Java Virtual Machine(Garbage collection)Memory Management in the Java Virtual Machine(Garbage collection)
Memory Management in the Java Virtual Machine(Garbage collection)
 
JVM Magic
JVM MagicJVM Magic
JVM Magic
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
 
JVM Performance Tuning
JVM Performance TuningJVM Performance Tuning
JVM Performance Tuning
 
Advanced Namespaces and cgroups
Advanced Namespaces and cgroupsAdvanced Namespaces and cgroups
Advanced Namespaces and cgroups
 
Quick introduction to Java Garbage Collector (JVM GC)
Quick introduction to Java Garbage Collector (JVM GC)Quick introduction to Java Garbage Collector (JVM GC)
Quick introduction to Java Garbage Collector (JVM GC)
 
Garbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVMGarbage Collection in Hotspot JVM
Garbage Collection in Hotspot JVM
 
OpenDS_Jazoon2010
OpenDS_Jazoon2010OpenDS_Jazoon2010
OpenDS_Jazoon2010
 

KĂŒrzlich hochgeladen

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Bert Jan Schrijver
 
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 

KĂŒrzlich hochgeladen (20)

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 

Jvm Architecture

  • 4.
  • 7. Serial Collector The serial collector uses a single thread to perform all garbage collection work. Efficient because there is no communication overhead between threads. It is best-suited to single/multi processor machines with data sets (up to approximately 100 MB) The serial collector is selected by default on certain hardware and operating system configurations, or can be explicitly enabled with the option - XX:+UseSerialGC.
  • 8. Parallel Collector The parallel collector (throughput collector) performs minor collections in parallel, which can significantly reduce garbage collection overhead. It is intended for applications with medium-sized to large-sized data sets that are run on multiprocessor or multithreaded hardware. The parallel collector is selected by default on certain hardware and operating system configurations, or can be explicitly enabled with the option -XX:+UseParallelGC. This is the default GC in Java8
  • 9. Concurrent Collectors The mostly concurrent collector performs most of its work concurrently (for example, while the application is still running) to keep garbage collection pauses short. ‱ CMS : This collector is for applications that prefer shorter garbage collection pauses and can afford to share processor resources with the garbage collection. ‱ G1: This server-style collector is for multiprocessor machines with large memories. It meets garbage collection pause time goals with high probability while achieving high throughput. Use the option -XX:+UseConcMarkSweepGC to enable the CMS collector or -XX:+UseG1GC to enable the G1 collector.
  • 10. Selecting GC If the application has a small data set (up to approximately 100 MB), then select the serial collector with the option - XX:+UseSerialGC. If (a) peak application performance is the first priority and (b) there are no pause time requirements or pauses of 1 second or longer are acceptable, then let the VM select the collector, or select the parallel collector with -XX:+UseParallelGC. If response time is more important than overall throughput and garbage collection pauses must be kept shorter than approximately 1 second, then select the concurrent collector with - XX:+UseConcMarkSweepGC or -XX:+UseG1GC. If the recommended collector does not achieve the desired performance, first attempt to adjust the heap and generation sizes to meet the desired goals. Reference: https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctun ing/toc.html
  • 11. Young Generation GC Copy (enabled with -XX:+UseSerialGC) - the serial copy collector, uses one thread to copy surviving objects from Eden to Survivor spaces and between Survivor spaces until it decides they've been there long enough, at which point it copies them into the old generation. PS Scavenge (enabled with -XX:+UseParallelGC) -the parallel scavenge collector, like the Copy collector, but uses multiple threads in parallel and has some knowledge of how the old generation is collected (essentially written to work with the serial and PS old gen collectors). ParNew (enabled with -XX:+UseParNewGC) -the parallel copy collector, like the Copy collector, but uses multiple threads in parallel and has an internal 'callback' that allows an old generation collector to operate on the objects it collects (really written to work with the concurrent collector). G1 Young Generation (enabled with -XX:+UseG1GC) -the garbage first collector, uses the 'Garbage First' algorithm which splits up the heap into lots of smaller spaces, but these are still separated into Eden and Survivor spaces in the young generation for G1.
  • 12. Old generation GC MarkSweepCompact (enabled with -XX:+UseSerialGC) -The serial mark- sweep collector, the daddy of them all, uses a serial (one thread) full mark- sweep garbage collection algorithm, with optional compaction. PS MarkSweep (enabled with -XX:+UseParallelOldGC) -The parallel scavenge mark-sweep collector, parallelised version (i.e. uses multiple threads) of the MarkSweepCompact. ConcurrentMarkSweep (enabled with -XX:+UseConcMarkSweepGC) -The concurrent collector, a garbage collection algorithm that attempts to do most of the garbage collection work in the background without stopping application threads while it works (there are still phases where it has to stop application threads, but these phases are attempted to be kept to a minimum). Note if the concurrent collector fails to keep up with the garbage, it fails over to the serial MarkSweepCompact collector for (just) the next GC. G1 Mixed Generation (enabled with -XX:+UseG1GC) -The garbage first collector, uses the 'Garbage First' algorithm which splits up the heap into lots of smaller spaces. Reference : http://www.fasterj.com/articles/oraclecollectors1.shtml
  • 13. Static method design when to choose static methods Static methods have following advantages If a class is having multiple constructors then it is difficult to choose which constructor to use unless we have good idea on API documentation. Static method have names which is more readable.  Builder design pattern recommends this approach http.getInmemoryManager().withUsername().password().havin gRole().build(); If the object states are limited it is good to use static methods and ENUMs to create objects. Flyweight Design pattern follows this. Boolean.valueOf() example of this
  • 14. SOLID Principles Single Responsibility Principle: Class should have only one reason to change. design for one specific purpose Open Close Principle: Open for extension and closed for modification. (interface and inheritance ; encapsulation) Liskov Substitution Principle: Derived class should be substituted with their parent class (inheritance). Interface Segregation Principle: Client should not depend on interface members that are not required.(split into multiple interface) (write adapters ) Dependency Inversion Principle: High level modules should not depend on low-level classes. And abstract classes shouldn’t refer concrete classes. (Bridge Design Pattern)
  • 15. Path and Paths Path is an interface where as Paths is a class with some static methods. Path path=Paths.get( URI); Path path=Paths.get( “”, “” , 
..); Stream<String> stream=Files.lines(path); Files.lines(path); Files.write(path, bytes);