Skip to main content

All Questions

Tagged with
0 votes
0 answers
30 views

Creating a process in a thread, can we?, should we?

Can/should we crate a new process in thread in, say, Unix? That is, we execute a fork() in a thread? Thanks!
Jie's user avatar
  • 1,256
-1 votes
1 answer
120 views

Reading lines from a file redirected to stdin in multiple processes using fgets

I'm trying to make a c program that creates several processes, based on an argument, and then has them all start reading lines from stdin and then do things with them (for now I'm just printing them ...
Sebastian Nuxoll's user avatar
1 vote
1 answer
98 views

What's wrong with this implementation of piping?

I would like to know what is wrong with this implementation of piping. I am trying to implement the following command ls |grep "main-pipe" |wc. However, it gets into infinite loop and I don'...
Erik Nouroyan's user avatar
0 votes
0 answers
15 views

Detect if a python pdb process is in break or waiting state

In Unix OS, is it possible to detect if a python program running in pdb, is in "break" or "waiting" state, given the process ID? I would like to detect that from outside the python ...
Hadikhamoud's user avatar
0 votes
0 answers
45 views

What is parent directory of a process?

In lsof output, it mentions 3 types of directories, cwd, rtd and pd. I understand cwd and rtd. But what is pd aka., parent directory for a process? I tried lsof | grep ' pd ', but I got no output. So ...
Sourav Kannantha B's user avatar
1 vote
1 answer
51 views

Child process doesn't modify statistics in parent process

I'm working on a C application that involves multiple processes, both child processes and the parent process, and I'm trying to share statistics between them using shared memory and semaphores. ...
chiara_tummi's user avatar
0 votes
1 answer
65 views

Customize the termination signal sent to subprocess that exceeds limits set by `resource.setrlimit()` in Python

I am writing an online judge for a competitive programming website and I want to detect if a program has exceeded the specified memory limits that results in the MLE (Memory Limit Exceeded) verdict. I ...
Saad Ahmed's user avatar
0 votes
0 answers
44 views

Custom shell in C - Result of pipelined processes comes after waiting for children and parent (Process Groups)

I am writing my own shell in C/C++. I am implementing pipelined processes, but I have a weird issue on the output. Let's suppose I have the command ls -al | grep something. Since they are pipelined ...
a_confused_programmer's user avatar
2 votes
1 answer
28 views

Reconnecting a unix pipe to a child process

I'm running a program a that requires some fixed input. Once all input is submitted, it opens a new process b using execve. b also accepts input but runs indefinitely. I want to automate sending input ...
Rick's user avatar
  • 150
1 vote
0 answers
21 views

How to understand the following quote from termios description

I'm using Mac (10.14.6), following quote is from man termios: When a controlling terminal becomes associated with a session, its foreground process group is set to the process group of the session ...
mzoz's user avatar
  • 1,345
2 votes
1 answer
926 views

executing the command "cat" with no options in c

If given no arguments or redirection use, the cat command reads from standard input. But when I execute it with execve() it doesn't behave as it does in bash. Code: #include <unistd.h> #include &...
KazumaIB's user avatar
0 votes
0 answers
134 views

Prevent program from forking

I want to run a binary in Python, but I want to disallow the binary from making new processes. It seems like the standard way to do this is to call setrlimit through the resource module, and constrain ...
Joey's user avatar
  • 219
0 votes
0 answers
51 views

C program using shared memory and signals to calculate length of line ends with 'User defined signal 1' or just termination instead of answer

I had to develop a set of producer-consumer programs implementing the following interprocess communication scheme using the semaphore mechanism and shared memory in C: Process 1 reads data from the ...
michvlek's user avatar
0 votes
1 answer
59 views

Why querying process available CPUs return all CPUs?

I'm trying to query the process available CPUs (on which CPUs he can run) using cpuset_getaffinity. cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, getpid(), sizeof(*...
Brave's user avatar
  • 317
0 votes
1 answer
112 views

¿Can I change the PGID of new bash instances? [duplicate]

I am writting a bash script first.sh in which I am required to run another scrip second.sh as a daemon. In order to do so it must be launched from a new bash instance using nohup, so when the bash ...
Infusco's user avatar

15 30 50 per page
1
2 3 4 5
43