Announcements. Today s Topics

Size: px
Start display at page:

Download "Announcements. Today s Topics"

Transcription

1 Announcements We will discuss final project ideas on Monday Three guest presenters coming to class Lab 5 is due on Wednesday Nov 4 th 1 Extensible - CSE 436 Software Networking Engineering Platform Workshop 1 Today s Topics Memory Usage Blocks System warnings Concurrency Threads Opera;ons and queues Audio Midterm 2 Extensible - CSE 436 Software Networking Engineering Platform Workshop 2

2 Memory on the iphone StarDng points for performance Load lazily Don t leak Watch your autorelease footprint Reuse memory System memory warnings are a last resort Respond to warnings or be terminated 3 Extensible - CSE 436 Software Networking Engineering Platform Workshop 3 Loading Lazily Pervasive in Cocoa frameworks Do only as much work as is required Applica;on launch ;me! Think about where your code really belongs Use muldple NIBs for your user interface If you are not using Storyboard 4 Extensible - CSE 436 Software Networking Engineering Platform Workshop 4

3 Loading a Resource Too Early What if it s not needed undl much later? Or not at all? - (id)init { self = [super init]; if (self) { // Too early... myimage = [self readsomehugeimagefromdisk]; return self; 5 Extensible - CSE 436 Software Networking Engineering Platform Workshop 5 Loading a Resource Lazily Wait undl someone actually requests it, then create it - (UIImage *) myimage { if (myimage == nill) { myimage = [self readsomehugeimagefromdisk]; Ends up benefidng both memory and launch Dme Not always the right move, consider your specific situadon NoDce that the above implementadon is not thread- safe! 6 Extensible - CSE 436 Software Networking Engineering Platform Workshop 6

4 Autorelease and You Autorelease simplifies your code Worry less about the scope and life;me of objects When an autorelease pool pops, it calls release on each object An autorelease pool is created automadcally for each iteradon of your applicadon s run loop 7 Extensible - CSE 436 Software Networking Engineering Platform Workshop 7 So What s the Catch? What if many objects are autoreleased before the pool pops? Consider the maximum memory footprint of your applicadon 8 Extensible - CSE 436 Software Networking Engineering Platform Workshop 8

5 A Crowded Pool... 9 Extensible - CSE 436 Software Networking Engineering Platform Workshop 9 Reducing Your High- Water Mark When many objects will be autoreleased, create and release your own pool Usually not necessary, don t do this without thinking! Tools can help iden;fy cases where it s needed Loops are the classic case 10 Extensible - CSE 436 Software Networking Engineering Platform Workshop 10

6 Memory AllocaDon and Leaks 11 Extensible - CSE 436 Software Networking Engineering Platform Workshop 11 Demo 12 Extensible - CSE 436 Software Networking Engineering Platform Workshop 12

7 Autorelease in a Loop Remember that many methods return autoreleased objects for (int i = 0; i < somelargenumber; i++) { NSString *string =...; string = [string lowercasestring]; string = [string stringbyappendingstring:...]; NSLog(@ %@, string); 13 Extensible - CSE 436 Software Networking Engineering Platform Workshop 13 (Old Way) CreaDng an Autorelease Pool One opdon is to create and release for each iteradon for (int i = 0; i < somelargenumber; i++) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *string =...; string = [string lowercasestring]; string = [string stringbyappendingstring:...]; NSLog(@ %@, string); [pool release]; 14 Extensible - CSE 436 Software Networking Engineering Platform Workshop 14

8 (New Way) CreaDng an Autorelease Pool One opdon is to create and release for each iteradon for (int i = 0; i < somelargenumber; i++) { NSString *string =...; string = [string lowercasestring]; string = [string stringbyappendingstring:...]; NSLog(@ %@, string); 15 Extensible - CSE 436 Software Networking Engineering Platform Workshop 15 Blocks A variable type that stores executable code Lets you create blocks of code to pass around like an object Example ^{ NSDate *date = [NSDate date]; NSLog(@ The date and Dme is %@,date); ; 16 Extensible - CSE 436 Software Networking Engineering Platform Workshop 16

9 Assigning Blocks to Variables void (^now) (void) return type name parameters void (^now) (void) = ^{ NSDate *date = [NSDate date]; NSLog(@ The date and Dme is %@,date); ; now(); 17 Extensible - CSE 436 Software Networking Engineering Platform Workshop 17 Blocks Blocks are closures They close around variables in scope when the block is declared NSDate *date = [NSDate date]; void (^now)(void) = ^{ NSLog(@ The date and Dme is %@,date); ; now(); sleep(5); date = [NSDate date]; now(); 18 Extensible - CSE 436 Software Networking Engineering Platform Workshop 18

10 Demo 19 Extensible - CSE 436 Software Networking Engineering Platform Workshop 19 Object CreaDon Overhead Most of the Dme, creadng and deallocadng objects is not a significant hit to applicadon performance In a Dght loop, though, it can become a problem... for (int i = 0; i < somelargenumber; i++) { MyObject *object = [[MyObject alloc] initwithvalue:...]; [object dosomething]; [object release]; 20 Extensible - CSE 436 Software Networking Engineering Platform Workshop 20

11 Reusing Objects Update exisdng objects rather than creadng new ones Combine intuidon and evidence to decide if it s necessary MyObject *myobject = [[MyObject alloc] init]; for (int i = 0; i < somelargenumber; i++) { myobject.value =...; [myobject dosomething]; [myobject release]; Remember - [UITableView dequeuereusablecellwithidendfier] 21 Extensible - CSE 436 Software Networking Engineering Platform Workshop 21 Memory Warnings Coexist with system applicadons Memory warnings issued when memory runs out Respond to memory warnings or face dire consequences! 22 Extensible - CSE 436 Software Networking Engineering Platform Workshop 22

12 Responding to Memory Warnings Every view controller gets didreceivememorywarning By default, releases the view if it s not visible Release other expensive resources in your subclass - (void)didreceivememorywarning { // Always call super [super didreceivememorywarning]; // Release expensive resources [expensiveresource release]; expensiveresource = nil; 23 Extensible - CSE 436 Software Networking Engineering Platform Workshop 23 What Other Resources Do I Release? Images Sounds Cached data 24 Extensible - CSE 436 Software Networking Engineering Platform Workshop 24

13 Use SQLite for Large Data Sets Many data formats keep everything in memory SQLite can work with your data in chunks 25 Extensible - CSE 436 Software Networking Engineering Platform Workshop 25 Concurrency 26 Extensible - CSE 436 Software Networking Engineering Platform Workshop 26

14 Why Concurrency? With a single thread, long- running operadons may interfere with user interacdon MulDple threads allow you to load resources or perform computadons without locking up your endre applicadon 27 Extensible - CSE 436 Software Networking Engineering Platform Workshop 27 Threads on the iphone Based on the POSIX threading API /usr/include/pthread.h Higher- level wrappers in the FoundaDon framework 28 Extensible - CSE 436 Software Networking Engineering Platform Workshop 28

15 NSThread Basics Run loop automadcally instandated for each thread Each NSThread needs to create its own autorelease pool Convenience methods for messaging between threads 29 Extensible - CSE 436 Software Networking Engineering Platform Workshop 29 (Old way) Typical NSThread Use Case - (void)someacdon:(id)sender { // Fire up a new thread [NSThread detachnewthreadselector:@selector(dowork:) withtarget:self object:somedata]; - (void)dowork:(id)somedata { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [somedata dolotsofwork]; // Message back to the main thread [self performselectoronmainthread:@selector(alldone:) withobject:[somedata result] waitundldone:no]; [pool release]; 30 Extensible - CSE 436 Software Networking Engineering Platform Workshop 30

16 (New way) Typical NSThread Use Case - (void)someacdon:(id)sender { // Fire up a new thread [NSThread detachnewthreadselector:@selector(dowork:) withtarget:self object:somedata]; - (void)dowork:(id)somedata { [somedata dolotsofwork]; // Message back to the main thread [self performselectoronmainthread:@selector(alldone:) withobject:[somedata result] waitundldone:no]; 31 Extensible - CSE 436 Software Networking Engineering Platform Workshop 31 UIKit and Threads Unless otherwise noted, UIKit classes are not threadsafe What does it mean to be thread safe? Objects must be created and messaged from the main thread 32 Extensible - CSE 436 Software Networking Engineering Platform Workshop 32

17 Demo: Threads and Xcode 33 Extensible - CSE 436 Software Networking Engineering Platform Workshop 33 Locks Protect cridcal secdons of code, mediate access to shared data NSLock and subclasses - (void)init{ mylock = [[NSLock alloc] init]; - (void)somemethod { [mylock lock]; // We only want one thread execudng this code at once [mylock unlock] 34 Extensible - CSE 436 Software Networking Engineering Platform Workshop 34

18 CondiDons NSCondiDon is useful for producer/consumer model Wait is equivalent to: unlock, sleep undl signalled, lock 35 Extensible - CSE 436 Software Networking Engineering Platform Workshop 35 The Danger of Locks Very difficult to get locking right! All it takes is one client poorly behaved client Accessing shared data outside of a lock Deadlocks Priority inversion 36 Extensible - CSE 436 Software Networking Engineering Platform Workshop 36

19 Threading Piqalls Subtle, nondeterminisdc bugs may be introduced Code may become more difficult to maintain In the worst case, more threads can mean slower code 37 Extensible - CSE 436 Software Networking Engineering Platform Workshop 37 AlternaDves to Threading Asynchronous (nonblocking) funcdons Specify target/ac;on or delegate for callback NSURLConnec;on has synchronous and asynchronous variants Timers One- shot or recurring Specify a callback method Managed by the run loop Higher level constructs like operadons 38 Extensible - CSE 436 Software Networking Engineering Platform Workshop 38

20 NSOperaDon Abstract superclass Manages thread creadon and lifecycle Encapsulate a unit of work in an object Specify priorides and dependencies 39 Extensible - CSE 436 Software Networking Engineering Platform Workshop 39 NSOperaDonQueue OperaDons are typically scheduled by adding to a queue Choose a maximum number of concurrent operadons Queue run operadons based on priority and dependencies 40 Extensible - CSE 436 Software Networking Engineering Platform Workshop 40

21 More on Concurrent Programming Grand Central Dispatch (GCD) Threading Programming Guide hsps://developer.apple.com/iphone/library/ documentadon/cocoa/conceptual/ MulDthreading 41 Extensible - CSE 436 Software Networking Engineering Platform Workshop 41 Blocks with Grand Central Dispatch (GCD) Blocks are closures They close around variables in scope when the block is declared NSDate *date = [NSDate date]; void (^now)(void) = ^{ sleep(5); NSDate *date = [NSDate date]; NSLog(@ The date and Dme is %@,date); ; //now(); dispatch_async(dispatch_get_main_queue(),now); NSLog (@ The original date is %@,date); 42 Extensible - CSE 436 Software Networking Engineering Platform Workshop 42

22 Audio 43 Extensible - CSE 436 Software Networking Engineering Platform Workshop 43 Uses for Audio Sound effects buuon clicks alert sounds short sounds accompanying user ac;ons Arbitrary length sounds (music, podcasts, spoken content) Streamed content from web services Recording audio 44 Extensible - CSE 436 Software Networking Engineering Platform Workshop 44

23 How to do it? Could be complex: Poten;ally mul;ple simultaneous sources Numerous possible outputs Dynamic events, oven out of user s control Different priori;es for seemingly similar ac;ons The OS manages the sound system You can ask for behavior, but the OS has control 45 Extensible - CSE 436 Software Networking Engineering Platform Workshop 45 CoreAudio High level, easy to use System Sound API - short sounds AVAudioPlayer class - ObjC, simple API Lower level, takes more effort but much more control Audio Toolbox - recording and playback, streaming, full control Audio Units - processing audio OpenAL - 3D posi;onal sound Which one you use depends on what you re trying to do Many of you are fine with System Sounds and AVAudioPlayer 46 Extensible - CSE 436 Software Networking Engineering Platform Workshop 46

24 Playing Short Sounds short means less than 5 seconds Very simple API, but has restricdons No looping No volume control Immediate playback Limited set of formats Linear PCM or IMA4.caf,.aif or.wav file 47 Extensible - CSE 436 Software Networking Engineering Platform Workshop 47 Playing Short Sounds Two step process Register the sound, get a sound ID in return Play the sound Op;onally can get callback when sound finishes playing NSURL *fileurl =... // url to a file SystemSoundID myid; // First register the sound AudioServicesCreateSystemSoundID ((CFURLRef)fileURL, &myid); // Then you can play the sound AudioServicesPlaySystemSound (myid); 48 Extensible - CSE 436 Software Networking Engineering Platform Workshop 48

25 Playing Short Sounds Clean up Dispose of sound ID when you re done Or if you get a memory warning SystemSoundID myid; // dispose of the previously registered sound AudioServicesDisposeSystemSoundID (myid); 49 Extensible - CSE 436 Software Networking Engineering Platform Workshop 49 ConverDng Sounds Command line udlity to convert sounds /usr/bin/afconvert Supports wide variety of input and output formats See man page for details Easily convert sounds to System Sounds formats /usr/bin/afconvert - f aiff - d BEI16 input.mp3 output.aif 50 Extensible - CSE 436 Software Networking Engineering Platform Workshop 50

26 Play longer sounds (> 5 seconds) AVAudioPlayer Locally stored files or in- memory (no network streaming) Can loop, seek, play, pause Provides metering Play muldple sounds simultaneously Cocoa- style API Ini;alize with file URL or data Allows for delegate Supports many more formats Everything the AudioFile API supports 51 Extensible - CSE 436 Software Networking Engineering Platform Workshop 51 Create from file URL or data AVAudioPlayer Simple methods for stardng/stopping AVAudioPlayer *player; NSString *path = [[NSBundle mainbundle] pathforresource...]; NSURL *url = [NSURL fileurlwithpath:path]; player = [[AVAudioPlayer alloc] initwithcontentsofurl:url]; if (!player.playing) { [player play]; else { [player pause]; 52 Extensible - CSE 436 Software Networking Engineering Platform Workshop 52

27 AVAudioPlayerDelegate Told when playback finishes Informed of audio decode errors Given hooks for handling interrupdons Incoming phone calls 53 Extensible - CSE 436 Software Networking Engineering Platform Workshop 53 OpenAL High level, cross- plaqorm API for 3D audio mixing Great for games Mimics OpenGL conven;ons Models audio in 3D space Buffers: Container for Audio Sources: 3D point emi`ng Audio Listener: Posi;on where Sources are heard More InformaDon: hsp:// 54 Extensible - CSE 436 Software Networking Engineering Platform Workshop 54

28 Playing Video Uses for Video: Provide cut- scene anima;on in a game Stream content from web sites Play local movies Play videos from applicadon bundle or remote URL Always full screen Configurable scaling modes Op;onal controls Supports:.mov,.mp4,.m4v,.3gp 55 Extensible - CSE 436 Software Networking Engineering Platform Workshop 55 Audio Demo 56 Extensible - CSE 436 Software Networking Engineering Platform Workshop 56

29 Midterm 57 Extensible - CSE 436 Software Networking Engineering Platform Workshop 57 Midterm Midterm Grades Average = 88% Median = 89% 58 Extensible - CSE 436 Software Networking Engineering Platform Workshop 58

CS193P - Lecture 10. iphone Application Development. Performance

CS193P - Lecture 10. iphone Application Development. Performance CS193P - Lecture 10 iphone Application Development Performance 1 Announcements 2 Announcements Paparazzi 2 is due next Wednesday at 11:59pm 2 Announcements Paparazzi 2 is due next Wednesday at 11:59pm

More information

CS193P - Lecture 16. iphone Application Development. Audio APIs Video Playback Displaying Web Content Settings

CS193P - Lecture 16. iphone Application Development. Audio APIs Video Playback Displaying Web Content Settings CS193P - Lecture 16 iphone Application Development Audio APIs Video Playback Displaying Web Content Settings 1 Today s Topics Audio APIs Video Playback Settings Bundles 2 Audio Playback 3 Uses for Audio

More information

Announcements. Today s Topics

Announcements. Today s Topics Announcements Lab 4 is due on Monday by 11:59 PM Special Guest Lecture next Wednesday Nathan Gitter, former Head TA of 438 He is currently featured on the front page of the ios App Store (Monday Oct 15

More information

A little more Core Data

A little more Core Data A little more Core Data A little more Core Data NSFetchedResultsController Interacts with the Core Data database on your behalf [fetchedresultscontroller objectatindexpath:] gets at row data [fetchedresultscontroller

More information

Mobile Application Development

Mobile Application Development Object Lifecycle Mobile Application Development Creating objects Memory management Destroying objects Basic ios Development 11-Nov-11 Mobile App Development 1 11/11/11 2 Object Creation Two step process

More information

CS193p Spring 2010 Wednesday, May 26, 2010

CS193p Spring 2010 Wednesday, May 26, 2010 CS193p Spring 2010 Announcements Please e-mail if you want to take the option to present your final project next Wednesday. (You will still have until the following Tuesday to turn in your code.) No class

More information

Announcement. Final Project Proposal Presentations and Updates

Announcement. Final Project Proposal Presentations and Updates Announcement Start Final Project Pitches on Wednesday Presentation slides dues by Tuesday at 11:59 PM Email slides to cse438ta@gmail.com Extensible Networking Platform 1 1 - CSE 438 Mobile Application

More information

CS193P - Lecture 3. iphone Application Development. Custom Classes Object Lifecycle Autorelease Properties

CS193P - Lecture 3. iphone Application Development. Custom Classes Object Lifecycle Autorelease Properties CS193P - Lecture 3 iphone Application Development Custom Classes Object Lifecycle Autorelease Properties 1 Announcements Assignments 1A and 1B due Wednesday 1/13 at 11:59 PM Enrolled Stanford students

More information

AVAudioRecorder & System Sound Services

AVAudioRecorder & System Sound Services AVAudioRecorder & System Sound Services Dept. of Multimedia Science, Sookmyung Women s University. prof. JongWoo Lee Index AVAudioRecorder? - (AudioRecorder) System Sound Service? - (SysSound) AVAudioRecorder

More information

IPHONE DEVELOPMENT. Getting Started with the iphone SDK

IPHONE DEVELOPMENT. Getting Started with the iphone SDK IPHONE DEVELOPMENT Getting Started with the iphone SDK OBJECTIVE-C The Big Picture STRICT SUPERSET OF C The Objective C Language Any C stuff applies Standard libs are here (time, sqrt etc) The C Language

More information

Announcements. Today s Topics

Announcements. Today s Topics Announcements Lab 2 is due tonight Lab 3 is posted Due next Wednesday Sept 30 th 1 Extensible - CSE 436 Software Networking Engineering Platform Workshop 1 Today s Topics Designing iphone Applica;ons Model-

More information

ITP 342 Mobile App Dev

ITP 342 Mobile App Dev ITP 342 Mobile App Dev Grand Central Dispatch Background Processing Grand Central Dispatch (GCD) New API for splitting up the work your app needs to do into smaller chunks that can be spread across multiple

More information

ITP 342 Mobile App Dev. Audio

ITP 342 Mobile App Dev. Audio ITP 342 Mobile App Dev Audio File Formats and Data Formats 2 pieces to every audio file: file format (or audio container) data format (or audio encoding) File formats describe the format of the file itself

More information

Advanced Memory Analysis with Instruments. Daniel Delwood Performance Tools Engineer

Advanced Memory Analysis with Instruments. Daniel Delwood Performance Tools Engineer Advanced Memory Analysis with Instruments Daniel Delwood Performance Tools Engineer 2 Memory Analysis What s the issue? Memory is critical to performance Limited resource Especially on iphone OS 3 4 Memory

More information

Design Phase. Create a class Person. Determine the superclass. NSObject (in this case)

Design Phase. Create a class Person. Determine the superclass. NSObject (in this case) Design Phase Create a class Person Determine the superclass NSObject (in this case) 8 Design Phase Create a class Person Determine the superclass NSObject (in this case) What properties should it have?

More information

CS193E Lecture #3 Categories and Protocols Cocoa Memory Management

CS193E Lecture #3 Categories and Protocols Cocoa Memory Management CS193E Lecture #3 Categories and Protocols Cocoa Memory Management Winter 2008, Dempsey/Marcos 1 Today s Topics Questions from Assignment 1A or 1B? Categories Protocols Cocoa Memory Management Object life

More information

CS193P - Lecture 11. iphone Application Development. Text Input Presenting Content Modally

CS193P - Lecture 11. iphone Application Development. Text Input Presenting Content Modally CS193P - Lecture 11 iphone Application Development Text Input Presenting Content Modally 1 Announcements 2 Announcements Paparazzi 3 assignment is due Wednesday 2/17 2 Announcements Paparazzi 3 assignment

More information

AVAudioPlayer. avtouch Application

AVAudioPlayer. avtouch Application AVAudioPlayer avtouch Application iphone Application Index 1. iphone Application 1) iphone Application 2) iphone Application Main Method 3) iphone Application nib(.xib) 2. avtouch Application 1) avtouch

More information

Multitasking and Background Execution

Multitasking and Background Execution Multitasking and Background Execution Fall, 2012 Prof. Massimiliano "Max" Pala pala@nyu.edu Introduction Spawning Threads and Tasks Background Execution User hits 'home' button the app is sent in the background

More information

Localizing with Xcode 6

Localizing with Xcode 6 Tools #WWDC14 Localizing with Xcode 6 Best practices and new workflows Session 412 Zoltan Foley-Fisher Xcode Software Engineer! Chris Hanson Xcode Software Engineer 2014 Apple Inc. All rights reserved.

More information

ITP 342 Mobile App Dev. Audio

ITP 342 Mobile App Dev. Audio ITP 342 Mobile App Dev Audio File Formats and Data Formats 2 pieces to every audio file: file format (or audio container) data format (or audio encoding) File formats describe the format of the file itself

More information

iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5

iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5 iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5 Questions? Announcements Assignment #1 due this evening by 11:59pm Remember, if you wish to use a free late you must email me before

More information

Grand Central Dispatch and NSOperation. CSCI 5828: Foundations of Software Engineering Lecture 28 12/03/2015

Grand Central Dispatch and NSOperation. CSCI 5828: Foundations of Software Engineering Lecture 28 12/03/2015 Grand Central Dispatch and NSOperation CSCI 5828: Foundations of Software Engineering Lecture 28 12/03/2015 1 Credit Where Credit Is Due Most of the examples in this lecture were inspired by example code

More information

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Fall Stanford CS193p Fall 2010

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Fall Stanford CS193p Fall 2010 Developing Applications for iphone 4, ipod Touch, & ipad Today Blocks Language syntax for declaring a function on the fly. Grand Central Dispatch C API for leveraging blocks to make writing multithreaded

More information

Concurrency. CS 442: Mobile App Development Michael Saelee

Concurrency. CS 442: Mobile App Development Michael Saelee Concurrency CS 442: Mobile App Development Michael Saelee note: ios devices are now (mostly) multi-core; i.e., concurrency may allow for real performance gains! but the more common incentive

More information

Advanced Object- C Features

Advanced Object- C Features Advanced Object- C Features Advanced Features Proper6es Categories Protocols Delegates Selectors Key- Value Coding Predicators Proper6es Provide access to object a?ributes Shortcut to implemen6ng ge?er/se?er

More information

File System Programming Guide

File System Programming Guide File System Programming Guide Contents About Files and Directories 8 At a Glance 8 The File System Imposes a Specific Organization 8 Access Files Safely 8 How You Access a File Depends on the File Type

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 28 March 25, 2013 ExcepDons Announcements HW 08 due tonight at midnight Weirich OH: 1:30 3PM today Midterm 2 is this Friday Towne 100 last names A

More information

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin 1 Legal Info iphone is a trademark of Apple Inc. Servin is a trademark of Servin Corporation 2 Welcome Welcome! Thank you! My promise

More information

Grand Central Dispatch

Grand Central Dispatch A better way to do multicore. (GCD) is a revolutionary approach to multicore computing. Woven throughout the fabric of Mac OS X version 10.6 Snow Leopard, GCD combines an easy-to-use programming model

More information

Missing pieces + Putting the pieces together

Missing pieces + Putting the pieces together Missing pieces + Putting the pieces together EE 122, Fall 2013 Sylvia Ratnasamy http://inst.eecs.berkeley.edu/~ee122/ Material thanks to Ion Stoica, Scott Shenker, Jennifer Rexford, Nick McKeown, and many

More information

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need iphone Training Contents About iphone Training Our ios training classes can help you get off to a running start in iphone, ipod and ipad app development. Learn from expert Objective-C developers with years

More information

Cocoa. Last Week... Music 3SI: Introduction to Audio/Multimedia App. Programming. Today... Why Cocoa? Wikipedia - Cocoa

Cocoa. Last Week... Music 3SI: Introduction to Audio/Multimedia App. Programming. Today... Why Cocoa? Wikipedia - Cocoa Music 3SI: Introduction to Audio/Multimedia App. Programming IDE (briefly) VST Plug-in Assignment 1 hints Last Week... Week #5-5/5/2006 CCRMA, Department of Music Stanford University 1 2 Today... Cocoa

More information

Performance

Performance Threading Programming Guide Performance 2010-04-28 Apple Inc. 2010 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form

More information

Announcements. Today s Topics

Announcements. Today s Topics Announcements Lab 2 is due tonight by 11:59 PM Late policy is 10% of lab total per day late So -7.5 points per day late for lab 2 Labs 3 and 4 are posted on the course website Extensible Networking Platform

More information

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011 Synchronization CS61, Lecture 18 Prof. Stephen Chong November 3, 2011 Announcements Assignment 5 Tell us your group by Sunday Nov 6 Due Thursday Nov 17 Talks of interest in next two days Towards Predictable,

More information

Thread Sanitizer and Static Analysis

Thread Sanitizer and Static Analysis Developer Tools #WWDC16 Thread Sanitizer and Static Analysis Help with finding bugs in your code Session 412 Anna Zaks Manager, Program Analysis Team Devin Coughlin Engineer, Program Analysis Team 2016

More information

Media Playback and Recording. CS193W - Spring Lecture 3

Media Playback and Recording. CS193W - Spring Lecture 3 Media Playback and Recording CS193W - Spring 2016 - Lecture 3 Today Images and animated images Text input controller Media playback controller Inline video playback Playing extended audio Recording audio

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Multithreading Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to large compute clusters Can perform multiple

More information

Science. Computer Science

Science. Computer Science Introductions CS 442: Mobile App Development Michael Saelee Michael (Sae) Lee - lee@iit.edu - moss.cs.iit.edu - Office: SB 226A Agenda - Syllabus & Administrivia - Course overview Android

More information

Graphite IntroducDon and Overview. Goals, Architecture, and Performance

Graphite IntroducDon and Overview. Goals, Architecture, and Performance Graphite IntroducDon and Overview Goals, Architecture, and Performance 4 The Future of MulDcore #Cores 128 1000 cores? CompuDng has moved aggressively to muldcore 64 32 MIT Raw Intel SSC Up to 72 cores

More information

CSE Opera*ng System Principles

CSE Opera*ng System Principles CSE 30341 Opera*ng System Principles Overview/Introduc7on Syllabus Instructor: Chris*an Poellabauer (cpoellab@nd.edu) Course Mee*ngs TR 9:30 10:45 DeBartolo 101 TAs: Jian Yang, Josh Siva, Qiyu Zhi, Louis

More information

ITP 342 Advanced Mobile App Dev. Memory

ITP 342 Advanced Mobile App Dev. Memory ITP 342 Advanced Mobile App Dev Memory Memory Management Objective-C provides two methods of application memory management. 1. In the method described in this guide, referred to as manual retain-release

More information

CS-537: Midterm Exam (Fall 2013) Professor McFlub

CS-537: Midterm Exam (Fall 2013) Professor McFlub CS-537: Midterm Exam (Fall 2013) Professor McFlub Please Read All Questions Carefully! There are fourteen (14) total numbered pages. Please put your NAME (mandatory) on THIS page, and this page only. Name:

More information

Multithreaded Programming Part II. CSE 219 Stony Brook University, Department of Computer Science

Multithreaded Programming Part II. CSE 219 Stony Brook University, Department of Computer Science Multithreaded Programming Part II CSE 219 Stony Brook University, Thread Scheduling In a Java application, main is a thread on its own Once multiple threads are made Runnable the thread scheduler of the

More information

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 13 Robert Grimm, New York University 1 Review Last week Exceptions 2 Outline Concurrency Discussion of Final Sources for today s lecture: PLP, 12

More information

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013 Developing Applications for ios -14 Coming Up Wednesday Alternate Final Presentation. If you are using Alternate Presentation time, submit your Keynote by noon tomorrow (Tuesday). Submit the slides using

More information

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013 Developing Applications for ios -14 Today What is this class all about? Description Prerequisites Homework / Final Project ios Overview What s in ios? MVC Object-Oriented Design Concept Objective C (Time

More information

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc.

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc. Intro to Native ios Development Dave Koziol Arbormoon Software, Inc. About Me Long time Apple Developer (20 WWDCs) Organizer Ann Arbor CocoaHeads President & ios Developer at Arbormoon Software Inc. Wunder

More information

Specifications Document

Specifications Document Contents Specifications Document 1 The XMMS2 Client Project 2 1.1 Project Description................................ 2 1.2 Target Audience.................................. 2 1.3 Goals........................................

More information

CS193p Spring 2010 Wednesday, March 31, 2010

CS193p Spring 2010 Wednesday, March 31, 2010 CS193p Spring 2010 Logistics Lectures Building 260 (History Corner) Room 034 Monday & Wednesday 4:15pm - 5:30pm Office Hours TBD Homework 7 Weekly Assignments Assigned on Wednesdays (often will be multiweek

More information

Objective-C Runtime. Cocoa s Jewel in the Crown. NSConference Nicolas

Objective-C Runtime. Cocoa s Jewel in the Crown. NSConference Nicolas Objective-C Runtime Cocoa s Jewel in the Crown NSConference 2011 Nicolas Seriot @nst021 [isa kindof:magic] 1. Objective-C 2. Recipes 3. Introspection 4. Debugging Objective-C Runtime OO, Smalltalk-like,

More information

Announcements. Lab 3 is due on Wednesday by 11:59 PM

Announcements. Lab 3 is due on Wednesday by 11:59 PM Announcements Lab 3 is due on Wednesday by 11:59 PM Extensible Networking Platform 1 1 - CSE 438 Mobile Application Development Today s Topics Property Lists iphone s File System Archiving Objects SQLite

More information

Enabling Your App for CarPlay

Enabling Your App for CarPlay Session App Frameworks #WWDC17 Enabling Your App for CarPlay 719 Albert Wan, CarPlay Engineering 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Page 1. Challenges" Concurrency" CS162 Operating Systems and Systems Programming Lecture 4. Synchronization, Atomic operations, Locks"

Page 1. Challenges Concurrency CS162 Operating Systems and Systems Programming Lecture 4. Synchronization, Atomic operations, Locks CS162 Operating Systems and Systems Programming Lecture 4 Synchronization, Atomic operations, Locks" January 30, 2012 Anthony D Joseph and Ion Stoica http://insteecsberkeleyedu/~cs162 Space Shuttle Example"

More information

Principles of Programming Languages. Objective-C. Joris Kluivers

Principles of Programming Languages. Objective-C. Joris Kluivers Principles of Programming Languages Objective-C Joris Kluivers joris.kluivers@gmail.com History... 3 NeXT... 3 Language Syntax... 4 Defining a new class... 4 Object identifiers... 5 Sending messages...

More information

Java 9: Tips on MigraDon and Upgradability

Java 9: Tips on MigraDon and Upgradability Java 9: Tips on MigraDon and Upgradability Bernard Traversat Vice President of Development Java SE PlaJorm Oracle November, 2017 Copyright 2017, Oracle and/or its affiliates. All rights reserved. ConfidenDal

More information

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation Why are threads useful? How does one use POSIX pthreads? Michael Swift 1 2 What s in a process? Organizing a Process A process

More information

COMP 3430 Robert Guderian

COMP 3430 Robert Guderian Operating Systems COMP 3430 Robert Guderian file:///users/robg/dropbox/teaching/3430-2018/slides/04_threads/index.html?print-pdf#/ 1/58 1 Threads Last week: Processes This week: Lesser processes! file:///users/robg/dropbox/teaching/3430-2018/slides/04_threads/index.html?print-pdf#/

More information

CS193E Lecture 16. Internationalization and Localization

CS193E Lecture 16. Internationalization and Localization CS193E Lecture 16 Internationalization and Localization Announcements Final Project Due: Wed, March 19th at 11:59 PM Announcements Final Project Demos Thurs, March 20th, 3:30-6:30 Same room Plan for about

More information

Object Oriented Programming and Design in Java. Session 18 Instructor: Bert Huang

Object Oriented Programming and Design in Java. Session 18 Instructor: Bert Huang Object Oriented Programming and Design in Java Session 18 Instructor: Bert Huang Announcements Homework 4 due Mon. Apr. 19 No multithreading in programming part Final Exam Monday May 10, 9 AM - noon, 173

More information

QUIZ Friends class Y;

QUIZ Friends class Y; QUIZ Friends class Y; Is a forward declaration neeed here? QUIZ Friends QUIZ Friends - CONCLUSION Forward (a.k.a. incomplete) declarations are needed only when we declare member functions as friends. They

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

CS 47. Beginning iphone Application Development

CS 47. Beginning iphone Application Development CS 47 Beginning iphone Application Development Introductions Who, why, which? Shameless Plug: LoudTap Wifi Access (If it works..) SSID: Stanford Username/password: csp47guest Expectations This is a programming

More information

CS 160: Interactive Programming

CS 160: Interactive Programming CS 160: Interactive Programming Professor John Canny 3/8/2006 1 Outline Callbacks and Delegates Multi-threaded programming Model-view controller 3/8/2006 2 Callbacks Your code Myclass data method1 method2

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Lecture 1: Mobile Applications Development Radu Ionescu raducu.ionescu@gmail.com Faculty of Mathematics and Computer Science University of Bucharest Evaluation Individual

More information

Finding Bugs Using Xcode Runtime Tools

Finding Bugs Using Xcode Runtime Tools Session Developer Tools #WWDC17 Finding Bugs Using Xcode Runtime Tools 406 Kuba Mracek, Program Analysis Engineer Vedant Kumar, Compiler Engineer 2017 Apple Inc. All rights reserved. Redistribution or

More information

Astronomical Ada. Experience Report Swiss Ada Event 2017 White Elephant GmbH. Ada Event Astronomicial Ada White Elephant GmbH 1

Astronomical Ada. Experience Report Swiss Ada Event 2017 White Elephant GmbH. Ada Event Astronomicial Ada White Elephant GmbH 1 Astronomical Ada Experience Report Swiss Ada Event 2017 White Elephant GmbH Ada Event 2017 - Astronomicial Ada White Elephant GmbH 1 Experience report on the problems we encountered gebng a program wricen

More information

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018 CSE 4/521 Introduction to Operating Systems Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018 Overview Objective: Explore the structure of an operating system

More information

Java s Implementation of Concurrency, and how to use it in our applications.

Java s Implementation of Concurrency, and how to use it in our applications. Java s Implementation of Concurrency, and how to use it in our applications. 1 An application running on a single CPU often appears to perform many tasks at the same time. For example, a streaming audio/video

More information

Midterm Exam. October 20th, Thursday NSC

Midterm Exam. October 20th, Thursday NSC CSE 421/521 - Operating Systems Fall 2011 Lecture - XIV Midterm Review Tevfik Koşar University at Buffalo October 18 th, 2011 1 Midterm Exam October 20th, Thursday 9:30am-10:50am @215 NSC Chapters included

More information

CSC369 Lecture 2. Larry Zhang

CSC369 Lecture 2. Larry Zhang CSC369 Lecture 2 Larry Zhang 1 Announcements Lecture slides Midterm timing issue Assignment 1 will be out soon! Start early, and ask questions. We will have bonus for groups that finish early. 2 Assignment

More information

CSE 333 Lecture 9 - storage

CSE 333 Lecture 9 - storage CSE 333 Lecture 9 - storage Steve Gribble Department of Computer Science & Engineering University of Washington Administrivia Colin s away this week - Aryan will be covering his office hours (check the

More information

10/10/ Gribble, Lazowska, Levy, Zahorjan 2. 10/10/ Gribble, Lazowska, Levy, Zahorjan 4

10/10/ Gribble, Lazowska, Levy, Zahorjan 2. 10/10/ Gribble, Lazowska, Levy, Zahorjan 4 What s in a process? CSE 451: Operating Systems Autumn 2010 Module 5 Threads Ed Lazowska lazowska@cs.washington.edu Allen Center 570 A process consists of (at least): An, containing the code (instructions)

More information

What s in a process?

What s in a process? CSE 451: Operating Systems Winter 2015 Module 5 Threads Mark Zbikowski mzbik@cs.washington.edu Allen Center 476 2013 Gribble, Lazowska, Levy, Zahorjan What s in a process? A process consists of (at least):

More information

Memory Management: The Details

Memory Management: The Details Lecture 10 Memory Management: The Details Sizing Up Memory Primitive Data Types Complex Data Types byte: char: short: basic value (8 bits) 1 byte 2 bytes Pointer: platform dependent 4 bytes on 32 bit machine

More information

Multithreading and Interactive Programs

Multithreading and Interactive Programs Multithreading and Interactive Programs CS160: User Interfaces John Canny. Last time Model-View-Controller Break up a component into Model of the data supporting the App View determining the look of the

More information

Threads SPL/2010 SPL/20 1

Threads SPL/2010 SPL/20 1 Threads 1 Today Processes and Scheduling Threads Abstract Object Models Computation Models Java Support for Threads 2 Process vs. Program processes as the basic unit of execution managed by OS OS as any

More information

Kevin van Vechten Core OS

Kevin van Vechten Core OS Kevin van Vechten Core OS 2 3 Bill Bumgarner 4 (lambda (a) (add a d)) 10 timesrepeat:[pen turn:d; draw] z.each { val puts(val + d.to_s)} repeat(10, ^{ putc('0'+ d); }); 5 6 7 8 ^ 9 [myset objectspassingtest:

More information

Lecture 10: Avoiding Locks

Lecture 10: Avoiding Locks Lecture 10: Avoiding Locks CSC 469H1F Fall 2006 Angela Demke Brown (with thanks to Paul McKenney) Locking: A necessary evil? Locks are an easy to understand solution to critical section problem Protect

More information

POSIX / System Programming

POSIX / System Programming POSIX / System Programming ECE 650 Methods and Tools for Software Eng. Guest lecture 2017 10 06 Carlos Moreno cmoreno@uwaterloo.ca E5-4111 2 Outline During today's lecture, we'll look at: Some of POSIX

More information

Designing iphone Applications

Designing iphone Applications Designing iphone Applications 4 Two Flavors of Mail 5 Organizing Content 6 Organizing Content 6 Organizing Content 6 Organizing Content 6 Organizing Content Focus on your user s data 6 Organizing Content

More information

Swift 5, ABI Stability and

Swift 5, ABI Stability and Swift 5, ABI Stability and Concurrency @phillfarrugia Important Documents Concurrency Manifesto by Chris Lattner https: /gist.github.com/lattner/ 31ed37682ef1576b16bca1432ea9f782 Kicking off Concurrency

More information

ios vs Android By: Group 2

ios vs Android By: Group 2 ios vs Android By: Group 2 The ios System Memory Section A43972 Delta Core OS Layer Core Services Layer Media Layer CoCoa Touch Layer Memory Section A43972 Delta Aaron Josephs Core OS Layer - Core OS has

More information

Game Center Techniques, Part 1

Game Center Techniques, Part 1 Game Center Techniques, Part 1 Get Your Game On Gabriel Belinsky Senior Software Engineer 2 Game Center Friends Leaderboards Achievements Multiplayer gaming 3 What You ll Learn Game Center API basics Authenticate

More information

Mobile Application Development

Mobile Application Development Mobile Application Development Lecture 17 Blocks, Concurrency, Networking 2013/2014 Parma Università degli Studi di Parma Lecture Summary Blocks Concurrency and multithreading Grand Central Dispatch (GCD)

More information

CO405H. Department of Compu:ng Imperial College London. Computing in Space with OpenSPL Topic 15: Porting CPU Software to DFEs

CO405H. Department of Compu:ng Imperial College London. Computing in Space with OpenSPL Topic 15: Porting CPU Software to DFEs CO405H Computing in Space with OpenSPL Topic 15: Porting CPU Software to DFEs Oskar Mencer Georgi Gaydadjiev Department of Compu:ng Imperial College London h#p://www.doc.ic.ac.uk/~oskar/ h#p://www.doc.ic.ac.uk/~georgig/

More information

E Event-based parser, XML, 180 Extended attributes, URLs, 118 API, 119 command line, 118 description, 118 NSURL category, 119

E Event-based parser, XML, 180 Extended attributes, URLs, 118 API, 119 command line, 118 description, 118 NSURL category, 119 Index A Access control lists (ACLs), 113 Application distribution, 353 certificate utility, 358 App ID creation, 358 App Store, 363 center, 357 no of certificates, 358 code sign identity, 362 configuring

More information

Collections & Memory Management. Lecture 2

Collections & Memory Management. Lecture 2 Collections & Memory Management Lecture 2 Demo: Accessing Documentation Collections NSArray a list of objects in order [array objectatindex:0] [array objectatindex:3] Counting starts at zero, not one NSSet

More information

Data IAP 2010 iphonedev.csail.mit.edu edward benson / Thursday, January 14, 2010

Data IAP 2010 iphonedev.csail.mit.edu edward benson / Thursday, January 14, 2010 Data IAP 2010 iphonedev.csail.mit.edu edward benson / eob@csail.mit.edu Today Property Lists User Defaults Settings Panels CoreData Property Lists Today Add persistence. plist 1. Using Property Lists in

More information

Announcements. Lab 3. Lab 2 is due on Monday Sept 21 st. Lab 3 is posted Due September 30 th

Announcements. Lab 3. Lab 2 is due on Monday Sept 21 st. Lab 3 is posted Due September 30 th Announcements Lab 2 is due on Monday Sept 21 st Lab 3 is posted Due September 30 th 1 Extensible - CSE 436 Software Networking Engineering Platform Workshop 1 Lab 3 2 Extensible - CSE 436 Software Networking

More information

Announcements. Paparazzi 3 assignment is due Wednesday 2/17 This Friday s extra session will feature Evan Doll

Announcements. Paparazzi 3 assignment is due Wednesday 2/17 This Friday s extra session will feature Evan Doll CS193P - Lecture 11 iphone Application Development Text Input Presenting Content Modally 1 Announcements Paparazzi 3 assignment is due Wednesday 2/17 This Friday s extra session will feature Evan Doll

More information

Learning from Bad Examples. CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014

Learning from Bad Examples. CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014 Learning from Bad Examples CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014 1 Goals Demonstrate techniques to design for shared mutability Build on an example where multiple threads

More information

VSI TCP/IP Stack & VCI 2.0

VSI TCP/IP Stack & VCI 2.0 VSI TCP/IP Stack & VCI 2.0 September 26, 2016 Agenda What Was Announced What Were VSI s OpDons Why Choose This OpDon How Does VSI TCP/IP V10.5 Compare To Current Stack What Are VSI TCPIP V10.5 Features

More information

How to Use Skype & Pamela Software to Record Your Podcast

How to Use Skype & Pamela Software to Record Your Podcast How to Use Skype & Pamela Software to Record Your Podcast Network 3000 Publishing 2014 1 Table of Contents Introduction...3 What is Skype?...3 The Popularity of Skype...4 What is Pamela?...4 Time to Get

More information

Vulkan: Scaling to Multiple Threads. Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics

Vulkan: Scaling to Multiple Threads. Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics Vulkan: Scaling to Multiple Threads Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics www.imgtec.com Introduction Who am I? Kevin Sun Working at Imagination Technologies Take responsibility

More information

INTERFACING REAL-TIME AUDIO AND FILE I/O

INTERFACING REAL-TIME AUDIO AND FILE I/O INTERFACING REAL-TIME AUDIO AND FILE I/O Ross Bencina portaudio.com rossbencina.com rossb@audiomulch.com @RossBencina Example source code: https://github.com/rossbencina/realtimefilestreaming Q: How to

More information

Queue Management. Last Wed: CongesDon Control. Today: Queue Management. Packet Queues

Queue Management. Last Wed: CongesDon Control. Today: Queue Management. Packet Queues Last Wed: CongesDon Control What can the end-points do to collectively to make good use of shared underlying resources? Queue Management? logical link? name Mike Freedman COS 461: Computer Networks h=p://www.cs.princeton.edu/courses/archive/spr14/cos461/

More information

CS193P - Lecture 11. iphone Application Development. Text Input Presenting Content Modally

CS193P - Lecture 11. iphone Application Development. Text Input Presenting Content Modally CS193P - Lecture 11 iphone Application Development Text Input Presenting Content Modally Announcements Presence 3 assignment has been posted, due Tuesday 5/12 Final project proposals due on Monday 5/11

More information

Operating Systems 2010/2011

Operating Systems 2010/2011 Operating Systems 2010/2011 Input/Output Systems part 1 (ch13) Shudong Chen 1 Objectives Discuss the principles of I/O hardware and its complexity Explore the structure of an operating system s I/O subsystem

More information