DISHA NIRDESHAN

Enlightens your career

Wednesday, July 6, 2016

Selective Repeat - Java Implementation

/************* Selective Repeat Server ********* /


import java.io.*;
import java.net.*;
import java.util.LinkedList;
public class SelRserver {
    public static void main(String args[]){
        try {
            //Create Socket at Server Side
            ServerSocket s=new ServerSocket(95);
            Socket con =s.accept();
            System.out.println("Server Selective Repeat Started...");
           
            BufferedReader fromclient = new BufferedReader(new InputStreamReader(con.getInputStream()));
            DataOutputStream toclient= new DataOutputStream(con.getOutputStream());
            OutputStream output = con.getOutputStream();
           
            LinkedList list = new LinkedList();

            String f = fromclient.readLine();
           
            int nf=Integer.parseInt(f);
            System.out.println("Number of packets = "+nf);
           
            int lost_ack=0,rndnum=1,lost=0;
            String rndm=fromclient.readLine();
            rndnum= Integer.parseInt(rndm);
           
            String flow = fromclient.readLine();
       
           
            if(flow.contains("n") || flow.contains("N")){
                for(int i=0;i               
                    if(i==rndnum) {
                        System.out.println("lost packet is"+i);
                        list.add(i,"lost");
                        lost=i;
                        continue;
                    }
               
                    String n=fromclient.readLine();
               
                    int num=Integer.parseInt(n);
                    String packet=fromclient.readLine();
                    list.add(num,packet);
               
                    if(list.contains("lost")){
                   
                        lost_ack= list.indexOf("lost");
                        toclient.writeBytes(lost_ack+"\n");
                        num=lost_ack;
                   
               
                        if(i>rndnum){
                            System.out.println("sending ack"+i);
                            toclient.flush();
                            toclient.writeBytes(i+"\n");
                            toclient.flush();
                        }else
                        {
                            System.out.println("sending ack"+num);
                            toclient.flush();
                            toclient.writeBytes(num+"\n");
                            toclient.flush();
                        }
                    }else
                    {
                        System.out.println("sending ack"+num);
                        toclient.flush();
                        toclient.writeBytes(num+"\n");
                        toclient.flush();
                    }
                }
                System.out.println(list);
                String n=fromclient.readLine();
                int num=Integer.parseInt(n);
                String packet=fromclient.readLine();
                System.out.println("received packet"+num+" = "+packet);
                list.set(lost,packet);
                System.out.println(list);
                toclient.flush();
                int ack=num;
           
                //Send the acknowledgment for lost packet,once it is received from client again.
                if(list.contains("lost")) {
                    lost_ack= list.indexOf("lost");
                    System.out.println("Sending lost Ack"+lost_ack);
                    toclient.writeBytes(lost_ack+"\n");
                } else {
                    System.out.println("Sending Ack"+ack);
                    toclient.writeBytes(ack+"\n");
                }
            }else{
                for(int i=0;i                    String n=fromclient.readLine();
                    int num=Integer.parseInt(n);
                    String packet=fromclient.readLine();
                    list.add(num,packet);
                    System.out.println("received packet"+num+" = "+packet);
                    System.out.println("sending ack"+i);
                    toclient.flush();
                    toclient.writeBytes(i+"\n");
                    toclient.flush();
                }
                System.out.println("received the following packets"+list);
            }
            //Close connections with client
            fromclient.close();
            output.close();
            con.close();
            s.close();
        }catch (Exception e) {
            System.out.println("\n\n ERROR"+e);
        }
    }
}




/***** Selective Repeat Client *******/


import java.io.*;
import java.net.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.LinkedList;
import java.util.*;

public class SelRClient {
   
@SuppressWarnings("static-access")
    public static void main(String args[]) {
   
    long start = System.currentTimeMillis();
    try
    {
        //Create Socket at client side
        Socket SRClient =new Socket("localhost",95);
       
        //Receive the input from console
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        DataOutputStream toSrServer= new DataOutputStream(SRClient.getOutputStream());
        BufferedReader fromSrServer = new BufferedReader(new InputStreamReader(SRClient.getInputStream()));
       
        //Create linked list to display and store the packets
        LinkedList list = new LinkedList();
       
        System.out.println("We maintained window size as 4,so for better performance evaluation kindly enter atleast 15 packets in input \n");
       
        Random rndNumbers = new Random();
        int rndNumber = 0;
       
        System.out.println("Enter number of packets to be transmitted");
       
        String n=in.readLine();
        int nf=Integer.parseInt(n);
        toSrServer.writeBytes(nf+"\n");
        int temp=nf-1;
       
        //Generate a random number so that particular packet is lost in demo
        rndNumber = rndNumbers.nextInt(temp);
       
        for(int i=0;i            System.out.println("Enter packet"+i+"to be transmitted");
            String packet=in.readLine();
            list.add(packet);
        }
        System.out.println("\nYou have entered following data "+list+"\n");
       
        toSrServer.writeBytes(rndNumber+"\n");
       
        System.out.println("Please enter Y for  successful sending or N for packet loss");
        String flow = in.readLine();
       
        toSrServer.writeBytes(flow+"\n");

         int w=4,wind=0,p=0,q=0;
        
        //While sending packet ignore the random number generated packet.
         if(flow.contains("n") || flow.contains("N")){
             for(int i=0;i                 p=i;
                 wind = windowSize(p,q);
           
                if((i==rndNumber)){
                   
                    System.out.println("Packet lost is"+i);
                    q=w;
                    wind = windowSize(p,q);
                    wind++;
                    q=wind;
                    continue;
                } else {
                    String str=list.get(i);
                    toSrServer.writeBytes(i+"\n");
                    toSrServer.writeBytes(str+"\n");
                }

                wind++;
                q=wind;
               
                String ak = fromSrServer.readLine();
                int ack = Integer.parseInt(ak);
                ack=i;
                System.out.println("Ack received for "+ack);
            }
                
            //Re-send the lost packet
            System.out.println("Resending packet"+rndNumber);
            String str=list.get(rndNumber);
       
            toSrServer.writeBytes(rndNumber+"\n");
            toSrServer.writeBytes(str+"\n");
            toSrServer.flush();
       
        //Timer set for expected acknowledgment
            Thread.currentThread().sleep(2000);

            String as = fromSrServer.readLine();
       
            System.out.println("Recieved ack no"+rndNumber);
            int aa = Integer.parseInt(as);
            if (aa != (list.size() -1))
                System.out.println("Ack received for "+rndNumber);
         }else
         {
             for(int i=0;i                p=i;
                 wind = windowSize(p,q);
                String str=list.get(i);
                 toSrServer.writeBytes(i+"\n");
                 toSrServer.writeBytes(str+"\n");
                 wind++;
                q=wind;
                 String ak = fromSrServer.readLine();
                int ack = Integer.parseInt(ak);
                ack=i;
                System.out.println("Ack received for "+ack);
             }
         }
        //Close socket and server connections
        fromSrServer.close();
        toSrServer.close();
        SRClient.close();
    }catch (Exception e){
        System.out.println("\n\n ERROR"+e);
    }
   
    //Calculate performance
    long end = System.currentTimeMillis();
    NumberFormat formatter = new DecimalFormat("#0.00000");
    System.out.println("Execution time is " + formatter.format((end - start) / 1000d) + " seconds");

    }
    public static int windowSize(int p,int wind) throws InterruptedException
    {
        int i=p,w=i+4,windw=wind;
        LinkedList < Integer > list1 = new LinkedList < Integer > ();
        if(i==0 || windw==4){
            System.out.println("\nBased on the window size, packets to be sent ");
            for(int q=i;q                windw=0;
                list1.add(q);
           
            }
            System.out.println(list1);
            if(windw==0){
                Thread.currentThread();
                Thread.sleep(2000);
            }
        }
        return windw;
    }
}


Go Back Client-Server Java implementation

/******  GO BACK Server  ******/
 
import java.io.*;
import java.net.*;
import java.util.LinkedList;
public class GoBackNserver {
    public static void main(String args[]) {
        try {
            ServerSocket s = new ServerSocket(7079);
            Socket con = s.accept();
            BufferedReader fromclient = new BufferedReader(new InputStreamReader(con.getInputStream()));
            DataOutputStream toclient = new DataOutputStream(con.getOutputStream());
            OutputStream output = con.getOutputStream();
            LinkedList < String > list = new LinkedList < String > ();
           
            String f = fromclient.readLine();
            int nf = Integer.parseInt(f);
            System.out.println("Number of packets = " + nf);
           
            String flow = fromclient.readLine();
            int ack = 0;
            System.out.println("Flow is "+flow);
            if(flow.contains("n") || flow.contains("N")){
            for (int i = 0; i < nf; i++) {
                   
                    if (i == 2) {
                        list.add(i, "killed");
                        ack = 2;
                        continue;
                    }
                    String n = fromclient.readLine();
               
                    int num = Integer.parseInt(n);
                    String packet = fromclient.readLine();
                    list.add(num, packet);

                    if (ack >= 2) {
                        System.out.println("Not received packet" + ack + "..... Hence Discardingpacket" + num);
                        num=num-1;
                    }else
                    {
                        System.out.println("received packet" + num + " = " + packet);
                    }
                    if (list.contains("killed")) {
                        toclient.writeBytes(ack + "\n");
                        num = ack-1;
                    }
            
                    System.out.println("sending ack" + num);
                    toclient.flush();
                    toclient.writeBytes(num + "\n");
                    toclient.flush();
                }
                System.out.println(list);
           
                    for (int r = ack; r < nf; r++) {
                        String n = fromclient.readLine();
                        int num = Integer.parseInt(n);
                        String packet = fromclient.readLine();
                        System.out.println("received packet" + num + " = " + packet);
                        list.add(num, packet);
                    }
            }else{
                int k=0;
                for (int i = 0; i < nf; i++) {
                    String n = fromclient.readLine();
                    int num = Integer.parseInt(n);
                    String packet = fromclient.readLine();
                    System.out.println("received packet" + num + " = " + packet);
                    list.add(num, packet);
                    k=i;
                }
                if(k==(nf-1)){
                    for(int j=0;j                        int num=j;
                        System.out.println("sending ack" + num);
                        toclient.flush();
                        toclient.writeBytes(num + "\n");
                        toclient.flush();
                    }
                }
            }
               
            fromclient.close();
            output.close();
            con.close();
            s.close();
        } catch (Exception e) {
            System.out.println(" " );
        }
    }
}





/************ Go Back Client *************/

import java.io.*;
import java.net.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.LinkedList;

public class GoBackNclient {
   
    public static void main(String args[]) {
        long start = System.currentTimeMillis();

        try {
            Socket con = new Socket("localhost", 7079);
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            DataOutputStream toserver = new DataOutputStream(con.getOutputStream());
            BufferedReader fromserver = new BufferedReader(new InputStreamReader(con.getInputStream()));

           
            LinkedList < String > list = new LinkedList < String > ();
          
        
            System.out.println("Enter number of packets to be transmitted");
            String n = in .readLine();
            int nf = Integer.parseInt(n);
            toserver.writeBytes(nf + "\n");
          
            for (int i = 0; i < nf; i++) {
                System.out.println("Enter packet" + i + "to be transmitted");
                String packet = in .readLine();
                list.add(packet);
            }
           
            System.out.println("\nYou have entered following data "+list+"\n");
           
            System.out.println("Please enter Y for  successful sending or N for packet loss");
            String flow = in.readLine();
            System.out.println("input read is "+flow);
            toserver.writeBytes(flow+"\n");
            int discard = 0;
            int ack = 0,w=4,wind=0,p=0,q=0;
            if(flow.contains("n") || flow.contains("N")){

            for (int i = 0; i < nf; i++) {
                p=i;
                wind = windowSize(p,q);
               
                                   
                    if (i == 2)  {
                        discard = 2;
                        System.out.println("Packet lost is"+i);
                        q=w;
                        wind = windowSize(p,q);
                        wind++;
                        q=wind;
                        continue;
                    } else {
                        String str = list.get(i);
                        if (discard == 2) str = "Discarded";
                        toserver.writeBytes(i + "\n");
                        toserver.writeBytes(str + "\n");
                    }
           
                    wind++;
                    q=wind;
                    String ak = fromserver.readLine();
               
                    ack = Integer.parseInt(ak);
                    if(ack==2)
                    System.out.println("Ack received for "+(ack-1));
                    else
                        System.out.println("Ack received for " + ack);
               
            }
                   
               
                    wind=0;q=4;
                    for (int r = ack; r < nf; r++) {
                        p=r;
                        wind = windowSize(p,q);
                        q=0;
                        System.out.println("Resending packet" + r);
                        String str = list.get(r);
                        toserver.writeBytes(r + "\n");
                        toserver.writeBytes(str + "\n");
                        wind++;
                        q=wind;
                    }
               
               
                   
                }else
                {    q=0;
                    for (int i = 0; i < nf; i++) {
                    p=i;
                    wind = windowSize(p,q);

                        System.out.println("Sending packet" + i);
                        String str = list.get(i);
                        toserver.writeBytes(i + "\n");
                        toserver.writeBytes(str + "\n");
                        wind++;
                        q=wind;
                        if(i==(nf-1)){
                            for(int j=0;j                                String ak = fromserver.readLine();
                       
                                ack = Integer.parseInt(ak);
                                ack=j;
                                System.out.println("Ack received for " + ack);
                            }
                        }
                }
                       
                       
               
               
            }
            fromserver.close();
            toserver.close();
            con.close();
        } catch (Exception e) {
            System.out.println("\n\n ERROR" + e);
        }
       
    
        long end = System.currentTimeMillis();
        NumberFormat formatter = new DecimalFormat("#0.00000");
        System.out.println("\nExecution time is " + formatter.format((end - start) / 1000d) + " seconds");

    }
   
    public static int windowSize(int p,int wind)throws InterruptedException
    {
        int i=p,w=i+4,windw=wind;
        LinkedList < Integer > list1 = new LinkedList < Integer > ();
        if(i==0 || windw==4){
            System.out.println("\nBased on the window size, packets to be sent ");
            for(int q=i;q                windw=0;
                list1.add(q);
               
            }
            System.out.println(list1);
            if(windw==0){
                Thread.currentThread();
                Thread.sleep(5000);
            }
        }
    return windw;
    }
}


Wednesday, February 3, 2016

CHILD LABOUR Presentation


CHILD LABOUR
INTRODUCTION :
Child labour is a person who is forced to work by there elders for their source of income and stage of studying and spoiling their childhood .
Here we go in details of child labour ,who is child labour,what does they do,how can reduce child labour.    

WHAT IS "CHILD LABOR"?
"Child labor" is, generally speaking, work for children that harms them or exploits them in some way (physically, mentally, morally, or by blocking access to education).
BUT: There is no universally accepted definition of "child labor". Varying definitions of the term are used by international organizations, non-governmental organizations, trade unions and other interest groups. Writers and speakers don't always specify what definition they are using, and that often leads to confusion.
Not all work is bad for children. Some social scientists point out that some kinds of work may be completely unobjectionable — except for one thing about the work that makes it exploitative. For instance, a child who delivers newspapers before school might actually benefit from learning how to work, gaining responsibility, and a bit of money. But what if the child is not paid? Then he or she is being exploited. As Unicef's 1997 State of the World's Children Report puts it, "Children's work needs to be seen as happening along a continuum, with destructive or exploitative work at one end and beneficial work - promoting or enhancing children's development without interfering with their schooling, recreation and rest - at the other. And between these two poles are vast areas of work that need not negatively affect a child's development." Other social scientists have slightly different ways of drawing the line between acceptable and unacceptable work.
International conventions also define "child labor" as activities such as soldiering and prostitution. Not everyone agrees with this definition. Some child workers themselves think that illegal work (such as prostitution) should not be considered in the definition of "child labor." The reason: These child workers would like to be respected for their legal work, because they feel they have no other choice but to work. .
To avoid confusion, when writing or speaking about "child labor," it's best to explain exactly what you mean by child labor — or, if someone else is speaking, ask for a definition. This website uses the first definition cited in this section: "Child labor" is work for children under age 18 that in some way harms or exploits them (physically, mentally, morally, or by blocking children from education).

WHO IS A "CHILD"?
International conventions define children as aged 18 and under.
Individual governments may define "child" according to different ages or other criteria.
"Child" and "childhood" are also defined differently by different cultures. A "child" is not necessarily delineated by a fixed age. Social scientists point out that children's abilities and maturities vary so much that defining a child's maturity by calendar age can be misleading. For a discussion, see Jo Boyden, Birgitta Ling, William Myers, "What Works for Working Children" (Stockholm: Radda Barnen and Unicef, 1998), pp 9-26.
WHO ARE CHILD LABORERS? AND HOW MANY ARE THERE?
In 2000, the ILO estimates, "246 million child workers aged 5 and 17 were involved in child labor, of which 171 million were involved in work that by its nature is hazardous to their safety, physical or mental health, and moral development. Moreover, some 8.4 million children were engaged in so-called 'unconditional' worst forms of child labor, which include forced and bonded labor, the use of children in armed conflict, trafficking in children and commercial sexual exploitation."
Unicef's State of the World's Children Report says only that although the exact number is not known, it is surely in the hundreds of millions.
  
WHERE DO CHILD LABORERS LIVE?
61% in Asia, 32% in Africa, and 7% in Latin America, 1% in US, Canada, Europe and other wealthy nations In Asia, 22% of the workforce is children. In Latin America, 17% of the workforce is children. The proportion of child laborers varies a lot among countries and even regions inside those countries. See Child Labour: Targeting the Intolerable, Geneva, 1998, p. 7; and other ILO publications.
"In Africa, one child in three is at work, and in Latin America, one child in five works. In both these continents, only a tiny proportion of child workers are involved in the formal sector and the vast majority of work is for their families, in homes, in the fields or on the streets." -- Unicef's 1997 State of the World's Children Report
IS THERE CHILD LABOR IN THE UNITED STATES?
Yes, if you are talking about "child labor" as defined by the US law. The Fair Labor Standards Act sets the minimum working age as 15, with some exceptions.
In the United States: An estimated 290,200 children were unlawfully employed in 1996. Some — it's not clear how many — were "older teens working a few too many hours in after-school jobs." About 59,600 were younger than age 14, and some 13,100 worked in garment sweatshops, according to an Associated Press series on child labor published in December 1997.
Unicef's 1997 State of the World's Children Report says "The growth of the service sector and the quest for a more flexible workforce in industrialized countries, such as the United Kingdom and the US, have contributed to an expansion of child labour."
"Hundreds of thousands" of children work in US agriculture, according to a report by Human Rights Watch published in June 2000.
WHAT DO CHILD LABORERS DO?
Work ranges from taking care of animals and planting and harvesting food, to many kinds of small manufacturing (e.g. of bricks and cement), auto repair, and making of footwear and textiles.
A large proportion of children whom the ILO classifies as child laborers work in agriculture.
More boys than girls work outside their homes. But more girls work in some jobs: for instance, as domestic maids. Being a maid in someone's house can be risky. Maids typically are cut off from friends and family, and can easily be physically or sexually abused by their employers.
Note: Less than 5% of child laborers make products for export to other countries. Sources for this statistic include Unicef's State of the World's Children Report 1997.
WHY SHOULD WE CARE?
Many children in hazardous and dangerous jobs are in danger of injury, even death.
Beyond compassion, consider who today's children will become in the future. Between today and the year 2020, the vast majority of new workers, citizens and new consumers — whose skills and needs will build the world's economy and society — will come from developing countries. Over that 20-year period, some 730 million people will join the world's workforce — more than all the people employed in today's most developed nations in 2000. More than 90 percent of these new workers will be from developing nations, according to research by Population Action International. How many will have had to work at an early age, destroying their health or hampering their education?

HOW CAN ORDINARY PEOPLE HELP REDUCE CHILD LABOR?
Learn about the issue. Support organizations that are raising awareness, and providing direct help to individual children.


HOW WAS CHILD LABOR REDUCED IN TODAY'S DEVELOPED COUNTRIES?
Four main changes took place:
economic development that raised family incomes and living standards
widespread, affordable, required and relevant education
enforcement of anti-child labor laws (along with compulsory education laws)
changes in public attitudes toward children that elevated the importance of education
.
WHAT ARE SOME "MYTHS" OR MISUNDERSTANDINGS ABOUT CHILD LABOR?
UNICEF lists four "myths":
It is a myth that child labor is only a problem in developing countries. "But in fact, children routinely work in all industrialized countries, and hazardous forms of child labour can be found in many countries. In the US, for example, children are employed in agriculture, a high proportion of them from immigrant or ethnic-minority families. A 1990 survey of Mexican-American children working in the farms of New York state showed that almost half had worked in fields still wet with pesticides and over a third had themselves been sprayed."
It is a myth that child labor will only disappear when poverty disappears. Hazardous labor can, and should be eliminated by even the poorest countries.
It is a myth that most child laborers work in sweatshops making goods for export. "Soccer balls made by children in Pakistan for use by children in industrialized countries may provide a compelling symbol, but in fact, only a very small proportion of all child workers are employed in export industries - probably less than 5 per cent. Most of the world's child labourers actually are to be found in the informal sector - selling on the street, at work in agriculture or hidden away in houses – far from the reach of official labour inspectors and from media scrutiny."
It is a myth that "the only way to make headway against child labour is for consumers and governments to apply pressure through sanctions and boycotts. While international commitment and pressure are important, boycotts and other sweeping measures can only affect export sectors, which are relatively small exploiters of child labour. Such measures are also blunt instruments with long-term consequences that can actually harm rather than help the children involved."
WHAT CAUSES CHILD LABOR TODAY?
Poverty is widely considered the top reason why children work at inappropriate jobs for their ages. But there are other reasons as well -- not necessarily in this order:
family expectations and traditions
abuse of the child
lack of good schools and day care
lack of other services, such as health care
public opinion that downplays the risk of early work for children
uncaring attitudes of employers
limited choices for women
"The parents of child labourers are often unemployed or underemployed, desperate for secure employment and income. Yet it is their children - more powerless and paid less - who are offered the jobs. In other words, says UNICEF, children are employed because they are easier to exploit," according to the "Roots of Child Labor" in Unicef's 1997 State of the World's Children Report.
The report also says that international economic trends also have increased child labor in poor countries. "During the 1980s, in many developing countries, government indebtedness, unwise internal economic policies and recession resulted in economic crisis. Structural adjustment programmes in many countries accentuated cuts in social spending that have hit the poor disproportionately. " Although structural adjustment programs are being revised to spare education from deep cuts, the report says, some countries make such cuts anyway because of their own, local priorities. In many countries public education has deteriorated so much, the report declared, that education itself has become part of the problem — because children work to avoid going to school. This conclusion is supported by the work of many social scientists, according to Jo Boyden, Birgitta Ling, and William Myers, who conducted a literature search for their 1998 book, What Works for Working Children (Stockholm: Radda Barnen, Unicef, 1998).
Children do some types of low-status work, the report adds, because children come from minority groups or populations that have long suffered discrimination. " In northern Europe, for example, child labourers are likely to be African or Turkish; in Argentina, many are Bolivian or Paraguayan; in Thailand, many are from Myanmar. An increasingly consumer-oriented culture, spurring the desire and expectation for consumer goods, can also lead children into work and away from school."
WHAT ARE SOME SOLUTIONS TO CHILD LABOR?
Not necessarily in this order:
Increased family incomes
Education — that helps children learn skills that will help them earn a living
Social services — that help children and families survive crises, such as disease, or loss of home and shelter
Family control of fertility — so that families are not burdened by children
The ILO's International Programme for the Elimination of Child Labor (IPEC) has explored many programs to help child laborers.
The 1989 Convention on the Rights of the Child calls for children to participate in important decisions that will affect their lives.
Some educators and social scientists believe that one of the most important ways to help child workers is to ask their opinions, and involve them in constructing "solutions" to their own problems. Strong advocates of this approach are Boyden, Myers and Ling; Concerned for Working Children in Karnataka, India; many children's "unions" and "movements," and the Save the Children family of non-governmental organizations.


BLU-RAY DISC Presentation


Blu-ray Disc (also known as Blu-ray or BD) is an optical disc storage media format. Its main uses are high-definition video and data storage. The disc has the same dimensions as a standard DVD or CD.
The name Blu-ray Disc is derived from the blue-violet laser used to read and write this type of disc. Because of its shorter wavelength (405 nm), substantially more data can be stored on a Blu-ray Disc than on the DVD format, which uses a red (650 nm) laser. A dual layer Blu-ray Disc can store 50 GB, almost six times the capacity of a dual layer DVD.
Blu-ray Disc was developed by the Blu-ray Disc Association, a group of companies representing consumer electronics, computer hardware, and motion picture production. The standard is covered by several patents belonging to different companies. As of March 2007, a joint licensing agreement for all the relevant patents had not yet been finalized.                                                  
As of February 19, 2008, more than 450 Blu-ray Disc titles have been released in the United States, and more than 250 in Japan.
Blu-ray Disc was locked in a format war with HD DVD until Blu-ray Disc's victory on February 19, 2008. On that day, Toshiba — the main driving force behind HD DVD — announced it would no longer develop, manufacture and market HD DVD players and recorders, leading almost all other HD DVD supporters to follow suit.
A blank rewritable Blu-ray Disc (BD-RE)

In 1998, commercial HDTV sets began to appear in the consumer market; however, there was no good, cheap way to record or play HD content. Indeed, there was no medium that could store that amount of data, except JVC's Digital VHS and Sony's HDCAM. Nevertheless, it was well known that using lasers with shorter wavelengths would enable optical storage with higher density. When Shuji Nakamura invented practical blue laser diodes, it was a sensation, although a lengthy patent lawsuit delayed commercial introduction.

 Origins

Sony started two projects applying the new diodes: UDO (Ultra Density Optical) and DVR Blue (together with Pioneer), a format of rewritable discs which would eventually become Blu-ray Disc (more specifically, BD-RE).
The first DVR Blue prototypes were unveiled at the CEATEC exhibition in October 2000. Because the Blu-ray Disc standard places the data recording layer close to the surface of the disc, early discs were susceptible to the Blu-ray Disc Association was founded by the nine initial members. contamination and scratches and had to be enclosed in plastic cartridges for protection. In February 2002, the project was officially announced as Blu-ray, and
The first consumer devices were in stores on April 10, 2003. This device was the Sony BDZ-S77; a BD-RE recorder that was made available only in Japan. The recommended price was US$3800; however, there was no standard for pre-recorded video and no movies were released for this player. The Blu-ray Disc standard was still years away, since a new and secure DRM system was needed before Hollywood studios would accept it, not wanting to repeat the failure of the Content Scramble System for DVDs.

 Blu-ray Disc format finalized

The Blu-ray Disc physical specifications were finished in 2004. In January 2005, TDK announced that they had developed a hard coating polymer for Blu-ray Discs. The cartridges, no longer necessary, were scrapped. The BD-ROM specifications were finalized in early 2006. AACS LA, a consortium founded in 2004, had been developing the DRM platform that could be used to securely distribute movies to consumers. However, the final AACS standard was delayed, and then delayed again when an important member of the Blu-ray Disc group voiced concerns.  At the request of the initial hardware manufacturers, including Toshiba, Pioneer and Samsung, an interim standard was published which did not include some features, like managed copy.

 

Launch and Sales developments

The first BD-ROM players were shipped in the middle of June 2006, though HD DVD players beat them in the race to the market by a few months.
The first Blu-ray Disc titles were released on June 20, 2006. The earliest releases used MPEG-2 video compression, the same method used on DVDs. The first releases using the newer VC-1 and AVC codecs were introduced in September 2006. The first movies using dual layer discs (50 GB) were introduced in October 2006.
The first mass-market Blu-ray Disc rewritable drive for the PC was the BWU-100A, released by Sony on July 18, 2006. It recorded both single and dual layer BD-R as well as BD-RE discs and had a suggested retail price of US$699.

 Competition from HD DVD

The DVD Forum (which was chaired by Toshiba) was deeply split over whether to go with the more expensive blue lasers or not. In March 2002, the forum voted to approve a proposal endorsed by Warner Bros. and other motion picture studios that involved compressing HD content onto dual-layer DVD-9 discs. In spite of this decision, however, the DVD Forum's Steering Committee announced in April that it was pursuing its own blue-laser high-definition solution.[24] In August, Toshiba and NEC announced their competing standard Advanced Optical Disc. It was finally adopted by the DVD Forum and renamed HD DVD the next year,[26] after being voted down twice by Blu-ray Disc Association members, prompting the U.S. Department of Justice to make preliminary investigations into the situation..
HD DVD had a head start in the high definition video market and Blu-ray Disc sales were slow at first. The first Blu-ray Disc player was perceived as expensive and buggy, and there were few titles available. This changed when PlayStation 3 launched, since every PS3 unit also functioned as a Blu-ray Disc player. By January 2007, Blu-ray discs had outsold HD DVDs, and during the first three quarters of 2007, BD outsold HD DVDs by about two to one.
Some analysts believe that Sony's PlayStation 3 video game console played an important role in the format war, believing it acted as a catalyst for Blu-ray Disc, as the PlayStation 3 used a Blu-ray Disc drive as its primary information storage medium. They also credited Sony's more thorough and influential marketing campaign. More recently several studios have cited Blu-ray Disc's adoption of the BD+ anti-copying system as the reason they supported Blu-ray Disc over HD DVD, an opinion supported by Paul Kocher, Cryptography Research's president and chief scientist.

                                                                       

Ending of the format war

In January 2008, a day before CES 2008, Warner Brothers, the only major studio still releasing movies in both HD DVD and Blu-ray Disc format, announced they will only release in Blu-ray Disc after May 2008. This effectively included other studios which came under the Warner umbrella, such as New Line Cinema and HBO, though in Europe HBO distribution partner the BBC annouced it would, while keeping an eye on market forces, continue to release product on both formats. This led to a chain reaction in the industry, including major US retailers such as Wal-Mart dropping HD DVD in their stores. A major European retailer Woolworths dropped HD DVD from its inventory. Netflix, the major online DVD rental site said it would no longer stock new HD DVDs. Following these new developments, on 19 February 2008, Toshiba announced it would be ending production of HD DVD devices, allowing Blu-ray Disc to become the industry standard for high-density optical disks. Universal Studios, the sole major movie studio to back HD DVD since inception, shortly after Toshiba's announcement said, "while Universal values the close partnership we have shared with Toshiba, it is time to turn our focus to releasing new and catalog titles on Blu-ray Disc. Paramount Studios, which started releasing movies only in HD DVD format during late 2007, also said it would start releasing in Blu-ray Disc. With this, all major Hollywood studios supported Blu-ray.[37]

Disc structure

 Laser and optics

Blu-ray Disc uses a "blue" (technically violet) laser operating at a wavelength of 405 nm to read and write data. Conventional DVDs and CDs use red and near infrared lasers at 650 nm and 780 nm respectively.
The blue-violet laser's shorter wavelength makes it possible to store more information on a 12 cm CD/DVD sized disc. The minimum "spot size" on which a laser can be focused is limited by diffraction, and depends on the wavelength of the light and the numerical aperture of the lens used to focus it. By decreasing the wavelength, increasing the numerical aperture from 0.60 to 0.85 and making the cover layer thinner to avoid unwanted optical effects, the laser beam can be focused to a smaller spot. This allows more information to be stored in the same area. In addition to the optical improvements, Blu-ray Discs feature improvements in data encoding that further increase the capacity. (See Compact disc for information on optical discs' physical structure.)

 Hard-coating technology

Because the Blu-ray Disc data layer is closer to the surface of the disc, compared to the DVD standard, it was at first more vulnerable to scratches. The first discs were housed in cartridges for protection. Advances in polymer technology eventually made the cartridges unnecessary.
TDK was the first company to develop a working scratch protection coating for Blu-ray Discs. It was named Durabis. In addition, both Sony and Panasonic's replication methods include proprietary hard-coat technologies. Sony's rewritable media are sprayed with a scratch-resistant and antistatic coating. Verbatim's recordable and rewritable Blu-ray Disc discs use their own proprietary hard-coat technology called ScratchGuard.

Recording speed

Drive speed
Data rate
Write time for Single/Dual Layer Blu-ray Disc
1X
36 Mbit/s
4.5 MB/s
1 h 30 min.
3 h.
2X
72 Mbit/s
9 MB/s
45 min.
1 h 30 min.
4X
144 Mbit/s
18 MB/s
23 min.
45 min.
6X
216 Mbit/s
27 MB/s
15 min.
30 min.
8X (Theoretical)
288 Mbit/s
36 MB/s
12 min.
23 min.
12X (Theoretical)
432 Mbit/s
54 MB/s
8 min.
15 min.

 Software standards

 Codecs(coding-decoding)

Codecs are compression schemes that store audio and video more efficiently, either giving longer play time or higher quality per megabyte. There are both lossy and lossless compression techniques.
The BD-ROM specification mandates certain codec compatibilities for both hardware decoders (players) and the movie-software (content). For video, all players are required to support MPEG-2, H.264/AVC, and SMPTE VC-1. MPEG-2 is the codec used on regular DVDs, which allows backwards compatibility. H.264/AVC was developed by MPEG and VCEG as a modern successor of MPEG-2. VC-1 is another MPEG-4 derivative codec mostly developed by Microsoft. BD-ROM titles with video must store video using one of the three mandatory codecs. Multiple codecs on a single title are allowed.
The choice of codecs affects the producer's licensing/royalty costs, as well as the title's maximum runtime, due to differences in compression efficiency. Discs encoded in MPEG-2 video typically limit content producers to around two hours of high-definition content on a single-layer (25 GB) BD-ROM. The more advanced video codecs (VC-1 and H.264) typically achieve a video runtime twice that of MPEG-2, with comparable quality.
For audio, BD-ROM players are required to support Dolby Digital AC-3, DTS, and linear PCM. Players may optionally support Dolby Digital Plus, and lossless formats Dolby TrueHD and DTS HD. BD-ROM titles must use one of the mandatory schemes for the primary soundtrack. A secondary audiotrack, if present, may use any of the mandatory or optional codecs.
For users recording digital television programming, the recordable Blu-ray Disc standard's datarate of 54 Mbit/s is more than adequate to record high-definition broadcasts from any source (IPTV, cable/satellite, or terrestrial). For Blu-ray Disc movies the maximum transfer rate is 48 Mbit/s (1.5x) (both audio and video payloads together), of which a maximum of 40 Mbit/s can be dedicated to video data. This compares favorably to the maximum of 30.24 Mbit/s in HD DVD movies for audio and video data.

 Java software support

At the 2005 JavaOne trade show, it was announced that Sun Microsystems' Java cross-platform software environment would be included in all Blu-ray Disc players as a mandatory part of the standard. Java is used to implement interactive menus on Blu-ray Discs, as opposed to the method used on DVD video discs, which uses pre-rendered MPEG segments and selectable subtitle pictures, which is considerably more primitive and less seamless. Java creator James Gosling, at the conference, suggested that the inclusion of a Java Virtual Machine as well as network connectivity in some BD devices will allow updates to Blu-ray Discs via the Internet, adding content such as additional subtitle languages and promotional features that are not included on the disc at pressing time. This Java Version is called BD-J and is a subset of the Globally Executable MHP (GEM) standard. GEM is the world-wide version of the Multimedia Home Platform standard.

Region codes

Regions for Blu-ray standard      Region A      Region B      Region C
Blu-ray Discs may be encoded with a region code, intended to restrict the area of the world in which they can be played; similar in principle to the DVD region codes, although the used geographical regions differ. Blu-ray Disc players sold in a certain region may only play discs encoded for that region. The purpose of this system is to allow motion picture studios to control the various aspects of a release (including content, date, and, in particular, price) according to the region. Discs may also be produced without region coding, so they can be played on all devices.

Region code
Area
A
B
C


This arrangement places the countries of
the major Blu-ray manufacturers (Japan, Korea, Malaysia) in the same region as the U.S., thus ensuring early releases of U.S. content to those markets. As of early 2008, about two-thirds of all released discs were region-free.
The region selection has been criticized for being US-centric like the previous DVD region code system. In the new system, the US is placed in region A, while regions B and C are used for countries that often experience significant localization delays before titles are released officially (Europe, African countries, Russia, China, etc).[citation needed] However, the opposite is also true. Some new titles, such as Harry Potter series, The Simpsons Movie, and Spider-man Trilogy are released in Europe before the US .Region coding makes importing difficult, unless the buyer has a device that can play discs formatted for the regions they are importing from. In response to the original DVD region system, Europe, Australia, and other countries which had strong demand for region 1 movies,            multi-region or region-free players became dominant.

 Digital rights management (DRM)

The Blu-ray Disc format employs several layers of Digital rights management.
Advanced Access Content System (AACS) is a standard for content distribution and digital rights management. It is developed by AS Licensing Administrator, LLC (AACS LA), a consortium that includes Disney, Intel, Microsoft, Matsushita (Panasonic), Warner Bros., IBM, Toshiba and Sony.
Since appearing in devices in 2006, several successful attacks have been made on the format. The first known attack relied on the trusted client problem. In addition, decryption keys have been extracted from a weakly protected player (WinDVD). However, even though some AACS cryptographic keys have been compromised, new releases will use new, uncompromised keys.

BD+ was developed by Cryptography Research Inc. and is based on their concept of Self-Protecting Digital Content. BD+ is effectively a small virtual machine embedded in authorized players. It allows content providers to include executable programs on Blu-ray Discs. Such programs can:
  • examine the host environment, to see if the player has been tampered with. Every licensed playback device manufacturer must provide the BD+ licensing authority with memory footprints that identify their devices.
  • verify that the player's keys have not been changed.
  • execute native code, possibly to patch an otherwise insecure system.
  • transform the audio and video output. Parts of the content will not be viewable without letting the BD+-program unscramble it.
If a playback device manufacturer finds that its devices have been hacked, it can potentially release BD+-code that detects and circumvents the vulnerability. These programs can then be included in all new content releases.
The specifications of the BD+ virtual machine are only available to licensed device manufacturers. A list of licensed adopters is available from the BD+ website.
BD+ was made available for content publishers in June 2007. The first titles using BD+ were released in October the same year. Players from Samsung and LG had problems playing back those titles until the manufacturers updated their firmware, but this problem was later identified as being related to BD-Java use, not BD+. BD+ was reported to have been circumvented by the developers of the program AnyDVD as of version 6.1.9.6 beta. However, such claims were found to be erroneous.
BD-ROM Mark is a small amount of cryptographical data that is stored physically differently from normal Blu-ray Disc data. Bit-by-bit copies that do not replicate the BD-ROM Mark are impossible to decode. A specially licensed piece of hardware is required to insert the ROM-mark into the media during replication. Through licensing of the special hardware element, the BDA believes that it can eliminate the possibility of mass producing BD-ROMs without authorization.

Player profiles

The BD-ROM specification defines four profiles of Blu-ray Disc players; in addition to the three listed in the table below, there is a fourth audio-only profile that does not require video decoding or BD-J. All the video-based profiles are required to have a full implementation of BD-J, but with varying levels of hardware support.
Feature
BD-Video (Grace Period Profile – Profile 1.0)
Bonus View (Final Standard Profile – Profile 1.1)
BD-Live (Profile 2.0)
Built-in persistent memory
64 KB
64 KB
64 KB
Local storage capability
 –
256 MB
1 GB
Secondary video decoder (PiP)
Optional
Mandatory
Mandatory
Secondary audio decoder
Optional
Mandatory
Mandatory
Optional
Mandatory
Mandatory
Internet connection capability
No
No
Mandatory

On November 1, 2007, the Grace Period Profile was superseded by Bonus View as the minimum profile for new players released to the market. With the exception of the PlayStation 3, Profile 1.0 players cannot be upgraded to be Bonus View compliant. On December 17, 2007, the PlayStation 3 became Bonus View 1.1 compliant through PlayStation 3 System Software version 2.10.
When software authored with interactive features dependent on Bonus View hardware capabilities are played on profile 1.0 players, some features may not be available or may offer limited capability. Profile 1.0 players will still be able to play the main feature of the disc, however.
The first BD Live titles (War and Saw IV) were released by Lionsgate in January 2008, despite the fact that no players existed to play the web-enhanced content. The PlayStation 3 will become Blu-ray Profile 2.0 compliant as early as May or June, taking full advantage of the PlayStation 3 Ethernet and WiFi connectivity and hard drive storage space.

Backward compatibility

While it is not compulsory for manufacturers, the Blu-ray Disc Association recommends that Blu-ray Disc drives should be capable of reading standard DVDs for backward compatibility. For instance, Samsung's first Blu-ray Disc drive can read CDs, regular DVDs, and Blu-ray Discs. All other Blu-ray Disc players that have been released so far are also capable of DVD playback though some early Blu-ray Disc players and drives did not support CD playback.[citation needed]

 Ongoing development

Front side of an experimental Blu-ray Disc
                  Furthermore TDK announced in August   experimental Blu-ray Disc capable of holding 200 GB of data on a single side, using six 33 GB data layers.
Also behind closed doors at CES 2007, Ritek has revealed that they had successfully developed a High Definition optical disc process that extends the disc capacity to 10 layers. That increases the capacity of the discs to 250 GB. However, they noted that the major obstacle is that current reader and writer technology does not support the additional layers.

JVC has developed a three layer technology that allows putting both standard-definition DVD data and HD data on a BD/DVD combo. If successfully commercialized, this would enable the consumer to purchase a disc which could be played
 on current DVD players, and reveal its HD version when played on a new BD player. This hybrid disc does not appear to be ready for production and no titles have been announced that would utilize this disc structure.
In January 2007, Hitachi showcased a 100 GB Blu-ray Disc, which consists of four layers containing 25 GB each. Unlike TDK and Panasonic's 100 GB discs, they claim this disc is readable on standard Blu-ray Disc drives that are currently in circulation, and it is believed that a firmware update is the only requirement to make it readable to current players and drives.

TYPES OF BLU-RAY DISC

 Mini Blu-ray Disc

The Mini Blu-ray Disc (also, Mini-BD and Mini Blu-ray) is a compact 8cm (~3in) diameter variant of the Blu-ray Disc that can store approximately 7.5 GB of data. It is similar in concept to the MiniDVD.
Recordable (BD-R) and rewriteable (BD-RE) versions of Mini Blu-ray Disc have been developed specifically for compact camcorders and other compact recording devices.

 BD9 / BD5 Blu-ray Disc

BD9 and BD5 are lower capacity variants of the Blu-ray Disc that contain Blu-ray compatible video and audio streams contained on a conventional DVD (650 nm wavelength / red laser) optical disc. Such discs offer the use of the same advanced compression technologies available to Blu-ray discs (including MPEG-4-AVC/H.264, SMPTE-421M/VC-1 and MPEG-2) while utilizing lower cost legacy media. BD9 utilizes a standard 8152MB DVD9 dual-layer disc while BD5 utilizes a standard 4489MB DVD5 single-layer disc.
Given that Blu-ray Discs are assumed to have a minimum transfer rate of 30.24 Mbit/s, BD9/BD5 discs must be spun at a high rate of speed, equivalent to a 3× DVD drive speed or greater.
BD9 and BD5 discs can be authored using home computers for private showing using standard DVD±R recorders. AACS digital rights management is optional.
The BD9 format was originally proposed by Warner Home Video, as a cost-effective alternative to regular Blu-ray Discs. It was adopted as part of the BD-ROM basic format, file system and AV specifications. BD9 is similar to HD DVD's 3x DVD.

 AVCREC

AVCREC is an official lower capacity variant of the Blu-ray Disc used for storing Blu-ray Disc compatible content on conventional DVD discs. It is being promoted for use in camcorders, distribution of short HD broadcast content and other cost-sensitive distribution needs. It is similar to HD REC for HD DVD.
 AVCREC is not the same as AVCHD content stored on DVD. The latter is a media independent format that originated prior to the release of Blu-ray Disc.

 Blu-ray Disc recordable

Disc recordable refers to two optical disc formats that can be recorded with an optical disc recorder. BD-R discs can be written to once, whereas BD-RE can be erased and re-recorded multiple times. As of January 2008, BD-R/RE drives up to 6x speed are available from retailers for about US$450, and 4x single-layer BD-R discs, with a capacity of 25 GB, can be found for around US$12. The theoretical maximum speed for Blu-ray Discs is about 12x as the speed of rotation (10,000 rpm) causes too much wobble for the discs to be read properly, similar to the 20x and 52x respective maximum speeds of DVDs and CDs.
Since September 2007, BD-RE was also available in the smaller 8 cm Mini Blu-ray Disc diameter size.

 

 HD DVD/Blu-ray Disc hybrid discs

Warner Brothers officially announced Total Hi Def at CES 2007. Total Hi Def hybrid discs support both HD DVD and Blu-ray Disc, HD DVD on one side (up to two layers) and Blu-ray Disc on the other side (up to two layers). However, in November 2007, Warner Brothers put development of the Total HD discs on hold for an indefinite amount of time. The project was finally canceled in January 2008 when Warner declared that they were dropping HD DVD in favor of publishing exclusively on Blu-ray Disc — thus eliminating the need for a hybrid disc. Warner also cited a lack of interest from fellow studios to publish on hybrid discs, as all but one studio, Paramount Pictures, were exclusive to either Blu-ray Disc or HD DVD and when Paramount became HD DVD exclusive in August 2007 they left Warner as the only major studio publishing on both discs. In February 2008, Toshiba abandoned the HD DVD format, ending any need for a hybrid disc.