Thread
Q1.
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: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]Q2.
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?Q3.
Which of the following is/are shared by all the threads in a process ? I. Program counter II. Stack III. Address space IV. RegistersQ4.
Let the time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE?Q6.
Consider the following statements about user level threads and kernel level threads. Which one of the following statements is FALSE?Q7.
A thread is usually defined as a 'light weight process' because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the followings is TRUE?Q9.
Consider the following statements with respect to user-level threads and kernel-supported threads (i) context switch is faster with kernel-supported threads (ii) for user-level threads, a system call can block the entire process (iii) Kernel supported threads can be scheduled independently (iv) User level threads are transparent to the kernel Which of the above statements are true?