> -----Original Message-----
> From: users <users-boun...@dpdk.org> On Behalf Of Tom Barbette
> Sent: Thursday, December 5, 2019 10:42 AM
> To: Perugu Hemasai Chandra Prasad <hemasaiper...@5g.iith.ac.in>;
> us...@dpdk.org; dev@dpdk.org
> Subject: Re: [dpdk-users] [dpdk-dev] Sharing Data structure between logical
> cores in DPDK- regarding
> 
> It depends on the datastructure.
> 
> If you use rte_hash, with the thread safety flags, it's safe.
> 
> In any case having a lot of cores accessing the same DS will lead to bad
> performance. You should try to have per-core data structures whenever
> possible.
> 
> Tom
> 
> ________________________________________
> De : dev <dev-boun...@dpdk.org> de la part de Perugu Hemasai Chandra Prasad
> <hemasaiper...@5g.iith.ac.in>
> Envoyé : jeudi 5 décembre 2019 11:16
> À : us...@dpdk.org; dev@dpdk.org
> Objet : [dpdk-dev] Sharing Data structure between logical cores in DPDK-
> regarding
> 
> Hi All,

Hi!

>           I have a small doubt, can we share a data structure between
> multiple logical cores in DPDK without locking?

Note that "locking" and "atomic instructions" are not the same. So locking a 
mutex is only one way of ensuring multiple cores have a coherent view on the 
datastructure.

The other method of doing "lock free" but multi-core safe data-structures is by 
using Atomic instructions, which ensure that results are observed correctly on 
all cores accessing that data-structure. A good example is the Multi-producer 
or Multi-consumer versions of the DPDK rte_ring ringbuffer.

Regards, -Harry

> I have tested it by sharing
> a small structure with two variable and incrementing them in all logical
> cores. It ran smooth I didn't get any issue. But I doubt if we can run it
> for long time with some huge data structure having many elements getting
> accessed by multiple logical cores.
>      Can anyone please clarify this.
> 
> Thanks and regards,
> Hemasai.

Reply via email to