What does fork() actually return?

  Рет қаралды 4,226

CodeVault

CodeVault

Күн бұрын

Source code can be found here:
code-vault.net/lesson/c5746b1...
===== Support us through our store =====
code-vault.net/shop
===== Check out our website =====
code-vault.net
===== Check out our Discord server =====
discord.code-vault.net

Пікірлер: 26
@JokerTropical
@JokerTropical Жыл бұрын
WE BACK LETS GOOO
@nythepegasus
@nythepegasus Жыл бұрын
Hey! I’m glad you’re back, your channel has some of the best C explanations i’ve seen on KZbin, thank you for everything you do!
@JakeLuden
@JakeLuden Жыл бұрын
So happy to see a new video from you! Amazing content - I hope you’ve been well.
@lorisp186
@lorisp186 Жыл бұрын
I'm doing 42 school and your videos are fire man. I recommend them to other students whenever I can. Thank you for the amazing work you're doing! I'm so happy to see you again, to see that you're all fine and healthy. I can see in the comment that I'm not the only one ;)
@alectonz2257
@alectonz2257 Жыл бұрын
So glad you are back! Your video series helps me a lot!
@hectordoyle4718
@hectordoyle4718 Жыл бұрын
good to see you back! all the best!
@animeshsarkar295
@animeshsarkar295 Жыл бұрын
Atlast you are back , Thank You Sir providing amazing content.
@nishadkanago4393
@nishadkanago4393 7 ай бұрын
Thank you for this playlist 🙏
@thefossenjoyer3346
@thefossenjoyer3346 Жыл бұрын
Nice, happy to see ya making videos again
@angelomarzocchi4202
@angelomarzocchi4202 Жыл бұрын
So happy to see you back
@obscuredbyclouds1209
@obscuredbyclouds1209 Жыл бұрын
I had this question but now I understand it clearly! Thank you very much!
@attituderecord7589
@attituderecord7589 Жыл бұрын
Awwwww 🤗 so good to see you again... Another great explanation
@jadl8926
@jadl8926 Жыл бұрын
THE GOAT IS BACK
@dimitrioskalfakis
@dimitrioskalfakis Жыл бұрын
keep them coming ;-)
@avatoruncharted1420
@avatoruncharted1420 Жыл бұрын
Nice explanation
@abhijitarun2415
@abhijitarun2415 6 ай бұрын
@CodeVault when a child is created it will have all lines of code that is below the fork() statement right? but here fork() is assigned to id and its in the same line . so how does child id gets value 0? if the child gets all the set values from parent then the id should be +ve ???
@CodeVault
@CodeVault 6 ай бұрын
Yes, the child process actually is a complete copy of the parent process. All that's different is what fork() actually returns
@mateicojo4879
@mateicojo4879 Жыл бұрын
ubb computer science students said thank you sir
@vilijanac
@vilijanac Жыл бұрын
Child process continues from the the fork statement, and what happens to memory is also interesting. The child gets a copy of all the set values by the parent. Unless the variables are a pointers. Is that correct?
@CodeVault
@CodeVault Жыл бұрын
The child process gets a copy of all variables. Even pointers (although they might not point to what you expect them to)
@vilijanac
@vilijanac Жыл бұрын
@@CodeVault I see, thanks, possibly point to the pointer, to some shared memory which could be dangerous.
@tendulkarzone8463
@tendulkarzone8463 Жыл бұрын
could you pls explain why this code prints 4 times hello ? int main() { int pid, pid2; pid = fork(); if (pid){ pid2 = fork(); printf("hello"); } else { printf("hello"); pid2 = fork(); } return 0; }
@CodeVault
@CodeVault Жыл бұрын
Well, it should only print "hello" 3 times. Twice in the if(pid) and once in the else block
@tendulkarzone8463
@tendulkarzone8463 Жыл бұрын
@@CodeVault I also agree with your point but in some of the online compilers (eg: one compiler) it's actually printing "hello" 4 times. that's why confused.
@CodeVault
@CodeVault Жыл бұрын
I tried it myself before replying and it only prints "hello" 3 times. Maybe it's using a previous version of the code?
@tendulkarzone8463
@tendulkarzone8463 Жыл бұрын
@@CodeVault that might be the reason
How to get environment variables in C
12:54
CodeVault
Рет қаралды 9 М.
Waiting for processes to finish (using the wait function) in C
10:41
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 25 МЛН
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН
What are Race Conditions?
13:09
CodeVault
Рет қаралды 89 М.
Why Function Pointers are Awesome
11:11
Jacob Beningo
Рет қаралды 6 М.
Calling fork multiple times
13:58
CodeVault
Рет қаралды 107 М.
What are variadic functions (va_list) in C?
13:49
CodeVault
Рет қаралды 20 М.
How Do Linux Kernel Drivers Work? - Learning Resource
17:02
LiveOverflow
Рет қаралды 542 М.
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 218 М.
fork() in linux
14:03
Techdose
Рет қаралды 14 М.
Format and parse datetime in C
17:41
CodeVault
Рет қаралды 3,8 М.
Difference between processes and threads
10:30
CodeVault
Рет қаралды 108 М.
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 25 МЛН