06.08.2013 Views

JAVA-BASED REAL-TIME PROGRAMMING

JAVA-BASED REAL-TIME PROGRAMMING

JAVA-BASED REAL-TIME PROGRAMMING

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Contents<br />

I Concurrent programming in Java ® 9<br />

1 Introduction 11<br />

2 Fundamentals 17<br />

2.1 Software execution is performed sequentially . . . . . . . . . . . 17<br />

2.2 Our physical world is parallel . . . . . . . . . . . . . . . . . . . 18<br />

2.3 Parallel computing . . . . . . . . . . . . . . . . . . . . . . . . . 20<br />

2.4 Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21<br />

2.4.1 Event processing . . . . . . . . . . . . . . . . . . . . . . 23<br />

2.4.2 Time and encapsulation . . . . . . . . . . . . . . . . . . 24<br />

2.4.3 Programming of parallel sequences . . . . . . . . . . . . 25<br />

2.5 Interrupts, pre-emption, and reentrance . . . . . . . . . . . . . 26<br />

2.5.1 Obtaining the time base . . . . . . . . . . . . . . . . . . 26<br />

2.5.2 Pre-emption . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />

2.5.3 Reentrance . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

2.6 Models of concurrent execution . . . . . . . . . . . . . . . . . . 30<br />

2.6.1 Fundamental abstractions . . . . . . . . . . . . . . . . . 31<br />

2.6.2 Concurrency in Java . . . . . . . . . . . . . . . . . . . . 34<br />

2.6.3 Processes and interrupts . . . . . . . . . . . . . . . . . . 35<br />

2.7 Multi-process programming . . . . . . . . . . . . . . . . . . . . 37<br />

2.8 Object interaction and encapsulation . . . . . . . . . . . . . . . 38<br />

2.9 Software issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 39<br />

3 Multi-Threaded Programming 41<br />

3.1 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42<br />

3.1.1 Thread creation . . . . . . . . . . . . . . . . . . . . . . 43<br />

3.1.2 Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44<br />

3.1.3 Sleeping . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />

3.1.4 Race conditions . . . . . . . . . . . . . . . . . . . . . . . 47<br />

3.1.5 Scheduling – Priorities . . . . . . . . . . . . . . . . . . . 48<br />

3.1.6 Thread interruption and termination . . . . . . . . . . . 51<br />

3.1.7 The Thread class . . . . . . . . . . . . . . . . . . . . . . 54<br />

3.2 Resources and mutual exclusion – Semaphores . . . . . . . . . 55<br />

Contents<br />

7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!