Download presentation
Presentation is loading. Please wait.
Published byGloria Bell Modified over 8 years ago
1
Process Scheduling in LegOS Implemented the Linux way (Final Report) Group 1: Jeremy Orchuk Brad Simons Treena Larrew
2
Process Scheduling in Linux Scheduler is preemptive and multitasking. It is based on priority and round robin scheduling. Scheduling algorithm works by dividing time into epochs. –Beginning –Beginning of the epoch, every process is given a time quantum. –Time –Time quantum of a process is the maximum CPU time it can use in that epoch. –Epoch –Epoch ends when all runnable processes have exhausted their quantum. –New –New quantum = old quantum/2 + priority.
3
Problems We’ve Encountered Our first attempt to write Linux scheduling into the LegOS kernel was a failure. –We tried to delete the 20 level priority queue altogether. –Far to many changes had to be made to meet project deadlines. –Almost the entire task manager file needed to be rewritten. Our second attempt was to leave their queue in tact and let it handle all process functions but remove its ability to schedule. –This worked!!!!
4
Scheduling in our LegOS Task manager implements preemptive multitasking of processes. Process is described by the data structure pdata_t: A counter variable and a priority variable must be added to the structure to account for time on cpu and quantum calculations. pdata_t structure Variable’s added to pdata_t structure Variable’s added to pdata_t structure pdata_t structure Size_t *sp_save Pstate_t pstate Pflags_t pf;ags Pchain_t *priority Struct_pdata_t *next Struct_pdata_t *previous Struct_pdata_t *parent Size_t *stackbase Wakeup_t (*wakeup)(wakeup_t) Wakeup_t wakeup_data int counter int priority
5
Our Second Attempt For our second attempt we modified the tm.h file to include a structure called sched_tbl this structure looks as follows: struct sched_tbl { pdata_t pro_id; pid_t id_num; int m_good_val; struct sched_tbl *next; }
6
How the structure works The structure we created simulates the appearance of a singular linked list of processes even though they are still residing in the legOS priority queues tbl_head Sched_tbl pdata_t
7
Creating the Structure The sched_tbl structure is built in the execi function of the tm.c file when a processes is created. Pdata_t Sched_tbl
8
Building the table For the sake of speed and common sense our sched_tbl list is sorted in desending order according to goodness values –So unless the process at the head is busy, it will be take out of the queue, scheduled on the CPU, and then reinserted in the proper location.
9
The Benefits of…. Implementing our queue in parallel with the original. –A–A–A–All the original functions still work and are used to control process functions. –W–W–W–We use almost all of their code except for two segments in the tm_schedular function. These functions are responsible for finding the next process and putting it on the scheduler.
10
Helping the Scheduler WWWWe implemented several helper functions: GGGGoodness(sched_tbl *tbl_item); TTTTbl_insert(sched_tbl *new_tbl_entry); TTTTbl_remove(pid_t id); TTTTbl_out(pid_t id); NNNNew_epoch(); FFFFind_proc();
11
Process Scheduling in LegOS Recall from before…. How good is the process? –Our –Our LegoOS implementation attempts to identify the best candidate among all processes in the run queue list. –A –A more simplistic algorithm then Linux weighs: a process's priority the CPU time it has received thus far Our goodness function will is: int sched_tbl * tbl_item) { pid->goodnessr = pid->priority + pid->counter; }
12
After the Epoch Ends If the queue end is reached before a processes is found this signals that a new epoch should begin. –Any –Any process with time left in its counter at the end of an epoch receives a slight time advantage in the next epoch. –pid->counter –pid->counter = ( pid->counter >> 1) + pid->priority (taking halves guarantees that the quantum will never be more than twice the base time quantum).
13
New Scheduler Scheduler still uses a prioritized round robin scheme. –To find the next process to be scheduled, run queue is searched by means of goodness function(). –In the run queue, state of task following the designated task is tested. If the process is not ready, the next process in the list is tested. If no ready processes are found, a new epoch begins. If only the idle process remains scheduler goes to sleep. –As a result of changes, lower priority processes are never starved out by higher priority processes.
14
In Conclusion We have implemented a partially functional kernal that: –I–I–I–Implements task management the linux way. –r–r–r–runs a test program. –A–A–A–A logical next step would be to implement the linux scheduler and remove the legOS priority queues.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.