14
Operating System Support The OS must provide: - Encapsulation - Concurrent Processing - Protection OS components: - Process Manager - Thread Manager - Communication Manager - Memory Manager - Supervisor Communication manager Thread manager Memory manager Supervisor Process manager 1 Isha Padhy, Department of CSE,CBIT, Hyderabad

Operating system support in distributed system

Embed Size (px)

Citation preview

Page 1: Operating system support in distributed system

Operating System Support• The OS must provide:- Encapsulation- Concurrent Processing- Protection• OS components: - Process Manager- Thread Manager- Communication Manager- Memory Manager- Supervisor

Communicationmanager

Thread manager Memory manager

Supervisor

Process manager

1Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 2: Operating system support in distributed system

Operating System Layer

Applications, services

Computer &

Platform

Middleware

OS: kernel,libraries & servers

network hardware

OS1

Computer & network hardware

Node 1 Node 2

Processes, threads,communication, ...

OS2Processes, threads,communication, ...

2Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 3: Operating system support in distributed system

Process/Thread Concepts• What are Processor, process, threads?Thread concepts:1. Address Space- Region

Fixed: un-modifiable text region containing program code.Heap: part of which is initialized by values.- There are indefinite no. of regions because a separate stack is

needed for each thread.

FixedHeapStack

3Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 4: Operating system support in distributed system

2. Creation of new processes a. Choice of a target host:

Node where process will reside, consists of some policy.1. Transfer Policy: Whether to situate a new process locally or remotely

depending on load of local node.2. Location Policy : which node should host a new process.Location Policy can bea. Static: optimize overall process throughput policy operate w/o regard to

current state of the system.- Deterministic: ‘A’ should always transfer process to ‘B’- Probabilistic: ‘A’ should transfer to any of nodes between ‘B’ to ‘E’b. Adaptive: Apply methods to make allocation( Ex. Measure load at each

node)

4Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 5: Operating system support in distributed system

b. Creation of new execution environment:

• Two approaches to define address space of newly created process:

1. Statically defined- Address space regions are initialized from an executable file.

2. Defined w.r.t. existing execution envt. Ex. In UNIX the newly created child process can physically share parent’s address space. The region is not getting physically copied but the page frames that make up the inherited region are shared between 2 address spaces.(COW technique)

5Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 6: Operating system support in distributed system

COW(Copy on Write)

a) Before write b) After write

Sharedframe

A's pagetable

B's pagetable

Process A’s address space Process B’s address space

Kernel

RA RB

RB copiedfrom RA

6Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 7: Operating system support in distributed system

Threads in Distribution System:Multi-threaded Clients

• Requirement: conceal the inter-process message propagation time. To hide communication latencies we can initiate communication and proceed with other work. Ex downloading a web page.

With Waiting single thread

Without Waiting single thread

Multi-threading

Every element like image, text ,icons etc in a web page requires a TCP/IP connection. So waiting time time will be more if we wait for all the elements to download first and use the web page.

Fetch the HTML page and subsequently display it.Display text while downloading image.

As soon as main HTML page is fetched every element is fetched with separate threads.

7Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 8: Operating system support in distributed system

Multi-threaded Servers- Servers on uni-processor systems can be developed to exploit parallelism

with multithreading.- Ex. File operations with multithreading, without multi-threading, finite-

state- machine

8Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 9: Operating system support in distributed system

Architecture of Multi-threaded Servers

1. Worker- pool architecture: Server creates a fixed no. of “worker threads” to serve the requests.

Server

N threads

Input-output

Client

Thread 2 makes

T1

Thread 1

requests to server

generates results

Requests

Receipt &queuing

9Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 10: Operating system support in distributed system

2. Thread- per- request architecture: 3. Thread- per- connection architecture4. Thread-per-object architecture

a. Thread-per-request b. Thread-per-connection c. Thread-per-object

remote

workers

I/O remoteremote I/O

per-connection threads per-object threads

objects objects objects

10Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 11: Operating system support in distributed system

Thread ImplementationKernel Level Implementation:

- Kernels support multi-threaded processes ex. Windows.

- These kernel provide thread creation and management system calls, schedule threads.

- Threads within a process can take advantage of multiprocessor.

- If a thread gets blocked the whole process is not blocked.

11Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 12: Operating system support in distributed system

User- level Implementation

• Thread scheduling module is implemented outside the kernel so it can be customized for a particular application.

• No system call for switching between threads of same process.• The process notifies the kernel when either:- Virtual Processor(VP) * is idle- Extra virtual processor is required* Kernel is running on a computer with one or more virtual

processor( physical processor allotted to virtual machines with different time slot).

* Kernel allocates one or more VP to the process threads which are controlled by user level scheduler within each process.

12Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 13: Operating system support in distributed system

The kernel notifies the process when any of 4 events occur:-1. Virtual processor allocated: VP allocated to process, this is the first time slice

for it. The scheduler (user level) can load the SA* with the context of a READY thread.

2. If SA is blocked, kernel uses a fresh SA to notify scheduler. The corresponding thread is BLOCKED and a READY thread is allocated to notifying SA.

3. If SA unblocked, kernel informs scheduler to release thread as READY and either allocates a new VP if available or pre-empts another SA in same process.

4. If SA pre-empted , scheduler places the pre-empted thread to READY list and reevaluates the thread allocation.

* SA( Scheduler Activation) - Call from kernel to process to notify allocation of a VP.

No. of SA= No. of VP assigned to process

13Isha Padhy, Department of CSE,CBIT, Hyderabad

Page 14: Operating system support in distributed system

Operating system Architecture

• Monolithic kernels• Micro kernels• Hybrid Kernels

14Isha Padhy, Department of CSE,CBIT, Hyderabad