April 26 Summary

joinableQueue()

The q.join() producer gets the total number of queues after the production is completed, and the line of code q.join() does not run until the element becomes 0.

Once q.join() finishes, it means that the queue is indeed emptied

 

A thread refers to a pipelined work process. A process is actually a resource unit. A process comes with a thread, and a thread is the execution unit.

Threads in the same process share the process resources, and the overhead of creating a thread is much smaller than creating a process

 current_thread is also a class, the attribute name is the name of the current thread, active-count is the active thread, and the extension is added to run

Deadlock phenomenon: metuxA=metuxB=Rlock() recursive lock, which can be acquired continuously (the reference count is incremented by one, until 0 others can grab it

Semaphore Semaphore sm=Semaphore(5) means 5 locks.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324888459&siteId=291194637