wiki:MutekS

MutekS

MutekS is the canonical Operating System for embedded software. It only implements the few system calls used by DSX.

trunk/dsx/lib/muteks

Available services

  • Locks (spin locks)
  • Synchronization barriers
  • Mwmr fifos

Implementation notes

Scheduler is very basic. It's build on the simple assertion scheduling decisions can be simplified to comparing a address value vith a fixed value. Six calls are available to set a thread waiting:

sched_wait_eq
sched_wait_ne
sched_wait_gt
sched_wait_lt
sched_wait_ge
sched_wait_lt

Thus locking becomes:

/*
 * Waits until a 0 is read at the lock address. This is only true when you get the lock
 */
sched_wait_eq( &lock, 0 );

Waiting on mwmr becomes:

/*
 * Read on fifo, need data in it
 * Wait on status before getting the lock, we are read-only and we'll refresh the value once the lock gotten
 */
...
try_again:
  sched_wait_ge( &(mwmr->status), needed );
  dsx_lock_lock( mwmr->lock );
  if ( mwmr->status < needed ) {
    // Someone probably got the lock in between and emptied the fifo
    dsx_lock_unlock( mwmr->lock, needed );
    goto try_again;
  }
...

And so on...

Last modified 18 years ago Last modified on Jul 31, 2006, 12:24:32 PM