Sponsored Content
Top Forums Shell Programming and Scripting An alternative to IPC mechanism Post 302419250 by Corona688 on Thursday 6th of May 2010 03:43:48 PM
Old 05-06-2010
Quote:
Originally Posted by helltrex
What if the operating systems would not use any ipc mechanism in order to exchange the datas with each other,which technique could be an alternative for messaging between the processes? Do you guys think using the vfork () system call to duplicate processes is a logical solution for this problem?
vfork hardly seems a solution to the problem of communication in general. If IPC is unavailable, it's possible to create ad-hoc mutexes with temp files: open("/tmp/lockfile", O_CREAT|O_EXCL, 000) will only succeed for the process that gets to create the file. You could also exploit the queueing behavior of fifos. Or you could use sockets.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ipc

I have a parent that is passing data to child A and then child A has to process it and pass to child B. I am able to pass the data to child A but am not able to pass it to child B. Child B seems to only be receiving the last data instead of the whole data. I saw one example in a book but it uses... (1 Reply)
Discussion started by: scmay
1 Replies

2. Programming

Mechanism reqd for knowing TCP buffer occupancy level

Hi, The description and the context of the mechanism that i require is as follows: There is an application communicating with a protocol stack binary. There is a TCP socket communication between the two. Now, the stack is pumping up data to the Application such that the receiving buffer of... (2 Replies)
Discussion started by: saptarshi
2 Replies

3. Programming

[C] Problem with IPC

Hi! I'm trying to write this program: in my intentions it should get a message and send it to a second process (pid_upost), then to a third process (pid1, pid2, pid3, depending on the choice made when a new message is inserted). This program should write the message in a file (message1, message2 or... (1 Reply)
Discussion started by: Kaminski
1 Replies

4. Shell Programming and Scripting

locking mechanism

I have a shell script. How can use some kind of locking mechanism to ensure that the script is not being executed by two people at the same time? (3 Replies)
Discussion started by: tjay83
3 Replies

5. AIX

mechanism of AIX ?

Hi all, on aix,whether have udev or devfs mechanism? thanks! (4 Replies)
Discussion started by: anonys
4 Replies

6. Programming

Open source my OIOIC, a completely new object-oriented mechanism for the C.

OIOIC is a completely new object-oriented mechanism for the C programming language. Please download the "OIOIC-Primer-2nd-Edition-English.tar.gz". (the English version of << OIOIC Primer >> ) http://code.google.com/p/oioic/downloads/list Welcome your advice! Using OIOIC, you can describe... (7 Replies)
Discussion started by: pervise.zhao
7 Replies

7. Solaris

errors on Netra-440: "IPC Warning: ipc: tcp_protocol: bad magic number"

I was asked to look into a problem with a Sun Netra 440 in another department. On the server in question, the relevant 'uname -a' information is, "SunOS host1 5.9 Generic_118558-16 sun4u sparc SUNW,Netra-440". That information aside, while the other admin is logged into the ALOM, these errors are... (0 Replies)
Discussion started by: Borealis
0 Replies

8. Programming

Best IPC mechanism to be used

Suppose I have 5 independent process divided in two imaginay sets: set1 set2 --------------------- p1 p3 | | p2 p4 | p5 The processes inside each set communicate mutually quite often. I mean p1 and p2 communicate mutually quite often Similarly p3, p4 and p5 communicate mutually... (2 Replies)
Discussion started by: rupeshkp728
2 Replies
VFORK(P)						     POSIX Programmer's Manual							  VFORK(P)

NAME
vfork - create a new process; share virtual memory SYNOPSIS
#include <unistd.h> pid_t vfork(void); DESCRIPTION
The vfork() function shall be equivalent to fork(), except that the behavior is undefined if the process created by vfork() either modifies any data other than a variable of type pid_t used to store the return value from vfork(), or returns from the function in which vfork() was called, or calls any other function before successfully calling _exit() or one of the exec family of functions. RETURN VALUE
Upon successful completion, vfork() shall return 0 to the child process and return the process ID of the child process to the parent process. Otherwise, -1 shall be returned to the parent, no child process shall be created, and errno shall be set to indicate the error. ERRORS
The vfork() function shall fail if: EAGAIN The system-wide limit on the total number of processes under execution would be exceeded, or the system-imposed limit on the total number of processes under execution by a single user would be exceeded. ENOMEM There is insufficient swap space for the new process. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
Conforming applications are recommended not to depend on vfork(), but to use fork() instead. The vfork() function may be withdrawn in a future version. On some implementations, vfork() is equivalent to fork(). The vfork() function differs from fork() only in that the child process can share code and data with the calling process (parent process). This speeds cloning activity significantly at a risk to the integrity of the parent process if vfork() is misused. The use of vfork() for any purpose except as a prelude to an immediate call to a function from the exec family, or to _exit(), is not advised. The vfork() function can be used to create new processes without fully copying the address space of the old process. If a forked process is simply going to call exec, the data space copied from the parent to the child by fork() is not used. This is particularly inefficient in a paged environment, making vfork() particularly useful. Depending upon the size of the parent's data space, vfork() can give a significant performance improvement over fork(). The vfork() function can normally be used just like fork(). It does not work, however, to return while running in the child's context from the caller of vfork() since the eventual return from vfork() would then return to a no longer existent stack frame. Care should be taken, also, to call _exit() rather than exit() if exec cannot be used, since exit() flushes and closes standard I/O channels, thereby damaging the parent process' standard I/O data structures. (Even with fork(), it is wrong to call exit(), since buffered data would then be flushed twice.) If signal handlers are invoked in the child process after vfork(), they must follow the same rules as other code in the child process. RATIONALE
None. FUTURE DIRECTIONS
This function may be withdrawn in a future version. SEE ALSO
exec() , exit() , fork() , wait() , the Base Definitions volume of IEEE Std 1003.1-2001, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 VFORK(P)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy