summaryrefslogtreecommitdiff
path: root/include/kernel/sched.h
diff options
context:
space:
mode:
authorJake Mannens <jakem_5@hotmail.com>2020-03-18 00:21:36 +1100
committerJake Mannens <jakem_5@hotmail.com>2020-03-18 00:21:36 +1100
commiteda36531e8daedd045fb02c9c590cdf4dddd957f (patch)
tree62d4dc49bc7505596d2e5f2213f8f7f0e3aff901 /include/kernel/sched.h
parentb808d33c6bf30691b8cdb6cc0fd65f49e7db29f8 (diff)
Implemented a proper read requests queue in the floppy driver.
Previously, all tasks waiting on the floppy drive, would be woken simultaneously and would compete for access to the drive, potentially causing a dangerous race condition. Now, tasks enter a read queue, where each task wakes the next after it is finished with the drive. This is the basic groundwork for request queueing. Seek queues will be implemented next along with a head scheduling algorithm. Added a timeout for read_data(). Reading status from the FDC will return an error if the FDC does not become available in the allotted time and thus, will no longer potentially hang the system.
Diffstat (limited to 'include/kernel/sched.h')
-rw-r--r--include/kernel/sched.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/kernel/sched.h b/include/kernel/sched.h
index 5429e8b..439da53 100644
--- a/include/kernel/sched.h
+++ b/include/kernel/sched.h
@@ -5,6 +5,9 @@
#include <stdint.h>
#include <unistd.h>
+/* TODO: change const 10 to tick rate */
+#define uptime() ((long) (ticks * 10))
+
#define TSTATE_RUNNING 0
#define TSTATE_INTERRUPTIBLE 1
#define TSTATE_UNINTERRUPTIBLE 2