All of lore.kernel.org
 help / color / mirror / Atom feed
* How to using add/lookup hash table in multithread environment
@ 2017-05-05  2:51 vuonglv
  2017-05-09 16:48 ` Dumitrescu, Cristian
  2017-05-09 16:49 ` Dumitrescu, Cristian
  0 siblings, 2 replies; 3+ messages in thread
From: vuonglv @ 2017-05-05  2:51 UTC (permalink / raw)
  To: dev

Hi DPDK team,
I am using DPDK to build a program in multithread environment.
I use 1 thread (on 1 core) to add and delete hash table key ( by 
rte_hash_add_key() and rte_hash_del_key() function); And use 8 thread 
(on 8 others core) to lookup (by rte_hash_lookup() function ).
As I know, rte_hash_lookup() function is /multi-thread safe,/ and 
te_hash_add_key() and rte_hash_del_key() function is not /multi-thread 
safe/.
So: Do I need using /lock/ when I add or delete key by 1 thread while 8 
others thread is looking-up?


Many thanks,
Vuong Le

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to using add/lookup hash table in multithread environment
  2017-05-05  2:51 How to using add/lookup hash table in multithread environment vuonglv
@ 2017-05-09 16:48 ` Dumitrescu, Cristian
  2017-05-09 16:49 ` Dumitrescu, Cristian
  1 sibling, 0 replies; 3+ messages in thread
From: Dumitrescu, Cristian @ 2017-05-09 16:48 UTC (permalink / raw)
  To: vuonglv, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> vuonglv@viettel.com.vn
> Sent: Friday, May 5, 2017 5:52 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] How to using add/lookup hash table in multithread
> environment
> 
> Hi DPDK team,
> I am using DPDK to build a program in multithread environment.
> I use 1 thread (on 1 core) to add and delete hash table key ( by
> rte_hash_add_key() and rte_hash_del_key() function); And use 8 thread
> (on 8 others core) to lookup (by rte_hash_lookup() function ).
> As I know, rte_hash_lookup() function is /multi-thread safe,/ and
> te_hash_add_key() and rte_hash_del_key() function is not /multi-thread
> safe/.
> So: Do I need using /lock/ when I add or delete key by 1 thread while 8
> others thread is looking-up?
> 
> 

You could use a single thread to do the table add/del (table manager thread); when other threads need to do add/del, have them send a request to the table manager.

> Many thanks,
> Vuong Le

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to using add/lookup hash table in multithread environment
  2017-05-05  2:51 How to using add/lookup hash table in multithread environment vuonglv
  2017-05-09 16:48 ` Dumitrescu, Cristian
@ 2017-05-09 16:49 ` Dumitrescu, Cristian
  1 sibling, 0 replies; 3+ messages in thread
From: Dumitrescu, Cristian @ 2017-05-09 16:49 UTC (permalink / raw)
  To: vuonglv, dev



> -----Original Message-----
> From: Dumitrescu, Cristian
> Sent: Tuesday, May 9, 2017 7:49 PM
> To: 'vuonglv@viettel.com.vn' <vuonglv@viettel.com.vn>; dev@dpdk.org
> Subject: RE: [dpdk-dev] How to using add/lookup hash table in multithread
> environment
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> > vuonglv@viettel.com.vn
> > Sent: Friday, May 5, 2017 5:52 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] How to using add/lookup hash table in multithread
> > environment
> >
> > Hi DPDK team,
> > I am using DPDK to build a program in multithread environment.
> > I use 1 thread (on 1 core) to add and delete hash table key ( by
> > rte_hash_add_key() and rte_hash_del_key() function); And use 8 thread
> > (on 8 others core) to lookup (by rte_hash_lookup() function ).
> > As I know, rte_hash_lookup() function is /multi-thread safe,/ and
> > te_hash_add_key() and rte_hash_del_key() function is not /multi-thread
> > safe/.
> > So: Do I need using /lock/ when I add or delete key by 1 thread while 8
> > others thread is looking-up?
> >
> >
> 
> You could use a single thread to do the table add/del (table manager thread);
> when other threads need to do add/del, have them send a request to the
> table manager.
> 

This doc section might give you more ideas:
http://www.dpdk.org/doc/guides/prog_guide/packet_framework.html#shared-data-structures

> > Many thanks,
> > Vuong Le

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-09 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05  2:51 How to using add/lookup hash table in multithread environment vuonglv
2017-05-09 16:48 ` Dumitrescu, Cristian
2017-05-09 16:49 ` Dumitrescu, Cristian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.