An operating-system-independent modular programming method is disclosed,
which includes providing one or more tasks, one or more task queues, and
zero or more condition queues. Each task is a program that is run in
sequence. Each task queue includes a task queue program and a queue
containing zero or more tasks. Each condition queue includes a condition
queue program and a queue containing zero or more tasks and associated
conditions. Each task includes task ending code that refers to zero, one,
or more than one successor task, and the task queue program or the
condition queue program handles each such successor task by either
running it or placing it in a task queue or a condition queue. The
programming method further includes providing a fan and an end fan
construct to enable a parent task to generate a plurality of child
sequences. These program constructs may be used to form pseudothreads,
each pseudothread being a single sequence of control, with interruptions
allowed but no concurrency of execution, implemented in an operating
system independent way. Also disclosed is an application of this
programming method to accomplish robust just-in-time response to multiple
asynchronous data streams in a RAID control program. The RAID control
program includes a plurality of requesters, a resource allocator, and a
plurality of stripe parity and IO masters, and an optional chainer, each
being implemented as a pseudothread.