Newer
Older
ubixos / docs / arch / scheduler
@apwillia apwillia on 8 Jul 2002 3 KB Updated scheduler docs
Documentation for Ubix Scheduler.
By Patrick Williams

Overview:

Ubix is meant to be a desktop OS, so in order to accomplish this a large burden is placed on the
scheduler to ensure the OS appears responsive to users.  The scheduler algorithm Ubix will implement
is a pre-emptive, priority-based scheduler.

The most important concept in the design of the scheduler will be wait-queues.  Every scheduler object
will be implemented as a wait-queue. Not only will there be the READY queue, but syncronization
objects will each have their own wait-queue.  In addition, each task will have a queue assigned for
holding other tasks which are in the JOIN state.

The main aspect of the Ubix scheduler will be the READY queues.  Since, the scheduler implements 32
priorities, there will be a READY queue for each priority.  When the scheduler is run, it will take


Definitions:

Task - In Ubix, a task is a group of instructions to run on the processor.  Typically, this is in 
		the form of a program THREAD.

Process - A grouping of one or more tasks, usually loaded from an executable file.  All of the 
		tasks in a process will share the same ADDRESS SPACE.  When a process is created, it will 
		initially contain one task.

Thread - Term used in unix environments to describe an Ubix TASK.

Address Space - Section of virtual memory to which a task has access to.

Priority - Importance placed on a task when the scheduler chooses a task to run.  There are two 
		different types of priority in Ubix.  A static priority is given when a task is created.  
		In addition, a task contains a dynamic priority which is usually the same as the static 
		priority.  At times, such as to prevent priority inversion or to minimize the running of a 
		CPU hogging task, this dynamic priority is changed.  Ubix will implement 32 different 
		priorities, 31 being the highest priority and 0 being the lowest.

State - Every task has a state that it can be in.  Also, processes have a state but there are fewer 
		states that a process can be running in.  
	
	States are:

    	STARTING - The task or process is in the process of being created.  Memory for it is being 
    			allocated.

    	READY - The task or process is set to be scheduled for execution.

    	RUNNING - The task or process is currently being run.  Once a process is first run after 
    			being started, it remains in the RUNNING state.

    	SUSPEND - The scheduler has stopped the execution of the task or process to do some 
    			housekeeping work.

    	SLEEP - (Task specific) A task has requested to be stopped for a period of time.

    	BLOCK - (Task specific) A task is being stopped on a syncronization device, such as a mutex 
    			or semaphore.

    	REPLY - (Task specific) A task has sent a syncronious message and is waiting for the response.

    	WAIT - (Task specific) A task is listening for messages from other tasks.

    	JOIN - (Task specific) A task is waiting for another task to complete.

    	EXITING - The task or process is done and waiting for the scheduler to complete its 
    			housekeeping tasks.