Sunday, September 25, 2016

Context Switching

As a task executes it utilizes the processor / micro-controller registers and accesses RAM and ROM just as any other program. These resources together (the processor registers, stack, etc.) comprise the task execution context.

ExeContext.gif 

A task is a sequential piece of code - it does not know when it is going to get suspended (swapped out or switched out) or resumed (swapped in or switched in) by the kernel and does not even know when this has happened. Consider the example of a task being suspended immediately before executing an instruction that sums the values contained within two processor registers. While the task is suspended other tasks will execute and may modify the processor register values. Upon resumption the task will not know that the processor registers have been altered - if it used the modified values the summation would result in an incorrect value.
To prevent this type of error it is essential that upon resumption a task has a context identical to that immediately prior to its suspension. The operating system kernel is responsible for ensuring this is the case - and does so by saving the context of a task as it is suspended. When the task is resumed its saved context is restored by the operating system kernel prior to its execution. The process of saving the context of a task being suspended and restoring the context of a task being resumed is called context switching

The Cost of Context Switching
Context switching is generally computationally intensive. That is, it requires considerable processor time, which can be on the order of nanoseconds for each of the tens or hundreds of switches per second. Thus, context switching represents a substantial cost to the system in terms of CPU time and can, in fact, be the most costly operation on an operating system.
Consequently, a major focus in the design of operating systems has been to avoid unnecessary context switching to the extent possible. However, this has not been easy to accomplish in practice. In fact, although the cost of context switching has been declining when measured in terms of the absolute amount of CPU time consumed, this appears to be due mainly to increases in CPU clock speeds rather than to improvements in the efficiency of context switching itself.
One of the many advantages claimed for Linux as compared with other operating systems, including some other Unix-like systems, is its extremely low cost of context switching and mode switching.

Friday, August 19, 2016

Thursday, May 19, 2016

Wednesday, May 18, 2016

Top 7 C Programming Books.


1- The C Programming Language


This book is a comprehensive guide to the finalized ANSI standard C language programming. It has been updated with extra sets of problems and examples to simplify the application of complicated language constructs. Additional material not only includes an in-depth look at the C language, but the official C language reference manual is also provided.


2- C: The Complete Reference


C: The Complete Reference is written by Herbert Schildt. It is a popular book among all other books written by Herbert Schildt. By reading it you’ll get in-depth coverage of the C language as well as all new features of C. The book also includes hundreds of examples and sample applications. Some other popular programming books written by Herbert Schildt are Java – The Complete Reference and Java – A Beginners Guide.


3- Programming in ANSI C


Programming in ANSI C is written by E Balagurusamy. I personally recommend you to start learning from this book because I learned all basic concepts of C using it. This book is one of the best and most popular C programming book in India. The author has given simple examples after every concept that will help you to learn C language in an easy way.


4- Let Us C


Written by Yashavant Kanetkar. He is a well know and popular author in India. This is another book that helped me to clear my C programming concepts. The best part of the book is, there are so many examples at the end of each chapter that really helps in improving C skills. Let Us C is 
Let Us C is another best selling and popular C programming book in India.


5- Head First C


Head First C is written by David Griffiths. Head First C provides a complete learning experience for C language and structured imperative programming. The book helps you understand how to be a great programmer. You will learn basics as well as advanced topics in easy manner with good programming examples.

These are some best C books that I have shared with you. If you know about any other popular and good C programming book then please mention it by commenting below. I will surely add it to this list.


6- Best C programming books – beginner

Best c programming book - beginner

If you are new to programming and want to learn c you have not picked the easiest language to start with. The plus side is that you will get a good understanding of how programming actually works and that will help you in the future.

As a beginner you need a book that focuses more on the basic concepts. When you get the hang of them learning more advanced topics will be so much easier.

One of the best c programming books that you can read is C Programming Absolute Beginner’s Guide, by Greg Perry. It is fun to read and a great introduction to programming.

7- Best c programming books – in a hurry

Best c programming book - in a hurry

Some people just want to get going as fast as possible. If you are one of them chances are that you don’t have the patience to sit down and read hundreds of pages.To stay focused you need something shorter and with a higher pace.A book that would suit you perfect is C Programming Professional Made Easy, by Getaway Guides. It teaches you exactly what you need to know to start using c, no more, no less.

Tuesday, May 17, 2016

Monday, May 16, 2016

10 Books Every Programmer Should Read

The list below is an unordered list. You can pick any book you like, and some of the books don’t even cover a programming language at all, but just help you understand the world of programming. It doesn’t matter which book you’ll pick, any book is a step to enlightenment.