[Skip Navigation] [CSUSB] / [CNS] / [CSE] / [R J Botting] /[CS320 Course Materials] /16.html [16.txt(Text)] [Search ]
Thu May 23 15:08:27 PDT 2013
[Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Grading] [Contact]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]


    CS320/16 Concurrency and Java

      Prev 15OO Programming and JavaChapter 2 section 17 + Java Handout + Chapter 12 lab15 Java101
      16Concurrency and JavaChapter 13 not sect'n 9lab16 Java102
      Next 17ExceptionsChapter 14lab17 Java103

      (Close Table)

      Preparation -- Chapter 13 -- Concurrency

      1. Study notes below and Chapter 13, but not section 9 (not on the final).
      2. You can forget about MIMD/SIMD in this class (not on the final).
      3. Don't answer review questions on hardware. They are not on the Final.


        Concurrency is often faked:

        One single processor or computer can work as if it had many processors.

        All modern operating systems use concurrency.

        The introductory definitions and ideas in the book are important.

        The various forms of hardware (MIMD and SIMD) and FORTRAN based concurrency can be ignored. Take our advanced architecture courses for this and/or talk to Dr. Gomez.

        You need to understand

        1. threads
        2. semaphores,
        3. monitors,
        4. deadlocks
        5. etc.

        1. They turn up all over the place: web sites, data bases, mail handlers, commercial transactions, system administration, etc..
        2. They are used in interview questions.
        3. They are a part of Java: [ Thread.html ]

        Threads are easier than networks

        [ 14723 ]


        The ideas in Ada are simple to use
        • rendezvous.
        • Protected records
        • The "message passing" model is simple, reliable, and flexible.

      Some concurrency bugs are hard to find by testing.

      1. Use simple and sure techniques: message passing and rendezvous.
      2. Use logical model checking tools to look for the rare combinations of events that cause bugs.
      3. Take CSci556: Formal Methods.

      Java Thread

      [Classes Object Thread and interface Runnable]

      Examples of Concurrency

      Look in these directories: [ http://cse.csusb.edu/dick/cs320/sieve/ ] [ http://cse.csusb.edu/dick/cs320/crypto/ ]

      Missing -- UNIX pipes

      1. Simple to use message passing
      2. Also in Java
      3. Symbol |
      4. Example
         			ls|grep 320

    1. For A,B:commands, A|B::command=connects the output of A to the input of B and executes them in parallel.


             ls|wc -l
      lists files and counts them. (ls =list, wc -l = count lines)

             ls|grep 320|wc -l
      list files, filters out those with '320' in the name and counts them.

             grep -l 320 *|wc -l
      counts the number of files with '320' inside them.

             ps -elf|grep $USER
      lists all processes and filters out those with your name in them... including the two processes 'ps -elf' and 'grep'.

      Why people do not like concurrency

      [ 1653418 ]

    . . . . . . . . . ( end of section Notes) <<Contents | End>>

    Class Work

    [ 16q.html ]

Lab Work

[ lab/16.html ]


[ 17.html ]

( End of document ) <<Contents | Top