NVIDIA Interview Question
InternsTeam: System Software
Country: United States
Interview Type: Phone Interview
It WILL be blocked if the thread is implemented as a user level thread and will NOT be blocked if it is implemented as a kernel level thread.
again stupid question.. what means "blocking entire process ?"
process consists of one or more threads. If, for example, a thread which processes the user input is busy on I/O then it would appear to the user that the process is "blocked".
It depends on your program logic if other threads should wait for the thread doing I/O operations at the moment..
"If, for example, a thread which processes the user input is busy on I/O then it would appear to the user that the process is blocked" -- The question is not about how the user "sees" it, but about what happens to the workload assigned to the rest of the threads, do they wait (by virtue of OS or something else) for this thread to finish, or do they carry on with their own business (assuming programmer has allowed them to do so).
The one by M@X above, "depends on which model of threads is used" is the right answer, as far as I know.
There are two types of threads-
1.user level threads ULT
they run in user mode
2.kernel level thread KLT
they run in kernel mode
Now if a ULT executes a blocking system call,all the threads of process are blocked.
However there is a technique 'jacketing' that can be used to convert a blocking system call to a non blocking system call.
In a KLT , blocking a thread does not block the whole process.
@siva.sai.2020 : It has nothing to do with the number of processors. If a thread or a process moves to a blocked state, then some other thread or process which is ready to run will be using the processor. It depends entirely the implementation of the threads, whether it is kernel level, user level or hybrid.
blocking of the entire process happens in ULT(user level thread) where the kernel is unaware about the process being split into two or more threads.
- Anonymous May 10, 2012