Misunderstanding the difference between single-threading and multi-threading programming

前端 未结 6 1417
梦毁少年i
梦毁少年i 2021-01-31 16:12

I have a misunderstanding of the difference between single-threading and multi-threading programming, so I want an answer to the following question to make everything clear.

6条回答
  •  故里飘歌
    2021-01-31 16:27

    The main difference between single thread and multi thread in Java is that single thread executes tasks of a process while in multi-thread, multiple threads execute the tasks of a process.

    A process is a program in execution. Process creation is a resource consuming task. Therefore, it is possible to divide a process into multiple units called threads. A thread is a lightweight process. It is possible to divide a single process into multiple threads and assign tasks to them. When there is one thread in a process, it is called a single threaded application. When there are multiple threads in a process, it is called a multi-threaded application.

提交回复
热议问题