SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Lost-and-not-found power supply – Quick-Quiz (Ungraded) – Use interrupts in a Linux/C.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Introduction to Rexx Prof. Chris GauthierDickey COMP 2400: Unix Tools.
Information Networking Security and Assurance Lab National Chung Cheng University 1 if condition Condition is defined as: "Condition is nothing but comparison.
Bash, part 2 Prof. Chris GauthierDickey COMP Unix Tools.
Bash Shell Scripting 10 Second Guide Common environment variables PATH - Sets the search path for any executable command. Similar to the PATH variable.
UNIX Shell Scripting > Echo “A quick how-to”. What is shell scripting? Interpreted (non-compiled) language Slower compared to compiled languages Much.
Shell Programming, or Scripting Shirley Moore CPS 5401 Fall August 29,
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Introduction to Python
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Shell Scripting Todd Kelley CST8207 – Todd Kelley1.
CSC Java Programming, Fall, 2008 Week 2: Java Data Types, Control Constructs, and their C++ counterparts, September 4.
GNU Compiler Collection (GCC) and GNU C compiler (gcc) tools used to compile programs in Linux.
Shell Scripting AFNOG IX Rabat, Morocco May 2008.
1 Week 2 The Crunchy Shell to the Soft and Chewy Kernel… Sarah Diesburg 8/3/2010 COP4610 / CGS5765.
CS2852 Week 2, Class 1 Today Generics (Section 051) Big-O runtime analysis Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See.
SE-1021 Software Engineering II Week 8, Class 1 Return Exam Producing UML diagrams automatically in EA Poll Everywhere Files Tomorrow Week 6 HW due (if.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
SE-3910 Real-time Systems Week 7, Class 1 – GStreamer – QT SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling, Some from.
Today Quiz Multithreading Options Qt socket buffers between threads Quiz today & Tuesday in lab SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr.
SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –
Introduction to Unix – CS 21
CS-2852 Data Structures Week 5, Class 2 – Testing and Stacks Announcement: Lab Demos - 2/3 & 4 on Friday Testing  Definitions, Example  (tentative) Testing.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
CSCI 330 UNIX and Network Programming Unit IX: Shell Scripts.
Introduction to Scripting Workshop October
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
1 Unix/Linux commands and shell programming-Part 2 (Dr. Mohamed El Bachir Menai)
SE-3910 Real-time Systems Week 7, Class 1 – Announcement – GStreamer – Bins Boardshots – QT Swing & Qt Signals & Slots – Code – Example SE Dr. Josiah.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Today Return Quiz First release of final project template Multithreading Options Qt socket buffers between threads Tomorrow: Quiz Interthread communication.
Lab 8 Overview Apache Web Server. SCRIPTS Linux Tricks.
CS2852 Week 6, Class 2 Today Class exercise: Implementing a recursive method Binary Search Trees Tomorrow: Quiz at start of lab Implementing a recursive.
Today Return Quiz First true release of final project (Lab 8) Multithreading Options Qt socket buffers between threads SE-2811 Slide design: Dr. Mark L.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
CS2852 Week 2, Class 2 Today Big-O runtime analysis Linked Lists Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See next slide)
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Shell Scripting September 27, 2004 Class Meeting 6, Part II * Notes adapted by Lenwood Heath from previous work by other members of the CS faculty at Virginia.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Linux Administration Working with the BASH Shell.
Introduction to Scripting Workshop February 23, 2016.
SE3910 Week 8, Class 2 Week 4 Lab: Please return your graded Lab 4 to me so I can enter it in my gradebook Week 7, Class 2 (Wednesday) Half-Exam 2 Done.
SE3910 Week 8, Class 3 Week 4 Lab: Please return your graded Lab 4 to me so I can enter it in my gradebook Week 9 Lab: Individual demos of working sub-modules.
CS-2852 Data Structures Week 5, Class 3 – Testing and Recursion Queue Implementing finite queues Binary Search Recursion Tomorrow – Quiz, Lab demos, Lab.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
CIRC Winter Boot Camp 2017 Baowei Liu
CSC 352– Unix Programming, Spring 2016, Final Exam Guide
Chapter 9 Shell Programming
SE-3910 Real-time Systems Week 10, Class 3 Loop jamming
Slide style: Dr. Hornick
Lab: ssh, scp, gdb, valgrind
What is Bash Shell Scripting?
SE-1021 Software Engineering II
Slide design: Dr. Mark L. Hornick
CSE 303 Concepts and Tools for Software Development
SE-1021 Software Engineering II
Polling vs. Interrupts CS2852 4/9/2019
CSC 352– Unix Programming, Fall, 2011
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
Basic shell scripting CS 2204 Class meeting 7
Presentation transcript:

SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Lost-and-not-found power supply – Quick-Quiz (Ungraded) – Use interrupts in a Linux/C environment Watchdog follow-up – Watchdog demo – (Tentative) HOW to set time-out for watchdog – Bash Scripting – Real-Time OS’s SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling, Some from Dr. Hornick, etc. 1

Quick Quiz! (1) How do you get a reference (pointer) to the first element in an array? int x[5] = {1,2,3,4,5} boolean foo(int *ip); a)foo(&x); b)foo(&x[0]); c)foo(x); d)foo(x[0]); SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 2

Quick Quiz! (2) How do you get a reference (pointer) to the second element in an array? int x[5] = {1,2,3,4,5} boolean foo(int *ip); a)foo(&x+1); b)foo(&x[0]); c)foo(x+1); d)foo(x[0]); e)foo(&(x+1)); SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 3

Real-Time Operating Systems What does an operating system REALLY need? – Essential Scheduler Memory allocation (e.g. malloc) File system Interrupts – Important Protection (security) (if on network) – Less important Networking Protection (security) (if off network) – Nice to have GUI Virtual memory Multithreading SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 4

UNIX Operating System Common driver strategies – Write to a file – Read from a file – ioctl (system call) – Short programs that wrap ioctl calls – [Addendum] “system calls” from C programs (which don’t really call the kernel, but rather execute the short command-line programs mentioned above or execute a program that reads/writes from a file… SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 5

Scripting Why learn scripting? – Faster to write than compiled code Why learn command-line (bash) scripting? – Command line works very naturally with files – UNIX/Linux runs on files SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 6

Starting a Script (More details)More details Put the following into a file (e.g. script) #!/bin/bash echo "Hello World" # other fun Now, run this command to make it executable chmod u+x script Now run the script like this:./script SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 7

Variables Set a variable export myVar="This is a variable" Read a variable, printing to standard out: echo $myVar Increment a Variable export myVar=$((myVar+1)) Other integer math export myVar=$((myVar+1)) SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 8

Arguments Suppose we run our script like this:./script arg1 arg2 arg3 And inside the script, we run this command: echo "argument 3 is: $3" This will print: argument 3 is: arg3 SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 9

Quoting - Escapes Suppose we run./script "this is a test" "of" "arguments" The quotes group the words … echo "arg1: $1" echo "arg2: $2" echo "arg3: $3" will print arg1: this is a test arg2: of arg3: arguments SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 10

Quoting - Escapes In the example from the previous section, echo "arg1: $1" prints arg1: this is a test but echo 'arg1: $1' prints arg1: $1 Escapes (e.g. "\\, \n, \r") are also useful. SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 11

Quoting Challenge: How do I run an ssh command like this – ssh host “command to run” But give “to run” as a single argument? Hint: Use escapes! Hint2: Command to run will be interpretted twice. SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 12

Conditionals (More details) (UPDATED link at end of lab)More details Comparison if test "$var1" = "$var2”; then echo "true" else echo "false" fi If file “$var1” exists… if test –e "$var1"; then echo "true" fi SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 13

“Counting” Loops Counting loop (my preferred approach) for i in `seq 1 10`; do echo $i; done; Processing files in current directory for i in *.pdf; do echo cp $i ${i/.pdf}.bak.pdf; done; # (Untested – test before use!) SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 14

“Sentinal” loops Loop while command succeeds (returns 0) while command echo "looping" done; Keep looping as long as the command fails. while !command echo "looping" done; Keep looping as long as test is “true” while test … echo "looping" done; SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 15

Useful commands – sleep 0.5 will sleep for half a second – time command args1 arg2 arg3 – will measure how long it takes – command arg1 arg2 arg3 to run SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 16

References for scripting One of the main resources linked from above: For if test …, I like this one better Guide/html/sect_07_01.html Intro to variables (possibly useful) eter-substitution.html eter-substitution.html SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 17

Watchdog On the Beaglebone og-timer og-timer Open the file /dev/watchdog Do not close the file Write something (e.g. "\n") to the file at least every 59 seconds to keep the system running DEMO Yes, it is possible to change the time. DEMO? DETAILS? SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 18

Command-Line Cheat-sheet I’m working on one I’ve got links to online ones I like Just ask me SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 19

Demo – Connecting to Beaglebone [TODO] – I plan to put instructions for setting up a DHCP server on your laptop using “connection sharing” – You know my number. SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 20

Demo – Watchdog [See computer] SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling 21