-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Alex Omar edited this page Jan 3, 2017
·
18 revisions
Single producer, multi-consumer model. Everything in parallel. Nice because no thread will move faster than the producer and no thread is slowed down by another thread because they are all independent of each other.
Responsible for polling flight instrumentation sensors, moving those values into memory locations shared between itself and the consumers (one memloc per consumer), and notifying each consumer that new data is available.
Pseudo code
sensor_data = get_data()
for c in consumers:
if( c.shared_mem.is_avail() ):
c.lock_shared_mem()
c.update_shared_mem(sensor_data)
c.unlock_shared_mem()
c.notify()
Reads data from shared memory and then operates on it. Controls consumer crunches the meco algorithm. Logging consumer writes to a file, Comms consumer does communication stuff.
Pseudo code
while True:
if( notified() ):
lock_shared_mem()
local_data = shared_mem; //copy data
unlock_shared_mem()
//comms() or controls() or log()
State Machine