当前位置:网站首页>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
边栏推荐
- Laravel Web Framework
- 2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)
- 每日刷題記錄 (十一)
- Unit test framework + Test Suite
- My 2020 summary "don't love the past, indulge in moving forward"
- La loi des 10 000 heures ne fait pas de vous un maître de programmation, mais au moins un bon point de départ
- 深度学习参数初始化(一)Xavier初始化 含代码
- Simple understanding of bubble sorting
- Search engine Bing Bing advanced search skills
- C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
猜你喜欢

Pytest -- write and manage test cases

Sorting out the core ideas of the pyramid principle

Dbnet: real time scene text detection with differentiable binarization

HMS core helps baby bus show high-quality children's digital content to global developers

Summary of UI module design and practical application of agent mode

MySQL installation

These two mosquito repellent ingredients are harmful to babies. Families with babies should pay attention to choosing mosquito repellent products

这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意
![[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)*

Win 10 find the port and close the port
随机推荐
Thoughts in Starbucks
Flask Foundation
JUC forkjoinpool branch merge framework - work theft
[LeetCode]404. Sum of left leaves
修改MySQL密码
Journal quotidien des questions (11)
Application scenarios of Catalan number
[untitled]
crontab定时任务
Personally design a highly concurrent seckill system
error C2017: 非法的转义序列
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
Understand software testing
Unittest attempt
Dbnet: real time scene text detection with differentiable binarization
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
UTC时间、GMT时间、CST时间
Redis command
Liang Ning: 30 lectures on brain map notes for growth thinking
Software testing assignment - day 1