http://pintosiiith.wordpress.com/2012/10/15/assignment-priority-scheduling-pintos/
This post will guide you how to implement priority scheduling in Pintos.
Background:
When a new thread is created, you can specify the priority for the thread as an argument to thread_create() which is ignored currently. You need to use that priority to handle the scheduling.
Requirements:
Priority scheduling’s scope for this assignment is reduced as compared to original assignment created by Stanford. You can check the complete scope here.
There are two cases:
1. When a thread enters ready queue with priority higher than running thread, then lower priority thread must yield the CPU and higher priority thread must be scheduled.
2. A thread may raise or lower its own priority at any time, but lowering its priority such that it no longer has the highest priority must cause it to immediately yield the CPU making way for the higher priority thread in the ready queue.
Priority range:
PRI_MIN – 0 – lowest
PRI_DEFAULT – 31 – default
PRI_MAX – 63 – highest
Code changes:
You need to implement thread_set_priority
and thread_get_priority
declared in threads/thread.c to simulate the scenario mentioned above.
Approach:
1. As you are familiar with thread structure from previous assignment, it will be easy for you to find the code you need to understand and change.
2. If not already understood, please go through the thread structure defined in thread.h that has the priority field that will help you implement the assignment.
3. Identify the changes and implement them.
Test cases:
- alarm-priority
- priority-change
Other test cases provided in Pintos for priority scheduling won’t pass as the scope of priority scheduling in original assignment is much higher.
To test your implementation further, write small programs that create threads with different priorities. Add this file to Pintos kernel as you did in 1st assignment and run it to verify your implementation.
Happy Coding!!!
- Rasesh Mori
'OS > Pintos Project' 카테고리의 다른 글
[Pintos Project] Guide Files (0) | 2014.04.23 |
---|---|
[Pintos Project] 2.2.3 Priority Scheduling requirement 번역 (0) | 2014.04.21 |
[pintos setup 2번째 방법] Installing PintOS on Linux Ubuntu 10 (0) | 2014.04.14 |
[Pintos] PintOS, kernel panic with -v option bochs on ubuntu (2) | 2014.04.13 |
[Pintos Project] 굉장히 유용한 사이트. (0) | 2014.04.13 |
[Pintos Project][Getting start] you may be modifying the files to coding (0) | 2014.04.12 |
[Pintos Project][Getting Start] Need to reading about the "Interrupt" document. (0) | 2014.04.12 |