SlideShare une entreprise Scribd logo
1  sur  45
Symbian OS Active Objects and Threads v2.0b – 21 May 2008 1 Andreas Jakl, 2008
Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006.  Andreas Jakl, 2008 2
Contents Concepts of asynchronous processing Threads vs. Active Objects Using AOs in Symbian OS Long-running background tasks Andreas Jakl, 2008 3
Asynchronous Processing Overview and motivation Andreas Jakl, 2008 4
Synchronous / Asynchronous Andreas Jakl, 2008 5 Synchronous function call Asynchronous (Blocking) Asynchronous F1 F2 F1 F2 F1 F2 Call Request Request wait Return Request completed Request completed e.g.:RBufbuf;buf.CreateL(10); e.g.:iSocket.Read( iBuffer, iStatus );
Motivation – Event Handling Andreas Jakl, 2008 6 Event (Key press) Keyboard ISR / DFC* Kernel / Driver Key event handling Window update Window Server Key event handling Application ISR = Interrupt Service Handler, DFC = Delayed Function Call
Process Contains 1+ threads New process: creates 1 primary thread Process: each has its own virtual memory Thread: shared memory. Generally a good thing, but negative aspects as well (overwriting data) Andreas Jakl, 2008 7 Physical Memory Virtual address space Virtual address space Process 1 Process 2 Thread(s) Thread(s) Memory access
Multitasking Pre-emptive: Threads run as long as they live or until they are interrupted by the scheduler (e.g. because of a thread with higher priority) e.g.: Windows XP, Symbian OS Cooperative: Task runs until it is finished or it gives time to other tasks e.g.: Windows 3.11 Non-Preemptive: Task runs until it is finished and is not interrupted until then (in its  own process) e.g.: Symbian OS (Active Objects) Andreas Jakl, 2008 8
Multitasking – Disadvantages Overheads for a context switch to another process: Runtime overhead (through kernel scheduler) Memory Management Unit Hardware caches Complexity: Protect shared objects(e.g. mutex, semaphore) Resources (files, …) are owned by only 1 thread (by default) – requires session sharing Andreas Jakl, 2008 9
Event Handling Active Objects Andreas Jakl, 2008 10
What is an Active Object? Requestsasynchronous service provided by Asynchronous Service Provider Receives call-back when finished / error message handling by Active Scheduler  Active Object ≈ Listener! Andreas Jakl, 2008 11
Event Handling Andreas Jakl, 2008 12 Asynchronous Service Providers Asynchronous Service Providers Event 1 Event 2 Event 1 Event 2 Event 3 Event 3 Application (Possibly an extra thread) Application (thread) ActiveScheduler (in app. thread) Event Handler (Thread) Event Handler (Thread) Event Handler (Thread) Event Handler (AO) Event Handler (AO) Event Handler (AO) all executed at the same time (pre-emptive scheduling) executed one after another Traditional Event-Handling ActiveObjects(Symbian OS)
Active Objects Asynchronous Service Provider (ASP) Executes asynchronous task e.g. timer, socket-related request, take a camera picture, load and prepare a sound file, ... Application-side: AOs encapsulate ASP and event handling (after the request to the ASP has finished) Modular separation: Active Scheduler (AS): event completion processing for all ASPs Active Object (AO): individual event handling Andreas Jakl, 2008 13
Multiple Applications System overview with multiple applications / threads Andreas Jakl, 2008 14 Single event handling thread Kernel scheduler (preemptive) Active Scheduler (non-preemptive) Active Obj.(Priority) AOPrio. AOPrio. … Asynchronous Service Provider (RTimer, …) ASP ASP Thread Thread Active Scheduler … not all threads require an AS
Application Overview Andreas Jakl, 2008 15 Callback(completition / error) Application (Thread) Active Scheduler Asynchronous Service Provider (ASP) Active Object 2 Active Object 3 Active Object 4 Active Object 1 Issuerequest ACTIVE iStatus = KErrNone NOT ACTIVE ACTIVE iStatus = KErrNotFound ACTIVE iStatus = KRequestPending List of registered AOs: ASP ASP AO 1: Issued request, waiting for completition AO 2: Request completed, call-back not yet handled AO 3: No request is active AO 4: Request completed, call-back not yet handled, error during ASP execution ASP
Scheduling Andreas Jakl, 2008 16 AO1: EPriorityStandard () AO2: EPriorityLow () AO3: EPriorityUserInput () Event 1 Event 2 Event 3 AO 1RunL() AO 2RunL() AO 3RunL() 1. Event 1 Event 2 Event 3 AO 2RunL() AO 3RunL() AO 1RunL() 2. Event 1 Event 2 Event 3 AO 2RunL() AO 3RunL() AO 1RunL() 3.
Structure of an AO Andreas Jakl, 2008 17
Active Object Class Tasks of an Active Object Request asynchronous service Handle completion event Provide a way to cancel the outstanding request (optional) Error handling To create it Derive a class from CActive Override two virtual functions: RunL() and DoCancel() Andreas Jakl, 2008 18
AOs – Classes Andreas Jakl, 2008 19 You only have to create this class
Example – Overview Timer example Creates continuous events, writes to RDebug-log Our Active Object: CExampleTimer Interface to the Asynchronous Service Provider Symbian OS RTimer-object Asynchronous Service Provider Generates call-back after a specified amount of time Note: A behaviour like this is actually pre-implemented in Symbian OS (class CTimer) Andreas Jakl, 2008 20
CExampleTimer – Definition Andreas Jakl, 2008 21 class CExampleTimer : public CActive { public: 	~CExampleTimer(); // Standard Symbian OS two-phased construction 	// Note: AOs usually created as instance variables -> NewLC() normally not necessary 	static CExampleTimer* NewL(); // Function called by our own application to initiate regular call-backs 	void After(TTimeIntervalMicroSeconds32& aInterval); protected: CExampleTimer(); 	void ConstructL(); protected:// Inherited from CActive … 	virtual void RunL();				// Handle the timer event 	virtual void DoCancel();			// Cancel the timer 	virtual TIntRunError(TIntaError);	// Leave occurred during RunL() private: RTimeriTimer;				// Symbian OS Asynchronous Service Provider 	TTimeIntervalMicroSeconds32 iInterval;	// Save interval for regular call-backs };
Create an AO CActive-derived class has to call constructor of base class with desired priority Add to the ActiveSchedulerer Andreas Jakl, 2008 22 CExampleTimer::CExampleTimer() : CActive(EPriorityStandard) { CActiveScheduler::Add(this); } CExampleTimer::ConstructL() { // Create the timer object (= Asynch. Service Provider) User::LeaveIfError(iTimer.CreateLocal()); } 1 2
Send out a new Request Test if a previousrequest is still active (only 1 Request / AO). If yes, either: Trigger a Panic if this can only happen because of a programming error Decline the new request (if allowed by the logical structure) Cancel and discard currently active request, send new request Send request to ASP, pass AO’s own iStatus as TRequestStatus&-parameter ASP will set iStatus to KErrNone when the request was finished successfully, otherwise to an error code Call SetActive()of the CActive-Base class ... to inform the Active Scheduler that we’re waiting for a request Andreas Jakl, 2008 23
New Request – Example Andreas Jakl, 2008 24 void CExampleTimer::After(TTimeIntervalMicroSeconds32& aInterval) { 	// Only allow 1 active timer request at a time 	// Here: caller (= app.) has to cancel the previous request himself – would also be	// be possible to cancel the request here or to ignore the new one 	if (IsActive()) { 		_LIT(KExampleTimerPanic, “CExampleTimer”); User::Panic(KExampleTimerPanic, KErrInUse)); 	} iInterval = aInterval;	// Save the interval for regular callbacks // Submit the request to the Asynchronous Service Provider  start the timer! iTimer.After(iStatus, aInterval); // Mark this object active, so that the Active Scheduler knows we expect a callback SetActive(); }
Event Handling AO has to implement RunL() – called by ASP when request has been processed What RunL() usually does:checks completion code (iStatus) Depending on iStatus: Send out another request Notify other objects in the system / application Can not be pre-empted by other AOs  make the processing time as short as possible! Andreas Jakl, 2008 25
Event Handling – Example  Andreas Jakl, 2008 26 void CExampleTimer::RunL() { // If an error occurred, deal with the problem in RunError() 	// (not very likely in the case of an RTimer) User::LeaveIfError(iStatus.Int()); // No error: Log the timer completion (or do any processing you like) 	__LIT(KTimerExpired, “Timer Expired”); RDebug::Print(KTimerExpired); // Resubmit a new timer request, to provide continuous call-backs iTimer.After(iStatus, iInterval); SetActive(); }
Cancelling AO must be able to cancel every asynch. process e.g. when application is closed Implement DoCancel() Call ASP cancellation Do necessary Cleanup Must not cause a leave (no L!) Application should only call Cancel()from CActive, not DoCancel() directly!(Cancel() checks if the AO is currently active at all and only calls DoCancel() if necessary) Andreas Jakl, 2008 27
Cancelling – Example  Andreas Jakl, 2008 28 void CExampleTimer::DoCancel() { 	// CActive::Cancel() checks if the AO is active and only calls DoCancel() if it is.  	// Therefore, we don’t have to check if the AO is active before cancelling the ASP. iTimer.Cancel(); }
Error handling If there’s a leave in RunL() Active Scheduler calls RunError() of your AO Parameter: Leave code.Return: Taken care of leave? Yes: return KErrNone No: ActiveSchedulerer calls own Error()  no context information is available anymore  problematic Andreas Jakl, 2008 29
Error Handling – Example  Andreas Jakl, 2008 30 TIntCExampleTimer::RunError(TIntaError) { // Called by the Active Scheduler if RunL() leaves 	// The parameter aError contains the error code 	_LIT(KErrorLog, “Timer Error %d”); // Log the error RDebug::Print(KErrorLog, aError); // Tell the Active Scheduler that the error has been handled 	return KErrNone; }
Destructor Call Cancel() in the AO-destructor! Cancel active requests Remember: Cancel() only calls DoCancel() if the AO is active! Release resources of the object Deleting AO without cancelling request: causes a „stray signal“ (E32USER-CBASE 46) Andreas Jakl, 2008 31
Destructor – Example  Andreas Jakl, 2008 32 CExampleTimer::~CExampleTimer() { // Don’t call DoCancel() directly! AObject::Cancel() will only call DoCancel() 	// if the AO is active and waits for the ASP to actually cancel the request 	// to avoid stray signals Cancel(); 	// Do normal cleanup after cancelling the AO! iTimer.Close(); }
Stray Signals ,[object Object], “Stray Signal”-panic (E32USER-CBASE 46) Possible reasons: CActiveScheduler::Add() missing in AO-construction SetActive() not called after submitting request More than 1 call-back from ASP (due to programming error or multiple requests from the same AO) Andreas Jakl, 2008 33
AOs – Events and Sequence Andreas Jakl, 2008 34 Executable Active Object Active Scheduler Asynch. Service Prov. Create Active Scheduler Wait for AOs Create AO Register with Active Scheduler Issue request to AO Request to ASP,AO::SetActive() Set status of AO and start serviceAO::iStatus = KRequestPending WaitForAnyRequest() Start Active Scheduler(only after first AO) iActive=ETrueiStatus=KRequestPending Run asynch.service Asynch.call Service CompletesAS::RequestComplete() Call RunL() of AOAO::iStatus=KErrNone AO::RunL()Handle event. Resubmit new request or stop AS. (optional) Cleanup, exit program Process orthread boundary
Active Objects vs. Threads Active Objects: Less runtime overhead Easier to implement: no mutexes, semaphores, ... You have to split up long processes into smaller, individual steps Threads: Large overhead for a context switch If you need them: use RThread Thread with pre-emptive multitasking Andreas Jakl, 2008 35
Background Tasks Long running Andreas Jakl, 2008 36
Background Task Usual solution: low-priority thread If you want to use AOs: Split task into multiple short increments( short RunL() as it cannot be pre-empted) Assign low priority (EPriorityIdle) Instead of using a timer, the AO instantly completes itself Andreas Jakl, 2008 37 AO::Activate() AO::RunL()Background task (when the system is idle) Active Scheduler User::RequestComplete()
Instant Completition AO tells Active Scheduler that its request has finished AS calls RunL() only when the system is idle due to the low priority of the AO Andreas Jakl, 2008 38 Call this code when initiating the background processing and after every increment of the RunL()-function: TRequestStatus* status = &iStatus; 	// Generates event on itself 	User::RequestComplete(status, KErrNone); 	// Important to set the AO as active so that the AS can call our RunL() SetActive(); ... Symbian’s wrapper class CIdle can also do that for you!
ASD-like Question – Easy  Which of the following statements about active objects are incorrect? A.SetActive() should be called on an active object by the calling client, after it has called the function which submits a request to an asynchronous service provider.  B. An active object class should implement RunL() and DoCancel() methods. C. The active object framework allows an active object to have multiple outstanding asynchronous requests. D. An active object should always derive from CActive. E. The active object should implement RunError() if a leave can occur in the RunL() function. Andreas Jakl, 2008 39 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Incorrect. The Active Object sets itself active right after it has submitted the request to the Asynchronous Service Provider (ASP). B.	Correct.  C.	Incorrect. Each Active Object (AO) can only have one pending request at the same time. If a second one should be issued, the AO can either Panic, ignore the new request or stop the previous request first. D.	Correct.  E.	Correct.  Andreas Jakl, 2008 40
ASD-like Question – Medium Which of the following statements regarding an active object used for a long-running background task are correct? A. It should have a high priority to ensure that it gets a chance to run to completion. B. It should maintain an internal state machine to track the different stages of the task. C. It should split the long-running task into small processing “slices”, with each execution of RunL() performing one such slice only. D. It should contain no accesses to data that would cause problems if the RunL() was preempted. E. It should use a timer to generate events that invoke RunL(). Andreas Jakl, 2008 41 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Incorrect. Long running background tasks should have a low priority, so that high priority events (e.g. user input) can be handled instantly. B.	Correct.  C.	Correct. D.	Incorrect. Active Objects are not pre-empted when they are in RunL(), therefore the RunL()-method should be rather short. E.	Incorrect. Background-tasks instantly set themselves to be complete, so that the Active Scheduler calls them again right away if no higher priority AO is waiting. Andreas Jakl, 2008 42
ASD-like Question – Hard The active scheduler causes a "stray signal" panic (E32USER-CBASE 46) when the scheduler receives a request completion and cannot find an active object associated with it.Which of the following errors in the implementation of an active object class could cause this problem? A. Not calling SetActive() after submitting a request to an asynchronous service provider. B. Not checking whether there is an outstanding request in the implementation of DoCancel(). C. Forgetting to add an active object to the active scheduler. D. Implementing RunL() so that it performs a lot of time-consuming processing before returning. E. Setting iStatus to KRequestPending before submitting it in a request to an asynchronous service provider. Andreas Jakl, 2008 43 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Yes. The Active Scheduler can only send completion events to Active Objects that are active and therefore waiting for completion events. B.	No. DoCancel() is only called by the Active Object base class after Cancel() checks that a request is currently active  C.	Yes. The Active Scheduler can’t send the event to the Active Object if it doesn’t know about it. D.	No. This is of course bad practice and makes your app unresponsive, but doesn’t cause a panic. E.	No. Automatically done by the Asynchronous Service Provider. Therefore, it doesn’t matter to what you set it before submitting the request. Andreas Jakl, 2008 44
Thanks for your attention That’s it! Andreas Jakl, 2008 45

Contenu connexe

En vedette

იოჰან სებასტიან ბახი
იოჰან სებასტიან ბახიიოჰან სებასტიან ბახი
იოჰან სებასტიან ბახიNikoloz Gvalia
 
consultoria y asesoria inventarios y almacenamiento
consultoria y asesoria inventarios y almacenamientoconsultoria y asesoria inventarios y almacenamiento
consultoria y asesoria inventarios y almacenamientoGESTYON
 
Francis Maiava Media Release.
Francis Maiava Media Release.Francis Maiava Media Release.
Francis Maiava Media Release.Francis Maiava
 
Vivek_Akotkar-Resume
Vivek_Akotkar-ResumeVivek_Akotkar-Resume
Vivek_Akotkar-ResumeVivek Akotkar
 
портфоліо зарицька
портфоліо зарицькапортфоліо зарицька
портфоліо зарицькаCatherine Petrova
 
звіт метод роботи 2014 2015 н. р.
звіт метод роботи 2014 2015 н. р.звіт метод роботи 2014 2015 н. р.
звіт метод роботи 2014 2015 н. р.Catherine Petrova
 
Tidsskriftet på iPad
Tidsskriftet på iPadTidsskriftet på iPad
Tidsskriftet på iPadnkstrand
 
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...Aleš Vidmar
 
[KGC 2013] Online Game Security in China
[KGC 2013] Online Game Security in China[KGC 2013] Online Game Security in China
[KGC 2013] Online Game Security in ChinaSeungmin Shin
 
00025233
0002523300025233
00025233fpem
 

En vedette (17)

Cloud Services
Cloud ServicesCloud Services
Cloud Services
 
იოჰან სებასტიან ბახი
იოჰან სებასტიან ბახიიოჰან სებასტიან ბახი
იოჰან სებასტიან ბახი
 
consultoria y asesoria inventarios y almacenamiento
consultoria y asesoria inventarios y almacenamientoconsultoria y asesoria inventarios y almacenamiento
consultoria y asesoria inventarios y almacenamiento
 
Francis Maiava Media Release.
Francis Maiava Media Release.Francis Maiava Media Release.
Francis Maiava Media Release.
 
Vivek_Akotkar-Resume
Vivek_Akotkar-ResumeVivek_Akotkar-Resume
Vivek_Akotkar-Resume
 
портфоліо зарицька
портфоліо зарицькапортфоліо зарицька
портфоліо зарицька
 
звіт метод роботи 2014 2015 н. р.
звіт метод роботи 2014 2015 н. р.звіт метод роботи 2014 2015 н. р.
звіт метод роботи 2014 2015 н. р.
 
FULLfast
FULLfastFULLfast
FULLfast
 
Porfolio
PorfolioPorfolio
Porfolio
 
Tidsskriftet på iPad
Tidsskriftet på iPadTidsskriftet på iPad
Tidsskriftet på iPad
 
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
 
Conto+termico ordingroma 4_6+feb+2015 (2)
Conto+termico ordingroma 4_6+feb+2015 (2)Conto+termico ordingroma 4_6+feb+2015 (2)
Conto+termico ordingroma 4_6+feb+2015 (2)
 
[KGC 2013] Online Game Security in China
[KGC 2013] Online Game Security in China[KGC 2013] Online Game Security in China
[KGC 2013] Online Game Security in China
 
Conférence_20150928_Linkedin
Conférence_20150928_LinkedinConférence_20150928_Linkedin
Conférence_20150928_Linkedin
 
Snr 2012 ee020344
Snr 2012 ee020344Snr 2012 ee020344
Snr 2012 ee020344
 
00025233
0002523300025233
00025233
 
Nvidia GTC 2014 Talk
Nvidia GTC 2014 TalkNvidia GTC 2014 Talk
Nvidia GTC 2014 Talk
 

Similaire à Symbian OS - Active Objects

Fltk S60 Introduction
Fltk S60 IntroductionFltk S60 Introduction
Fltk S60 Introductionguest5c161
 
Symbian OS - Memory Management
Symbian OS - Memory ManagementSymbian OS - Memory Management
Symbian OS - Memory ManagementAndreas Jakl
 
Java ME - 04 - Timer, Tasks and Threads
Java ME - 04 - Timer, Tasks and ThreadsJava ME - 04 - Timer, Tasks and Threads
Java ME - 04 - Timer, Tasks and ThreadsAndreas Jakl
 
Christophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java ExchangeChristophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java ExchangeSkills Matter
 
Symbian OS - Client Server Framework
Symbian OS - Client Server FrameworkSymbian OS - Client Server Framework
Symbian OS - Client Server FrameworkAndreas Jakl
 
Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes
 Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes
Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnesdistributed matters
 
Microservices with Netflix OSS and Spring Cloud
Microservices with Netflix OSS and Spring CloudMicroservices with Netflix OSS and Spring Cloud
Microservices with Netflix OSS and Spring Cloudacogoluegnes
 
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
Microservices with Netflix OSS and Spring Cloud -  Dev Day OrangeMicroservices with Netflix OSS and Spring Cloud -  Dev Day Orange
Microservices with Netflix OSS and Spring Cloud - Dev Day Orangeacogoluegnes
 
iOS Multithreading
iOS MultithreadingiOS Multithreading
iOS MultithreadingRicha Jain
 
Taking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyTaking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyBen Hall
 
fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...
fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...
fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...Luca Berardinelli
 
Technology Stack - Template.docx
Technology Stack - Template.docxTechnology Stack - Template.docx
Technology Stack - Template.docxSMuthuKumar15
 
Cloud 2010
Cloud 2010Cloud 2010
Cloud 2010steccami
 
Manage all the things, small and big, with open source LwM2M implementations ...
Manage all the things, small and big, with open source LwM2M implementations ...Manage all the things, small and big, with open source LwM2M implementations ...
Manage all the things, small and big, with open source LwM2M implementations ...Benjamin Cabé
 
Microservices in Unikernels
Microservices in UnikernelsMicroservices in Unikernels
Microservices in UnikernelsMadhuri Yechuri
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSVTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSvtunotesbysree
 

Similaire à Symbian OS - Active Objects (20)

Fltk S60 Introduction
Fltk S60 IntroductionFltk S60 Introduction
Fltk S60 Introduction
 
Symbian OS - Memory Management
Symbian OS - Memory ManagementSymbian OS - Memory Management
Symbian OS - Memory Management
 
Java ME - 04 - Timer, Tasks and Threads
Java ME - 04 - Timer, Tasks and ThreadsJava ME - 04 - Timer, Tasks and Threads
Java ME - 04 - Timer, Tasks and Threads
 
Christophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java ExchangeChristophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java Exchange
 
Symbian OS - Client Server Framework
Symbian OS - Client Server FrameworkSymbian OS - Client Server Framework
Symbian OS - Client Server Framework
 
Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes
 Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes
Microservices with Netflix OSS & Spring Cloud - Arnaud Cogoluègnes
 
Microservices with Netflix OSS and Spring Cloud
Microservices with Netflix OSS and Spring CloudMicroservices with Netflix OSS and Spring Cloud
Microservices with Netflix OSS and Spring Cloud
 
Tech talk
Tech talkTech talk
Tech talk
 
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
Microservices with Netflix OSS and Spring Cloud -  Dev Day OrangeMicroservices with Netflix OSS and Spring Cloud -  Dev Day Orange
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
 
iOS Multithreading
iOS MultithreadingiOS Multithreading
iOS Multithreading
 
Memory management in c++
Memory management in c++Memory management in c++
Memory management in c++
 
Taking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyTaking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) Family
 
iiwas2009
iiwas2009iiwas2009
iiwas2009
 
RT-lab based real-time simulation of flywheel energy storage system associate...
RT-lab based real-time simulation of flywheel energy storage system associate...RT-lab based real-time simulation of flywheel energy storage system associate...
RT-lab based real-time simulation of flywheel energy storage system associate...
 
fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...
fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...
fUML-Driven Design and Performance Analysis of Software Agents for Wireless S...
 
Technology Stack - Template.docx
Technology Stack - Template.docxTechnology Stack - Template.docx
Technology Stack - Template.docx
 
Cloud 2010
Cloud 2010Cloud 2010
Cloud 2010
 
Manage all the things, small and big, with open source LwM2M implementations ...
Manage all the things, small and big, with open source LwM2M implementations ...Manage all the things, small and big, with open source LwM2M implementations ...
Manage all the things, small and big, with open source LwM2M implementations ...
 
Microservices in Unikernels
Microservices in UnikernelsMicroservices in Unikernels
Microservices in Unikernels
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSVTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
 

Plus de Andreas Jakl

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityAndreas Jakl
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAndreas Jakl
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndreas Jakl
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndreas Jakl
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndreas Jakl
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Andreas Jakl
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web TechnologiesAndreas Jakl
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreAndreas Jakl
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Andreas Jakl
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test AutomationAndreas Jakl
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Andreas Jakl
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneAndreas Jakl
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingAndreas Jakl
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartAndreas Jakl
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosAndreas Jakl
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentAndreas Jakl
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)Andreas Jakl
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt CommunicationAndreas Jakl
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and GraphicsAndreas Jakl
 

Plus de Andreas Jakl (20)

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented Reality
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with Unity
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App Management
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSON
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - Introduction
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web Technologies
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer Training
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC Quickstart
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App Scenarios
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC Development
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Symbian OS - Active Objects

  • 1. Symbian OS Active Objects and Threads v2.0b – 21 May 2008 1 Andreas Jakl, 2008
  • 2. Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006. Andreas Jakl, 2008 2
  • 3. Contents Concepts of asynchronous processing Threads vs. Active Objects Using AOs in Symbian OS Long-running background tasks Andreas Jakl, 2008 3
  • 4. Asynchronous Processing Overview and motivation Andreas Jakl, 2008 4
  • 5. Synchronous / Asynchronous Andreas Jakl, 2008 5 Synchronous function call Asynchronous (Blocking) Asynchronous F1 F2 F1 F2 F1 F2 Call Request Request wait Return Request completed Request completed e.g.:RBufbuf;buf.CreateL(10); e.g.:iSocket.Read( iBuffer, iStatus );
  • 6. Motivation – Event Handling Andreas Jakl, 2008 6 Event (Key press) Keyboard ISR / DFC* Kernel / Driver Key event handling Window update Window Server Key event handling Application ISR = Interrupt Service Handler, DFC = Delayed Function Call
  • 7. Process Contains 1+ threads New process: creates 1 primary thread Process: each has its own virtual memory Thread: shared memory. Generally a good thing, but negative aspects as well (overwriting data) Andreas Jakl, 2008 7 Physical Memory Virtual address space Virtual address space Process 1 Process 2 Thread(s) Thread(s) Memory access
  • 8. Multitasking Pre-emptive: Threads run as long as they live or until they are interrupted by the scheduler (e.g. because of a thread with higher priority) e.g.: Windows XP, Symbian OS Cooperative: Task runs until it is finished or it gives time to other tasks e.g.: Windows 3.11 Non-Preemptive: Task runs until it is finished and is not interrupted until then (in its own process) e.g.: Symbian OS (Active Objects) Andreas Jakl, 2008 8
  • 9. Multitasking – Disadvantages Overheads for a context switch to another process: Runtime overhead (through kernel scheduler) Memory Management Unit Hardware caches Complexity: Protect shared objects(e.g. mutex, semaphore) Resources (files, …) are owned by only 1 thread (by default) – requires session sharing Andreas Jakl, 2008 9
  • 10. Event Handling Active Objects Andreas Jakl, 2008 10
  • 11. What is an Active Object? Requestsasynchronous service provided by Asynchronous Service Provider Receives call-back when finished / error message handling by Active Scheduler  Active Object ≈ Listener! Andreas Jakl, 2008 11
  • 12. Event Handling Andreas Jakl, 2008 12 Asynchronous Service Providers Asynchronous Service Providers Event 1 Event 2 Event 1 Event 2 Event 3 Event 3 Application (Possibly an extra thread) Application (thread) ActiveScheduler (in app. thread) Event Handler (Thread) Event Handler (Thread) Event Handler (Thread) Event Handler (AO) Event Handler (AO) Event Handler (AO) all executed at the same time (pre-emptive scheduling) executed one after another Traditional Event-Handling ActiveObjects(Symbian OS)
  • 13. Active Objects Asynchronous Service Provider (ASP) Executes asynchronous task e.g. timer, socket-related request, take a camera picture, load and prepare a sound file, ... Application-side: AOs encapsulate ASP and event handling (after the request to the ASP has finished) Modular separation: Active Scheduler (AS): event completion processing for all ASPs Active Object (AO): individual event handling Andreas Jakl, 2008 13
  • 14. Multiple Applications System overview with multiple applications / threads Andreas Jakl, 2008 14 Single event handling thread Kernel scheduler (preemptive) Active Scheduler (non-preemptive) Active Obj.(Priority) AOPrio. AOPrio. … Asynchronous Service Provider (RTimer, …) ASP ASP Thread Thread Active Scheduler … not all threads require an AS
  • 15. Application Overview Andreas Jakl, 2008 15 Callback(completition / error) Application (Thread) Active Scheduler Asynchronous Service Provider (ASP) Active Object 2 Active Object 3 Active Object 4 Active Object 1 Issuerequest ACTIVE iStatus = KErrNone NOT ACTIVE ACTIVE iStatus = KErrNotFound ACTIVE iStatus = KRequestPending List of registered AOs: ASP ASP AO 1: Issued request, waiting for completition AO 2: Request completed, call-back not yet handled AO 3: No request is active AO 4: Request completed, call-back not yet handled, error during ASP execution ASP
  • 16. Scheduling Andreas Jakl, 2008 16 AO1: EPriorityStandard () AO2: EPriorityLow () AO3: EPriorityUserInput () Event 1 Event 2 Event 3 AO 1RunL() AO 2RunL() AO 3RunL() 1. Event 1 Event 2 Event 3 AO 2RunL() AO 3RunL() AO 1RunL() 2. Event 1 Event 2 Event 3 AO 2RunL() AO 3RunL() AO 1RunL() 3.
  • 17. Structure of an AO Andreas Jakl, 2008 17
  • 18. Active Object Class Tasks of an Active Object Request asynchronous service Handle completion event Provide a way to cancel the outstanding request (optional) Error handling To create it Derive a class from CActive Override two virtual functions: RunL() and DoCancel() Andreas Jakl, 2008 18
  • 19. AOs – Classes Andreas Jakl, 2008 19 You only have to create this class
  • 20. Example – Overview Timer example Creates continuous events, writes to RDebug-log Our Active Object: CExampleTimer Interface to the Asynchronous Service Provider Symbian OS RTimer-object Asynchronous Service Provider Generates call-back after a specified amount of time Note: A behaviour like this is actually pre-implemented in Symbian OS (class CTimer) Andreas Jakl, 2008 20
  • 21. CExampleTimer – Definition Andreas Jakl, 2008 21 class CExampleTimer : public CActive { public: ~CExampleTimer(); // Standard Symbian OS two-phased construction // Note: AOs usually created as instance variables -> NewLC() normally not necessary static CExampleTimer* NewL(); // Function called by our own application to initiate regular call-backs void After(TTimeIntervalMicroSeconds32& aInterval); protected: CExampleTimer(); void ConstructL(); protected:// Inherited from CActive … virtual void RunL(); // Handle the timer event virtual void DoCancel(); // Cancel the timer virtual TIntRunError(TIntaError); // Leave occurred during RunL() private: RTimeriTimer; // Symbian OS Asynchronous Service Provider TTimeIntervalMicroSeconds32 iInterval; // Save interval for regular call-backs };
  • 22. Create an AO CActive-derived class has to call constructor of base class with desired priority Add to the ActiveSchedulerer Andreas Jakl, 2008 22 CExampleTimer::CExampleTimer() : CActive(EPriorityStandard) { CActiveScheduler::Add(this); } CExampleTimer::ConstructL() { // Create the timer object (= Asynch. Service Provider) User::LeaveIfError(iTimer.CreateLocal()); } 1 2
  • 23. Send out a new Request Test if a previousrequest is still active (only 1 Request / AO). If yes, either: Trigger a Panic if this can only happen because of a programming error Decline the new request (if allowed by the logical structure) Cancel and discard currently active request, send new request Send request to ASP, pass AO’s own iStatus as TRequestStatus&-parameter ASP will set iStatus to KErrNone when the request was finished successfully, otherwise to an error code Call SetActive()of the CActive-Base class ... to inform the Active Scheduler that we’re waiting for a request Andreas Jakl, 2008 23
  • 24. New Request – Example Andreas Jakl, 2008 24 void CExampleTimer::After(TTimeIntervalMicroSeconds32& aInterval) { // Only allow 1 active timer request at a time // Here: caller (= app.) has to cancel the previous request himself – would also be // be possible to cancel the request here or to ignore the new one if (IsActive()) { _LIT(KExampleTimerPanic, “CExampleTimer”); User::Panic(KExampleTimerPanic, KErrInUse)); } iInterval = aInterval; // Save the interval for regular callbacks // Submit the request to the Asynchronous Service Provider  start the timer! iTimer.After(iStatus, aInterval); // Mark this object active, so that the Active Scheduler knows we expect a callback SetActive(); }
  • 25. Event Handling AO has to implement RunL() – called by ASP when request has been processed What RunL() usually does:checks completion code (iStatus) Depending on iStatus: Send out another request Notify other objects in the system / application Can not be pre-empted by other AOs  make the processing time as short as possible! Andreas Jakl, 2008 25
  • 26. Event Handling – Example Andreas Jakl, 2008 26 void CExampleTimer::RunL() { // If an error occurred, deal with the problem in RunError() // (not very likely in the case of an RTimer) User::LeaveIfError(iStatus.Int()); // No error: Log the timer completion (or do any processing you like) __LIT(KTimerExpired, “Timer Expired”); RDebug::Print(KTimerExpired); // Resubmit a new timer request, to provide continuous call-backs iTimer.After(iStatus, iInterval); SetActive(); }
  • 27. Cancelling AO must be able to cancel every asynch. process e.g. when application is closed Implement DoCancel() Call ASP cancellation Do necessary Cleanup Must not cause a leave (no L!) Application should only call Cancel()from CActive, not DoCancel() directly!(Cancel() checks if the AO is currently active at all and only calls DoCancel() if necessary) Andreas Jakl, 2008 27
  • 28. Cancelling – Example Andreas Jakl, 2008 28 void CExampleTimer::DoCancel() { // CActive::Cancel() checks if the AO is active and only calls DoCancel() if it is. // Therefore, we don’t have to check if the AO is active before cancelling the ASP. iTimer.Cancel(); }
  • 29. Error handling If there’s a leave in RunL() Active Scheduler calls RunError() of your AO Parameter: Leave code.Return: Taken care of leave? Yes: return KErrNone No: ActiveSchedulerer calls own Error()  no context information is available anymore  problematic Andreas Jakl, 2008 29
  • 30. Error Handling – Example Andreas Jakl, 2008 30 TIntCExampleTimer::RunError(TIntaError) { // Called by the Active Scheduler if RunL() leaves // The parameter aError contains the error code _LIT(KErrorLog, “Timer Error %d”); // Log the error RDebug::Print(KErrorLog, aError); // Tell the Active Scheduler that the error has been handled return KErrNone; }
  • 31. Destructor Call Cancel() in the AO-destructor! Cancel active requests Remember: Cancel() only calls DoCancel() if the AO is active! Release resources of the object Deleting AO without cancelling request: causes a „stray signal“ (E32USER-CBASE 46) Andreas Jakl, 2008 31
  • 32. Destructor – Example Andreas Jakl, 2008 32 CExampleTimer::~CExampleTimer() { // Don’t call DoCancel() directly! AObject::Cancel() will only call DoCancel() // if the AO is active and waits for the ASP to actually cancel the request // to avoid stray signals Cancel(); // Do normal cleanup after cancelling the AO! iTimer.Close(); }
  • 33.
  • 34. AOs – Events and Sequence Andreas Jakl, 2008 34 Executable Active Object Active Scheduler Asynch. Service Prov. Create Active Scheduler Wait for AOs Create AO Register with Active Scheduler Issue request to AO Request to ASP,AO::SetActive() Set status of AO and start serviceAO::iStatus = KRequestPending WaitForAnyRequest() Start Active Scheduler(only after first AO) iActive=ETrueiStatus=KRequestPending Run asynch.service Asynch.call Service CompletesAS::RequestComplete() Call RunL() of AOAO::iStatus=KErrNone AO::RunL()Handle event. Resubmit new request or stop AS. (optional) Cleanup, exit program Process orthread boundary
  • 35. Active Objects vs. Threads Active Objects: Less runtime overhead Easier to implement: no mutexes, semaphores, ... You have to split up long processes into smaller, individual steps Threads: Large overhead for a context switch If you need them: use RThread Thread with pre-emptive multitasking Andreas Jakl, 2008 35
  • 36. Background Tasks Long running Andreas Jakl, 2008 36
  • 37. Background Task Usual solution: low-priority thread If you want to use AOs: Split task into multiple short increments( short RunL() as it cannot be pre-empted) Assign low priority (EPriorityIdle) Instead of using a timer, the AO instantly completes itself Andreas Jakl, 2008 37 AO::Activate() AO::RunL()Background task (when the system is idle) Active Scheduler User::RequestComplete()
  • 38. Instant Completition AO tells Active Scheduler that its request has finished AS calls RunL() only when the system is idle due to the low priority of the AO Andreas Jakl, 2008 38 Call this code when initiating the background processing and after every increment of the RunL()-function: TRequestStatus* status = &iStatus; // Generates event on itself User::RequestComplete(status, KErrNone); // Important to set the AO as active so that the AS can call our RunL() SetActive(); ... Symbian’s wrapper class CIdle can also do that for you!
  • 39. ASD-like Question – Easy Which of the following statements about active objects are incorrect? A.SetActive() should be called on an active object by the calling client, after it has called the function which submits a request to an asynchronous service provider. B. An active object class should implement RunL() and DoCancel() methods. C. The active object framework allows an active object to have multiple outstanding asynchronous requests. D. An active object should always derive from CActive. E. The active object should implement RunError() if a leave can occur in the RunL() function. Andreas Jakl, 2008 39 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 40. Solution A. Incorrect. The Active Object sets itself active right after it has submitted the request to the Asynchronous Service Provider (ASP). B. Correct. C. Incorrect. Each Active Object (AO) can only have one pending request at the same time. If a second one should be issued, the AO can either Panic, ignore the new request or stop the previous request first. D. Correct. E. Correct. Andreas Jakl, 2008 40
  • 41. ASD-like Question – Medium Which of the following statements regarding an active object used for a long-running background task are correct? A. It should have a high priority to ensure that it gets a chance to run to completion. B. It should maintain an internal state machine to track the different stages of the task. C. It should split the long-running task into small processing “slices”, with each execution of RunL() performing one such slice only. D. It should contain no accesses to data that would cause problems if the RunL() was preempted. E. It should use a timer to generate events that invoke RunL(). Andreas Jakl, 2008 41 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 42. Solution A. Incorrect. Long running background tasks should have a low priority, so that high priority events (e.g. user input) can be handled instantly. B. Correct. C. Correct. D. Incorrect. Active Objects are not pre-empted when they are in RunL(), therefore the RunL()-method should be rather short. E. Incorrect. Background-tasks instantly set themselves to be complete, so that the Active Scheduler calls them again right away if no higher priority AO is waiting. Andreas Jakl, 2008 42
  • 43. ASD-like Question – Hard The active scheduler causes a "stray signal" panic (E32USER-CBASE 46) when the scheduler receives a request completion and cannot find an active object associated with it.Which of the following errors in the implementation of an active object class could cause this problem? A. Not calling SetActive() after submitting a request to an asynchronous service provider. B. Not checking whether there is an outstanding request in the implementation of DoCancel(). C. Forgetting to add an active object to the active scheduler. D. Implementing RunL() so that it performs a lot of time-consuming processing before returning. E. Setting iStatus to KRequestPending before submitting it in a request to an asynchronous service provider. Andreas Jakl, 2008 43 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 44. Solution A. Yes. The Active Scheduler can only send completion events to Active Objects that are active and therefore waiting for completion events. B. No. DoCancel() is only called by the Active Object base class after Cancel() checks that a request is currently active C. Yes. The Active Scheduler can’t send the event to the Active Object if it doesn’t know about it. D. No. This is of course bad practice and makes your app unresponsive, but doesn’t cause a panic. E. No. Automatically done by the Asynchronous Service Provider. Therefore, it doesn’t matter to what you set it before submitting the request. Andreas Jakl, 2008 44
  • 45. Thanks for your attention That’s it! Andreas Jakl, 2008 45