473,320 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Alternative to C for system programming

Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.

Feb 4 '07 #1
30 3380

"pavan" <pa********@gmail.comwrote i
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
C++.
Feb 4 '07 #2
"pavan" <pa********@gmail.comwrote in message
news:11*********************@h3g2000cwc.googlegrou ps.com...
Is there a modern (OO, garbage collected etc...) programming language
garbage collected systems language? I would avoid that crap like the plague!
Feb 4 '07 #3
"pavan" <pa********@gmail.comwrites:
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
I think you're asking in exactly the wrong place; things other than C
are exactly what we don't discuss here.

Try comp.programming.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 4 '07 #4
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.

I think you're asking in exactly the wrong place; things other than C
are exactly what we don't discuss here.

Try comp.programming.

good advice Keith :-)

Feb 5 '07 #5
"pavan" <pa********@gmail.comwrote in message
news:11*********************@h3g2000cwc.googlegrou ps.com...
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
There is no alternative. C and assembly-language is the rule.

Garbage collected? Why?

I just laugh at the constant string of posters that blast C for this and
that, including lack of automatic memory allocation and/or garbage
collection and/or array bounds checking.

Ritchie got it right. And still, 30+ years after the fact, they are too
daft to recognize what and why.

Unix--the operating system of the future--as it has been for 30 years now.

C--the langauge of the future--as it has been for 30 years now.

--
David T. Ashley (dt*@e3ft.com)
http://www.e3ft.com (Consulting Home Page)
http://www.dtashley.com (Personal Home Page)
http://gpl.e3ft.com (GPL Publications and Projects)
Feb 5 '07 #6

pavan wrote:
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
Try Ada.

Feb 5 '07 #7
David T. Ashley wrote:
"pavan" <pa********@gmail.comwrote in message
news:11*********************@h3g2000cwc.googlegrou ps.com...
>>Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.


There is no alternative. C and assembly-language is the rule.
Untrue, C++ does just as good a job.

--
Ian Collins.
Feb 5 '07 #8
"pavan" <pa********@gmail.comwrote:
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
No. Your demands are mutually exclusive.

Richard
Feb 5 '07 #9
pavan a écrit :
Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
Use a Visual Basic interpreter written in C#

Intel and AMD will be of great help to you. They will be
happy to provide a 100 processor parallel machine to
be able to boot the OS!!!

More seriously:

1) C can use a garbage collector without any trouble. See
http://www.cs.virginia.edu/~lcc-win32

2) An OPERATING SYSTEM can't use a garbage collector. The
delay provoked by a full GC within the OS would be
quite a show stopper. In the first versions of linux
even malloc was forbidden.

3) Many operating systems have been written in C. "OO"
operating systems have been proposed, and even some have been
implemented like the famous TALIGENT failure, or more recently the
deceased BEOS. C++ is not a good choice for an OS, and
linux has recently resisted any change in that direction.
Feb 5 '07 #10
jacob navia wrote:
>
C++ is not a good choice for an OS, and
linux has recently resisted any change in that direction.
C++ would be an ideal choice, they're just concerned about mixing C and C++.

--
Ian Collins.
Feb 5 '07 #11
Ian Collins a écrit :
jacob navia wrote:

C++ is not a good choice for an OS, and
> linux has recently resisted any change in that direction.


C++ would be an ideal choice, they're just concerned about mixing C and C++.
Surely not ideal

1) Exception handling in the kernel is a NO-NO... Many programs
in C++ rely on that however.
2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.
3) The performance of C++ is not better than C, and mostly
worst. In an OS context this is not really a plus

jacob
Feb 5 '07 #12
Le 05-02-2007, jacob navia <ja***@jacob.remcomp.fra écrit*:
1) Exception handling in the kernel is a NO-NO... Many programs
in C++ rely on that however.
Writing C++ kernel code is not the same that writing C++ webservice
code. Yes.
The same, using malloc and printf is often a bad idea in writing
Lunix kernel code, and many programs in C rely on that. Does
it means that writing C kernel code is a bad idea ?
2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.
What did you mean by 'OO paradigm' ? And did you think
OO is the only C++ paradigm ?
3) The performance of C++ is not better than C, and mostly
worst. In an OS context this is not really a plus
'mostly worst' ? As far as I know, C++ is worst than C when
it use C++ specific functionnalities. But you are not forced
to use it (and on C++ paradigm is 'dont pay for what you dont
use').

Marc Boyer
Feb 5 '07 #13
jacob navia wrote:
Ian Collins a écrit :
jacob navia wrote:

C++ is not a good choice for an OS, and
linux has recently resisted any change in that direction.
C++ would be an ideal choice, they're just concerned about mixing C andC++.
Surely not ideal

1) Exception handling in the kernel is a NO-NO... Many programs
in C++ rely on that however.
Exception handling is not forced upon C++ programmers. Presumably,
kernel code would avoid it.
2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.
FWIW, significant amounts of Windows NT and MacOSX are written in
object oriented C++. Things like the filesystem and device drivers do
lend themselves to object oriented design, though that may not always
be the best choice.
3) The performance of C++ is not better than C, and mostly
worst. In an OS context this is not really a plus
No. Only some portions of C++ are slower than C, and it so happens
that those are the portions that are likely to be of least use to
system programming.

High performance microkernels like L4 disprove your assertion that C++
is bad for writing operating systems. It's being increasingly used in
this domain.

C is used because, often it so happens that high quality compilers are
available for it, and C++, until recently suffered in this area. For
example, when Linux was started, in 1990, gcc was already a very good
C compiler, but it's C++ version was buggy to say the least. It's
taken much longer to write good C++ compilers, but it's nearly done,
and hence you see more and more system code being done in C++.

Personally, I still like C's simplicity over C++, and if I were to
write an OS, I would probably favour it over C++, but that a personal
preference. It doesn't mean that one is definitively better than the
other.

Feb 5 '07 #14
C++ is not a good choice for an OS, and
linux has recently resisted any change in that direction.
if Linux resists any change in that direction then it does not mean
that C++ can not be used to write an OS. Linux Torvalds doe snot like C
++, he hated it. i once read his words/views on C++. i have lost his
views but i completely disagree with him on his view of C++. have a
look at these:

http://l4ka.org/projects/pistachio/

http://www.coyotos.org/docs/bitc/PLOS2006-shap.html

BTW, i don't like C++ much and code is much shorter with C++ (yes, in
procedural style) BUT still i dont like C++ (If i has a choice i will
choose C, and it does not mean that C++ can not do the thing i want to
do, writing an OS .)
Feb 5 '07 #15
Surely not ideal
>
1) Exception handling in the kernel is a NO-NO... Many programs
in C++ rely on that however.

why you want to use exceptions when you want to write a kernel in C++?

2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.

you are mixing and hence confusing OOP with C++. be clear, OOP or C+
+?

3) The performance of C++ is not better than C, and mostly
worst. In an OS context this is not really a plus

i wrote a C++ programme using Standard Library "String class" which
was as fast as the same C programme using malloc/free. [1] AND i am
very sure you can lots of C programmes fatser than C++ AND i am also
sure you can see lots of C++ programmes faster than C.

that is not the C++/C issue. it depends upon the programmer.
[1] i created/destroyed string class & malloc/free more than 1 million
times. on my AMD64 with 1GB of RAM, it took a while to execute :-)
Feb 5 '07 #16
Look at the Singular project at Microsoft. http://
research.microsoft.com/os/singularity/
They are building an OS from square 1 using C# and a bit of C. Most of
the OS is written in C#.

Using a modern language to write systems programs is not a bad idea. I
believe that the modern languages have been lacking in performance
because not many use them for systems programs. Once their use becomes
widespread, research would concentrate on building efficient compilers
for these languages. In a way, this is a vicious circle. Nowadays, It
is critical to consider relibility, stability, and maintainability
apart from performance.

Feb 5 '07 #17
On Feb 5, 4:22 am, "pavan" <pavan.m...@gmail.comwrote:
Look at the Singular project at Microsoft. http://
research.microsoft.com/os/singularity/
They are building an OS from square 1 using C# and a bit of C. Most of
the OS is written in C#.

Microsoft has also written Windows, largest used Desktop OS. is it
really good?

i have used Windows for 4 years, it is a 3rd class OS, complete
garbage. i am using Linux from last 1year and quite happy with it.
Using a modern language to write systems programs is not a bad idea. I
believe that the modern languages have been lacking in performance
because not many use them for systems programs. Once their use becomes
widespread, research would concentrate on building efficient compilers
for these languages.
creating fast compilers for new langugaes like (Ruby,Python,Java )
will not make them as fast a C or C++ programme and i am talking of
the same programme written in all these new languages compared with
writtne in C or C++.
In a way, this is a vicious circle. Nowadays, It
is critical to consider relibility, stability, and maintainability
apart from performance.
Hmmm..... seems like you are talking about COYOTOS (http://
http://www.coyotos.org/docs/osverify...rify-2004.html)

-- arnuld
http://arnuld.blogspot.com

Feb 5 '07 #18
pavan wrote:
Look at the Singular project at Microsoft. http://
research.microsoft.com/os/singularity/
They are building an OS from square 1 using C# and a bit of C. Most of
the OS is written in C#.
Yes, and it'll probably be usable when transistor sizes approach
singularity.
Using a modern language to write systems programs is not a bad idea. I
believe that the modern languages have been lacking in performance
because not many use them for systems programs. Once their use becomes
widespread, research would concentrate on building efficient compilers
for these languages. In a way, this is a vicious circle. Nowadays, It
is critical to consider relibility, stability, and maintainability
apart from performance.
What exactly are the characteristics of "modern" programming
languages? How are they better for system programming than carefully
written C or C++ code? What does C# or .NET or Java provide that's
impossible to do in C or C++, with regards to operating system and
other low-level programming? System programmers are expected, and
trusted, to know their field, not to have their hand held, and
boundries circumscribed by "we do it all for you" languages and
compilers.

Feb 5 '07 #19
In article <45***********************@news.orange.fr>,
jacob navia <ja***@jacob.remcomp.frwrote:
>2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.
Many parts of an OS are well-suited to an object-oriented approach,
and many OSes written in C use that approach. For example, many
operating systems have a structure for device drivers that contains
pointers to functions for read, write, close, and so on. This would
be very naturally done by subclassing an abstract driver class that
had no-op methods for everything.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Feb 5 '07 #20
jacob navia wrote, On 05/02/07 10:17:
pavan a écrit :
>Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.
Use a Visual Basic interpreter written in C#

Intel and AMD will be of great help to you. They will be
happy to provide a 100 processor parallel machine to
be able to boot the OS!!!

More seriously:

1) C can use a garbage collector without any trouble. See
http://www.cs.virginia.edu/~lcc-win32
You mean without any trouble if you do not do the things which break
under GC and you can afford the unpredictable overheads of GC as has
been pointed out before. If you are willing to live with those issues
then you can use a 3rd party extension to do GC, but then you are
writing in C+GC not in C (although much of the code might be C).
2) An OPERATING SYSTEM can't use a garbage collector. The
delay provoked by a full GC within the OS would be
quite a show stopper. In the first versions of linux
even malloc was forbidden.
Ah, so you admit you cannot use GC without any problems having just
stated you can.
3) Many operating systems have been written in C. "OO"
operating systems have been proposed, and even some have been
implemented like the famous TALIGENT failure, or more recently the
deceased BEOS. C++ is not a good choice for an OS, and
linux has recently resisted any change in that direction.
Various aspects of an OS do suite themselves nicely to an OO approach
and just as you can avoid the parts of C that can cause a problem
(writing an OS you are generally not using a hosted implementation so
you are likely not to have some of the problematic library functions)
you can avoid the parts of C++ that cause a problem in such areas as
they would be a problem. E.g the following is, I believe, a perfectly
valid C++ program which does not use most of the features of C++ that
would be a problem.

int main(void)
{
return 0;
}

Of course, for an OS you may well not have a main function and you would
be unlikely to return from it if you did.

As always you use the parts of the language that are appropriate for the
task at hand and not the parts that are not appropriate.
--
Flash Gordon
Feb 5 '07 #21
In article <fh************@news.flash-gordon.me.uk>,
Flash Gordon <sp**@flash-gordon.me.ukwrote:
>1) C can use a garbage collector without any trouble. See
http://www.cs.virginia.edu/~lcc-win32
>You mean without any trouble if you do not do the things which break
under GC and you can afford the unpredictable overheads of GC as has
been pointed out before. If you are willing to live with those issues
then you can use a 3rd party extension to do GC, but then you are
writing in C+GC not in C (although much of the code might be C).
>2) An OPERATING SYSTEM can't use a garbage collector. The
delay provoked by a full GC within the OS would be
quite a show stopper. In the first versions of linux
even malloc was forbidden.
>Ah, so you admit you cannot use GC without any problems having just
stated you can.
You seem to be deliberately looking for something to complain about here.

Jacob made the perfectly reasonable (though disputable) point that the
problem for GC is not the language (C) but the application (an OS). Just
because he spread it out over two paragraphs doesn't mean you should
pretend he got it wrong and then admitted it.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Feb 5 '07 #22
In article <eq***********@pc-news.cogsci.ed.ac.uk>,
Richard Tobin <ri*****@cogsci.ed.ac.ukwrote:
....
>You [Flesh Gordon, ed.] seem to be deliberately looking for something
to complain about here.
And, in other news, water is wet and the sun rises in the east.

Feb 5 '07 #23
pavan wrote:
>
Look at the Singular project at Microsoft.
http://research.microsoft.com/os/singularity/
They are building an OS from square 1 using C# and a bit of C.
Most of the OS is written in C#.
Since they don't know how to build an OS with real tools (see links
below) think how much better they can foul up with tools written in
an unstandardized and untested by time language.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Feb 5 '07 #24
jacob navia wrote:
Ian Collins a écrit :
>jacob navia wrote:

C++ is not a good choice for an OS, and
>> linux has recently resisted any change in that direction.

C++ would be an ideal choice, they're just concerned about mixing C
and C++.
Surely not ideal

1) Exception handling in the kernel is a NO-NO... Many programs
in C++ rely on that however.
As Marc said, many C programs rely on malloc, but kernels are still
written in C.
2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.
It's ideally suited to many aspects of kernel and driver writing.
3) The performance of C++ is not better than C, and mostly
worst. In an OS context this is not really a plus
Care to provide an example?

--
Ian Collins.
Feb 5 '07 #25
David T. Ashley wrote:
Garbage collected? Why?

I just laugh at the constant string of posters that blast C for this and
that, including lack of automatic memory allocation and/or garbage
collection and/or array bounds checking.
Generation Y/Z --"Why can't I be lazy?"
Feb 5 '07 #26
On Mon, 05 Feb 2007 12:49:59 +0000, Richard Tobin wrote:
In article <45***********************@news.orange.fr>,
jacob navia <ja***@jacob.remcomp.frwrote:
>>2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.

Many parts of an OS are well-suited to an object-oriented approach,
and many OSes written in C use that approach. For example, many
operating systems have a structure for device drivers that contains
pointers to functions for read, write, close, and so on. This would
be very naturally done by subclassing an abstract driver class that
had no-op methods for everything.
Interestingly enough, they manage to do exactly this without using C++.
You can "derive" class interfaces by nesting structures. There are also
some macros, like container_of, provided as part of the kernel
headers which assist such techniques.

There are some things which C++ may, arguably, improve the expressiveness
of. But not enough, or in regard to the most important aspects, to
convince that community to use C++. And even the most bare-bones C++'ish
implementation carries more baggage than they want.
Feb 5 '07 #27
Richard Tobin a écrit :
>
You seem to be deliberately looking for something to complain about here.
He always "comments" my posts. I wouldn't give it any importance.
Feb 5 '07 #28
"Ian Collins" <ia******@hotmail.comwrote in message
news:52**************@mid.individual.net...
David T. Ashley wrote:
>"pavan" <pa********@gmail.comwrote in message
news:11*********************@h3g2000cwc.googlegro ups.com...
>>>Is there a modern (OO, garbage collected etc...) programming language
that can server as a good alternative for C for system programming. I
wouldn't want to compromise too much on performance.


There is no alternative. C and assembly-language is the rule.
Well, 90% agreed here... However...

Untrue, C++ does just as good a job.
Supporting exceptions in the bootloader and in the early kernel environments
can be a bit annoying. But hey, who said you have to use exceptiong anyway!
So, yeah I could use C++ and an assembler for all of that stuff...

:^)
Feb 6 '07 #29

"William Ahern" <wi*****@25thandClement.comwrote in message
news:77************@wilbur.25thandClement.com...
Interestingly enough, they manage to do exactly this without using C++.
You can "derive" class interfaces by nesting structures. There are also
some macros, like container_of, provided as part of the kernel
headers which assist such techniques.

There are some things which C++ may, arguably, improve the expressiveness
of. But not enough, or in regard to the most important aspects, to
convince that community to use C++. And even the most bare-bones C++'ish
implementation carries more baggage than they want.
funny, I read the first paragraph and already had the second paragraph in my
head when I started reading it :)
Indeed, C++ would improve the expressiveness by just having virtual
functions in a class etc, in C you have to code that mechanism yourself. But
its not that often you need it and the C expressiveness is good enough.

It's quite interesting to see how the usual FILE I/O is implemented in a C
library and how the different functionalities are overridden for serial
output, file output etc
Feb 7 '07 #30

"Flash Gordon" <sp**@flash-gordon.me.ukwrote in message
news:fh************@news.flash-gordon.me.uk...
You mean without any trouble if you do not do the things which break under
GC and you can afford the unpredictable overheads of GC as has been
pointed out before. If you are willing to live with those issues then you
can use a 3rd party extension to do GC, but then you are writing in C+GC
not in C (although much of the code might be C).
Thats the beauty of C, you have the choice.
If you have a system where you can get away with GC and having correct
programs delivered on time is more important than portability and efficiency
why not use it.
If you have a system where GC makes the system too slow to be usable then
dont use it!
Feb 7 '07 #31

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

115
by: TheAd | last post by:
At this moment I use MsAccess and i can build about every databound application i want. Who knows about a serious open source alternative? Because Windows will be a client platform for some time, i...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.