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 offline Forum Staff  
Administrator
 
Join Date: Sep 2000
Last Activity: 19 December 2014, 5:30 AM EST
Location: Asia pacific region
Posts: 13,038
Thanks: 547
Thanked 914 Times in 412 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 11:23 AM
Fork and \n xyz123456 Programming 2 05-16-2008 07:18 AM
Fork or what? crippe Programming 0 03-08-2005 05:21 AM
fork() MKSRaja Programming 2 02-07-2005 11:55 AM
Fork Deepali UNIX for Dummies Questions & Answers 5 08-26-2001 09:14 PM



All times are GMT -4. The time now is 08:54 AM.