I am somewhat new to programming and the best way I can ask this question is with an example.

I know how to do basic things in Java and C#. Things like a small windows forms application or make a generic class. I've basically been learning and haven't tried to do anything big yet. Anyways, I've always been curious about how things are done "under the hood" I guess you could say.

I know it all gets boiled down to 1s and 0s and that assembly languages basically give commands to patterns of 1s and 0s, but its seems like there's this jump from there to: use a library for this a library for that. It seems to me like all C# can do without a library is arithmetic and binary logic. To get input or output, you use libraries, etc...

I know this question probably seems obvious to some and I know that I have a lot to learn but I don't even know where to begin with a question like this. Thank you.

So my question is this:

If someone were going to make a virtual machine or a Playstation emulator, or an operation system, or a driver, or add mp3 support to a media player, or make your own file type, etc... How? I can't see the way that would be done with C# or Java.

In other words, if I read a book like Professional C# by WROX or Programming C# by OReilly, would I know how to do these things? Or do you have to learn assembly language or something more low level like C++?

  • 7
    One trick to understanding what's going on "under the hood" is to focus and use paragraphs to make things easy to read and understand. Please edit this question to be easier to read.
    – S.Lott
    Apr 26, 2011 at 14:49
  • 1
    Given your interest you might want to pick up a copy of Charles Petzold's Code: The Hidden Language of Computer Hardware and Software. It's a good read. amazon.com/Code-Language-Computer-Hardware-Software/dp/…
    – DKnight
    Apr 26, 2011 at 19:11
  • @S.Lott To the rescue :-) Apr 26, 2011 at 20:47
  • @Martin Wickman: While very nice work, did it help @fender1901 to edit or focus?
    – S.Lott
    Apr 26, 2011 at 20:57
  • 1
    @Martin Wickman: Undoing the changes is not the point. Encouraging others to learn by doing is my point. You clearly already know. @fender1901 needs to learn by doing. My question is this: "did it help @fender1901 to edit or focus?" What do you think?
    – S.Lott
    Apr 26, 2011 at 21:02

7 Answers 7


Interesting question! You'll find that languages like Java and C# do in fact support fairly low level programming. For example look at some of the I/O source code in the OpenJDK for Java. You'll see that the higher level methods are implemented with lower level socket technologies, byte arrays and bit twiddling.

With regards to C# and Java, those languages compile down to bytecode, which gets eecuted on a virtual machine. You can actually quite happily view and learn from the bytecode (e.g. Seeing how Java deals with concatenating String objects).

If the environment you are developing in does not host one of these higher level VMs (often due to space and performance requirements), then you need to use a 'lower level' language.

I believe that C/C++ still rules the roost in the area of writing low level drivers etc as you can tweak the memory management and the data structures to the nth degree.

Assembly is pretty specialised these days, it's good to take at least a quick course in it to appreciate what happens at that level. When you write some Assembly to back fill a register while it's emptying, you start to appreciate the sorts of lengths that each programming language layer has to go to.


  • Can you actually program with the intermediate languages or are they just there to examine?
    – fender1901
    Apr 27, 2011 at 13:34
  • Are you asking whether you can write 'bytecode' source code? Apr 27, 2011 at 18:31
  • I think. I'm wondering if you can just start coding using bytecode or il just like you would java or c#?
    – fender1901
    Apr 29, 2011 at 12:49
  • Java or C#, very few people are into manipulating bytecode, however a larger set of people do look at what byte code their particular higher level code boils down to Apr 29, 2011 at 13:24

Most "low-level" programming basically amounts to directly interfacing with the Operating System. The reason it doesn't seem to you like there is an "obvious" way to do this is because generally speaking, higher level languages like Java strive for ease of use and portability. Code that directly interfaces with the Operating System is generally a lot less portable than higher-level code, unless it is wrapped in an abstraction.

In lower-level languages like C and C++, the Operating System API is directly accessible (largely due to the fact that most Operating Systems are written in C, so they expose an API through the C language). For example, in C on a UNIX system you can call the ioctl function to directly interface with a device.

Of course, higher-level languages like Java and C# also need to talk with the Operating System. Every time you open a file or read from a network socket, you're interfacing with the OS. It's just that Java and C# wrap the low-level OS system calls in higher-level abstractions, like a Socket object. This higher-level approach has the advantage that the same Java code will work on different platforms. Whereas, the way you would open up a socket in C on UNIX is quite different from the way you would do it on Windows.

In general, the more higher-level the language is, the less control you'll have over how your program interfaces with the Operating System. That said, a lot of things you mention are possible to do in a higher level language. For example, there's no reason you can't write a Virtual Machine in Java or C#.


The good news is, it can be done with Java or C#. The only problem you need to know is how. Basically, you need to know this nice little things about Hardware Architecture (not necessary PC, but Playstation if that's what you want to emulate). And I am afraid you would need to go deep, like Assembler and Machine Language.
All ALUs, registers, MMUs and stuff could be abstracted and emulated with high level language. You can even call low-level functions to obtain hardware support (learn about PInvoke and JNA for example).

However, since you are beginner I wouldn't recommend to start with such enormous task. I would suggest that you learn C/C++, a bit about Linux (or other Unix-like OS, i.e. FreeBSD), Computer Architecture, then Assembler... It could take a few years, so...
What you really need is motivation and patience.


What I did what learned a high level language (Java) then became more interested, as you are, about low level languages and hardware. In its most primitive state, a computer is electronics. 1's and 0's are just figures for electrical charges (on and off). Once I began to understand the logic behind processors, and what is inside an Arithmetic Logic Unit, things really fell into place.
I think you should start your studies with things like boolean logic (AND, OR, XOR, etc.), then start designing small ALUs and looking at how memory and registers play into things. After that learn some assembly language and then youll realize how a compile works. Pretty soon high level languages will seem boring! :) Just kidding. It's beautiful how everything falls into place though, and it should be enjoyable to learn. Once you start following the path of curiosity, you'll pick things up in no time.


While you can do low-level stuff with C# or Java (or most other languages), most people don't. Therefore, any reasonably popular book you pick up on either will leave low-level stuff out. They're likely to cover the language features you'd need, but not apply them the way you're curious about. Similarly, books on low-level stuff will probably be in C, with perhaps a little assembly language.

Learning C itself won't be hard for a C# programmer, aside from pointer manipulation, although learning to do things in it will take longer. Since C is a less expressive language than C#, some things that you know how to do efficiently in C# will have to be done in a much different, and often clumsier, way in C.

What you should look for next is books on the lower-level stuff you want to learn. There are books on the Linux kernel, for example, but kernel-level programming is going to be difficult to grasp without some background, so you might want to study operating system fundamentals first.

  • I think my biggest problem right now is that a lot of these topics are going to be difficult to grasp because I don't have the background. I need, I guess, a bridge into those areas.
    – fender1901
    Apr 27, 2011 at 13:39
  • @fender1901: That could be a problem. The Linux kernel does some things that would look really odd to somebody who doesn't understand what operating systems do. The emulator, of the things you mentioned, would probably be the easiest to understand, and there are simple emulators out there, often for early microcomputers. Apr 27, 2011 at 13:42

You must find out, that is it possible to do the low-level function with the used platform/language or not:

  • storing a byte into a variable,
  • reading/writing files by bytes,
  • setting up an array of bytes, accessing elements,
  • use true procedural features, OOP,
  • accessing the screen, keyboard, sockets.

Hm, sounds that choosing a language should be random.


The question has several answer: 1. Java and C# are high level languages they are developed for application development on a existing Operating system who manages the memory (this also makes it possible to make hybrid programmes that can run on different systems). 2. The areas where low level programming is needed is OS development, Driver development, AAA games development, etc. Normally low level programming is not done in Java or C# it is carried on using C/C++ and Assembly language.

With only this two points we can say that low level programming is done separately and there is no need for low level programming in high level programming. The parts where low programming is needed like the I/O is carried out by the interpreter which is itself written in a low level language (for example java's JVM is written in C).

The main answer of your question is this things are not developed using Java and C# this things are done in C and Assembly so rather than finding ways to do it in Java and C# you should bagin learning C and Assembly as they are the biggest dudes of programming and yes the big advantage is the program written in low level are small and speedy.

  • this doesn't seem to offer anything substantial over points made and explained in prior 6 answers that were posted few years ago
    – gnat
    Apr 15, 2016 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.