Direct the CPU
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 15 of 47
  1. #1
    Join Date
    Mar 2012
    Location
    Frankfurt
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Direct the CPU

    Can please somebody, how to contol the CPU. Very often I have more then 90% CPU, how can I stop this?

  2. #2
    Super Jamie Guest

    Re: Direct the CPU

    Open a terminal and run top to see what is using CPU time.

  3. #3
    Join Date
    Mar 2012
    Location
    Frankfurt
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    I can see it. Most times Mailing and Surfing.
    How can I limit the CPU ?
    Thank You for help.

  4. #4
    Join Date
    Aug 2009
    Location
    Waldorf, Maryland
    Posts
    7,345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    ??? Don't use email, and don't surf the net so much.???

  5. #5
    Join Date
    Aug 2011
    Location
    North Carolina
    Age
    52
    Posts
    2,412
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Quote Originally Posted by matheandcreate
    I can see it. Most times Mailing and Surfing.
    Quote Originally Posted by jpollard
    ??? Don't use email, and don't surf the net so much.???
    Funny And I am wondering your hard ware specs?

    I have 64-bit Ubuntu 14.04 (Unity) on a Lenovo Thinkpad T400 (Centrino 2 with 2GB of RAM) - With Firefox web browser and Thunderbird email client going, I'm using 58% of my RAM and 30% of my dual core processor.

    I would guess run away system service, or your hardware is tight
    On quest for blue smoke and red rings...

  6. #6
    Join Date
    Jul 2005
    Location
    RainCity
    Posts
    1,885
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Quote Originally Posted by BBQdave
    I have 64-bit Ubuntu 14.04 (Unity) on a Lenovo Thinkpad T400
    I've had a T400 for a couple of months now, and was convinced it was a 32 bit chip. I just confirmed it with lshw, thanks for the wake-up.

  7. #7
    Join Date
    Apr 2014
    Location
    Toronto, Ontario, Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Quote Originally Posted by matheandcreate
    I can see it. Most times Mailing and Surfing.
    How can I limit the CPU ?
    Thank You for help.
    "nice" and "ulimit". The "r" key in top.

  8. #8
    Join Date
    Apr 2014
    Location
    Sweden
    Age
    50
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Have you checked wether it is running at full frequency when the load is high?
    My system often lock to lower frequency at high load
    Maybe you have a similar problem?
    http://forums.fedoraforum.org/showthread.php?p=169767

  9. #9
    Join Date
    Mar 2012
    Location
    Frankfurt
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Quote Originally Posted by fredweigel
    "nice" and "ulimit". The "r" key in top.
    I tried
    nice
    a little of a little bit better.

    What does mean the r?

    Thank You for help.

    Question again:
    Can I limit tasks
    so they can only use 80% of the CPU?

    So no frozen.
    Hardware is fine 4 GB or more.

  10. #10
    Join Date
    Oct 2010
    Location
    Canberra
    Posts
    3,220
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)

    Re: Direct the CPU

    Quote Originally Posted by matheandcreate
    What does mean the r?
    He is referring to pressing the r key while running top - this will allow you to enter a number to change the nice value for a process identifier (pid).

    Unfortunately a process will use all available CPU even when it has a high nice value - it just gets swapped out more easily so that other processes can run.

    Question again:
    Can I limit tasks
    so they can only use 80% of the CPU?

    So no frozen.
    Yes, but not very easily. There are programs like cpulimit that can do this: https://github.com/opsengine/cpulimit
    but it may not be in the repositories so you may have to build it yourself.

    These programs will work by pausing the process at regular intervals. Be careful that the intervals are not too long or you will applying a lot of thermal cycling to your CPU which will probably not be good for it.

    User error. Please replace user and try again

  11. #11
    Join Date
    Mar 2012
    Location
    Frankfurt
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    It is difficult.
    Thank You.
    Nice is improving the situation,
    but not solving.
    Question: Linux is an Operation System.
    Linux is an Multiuseroperation System.
    OK
    So is this wrong: The admin must be able
    to give and limit ressources of the whole group.
    Is this right?
    Is there a way to manage
    priority
    CPU
    space
    and I/O in Linux?


    Thank You for help.

  12. #12
    Join Date
    Apr 2014
    Location
    Toronto, Ontario, Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Actually, this is a more complicated problem!

    Good that "nice" is working for you. Try "nice -n 19" for maximum "niceness". Now for the problem.

    First, if the job you are running is NOT competing for CPU with other jobs, there is no reason to
    NOT give it as much CPU as it wants. Specifically, this strategy can allow the job to be complete
    EARLIER, resulting in more future availability.

    "nice" only does something IF the job is competing. It gives a hint to the OS to give less CPU to the job you have decided to apply "nice" to.

    To impose limts, you would use "ulimit"

    ulimit -t 10

    sets the maximum allowed cpu seconds applied to the job to 10. ulimit -a will report all limits.
    For example:

    [fred@dejah bin]$ ulimit -a
    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 0
    file size (blocks, -f) unlimited
    pending signals (-i) 30009
    max locked memory (kbytes, -l) 64
    max memory size (kbytes, -m) unlimited
    open files (-n) 1024
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 8192
    cpu time (seconds, -t) 10
    max user processes (-u) 1024
    virtual memory (kbytes, -v) unlimited
    file locks (-x) unlimited
    [fred@dejah bin]$

    Now, it is possible to control resources at even a finer level. taskset will allow you to assign jobs to specific cpus. "man taskset" for details. The chrt command "man chrt" will allow you
    to do things like set a job to run ONLY if the system is otherwise idle... "super nice" if you will.

    Generally, "nice" is good (or, ulimit with nice, say "ulimit -e 8"). Do this very early. Or, if your user name is "fred", try "sudo renice +10 -u fred".

    Try the "sar" command (system activity report). This is an old-school Unix command (like nice and ulimit). Probably in package sysstat (try "what whatprovides */sar"). Once loaded, every few minutes your system utilization will be gathered and reported. Daily reports will be available. These are saved in /var/log/sa. Prune the files when you no longer need the data.

    For example, from my system.
    [fred@dejah sa]$ sar
    Linux 3.14.2-200.fc20.x86_64 (dejah) 07/05/14 _x86_64_ (4 CPU)

    12:00:01 AM CPU %user %nice %system %iowait %steal %idle
    12:10:01 AM all 3.87 0.00 2.01 0.08 0.00 94.05
    12:20:01 AM all 4.86 0.00 2.24 0.20 0.00 92.70
    12:30:01 AM all 3.74 0.00 1.98 0.07 0.00 94.21
    12:40:01 AM all 3.92 0.00 2.09 0.07 0.00 93.92
    12:50:01 AM all 9.82 0.11 3.62 0.62 0.00 85.82
    01:00:01 AM all 13.99 0.02 6.83 1.43 0.00 77.72
    01:10:01 AM all 16.85 0.01 6.35 1.49 0.00 75.31
    01:20:01 AM all 18.76 0.00 7.19 1.66 0.00 72.39
    01:30:01 AM all 24.67 0.00 7.00 1.70 0.00 66.62
    01:40:01 AM all 22.74 0.13 5.96 1.76 0.00 69.41
    01:50:01 AM all 17.88 0.00 5.33 2.46 0.00 74.34
    02:00:01 AM all 16.28 0.02 4.05 1.82 0.00 77.83
    02:10:01 AM all 13.19 0.25 3.00 0.34 0.00 83.22
    02:20:01 AM all 13.45 0.00 3.85 2.22 0.00 80.48
    02:30:01 AM all 16.26 0.00 4.06 2.02 0.00 77.66
    02:40:01 AM all 17.44 0.09 3.59 1.50 0.00 77.38
    02:50:01 AM all 21.74 0.00 4.66 2.49 0.00 71.12
    03:00:01 AM all 22.64 0.07 4.60 2.20 0.00 70.49
    03:10:02 AM all 15.54 0.09 4.31 2.21 0.00 77.85
    03:20:01 AM all 12.61 1.41 3.41 1.38 0.00 81.18
    Average: all 14.50 0.11 4.31 1.38 0.00 79.70
    [fred@dejah sa]$

    sar can report by CPU, paging activity, i/o activity -- try it.

    Fred Weigel

    PS. the "r" key is available when you are running "top", instead of having to leave "top"
    to issue a "renice" command.

    If you need to dive into overriding the scheduler (and, be careful, the system is actually
    very very good at scheduling jobs), it is possible to control CPU affinity, and to control
    things at a very low level. Usually, this would be if (for example), you needed real-time or
    near real-time response. One or more CPU cores can be dedicated to a job, and the job
    boosted into RT (realtime) priority. Of course, those cores are NOT AVAILABLE for anything
    else! Or, processes could be put into idle-time. Do ANYTHING else, and they would no
    longer run (usually, we consider this "BATCH"). Try "man batch" and "man at".

    And yes, you could assign a job 80% of a CPU. That is a bit tricky, so I will give you some
    "background reading". This is done with "control groups":

    http://en.wikipedia.org/wiki/Cgroups

    If you want more infomation on this let me know. But, first, detail what you are trying to accomplish.

  13. #13
    Join Date
    Apr 2014
    Location
    Toronto, Ontario, Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Continuing my answer... How to give a process 80% of a CPU. Typically, the question would then become "which process". On my tablet riight now, there are over 200 processes:

    ps ax results in

    PID TTY STAT TIME COMMAND
    1 ? Ss 0:05 /usr/lib/systemd/systemd --switched-root --system --deserialize 23
    ..snip...
    1034 ? S 0:00 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432
    1060 ? Ss 0:00 postgres: logger process
    1068 ? S< 0:00 [kworker/3:1H]
    1075 ? Ss 0:00 postgres: checkpointer process
    1076 ? Ss 0:00 postgres: writer process
    1077 ? Ss 0:00 postgres: wal writer process
    1078 ? Ss 0:00 postgres: autovacuum launcher process
    1079 ? Ss 0:01 postgres: stats collector process
    1086 ? S 0:00 /usr/sbin/httpd -DFOREGROUND
    1088 ? S 0:00 /usr/sbin/httpd -DFOREGROUND
    1089 ? S 0:00 /usr/sbin/httpd -DFOREGROUND
    1090 ? S 0:00 /usr/sbin/httpd -DFOREGROUND
    1091 ? S 0:00 /usr/sbin/httpd -DFOREGROUND
    1116 ? Sl 0:00 gdm-session-worker [pam/gdm-launch-environment]
    1148 ? Ss 0:00 /usr/lib/systemd/systemd --user
    1151 ? S 0:00 (sd-pam)
    1231 ? Ssl 0:03 /usr/libexec/upowerd
    1422 ? Ssl 0:00 /usr/libexec/colord
    1586 ? Ssl 0:22 /usr/lib/udisks2/udisksd --no-debug
    1757 ? Sl 0:00 gdm-session-worker [pam/gdm-password]
    1808 ? S 0:00 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-wlp1s0.pid -lf /var/lib/NetworkManager/dhclient-2ae1694a-e193-4724-8a3d-305a0b526cf3-wlp1s0.lease -cf /var/lib/NetworkManager/dhclient-wlp1s0.conf wlp1s0
    1834 ? Ss 0:02 sendmail: accepting connections
    1859 ? Ss 0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
    1872 ? Ss 0:00 /usr/lib/systemd/systemd --user
    1873 ? S 0:00 (sd-pam)
    1949 ? SNs 0:00 /usr/lib/systemd/systemd --user
    1950 ? SN 0:00 (sd-pam)
    1954 ? SNl 0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
    2014 ? SNsl 0:00 gnome-session
    2022 ? SN 0:00 dbus-launch --sh-syntax --exit-with-session
    2023 ? SNs 0:02 /bin/dbus-daemon --fork --print-pid 4 --print-address 6 --session
    2059 ? SNl 0:00 /usr/libexec/at-spi-bus-launcher
    2063 ? SN 0:57 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
    2066 ? SNl 0:23 /usr/libexec/at-spi2-registryd --use-gnome-session
    2073 ? SNl 0:00 /usr/libexec/gvfsd
    2077 ? SNl 0:00 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
    2097 ? SNl 0:08 /usr/libexec/gnome-settings-daemon
    2101 ? SNl 3:32 /usr/bin/pulseaudio --start
    2116 ? SN 0:00 /usr/libexec/pulse/gconf-helper
    2123 ? SNl 0:01 /usr/libexec/gvfs-udisks2-volume-monitor
    2129 ? SNl 0:00 /usr/libexec/gvfs-afc-volume-monitor
    2134 ? SNl 0:00 /usr/libexec/gvfs-mtp-volume-monitor
    2138 ? SNl 0:00 /usr/libexec/gvfs-goa-volume-monitor
    2141 ? SNl 0:03 /usr/libexec/goa-daemon
    2146 ? SNl 0:02 /usr/libexec/mission-control-5
    2153 ? SNl 0:00 /usr/libexec/gvfs-gphoto2-volume-monitor
    2167 ? SNl 0:00 /usr/libexec/gsd-locate-pointer
    2171 ? SNl 7:03 mousetweaks
    2175 ? Ss 0:00 /usr/sbin/cupsd -f
    2186 ? SNl 0:00 /usr/libexec/gsd-printer
    2199 ? SNl 0:00 /usr/libexec/dconf-service
    2223 ? SNl 0:01 /usr/bin/ibus-daemon --replace --xim --panel disable
    2227 ? SNl 0:00 /usr/libexec/ibus-dconf
    2229 ? SNl 0:00 /usr/libexec/ibus-x11 --kill-daemon
    2241 ? SNl 0:00 /usr/libexec/gnome-shell-calendar-server
    2247 ? SNl 0:00 /usr/libexec/evolution-source-registry
    2255 ? SNl 0:00 /usr/libexec/ibus-engine-simple
    2283 ? SNl 0:11 florence
    2287 ? SNl 0:01 abrt-applet
    2291 ? SNl 0:09 /usr/libexec/tracker-miner-fs
    2292 ? SNl 0:00 /usr/bin/gnome-software --gapplication-service
    2294 ? SNl 0:07 nm-applet
    2299 ? SNl 0:01 /usr/libexec/evolution/3.12/evolution-alarm-notify
    2310 ? SNl 0:22 /usr/libexec/tracker-store
    2315 ? SNl 0:16 /usr/bin/rygel
    2316 ? SNl 0:19 easystroke
    2320 ? SNl 0:01 cryptkeeper
    2333 ? SNsl 0:34 /home/fred/.dropbox-dist/dropbox
    2388 ? SNl 0:01 /usr/libexec/evolution-calendar-factory
    2440 ? SNl 0:00 /usr/libexec/gvfsd-trash --spawner :1.5 /org/gtk/gvfs/exec_spaw/0
    2482 ? SNl 0:00 /usr/libexec/gvfsd-metadata
    2490 ? SNl 0:00 /usr/libexec/gvfsd-burn --spawner :1.5 /org/gtk/gvfs/exec_spaw/1
    2946 ? SN 0:00 dbus-launch --autolaunch cff9a9d93b46432bba4cc0242c36d194 --binary-syntax --close-stderr
    2947 ? SNs 0:00 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
    2982 ? SNl 5:09 /usr/libexec/gnome-terminal-server
    2985 ? SN 0:00 gnome-pty-helper
    3035 ? S< 0:00 [cifsiod]
    3039 ? S 0:06 [cifsd]
    ...snip...
    28823 pts/3 RN+ 0:00 ps ax
    28824 pts/3 SN+ 0:00 xclip -selection clipboard

    Notice that I am running a web server (httpd) and a database server (postgresql), gnome 3.12
    desktop, totem video player, all on an Intel i3 with 4GB of RAM. And Firefox and Nautilus. No swap yet (3.5GB of RAM in use). CPU load is quite low.

    With this data, and my historical sar data, I may be able to determine if second-guessing the OS scheduling is appropriate. Usually it's not. There is a complementary technology called "containers" which is lightweight virtualization. Basically, a container is another linux running on linux (that can even share the same OS files). Containers allow you to group the pieces needed for a complete job, reducing the "ps" output. For example, I could assign postgres database server into a container and control that with cgroups.

  14. #14
    Join Date
    Oct 2010
    Location
    Canberra
    Posts
    3,220
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)

    Re: Direct the CPU

    For storage you can use disk quotas:
    http://www.linux.com/learn/tutorials...uotas-in-linux

    The ulimit command can put some limits on a user - the most useful is a limit to the number of processes to prevent "fork bombs".

    Process priority can be controlled via nice, or ulimit. As we have previously discussed a limit on CPU usage is a bit more difficult.

    Network I/O can be managed in many ways - I found this which is a bit old now, but might be of assistance:
    http://www.tldp.org/HOWTO/html_singl...Control-HOWTO/

    User error. Please replace user and try again

  15. #15
    Join Date
    Mar 2012
    Location
    Frankfurt
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Direct the CPU

    Quote Originally Posted by fredweigel
    Actually, this is a more complicated problem!

    Good that "nice" is working for you. Try "nice -n 19" for maximum "niceness". Now for the problem..

    God morning.
    Thank You for Your friendly and patient post.
    I shall print this thread, I shall study it, and I shall answer tomorrow.

    One question more:
    Did not I need "limits" when I shall use Eclipse, because writing software creates many mistakes.
    Regards
    matheandcreate

Page 1 of 4 1 2 3 ... LastLast

Similar Threads

  1. Replies: 1
    Last Post: 25th April 2011, 07:03 PM
  2. /proc/cpu info reports erroneous cpu speed
    By parish in forum Using Fedora
    Replies: 4
    Last Post: 23rd February 2008, 08:03 AM
  3. Dual-Core CPU Not Recognized as 2 CPU's by top/System Monitor?
    By ThinkOpen in forum Hardware & Laptops
    Replies: 8
    Last Post: 3rd July 2007, 11:05 PM
  4. Replies: 6
    Last Post: 24th February 2006, 01:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •