This blog is dedicated for exploring the working of computers and making them fun , easy and exciting to work on ! Please feel free to correct , update or post any new information that might be helpful .
Friday, June 17, 2011
Saturday, September 18, 2010
What is the difference between physical memory addresses and virtual memory addresses? What is a page table / page table entry?
What is the difference between kernel mode and user mode? What is a system call?
What is a spinlock? Why would you use one? When and when not?
What is a context switch? What happens when a thread is "blocked"?
What does the scheduler do?
What happens (to the state of a running thread) when an interrupt occurs?
What sorts of things must an interrupt handler do?
How will you keep track of its usage?
Under what license will you write your driver?
Why not vmalloc?
What if you got to know that your memory is leaking?
Thursday, September 9, 2010
Setting up Version Control systems in Linux
An orderly life certainly warrants the need of keep a check of all the "Kodak Moments of life" , when a certain combination of the code worked brilliantly , bringing a smile on the developers face.
Over the course of time , the code is updated for getting a bigger smile .. but yeah sometimes one is not able to remember or browse through the whole source code to find out as to where the error has crept in from . And any frantic search of the Kodak Moment in the memory just does not seem to work out .
This is where the CVS comes to the rescue , as it acts as the database , which has stored the snapshots of the code , perhaps with a comment about those glorious days of the working code .
Just download the base-lined version and voila , it works . Now its just needed to compare what the updated code has more in it , that caused the error.
Subversion is an alternative to CVS that is growing in popularity.
apt-get install subversion subversion-tools
Creating a Repository :
Create a directory by the name repo/ under your home folder say /home/rajesh/
This is the place where we would be placing the repositories of all the projects that I am working on . This is different from my workspace directory.
timesheetapp is the application that I am working on and I want to keep a repository of that .
svnadmin create ~/repo/timesheetapp
The contents of the folder would look like this :
rajesh@rajesh-desktop:~$ ls -lrt /home/rajesh/repo/timesheetapp/
total 24
-rw-r--r-- 1 rajesh rajesh 229 2010-09-09 12:29 README.txt
drwxr-xr-x 2 rajesh rajesh 4096 2010-09-09 12:29 locks
drwxr-xr-x 2 rajesh rajesh 4096 2010-09-09 12:29 hooks
drwxr-xr-x 2 rajesh rajesh 4096 2010-09-09 12:29 conf
drwxr-sr-x 6 rajesh rajesh 4096 2010-09-09 12:29 db
-r--r--r-- 1 rajesh rajesh 2 2010-09-09 12:29 format
For optimum use of the subversion its advisable to use create a directory structure
mkdir timesheetappsvn import . file:///home/rajesh/repo/timesheetapp --message 'Creating repository for timeSheetApp
mkdir timesheetapp/trunk
mkdir timesheetapp/branches
mkdir timesheetapp/tags
Steps for Creating a debian package installer for an application in Linux
Debian packages are standard Unix archives that include two gzipped, bzipped or lzmaed
The canonical program for handling these packages is dpkg, most commonly via apt/aptitude. [apt/aptitude are programs for application installers that come by default with Ubuntu]
A deb file contains two main files :
- control.tar.gz
- data.tar.gz
- Package: you have to put here the name of the package, never use spaces, never use a version number. It is case sensitive, be warned!
- Version: of course, the version number / code. It can also be, for example, opengeu-3.0.2 or any other weird code, as long as the last part is a number. Always remember that chaning the version to a higher number triggers the system to consider that new file as an update of course!
- Priority: optional, high, low, only system or security updated should have something like high in the priority.
- Architecture: i386, amd64, all, you should specify here what platform this package is compiled for. If it is only an artowork or a metapackage, you can put all in the Architecture field.
- Depends: a list of all the packages this package depends on. A metapackage, for example, can include almost nothing but depend on a lot of other packages so that installing this metapackage automatically installs a lot of other packages! That’s what happens with opengeu-desktop for example!
- Conflicts: if you know that your package can’t work if another package is installed, well, you should then list that package here.
- Description: put only a very short description in the first line, then enter a longer description on the second line, like it is shown in the example above.
Wednesday, June 11, 2008
Programming with Bytes :
Programming with Bytes :
The world - 21st Century
There was a huge empire … an empire of cranky devices christened “Computers”. These later on went to be called “Supercomputers” , machines which could do anything and after a few decades probably everything .
Such was the extent to which they had spread themselves over our lives and turning back was unimaginable. But all said and done , everything surviving on earth needs to follow the Rules of the nature i.e even the largest of Dinosaurs were to be created from the tiniest of cells.
Thus the Supercomputers that we see today work on nothing more than a bit a.k.a. cells of the computer . A ‘bit’ symbolizes the smallest unit of information that can be stored in a memory (Artificial).So what does it store afterall . Any resemblence or attempt to relate this to the human brain could prove fatal as the complexity of the human is really complex. Hats off to the Human brain anyways especially the one that makes me write this.
Well back to what we were discussing , a bit . A bit stores either a ‘ON’ or a ‘OFF’ , this can be very easily an safely be related to a switch , a very normal Electric switch , the one one at home used to turn ON or OFF a bulb.
So how do the 108 keys on your keyboard become recognisable data to the computer.
Lets take an example , say A , * , 1 need to be represented in an understandable format to the processor.
Now for the computer these 3 are no different from each other , neither does it understand that these are English Alphabets , a special symbol , a Maths number respectively.For the processor these are mere unique values which need to be always stored in a particular form onto the memory such that on reading from the processor , for those to whom it really matters (i.e you and me) do get to understand as them as English Alphabets , a special symbol , a Maths number respectively.
Here is where we come an imporatant industry standard , ASCII - Short for American Standard Code for Information Interexchange . which assigns letters, numbers and other characters within the 256 slots available in the 8-bit code.
So ASCII values come as great help over here. ASCII values are standard values that are uniform all around the world . So A is said to have an ASCII value ( let me tell you its 65 ) We have a Appendix ‘A’ section later on in this blog for a list of ASCII values.
At this stage let me introduce you to Procy , Procy is our friendly processor who would amuse and awe you with his antics and in the process help us understand the working of a processor.
Over to Procy …
Hello Everyone ! A very good day to you !
Well to start with let me be courteous enough to introduce myself. I am Procy , I am a processor. The Adam of my family came to earth sometime around in the early 1970. The first of my kind as far as I have heard was a quite fat and bulky , almost the size of a cricket bat . But since then , with all these slimming packages available , here I am the slim beauty , a mirror cracking material ! Oops am boasting too much , well I am just telling the truth.
Now , let me take 2 cases for our study !
1) A simple file (to keep the complexity to the bare minimum let us take a “text” file written and saved in a notepad) . We will migrate to MS Word documents later on this section.
If we type the letter ‘A’ in a notepad and save it onto the harddisk with under a text file format , we notice that it takes 1 byte of space in the memory.You may also take a notepad on your system and type the letter ‘A’ in it (without quotes) .
Now how does this ‘A’ get stored in the memory finally . I mean if you just pluck out the memory and are somehow able to view or read the contents marked at the location where the file is saved.
Well as per my understanding the ‘A’ would first get converted into its ASCII value ( Just to remind – its 65 )and then this again gets converted into an 8 bit digit in its binary form . So this is how it would be stored in the bare memory , and the Notepad program that was developed would have in its list of important values – the address where this particular 8 bit value resides.
So from an OS perspective when we again try to open the file using NotePad :
First the program files are loaded into memory , ( now the RAM ) , then the data whose address in the harddisk would be stored along with the tasks of the NotePad application will be copied on to the RAM.
Now these ASCII values are converted to human readable characters by the NotePad application (well that’s what it does and sells for).