0% found this document useful (0 votes)
3 views9 pages

Parallel and Distributed Computing - Chapter 1

Chapter 1 discusses distributed computing, defining it as a system of independent computers working together over a network, and contrasts it with monolithic and parallel computing. It outlines the strengths and weaknesses of distributed systems, including resource sharing and security concerns, and introduces key concepts such as processes, threads, and network protocols. The chapter also covers the architecture of distributed applications and the basics of software engineering relevant to network applications.

Uploaded by

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

Parallel and Distributed Computing - Chapter 1

Chapter 1 discusses distributed computing, defining it as a system of independent computers working together over a network, and contrasts it with monolithic and parallel computing. It outlines the strengths and weaknesses of distributed systems, including resource sharing and security concerns, and introduces key concepts such as processes, threads, and network protocols. The chapter also covers the architecture of distributed applications and the basics of software engineering relevant to network applications.

Uploaded by

Shahid Khaan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Chapter 1: Distributed Computing :

A distributed system is a collection of independent computers,


interconnected via a network, that are capable of collaborating on a task.
Computers are considered independent if they do not share memory or
program execution space.

Network service: A network service is a service provided by a special kind


of program known as a server on a network. The World Wide Web is such a
service, as is electronic mail (email) and file transfer (FTP). A server program
is just half of the story in the so-called client-server model of distributed
computing. Client-server will be studied extensively in later chapters of this
book.

network application : A network application is an application that runs on


networked computers for end users. Network applications range from
enterprise applications such as online shopping carts and electronic auction
sites to noncommercial applications such as chat rooms and network games.

Different Forms of Computing

Monolithic Computing
In this form, a single computer (like a PC) is used without a network. It can
only use its own resources. A single user runs applications such as word
processing or spreadsheets — this is called single-user monolithic computing.

Later, multiple users used one computer through time-sharing (1970s–


1980s). Large systems called mainframes (e.g., IBM 360, Univac 1100)
allowed many users to connect through terminals for tasks like payroll or
billing.

Distributed Computing
Here, many network-connected computers, each with its own processor,
share tasks. A user can use local resources and also access remote ones. The
World Wide Web is an example: a browser (Netscape, Internet Explorer) on
your PC communicates with a remote Web server to fetch files.

Parallel Computing
Parallel computing (parallel processing) uses multiple processors to run one
program at the same time. It makes programs faster but is hard to divide
work among CPUs without conflict.

It is usually on one computer with many CPUs, but can also be done on
connected computers with distributed processing software.
Cooperative Computing
Distributed computing is also used in cooperative projects like SETI and
[Link]. These projects divide large computing tasks among
Internet-connected computers, using their extra CPU power.

Strengths and Weaknesses of Distributed Computing

Strengths

 Affordable & Available: Modern PCs are cheaper and more powerful
than old mainframes, and Internet access is widely available.

 Resource Sharing: Organizations can keep local resources while


sharing others over a network. The Web is a good example.

 Scalability: More resources can be added by connecting more


computers. Example: adding email servers for more users.

 Fault Tolerance: Backup copies of data on different systems allow


services to continue even if one computer fails.

Weaknesses

 Multiple Points of Failure: If one computer or network link fails, the


whole system may be affected. Leslie Lamport said: “A distributed
system is one in which the failure of a computer you didn’t even know
existed can render your own computer unusable.”

 Security Concerns: More chances for attacks because management


is decentralized. Worms and viruses show this weakness. Security
methods like encryption, authentication, and digital signatures are
used, but the topic is very broad and not fully covered here.

1.5 Basics of Operating Systems

Distributed computing uses programs running on multiple computers. To


understand this, we first look at how programs run in modern systems.

Computer Programs and Processes

 A program is written by a developer in a high-level language and then


translated into machine code using a compiler or interpreter.

 When a program is executed, it becomes a process. A process is a


dynamic entity that includes the running program, its current values,
state, and resources.
 A process goes through states: Ready → Running → Blocked →
Terminated.

o Ready: waiting in a queue.

o Running: CPU is executing it.

o Blocked: waiting for an event (like input/output).

o Terminated: execution is finished.

Java Programs

 Java programs are compiled into bytecode, which the Java Virtual
Machine (JVM) converts into machine code.

 Types of Java programs:

o Applications: have a main method, run as stand-alone


programs.

o Applets: no main method, run inside a browser or applet viewer.

o Servlets: no main method, run inside a Web server.

In this book, Java code examples (applications, applets, servlets) will be


used often, with applications being the most common.

Platform Independence
Java bytecode is the same on all machines. At run time, the JVM translates
it into machine code. This makes Java platform-independent, meaning
the same program can run on any machine with a JVM.

Concurrent Programming
Concurrent programming means running multiple processes at the
same time. In distributed computing, this is very important.

1. Concurrent processes on multiple computers

 Processes run on different machines connected by a network.

 They interact by exchanging data over the network.

 Example: Your browser process communicates with a Web server


process.

 Programs must be written with special logic to handle this interaction


(main theme of the book).
2. Concurrent processes on a single computer

 Modern OS allows multitasking (many processes).

 If the computer has multiple CPUs → true parallel execution.

 If only one CPU → time-sharing (time-slicing) creates the illusion of


parallel execution.

3. Parent and Child Processes

 A running process (parent) can create new child processes.

 Both parent and child run together.

 Child has its own state and values, some inherited from the parent.

 The parent can be notified when the child finishes.

Threads
A process can create threads (lightweight processes). Threads use less state
information and are faster than child processes, so they are preferred.

The program must include logic to spawn and coordinate threads.


Synchronization is needed so all threads work correctly.

Race Condition

 Happens when two or more threads access shared data at the same
time.

 Example: Two threads increment the same variable counter.

o If run one after another → result = 2.

o If interleaved → result = 1.

 To avoid this, we use mutual exclusion so only one thread runs that
code section at a time. That section is called a critical region.

Multi-threaded Programming

 Writing programs with threads is called multi-threaded


programming.

 A program that avoids race conditions is called thread-safe.

 Writing complex thread-safe programs needs advanced skills.

1.6 Network Basics


Protocols

 A protocol is a set of rules for communication.

 Example: In a meeting, people follow a natural protocol (one speaks,


others listen). On phone calls, one talks while the other waits.

 In computer networks, rules must be formally defined and


implemented.

 Protocol defines:

1. How data is encoded.

2. How sending/receiving is ordered (synchronized).

 Example: HTTP defines rules between browser and web server. The
rules are fixed, but implementation (Chrome, Firefox, etc.) can be
different.

 Analogy: Basketball rules are the same, but teams implement them
differently.

Network Architecture

 To manage complexity, networks are divided into layers.

 OSI Model (7 layers): Application, Presentation, Session, Transport,


Network, Data Link, Physical.

 Internet Model (4 layers):

1. Physical layer – sends raw signals (bits).

2. Internet layer – delivers packets to correct computer (IP).

3. Transport layer – delivers packets to correct process (TCP/UDP).

4. Application layer – supports apps like Web, Email (HTTP, FTP,


SMTP).

 Layers are conceptual, not strict in real hardware/software.

 Purpose of layers:

o Make protocol design systematic (layer by layer).

o Easier to understand communication.

Protocols in Internet Architecture


 Internet Layer: Internet Protocol (IP).

 Transport Layer:

o TCP – connection-oriented.

o UDP – connectionless.

 Application Layer: FTP, SMTP, HTTP.

 TCP/IP Stack: Combination of Internet + Transport layers. Used


everywhere on the Internet.

Connection-Oriented vs. Connectionless

1. Connection-Oriented (TCP):

 Like a phone call – caller and callee connect, then exchange data until
finished.

 Ensures data arrives safely and in order.

 Requires more processing (heavier).

2. Connectionless (UDP):

 Like emails/letters – each message is sent separately with its own


address.

 Simple, fast, but data may be lost or arrive out of order.

Comparison:

 Connection-Oriented: Reliable, ordered, heavy.

 Connectionless: Fast, simple, but unreliable.

Table 1.1 – Connection-Oriented vs. Connectionless IPC

Feature Connection-Oriented (TCP) Connectionless (UDP)

Given once at connection Must be given with every


Addressing
setup. No need to repeat. send/receive.

Connection Extra cost for setting up the


No setup needed, faster.
Overhead connection.

Addressing None after connection is Overhead in every operation.


Feature Connection-Oriented (TCP) Connectionless (UDP)

Overhead made.

Data
Maintains proper order of Order may be lost, packets may
Delivery
packets. arrive scrambled.
Order

Best for large data streams or Best for small, quick data with
Protocols
many rounds of exchange few exchanges (e.g., DNS
Usage
(e.g., file transfer, video call). lookup, simple messages).

Top-Level Domains

 .com → For commercial entities, anyone worldwide can register.

 .net → Originally for Internet organizations, now open for all.

 .org → For miscellaneous organizations, including nonprofits.

 .edu → For 4-year accredited institutions.

 .gov → For U.S. federal government entities.

 .mil → For the U.S. military.

 Country codes → Example: .ca (Canada), .jp (Japan).

Domain Names & IP Mapping

 Example: [Link] → maps to a network portion of IP, while rest


(e.g., [Link]) identifies subnet/host.

 Each domain maps to an IP address, but mapping may change.

 Example: [Link] → [Link].

 localhost → [Link] (always means “this computer”).

Process & Resource Identification

 URN: Permanent, location-independent names (not widely adopted).

 URL: Non-permanent, widely used.

o Format:

o protocol://user:password@host:port/directory
o Example: [Link]

 Relative URL: Short form, used within same directory (e.g.,


[Link]).

XNS (Extensible Name Service)

 Managed by XNSORG.

 Supports one universal address for email, phone, fax, web, IM,
postal mail.

 Works above DNS (uses DNS internally).

 Name types: =personal, @business, +general (up to 64 Unicode


chars).

Name Resolution

 Converts symbolic name → physical address.

 Example: [Link] → [Link].

 DNS servers handle this using distributed databases.

 If one DNS server doesn’t know, it forwards the request until resolved.

Software Engineering Basics

Software engineering is a part of computer science that focuses on the


process of making applications.
This book explains the technical side of network applications, but not
the full software development process.
Still, some basic concepts from software engineering are useful here.

Procedural vs Object-Oriented Programming

1. Procedural Languages

 Example: C language.

 Use procedures (functions) to break tasks into steps.

 Example: one procedure for input, another for computation, and


another for output.

2. Object-Oriented Languages

 Example: Java, C++.


 Use objects that combine data (state) and behaviors (methods).

 Each object represents something like a real-life object.

 Data = instance data / data members.

 Behavior = methods.

Architecture of Distributed Applications

Like data networks, distributed applications also use a multilayer


architecture.
This architecture has three layers:

1. Presentation Layer – Shows the user interface.

o Example: In a shopping cart app, this layer makes the web


pages that the shopper sees in the browser.

2. Application Logic Layer – Does the computation and logic.

o Also called the business logic layer.

o Example: In shopping cart, it handles credit checking, order


amount, tax, and delivery cost.

3. Service Layer – Provides the services needed by the above two


layers.

o Examples: Database access, directory services (DNS),


interprocess communication.

o This book mainly focuses on this layer.

Toolkits, Frameworks, and Components

 A toolkit or framework = collection of classes, tools, and


examples.

o Example: Java Development Toolkit (JDK), Microsoft .NET


framework.

 Component-based development = software made by assembling


reusable components.

o Benefits: Reuse, less cost, fewer errors.

o Example platforms: Enterprise Java Bean (EJB), Microsoft


COM (Component Object Model).

You might also like