Pumpkin, Inc.

Pumpkin User Forums

New time oriented function

Have an idea on how to make Salvo better? Post it here!

Re: New time oriented function

Postby luben » Fri Sep 28, 2001 3:12 am

Hello,

I tried to imagine the worst case, that could be use in the practic and could revail hidden problems in the new time oriented function. If it can support it – then will be no problem for more simply cases to be solved.

So, let’s imagine that we have 8 tasks , especially 8 tasks use new OS_Interval function with different Interval values and different offset. And all they use OS_Delay, OS_Yield, OS_WaitXYZ with timeout between their calls of OS_Interval . That means you can’t exchange OS_Interval with OS_Delay, because of the impossibility to calculate exactly amount of time consumed of additional delays, waiting for events, timeouts. So if your OS_Interval can “survive” in such environment - it’s made in the right way. In short – if OS_Interval can “live” when:
- multiple tasks use OS_Delay in the same time with different values, when other tasks use OS_Interval and this will not destroy their pace rhythm.
- multiple tasks use different OS_Interval with different intervals and offsets – SALVO have to allow multiple OS_Interval to be used in different tasks simultaneously.
- between calling of OS_Interval the user could issue OS_Delay, OS_WaitXYZ or OS_Yield many times without destroying the pace rhythm of intervals (the last two functions are not so critical, but OS_Delay is critical, because of the similarity to OS_Interval). This could be done if additional function have to be called, like OSReadSync – like you proposed. This case needs additional variable (where to keep the value from OSReadSync), but only in these tasks where OS_Delay is called between OS_Interval.

I think that my idea for accumulating time events is not good and I agree that OS_Interval without such accumulating is like OS_Delay. And delaying to wake up for more then 2 intervals is indicative of deep failures inside the structure of the program. This simplifies the implementation of the new function. In fact this is not a restriction, but the normal, desired way of operation.


Regards
Luben

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

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: New time oriented function

Postby aek » Fri Sep 28, 2001 6:29 am

Please repost the OSAttention() idea to a new topic (and remove it from the previous posting, leaving the OSInterval() stuff in there).

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

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: New time oriented function

Postby aek » Fri Sep 28, 2001 6:39 am

I've given some more thought to the OSInterval() issue.

1) Here are two code snippets that do your earlier example:

code:
while(1) {
...
OS_Delay(4.9s, label1);
LED = 1;
OS_Delay(0.1s, label2);
LED=0;
...
}

and

code:
while (1) {
...
OS_Interval(5.0s, label1);
LED=1;
OS_Delay(0.1s, label2);
LED=0;
...
}

The second one is much more elegant, and more accurate, too.

There is one major problem, though, and that is the issue of RAM. For the second example, the "sync value" would have to be stored separately. This isn't a problem on an x86, but it would need an additional sizeof(sync) x OSTASKS of RAM on a PICmicro.

I think the best way around this problem would be something like this:

code:
static OStypeDelay sync;

while (1) {
...
OS_Interval(5.0s, label1);
sync=OSGetSync();
LED=1;
OS_Delay(0.1s, label2);
LED=0;
OSSetSync(sync);
...
}


This way, static RAM to save a particular task's sync is needed only in those tasks that use both OS_Interval() and OS_Delay(). The actual OSGetSync() and OSSetSync() functions are very small, and the library ROM size is actually smaller than if an extra field in each tcb were dedicated to the sync.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: New time oriented function

Postby luben » Fri Sep 28, 2001 7:57 am

Hello,

Because not all task will use both OS_Interval and OS_Delay the RAM usage for sure will be less then we expected. I mean, one additional variable for task that wants such big "extra" is acceptible. I feel that the idea came near to the final point, of course with the suplementary function OSReadSync() and OSSetSync(). I mean, it's better the user to care for such variable, then to increase the size of RAM memory for variables, that will be not used from all tasks.

At now moment we have good balance between simplicity, functionality and compact code. Seems that SALVO becomes more and more beautiful :-) I just wonder how it will look like after year or two.......

Luben

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

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: New time oriented function

Postby luben » Fri Sep 28, 2001 8:29 am

Hello,

Time Stamp is OK and brings really good idea for boths - that this is time oriented function and it's something similar to OS_Delays(). The last one will preserve users to use OS_Delay and OS_DelayTS without attention. Congratulations - now the idea looks very good. Will be very nice if this could be implemented into SALVO 2.3. I don't have patient to use the new SALVO 2.3 :-)

Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: New time oriented function

Postby luben » Wed Oct 10, 2001 1:28 am

Hello,

I think that SALVO2.2 users could very easy do something like OSInterval() function, by using standard BinSem.

When calling OSTimer() or by other time Interrupt function the user can call OSSignalBinSem(BINSEM_time_stamp....) that will result of Interval oriented function. By simple adding of some prescaller the user can get almost any pace rate. Well, every task should has its own BinSem, that consumes RAM and ROM and if they use prescaller - additional variable. It will really work nice, if you don't care for very tight code.
The task that needs the pace rate will only wait for this BinSem.

Just an idea for users that still have SALVO2.2 and want to have OSInterval in their projects.

Regards
Luben

[This message has been edited by luben (edited October 10, 2001).]

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: New time oriented function

Postby luben » Mon Nov 05, 2001 8:56 am

Hello,

I had to remake a project on ATMEL89C4051 with Franklin C compiler (where is build in RTOS) and I succeeded to implement their poor functions for multitasking.

What I saw is that they have 2 types of delays - relative and absolute. The second type of delay is similar to OS_Interval() and the first one is just normal delay.

This approach to delays is implemented into wait semaphores and wait signals timeouts - relative and absolute timeouts exists.

I meant, one other approach, inspired from this compiler is just to define 2 types of time related functins - let's say normal time delay/timeout and Interval or Absolute delay/timeout.

I sent you the HELP file of Frnaklin and you can see the description of these functions there.

For sure all multitasking services are very, very poor, compared with SALVO. In addition there is very bad mnemonic of the functions - you can't understand from first view what's up. They use inverse type of semaphores compared with SALVO - if set - wait, if cleared - continue. Maybe ATMEL is not so optimized for speed processor, because for 3 tasks system one contex switch happens not less then 800uS.

Some advantages are too - because this is build in RTOS, there is no need to create labels for contex switch operators. There is semi automatic definition of signals and semaphores. And maybe it's very good optimization for code/RAM size and speed. They have something like wizard to chose the type of RTOS model (thiny, standard, professional), RAM size, ROM size, etc.

Anyway, the basic idea of this issue is just to throw the idea that all time functions (delays and timeouts) could be just defined like 2 types - absolute and realtive.

So, you can have OS_WaitBinSem() for relative times and OS_WaitBinSemABS() for absolute intervals. And OS_Delay() and OS_DelayABS().... Or to have additional field showing that the time is relative or absolute. Or even it's possible to check the sign of the time value - negative for absolute delays/timeouts, positive values for relative delays/timeouts... Well, I know that you're better then me in creating excellent mnemonic.

Best regard and good luck

Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: New time oriented function

Postby tbims23822 » Wed Jul 08, 2009 12:24 am

www.drop-shopping.com is a premium website for cheap air jordans shoes and other more really nike air jordan shoes.We have varity of cheap air jordan shoes available for wholesale.Cheap China wholesale shoes including cheap Nike shoes and cheap jordan shoes,nike sneakers,nike sneakers discount,air jordan sneakers,air force sneakers.We supply nike sneakers,jordan sneakers,air jordan sneakers,air force sneakers wholesale.You can buy very cheap jordans shoes including cheap women shoes,cheap nike shoes,cheap running shoes from us.

tbims23822
 

Previous

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest