30 Topics

Member Avatar for
Member Avatar for kyle.mace.35

Alright so I am getting a weird problem with the following code int toDB[2]; int fromDB[2]; char * param1; char * param2; err = pipe(toDB); if(err==-1) { printf("Error on pipe creation: %d\n", errno); exit(1); } sprintf(param1, "%d", toDB[0]); err = pipe(fromDB); if(err==-1) { printf("Error on pipe creation: %d\n", errno); exit(1); …

Member Avatar for rubberman
0
1K
Member Avatar for kyle.mace.35

How do I use pipes to communicate with another proccess that is being run using an execl command? I know how I can send info to that process but how do I get info back from that proccess? Some more information on what Im trying to do: I am trying …

Member Avatar for rubberman
0
2K
Member Avatar for Xheis

Hi, I have to create a program that creates N child processes, and they muliply the matrix. I have some base codes but when I try to run them they give me segmentation error and I cant find the problem. #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <sys/types.h> …

Member Avatar for David W
0
294
Member Avatar for greatman05

Hello. I need to set up some pipes for a homework assignment as part of a bigger project. The issue I'm having is that the array (args) I'm using to populate the pipe arguments keeps segfaulting and I don't know why. Everything has been malloced beforehand and the faults only …

Member Avatar for greatman05
0
256
Member Avatar for haresh.sankarraj

Hi members, This is a program i wanted to implement semaphore between parent and child processes which are trying to access a shared variable called counter ... i dont know why it is not getting incremented during the child process !! someone help please !! #include <stdio.h> #include <sys/types.h> #include …

Member Avatar for rubberman
0
2K
Member Avatar for emaellie

Hi ya guys, I have been learning about forks and processes, below is my code that i have created but am having difficulty on certain things. **1. Add code to print out and note the values of :** i. The values held within the array fd[ ] from the parent …

0
121
Member Avatar for Qwert_1

Here is a code that creates two childern using fork. My question is how can we create mutiple grandchildern and great grandchildern at the same time . And the line 21 of code gives an unexpected output i.e instead on one parent id it gives three id's. Here is the …

Member Avatar for rubberman
0
1K
Member Avatar for Ondrej.Behulek

Hello, I have a course that is Operational Systems.. My lecturer doesnt explain so much and after He say, You must solve this problem, because u r a programmer.. I have such a problem with linux programming. I put my code here, He wants, I must allow multi-client to server. …

0
235
Member Avatar for cacofonix

Hi All, In my script, i am trying to call multiple fork call. if i call less than 10 times, its working fine. If i call more than 20 or 30 times, most of the process getting time out or died foreach my $ttyport (@processTTY) { my $pid = fork();Inline …

Member Avatar for coding101
0
142
Member Avatar for Fredszky

So i'm trying to make multiple clients logon to a server through filesockets, and perform simple commands like ls -l, ls, mkdir. I've managed to make one client recieve output of ls -l command, sometimes, its buggy. Now i've been sitting for days trying to figure out how to fork() …

Member Avatar for Fredszky
0
6K
Member Avatar for devilmaycry1

hi friends I've a code to compute integral with area function in code. I used Fork, and for returned values I must use shared memory. now I need to embed a semaphore in my code to control the critical area(here is shared memory). I don't know how to embed semaphore …

Member Avatar for DeanMSands3
0
2K
Member Avatar for boiishuvo

Okay I am trying to write a program where a parent process creates three child processes. Also waits for each of them to finish. Here is my code: [code] #include <stdio.h> #include <unistd.h> main() { int i; // create 3 child processes for (i = 0; i < 3; i++) …

Member Avatar for rakeshbiswal
0
4K
Member Avatar for shujat132

**My academic assignmentt ** **Please help me in coding for this assignment** In Linux Ubuntu flavor, write a program in C language to do the following tasks. 1) Use fork ( ) system call to create a child process. 2) Child process should first take student name as input and …

Member Avatar for khudayar
0
2K
Member Avatar for jnewman3

I'm applying the peterson solution for protecting memory of the critcal section. Each child process should contain a local variable that keeps track of the number of times it interrupts the other child while it is in its critical section. The process should display this value before terminating. I'm having …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for omkar_hande

If a child process encounters exit(0) statement, where is this exit status returned in the parent process? Is there any variable associated with every process that holds this information? If not, how do children and parent processes communicate?

Member Avatar for poornamoksha
0
280
Member Avatar for wschamps42

Can somone please explain to me what does fork() != 0 mean? From what I understand I think it means if fork is not false? Or if fork is true then.... I dont understand how Fork() can be true or false, seeing that it just creates a copy of a …

Member Avatar for np complete
0
178
Member Avatar for mayank.dyl

what does fork() do in c.? Is it same as fork operation in OS ? What is the o/p of following program ? #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

Member Avatar for mayank.dyl
0
187
Member Avatar for rutwvu

I was asked to write a program, based on parent-child cooperation, which uses a “parallel” merge sort to a sequence of 800 numbers from a text file.I have to read the sequence of 800 integers, which I store in an array, and then pass half of them to a child, …

Member Avatar for rutwvu
0
1K
Member Avatar for Efficience

I have written a code for checking vfork in unix. But I am getting the ambiguous behavious. When I am using exit(0) in child process , output is fine i.e; output :- Before fork I am a child My name is parent child PID=> 23133 kValue => 2 ] But …

Member Avatar for Efficience
0
282
Member Avatar for NickPatton

I'm using sockets in C to write 10 bytes to a socket and then read 10 bytes from that socket. I create a parent process that forks, creating a child that acts as the socket server that writes the 10 bytes. After the 10 bytes are wrote, back in the …

Member Avatar for NickPatton
0
271
Member Avatar for JDevelop

Hello there, I'm new to C programming and am following a course in C. I've got an example code for piping. It's not a very hard code to understand. It goes like this: [CODE] #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #define READ_END 0 #define WRITE_END 1 const char …

Member Avatar for JDevelop
0
163
Member Avatar for tikoti

Hi everybody! I am trying to use fork() and wait to perform a simple task with c++ but I have noticed that the performance is quite different from what I expected. [CODE] #include <unistd.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int number = atoi(argv[1]); int i; …

Member Avatar for tikoti
0
3K
Member Avatar for SpyrosMet

Hi everyone. i have an issue with a server program i'm developing for a university project. The issue is the following: The server program i'm building uses shared memory and forks. However i have a problem as to how can i destroy the shared memory segments i've created. A simplified …

Member Avatar for SpyrosMet
0
198
Member Avatar for vs.vaidyanathan

If i fork off a parent and want to fork of fthe child, can i pass new variables from the child to the "grand -child"? PL help me clear this concept.

0
94
Member Avatar for vs.vaidyanathan

I wasnt to fork from a parent and execute two perl codes simultaneously rot13.pl and pi.pl.I want to keep track of the pid's of both children. i am not aware how to do it within the system() cmd. I have written the code below. But something tells me I'm being …

0
90
Member Avatar for xx_infer

hi, i have problems using exec(), I need to pass a set of numbers using exec to another program that is supposed to use them to calculate something,,, i dont know how to pass them any suggestions??

Member Avatar for Salem
0
102
Member Avatar for PMACLEAN

Could someone please advise me on how to implement fork() in a parallel processing (multiplying) of a 2d array....I have been at this for far too long.. here is my code [code] for (int i = 0; i < rowCol[0]; i++ ) result[i] = (float*)malloc ( rowCol[1] * sizeof(float) ); …

Member Avatar for abhimanipal
0
177
Member Avatar for paddy8788

I want to launch a new process from a given string of input (including parameter). I tried to use system() but it appears that in the child process, getppid() is not the same as the caller in some runs (probably because system uses the shell as command interpreter). However, if …

Member Avatar for nezachem
0
237
Member Avatar for DimaYasny

Hi all, I'm helping my girl out with her hw, (/me not knowing C at all, but someone has to help, right?) I am supposed to read user input, and then try to execute a given command plus the arguments in every given $PATH. I managed it all, but I …

Member Avatar for DimaYasny
1
295
Member Avatar for dheerajsuthar

Hi, I was honing my linux programming skill when this nuisance started bugging me. I wanted to create an empty file creator program. While creating a large file it must print # for progress bar. But the output shows it happening reverse way. ie. first it copies file and shows …

Member Avatar for dheerajsuthar
0
166

The End.