Designing Concurrency - PowerPoint PPT Presentation

About This Presentation
Title:

Designing Concurrency

Description:

Designing Concurrency Software Engineering issues with regards to the development of concurrent systems – PowerPoint PPT presentation

Number of Views:154
Avg rating:3.0/5.0
Slides: 16
Provided by: Ernes88
Category:

less

Transcript and Presenter's Notes

Title: Designing Concurrency


1
Designing Concurrency
  • Software Engineering issues with regards to the
    development of concurrent systems

2
Placing concurrency
  • Very much associated with R-T systems
  • In high regard within control systems
  • Regarded with intimidation by many s/w developers
  • Should be reflected in all phases of s/w
    development - especially in the initial ones
  • A lot of scheduling theory (already covered)
    assumed concurrent tasks

3
Some aspects of concurrent systems
  • Multitasking support
  • Scheduling concerns
  • Time responsiveness
  • Task priorities
  • Resource sharing
  • Task synchronisation

4
Ways of running concurrent tasks (1)
  • Sequential (fixed) execution
  • Pros
  • Tasks are periodic with periods T1 T2 T3
    t1 t2 t3
  • Easy to implement
  • No context switching (1 processor 1 sequential
    chunk)
  • Easily visible control structure
  • Cons
  • Low time response control
  • Could lead to task execution failure

5
Ways of running concurrent tasks (2)
  • Time sliced (shared) execution

6
Ways of running concurrent tasks (3)
  • Software supported multitasking

Run-time software support
7
The functions of run-time support software
  • Basic functions
  • Create new tasks (define a task within system
    framework)
  • Task activation (make a task runnable)
  • Task management (manage task states)
  • Task states
  • Running (currently executing)
  • Waiting (waiting for its turn to run)
  • Suspended (waiting to be ready)
  • Terminated (ended normally or abnormally)

8
Ways of running concurrent tasks (4)
  • Using co-routines (see Modula2 / 3 programming
    language)
  • Better mimic the concept of time sliced execution
  • No master-slave assumptions (as in normal
    sub-routines)
  • Once started it need not necessarily terminate
    before relinquishing control to its original
    caller

9
Ways of running concurrent tasks (5)
  • Task scheduler (control over when tasks are made
    active)

Task scheduler
10
Ways of running concurrent tasks (6)
  • Task prioritisation
  • This topic was covered in the Real-Time part of
    this course.
  • No further discussion will be undertaken at this
    point.

11
Ways of running concurrent tasks (7)
  • Using interrupts to control tasks (earliest form
    of scheduling)
  • In limited memory capacity systems
  • In very fast (response) systems
  • Some cons of such systems
  • Only interrupt driven tasks
  • Awareness of interrupt
  • organisation
  • Awareness of the hard-
  • ware system which is to
  • host it.

12
Co-operation between concurrent tasks
  • The main problems arising from task co-operation
  • Mutual exclusion problem
  • This implies task requirement for exclusive
    usage of a resource shared by other tasks (common
    resource)
  • Task synchronisation problem
  • This arises from the fact that independent tasks
    are not necessarily non-co-operating tasks. If
    tasks co-operate in any way, then they require
    some form of synchronisation
  • The producer/consumer problem
  • This problem relates to the passage
    (communication) of data between tasks. Data sent
    is produced while data received is consumed.

13
The mutual exclusion problem
  • Imagine 2 processes having to write the word
    hello (indefinitely) to a screen. Assume that
    the one writes the string he and the other
    writes the string llo.

PN markings p1 String he available p2
String llo available p3 String he
displayed p4 String llo displayed. Transition
functions t1 Display he t2 Display
llo t3 Compute he t4 Compute llo.
14
Solutions to the mutual exclusion problem
  • Single flag method
  • Method by which critical areas (i.e. parts of
    code accessing shared resources) is signalled by
    a simple indicator (flag). Flag up means in use,
    flag down - free.
  • Use of the priority ceiling protocol
  • This is the same as was explained in the R-T part
    of this course. Please refer to that material.
  • Use of semaphores (both of binary and counting
    semaphores)
  • Basically, a protected variable with 2 associated
    operations - wait and signal (usually called P
    and V)

15
The single flag method
  • Very easily implemented and understood
    (straightforward)
Write a Comment
User Comments (0)
About PowerShow.com