Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 2)

javathread.jpeg

Evaluation Criteria for Multithreaded Programs

safety

** 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

** 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

** 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

** 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.

Summary of evaluation criteria

It is essential to protect safety and survivability. After satisfying this, how to improve reusability and performance is important.

Java thread priority

Java priority is useless without specifying the execution system

--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.

Class field representing priority

Method to set / get priority

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

Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 10)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 9)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 6)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 4)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 5)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 2)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 1)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 11)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 12)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 8)
[Java] Summary of design patterns
Summary of Java language basics
A quick review of Java learned in class part3
A quick review of Java learned in class part2
I read Hiroshi Yuki "Introduction to Design Patterns Learned in Java Language" (SB Creative)
Java Design Patterns
What I learned in Java (Part 2) What are variables?
A quick review of Java learned in class
Summary of what I learned in Spring Batch
Try design patterns in C language! Memento pattern-Let's memorize the memories of the data
[Java] Basic summary of Java not covered by Progate ~ Part 1 ~
What I learned in Java (Part 3) Instruction execution statement
Summary of how to implement default arguments in Java
Summary of Java support 2018
Java design pattern summary
What I learned in Java (Part 4) Conditional branching and repetition
[Java] Basic summary of Java not covered by Progate ~ Part 2 ยท List ~
Road to Java Engineer Part2 What kind of language is Java?
Read design patterns in Ruby
[Java11] Stream Summary -Advantages of Stream-
[Java] Summary of regular expressions
[Java] Summary of for statements
Summary of Java Math class
Implementation of gzip in java
[Java] Summary of control syntax
Implementation of tri-tree in Java
Summary of java error processing
[Java] Summary of mathematical operations
What I have learned in Java (Part 1) Java development flow and overview
Summary of ORM "uroboroSQL" that can be used in enterprise Java
Summary of [Java silver study] package
Basic usage of java Optional Part 1
thread safe process in java language
AtCoder 400 points algorithm summary (Java edition)
List of members added in Java 9
Creating lexical analysis in Java 8 (Part 2)
List of types added in Java 9
Summary of object-oriented programming using Java
Implementation of like function in Java
Creating lexical analysis in Java 8 (Part 1)