Q24
Which of the following statements about threads is/are TRUE?
More than one option can be correct.
Show answer without attempting
Answer: D
GATE CS · Processes and Threads · 6 questions
6 Threads questions from GATE CS papers, each with the official answer key. Part of Processes and Threads. Answer any question right here and it is marked straight away, or practise them one at a time.
Answer: D
Answer: B, C, D
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);}Answer: A, D
Answer: D
Answer: B
Answer: D
0/60 correct0 marks