Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This situation is why there is "hello world"; that program seems trivial but actually has important implications; for instance, that your environment works, that you know how to feed programs to the compiler, that you can actually run the output.

I never took "hello world" seriously until I started doing embedded systems work; it's now an extraordinarily important tool for me (I work an anomalously weird number of different environments).



I once had a particularly slow week at work, and decided to write an article about how "Hello World" works in C. How it really works -- including compiling, linking, system calls, operating system involvement, hardware I/O, communication between ICs, etc. The path from the block of text to photons emitting from the screen, with fairly detailed explanations at every level.

I ended up with a 50 page LaTeX document that barely even scratched the surface, and then work picked up and I never finished it. A "full" explanation would probably be a 600+ page book.

I still think it would be a neat resource to have. We kind of take for granted that the simple "Hello World" is built on 60 years of research, and is anything but simple.


I second the motion to post the unfinished guide! Perhaps on Github where some other HN guys can make it complete for you.

Regardless, I think it's a great idea, and would really give insight as to why things work the way they do, instead of us just seeing Hello World!


Posting it on Github is a fantastic idea.


My (admittedly, considerably more humble) attempt is http://eli.thegreenplace.net/2012/08/13/how-statically-linke...

It takes on an even simpler program, namely:

  int main() {
      return 42;
  }
But digs in the C runtime, Linux kernel and touches on compilers, linkers and loaders.

Hope it's helpful


I have been looking for a guide like that. I would also appreciate a release of the unfinished version.


Some resources on making tiny Hello World programs down to the kernel level that may be useful:

https://blogs.oracle.com/ksplice/entry/hello_from_a_libc_fre...

http://www.muppetlabs.com/~breadbox/software/tiny/teensy.htm...

http://timelessname.com/elfbin/

A wee bit heavy, but it's comprehensive. It deals with what happens when you run code, how the architecture of the computer works (by and large) including at the logic level:

http://www.amazon.co.uk/Computer-Systems-Programmers-Randal-...

If you want to go lower (and higher).. look at Understanding the Linux kernel for a good understanding of how an OS is put together, with specific examples i.e. Linux.

Code, by Petzold, deals with logic and computers from the ground up. It starts with relays and builds them up into gates and usable arithmetic blocks.

http://www.amazon.co.uk/Code-Language-Computer-Hardware-Soft...

http://www.amazon.co.uk/Understanding-Linux-Kernel-Daniel-Bo...

The physics is fairly simple, at least from a CRT or LED display perspective. Gets more tricky dealing with interconnecting microprocessors because a good chunk is vendor specific.

I think this kind of project is well suited to a guide on how to build a computer from the ground up, starting with logic gates, writing a real time OS and developing a scripting language that will run and compile on it. Then you can skip a lot of largely extraneous stuff and have a solid understanding of how the hardware works.


This book and its companion (free) online course are great: http://mitpress.mit.edu/books/elements-computing-systems http://www.nand2tetris.org


Very good indeed. The Google Tech-Talk presentation is worth watching.


> How it really works -- including compiling, linking, system calls, operating system involvement, hardware I/O, communication between ICs, etc. The path from the block of text to photons emitting from the screen, with fairly detailed explanations at every level.

That reminds me of JBQ's blog post from shortly after Dennis Ritchie's death: https://plus.google.com/112218872649456413744/posts/dfydM2Cn...

I would love to see that document if you still have it.


WOW, you should post that LaTeX document regardless of it being unfinished! Just the fact that you spent so much effort, requires some sort of release :)


This is the sort of thing I was looking for when I started wanting to understand the 'big picture' of computer programming. Would be great if you posted it!


I have often had the same idea, but more towards the goal of the intended audience being non-programmers.

But if you do finish this, I certainly would be interested in reading it.


Can you please post it somewhere? I am really curious!


This sounds like an outstanding Kickstarter project.


Please, please post this. Or if not would you be willing to share it privately? This is the sort of reading that really gets my rocks off. My email is in my profile if you're interested at all. I really would love to see this.


Agreed. "Hello world" is how you test that you are able to create a particular software artifact at the most basic level. My first kernel device driver was a NetBSD one called /dev/hello; it simply spit out "HELLO WORLD " over and over, for as long as you cared to read it. But it showed me how drivers do I/O and that I could write one and link it in.


Another important outcome of a successful "hello, world!" is that you find some kind of MVP - Minimal Viable Printf.

Just because it is C doesn't mean you've got a sane libc. Let alone the luxury of a debugger. Just seeing that simple string on the screen/logfile can be a blessed relief.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: