Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Parallel processing?  (Read 1218 times)

0 Members and 1 Guest are viewing this topic.

tom64

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Parallel processing?
« on: March 27, 2013, 06:26:31 am »
Does anyone know of an easy way to get the computer to do something like: 4 completely separate tasks (assuming you have 4 cores), for each core?

i.e.

core_1( *task_1() )
core_2( *task_2() )
core_3( *task_3() )
core_4( *task_4() )

I know with parallel processing there are usually problems like collisions, but what if you give the different cores completely separate tasks with separate memory that won't collide?

Sincerely,
Tom
« Last Edit: March 27, 2013, 06:28:10 am by tom64 »
Newbie to C++ and SFML

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Parallel processing?
« Reply #1 on: March 27, 2013, 08:13:26 am »
If each task is completely separated from each other, then just run each one in a its own thread. If you want to make sure that each thread runs on a separate core, you can heack a little with OS functions, but that shouldn't be necessary, the OS is supposed to dispatch threads optimally.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Parallel processing?
« Reply #2 on: March 27, 2013, 08:24:56 am »
sf::Thread or std::thread. ;)

Keep in mind though that parallel programming is not at all a trivial task, but if things are  completely separated, then there shouldn't be many problems.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything