GATE CS 2025 (Forenoon) — Question 29

Operating Systems (OS)CPU and I/O SchedulingNAT1 markMedium

Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is ________. (Answer in integer)
c
1int main( )
2{
3    int x = 0, i = 0;
4    scanf("%d", &x);
5    for(i = 0; i < 20; i++)
6    {
7        x = x + 20;
8        printf("%d\n", x);
9    }
10    return 0;
11}
12
Practise the full 2025-FN paper
Challenge a friend: WhatsApp Telegram
Recommended book · affiliate linkOperating System Concepts (Galvin)Scheduling, synchronisation, deadlocks, memory and file systems.
Practise more on CPU and I/O SchedulingTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group