On Tue, Sep 15, 2009 at 1:38 AM, Adrian Chadd <adr...@squid-cache.org> wrote: > 2009/9/15 Sachin Malave <sachinmal...@gmail.com>: >> On Tue, Sep 15, 2009 at 1:18 AM, Adrian Chadd <adr...@squid-cache.org> wrote: >>> Guys, >>> >>> Please look at what other multi-CPU network applications do, how they >>> work and don't work well, before continuing this kind of discussion. >>> >>> Everything that has been discussed has already been done to death >>> elsewhere. Please don't re-invent the wheel, badly. > >> Yes synchronization is always expensive . So we must target only those >> areas where shared data is updated infrequently. Also if we are making >> thread then the amount of work done must be more as compared to >> overheads required in thread creation, synchronization & scheduling. > > Current generation CPUs are a lot, lot better at the thread-style sync > primitives than older CPUs. > > There's other things to think about, such as lockless queues, > transactional memory hackery, atomic instructions in general, etc, > etc, which depend entirely upon the type of hardware being targetted. > >> If we try to provide locks to existing data structures then >> synchronization factor will definitely affect to our design. > >> Redesigning of such structures and there behavior is time consuming >> and may change whole design of the Squid. > > > Adrian >
And current generation libraries are also far better than older, like OpenMP, creating threads and handling synchronization issues in OpenMP is very easy... Automatic locks are provided, u need not to design your own locking mechanisms........ Just a statement and u can lock the shared variable... Then the major work remains is to identify the shared access..... I WANT TO USE OPENMP library............. ANY suggestions.....