Question 1 |
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 the same process?
Page table base register | |
Stack pointer | |
Program counter | |
General purpose registers |
Question 1 Explanation:
Question 2 |
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:
[MSQ]
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?[MSQ]
Both P1 and P2 will print the value of x as 2. | |
At least 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. |
Question 2 Explanation:
Question 3 |
Which of the following is/are shared by all the threads in a process ?
I. Program counter
II. Stack
III. Address space
IV. Registers
I. Program counter
II. Stack
III. Address space
IV. Registers
I and II only | |
III only | |
IV only | |
III and IV only |
Question 3 Explanation:
Question 4 |
Threads of a process share
global variable but not heap. | |
heap but not global variables. | |
neither global variables nor heap. | |
Both heap and global variables. |
Question 4 Explanation:
Question 5 |
Which one of the following is FALSE?
User level threads are not scheduled by the kernel | |
When a user level thread is blocked, all other threads of its process are blocked. | |
Context switching between user level threads is faster than context switching between
kernel level threads. | |
Kernel level threads cannot share the code segment |
Question 5 Explanation:
There are 5 questions to complete.