Programming :: Python's Thread & Fork Support Is Compared To Perl?

Mar 24, 2011

I'm wondering how python's thread & fork support is compared to perl? Which one is best option among Perl and Python

View 1 Replies


Programming :: Unix Programming - Single Thread Server Can Support Exactly 2 Clients At Once

Sep 28, 2010

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit

View 4 Replies View Related

Programming :: Converting Perl Script To Python?

Jul 21, 2011

print "Input File Name: ";
$filename = <>;
$filename =~ s/s+$//;mkdir "$filename";


View 3 Replies View Related

Programming :: Perl Vs Python Which Is Easier To Learn

Jan 21, 2011

i want to learn a scripting language,which one should i go for ,among perl and python.

View 14 Replies View Related

Programming :: Access A Perl Script Behind A Firewall From Python?

Nov 23, 2010

I have a Perl script behind a firewall. I want to access this script from Python on Google App Engine. I have access to the server running the Perl script via the following methods: SSH VPN What are the ways I can do this with Python on GAE? Can I use something like wget, login through ssh and run the script using perl interpreter?

Currently it is a CGI script that I can access through a web browser if I'm inside the firewall. My only other option is to turn the process around, i.e. have perl send data outside the firewall to google app engine. But I want to know if this is possible as it is now without changing the perl script.

View 8 Replies View Related

Programming :: Unable To Configure Apache2 With Python Support

May 31, 2011

I'm unable to configure the apache2 with python support. I have done the configuration in the following method, but unable to start the python cgi support: I have installed the libapache2-mod-python it has installed python.load in the mods-available directory. In the apache2/sites-available/default file, I have added the following lines.


when I request for a python script in the py folder. I get a 404 Not found error.

View 1 Replies View Related

Programming :: Multi-core Support - Control On What Core Will A Thread Run

Oct 31, 2010

Is there any Linux API that will let me control on what core will a thread run? If not, do I have to use assembly language?

View 2 Replies View Related

Programming :: How To Bind Thread To Specific Thread In Multithread Application?

Dec 25, 2010

I am going to use "pthread_setaffinity_np" to bind a thread to a specific core. My application has two threads. I have used mutex to assign a specific id to each thread and then bind that thread to a core different from another core. but it seems that the os assigns both thread to one core.What should I do to bind each thread to a specific core?

View 4 Replies View Related

CentOS 5 :: Yum Python New Thread.error When Mysqld Is Running

Mar 13, 2009

I installed mysqld with yum then yum quit working with this error: when mysqld is stopped yum works again. what does a running instance of mysqld have in common with a python yum package manager?

rpm -qa rpm* python* yum* mysql* | sort


View 3 Replies View Related

Programming :: Python Script - Add A Perl Script ?

Aug 18, 2010

I have a python script (which I know nothing about python) that runs a third party binary called "report". What I would like to do is add a perl script I wrote to be executed at the end of this python script. My perl script runs the cpulimit command on the PID that's created from running the python script.

View 5 Replies View Related

Programming :: Python "support" Included In C Program?

Jul 11, 2011

I am just asking how this works in general. I know Python can wrap a C code, but here it seems Python is already integrated with this C program.Would it be correct to say one would have to understand the C code in addition to py programming in order to accomplish anything useful here?I need to control the program, and especially import its output to some algorithm that accomplishes command and control in the way of bash scripts or whatever.

View 2 Replies View Related

OpenSUSE :: Compile QT With Thread Support

Nov 1, 2010

I am trying to install an Open GL screen saver "EulerTop-1.2" and I get the following error message when I run configure - "checking for perl /usr/bin/perl checking for Qt... configure: error: Qt (>= Qt 3.2) (library qt-mt) not found. For more details about this problem, look at the end of config.log. Make sure that you have compiled Qt with thread support!" It appears to be installed -

vance@linux-i4xo:/> rpm -q qt3

how does one enable thread support? I have looked around the web but cannot find a solution.

View 9 Replies View Related

Ubuntu :: Download Manager Support Multi Thread As Well As Site Logins?

Feb 1, 2010

Anyone know of a good download manager for ubuntu that will support multi thread as well as site logins. I do a lot of downloading from rapid share and all the download managers i've tried don't support site logins.

View 4 Replies View Related

Programming :: Make Python Programs Run Without Entering The Command Python?

Mar 22, 2009

I want to be able to do

sudo ./

instead of always having to do

sudo python

What do I need to change?

View 5 Replies View Related

Programming :: Python - Get Text File Data Into An Array On Python?

Nov 30, 2009

I've already used line split stuff to transform my data into something like this in a text file:


['1', '1', '3', '20.7505207']
['2', '1', '3', '23.0488319']
['3', '1', '3', '-1.5768747']
['4', '1', '3', '-26.4772491']


How can I get this on a python program so I can manipulate it as an array?

View 3 Replies View Related

Programming :: How To Use Globals When Using Fork

Sep 16, 2010

As part of my ongoing project I need to put together a messaging server of sorts. So far I have coded a server which accepts multiple connections, which then runs a function that will perform a task, see below.On this sever I have a global structure which is populated using the data found in a read() buffer. However with each fork() that runs the below function each process is handed a blank structure. How could I go about allowing each fork() child process access the same structure?

My code should hopefully show what I am trying to do?
Code: void listen_for_client(int sock)


View 5 Replies View Related

Programming :: Can't Run Second Child In C (Fork)

Apr 10, 2011

Now,I created one parent and two children. I must create some value as random in child1 and child1 has to send these values to child2.Child2 must read them.. now,I cant create some random values and i can send them.But child2 doesnt work. I have two functions. One them is writing, another one is reading. Child2 uses reading function,but it doesnt work (child2 cant call it, because writing function in endless loop) What i must do? I used wait,usleep... No way.. I attached my file and also there is code..

PHP Code: #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <stdarg.h>
#include <sys/types.h>

View 2 Replies View Related

Programming :: Fork/exec Versus Posix_spawn

Sep 30, 2010

Just coming over from Windows here... where I've been using "CreateProcess" which returns a value depending on whether the process was created successfully or not.

Now I'm trying to create a process on linux and I've been learning about fork/exec, and I've been struggling with the fact that there seems to be no easy way to know (within the original parent process) if exec succeeded or not. (without forcing the parent process to hang around polling it or something).

Anyway, I've now just discovered the posix_spawn function, and it seems exactly what I need. However I'm finding the documentation a little hard to understand. In particular, I can't find actual confirmation that it will definitely return an error if creating the process fails (like CreateProcess does on windows). So can anyone confirm that for me?

The text on the documentation states: "If posix_spawn() or posix_spawnp() fail for any of the reasons that would cause fork() or one of the exec family of functions to fail, an error value shall be returned as described by fork() and exec"

This makes me think it uses exec/fork under the hood, and so I wonder if it can be trusted..?

And also, most of the examples on the internet for creating processes use fork/exec, so I wonder if there is some catch with posix_spawn I haven't read about... (since it seems a much simpler way of doing things)

View 2 Replies View Related

Programming :: Passing Usb_dev_handle After Fork Exec?

Aug 19, 2010

I have been struggling with this for about a week now. I'm working with QuickUSB to send video streams to and from a device. I get the fastest results by fork()ing and exec()ing new processes everytime I run a pipeline, which works great when reading from files, but now i have to transition it so that i am reading/writing data over a QuickUSB bus. I have it working for each individual process, but i can't run multiple processes because it won't let me open the device. After looking through QuickUSB's API a little closer, i found that the QHANDLE type that they use to describe the usb device is actually just a usb_dev_handle *. From what i have found, this is an incomplete structure, so i am having trouble with opening it in the main process and passing it to each new process to write to it. I already have semaphores set up to prevent multiple processes using it at the same time. I just CANT find out how to utilize the same usb device between two process that are forked and exec. i also must do the exec() because otherwise my gtk and gstreamer fails for trying to share resources.

View 1 Replies View Related

Programming :: Creating Multiple Processes Using Fork

Oct 23, 2010

As an assignment i was doing a program to create two process using fork and pass messages between them using message queue.Did it worked well until my friend tried to copy it using scp.suddenly all hell broke loose as processes without ran syncronisation ie. in tech terms the process just wont wait wen a message queue is keeps on executing randomly.but after a reboot .. everything worked fine. until again i tried to do scp on my system on purpose. and again the program just went mad.

View 3 Replies View Related

Programming :: Why Fork Is Executing The Program Twice From Start

May 25, 2011

I am learning about OS and I wrote this simple forking program... Here's the code..

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>


How can it print the first statement, that is BEFORE the fork() statement twice?

I am running Natty 11.04 btw..

View 8 Replies View Related

Programming :: Understanding Pid() And Fork() Programming?

Mar 28, 2011

I have been doing programming since the last 5 years. however, i have used to cut and paste the template without knowing in depth since i am chasing the time to finish a certain project. The title above seems easy if we read the manual, its just that im kinda confuse just for a second. Hope you guys can help me to give a better understanding for me so that i can upgrade my knowledge.Well, during my normal practice cut and paste, i try to understand this code below :-

Code: pid_t pid;
if (pid < 0) {perror("Erro spawning process : "); exit(EXIT_FAILURE);}


View 4 Replies View Related

Programming :: Fork()ing Multi Child Process In C - Stuck

May 12, 2011

i got basic knowledge about creating a single child from a parent using fork(). But when it comes into creating multiple children, i am simply stuck. I am trying to create two processes from a parent and it would wait for both two processes to finish. my attempt is as below


View 3 Replies View Related

Programming :: Fork() Copies The Address Space Of The Calling Process?

May 13, 2010

I know that fork() copies the address space of the calling process. Say, however, i have a linked list allocated. Will the list be copied over to the child process's space? If so, i would have to free them in the child process as well as the parent process, correct? Or will the variables be copied but not be pointing to any valid address? Or would it just kind of not do anything?example:

struct ll_ex {
struct ll_ex * next;


View 7 Replies View Related

Programming :: Fork() - Variable Values Between Child And Parent Process?

Feb 24, 2010


int main()
int pi;
int i=10;


Q 1. The value of the variable pid returned by the fork() function will be greater than 0 in the parent process and equal to zero in the child process? but during forking, there values are exactly copied so what's went wrong here?

Q 2. "changes to the variable in one process is not reflected in the other process" why it is so? >> Even if we have variable i declared as a pointer or a global it wont make a difference.


int main()
int i, pid;
printf("before fork i is %d


Q. Through this program it is clear that both process is using the data from the same location, so where's the original value is residing when the child process is in execution.?

View 6 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr For Program Run As Fork()/execl()?

Nov 24, 2010

I'm trying to write a program that will fork a series of FTP sessions. For each session, there should be separate input and output files associated with stdin and stdout/stderr.
I keep reading how I should be able to do that with dup2() in the child process before the execl(), but it's not working for me. Could someone please explain what I've done wrong? The program also has a 30-second sniper alarm for testing and killing of FTPs that go dormant for too long.

The code: (ftpmon.c)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


The output:

$ ftpmon
Connected to (
220 (vsFTPd 2.0.1)
ftp> waitpid(): Interrupted system call

Why am I getting the ftp> prompt? If the dup2() works, shouldn't it be taking input from my script and not my terminal? In stead, it does nothing, and winds up getting killed after 30 seconds. The log file is created, but it's empty after the run.

View 3 Replies View Related

Programming :: Re-mapping Stdio For A Fork'd/exec'd Executable Doesn't Seem To Behave

Jan 27, 2011

I have a monitoring program ( GIT link to sourceforge ) which I'm trying to use to track when a child exits/dies/whatever. I'm calling fork(), then close for 0,1,2, and then opening /dev/null, monitored.stdout, and monitored.stderr as a replacement. I'm not sure if I've done something incorrect (perhaps I should use dup2 for explicit assignment?) but it appears that printf() messages are just being blackholed. I've tried setting the line buffering as a last ditch effort. On a different system, using code similar to the spawn_monitor() function, this appears to work fine, which makes me think I'm relying on some implementation specific detail.

Relevant function, for those who don't click links:


26 int spawn_monitored(char *argv[])
27 {
28 int exit = 0;
29 pid_t child;
30 const struct rlimit inf = {


View 14 Replies View Related

Ubuntu Installation :: Getting Opencv To Run With Python Support?

Oct 10, 2010

So I followed all the steps here.[URl].. whixh is basically the same steps as in the installation wiki.The problem is that I can't find the file in /usr/local/lib/python2.6/site-packages . the folder is empty.

View 1 Replies View Related

Ubuntu :: Adding Python Support To Eclipse?

Apr 4, 2011

I have Eclipse Java IDE installed in Ubuntu, and now I want to add Python support

View 2 Replies View Related

Software :: Qgis With Python Support On Slackaware?

Mar 3, 2010

I am trying to build qgis_1.0.2 from subversion, on slackware 12. For some reason, sip does not get detected and therefore the python support is not enabled during setup: I build and installed successfully from source Q-4.6.2, sip-4.10 and PyQt-x11-gpl-4.7 Python 2.55 is also installed (also) as a shared library: here is the output of ldconfig: (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/python/config/


View 1 Replies View Related

Copyrights 2005-15, All rights reserved