There are various standards out there and ways of doing things but DO-178C is the latest iteration of the document that outlines how real time avionics are to be programed. Certifying agencies like the FAA may have their own supplements/orders that specify specifics for a given jurisdiction, for example here is the FAA's order.
Avionics themselves often connect over the ARNIC data bus.
Many avionics and aircraft companies design their own OS's when they needed them for real time applications
Honeywell, for example, created the digital "engine" operating system
(DEOS) and Rockwell Collins, the virtual machine operating system
(VMOS), which it engineered from an earlier LynuxWorks product in the
late 1990s. Collins licensed the changes back to LynuxWorks in the
2002-2003 time frame, and LynuxWorks now offers the new version of the
software as LynxOS-178.
WindRiver did the OS for the dreamliner
Smiths Aerospace chose Wind River Systems' VxWorks 653 RTOS for the
B787's common core system (CCS), a cabinet that will host 80 to 100
applications, including Honeywell's FMS and health management software
and Collins' crew alerting and display management software.
There is a great podcast on designing spacecraft software (basically the same use case) that you can find here.
Its worth noting that the cost to certify avionics tends to be quite high (under the FAA) so code and methodology dont change all to much. Once avionics get certified companies have a way of continuing to make them for a very, very, very long time.