Top 10 Downloads
  Last 15 New Files
  Web Links
  Last 15 New Tips
  NLM Programming
  Admins Club

SUPLA System
Internet of Things

Installation and Administration

Polish Forum SUSE

Who's Online

 There are currently,
6 guest(s)
that is (are) online.

Technical Information

Back to List of Categories

Technical Information about
  A Little YaST Magic
  A Slideshow for Your KDE Wallpaper
  Add Novell Support to Your Firefox Search Engine
  Adding To The Panels In Gnome.
  Akregator - RSS News Reader
  An Introduction to WBEM and OpenWBEM in SUSE LINUX
  Authenticating SUSE LINUX to eDirectory via LDAP
  Basic Mounting Differences between Windows and Linux
  Beginner's Guide to Using Novell SUSE LINUX's Build Utility
  Browsing Files
  Card Readers on SUSE LINUX 9.2 Professional?
  Changing the Default Browser in Gnome
  Developing Perl CGI scripts on SUSE LINUX
  Do I Have Permission?
  Double SYNC -- Using RSYNC Simultaneously With and Without Branch Office for Data Backup
  Dumb Question: Mounting Linux CDs
  Easy Command-Line Introduction
  Easy Way to Debug SSL Connections
  Enabling an Interactive Startup in Novell/SUSE LINUX
  Exploring MySQL 4.1 and PHP 5 on SUSE LINUX
  Extend Your Panels Using Gnome Drawers.
  Firefox Speed Tip
  Fix Java Errors With ConsoleOne On Linux
  Fix Your Mouse Wheel...
  Gimp -- Closing In on Photoshop...
  Gimp Tips Part 1: Resizing Images
  Gimp Tips Part 2: Rounding Corners
  Gimp Tips Part 3: Fading Photography Edges
  Gimp Tips Part 4: Selective Colorization
  Gimp Tips Part 5: Plugins a Plenty - Adding Light
  Gimp Tips Part 6: Using The Clone Tool
  Google Auto-fill Replica for Linux
  How a Corrupted USB Drive Was Saved by GNU/Linux
  How to Implement Login Scripts into a Pure Linux Environment
  How to install and connect an External Modem on a Linux PC
  How to Install the Novell Client for Linux on SUSE Linux 10.0
  How to launch applications at login in Gnome
  How to Remote Control Linux
  How to setup a Linux application to automatically startup when you login.
  How to share Files and Printers Between Linux and MS Windows with Samba
  How to uninstall the Novell Client for Linux
  How to upgrade the Novell Client for Linux
  How to use SMB without turning off the firewall
  How's the Weather?
  HTML Development Tools in Linux
  Informative Bash Prompt
  Install and Use QEMU on SUSE 9.2
  Install Linux Frequently, Without the Hassle
  Installing Apache, PHP, and MySQL on SUSE LINUX Professional
  Installing RPM Files
  Integrating Novell Linux Desktop into a Novell NetWare network
  Introduction to Oracle 10g R1 ( on SUSE LINUX Professional 9.3
  iPrint Printers on Novell Linux Desktop
  Linux Scheduling Priorities Explained
  Make a Misbehaving Program Quit
  Manually Mounting a USB Flash Drive in Linux
  Migrating To Linux, Advantages Over Windows 9.x And XP
  Minimize Your Maximizing with Multiple Desktops
  Mounting NetWare Volumes On NLD Illustrated
  Move Your /home to Another Computer
  Mozilla Mail Review
  Need a Backup?
  Novell Client Settings with Windows Terminal Server
  Novell Linux Desktop Equivalents of Windows Software - New and Improved
  Novell Linux Desktop System Upgrade How-To
  Partitioning Hard Drive for Linux Install
  Perform Remote SuSE Installations With Virtual Network Computing
  Quick Intro to Klipper
  Quick Shortcuts in The Gimp
  Reset Your Lost Root Password
  Resizing Your Gnome / KDE Panels
  Runlevels in SUSE LINUX
  Running Existing Win32 Applications on SUSE LINUX
  Service Command in /etc/init.d/
  Setting Shortcut Keys
  Setting up a Linux NFS Install Source for Your LAN
  Should I choose Novell Linux Desktop or SUSE LINUX Professional as my desktop?
  Starting Services From the Command Line On SuSE LINUX
  Sticky Notes for Gnome
  SUSE LINUX 9.3 Professional Review
  Sync Up The Taskbar and the Desktop in Gnome
  System Upgrade How-To
  Taking Screenshots in Linux
  The Basics of Messaging in the Cross-Platform GroupWise Client
  The Novell Client for Linux (beta).
  Transparent Panels in Gnome
  Trick Out Your KDE Desktop
  Understanding the YAST Software Module Options
  Updating Your Software with Red Carpet
  Using dsbk on Linux and Unix
  Using iFolder to Synchronize Firefox Bookmarks
  Using Multiple Swap Partitions In 2.4
  Using openSSH to Securely Access Remote Systems
  What FTP client should I use on Linux?
  What Is Logical Volume Management?
  What is so great about Firefox?
  Which Graphic Formats For What?
  Windows Shortcuts for Firefox Tabs on Linux
  Windows to Linux: A Beginner's Guide
  Windows Users Can Feel at Home Exploring Files in Linux
  WLAN interface as the Default
  Work With User Selection Icons In KDM
  YAST Online Update De-Mystified

Technical Information
 Linux Scheduling Priorities Explained

Printer-friendly version

Posted: 11 May 2005

Scheduling Priorities aren't something most people think much of when using a computer; but once in a while, they can come in very handy when trying to figure out why your system is running abnormally slow while multitasking.

the problem

Running a process that takes a long time to complete, and uses a large amount of system resources, while you try to use the computer for other things will most likely cause your computer to behave very slowly.

Example: I want to run a script that will take 2000 music files and convert them to oggs. When I run the program, it will undoubtedly take 100% of the CPU cycles, and will probably take quite a long time to complete the task. I still want to use my computer in the meantime, but running other programs will undoubtedly be a very slow process. What can I do to make things run faster?

the solution

First off, Linux isn't magic. It can't make your computer do everything faster at the same time, but it does have quite a powerful scheduling system that tells the computer what program has first priority on the CPU.

What this means, is when you are running two programs at the same time, and your CPU is being asked to do more than it can, it has to switch between the two programs while working 100% of the time.

With Linux, you can declare which programs have higher priority than others, and if done right, this could significantly improve the over all performance of your machine.

Let's go back to my example:

I want to convert all my music to oggs, but I want to be able to work on my computer at the same time, and have it run just as fast as it normally does. Is it possible? Yes.

In this scenario, I would simply tell Linux that I want the music converter to have the lowest priority possible. This means that anything else I run in the meantime will have a higher priority, and can push the converter aside, get done what needs to be done, and then give the CPU back to the converter.

This means it'll take a little bit longer to convert your music, but it also means your computer will do other tasks quickly.

It's kind of like being the CEO of some business, and having 20 people want to talk to you at the same time. Is it possible to understand them all at once? No. But you can tell certain people that they'll just have to wait while you get the more important issues resolved. Once they're resolved, you can go back to working on the lesser issues.

actually doing it

The Linux scheduler system is usually referred to as the "nice" system or "nice levels" and the way you use it is actually quite easy.

*note* - Under normal circumstances, most people shouldn't have to change the nice settings at all. Only set the nice level manually if you need to.

The nice levels go from -20 to 19.

-20 is the lowest nice level, which gives it the highest priority. 19 is the highest nice level, which gives it the lowest priority. Just think of the nice level as "The ability of the program to play nice with other programs." The higher the nice level, the more the program will get out of the way of other programs. The lower the nice level, the more it will stop other programs from using system resources.

If I were running a script named "song_converter.pl" which I wanted just to use spare CPU cycles, or have the lowest priority of system resources, I would put the nice level high by issuing the following command:

jason@Predator jason $ nice -n 19 song_converter.pl

That will set the priority of the song_converter.pl program to the absolute lowest.

If you try to run a program with a very high priority, you will have to be the root user, or you'll get a message saying permission has been denied:

jason@Predator jason $ nice -n -20 song_converter.pl
nice: cannot set priority: Permission denied

Setting programs to high nice levels is a pretty good way to let an application run harmlessly in the background for a long period of time without slowing down your computer when you want it to do other things.

Since 2003

Portal posiada akceptację firmy Novell Polska
Wszystkie materiały dotyczące produktów firmy Novell umieszczono za zgodą Novell Polska
Portal has been accepted by the Novell Polska
All materials concerning products of Novell firm are placed with Novell Polska consent.
NetWare is a registered trademark of Novell Inc. in the United States and other countries.
Windows is a trademark or a registered trademark of Microsoft Corporation in the United States and other countries.
Sybase is a registered trademark of Sybase Inc. in the United States of America.
Other company and product names are trademarks or registered trademarks of their respective owners.