• avi

    Difference between Hard and Soft Real-Time Systems

    We know that real time operating systems are deterministic, time dependent and mainly used in hard real time systems. Whereas if we take general purpose operating systems they are not deterministic, or time independent and they are mainly used for soft real time system.

    Examples for real time operating systems (RTOS) are VxWorks, µcos, Qnx, Rtlinux, window embedded etc. for general purpose operating system (GPOS) are Windows (95,98,Xp, Vista, 7, 8, media center etc.), Linux (Ubuntu, Red hat, fedora, Mandarin, Linux mint, etc. ), Apple (leopard, tiger etc. ), Novel NetWare, Solaris, etc. all these GPOS are used in desktop and server level systems. RTOS are mainly used in Real Time Embedded Systems.

    When coming to the difference between RTOS and GPOS:
    Determinism: We know that deterministic systems will give same output for given input condition and we can predict output of the system for a given input. RTOS are deterministic operating system which will take same time to give output for different inputs. Whereas in GPOS we cannot predict the output but we cannot predict the time of the output, in GPOS mostly randomness is involved. Example for RTOS is mainly used in defense systems which are more deterministic (missile launching operations, communication systems etc.). GPOS are used for normal applications like audio video systems, personal computer etc.

    Hardware architecture: GPOS are used on heavy architecture; for example PC, Servers, mainframes etc. RTOS are light weight operating systems which are used in small architecture like mobile phones, chocolate vending machines and other embedded applications. Usually RTOS process are fixed and normally used in small applications where we will use only limited number of tasks to do, example: if we take normal chocolate vending machine it will show the display of different chocolates and price of the chocolates. If the user selected the chocolate vending machine must check the amount given by the user and deliver the chocolate, if the amount is not sufficient it should display a warning message. But in GPOS we can add another process accordingly to do more tasks; for example in normal windows operating system we add many extra applications like IDE, software’s for games, players etc.). In the hardware RTOS can run on very small configuration like (few kilobytes of ram, micro controller as CPU etc.) if we take GPOS need minimum of (64 MB of ram and need high end microcontroller or microprocessor as CPU).

    Kernel: RTOS will use pre-emptive kernel where as normal GPOS will use non pre-emptive kernel. Pre-emptive kernel will run in kernel mode and process the threads according to the priority. If a high priority process came to the CPU pre-emptive kernel will immediately treat all other process as the external process, context switch to the high priority process and process it. Where as in the non preemptive kernel if a high priority process came to the processor, the existing process which CPU is processing may allow the high priority process to context switch and process high priority process or high priority process should wait until the existing process is completed.

    Scheduling: Scheduling is a method in which will provide the resources of the system to the process. The main reason of developing scheduling algorithm is for multitasking operating system which has to manage number of process at a time. RTOS scheduling algorithm is based on priority, that is process should be scheduled according to there priority. In RTOS always highest priority tasks are scheduled first and low priority process are paused until the high priority process are processed. If any high priority process came for scheduling the existing process are context switch and schedule the high priority process first for processing. In GPOS Scheduling is not based on priority if a high priority process came for processing it should wait until the existing process is processed. For GPOSthroughput is high (throughput means number of process complete there processing at one time) for RTOS throughput is always low. RTOS used rate monotonic, earlier deadline first, preemptive scheduling algorithms where as GPOS uses completely fair scheduling, round robin, rotary inventor fair scheduling, O(1) etc.

    Interrupt Latency: interrupt latency of the RTOS is always zero. When we take the GPOS interrupt latency is more when it has to process when number of process at a time.

    Concepts like virtual memory, paging, and huge file system management are not present in RTOS. And RTOS is more economical for embedded devices rather than choosing GPOS.

    We will discuss about Kernel, Compilation of kernel, Porting, Android compilation in next sessions.