Subversion Repositories HelenOS-doc

Rev

Rev 57 | Rev 59 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 57 Rev 58
Line 40... Line 40...
40
    <para>The most narrow sence refers to the the synchronous register
40
    <para>The most narrow sence refers to the the synchronous register
41
    context. It includes all the preserved registers as defined by the
41
    context. It includes all the preserved registers as defined by the
42
    architecture. To highlight some, the program counter and stack pointer
42
    architecture. To highlight some, the program counter and stack pointer
43
    take part in the synchronous register context. These are the registers
43
    take part in the synchronous register context. These are the registers
44
    that must be preserved across a procedure call and during synchronous
44
    that must be preserved across a procedure call and during synchronous
45
    context switches. </para>
45
    context switches.</para>
46
 
46
 
47
    <para>The next type of the context understood by the kernel is the
47
    <para>The next type of the context understood by the kernel is the
48
    asynchronous register context. On an interrupt, the interrupted execution
48
    asynchronous register context. On an interrupt, the interrupted execution
49
    flow's state must be guaranteed to be eventually completely restored.
49
    flow's state must be guaranteed to be eventually completely restored.
50
    Therefore the interrupt context includes, among other things, the scratch
50
    Therefore the interrupt context includes, among other things, the scratch
Line 101... Line 101...
101
      returned.</para>
101
      returned.</para>
102
    </section>
102
    </section>
103
  </section>
103
  </section>
104
 
104
 
105
  <section>
105
  <section>
106
    <title>Scheduler</title>
106
    <title>Threads</title>
107
 
107
 
-
 
108
    <para>A thread is the basic executable entity with some code and stack.
-
 
109
    While the code, implemented by a C language function, can be shared by
-
 
110
    several threads, the stack is always private to each instance of the
-
 
111
    thread. Each thread belongs to exactly one task through which it shares
-
 
112
    address space with its sibling threads. Threads that execute purely in the
-
 
113
    kernel don't have any userspace memory allocated. However, when a thread
-
 
114
    has ambitions to run in userspace, it must be allocated a userspace stack.
-
 
115
    The distinction between the purely kernel threads and threads running also
-
 
116
    in userspace is made by refering to the former group as to kernel threads
-
 
117
    and to the latter group as to userspace threads. Both kernel and userspace
-
 
118
    threads are visible to the scheduler and can become a subject of kernel
-
 
119
    preemption and thread migration during times when preemption is
-
 
120
    possible.</para>
-
 
121
 
-
 
122
    <para>HelenOS userspace layer knows even smaller units of execution. Each
-
 
123
    userspace thread can make use of an arbitrary number of pseudo threads.
-
 
124
    These pseudo threads have their own synchronous register context,
-
 
125
    userspace code and stack. They live their own life within the userspace
108
    <para>How scheduler designed and how it works.</para>
126
    thread and the scheduler does not have any idea about them because they
-
 
127
    are completely implemented by the userspace library. This implies several
-
 
128
    things:</para>
-
 
129
 
-
 
130
    <itemizedlist>
-
 
131
      <listitem>
-
 
132
        <para>pseudothreads schedule themselves cooperatively within the time
-
 
133
        slice given to their userspace thread,</para>
-
 
134
      </listitem>
-
 
135
 
-
 
136
      <listitem>
-
 
137
        <para>pseudothreads share FPU context of their containing thread
-
 
138
        and</para>
-
 
139
      </listitem>
-
 
140
 
-
 
141
      <listitem>
-
 
142
        <para>all pseudothreads of one userspace thread block when one of them
-
 
143
        goes to sleep.</para>
-
 
144
      </listitem>
-
 
145
    </itemizedlist>
-
 
146
 
-
 
147
    <para></para>
109
  </section>
148
  </section>
110
</chapter>
149
</chapter>
111
150