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

In summary, the conversation discusses issues with using Mathematica and Firefox on a computer with 2GB of RAM. It appears that the computer becomes unmanageably slow when multiple programs are open and the swap file starts to get larger. The conversation also mentions potential solutions such as increasing the amount of RAM or optimizing Mathematica code. There is also a discussion about the amount of memory each program takes up when open. The conversation ends with a suggestion to try using a computer with more RAM or faster USB ports.
  • #1
Hepth
Gold Member
464
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
  • #2
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).
 
  • #3
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.
 
  • #4
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.
 
  • #5
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.
 
  • #6
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:
  • #7
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.
 
  • #8
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.
 
  • #9
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.
 

1. Why is my Ubuntu computer running slow?

There are a few potential reasons why your Ubuntu computer may be running slow. It could be due to a lack of available memory or storage space, running too many programs at once, outdated hardware, or issues with the operating system itself.

2. How can I speed up my Ubuntu computer?

To speed up your Ubuntu computer, you can try some of these solutions: close any unnecessary programs, clear out temporary files and unused applications, upgrade to a solid-state drive, increase your RAM, and regularly update your operating system and software.

3. Could a virus be causing my Ubuntu computer to run slow?

It is unlikely that a virus is causing your Ubuntu computer to run slow. Linux-based operating systems like Ubuntu are generally considered more secure and less susceptible to viruses compared to Windows or Mac. However, it is still possible for a virus or malware to affect your computer's performance, so it's always a good idea to have antivirus software installed.

4. What are some common mistakes that can slow down an Ubuntu computer?

Some common mistakes that can slow down an Ubuntu computer include filling up the hard drive with unnecessary files, not regularly updating the operating system and software, running too many programs at once, and not having enough RAM to handle the tasks you are trying to perform.

5. Is there a way to monitor my Ubuntu computer's performance?

Yes, there are various tools and commands available in Ubuntu that allow you to monitor your computer's performance. These include the "top" command, System Monitor application, and various third-party performance monitoring tools such as Conky and GKrellM.

Similar threads

Replies
38
Views
3K
Replies
2
Views
5K
  • Computing and Technology
Replies
22
Views
2K
  • Computing and Technology
Replies
7
Views
3K
Replies
29
Views
4K
  • Computing and Technology
Replies
32
Views
3K
Replies
2
Views
3K
  • Computing and Technology
Replies
10
Views
38K
  • Computing and Technology
Replies
21
Views
6K
Back
Top