C++ Agents Implementation Chris Rouse CSS 497. Outline  Finish Agent Implementation  Involves changes to the following classes:  Agents_base.h/.cpp.

Slides:



Advertisements
Similar presentations
Relaxed Consistency Models. Outline Lazy Release Consistency TreadMarks DSM system.
Advertisements

CSCC69: Operating Systems
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Chap 2 System Structures.
Slide 1 Client / Server Paradigm. Slide 2 Outline: Client / Server Paradigm Client / Server Model of Interaction Server Design Issues C/ S Points of Interaction.
Transaction Processing Lecture ACID 2 phase commit.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
Programming Language Semantics Java Threads and Locks Informal Introduction The Java Specification Language Chapter 17.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
Chapter 11 Operating Systems
Scheduler Activations : Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska.
Chris Rouse CSS Cooperative Education Faculty Research Internship Winter / Spring 2014.
Threads in Java1 Concurrency Synchronizing threads, thread pools, etc.
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
Nachos Phase 1 Code -Hints and Comments
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
The process concept (section 3.1, 3.3 and demos)  Process: An entity capable of requesting and using computer resources (memory, CPU cycles, files, etc).
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
Games Development 2 Concurrent Programming CO3301 Week 9.
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
Internet Software Development Controlling Threads Paul J Krause.
The Alternative Larry Moore. 5 Nodes and Variant Input File Sizes Hadoop Alternative.
Synchronized and Monitors. synchronized is a Java keyword to denote a block of code which must be executed atomically (uninterrupted). It can be applied.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
Synchronizing threads, thread pools, etc.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Concurrency in Java Brad Vander Zanden. Processes and Threads Process: A self-contained execution environment Thread: Exists within a process and shares.
IT 325 Operating systems Chapter6.  Threads can greatly simplify writing elegant and efficient programs.  However, there are problems when multiple.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Software Systems Advanced Synchronization Emery Berger and Mark Corner University.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
1 5-High-Performance Embedded Systems using Concurrent Process (cont.)
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
3/17/2016cse synchronization-p2 © Perkins, DW Johnson and University of Washington1 Synchronization Part 2 CSE 410, Spring 2008 Computer.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
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.
Pitfalls: Time Dependent Behaviors CS433 Spring 2001 Laxmikant Kale.
Multiprocessors – Locks
Tutorial 2: Homework 1 and Project 1
Process Management Deadlocks.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Software Coherence Management on Non-Coherent-Cache Multicores
Lecture 21 Synchronization
Compilation and Debugging
Compilation and Debugging
Concurrency.
Chapter 2: System Structures
Multithreading Tutorial
ITEC 202 Operating Systems
Multithreading.
Multithreading Tutorial
Background and Motivation
Multithreading Tutorial
Software Transactional Memory Should Not be Obstruction-Free
ECE 3430 – Intro to Microcomputer Systems
Multithreading Tutorial
Kernel Synchronization II
Chapter 2: Operating-System Structures
CS333 Intro to Operating Systems
Processes Creation and Threads
Electrical and Computer Engineering
“The Little Book on Semaphores” Allen B. Downey
Presentation transcript:

C++ Agents Implementation Chris Rouse CSS 497

Outline  Finish Agent Implementation  Involves changes to the following classes:  Agents_base.h/.cpp  Agent.h/.cpp  Mprocess.h/.cpp  Messages.h/.cpp  Exchange_helper.h/.cpp  Attempt to fix Eclipse IDE development problems for C++ version

Agents_base.h/.cpp  Must add methods:  CallAll()  Instantiate bag of Agents to use  Must allocate Agents for each thread  Will send a command to all agents to execute  Wait for response back  ManageAll()  Will need to update information between all agents  Manages spawning, migrating, and killing of agents

Agents_base.h/.cpp cont.  Difficulties:  All must pull from a single bag, causing a possibility for race conditions  This leads to the bag of agents being a critical section NormalWiki exampleRace Condition  To remedy the problem, we need to make use of pthread_mutex_lock() to control when a thread can access this bag

Agents_base.h/.cpp  Mutex locking will help prevent race conditions by ‘locking down’ the critical section upon use  Any requests must first acquire the lock rights before they can access the agents  If bag is already locked, other requests must wait until the lock releases and notifyAll is called before attempting to gain the lock again

Agents_base.h/.cpp  Difficulties cont:  Waiting and Notifying  Should wait to hear back about status of agent  Typically we make use of Notify and Wait  Can use provided methods barrierThreads and resumeThreads to wait and notify  What to do when an Agent doesn’t send notifications back?  At this time, we will assume that all Agents will respond and not take precautions in the event they do not  As currently planned, if an Agent doesn’t respond, the program will simply crash

Agents_base.h/.cpp  CallAll method will essentially work like so: Step 1: Create Bag of Agents Step 2: Lock Bag Upon First Pop Request Step 3: Remove Last Agent From Vector of Agents Step 4: Send Copy of Command to Popped Agent Step 5: Release the Lock Step 6: Continue Until Out of Agents Step 7: Wait for Agents to Finish Task Step 8: Collect Finished Agents into New Bag and Replace Old Bag

Agents.h/.cpp  Must add methods:  Spawn()  To create Agents in current place  Migrate()  To move agents between Place locations  Kill()  To remove an Agent when it is finished with execution  This must also handle sending the commands to the slave agents

Messages.h/.cpp & Exchange_helper.h/.cpp  Messages will need to be modified:  This will need to use the CallAll() & ManageAll() calls mentioned earlier  Exchange_helper will need to be modified too  Will need to be able to exchange agents between slaves  This will happen either locally in the same place or through a set of slave locations

Current Status  Still working on CallAll() method  Reading and understanding existing code has been time consuming and confusing  Working on recompilation of existing code using Makefile while on campus  Decided to use a single bag of Agents to more efficiently handle race condition vs. Multiple bags of Agents  Working on implementing tests to make sure Agents are being taken correctly and passed correct instructions  Wait and Notify have not been used and tested yet

Current Difficulties  Unfamiliar code  Code is complex and often contains information that I don’t understand  No working IDE  Eclipse has issues with some of the function calls and classes  Currently working on fixing problems that would prevent IDE development of the C++ version  Unknown behavior  Haven’t worked with the code’s output much yet, so any output I read needs to be checked for correct behavior, then rechecked with new changes  Code must be recompiled on campus  Code uses libraries stored in Professor Fukuda’s campus drive, so to recompile easily, needs to happen via SSH or on campus computers

Deprecation Fixes  Some functions in the code are now deprecated and throw errors when used  Most recent example is bcopy(), which is now deprecated in newer Linux systems  My original fix was to include the String.h class, which had many of the deprecated values still included in it  This call can now be made using the memcpy() call, which takes the same parameters as bcopy, and functions the same  My current copy of the code contains all changes made for bcopy using a quick Linux ‘find | xargs | sed’ command to make all the necessary replacements, though no testing as of yet

Future Plans  Finish wait/notify in Agents_base and check for errors  Test the memcpy command to make sure it works as intended  Fully test CallAll implementation  Move onto Spawn and Kill methods of Agents when complete with all the above  Continue to work on Eclipse IDE problems to enable further development easier for new research students