** Safety ** means not destroying an object. Breaking often corresponds to an object's field taking an unexpected value. For example, if your bank account has a negative deposit balance, this means that the object that represents your bank account has been corrupted. A class that is safe even when used by multiple threads is called a ** thread-safe ** class.
** Survivability ** means that the necessary processing must be performed. Safety and survivability can be conflicting requirements. A typical example is ** deadlock **. This is a situation where multiple threads wait for each other to unlock each other.
** Reusability ** means that a class can be reused. In multi-thread programming, if the mechanism and policy of exclusive control of threads are well hidden in the class, it becomes a highly reusable program.
** Performance ** means that processing can be performed at high speed and in large quantities. ** Throughput ** is the number of processes per unit time. ** Responsiveness ** is the time from when a request is made until a response is returned. High responsiveness is sometimes called short latency **. ** Capacity ** is the number that can be processed at the same time.
It is essential to protect safety and survivability. After satisfying this, how to improve reusability and performance is important.
--There is almost nothing specified in common with all Java execution processing systems. --Therefore, the priority is useless unless the execution processing system (JVM implementation, version, OS) is specified. --In some execution systems, a thread with a higher priority may allocate more CPU time than a thread with a lower priority, and a thread with a higher priority may use all the CPU time. --The thread scheduling algorithm is also not specified.
Instance method of Thread class Set priority with setPriority Get priority with getPriority
Relation Summary of "Design Patterns Learned in Java Language (Multithreaded Edition)" (Part 1)
Recommended Posts