what is multi thread in java?

krishbcs

krishbcs

@krishbcs-5tG26c Oct 22, 2024
I want to know what is multi thread in java? I am a computer science engineer. I want to know about it in detail and not just the technical definition. Please explain.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Anoop Kumar

    Anoop Kumar

    @anoop-kumar-GDGRCn Feb 22, 2012

    running a more than one segment of a program cuncurrently. basically to use computing resources efficiently .

    Why:
    you have a program to count 10 sec and read a file and then showing the containt of the file.
    Now you have two option.

    1.single thread program: count 1-10 sec -->then read file (taking 5 sec to read) -->then show result (taking 2 sec to show out put):
    how much time consumed: >(10+5+2) ~ 17 sec

    2.Multithreaded: count 1-10 sec and simultaneously read file (taking 5 sec to read) --->then show result (taking 2 sec to show out put):
    How much time consumed: >10 sec+2 sec ~ 12sec.




  • vinci

    vinci

    @vinci-e4PtMU Feb 22, 2012

    executing two or more threads concurrently is known as multi threading
  • krishbcs

    krishbcs

    @krishbcs-5tG26c Feb 23, 2012

    thanks