- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# sched.h

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: sched_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #ifndef _SCHED_H
    00031 #define _SCHED_H
    00032
    00033 #include <ubixos/types.h>
    00034 //#include <ubixos/elf.h>
    00035 #include <ubixos/tty.h>
    00036 #include <vfs/file.h>
    00037 #include <sys/tss.h>
    00038 #include <sys/thread.h>
    00039
    00040
    00041 typedef enum { PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4,WAIT=5 } tState;
    00042
    00043 struct osInfo {
    00044   uInt8                 timer;
    00045   uInt8                 v86Task;
    00046   bool                  v86If;
    00047   uInt32                vmStart;
    00048   uInt32                stdinSize;
    00049   uInt32                controlKeys;
    00050   char                 *stdin;
    00051   char                  cwd[1024];          /* current working dir */
    00052   };
    00053
    00054 typedef struct taskStruct {
    00055   pidType            id;
    00056   struct taskStruct *prev;
    00057   struct taskStruct *next;
    00058   struct tssStruct   tss;
    00059   struct i387Struct  i387;
    00060   struct osInfo      oInfo;
    00061   fileDescriptor    *imageFd;
    00062   tState             state;
    00063   uInt32             gid;
    00064   uInt32             uid;
    00065   uInt16             usedMath;
    00066   tty_term          *term;
    00067   struct thread      td;
    00068   } kTask_t;
    00069
    00070
    00071 int      sched_init();
    00072 int      sched_setStatus(pidType,tState);
    00073 int      sched_deleteTask(pidType);
    00074 int      sched_addDelTask(kTask_t *);
    00075 kTask_t *sched_getDelTask();
    00076 void     sched_yield();
    00077 void     sched();
    00078
    00079 void schedEndTask(pidType pid);
    00080 kTask_t *schedNewTask();
    00081 kTask_t *schedFindTask(uInt32 id);
    00082
    00083 extern kTask_t *_current;
    00084 extern kTask_t *_usedMath;
    00085
    00086
    00087 #endif
    00088
    00089 /***
    00090  $Log: sched_8h-source.html,v $
    00090  Revision 1.7  2006/12/15 17:47:06  reddawg
    00090  Updates
    00090
    00091  Revision 1.3  2006/12/15 15:43:46  reddawg
    00092  Changes
    00093
    00094  Revision 1.2  2006/10/27 16:42:42  reddawg
    00095  Testing
    00096
    00097  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
    00098  ubix2
    00099
    00100  Revision 1.2  2005/10/12 00:13:37  reddawg
    00101  Removed
    00102
    00103  Revision 1.1.1.1  2005/09/26 17:23:55  reddawg
    00104  no message
    00105
    00106  Revision 1.30  2004/09/11 22:21:11  reddawg
    00107  oInfo.cwd is now an array no longer a pointer..
    00108
    00109  Revision 1.29  2004/09/08 23:19:58  reddawg
    00110  hmm
    00111
    00112  Revision 1.28  2004/09/08 22:16:02  reddawg
    00113  Fixens
    00114
    00115  Revision 1.27  2004/09/08 21:19:32  reddawg
    00116  All good now
    00117
    00118  Revision 1.26  2004/09/07 21:54:38  reddawg
    00119  ok reverted back to old scheduling for now....
    00120
    00121  Revision 1.20  2004/08/09 12:58:05  reddawg
    00122  let me know when you got the surce
    00123
    00124  Revision 1.19  2004/08/06 22:43:04  reddawg
    00125  ok
    00126
    00127  Revision 1.18  2004/08/06 22:32:16  reddawg
    00128  Ubix Works Again
    00129
    00130  Revision 1.16  2004/08/04 08:17:57  reddawg
    00131  tty: we have primative ttys try f1-f5 so it is easier to use and debug
    00132       ubixos
    00133
    00134  Revision 1.15  2004/07/29 21:32:16  reddawg
    00135  My quick lunchs breaks worth of updates....
    00136
    00137  Revision 1.14  2004/07/21 17:15:02  reddawg
    00138  removed garbage
    00139
    00140  Revision 1.13  2004/07/21 14:43:14  flameshadow
    00141  add: added cwc (current working container) to the osInfo strut
    00142
    00143  Revision 1.12  2004/07/19 02:32:21  reddawg
    00144  sched: we now set task status to dead which then makes the scheduler do some clean it could be some minor overhead but i feel this is our most efficient approach right now to prevent corruption of the queues
    00145
    00146  Revision 1.11  2004/07/19 02:08:27  reddawg
    00147  Cleaned out the rest of debuging code also temporarily disabled the ip stack to improve boot time
    00148
    00149  Revision 1.10  2004/07/18 05:24:15  reddawg
    00150  Fixens
    00151
    00152  Revision 1.9  2004/07/09 13:23:20  reddawg
    00153  sched: schedInit to sched_init
    00154  Adjusted initialization routines
    00155
    00156  Revision 1.8  2004/06/22 14:02:14  solar
    00157  Added the PLACEHOLDER state for a task
    00158
    00159  Revision 1.7  2004/06/18 13:01:47  solar
    00160  Added nice and timeSlice members to the kTask_t type
    00161
    00162  Revision 1.6  2004/06/17 02:12:57  reddawg
    00163  Cleaned Out Dead Code
    00164
    00165  Revision 1.5  2004/06/16 14:04:51  reddawg
    00166  Renamed a typedef
    00167
    00168  Revision 1.4  2004/06/14 12:20:54  reddawg
    00169  notes: many bugs repaired and ld works 100% now.
    00170
    00171  Revision 1.3  2004/05/21 15:49:13  reddawg
    00172  The os does better housekeeping now when a task is exited
    00173
    00174  Revision 1.2  2004/05/21 15:20:00  reddawg
    00175  Cleaned up
    00176
    00177
    00178  END
    00179  ***/
    00180