Category Archives: Без рубрики

Java.Multithreading.How can a thread be started forcibly?

Scenario Can you do it? How? Start a thread without calling start() ❌ No start() is required Start a thread from another thread externally ❌ No Caller must control it Force a paused/sleeping thread to resume ❌ Not directly You … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.How can a thread be started forcibly?

Java.Multithreading.What is the difference between start() and run() methods in Thread?

✅ The Thread class in Java just implements the Runnable interface. so… 🧵 The Core Difference Method What it Does start() Starts a new thread of execution (calls run() on a new thread) run() Just a normal method call, executes … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.What is the difference between start() and run() methods in Thread?

Java.Multithreading.What is the difference between Thread and Runnable?

Let’s break it down step by step: 🧠 Core Difference Concept Thread Runnable What is it? A class that represents a thread of execution A functional interface (task to run in a thread) Role Executes the code Defines the code … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.What is the difference between Thread and Runnable?

Java.Multithreading.How can a thread be created?

🔨 1. Extending Thread Class ✅ Easy to use❌ Can’t extend another class (Java has single inheritance)

Posted in Без рубрики | Comments Off on Java.Multithreading.How can a thread be created?

Java.Multithreading.What are “green threads” and do they exist in Java?

🌱 What Are Green Threads? Green threads are threads that are scheduled and managed entirely by the JVM (or user-level runtime), not the OS. That means: The JVM simulates threading using only one OS thread (or very few) Thread switching … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.What are “green threads” and do they exist in Java?

Java.Multithreading.What is the difference between a process and a thread?

🧠 What’s the Difference Between a Process and a Thread? Feature Process Thread Definition A program in execution (independent) A lightweight unit of execution within a process Memory Has its own memory space Shares memory with other threads in same … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.What is the difference between a process and a thread?

Java.Multithreading.What is ordering, as-if-serial semantics, sequential consistency, visibility, atomicity, happens-before, mutual exclusion, safe publication?

🧩 1. Ordering Ordering is about the sequence of execution of operations (like reads and writes). It matters because compilers, JVM, and CPUs may reorder instructions to optimize performance. You’d assume x is set before y, but the JVM might … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.What is ordering, as-if-serial semantics, sequential consistency, visibility, atomicity, happens-before, mutual exclusion, safe publication?

Java.Multithreading.What is “cooperative multitasking”? What type of multitasking does Java use? What is the reason for this choice?

🧠 What is Cooperative Multitasking? 🧩 Cooperative multitasking means:Tasks (threads/processes) voluntarily yield control of the CPU so others can run. 🔧 How It Works: The OS does not forcibly interrupt a running task. It relies on each task to be … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.What is “cooperative multitasking”? What type of multitasking does Java use? What is the reason for this choice?

Java.Multithreading.Can i adjust ThreadPoolExeccutor to work on different cores ?

❓ Can you adjust ThreadPoolExecutor to run on different cores? ⚠️ Short Answer: Not directly in Java — you cannot manually bind threads to specific cores using ThreadPoolExecutor or Java alone. But… ✅ Long Answer: You can influence it indirectly … Continue reading →

Posted in Без рубрики | Comments Off on Java.Multithreading.Can i adjust ThreadPoolExeccutor to work on different cores ?

Java.Multithreading.Is ForkJoin more effective than threadExecutor ?

✅ Yes, ForkJoinPool is more effective than ThreadPoolExecutor in certain scenarios — but not always. Let’s dive into when and why ForkJoinPool outperforms ThreadPoolExecutor, and when it might not.

Posted in Без рубрики | Comments Off on Java.Multithreading.Is ForkJoin more effective than threadExecutor ?