f.ben.isaac
November 11th, 2008, 09:25 PM
What kind of "context information" required by processes and threads?
for sake of simplicitly, i can say the thread context includes the thread's set of machine registers, the kernel stack, etc...
process context has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, etc
Q1. Is what i have mentioned above is right?
Q2. What is Base Priority - Is it the first thread?
Threads are scheduled to run based on their scheduling priority. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority).
***Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.)***
Q3. Is this zero-page thread is created immediately after the process is created?
The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority.
Q4. These two sentences contradicts itself!
The system treats all threads with the same priority as equal. Ok
The system assigns time slices in a round-robin fashion to all threads with the highest priority. Now what? Isn't this a contradiction?
If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority.
Q5. I do not get it! threads always are ready to run. If an application that has multi-threads capability and you run one activity, the other ones are always ready to run! All you have to do is click it. Can you explain the quote please?
If a higher-priority thread becomes available to run, the system rejects to execute the lower-priority thread (without allowing it to finish using its time slice), and assigns a full time slice to the higher-priority thread.
Q6. So the process will only run one thread at a time since its after the highest priority thread only! Can you clarify please
Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating system, which assigns time slices to each process in equal portions and in order, handling all processes without priority.
Q7. round-robin algorithm handles all process without priority. In quote of Q4, it says The system assigns time slices in a round-robin fashion to all threads with the highest priority.
The scheduler maintains a queue of executable threads for each priority level. These are known as ready threads. When a processor becomes available, the system performs a context switch.
Q8. "These are known as ready threads". What are the not ready threads? Can you give an example of situation for a real life application please?
Q9. "When a processor becomes available, the system performs a context switch." Does this mean when the user creates new activity (thread) on the same application by clicking on the mouse on the activity?
Context switching takes the highest priority queue that contains ready threads.
Q10. Since we are using queue. Context switching happens on the front thread. What if a highest priority is in the middle of the queue. How this is going to be dealt?
Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
Q11. Is primary thread here refers to the application itself without having it run anything?
For example, a program executes which creates a process (application itself), Is it a the same time called primary thread?
Or primary thread is the first activity that happens on the process?
Can you please explain it in a plain English language, because i always get confused in concepts of threads, childs, parents, etc....
I'm looking forward to hearing from you!
THANKS
for sake of simplicitly, i can say the thread context includes the thread's set of machine registers, the kernel stack, etc...
process context has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, etc
Q1. Is what i have mentioned above is right?
Q2. What is Base Priority - Is it the first thread?
Threads are scheduled to run based on their scheduling priority. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority).
***Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.)***
Q3. Is this zero-page thread is created immediately after the process is created?
The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority.
Q4. These two sentences contradicts itself!
The system treats all threads with the same priority as equal. Ok
The system assigns time slices in a round-robin fashion to all threads with the highest priority. Now what? Isn't this a contradiction?
If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority.
Q5. I do not get it! threads always are ready to run. If an application that has multi-threads capability and you run one activity, the other ones are always ready to run! All you have to do is click it. Can you explain the quote please?
If a higher-priority thread becomes available to run, the system rejects to execute the lower-priority thread (without allowing it to finish using its time slice), and assigns a full time slice to the higher-priority thread.
Q6. So the process will only run one thread at a time since its after the highest priority thread only! Can you clarify please
Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating system, which assigns time slices to each process in equal portions and in order, handling all processes without priority.
Q7. round-robin algorithm handles all process without priority. In quote of Q4, it says The system assigns time slices in a round-robin fashion to all threads with the highest priority.
The scheduler maintains a queue of executable threads for each priority level. These are known as ready threads. When a processor becomes available, the system performs a context switch.
Q8. "These are known as ready threads". What are the not ready threads? Can you give an example of situation for a real life application please?
Q9. "When a processor becomes available, the system performs a context switch." Does this mean when the user creates new activity (thread) on the same application by clicking on the mouse on the activity?
Context switching takes the highest priority queue that contains ready threads.
Q10. Since we are using queue. Context switching happens on the front thread. What if a highest priority is in the middle of the queue. How this is going to be dealt?
Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
Q11. Is primary thread here refers to the application itself without having it run anything?
For example, a program executes which creates a process (application itself), Is it a the same time called primary thread?
Or primary thread is the first activity that happens on the process?
Can you please explain it in a plain English language, because i always get confused in concepts of threads, childs, parents, etc....
I'm looking forward to hearing from you!
THANKS