201671010128 the concurrency of Java programming in 2017-12-17

Source: Internet
Author: User

First, the basic concept

    1. A program is a static code that is the blueprint for application execution.
    2. A process is a dynamic execution of a program that corresponds to a complete process from code loading to execution to completion.
    3. The operating system allocates a separate memory space and system resources for each process, including: code data and resources such as stacks. The internal data and state of each process are completely independent.
    4. In a multitasking operating system, process switching is expensive for CPU resources.
    5. Multithreading is a number of execution threads that occur during process execution.
    6. A thread is a smaller unit than a process execution.
    7. Threads cannot exist independently and must exist in the process, sharing process space data among the threads of the same process.
    8. Each thread has its own production, existence and extinction process, is a dynamic concept.
    9. Multithreading means that a multi-line statement of a program can appear to run at the same time almost simultaneously.
    10. Thread creation, destruction, and switching loads are much smaller than processes, also known as lightweight processes (lightweight process).

Second, the interruption of the thread

    1. When the thread's Run method executes the last statement in the method body and returns by executing a return statement, or if there is an exception that is not caught in the method, the thread terminates and yields the CPU usage.
    2. Calling the interrupt () method can also terminate the thread. The interrupt () method can break not only the running thread, but also the thread in the blocked state, at which point the interrupt () method throws a Interruptedexception exception.
    3. Java provides several methods for testing whether a thread has been interrupted.

Third, the state of the thread

    1. Through the state transformation of each thread, we can control each thread to take turns using CPU, and embody the parallelism characteristic of multithreading.
    2. There are 6 types of threads in the following states:
    • New (newly created)
    • Runnable (can be run)
    • Blocked (blocked)
    • Waiting (Wait)
    • Timed Waiting (timed Wait)
    • Terminated (terminated)

Four, object-oriented Programming curriculum learning progress bar

Moonphases Number of lines of code (read/write) Post Blog volume/Comment blog number Classroom/after-school time (hours) The most satisfying programming task
First week 20/7 1/1 6/4 Write the Hello World program
Second week 38/20 1/1 6/5 Experiment two task three
Third week 50/30 1/1 6/7 Experiment Three
Week Four 58/46 1/1 6/5 Write the output n digits of the numbers, and sum
Week Five 67/53 1/1 6/6 Classes are defined and overloaded
Week Six 71/60 1/1 6/4 Interface
Eighth Week 80/66 1/1 6/3 LAMDBA-expression
Nineth Week 85/60 1/1 6/2 Operation of the ID
Tenth Week 121/80 1/1 6/2 Experiment Nine
11th Week 120/84 1/1 6/2 Experiment Ten
12th Week 131/90 1/1 6/2 Experiment Xi.
13th Week 130/100 1/1 6/2 Experiment 12
14th Week 120/90 1/1 6/2 Experiment 13
15th Week 124/90 1/1 6/2 Experiment 14
16th Week 130/80 1/1 6/2 Experiment 14
17th Week 130/90 1/ 6/2 Concurrent
......
Cumulative 1545/959 17/16 96/52

201671010128 the concurrency of Java programming in 2017-12-17

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.