server/src/sched.h

Go to the documentation of this file.
00001 /*!
00002  * \file   cpu_reserve/server/src/sched.h
00003  * \brief  prototypes for scheduling management
00004  *
00005  * \date   09/04/2004
00006  * \author Jork Loeser <jork.loeser@inf.tu-dresden.de>
00007  *
00008  */
00009 /* (c) 2004 Technische Universitaet Dresden
00010  * This file is part of DROPS, which is distributed under the terms of the
00011  * GNU General Public License 2. Please see the COPYING file for details.
00012  */
00013 #ifndef __CPU_RESERVE_SERVER_SRC_SCHED_H_
00014 #define __CPU_RESERVE_SERVER_SRC_SCHED_H_
00015 #include <l4/sys/types.h>
00016 #include <l4/rt_mon/histogram.h>
00017 #include <l4/semaphore/semaphore.h>
00018 
00019 extern l4_threadid_t main_id;
00020 
00021 typedef struct sched_t{
00022     const char*name;
00023     l4_threadid_t thread;
00024     l4_threadid_t creator;
00025     int id;             /* id of reservation */
00026     int prio;
00027     int period;                 // if 0, delayed preemption
00028     int wcet;
00029     int deadline;               // if 0, don't care
00030     unsigned *watch;            // array for watching. 0 if unset
00031     l4thread_t watcher;         // watcher thread, L4THREAD_INVALID if unset
00032     l4semaphore_t watcher_end_sem; //end-sema for watcher thread
00033     l4_cpu_time_t dl_old;
00034     rt_mon_histogram_t *dl_hist;
00035 } sched_t;
00036 extern int sched_cur_threads, sched_max_threads;
00037 extern sched_t **scheds;
00038 extern l4semaphore_t scheds_lock;
00039 
00040 extern int sched_init(void);
00041 extern int sched_index(int prio);
00042 extern int sched_response_time(sched_t *sched, int pos, sched_t *new_);
00043 extern int sched_prepare_free(int pos);
00044 extern int sched_free(int pos);
00045 static inline int is_dp(sched_t *sched){
00046     return sched->period==0;
00047 }
00048 
00049 /* Locking is required when modifiying the scheds-array and when accessing
00050  * it from the watcher threads. */
00051 void lock_scheds(void);
00052 void unlock_scheds(void);
00053 
00054 #endif

CPU reservation server Reference Manual, written by Jork Loeser  © 2004