##
### ( : ; : /)
+ :
+ **** :
+ **** :
+ :
+ python
+ cpu
+
###
+ **** :
+ **** : ,
+ :
### ( : 1 : N)
+ ****
+ ************
+
+
+
+
+ ****
+ ****
+ ******************
+
+
+ I/O
+ ****
+ ,
+
+ ,
+
+ . .
+ . .
###
+ threading `import threading`
```python
import threading
# threading.Thread(target=)
threading.Thread(self, group=None, target=, name=,
args=(), kwargs=None, *, daemon=None)
```
1. ( args=() ) `threading.Thread(target=, args=())`
2. **join()** : ,
3. **setDaemon()** : () `.setDaemon(True)`
+
+ eg: QQ
4.
+ **getName()** :
+ **setName()** :
+ **is_alive()** : ( isAlive() )
5. threading
+ **threading.currentThread() threading.current_thread()** :
+ **threading.enumerate()** : list (: , )
+ **threading.activeCount()** threading.active_count() : , len(threading.enumerate())
+ ( threading.Thread run() )
```python
import threading
import time
class MyThread(threading.Thread):
def __init__(self, num):
super(MyThread, self).__init__()
self.num = num
def run(self):
for i in range(self.num):
print(f"---run\t{i}---")
if __name__ == "__main__":
my_thread = MyThread(3)
my_thread.run()
```
+
+ ""
+