Monday, May 30, 2011

Distributed Computing


Find all class lecture slides HERE 
Slides are as follows:
1. Introduction

2. System Architecture
3. Process and IPC
4. Communication and RPC
5. Socket Programming
6. Java RMI and Threads
7. JINI
8. Mobile Agents and JINI
9. Synchronization
10. Naming
11. Replication and Consistency


Also included two reports that are to be submitted in lab, on 1) Cloud Computing and 2) Grid Computing.

Tuesday, April 19, 2011

Wipro chairman Mr. Azim Premji’s comment on reservation

I think we should have job reservations in all the fields. I completely support the PM and all the politicians for promoting this. Let’s start the reservation with our cricket team. We should have 10 percent reservation for Muslims. 30 percent for OBC, SC/ST like that. Cricket rules should be modified accordingly.
The boundary circle should be reduced for an SC/ST player. The four hit by a OBC player should be considered as a six and a six hit by a OBC player should be counted as 8 runs. An OBC player scoring 60 runs should be declared as a century.
We should influence ICC and make rules so that the pace bowlers like Shoaib Akhtar should not bowl fast balls to our OBC player. Bowlers should bowl maximum speed of 80 km/ hour to a OBC player. Any delivery above this speed should be made illegal.
Also we should have reservation in Olympics. In the 100 meters race, an OBC player should be given a gold medal if he runs 80 meters.
There can be reservation in Government jobs also. Let’s recruit SC/ST and OBC pilots for aircrafts which are carrying the ministers and politicians (that can really help the country…) Ensure that only SC/ST and OBC doctors do the operations for the ministers and other politicians. (Another way of saving the country…)
Let’s be creative and think of ways and means to guide INDIA forward…
Let’s show the world that INDIAis a GREAT country.
Let’s be proud of being an INDIAN…
May the good breed of politicians like ARJUN SINGH long live…
“Education’s purpose is to replace an empty mind with an open one.”

Monday, April 18, 2011

Tutorial for DEBUG


A good tutorial for using the "DEBUG" tool.

Click HERE to download

Operating Systems Lab



1. Shell Scripting
2. Producer-Consumer Problem using semaphores.                 
3. A Broadcast Program
4. A GUI simulating a telephonic conversation.

Download the assignment's solutions at:Download Link

Friday, March 25, 2011

Mission Code Prelims


Srijan - Jadavpur University Techfest
Mission Code (Prelims) : Question Paper download link: https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B-mmfn2DeWvJM2UzZWQ4NGUtMzQ3Zi00YjYxLWJmN2YtZWI0MTE2Y2Y2ZmY3&hl=en

Debug Prelims Solutions are given below:
Group A Answers
1 c
2 a
3 c
4 a
5 a
6 d
7 d
8 b
9 a
10 d
11 a
12 d
13 b
14 c
15 d
16 a
17 d
18 c
19 a
20 d
Group B Answers
1 c
2 a
3 a
4 a
5 d
6 b
7 a
8 c
9 c
10 a


Friday, March 18, 2011

LIBRARY FILE



;*******************************************************
; Some esential macros for elegant programming in masm *
;*******************************************************

exit macro
            mov ax,4c00h
            int 21h
endm

space macro
            mov ah,02h
            mov dl,20h
            int 21h
endm

;----------------------------------------------------
;Accepts single 2-digit hex nos.
;output: input value stored in AL
;regs. affected: AX,BH
;----------------------------------------------------
input macro                            ;two hex-digit input
            local ok,p,ok1,p1
            mov ah,01h
            int 21h
            cmp al,39h                  ;ascii value of 9
            jbe ok
            sub al,61h                    ;ascii value of a
            add al,0ah
            jmp p
ok:       sub al,30h
p:         rcl al,01h
            rcl al,01h
            rcl al,01h
            rcl al,01h
            mov bh,al
            mov ah,01h
            int 21h
            cmp al,39h                  ;ascii value of 9
            jbe ok1
            sub al,61h                    ;ascii value of a
            add al,0ah
            jmp p1
ok1:sub al,30h
p1:       add al,bh
endm

;---------------------------------------------------
;Prints two hex digits on console
;input: provide the digits in BH
;regs. affected: AX,DX
;---------------------------------------------------
output macro                         ;two hex-digit output
            local ok1,show,ok2,show2
            mov al,bh                   ;the digits to display is in BH
            and al,0fh       
            mov dh,al
            mov al,bh
            and al,11110000b        ;even binary values allowed in masm
            rcr al,01h
            rcr al,01h
            rcr al,01h
            rcr al,01h
            mov dl,al
            cmp dl,09h
            jbe       ok1
            sub dl,0ah
            add dl,41h                               ;hex digit handler
            jmp show
ok1:add dl,30h
show:
            mov ah,02h
            int 21h
            mov dl,dh
            cmp dl,09h
            jbe       ok2
            sub dl,0ah
            add dl,41h                               ;hex digit handler
            jmp show2
ok2:add dl,30h
show2: int 21h
endm

showmsg macro str     ;str data pssed through macro
            mov ax,@data
            mov ds,ax
            lea dx,str
            mov ah,09h
            int 21h
endm

str_length macro str    ;computes length of a string
            local lp1,done
            mov ax,@data
            mov ds,ax
            mov si,00h
            mov cx,0000h  ;clear cx
lp1:
            cmp str[si],24h ;check if its '$'
            je done
;else still chars left
            inc si
            inc cx
            jmp lp1
done:
            mov ax,cx
endm

;---------------------------------------------------
;Accepts input, and places them in an array
;array: is the address of the location from where inputs would be stored
;count: the no. of inputs
;---------------------------------------------------
input_array macro array,count,str
            local lp
            mov cx,count  ;the array size
            mov si,0000h
            mov bh,00h
            showmsg str
lp:        input                            ;call the single input macro
            mov array[si],al
            inc si
            space
            loop lp
endm

;---------------------------------------------------
;Setting the cursor
;Input: set row number in DH & column number in DL
;Registers affected: AH,BH
;---------------------------------------------------
cursor macro
            mov ah,02h                 ;request set cursor
            mov bh,00h                 ;page number 0
            int 10h                          ;Interrupt-call BIOS
endm

;---------------------------------------------------
;Clearing the screen
;Registers affected: AX,BH,CX,DX
;---------------------------------------------------
clrscrn macro
            mov ax,0600h              ;ah 06(scroll), al 00 (full screen)
            mov bh,71h                             ;attribute: white (7) on blue (1)
            mov cx,0000h              ;upper left row:column
            mov dx,184fh               ;lower right row:column
            int 10h                                      ;Interrupt-call BIOS
endm

;---------------------------------------------------
;display array
;Input:  Array address, the size of the array and an output message
;---------------------------------------------------
display_array macro array,count,str
            local lp
            pusha
            mov cx,count  ;the array size
            mov si,0000h
            mov bh,00h
            showmsg str
lp:        mov bh,array[si]          ;retrieving the individual terms of the array before calling the output macro
            output                                     ;calling output macro
            inc si
            space
            loop lp
            pop a
endm

Friday, March 11, 2011

Rate your prof


Participate in the departmental professor rating survey! Take your time to answer all the questions. For each of the underlying professors, give an overall rating accordingly. This should include, the way the particular person teaches, attitude towards students, grading, attendance during lab classes, overall popularity etc.Ideally students should participate in this poll after they have completed their 3rd year at JU-CSE.

Please follow this link to complete the survey: http://www.surveymonkey.com/s/RS9GPF3

Monday, February 28, 2011

Lexer, First-Follow, Left Recursion


 
Covers :

1) Lexical Analyzer (C)

2) Left Recursion (Java, GUI)

3) First and Follow (Java, GUI)












The codes of the above three assignments are provided at:
https://docs.google.com/leaf?id=0B-mmfn2DeWvJMGE4OGU3YTAtNDYxZi00MDc3LWIxMDQtZGQ0MGZjMjdhMzZm&hl=en


Thursday, February 10, 2011

VLSI Laboratory


VHDL Codes for FPGA implementation
  1. Full Adder (1-bit)
  2. Full Adder (4-bit)
  3. 7-Segment Decoder (3-8)
  4. 4-bit ALU
  5. Comparator (4-bit)
  6. Multiplexer (8 X 1)
  7. Demultiplexer (1 X 8)
  8. Binary to Gray Code Conversion
  9. (Even) Parity Generator
  10. D Flip Flop
  11. T flip-flop
  12. Binary Coded Decimal Adder(1 bit)
  13.  MULTIPLIER(2 bits)
  14.  Decoder(3-8)
  15.  Encoder(0-9)
  • In Viva you have to implement and run a full program (obtained by card picking).
Complete Source Codes, with UCF file and circuit diagram are provided here:
https://docs.google.com/leaf?id=0B-mmfn2DeWvJZDdkYjAxZTUtODQ5Yy00NzY5LWE1YjEtY2ZiMDk4ZmJiODYy&hl=en

Binary to Hexadecimal



%OUT-----------------------------------------------------------------------------------------
%OUT- Prints a 8-bit binary number in its equivalent hexadecimal form                     
%out- input: 8-bit binary string accepted from the user                                                  
%out- output: 1 byte Hexadecimal equivalent of the binary string is printed 
%out – author: Ayon and Ariyam                                
%OUT-----------------------------------------------------------------------------------------

if1
include macrolib.lby
endif

.model small
.stack

.data
count equ 08h                                                                                            ;for 8-bit binary string
ip db "Enter a 8-bit binary number: ","$"                                              ;a request to prompt the user for entering the binary no.
op db "  Hexadecimal form:  ","$"                                                           ;output message
err db " Invalid Entry!","$"                                                             ;error message
heading db "***** BINARY to HEXADECIMAL *****","$"                     ;a heading

.code


main proc
            ;clrscrn                                                           ;clearing the screen
            mov dx,0105h
            ;cursor                                                            ;setting up the cursor
            showmsg heading                                     ;displaying heading
           
            mov dx,0303h                                             ;pointing to next line
            ;cursor                                                            ;setting up the cursor
            showmsg ip                                                  ;prompt the user to enter the binary string
                       
            xor bh,bh                                                      ;clearing register Bh
            mov cx,count                                             ;loading cx with length of the binary string

           
continue:      rol bh,01h  ;rotate BH left, 0 will come in the LSB of BH, as intially BH was cleared
                        mov ah,01h
                        int 21h
                        sub al,30h                             ;getting the binary digit (bit 0 or 1) in AL
                        cmp al,01h                           ;when bit is greater than 0 or 1
                        ja WRONG
                        add bh,al                             ;add the input bit (0 or 1) to BH
                        loop continue                     ;iterate till 8 bits are accepted from the user
           
            showmsg op                                    ;display output message, content of BH not hampered
            output                                              ;calling output macro
            jmp FINISH
           
WRONG:       showmsg err                        ;displaying error message           
FINISH:                       exit
           
main endp
end main
           

Merge Sort



%OUT------------------------------------------------------------------------------------------------------------------------------------
%OUT- Accept two arrays, merge them and then sort them in ascending order using any SORTING algorithm
%out- input: Each term of the each of the two arrays is accepted from the user        
                                               ; Sizes of the arrays are mentioned in the program itself
%out- output: Print the arrays after merging them and reprint after sorting them    
%out – author: Ayon and Ariyam                                            
%OUT---------------------------------------------------------------------------------------------------------------------------------------

if1
include macrolib.lby
endif

.model small
.stack
.data

array_size1 equ 4                                                         ;assuming array_size1 to be equal to 3
array1 db array_size1 dup(?)                                       ;reserving bytes = array_size1 for the array1, uninitialised
array_size2 equ 3                                                         ;assuming array_size2 to be equal to 3
array2 db array_size2 dup(?)                                       ;reserving bytes = array_size2 for the array2, uninitialised
merge_size equ 7                                                        ;this will be equal to array_size1+array_size2

ip1 db "Enter terms for 1st array: ","$"               ;a request to prompt the user for entering terms of the 1st array
ip2 db "Enter terms for 2nd array: ","$"             ;a request to prompt the user for entering terms of the 2nd array
op1 db "After merging: ","$"                                         ;output message        
op2 db "After sorting: ","$"                                           ;output message        
heading db "***** MERGE & THEN SORT *****","$"         ;a heading

.code

main proc
            clrscrn                                                  ;clearing the screen
            mov dx,0105h
            cursor                                                   ;setting up the cursor
            showmsg heading                              ;displaying heading
           
            mov dx,0303h                                      ;pointing to next line
            cursor                                                   ;setting up the cursor
            input_array array1,array_size1,ip1        ;accept array from user
           
            mov dx,0503h                                      ;pointing to next line
            cursor                                                   ;setting up the cursor
            input_array array2,array_size2,ip2        ;accept array from user
                       
; ============= begin merging ==================================

            mov si,array_size1
            mov di,00h
            mov cx,array_size2

merge: mov ah,array2[di]
            mov array1[si],ah                                ;merge the element from second array into first at the end
            inc di
            inc si
            loop merge
                                   
            mov dx,0703h                                      ;pointing to next line
            cursor                                                   ;setting up the cursor
            display_array array1,merge_size,op1   ;print the merged array

; ============== begin sorting (bubble sort) ===================       
           
            mov cx,merge_size
            sub cx,01h       
           
            outer:               push cx                        ;saving the current iteration number
                                    mov bx,0001h             
;loading bx (displacement for based indexed addressing with displacement)
                                    mov di,00h                  ;pointer to first array element
            inner:               mov al,array1[di]       
                                    cmp al,array1[di+bx]  ;comparing 2 consecutive array elements
                                    jbe continue
            swap:              mov ah,array1[di+bx]
;performing swap by using two registers ah and al, when succeeding array element is smaller
                                    mov array1[di],ah
                                    mov array1[di+bx],al
            continue:         inc di                           ;point to next array element
                                    loop inner                    ;iterate till the maximum is bubbled down
                                    pop cx                         ;loader count for outer loop
                                    dec cx
                                    cmp cx,0000h              ;short jump not possible
                                    jne outer
                                                                                   
            mov dx,0903h                                      ;pointing to next line
            cursor                                                   ;setting up the cursor
            display_array array1, merge_size, op2             ;print the merged array after sorting

            exit

main endp
end main