GTU SPI /CPI/CGPA Calculator

hello friend i make simple software in WCF - (Windows Communication Foundation) platform for microsoft technology in .net....

About GTU SPI Calculator

GTU SPI Calculator is a handy and reliable application designed to calculate your current semester performance in the Gujarat Technological University (GTU) India.

In basic of your performance in examination, assignments, practical exam is awarded a grade. These grade are described by the letters like AA, AB, BB, BC etc, and a numerical equivalent called the grade.So you can directly calculate your SPI using this tool.also you can Calculate SPI, CPI, CGPA and CGPA to Percentage.

Feature Added In This Version

• CGPA Calculation
• Ability to calculate SPI up to 12 subject and up to 20 credit.
• Update Check.
• Smart Check and error detection in SPI and CPI calculation.

Under GNU GPL.v3.0 Free Software(You don't need to register or pay)

TUTORIAL 6 of Artificial Intelligence

a.     Write a program to find the position of an element from the given list.
domains
symbollist = symbol*

predicates
list_getpos(symbol,symbollist)
getpos(symbol,symbollist,integer)

clauses
list_getpos(X,SymList):-
P = 0,
getpos(X,SymList,P).

getpos(S,[S|_],P):-
write("Position is : "),
write(P),nl.

PP = P + 1,
getpos(S,Tail,PP).

b.    Write a program to append a list by adding at the front and the last of the list.
domains
symbollist = symbol*

predicates
print_list(symbollist)
list_append(symbollist,symbollist)
append(symbollist,symbollist,symbollist)

clauses
print_list([]).

print_list(Tail).

list_append(SymList1,SymList2):-
append(SymList1,SymList2,Appended),
append(Appended,Symlist1,FinalAppended),
write("Appended list : [ "),
print_list(FinalAppended),
write("]"),nl.

append([],SymList2,SymList2).

append(Tail1,SymList2,Tail2).

C.        Write a program to find the minimum and maximum from the given list of numbers.
domains
numlist = integer*

predicates
list_get_minmax(numlist,integer,integer)
get_minmax(numlist)
get_min(numlist,integer,integer)
get_max(numlist,integer,integer)

clauses
get_minmax(NumList):-
list_get_minmax(NumList,Min,Max),
write("Minimum is : "),write(Min),nl,
write("Maximum is : "),write(Max),nl.

get_min([],PrevMin,MinAns):-
MinAns = PrevMin.

get_min(Tail,PrevMin,MinAns).

get_max([],PrevMax,MaxAns):-
MaxAns = PrevMax.

get_max(Tail,PrevMax,MaxAns).

Tutorial 5 Distributed Systems

Q1) Study about clock synchronization NTP & Lamports algorithm
Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.
OVERVIEW
·        NTP provides Coordinated Universal Time (UTC) including scheduled leap second adjustments. No information about time zones or daylight saving time is transmitted; this information is outside its scope and must be obtained separately.
·        NTP uses Manzullo’s algorithm and is designed to resist the effects of variable latency. NTP can usually maintain time to within tens of milliseconds over the public Internet, and can achieve 1 millisecond accuracy in local area networks under ideal conditions.
·        The protocol uses the User Datagram Protocol (UDP) on port number 123.

NTP SOFTWARE IMPLEMENTATIONS

·        For modern Unix systems, the NTP client is implemented as a daemon process that runs continuously in user space (ntpd). Because of sensitivity to timing.
·        it is important to have the standard NTP clock phase-locked loop implemented in kernel space. All recent versions of Linux, BSD, Mac OS X, Solaris and AIX are implemented in this manner.
·        The NTP packet is a UDP datagram, carried on port 123.

MICROSOFT WINDOWS

·        Microsoft Windows NT 4.0 did not come with an NTP implementation. The reference implementation of NTP can be used on NT4 systems.
·        All Microsoft Windows versions since Windows 2000 and Windows XP include the Windows Time Service ("w32time"), which has the ability to sync the computer clock to an NTP server.
·        The version in Windows 2000 and Windows XP only implements Simple NTP, and violates several aspects of the NTP version 3 standard. Beginning with Windows Server 2003 and Windows Vista, a compliant implementation of full NTP is included.
·       However, Microsoft does not guarantee that their implementation will be more accurate than 2 seconds. If higher accuracy is desired, Microsoft recommends to use a different NTP implementation.
LAMPORT'S BAKERY ALGORITHM
·        It  is a computer algorithm devised by computer scientist Leslie Lamport, which is intended to improve the safety in the usage of shared resources among multiple threads by means of mutual exclusion.
·        In computer science, it is common for multiple threads to simultaneously access the same resources. Data corruption can occur if two or more threads try to write into the same memory location, or if one thread reads a memory location before another has finished writing into it.
·        Lamport's bakery algorithm is one of many mutual exclusion algorithms designed to prevent concurrent threads entering critical sections of code concurrently to eliminate the risk of data corruption.

Algorithm

Analogy

·        Lamport envisioned a bakery with a numbering machine at its entrance so each customer is given a unique number. Numbers increase by one as customers enter the store.
·         A global counter displays the number of the customer that is currently being served. All other customers must wait in a queue until the baker finishes serving the current customer and the next number is displayed.
·        When the customer is done shopping and has disposed of his or her number, the clerk increments the number, allowing the next customer to be served. That customer must draw another number from the numbering machine in order to shop again.
·        Due to the limitations of computer architecture, some parts of Lamport's analogy need slight modification. It is possible that more than one thread will get the same number when they request it; this cannot be avoided.
·        Therefore, it is assumed that the thread identifier i is also a priority. A lower value of i means a higher priority and threads with higher priority will enter the critical section first.
·        Lamport was the first to give a distributed mutual exclusion algorithm as an illustration of his clock synchronization scheme. Let Ri be the request set of site Si , i.e. the set of sites from which Si needs permission when it wants to enter CS. In Lamport's algorithm, i : 1 ≤ i ≤ N :: Ri= {S1, S2,...,SN}. Every site Si keeps a queue, request_queuei, which contains mutual exclusion requests ordered by their timestamps. This algorithm requires messages to be delivered in the FIFO order between every pair of sites.
Requesting the critical section.

1. When a site Si wants to enter the CS, it sends REQUEST(tsi, i) message to all the sites in its request set Ri and places the request on request_queuei (tsi is the timestamp of the request).
2. When a site Sj receives the REQUEST(tsi, i) message from site Si, it returns a timestamped REPLY message to Si and places site S'is request on request_queuej.

Executing the critical section.

1. Site Si enters the CS when the two following conditions hold:
a) [L1:] Si has received a message with timestamp larger than (tsi, i) from all other sites.
b) [L2:] S'is request is at the top request_queuei.

Releasing the critical section.

1. Site Si, upon exiting the CS, removes its request from the top of its request queue and sends a timestamped RELEASE message to all the sites in its request set.
2. When a site Sj receives a RELEASE message from site Si, it removes S'is request from its request queue.

When a site removes a request from its request queue, its own request may come at the top of the queue, enabling it to enter CS. The algorithm executes CS requests in the increasing order of timestamps.