17/01/2015
Top 10 Places Where C Language is Used for
Where C Language is Used for is a question arises in the mind of any new guy when s/he starts-up to learn C. If you are interested in the answer of this question too, this article is just for you.
Using a high level language, such as C, can make OS development much easier. The most common languages that are used in OS development are C, C++, and Perl. Do not think these are the only languages that may be used; It is possible in other languages.
C and C++ are the most common, with C being the most used. C, as being a Middle Level Language, provides high level constructs while still providing Low-Level Details that are closer to Assembly Language, and hence, the System. Because of this, using C is fairly easy in OS development.
This is one of the primary reasons why it is the most commonly used: Because the C programming language was originally designed for System Level and Embedded Software development.
Following are some programming fields where generally either there is no choice other than C or no alternative regarding performance, easiness, speed and many more factors, that’s why C is the most used language:
Operating System Kernel Development
Almost all major Operating System Kernels have been written in C. C++ came as a natural extension to some of them. For example Android Platform has an underlying Linux kernel which is written basically in C. Although as a Middleware of the Android Platform is written in Java, so that you can develop Android Apps using Java.
Middleware, Firmware and Drivers
These pieces of software in the Operating System interact with the Kernel which is basically written in C. Also, they need to be really fast. Hence they tend to be written in C as well. Although this is changing and more middleware comes in Java these days, but still some sectors are there where you need to stick with C for Middleware, Firmware and Device Drivers.
File Systems
These have got to be in C because of C’s closeness to Hardware as compared to upper layer languages like Java, C #. Since, the speed of Disk is always slowest part of any Computer System, so it’s naturally very important to interact with File System (which exists on the Hard Disk Drive) should be as fast as possible and that’s why C is the best choice to work with File Systems.
Implementation of Network Sockets
As Jin Christophe mentions in his post, TCP/IP, IP over infiniband and all the code going into Routers, Gateways, Relays and Switches need to be FAST. These have layers and layers of code written fully in C, primarily for speed.
Video Games
When computing speed was an issue and Physical Memory wasn’t equal to the size of Virtual Memory, Games were written in C to compute more data per unit game cycle. Some examples of such games: Doom, Quake, City of Heroes, championship manager, most Microsoft games, EA game engines etc. Game Engines in particular need speed and optimization for the Hardware they are being built for.
In fact Graphics Libraries like OpenGL (and DirectX too?) are written in C/C++, with APIs supporting other languages. This is changing though with increasing computational power available to us but still approximately all task related to Computer Graphics basically depends on either OpenGL or DirectX like libraries which have been developed and maintained in C/C++ and that’s why, still most of the Graphics Software like Photoshop, Adobe Premier, Maya, 3D Studio, AutoCad, etc… and the Games are mostly powered by OpenGL or DirectX Libraries.
Many Libraries
OpenGL, OpenCV, OpenGV, Boost, DirectX, GTK, GIMP etc. all have been developed in basically C/C++ because these are the libraries basically related to Computer Graphics and Graphics should be the most performing part of any Visual Device like Computer, Mobile Phone, Game Console, etc…
The C programming language uses libraries as its primary method of extension. In C, a library is a set of functions contained within a single “archive” file. Each library typically has a header file, which contains the prototypes of the functions contained within the library that may be used by a program and declarations of special data types and macro symbols used with these functions.
In order for a program to use a library, it must include the library’s header file and the library must be linked with the program which in many cases requires compiler flags (e.g., -lm, shorthand for “math library“).
The most common C library is the C Standard Library, which is specified by the ISO and ANSI C Standards and comes with every C implementation. (Implementations which target limited environments such as Embedded Systems may provide only a subset of the standard library.)
This library supports Stream Input and Output, Memory Allocation, Mathematics, Character Strings, and Time Values. Several separate standard headers (for example, stdio.h) specify the interfaces for these and other standard library facilities.
Another common set of C library functions are those used by applications specifically targeted for Unix and Unix-like systems, especially functions which provide an interface to the kernel. These functions are detailed in various standards such as POSIX and the Single UNIX Specification.
Since many programs have been written in C, there are a wide variety of other libraries available. Libraries are often written in C because C compilers generate efficient object code; programmers then create interfaces to the library so that the routines can be used from higher-level languages like Java, Perl, and Python.
Browsers
Chrome and Firefox are both written in C++ because Web Browsers are actually another kinds of Operating System which in turn executes on Operating System. That’s why they also needs to be very fast and wherever the SPEED is in main concern, C/C++ is the only choice.
Codecs
Since, Codecs are actually related to Sound / Audio which also is the biggest Media Type after Graphics, so codecs are also primarily developed in C/C++, because Speed and Performance of processing Audio is the main concern too in any Audio Processing Application like WavePad, Audacity, Fruity Loops, VirtualDJ, etc…
Unit Tests in Semiconductor Companies
Chip making is hard. For every small piece, you need to write a test. Although scripts are useful you normally would write a small software model (in C/C++) to test your unit against.
Embedded Systems
We already have discussed this sector in too much detail, where Embedded Products rely on C heavily.
There are so many more…
Here’s a very small list of Applications Written in C/C++ discussed above but there are lots and lots more. Frankly, C/C++ is an area that does not seem like a popular language among quorans. You’ll see tons of discussions about Python, PHP, Ruby, some random language made in Facebook, Google or Twitter. These are all custom languages made to speed up certain elements of design or a specific domain.
C is basically a vocabulary on top of the Von Neumann Machine. And since every computer you’ll ever use is a von Neumann Machine, C is perhaps the most useful language for fundamentally reasoning about the properties and problem-solving capabilities of a computer.