Questions tagged [multiprocess]

Concerning running parallel code in separate processes (unlike multithreading) and/or related to package `multiprocess` from PyPI.

462 questions
3
votes
1 answer

Socket programming: accept() delayed

I have a server written in C which is blocked at function accept() and awaits new incoming connections. When a new connection is accepted, it creates a new process by calling fork(). I don't use epoll as each client socket is handled by a…
vesontio
  • 381
  • 1
  • 7
  • 19
3
votes
1 answer

How does process join() work?

I am trying to understand multiprocessing in Python, I wrote the following program: from multiprocessing import Process numOfLoops = 10 #function for each process def func(): a = float(0.0) for i in xrange(0, numOfLoops): a += 0.5 …
3
votes
1 answer

Why Python Multiprocess class doesn't change the attribute?

#!/usr/bin/env python from multiprocessing import Process class Signprocess(Process): """docstring for SignThread""" def __init__(self): super(SignThread, self).__init__() self.result = False def run(self): self.result = True …
demonguy
  • 1,977
  • 5
  • 22
  • 34
3
votes
1 answer

Need help understanding Perl code- Multi process / fork

I was looking for an example to limit the number of forked processes to run at the same time and I ran across this old code #!/usr/bin/perl #total forks, max childs, what to run #function takes 2 scalars and a reference to code to run sub mfork…
genx1mx6
  • 425
  • 1
  • 6
  • 12
3
votes
1 answer

Why does my Berkeley DB concurrent data store application hang?

My application hangs when trying to open a concurrent data store (CDB) database for reading: #0 0x0000003ad860b309 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 #1 0x00007ffff7ce67de in __db_pthread_mutex_lock (env=0x610960,…
Steve Emmerson
  • 7,702
  • 5
  • 33
  • 59
3
votes
2 answers

Multi Process Shared Preferences return wrong value in multi process environment

my shared prefs are defined like this: sharedPreferences = context.getSharedPreferences(Consts.SHARED_PREFS_NAME, Context.MODE_MULTI_PROCESS); my receiver is defined in a different process:
Eitan Schwartz
  • 463
  • 6
  • 19
3
votes
3 answers

Tell consumers to stop waiting for queue elements

Here's an example. I have one producer and several consumers. #!/usr/bin/env python2 from multiprocessing import Process, Queue import time def counter(low, high): current = low while current <= high: yield current current…
bbc
  • 240
  • 2
  • 8
3
votes
1 answer

dup() followed by close() from multiple threads or processes

My program does the following in chronological order The program is started with root permissions. Among other tasks, A file only readable with root permissions is open()ed. Root privileges are dropped. Child processes are spawned with clone() and…
Will
  • 2,014
  • 2
  • 19
  • 42
3
votes
1 answer

Django Multiprocessing oddity

In using ./manage.py shell to exercise some code, I've come across something I don't understand. Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2 Type "help", "copyright", "credits" or "license" for…
3
votes
1 answer

Strange results in multiprocess signal handling program

I have this multiprocess program which consists of 9 processes. One is the main process which spawns 3 signal generating processes and 4 signal handling processes. One is the monitoring process. Now I have used two signals SIGUSR1 and SIGUSR2. Each…
user34790
  • 2,020
  • 7
  • 30
  • 37
2
votes
3 answers

C++ how to check if file is in use - multi-threaded multi-process system

C++: Is there a way to check if a file has been opened for writing by another process/ class/ device ? I am trying to read files from a folder that may be accessed by other processes for writing. If I read a file that is simultaneously being written…
Thalia
  • 13,637
  • 22
  • 96
  • 190
2
votes
2 answers

C: multi-processes stdio append mode

I wrote this code in C: #include #include #include #include void random_seed(){ struct timeval tim; gettimeofday(&tim, NULL); double t1=tim.tv_sec+(tim.tv_usec/1000000.0); srand (t1); } void…
2
votes
0 answers

Can I change python multiprocess entry point?

Python multiprocess entry point could be controlled? I've injected run_entry function on entry.py. But why new process importing main.py again? instead of starting with run_entry func on entry.py by direct importing entry.py I've tested it on…
2
votes
2 answers

Python: Multiprocessing.Process does not invoke target function sometimes

I have a script that runs daily and while invoking processes, out of 100+ processes sometimes randomly 2 or 3 process do not get started and my target function is not called. This started occurring recently and before some days it was running fine.…
2
votes
1 answer

Building a Pandas dataframe using multiprocessing leads to errors

I am trying to build a big dataframe using a function that takes some arguments and return partial dataframes. I have a long list of documents to parse and extract relevant information that will go the big dataframe, and I am trying to do it using…