432 is lwp in kernel address space or in user address

This preview shows page 21 - 25 out of 33 pages.

4.3.2. Is LWP in kernel address space or in user address space?
Image of page 21

Subscribe to view the full document.

22 It depends on implementation: User address space: An LWP is visible within a process to the application. Thus, LWP data structures exist within their respective process address space. At the same time, each LWP is bound to a single dispatchable kernel thread, and the data structure for that kernel thread is main tained within the kernel’s address space. Kernel address space: ULT library makes system call to request LWPs from the kernel. A process may consist of a single ULT bound to a single LWP. In this case, there is a single thread of execution, corresponding to a traditional UNIX process. When concurrency is not required within a single process, an application uses this process structure. If an application requires concurrency, its process contains multiple threads, each bound to a single LWP, which in turn are each bound to a single kernel thread. In addition, there are kernel threads that are not associated with LWPs. The kernel creates, runs, and destroys these kernel threads to execute specific system functions. The use of kernel threads rather than kernel processes to implement system functions reduces the overhead of switching within the kernel (from a process switch to a thread switch). Figure 4.6 (Revisit Figure 2.5): Process Structure in UNIX and Solaris Figure 4.6 compares, in general terms, the process structure of a traditional UNIX system with that of Solaris. On a typical UNIX implementation, the process structure includes the process ID; the user IDs; a signal dispatch table, which the kernel uses to decide what to do when sending a signal to a process; file descriptors, which describe the state of files in use by this process; a memory map, which defines the address space for this process; and a processor state structure, which includes the kernel stack for this
Image of page 22
23 process. Solaris retains this basic structure but replaces the processor state block with a list of structures containing one data block for each LWP. The LWP data structure includes the following elements: An LWP identifier The priority of this LWP and hence the kernel thread that supports it A signal mask that tells the kernel which signals will be accepted Saved values of user-level registers (when the LWP is not running) The kernel stack for this LWP, which includes system call arguments, - results, and - error codes for each call level Resource usage and profiling data Pointer to the corresponding kernel thread Pointer to the process structure Figure 4.7: Solaris Thread States (Solaris 10) 1:1 mapping between ULTs and LPWs
Image of page 23

Subscribe to view the full document.

24 Figure 4.8: Solaris ULTs and LWT States (Solaris 8, 9) Let us assume L represents number of LWPs and U represents the number of ULTs. No benefit to having L > U If U > L, some threads may have to wait for an LWP to run o Active thread - executing on an LWP o Runnable thread - waiting for an LWP Executing synchronous system call blocks LWP o Need at least k LWPs to allow k concurrent I/O operations Blocking on synchronization mutex, condition variable) - LWP switches to run another thread If N CPUs, need at least N LWPs to keep them all busy Kernel may take away LWPs if some are idle for a long time, or allocate more LWPs as needed 4.3.3. Combination of 1:1 and M:N models
Image of page 24
Image of page 25
You've reached the end of this preview.
  • Spring '12
  • GwangS.Jung

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern