Open In App

Python | os.sched_rr_get_interval() method

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
OS module contains some methods which provides an interface to the scheduler and used to control how a process is allocated CPU time by the operating system. 
os.sched_rr_get_interval() method in Python is used to get the Round Robin quantum in seconds for the process indicated by the specified process id.
What is Round Robin quantum? 
In the Round-Robin scheduling policy, processes are dispatched in a FIFO manner but are given a limited amount of CPU time called a time-slice or a quantum
Note: This method is only available on some UNIX platforms.
 

Syntax: os.sched_rr_get_interval(pid) 
Parameter: 
pid: The process id of the process whose Round Robin quantum value is required. A pid of 0 represents the calling process. 
Return Type: This method returns an float value which represents the Round Robin quantum in seconds. 
 


Code: Use of os.sched_rr_get_interval() method 
 

Python3
# Python program to explain os.sched_rr_get_interval() method  

# importing os module 
import os

# get the Round-Robin time quantum
# of the current process
# A pid of 0 represents the
# the calling process 
pid = 0
quantum = os.sched_rr_get_interval(pid)

# print round robin time quantum
print("Round Robin time quantum (in seconds):", quantum)

Output: 
Round Robin time quantum (in seconds): 0.016

 

References: https://docs.python.org/3/library/os.html#os.sched_rr_get_interval
 


Next Article
Article Tags :
Practice Tags :

Similar Reads

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy