Given below are two statements : Statement (I) : A thread is a dispatchable…

2023

Given below are two statements :

Statement (I) : A thread is a dispatchable unit of work that does not executes sequentially and is not interruptible

Statement (II) : It is not possible to alter the behaviour of a thread by altering its context when thread is suspended

In the light of the above statements, choose the most appropriate answer from the options given below :

  1. A.

    Both Statement I and Statement II are correct

  2. B.

    Both Statement I and Statement II are incorrect

  3. C.

    Statement I is correct but statement II are incorrect

  4. D.

    Statement I is incorrect but statement II are correct

Attempted by 293 students.

Show answer & explanation

Correct answer: B

Answer: Both statements are incorrect.

Why Statement (I) is incorrect:

  • A thread is a schedulable (dispatchable) unit of execution that has its own sequential flow of control: the thread's instructions execute one after another.

  • Threads are generally interruptible or preemptible by the operating system scheduler; they are not inherently uninterruptible.

Why Statement (II) is incorrect:

  • When a thread is suspended, its execution context (registers, program counter, stack pointer, etc.) is saved. Modifying this saved context will change what the thread does when it is resumed.

  • Debuggers commonly alter a suspended thread's context (for example changing the program counter) to change or inspect behaviour, demonstrating that altering context does affect execution.

Therefore, both statements are false.

Explore the full course: Mppsc Assistant Professor