fork

How can I fork a Perl CGI program to hive off long-running tasks?

我的未来我决定 提交于 2019-12-18 17:13:23
问题 I am writing a Bulk Mail scheduler controlled from a Perl/CGI Application and would like to learn abut "good" ways to fork a CGI program to run a separate task? Should one do it at all? Or is it better to suffer the overhead of running a separate job-queue engine like Gearman or TheSchwartz as has been suggested recently. Does the answer/perspective change when using an near-MVC framework like CGI::Application over vanilla CGI.pm? The last comes from a possible project that I have in mind for

Can I fork another persons repo twice into my own account?

六眼飞鱼酱① 提交于 2019-12-18 14:11:11
问题 On GitHub, I can't seem to figure out how I can fork a repo twice into one account. So there is a repo from Bob/CoolFramework I fork it to Jeremy/MyShooter and start to build a game Now I also want to fork it to Jeremy/MyRPG to build another new game When I try to fork CoolFramework a second time, it just takes me to MyShooter. So the options I can think of: A) I'm not using Git in the right way B) It's not possible on Git C) I just couldn't see the option on Github 回答1: In your case, I would

fork() failing with Out of memory error

守給你的承諾、 提交于 2019-12-18 13:19:09
问题 The parent process fails with errno=12(Out of memory) when it tries to fork a child. The parent process runs on Linux 3.0 kernel - SLES 11. At the point of forking the child, the parent process has already used up around 70% of the RAM(180GB/256GB). Is there any workaround for this problem? The application is written in C++, compiled with g++ 4.6.3. 回答1: Maybe virtual memory over commit is prevented in your system. If it is prevented, then the virtual memory can not be bigger than sizeof

How does fork() return for child process

主宰稳场 提交于 2019-12-18 10:20:35
问题 I know that fork() returns differently for the child and parent processes, but I'm unable to find information on how this happens. How does the child process receive the return value 0 from fork? And what is the difference in regards to the call stack? As I understand it, for the parent it goes something like this: parent process--invokes fork-->system_call--calls fork-->fork executes--returns to-->system_call--returns to-->parent process. What happens in the child process? 回答1: % man fork

Zombie process vs Orphan process

好久不见. 提交于 2019-12-18 09:54:47
问题 A Zombie is created when a parent process does not use the wait system call after a child dies to read its exit status, and an orphan is child process that is reclaimed by init when the original parent process terminates before the child. In terms of memory management and the process table how are these processes handled differently, specifically in UNIX? What is an example or extreme case when the creation of zombies or orphans can be detrimental to the greater application or system? 回答1:

Does the C execv() function terminate the child proccess?

安稳与你 提交于 2019-12-18 09:34:04
问题 Heres a breakdown of my code. I have a program that forks a child (and registers the child's pid in a file) and then does its own thing. The child becomes any program the programmer has dignified with argv. When the child is finished executing, it sends a signal (using SIGUSR1) back to the parent processes so the parent knows to remove the child from the file. The parent should stop a second, acknowledge the deleted entry by updating its table, and continue where it left off. pid = fork();

Wait for and/or kill process grandchildren produced by fork

萝らか妹 提交于 2019-12-18 07:15:18
问题 I fork() into process X and Y, afterwards Y forks() again into itself and process Z multiple times. Now process Y is some kind of "listener" and I would like X to be the deleter. The Z processes perform the actual actions. Z processes are grandchildren of X. With a FIFO and some signaling, X has produced a list of all pids of the Z processes. The problem now is that I would like to delete Z process zombies with X (going through the list of pids). I've tried it with waitpid() , but of course

Fork Join Matrix Multiplication in Java

邮差的信 提交于 2019-12-18 07:14:25
问题 I’m doing some performance research on the fork/join framework in Java 7. To improve the test results I want to use different recursive algorithms during the tests. One of them is multiplying matrixes. I downloaded the following example from Doug Lea's website (): public class MatrixMultiply { static final int DEFAULT_GRANULARITY = 16; /** The quadrant size at which to stop recursing down * and instead directly multiply the matrices. * Must be a power of two. Minimum value is 2. **/ static

If I have a process, and I clone it, is the PID the same?

主宰稳场 提交于 2019-12-18 07:13:07
问题 Just a quick question, if I clone a process, the PID of the cloned process is the same, yes ? fork() creates a child process where the PID differs, but everything else is the same. Vfork() creates a child process with the same PID. Exec works to change a process currently in execution to something else. Am I correct in all of these statements ? 回答1: Not quite. If you clone a process via fork/exec, or vfork/exec, you will get a new process id. fork() will give you the new process with a new

fork/chroot equivalent for Windows server application

心不动则不痛 提交于 2019-12-18 06:43:30
问题 I have written a small custom web server application in C running on Linux. When the application receives a request it calls fork() and handles the request in a separate process, which is chrooted into a specific directory containing the files I want to make available. I want to port the application to Windows, but neither fork() nor chroot() are available on this platform, and there don't seem to be any direct equivalents. Can you point me to a simple (and preferably well written) example of