Understanding Processes and Threads in Distributed Systems, High school final essays of Computer science

The concept of processes and threads in the context of distributed systems. It covers the definition of a process, the importance of process state and process control blocks, and the role of threads in enhancing performance and simplifying programming. The document also discusses the implementation of threads and their usage in both non-distributed and distributed systems.

Typology: High school final essays

2021/2022

Uploaded on 03/20/2022

pro-nebyu
pro-nebyu 🇸🇨

7 documents

1 / 27

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter Three
Process
2/21/2022 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Understanding Processes and Threads in Distributed Systems and more High school final essays Computer science in PDF only on Docsity!

Chapter Three

Process

2/21/

Principles in Distributed Systems

What is process?

a process

is a program

in execution

sharing resources by processes is transparent.

processes should not interfere with each other.

Process tables or PCBs(Process control block) are used to keeptrack of processes.

important issues arise in distributed systems include:

Multi threading

to enhance performance by overlapping

communication and local processing.

how are clients and servers organized and server design issues?

process

or

code migration

to achieve scalability

2/21/

Threads and their Implementation •

a thread also executes independently from other threads

threads can be used in both distributed and non distributed systems

Threads in Non distributed Systems •

a process has an

address space

(containing program text and data) and a

single thread

of control, as well as other resources such as open files,

child processes, etc.

Process 1

Process 2

Process 3

processes each with one thread

one process with three threads

2/21/

each thread has its own

program counter

registers

stack

, and

state(thread id)

; but all threads of a process share

address space,

global variables

and other resources such as

open files

, etc.

2/21/

Threads allow

multiple executions

to take place in the same

process environment, called

multi threading

Thread Usage – Why do we need threads?^ 

e.

g., a wordprocessor has different parts; parts for

spelling and grammar checking, etc.

interacting with the user

formatting the page as soon as changes are made

timed savings (for auto recovery)

1. Simplifying the programming model: since many activities

are going on at once more or less

independently

2.They are easier to

create

and

destroy

than

processes

since

they do not have any resources attached to them.

3.Performance improves by

overlapping activities

if there is

too much I/ O.

4. Real

parallelism

is possible in a multiprocessor system

2/21/

In

non

distributed

systems,

threads

can

be

used

with

shared

data

instead

of

processes

to

avoid

context switching

overhead in

inter process communication

(IPC).

During IPC

allocating

resources for a new process and

context

switching

take time. context switching as the result of IPC

2/21/

LWP 

2/21/

Threads in Distributed Systems •

Multithreaded Clients

consider a

Web browser

fetching

different parts of a page can

be implemented as a separate thread, each opening its own TCPconnection to the server.

each can display the results as it gets its part of the page

parallelism can also be achieved for replicated servers sinceeach thread request can be forwarded to separate replicas

Multithreaded Servers

servers can be constructed in three ways

A. single-threaded process

it gets a request, examines it, carries it out to completionbefore getting the next request.

the server is idle while waiting for disk read, i.e., systemcalls are blocking

2/21/

b. Threads

threads are more important for implementingservers

e.g., a file server

the dispatcher thread reads incoming requests for afile operation from clients and passes it to an idleworker thread.

2/21/

C

finite

state

machine

if threads are not available

it gets a request, examines it, tries to fulfill the requestfrom cache, else sends a request to the file system

but instead of blocking it records the state of thecurrent request and proceeds to the next request

2/21/

Role of Virtualization 

2/21/

General organization between aprogram, interface, and system.

General organization of virtualizingsystem A on top of system B.

Structure of Clients and Servers Two issues:

user interfaces

and

client-side software

for distribution

transparency

A. Networked User Interfaces •

to create a convenient environment for the interaction of ahuman user and a remote server; e.g.

mobile phones

with simple

displays and a set of keys

GUIs are most commonly used

it has the

X kernel

: the part of the OS that controls the terminal

monitor,

keyboard,

pointing

device

like

a

mouse)

and

is

hardware dependent

2/21/

17

Servers and Design Issues 1 General Design Issues A server is a process implementing a specific service on behalf of a

collection of clients.

a. How to organize servers?Iterative server •

the server itself handles the request and returns the result.

Concurrent server •

it passes a request to a separate process or thread and waits for thenext incoming request; e.g., a multithreaded server; 

2/21/

b

Where

do

clients

contact

a

server?

using

endpoints

or

ports

at the machine where the server is

running where each server listens to a specific endpoint.

How do clients know the endpoint of a service? •

globally assign endpoints for well-known services;

e.g.

FTP

is on TCP port 21,

HTTP

is on TCP port 80

2/21/