pthread线程培训提纲

 

=================================线程培训===============================

线程故事

cocurrent process、pthread、POISX

线程设计模式

boss\work

Peer

Pipe Line

what time need thread?

It is independent of other tasks

It can become blocked in potentially long waits

It can use a lot of CPU cycles

It must respond to asynchronous events

Its work has greater or lesser importance than other work in the application

确认并行比串行快,I/O requests

 

场景分析:我(CPU)打算使用辣椒、藕片、土豆(输入)做个两个菜:抄藕片、香辣土豆丝(输出)

 

Buffering Data Between Threads

A buffer

A lock

A suspend/resume mechanism

State information

rule:

Obtain a lock before accessing the resource

Release the lock when you are finished with the resource

 

线程同步

pthread_join function

Mutex variable functions

Condition variable functions

pthread_once function

Reader/writer exclusion

Threadsafe data structures

Semaphores

 

线程管理

Thread attributes

The pthread_once mechanism

Scheduling

Mutex scheduling attributes

 

线程调度

 

总结

IO、CPU、MEM

atomic、voliate、sleep(0)

多进程

SMB

你可能感兴趣的:(pthread)