Thread: IPC thread question

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    13

    IPC thread question

    i'm currently doing sample questions to practice for my exam, and one of the questions about IPC(Inter process communication) stated that processes need to communicate to:
    1. pass some information
    2. so as to not interfere with on another when accessing shared resources
    3. to ensure proper sequencing of dependent activities
    the question asks the last two relates to threads, why not the first one?

    I've looked through my lecture notes but couldn't find an answer, can anyone please help?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Because threads and processes run independently and cannot directly pass information between themselves.
    The hint is in #2... shared resources.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Izzy123 View Post
    the question asks the last two relates to threads, why not the first one?
    Because threads are not independent processes. They do not need to pass any information between themselves -- their information namespace is already shared globally, the same way it is in a normal, single threaded program. So #1 is not an issue.

    However, because they run concurrently, how they access global information and resources is an issue, and one solution is to use a sort of IPC, such as semaphores. This isn't really "inter-process" communication, but it functions identically (since semaphores can be used for real IPC).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about Thread Posts...
    By Ocin101 in forum C Programming
    Replies: 7
    Last Post: 07-21-2009, 02:17 AM
  2. Question on thread
    By flexo87 in forum C Programming
    Replies: 10
    Last Post: 01-28-2009, 10:52 AM
  3. question about thread
    By wgan in forum Windows Programming
    Replies: 6
    Last Post: 06-30-2003, 12:36 PM
  4. General Thread question
    By Magos in forum Windows Programming
    Replies: 3
    Last Post: 09-13-2002, 12:49 PM
  5. General Thread question
    By Magos in forum Windows Programming
    Replies: 2
    Last Post: 09-11-2002, 12:32 PM