Reply by Rob Windgassen August 16, 20072007-08-16
On Thu, 16 Aug 2007 08:19:22 -0700, dick wrote:

> > Paul Keinanen wrote: >> On Tue, 14 Aug 2007 10:00:47 -0700, dick <dick_12345678@hotmail.com> >> wrote:
>> Why do you want to use critical sections in the first place ? >> >> I would consider critical sections harmful. A program with lots of >> critical sections cluttered all over the program is a sign of bad >> architectural design, which is also prone to priority inversion and >> other problems. >> >> With proper data structure design and proper partitioning of >> functionality into (server)tasks, the need for critical sections would >> be greatly reduced. >> >> In single processor embedded systems, disabling the interrupts (which >> also disables task switching), doing 2-4 lines of critical code and >> then enabling interrupts should satisfy the needs for critical >> sections. If this is not enough, you should look at your architectural >> design. >> >> Paul > > So you treat C as an abstract ASM or a machine code generator? > > I know why C is an OLD language. Just because the C community is not > willing to improve it. > C evolve slower than English.
First, Paul is describing how you can handle certain problems regardless of the language being used. So I don't understand your reply in this context. Second, you are not totally wrong when you see a relationship between C and ASM: C was developed as high level 'assembly' for building the Unix operating system. Third, you may regard the low-level look-and-feel of C as a disadvantage, but right for the above mentioned use, e.g. OSes but also embedded systems, it is advantageous to have precise control: C statements do what they must do and nothing else. Of course this may not be what you want, but then you are free to use any other tool that suits you well, and it is no reason to start mocking about a presumed "C community". Have a look at comp.std.c and see how different people have many different opinions on the directions of the C language: a monolithic "C community" with a single voice denying change does not exist. Rob Windgassen
Reply by dick August 16, 20072007-08-16
Paul Keinanen wrote:
> On Tue, 14 Aug 2007 10:00:47 -0700, dick <dick_12345678@hotmail.com> > wrote: > > > > >Is there any C syntax extension that support multi-thread like Java > >syntax? > >or how can I use C Macro to hide the OS routine call in C program? > > > >I don't like the style: > >fun(...) > >{ > >p(); > >. > >. > >. > >v(); > >} > > > >I want to use > >syn fun(...) > >{ > >. > >. > >. > >} > > Why do you want to use critical sections in the first place ? > > I would consider critical sections harmful. A program with lots of > critical sections cluttered all over the program is a sign of bad > architectural design, which is also prone to priority inversion and > other problems. > > With proper data structure design and proper partitioning of > functionality into (server)tasks, the need for critical sections would > be greatly reduced. > > In single processor embedded systems, disabling the interrupts (which > also disables task switching), doing 2-4 lines of critical code and > then enabling interrupts should satisfy the needs for critical > sections. If this is not enough, you should look at your architectural > design. > > Paul
So you treat C as an abstract ASM or a machine code generator? I know why C is an OLD language. Just because the C community is not willing to improve it. C evolve slower than English.
Reply by dick August 16, 20072007-08-16
Paul Keinanen wrote:
> On Tue, 14 Aug 2007 10:00:47 -0700, dick <dick_12345678@hotmail.com> > wrote: > > > > >Is there any C syntax extension that support multi-thread like Java > >syntax? > >or how can I use C Macro to hide the OS routine call in C program? > > > >I don't like the style: > >fun(...) > >{ > >p(); > >. > >. > >. > >v(); > >} > > > >I want to use > >syn fun(...) > >{ > >. > >. > >. > >} > > Why do you want to use critical sections in the first place ? > > I would consider critical sections harmful. A program with lots of > critical sections cluttered all over the program is a sign of bad > architectural design, which is also prone to priority inversion and > other problems. > > With proper data structure design and proper partitioning of > functionality into (server)tasks, the need for critical sections would > be greatly reduced. > > In single processor embedded systems, disabling the interrupts (which > also disables task switching), doing 2-4 lines of critical code and > then enabling interrupts should satisfy the needs for critical > sections. If this is not enough, you should look at your architectural > design. > > Paul
So you treat C as an abstract ASM or a machine generator? I know why C is an OLD language. Just because the C community is not willing to improve it. C evolve slower than English.
Reply by The Real Andy August 16, 20072007-08-16
On Thu, 16 Aug 2007 13:10:35 +0300, Paul Keinanen <keinanen@sci.fi>
wrote:

>On Tue, 14 Aug 2007 10:00:47 -0700, dick <dick_12345678@hotmail.com> >wrote: > >> >>Is there any C syntax extension that support multi-thread like Java >>syntax? >>or how can I use C Macro to hide the OS routine call in C program? >> >>I don't like the style: >>fun(...) >>{ >>p(); >>. >>. >>. >>v(); >>} >> >>I want to use >>syn fun(...) >>{ >>. >>. >>. >>} > >Why do you want to use critical sections in the first place ? > >I would consider critical sections harmful. A program with lots of >critical sections cluttered all over the program is a sign of bad >architectural design, which is also prone to priority inversion and >other problems. > >With proper data structure design and proper partitioning of >functionality into (server)tasks, the need for critical sections would >be greatly reduced. > >In single processor embedded systems, disabling the interrupts (which >also disables task switching), doing 2-4 lines of critical code and >then enabling interrupts should satisfy the needs for critical >sections. If this is not enough, you should look at your architectural >design.
How many times have you had the opportunity to re-architect a badly designed system?
>Paul
Reply by Paul Keinanen August 16, 20072007-08-16
On Tue, 14 Aug 2007 10:00:47 -0700, dick <dick_12345678@hotmail.com>
wrote:

> >Is there any C syntax extension that support multi-thread like Java >syntax? >or how can I use C Macro to hide the OS routine call in C program? > >I don't like the style: >fun(...) >{ >p(); >. >. >. >v(); >} > >I want to use >syn fun(...) >{ >. >. >. >}
Why do you want to use critical sections in the first place ? I would consider critical sections harmful. A program with lots of critical sections cluttered all over the program is a sign of bad architectural design, which is also prone to priority inversion and other problems. With proper data structure design and proper partitioning of functionality into (server)tasks, the need for critical sections would be greatly reduced. In single processor embedded systems, disabling the interrupts (which also disables task switching), doing 2-4 lines of critical code and then enabling interrupts should satisfy the needs for critical sections. If this is not enough, you should look at your architectural design. Paul
Reply by Robert Adsett August 15, 20072007-08-15
In article <1187200063.146222.145190@d55g2000hsg.googlegroups.com>, dick 
says...
> > Andrew Reilly wrote: > > On Tue, 14 Aug 2007 19:49:12 -0700, dick wrote: > > > > > if the language support multi-thread, the debug time will be less. > > > > > > a save language should not let user see the OS. > > > > If you want a "safe" language that was designed to operate in a > > multithreaded environment and do systems/embedded programming, then there > > are approximately two answers, that I know of: Ada and Modula-3. There > > are certainly groups of people with extended versions of Java and C# doing > > approximately that too, though. Eiffel might fit the bill, and > > generally compiles through C, which might help. > > > > Most practitioners just use C or assembly, and leave the safety and > > threading to higher-level tools (such as static checkers or code review > > processes) and operating systems. > > > > If you want state of the art type safety, you might want to investigate > > erlang, ocaml, sml and hascall, but I don't know that anyone is using them > > for embedded work, unless you count telephone exchanges (quite a few of > > which run erlang) as embedded systems, which they probably are... > > > > Is there any Macro can hide the OS routine?
What OS routine are you referring to?
> I believe that C syntax extension is a cheaper solution than a new > language.
Are you planning on writing a compiler for only your use?
> Actually in Embedded world, C has a lot syntax extension such as > "interrupt fun()"...
Which a don't use (or trust come to that). Although others certainly do. The syntax varies considerably as well.
> So can we have "exclusive fun()" or "exclusive {...}"?
And these would do what exactly? Robert -- Posted via a free Usenet account from http://www.teranews.com
Reply by dick August 15, 20072007-08-15
Andrew Reilly wrote:
> On Tue, 14 Aug 2007 19:49:12 -0700, dick wrote: > > > if the language support multi-thread, the debug time will be less. > > > > a save language should not let user see the OS. > > If you want a "safe" language that was designed to operate in a > multithreaded environment and do systems/embedded programming, then there > are approximately two answers, that I know of: Ada and Modula-3. There > are certainly groups of people with extended versions of Java and C# doing > approximately that too, though. Eiffel might fit the bill, and > generally compiles through C, which might help. > > Most practitioners just use C or assembly, and leave the safety and > threading to higher-level tools (such as static checkers or code review > processes) and operating systems. > > If you want state of the art type safety, you might want to investigate > erlang, ocaml, sml and hascall, but I don't know that anyone is using them > for embedded work, unless you count telephone exchanges (quite a few of > which run erlang) as embedded systems, which they probably are... >
Is there any Macro can hide the OS routine? I believe that C syntax extension is a cheaper solution than a new language. Actually in Embedded world, C has a lot syntax extension such as "interrupt fun()"... So can we have "exclusive fun()" or "exclusive {...}"?
> -- > Andrew
Reply by larwe August 15, 20072007-08-15
On Aug 15, 10:23 am, Vladimir Vassilevsky

> Stupid questions deserve equaly stupid answers.
The question may have been ill-formed but I do not have enough information to judge that its intent was stupid.
Reply by rickman August 15, 20072007-08-15
On Aug 15, 10:23 am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
> larwe wrote: > > On Aug 14, 4:15 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > > wrote: > > >>dick wrote: > > >>>Hi everyone, > > >>>I am planning to learn Java. > > >>http://www.microsoft.com/mspress/books/10457.aspx > > > What has Microsoft's proprietary closed nonsense got to do with Java? > > Or, for that matter, embedded programming? > > Stupid questions deserve equaly stupid answers. > > VLV
And you are always there to oblige, right? ;^) Sorry, I couldn't resist...
Reply by Vladimir Vassilevsky August 15, 20072007-08-15

larwe wrote:

> On Aug 14, 4:15 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > wrote: > >>dick wrote: >> >>>Hi everyone, >> >>>I am planning to learn Java. >> >>http://www.microsoft.com/mspress/books/10457.aspx > > > What has Microsoft's proprietary closed nonsense got to do with Java? > Or, for that matter, embedded programming? >
Stupid questions deserve equaly stupid answers. VLV