Small problems in discussion of nice/renice (Chapter on processes)
The chapter on processes introduces nice and renice. I've understood this to set the niceness of a process. The higher the niceness (max 19), the less the priority and vice versa.
In the video the instructor uses ps lf to display running processes. There is a column headed NI which contains the niceness. The column preceding this one is labelled PRI, so I suppose it contains the priority values.
First, the output of renice -n 5 does not produce the output "old niceness 0, new niceness 5" but "old priority 0, new priority 5". When the instructor reissues the command ps lf, both priority and niceness have gone up by 5.
Second, the man page for nice says that issuing renice -n alters the scheduling priority. It seems, however, that it does not increment the niceness but sets its niceness to the value given, because the instructor then issues a sudo renice -5, which does not make the niceness go down again to 0 but sets it to -5. (And again the output is "old priority 5, new priority -5" instead of "niceness".)
I'm confused here. My man page says that renice used without -n alters the priority and not the niceness. And that if used with -n the value will be considered an increment, otherwise it will set the priority. [Note: I'm on BSD.]
Comments
-
[Note: I'm on BSD.]
Are you on a Linux system? I don't claim to understand any peculiarities of linux/bsd implementation differrences. In Linux, niceness and priority are directly related by mathematical formula and cannot be changed independently. i.e.,
static priority = 120 - nice value. Not very complicated. If you are not running on a Linux distribution, this is outside the course coverage.If there is a word confusion in the video, I would not pay much attention to it. It's not feasible to correct a word or two in a video,
and on long time intervals we redo them if there are important system changes or errors. (the whole video has to be redone.)
Trust the man pages and what we see on the command line when you do things.0 -
OK, thank you for the formula, that's nice :-)
The values used in the video do not conform to this formula, btw. He has prio 20 and niceness 0. 120 - 0 is 120. Maybe you wanted to type 20 and hit the 1 accidentally.I understand what you're saying about correcting mistakes in the videos, it's a lot of bother.
Still, what the instructor says contradicts what is displayed on his screen. (Not mine, his.) And as he's typing as he talks, that's really odd. So either the screen filming is fake, or the linux he uses works differently from all others.
He types renice +5 3077 which should either increase the niceness and decrease the prio, or decrease niceness and increase prio. His next command is ps and in this BOTH prio and niceness are INcreased. This makes no sense.Sorry to nag, but I'm like this. A long time ago I attended a workshop on programming Objective C, and the tutor demonstrated a bit of code that was full of holes, and I said, what happens when the user does (whatever it was)? And the tutor's comment was (jokingly): "Oh god, don't be so GERMAN!"
Sorry, I am, can't help it.0 -
Notice i said:
static priority = 120 - nice valuenot priority. This is the actual formula used in the kernel. The first 100 priorities (0-99) are used for "real-time" tasks and are scheduled rather differently (that's a whole other discussion) So the top program (and others) are subtracting out the 100 because it looks simpler , but technically the true internal priority is actually 100, not 0 by default. I don't have time to look at the video and see if it is messy or not, but I will at some point.
0
Categories
- All Categories
- 175 LFX Mentorship
- 175 LFX Mentorship: Linux Kernel
- 745 Linux Foundation IT Professional Programs
- 372 Cloud Engineer IT Professional Program
- 168 Advanced Cloud Engineer IT Professional Program
- 73 DevOps IT Professional Program - Discontinued
- 3 DevOps & GitOps IT Professional Program
- 98 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- AI & ML Training
- Blockchain & Decentralized Identity Training
- Cloud & Containers Training
- Cybersecurity Training
- DevOps & Site-Reliability Training
- Linux Kernel Development Training
- Networking Training
- Open Source Best Practice Training
- System Administration Training
- System Engineering Training
- Web & Application Development Training
- 2 LFD103-JP クラス フォーラム
- 4 LFD210-CN Class Forum
- 764 LFD259 Class Forum
- 681 LFS101 Class Forum
- 2 LFS158-JP クラス フォーラム
- 162 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 4 LFS207-JP クラス フォーラム
- 61 LFS241 Class Forum
- 52 LFS242 Class Forum
- 42 LFS243 Class Forum
- 19 LFS244 Class Forum
- 4 LFS250-JP クラス フォーラム
- 166 LFS253 Class Forum
- 19 LFS256 Class Forum
- 1.4K LFS258 Class Forum
- 165 LFS261 Class Forum
- 26 LFS267 Class Forum
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 768 Linux Distributions
- 81 Debian
- 67 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 106 Mobile Computing
- 18 Android
- 73 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 945 Programming and Development
- 310 Kernel Development
- 617 Software Development
- 977 Software
- 369 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)
