threading

threading

I have intel i3 processor on my laptop. though it has 2 cores it can run 4 threads at a time. When I see task manager I see programs with 11 threads , 40 threads. How are these threads scheduled? is it hardware implemented or managed by the host OS?

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

The operating system, when it has more software threads to run than hardware threads, will run a software thread until the earlier of: time quanta (few ms) or I/O that blocks. At that point it suspends the thread, then chooses a waiting software thread to run on that hardware thread.

A program can have more software threads than hardware threads (usually because they are waiting for something to do).

For compute bound applications it is usually counterproductive to use more software threads than hardware threads and optionally those that would otherwise be idle during run of application. Meaning should your system have two compute bound applications then better performance might be seen, say on your system 2C/4T, to have each app use 1C/2T. This would avoid adverse L1 and L2 cache interactions.

Jim Dempsey

www.quickthreadprogramming.com

You can also add to this explanation thread priorities which are used to prioritize execution and choose the higher priority thread to run before the lower priority thread.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya