LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Physical RAM Usage Indicator (https://www.linuxquestions.org/questions/linux-hardware-18/physical-ram-usage-indicator-587986/)

sedition 09-28-2007 07:57 AM

Physical RAM Usage Indicator
 
Hi all,

I've built a device that will indicate through 10 LEDS the amount of RAM remaining on a system via the USB port(think, an external desktop applet). They illuminate corresponding to a number that is a percentage from a shell script that loops cat /proc/meminfo, does the math, and spits it out via > /dev/ttyUSB0. The problem that I've run into is, when testing, I open tons of apps to eat away the RAM and change the indicators, but there are severe delays or even complete pauses until the system finishes opening the programs before changing the indicators. Is there a better or more efficient way to send the data to USB? The batch file is just being run via terminal in Gnome right now and I had planned on running it in the background on login, but until I get the delays worked out, I don't see much use.

syg00 09-28-2007 08:59 AM

Kernel module would probably be the best bet, else you're just going to have to wait until it's your turn. Why not start it in the init scripts (rc.local or similar) ???.

sedition 09-28-2007 09:55 AM

I've been running it in the terminal just for testing. Can running it via init script cause it to run at different priority/more smoothly? Also, though I can easily Google, do you have any recommendations for learning to write kernel module programs? Thanks for the response, it's greatly appreciated. I was afraid that this may be a bit too esoteric for the forums.

syg00 09-28-2007 10:15 AM

"The Linux Kernel Module Programming Guide" at tldp.org is very good; recently updated too.
Also Linux Device Drivers (vol 3) - by the guy that runs lwn.net and a couple of mates. Heard Jonathan Corbet talk at a conference on the sysfs implementation - very good. I have the book in hardcopy, but the authors have it for free download as well - see here.

As for my init script suggestion, that was just to ensure it was running early (prior to X) - will still be subject to pre-emption. A limitation of running as a script.

sedition 09-28-2007 10:38 AM

Outstanding. Thanks for the info, looks like I'll have a project this weekend!


All times are GMT -5. The time now is 07:25 PM.