What is multithreading? What is a lock? What is the amount of information? and their usefulness.

Source: Internet
Author: User

    1. Thread Concept:
    • Each program that is running on the system is a process. Each process contains one or more threads. A process can also be a dynamic execution of an entire program or part of a program. A thread is a set of instructions, or a special section of a program that can be executed independently in a program. It can also be understood as the context in which the code runs. So a thread is basically a lightweight process that is responsible for multitasking in a single program. Typically, the operating system is responsible for scheduling and executing multiple threads.
    • A thread is a single sequential control flow in a program. Running multiple threads at the same time in a single program accomplishes different tasks, called multithreading.
    • The difference between a thread and a process is that the child process and the parent process have different code and data spaces, while multiple threads share the data space, and each thread has its own execution stack and program counter for its execution context. Multithreading is mainly to save CPU time, play use, depending on the situation. The running of a thread requires the use of the computer's memory resources and CPU.
    1. The concept of multithreading
    • Multithreading refers to the technique of implementing concurrent execution of multiple threads from software or hardware.
    • Multithreading is to accomplish many tasks synchronously, not to improve the efficiency of the operation, but to improve the efficiency of the use of resources to improve the efficiency of the system. Threads are implemented at the same time when multiple tasks need to be completed.
    • The simplest analogy is that multithreading is like every carriage of a train, while a process is a train. It is impossible to run without a train, and the train cannot have only one compartment. The advent of multithreading is to improve efficiency.

What is multithreading? What is a lock? What is the amount of information? and their usefulness

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.