|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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 | ||
|
![]() |
| Thread Tools | Search this Thread |
| 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 |
|
|