Re: Using Threads?

Поиск
Список
Период
Сортировка
Искать
От
Bruce Guenter
Тема
Re: Using Threads?
Дата
Msg-id
20001205100925.A7398@em.ca
Ответ на
Re: Using Threads? (Tom Samplonius)
Список
Дерево обсуждения
Re: Using Threads? Myron Scott <mscott@sacadia.com>
Re: Using Threads? Karel Zak <zakkr@zf.jcu.cz>
Re: Using Threads Myron Scott <mscott@sacadia.com>
Re: Using Threads Karel Zak <zakkr@zf.jcu.cz>
Re: Using Threads The Hermit Hacker <scrappy@hub.org>
On Mon, Dec 04, 2000 at 08:43:24PM -0800, Tom Samplonius wrote:
>   Some OSes (Linux is the main one) implement threads as pseudo processes.
> Linux threads are processes with a shared address space and file
> descriptor table.
> 
>   Context switch cost for threads can be lower if you are switching to a
> thread in the same process.  That of course assumes that all context
> switches will occur within the same process, or the Linux
> everything-is-a-process model isn't used.

Actually, context switch cost between threads is low on Linux as well,
since the CPU's VM mappings don't get invalidated.  This means that its
page tables won't get reloaded, which is one of the large costs involved
in context switches.  Context switches between processes takes (with no
significant VM) about 900 cycles (1.8us) on a 450MHz Celery.  I would
expect thread switch time to be slightly lower than that, and context
switches between processes with large VMs would be much larger just due
to the cost of reloading the page tables.
-- 
Bruce Guenter                        http://em.ca/~bruceg/
В списке pgsql-hackers по дате отправления
От: Alfred Perlstein
Дата:
От: Tom Lane
Дата:
FAQ