Board index FlightGear Support Installation Linux

renice (just sharing)

Installing FlightGear, scenery, aircraft etc. on Linux systems like Ubuntu.

renice (just sharing)

Postby JazzTp » Mon May 12, 2014 2:59 am

Hi,


This might be interesting for FG pilots with not high end hardware.

I recently discovered that with my hardware FG runs faster in Linux than in Windows 7 Ultimate 64 bit (*).

I've also found out that I can increase the priority the Linux kernel gives to the fgfs process and gain some frames per second in difficult situations (typically crosswind with other planes around in MP with complex sceneries).

This can be done by locating the fgfs process and its numeric id, and then issueing a renice command on it.
Code: Select all
ps -ax | grep /usr/games/fgfs | grep -v grep

or just
Code: Select all
ps -ax | grep fgfs
and you look for the fgfs process (NOT the grep command we just issued).

You might want to read the second footnote (**).

Then you issue this command:
Code: Select all
sudo -s renice -10 <process id number>


Let's say you read that /usr/games/fgfs is process number 3109, then you type the command:
Code: Select all
sudo -s renice -10 3109

-10 or some other value between -1 and -20

0 is default priority, -20 is top priority, which I'm using sometimes, but be warned, that might have side effects: Bombable projectiles motion and detonation noise affected, and in "heavy situations" lags or audio drops, to avoid which you might need in FG to establish a framerate throttle value, I set 25 or 24 fps (PAL or movies framerate)... In FG running: main menu, View, Rendering Options.

You might start testing with -5 or -10 as I put in the example line above, or -15...


I am not experimenting especial heating of the CPU or GPU but be careful about that especially if you have an old graphics card (my previous card, NVidia 8800 Gt, was easily reaching 80º C), because the reniced process might be able to ask more from it... I don't know I'm just speculating.

I keep a fan blowing into the totally open PC when using BOINC (giving spare CPU and GPU cycles to scientific investigation, through World Community Grid or not, investigation about Aids, Cancer, Dengue, or whatever you give priority to) even if I keep BOINC controlled by TThrottle not to pass certain temperature limits.
I don't use the fan with FG but you might need to use one.


I am not experimenting problems with the built-in Terrasync (a separated Terrasync process would be affected I imagine, but bandwidth is the bottle neck there so it could maybe still function decently, or you could renice fgfs after syncing scenaries with FG or Terramaster, or renice Terrasync too).

I'm still making tests with this trick... but I could recently do something I couldn't before, that is practicing touch and go (with the Tiffy from Dave's Hangar not the UK hangar one which might be a little more demanding for the hardware, not sure yet though) in KSFO with strong cross wind and various planes around, without downconfiguring anything or cutting the MP connection.

It works for me, hope for others too.
Cheers!
Nicola - JazzTp


(*) I am running Linux Ubuntu 14.04 "Trusty" 64 bit on a pretty old Quad 6600 2.4 GHz 8 GB DDR2 RAM, first version PCI Express BUS, Asus P5KC motherboard, Asus NVidia GTX660 2 GB DDR5 RAM not top of the line admittedly... but it would take profit of a PCI Express 3 connection if the motherboard featured it... With FG 3.1.0 edge built about 48 hours ago I use to keep shader options at Maximum level with framerate not affected at all, except as usual when 3D clouds may or not cause a dramatic framerate drop, don't know why/when yet, maybe it happens when I don't have enough free kernels in the GPU because of scenery features... If you can then buy a more powerful GPU than the GTX660, I bought this to extend the life of my PC because the immediately bigger model would have required to change cabinet, besides I was going to get it back to Argentina and the customs only allow to bring in up to 300 USD stuff without any formalities or taxes, beyond that value you might have to accomplish formalities and pay taxes.

(**) I'm checking the ps man page
Code: Select all
man ps
ps ax is BSD syntax... standard is ps -e or ps -ef or ps -eF or ps -ely... well I typed ps -ax (with dash, same result as ps ax without it) because I had that in the fingers since some years ago... use the syntax you prefer and get the result you like better. I might add this renice feature to my launcher script or to a separate script, not to have to do this by hand each time... well I've just discovered the trick last night :D
JazzTp
 
Posts: 38
Joined: Sun Aug 18, 2013 6:47 pm

Re: renice (just sharing)

Postby chris_blues » Mon May 12, 2014 2:37 pm

Well, I'd say your hardware is not that bad! Certainly not the end of the line! I run FG 3.1 on similar hardware, though my graphics card ain't as powerful as yours. And in most cases this is the bottleneck. And 8Gigs of RAM would certainly make my flights a lot smoother! Especially since the new scenery arrived.

But anyway, thanks for sharing the tip with renice, haven't thought of that!

And if you're comfortable in the CLI, you could try ArchLinux - that gave me quite some fps more! Not to mention the choice of the Desktop environment. Openbox/LXDE doesn't seem to use any ressources at all! :) I have 350MB RAM used on LXDE and CPU always below 2%... Plenty of computing power left for FG!
Last edited by chris_blues on Mon May 12, 2014 3:13 pm, edited 1 time in total.
Don't hesitate to let me know if I'm incorrect or just annoying! As long as you do it gently! :)
Debian stable 64bit - i7 8x2.8GHz - 20GB RAM - GeForce GTS 450
Citation II
User avatar
chris_blues
Retired
 
Posts: 1577
Joined: Mon May 03, 2010 2:30 pm
Location: claws of real life
Callsign: chris_blues
Version: GIT
OS: Debian stable 64

Re: renice (just sharing)

Postby Hooray » Mon May 12, 2014 2:59 pm

I suggest to use a simple WM (not KDE or gnome!) and then use that in combination with re-nicing the process. Adjusting your swap settings and shutting down any daemon processes (mysql/apache etc) may also help
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: renice (just sharing)

Postby JazzTp » Wed May 14, 2014 9:57 pm

Thanks a lot for your replies, I will try your suggestions!


I'd like to put the first part of the trick I suggested in a simpler way I had forgot of.

To obtain the process id number to renice, this simpler command should do:

Code: Select all
pgrep fgfs


then as before

Code: Select all
sudo -s renice -10 <process id number>



(I remembered of pgrep while making myself a script which manages my paths and usual options, changes mouse speed, renices the process... I'm using the script instead of the launcher, still improving details though.)
JazzTp
 
Posts: 38
Joined: Sun Aug 18, 2013 6:47 pm

Re: renice (just sharing)

Postby Hooray » Wed May 14, 2014 10:01 pm

feel free to add such optimization hints to the wiki

to sneak out even more performance, you can work through this: http://wiki.flightgear.org/Howto:Debugg ... l_settings
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: renice (just sharing)

Postby Philosopher » Thu May 15, 2014 12:50 am

Does pgrep just output a number? (i.e. and no extra characters) If so, this should work too ;):
Code: Select all
sudo -s renice -10 $(pgrep fgfs)
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: renice (just sharing)

Postby JazzTp » Thu May 15, 2014 7:47 pm

Philosopher wrote in Thu May 15, 2014 12:50 am:Does pgrep just output a number? (i.e. and no extra characters) If so, this should work too ;):
Code: Select all
sudo -s renice -10 $(pgrep fgfs)


It works, thank you, and also:

Code: Select all
renice -10 `pgrep fgfs`


I'm actually using values between -15 and -20 at present... still "experimental", but seems OK here.

I have just installed Arch Linux 2014.05.01 , fascinating, very promising, thank you.
Actually I've always wondered why not keep in cache as much data as possible in unused RAM and only unload cached data when in need of RAM space... And there it is.

I still have to install a minimal graphics environment with Openbox (thank you), a suitable driver for the graphics card and then I'd try a FlightGear edge PPA.

I might post the result of running ps -ax and ask you what daemons I could/should safely kill.

As for the wiki, I could report there after summing up... if I'm not too much a FG newbie to "touch" already existing docs...?

My first sheduled contact with editing the wiki was actually to be after finishing these rudder pedals I'm currently using, Da Vinci style model almost suitable for a country under embargo :D (my friend Michat asked me to keep taking pictures of the prototyping process to later publish in the wiki).
JazzTp
 
Posts: 38
Joined: Sun Aug 18, 2013 6:47 pm

Re: renice (just sharing)

Postby Hooray » Thu May 15, 2014 7:54 pm

-20 is too much :!:

daemons should be removed via /sbin/service or chkconfig

no, just go ahead and edit the wiki - we're all newbies too, we just aren't shy about it :D
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: renice (just sharing)

Postby saiarcot895 » Thu May 15, 2014 7:55 pm

On Ubuntu, at least, you need to use sudo to increase the priority of a process (decreasing can be done by anyone).
Saikrishna Arcot

My FlightGear PPAs: FlightGear Stable, FlightGear Development (Edge)
saiarcot895
 
Posts: 343
Joined: Sat Feb 02, 2013 5:26 pm
Callsign: flyhigh
Version: -next PPA
OS: Ubuntu 20.04

Re: renice (just sharing)

Postby JazzTp » Fri May 23, 2014 3:57 am

Hooray wrote in Thu May 15, 2014 7:54 pm:-20 is too much :!:

daemons should be removed via /sbin/service or chkconfig

no, just go ahead and edit the wiki - we're all newbies too, we just aren't shy about it :D


ok thank you for the input!
as for the wiki... I'd like to test more, before writing bad data on it.. and I'm a little bit puzzled right now...
or I'll just mention the tips about having FG running faster without trying to report accurately about what happens on my PC.



Actually... I think I might have been hacked, on Monday 12th in the late afternoon I picked up my smart phone connected here to my home wifi, and it was behaving strangely (never like that in two and a half years). Besides, later I had to reinstall one broken thing in my PC under Linux Ubuntu (in the Trisquel page there was mention of Debian being full of backdoors left by "developers" which are actually working for... the NSA I think I read)

And finally, I noticed I had 7-800 MBytes less free space in Windows than two days before... which fact alone would not surprise me too much as Windows 7 is known to keep growing like Blob, google "Windows 7 keeps growing" and you'll see... the point is that FlightGear in Windows was now running faster!

The day before I had shared and commented on my Facebook wall something about 911... well in case: THANK YOU GUYS, thank you for the new USAF-NSA Windows kernel, it works great, I'm sure you agreed with my commentary. And... I need to buy a webcam soon (Arch Linux compatible), sooo STAY TUNED!!! ;D

No seriously, I'm puzzled. On my PC, Flightgear 3.0.1 in Windows is now running apparently as fast as in ArchLinux (despite the fact there's no match at all in the free memory aspect)... I didn't check in different MP circumstances though and I don't have the same FG version, so comparing is not too useful, not the same OS, not the same FG version...

In Windows and Arch Linux I have FG version 3.0.1, In Ubuntu I have FG version 3-1-0 edge built about 10-15 days ago. (I was writing a longer and detailed post last Sunday but an electricity black-out cut me off during the last pre-submit check, thus saving you all from that post even longer than this one, too long,I realized later... I hadn't saved a draft).

Anyway, let's just say that I have FlightGear in Arch Linux (and now Windows) running faster than in Ubuntu. For instance, in stereo anaglyphic 3D, 20 msec vs. 40 msec frame spacing, 30 fps vs. 25 fps or 60 vs. 38 (depending on scenery and weather conditions and MP aircrafts around and active rendering options).


I have had the impression that, even with the same numbers for framespacing and fps, I have faster response from the aicraft in Arch Linux than in Windows, like if some "parts" of the software (JSBSim?) were receiving more resources in Arch Linux than in Windows, but I'm not so sure any more. I had noticed it with the Tiffy and with the F7F from Dave's Hangar (with the Dave's Pack modified in the UK Hangar).

Well Windows is now (almost or completely) matching Arch Linux on this machine, while it was slower than Ubuntu days before.


saiarcot895 wrote in Thu May 15, 2014 7:55 pm:On Ubuntu, at least, you need to use sudo to increase the priority of a process (decreasing can be done by anyone).


Thanks for your repository Saiarcot895, I have been looking for an equivalent for Arch Linux but found none.
(I should learn how to build FG myself anyway.)
JazzTp
 
Posts: 38
Joined: Sun Aug 18, 2013 6:47 pm

Re: renice (just sharing)

Postby chris_blues » Fri May 23, 2014 10:57 am

JazzTp wrote in Fri May 23, 2014 3:57 am:I should learn how to build FG myself anyway.

Look a here: [TUTORIAL] Compiling from Git on Arch
Don't hesitate to let me know if I'm incorrect or just annoying! As long as you do it gently! :)
Debian stable 64bit - i7 8x2.8GHz - 20GB RAM - GeForce GTS 450
Citation II
User avatar
chris_blues
Retired
 
Posts: 1577
Joined: Mon May 03, 2010 2:30 pm
Location: claws of real life
Callsign: chris_blues
Version: GIT
OS: Debian stable 64

Re: renice (just sharing)

Postby JazzTp » Fri May 23, 2014 2:44 pm



Great, thank you!
JazzTp
 
Posts: 38
Joined: Sun Aug 18, 2013 6:47 pm

Re: renice (just sharing)

Postby JazzTp » Fri Jun 06, 2014 9:06 pm

A renice value of -10 is what I'm actually using.

It seems to me that a very high renice priority delays the loading of other planes models, does that make sense or I did I just run into circumstances/coincidences?


When it comes to lag in presence of other planes, I think I can say I definitely have a difference in Arch Linux from what I get in Windows 7.
Arch Linux and Openbox are very lightweight, as you told me, thank you again.

I'll have to look for a tool to capture desktop video in Arch Linux using the NVidia H264 compression hardware. ShadowPlay in Windows does a very fine job with very small impact on the CPU (although my system is not ShadowPlay ready: an i3 would be the minimum requirement... we asked them to unblock the feature and let us try, NVidia answered positively with facts, I could even record at more than PAL framerate one of their demo which has minimum requirements above my GPU and CPU... then we asked to be able to record OpenGL too and not only DirectX stuff, and here it is, anything happening on the screen can be recorded now).


I think I have another trick which could contribute to further reduce lag in presence of other planes.

As the Arch Linux kernel keeps disk data in cache as much as possible and only releases actually needed memory, I have tar read the disk tree with the files of all aircraft models I have available on disk.
After this, when I meet new aircraft models I have much much less lag while FG loads the new models (and the hard disk doesn't even move).

Code: Select all
#!/bin/bash

# LINUXDIST="ARCH"
MOUNTFOLDER="/mnt"
UBUNTUMOUNTFOLDER="/media/nicola"
FGFS="/usr/bin/fgfs"
FGROOT="/usr/share/flightgear/data/"


if [ -d $UBUNTUMOUNTFOLDER ] ; then
        # LINUXDIST="UBUNTU"
        MOUNTFOLDER=$UBUNTUMOUNTFOLDER
        FGFS="/usr/games/fgfs"
        FGROOT="/usr/share/games/flightgear/data/"
fi


tar -cSpf- "$MOUNTFOLDER/D_data_disk2/FlightGear_Aircrafts/" > /dev/null
tar -cSpf- "$FGROOT/Aircraft" > /dev/null



This is how long it takes the first time and the second time when everything is in cache:
Code: Select all
[nbern@archquad FG]$ time ./cacheAircrafts.sh
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names

real    0m59.006s
user    0m1.223s
sys     0m3.583s
[nbern@archquad FG]$ time ./cacheAircrafts.sh
tar: Removing leading `/' from member names
tar: Removing leading `/' from member names

real    0m8.652s
user    0m1.297s
sys     0m3.233s
[nbern@archquad FG]$


Maybe in more recent machines with faster disks the difference would be less noticeable.

The script should be Ubuntu 14.04 compatible (at least on my system) BUT I think it might be less effective in Ubuntu unless they adopted for their kernels the Arch philosophy (I realize now that I haven't flied in Ubuntu for quite a while so I didn't try out this trick).


I love Arch Linux, but alas I've been spending some time looking into the ALC883 sound hardware configuration (P5KC motherboard here), I tried various "solved" posts out there but I'm still having problems (implying I can't use Mumble presently, though I could before, don't know why yet). I have more posts to read and try out though.


As for building FG in Arch, I haven't run the modified script to have the FG-from-git build yet, I'll have to focus a bit on that and reorganize partition contents a little to get space, maybe I'll create a loop mounted disk of 50-60 GB into a NTFS partition.

I did not touch the FG wiki either yet, sorry. When I come to it, I could add this cache trick I think.


{{{ I really need to "fly" in my spare time. Apart from normal occupations, I'm looking after 10 cats currently, three have been with me for 1-2 years and everything is ok, love love love and not much extra work, but seven are wild cats, winter is coming, they are not having a very good time, I'm trying to get them familiar with humans and find adoptive human families for them, I took pictures and published in shops and Facebook, candidates are calling, no wonder because this cats are really beautiful... I have three of them in my bathroom, 2-3 months old, and their mother out here looks at me with devastating expressions in her very expressive eyes, not to mention the "kids" crying at night, every day a little less though... The biggest problems will be with the bigger sister + very strong father, and their mother). Triple parenthesis is because this is quite off-topic :) and even off-forum-topic }}}
JazzTp
 
Posts: 38
Joined: Sun Aug 18, 2013 6:47 pm


Return to Linux

Who is online

Users browsing this forum: No registered users and 1 guest