Why we should read UNIX 6th source code


Lately, I finished writing the note of UNIX 6th code reading.

I recommend you to read the UNIX 6th source codes, too.

I'll show you why it's so worthy, here.


UNIX 6th is appropriate for who has never read the source code of OS.

Begin to read it A.S.A.P!

You can read the source code here.

The reason why I recommend you to read UNIX 6th source code

The number of lines is just only about 10,000

The number of lines of recent Linux source code is over than 1,000,000. It's very hard for us to understand it overall.

The other hand, the number of lines of UNIX 6th source code including device drivers is just about 10,000.

And the number of lines of each device driver source code is only about 100. They're very simple, so you can get to know the detail easily.

It includes fundamental ideas of OS

Unix 6th source code includes basic OS techniques.

File system, Process, Process switch( Context switch ), System call, Interrupt, Trap, Pipe, Device driver, and so on. They're implemented as simple logics.

A recent OS source code has been modified and sophisticated. So you can't easily understand what they do, i think.

Understanding UNIX 6th will help you understand them because you can guess what they do if you have basic ideas of OS.

As you know UNIX 6th was written many years ago. So, be careful that it doesn't include recent techniques. For example, Network, Thread, logic for Multiprocessing, and so on.

The guide book exists

The guide book for reading UNIX 6th code exists. That is "Lions' Commentary on UNIX" called "Lions Book" by some people.

If you can't afford to buy it, you can get the pdf files for free because it's published by the author on internet. I'll introduce you the web site below.

And I've attended the workshop of the Lions Book since 2010. Please feel free to join it if you're interested in it.

Besides, of course, you can refer to my blog articles to read the code. I believe they help you understand.

Sufficient materials

You can get the sufficient UNIX 6th and PDP11 materials on internet.

I'll introduce you the web site you can get materials later.

Besides the emulator of UNIX 6th and PDP11 exists. You can read the source code with actually operating UNIX 6th. (How nice!) You can get the information of it here.

It helps your job well

As you know, OS is the basement of a computer system.

Understanding OS helps you understand how hardwares are used.

Understanding OS helps you understand how programs are handled.

That is, it's beneficial for both hardware engineers and software engineers. You can guess what the bottle neck is in a system if you have the knowledge of OS.

In other words, understanding OS helps you understand a computer system all over.


Yap, of course we have some problems to read UNIX 6th source code.

First, pre K&R C. Most code readers are confused by it. I'll show you one of the examples.

struct {
  char high ;
  char low ;
} ;

hogehoge( arg ) {
  int hoge ;
  hoge = arg ;
  return hoge->low ;

I expect that you're confused now like "Why types aren't written at hogehoge( ) function and arg arguments!?", "Why integer hoge can use hoge->low!?". But, that is pre K&R C!

Second, some programs are written in assembly code. I guess it must be very serious problems for some people. I tried understood some of them and wrote the descriptions on my blog. I believe they help you understand.

Third, some of the source codes aren't sophisticated yet.

Finally, it's not so easy to understand Lions Book. See my articles when you can't understand it. You're required not to mind them too much. :-)

My articles

Basically I followed the flow of the Lions Book. The line numbers written in the articles are corresponding to the source code ones used in Lions Book.

And I've tried translating them into English. I'm afraid but, I haven't finished yet. If you want to read A.S.A.P, please cheer and support me. :-)

The following list is the note of the work shop of Lions book I introduced you the above.

These articles are the notes of the camp that is took place with the work shop members.

I've tried making some software and doing experiments regarding to UNIX 6th.



I hope you're inspired to read the UNIX 6th source code now.

Don't hesitate, just try it!