BBC BASIC for Windows
« Pausing and restarting multiple PROCs ? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:51pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Pausing and restarting multiple PROCs ?  (Read 572 times)
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Pausing and restarting multiple PROCs ?
« Reply #3 on: Jun 19th, 2012, 01:43am »

Thanks for providing a reply, always good for someone to show interest.

Quote:
I'm not sure whether I'm not understanding what you are trying to achieve, or whether you're not understanding what 'multi-tasking' entails, but your program appears to be carrying out no task switching at all!


Hm, I think that "multi-tasking" was your term not mine. There is nothing obscure about the little demo, it is decidedly pedestrian really, is just does what it shows: switches between the two PROCs on a time clock.

Quote:
each 'task' has to explicitly preserve its own 'context' using PRIVATE variables, automatically restarting loops in the correct place and so on,


Yes, of course you figured that one out!

Quote:
whilst this is practical for the trivial tasks you have used it wouldn't be for anything more complicated.


I am not aiming to create a multi-user multi-tasking sub-operating system. I am just doing things which are useful to me when I want a programme to juggle several balls at once. If by "more complicated" you mean something which exceeds our imagination to solve it with these simple BASIC commands (thank you BB4W) then your proposition is arguably self-fulfilling. You say you have failed to create the system you wanted, so unfortunately you cannot share it with us. I just aim to do what can be done.

My original question still remains: Does the demo contain anything which - due to my ignorance of more sophisticated tenchnical matters - could be considered "dangerous" or "nasty". Hopefully not, otherwise I must change my strategy before I have gone too far!

Thanks again, best of luck!
--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Pausing and restarting multiple PROCs ?
« Reply #4 on: Jun 19th, 2012, 05:37am »

on Jun 19th, 2012, 01:43am, 19Grumpah42 wrote:
Hm, I think that "multi-tasking" was your term not mine.

You described it as a "time-sharing run-time executive (an RTE)" which, to me, implies task-switching.

Quote:
I am just doing things which are useful to me when I want a programme to juggle several balls at once.

The technique you have adopted cannot practically be extended to a situation in which the tasks do something more complicated than a simple loop. Suppose a task uses nested loops, or performs two or more operations in sequence. In those cases - which are still untypically simple - the saving-and-restoring of context (which is already quite messy in your trivial example) will rapidly become unmanageable.

Personally I don't think the term RTE can reasonably be applied to what you are doing. There is some time-sharing, but where is the "executive" if each task has responsibility for testing that its time-slice has elapsed and for saving/restoring its context?

Quote:
My original question still remains: Does the demo contain anything which - due to my ignorance of more sophisticated technical matters - could be considered "dangerous" or "nasty"

It's "dangerous" because it involves messy code, which cannot be understood 'at a glance' and which will be very difficult to test and debug.

You can write a program which appears to be doing 'several things at once' without introducing anything as complicated, and risky, as the code you have listed. Typically there is no need to divide the tasks into 'time slices', which is the key complicating feature of your code. Instead simply get each procedure to perform a processing 'chunk' which is a natural unit, such as one iteration of a loop. It probably doesn't matter if it takes a microsecond or a millisecond, so long as it takes only a short time.

That way there's no need for a timer interrupt, no need for tasks to monitor how long they have been running, and the saving and restoring of context is hugely simplified. By stripping the program of all the overheads associated with your 'RTE' it will be shorter, faster, easier to understand and more reliable.

Richard.
« Last Edit: Jun 19th, 2012, 05:42am by admin » User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Pausing and restarting multiple PROCs ?
« Reply #5 on: Jun 20th, 2012, 07:23am »

Thanks for the detailed reply, I'm definitely relieved to hear that there is nothing fundamental wrong with my little example. I was surprised that you consider PRIVATE variables to be "messy", but never mind.

Quote:
It's "dangerous" because it involves messy code, which cannot be understood 'at a glance' and which will be very difficult to test and debug.


Well, no need for you to fret! If you have difficulty understanding my "trivial" example, just leave it for others to get on with. I am now implementing a controlled and extended version of the structured and cascaded error trapping methods, as you strongly recommended, so debugging is very straightforward, and this little programme is - of course - a test in its own right, so I guess it was easy to test. Don't worry, I'm quite happy now.

--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Pausing and restarting multiple PROCs ?
« Reply #6 on: Jun 20th, 2012, 08:23am »

on Jun 20th, 2012, 07:23am, 19Grumpah42 wrote:
If you have difficulty understanding my "trivial" example, just leave it for others to get on with.

Very droll. rolleyes

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls