Concurrent Processes and Programming Outline | COP 5615, Study notes of Computer Science

Material Type: Notes; Professor: Chow; Class: DIST OPER SYS PRINC; Subject: COMPUTER PROGRAMMING; University: University of Florida; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 03/18/2009

koofers-user-wua-1
koofers-user-wua-1 🇺🇸

5

(1)

10 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CHAPTER 3: CONCURRENT PROCESSES
AND PROGRAMMING
Chapter outline
Thread implementations
Process models
The client/server model
Time services
Language constructs for synchronization
Concurrent programming systems
Processes and threads
Processes: separate logical address space
Threads: common logical address space
Major Issues
Process/thread creation
Light weight context switching
Blocking and scheduling
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Concurrent Processes and Programming Outline | COP 5615 and more Study notes Computer Science in PDF only on Docsity!

CHAPTER 3: CONCURRENT PROCESSES

AND PROGRAMMING

Chapter outline

  • Thread implementations
  • Process models
  • The client/server model
  • Time services
  • Language constructs for synchronization
  • Concurrent programming systems

Processes and threads

  • Processes: separate logical address space
  • Threads: common logical address space

Major Issues

  • Process/thread creation
  • Light weight context switching
  • Blocking and scheduling

Two-level concurrency of processes and threads

PCB TCB TCB TCB thread thread thread

PCB TCB TCB TCB thread thread thread

PCB

thread process

Native Computer System

Single thread (^) Multiple thread processes Thread run-time library support Native operating system

Thread applications

multiple processor system

LWP LWP LWP LWP

Heavy-weight process Heavy-weight process User space threads Light-weight processes

Kernel space threads

Process models

Synchronous Process, Asynchronous Communication, Time-Space

Graph representations

precedencerelations communicationchannels

one - way

client / server

peer

Synchronous process graph Asynchronous process graph andcommunication scenarios

Time-space model

Processes P P P P

: communication : events

Space

Time

Time services

  • time and timer
  • physical and logical clocks

Physical clock A distributed time service architecture

TS

TS TS TC TC

Distributed Time Service

Client Time Clerks T ime Servers

External UTC Sources

Time Discrepancies

UTC 5

discarded new UTC

UTC 4

UTC 3

UTC 2

UTC 1

Logical clock

The happens-before relationship:

  1. If a → b within a same process then C(a) < C(b).
  2. If a is the sending event of Pi and b C is the corresponding receiving event of Pj , then i(a)^ < Cj (b).

Implementation:

timestamp of the s ending event and^ C(b) =^ C(a) +^ d^ and^ Cj^ (b) =^ max d is a positive number.(T Sa^ +^ d, Cj^ (b)), where^ T Sa^ is the

Matrix logical clock

MCi[i, i] = MCi[i, i] + d MCj [j, l] = max(MCj [j, l], T Si[j, l]) : l = 1...n MCj [k, l] = max(MCj [k, l], T Si[k, l]) : k = 1...n, l = 1...n

Concurrent languages

  • Specification of concurrent activities
  • Synchronization of processes
  • Interprocess communication
  • Nonderterministic execution of processes

Language constructs

  • Program structure
  • Data structure
  • Control structure
  • Procedure and system call
  • Input and output
  • Assignment

Example:rency the reader/write problems, synchronization + concur-

  • reader preference
  • strong reader preference
  • weak reader preference
  • weaker reader preference
  • writer preference

Semaphore solution to the weak reader preference problem

var mutex, db: semaphore; rc: integer reader processes writer processes Prc := rc + 1(mutex) if V (^) (mutex)rc = 1 then P(db) P(db)

read database write database Prc := rc -1(mutex) if V (^) (mutex)rc = 0 then V(db) V(db)

Monitor solution

Message Passing Synchronization

  • Asynchronous: non-blocking send, blocking receive
  • Synchronous: blocking send, blocking receive

Mutual exclusion using asyn. msg. passing

Mutual exclusion using syn. msg. passing

Communicating Sequential Processes (CSP)

P : Q!exp, Q: P ?var, and guarded commands

ADA rendezvous

Coordination languages

  • OCCAM: based on CSP process model, use PAR, ALT, and SEQ con- structors, use explict global links for communication.
  • SR: based on resource (object) model, use synchronous CALL and asyn- chronous SEND and rendezvous IN, use capability for channel naming.
  • LINDAsent both process and object, use blocking IN and RD and non-blocking: based on distributed data structure model, use tuples to repre- OUT for communication.

Distributed and Network Programming

Programming languages for loosely coupled systems:

ORCA

fork process-name(parameters) [on (processor-number)]; operation guard condition op(parameters) do statements; guard condition do statements; invoke(object, operation, parameters) t t[1] = 6[6] = 0, A,, B, (^80) t[8] = 0, C, 0

JAVA

  • Well-defined standard interfaces for integrating software modules
  • Capability of running software modules on any machine
  • Infrastructure for coordinating and transporting software modules Applet and system security