exec with threads

This is a discussion on exec with threads within the Linux Programming forums, part of the Platform Specific Boards category; How do the different types of exec work? Do the parent and child threads need to be compiled separately?...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    241

    exec with threads

    How do the different types of exec work? Do the parent and child threads need to be compiled separately?

  2. #2
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    ?? not sure what you mean by that. What are you trying to do?

    there are many varieties of exec_ function, each does something a bit differently. man exec for all the options or look here: http://linux.about.com/library/cmd/blcmdl3_execvp.htm

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  3. #3
    .
    Join Date
    Nov 2003
    Posts
    307
    fork() .. exec..() calls create child processes running separate code streams. Threads are different from processes.

    try man pthread

  4. #4
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    >>Threads are different from processes.<<

    hehe, then why do they appear in 'ps' As I'm getting more into OS design, I've noticed that thread implementation in Linux has many shortcomings - with many issues still not being addressed in the newest kernels.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    Just curious what shortcomings are you refering to.
    Are you speaking of posix threads.

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    241
    what I was needing to do was have a parent process that created n child processes. the parent sends data to the child by a pipe represented by a int in[n][2]. and each child will output to a single pipe sending data back to the parent. I have no idea how to implement this, I have looked all over, and I can't find anything that works for this. please help me out if you can.

  7. #7
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    >>Just curious what shortcomings are you refering to.
    Are you speaking of posix threads.<<

    No, I'm talking about threads in general. If you look at the documentations of Kernels as they are "improved " over time, threads are the one thing that always need more and more improvement. When 2.6 came out, the documentation stated "Improved simultenous multithreading; better performance on CPus with hyperthreading support". Other issues I've read about: threads acting/appearing as processes, poor implementation of the three main kinds of threads, etc etc.

    I had a good link about it all but can't find it now maybe its on my school account

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  8. #8
    Registered User
    Join Date
    Nov 2001
    Posts
    241
    Can anyone help me?

  9. #9
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    Do you have anything to work from? anything you tried? show some code.

    This shouldn't be that difficult since you could use an array of pipes.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  10. #10
    .
    Join Date
    Nov 2003
    Posts
    307
    Axon - Linux threads aren't really POSIX compliant - I don't know for sure but I think some newer versions of some distros have it right.

    Early Linux used processes that pretended they were threads. A process is a container for threads.

  11. #11
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    Actually, gnu's new libc incorporates native posix thread library (NPTL) which is a lot better than in previous linuxs. Look here for more infor http://people.redhat.com/drepper/nptl-design.pdf
    LInux is getting better with threads, but I agree they need work.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  12. #12
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    Korn1699, correct me if I'm wrong, but you want to create n child processes that communicate (IPC) via pipes.

    You can do this using fork and using dup2 function to copy file descriptors (pipe ends) between paraent and child. Then use these file descriptors to communicate between the two.

    There's plently on IPC using this methods on the Net - try google:

    http://www.google.co.uk/search?hl=en...fork+ipc&meta=

    rotis23

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-17-2008, 11:28 AM
  2. Yet another n00b in pthreads ...
    By dimis in forum C++ Programming
    Replies: 14
    Last Post: 04-07-2008, 12:43 AM
  3. Classes and Threads
    By Halloko in forum Windows Programming
    Replies: 9
    Last Post: 10-23-2005, 05:27 AM
  4. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 02:39 PM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 03:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21