Beaglebone Multitasking (?)

Hello there,

I am using a RFID module attached to my beaglebone with UART1, reading ID Tags and printing the tags to the LED. Everything is OK up to this point. My question is the continuing: when I execute the python code, I cannot do anything else with my beaglebone. Because it keeps executing until I stop it. What I want is kind of a interrupt structure. What I mean is: when I execute the python code, it will be working at the background and when it reads a RFID card (an interrupt will occur) it will print the ID to the screen and then program will continue running at the background.

I do not have an idea how to do it. Could you please help me?

Regards

I am searching for the equivalent of:

*any_command* &
Run any command in the background (the symbol “&” means “run the preceding command in the background”). The*job_number* is printed on the screen so you can bring the command in the foreground (see below) if you want. I use “&” often when starting a GUI program from an X-terminal.

Hi Amadeus,

I am not sure what you are trying to do.

If you want your code to run in the background, you can call “python myscript.py &” like with any other program.

If the issue is that your code prevents anything else from running, you might want to have a look at Python’s “threading” package.

HTH,
– J.B.L

2012/6/21 Amadeus Bachmann <satanasxentius@gmail.com>

I am sorry for spamming. I found the solution: python xyz.py & makes the process run in the background. Now, I have one last question: I want my process to start when I login to my beaglebone. How can I do that? Is there a directory that have the list of start up programs?

Regards

As python is an interpreted language it runs very slowly, uses up lots of resources on Beagleboard and I'm sure it's the same on the BeagleBone.

  I have an application with some C code and mostly python, it runs with pauses between outputting sound on the -XM to the point where speech is heard in one second intermittent bursts.

The same program run on an x86_64 uses ~40% CPU while another program written in C to do exactly the same thing runs at < 3% CPU.
Regards
Sid.

http://en.wikipedia.org/wiki/Write_(Unix)

You want to be trying to write directly to the TTY (console) this will let you run the program in the background but still alert you to important messages on the console.

That doesn't relieve pressure on CPU resources.
Regards
Sid.

Thank you for your answer. CPU usage was not something I have taken into consideration. However from now on I will think more about it. Thanks again!

Hi Jean-Baptiste,

I was trying to make my code run in the background and as indicated by my third message, I found its solution. But now I want my program to start running directly when I login to my beaglebone without any commands . Just like adding a program to start-up programs in windows. When you login to your windows account, those programs start instantly. Do you have an idea how this can be done?

Thanks,
Amadeus

If you can get to run "top" it'll show you how much CPU and memory python is using.
Memory may not be a problem but no doubt CPU usage will be high.
Regards
Sid.

I don't have a beaglebone but normally if you want a program to run
when the user logs in you would put in their .bashrc, .profile file or
such (depending on the linux distribution) which resides in the users
home directory. Does the beaglebone use the busybox ash shell?

- Jim

Hi,

Nice answer.

In your opinion, which is the efficient language to use with beaglebone? Can we use Java or NodeJS?
In one of our projects, we planned to use beaglebone to be highly multitasking with a lot of sensors and internet connectivity.
What is your choice of language that we should use?

(C/C++/JAVA/PHP/Node.Js/Python)