Alternative to C for system programming

P

pavan

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.
 
M

Malcolm McLean

pavan said:
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++.
 
C

Chris Thomasson

pavan said:
Is there a modern (OO, garbage collected etc...) programming language

garbage collected systems language? I would avoid that crap like the plague!
 
K

Keith Thompson

pavan said:
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.
 
G

geek.arnuld

Is there a modern (OO, garbage collected etc...) programming language
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 :)
 
D

David T. Ashley

pavan said:
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.
 
S

santosh

pavan said:
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.
 
R

Richard Bos

pavan said:
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
 
J

jacob navia

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.
 
I

Ian Collins

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++.
 
J

jacob navia

Ian Collins a écrit :
jacob navia wrote:

C++ is not a good choice for an OS, and



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
 
M

Marc Boyer

Le 05-02-2007 said:
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
 
S

santosh

jacob said:
Ian Collins a écrit :
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.
 
A

arnuld

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 .)
 
A

arnuld

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 :)
 
P

pavan

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.
 
F

Flash Gordon

jacob navia wrote, On 05/02/07 10:17:
pavan a écrit :
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.
 
A

arnuld

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://
www.coyotos.org/docs/osverify-2004/osverify-2004.html)

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

santosh

pavan said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top