fork() and IPC | Unix Linux Forums | Programming

  Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

fork() and IPC

Programming


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-30-2001
TelePlayer TelePlayer is offline
Registered User
 
Join Date: May 2001
Last Activity: 28 November 2008, 8:53 AM EST
Location: Wharton, NJ
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
fork() and IPC

Hey all. I recently ported a multithreaded program from WinNT to LINUX using pthreads. Everything works fine, except that it turns out the drivers for the hardware I'm working with aren't thread safe. So, now I have to find a way to make this multi-process instead of multi-threaded.

I just started working with fork(), and am having a little trouble following the interprocess communication models. Is there an "easy" way to allow a child process(es) to have access to the global variables in the parent process? This is the way the original programmer did it under NT multithreaded, and I'd rather not rewrite the entire app (it's big).
Sponsored Links
    #2  
Old Unix and Linux 05-30-2001
Neo's Unix or Linux Image
Neo Neo is offline Forum Staff  
Administrator
 
Join Date: Sep 2000
Last Activity: 1 April 2015, 8:43 AM EDT
Location: Asia pacific region
Posts: 13,137
Thanks: 615
Thanked 964 Times in 439 Posts
The primary way to share data between processes using UNIX IPCs are:

(1) Shared memory;

(2) Sockets:

There are other UNIX IPCs including

(3) Message Queues.

(4) Semaphores;

(5) Signals.

Your best best (for IPCs) is to use shared memory segments, based on your post. You might need to use semaphores to insure that the shared memory operations are atomic.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Fork() Peevish Programming 4 01-13-2010 10:23 AM
Fork and \n xyz123456 Programming 2 05-16-2008 06:18 AM
Fork or what? crippe Programming 0 03-08-2005 04:21 AM
fork() MKSRaja Programming 2 02-07-2005 10:55 AM
Fork Deepali UNIX for Dummies Questions & Answers 5 08-26-2001 08:14 PM



All times are GMT -4. The time now is 10:26 AM.