Twitter Delicious Facebook Digg Stumbleupon Favorites More

Wednesday 28 September 2011

Finding r's complement and (r-1)'s complement of a number (1s complement and 2s complement)


Finding the r's and (r-1)'s complement

Here we are going to learn how to convert a number to its r's and (r-1)'s complement. 
Method:
Let 'N' is a number and r is its base where r>1 and in N,  'n' is the number of digits before its decimal point then  we can write 
r's complement of number = r^n-N

EX.
                       N = (23)10
                              here r = 10
                              n = 2 and N = 23 
hence we can write the 10's complement of this number as 10^2 - 23 = 77.
hence we can say that 10's comp of 23 is 77. 
Although this method is good enough to solve any problem regarding to this concept, but we will follow different method for finding r's and r-1's complement.

Easy Method:
Let we have to find again the 10's comp of 23 then this method tells us to divide 3 from 10 and 2 from 9 (i.e 10-9). which gives us a result of 77.

                               9  10
                           -  2    3
                                       
                               7    7
i.e the generalized form of writing a r's comp of a number 'abc' which is in r base, we can write.

                             (r-1)   (r-1)   r
                        -     a            b    c
                                                       

this difference gives us the r's comp of that number.
i.e we can find r's complement of a number by subtracting its right most digit by r and all digits by r-1.

Finding (r-1)'s complement:
We can do this easily by subtracting all the digits of that number from (r-1) where r is the base of that number.

EXAMPLES:  
Find the 10's and 9's complement of (348)10
ans:                   9   9   10
                       - 3   4     8
                                       
                        6    5    2    here 652 is 10's comp of 348 


9's comp          9    9    9 
                     -  3   4    8
                                      
                        6    5    1    here 651 is 9's comp of 348

from this method you can find the r's and (r-1)'s complement of any number with base r.

if any questions DO COMMENTS..

Friday 23 September 2011

The Tower of Hanoi (interesting fact)


THE Tower Of Hanoi

According to legend, there is a set of 64 gold disks on 3 diamond needles, called the Tower of Brahma. Legend reports that the Universe will end when the task is completed. (Edouard Lucas, R ́cr ́ations e e Math ́matiques, Vol. 3, pp 55–59, Gauthier-Villars,eParis, 1893.)

How many moves will it need? If done correctly,
T (64) = 2^64 − 1 = 1.84 × 10^19 moves. At one move
per second, that’s
= 1.84 × 10^19 seconds
= 3.07 × 10^17 minutes
= 5.12 × 10^15 hours
= 2.14 × 10^14 days
= 5.85 × 10^11 years


Current age of Universe is ≈ 10^10 years  

Friday 16 September 2011

Process Synchronisastion

Process Synchronization

Introduction: In operating system if two or more co-operating processes some logical space i.e both data and code section or only data using some message call. In the process of sharing if two processes starts manipulating the same data at the same time then data inconsistency may occur, hence we need some rules by which we can restrict two or more process to manipulate data at the same time, so that data consistency is maintained.

we can view this problem from this example.
Let two process P1 and P2 is working on the same resource(data)  a=30(initially).

     P1                                          P2
 temp = a;                                temp = a;
 temp = temp+10;                    temp = a-5;
 a = temp;                                a = temp;

Here temp is a local variable

Let first process P1 starts executing it and stores value of   'a'   to temp then it adds 10 to temp.
now a = 30   and   temp = 40 (here temp is local to P1)
let there is a context switch and process P2 starts executing then it stores  a =30 to its local variable temp and decrements it by 5 i.e
now a = 30(still)    temp = 25 (here temp is local to P2)
now let again their is a context switch and process P1 starts executing  and it stores 40 to 'a' (from its local temp). and gets terminated, again process P2 starts and finally it stores 25 (from its local temp) to 'a' .

Hence we end up with 'a = 25' which may be different (i.e  40) if process ends lastly.
so we can see that for different execution sequences we have different end results. This anomaly is known as 'Race Condition'.
Hence we need to insure that only one process may change the variable at a time, in order to achieve this we require that process should be synchronized.

Thursday 15 September 2011

Digital Logic gates (AND gate, OR gate, NOT gate)


Digital Logic Gates

Logic gates are the fundamental building blocks of digital systems.
There are three basic gates
1.  AND
2.  OR
3.  NOT


here in this picture you can find that for AND gates out-put becomes 0 if any of the input is Zero(0).
similarly for OR gate out-put is 1 if any of the input is 1.
NOT gate simply reverse the input at its out-put.

Here we are not going to the details of hardware realization of logic gates.(Since it is not in the syllabus of gate exam.)
Although we can realize any circuit using AOI(AND, OR, NOT) gates, there are also two different gates which can also realize any circuit using these gates. So we call these gates as universal gates. Name of these gates are NAND and NOR. from this figure we can also find their truth tables.
Here I am giving you an overview how these gate works we will come later here for more sophisticated   operation of logic gates.




here it is a java applet use this to understand the how logic gate works.

Wednesday 14 September 2011

Digital Electronics and Gates(And gate, OR gate, Not gate)

Digital Electronics

Introduction: When we listen the term digital logic the first thing which comes in our mind is digital values i.e 0 and 1. In digital electronics generation of zero volt input is almost impossible to achieve hence we think values of  ~ 0.5, 0.6, 0.7 V~ as 0V input and  ~ 4.5, 4.6, 4.7V ~ as 5V.
So here question is that why we use digital signal if they are actually not discrete, ( as we know we take ~ 0.5, 0.6, 0.7 V~ as 0V input and  ~ 4.5, 4.6, 4.7V ~ as 5V. etc...)

So lets starts with some different concepts.
Let us take an analog signal

Analog to Digital

we will quantize this signal using some discrete quantum values, and the portion which comes in between two quantum is known as quantization error. So if we take small quantum then this error will be less.
And after getting this discrete values we use comparator to give them a some level for a particular range, and when we get a discrete value we use it with logic gates.

Monday 12 September 2011

GATE 2012 Application Form


GATE 2012 Application Form

Pre-final year students are not eligible to write GATE 2012. For more details, please refer to eligibility criteria for GATE examination.
Hello everyone, date of application form for GATE 2012 has been declared and it stars from 12 september 2012. This time there is a little change in eligibility criteria (you can check it here). You can get application form for GATE from here . From here you can apply for GATE online.

You can also view the respective Zones. GATE is conducted through the constitution of eight zones. The zones and the corresponding administrative institutes are:



Zone Website
IISc Bangaloregate.iisc.ernet.in
IIT Bombaywww.iitb.ac.in/gate
IIT Delhiwww.iitd.ac.in/gate
IIT Guwahatiwww.iitg.ernet.in/gate
IIT Kanpurwww.iitk.ac.in/gate
IIT Kharagpurgate.iitkgp.ac.in
IIT Madrasgate.iitm.ac.in
IIT Roorkeewww.iitr.ac.in/gate

Last Date of Submission 17-OCT-2011 (Monday)

Date of Online Examination: 29-01-2012 (Sunday)
Date of Offline Examination: 12-02-2012 (Sunday)


GATE Eligibility Criteria for 2012

Wednesday 7 September 2011

Process Scheduling

Process Scheduling

In a single processor system where there are many processor fighting for their execution or in the multiprocessor system where the same fight occurs, we need some mechanism or some rules to allocate the CPU one by one to them, and in such a system we need that the CPU of the system must be used efficiently, and this mechanism is known as Process Scheduling.
Suppose in a situation where one process starts I/O, then in case of without scheduling the processor will sit idle and hence it decreases the CPU utilization.
When a process is waiting in the ready queue and if CPU becomes idle then the operating system selects one of   the process in the ready queue using Short term Scheduler and here is the work of Process Scheduling comes.

There are two types of process Scheduling:
1. Preemptive Scheduling: In preemptive scheduling if a process is waiting for an I/O or a high priority process comes in the time of their execution that process leaves the CPU for that process using a context switch and it is preemption and this scheduling is known as Preemptive scheduling.
2. Non Preemptive scheduling: In non-preemptive scheduling if a process starts executing, it leaves after its termination, hence all process has to wait if a process is executing in CPU.

There are different types of scheduling algorithms used for process scheduling.
1. First come First serve (FCFS)
2. Shortest job first (SJF)
3. Round-Robin Scheduling (R-R)
4. Priority Scheduling
5. Multilevel Queue Scheduling
6. Multilevel Feed-back queue Scheduling

Tuesday 6 September 2011

Inter-process communication (IPC)

           
Inter process Communication
If there are two processes executing parallel in an operating system then they may have two types
1. Independent process: Those process who do not affect or affected by another process which is executing in the OS(Operating System). 


2. Co-operating Process: These processes need some communication between them to complete their work.


Since there are lots of processes who communicates with another process due to several reasons like Information sharing, To increase the computation speed. etc..
Co-operating process needs some mechanism which may allow them to make communication with other processes and this mechanism is known as Inter Process Communication(IPC). 
Inter Process Communication is of two types
1. Shared memory System.
2. Message passing System.


Shared memory System:
In Shared memory System two process shares some part of their address space.(since it is not allowed by OS to share address space by two processes hence for shared memory system they(sharing processes) must agree to remove this restriction). This address space is then used by all co-operating process, here programmer has to explicitly develop the code for process in such a way the will not be updating at the same location simultaneously(using semaphore). Operating System dosen't take overhead for these things.


Message passing System:
If two processes are co-operating process then they communicate by message passing system also but message passing can slow the execution since message passes through the kernel. But this type of communication is very helpful in distributed computing environment where there is no common address space for communicating process.

Sunday 4 September 2011

Thread in Operating System

Threads

Saturday 3 September 2011

Process in Operating System

                PROCESS

Friday 2 September 2011

Evolution of Operating System

Now in these days we are working with Operating System like Win7, Vista, Xp, Mac, these are highly graphical and very fast Operating Systems. There are other OS Android, Symbian etc for mobile phone these are also very advanced.
      Initially users( basically the scientist or programmer) use batch system, then after Multitasking, Real time system, Multi-programming system, Time sharing system has came.

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates