- Perl Basics
- Perl - Home
- Perl - Introduction
- Perl - Environment
- Perl - Syntax Overview
- Perl - Data Types
- Perl - Variables
- Perl - Scalars
- Perl - Arrays
- Perl - Hashes
- Perl - IF...ELSE
- Perl - Loops
- Perl - Operators
- Perl - Date & Time
- Perl - Subroutines
- Perl - References
- Perl - Formats
- Perl - File I/O
- Perl - Directories
- Perl - Error Handling
- Perl - Special Variables
- Perl - Coding Standard
- Perl - Regular Expressions
- Perl - Sending Email
- Perl Advanced
- Perl - Socket Programming
- Perl - Object Oriented
- Perl - Database Access
- Perl - CGI Programming
- Perl - Packages & Modules
- Perl - Process Management
- Perl - Embedded Documentation
- Perl - Functions References
- Perl Useful Resources
- Perl - Questions and Answers
- Perl - Quick Guide
- Perl - Useful Resources
- Perl - Discussion
Perl setpriority Function
Description
This function sets the priority for a process (PRIO_PROCESS), process group (PRIO_PGRP), or user (PRIO_USER). The argument WHICH specifies what entity to set the priority for, and WHO is the process ID or user ID to set. A value of 0 for WHO defines the current process, process group, or user. Produces a fatal error on systems that don.t support the system setpriority( ) function.
The priority is a number representing the level of priority (normally in the range 120 to 20) where the lower the priority the more favorable the scheduling of the process by the operating system.
Syntax
Following is the simple syntax for this function −
setpriority WHICH, WHO, PRIORITY
Return Value
This function does not return any value.
Example
Following is the example code showing its basic usage −
#!/usr/bin/perl print("setpriority() ", setpriority(0, 0, -20), "\n");
When above code is executed, it produces the following result −
setpriority() 0