diff options
author | Christian Cunningham <cc@localhost> | 2022-03-11 13:41:49 -0800 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-11 13:41:49 -0800 |
commit | 0b812480a8b81607802cdceb273b69680cd5082c (patch) | |
tree | 4bff9ed959dd91fee4d647c8c1e12f84f78ca777 /include/sys | |
parent | ad9e577e8b2f6431d48a6a64fd95aff432e48441 (diff) |
Statically Allocated Scheduling
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/schedule.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/include/sys/schedule.h b/include/sys/schedule.h index 397ab2e..0205f54 100644 --- a/include/sys/schedule.h +++ b/include/sys/schedule.h @@ -30,24 +30,29 @@ struct Thread { unsigned short s_reserved; }; -struct ThreadRotBuffer { - unsigned int roffset; - unsigned int woffset; - struct Thread* queue[TQUEUE_MAX]; +struct ThreadEntry { + struct Thread* thread; + struct ThreadEntry* prev; + struct ThreadEntry* next; }; -struct ThreadQueues { - struct ThreadRotBuffer ready; - struct ThreadRotBuffer mwait; - struct ThreadRotBuffer swait; +struct ThreadEntryIterator { + struct ThreadEntry* entry; +}; + +struct ThreadQueue { + struct ThreadEntry entry[TQUEUE_MAX]; + struct ThreadEntryIterator read; + struct ThreadEntryIterator write; }; struct Scheduler { struct Thread* rthread; - struct ThreadQueues thread_queues[PRIORITIES]; + struct ThreadQueue ready[PRIORITIES]; + struct ThreadQueue mwait[PRIORITIES]; + struct ThreadQueue swait[PRIORITIES]; }; - void init_scheduler(void); void add_thread(void* pc, void* arg, unsigned char priority); void uart_scheduler(void); |