Lecture on Java Concurrency Day 2 on Feb 4, 2009.
Upcoming SlideShare
Loading in...5
×
 

Lecture on Java Concurrency Day 2 on Feb 4, 2009.

on

  • 460 views

Lecture on Java Concurrency Day 2 on Feb 4, 2009. (in Korean)

Lecture on Java Concurrency Day 2 on Feb 4, 2009. (in Korean)
Lectures are 4 days in all.

See http://javadom.blogspot.com/2011/06/lecture-on-java-concurrency-day-2.html

Statistics

Views

Total Views
460
Views on SlideShare
460
Embed Views
0

Actions

Likes
0
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Deadlock :circular dependencies among locks Livelock : a continously retried action countinously fails
  • rs represents the ratio of the sequential portion in one program
  • Process Context Switch Overhead : text/data/stack (user area), kernel stack Thread Context Switch Overhead : stack (user), kernel stack

Lecture on Java Concurrency Day 2 on Feb 4, 2009. Lecture on Java Concurrency Day 2 on Feb 4, 2009. Presentation Transcript

  • Practical Concurrency January, 2009 http://javadom.blogspot.com/2011/06/lecture-on-java-concurrency-day-2.html
  • Day 2 (9am, Feb 4, 2009) Concurrency Concerns Performance Concurrency Design
  • 2-1 Concurrency Concerns Correctness Liveness
  • Correctness (Multi-threaded Safety)
    • Conflicts
      • Read-write conflicts
      • Write-write conflicts
  • Liveness
    • Blockages
      • Lock
      • Wait
      • Input
      • CPU contention
      • Failure
  • Deadlock
    • A situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does.
      • Lock-ordering deadlock
      • Dynamic lock-ordering deadlock
      • Resource deadlock
      • Thread-starvation deadlock
  • Livelock
    • similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing
  • 2-2 Performance Amdahl’s law Context Switch Overhead Memory Barrier Overhead
  • Amdahl’s law
  • Context Switch Overhead
    • All the Registers
    • Program Control Block
      • Kernel stack
      • User Area
        • Text/data/ stack
  • Memory Barrier
    • a class of instructions which cause a central processing unit (CPU) to enforce an ordering constraint on memory operations issued before and after the barrier instruction.
    • Assures ordered access and memory visibility in multi-processor environments
    • Accessing volatile fields are usually implemented using memory barrier
  • 2-3 Concurrency Design Concurrency Design Step Concerns Objects in Worker Thread Model Collection Design
  • Steps of Designing Concurrency
    • Identify Shared Resources
    • Identify Critical Sections
    • Design Lock Granularity
    • Check multiple locking sanity
      • Check long critical sections
      • Check possible locking order problems
  • Concerns on Designing Concurrency
    • Liveness
      • Deadlock
      • Starvation
      • Waiting
    • Performance
      • Context switching overhead
      • Lock contention
  • Further considerations
    • Thread confinement
    • Locking itself is not critical overhead
      • Lock contention and context switching is.
  • Worker Threads
    • Worker threads
      • One thread to execute many unrelated tasks
      • Aka., background threads or thread pools (when more than one thread is used)
    • Object life cycle and work threads
      • Instance sharing
      • New instance per work
    • Worker threads and Instance variables
  • Worker Threads and Objects
    • JavaEE EJB Session Bean
      • Stateless session bean objects are pooled
      • The container assures the serialized access to each objects (so, always thread-safe)
      • Statefull session bean might throw ConcurrentAccessException
    • JavaEE Servlet
      • Servlet object life cycle
      • Objects per Request/Session/Page/Application lifecycle
  • Worker Threads and Objects (2)
    • JMX MBean (Local/Connector)
      • Creates new thread per messages
      • Just like the servlet model
    • ProBus Process(or Flow)
      • Use the same Flow class and LProcess objects are created per flow instances (contentions against Lprocess and …)
    • BizMaster Workflow Process
      • Per-process class is generated and no process instances (contentions against RuntimeContext and …)
    • ProBus Adapter Rule
      • Just like the servlet model