Why OS ====== .. toctree:: :maxdepth: 1 why-os/index Course Structure ---------------- .. toctree:: overview/index interrupt/index spinlocks/index threads/index Todo ---- * Restructure why/code -> why/why-os * rename cmake targets accordingly * Reformulate :doc:`/trainings/material/soup/linux/sysprog/scheduling/processes-and-threads` in terms of this * Enable/disable safeguards against blocking in interrupts * ``class FD`` to handle this * start unchecked * inside the isr, prompt the user * see how everything stalls * user input -> continue * enable check Random Notes ------------ jjj sort that out Intro ..... When you somewhere want to consume data that was produced by an ISR, you either do it in another (timer possibly) interrupt, or in the main loop, pointlessly polling for something that will only happen once in a lifetime. must do powermanagement in that loop, suspending the device in deep sleep when on battery. * show isr race condition on a list for example jjj link to source * show fix via spinlock (show why-spinlock.cpp) * Discussion: do much in ISR -> write program that has a global ``std::list``, and adds/removes one node in each isr https://codeberg.org/jfasch/jf-why-rtos/src/branch/main/firmware/do-much-in-isr.cpp * Some :doc:`memory model ` * Add spinlock https://codeberg.org/jfasch/jf-why-rtos/src/branch/main/firmware/do-much-in-isr-spinlock.cpp * Add why-shell Scheduling, Tasks/Threads ......................... Realtime ........ * hmmm show priority inversion? Interrupt Communication ....................... * message queue/pipe usage -> blocking in isr forbidden * possibly only signal someone who's sleeping? * one msqg for (thread, interrupt)? or ``msgq1=(thread1, (interrupt1, interrupt2)), msgq2=(thread2, (interrupt3))`` Polling .......