当前位置:网站首页>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
边栏推荐
- centos php7.3安装redis扩展
- How to plan well?
- 这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意
- Practice of enterprise ab/testing platform
- VMware virtual machine C disk expansion
- Liang Ning: 30 lectures on brain map notes for growth thinking
- How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?
- (翻译)异步编程:Async/Await在ASP.NET中的介绍
- How to specify the execution order for multiple global exception handling classes
- Pits encountered in the use of El checkbox group
猜你喜欢

POI excel percentage
![[classes and objects] explain classes and objects in simple terms](/img/41/250457530880dfe3728432c2ccd50b.png)
[classes and objects] explain classes and objects in simple terms

Flask Foundation

golang操作redis:写入、读取hash类型数据

MySQL installation

Ruoyi interface permission verification

JMeter JSON extractor extracts two parameters at the same time

Summary of UI module design and practical application of agent mode

(翻译)异步编程:Async/Await在ASP.NET中的介绍
![[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones](/img/d0/850e095a43610366d6144b2471f3f7.jpg)
[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones
随机推荐
Basic teaching of crawler code
How does the insurance company check hypertension?
Software testing learning - the next day
php artisan
Stream stream
The education of a value investor
Ruoyi interface permission verification
MySQL mistakenly deleted the root account and failed to log in
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
IC_ EDA_ All virtual machine (rich Edition): questasim, vivado, VCs, Verdi, DC, Pt, spyglass, icc2, synthesize, innovative, ic617, mmsim, process library
Software testing assignment - the next day
Operation principle of lua on C: Foundation
Sorting out the core ideas of the pyramid principle
Crontab scheduled task
Inno setup production and installation package
[attribute comparison] defer and async
PHP install composer
Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record
深度学习参数初始化(一)Xavier初始化 含代码
Pytest -- write and manage test cases