Article:The middle path between OS and Non-OS Design
The decision on whether to use an Operating System or not,should depend entirely on project complexity and parameters to be achieved. Also it largely depends on the skill set of the team. What an OS brings to the design is a standard and safe method of handling execution of different modules,reacting to events like interrupts and also assuring data security. If these functions can be carried out by developing good code, then a commercial OS is not required. After all a commercial OS does add to the cost of the project. However there is the middle path between OS and Non OS design. This means developing small snippets of code which perform some of the critical OS functions.
Many of the features provided by commercial OS may not be required by the project. The features most required can be developed easily if there is a good understanding of what an OS does. These code snippets,once developed can be reused as and when required. They will then provide partial OS functionality without the need to purchase a commercial OS
Some important OS features, most required, that can be developed easily:-
1. Task Scheduler :-- A task is basically a function which is called to perform certain actions.A Task Scheduler basically makes sure that various tasks run in a certain order. If tasks have fixed priority, the order is fixed. If they have variable priority, then during run - time the order of execution may change. Task 1 may become Task 3 and so on. Now a simple Task scheduler can be implemented by using an Array of Functions and some amount of stack manipulation. The index of the array can decide priority. For variable priority, swapping the elements of the array can be implemented. So if Task 1 has to become Task 3 , swap the 1st and third elements of the array. Task Scheduler is one of the most commonly used features of an OS which can be easily implemented.
2. OS-Timer :-- This is a basic timer which switches tasks when it expires. It ensures that each task runs only for a certain amount of time. When the OS-Timer interrupt occurs,current running task is popped from the stack and next task is pushed. Also checks for change in priority of the tasks are carried out. Usually interrupts cause change in task priority.
3. Semaphores :-- A semaphore is basically a flag. It can be used to protect data elements or variables from being corrupted by denying access to them. It can also be used to prevent execution of some code pockets. Now as can be seen from the description, very easy to develop.
4. Lists and Queues :-- These are used to basically buffer data. Basically if the data to be acted on arrives faster than it is processed, a List or a Queue can be used. Using Arrays of structures it is ease to develop these. Also standard functions to write, read and clear them are easy to develop.
While developing some OS features on your own, it is important to remember that OS is just a bunch of code. If there is good understanding of what the code does, then customized snippets performing some of the functions required are easily developed. These snippets can be modified as required to suit different project requirements.