Is it wise to access read-only data from multiple threads simultaneously?

后端 未结 4 530
小鲜肉
小鲜肉 2020-12-20 11:41

I have an application that I\'m trying to make multithreaded. Each thread will access a large chunk of read-only data.

Is is okay if multiple threads access the data

相关标签:
4条回答
  • 2020-12-20 12:02

    If the data is truly read-only for the duration of the multi-threaded access, then no synchronization is necessary.

    0 讨论(0)
  • 2020-12-20 12:10

    Yes, that's fine.

    You shouldn't have any problem.

    0 讨论(0)
  • 2020-12-20 12:18

    If the data is read-only for the lifetime of all the threads that read it, then yes, it's perfectly fine to read without synchronization.

    0 讨论(0)
  • 2020-12-20 12:18

    If the data is fixed before any of the reading threads start, then yes, it's OK.

    0 讨论(0)
提交回复
热议问题