Tuesday, May 6, 2014

All about Computer Architecture

Ever since my undergraduate days, I perceived the need for a new book in computer architecture.Ultimately, I have had the privelege with my publisher, McGrawHill India, of writing it. The reason that I felt that there is a requirement for a new book  is as follows. In the late nineties, the field of computer architecture was very rapidly growing, and textbooks in computer architecture were finding it hard to strike a balance between timeless concepts and recent advances.  We need to understand that recent advances in a field are often controversial and ephemeral. There is typically no broad based consensus between designers and researchers regarding the right way to proceed. Consequently, books that focus more on fundamentals are better suited for early undergraduate education. Secondly, I also found a lot of divergence between books in computer architecture, and books in more mature disciplines such as electrical and mechanical engineering. The latter fields were established since the 50s, and their textbooks reflected this maturity. They derived all the results from first principles, and even design oriented chapters were properly motivated from a theoretical perspective. In comparison, my early interaction with the field of computer architecture did not answer the question, "why is this designed this way?''.

The second important motivation for writing this book, is that most computer architecture books were exclusively targetted to the American undergraduate education system because they were written by American authors. Undergraduate education systems in countries such as India, China, and South Korea are comparatively very different. The background of students, the pedagogical methods, and even the aspirations of students are very different. To put it simply, the education system in these countries is slightly more "strict." Hence, I wanted to design a book that is suitable for all educational systems. It has "strict" parts as well as "liberal" parts. Large parts of a good book should read like a story, and there should be the right amount of rigour at the right places. It has been my constant endeavour to ensure these dual goals.

As an example, let us consider the first chapter. The first chapter answers the question, "what is the difference between a calculator and a computer?'' Both of them can perform mathematical computations. However, there is a basic difference, and it is that we can program a computer to do fairly sophisticated tasks such as predicting the weather after 10 days in Moscow. A calculator cannot do that. What is it that is so fundamentally different in a computer? It turns out that a computer has a little bit of extra circuitry that makes it radically different from a calculator. It is important for readers to understand and appreciate this fact. Secondly, what is this extra circuitry that makes such a big difference? We take recourse to results in theoretical computer science to explain to readers that a computer is fundamentally different from most other devices that can process numbers such as a calculator and an abacus.

The first part deals with the design of the software interface of a processor. A processor needs to be essentially programmed with a sequence of bits. A bit is an electrical signal that can take have two values -- on (1), and off(0). We shall show that it is possible to design an exquisite variety of software by just using a sequence of bits. We start with simple abstractions in Chapter 2. We first try to design a method to represent positive and negative integers using a sequence of bits. Here again, the approach of this book is very different. The book provides a thorough theoretical justification of the design of number systems, their limitations and their properties. This is the "rigour'' aspect of the book. We subsequently, proceed to design representations for floating-point (numbers with a decimal point) numbers, and pieces of text.

The question that arises now is how do we use this information to design an instruction set for a processor. To give the reader a flavor of designing a full computer from scratch, we proceed to design our own custom instruction set called SimpleRisc in Chapter 3. It is very important for the reader to understand that to become a good computer architect, it is necessary to build and design computers. Just reading and appreciating theoretical concepts is not enough. To motivate readers to tread this path, this book devotes 5 chapters to designing a computer for the SimpleRisc instruction set. We discuss different design styles. At this stage, the reader is expected to create her own designs for computers that are compatible with the SimpleRisc instructions. To aid the reader in this process, we provide reference designs with both the Logisim simulator and VHDL in the companion website of the book. In fact, we would further like to challenge the reader to design a more expressive instruction set and extend the reference design of the processor to create more efficient designs.

Another important distinguishing feature of this book will be the emphasis on modern technologies such as multicore processors and I/O systems. We need not go very far. Let us take a look at our cell phones. Most smart phones these days have multiple processors (cores), and have a lot of peripherals such as cameras, sound cards, graphics cards, USB ports, NFC communication devices, and accelerometers. Interfacing with these components is a very important aspect of modern processor design. Most jobs in the field of computer architecture are now in the field of system design, where the job of the designer is to integrate a variety of components including a variety of processors in the same chip. The main challenge is to design efficient mechanisms to transport data between different units in a chip, and talk to third party components. Chapters 10, 11, and 12 look at the design of advanced memory systems, multiprocessor (multicomponent) systems, and I/O systems respectively.

Let me again go back to discussing the big picture. The main idea of this book is two fold: a deep theoretical perspective, and a very immersive practical experience. Both are required in equal measure to make a computer architect. We try to provide both in this book. The theorems, lemmas, proofs, and intuitions provide the theoretical perspective; whereas, the chapters devoted to designing a full computer from scratch provide the practical perspective.

There are several other important aspects of this book also. We have cleanly separated fundamental concepts, assembly languages based on open or proprietary standards, and state of the art processor designs in this book. Each chapter has only one theme. We have not mixed issues in any chapter. For example, the design of state of the art processors by Intel, ARM, AMD, and NVIDIA is confined to Appendices A and B. Later on, when the designs change or become obsolete, we can add more appendices. Secondly, we have separated the discussion on assembly languages into three chapters. The first chapter looks at the theory of assembly languages, and Chapters 4 and 5 discuss vendor specific assembly languages. This separation of topics was greatly appreciated by both reviewers  and students alike.

Another important differentiating aspect is the design of problems at the back of the chapters. In my student days, something that struck me was the astonishing simplicity and banality of problems in computer architecture courses. Most of the problems involved evaluating the results of formulae presented in the book  with a varying set of constants. There were hardly any profound insights to be gathered. In comparison, problems in textbooks in other areas took a long time to solve. I remember thinking about solutions to problems in my formal languages and automata theory course for days at a stretch. It has been our sincere effort to bring a similar culture to a computer architecture textbook. The star marked problems at the back of the chapters are genuinely difficult and will prove to be thoroughly engaging. They might even take days to solve!!!

To summarise, the basic aim of writing this book is to give the computer architecture community something new. Secondly, there has been an implicit desire on the part of myself to bring this book at par with books in other disciplines. While reading this book, the reader should be convinced that results in computer architecture are very deep, are theoretically justified, and there are a variety of engineering choices to make.

9 comments:

  1. when the book is coming in market , Because Difference between computers and calculators is not given so nicely in any computer architecture books i had read so far.

    ReplyDelete
  2. Respected Sir

    It appears that your book will be of immense help to the students. I am teaching for nearly 12 years in different Private engineering colleges of West Bengal. The pedagogy is totally different for the Indian students. I hope your book will help students to understand the Subject Computer Architecture very well. Needless to say I am sure the book must have lot of examples from real life.

    ReplyDelete
  3. I believe that my book will be in the market 1-2 months from now. We are now in the last stages of the publication process.

    Secondly, regarding the pedagogy, I have tried to maintain some amount of academic rigour, and also relate it with examples of real life (as much as possible). I hope to learn a lot from the feedback of readers.

    ReplyDelete
  4. Eagerly waiting for your book .

    ReplyDelete
  5. Unfortunately in India, computer science is taught like "english literature" with no much real world exposure. Wonder if we are being put into "virtual world" as preparation for careers in virtualization !

    Certainly after finishing this book even small town boys like me will start boasting our experiences in designing and implementing a pipelined processor from scratch, just like how our IIT peers do just before leaving the country forever !

    Hope atleast with the coming of this book, teaching faculty will make lab components a integral part of computer science learning.

    This book also reminds me of 2 books I read (after graduating ! ), "The elements of computing sytem" by schocken and "Operating systems a deisgn oriented approach" by Crowley. Awesome books.

    A few comments on the probable technical content of this book.
    I think it covers 2 areas,
    1. Design, implementation of a processor and methods to speed it up
    2. Study of computer system organisation where CPU is just a "Big Brother".

    Its the second part that i am very curious about. Why should it be a study of computer organisation ? why not build somethign there too ? Any simulator towards this end?

    - Bus interfaces are too complicated to just imagine things. Whats the relevance of so many buses on the same system ? their interplay ? I do't expect you to provide arcane details to turn me into a device driver developer. Some experiements to learn hands on by seeing the need for more ?

    - DMA does't seem to be just direct memory access. How is that this chip could do things in one shot which the processor could not ? Whats the design and implementation of this chip ? Atleast as part of exercises with some hints.

    - Memory and I/O mapped I/O. How one scores over the other ? Any historical perspective as how they evolved ? Any details to dig into "My Computer" to see which device is what ?

    -Multicores. One of the most ill written subjects in our time. How different will the logical organisation of a computer be with multi processor systems.Who boots up first.. who controls I/O, interrupts ? It's impossible to convincingly preseant this topic without touching OS. The details on this topic provided by the above mentioned book written by Crowley helped me a lot.. a lot.

    A pathbreaking attempt from your side. Hope it helps us.

    On a aside, one last thing. Please scrap undergraduate education at top 5 IITs. Double the intake of grauate students. Most graduate students prefer to stay back in India and even if a small part of tehm choose to join teaching careers it will be of a great impact on learnings in lesser known colleges. Use NPTEL to effectively offer undergraduate courses. UNfortunately many of the courses there are delivered by great teachers without much art of teaching. No hands on practical components either. Please make Lab components compulsory in all the state level colleges too. No networking lab.. No OS lab. Just "hello world" labs !

    ReplyDelete
    Replies
    1. My book has been released. You can take a look and let me know.
      -Smruti Sarangi

      Delete
  6. My book has been released. It is available on Amazon and Flipkart. There are some minor problems with the links on both the sites. This websites contains the links:
    http://www.cse.iitd.ac.in/~srsarangi/buyitlink.html

    Please do take a look at the book, and let me know.
    Smruti Ranjan Sarangi

    ReplyDelete
  7. Nice and informative blog. The admin of this blog create a very informative and helpful blog which is the main concept to update the major information. Very thanks for sharing me.
    Home Tutors in Delhi | Home Tutors Delhi

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete