Page 1 of 1

New type of priority function? OSAttention()

PostPosted: Fri Sep 28, 2001 12:47 am
by aek
I haven't given this too much thought, and it certainly won't be incorporated into the v2.3.0 release.

But how's this for an idea? Since the "resume address" of each task is quite accessible (as OSTCBP(n)->tFP), one could "force" one or more tasks to vector (this would be a call ... return kind of thing) to a particular place in the code the next time they run ...

------------------


Re: New type of priority function? OSAttention()

PostPosted: Fri Sep 28, 2001 7:49 am
by luben
By the way in my mind came idea of one other function that doesn’t exist in SALVO – let’s call it OSAttention(OSAttentionLevel) – of course it’s very unclear in my mind, so I just share my initial thoughts. It should be something that will be read from all other tasks (or some of them), something important. This idea came from the real life – your messages are information streams. But they don’t have priorities, hierarchy. Imagine you receive a stream of messages like “You late, you have to hurry”, “turn left the car”, “your phone rings” and “your home burns”. If you don’t have hierarchy of the messages you even could process them by their natural sequence – one after other and you’ll process the “burning home” message last. Of course this could be implement in SALVO like different task that has highest priority and waits forever for “fire” related event. After waking up the task could change priorities of different tasks to make possible quick response to the emergency event.

But emergency events have totally different algorithm, they are totally different from normal stream of operation (“fire” example – you begin to do absolutely different things, you behave in different manner). So, maybe after issuing OSAttention() all task should understand that situation is changed. Maybe the kernel will bring the control to fixed location into every task – something like interrupt vectors in uP. So, we can call such function OSAttention “SALVO interrupt” – it breaks the common operation of all or some of tasks (that are defined to be sensitive to attention) and brings the control to some special section of every task, where the programmer takes care for such emergency cases. Such behavior looks like JMP (not like CALL). Of course this could be done with current SALVO like defining emergency tasks and stopping the tasks that we don’t need in emergency situation, for sure it could be implemented with current SALVO, but on very high price. Will be more natural if we have some simple, build-in way to process all emergency events

In short – what is the core of my idea is – how to implement different priorities for the events, how to define some “emergency”, “special” events without doing complicated algorithms in the tasks, something like Interrupts in SALVO that could break the normal operation and to switch to different type of operations into all or some of the tasks. As I told you – it’s just initial idea and I know that it needs time to ripe or to be removed totally (due to absence of sense). The way of our mind’s movements is like “ant” track on the bottom – left, right, up, down, until we get the crumb of bread.


Re: New type of priority function? OSAttention()

PostPosted: Fri Sep 28, 2001 8:52 am
by luben
Hello,

Yes, because SALVO can access any of the labels, defined into tasks, in some situation it's possible the user to force to GOTO some of this labels, let's call it - Emergency Label and to do this immediately. And tasks that are eligible and marked for emergency will be forced to go not to the normal return point , but to the emergency labels. Something like mobilization in war situation - you don't go in the office, but in the army. Or other time - you don't go in the office, because your car need service right now. Or old friend is deadly ill - you don't go in the office too. And this is part of the real life.. I mean, it's possible. The same is with the programs - sometimes they need to break dramatically the rules. Because SALVO is very good made, it's really hard to break the rules dramatically - waiting forever tasks for some event will wake up only after the danger disappeared, delayed for long time tasks will wake up after the house was burned up. Do you understand the basic idea - how to force all sleeping functionality to wake up and to go in emergency state (sounds very actual for US now).

As I told you - this is just idea and it's not cleared. But the seed is - sometimes we need to break the rules, or more exactly - to change dramatically the rules. In such cases we need some new approach - to GOTO to some place immediately. So all tasks that are waiting or delayed and are marked for emergency will wake up and go to some place.

Even it's possible to be defined some number of different attention - Atention Levels. Calling every lavel will break the normal algorithm of some tasks and GOTO to their EMERGENCY labels for this attention level.

An example, that will explain my idea - you have hot printing machine with head, that is over 200 degress hot and it's controlled from step mottor. Now imagine that the worker put his hand under the thermal head (accident) and tries to remove it - he press the emergency stop button. With current functionality of SALVO is hard to implement such immediately response in all levels, taht will save the worker. Well, using EFlags could help somehow, but the program will become very heavy - to watch after every efent flag waiting is there emergency bit set. I tell you this, because a friend of mine was badly injured because the machine didn't have immediately save response. One tick more - and it's late.

As I told you this is just idea. All your efforts are into direction to make SALVO with clear algorythm, simple and clear rules. Maybe my idea is in opposide direction - to make exception of this rules. You know - in the real life is good from time to time to make exceptions, they are part of our life and they ar every useful in critical situations. SO, this article is maybe in destroy direction for SALVO - to bring some small amount of "haos" into it's university... little solt.

Regards
Luben

[This message has been edited by luben (edited September 28, 2001).]