当前位置:网站首页>Advanced API (multithreading)
Advanced API (multithreading)
2022-07-03 07:01:00 【Bugxiu_ fu】
Not all programming languages support multithreading
Multithreading is actually equivalent to a robot ( Automatically handle things )
A few key words
1. multitasking
Self righteous to deal with multiple things at the same time
2. Program
Still , Example ---QQ installation is complete
3. process
Dynamic , When the program is opened by double clicking , The process will appear .
4. Threads
A thread is an execution unit path in a process .( The process of doing something )
summary :
A program has one or more processes
A process has at least one thread or multiple threads .
Program closed --- The process will shut down
Thread shutdown --- The process will not shut down
1. One Java The program has at least 2 Threads Customize
(1) The main thread --- effect --- Perform the operation
(2)gc Threads --- effect --- Recycling waste
The core of multithreading : Automatically complete things .
Multithreading comes from lang package
Multithreaded objects :Thread
stay Java There are ways to implement multithreading in the program 2 Kind of
1. Inherit Thread
rewrite run Method
Custom thread inheritance Thread after , If you want to implement some operations -- Must be in the run Method to perform these so-called operations .
2. Realization Runnable Interface
Custom class implementation Runnable Interface must override all abstract methods in the interface
implements Runnable{
@Override
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println(i+"---- Custom thread "+Thread.currentThread().getName());
}
}
matters needing attention : If the thread is implemented Runnable Interface To open, you must use Thread Class call start.
MyF mf = new MyF();
Thread t = new Thread(mf);
t.setPriority(10);// Priority
t.start();// Start the custom thread manually
边栏推荐
- Setting up the development environment of dataworks custom function
- 2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)
- 修改MySQL密码
- [LeetCode]404. 左叶子之和
- 机械观和系统观的科学思维方式各有什么特点和作用
- Integration test practice (1) theoretical basis
- golang操作redis:写入、读取hash类型数据
- Summary of UI module design and practical application of agent mode
- How does the insurance company check hypertension?
- Error c2017: illegal escape sequence
猜你喜欢

机器学习 | 简单但是能提升模型效果的特征标准化方法(RobustScaler、MinMaxScaler、StandardScaler 比较和解析)

Integration test practice (1) theoretical basis

Win 10 find the port and close the port

Golang operation redis: write and read kV data

VMware virtual machine C disk expansion

JMeter test result output

10000小时定律不会让你成为编程大师,但至少是个好的起点

Summary of UI module design and practical application of agent mode
![[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*](/img/1f/f579110a408c5b5a094733be57ed90.jpg)
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*

Application scenarios of Catalan number
随机推荐
[LeetCode]404. Sum of left leaves
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
Sorting out the core ideas of the pyramid principle
Reading notes of "learn to ask questions"
Winter vacation work of software engineering practice
利用C#实现Pdf转图片
MySQL mistakenly deleted the root account and failed to log in
Hands on redis master-slave replication, sentinel master-slave switching, cluster sharding
万卷书 - 价值投资者指南 [The Education of a Value Investor]
Pytest attempts to execute the test case without skipping, but the case shows that it is all skipped
机器学习 | 简单但是能提升模型效果的特征标准化方法(RobustScaler、MinMaxScaler、StandardScaler 比较和解析)
[Code] occasionally take values, judge blanks, look up tables, verify, etc
Thoughts in Starbucks
Software testing learning - day one
Class and object summary
每日刷題記錄 (十一)
Resthighlevelclient gets the mapping of an index
instanceof
[set theory] partition (partition | partition example | partition and equivalence relationship)
crontab定时任务