0% found this document useful (0 votes)
25 views

App Unit 1 Notes

app

Uploaded by

Suganthi N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

App Unit 1 Notes

app

Uploaded by

Suganthi N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Unit-1 - Introduction to Programming Paradigm 12 Hour

Programming Languages – Elements of Programming languages - Programming Language Theory - Bohm-


Jacopini structured program theorem - Multiple Programming Paradigm – Programming Paradigm
hierarchy – Imperative Paradigm: Procedural, Object-Oriented and Parallel processing – Declarative
programming paradigm: Logic, Functional and Database processing - Machine Codes – Procedural and
Object-Oriented Programming – Suitability of Multiple paradigms in the programming language -
Subroutine, method call overhead and Dynamic memory allocation for message and object storage -
Dynamically dispatched message calls and direct procedure call overheads – Object Serialization – parallel
Computing

Introduction to Programming Paradigm

Paradigm can also be termed as method to solve some problem or do some task. Programming
paradigm is an approach to solve problem using some programming language or also we can say
it is a method to solve a problem using tools and techniques that are available to us following
some approach. There are lots for programming language that are known but all of them need to
follow some strategy when they are implemented and this methodology/strategy is paradigms.
Apart from varieties of programming language there are lots of paradigms to fulfill each and

every demand.

• A programming paradigm is an approach to programming a computer based on a


coherent set of principles or a mathematical theory
• A program is written to solve problems
• Any realistic program needs to solve different kinds of problems
• Each kind of problem needs its own paradigm

• So we need multiple paradigms and we need to combine them in the same program
Program

A programming language is a set of instructions and syntax used to create software programs.

Some of the key features of programming languages include:


1. Syntax: The specific rules and structure used to write code in a programming
language.
2. Data Types: The type of values that can be stored in a program, such as numbers,
strings, and booleans.
3. Variables: Named memory locations that can store values.
4. Operators: Symbols used to perform operations on values, such as addition,
subtraction, and comparison.
5. Control Structures: Statements used to control the flow of a program, such as if-else
statements, loops, and function calls.
6. Libraries and Frameworks: Collections of pre-written code that can be used to
perform common tasks and speed up development.
7. Paradigms: The programming style or philosophy used in the language, such as
procedural, object-oriented, or functional.

A programming language is a formal language that specifies a set of instructions for a computer
to perform specific tasks. It’s used to write software programs and applications, and to control
and manipulate computer systems. There are many different programming languages, each with
its own syntax, structure, and set of commands. Some of the most commonly used programming
languages include Java, Python, C++, JavaScript, and C#.

A program is a set of instructions given to a computer to perform a specific operation. or


computer is a computational device that is used to process the data under the control of a
computer program. While executing the program, raw data is processed into the desired output
format. These computer programs are written in a programming language which are high-level
languages. High level languages are nearly human languages that are more complex than the
computer understandable language which are called machine language, or low level language.

Hierarchy of Computer language –

Characteristics of a programming Language

● A programming language must be simple, easy to learn and use, have good
readability, and be human recognizable.
● A portable programming language is always preferred.
● Programming language’s efficiency must be high so that it can be easily converted
into a machine code and its execution consumes little space in memory.
● A programming language should be well structured and documented so that it is
suitable for application development.
● Necessary tools for the development, debugging, testing, maintenance of a program
must be provided by a programming language.
● A programming language should provide a single environment known as Integrated
Development Environment(IDE).
● A programming language must be consistent in terms of syntax and semantics.
ELEMENTS OF PROGRAMMING LANGUAGES
Basic Terminologies in Programming Languages:
● Algorithm: A step-by-step procedure for solving a problem or performing a task.
● Variable: A named storage location in memory that holds a value or data.
● Data Type: A classification that specifies what type of data a variable can hold, such
as integer, string, or boolean.
● Function: A self-contained block of code that performs a specific task and can be
called from other parts of the program.
● Control Flow: The order in which statements are executed in a program, including
loops and conditional statements.
● Syntax: The set of rules that govern the structure and format of a programming
language.
● Comment: A piece of text in a program that is ignored by the compiler or interpreter,
used to add notes or explanations to the code.
● Debugging: The process of finding and fixing errors or bugs in a program.
● IDE: Integrated Development Environment, a software application that provides a
comprehensive development environment for coding, debugging, and testing.
● Operator: A symbol or keyword that represents an action or operation to be
performed on one or more values or variables, such as + (addition), – (subtraction), *
(multiplication), and / (division).
● Statement: A single line or instruction in a program that performs a specific action or
operation.

Low-level programming language

Low-level language is machine-dependent (0s and 1s) programming language. The processor
runs low- level programs directly without the need of a compiler or interpreter, so the programs
written in low-level language can be run very fast.

i. Machine Language

Machine language is a type of low-level programming language. It is also called as machine code
or object code. Machine language is easier to read because it is normally displayed in binary or
hexadecimal form (base 16) form.

i. Assembly Language

Assembly language (ASM) is also a type of low-level programming language that is designed for
specific processors. It represents the set of instructions in a symbolic and human-understandable
form. It uses an assembler to convert the assembly language to machine language.

High-level programming language

High-level programming language (HLL) is designed for developing user-friendly software


programs and websites. This programming language requires a compiler or interpreter to
translate the program into machine language (execute the program).

Middle-level programming language

Middle-level programming language lies between the low-level programming language and
high-level programming language. Machine code

Programming Language Theory

Böhm–Jacopini theorem
The structured program theorem, also called the Böhm–Jacopini theorem,[1][2] is a result in
programming language theory. It states that a class of control-flow graphs (historically called
flowcharts in this context) can compute any computable function if it combines subprograms in
only three specific ways (control structures). These are
1. Executing one subprogram, and then another subprogram (sequence)
2. Executing one of two subprograms according to the value of a boolean expression
(selection)
3. Repeatedly executing a subprogram as long as a boolean expression is true
(iteration)

E.g SEQUENCE

def addtwo1():
x = int(raw_input("Enter an integer: "))
ans = x + 2
return ans

LOOP
for x in [3,5,9]:
print x

Outputs:

3
5
9

SELECTION
num = int(input("Enter a number: "))
if (num % 2) == 0:
print("NUM is Even”)
else:
print("NUM is Odd")

Multiple Programming Paradigm

It support one, or sometimes two paradigms)?

Multi-Paradigm Languages are languages that can use multiple Programming paradigm together.
Many programming languages support Muli Pradigum programming, for example, C++ is both
an imperative and an object-oriented language, Parlog is both a parallel and a logic programming
language.
The concept of multi-paradigm programming is very simple to understand, When a programming
language use more than one programming paradigm it know as multi-paradigm language, and the
concept of combining these paradigms are Multiparadigm programming.
 Imperative: Programming with an explicit sequence of commands that update state.
 Declarative: Programming by specifying the result you want, not how to get it.
 Structured: Programming with clean, goto-free, nested control structures.
 Procedural: Imperative programming with procedure calls.
 Functional Programming
 Object-Oriented Programming
 Declarative Programming

Examples of multi paradigm Programming Languages


There are some major programming languages that can be classified as multi paradigmatic. C++
is one of the greatest examples. C++ started as an extension of the C language. The original goal
of C++ was to add object orientation support into C.

Programming Paradigm hierarchy

1. Imperative programming paradigm: It is one of the oldest programming paradigm. It


features close relation to machine architecture. It is based on Von Neumann architecture. It
works by changing the program state through assignment statements. It performs step by step
task by changing state. The main focus is on how to achieve the goal. The paradigm consist of
several statements and after execution of all the result is stored.

advantage
1. Very simple to implement
2. It contains loops, variables etc.
Disadvantage:
1. Complex problem cannot be solved
2. Less efficient and less productive
3. Parallel programming is not possible
Structure programming processing
 Program is made as a single structure.
 Code will execute the instruction by instruction one after the other.
 It doesn’t support the possibility of jumping from one instruction to some other with the
help of any statement like GOTO, etc.
 The structured program consists of well structured and separated modules. But the entry
and exit in a Structured program is a single-time event. It means that the program uses
single-entry and single-exit elements.
 Instructions in this approach will be executed in a serial and structured manner. The
languages that support Structured programming approach are: C, C++, Java, C# ..etc
 The structured program mainly consists of three types of elements:
a. Selection Statements
b. Sequence Statements
c. Iteration Statements
Selection Statements
f else
Syntax:
if test expression:
statement(s)

If else
Syntax:
if test expression:
Body of if
else:
Body of else

If elif else
Syntax:
if test expression:
Body of if
elif test expression:
Body of elif
else:
Body of else
Conditional
• A conditional expression evaluates an expression based on a condition.
• Conditional expression is expressed using if and else combined with expression
Syntax:
expression if Boolean-expression else expression

Example:
Biggest of two numbers

num1 = 23
num2 = 15
big = num1 if num1 > num2 else num2
print ( “ the biggest number is “ , big )

Even or odd
print ( “ num is even “ if num % 2 == 0 else “ num is odd “)
Looping

For Loop
Syntax:
for iterating_var in sequence:
statements(s)
Example:

for letter in 'Python': # First Example


print 'Current Letter :', letter

fruits = ['banana', 'apple', 'mango']


for index in range(len(fruits)):
print 'Current fruit :', fruits[index]
print "Good bye!“
● Procedural programming paradigm –
This paradigm emphasizes on procedure in terms of under lying machine model.
There is no difference in between procedural and imperative approach. It has the
ability to reuse the code and it was boon at that time when it was in use because of its
reusability.

Characteristics of Procedure-Oriented Programming


• Emphasis is on doing things.
• Large programs are divided into smaller programs known as functions.
• Most of the functions share global data.
• Data move openly around the system from function to function.
• Functions transform data from one form to another.
• Employs top-down approach in program design.
Object oriented programming –
The program is written as a collection of classes and object which are meant for
communication. The smallest and basic entity is object and all kind of computation is
performed on the objects only. More emphasis is on data rather procedure. It can handle
almost all kind of real life problems which are today in scenario.
Advantages:
● Data security
● Inheritance
● Code reusability
● Flexible and abstraction is also present
Basic Concepts of Object-Oriented Programming
• objects
• Classes
• Data Abstraction and Encapsulation
• Inheritance
• Polymorphism
• Dynamic Binding
• Message Passing
Declarative programming paradigm:

It is divided as Logic, Functional, Database. In computer science the declarative programming is a style
of building programs that expresses logic of computation without talking about its control flow. It often
considers programs as theories of some logic.It may simplify writing parallel programs. The focus is on
what needs to be done rather how it should be done basically emphasize on what code is actually doing.
It just declares the result we want rather how it has be produced. This is the only difference between
imperative (how to do) and declarative (what to do) programming paradigms. Getting into deeper we
would see logic, functional and database.
● Logic programming paradigms –
It can be termed as abstract model of computation. It would solve logical problems
like puzzles, series etc. In logic programming we have a knowledge base which we
know before and along with the question and knowledge base which is given to
machine, it produces result. In normal programming languages, such concept of
knowledge base is not available but while using the concept of artificial intelligence,
machine learning we have some models like Perception model which is using the
same mechanism. In logical programming the main emphasize is on knowledge base
and the problem. The execution of the program is very much like proof of
mathematical statement, e.g., Prolog
predicates
sumoftwonumber(integer, integer).

clauses
sumoftwonumber(0, 0).
sumoftwonumber(N, R) :-
N > 0,
N1 is N - 1,
sumoftwonumber(N1, R1),
R is R1 + N.
Functional programming paradigms –

The functional programming paradigms has its roots in mathematics and it is language
independent. The key principle of this paradigms is the execution of series of mathematical
functions. The central model for the abstraction is the function which are meant for some
specific computation and not the data structure. Data are loosely coupled to functions.The
function hide their implementation. Function can be replaced with their values without changing
the meaning of the program. Some of the languages like perl, javascript mostly uses this
paradigm.

Pure functions: These functions have two main properties. First, they always produce
the same output for same arguments irrespective of anything else.
Secondly, they have no side-effects i.e. they do not modify any arguments or
local/global variables or input/output streams.
sum(x, y) // sum is function taking x and y as arguments
return x + y // sum is returning sum of x and y without
changing them
Recursion: There are no “for” or “while” loop in functional languages. Iteration in
functional languages is implemented through recursion. Recursive functions repeatedly
call themselves, until it reaches the base case.
fib(n)
if (n <= 1)
return 1;
else
return fib(n - 1) + fib(n - 2);

Functional Programming – Advantages


Functional programming offers the following advantages −
Bugs-Free Code − Functional programming does not support state, so there are no side-

effect results and we can write error-free codes.
 Efficient Parallel Programming − Functional programming languages have NO
Mutable state, so there are no state-change issues. One can program "Functions" to work
parallel as "instructions". Such codes support easy reusability and testability.
 Efficiency − Functional programs consist of independent units that can run concurrently.
As a result, such programs are more efficient.
 Supports Nested Functions − Functional programming supports Nested Functions.
 Lazy Evaluation − Functional programming supports Lazy Functional Constructs like
Lazy Lists, Lazy Maps, etc.
LAMBDA FUNCTION

Python Lambda Functions are anonymous function means that the function is
without a name
Syntax: lambda arguments : expression
def cube(y):
return y*y*y
lambda_cube = lambda y: y*y*y
cube(5)

Python Function Arguments


Arguments are the values passed inside the parenthesis of the function. A function can
have any number of arguments separated by a comma.

Types of Python Function Arguments

Python supports various types of arguments that can be passed at the time of the
function call. In Python, we have the following 4 types of function arguments.
 Default argument
 Keyword arguments (named arguments)
 Positional arguments
 Arbitrary arguments (variable-length arguments *args and **kwargs)
Default Arguments
A default argument is a parameter that assumes a default value if a value is not
provided in the function call for that argument.
def myFun(x, y=50):
print("x: ", x)
print("y: ", y)
myFun(10)

Output:
x: 10
y: 50
Required Arguments: The number of arguments in the function call should
match exactly with the function definition.
def my_details( name, age ):
print("Name: ", name)
print("Age ", age)
return
my_details("george",56)
Output:

Name: george

Age 56

Keyword Arguments:

Python interpreter is able to use the keywords provided to match the values
with parameters even though if they are arranged in out of order.

def my_details( name, age ):


print("Name: ", name)
print("Age ", age)
return
my_details(age=56,name="george")
Output:

Name: george

Age 56

Variable length Arguments

If we want to specify more arguments than specified while defining the


function, variable length arguments are used. It is denoted by * symbol before
parameter.
ef my_details(*name ):
print(*name)
my_details("rajan","rahul","micheal",ärjun")
Output:
rajan rahul micheal ärjun

Database/Data driven programming approach –


This programming methodology is based on data and its movement. Program statements are
defined by data rather than hard-coding a series of steps. A database program is the heart of a
business information system and provides file creation, data entry, update, query and reporting
functions. There are several programming languages that are developed mostly for database
application. For example SQL. It is applied to streams of structured data, for filtering,
transforming, aggregating (such as computing statistics), or calling other programs. So it has its
own wide application.
CREATE DATABASE databaseAddress;
CREATE TABLE Addr ( PersonID int,LastName varchar(200),FirstName varchar(200),
Address varchar(200),City varchar(200),State varchar(200));
- Machine Codes
Machine code, also known as machine language, is the elemental language of computers. It is
read by the computer's central processing unit (CPU), is composed of digital binary numbers and
looks like a very long sequence of zeros and ones. Ultimately, the source code of every human-
readable programming language must be translated to machine language by a compiler or an
interpreter, because binary code is the only language that computer hardware can understand.

Procedural Programming

Procedural Programming can be defined as a programming model which is derived from


structured programming, based upon the concept of calling procedure. Procedures, also known as
routines, subroutines or functions, simply consist of a series of computational steps to be carried
out. During a program’s execution, any given procedure might be called at any point, including
by other procedures or itself. Languages used in Procedural Programming: FORTRAN,
ALGOL, COBOL, BASIC, Pascal and C.

Object-Oriented Programming
Object-oriented programming can be defined as a programming model which is based upon the
concept of objects. Objects contain data in the form of attributes and code in the form of
methods. In object-oriented programming, computer programs are designed using the concept of
objects that interact with the real world. Object-oriented programming languages are various but
the most popular ones are class-based, meaning that objects are instances of classes, which also
determine their types. Languages used in Object-Oriented Programming: Java, C++, C#,
Python, PHP, JavaScript, Ruby, Perl,

Procedural Oriented Programming Object-Oriented Programming


In procedural programming, the program is In object-oriented programming, the program is
divided into small parts called functions. divided into small parts called objects.

Procedural programming follows a top-down Object-oriented programming follows a bottom-up


approach. approach.

There is no access specifier in procedural Object-oriented programming has access specifiers


programming. like private, public, protected, etc.

Adding new data and functions is not easy. Adding new data and function is easy.

Procedural programming does not have any Object-oriented programming provides data hiding
proper way of hiding data so it is less secure. so it is more secure.

In procedural programming, overloading is Overloading is possible in object-oriented


not possible. programming.

In procedural programming, there is no In object-oriented programming, the concept of data


concept of data hiding and inheritance. hiding and inheritance is used.

In procedural programming, the function is In object-oriented programming, data is more


more important than the data. important than function.

Procedural programming is based on the Object-oriented programming is based on the real


unreal world. world.

Procedural programming is used for Object-oriented programming is used for designing


designing medium-sized programs. large and complex programs.

Procedural programming uses the concept of Object-oriented programming uses the concept of
procedure abstraction. data abstraction.

Code reusability absent in procedural Code reusability present in object-oriented


programming, programming.

Examples: C, FORTRAN, Pascal, Basic, etc. Examples: C++, Java, Pytho


Machine Codes – Procedural and Object Oriented Programming
• Machine code, also known as machine language, is the lowest level of
programming language that can be directly executed by a computer's
processor.
• It consists of binary instructions that represent specific operations and data
manipulations understood by the computer's hardware.
• Machine code instructions are specific to a particular computer architecture
or processor.
Procedural Programming with Machine Code:
• In procedural programming, machine code instructions are used to write
programs that follow a procedural structure.
• Procedural programming focuses on breaking down a problem into a series
of procedures or functions, which are then executed sequentially. Each
procedure or function contains a set of machine code instructions that
perform a specific task.
• In procedural programming with machine code, the programmer directly
writes or manipulates the machine code instructions to implement the
desired functionality.
• The programmer needs to understand the low-level details of the computer's
architecture, instruction set, and memory layout to write efficient and correct
code.
Object-Oriented Programming with Machine Code:
• Object-Oriented Programming with Machine Code:
• Object-oriented programming (OOP) is a higher-level programming
paradigm that emphasizes objects as the fundamental building blocks
of programs.
• OOP provides concepts such as classes, objects, encapsulation,
inheritance, and polymorphism. While machine code is not inherently
object-oriented, it can still be used to implement object-oriented
programming principles at a lower level.
• In an object-oriented programming approach with machine code, the
programmer can design and implement their own object-oriented
system using machine code instructions.

Subroutine
• A subroutine is a named sequence of instructions within a program
that performs a specific task. It is also known as a function or
procedure. Subroutines help in organizing code, promoting code
reusability, and improving code readability.
• When a subroutine is called, the program jumps to the subroutine's
location, executes its instructions, and returns to the point of the
program from where it was called.
Method Call Overhead:
• Method call overhead refers to the additional time and resources
required to invoke a method or function in an object-oriented
programming language. When a method is called, there is a certain
amount of overhead involved in setting up the call, passing arguments,
and returning results.
• This overhead includes tasks such as pushing arguments onto the
stack, saving registers, and managing the call stack. While the
overhead is
• typically small and negligible for most applications, it becomes more
significant in high-performance scenarios or when calling methods
frequently in tight loops
Dynamic Memory Allocation for Message and Object Storage
• In object-oriented programming, objects are instances of classes that
encapsulate data and behavior.
• Dynamic memory allocation is often used to allocate memory for
objects during runtime.
• When an object is created, memory is dynamically allocated from
the heap to store the object's data.
• This dynamic memory allocation allows objects to have a flexible
lifetime and enables the creation and destruction of objects as needed.
• Message passing is a mechanism used in object-oriented
programming to invoke methods or communicate between objects.
• When a message is sent to an object, the object's method is invoked
to handle the message.
• Depending on the programming language and implementation, the
message might contain information such as the name of the method
and the arguments to be passed.
• Dynamic memory allocation for message and object storage involves
the allocation and deallocation of memory during runtime, as objects
are created, used, and destroyed.
• This flexibility in memory allocation allows for dynamic object
creation, polymorphism, and memory management.
• However, dynamic memory allocation comes with additional
overhead compared to static memory allocation. There is a cost
associated with allocating and deallocating memory, and improper
memory management can lead to memory leaks or fragmentation.
• Efficient memory allocation strategies and techniques, such as
pooling, garbage collection, or smart pointers, are often employed to
optimize memory usage and minimize overhead in dynamic memory
allocation scenarios.
• Overall, subroutines, method call overhead, and dynamic memory
allocation for message and object storage are important concepts in
programming that help organize code, enable code reuse, and provide
flexibility in memory management.
• Understanding these concepts is crucial for writing efficient and
maintainable code in procedural and object-oriented programming
paradigms
Dynamically dispatched message calls and direct procedure call overheads
• Dynamically Dispatched Message Calls:
• In object-oriented programming, dynamically dispatched message
calls refer to the mechanism of invoking methods or functions on
objects at runtime based on the actual type of the object.
• When a message is sent to an object, the runtime system determines
the appropriate method to be called based on the object's dynamic
type or class hierarchy.
• Dynamically dispatched message calls involve a level of indirection
and typically incur some overhead compared to direct procedure calls.
The overhead is due to the need for runtime lookup and method
resolution to determine the correct method implementation to be
invoked.
• This lookup process involves traversing the object's class hierarchy
and finding the appropriate method implementation based on the
dynamic type of the object.
• The overhead associated with dynamically dispatched message calls
can vary depending on factors such as the programming language, the
complexity of the class hierarchy, and the efficiency of the runtime
system.
• However, modern object-oriented programming languages and
runtime systems employ various optimizations, such as caching
method tables or using virtual function tables (vtables), to reduce the
overhead of dynamic dispatch
• Direct Procedure Call Overheads:
• Direct procedure calls refer to the direct invocation of procedures or
functions without involving any dynamic dispatch mechanism.
• In direct procedure calls, the address of the function is known at
compile time, allowing the program to directly jump to the memory
location of the function and execute its instructions.
• Direct procedure calls typically have lower overhead compared to
dynamically dispatched message calls.
• The direct nature of the call avoids the need for runtime method
resolution and lookup, reducing the indirection and associated
overhead.
• Direct procedure calls have a more straightforward and efficient
execution path since the target procedure's address is known in
advance.
• However, it's important to note that the overhead of direct procedure
calls can still exist due to factors such as argument passing, stack
manipulation, and context switching.
• The specific overhead may vary depending on the programming
language, the calling convention used, and the underlying hardware
architecture.
• In general, dynamically dispatched message calls introduce a level
of indirection and overhead due to the runtime lookup and method
resolution required.
• On the other hand, direct procedure calls have lower overhead as
they directly invoke functions without the need for runtime lookup.
• The choice between dynamically dispatched message calls and direct
procedure calls depends on the specific requirements of the
application, the level of polymorphism needed, and the performance
considerations

Object Serialization
• Object serialization refers to the process of converting an
object's state into a format that can be stored, transmitted, or
reconstructed later.
• It involves transforming the object and its associated data into a
sequence of bytes, which can be written to a file, sent over a network,
or stored in a database.
• The reverse process, where the serialized data is used to reconstruct
the object, is called deserialization.
Object serialization is primarily used for two purposes:
• Persistence: Object serialization allows objects to be stored
persistently, meaning they can be saved to a file or database and
retrieved later. This enables applications to preserve the state of
objects across multiple program executions or to transfer objects
between different systems.
• Communication: Serialized objects can be sent over a network or
transferred between different processes or systems. This is particularly
useful in distributed systems or client-server architectures where
objects need to be exchanged between different components or across
different platforms.
• During object serialization, the object's state, which includes its
instance variables, is transformed into a serialized form. This process
may involve encoding the object's data, along with information about
its class structure and metadata. The serialized data is typically
represented as a sequence of bytes or a structured format like XML or
JSON.
• Some programming languages and frameworks provide built-i parallel
Computing
Parallel computing
• Parallel computing refers to the use of multiple processors or
computing resources to solve a computational problem or perform a
task simultaneously.
• It involves breaking down a problem into smaller parts that can be
solved concurrently or in parallel, thus achieving faster execution and
increased computational power.
• Parallel computing can be applied to various types of problems,
ranging from computationally intensive scientific simulations and data
analysis to web servers handling multiple requests simultaneously.
• It is particularly beneficial for tasks that can be divided into
independent subtasks that can be executed concurrently.
• There are different models and approaches to parallel computing:
• Task Parallelism:
• In task parallelism, the problem is divided into multiple independent
tasks or subtasks that can be executed concurrently.
• Each task is assigned to a separate processing unit or thread,
allowing multiple tasks to be processed simultaneously.
• Task parallelism is well-suited for irregular or dynamic problems
where the execution time of each task may vary.
Object serialization
However, not all objects are serializable by default. Certain object
attributes, such as open file handles, network connections, or transient
data, may not be suitable for serialization. In such cases, specific
measures need to be taken to handle or exclude these attributes during
serialization.

• Object serialization is a powerful mechanism that facilitates data


storage, communication, and distributed computing. It allows objects
to be easily persisted or transmitted across different systems,
preserving their state and enabling seamless integration between
heterogeneous environments

You might also like