当前位置:网站首页>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
边栏推荐
- RestHighLevelClient获取某个索引的mapping
- Software testing assignment - day 1
- Asynchronous programming: async/await in asp Net
- [day15] introduce the features, advantages and disadvantages of promise, and how to implement it internally. Implement promise by hand
- php artisan
- 10000小时定律不会让你成为编程大师,但至少是个好的起点
- Tool class static method calls @autowired injected service
- Stream stream
- 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
- MySQL transaction rollback, error points record
猜你喜欢

POI excel percentage

这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意

golang操作redis:写入、读取kv数据

多个全局异常处理类,怎么规定执行顺序

Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record

每日刷題記錄 (十一)

New knowledge! The virtual machine network card causes your DNS resolution to slow down

EasyExcel

Notes on the core knowledge of Domain Driven Design DDD

【无标题】
随机推荐
2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)
HMS core helps baby bus show high-quality children's digital content to global developers
(翻译)异步编程:Async/Await在ASP.NET中的介绍
crontab定时任务
萬卷書 - 價值投資者指南 [The Education of a Value Investor]
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
MySQL mistakenly deleted the root account and failed to log in
What are the characteristics and functions of the scientific thinking mode of mechanical view and system view
[untitled]
The dynamic analysis and calculation of expressions are really delicious for flee
爬虫代码基础教学
Machine learning | simple but feature standardization methods that can improve the effect of the model (comparison and analysis of robustscaler, minmaxscaler, standardscaler)
[LeetCode]404. Sum of left leaves
Summary of UI module design and practical application of agent mode
[Code] if (list! = null & list. Size() > 0) optimization, set empty judgment implementation method
How to migrate or replicate VMware virtual machine systems
Reading notes of "learn to ask questions"
Crontab scheduled task
Simple understanding of bubble sorting
熊市里的大机构压力倍增,灰度、Tether、微策略等巨鲸会不会成为'巨雷'?