首页 > 代码库 > 多线程

多线程

multithreading,multiprocessing

Block multi-threading:context switching意味着从现有的寄存器集切换到另一套

Interleaved multithreading:similar to preemptive multitasking,more modern,需要更大的cache和TLB

Simutaneous multithreading:

instruction level parallelism:measure of  how many of the operations in a computer program can be performed simultaneously

 

spinlock:repeatedly checking if the lock is available. thread remains active but is not performing a useful task. (busy waiting)

avoid overhead from os process rescheduling or context-switching, efficient if threads are blocked for a short period. wasteful if  held for longer durations.

 

superscalar cpu

 

Monitor(synchronization): important
semaphores

test-and-set

 

 

processes, kernel threads, user threads, fiber(coroutines)

 

inter-process communication

 

 

interrupt:

hardware interrupt:

 

non-blocking algorithm:

wait-freedom:

lock-freedom:

software interrupt: