O que é um segmento de usuário e um segmento do kernel?

12

Eu sei o que é um thread e sei como funcionam, mas estou bastante confuso sobre o que um thread de usuário e um thread do kernel estão em termos do que eles estão autorizados a fazer.

Você pode, por favor, esclarecer o que um thread de usuário pode fazer e o que um thread do kernel pode fazer?

    
por Fasih Khatib 30.07.2012 / 14:20

1 resposta

12

A kernel thread, sometimes called a LWP (Lightweight Process) is created and scheduled by the kernel. Kernel threads are often more expensive to create than user threads and the system calls to directly create kernel threads are very platform specific.

A user thread is normally created by a threading library and scheduling is managed by the threading library itself (Which runs in user mode). All user threads belong to process that created them. The advantage of user threads is that they are portable. The major difference can be seen when using multiprocessor systems, user threads completely managed by the threading library can't be ran in parallel on the different CPUs, although this means they will run fine on uniprocessor systems. Since kernel threads use the kernel scheduler, different kernel threads can run on different CPUs. Many systems implement threading differently,

A many-to-one threading model maps many user processes directly to one kernel thread, the kernel thread can be thought of as the main process. A one-to-one threading model maps each user thread directly to one kernel thread, this model allows parallel processing on the multiprocessor systems. Each kernel thread can be thought of as a VP (Virtual Process) which is managed by the scheduler.

Fonte: Respostas

Você também pode encontrar informações no capítulo 3 - 3 da wikipedia Processos, tópicos do kernel, tópicos do usuário e fibras:

Thread

    
por 30.07.2012 / 14:27