Java Foundation Nineth Day Course Summary

Source: Internet
Author: User
  1. Implementing the Runnable Interface

  2. Run method in sub-overlay interface

  3. Thread is created through the thread class and the subclass object that implements the Runnable interface is passed as a parameter to thread

    Constructors for classes

  4. The thread class object calls the Start method to open threads

  5. The thread starts with the Start method

    Causes of security problems

    Multiple threads are now delayed

    Thread Randomness

    The thread safety problem is not easy to appear in the ideal state, but once the impact on the software is very large.

    Synchroized (object)

    {

    }

    Synchronization can solve security problems, it is on the object

    The premise of synchronization is multiple objects, and multiple threads use the same lock, consuming resources, synchronizing the concurrency after the cancellation, synchronization of the code as short as possible, inefficient.

    A synchronous function is a function defined in a class that contains a synchronous object, or a class descriptor if it is static

    The communication between threads is mainly a synchronization problem.

    The problem of producers and consumers.


  6. Any object has the function of the information light. The method called by any object must be defined in object. Waite can add wait until waiting queue, give up the monitoring power of the CPU, be notified by others, continue to seize the right to monitor. Sleep does not give up monitoring power to the CPU.

    Synchronous methods need to add synchnoized

  7. The priority of the thread is 10, and the priority can continue from the main thread


Java Foundation Nineth Day Course Summary

Related Article

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.