1

00:00:01,140  -->  00:00:02,250
So that's the end of that.

2

00:00:02,260  -->  00:00:08,820
J.B. I'm in dentals chapter and Bonneau have a good understanding of the internal workings of the Jalla

3

00:00:08,820  -->  00:00:10,530
platform.

4

00:00:10,530  -->  00:00:16,420
Let's go ahead and review some of the main features we covered in this chapter.

5

00:00:16,470  -->  00:00:20,300
We began this chapter by looking at the lifetime of a type.

6

00:00:20,580  -->  00:00:26,010
We saw that a pipe goes through three stages from the time it is access for the very first time to the

7

00:00:26,010  -->  00:00:27,910
time it is executed.

8

00:00:28,080  -->  00:00:35,070
The three stages are loading linking and initialization learning is nothing but glassblowing and it

9

00:00:35,070  -->  00:00:38,840
is performed by the classloader which is a GBM component.

10

00:00:39,360  -->  00:00:45,160
When the glasses axis for the very first time the classloader searches for the dark classifier.

11

00:00:45,690  -->  00:00:52,020
And once it is found it will lower the corresponding bite caught the memory and will also create a class

12

00:00:52,020  -->  00:00:54,870
object for that particular class.

13

00:00:55,020  -->  00:01:02,070
So the output of this stage is a class object which will be in the next stage which is linking linking

14

00:01:02,070  -->  00:01:09,350
is a most complicated of the three stages and it involves three suffixes verification preparation and

15

00:01:09,440  -->  00:01:17,510
optional resolution step verification ensures that the classloader is safe to be executed by JVM.

16

00:01:17,610  -->  00:01:25,050
That is it ensures that it's not compiled by a malicious compiler next preparations don't create storage

17

00:01:25,090  -->  00:01:29,760
for that use an initialization with default values.

18

00:01:29,760  -->  00:01:35,670
Third step is resolution which is responsible for loading any grassers that the current class is accessing

19

00:01:36,810  -->  00:01:43,800
to be more specific as the bermed resolution suggests it resolves any symbolic references by replacing

20

00:01:43,800  -->  00:01:46,030
them with direct references.

21

00:01:46,500  -->  00:01:52,910
Example references could be two classes or any fields or methods in those classes.

22

00:01:52,950  -->  00:01:58,590
Also the resolution can be performed right after Operation step in which case it is called as early

23

00:01:58,590  -->  00:02:04,570
loading or it can be delayed to a later time in which case it is called lazy loading.

24

00:02:05,010  -->  00:02:11,970
Typically more DBMS implement lazy loading in which case classes are loaded only as they are and counted

25

00:02:12,240  -->  00:02:14,640
during the program execution.

26

00:02:14,640  -->  00:02:18,200
Finally we have the initialization stage in this stage.

27

00:02:18,540  -->  00:02:24,710
Static fields that were earlier assigned default values during the preparation step will be done with

28

00:02:24,710  -->  00:02:28,590
a user defined initial values.

29

00:02:28,620  -->  00:02:34,110
Next we look at the reflection reflection allows programs to do two things.

30

00:02:34,140  -->  00:02:41,880
One is it allows programs to introspect known or unknown code that would allow us to view Rockmart that

31

00:02:41,940  -->  00:02:47,090
feels an constrictors are defined in a particular class on a particular object.

32

00:02:47,640  -->  00:02:54,900
One example usage of this can be found in ideas like Eclipse which allow us to browse fields on methods

33

00:02:54,990  -->  00:02:57,830
in a class or an interface.

34

00:02:58,080  -->  00:03:01,690
Reflection also allows us to affect the runtime behavior.

35

00:03:02,370  -->  00:03:08,160
For example if you just know the class name at runtime you will be able to load the class create an

36

00:03:08,160  -->  00:03:09,440
instance of that class.

37

00:03:09,840  -->  00:03:17,100
And even in metrics on that instance and even set or get values of fields of that instance if you'll

38

00:03:17,100  -->  00:03:24,180
recall we discussed briefly about ambition processors and dynamic proxies both of these use reflection

39

00:03:24,300  -->  00:03:27,810
to affect the runtime behavior.

40

00:03:27,810  -->  00:03:33,800
Next we looked at the different runtime data areas that formed part of the Gibeah memory which is a

41

00:03:33,810  -->  00:03:40,530
look at it but the underlying operating system one of the runtime data areas is heape which is where

42

00:03:40,620  -->  00:03:42,720
all the objects are stored.

43

00:03:43,140  -->  00:03:46,300
Even arrays and class objects get stored here.

44

00:03:46,980  -->  00:03:54,520
Basically it is where we how all the instance data matter area is where we store plastic to between

45

00:03:54,530  -->  00:03:59,980
grid Mad-Eye information about classes and also the actual method bytecode.

46

00:04:00,090  -->  00:04:01,890
It would also include the runtime constant.

47

00:04:01,910  -->  00:04:10,260
Well not that priority of Java aid method is part of permanent generation space but from Java 8 onwards

48

00:04:10,700  -->  00:04:16,130
method is part of a news is called model space which is part of the of memory.

49

00:04:16,440  -->  00:04:25,160
So there is not firm space anymore but metal Elyon heap are shared across all threads and other runtime

50

00:04:25,180  -->  00:04:30,690
the diarrhea that we discussed in detail is a stock which holds information about the methods that are

51

00:04:30,690  -->  00:04:35,000
currently being executed for each exit getting murdered.

52

00:04:35,100  -->  00:04:38,810
We will have a corresponding stack frame on the stack.

53

00:04:38,940  -->  00:04:44,850
Recall that if a local variable in the method is an object reference then that reference will be stored

54

00:04:44,850  -->  00:04:46,510
on the stack frame itself.

55

00:04:46,830  -->  00:04:50,950
But the actual object it is referring to will still be on the heap.

56

00:04:51,210  -->  00:04:51,420
OK.

57

00:04:51,420  -->  00:04:58,200
So just keep that in mind now as you can see here the GBM stack native stack and the program counter

58

00:04:58,320  -->  00:05:00,900
are maintained at a partridge level.

59

00:05:01,800  -->  00:05:06,680
Finally native heape is basically the total user space minus a Java heaps.

60

00:05:06,680  -->  00:05:08,020
Ms.

61

00:05:08,060  -->  00:05:14,690
How are some of the runtime data areas like the metro area the stacks under PC icon for some of the

62

00:05:14,690  -->  00:05:20,970
space so near to memory is basically the leftover part that you can see here on the left corner of the

63

00:05:20,970  -->  00:05:23,460
diagram.

64

00:05:23,460  -->  00:05:29,130
Next we'll have that automatic memory management which is one of the main benefits of Java over a language

65

00:05:29,130  -->  00:05:31,080
like C++.

66

00:05:31,080  -->  00:05:36,630
It helps in avoiding memory corruption which can lead to issues like dangling references and memory

67

00:05:36,630  -->  00:05:38,160
leaks.

68

00:05:38,160  -->  00:05:45,060
It does this by restricting programmers from directly manipulating memory a process called Garbage collection

69

00:05:45,060  -->  00:05:50,850
is used for this which reclaim space occupied by dead or abandoned objects.

70

00:05:51,360  -->  00:05:54,300
Not that memory leaks are still possible in Java.

71

00:05:54,750  -->  00:06:01,050
However I suggested an effective Daleiden memory leaks can be avoided by ensuring that there are no

72

00:06:01,070  -->  00:06:08,890
obsolete object or Francis now when it comes to garbage collection there are two main challenges.

73

00:06:09,000  -->  00:06:12,660
One is to do with identifying and reclaiming data objects.

74

00:06:13,280  -->  00:06:20,220
What is garbage collectors employ mark and sweep kind of algorithms these algorithms would require pausing

75

00:06:20,220  -->  00:06:21,880
the application completely.

76

00:06:22,140  -->  00:06:29,700
And that leads to the second challenge which is how do we minimize such application pastimes to address

77

00:06:29,700  -->  00:06:36,990
this garbage can APIs use generational collection approach which mainly focuses on newly created objects

78

00:06:37,500  -->  00:06:41,520
and does not bother much about long living objects.

79

00:06:41,520  -->  00:06:48,250
Certain garbage collectors use features like multi-threading to further reduce the pastimes.

80

00:06:48,270  -->  00:06:55,680
Finally we look at few important bytecode instructions A-story instruction box data from the operand

81

00:06:55,680  -->  00:07:02,490
stack and start it at a specified index in the local variables are it a lot instruction does the exact

82

00:07:02,490  -->  00:07:10,410
opposite in what expression is used for invoking instance initialization methods private methods and

83

00:07:10,410  -->  00:07:11,790
methods of a superclass.

84

00:07:11,790  -->  00:07:19,460
We are the supercooled instance initialization methods are nothing but the constructors invoke virtual

85

00:07:19,500  -->  00:07:22,260
is used for invoking instance methods.

86

00:07:22,920  -->  00:07:30,090
No not that would invoke special and invoke virtual fusspot pop the top element on the operand stack

87

00:07:30,180  -->  00:07:33,150
of the current method unstarted at zero.

88

00:07:33,180  -->  00:07:36,560
And next in the local variables array of the Invoke method.

89

00:07:36,840  -->  00:07:38,890
OK so just keep that in mind.

90

00:07:39,450  -->  00:07:41,930
Another instruction is in static.

91

00:07:42,090  -->  00:07:48,030
It was discussed well covering method binding and it is used for invoking static methods.

92

00:07:48,030  -->  00:07:49,350
So that's about it.

93

00:07:49,350  -->  00:07:52,260
I think that's a pretty solid tradeoff JVM.

94

00:07:52,470  -->  00:07:56,570
It is more like a medium sized course on just JVM.

95

00:07:56,610  -->  00:07:58,870
So congratulations for completing the chapter.

96

00:07:59,130  -->  00:08:01,750
And thanks for listening and I will see you soon.

97

00:08:01,880  -->  00:08:03,320
Until then happy coding
