Hacker News new | ask | show | jobs
by fermienrico 2275 days ago
Linux is a GPOS (general purpose operating system) whereas the domain of servo controller programming (as shown in the videos) is falls under (RTOS). Even if there is no RTOS installed and the author is programming on bare metal with interrupt-service-routines (ISR), it is essentially a "Real-time Operating System" or RTOS. The author could also have used FreeRTOS. The primary difference between GPOS such as Linux and RTOS (bare metal roundrobin or using something like FreeRTOS, Micrium, etc) is that GPOS focus on "throughput" and RTOS specializes in "priority". RTOS works by priority-scheduling or roundrobin.

An example would be better. Say there is an external input to the system (a sensor that detects roller coaster position), you want a deterministic scheduling of the task without any concern about the rest of the state of the operating system. Doesn't matter what the OS is doing - when the roller coaster's position is sensed and there is an interrupt generated to call a subroutine (ISR), a RTOS will not block and it will guarantee execution. Meanwhile, Linux will schedule the task hoping it will get executed but there is no guarantee... I am sure you can hack into the kernel space and write a driver but it becomes a much more of a laborious task - it is just better to use the right OS from the get go.

Hope that makes sense.

A professional motion control system such as [1] comes with 2 components. RTOS element which is a proprietary controller and a GPOS component which is used to communicate, monitor, interface with the user (GUI) and do high-level functions. Usually this is a piece of software installed on a Windows OS, with dedicated PCI cards to communicate to the RTOS modules.

[1] https://www.aerotech.com/product-catalog.aspx

Related reading: https://stackoverflow.com/questions/38241352/rtos-example-wh...

https://stackoverflow.com/questions/536506/how-do-real-time-...

Also, checkout LynxOS...this is the top-end of all RTOSs which has some POSIX (UNIX) like features. It can also run on powerful processors such as Intel and AMD. This is used in airplanes (avionics), trains and public works, super critical operations: https://www.lynx.com/products/lynxos-178-do-178c-certified-p...

1 comments

I think a better way to describe an RTOS than as specializing in "priority" is that an RTOS has bounded latency. If it's hard real-time that means deterministically bounded, while soft real-time means probabilistically bounded. What that bound is (or the distribution for soft real-time systems) is up to the system designer. It could be a microsecond, could be a day. But it has to exist, whereas in a GPOS there's no bound at all.