Can it run Linux, or any stripped-down flavor of the same? Does "the operating system that came with it" implement multitasking?
Any CPU can potentially implement some form of multitasking, and, these days, most of them do. You do not have to have "multiple cores."
(In this discussion, I'm going to be loose-and-easy with terminology. I'm going to omit discussion of "threads" and speak only of "processes," just for clarity. "Threads" are implied. "Task" colloquially means "process" (or "thread"). I'm painting with a very broad brush ...)
In essence, multitasking allows the operating system to recognize "multiple available units-of-work," otherwise known as "processes." At any particular nanosecond, some of them are "runnable right now," while the others are "waiting" for some reason. The operating system's scheduler chooses which runnable task should run next. It hands-over control to that task, after setting a timer. The task will now run until it yields the remainder of its "time-slice," or until the timer "pops" (or a hardware or software interrupt comes in ...) and the task is pre-empted.
"pthread" is a well-defined and more-or-less operating-system independent interface to multitasking capability, but in a robot you might have other choices, too.
For instance, you could have non-preemptive multitasking, in which every task is obliged to call some kind of (say ...) yield() subroutine "frequently" (and the system will "hang" if they don't). Through the simple expedient of swapping sets of processor registers (and, without the need for privileged machine instructions), the tasks voluntarily "pass the baton." Each process runs until it gives up the CPU, and eventually it sees that "the yield() subroutine 'returned,'" although any number of other processes might have taken their turn in the meantime. You can achieve a very useful set of functionality in this way, with a remarkable economy of code (and great efficiency), provided that all processes concerned "know and trust one another" (as they would, in a robot).
Last edited by sundialsvcs; 11-07-2016 at 09:05 AM.
|