I have worked with ubuntu 14.04, 16.04 and 18.04 (x64) on my laptop and I had the same problem in each one of them. The problem is copying takes CPU and it takes a lot of it. It doesn't matter the which file, as long as copying to another drive or flash memory or an external HDD, cpu is working a lot. I checked for copying in the same ubuntu on my friend's pc and it was ok.

cpu usage

As you see I found the two processes using the cpu

P.S: I have installed ubuntu 18.04 on an SSD memory and the installed ubuntu for my friend's pc on an HDD.

  • "Copying" or "Moving" a file within a filesystem is different than across filesystems. It seems like you are asking about the latter. There is a fair amount of locking and coordination required to do this. Anyway, tracking CPU with top or htop isn't actually telling you much other than the system has cycles to spare and is trying to do what you asked using as much of those cycles as it can. For a fuller picture you can profile commands on Linux with things like strace. – jdv Oct 18 '18 at 16:51
  • It's not about copying just quickly, It's about laptop battery usage too! ( Jacob Vlijm ) – tr64 Oct 18 '18 at 16:58
  • I didn't get your first sentence (jdk). If you are saying coordination takes cpu, then my question is why other systems don't have the same problem as I do? At least the systems I saw... how should I use strace to get the fuller picture? – tr64 Oct 18 '18 at 17:06
  • Unfortunately Jacob, I don't understand what you are saying... other systems don't have my problems... why copying should take CPU this much? – tr64 Oct 18 '18 at 17:11
  • 1
    If the choice of processes in the screencap is important: askubuntu.com/q/79481/459652 – jdv Oct 18 '18 at 17:59

(This small essay is a variation on my usual reference to the truism "Good, Fast, or Cheap; Choose any two")

Turn the question around. On an otherwise unloaded system, what would you expect to happen? Should the system starve processes or resources like memory or CPU if no other process needs those right now?

An OS has to balance speed and space and do so in a correct manner, and it has to do that for any process that may want access to the same resources. It has to honour notions like "locks" that a process may request so it can do things atomically, and it may be that copying files requires more than a few atomic operations. But it will do its best to coordinate those requests with priority over the lifetime of the OS uptime.

Inspecting processes with top etc. doesn't tell you much about the internals of a process. It gives you a general picture of the overall state a few moments ago, and can help identify some general problems. But it shouldn't be used as a benchmark for processes, especially those that rely a lot on kernel operations.

In general, the scheduler operates within some parameters to balance resource requests and reduce contention (if possible) while optimizing execution. Copying files, especially across filesystems, is special in that there is a lot of coordination to be done across devices and kernel space to make sure things are safe as well. Copying a file is intended to be relatively bomb-proof, so in most cases there are locks and checks and retries that handle all the little things that can go wrong. There are going to be waits while the copy is in a critical section, and the UI has to be updated as well. So the entire system from UI/console to kernel to devices is involved.

I see you have mentioned laptop battery life in a comment (which should have been in the the question). This is a case where the copying operation just doesn't care. Copying files doesn't care about your battery. It is up to the scheduler/OS/kernel to throttle the resources available if the intention is to never spin the CPU high enough to require stepping to a higher power level.

Maybe the Linux kernel isn't good at this, or the Ubuntu free or non-free, properietary battery control devices and widgets aren't working for you. But this is a different issue, and could be seen with any process that needed the same resources as file copies or moves.

What we need is some sort of power stat tool that allows us to dig into the most power-hungry processes, like mobile phones have.

In fact, the system may already be throttling things so the CPU is in a lower power state, and the copies are taking longer as a result. That "90%" is a percentage of the total estimated available "CPU". It isn't a hard or even well-defined value.

(I'm also reminded at the power cost of operations in data centres, and disk seeks of any kind, even when cached in memory, are a huge part of the power cost and source of the waste heat!)

  • Thanks jdv. From what I understand from your post, this balance should show itself commonly by taking CPU... If so then why only I have the problem? – tr64 Oct 18 '18 at 17:27
  • You actually don't say what your problem is. Some process at 90% CPU utilization is not necessarily a problem is my point. – jdv Oct 18 '18 at 17:32
  • My problem is battery usage ... say I want to copy big files (30 gigabytes) to an external hard drive while I'm on battery...my battery drains very quickly!!! – tr64 Oct 18 '18 at 17:36
  • There is so much that can go wrong here. Assuming this is a USB connected drive, this drive may require lots of power. The USB hardware on the drive enclosure or the laptop may be interfering with CPU states in certain situations (like bulk transfers). This laptop may have a different idea of how to manage power states than another laptop, or the power management may be badly configured or not even running. But this is the sort of thing that needs to be made clear in the question. Also, batteries are consumables; it might just be on the downward end of its power curve or be a bad battery. – jdv Oct 18 '18 at 17:42
  • Ok, then. I think it's my laptop then... thanks anyway. I will get over this like the past four years. Thanks very much – tr64 Oct 18 '18 at 17:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.