Changes between Initial Version and Version 1 of MutekS


Ignore:
Timestamp:
Jul 31, 2006, 12:24:32 PM (18 years ago)
Author:
Nicolas Pouillon
Comment:

Little explaination of MutekS's sched

Legend:

Unmodified
Added
Removed
Modified
  • MutekS

    v1 v1  
     1= MutekS =
     2
     3MutekS is the canonical Operating System for embedded software.
     4It only implements the few system calls used by DSX.
     5
     6[source:trunk/dsx/lib/muteks]
     7
     8== Available services ==
     9
     10 * Locks (spin locks)
     11 * Synchronization barriers
     12 * Mwmr fifos
     13
     14== Implementation notes ==
     15
     16Scheduler is very basic. It's build on the simple assertion scheduling decisions can be simplified to comparing a address value vith a fixed value.
     17Six calls are available to set a thread waiting:
     18{{{
     19sched_wait_eq
     20sched_wait_ne
     21sched_wait_gt
     22sched_wait_lt
     23sched_wait_ge
     24sched_wait_lt
     25}}}
     26
     27Thus locking becomes:
     28{{{
     29/*
     30 * Waits until a 0 is read at the lock address. This is only true when you get the lock
     31 */
     32sched_wait_eq( &lock, 0 );
     33}}}
     34
     35Waiting on mwmr becomes:
     36{{{
     37/*
     38 * Read on fifo, need data in it
     39 * Wait on status before getting the lock, we are read-only and we'll refresh the value once the lock gotten
     40 */
     41...
     42try_again:
     43  sched_wait_ge( &(mwmr->status), needed );
     44  dsx_lock_lock( mwmr->lock );
     45  if ( mwmr->status < needed ) {
     46    // Someone probably got the lock in between and emptied the fifo
     47    dsx_lock_unlock( mwmr->lock, needed );
     48    goto try_again;
     49  }
     50...
     51}}}
     52
     53And so on...