Home Java Docker
Home     Java

Java Topic

What is Java
History of Java
Freature of Java
Difference Between Java & C++
Java Environment Set Up
Java Hello World Program & its Internal Process
Java Hello World Program
JDK, JRE and JVM
Java Variables
Java Data Types & Unicode System
Java Operators
Java Keywords
Java Control Statements
Java if else
Java switch
Java for loop
Java While loop
Java Do While loop
Java break
Java continue
Java Oops Concept
Java Object & Class
Java Method
Java Constructor
Java Static Keyword
Java this Keyword
Java Inheritance
Java Hybrid Inheritance
Aggregation(HAS-A)
Java Polymorphism
Java method overloading
Java method overriding
Java Runtime polymorphism
Java Dynamic Binding
Super keyword
Final keyword
Difference Between method overloading and method overriding
Java Abstraction
Java Interface
Abstract class vs Interface
Java Encapsulation
Java Package
Java Access Modifiers
covariant return type
Instance initializer block
Java instanceof operator
Object Cloning in Java
Wrapper classes in Java
Java Strictfp Keyword
Recursion in Java
Java Command Line Arguments
Difference between object and class
Java String
Java String Class
Java Immutable String
Java Immutable Class
String Buffer
String Builder
String Buffer vs String
String Builder vs String Buffer
String Tokenizer in Java
Java Array
Java Exceptions Handling
Java Try-Catch block
Java Multiply Catch Block
Java Finally Block
Java Throws Keyword
Java Throw Keyword
Java Exception Propagation
Java Throw vs Throws
Final vs Finally vs Finalize
Exception Handling With Method Overridding
Java Multithreading
Lifecycle and States of a Thread in Java
How to create a thread in Java
Thread Scheduler in Java
Sleeping a thread in Java
Calling run() method
Joining a thread in Java
Naming a thread in Java
Thread Priority
Daemon Thread
Thread Pool
Thread Group
Shutdown hook
Multitasking vs Multithreading
Garbage Collection
RunTime Class
Java Synchronization
Synchronized block in Java
Static Synchronization in Java
Deadlock in Java
Inter Thread Communication in Java
Interrupting Thread in Java
Reentrant Monitor in Java
Java Applet
Animation in Applet
EventHandling in Applet
Display image in Applet
Displaying Graphics in Applet
Parameter in Applet
Java 8 Features
Java Lambda Expressions
Method References
Functional Interfaces
Java 8 Stream
Base64 Encode Decode
Default Method
for Each() Method
Collectors class
String Joiner Class
Optional Class
JavaScript Nashron
Parallel Array Sort
Type Interface
Parameter Reflection
Type and Repeating Annotations
JDBC Improvements

Difference betweeen Multitasking and Multithreading

Java Multitasking

    • When a single CPU performs multiple tasks (program, process, task, threads) at the same time, this is referred to as multitasking. To perform multitasking, the CPU switches between these tasks frequently so that the user can interact with each program at the same time.
    • A multitasking operating system allows multiple users to share the system at the same time. As we saw, the CPU rapidly switches between tasks, so switching from one user to the next takes some time. This gives the user the impression that the entire computer system is dedicated to him.
    • When several users share a multitasking operating system, CPU scheduling and multiprogramming allow each user to have at least a small portion of the Multitasking OS and at least one program in memory for execution.





Java Multithreading

  • Multithreading differs from multitasking in that multitasking allows multiple tasks to be executed concurrently, whereas Multithreading allows multiple threads of a single task (program, process) to be executed concurrently by the CPU.

  • Before we get into multithreading, let's define a thread. A thread is a basic execution unit that has its own program counter, register set, and stack but shares the process's code, data, and file. A process can have multiple threads running at the same time, and the CPU switches between them so frequently that the user believes all threads are running at the same time, which is known as multithreading.
  • Multithreading improves system responsiveness because if one thread of an application is not responding, the other will, and the user will not have to sit idle. Multithreading enables resource sharing because threads belonging to the same process can share the process's code and data, and it enables a process to have multiple threads active in the same address space at the same time.

  • Creating a new process is more expensive because the system must allocate separate memory and resources to each process, whereas creating threads is simple because it does not require allocating separate memory and resources for threads of the same process.





Difference between StringBuffer and String class

Difference between StringBuffer and String class are mention below


S.no Multitasking Multithreading
1. Multitasking allows the CPU to perform multiple tasks at the same time. Multithreading allows the CPU to run multiple threads of a process at the same time.
2. When multitasking, the CPU frequently switches between programs. The CPU frequently switches between threads in multithreading.
3. Each program that the CPU is executing in a multitasking system requires its own memory and resources. When a multithreading system allocates memory to a process, multiple threads of that process share the same memory and resources.
4. The CPU is used in multitasking to execute multiple tasks at once. A CPU is also provided in multithreading in order to execute multiple threads from a process at the same time.
5. Multitasking is slower than multithreading. Multithreading, on the other hand, is faster.
6. Terminating a process takes longer when multitasking. Thread termination takes less time in multithreading.
7. Multitasking allows for isolation and memory protection. In multithreading, isolation and memory protection do not exist.



Garbage Collection Next »
« Perv Next »


Post your comment





Read Next Topic
Java Tutorial - Topic
Java Multithreading
Lifecycle and States of a Thread in Java
How to create a thread in Java
Thread Scheduler in Java
Sleeping a thread in Java
Calling run() method
Joining a thread in Java
Naming a thread in Java
Thread Priority
Daemon Thread
Thread Pool
Thread Group
Shutdown hook
Multitasking vs Multithreading
Garbage Collection
RunTime Class
Read Other Java Chapter
Java Topic
Java Basic Tutorial
Java Control Statements
Java Classes & Object
Java Inheritance
Java Polymorphism
Java Abstraction
Java Encapsulation
Java OOPs Miscellaneous
Java Array
Java String
Java Exception Handling
Java Multithreading
Java Synchronization
Java Applet
Java 8 Features
Java 9 Features
Java Collection
Java Mcq
Java Interview Question
Tools
  

Useful Links

  • Home
  • Blog
  • About us
  • Contact Us
  • Privacy policy

Contact Us

Police Colony
Patna, Bihar
India

Email:

About DockerTpoint


India's largest site for Programming Tutorial as well as BANK, SSC, RAILWAY exam
and Campus placement preparation.