The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+25 votes
2.7k views

Which one of the following is FALSE?

  1. User level threads are not scheduled by the kernel.
  2. When a user level thread is blocked, all other threads of its process are blocked.
  3. Context switching between user level threads is faster than context switching between kernel level threads.
  4. Kernel level threads cannot share the code segment.
asked in Operating System by Veteran (99.8k points) | 2.7k views

2 Answers

+32 votes
Best answer

(D) is the answer. Threads can share the Code segments. They have only separate Registers and stack.

User level threads are scheduled by the thread library and kernel knows nothing about it. So, A is TRUE. 

When a user level thread is blocked, all other threads of its process are blocked. So, B is TRUE. (With a multi-threaded kernel, user level threads can make non-blocking system calls without getting blocked. But in this option, it is explicitly said 'a thread is blocked'.)

Context switching between user level threads is faster as they actually have no context-switch- nothing is saved and restored while for kernel level thread, Registers, PC and SP must be saved and restored. So, C also TRUE. 

Reference: http://www.cs.cornell.edu/courses/cs4410/2008fa/homework/hw1_soln.pdf

answered by Loyal (7.6k points)
edited by
+11
This is an ambiguos question. I think B and D both should be answer.
D , obviosly true
In case of B, the statement is not always true and depends on the model being used.i.e ,if one to one OR many to many model is used ,then the statement is false.
+13

Yes @Hcas you are TRUE . Blocking a user level threads blocks all user threads ONLY in many-to-one threading model. For other models like one-to-one it is not true.

But generally, not in all the general purpose processor we have this feature of running a kernel level  thread for every user thread that  runs. Hence (D) is  more STRONGER and UNIVERSAL answer for the time being unless threading model is explicitly stated.

0
ok.. thanks bro :)
0

From the Galvin:

Many to one model

  • Maps many user level threads to one kernel thread
  • Thread library in user space provides thread management
  • If thread makes a blocking system call, the entire process will be blocked.

One ot one model

  • Maps each user thread to kernel level thread
  • Kernel provides full thread support (Makes Option A wrong)
  • If one thread makes a blocking system call, other threads can continue to run  (Makes Option B wrong)
+15 votes
USER LEVEL THREAD KERNEL LEVEL THREAD
User thread are implemented by user processes. kernel threads are implemented by OS.
OS doesn’t recognized user level threads. Kernel threads are recognized by OS.
Implementation of User threads is easy. Implementation of Kernel thread is complicated.
Context switch time is less. Context switch time is more.
Context switch requires no hardware support. Hardware support is needed.
If one user level thread perform blocking operation then entire process will be blocked. If one kernel thread perform blocking operation then another thread can continue execution.
Example : Java thread, POSIX threads. Example : Window Solaris.
answered by Loyal (8.3k points)
0
Good Information
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

38,009 questions
45,507 answers
131,662 comments
48,695 users