Find the answer to your Linux question:
Results 1 to 2 of 2
I'm going to writing multi-thread/multi-process program. One thread read data from serial port. One thread, send this data to server. And main thread will initialize and monitor these two threads. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    1

    what is better pthread() or exec()?


    I'm going to writing multi-thread/multi-process program. One thread read data from serial port. One thread, send this data to server. And main thread will initialize and monitor these two threads. But I consider to use pthread() or exec() to for my multi-thread/multi-process program.
    Can anyone give me some comments? Should I use pthread() or exec()? What is advantage and disadvantage of pthread() and exec().
    Thanks in advance.
    Last edited by asnl1987; 12-14-2011 at 02:58 AM.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    This sounds a bit like a homework question, which are not allowed on this forum.

    Multithreaded and multi-process applications work quite differently. In this case, it sounds like a key part of your application is sharing data between the reader part and the sender part. Although there are methods of doing inter-process communication (IPC), sharing data within a single process is generally simpler and more efficient.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •