🤖 Most developers use the JVM daily But rarely think about what happens between writing code and running it Here’s the simplified flow 👇 1️⃣ Compile javac converts .java into bytecode (.class / JAR) → platform independent 2️⃣ Load Classes are loaded on demand using the parent delegation model (Bootstrap → Platform → Application) 3️⃣ Link • Verify (safety) • Prepare (allocate memory) • Resolve (map references) 4️⃣ Initialize Static variables and blocks execute once 5️⃣ Memory • Heap → objects • Method Area → metadata • Stack → execution GC cleans unused memory 6️⃣ Execution • Interpreter runs bytecode • JIT compiles hot code → better performance over time 7️⃣ Native JNI allows calls to C/C++ when needed 💡 JVM = portability + memory management + runtime optimization 🔍 Production signals: Slow startup, GC pauses, warm-up gains → all JVM behavior #Java #JVM #BackendEngineering #SystemDesign #Performance
JVM Life Cycle and Performance Optimization
More Relevant Posts
-
Linked list problems often test how well you can manipulate pointers without losing track. 🚀 Day 114/365 — DSA Challenge Solved: Swap Nodes in Pairs Problem idea: We need to swap every two adjacent nodes in a linked list without changing values, only pointers. Efficient approach: Use a dummy node and carefully adjust pointers in pairs. Steps: 1. Use a dummy node pointing to head 2. Maintain a pointer prev before the current pair 3. Identify two nodes: first and second 4. Swap them by updating pointers 5. Move prev forward to the next pair This ensures all pairs are swapped correctly. ⏱ Time: O(n) 📦 Space: O(1) Day 114/365 complete. 💻 251 days to go. Code: https://lnkd.in/dad5sZfu #DSA #Java #LinkedList #LeetCode #LearningInPublic
To view or add a comment, sign in
-
-
The easiest way to ruin performance is to keep asking a system how it’s doing. so we don’t. We monitor system by just watching, using tools like JMH and JVM perf data, because the moment you interrupt the system, you’ve already disturbed the very behavior you wanted to measure. JMH for controlled, statistical microbenchmarks; JVM perf data accessed via tools like jcmd, jps, VisualVM, and similar utilities for low-intrusion runtime observability. A note: observability starts with understanding the data path. Every tool be it JVM-based, agents or frameworks like Spring Boot Actuator, comes with trade-offs depending on how it sources and exposes metrics. #java
To view or add a comment, sign in
-
-
Linked list problems often simulate real-world processes — this one is just like manual addition. 🚀 Day 112/365 — DSA Challenge Solved: Add Two Numbers Problem idea: We are given two numbers in reverse order as linked lists, and we need to return their sum as a linked list. Efficient approach: Simulate the addition process digit by digit with a carry. Steps: 1. Traverse both linked lists simultaneously 2. Add corresponding digits along with carry 3. Create a new node with (sum % 10) 4. Update carry = sum / 10 5. Continue until both lists and carry are exhausted Using a dummy node helps simplify list construction. ⏱ Time: O(max(n, m)) 📦 Space: O(max(n, m)) Day 112/365 complete. 💻 253 days to go. Code: https://lnkd.in/dad5sZfu #DSA #Java #LinkedList #LeetCode #LearningInPublic
To view or add a comment, sign in
-
-
Deep Dive into JVM Internals — Beyond the Basics 🔲 Slide 1 — The Nesting Doll JDK ⊃ JRE ⊃ JVM. Three nested layers. Not three separate tools. Most developers have used all three for years without knowing the difference. 🔗 Slide 2 — Class Loader Every class request travels UP the chain before any loader handles it. Bootstrap → Platform → Application → Custom. This parent delegation contract is why you can never shadow java.lang.String — no matter how hard you try. 🧠 Slide 3 — Memory Architecture Per-thread → PC Register · JVM Stack · Native Stack Shared → Heap (Eden → Survivor → Old Gen) · Metaspace · Code Cache · Constant Pool One fact most devs miss: Every Java object costs 12–16 bytes of header before your first field. That's why int[] uses 8× less memory than Integer[]. ⚡ Slide 4 — JIT Tiered Compilation T0 → T1 → T2 → T3 → T4 (C2 peak) C2 does inlining, escape analysis, lock elision, loop unrolling, and scalar replacement. If an object never leaves a method → C2 puts it on the stack. Zero heap allocation. Zero GC pressure. ♻️ Slide 5 — GC Internals All collectors share tri-colour marking: White → Gray → Black. Serial · Parallel · G1 (default, Java 9+) · ZGC · Shenandoah ZGC's trick: GC state lives in unused bits of 64-bit pointers. Relocation happens concurrently. Threads never pause. Sub-1ms guaranteed. 🔁 Slide 6 — Bytecode → CPU .java → javac → .class → ClassLoader → Interpreter → JIT → Code Cache → CPU The OS is involved at every step: thread scheduling · mmap for heap · SIGSEGV → NullPointerException Java 21 virtual threads intercept I/O before the syscall. Millions of threads. Near-zero OS overhead. 📋 Slide 7 — Quick Reference Card Essential JVM flags · diagnostic tools · jstack · jmap · async-profiler A cheat sheet worth bookmarking. #Java #JVM #BackendDevelopment #SystemDesign #Performance #SoftwareEngineering
To view or add a comment, sign in
-
Day 71 - Delete Middle Node Handling linked list traversal to identify and remove the middle node efficiently. Approach: • Traverse once to count nodes • Find middle index using n/2 • Traverse again to reach previous node • Update pointers to remove middle Key Insight: Careful handling needed when list size is small (edge cases) Time Complexity: O(n) Space Complexity: O(1) #Day71 #LeetCode #Java #CodingPractice #TechJourney #DSA #LinkedList
To view or add a comment, sign in
-
-
Some linked list problems are all about reversing connections in a controlled range. 🚀 Day 115/365 — DSA Challenge Solved: Reverse Linked List II Problem idea: We need to reverse a portion of a linked list from position left to right, while keeping the rest unchanged. Efficient approach: Use in-place reversal with pointer manipulation. Steps: 1. Use a dummy node to simplify edge cases 2. Move a pointer to the node just before position left 3. Start reversing nodes one by one within the range 4. Adjust links so that reversed nodes are inserted at the correct position 5. Connect the reversed portion back to the list This avoids creating extra space and keeps the solution efficient. ⏱ Time: O(n) 📦 Space: O(1) Day 115/365 complete. 💻 250 days to go. Code: https://lnkd.in/dad5sZfu #DSA #Java #LinkedList #LeetCode #LearningInPublic
To view or add a comment, sign in
-
-
Day 66/75 — Climbing Stairs Revisited a classic DP problem today. Approach: • Recognize it as Fibonacci pattern • Ways(n) = Ways(n-1) + Ways(n-2) • Use space-optimized DP with two variables Key idea: int prev2 = 1; int prev1 = 1; for (int i = 2; i <= n; i++) { int current = prev1 + prev2; prev2 = prev1; prev1 = current; } return prev1; Time Complexity: O(n) Space Complexity: O(1) Simple problem, but very important for building DP intuition. 66/75 📈 #Day66 #DSA #DynamicProgramming #Java #LeetCode
To view or add a comment, sign in
-
-
Understanding HotSpot error files can save hours of debugging time. In this post, I break them down and share two practical tools: a VSCode syntax highlighter and a browser-based redaction tool: https://lnkd.in/dayik_wS
To view or add a comment, sign in
-
Linked list problems often become simpler when you break them into clear steps. 🚀 Day 111/365 — DSA Challenge Solved: Remove Nth Node From End of List Problem idea: We need to remove the nth node from the end of a linked list. Efficient approach: Convert the problem into finding the (size − n)th node from the start. Steps: 1. Traverse the list to calculate its size 2. If n equals size → remove the head 3. Otherwise, find the node just before the target 4. Update pointers to remove the node This simplifies the problem using basic traversal and pointer manipulation. ⏱ Time: O(n) 📦 Space: O(1) Day 111/365 complete. 💻 254 days to go. Code: https://lnkd.in/dad5sZfu #DSA #Java #LinkedList #LeetCode #LearningInPublic
To view or add a comment, sign in
-
-
𝐃𝐚𝐲 𝟖𝟏 – 𝐃𝐒𝐀 𝐉𝐨𝐮𝐫𝐧𝐞𝐲 | 𝐀𝐫𝐫𝐚𝐲𝐬 🚀 Today’s problem focused on finding two unique numbers where all others appear twice. 𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐒𝐨𝐥𝐯𝐞𝐝 • Single Number III 🔗 https://lnkd.in/dEQaaF3F 𝐀𝐩𝐩𝐫𝐨𝐚𝐜𝐡 – 𝐁𝐢𝐭 𝐌𝐚𝐧𝐢𝐩𝐮𝐥𝐚𝐭𝐢𝐨𝐧 (𝐎𝐩𝐭𝐢𝐦𝐚𝐥) Steps: • XOR all elements → gives a ⊕ b (two unique numbers) • Find rightmost set bit → differentiates a & b • Divide numbers into 2 groups based on that bit • XOR each group → get the two unique numbers 𝐊𝐞𝐲 𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠𝐬 • XOR cancels duplicate elements • Bit tricks help split data into meaningful groups • Problems can often be optimized from O(n²) → O(n) • Understanding bit-level operations is very powerful 𝐂𝐨𝐦𝐩𝐥𝐞𝐱𝐢𝐭𝐲 • Time: O(n) • Space: O(1) 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲 When duplicates cancel out, think in terms of XOR and bit patterns. 81 days consistent 🚀 On to Day 82. #DSA #Arrays #BitManipulation #LeetCode #Java #ProblemSolving #DailyCoding #LearningInPublic #SoftwareDeveloper
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development