a module a page (keeps the mind sane)?
I'm looking into the code that is written for the citizen science project Luftdaten. The link below shows the code for firmware for a sensor node, the esp8266. https://github.com/opendata-stuttgart/sensors-software/blob/master/airrohr-f... The firmware is written in the arduino language. Arduino is not a modulair language, the main program is over 4000 lines of code. +/- 75 pages (A4). Does anyone remember where Niklaus mentions the ' one page of code, one module ' rule? Greets, F.P. Vonck
Hi Frans-Pieter,
Does anyone remember where Niklaus mentions the ' one page of code, one module ' rule?
When you originally asked this (on this list in December 2015, can't believe it was that long ago!) :) I asked a colleague and he couldn't remember where he had read it either. But asked again and intrigued, he embarked on a browse of his dead-tree library and eventually conceded that what he had probably remembered, or at least the closest thing he could find, was "The Elements of Programming Style", 2nd Edition (Kernighan and Plauger), page 150, bottom two lines:- "The modularization would have the advantage that each part of the program would fit comfortably on one page." (BTW Google indicates that the Università di Pisa seems to have a PDF of this book on its server for course materials, but I'm not sure what the copyright status is...) I'm reminded of the fact that it often really doesn't matter who said it. The (rather topical, albeit now-sexist) quote "The only thing necessary for the triumph of evil is for good men to do nothing" is, according to the UK Independent newspaper, often "attributed to [the 18th Century Irish politician] Edmund Burke, including by John F Kennedy in a speech in 1961. [But] Burke didn’t say it [although certainly he could have done], and its earliest form was by John Stuart Mill, who said in 1867: 'Bad [people] need nothing more to compass their ends, than that good [people] should look on and do nothing.'" Cheers, Paul
On 3 Nov 2018, at 14:55, Paul Reed <paulreed@paddedcell.com> wrote:
Hi Frans-Pieter,
Does anyone remember where Niklaus mentions the ' one page of code, one module ' rule?
When you originally asked this (on this list in December 2015, can't believe it was that long ago!) :) I asked a colleague and he couldn't remember where he had read it either.
But asked again and intrigued, he embarked on a browse of his dead-tree library and eventually conceded that what he had probably remembered, or at least the closest thing he could find, was
"The Elements of Programming Style", 2nd Edition (Kernighan and Plauger), page 150, bottom two lines:-
"The modularization would have the advantage that each part of the program would fit comfortably on one page."
There was a very practical reason for a 'one page, one procedure' rule when I started programming in the early 1980s. I was a COBOL programmer and we did not have terminals or such luxuries. Instead we wrote our code in pencil on coding sheets (paper), submitted it to the data prep women (always women) and a few days later received the sheets back with a paper tape version of the source code which we could then attempt to compile. Because we practised Jackson Structured Programming we could write subroutines which fit on one coding sheet and re-use the coding sheets for other programs, or shuffle them, insert other code on separate sheets etc as needed. Only for short, simple edits and quick compiler turnaround when we had the machine to ourselves on a Tuesday evening did we need to cut and paste, quite literally, the paper tape. Anything involving a new coding sheet would take a week, but that was much easier than dealing with something monolithic which involve re-pencilling numerous sheets from scratch.
I was a COBOL programmer and we did not have terminals or such luxuries. Instead we wrote our code in pencil on coding sheets (paper), submitted it to the data prep women (always women) and a few days later received the sheets back with a paper tape
That reminds me of my early attempts with programming, FORTRAN '77, punch cards, we also had punch tapes. Cards had little advantage as they had code printed at the top. No terminals, system typing machine, resembling a type writer. Also women were called admins at that time, nowadays admins have different meaning and not always women :-) One page concept can also be seen in Forth language, sort of. I had toyed with years ago, never mastered though, the code, text is split into 512 block entities, fixed. Each block doing something useful on its own, is also mapped directly to underlying persistent media physical blocks. -- Tomas Kral <thomas.kral@email.cz>
Tomas:
That reminds me of my early attempts with programming, FORTRAN '77, punch cards, we also had punch tapes. Cards had little advantage as they had code printed at the top. No terminals, system typing machine, resembling a type writer.
My earliest programming experience was Fortran IV using Cyber 73. A practical limit of a program size was a box full of cards. It was difficult to maintain decks of cards which would not fit into a box. In all honesty, the Cyber 73 operating system named SCOPE allowed to maintain the programs on disk rather than in a box. So a box was not a hard limit. The women were always at the other side of the glass. I watched them taking my decks of cards, unwrapping a rubber band holding the cards together, and feeding the decks to a punch card reader. We called these women "operators". Fortran 77 came later.... Wojtek
One page concept can also be seen in Forth Wauw, Forth. One line of Forth is already mind-boggling, let alone a full page.
Greets, F.P. Tomas Kral schreef op 2018-11-03 17:10:
I was a COBOL programmer and we did not have terminals or such luxuries. Instead we wrote our code in pencil on coding sheets (paper), submitted it to the data prep women (always women) and a few days later received the sheets back with a paper tape
That reminds me of my early attempts with programming, FORTRAN '77, punch cards, we also had punch tapes. Cards had little advantage as they had code printed at the top. No terminals, system typing machine, resembling a type writer.
Also women were called admins at that time, nowadays admins have different meaning and not always women :-)
One page concept can also be seen in Forth language, sort of. I had toyed with years ago, never mastered though, the code, text is split into 512 block entities, fixed. Each block doing something useful on its own, is also mapped directly to underlying persistent media physical blocks.
On Mon, 5 Nov 2018 at 21:37, Frans-Pieter Vonck <fp@vonck.nl> wrote:
Wauw, Forth. One line of Forth is already mind-boggling, let alone a full page.
Heh. You should see APL, then. It makes Forth look like BASIC. :-D -- Liam Proven - Profile: https://about.me/liamproven Email: lproven@cix.co.uk - Google Mail/Hangouts/Plus: lproven@gmail.com Twitter/Facebook/Flickr: lproven - Skype/LinkedIn: liamproven UK: +44 7939-087884 - ČR (+ WhatsApp/Telegram/Signal): +420 702 829 053
In "Psychology of Computer Programming", from the early 1970s or so, Weinberg reported that studies showed that programmer comprehension generally dropped dramatically the moment the programmer had to scroll the edit window or turn the page on a listing. This gave rise to the "one page, one module" guideline. Bob Walkden said:
There was a very practical reason for a 'one page, one procedure' rule when I started programming in the early 1980s.
I was a COBOL programmer and we did not have terminals or such luxuries. Instead we wrote our code in pencil on coding sheets (paper), submitted it to the data prep women (always women) and a few days later received the sheets back with a paper tape version of the source code which we could then attempt to compile.
Because we practised Jackson Structured Programming we could write subroutines which fit on one coding sheet and re-use the coding sheets for other programs, or shuffle them, insert other code on separate sheets etc as needed. Only for short, simple edits and quick compiler turnaround when we had the machine to ourselves on a Tuesday evening did we need to cut and paste, quite literally, the paper tape.
Anything involving a new coding sheet would take a week, but that was much easier than dealing with something monolithic which involve re-pencilling numerous sheets from scratch.
--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of John R. Strohm Sent: Sunday, 4 November 2018 8:45 AM To: paulreed@paddedcell.com; ETH Oberon and related systems Subject: Re: [Oberon] a module a page (keeps the mind sane)?
In "Psychology of Computer Programming", from the early 1970s or so, Weinberg reported that studies showed that programmer comprehension generally dropped dramatically the moment the programmer had to scroll the edit window or turn the page on a listing. This gave rise to the "one page, one module" guideline.
That is true. However, what has changed from the 1970's is the number of lines than can be viewed on an edit window without scrolling. The early VDU screens used to be 24 lines by 80 characters. With one of my 20" monitors in portrait mode I can easily read 125 lines by 80 characters using a 9pt Consolas monospaced font. That still leaves enough room for the Astrobe title bar, menu, toolbar, tab headings, status bar and procedure navigation / import list pane. Note that in those days a complete application would often have been in a single file and the term 'module' would have been referring to a logical unit equivalent to one of today's procedures. Regards, Chris Chris Burrows CFB Software http://www.astrobe.com/RISC5
I don‘t know whether NW or another person once really said „one page, one module“. I personally don‘t follow that guideline; I’m rather follower of Chris‘ guideline „one page, one procedure“. It‘s anyhow difficult as the word „page“ is vaguely defined and heavily depends on the screen size, resolution and font used😀 Whenever a procedure doesn‘t fit on one „page“ I try to split it. But I‘m not absolutely consequent on this guideline either. There are cases where a procedure is longer than a page. Cases that come to my mind where I break my own guideline: A) long CASE statement. But I try to at least fit one CASE on one page B) HW drivers, where speed is king and I don‘t want jumps an inner loop Jörg Am 03.11.2018 um 23:51 schrieb Chris Burrows <chris@cfbsoftware.com>:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of John R. Strohm Sent: Sunday, 4 November 2018 8:45 AM To: paulreed@paddedcell.com; ETH Oberon and related systems Subject: Re: [Oberon] a module a page (keeps the mind sane)?
In "Psychology of Computer Programming", from the early 1970s or so, Weinberg reported that studies showed that programmer comprehension generally dropped dramatically the moment the programmer had to scroll the edit window or turn the page on a listing. This gave rise to the "one page, one module" guideline.
That is true. However, what has changed from the 1970's is the number of lines than can be viewed on an edit window without scrolling. The early VDU screens used to be 24 lines by 80 characters. With one of my 20" monitors in portrait mode I can easily read 125 lines by 80 characters using a 9pt Consolas monospaced font. That still leaves enough room for the Astrobe title bar, menu, toolbar, tab headings, status bar and procedure navigation / import list pane.
Note that in those days a complete application would often have been in a single file and the term 'module' would have been referring to a logical unit equivalent to one of today's procedures.
Regards, Chris
Chris Burrows CFB Software http://www.astrobe.com/RISC5
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Jörg said:
I don‘t know whether NW or another person once really said „one page, one module“. I personally don‘t follow that guideline; I’m rather follower of Chris‘ guideline „one page, one procedure“. It‘s anyhow difficult as the word „page“ is vaguely defined and heavily depends on the screen size, resolution and font used😀
Whenever a procedure doesn‘t fit on one „page“ I try to split it. But I‘m not absolutely consequent on this guideline either. There are cases where a procedure is longer than a page. Cases that come to my mind where I break my own guideline: A) long CASE statement. But I try to at least fit one CASE on one page B) HW drivers, where speed is king and I don‘t want jumps an inner loop
I've been in this crazy racket, as student and then professional, since about 1970. In all of that time, close to half a century now, with the specific exception of CASE statements implementing finite state machines parsing things (source code files, event trace sequences), I've seen exactly one procedure [*] that NEEDED to be more than one printed page (about 60 lines) long. I've seen a LOT of run-on stream-of-consciousness procedures that were a lot longer than 60 lines, and ALL of them could have been made a lot simpler with some judicious refactoring. (One in particular was a HUGE cut-and-paste mess, that I reduced DRAMATICALLY by undoing the cut-and-paste and making about half a dozen short procedures for the common fragments.) Elizabeth Rather and I agreed that FORTH was powerful and good, but we disagreed on why. She was convinced it was the interactive nature. I remain convinced that it is because it is NOT POSSIBLE in the typical FORTH system to write a procedure longer than 16 lines x 64 characters. (Yes, the language is extremely concise, compared to common languages, but the point remains the same. FORTH *FORCES* modularization.) I also observe that I saw long run-on stream-of-consciousness modules written by people using a FORTH that allowed longer things. [*] The module in question was actually a FORTRAN IV subroutine, from the CDC 6600 STARTRK game. It was the photon torpedo handler. It had to set up a loop, to handle firing either one or three torpedoes, around a loop that simulated the torpedo flightpath, around setting up a stack to simulate recursion and do 8-way connectivity, to detect nova chain reactions. FORTRAN IV didn't support recursion, so the programmer had to fake it. I suspect that it would have been a bit simpler in a language that supported recursion. --John R. Strohm --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
I remain convinced that it is because it is NOT POSSIBLE in the typical FORTH system to write a procedure longer than 16 lines x 64 characters.
Reading this, I have to correct my earlier statement about FORTH, one code page/one screen window/one file block = 16x64 = 1024 flat file with filling blanks. My understanding was, that file caching was not necessary as h/w pages(sectors) were mapped directly to code blocks, for better performance reasons, possibly. -- Tomas Kral <thomas.kral@email.cz>
maybe it was an ideal Dijkstra rule. A handwritten prove of only one page Greets, F.P. John R. Strohm schreef op 2018-11-03 23:15:
In "Psychology of Computer Programming", from the early 1970s or so, Weinberg reported that studies showed that programmer comprehension generally dropped dramatically the moment the programmer had to scroll the edit window or turn the page on a listing. This gave rise to the "one page, one module" guideline.
Bob Walkden said:
There was a very practical reason for a 'one page, one procedure' rule when I started programming in the early 1980s.
I was a COBOL programmer and we did not have terminals or such luxuries. Instead we wrote our code in pencil on coding sheets (paper), submitted it to the data prep women (always women) and a few days later received the sheets back with a paper tape version of the source code which we could then attempt to compile.
Because we practised Jackson Structured Programming we could write subroutines which fit on one coding sheet and re-use the coding sheets for other programs, or shuffle them, insert other code on separate sheets etc as needed. Only for short, simple edits and quick compiler turnaround when we had the machine to ourselves on a Tuesday evening did we need to cut and paste, quite literally, the paper tape.
Anything involving a new coding sheet would take a week, but that was much easier than dealing with something monolithic which involve re-pencilling numerous sheets from scratch.
--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Eventloop the arduino way. (a little offtopic Here is a nice example on Adafruit how multitasking can be achieved with a timer. https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview As the tutorial progresses the event loop is cleaned up by using classes. a snippet from the code: Flasher led1(12, 100, 400); Flasher led2(13, 350, 350); void loop() { led1.Update(); led2.Update(); } A scheduler is not necessary and the code is still readable. Could be nice also as an example for oberon07 (astrobe) Greets, F.P.
F.P. Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon. T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T); Every 1000 ms the procedure „myHandler“ will be called. Another way to have cooperative multitasking is to implement module „Coroutines“. br Jörg
Am 05.11.2018 um 22:02 schrieb Frans-Pieter Vonck <fp@vonck.nl>:
Eventloop the arduino way. (a little offtopic Here is a nice example on Adafruit how multitasking can be achieved with a timer. https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview
As the tutorial progresses the event loop is cleaned up by using classes.
a snippet from the code:
Flasher led1(12, 100, 400); Flasher led2(13, 350, 350);
void loop() { led1.Update(); led2.Update(); }
A scheduler is not necessary and the code is still readable. Could be nice also as an example for oberon07 (astrobe)
Greets, F.P. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Jörg, I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that, Thanks. F.P. Jörg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure „myHandler“ will be called.
Another way to have cooperative multitasking is to implement module „Coroutines“.
br Jörg
Am 05.11.2018 um 22:02 schrieb Frans-Pieter Vonck <fp@vonck.nl>:
Eventloop the arduino way. (a little offtopic Here is a nice example on Adafruit how multitasking can be achieved with a timer. https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview
As the tutorial progresses the event loop is cleaned up by using classes.
a snippet from the code:
Flasher led1(12, 100, 400); Flasher led2(13, 350, 350);
void loop() { led1.Update(); led2.Update(); }
A scheduler is not necessary and the code is still readable. Could be nice also as an example for oberon07 (astrobe)
Greets, F.P. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
F.P. "Coroutines" is very small; if I remember correctly a page of code for the whole module or so. This module is very compact but not easy to understand for outsiders as it "just" plays around with internal registers. If I have time I might port it over. br Jörg -----Original Message----- From: Frans-Pieter Vonck <fp@vonck.nl> Sent: Tuesday, November 6, 2018 9:09 AM To: Jörg Straube <joerg.straube@iaeth.ch> Cc: ETH Oberon and related systems <oberon@lists.inf.ethz.ch>; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)? Hi Jörg, I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that, Thanks. F.P. Jörg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure „myHandler“ will be called.
Another way to have cooperative multitasking is to implement module „Coroutines“.
br Jörg
Am 05.11.2018 um 22:02 schrieb Frans-Pieter Vonck <fp@vonck.nl>:
Eventloop the arduino way. (a little offtopic Here is a nice example on Adafruit how multitasking can be achieved with a timer. https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview
As the tutorial progresses the event loop is cleaned up by using classes.
a snippet from the code:
Flasher led1(12, 100, 400); Flasher led2(13, 350, 350);
void loop() { led1.Update(); led2.Update(); }
A scheduler is not necessary and the code is still readable. Could be nice also as an example for oberon07 (astrobe)
Greets, F.P. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed. "An alternative to threads is presented as a paradigm for single-processor multi-tasking systems. It avoids complex and hidden mechanisms for process scheduling, and is therefore particularly suitable for realtime systems requiring fast response times, and for small systems in general." "Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept and is shown to require surprisingly few changes and additions to the existing system, hence retaining its basic compactness and efficiency." An implementation of these ideas (called System7) on Native Oberon can be downloaded from the ETH Oberon site: ftp://ftp.ethoberon.ethz.ch by following the path: ETHOberon/Contrib/System7/ Now that interrupts are working on Project Oberon 2013 it would be an interesting exercise to try out these concepts there as well, Regards, Chris Chris Burrows CFB Software http://www.astrobe.com/RISC5
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Frans-Pieter Vonck Sent: Tuesday, 6 November 2018 6:39 PM To: Jörg Straube Cc: ETH Oberon and related systems; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Hi J rg,
I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that,
Thanks. F.P.
J rg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure myHandler will be called.
Another way to have cooperative multitasking is to implement module Coroutines .
br J rg
Hi Chris, do you have by any chance a link for the article "Tasks versus Threads [..]" I cannot find it on the net. From Wirth: "Embedded Systems and Real-Time Programming" " The next decision was to eliminate the RT-OS, as it seemed possible to do essentially without concurrent processes in the form of threads. The third decision was to program the entire software in Oberon [2], which is very suitable for programming close to the hardware." So he probably used Tasks vs Threads concept for the helicopter.
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept In the oberon loop the commands are already interrupted by input events: keyboard, mouse, network communication. Does he mean, tat a task can interrupt another task? Explanation must be found in his article.
Greets, F.P. Chris Burrows schreef op 2018-11-06 11:48:
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed.
"An alternative to threads is presented as a paradigm for single-processor multi-tasking systems. It avoids complex and hidden mechanisms for process scheduling, and is therefore particularly suitable for realtime systems requiring fast response times, and for small systems in general."
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept and is shown to require surprisingly few changes and additions to the existing system, hence retaining its basic compactness and efficiency."
An implementation of these ideas (called System7) on Native Oberon can be downloaded from the ETH Oberon site:
ftp://ftp.ethoberon.ethz.ch
by following the path:
ETHOberon/Contrib/System7/
Now that interrupts are working on Project Oberon 2013 it would be an interesting exercise to try out these concepts there as well,
Regards, Chris
Chris Burrows CFB Software http://www.astrobe.com/RISC5
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Frans-Pieter Vonck Sent: Tuesday, 6 November 2018 6:39 PM To: Jörg Straube Cc: ETH Oberon and related systems; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Hi J rg,
I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that,
Thanks. F.P.
J rg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure myHandler will be called.
Another way to have cooperative multitasking is to implement module Coroutines .
br J rg
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
I have found a copy here: http://norayr.am/papers/WirthTasksVersusThreads.pdf On Tue, Nov 6, 2018 at 5:00 AM Frans-Pieter Vonck <fp@vonck.nl> wrote:
Hi Chris,
do you have by any chance a link for the article "Tasks versus Threads [..]" I cannot find it on the net.
From Wirth: "Embedded Systems and Real-Time Programming"
" The next decision was to eliminate the RT-OS, as it seemed possible to do essentially without concurrent processes in the form of threads. The third decision was to program the entire software in Oberon [2], which is very suitable for programming close to the hardware." So he probably used Tasks vs Threads concept for the helicopter.
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept In the oberon loop the commands are already interrupted by input events: keyboard, mouse, network communication. Does he mean, tat a task can interrupt another task? Explanation must be found in his article.
Greets, F.P.
Chris Burrows schreef op 2018-11-06 11:48:
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed.
"An alternative to threads is presented as a paradigm for single-processor multi-tasking systems. It avoids complex and hidden mechanisms for process scheduling, and is therefore particularly suitable for realtime systems requiring fast response times, and for small systems in general."
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept and is shown to require surprisingly few changes and additions to the existing system, hence retaining its basic compactness and efficiency."
An implementation of these ideas (called System7) on Native Oberon can be downloaded from the ETH Oberon site:
ftp://ftp.ethoberon.ethz.ch
by following the path:
ETHOberon/Contrib/System7/
Now that interrupts are working on Project Oberon 2013 it would be an interesting exercise to try out these concepts there as well,
Regards, Chris
Chris Burrows CFB Software http://www.astrobe.com/RISC5
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Frans-Pieter Vonck Sent: Tuesday, 6 November 2018 6:39 PM To: Jörg Straube Cc: ETH Oberon and related systems; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Hi J rg,
I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that,
Thanks. F.P.
J rg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure myHandler will be called.
Another way to have cooperative multitasking is to implement module Coroutines .
br J rg
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Thanks, F.P. Charles Perkins schreef op 2018-11-06 16:05:
I have found a copy here: http://norayr.am/papers/WirthTasksVersusThreads.pdf
On Tue, Nov 6, 2018 at 5:00 AM Frans-Pieter Vonck <fp@vonck.nl> wrote:
Hi Chris,
do you have by any chance a link for the article "Tasks versus Threads [..]" I cannot find it on the net.
From Wirth: "Embedded Systems and Real-Time Programming"
" The next decision was to eliminate the RT-OS, as it seemed possible to do essentially without concurrent processes in the form of threads. The third decision was to program the entire software in Oberon [2], which is very suitable for programming close to the hardware." So he probably used Tasks vs Threads concept for the helicopter.
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept In the oberon loop the commands are already interrupted by input events: keyboard, mouse, network communication. Does he mean, tat a task can
interrupt another task? Explanation must be found in his article.
Greets, F.P.
Chris Burrows schreef op 2018-11-06 11:48:
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed.
"An alternative to threads is presented as a paradigm for single-processor multi-tasking systems. It avoids complex and hidden mechanisms for process scheduling, and is therefore particularly suitable for realtime systems requiring fast response times, and for small systems in general."
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept and is shown to require surprisingly few changes and additions to the existing system, hence retaining its basic compactness and efficiency."
An implementation of these ideas (called System7) on Native Oberon can be downloaded from the ETH Oberon site:
ftp://ftp.ethoberon.ethz.ch
by following the path:
ETHOberon/Contrib/System7/
Now that interrupts are working on Project Oberon 2013 it would be an interesting exercise to try out these concepts there as well,
Regards, Chris
Chris Burrows CFB Software http://www.astrobe.com/RISC5
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Frans-Pieter Vonck Sent: Tuesday, 6 November 2018 6:39 PM To: Jörg Straube Cc: ETH Oberon and related systems; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Hi J rg,
I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that,
Thanks. F.P.
J rg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure myHandler will be called.
Another way to have cooperative multitasking is to implement module Coroutines .
br J rg
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Found the rule in Nasa/JPL document "Rules of Ten" , written by Gerard Holzmann. The Power of Ten – Rules for Developing Safety Critical Code ----------------------------- Rule 4 --------------- No function should be longer than what can be printed on a single sheet of paper in a standard reference format with one line per statement and one line per declaration. Typically, this means no more than about 60 lines of code per function. Rationale ---------------------- Each function should be a logical unit in the code that is understandable and verifiable as a unit. It is much harder to understand a logical unit that spans multiple screens on a computer display or multiple pages when printed. Excessively long functions are often a sign of poorly structured code. -------------------------------------- See, http://spinroot.com/gerard/pdf/P10.pdf Also interesting presentation by Holzmann about mission critical software standards. Mars Code https://youtu.be/Dk-tchkQXoQ Greets, F.P. Frans-Pieter Vonck schreef op 2018-11-06 17:45:
Thanks, F.P.
Charles Perkins schreef op 2018-11-06 16:05:
I have found a copy here: http://norayr.am/papers/WirthTasksVersusThreads.pdf
On Tue, Nov 6, 2018 at 5:00 AM Frans-Pieter Vonck <fp@vonck.nl> wrote:
Hi Chris,
do you have by any chance a link for the article "Tasks versus Threads [..]" I cannot find it on the net.
From Wirth: "Embedded Systems and Real-Time Programming"
" The next decision was to eliminate the RT-OS, as it seemed possible to do essentially without concurrent processes in the form of threads. The third decision was to program the entire software in Oberon [2], which is very suitable for programming close to the hardware." So he probably used Tasks vs Threads concept for the helicopter.
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept In the oberon loop the commands are already interrupted by input events: keyboard, mouse, network communication. Does he mean, tat a task can
interrupt another task? Explanation must be found in his article.
Greets, F.P.
Chris Burrows schreef op 2018-11-06 11:48:
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed.
"An alternative to threads is presented as a paradigm for single-processor multi-tasking systems. It avoids complex and hidden mechanisms for process scheduling, and is therefore particularly suitable for realtime systems requiring fast response times, and for small systems in general."
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept and is shown to require surprisingly few changes and additions to the existing system, hence retaining its basic compactness and efficiency."
An implementation of these ideas (called System7) on Native Oberon can be downloaded from the ETH Oberon site:
ftp://ftp.ethoberon.ethz.ch
by following the path:
ETHOberon/Contrib/System7/
Now that interrupts are working on Project Oberon 2013 it would be an interesting exercise to try out these concepts there as well,
Regards, Chris
Chris Burrows CFB Software http://www.astrobe.com/RISC5
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Frans-Pieter Vonck Sent: Tuesday, 6 November 2018 6:39 PM To: Jörg Straube Cc: ETH Oberon and related systems; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Hi J rg,
I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that,
Thanks. F.P.
J rg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure myHandler will be called.
Another way to have cooperative multitasking is to implement module Coroutines .
br J rg
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
As always: better take a top-down-view. The screen/page contents is subservient to the Human Cognition. Eg. this current WebBased gmail is far inferior to our 90's NativeOberon: - I can't see the email thread's Subject/Title. N.O. shows such vital info ALWAYS in the TopFrame. - If you need to have simultaneous sight of multiple sections of a textFile, N.O. does it. Products of this F/B twitter age can't. There's a problem of proliferation of fileNames and DirectoryTree structure, if every bit of info is to get its own file. When re/searching a new topic: I create a single <BookFile> with the SectionTitles at the top. Which is another example of needing to view 2 sections of a file together: see the top-ContentsDescription, while CopyPaste to autoSearch for the required section. Every time I search/read the book, it tends to become smaller; by deletions of the terrible redundancy of web-publications.
Every time I search/read the book, it tends to become smaller; I was trained to do my technical writing the Pyramid way. https://medium.com/lessons-from-mckinsey/the-pyramid-principle-f0885dd3c5c7
And I just met a russian programmer who had learned the visual language Drakon. Drakon is fun: https://drakonhub.com/video-drakon-part-1 Programming in Modula (Oberon) one needs no flow charting, according to Niklaus. However I feel comforable with drawing sketches with pencil and paper. Greets, Frans-Pieter eas lab schreef op 2018-12-19 02:30:
As always: better take a top-down-view. The screen/page contents is subservient to the Human Cognition. Eg. this current WebBased gmail is far inferior to our 90's NativeOberon: - I can't see the email thread's Subject/Title. N.O. shows such vital info ALWAYS in the TopFrame.
- If you need to have simultaneous sight of multiple sections of a textFile, N.O. does it. Products of this F/B twitter age can't.
There's a problem of proliferation of fileNames and DirectoryTree structure, if every bit of info is to get its own file.
When re/searching a new topic: I create a single <BookFile> with the SectionTitles at the top. Which is another example of needing to view 2 sections of a file together: see the top-ContentsDescription, while CopyPaste to autoSearch for the required section. Every time I search/read the book, it tends to become smaller; by deletions of the terrible redundancy of web-publications.
Just a remark to Drakon: In the example it was shown that a question icon (IF) may exit a repetition loop (FOR). In my point of view not a good practice and not possible in Oberon-07 Jörg -----Original Message----- From: Oberon <oberon-bounces@lists.inf.ethz.ch> On Behalf Of Frans-Pieter Vonck Sent: Wednesday, December 19, 2018 5:23 PM To: eas lab <lab.eas@gmail.com> Cc: ETH Oberon and related systems <oberon@lists.inf.ethz.ch> Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Every time I search/read the book, it tends to become smaller; I was trained to do my technical writing the Pyramid way. https://medium.com/lessons-from-mckinsey/the-pyramid-principle-f0885dd3c5c7
And I just met a russian programmer who had learned the visual language Drakon. Drakon is fun: https://drakonhub.com/video-drakon-part-1 Programming in Modula (Oberon) one needs no flow charting, according to Niklaus. However I feel comforable with drawing sketches with pencil and paper. Greets, Frans-Pieter eas lab schreef op 2018-12-19 02:30:
As always: better take a top-down-view. The screen/page contents is subservient to the Human Cognition. Eg. this current WebBased gmail is far inferior to our 90's NativeOberon: - I can't see the email thread's Subject/Title. N.O. shows such vital info ALWAYS in the TopFrame.
- If you need to have simultaneous sight of multiple sections of a textFile, N.O. does it. Products of this F/B twitter age can't.
There's a problem of proliferation of fileNames and DirectoryTree structure, if every bit of info is to get its own file.
When re/searching a new topic: I create a single <BookFile> with the SectionTitles at the top. Which is another example of needing to view 2 sections of a file together: see the top-ContentsDescription, while CopyPaste to autoSearch for the required section. Every time I search/read the book, it tends to become smaller; by deletions of the terrible redundancy of web-publications. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed.
In the article of Marco Sanvido explanation of the scheduler of HelyOS, the basis for the Onbass project. https://www.researchgate.net/profile/Marco_Sanvido/publication/2460197_A_Com... From the article: "The strategy usually adopted is the use of coroutines as the multitasking entity. Our approach, uses subroutines as the multitasking entity in- stead. The scheduler starts the subroutine tasks in a fixed and predefined order, according to their priority. The task may be preempted by other tasks, i.e. sus- pended but, in opposition to the coroutine approach, they run to completion." In wikipedia explained as: https://en.wikipedia.org/wiki/Rate-monotonic_scheduling#cite_note-12 The article of Wirth "Tasks versus Threads" was plublished in 1996, a year later, in 1997 the Marsrover was rebooting by the Watchdog timer,caused by used priority inheritence in combination with threads. "VxWorks provides preemptive priority scheduling of threads. Tasks on the Pathfinder spacecraft were executed as threads with priorities that were assigned in the usual manner reflecting the relative urgency of these tasks. Pathfinder contained an "information bus", which you can think of as a shared memory area used for passing information between different components of the spacecraft. A bus management task ran frequently with high priority to move certain kinds of data in and out of the information bus. Access to the bus was synchronized with mutual exclusion locks (mutexes)." From "What really happened on Mars Rover Pathfinder" http://www.rvs.uni-bielefeld.de/lectures/TechInf/TI2/download/19.49-1.1.html Some lessons learned... https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf Greets, F.P. Chris Burrows schreef op 2018-11-06 11:48:
I recommend that you read Wirth's 1996 paper titled "Tasks versus Threads: An Alternative Multiprocessing Paradigm". The relative merits of tasks, processes, coroutines and threads are discussed.
"An alternative to threads is presented as a paradigm for single-processor multi-tasking systems. It avoids complex and hidden mechanisms for process scheduling, and is therefore particularly suitable for realtime systems requiring fast response times, and for small systems in general."
"Tasks, called commands, are a conceptual pillar of the Oberon operating environment. Making them interruptible adds significant power to the concept and is shown to require surprisingly few changes and additions to the existing system, hence retaining its basic compactness and efficiency."
An implementation of these ideas (called System7) on Native Oberon can be downloaded from the ETH Oberon site:
ftp://ftp.ethoberon.ethz.ch
by following the path:
ETHOberon/Contrib/System7/
Now that interrupts are working on Project Oberon 2013 it would be an interesting exercise to try out these concepts there as well,
Regards, Chris
Chris Burrows CFB Software http://www.astrobe.com/RISC5
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Frans-Pieter Vonck Sent: Tuesday, 6 November 2018 6:39 PM To: Jörg Straube Cc: ETH Oberon and related systems; paulreed@paddedcell.com Subject: Re: [Oberon] a module a page (keeps the mind sane)?
Hi J rg,
I saw the coroutine module is not yet written for project oberon. But that does not keep me from trying out the concept of cooperatieve multitasking. I will look into that,
Thanks. F.P.
J rg Straube schreef op 2018-11-05 23:22:
F.P.
Installing tasks in the Oberon loop is THE way to enable multi tasking in Oberon.
T := Oberon.NewTask(myHandler, 1000); Oberon.Install(T);
Every 1000 ms the procedure myHandler will be called.
Another way to have cooperative multitasking is to implement module Coroutines .
br J rg
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
https://en.wikipedia.org/wiki/Rate-monotonic_scheduling#cite_note-12 ..."What really happened on Mars Rover Pathfinder" http://www.rvs.uni-bielefeld.de/lectures/TechInf/TI2/download/19.49-1.1.ht ml ...Some lessons learned... https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
Thanks, nice reading! It reminded me that Chris Burrows has already pointed out how much you need to do of MISRA-C when writing in C, which with Oberon you get out-of-the-box. Cheers, Paul
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Paul Reed Sent: Monday, 12 November 2018 12:26 AM To: ETH Oberon and related systems Subject: Re: [Oberon] Oberon as (embedded) rtos.
https://en.wikipedia.org/wiki/Rate-monotonic_scheduling#cite_note- 12 ..."What really happened on Mars Rover Pathfinder" http://www.rvs.uni- bielefeld.de/lectures/TechInf/TI2/download/19.49-1. 1.ht ml ...Some lessons learned... https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
Thanks, nice reading! It reminded me that Chris Burrows has already pointed out how much you need to do of MISRA-C when writing in C, which with Oberon you get out-of-the-box.
From Wikipedia: "MISRA C is a set of software development guidelines for the C programming language developed by MISRA (Motor Industry Software Reliability Association). Its aims are to facilitate code safety, security,
Thanks for remembering, Paul! For those who were not fortunate enough to be able to attend Oberon Day 2011 this is a summary of my attempts to get some measure of the comparative reliability of C and Oberon-07 when used for embedded software development. portability and reliability in the context of embedded systems" I took the 142 rules of the MISRA-C:2004 "Guidelines for the use of the C language in critical systems" and applied them to Oberon-07. I discovered that more than 70% of the rules are NOT required when programming in Oberon-07. They are either already enforced by the language or are not applicable. Examples of MISRA rules that are not applicable to Oberon-07: Rule 14.4: The goto statement shall not be used. (Oberon-07 does not have GOTO) Rule 14.5: The continue statement shall not be used. (Oberon-07 does not have CONTINUE) Examples of MISRA rules that are enforced by the design of Oberon-07: Rule 14.7: A function shall have a single point of exit at the end of the function. Rule 16.6: The number of arguments passed to a function shall match the number of parameters. The remaining 30% of MISRA rules would need to be followed if using Oberon-07 for critical systems. They include: Rule 2.4 (advisory): Sections of code should not be "commented out". Rule 20.4: Dynamic heap memory allocation shall not be used. More information about MISRA and their guidelines can be found on their website: www.misra.org.uk Regards, Chris Burrows CFB Software http://www.astrobe.com
Also interesting, the JPL Rule for inter process communication. from: https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf --------------------------------------------------------------------------- Rule 6 (inter-process communication) An IPC mechanism should be used for all task communication. Callbacks should be avoided. No task should directly execute code or access data that belongs to a different task. All IPC messages shall be received at a single point in a task. Communication and data exchanges between different tasks (modules) in the system are best performed through a disciplined use of IPC (inter-process communication) messaging. IPC messages should then contain only data, preferably no data pointers, and never any function pointers. Each task or module should maintain its own data structures, and not allow direct access to local data by other tasks. This style of software architecture is based on principles of software modularity, data hiding, and the separation of concerns that can avoid the need for the often more error-prone use of semaphores, interrupt masking and data locking to achieve task synchronization ---------------------------------------------------- Found in System Oberon, message handlers! Now the question is how this message model is implemented in C++ by JPL. They use the rtos Vxworks for flight systems and that has a message que between tasks See code below (From: https://www.uio.no/studier/emner/matnat/fys/FYS4220/h11/undervisningsmateria...) /* In this example, task t1 creates the message queue and sends a message * to task t2. Task t2 receives the message from the queue and simply * displays the message. */ /* includes */ #include <vxWorks.h> #include <msgQLib.h> /* defines */ #define MAX_MSGS (10) #define MAX_MSG_LEN (100) MSG_Q_ID myMsgQId; task2 (void) { char msgBuf[MAX_MSG_LEN]; /* get message from queue; if necessary wait until msg is available */ if (msgQReceive(myMsgQId, msgBuf, MAX_MSG_LEN, WAIT_FOREVER) == ERROR) return (ERROR); /* display message */ printf ("Message from task 1:\n%s\n", msgBuf); } #define MESSAGE "Greetings from Task 1" task1 (void) { /* create message queue */ if ((myMsgQId = msgQCreate (MAX_MSGS, MAX_MSG_LEN, MSG_Q_PRIORITY)) == NULL) return (ERROR); /* send a normal priority message, blocking if queue is full */ if (msgQSend (myMsgQId, MESSAGE, sizeof (MESSAGE), WAIT_FOREVER, MSG_PRI_NORMAL) == ERROR) return (ERROR); } Paul and Chris, Oberon in Space? http://flightsoftware.jhuapl.edu/ Greets, F.P. Chris Burrows schreef op 2018-11-12 08:12:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Paul Reed Sent: Monday, 12 November 2018 12:26 AM To: ETH Oberon and related systems Subject: Re: [Oberon] Oberon as (embedded) rtos.
https://en.wikipedia.org/wiki/Rate-monotonic_scheduling#cite_note- 12 ..."What really happened on Mars Rover Pathfinder" http://www.rvs.uni- bielefeld.de/lectures/TechInf/TI2/download/19.49-1. 1.ht ml ...Some lessons learned... https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
Thanks, nice reading! It reminded me that Chris Burrows has already pointed out how much you need to do of MISRA-C when writing in C, which with Oberon you get out-of-the-box.
Thanks for remembering, Paul!
For those who were not fortunate enough to be able to attend Oberon Day 2011 this is a summary of my attempts to get some measure of the comparative reliability of C and Oberon-07 when used for embedded software development.
From Wikipedia: "MISRA C is a set of software development guidelines for the C programming language developed by MISRA (Motor Industry Software Reliability Association). Its aims are to facilitate code safety, security, portability and reliability in the context of embedded systems"
I took the 142 rules of the MISRA-C:2004 "Guidelines for the use of the C language in critical systems" and applied them to Oberon-07. I discovered that more than 70% of the rules are NOT required when programming in Oberon-07. They are either already enforced by the language or are not applicable.
Examples of MISRA rules that are not applicable to Oberon-07:
Rule 14.4: The goto statement shall not be used. (Oberon-07 does not have GOTO)
Rule 14.5: The continue statement shall not be used. (Oberon-07 does not have CONTINUE)
Examples of MISRA rules that are enforced by the design of Oberon-07:
Rule 14.7: A function shall have a single point of exit at the end of the function.
Rule 16.6: The number of arguments passed to a function shall match the number of parameters.
The remaining 30% of MISRA rules would need to be followed if using Oberon-07 for critical systems. They include:
Rule 2.4 (advisory): Sections of code should not be "commented out".
Rule 20.4: Dynamic heap memory allocation shall not be used.
More information about MISRA and their guidelines can be found on their website:
www.misra.org.uk
Regards, Chris Burrows CFB Software http://www.astrobe.com
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
They use the rtos Vxworks for flight systems and that has a message que between tasks Nasa uses vxworks (closed source) ESA uses RTEMS (open source) https://www.rtems.org/
RTMES in combination with ADA https://devel.rtems.org/wiki/TBR/UserManual/RTEMSAda http://beru.univ-brest.fr/~singhoff/ENS/USTH/TP/tp.html#Ref1.1 Greets, F.P. Frans-Pieter Vonck schreef op 2018-11-12 12:27:
Also interesting, the JPL Rule for inter process communication.
from: https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf --------------------------------------------------------------------------- Rule 6 (inter-process communication)
An IPC mechanism should be used for all task communication. Callbacks should be avoided. No task should directly execute code or access data that belongs to a different task. All IPC messages shall be received at a single point in a task.
Communication and data exchanges between different tasks (modules) in the system are best performed through a disciplined use of IPC (inter-process communication) messaging. IPC messages should then contain only data, preferably no data pointers, and never any function pointers. Each task or module should maintain its own data structures, and not allow direct access to local data by other tasks. This style of software architecture is based on principles of software modularity, data hiding, and the separation of concerns that can avoid the need for the often more error-prone use of semaphores, interrupt masking and data locking to achieve task synchronization ----------------------------------------------------
Found in System Oberon, message handlers! Now the question is how this message model is implemented in C++ by JPL. They use the rtos Vxworks for flight systems and that has a message que between tasks See code below (From: https://www.uio.no/studier/emner/matnat/fys/FYS4220/h11/undervisningsmateria...)
/* In this example, task t1 creates the message queue and sends a message * to task t2. Task t2 receives the message from the queue and simply * displays the message. */ /* includes */ #include <vxWorks.h> #include <msgQLib.h> /* defines */ #define MAX_MSGS (10) #define MAX_MSG_LEN (100) MSG_Q_ID myMsgQId;
task2 (void) { char msgBuf[MAX_MSG_LEN]; /* get message from queue; if necessary wait until msg is available */ if (msgQReceive(myMsgQId, msgBuf, MAX_MSG_LEN, WAIT_FOREVER) == ERROR) return (ERROR); /* display message */ printf ("Message from task 1:\n%s\n", msgBuf); }
#define MESSAGE "Greetings from Task 1" task1 (void) { /* create message queue */ if ((myMsgQId = msgQCreate (MAX_MSGS, MAX_MSG_LEN, MSG_Q_PRIORITY)) == NULL) return (ERROR); /* send a normal priority message, blocking if queue is full */ if (msgQSend (myMsgQId, MESSAGE, sizeof (MESSAGE), WAIT_FOREVER, MSG_PRI_NORMAL) == ERROR) return (ERROR); }
Paul and Chris, Oberon in Space? http://flightsoftware.jhuapl.edu/
Greets, F.P.
Chris Burrows schreef op 2018-11-12 08:12:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Paul Reed Sent: Monday, 12 November 2018 12:26 AM To: ETH Oberon and related systems Subject: Re: [Oberon] Oberon as (embedded) rtos.
https://en.wikipedia.org/wiki/Rate-monotonic_scheduling#cite_note- 12 ..."What really happened on Mars Rover Pathfinder" http://www.rvs.uni- bielefeld.de/lectures/TechInf/TI2/download/19.49-1. 1.ht ml ...Some lessons learned... https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
Thanks, nice reading! It reminded me that Chris Burrows has already pointed out how much you need to do of MISRA-C when writing in C, which with Oberon you get out-of-the-box.
Thanks for remembering, Paul!
For those who were not fortunate enough to be able to attend Oberon Day 2011 this is a summary of my attempts to get some measure of the comparative reliability of C and Oberon-07 when used for embedded software development.
From Wikipedia: "MISRA C is a set of software development guidelines for the C programming language developed by MISRA (Motor Industry Software Reliability Association). Its aims are to facilitate code safety, security, portability and reliability in the context of embedded systems"
I took the 142 rules of the MISRA-C:2004 "Guidelines for the use of the C language in critical systems" and applied them to Oberon-07. I discovered that more than 70% of the rules are NOT required when programming in Oberon-07. They are either already enforced by the language or are not applicable.
Examples of MISRA rules that are not applicable to Oberon-07:
Rule 14.4: The goto statement shall not be used. (Oberon-07 does not have GOTO)
Rule 14.5: The continue statement shall not be used. (Oberon-07 does not have CONTINUE)
Examples of MISRA rules that are enforced by the design of Oberon-07:
Rule 14.7: A function shall have a single point of exit at the end of the function.
Rule 16.6: The number of arguments passed to a function shall match the number of parameters.
The remaining 30% of MISRA rules would need to be followed if using Oberon-07 for critical systems. They include:
Rule 2.4 (advisory): Sections of code should not be "commented out".
Rule 20.4: Dynamic heap memory allocation shall not be used.
More information about MISRA and their guidelines can be found on their website:
www.misra.org.uk
Regards, Chris Burrows CFB Software http://www.astrobe.com
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hello: There is this "proper procedure" named LED on page 15 in the Oberon-07 Report dated Revision 1.10.2013 / 3.5.2016, which is the newest version of the language. Proper procedures: Name Argument types Function LED(n) INTEGER display n on LEDs It is a very convenient procedure indeed. It is provided in both the Oberon System proper, as well as Astrobe. It is used in the core bootloader to track the progression of the code. However... Is it not strange that the little debugging utility geared towards just the FPGA applications has been carved into the Language Report? I would rather see it as a SYSTEM feature SYSTEM.LED(n), or as an "undocumented feature" of a particular implementation. Ideally, it would have been a separate MODULE. But I do understand that it was needed for the bootloader which is executed prior to loading the system kernel. In this situation, SYSTEM.LED would be the most appropriate, IMHO. In my RiskFive we are not providing the FPGA pins to drive LEDS due to shortage of pins in the Artix-7 in the CSG324 package. I am rather providing an I2C pin expander with eight LEDs. We will provide for eight LEDs driven with outputting an INTEGER to a particular address, where the I2C firmware will take care of sequencing the signals. So I am not ditching the LEDs. But I do not like including such a specialized facility directly in the Language Report. Wojtek
Hi Wojtek, LED even practical into PO ecosystem is hardware specific. In my RiscCore there are not LEDs connected to processor core. This functionality is relayed to the custom project. The final user implement your own status indicators in hardware and the correspondent software module; so, LED related lines are commented in my compiler files set to avoid mistakes. Regards. El 5/11/18 a las 23:36, Skulski, Wojciech escribió:
Hello:
There is this "proper procedure" named LED on page 15 in the Oberon-07 Report dated Revision 1.10.2013 / 3.5.2016, which is the newest version of the language.
Proper procedures: Name Argument types Function LED(n) INTEGER display n on LEDs
It is a very convenient procedure indeed. It is provided in both the Oberon System proper, as well as Astrobe. It is used in the core bootloader to track the progression of the code.
However... Is it not strange that the little debugging utility geared towards just the FPGA applications has been carved into the Language Report? I would rather see it as a SYSTEM feature SYSTEM.LED(n), or as an "undocumented feature" of a particular implementation. Ideally, it would have been a separate MODULE. But I do understand that it was needed for the bootloader which is executed prior to loading the system kernel. In this situation, SYSTEM.LED would be the most appropriate, IMHO.
In my RiskFive we are not providing the FPGA pins to drive LEDS due to shortage of pins in the Artix-7 in the CSG324 package. I am rather providing an I2C pin expander with eight LEDs. We will provide for eight LEDs driven with outputting an INTEGER to a particular address, where the I2C firmware will take care of sequencing the signals. So I am not ditching the LEDs. But I do not like including such a specialized facility directly in the Language Report.
Wojtek -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Bob and Paul, maybe I've read about the "one page rule" in the introduction of a modula-2 book.
When you originally asked this (on this list in December 2015, can't
believe it was that long ago!) :) Ha, should have looked in the archive. There was a very practical reason for a 'one page, one procedure' rule One page, one procedure. That is a more reasonable rule. Maybe, one class per page.
Another aspect of the arduino code I looked into. The main event loop is 500 lines. Mostly timer checks. I get inspiration from event loop https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources/Oberon.Mod.txt With this implimentation https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources/Blink.Mod.txt Greets, F.P. Bob Walkden schreef op 2018-11-03 16:42:
On 3 Nov 2018, at 14:55, Paul Reed <paulreed@paddedcell.com> wrote:
Hi Frans-Pieter,
Does anyone remember where Niklaus mentions the ' one page of code, one module ' rule?
When you originally asked this (on this list in December 2015, can't believe it was that long ago!) :) I asked a colleague and he couldn't remember where he had read it either.
But asked again and intrigued, he embarked on a browse of his dead-tree library and eventually conceded that what he had probably remembered, or at least the closest thing he could find, was
"The Elements of Programming Style", 2nd Edition (Kernighan and Plauger), page 150, bottom two lines:-
"The modularization would have the advantage that each part of the program would fit comfortably on one page."
There was a very practical reason for a 'one page, one procedure' rule when I started programming in the early 1980s.
I was a COBOL programmer and we did not have terminals or such luxuries. Instead we wrote our code in pencil on coding sheets (paper), submitted it to the data prep women (always women) and a few days later received the sheets back with a paper tape version of the source code which we could then attempt to compile.
Because we practised Jackson Structured Programming we could write subroutines which fit on one coding sheet and re-use the coding sheets for other programs, or shuffle them, insert other code on separate sheets etc as needed. Only for short, simple edits and quick compiler turnaround when we had the machine to ourselves on a Tuesday evening did we need to cut and paste, quite literally, the paper tape.
Anything involving a new coding sheet would take a week, but that was much easier than dealing with something monolithic which involve re-pencilling numerous sheets from scratch.
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Greetings, On 03/11/2018, Paul Reed <paulreed@paddedcell.com> wrote (in part):
Hi Frans-Pieter,
Does anyone remember where Niklaus mentions the ' one page of code, one module ' rule?
When you originally asked this (on this list in December 2015, can't believe it was that long ago!) :) I asked a colleague and he couldn't remember where he had read it either.
But asked again and intrigued, he embarked on a browse of his dead-tree library and eventually conceded that what he had probably remembered, or at least the closest thing he could find, was
"The Elements of Programming Style", 2nd Edition (Kernighan and Plauger), page 150, bottom two lines:-
"The modularization would have the advantage that each part of the program would fit comfortably on one page."
I also remember reading it somewhere (and I will also browse my collection later but not whether it was Wirth, Yourdan, Brookes, Dijstra, or ...). I also remember a commentary, in the same place, about a manager insisting on each (Fortran) programmer have no more than 60 lines per file; one programmer printed out his thousand-line file, took a ruler, and drew a line every 60 lines to split up his code. N.
participants (14)
-
Bob Walkden -
Charles Perkins -
Chris Burrows -
eas lab -
Frans-Pieter Vonck -
John R. Strohm -
Jörg -
Jörg Straube -
Liam Proven -
Nemo -
Paul Reed -
Skulski, Wojciech -
Tomas Kral -
Walter Gallegos