From eda36531e8daedd045fb02c9c590cdf4dddd957f Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 18 Mar 2020 00:21:36 +1100 Subject: 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. --- include/kernel/sched.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/kernel') 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 #include +/* TODO: change const 10 to tick rate */ +#define uptime() ((long) (ticks * 10)) + #define TSTATE_RUNNING 0 #define TSTATE_INTERRUPTIBLE 1 #define TSTATE_UNINTERRUPTIBLE 2 -- cgit v1.3