Computer Science An Introduction and Some Advanced Concepts Too! Prof. Paul Sivilotti Dept. of Computer & Info. Science The Ohio State University

Slides:



Advertisements
Similar presentations
Using a Recipe and Types of Recipes Culinary Basics LSHS.
Advertisements

Recipes.
Understanding Recipes
Computer Science and Engineering The Ohio State University To Ponder Does a problem get easier or harder to solve if I give you less information?
Introduction to Programming
Amazing pancakes! ((FROM SCRATCH!!)) Created by Jaime Kolbe ;)
Fractions with Mom’s Chocolate Chip Jumbles By Margie MacDonald.
Fruit Salad. What is fruit salad? Fruit salad is a delicious, healthy snack or dessert. You can eat it on its own or with ice-cream or yoghurt. It can.
 You will be creating a dessert for a banquet.  Who will the banquet be for?  The banquet will be for 22 people  Menu: Dessert (two different kinds)
MEASUREMENT MAN © Jennifer Choquette.
By Brianne and Lacey This presentation is going to explain to you how to make chocolate chip cookies. Supplies Ingredients Directions It will include:
1.02 I Preparation Tasks List
White Chocolate Orange Cookies. 1 cup butter softened 1/2 cup white sugar 1/2 cup brown sugar 1 egg 1 tablespoon orange zest 2 1/4 cups all-purpose flour.
PEC Baking Fundraiser Mugg’s Baking with Fractions.
Why is it important to read through and understand all parts of the recipe?
Standards of Measurement A.Abbreviations 1.T or Tbsp 2.t or tsp 3.c 4.pt 5.qt 6.gal 7.oz 8.lb 9.f. g. 10.L T.
Algorithms: The recipe for computation What is an algorithm?
Algorithms: The recipe for computation What is an algorithm?
Problem Solving 101 DEFN An algorithm is a group of instructions (often expressed informally) for performing some task. DEFN An algorithm is a group of.
Banana Muffins Ingredients  Bananas  Flour  Baking Powder  Baking Soda  Pinch of Salt  Eggs  Vegetable Oil  Dark Chocolate Chips  Sugar  Cinnamon.
1.02 I Preparation Tasks List 11.02I Listing Preparation Tasks.
Baking Cookies English Club eats chocolate chip cookies!
RECIPE. NAME: Three chocolates cake. INGREDIENTS 3 cups 1 1/2 tsp 3/4 tsp 1 1/2 tsp 2 2/3 cups 1 cup + 2 Tb 1 cup + 2 Tb 1 cup + 2 Tb 5 large or 4 Jumbo.
Algorithms: The recipe for computation What is an algorithm?
1 Computers Can’t Cook! Programming Methodology Girls Engaged in Math and Science, June 2012 Bri Chapman.
Sugar VS Splenda Which batch of sugar cookies are sweeter.
Computer Science & Engineering An Introduction (and Some Advanced Concepts Too!) Prof. Paul Sivilotti Dept. of Computer Science & Engineering The Ohio.
1.02 C Work Plans 1 The secret for success!. Why use a work plan? Helps meal preparation run smoothly Implement these steps: 1.02CWork Plans2 Steps 1-
The Algorithmic Model. What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples.
Instructional Video Read the Recipe Select Ingredients And Equipment Prepare The Recipe BAKING COOKIES IN THE VIRTUAL WORLD HELP About LO.
Chocolate Crackle Cookies. We’re going to enjoy a very cold Christmas festive season as usual in a few more days. I’ve learned to create imagery pictures.
Introducing 8 th Grade Girls to Fault Tolerant Computing (An Experience Report) Paul A.G. Sivilotti Murat Demirbas Dept. of Computer & Info. Science The.
How to make “chocolate chip cookies” By Class Ping Nancy 11.
Fault Tolerance Computer Programs that Can Fix Themselves! Prof’s Paul Sivilotti and Tim Long Dept. of Computer & Info. Science The Ohio State University.
Pancakes. Person 1 In a medium size bowl measure 1 c flour 2 T sugar 2 tsp baking powder 3/4 tsp salt - mix thoroughly.
Chemical Reaction Terminology
Cookies !. Ingredients: 3/4 cup granulated sugar 3/4 cup packed brown sugar 1 cup butter or margarine, softened 1 teaspoon vanilla 1 egg 2 cups Gold Medal.
Prepare a simple nutritious dish for both your sister and you. Given $10 to purchase your ingredients, explain your choice of ingredients used and the.
Reading a Recipe and Measuring
How To Make Some Chocolate Cookies. You Have To Prepare: Flour g Sugar g Baking Powder a tablespoon Chocolate g.
How to make chocolate chip cookies By Rose Savage.
Math on the Menu By Lauren.
Reading Recipes Unscramble the following sentence: “Reebof uyo can eb a dgoo okco, uyo tmsu sitrf eanrl ot aerd a eeiprc.” “Before you can be a good cook,
Measurements and Equivalents. Recipe Basics Recipe Adjustments.
+ Chocolate Chip Cookies Diamond Britton. + Recipe (2 dozen) 1 teaspoon baking soda 1 teaspoon vanilla extract 1 large egg 1 cup flour 1 teaspoon salt.
Grease and lightly flour an 8x8x2-inch baking pan. Melt chocolate and butter; cool. Stir together flour, baking powder, and ¼ teaspoon salt. In a mixer.
How to Make Chocolate Chip Cookies
RECIPE YIELDS. Increasing (+) and Decreasing (-) Recipe Yields When changes are made to the recipe yield and ingredients, it is usually necessary to make.
How to Make Chocolate Chip Cookies Fast, Easy, and Yummy Original Author Unknown Modified By: CTAE Resource Network.
Cheddar Bay Biscuits Weekly Recipe. Ingredients YIELDS- 9 biscuits 2 1⁄2 cups Bisquick baking mix 4 tablespoons cold butter 1 cup sharp cheddar cheese,
The cookies. ingredients for cookies 250 g butter g chocolate chips - 2 eggs g flour g of sugar g of brown sugar - 1 teaspoon.
Pierre Kerboriou Chocolate Fairy Cake Less than 30min preparation time.
Individual Chocolate Layer Cakes
Cookies’ recipe ingredients directions Help ! 225 g flour Melt butter.
Math on the Menu By Lauren Bartlett.
Cookies.
A recipe for chocolate cake.
CHOCOLATE Method Sugar, vanilla sugar and water are put in a cracker to boil: Cool the syrup with butter to work with it and pour over homogenized powdered.
How can we do cookies ?. How can we do cookies ?
Pancake Poppers INGREDIENTS
Algorithms: The recipe for computation
By: Emily, Jacob, Julia, and Manisha
Recipes.
Abbreviations.
Let’s make Cookies!.
Cookie Chemistry Ms. Chang.
Algorithms vs. Programming
Fudgy Chocolate Brownies Recipe
Algorithms: The recipe for computation
Algorithms vs. Programming
Presentation transcript:

Computer Science An Introduction and Some Advanced Concepts Too! Prof. Paul Sivilotti Dept. of Computer & Info. Science The Ohio State University

Computers Are All Around

The 1 st Computer Scientist Ada Byron King, Countess of Lovelace

Computers and Programs Computer: a device that “computes” Takes inputs, produces output Becoming smaller, faster, cheaper Program: sequence of instructions How to produce the output Must be specific Becoming larger and more complicated!

Now We’re Cooking! Computer = chef Program = recipe 1. Preheat oven to 350 o 2. Sift together flour, cocoa, baking powder, salt 3. Melt 1/2c butter and 1lb chocolate 4. Stir 1/2c sugar into chocolate mixture 5. Sir in 3 large eggs 6. Stir in dry ingredients 7. Add chocolate chunks 8. Form into rounded balls (1T each) 9. Bake 10 min

Computing Choc. Cookies 2 tbsp cocoa 1 tsp baking pwdr 3 eggs 1 ¼ c flour ¾ tsp salt ½ c butter ½ c sugar 1 lb chocolate 36 chocolate chip cookies Sequence of instructions

Software Engineering A software engineer builds programs Design, develop, test, modify, maintain Program requirements? Most important: ingredients and final dish! (Also: time, space) For the same requirements, many solutions Good recipes are correct Good recipes are easy to understand Good recipes are easy to change

Module I: Write a Program Robots on a grid Stack of index cards Each is an instruction for robot fwd 1, turn, pick up, … Requirements: Robot initial position Robot goal(s) Other constraints Your task: write a program for the robot! A sequence of cards Robot follows program

Now We’re Cooking! Computer = chef Program = recipe 1. Preheat oven to 350 o 2. Sift together flour, cocoa, baking powder, salt 3. Melt 1/2c butter and 1lb chocolate 4. Stir 1/2c sugar into chocolate mixture 5. Sir in 3 large eggs 6. Stir in dry ingredients 7. Add chocolate chunks 8. Form into rounded balls (1T each) 9. Bake 10 min

Time Required 1. Preheat oven 2. Dry ingredients 3. Melt chocolate 4. Add sugar 5. Add eggs 6. Combine wet & dry 7. Add chocolate chunks 8. Form into balls 9. Bake 5 min 6 min 2 min 1 min 10 min Total: 35 min

Two Chefs 1. Melt chocolate/Dry ingredients 2. Add sugar 3. Add eggs 4. Combine wet & dry 5. Add chocolate chunks 6. Form into balls 7. Bake 6 min 5 min 2 min 1 min 5 min 5 min 10 min Total: 25 min (> 35/2)

Lots of Chefs Total: 20 min 1. Melt choc/Dry ingr 2. Add sugar 3. Add eggs 4. Combine wet & dry 5. Add choc chunks 6. Form into balls 7. Bake 6 min 1 min 1 min 2 min 1 min 2 min 1 min 0 min 0 min 0 min 0 min … 10 min

Diminishing Returns # of chefs time ideal recipe 2 actual

A Sorting Program: BubbleSort

Time Required (Bubblesort) After going down the whole list, what can we say about the result? After going down the whole list twice, what can we say about the result?

A Faster Program

Another Parallel Program To figure out where a number goes: Count how many numbers are smaller! Do this for each number in parallel!

Summary Sequential programs are slow Use as many chefs as possible! Every day they get faster and cheaper New recipes are needed that scale efficiently Note: increased complexity of recipe So we need new ways to design these complex recipes

Module II: Parallel Program Sequential program: Bubble Sort Parallel programs: Even-Odd Transposition Sort Radix Sort

Fault-Tolerance Sometimes, when a program runs, things go wrong: a fault Faults are rare, but do occur Oven doesn’t work! Cookies end up gloopy No eggs in pantry! Chef stops, doesn’t know what to do (no cookies) Use salt by accident instead of sugar! Cookies end up gross “Fault-tolerant”: a program that still does the right thing, despite faults The program heals itself, and recovers

Making Sure the Cookies Turn Out How can you improve the odds of getting a good batch of cookies? Answer: use many chefs! Each chef makes a complete recipe Pick the best batch Even if some chefs experience faults, most will not “Triple Modular Redundancy” Simple, expensive

Tokens for Taking Turns Consider all the chefs across the city Say they need to take turns Only one can be on vacation at a time How do they coordinate when to go on vacation? Solution: use a “token” Pass token around Rule: If you have the token, you can go on vacation

Tokens Ring Problem: What about faults? What happens if token is lost? One fault means disaster!

Prevent Loss of Token Rule (for most chefs): if left neighbor is different from me, then I have the token Make my number equal to that neighbor’s

Fault: Corruption of Values Problem: multiple tokens in ring Tokens chase each other around ring One fault means disaster

Dijkstra’s Token Ring Use more than 2 values! Same rule If left neighbor different from me: I have the token! (use it) Change my value to be equal to neighbor Again, one chef is special If left neighbor same as me I have the token (use it) Change my value to be one bigger

Module III: Token Rings Form a ring Each person has number cards Each person has a chime When you get the token: Play your chime Then change your number We’ll run different versions I’ll introduce “faults” and see if you can recover!

Take-Home Messages Computer program: a sequence of instructions A recipe for a chef Software engineering: how to design programs Recipe requirements: ingredients and final dish Recipe design: correct, easy to understand and modify Parallel programming: lots of chefs in the kitchen Sequential programs are slow, parallel programs are fast! Fault tolerance: programs can heal themselves Redundancy Distributed programs