Lab 1 The Alarm Clock (Threads and Semaphores)

Size: px
Start display at page:

Download "Lab 1 The Alarm Clock (Threads and Semaphores)"

Transcription

1 Exercises and Labs Lab 1 The Alarm Clock (Threads and Semaphores) Exercise session - preparation In this exercise you will design a real-time system for an alarm clock application using threads, semaphores and provided hardware emulation. In lab 1 you will implement your design (the implementation usually takes longer than two hours so be sure to start well in advance of the review occasion). Objective After this design and programming exercise you will have implemented the real-time software for a small embedded system. You should know the following terms: Sporadic and periodic threads Semaphore and be able to Use semaphores for signaling and mutual exclusion Share data between threads through a passive object protected by a semaphore Design small realtime systems containing both event-driven and periodic activities You will know the di erence between sporadic and periodic threads, and you will know how the use the semaphore primitive for signaling and mutual exclusion. You will know how to design a small realtime system with two threads. Preparation and design Study the provided specification, description of the handout code and hardware emulator and answer the following questions (express your design in class diagrams and Java code where necessary): 1. What parallel activities are needed, i.e., which thread objects do you need? 2. What common data need to be shared between threads? Where are the data to be stored? 3. What operations on data are needed for each thread? Where should this logic be stored? 25

2 Multi-Threaded Programming in Java 4. Where will data be accessed concurrently from di erent threads, i.e., where do you need to provide mutual exclusion? 5. Are there other situations in the alarm clock where semaphores are needed for synchronization? Hint: study the ClockInput class. 6. If you in a thread wait for the next second by simply calling sleep(1000), what will the e ect on the clock time be? Is this ok for alarm clock time updating? Can it be improved? Specification 1. The displayed clock time should be updated every second (by calling the ClockOutput.showTime method). Note: when the user has selected set alarm or set time, the hardware/emulator shows the set time and an update of the clock time will have no e ect on the clock display. Still, the clock time should be updated every second regardless of mode. 2. It should be possible to set the clock time and the alarm time. The hardware emulator internally handles the actual setting/editing of the time value. When the user selects another mode, the set value is written to the ClockInput object and give is called for its semaphore. For example, the user selects set alarm and edits (using number keys or arrows) the alarm time. Nothing needs to be done by the control software. Then the user selects set time and the alarm time is written to the ClockInput object and give is called. Note: give is called for each key press or interaction with the alarm clock. It is therefore necessary to filter signals according to the comment in ClockInput.getValue. 3. When the clock time is equal to the alarm time, and the alarm on tick box is selected, the alarm should beep once a second for 20 seconds. The ClockOutput.doAlarm() method provides one beep. The sound should be turned o if the user pushes any button while the alarm is sounding. 4. The program should later on be written in Java, using the Thread class. Signalling and mutual exclusion shall be achieved through semaphores according to the se.lth.cs.realtime package Optional: Include in your design an AlarmClock.terminate() method. The terminate method should result in termination of all your threads, before returning to the caller.

3 Exercises and Labs Using the emulator Start the AlarmClock (through Eclipse) as an applet. First, you must click somewhere on the image of the clock to give the applet keyboard focus (light blue area). Clicking the check box or another window will steal keyboard focus again. Hold Shift to set clock time (button 1). Hold Ctrl to set alarm time (button 3) 2. Hold Shift+Ctrl to toggle alarm on or o. Use direction keys for buttons 2-6. The two lines on the LCD display should be fairly obvious. The first line displays the current clock time. The second line displays the alarm time. When the alarm is set the separators in the alarm time turn into colons, otherwise they remain as underscores. When the alarm is beeping the separators will flash with the beeps of the alarm. Below the buttons is a small status field which displays the alarm status with a check box and the current input mode with three radio buttons. The radio buttons may not be manipulated directly, but the check box can be used to modify the alarm status (on/o ). When either of the modes Set Time or Set Alarm is active the user may increase the digit under the cursor (indicated by an underscore) by pressing the up button (2), decrease the digit under the cursor with the down button (5), shift cursor left with the left button (4) and shift cursor right with the right button (6). Handout code The handout code consists of two Java packages called done and todo. Thedone package contains the emulator (as an applet) as well as hardware interfaces (ClockInput and ClockOutput). The todo package will contain your real-time system. todo right now contains one class, AlarmClock, that contains a sample implementation that beeps upon key presses. You will modify and extend todo with classes as you deem necessary for your implementation. 2 Note for Mac OS X users: in case your computer behaves strangely upon pressing Ctrl, it can be a good idea to switch from KeyEvent.VK_CTRL to something less meaningful, e.g., KeyEvent.VK_COMMA in the ClockGUI.keyPressed and ClockGUI.keyReleased methods respectively (in package done). 27

4 Multi-Threaded Programming in Java AlarmClock class package todo; import done.*; import se.lth.cs.realtime.semaphore.semaphore; import se.lth.cs.realtime.semaphore.mutexsem; public class AlarmClock extends Thread { private static ClockInput input; private static ClockOutput output; private static Semaphore sem; public AlarmClock(ClockInput i, ClockOutput o) { input = i; output = o; sem = input.getsemaphoreinstance(); // The AlarmClock thread is started by the simulator. No // need to start it by yourself, if you do you will get // an IllegalThreadStateException. The implementation // below is a simple alarmclock thread that beeps upon // each keypress. To be modified in the lab. A recommendation // is to use this thread to start up your system similar // to RTsemBuffer in exercise 1. public void run() { while (true) { sem.take(); output.doalarm(); Looking inside the simulator for a moment, what is happening at startup is that the simulator creates an instance of your AlarmClock class and starts a new thread on the resulting object. The new thread starts executing in the AlarmClock.run() method. Simulator excerpt: AlarmClock startup code ClockInput butt2ctrl; // Interface to user actions via hardware/software. ClockOutput ctrl2disp; // Interface to display hardware/software. AlarmClock control; // The actual alarm-clock software. //... control = new AlarmClock(butt2ctrl, ctrl2disp); control.start(); In the same manner, when the applet is stopped (corresponding to hardware reset), there is a call control.terminate(); which you need to override, if you want to fulfil the optional specification item 5. The following classes are the ClockOutput and the ClockInput that describe the interface between the control software and the clock hardware/emulator. 28

5 Exercises and Labs Excerpt from the ClockOutput class public class ClockOutput { * Wake-up clock user. public void doalarm() {... * If the display is currently used to display the time, update it. * If user is using display for setting clock or alarm time, do * nothing. public void showtime(int hhmmss) {... Excerpt from the ClockInput class public class ClockInput { * Semaphore that signals when the user has changed any setting. * Get-method to access the semaphore instance directly. public Semaphore getsemaphoreinstance() {... * Get check-box state. public boolean getalarmflag() {... * Return values for getchoice. public static final int SHOW_TIME = 0; public static final int SET_ALARM = 1; public static final int SET_TIME = 2; * Get radio-buttons choice. public int getchoice() {... * When getchoice returns a new choice, and the previous choice * was either SET_ALARM or SET_TIME, the set-value of the display * is returned in the format hhmmss where h, m, and s denotes * hours, minutes, and seconds digits respectively. This means, * for example, that the hour value is obtained by dividing the * return value by * Make sure to wait until a new choice has been reported before * deciding what to do public int getvalue() {... Some advice Originally, this exercise aimed at a physical alarm clock, where the hardware expected (minimal) C-code. The respective Java to C translator cannot cope with the entire Java language and framework. Keeping in mind that the translator s requirements would be necessary to fulfill, you should try to stick to these constraints also when only using the emulator and pure Java. This means to keep your design as minimal as possible, specifically the number of threads should be kept small for the design. 29

6 Multi-Threaded Programming in Java Checklist for self- and peer assessment of your design You should be able to answer the following questions with yes before asking your teacher for approval of your design: Is there a minimal number of active objects (threads) in the design? Is there some passive object (data storage) to maintain the current clock and alarm times? Is the design supporting mutually exclusive access to data accessed by di erent threads? Is there an activity (thread) designated to take care of user input (button presses)? Is there an activity (thread) designated to handle the clock updates? Are all relevant functionalities (see specification) planned to be taken care of by respective methods? Are calculations planned to be made at the right place (data / monitor logic, vs thread logic)? Once you assume all questions positively answered for your own design, hand it over to your partner group for cross checking. Do the same check for the other group s design. After getting a confirmation for the checklist, show your solution to the teacher. All students in your group need to be able to explain the design for approval! 30

7 Multi-Threaded Programming in Java Laboratory session - programming You are now supposed to implement your alarm clock system designed in the previous exercise. The actual target system is an AVR board equipped with LCD display and six buttons (as shown in the image), for which it is required to use a Java-to-C compiler, as the hardware only can handle C code. However, for this course you will only implement the alarm clock in Java using semaphores and execute it on the Java emulator provided through the course workspace (see the respective.zip-file provided on the course web). Still, you should design and write your program according to the instructions and advice that would be necessary for the cross-compilation. Programming advice It is generally a good idea to start programming before the lab occasion. You should use both the emulator and the code stubs provided in the Eclipse workspace which is available as a.zip-file from the course web page. Remember that the emulator should be run as an applet. Before you start programming you need to have your design of the system approved by your teacher. If you do not have this approval, start over with the preparation exercise! Inspect the code skeleton and prepared classes in the AlarmClock project s done and todo folders. You will implement your real-time system in the todo folder by modifying the present AlarmClock class and adding further classes as your design requires. Some advice The Java to C translator cannot cope with the entire Java language and framework. Keeping in mind that the translator s requirements would be necessary to fulfill, you should try to stick to these constraints also when only using the emulator and pure Java. Also, from an embedded systems point of view it is best to import as little as possible to minimize memory requirements. Avoid * when importing, just import the classes that are needed 3. For the lab a very small subset is necessary: 3 A comment on LJRT: The curious reader might wonder why we use an inhouse package to provide synchronization primitives. The explanation is that the LJRT package (Lund Java Real-Time) was specifically developed to support Java to C translation for small embedded systems. During translation the LJRT Java primitives are replaced by their C counterparts. The translation tool we use was developed as part of a doctoral real-time thesis presented a few years back. The tool is now hosted on 32

8 Exercises and Labs Thread System.currentTimeMillis() LJRT semaphores se.lth.cs.realtime.semaphore.semaphore se.lth.cs.realtime.semaphore.mutexsem se.lth.cs.realtime.semaphore.countingsem You are (in this lab) only allowed to use take and give operations on the semaphores, trytake is forbidden. Checklist and hints for self- and peer assessment (and correction) of the implementation You should be able to answer the following questions with yes before asking your teacher for approval of your program: Does the program correspond to the approved design (in case it does not, is there an acceptable reason)? Does the program (applet) work according to specifications (check against the given specification, if there are deviations, debug the respective methods, or simply add the forgotten functionality, check that your threads are started properly)? Is (according to the program code) mutual exclusion handled appropriately (any data manipulation should be protected by a semaphore, use several MutexSems only when absolutely sure about what you are doing and why, otherwise one instance is su cient - and safest)? Are (according to the program code) signals handled appropriately (no busy waits, i.e., no loops that keep running and checking some condition instead of an eternal loop that is blocked by waiting on a signalling semaphore)? Is made sure (according to the program code) that there is no unnecessary handling of input data (check the getchoice / getvalue specification and use of those methods, only when the choice is changed FROM certain choice-values, the respective time value should be handled)? Is the clock update correctly handled (i.e., no accumulative error in time calculations, see remarks on Time in the booklet, and make sure the code follows the principles for one as exact as possible update per second)? A hint on the display during input: In case you get cryptic signs instead of the expected numbers, check your conditions for when to retrieve and update the time / alarm time values against the specification. In case you get stuck beyond the hints given above, consult with your partner group first, then turn to the lab assistant or teacher for help. Once you assume all questions positively answered for your own implementation, hand it over to your partner group for cross checking. Do the same check for the other group s implementation. After getting a confirmation for the checklist, show your program to the teacher. All students in your group need to be able to explain the program for approval! 33

Tentamen EDAF85/EDA698 Realtidssystem (Helsingborg)

Tentamen EDAF85/EDA698 Realtidssystem (Helsingborg) LUNDS TEKNISKA HÖGSKOLA 1(10) Institutionen för datavetenskap Tentamen EDAF85/EDA698 Realtidssystem (Helsingborg) 201 10 26, 14.00 19.00 Det är tillåtet att använda Java snabbreferens och miniräknare,

More information

Real-Time and Concurrent Programming Lecture 4 (F4): Monitors: synchronized, wait and notify

Real-Time and Concurrent Programming Lecture 4 (F4): Monitors: synchronized, wait and notify http://cs.lth.se/eda040 Real-Time and Concurrent Programming Lecture 4 (F4): Monitors: synchronized, wait and notify Klas Nilsson 2016-09-20 http://cs.lth.se/eda040 F4: Monitors: synchronized, wait and

More information

Java Programming Constructs Java Programming 2 Lesson 1

Java Programming Constructs Java Programming 2 Lesson 1 Java Programming Constructs Java Programming 2 Lesson 1 Course Objectives Welcome to OST's Java 2 course! In this course, you'll learn more in-depth concepts and syntax of the Java Programming language.

More information

Exercises and Labs. Part I. Exercises

Exercises and Labs. Part I. Exercises Exercises and Labs Part I Exercises 7 Exercises and Labs Exercise 1 Semaphores Answer the questions below: 1. Sometimes, multiple threads in a program write to the same file concurrently. One example

More information

Boot Camp. Dave Eckhardt Bruce Maggs

Boot Camp. Dave Eckhardt Bruce Maggs Boot Camp Dave Eckhardt de0u@andrew.cmu.edu Bruce Maggs bmm@cs.cmu.edu 1 This Is a Hard Class Traditional hazards 410 letter grade one lower than other classes All other classes this semester: one grade

More information

Lab Exercise Test First using JUnit

Lab Exercise Test First using JUnit Lunds tekniska högskola Datavetenskap, Nov, 2017 Görel Hedin/Ulf Asklund EDAF45 Programvaruutveckling i grupp projekt Lab Exercise Test First using JUnit Goal This lab is intended to demonstrate basic

More information

Operating Systems, Assignment 2 Threads and Synchronization

Operating Systems, Assignment 2 Threads and Synchronization Operating Systems, Assignment 2 Threads and Synchronization Responsible TA's: Zohar and Matan Assignment overview The assignment consists of the following parts: 1) Kernel-level threads package 2) Synchronization

More information

LookoutDirect Basics: Windows, Tools, Files, and Path Names

LookoutDirect Basics: Windows, Tools, Files, and Path Names LookoutDirect Basics: Windows, Tools, Files, and Path Names 4 Starting LookoutDirect Logging on to LookoutDirect This chapter explains how to start and get around within LookoutDirect. It describes the

More information

SYNCHRONIZED DATA. Week 9 Laboratory for Concurrent and Distributed Systems Uwe R. Zimmer. Pre-Laboratory Checklist

SYNCHRONIZED DATA. Week 9 Laboratory for Concurrent and Distributed Systems Uwe R. Zimmer. Pre-Laboratory Checklist SYNCHRONIZED DATA Week 9 Laboratory for Concurrent and Distributed Systems Uwe R. Zimmer Pre-Laboratory Checklist vvyou have read this text before you come to your lab session. vvyou understand and can

More information

LAB 7 Writing Assembly Code

LAB 7 Writing Assembly Code Goals To Do LAB 7 Writing Assembly Code Learn to program a processor at the lowest level. Implement a program that will be used to test your own MIPS processor. Understand different addressing modes of

More information

Recap: Thread. What is it? What does it need (thread private)? What for? How to implement? Independent flow of control. Stack

Recap: Thread. What is it? What does it need (thread private)? What for? How to implement? Independent flow of control. Stack What is it? Recap: Thread Independent flow of control What does it need (thread private)? Stack What for? Lightweight programming construct for concurrent activities How to implement? Kernel thread vs.

More information

Java Threads and intrinsic locks

Java Threads and intrinsic locks Java Threads and intrinsic locks 1. Java and OOP background fundamentals 1.1. Objects, methods and data One significant advantage of OOP (object oriented programming) is data encapsulation. Each object

More information

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014 Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class

More information

Real-Time and Concurrent Programming Lecture 1 (F1): Embedded concurrent software

Real-Time and Concurrent Programming Lecture 1 (F1): Embedded concurrent software http://cs.lth.se/eda040 Real-Time and Concurrent Programming Lecture 1 (F1): Embedded concurrent software Klas Nilsson 2016-08-30 http://cs.lth.se/eda040 F1: Embedded concurrent real-time software 2016-08-30

More information

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Using Eclipse for Java. Using Eclipse for Java 1 / 1 Using Eclipse for Java Using Eclipse for Java 1 / 1 Using Eclipse IDE for Java Development Download the latest version of Eclipse (Eclipse for Java Developers or the Standard version) from the website:

More information

1) Discuss the mutual exclusion mechanism that you choose as implemented in the chosen language and the associated basic syntax

1) Discuss the mutual exclusion mechanism that you choose as implemented in the chosen language and the associated basic syntax Lab report Project 3 Mihai Ene I have implemented the solution in Java. I have leveraged its threading mechanisms and concurrent API (i.e. concurrent package) in order to achieve the required functionality

More information

Resource 2 Embedded computer and development environment

Resource 2 Embedded computer and development environment Resource 2 Embedded computer and development environment subsystem The development system is a powerful and convenient tool for embedded computing applications. As shown below, the development system consists

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use

More information

Getting to know Greenfoot

Getting to know Greenfoot CHAPTER 1 Getting to know Greenfoot topics: concepts: the Greenfoot interface, interacting with objects, invoking methods, running a scenario object, class, method call, parameter, return value This book

More information

Advanced Programming - CS239

Advanced Programming - CS239 Advanced Programming - CS239 Department of Computer Science LAB: EXPERIMENTING WITH SPECIALIZATION Getting Ready: Before going any further you should: 1. Make a directory on your N: drive for this lab.

More information

3 Getting Started with Objects

3 Getting Started with Objects 3 Getting Started with Objects If you are an experienced IDE user, you may be able to do this tutorial without having done the previous tutorial, Getting Started. However, at some point you should read

More information

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Introduction. Key features and lab exercises to familiarize new users to the Visual environment Introduction Key features and lab exercises to familiarize new users to the Visual environment January 1999 CONTENTS KEY FEATURES... 3 Statement Completion Options 3 Auto List Members 3 Auto Type Info

More information

Building a safe and secure embedded world. Testing State Machines. and Other Test Objects Maintaining a State. > TESSY Tutorial Author: Frank Büchner

Building a safe and secure embedded world. Testing State Machines. and Other Test Objects Maintaining a State. > TESSY Tutorial Author: Frank Büchner Building a safe and secure embedded world Testing State Machines and Other Test Objects Maintaining a State > TESSY Tutorial Author: Frank Büchner Topic: TESSY is especially well-suited for testing state

More information

Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools

Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools Section 1. Opening Microsoft Visual Studio 6.0 1. Start Microsoft Visual Studio ("C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV.EXE")

More information

CPS 310 second midterm exam, 11/14/2014

CPS 310 second midterm exam, 11/14/2014 CPS 310 second midterm exam, 11/14/2014 Your name please: Part 1. Sticking points Consider the Java code snippet below. Is it a legal use of Java synchronization? What happens if two threads A and B call

More information

ETS110: Internet Protocol Routing Lab Assignment

ETS110: Internet Protocol Routing Lab Assignment Dept of Electrical and Information Technology 2010-10-13 Jens A Andersson vers 3.1 ETS110: Internet Protocol Routing Lab Assignment 1 Purpose and Goals This lab assignment will give a hands-on experience

More information

ETS110: Internet Protocol Routing Lab Assignment

ETS110: Internet Protocol Routing Lab Assignment Dept of Electrical and Information Technology 2009-04-28 Jens A Andersson vers 2.0.5 ETS110: Internet Protocol Routing Lab Assignment 1 Purpose and Goals This lab assignment will give a hands-on experience

More information

ASSIGNMENT 5 Objects, Files, and More Garage Management

ASSIGNMENT 5 Objects, Files, and More Garage Management ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,

More information

Micrium OS Kernel Labs

Micrium OS Kernel Labs Micrium OS Kernel Labs 2018.04.16 Micrium OS is a flexible, highly configurable collection of software components that provides a powerful embedded software framework for developers to build their application

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

Creating Folders in Foliotek

Creating Folders in Foliotek Creating Folders in Foliotek You can organize your files in Folders in Foliotek and that is actually a much more efficient way to do your business. You can create a folder for each of your classes that

More information

Summer Assignment for AP Computer Science. Room 302

Summer Assignment for AP Computer Science. Room 302 Fall 2016 Summer Assignment for AP Computer Science email: hughes.daniel@north-haven.k12.ct.us website: nhhscomputerscience.com APCS is your subsite Mr. Hughes Room 302 Prerequisites: You should have successfully

More information

Lab 3b: Scheduling Multithreaded Applications with RTX & uvision

Lab 3b: Scheduling Multithreaded Applications with RTX & uvision COE718: Embedded System Design Lab 3b: Scheduling Multithreaded Applications with RTX & uvision 1. Objectives The purpose of this lab is to introduce students to RTX based multithreaded applications using

More information

Excel Tips to help you with the PS477/577 Final Paper Project

Excel Tips to help you with the PS477/577 Final Paper Project Excel Tips to help you with the PS477/577 Final Paper Project Please try working through this sheet BEFORE the training session -- it will allow you to learn much more at the training session. Best of

More information

Dealing with Issues for Interprocess Communication

Dealing with Issues for Interprocess Communication Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed

More information

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version. NetBeans Tutorial For Introduction to Java Programming By Y. Daniel Liang This tutorial applies to NetBeans 6, 7, or a higher version. This supplement covers the following topics: Getting Started with

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

2 Getting Started. Getting Started (v1.8.6) 3/5/2007 2 Getting Started Java will be used in the examples in this section; however, the information applies to all supported languages for which you have installed a compiler (e.g., Ada, C, C++, Java) unless

More information

TDDD56 Multicore and GPU computing Lab 2: Non-blocking data structures

TDDD56 Multicore and GPU computing Lab 2: Non-blocking data structures TDDD56 Multicore and GPU computing Lab 2: Non-blocking data structures August Ernstsson, Nicolas Melot august.ernstsson@liu.se November 2, 2017 1 Introduction The protection of shared data structures against

More information

GE420 Laboratory Assignment 3 More SYS/BIOS

GE420 Laboratory Assignment 3 More SYS/BIOS GE420 Laboratory Assignment 3 More SYS/BIOS Goals for this Lab Assignment: 1. Introduce Software Interrupt Objects (Swis) 2. Introduce 2 X 20 character LCD functions. 3. Investigate an issue with 32 bit

More information

DOMAIN TECHNOLOGIES. Getting Started Guide Version 1.1. BoxView IDE. Integrated Development Environment

DOMAIN TECHNOLOGIES. Getting Started Guide Version 1.1. BoxView IDE. Integrated Development Environment Getting Started Guide Version 1.1 BoxView IDE Integrated Development Environment Table of Contents INTRODUCTION...3 System Requirements...3 INSTALLATION...4 License Server...4 Registration...5 Node Locked

More information

5. Synchronization. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

5. Synchronization. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn 5. Synchronization Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn operating system Synchronization 3 Review - thread on single core Process 1 p1 threads Process N threads

More information

Programming Assignment #4 Writing a simple parallel port device driver

Programming Assignment #4 Writing a simple parallel port device driver Programming Assignment #4 Writing a simple parallel port device driver Value: (See the Grading section of the Syllabus.) Due Date and Time: (See the Course Calendar.) Summary: This is your second exercise

More information

Exam Concurrent and Real-Time Programming

Exam Concurrent and Real-Time Programming LUNDS TEKNISKA HÖGSKOLA 1(6) Institutionen för datavetenskap Exam Concurrent and Real-Time Programming 2009 12 16, 08.00 13.00 You are allowed to use the Java quick reference and a calculator. Also dictionaries

More information

Drools Tools Reference Guide. Version: CR1

Drools Tools Reference Guide. Version: CR1 Drools Tools Reference Guide Version: 5.0.0.CR1 1. Introduction... 1 1.1. What is Drools?... 1 1.2. Drools Tools Key Features... 1 1.3. Other relevant resources on the topic... 2 2. Creating a New Drools

More information

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

Laboratory 1: Eclipse and Karel the Robot

Laboratory 1: Eclipse and Karel the Robot Math 121: Introduction to Computing Handout #2 Laboratory 1: Eclipse and Karel the Robot Your first laboratory task is to use the Eclipse IDE framework ( integrated development environment, and the d also

More information

INF 111 / CSE 121. Homework 3: Code Reading

INF 111 / CSE 121. Homework 3: Code Reading Homework 3: Code Reading Laboratory Date: Thursday, July 2, 2009 Take Home Due: Monday, July 2, 2009 Name : Student Number : Laboratory Time : Instructions for the Laboratory Objectives Open a project

More information

LARGE SCALE IP ROUTING

LARGE SCALE IP ROUTING Building ISP Networks Xantaro Page 1 / 18 TABLE OF CONTENTS 1. LAB ACCESS 4 1.1 Accessing the Jumphost... 4 1.2 Access to your routers... 4 1.3 Local Network Topology... 5 1.4 Global Network Topology...

More information

CSC207 Week 4. Larry Zhang

CSC207 Week 4. Larry Zhang CSC207 Week 4 Larry Zhang 1 Logistics A1 Part 1, read Arnold s emails. Follow the submission schedule. Read the Q&A session in the handout. Ask questions on the discussion board. Submit on time! Don t

More information

ETSF05: Internet Protocol Routing Project Assignment

ETSF05: Internet Protocol Routing Project Assignment Dept of Electrical and Information Technology 2014-11-10 Jens A Andersson vers 7.0.5 ETSF05: Internet Protocol Routing Project Assignment 1 Introduction The goal of this project is to study two different

More information

Atropos User s manual

Atropos User s manual Atropos User s manual Jan Lönnberg 22nd November 2010 1 Introduction Atropos is a visualisation tool intended to display information relevant to understanding the behaviour of concurrent Java programs,

More information

Reminder from last time

Reminder from last time Concurrent systems Lecture 2: More mutual exclusion, semaphores, and producer-consumer relationships DrRobert N. M. Watson 1 Reminder from last time Definition of a concurrent system Origins of concurrency

More information

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise

More information

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0.

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0. 3 TUTORIAL Figure 1-0. Table 1-0. Listing 1-0. In This Chapter This chapter contains the following topics: Overview on page 3-2 Exercise One: Building and Running a C Program on page 3-4 Exercise Two:

More information

Introduction to programming the FRDM/MBED in Java David J. https://www.cs.kent.ac.uk/~djb/

Introduction to programming the FRDM/MBED in Java David J. https://www.cs.kent.ac.uk/~djb/ Introduction to programming the FRDM/MBED in Java David J. Barnes d.j.barnes@kent.ac.uk @kentdjb https://www.cs.kent.ac.uk/~djb/ Introduction This document is an introduction to programming a FRDM/MBED

More information

Synchronization (Part 2) 1/40

Synchronization (Part 2) 1/40 1/40 Learning Objectives Understand and apply the monitor concept to solve synchronization problems in concurrent programs Understand and apply the concept of condition variables in monitors Understand

More information

Fall 2004 CS414 Prelim 1

Fall 2004 CS414 Prelim 1 Fall 2004 CS414 Prelim 1 1. The Sim City Smoking Ban problem: In the Sim-City community Woobish most people smoke, but the laws of Sim City require that non-smokers be protected from passive smoke. So

More information

How to program with Matlab (PART 1/3)

How to program with Matlab (PART 1/3) Programming course 1 09/12/2013 Martin SZINTE How to program with Matlab (PART 1/3) Plan 0. Setup of Matlab. 1. Matlab: the software interface. - Command window - Command history - Section help - Current

More information

Performance of Telecommunication Networks

Performance of Telecommunication Networks MONASH UNIVERSITY DEPARTMENT OF ELECTRICAL & COMPUTER SYSTEMS ENGINEERING Performance of Telecommunication Networks Experiment V: Introduction to Modeling Wireless Networks and Their Network Layer Protocols

More information

SmartCVS Tutorial. Starting the putty Client and Setting Your CVS Password

SmartCVS Tutorial. Starting the putty Client and Setting Your CVS Password SmartCVS Tutorial Starting the putty Client and Setting Your CVS Password 1. Open the CSstick folder. You should see an icon or a filename for putty. Depending on your computer s configuration, it might

More information

Using LookoutDirect. Overview of the Process Development Cycle

Using LookoutDirect. Overview of the Process Development Cycle 5 Overview of the Process Development Cycle The first step in developing a process file is creating a process file. After the file is created, control panels are added. Control panels are windows you use

More information

EECS 678: Intro to Operating Systems Programming Assignment 3: Virtual Memory in Nachos

EECS 678: Intro to Operating Systems Programming Assignment 3: Virtual Memory in Nachos EECS 678: Intro to Operating Systems Programming Assignment 3: Virtual Memory in Nachos 1. Introduction 2. Background 3. Assignment 4. Implementation Details 5. Implementation Overview 6. Testing and Validation

More information

Assignment 1. Application Development

Assignment 1. Application Development Application Development Assignment 1 Content Application Development Day 1 Lecture The lecture provides an introduction to programming, the concept of classes and objects in Java and the Eclipse development

More information

Operating System Services

Operating System Services CSE325 Principles of Operating Systems Operating System Services David Duggan dduggan@sandia.gov January 22, 2013 Reading Assignment 3 Chapter 3, due 01/29 1/23/13 CSE325 - OS Services 2 What Categories

More information

CS 134 Programming Exercise 3:

CS 134 Programming Exercise 3: CS 134 Programming Exercise 3: Repulsive Behavior Objective: To gain experience implementing classes and methods. Note that you must bring a program design to lab this week! The Scenario. For this lab,

More information

THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II)

THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II) THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II) The exam will contain: 6 questions (3 for each part) Time

More information

cs 140 project 1: threads 9 January 2015

cs 140 project 1: threads 9 January 2015 cs 140 project 1: threads 9 January 2015 git The basics: git clone git add git commit git branch git merge git stash git pull git push git rebase git Some guidelines & ideas: Write helpful commit and stash

More information

Synchronization 1. Synchronization

Synchronization 1. Synchronization Synchronization 1 Synchronization key concepts critical sections, mutual exclusion, test-and-set, spinlocks, blocking and blocking locks, semaphores, condition variables, deadlocks reading Three Easy Pieces:

More information

Getting Started with the HCS12 IDE

Getting Started with the HCS12 IDE Getting Started with the HCS12 IDE B. Ackland June 2015 This document provides basic instructions for installing and using the MiniIDE Integrated Development Environment and the Java based HCS12 simulator.

More information

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control Interrupts and Time Real-Time Systems, Lecture 5 Martina Maggio 28 January 2016 Lund University, Department of Automatic Control Content [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts

More information

UNIVERSITY OF OSLO. Faculty of Mathematics and Natural Sciences

UNIVERSITY OF OSLO. Faculty of Mathematics and Natural Sciences Page 1 UNIVERSITY OF OSLO Faculty of Mathematics and Natural Sciences Exam in : FYS4220/ FYS9220 Day of exam : 16. December 2010 Exam hours : 09.00 13.00 This examination paper consists of 6 page(s). Appendices:

More information

Xilinx Vivado/SDK Tutorial

Xilinx Vivado/SDK Tutorial Xilinx Vivado/SDK Tutorial (Laboratory Session 1, EDAN15) Flavius.Gruian@cs.lth.se March 21, 2017 This tutorial shows you how to create and run a simple MicroBlaze-based system on a Digilent Nexys-4 prototyping

More information

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts Content Interrupts and Time Real-Time Systems, Lecture 5 [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts Martina Maggio 25 January 2017 Lund University, Department of Automatic

More information

Computer Basics: Step-by-Step Guide (Session 2)

Computer Basics: Step-by-Step Guide (Session 2) Table of Contents Computer Basics: Step-by-Step Guide (Session 2) ABOUT PROGRAMS AND OPERATING SYSTEMS... 2 THE WINDOWS 7 DESKTOP... 3 TWO WAYS TO OPEN A PROGRAM... 4 DESKTOP ICON... 4 START MENU... 5

More information

Mr.Kailley s AP Chem programming Unit Set up instruction sheet for PC s (Mac will be kind of similar: good luck) 1) Go to the following website:

Mr.Kailley s AP Chem programming Unit Set up instruction sheet for PC s (Mac will be kind of similar: good luck) 1) Go to the following website: Mr.Kailley s AP Chem programming Unit Set up instruction sheet for PC s (Mac will be kind of similar: good luck) 1) Go to the following website: https://www.easyeclipse.org/site/distributions/desktop-java.html

More information

Good Coding Practices Spring 2018

Good Coding Practices Spring 2018 CS18 Integrated Introduction to Computer Science Fisler, Nelson Contents Good Coding Practices Spring 2018 1 Introduction 1 2 The Don ts 1 3 The Dos 4 4 CS 18-Specific Practices 5 5 Style 6 1 Introduction

More information

F28335 ControlCard Lab1

F28335 ControlCard Lab1 F28335 ControlCard Lab1 Toggle LED LD2 (GPIO31) and LD3 (GPIO34) 1. Project Dependencies The project expects the following support files: Support files of controlsuite installed in: C:\TI\controlSUITE\device_support\f2833x\v132

More information

Virtual Machine Design

Virtual Machine Design Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview

More information

Lab 9 Loops, Debugging

Lab 9 Loops, Debugging Lab 9 Loops, Debugging The following exercises are to be completed during lab class. If you do not have time to finish during lab, they must be completed before the beginning of the following lab session.

More information

Lab 3a: Scheduling Tasks with uvision and RTX

Lab 3a: Scheduling Tasks with uvision and RTX COE718: Embedded Systems Design Lab 3a: Scheduling Tasks with uvision and RTX 1. Objectives The purpose of this lab is to lab is to introduce students to uvision and ARM Cortex-M3's various RTX based Real-Time

More information

Exam Concurrent and Real-Time Programming

Exam Concurrent and Real-Time Programming LUNDS TEKNISKA HÖGSKOLA 1(12) Institutionen för datavetenskap Exam Concurrent and Real-Time Programming 2014 01 07, 08.00 13.00 You are allowed to use the Java quick reference and a calculator. Also dictionaries

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 7/8: Synchronization (1) Administrivia How is Lab going? Be prepared with questions for this weeks Lab My impression from TAs is that you are on track

More information

Instructions PLEASE READ (notice bold and underlined phrases)

Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercises wk05 More Debugging with NetBeans Required Reading None Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercise has three parts: A. Lab Demo Watch Demo, reproduce it, show

More information

AP Computer Science A Magpie Chatbot Lab Student Guide

AP Computer Science A Magpie Chatbot Lab Student Guide AP Computer Science A Magpie Chatbot Lab Student Guide The AP Program wishes to acknowledge and thank Laurie White of Mercer University, who developed this lab and the accompanying documentation. Activity

More information

CPS 310 first midterm exam, 10/6/2014

CPS 310 first midterm exam, 10/6/2014 CPS 310 first midterm exam, 10/6/2014 Your name please: Part 1. More fun with fork and exec* What is the output generated by this program? Please assume that each executed print statement completes, e.g.,

More information

EE121 Foundation Review Session Page 1 of 16 Winter Learning to Love Xilinx Foundation 4.1i in 40 Easy Steps

EE121 Foundation Review Session Page 1 of 16 Winter Learning to Love Xilinx Foundation 4.1i in 40 Easy Steps EE121 Foundation Review Session Page 1 of 16 Learning to Love Xilinx Foundation 4.1i in 40 Easy Steps You all know how to design and implement a digital circuit with Foundation. But sometimes going from

More information

Getting Started (1.8.7) 9/2/2009

Getting Started (1.8.7) 9/2/2009 2 Getting Started For the examples in this section, Microsoft Windows and Java will be used. However, much of the information applies to other operating systems and supported languages for which you have

More information

NI LabView READ THIS DOCUMENT CAREFULLY AND FOLLOW THE INSTRIUCTIONS IN THE EXERCISES

NI LabView READ THIS DOCUMENT CAREFULLY AND FOLLOW THE INSTRIUCTIONS IN THE EXERCISES NI LabView READ THIS DOCUMENT CAREFULLY AND FOLLOW THE Introduction INSTRIUCTIONS IN THE EXERCISES According to National Instruments description: LabVIEW is a graphical programming platform that helps

More information

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java) Goals - to learn how to compile and execute a Java program - to modify a program to enhance it Overview This activity will introduce you to the Java programming language. You will type in the Java program

More information

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. 1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. What will be the ratio of page faults for the following replacement algorithms - FIFO replacement

More information

1 Process Coordination

1 Process Coordination COMP 730 (242) Class Notes Section 5: Process Coordination 1 Process Coordination Process coordination consists of synchronization and mutual exclusion, which were discussed earlier. We will now study

More information

Synchronization I. Jo, Heeseung

Synchronization I. Jo, Heeseung Synchronization I Jo, Heeseung Today's Topics Synchronization problem Locks 2 Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Also, to coordinate

More information

Lab 5 Random numbers!

Lab 5 Random numbers! Lab 5 Random numbers! ADT:s as Programming Tools! D0010E! Lecture 13! Iterators! MasterMind Reminder: Groups must have their designs approved before any actual programming is allowed to start. Some review

More information

Getting Started with Web Services

Getting Started with Web Services Getting Started with Web Services Getting Started with Web Services A web service is a set of functions packaged into a single entity that is available to other systems on a network. The network can be

More information

Quick Guide. Choose It Maker 2. Overview/Introduction. ChooseIt!Maker2 is a motivating program at first because of the visual and musical

Quick Guide. Choose It Maker 2. Overview/Introduction. ChooseIt!Maker2 is a motivating program at first because of the visual and musical Choose It Maker 2 Quick Guide Created 09/06 Updated SM Overview/Introduction This is a simple to use piece of software that can be tailored for use by children as an alternative to a pencil and paper worksheet,

More information

Operating Systems. Synchronization

Operating Systems. Synchronization Operating Systems Fall 2014 Synchronization Myungjin Lee myungjin.lee@ed.ac.uk 1 Temporal relations Instructions executed by a single thread are totally ordered A < B < C < Absent synchronization, instructions

More information

Using the Zoo Workstations

Using the Zoo Workstations Using the Zoo Workstations Version 1.86: January 16, 2014 If you ve used Linux before, you can probably skip many of these instructions, but skim just in case. Please direct corrections and suggestions

More information

Lab Exercise 6: Abstract Classes and Interfaces CS 2334

Lab Exercise 6: Abstract Classes and Interfaces CS 2334 Lab Exercise 6: Abstract Classes and Interfaces CS 2334 September 29, 2016 Introduction In this lab, you will experiment with using inheritance in Java through the use of abstract classes and interfaces.

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst What is a Monitor? Ties data and the synchronization operations together Monitors guarantee mutual exclusion, i.e.,

More information