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

  • Thread starter Thread starter Hepth
  • Start date Start date
  • Tags Tags
    Computer Ubuntu
Click For Summary

Discussion Overview

The discussion revolves around the performance issues experienced on an older computer running Ubuntu 12.04 with 2GB of RAM, particularly when using Mathematica and Firefox simultaneously. Participants explore potential causes of the slowdown, including memory usage, swap file management, and software inefficiencies.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant notes that the computer becomes unmanageably slow when physical memory is maxed out, leading to increased swap usage.
  • Another suggests that the issue may stem from a bug or memory leak in Mathematica or Firefox, particularly if Flash or Java applications are involved.
  • A different viewpoint emphasizes the importance of efficient coding in Mathematica, suggesting that poorly written code can waste resources.
  • One participant provides detailed memory usage statistics for Mathematica and Firefox, indicating that their combined usage approaches the physical memory limit.
  • Concerns are raised about the performance of the hard drive, with one participant speculating that it may be contributing to the slowdown when the system accesses swap space.
  • Suggestions include adding more RAM to alleviate memory constraints, with some participants arguing that 2GB may be insufficient for the tasks at hand.
  • There are discussions about the potential for Java compatibility issues with Mathematica affecting performance.
  • One participant proposes using a fast USB drive for swap space as a possible workaround, while others recommend upgrading to an SSD and increasing RAM.

Areas of Agreement / Disagreement

Participants express a range of opinions on the causes of the slowdown, with no consensus reached. Some believe the issue lies with software inefficiencies, while others point to hardware limitations, particularly RAM and hard drive performance.

Contextual Notes

Participants mention various assumptions about the performance of Mathematica and the efficiency of the operating system, as well as the age and condition of the hardware being used. There are unresolved questions regarding the impact of specific software configurations and memory management practices.

Who May Find This Useful

This discussion may be of interest to users experiencing performance issues with older computers running Linux, particularly those using resource-intensive applications like Mathematica and Firefox.

Hepth
Science Advisor
Gold Member
Messages
458
Reaction score
40
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 can't 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 there's 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
 
Last edited by a moderator:
Computer science news on Phys.org
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).
 
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.
 
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 that's 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.
 
Hepth said:
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.
 
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)
 
Last edited:
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 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.
 
Bill Simpson said:
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!
 
  • #10
Mark44 said:
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.
Chronos said:
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.
 
  • #11
Hepth said:
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.
 

Similar threads

Replies
38
Views
5K
Replies
2
Views
6K
  • · Replies 22 ·
Replies
22
Views
3K
Replies
2
Views
4K
  • · Replies 10 ·
Replies
10
Views
38K
Replies
29
Views
5K
  • · Replies 32 ·
2
Replies
32
Views
5K
  • · Replies 21 ·
Replies
21
Views
7K
  • · Replies 12 ·
Replies
12
Views
6K
Replies
6
Views
3K