Skip to content

Commit 0d586e4

Browse files
committed
Remove bold tags from headings. It messes up with the menu links.
1 parent 9254977 commit 0d586e4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Foundations.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ JS Engines were written to improve the performace of JavaScript in the browser.
88

99
This documentation alalyses the [V8 Chrome Engine](https://v8.dev).
1010

11-
### <b>How it works:</b>
11+
### How it works:
1212

1313
![JavaScript Engine](./Assets/JS_Engine.png)
1414

@@ -64,7 +64,7 @@ Both of these do exactly what compilers do: Take one language and convert into a
6464

6565
</i>
6666

67-
### <b>JIT Compiler</b>
67+
### JIT Compiler
6868

6969
JIT (Just in time) compilers are essentially the combination of an interpreter and a compiler. They were designed to make JS Engines run faster.
7070

@@ -138,19 +138,19 @@ You can think of the call stack as a region in memory which operates in 'first i
138138

139139
---
140140

141-
## <b>Memory Heap</b>
141+
## Memory Heap
142142

143143
In most native executable programs, there are two types of memory available: stack-based and heap-based memory.
144144

145145
The heap is reserved for the memory allocation needs of the program. It is an area apart from the program code and the stack which stores program data in an unordered fashion.
146146

147-
### <b>Garbage Collection</b>
147+
### Garbage Collection
148148

149149
JavaScript is a garbage collected language. Data stored in the memory heap that isn't needed anymore gets cleared away to preserve memory. This helps prevent memory leaks.
150150

151151
Garbage collection in JS uses the 'mark and sweep' algorithm. Essentially it marks data which is being used and needs to be kept, and sweeps away data which is no longer being used or referenced.
152152

153-
### <b>Memory Leaks</b>
153+
### Memory Leaks
154154

155155
A memory leak occurs when a computer program incorrectly manages memory allocations in such a way that memory which is no longer needed is not released. This is often due to unintentional references from other objects. Memory leaks in web pages often involve interaction between JavaScript objects and DOM elements.
156156

@@ -176,15 +176,15 @@ The JS Runtime Environment executes asynchronous code in the background and uses
176176

177177
All modern browsers have a JS engine as well as a JS runtime which provides a web API.
178178

179-
### <b>Web Browser API</b>
179+
### Web Browser API
180180

181181
Web API's are applications provided by the browser which can do a variety of tasks in the background such as sending HTTP requests, listening to DOM events, caching and database storage on the browser.
182182

183-
### <b>The Heap</b>
183+
### The Heap
184184

185185
The first container in the environment, which is also part of the V8 JS Engine, is called the ‘memory heap.’ As the V8 JS Engine comes across variables and function declarations in the code it stores them in the Heap.
186186

187-
### <b>The Stack</b>
187+
### The Stack
188188

189189
The second container in the environment is called the ‘call stack.’ It is also part of the V8 JS Engine. As the JS Engine comes across an actionable item, like a function call, it adds it to the Stack.
190190

@@ -194,17 +194,17 @@ When a function returns a value, or is sent to the Web API container, it is popp
194194

195195
<i>Note - the Stack is a data structure that runs LIFO — last in first out. No function other than the one at the top of the stack will ever be in focus, and the engine will not move to the next function unless the one above it is popped off.</i>
196196

197-
### <b>The Web API Container</b>
197+
### The Web API Container
198198

199199
The Web API calls that were sent to the Web API container from the Stack, like event listeners, HTTP/AJAX requests, or timing functions, sit there until an action is triggered. Either a ‘click’ happens, or the HTTP request finishes getting its data from its source, or a timer reaches its set time. In each instance, once an action is triggered, a ‘callback function’ is sent to the fourth and final container, the ‘callback queue.’
200200

201-
### <b>The Callback Queue</b>
201+
### The Callback Queue
202202

203203
The Callback Queue will store all the callback functions in the order in which they were added. It will ‘wait’ until the Stack is completely empty. When the Stack is empty it will send the callback function at the beginning of the queue to the Stack. When the Stack is clear again, it will send over its next callback function.
204204

205205
<i>Note - the Queue is a data structure that runs FIFO — first in first out. Whereas the Stack uses a push and pop (add to end take from end), the Queue uses push and shift (add to end take from beginning).</i>
206206

207-
### <b>The Event Loop</b>
207+
### The Event Loop
208208

209209
The Event Loop can be thought of as a ‘thing’ inside the javascript runtime environment. It's job is to constantly look at the Stack and the Queue. If it sees the Stack is empty, it will notify the Queue to send over its next callback function. The Queue and the Stack might be empty for a period of time, but the event loop never stops checking both. At any time a callback function can be added to the Queue after an action is triggered from the Web API container.
210210

0 commit comments

Comments
 (0)