Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #503
| From | ittium <ittium@gmail.com> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | (context switch + condition variable+ mutex) Vs Few Mutex |
| Date | 2011-08-11 11:07 +0530 |
| Organization | A noiseless patient Spider |
| Message-ID | <j1vpro$bs8$1@dont-email.me> (permalink) |
Group, I am designing a call processing module that reads the data from some fd and process it. I am analyzing two designs 1. One thread reads the data, apply a hash function on call identifier and find out worker thread id. Pass it to worker thread through a queue synchronized using condition variable. This ensures, All messages of a call are processed by same thread. These threads will have their dedicated data sets. so no locks will be needed during processing. 2. In the second design, threads reads from the fd, get the call context and other data from mutex protected global data strucutres (map with around 1 million entries), and process the data. In #1 there is contex switch and communication overhead since data will go through condition variable/mutex protected queue In #2, each thread will have to lock/unlock 4-5 data structures (map) but there is no context switch. Which scheme is better in terms of performance. thanks Ittium
Back to comp.programming.threads | Previous | Next — Next in thread | Find similar | Unroll thread
(context switch + condition variable+ mutex) Vs Few Mutex ittium <ittium@gmail.com> - 2011-08-11 11:07 +0530 Re: (context switch + condition variable+ mutex) Vs Few Mutex naveen <naveenkumarkaushik@gmail.com> - 2011-08-12 02:48 -0700 Re: (context switch + condition variable+ mutex) Vs Few Mutex David Schwartz <davids@webmaster.com> - 2011-08-20 03:56 -0700
csiph-web