Please answer the 4 multiple choice questions below: A thread attempting to secu
ID: 3675351 • Letter: P
Question
Please answer the 4 multiple choice questions below:
A thread attempting to secure a spin lock will remain in the run state during the time it takes to gain possession of the lock. True False Both processes and threads have various attributes as we've seen in chapter 3 Which of the following attributes is NOT a thread attribute: CPU general purpose register values run. ready and block states the active stack memory object the current address space Each thread of a given process has a LWP (Light Weight Process) identifier (sometimes called a thread-ID or TID), but they all share the same PID. True False A user thread running in user mode can never remain in user mode for very long. The thread will enter the kernel run state within a guaranteed maximum time span because: the CPU that it's running on will receive a clock interrupt random alpha particles raise exceptions on all CPUs every few milliseconds no thread can execute for more than a few instructions without causing an exception the thread is forced to make a system callExplanation / Answer
65) True
a spinlock is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. Since the thread remains active but is not performing a useful task, the use of such a lock is a kind of busy waiting. Once acquired, spinlocks will usually be held until they are explicitly released, although in some implementations they may be automatically released if the thread being waited on (that which holds the lock) blocks, or "goes to sleep".
66). the current address space
becuase threads share their address space of process, so it is not thread attribute, it is process attribute
67). True
here first and most important thing to realize is that "PID" means different things in kernel space and user space. What the kernel calls PIDs are actually kernel-level thread ids (often called TIDs), not to be confused with pthread_t which is a separate identifier. Each thread on the system, whether in the same process or a different one, has a unique TID (or "PID" in the kernel's terminology).
What's considered a PID in the POSIX sense of "process", on the other hand, is called a "thread group ID" or "TGID" in the kernel. Each process consists of one or more threads (kernel processes) each with their own TID (kernel PID), but all sharing the same TGID, which is equal to the TID (kernel PID) of the initial thread in which main runs.
68). the thread is forced to make a system call
User thread only enter in kernel mode if it invokes system call