1 Mouse Events See Figure 11.27 See Example in Figure 11.28, 11.31.

Slides:



Advertisements
Similar presentations
Ade Azurat, Advanced Programming 2004 (Based on LYS Stefanus’s slides) Advanced Programming 2004, Based on LYS Stefanus’s slides Slide 2.1 Multithreading.
Advertisements

CS 5704 Fall 00 1 Monitors in Java Model and Examples.
Java How to Program, 9/e CET 3640 Professor: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
G52CON: Concepts of Concurrency Lecture 2 Processes & Threads Chris Greenhalgh School of Computer Science
1 L49 Multithreading (1). 2 OBJECTIVES  What threads are and why they are useful.  How threads enable you to manage concurrent activities.  The life.
Slides for Chapter 6: Operating System support From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L19 (Chapter 24) Multithreading.
 2007 Pearson Education, Inc. All rights reserved. 1 Ch23 Multithreading: OBJECTIVES In this chapter you will learn:  What threads are and why they are.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
1 Threads (Part I) Introduction to Threads and Concurrency Overview  Introduction to Threads of Computation  Creating Threads in java an Example  Thread.
Multithreading in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Fundamentals of Python: From First Programs Through Data Structures
Java How to Program, 9/e CET 3640 Professor: Dr. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
What is Concurrent Programming? Maram Bani Younes.
Parallel Processing (CS526) Spring 2012(Week 8).  Thread Status.  Synchronization in Shared Memory Programming(Java threads ) ◦ Locks ◦ Barriars.
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
COP 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Collage of Information Technology University of Palestine Advanced programming MultiThreading 1.
Java Programming, Second Edition Chapter Seventeen Multithreading and Animation.
Threads. Overview Problem Multiple tasks for computer Draw & display images on screen Check keyboard & mouse input Send & receive data on network Read.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Multithreading in Java Project of COCS 513 By Wei Li December, 2000.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
Dr. R R DOCSIT, Dr BAMU. Basic Java : Multi Threading 2 Objectives of This Session State what is Multithreading. Describe the life cycle of Thread.
111 © 2002, Cisco Systems, Inc. All rights reserved.
A Guide to Advanced Java Faculty:Nguyen Ngoc Tu. Concurrent programming in Java How to make all things run-able?
Multithreading in Java Sameer Singh Chauhan Lecturer, I. T. Dept., SVIT, Vasad.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Concurrency in Java Brad Vander Zanden. Processes and Threads Process: A self-contained execution environment Thread: Exists within a process and shares.
1 Introduction to Threads Computers can perform many tasks concurrently – download a file, print a file, receive , etc. Sequential languages such.
Introduction to Threads Session 01 Java Simplified / Session 14 / 2 of 28 Objectives Define a thread Define multithreading List benefits of multithreading.
Multithreading Chapter Introduction Consider ability of _____________ to multitask –Breathing, heartbeat, chew gum, walk … In many situations we.
Multithreading Chapter Introduction Consider ability of human body to ___________ –Breathing, heartbeat, chew gum, walk … In many situations we.
Multithreading in JAVA
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Multi-Threading in Java
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 More on Thread API.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 16 – Multithreading Outline 16.1 Introduction 16.2 Thread States: Life Cycle of a Thread 16.3.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 7: Operating.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Threads in Java Threads Introduction: After completing this chapter, you will be able to code your own thread, control them efficiently without.
Thread A thread represents an independent module of an application that can be concurrently execution With other modules of the application. MULTITHREADING.
T HREADS Lecture 5 1 L. Mohammad R.Alkafagee. H EAVYWEIGHT - PROCESSES The cooperation of traditional processes also known as heavyweight processes which.
Multithreading & Synchronized Algoritma Pemrograman 3 Sistem Komputer – S1 Universitas Gunadarma 1.
Multithreading. Multitasking The multitasking is the ability of single processor to perform more than one operation at the same time Once systems allowed.
Process Control Management Prepared by: Dhason Operating Systems.
Concurrent Programming in Java Based on Notes by J. Johns (based on Java in a Nutshell, Learning Java) Also Java Tutorial, Concurrent Programming in Java.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Chapter 4 – Thread Concepts
Threads in Java Jaanus Pöial, PhD Tallinn, Estonia.
Multithreading / Concurrency
Multi Threading.
Lecture 9 Object Oriented Programming Using Java
Chapter 4 – Thread Concepts
Multithreaded Programming in Java
Lecture 21 Concurrency Introduction
23 Multithreading.
Multithreading Chapter 23.
Chapter 15, Exploring the Digital Domain
Slides for Chapter 6: Operating System support
Multithreading.
TDC 311 Process Scheduling.
Java Based Techhnology
Multithreading.
Process Scheduling Decide which process should run and for how long
21 Threads.
Computer Science 2 06A-Java Multithreading
Threads and Multithreading
Java Chapter 3 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

1 Mouse Events See Figure See Example in Figure 11.28, 11.31

1 Digital Images Images are comprised of a two dimensional grid of pixels Each pixel (picture element) contains information about a color Many formats exist for storing images – Each has its own features – Examples: JPEG GIF PNG

1 Images in Java See Figure 21.1

1 Concurrency in Java Concurrency normally available in OS primitives – Most computers today allow more than one process or task running at any given time – Computers with more than one processor can actually run more than one process at a time Java provides built-in multithreading – Threads are to processes as applet are to applications – Multithreading improves the performance of some programs

1 Threads Thread states – Born state Thread was just created – Ready state Thread’s start method invoked Thread can now execute – Running state Thread is assigned a processor and running – Dead state Thread has completed or exited Eventually disposed of by system

1 A Thread's Life Ready Running BlockedSleepingWaiting start issue I/O request wait notify notifyAll timeout expires interrupt thread dispatch (assign a processor) quantum expiration yield sleep complete sleep interval expires interrupt Born enter synchronized statement I/O completes acquire lock interrupt When a thread completes (returns from its run method), it reaches the Dead state (shown here as the final state)

1 Thread Priorities and Thread Scheduling Java thread priority – Priority in range 1-10 Timeslicing – Each thread assigned time on the processor called a quantum – Keeps highest priority threads running

1 Thread priority scheduling example Priority 9 Priority 8 Priority 7 Priority 10 Priority 6 Priority 5 Priority 4 Priority 3 Priority 2 Priority 1 AB D C EF G H I JK Ready threads Thread.MIN_PRIORITY Thread.MAX_PRIORITY Thread.NORM_PRIORITY

1 Creating and Executing Threads Sleep state – Thread method sleep called – Thread sleeps for a set time interval then awakens Example – Figure 16.3: ThreadTester.java

1 Animating a Series of Images Threads are very useful for animation – Repeat Draw graphics Sleep Wake up Update – Loop structure handled at the thread level Example – Figure 21.2: LogoAnimator.java

1 Vectors Class java.util.Vector – Array-like data structures that can resize themselves dynamically – Contains a capacity – Grows by capacity increment if it requires additional space Example – Figure 21.1: VectorTest.java