1

00:00:01,080  -->  00:00:02,140
Hi there.

2

00:00:02,310  -->  00:00:08,190
Now let's look at the lifetime offer pipe which means that we are going to look at what happens to your

3

00:00:08,190  -->  00:00:13,650
type since the time it does access for the very first time and the time it is executed and how it can

4

00:00:13,650  -->  00:00:16,630
be either a class or an interface.

5

00:00:16,830  -->  00:00:22,080
But when you look at the lifetime R-Type let's look at what components of JVM we are going to discuss

6

00:00:22,080  -->  00:00:23,490
in this chapter.

7

00:00:23,490  -->  00:00:28,260
You may recall this illustration from our first chapter when discussing JVM.

8

00:00:28,260  -->  00:00:32,920
So here we have a class called Halo which needs to be executed by Gibeon.

9

00:00:33,270  -->  00:00:38,650
And in this chapter when discussing the lifetime of type we will discuss these two components classloader

10

00:00:38,690  -->  00:00:40,130
on bytecode verifier.

11

00:00:40,380  -->  00:00:45,360
And once we are done with lifetime type we will look at garbage collector and to an extent we will also

12

00:00:45,360  -->  00:00:49,240
look at bytecode instructions on Witan the execution engine.

13

00:00:49,260  -->  00:00:55,260
We only did this because the G.I. decompiler in first chapter while discussing JVM and I think that

14

00:00:55,260  -->  00:01:00,600
discussion would suffice and if needed to support TLAs separate lesson object decompiler at some point

15

00:01:00,600  -->  00:01:01,580
in the future.

16

00:01:02,070  -->  00:01:04,430
But the discussion we had should suffice.

17

00:01:04,560  -->  00:01:10,140
Now at the top we have the different runtime data areas which represent the memory that GBM is a look

18

00:01:10,140  -->  00:01:10,860
at it.

19

00:01:10,990  -->  00:01:16,770
So when GBM get started it gets a look at it a chunk of memory from the underlying operating system

20

00:01:17,500  -->  00:01:23,100
on GBM splits that memory in two different areas which we can see here and we would be discussing most

21

00:01:23,100  -->  00:01:24,750
of these some areas.

22

00:01:24,840  -->  00:01:26,870
So that's got to be a micro texture.

23

00:01:26,880  -->  00:01:33,450
Now let's look at life in a market like let's consider this class called us Halo and let's assume that

24

00:01:33,510  -->  00:01:38,850
this class is being accessed for the very first time which means that it is either being run from the

25

00:01:38,850  -->  00:01:43,400
command line or it is being accessed in some way from some other place.

26

00:01:43,650  -->  00:01:49,280
That is we are either creating an instance of this class or accessing some variables hard matter within

27

00:01:49,290  -->  00:01:50,500
this particular class.

28

00:01:50,940  -->  00:01:55,710
But this class is being accessed for the very first time and in that case we need to load this class

29

00:01:55,770  -->  00:02:03,390
into memory and JVM does that sort of holds the class and it checks that this class is well-formed or

30

00:02:03,390  -->  00:02:04,200
not.

31

00:02:04,200  -->  00:02:08,590
That is whether it is obeying the language introduced off giallo.

32

00:02:08,670  -->  00:02:11,240
Now we know that that is already done by compiler.

33

00:02:11,290  -->  00:02:13,190
Hello dark glasses generator.

34

00:02:13,530  -->  00:02:15,320
So the question is why is it doing.

35

00:02:15,320  -->  00:02:16,650
One more time.

36

00:02:16,710  -->  00:02:22,370
And the reason is this glass hollowed out glass could have been downloaded from across the network and

37

00:02:22,380  -->  00:02:29,010
it could have been compiled by a hostile compiler whose intention is to perform some malicious actions

38

00:02:29,160  -->  00:02:31,940
on the system on which it is going to be executed.

39

00:02:32,310  -->  00:02:37,470
So JVM is not going to trust any of the classes that are just going to execute.

40

00:02:37,520  -->  00:02:42,810
It needs to perform this kind of a check and if it finds that it is not real fun it is going to reject

41

00:02:42,810  -->  00:02:46,220
this class which means that it's not going to exhibit it.

42

00:02:46,530  -->  00:02:48,650
But if the fight is well formed then it.

43

00:02:48,720  -->  00:02:54,900
Look it's best for any of the static variables within this class undergrad also going to initialize

44

00:02:54,900  -->  00:03:01,170
those variables but the default values which is dependent on the data type of the variables.

45

00:03:01,200  -->  00:03:05,770
None of this Grothus access for the very first time by creating an instance of it.

46

00:03:05,850  -->  00:03:10,650
Then on the instance variables will also be looked at that space and they would be initialized with

47

00:03:10,650  -->  00:03:13,000
default values.

48

00:03:13,260  -->  00:03:16,520
So the next step is to look at any reference classes.

49

00:03:16,660  -->  00:03:20,110
No Hello non-class might be referencing other classes.

50

00:03:20,310  -->  00:03:26,490
That is it could be accessing variables or methods in other classes or it could be creating instances

51

00:03:26,490  -->  00:03:28,230
of other classes.

52

00:03:28,260  -->  00:03:35,640
So in this case we are going to at all the classes that are being referenced from the US and the final

53

00:03:35,640  -->  00:03:37,970
step is to initialize variables.

54

00:03:38,160  -->  00:03:43,920
Earlier we created a space for static variables and we initialized them with different values.

55

00:03:43,950  -->  00:03:50,550
So here we are going to override those default values with the actual user defined initial values which

56

00:03:50,550  -->  00:03:56,430
are part of either the Declaration or they could be part of the static initializer gawks or instance

57

00:03:56,430  -->  00:03:58,590
initializer groks.

58

00:03:58,650  -->  00:04:00,290
So those are the different steps.

59

00:04:00,510  -->  00:04:06,600
And this first step where we are loading class it is called us loading underdosed performed by this

60

00:04:06,600  -->  00:04:08,870
component called us classloader.

61

00:04:09,300  -->  00:04:15,930
So when classloader has to load this class called Hello Doc class it's just a class bot to see where

62

00:04:15,930  -->  00:04:22,330
it can find this class and once it finds that class once it gets it it reports a corresponding byte

63

00:04:22,350  -->  00:04:23,910
course into memory.

64

00:04:24,300  -->  00:04:30,030
And after that it generates something called as a class object which is the output of the loading step

65

00:04:30,560  -->  00:04:34,580
on class object simply has the Mattei information about this class.

66

00:04:34,980  -->  00:04:41,310
So that information would be things like the class name which is hollow and names of any of the superclasses

67

00:04:41,700  -->  00:04:45,800
and it would also include information like method names and so on.

68

00:04:45,840  -->  00:04:53,250
We very briefly discuss the class object while discussing the object class in the okes chapter not duck

69

00:04:53,350  -->  00:04:59,370
discuss object will be created only once when the corresponding class is accessed for the first time

70

00:04:59,370  -->  00:05:00,060
.

71

00:05:00,060  -->  00:05:06,280
So on subsequent accesses classloader will simply fits to create a class object from the memory and

72

00:05:06,330  -->  00:05:07,820
it would use it.

73

00:05:08,250  -->  00:05:13,770
So the output of this loading step is a class object and that would be the input for the next step.

74

00:05:13,760  -->  00:05:19,860
It is linking unlinking has these three steps which are represented in this three boxes on the first

75

00:05:19,860  -->  00:05:21,480
step is cardless verification.

76

00:05:21,630  -->  00:05:28,650
Because we are simply verifying whether the input class is well-formed or not on verification as performed

77

00:05:28,740  -->  00:05:34,440
by a component called bytecode verifier and the next step is called preparation and the third step is

78

00:05:34,440  -->  00:05:39,960
called a resolution because we are resolving the referenced classes.

79

00:05:39,990  -->  00:05:43,240
Note that here the classes are being loaded at runtime.

80

00:05:43,550  -->  00:05:44,880
OK in a dynamic range.

81

00:05:45,080  -->  00:05:45,920
Undo to that.

82

00:05:45,990  -->  00:05:52,920
This kind of linking is called as dynamic linking because it is happening dynamically at runtime.

83

00:05:52,920  -->  00:05:58,020
Now in some languages there is also static blinking which happens at compile time itself so it does

84

00:05:58,020  -->  00:06:04,500
not happen at runtime so the referenced process will be copied into the final executable at compile

85

00:06:04,500  -->  00:06:11,550
time itself on this resolution step is an optional step which means that it can happen right after the

86

00:06:11,550  -->  00:06:12,730
preparation step.

87

00:06:12,780  -->  00:06:18,720
Or it can happen after the next stage which is initialization where we're actually initializing redeemers

88

00:06:18,930  -->  00:06:22,710
so it can also happen after initialization stage.

89

00:06:22,920  -->  00:06:27,810
So the third step is the initialization step under simply initializes the variables.

90

00:06:27,840  -->  00:06:28,990
As discussed earlier.

91

00:06:29,160  -->  00:06:34,560
So overloaded the default values that the user define any shell about use.

92

00:06:34,680  -->  00:06:39,890
So those are the three stages loading linking and initialization.

93

00:06:40,390  -->  00:06:47,710
No not that when we are loading a glass it's superclasses will be loaded before the current class so

94

00:06:47,800  -->  00:06:51,180
its superclasses can be loaded uninitialized before the current class.

95

00:06:51,180  -->  00:06:55,520
OK so the superclass of hello will be loaded and initialized before hello.

96

00:06:55,560  -->  00:07:02,820
As noted on wanting to know about initialization is dark and this gives the pipe as a class but if pipe

97

00:07:02,820  -->  00:07:10,530
happens to be an interface then it will be loaded but not initialized under could be initialized only

98

00:07:10,530  -->  00:07:18,150
if one off its tactic methods are accessed and we know that in interface's topic methods are possible

99

00:07:18,330  -->  00:07:21,760
only from Jawa 8 onwards before July 8.

100

00:07:21,780  -->  00:07:24,650
Interfaces cannot how static methods.

101

00:07:24,660  -->  00:07:30,480
So that's one way in which an interface gets initialized and the second way is if it is accessed in

102

00:07:30,480  -->  00:07:35,270
an interface but the field is initialized via a method.

103

00:07:35,340  -->  00:07:37,920
In that case initialization is possible.

104

00:07:38,430  -->  00:07:40,200
So that's about initialization.

105

00:07:40,200  -->  00:07:46,220
With respect to interfaces on Finally the type will be executed.

106

00:07:46,380  -->  00:07:51,630
So if you are accessing a particular matter then that particular matter in the class will be executed

107

00:07:51,640  -->  00:07:52,090
.

108

00:07:52,560  -->  00:07:54,160
So those are the three stages.

109

00:07:54,180  -->  00:08:00,090
Loading linking on initialization under a high level overview of these stages are in the form of lessons

110

00:08:00,180  -->  00:08:04,740
we are going to get into the details of loading and linking unfought initialization.

111

00:08:04,740  -->  00:08:09,810
There is nothing more to discuss with regards to initialization of interfaces.

112

00:08:09,810  -->  00:08:14,910
We are going to look at that in a very detailed way in a demo which we will be doing after looking at

113

00:08:14,910  -->  00:08:17,300
the theory part of the lifetime of a type.

114

00:08:17,430  -->  00:08:22,080
So once we are done with the theory part of the lifetime of our type we are going to do more detail

115

00:08:22,230  -->  00:08:28,710
more of the total lifetime type and that's when we will also look at the initialization of interfaces

116

00:08:29,560  -->  00:08:30,860
and that's about it.

117

00:08:30,930  -->  00:08:31,400
Thank you
