0

Is there a simple way in the C language, using POSIX threads, to send all the file output of a program (e.g. fprintf...) to a cpu core other than the one that is executing the code? I mean in such a way that the code keeps on flowing and does not need to wait for the file to have been written to continue.

My program does numerical integration and at every step of integration writes data to a file.

Thank you.

Duck
  • 26,924
  • 5
  • 64
  • 92
Janus Gowda
  • 295
  • 1
  • 4
  • 17
  • 1
    There are many ways, do you have a specific problem? – this Mar 22 '14 at 19:10
  • I would like to see an example of what libraries I have to include, and what is the command to send the output to another core. I'm very new in multihreading – Janus Gowda Mar 22 '14 at 19:28

1 Answers1

0

You can find the information regarding your question on how to set a particular thread on a particular core from: how to set CPU affinity of a particular pthread?

However setting the 2 thread(writer thread and other thread) on different core does not mean that you does not require to synchronize between these threads. You would have to synchronize between these two threads. By setting 2 threads on different core may give you the better througput(but it depends on many other factor).

Community
  • 1
  • 1
Mantosh Kumar
  • 5,659
  • 3
  • 24
  • 48