Why C is best for OS programming? [closed] - c

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am a computer science student and I am trying to follow Operating System Module. Still I am confused about which language should I use for testing, C or C++. Most people say C is good.Why c is important for operating systems??

C is used for operating systems for four major reasons:
It is a low level portable representation of programs executable on Von Neumann machines (the vast majority of modern machines). With small, vendor-specific modifications, it can be used for non-Von Neumann machines. (Usually the only major omission for such machines is function pointers)
It was used for Unix. Most modern operating systems (that is, Windows NT, OSX, Linux, BSD, etc.) are Unix clones of some sort.
The POSIX standards are specified in terms of it.
It doesn't require extensive runtime support.

Related

Port existing C code to ARMv7 [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I was recently given the source code for an audio decoder which executes fine with on Windows when compiled with MSVC.
I was assigned the job of porting this decoder (which is written in c) to the ARMv7 platform.
Since I'm totally new to this field, I'm not sure how to go about doing this. I have already googled a lot, but could not find much that applied to my particular case.
Any suggestions about how to pull off such a port would be greatly appreciated.
Compile it and see what breaks is a good place to start.
ARM is a 32 bit target and off-the-shelf ARM based micro-controllers are invariably little-endian like x86, so there are generally few issues porting code.
If the code makes OS calls to Win32, or uses third-party libraries not ported to ARM, then of course you will need to remove those dependencies or port to the target environment. Similarly if the code makes use of the PC based hardware, such as the sound card, that will certainly need to be adapted.
Code and algorithms that simply processes data should port directly if the code quality was sufficiently portable in the first instance. Undefined or implementation defined compiler behaviour however will need to have been be avoided, since this is likley to differ between compilers and targets.

Compiler/language runtime vs. Middleware [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are the specific operations a language runtime does that an operating system does not? How is a language runtime different from a middleware?
This depends on the operating system and the runtime. libc is a good example of a language runtime and the linked article on Wikipedia gives a good overview of what it does. Generally the goal of a language runtime is to provide implementations of standard basic functionality which is likely to be implemented differently between the operating systems the language supports, or functionality which is extremely common, but not provided by the operating system.
Middleware is a very general concept but it simply refers to software placed between two systems as an abstraction layer. You could consider a language runtime as a form of middleware in some contexts.

If I'm making a new programming language, should I compile to assembly or C? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm making a language that is based on a different mathematical model than is normally used. If I use C, well, I'm not sure that I can because the model is so different compared to C. But then if I use assembly code, it's not portable, is it? Is there a generic assembly language that can be abstracted over all of the architectures possibly that I'm not aware about? Or am I missing something? I suppose that if C is Turing complete, then I should be able to compile to it if my language is Turing complete... Is assembly more powerful than C? If I wanted a compiled language, what are the advantages of compiling to assembly, and what are the advantages of compiling to C?
I would say C. It will save you tons of time writing compilers for every platform when you can write one and let the C compiler do the dirty work for you. C has been used as intermediate language for a lot of higher-level languages with design different from C, such as C++.
Also, there are no assembly language that is cross platform without massive modification.

What C compilers are commonly used for embedded development on x86/x64 platforms? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What C compilers are commonly used for embedded development on x86/x64 platforms?
Is GCC commonly used?
As already said, it depends on the architecture of the embedded system. However, more often than not, I have found a "ported" gcc cross-compiler for the architecture under question. Another popular compiler is Keil.
Depends on the architecture.
If you have an exotic architecture, let's say a standard model CPU customized by third-party (e.g. a modified MIPS, like Allegrex on PSP) then probably a standard GCC will not output the most optimized code. You would have to use their own tools/compilers (or modify GCC itself to add the modifications for this architecture).
If it's a standard architecture/CPU supported by GCC, then GCC should be as good, if not better, as any other C compiler.
I am also working on embedded systems(mainly DSP processors). I normally use just GCC for testing and simulating my initial code on a LINUX machine. But to create a code-set that would actually work on DSP, I have to use a separate compiler (VisualDSP++, it is developed by ADI for its own set of DSP processors). You might need to check with the manufacturer of the embedded system, which specific compiler to use.
Anshu
Free software (GNU): GCC, definitely.
Proprietary software for ARM might be Keil or IAR C compilers. IAR also supports a lot of other processors and simpler microcontrollers.

In embedded application why c is most poppular? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
see ,
still yet i have seen that most of the embedded application are written in c.
Most of the libraries are written in c.
Device-driver are written in c.
So i want to ask you is there any logical reason behind this?
(My apologies if this post sounds silly/stupid. I thought I'd ask here. Ignoring these core bits never made anyone a better programmer.)
There are many reasons, including but not limited to:
It has access to many low level functions not accessible from many other languages.
It has existed for many many years and has lots of developers that are familiar with it.
If written well it's extremely efficient.
It gives almost complete control over memory etc.
It's very portable, largely due to the myriad of compilers written for it.
Because of Dennis Ritchie. C is easily the most portable language.

Resources