Register to reply

[Ubuntu] Why is my computer slow! (jk, but seriously...)

by Hepth
Tags: slow, ubuntu
Share this thread:
Hepth
#1
Nov1-13, 06:41 AM
PF Gold
Hepth's Avatar
P: 471
So I know an awful lot about computers. Currently at work they have me on this older Core2 with Ubuntu 12.04 and 2GBs of ram. The computer itself is fast and fine, UNTIL you have some programs open.

When looking at "htop" (a better version of "top" in unix) I see that if I have mathematica open and firefox, those two programs hit my physical memory barrier of 2GB, and the swap file starts to get larger (maybe >500MB). As soon as this happens the computer becomes unmanagebly slow; as in I cant even click on another program or desktopfile without waiting for more than 10-15 seconds. I can hear the HDD working its butt off too...

I turned off the 3D GUI/startups/etc so theres no overhead, but I cannot avoid using both firefox/adobe reader and mathematica at the same time.

Are there any options for proiority of swap file usage in unix/linux that could maybe force mathematica to use more virtual memory rather than physical as it sits? Its not a processor problem but a memory one. Does the sound signify that mayber the HD is going bad and the bottleneck is the writing to swap (the HD is gettign a little louder).

This is a clean install of Ubuntu. There are no other applications open at all. I remember reading once there were ways to change the swap file's priority. In windows I know what I would do, I would delete the swap, defrag the entire drive, and make a static-sized swap so its in one chunk of the hard drive. Do people do similar things in linux?

Thanks for any help!
-Hepth
Phys.Org News Partner Science news on Phys.org
Experts defend operational earthquake forecasting, counter critiques
EU urged to convert TV frequencies to mobile broadband
Sierra Nevada freshwater runoff could drop 26 percent by 2100
DeIdeal
#2
Nov1-13, 06:50 AM
P: 128
Defragging isn't necessary on Linux, but you should definitely have a swap partition, if you don't already.

To me, that sounds like a bug/memory leak in Mathematica and/or Firefox. Are you by any chance running flash or java applications on Firefox when this happens? They can become really buggy (Adobe dropped native Flash support for Linux some time ago, and especially if you're running older flash apps, they might be really slow.), and it might be worthwhile to try out another browser, Chromium, for example, to see if that's the cause. Are you certain that your programs are up to date (clean installs don't necessary contain the most recent versions unless you have added and/or enabled the correct repos).
Bill Simpson
#3
Nov1-13, 10:35 AM
P: 1,037
If you can, take a serious look at how inefficiently you have coded the Mathematica notebook you are using. Sometimes people write Mathematica code in a way that wastes vast resources and they often don't have any understanding of what they have done. Mathematica often doesn't make this obvious. Mathematica is not FORTRAN, it is not c, many users assume it is, but the language is more different under the surface than almost any user imagines.

If you just cannot rewrite the notebook to make it far more efficient then my stock advice is to give Mathematica 32 gigabytes of real memory. If you give it so much memory that other people think you are a little nuts then you will likely find that this will repay you many times over. Memory is cheap, buy lots and lots.

Hepth
#4
Nov1-13, 11:48 AM
PF Gold
Hepth's Avatar
P: 471
[Ubuntu] Why is my computer slow! (jk, but seriously...)

The Mathematica code is not the problem, I know what I'm doing there.

With no code open (new start, fresh notebook):

The mathematica "java" binary for JLink takes up 468MB.
The FrontEnd binaries are at 109MB.
The Kernel is 176MB.

So thats about 753MB from just open, blank Mathematica 7.0.

Firefox only open to PF is at 622MB.

Unity-2D-shell is 352MB
Unity-panel-service is 145MB

So just my GUI with MM and FF open are about 1872MB. Thats very near my limit of 2GB. If I open anythign else, I can hear it moving things to virtual memory (my page/swap partition, which is set at 2GB). the HD sounds a little old, and EVERYTHING gets really slow when its doing it, but doesn't get slow when saving a large file. Not to mention the myriad other Ubuntu things its constantly running in the background (I tried to disable all of them).

But even so, 2GB of working ram should be fine, I think its just having trouble with the swap. I've used mathematica on much less of a machine, and it could multi-task without a problem. I can't even alt-tab when I have a few things open.

Maybe I just need to go buy some RAM for this thing out of pocket, or just use my laptop instead of a work computer.
Mark44
#5
Nov1-13, 01:25 PM
Mentor
P: 21,311
Quote Quote by Hepth
So just my GUI with MM and FF open are about 1872MB. Thats very near my limit of 2GB.
.
.
.
But even so, 2GB of working ram should be fine, I think its just having trouble with the swap.
I would guess that running that close to your 2GB limit is what's causing problems. It's not likely that your unused RAM is in nice contiguous blocks, so anything new that's saved to RAM probably has to be tucked in here and there, which could in turn cause problems with the cache needing to be refreshed.

If there are any slots left for adding another gig or two of memory, I think that would go a long way toward speeding up your computer.
Bill Simpson
#6
Nov1-13, 01:34 PM
P: 1,037
So did you run Mathematica with a 753 megabyte footprint on that much less of a machine and do the same calculations within Mathematica you are doing now and it ran just fine?

So with 128 megabyte free memory if you don't do anything within Mathematica does it run just fine now? Or is this when you start evaluating a notebook and Mathematica begins grabbing all the memory it wants?

In my experience the reason a system starts hammering the swap space is because Mathematica has consumed all available memory and demands more and more and the system slows to a crawl as half a gigabyte or a gigabyte is continually shoveled in and out of swap.

But if your footprint has consumed "all" available memory when just idle then I think that has answered the question.

I don't suppose you have fast USB 3.0 ports and could plug in a really fast 32 gigabyte thumb drive and move your swap space onto that, could you? (Different thumb drives even with the same fast port report more than 10x differences in speed and there doesn't seem to be an easy way of knowing which brand/model will really be fast)
Bill Simpson
#7
Nov1-13, 03:55 PM
P: 1,037
I vaguely remember years ago some reports surfacing about a new release of Mathematica being slow and I think something was finally tracked down to a Java compatibility problem.

https://www.google.com/search?q=Mathematica+slow+java

might help you track that down and determine whether that is any part of your problem.
Chronos
#8
Nov15-13, 01:47 AM
Sci Advisor
PF Gold
Chronos's Avatar
P: 9,454
I would recommend adding another 2G of ram. That may not be a solution, but, should help. RAM is dirt cheap so its not an expensive fix.
Hepth
#9
Nov15-13, 04:25 AM
PF Gold
Hepth's Avatar
P: 471
Quote Quote by Bill Simpson View Post
I vaguely remember years ago some reports surfacing about a new release of Mathematica being slow and I think something was finally tracked down to a Java compatibility problem.

https://www.google.com/search?q=Mathematica+slow+java

might help you track that down and determine whether that is any part of your problem.
I think the temporary fix they released cut the BG process from about 40% CPU usage to about 20%. I already did this. It also goes away more if I completely disable the JAVA in Mathematica (by makign the files nonexecutable), but then I can't access the manuals/help.

I have no problem like this on my Windows laptop. Same notebooks. Even when running a calculation, its not a problem. Unix seems to be doing just fine with calculations running at 100% cpu usage too, the priorities I set up are working. It all comes down to when the memory is nearing 2GB of real allocation, and ANYTHING uses the swap.

I'm willing to bet its not even mathematica, but rather just the ram usage handling in Unix coupled with a HD that I was given by the department that is probably 6 years old and has been reformatted 100 times, and just makes for a really slow swap.

I doubt this machine has USB3.0. I'm probably better off ordering a small SSD and another few GB of ram.

Unix systems can handle 8GB+ of ram on a 32bit system right? (Unlike Windows)? Now I just have to find a decent place to get cheap memory in Europe...

Thank you all for your help!
Borg
#10
Nov17-13, 05:35 AM
PF Gold
Borg's Avatar
P: 771
Quote Quote by Mark44 View Post
I would guess that running that close to your 2GB limit is what's causing problems. It's not likely that your unused RAM is in nice contiguous blocks, so anything new that's saved to RAM probably has to be tucked in here and there, which could in turn cause problems with the cache needing to be refreshed.

If there are any slots left for adding another gig or two of memory, I think that would go a long way toward speeding up your computer.
Quote Quote by Chronos View Post
I would recommend adding another 2G of ram. That may not be a solution, but, should help. RAM is dirt cheap so its not an expensive fix.
I'll add my vote to this. I was visiting a friend last month that had the exact same problems. He had a single core with 2GB of RAM. I looked up the specs for his memory, picked up 4GB of additional memory and installed it. Problem solved.
Ben Niehoff
#11
Nov17-13, 06:43 PM
Sci Advisor
P: 1,594
Quote Quote by Hepth View Post
Unix systems can handle 8GB+ of ram on a 32bit system right? (Unlike Windows)?
No. 32 bits will limit you to 4 GB total memory. 32-bit Windows XP is limited to 3 GB total memory due to weirdness in how it's coded.


Register to reply

Related Discussions
Slow Computer - External Hard Drive Cause? Computers 6
My computer runs very slow on internet and other program Computers 10
Slow computer Computers 30
Slow, stupid computer/printer face General Discussion 6
Computer running too slow Computing & Technology 27