(1) The biggest hurdle is speed: The interpreted Java is about 20 times times slower than C's execution speed. No matter what, the Java language cannot be prevented from compiling. When writing this book, there have just been some quasi-real-time
In the collection type of C #, there are synchronized static methods, and SyncRoot instance methodsFor ArrayList and Hashtable collection classes, when thread safety is required, it is best to take advantage of its own property syncroot, although it
Java locks are divided into object locks and class locks.1. When two concurrent threads access the same object in the synchronized (this) synchronization code block, only one thread can be executed for that object within a single time. The other
HashTable write operation time, lock full table source code: Publicsynchronized v put (K key, V value) {//Make sure the value was not nullif (value = = null) {throw new NullPointerException (); } //makes sure the key is not already in the Hashtable.
Thread State1. New state: A new Thread object was created.2. Ready state (Runnable): After the thread object is created, other threads call the object's start () method. The thread in this state is in the "Running thread pool" and becomes
We know that there are two types of synchronized: The synchronization method (synchronized) and the synchronous statement block (synchronized block). So what are the differences and the pros and cons of these two?Synchronizedmethod:Advantages:
1. What is a JVM and how it works2, the difference between equal and = = in Java3. Differences between interfaces and abstract classes in Java4. The difference between private, protected, public and default5. Is string the most basic data type?The
Threads under certain conditions, the state will change. There are several states for a thread:1. New state: A new Thread object was created.2. Ready state (Runnable): After the thread object is created, other threads call the object's start ()
20165318 2017-2018-2 "Java Programming" Eighth Week study summaryDirectory
Problems encountered in learning process and summary
Summary of learning contents of textbook
The 12th Chapter Java multithreading mechanism
One, what is singlethreadexecution mode?Only one thread can perform processing at the same timeTwo, examples1. Unsafe conditionsThe program simulates three of people frequently passing through a door that only allows one person to pass through. When
Wait () and notify () are directly subordinate to the object class, which means that all objects have this pair of methods. At first glance this is incredible, but in fact it is natural, because this pair of methods is blocked to release the
Summary
The most valuable debugging tools are thread-centric. Most Java errors are related to thread interaction. Multithreaded debugging enables developers to view the execution of each thread running in an application.
SUN Laura Bennett
1 lock is an interface, while synchronized is the key word in Java, synchronized is the built-in language implementation;
2) synchronized in the event of an exception, will automatically release the thread-occupied locks, so that the deadlock does
First, the basic concept of multithreadingExclusive: Maintains state consistency by blocking harmful interference between multiple concurrent behaviors. Asynchronous methods are usually used sychronizedState dependency: Triggering, blocking,
Program | Programmers first, talk about final, finally, finalize the difference.
Second, Anonymous Inner class (anonymous inner Class) can extends (inherit) other classes, can implements (implement) interface (interface)?
Third, Static Nested class
Program | Programmers first, talk about final, finally, finalize the difference.
Second, Anonymous Inner class (anonymous inner Class) can extends (inherit) other classes, can implements (implement) interface (interface)?
Third, Static Nested class
1 threads in several ways to explainThread.Sleep (long milliseconds)Sleeps the current thread for a specified amount of time, gives control to another thread, and the dormant thread still owns the lock it occupies.Thread.yield ();Pauses or discards
In the collection type of C #, there are synchronized static methods, and SyncRoot instance methodsFor ArrayList and Hashtable collection classes, when thread safety is required, it is best to take advantage of its own property syncroot, although it
Context:About thread always read the forget, see forget. Let's write it down. Translation is the Orcale official website of the lock explaining the document addressLock:The synchronization mechanism revolves around the internal entity, intrinsic
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.