The Threading Demo What is here Copyright © 2017 Curt Hill.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Advertisements

Synchronization and Deadlocks
Ch 7 B.
CH7 discussion-review Mahmoud Alhabbash. Q1 What is a Race Condition? How could we prevent that? – Race condition is the situation where several processes.
Rtizen ‘s Introduction to EDA Solutions It’s a software tool to make error free engineering drawings (both 2d & 3d) in a cost effective way.
Threads Load new page Page is loading Browser still responds to user (can read pages in other tabs)
Chapter 5 Concurrency: Mutual Exclusion and Synchronization
CS470 Lab 4 TA Notes. Objective Simulate the activities of a producer and consumer – Page 326 Use thread synchronization to solve the producer-consumer.
Using Multiple Forms. Creating a New Form ProjectAdd Windows Form.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
Java: Animation Chris North cs3724: HCI. Animation? Changing graphics over time Examples: cartoons Clippy, agents/assistants Hour glass Save dohicky Progress.
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
Semaphores and Bounded Buffer Andy Wang Operating Systems COP 4610 / CGS 5765.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
Copyright © Curt Hill First Window Builder Program Easy GUIs in Eclipse.
Copyright © 1997 – 2014 Curt Hill Concurrent Execution of Programs An Overview.
Windows Builder An Eclipse Plugin for Creating Windows Graphical User Interfaces Copyright © 2014 Curt Hill.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Copyright © Curt Hill More Components Varying the input of Dev-C++ Windows Programs.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. C H A P T E R E L E V E N Concurrent Programming.
Parser Generation Using SLK and Flex++ Copyright © 2015 Curt Hill.
Scanner Generation Using SLK and Flex++ Followed by a Demo Copyright © 2015 Curt Hill.
Recipes How to craft items from others Copyright © 2015 Curt Hill.
Copyright © – Curt Hill Building Windows Applications in wxDev-C++
Copyright © Curt Hill Common Dialogs Easily Obtaining File Names in DevC++ Windows Programs.
Copyright © 2015 – Curt Hill Window Builder Again Some more features.
Process Synchronization. Objectives To introduce the critical-section problem, whose solutions can be used to ensure the consistency of shared data To.
CS 311/350/550 Semaphores. Semaphores – General Idea Allows two or more concurrent threads to coordinate through signaling/waiting Has four main operations.
Chapter 3: Windows7 Part 5.
Completing the Programme Evaluation Document (PED)
Multithreading / Concurrency
PowerShell Introduction Copyright © 2016 – Curt Hill.
Not a Language but a series of techniques
An Eclipse Plugin for Creating Windows Graphical User Interfaces
Background on the need for Synchronization
Putting Objects in Motion
Using SLK and Flex++ Followed by a Demo
Using Multiple Forms.
Parser and Scanner Generation: An Introduction
The Prototyping Paradigm
Organizing common actions
Predefined Dialog Boxes
Chapter 3: Windows7 Part 5.
Doing things more than once
Concepts From Alice Switching to Java Copyright © Curt Hill.
Programming in Java Text Books :
The Rapid Application Development Paradigm
Putting things in order
Waiting and Synchronization
Miscellaneous Thoughts Nothing on the APIs
A poorly named Curt Hill utility program
Process Synchronization
Concurrent Programming
Multithreaded Programming
Background and Motivation
Concurrency: Mutual Exclusion and Process Synchronization
The Java Alternative to Multiple Inheritance
Your site should be here
Why Threads Are A Bad Idea (for most purposes)
Windows APIs Some odds and ends Copyright © 1997 – 2016 Curt Hill.
CSE 153 Design of Operating Systems Winter 19
CSE 153 Design of Operating Systems Winter 2019
First Window Builder Program
An Eclipse Plugin for Creating Windows Graphical User Interfaces
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
The IF Revisited A few more things Copyright © Curt Hill.
Lex Appendix B.1 -- Lex.
Synchronization and liveness
Join Implementation How is it done? Copyright © Curt Hill.
Presentation transcript:

The Threading Demo What is here Copyright © 2017 Curt Hill

Introduction This presentation is on the Dev Threading demo It puts the things to notice in one place As such it introduces nothing new or testable This demonstrates CreateThread, CreateProcess, Sleep and critical sections Copyright © 2017 Curt Hill

Overview The demo is the standard ggFrm with the normal files There are four additional: Buffer.cpp and .h Stuff.cpp and .h The buffer is a concurrent producer and consumer problem Stuff is to demonstrate the presence or absence of race errors Copyright © 2017 Curt Hill

Threading and Synchronization There is a #define that determines whether to use critical sections It is in buffer.h and named CRITICAL Commenting it out should provoke race errors Copyright © 2017 Curt Hill

First Button The WxButton1Click0 event handler is where we start It does the CreateThread in a loop limited by user defined input It creates all of these suspended It then starts them all at as close to one time as is practicable The thread function is func Defined in Stuff.cpp and .h This is defined only to demonstrate race errors Copyright © 2017 Curt Hill

Thread func This function must be a WINAPI function It drops into a big for loop It then increments and tests two integers It then does a sleep for a millisecond If the critical section is enabled there should be no race errors to find Copyright © 2017 Curt Hill

Stuff Contains several integers and critical sections Stuff is to increment these in succession, so that they are always within one of each other, but usually equal The constructor initializes the critical section Copyright © 2017 Curt Hill

Producer / Consumer The second button starts a producer and consumer problem with multiple threads Buffer contains the class and thread function Copyright © 2017 Curt Hill

Starting a process The last button does a common dialog box to start a new program Its event handler does a CreateProcess Copyright © 2017 Curt Hill

Finally Let’s now look at the demo Copyright © 2017 Curt Hill