Question 1
Which of the following statement(s) is/are correct in the context of CPU scheduling?
GATE CSE 2021,SET2 - [1Marks] (MSQ)
A. Turnaround time includes waiting time.
B. Round-robin policy can be used even when the CPU time required by each of the processes is not known apriori.
C. Implementing pre-emptive scheduling needs hardware support.
D. The goal is to only maximize CPU utilization and minimize throughput.
Question 2
Consider the following C program:
int main()
{
int i;
for(i=0; i<3; i++)
{
if (fork()==0)
{
continue;
}
else
{
break;
}
}
printf("Hello");
return 0;
}
Find how many times printf will execute.
(Note: Assume every call to fork successfully creates a child process.)
GATE CSE 2026, SET1 - [NAT]
4
Question 3
A CPU executes two types of processes.
New processes of type A arrive at times t=10,20,30,40,50 seconds.
New processes of type C arrive at times
t=11,22,33,44,55 seconds.
The CPU scheduling policy used is FCFS. The first process of type A starts execution at t=10 seconds.
The average waiting time of these 10 processes is ____ seconds.
GATE CSE 2026 , SET1 - [NAT]
9.5
Question 4
Which one or more of the following CPU scheduling algorithms can potentially cause starvation?
GATE CSE 2023, Set 1 - 1Marks (MSQ)
First-in First-Out
Round Robin
Priority Scheduling
Shortest Job First
Question 5
Which one or more of the following need to be saved on a context switch from one thread (T1) of a process to another thread (T2) of same process ?
GATE CSE 2023, Set 1 - 1Marks (MSQ)
Page Table base register
Stack pointer
Program Counter
General purpose register
Question 6
Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially a = b = 1. Though context switching between threads can happen at any time, each statement of T1 or T2 is executed atomically without interruption.
T1 T2
a = a + 1; b = 2 * b;
b = b + 1; a = 2 + a;Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?
GATE CS 2024 Set-1 - 2Marks (MCQ)
(a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3)
(a = 3, b = 4); (a = 4, b = 3); (a = 3, b = 3)
(a = 4, b = 4); (a = 4, b = 3); (a = 3, b = 4)
(a = 2, b = 2); (a = 2, b = 3); (a = 3, b = 4)
Question 7
Which of the following process state transition is/are NOT possible?
GATE 2024 Set 1 - 1 Marks (MCQ)
Ready to Waiting
Running to Ready
Running to Terminated
Waiting to Running
Question 8
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time.
A (0, 10), B (2, 6), C (4, 3), and D (6, 7).
Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?
GATE CS 2024, Set 2 - 2Marks (MCQ)
SRTF = 6, NP-SJF = 7
SRTF = 6, NP-SJF = 7.5
SRTF = 7, NP-SJF = 7.5
SRTF = 7, NP-SJF = 8.5
Question 9
Consider the following multi-threaded code segment (in a mix of C and pseudocode), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:
int x = 0; // global
Lock L1; // global
main() {
create a thread to execute foo(); // Thread T1
create a thread to execute foo(); // Thread T2
wait for the two threads to finish execution;
print (x);}
foo () {
int y = 0;
Acquire L1;
x = x + 1;
y = y + 1;
Release L1;
print (y);}
Which of the following statement(s) is / are correct?
GATE CSE 2021,SET2 - [2Marks] (MSQ)
At least one of P1 and P2 will print the value of x as 4.
At least one of the threads will print the value of y as 2.
Both T1 and T2, in both the processes, will print the value of y as 1.
Both P1 and P2 will print the value of x as 2.
Question 10
Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?
GATE CSE 2021, SET1 - [1Marks] (MSQ)
strlen
sleep
malloc
exit
There are 31 questions to complete.