LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-01-2021, 03:33 PM   #1
winger9
Member
 
Registered: Jan 2014
Posts: 85

Rep: Reputation: 1
Why does mouse and cursor movement become erratic when I copy an entire memory stick to another stick?


I copied a 16 GB USB memory stick to another 16 GB stick (cloned it), by using
the following command:

Code:
cp /dev/sdb /dev/sdd
It took about 27 minutes, and the cloning works. But during the entire copy
process, the mouse and cursor movement become erratic, and lag terribly. This
makes using the laptop during the copy almost impossible.

This happened to me on a previous occasion, so the effect is reproducible.

What causes this effect?
How do I stop the erratic behaviour?
Are you able to replicate the behaviour on your computer?
 
Old 09-01-2021, 03:40 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,011

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
Limited resource condition I assume.
 
Old 09-01-2021, 07:28 PM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
See the man pages for nice, renice and ionice.
 
Old 09-01-2021, 08:21 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,011

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
https://www.zylk.net/en/web-2-0/blog...-safer-than-cp

It boils down to laptop, usb and the copy program.
 
Old 09-01-2021, 09:35 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,249

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
I assume it's because the mouse and the USB drive are on the same USB bus, and the USB drive is saturating it.
 
Old 09-01-2021, 10:50 PM   #6
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,000

Rep: Reputation: 472Reputation: 472Reputation: 472Reputation: 472Reputation: 472
The kernel is swapping out programs to use memory for disk caching. You can lower the value of /proc/sys/vm/swappiness to as little as 1 to preclude this.

Code:
echo 1 > /proc/sys/vm/swappiness
Ed
 
Old 09-02-2021, 08:13 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,375
Blog Entries: 28

Rep: Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162
Quote:
I assume it's because the mouse and the USB drive are on the same USB bus, and the USB drive is saturating it.
I would second this suggestion. This issue actually came up in our virtual LUG meeting a couple of hours ago.
 
Old 09-08-2021, 10:48 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
As noted above, you can use "nice cp ..." to run this command. This voluntarily assigns the process a reduced priority, so that it will let other processes which are competing against it (such as your UI ...) "play through." (Which is, after all, a "nice, courteous" thing for resource-intensive processes to do ...)

Interestingly, my experience is that this really doesn't affect the completion time of most things very much. There's usually an abundance of CPU and I/O resources to spare. So, this command simply causes the "nice" process to step aside when challenged. When you move your mouse and the UI needs to redraw the mouse-pointer quickly, the "nice" activity doesn't get in the way.

Last edited by sundialsvcs; 09-08-2021 at 10:50 AM.
 
Old 09-08-2021, 02:16 PM   #9
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
That's where ionice comes in idoes the same thing as nice/renice but for io operations
 
Old 09-10-2021, 03:25 PM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Heartily agree with that. (I had overlooked "ionice.")

It certainly wouldn't hurt to say nice && ionice && cp ...

Last edited by sundialsvcs; 09-10-2021 at 03:27 PM.
 
1 members found this post helpful.
Old 09-12-2021, 12:19 AM   #11
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,814

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by EdGr View Post
The kernel is swapping out programs to use memory for disk caching.
That assumes that swap space was even allocated. If I got a nickel for every time I ran across a post on the 'Net effectively saying "Nah... you don't need swap".
 
Old 09-12-2021, 10:43 AM   #12
EdGr
Senior Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,000

Rep: Reputation: 472Reputation: 472Reputation: 472Reputation: 472Reputation: 472
Quote:
Originally Posted by rnturn View Post
That assumes that swap space was even allocated. If I got a nickel for every time I ran across a post on the 'Net effectively saying "Nah... you don't need swap".
Swapping is the most likely explanation. The kernel's default swappiness (60) is too high for desktop use. Desktop users need to lower the swappiness to prevent the kernel from swapping out programs during large file copies.

In contrast, lowering the priority is not likely to help because the OP's copy is transferring only 10MB/s (the speed of the USB flash). This rate is far too slow to saturate USB2 or anything else in the computer.
Ed
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Marble Mouse in Gentoo Erratic Movement illiadum Linux - Hardware 3 05-22-2006 06:54 AM
erratic mouse movement jnev Ubuntu 2 12-22-2005 04:20 PM
firefox erratic cursor behaviour Tuttle Linux - Software 1 03-17-2005 07:51 PM
Erratic Mouse / Cursor Behavior amocjr Linux - General 1 09-08-2003 03:44 AM
Mouse Movement slow and erratic on screen arun79 Linux - Hardware 2 06-26-2003 02:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration