process based multitasking v/s thread based multitasking

Upload: shukerullah

Post on 04-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Process Based Multitasking V/s Thread Based Multitasking

    1/4

    Core Java Programming Differences

    Shree M. & N. Virani Science College, Rajkot

    By : Vaishali Vithalani

    (1). Process Based Multitasking V/s Thread Based Multitasking

    Process Based Multi-tasking Thread Based Multi-tasking A process is essence ofprogram that is executing whichrunning parallel

    Thread is a such part ofmultithreaded program whichdefines separate path forexecution

    It allows you to run java compilerand text editor at a same time.

    It doesnt support java compilerand text editor run simultaneously.Both have performed differenttasks.

    Process multitasking hasmore overhead than threadmultitasking.

    Thread multitasking has lessoverhead than processmultitasking.

    Here, it is unable to gain accessover idle time of CPU.

    It allows taking gain access overidle time taken by CPU.

    It is not under control of java. It is totally under control of java.

    Process based multitasking iscomparatively heavyweightprocess comparing to threadbased multitasking.

    Thread based multitasking isknown to be lighter eight process.

    Inter-process communication isexpensive and limited.

    Inter-thread communication isinexpensive and context switchingfrom one thread to other.

    It has slower data rate multitasking. It has faster data rate multithreadingor tasting.

  • 7/30/2019 Process Based Multitasking V/s Thread Based Multitasking

    2/4

    Core Java Programming Differences

    Shree M. & N. Virani Science College, Rajkot

    By : Vaishali Vithalani

    (2). Method Overloading V/s Method Overriding

    (3). Byte Stream V/s Character Stream

    Byte stream Character stream

    Byte stream providesconvenient means for handling I/O ifbyte.

    Character stream providesconvenient means for handling I/Ocharacter.

    Byte stream were included injava 1.0 version.

    Character stream were includedin 1.1 versions.

    At the top there are two mainabstract classes input stream &output stream.

    At the top there are two mainabstract classes reader & writer.

    Concrete subclasses tohandle devices like file, n/w

    It has to handle Unicodecharacter streams.

    Method overloading Method overriding

    It occurs when two or moremethod have same name withdifferent signature.

    Overriding occurs when aclass declares a method that hassame type of signature.

    It is used in java programfrequently because it allowsusing the same name for groupof method that basically hassame purpose.

    Overriding is a compatibilityof java program because eachoverridden method has providedfor unique implementation.

    Overloading allowsprogrammer to use differentfunctionalities to a same namedmethod.

    Overriding allowsprogrammer to add otherfunctionalities to its method isclasses.

    Java complier issues onerror message because it is unableto determine which form to use.

    Java compilers issues anerror message it method overridesanother method has differentreturn type.

    It allows easy handle todefault parameters.

    It uses super class referenceto super class object.

    It can occur within a class indifferent method.

    Overriding requires super &sub class for different method.

    Println ( ) is example ofoverloading.

    Versions of Java are anexample of overriding.

    Constructor can beoverloaded.

    Constructor cant beoverridden.

  • 7/30/2019 Process Based Multitasking V/s Thread Based Multitasking

    3/4

    Core Java Programming Differences

    Shree M. & N. Virani Science College, Rajkot

    By : Vaishali Vithalani

    connection and memory buffers.

    Read ( ) & write ( ) methodsrespectively read & write byte ofdata. These methods are overridden

    from byte stream class.

    Read ( ) & write ( ) methodsrespectively use read and writecharacter at data. These methods are

    overridden from character streamclass.

    Both provide API & partialimplementation for input streamoutput stream whose size is 8 butbyte.

    Both provide API & partialimplementation for reader. Writerwhose size is 16 but character.

    Handle text file. Handle binary file.

    (4). Type Casting V/s Type Conversion

    Type casting Type conversion

    Type casting takes placebetween incompatible types.

    Type conversion can takeplace in both compatible &incompatible types.

    In java there is no suchconcept of automatic type casting.

    In java type conversion isautomatically done betweencompatible types.

    Type casting is allowedexplicitly.

    Type conversion is allowedimplicitly.

    Wrapper classes and specialmethods are used in type casting.

    Narrowing & wideningconversion method are used in typeconversion.

    (8). Vector V/s Array

    Vector Array

    Convenient to use & store

    object.

    Convenient to use simple

    data types. Size can be varied forstrongly object.

    Size can be explicitlyspecified.

    Different types of objects arestored.

    Save data types basedvalues are stored.

    Vector has no dimension. Arrays do have fix dimension.

    By converting simple type to Arrays cannot support this

  • 7/30/2019 Process Based Multitasking V/s Thread Based Multitasking

    4/4

    Core Java Programming Differences

    Shree M. & N. Virani Science College, Rajkot

    By : Vaishali Vithalani

    object by using wrapper class. particular feature.

    (9). String V/s String Buffer

    (10). Interface V/s Abstract Class

    Interface Abstract class

    Interface is use to beimplemented in java programs.

    Abstract class is use toextend in java program.

    Object can be taken ofinterface.

    Object can not be considered.

    Interface is use as reusabilityof codes.

    Abstract class is not useful asreusability as codes.

    Can be define & declare inbase class.

    Method can be declare inabstract class and must be used in

    subclass. Syntax of Interface: -interface {

    variables method.}

    Syntax of Abstract Class: -abstract class {

    variable method.}

    String String Buffer

    String represents fixed length,immutable character sequences.

    String buffer represents grow-able & writable character sequence.

    String argument storescharacters without reallocation.

    String buffer allocatesreserves room for 16 characters. Ituses extra fragmentation for

    String can be use as primitivedata type.

    String buffer are not used asdata type.

    Literals directly can be

    assigning to string.

    String buffer cant use literals

    as string directly. String doesnt haveconstructors to define.

    String buffer defines following

    string buffer ( )

    string buffer (int size)

    string buffer (string s)