Concurrent, Real-Time and Distributed Programming in Java - Badr Benmammar - E-Book

Concurrent, Real-Time and Distributed Programming in Java E-Book

Badr Benmammar

0,0
139,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

This book provides an introduction to concurrent, real-time, distributed programming with Java object-oriented language support as an algorithm description tool. It describes in particular the mechanisms of synchronization (cooperative and competitive) and sharing of data (internal class, static variables) between threads in Java. He then discusses the use of Java for real-time applications. Consequently, a presentation of the RTSJ (Real Time Specification for Java) specification dedicated to the development of real-time applications in Java is also introduced in this book. Finally, a presentation of programming distributed in Java is presented in this book. We are particularly interested in communication using the TCP Sockets and high-level communication using Java Remote Method Invocation (RMI). The book also contains an annex which contains a practical set of application exercises in relation to the theme of the book. Knowledge of the Java language is a prerequisite for understanding the book.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 110

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cover

Title

Copyright

List of Acronyms

Introduction

1 Introduction to Threads in Java

1.1. Processes versus threads

1.2. Concurrent computing

1.3. Thread creation

1.4. Types of thread

1.5. Monotask versus multitask

1.6. Different states of a thread

1.7. Lifecycle of a thread

1.8. A few notes concerning threads

1.9. Programming a task: Timer and TimerTask

2 Thread Synchronization

2.1. Synchronization upon termination: join() method

2.2. Resource in mutual exclusion: synchronized modifier

2.3. Shared variables: internal class

2.4. The problem with mutual exclusions

2.5. Synchronized block

2.6. Synchronized instance method

2.7. Shared variables: class variable

2.8. Synchronization between threads

2.9. Classic Producer–Consumer pattern

2.10. Semaphore in Java

3 Real-Time Systems and Real-Time Java

3.1. Real-time systems

3.2. Java in real-time

4 Distributed Programming in Java

4.1. Definition of a distributed application

4.2. Communication in a distributed application

Appendix

Bibliography

Index

End User License Agreement

List of Illustrations

1 Introduction to Threads in Java

Figure 1.1. Isolation between processes

Figure 1.2. Execution and latency times of four different threads

Figure 1.3. Lifecycle of a thread

Figure 1.4. Thread tree

2 Thread Synchronization

Figure 2.1. Critical section shared between three threads. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 2.2. Critical section shared between three threads. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 2.3. Consumer/producer example. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 2.4. Classic Producer–Consumer pattern. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

3 Real-Time Systems and Real-Time Java

Figure 3.1. Reference implementation

Figure 3.2. Implementation of JamaicaVM

4 Distributed Programming in Java

Figure 4.1. Monolithic application versus distributed application. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.2. Example of communication with Sockets. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.3. Diagram of communication with Sockets. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.4. Communication between an applet and a server with the Sockets. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.5. Position of Middleware in a network. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.6. RPC operation. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.7. rmiregistry

Figure 4.8. Operation of an RMI application. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.9. Stages of a distant method call. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.10. RMI architecture. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.11. Deploying RMI. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.12. rmiregistry. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.13. RMI with TLS. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.14. Callback in RMI. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Figure 4.15. Necessary classes for a callback. For a color version of the figure, see www.iste.co.uk/benmammar/java.zip

Guide

Cover

Table of Contents

Begin Reading

Pages

C1

iii

iv

v

vii

viii

ix

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

61

62

63

64

65

66

67

68

69

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

157

158

G1

G2

G3

G4

G5

G6

G7

G8

e1

FOCUS SERIES

Jean-Charles Pomerol

Concurrent, Real-Time and Distributed Programming in Java

Threads, RTSJ and RMI

Badr Benmammar

First published 2018 in Great Britain and the United States by ISTE Ltd and John Wiley & Sons, Inc.

Apart from any fair dealing for the purposes of research or private study, or criticism or review, as permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced, stored or transmitted, in any form or by any means, with the prior permission in writing of the publishers, or in the case of reprographic reproduction in accordance with the terms and licenses issued by the CLA. Enquiries concerning reproduction outside these terms should be sent to the publishers at the undermentioned address:

ISTE Ltd

27-37 St George’s Road

London SW19 4EU

UK

www.iste.co.uk

John Wiley & Sons, Inc.

111 River Street

Hoboken, NJ 07030

USA

www.wiley.com

© ISTE Ltd 2018

The rights of Badr Benmammar to be identified as the author of this work have been asserted by him in accordance with the Copyright, Designs and Patents Act 1988.

Library of Congress Control Number: 2017957888

British Library Cataloguing-in-Publication Data

A CIP record for this book is available from the British Library

ISSN 2051-2481 (Print)

ISSN 2051-249X (Online)

ISBN 978-1-78630-258-8

List of Acronyms

API

Application Programming Interface

CNI

Cygnus Native Interface

CORBA

Common Object Request Broker Architecture

DCOM

Distributed Component Object Model

DGC

Distributed Garbage Collection

FIFO

First In, First Out

GC

Garbage Collector

GCC

GNU Compiler Collection

GCJ

GNU Compiler for Java

GNU

GNU’s Not Unix

IIOP

Internet Inter-ORB Protocol

IP

Internet Protocol

J2SE

Java 2 Standard Edition

J2EE

Java 2 Enterprise Edition

J2ME

Java 2 Micro Edition

JDK

Java SE Development Kit

JNI

Java Native Interface

JRMP

Java Remote Method Protocol

JSSE

Java Secure Socket Extension

JVM

Java Virtual Machine

KVM

Kilo VM

OSI

Open Systems Interconnection

PCP

Priority Ceiling Protocol

PIP

Priority Inheritance Protocol

RMI

Remote Method Invocation

RMIC

RMI Compiler

RPC

Remote Procedure Call

RRL

Remote Reference Layer

RTSJ

Real-Time Specification for Java

SSL

Secure Sockets Layer

TCP

Transmission Control Protocol

TLS

Transport Layer Security

UDP

User Datagram Protocol

URL

Uniform Resource Locator

WinCE

Windows Embedded Compact

Introduction

This book constitutes an introduction to real-time and distributed concurrent computing, using Java object-oriented language as a support tool for describing algorithms. It describes in particular the synchronization mechanisms (in cooperation and in competition) and data-sharing mechanisms (internal class, static type variables) between threads in Java. We then discuss the use of Java for real-time applications. Subsequently, a presentation of RTSJ (Real-Time Specification for Java) is also introduced in this book. Finally, a presentation of distributed computing can also be found. We focus in particular on low-level communication using TCP Sockets and high-level communication using Java RMI (Remote Method Invocation) middleware. The book also contains an appendix including a set of practical application exercises in relation to the theme of the book. Knowledge of Java language is a prerequisite to properly understanding this book.