-4

What are the advantages of having a multi-tasking program with RTOS support rather than a single sequential program?

Are there any disadvantages?

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180
user1080390
  • 451
  • 3
  • 8
  • 20
  • what is RTOS ? Real time operating system ? – Manuel Selva Jan 12 '12 at 10:08
  • Yes, RTOS = real time os – user1080390 Jan 12 '12 at 10:12
  • See my answer below. Your question is not clear, so please clarify your context and what you really want to know. – Manuel Selva Jan 12 '12 at 10:17
  • 2
    @Manuel: Since you answered the question in a manner that suggests some knowledge of the subject, why did you feel the need to clarify the meaning of RTOS? In the context of this site, the term is entirely unambiguous, there is even a widely recognised tag for it. Many Stackoverflow questions have acronyms or terms I am not familiar with, but I would not necessarily query them because *I* did not understand them; rather I would assume that I did not have the expertise to answer the question. Software engineering is a broad field. – Clifford Jan 13 '12 at 14:06
  • @Clifford My comment was not good and it should have asked to clarify the question. Nevertheless I didn't get the last part of your comment: do you mean my answer was not correct ? On a side note, reading the question again I really don't get it. – Manuel Selva Jan 13 '12 at 15:12
  • @Manuel: I have no issue with your answer beyond the comment I made to the answer itself. I am not sure what in the "last part" of my comment would lead you to believe otherwise; all I said was that software engineering is a broad field, meaning that an expert in one field of software development may not understand or be able to answer all questions on SO. Closing and down-voting this question seems somewhat harsh to me; it seems it is only "difficult to tell what is being asked" if you did not know what an RTOS was! No one who closed it commented on it to improve it or explain. – Clifford Jan 13 '12 at 18:18

2 Answers2

2

In a sequential or "big-loop" program, other than interrupt handling, events are processed when the program "gets around to it", the cycle time may be non-deterministic and may vary as functions are added, removed and changed. So the performance and responsiveness of your system is dependent upon every change you make to the code, and the behaviour and ability to meet timing deadlines can be affected by changes unrelated to the function that ultimately fails.

By using pre-emptive priority based scheduling an RTOS can respond deterministically to events so changes in processing time of one task need not affect other tasks of higher priority.

Beyond the deterministic response, the ability to separate functionality into threads of execution, makes each of these threads simpler and less co-dependent. Instead of one "big loop" handling everything, you have many independent specialist loops that are easier to test and develop and easier to add, remove and re-use to change the behaviour and functionality of your system.

Clifford
  • 88,407
  • 13
  • 85
  • 165
0

Real time operating systems main objectives are to provide bounded responses times for kernel level operations and specifics real time scheduling policies. It doesn't relate at all to sequential vs parallel programing.

These OS are used in embedded systems with hard real time requirements and you shouldn't care about them for other purposes.

Manuel Selva
  • 18,554
  • 22
  • 89
  • 134
  • What are the main reasons embedded systems use RTOS? – user1080390 Jan 12 '12 at 10:22
  • 1
    embedded systems without real time needs don't use RTOS. As the name says: Real Time Operating Systems are for Real Time systems. Because embedded systems often have real time requirements linked to their link with physical environment, they often use RTOS but it's not always the case. – Manuel Selva Jan 12 '12 at 10:29
  • So you need scheduling policies in a sequential program? – ziggystar Jan 12 '12 at 12:14
  • @ziggystar, I don't understand your comment. Can you help ? – Manuel Selva Jan 12 '12 at 12:34
  • @Manuel For µC a large value of an OS (RT or not, though most are RT) lies in its multi-tasking support. So the question to use an (RT)OS or not very well relates to whether you have need multi-tasking in your application or not. – ziggystar Jan 12 '12 at 13:18
  • If we "shouldn't care about them for other purposes", why has RIM chosen to base it new Smart Phone and Tablet OS on QNX Neutrino? Why is WinCE real-time capable? RTOSs are also used in industrial PC applications, not just embedded systems (though it depends on your definition of embedded). – Clifford Jan 12 '12 at 16:55