[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Programming prioritisation



The analogy stands.

 

Anything at the front has higher (activity, resources) priority than anything admin. So do the messages coming from the front.

 

A message can carry any priority, the question is which criterium to use to assign it.

 

From: "ruth@xxxxxxxxxx"@ivimey.org [mailto:"ruth@xxxxxxxxxx"@ivimey.org] On Behalf Of Ruth Ivimey-Cook
Sent: Thursday, October 04, 2012 8:34 PM
To: eric.verhulst@xxxxxxxxxxxxx
Subject: Re: Programming prioritisation

 

Eric Verhulst (OLS) wrote:

In OpenComRTOS the equivalent of messages (implemented using Packet switching)  inherit the priority of the generating Task. What criterium would you else us?

Only giving priorities to messages make little sense as they don't use a lot of the processing resources, whereas Tasks/Processes do.


The point raised back then was that a message "implies" a priority of the things around it.

Consider an analogy.

A war office, with the generals poring over the battle plans. Someone comes in with a message about renewing the rum ration for the men, and a moment later another person comes in with a message about the enemy breaking through the lines.

In a programming situation, the send-updated-rum process was low priority, but the generals weren't doing anything much so it got some resource and did it's thing. The notify-battle conditions process was high priority, but it didn't start sending its message until after the rum message was sent.

Back in the war office, the general sees two messengers standing at the door, notices that while the man at the front is from the admin office, the one behind is obviously news from the front and takes it. The other is left till later.

In the program, to achieve this result you would have had to PRI ALT over two channels to have a hope, and even then it only works if you haven't started accepting the low priority one.


Essentially, priority is an aspect of the message, not the sender, though possibly it is better described as a message+receiver thing (the importance of the message to the recipient may change, depending on both). However, that is probably a layer of complexity too far.

How you could implement message-priority i don't know, but I think it is the right principle - and it doesn't rely on whether resources are shared or not: it works equally well for two cores as two threads.

Regards
Ruth



-- 
Software Manager & Engineer
Tel: 01223 414180
Blog: http://www.ivimey.org/blog
LinkedIn: http://uk.linkedin.com/in/ruthivimeycook/