Mo7amed_Alaa's blog

By Mo7amed_Alaa, history, 7 weeks ago, In English

alsalam ealaykum: can i use the concepts of parallel programming on competitive programming without any issues occurs?

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

»
7 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

if you don't know about Parallel Programming,this blog will help you (https://www.perforce.com/blog/qac/multithreading-parallel-programming-c-cpp)

  • »
    »
    7 weeks ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    You can, but it will be totally useless if the number of cores (on the CPU that your code will finally be tested on) is 1, primarily because most of the solutions end up being CPU-bound processes rather than being IO-bound.

    Even if the CPU has multiple cores (which is quite probable, single-core CPUs are outdated now), you'll have to take care of lot of things like atomicity while updating shared data-structures, chunking your process to multiple independent tasks to achieve more juice out of all the cores, etc. You can get quite a bit of optimization, but it would also incur cost of managing multiple threads, etc. And it probably goes without saying, it's not that easy and an overkill for the kind-of solutions that are generally intended.

    EDIT: Also understanding of how exactly all the compilation requests sent of CF are handled and scheduled by their servers would be helpful. If you aren't really the one managing the infrastructure on which your code runs, it's generally a bad idea to try these things out (IMHO)