fork() and IPC | Unix Linux Forums | Programming

  Go Back    


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

fork() and IPC

Programming


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 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 05-30-2001
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
 
Join Date: Sep 2000
Last Activity: 21 October 2014, 12:42 PM EDT
Location: Asia pacific region
Posts: 13,023
Thanks: 522
Thanked 877 Times in 402 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 Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:46 PM.