fork() and exec() System Calls

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 185

  • @xrafter
    @xrafter 4 роки тому +92

    exec : execute a binary file and push arguments in. The stack
    Fork : used to eat food

  • @nikolaoschairopoulos9005
    @nikolaoschairopoulos9005 4 роки тому +88

    EXCELLENT EXPLANATION ( hello from national technical university of Athens - Greece)

    • @fahadxxdbl
      @fahadxxdbl 3 роки тому +3

      hello from the University of Leeds - England
      (guys write your universities here too =D )

    • @richardsinclair7661
      @richardsinclair7661 2 роки тому +2

      Hello from the University of Texas Rio Grande Valley - United States!

    • @jaimecoloma6034
      @jaimecoloma6034 2 роки тому +1

      Hello from the Pontifical Catholic University of Chile!

    • @jameshunt1822
      @jameshunt1822 2 роки тому +3

      Hello from Centre for Advanced Computing, Pune, Indua

    • @cse080chandrasekhar9
      @cse080chandrasekhar9 2 роки тому

      hlo from MITS

  • @narasimhann2814
    @narasimhann2814 4 роки тому +62

    The Best Explanation for fork() and exec() I ever saw. Hats off Sir !!

  • @lakshminarayanans9252
    @lakshminarayanans9252 5 років тому +51

    Because of your c programming video today I have clear the 1st round of ZOHO... Really thank you sir

    • @Amir-tv4nn
      @Amir-tv4nn 3 роки тому +1

      did you understand why he created the array of arguments and passed them into the function? lmao

    • @randomguy4738
      @randomguy4738 3 роки тому +1

      @@Amir-tv4nn No... Still alot more helpful tutorial than what I was searching through though...

  • @shaiksoofi3741
    @shaiksoofi3741 4 роки тому +166

    Sir it's🔥🔥🔥🔥..U are simply awesome..Why can't we find a professor like u in colleges???🙍🙍

    • @aniket7512
      @aniket7512 3 роки тому +12

      Cuz clg profs are paid and hence no value.😅
      .
      I would love to pay my clg fees to NesoAcademy!😍

    • @Amir-tv4nn
      @Amir-tv4nn 3 роки тому +1

      It's because anyone can find other simple examples and just redo them on youtube. I'm glad he is not a professor lol. did anyone understand what he did with the arguments he created and passed into execv(). lmao ignorants

    • @PersonofInterest23621
      @PersonofInterest23621 3 роки тому +4

      @@Amir-tv4nn ah I see a triggered professor (or maybe a child of a professor). Either way, yeah we got it. He explains better than paid professors. Who are mostly slackers.

    • @conceptgraduation694
      @conceptgraduation694 2 роки тому

      Same doubt

    • @thanioruvan4556
      @thanioruvan4556 2 роки тому

      May be you are in a college which is in lower tier. Like in any other organizations, there are good professors employed in good tier 1 institutions as they are payed decently. As the institution level goes down, professor's skill also compromised. Better to study well, crack entrances and get in to top institutes.

  • @quratraja7391
    @quratraja7391 4 роки тому +9

    Thank You!
    So, fork() function creates a duplicate copy of the same program with different process id. The process who calls fork() is called parent process while the newly created process with exactly same contents and different process is called child process.
    Whereas exec() function is called with some argument by an already existing process. It replaces the existing process with the one referenced in argument. So the whole process is replaced by another with same process id of the older process. In fork (), process id changes while in exec(), process id remains the same. Fork produces duplicate while exec replaces the program.

    • @xrafter
      @xrafter 4 роки тому

      Yes fork and exec are the most used syscalls in unix .
      You always use them the shell always use them
      exec is to execute a binary file

    • @prantobhoumik6586
      @prantobhoumik6586 4 роки тому

      if exec() function replace the whole content of running program then why the frist printf line execute which is written before the exec() function call

    • @ssc_-kn6os
      @ssc_-kn6os 2 роки тому

      @@prantobhoumik6586
      After exec() is called with ex2 as argument then the whole ex2 program will be replaced from that line and the process will not return back to ex1
      And
      Before exec() whatever is written will obviously will get executed

  • @masakusapele8405
    @masakusapele8405 Рік тому +6

    You are all I needed. Thank you for this insightful and well explained lesson about fork() and exec()

  • @HelloWorldTrip
    @HelloWorldTrip 5 років тому +9

    Thank you for the explaining why PID was printed two times !

  • @ardaaltntas9500
    @ardaaltntas9500 Рік тому +1

    After listening my proffesor`s meaningless and not understandable 3 hour fork() and exec() lessons, this video brings me to the moon man. Totally understand in

  • @ulfinawakjira1977
    @ulfinawakjira1977 3 роки тому +4

    Thank you very much you're helping many computer science students get through college!!

  • @manshushivam295
    @manshushivam295 3 роки тому

    hats off for showing thing practically ...really its redefining learning

  • @mohammedkhalid1648
    @mohammedkhalid1648 8 місяців тому +2

    I got full mark in the quiz cuz of you TYSM

  • @adrianharo6586
    @adrianharo6586 4 роки тому +2

    My favorite explanation of fork and exec calls, thank you.

  • @nicolagigante980
    @nicolagigante980 6 місяців тому +1

    If my college professors explained programming concepts like you do, many students would finish their degrees instead of dropping out!

  • @bluechacha
    @bluechacha 3 роки тому +1

    Very straight and clear explanation with simple example.

  • @ismail8973
    @ismail8973 4 роки тому +4

    Thanks sir
    with respect from NIT Calicut

  • @raffayylsamuill9164
    @raffayylsamuill9164 8 місяців тому +1

    Thank you for this great explanation.

  • @kawhao3757
    @kawhao3757 2 роки тому

    you are EXPLAIN clearly than my teachers , Thanks a lot sir.

  • @leeyeonseo6600
    @leeyeonseo6600 Рік тому

    Thanks a lot, this is the best explanation of exec and fork that i found.

  • @laharibasu9731
    @laharibasu9731 4 роки тому +4

    Awesome practical explanation.😇❤️

  • @followying392
    @followying392 3 роки тому +1

    I got this, lessons on my class created the fear on me !
    Thank you !

  • @JasmineJas-kv4fl
    @JasmineJas-kv4fl Рік тому

    Thank you ur explaining everything detaily

  • @kasaneshmeshesha3933
    @kasaneshmeshesha3933 2 роки тому

    Thank you for your good and simple explanation.

  • @saraswati558
    @saraswati558 3 роки тому +7

    I can't believe I finally got this

  • @rahuljain224
    @rahuljain224 9 місяців тому +1

    Very nice explanation ❤

  • @vanidixit3894
    @vanidixit3894 3 місяці тому

    best explanation ever.
    thank you

  • @bryanshi3774
    @bryanshi3774 2 роки тому

    super clear explanation

  • @gufengmsa
    @gufengmsa 2 роки тому

    very clean instruction. Thank you

  • @hafsazaman367
    @hafsazaman367 4 роки тому +1

    thank u sooooo much sir.....you are the best teaher ever

  • @filosofiadetalhista
    @filosofiadetalhista Рік тому

    You are an amazing teacher.

  • @farooqhaider9902
    @farooqhaider9902 3 місяці тому

    Nicely explained

  • @soult7849
    @soult7849 3 роки тому

    Thanks you are way better than my professor.

  • @NoOne-lj3zb
    @NoOne-lj3zb 2 роки тому

    All time favorite @ neso academy ❤️

  • @ayushiydvKG
    @ayushiydvKG 5 місяців тому

    19:46 yesss, clear. 😊❤

  • @niranjankannan1248
    @niranjankannan1248 3 роки тому

    Excellent explanation Thanks

  • @NitinSatish
    @NitinSatish 3 роки тому

    Thank you for the superb explanation

  • @طلحہمحمود-ر7غ
    @طلحہمحمود-ر7غ 4 роки тому +1

    Thank you sir. You are explaining every thing in a great way thank you very much.

  • @cherryson4625
    @cherryson4625 3 роки тому +1

    The best video in the whole youtube...

  • @hoangminhchau2187
    @hoangminhchau2187 Рік тому +1

    1) fork()
    - create a duplicate and separate process
    - number of processes created eqaul to 2^n where n is the number of invocation of fork()
    2) exec()
    - replace the entire process, including all threads, by the program pass to this call

  • @nicholaswoel-nogueira4074
    @nicholaswoel-nogueira4074 4 роки тому +3

    what are those quotes on the cow. Lowkey love it

  • @ghita2003able
    @ghita2003able Рік тому

    amazing explanation

  • @venkataswamykadiyam977
    @venkataswamykadiyam977 3 роки тому

    Excellent explanation sir

  • @HopeNHopes
    @HopeNHopes 10 днів тому

    Tnk U so much for your awsome contents🤞🔥
    (from IUST university of Iran;//)

  • @ujjwalsharma9943
    @ujjwalsharma9943 5 років тому +2

    goood job guys kudos to your content .....keep uploading informative videos

  • @Shivam-kz2dg
    @Shivam-kz2dg Рік тому

    6:10 if you are using windows terminal , use ./a.exe

  • @anaruzzzzzz
    @anaruzzzzzz 5 років тому +2

    Thank you! great explanation

  • @jagadeeshmoulijyothula933
    @jagadeeshmoulijyothula933 2 роки тому

    Sir i think 8times the execution of system calls takesplace sir(fork)....loved ur teaching sir

  • @a-87shreyashajaychoudhary28
    @a-87shreyashajaychoudhary28 3 роки тому

    Neso Academy is doing a great JOB!!

  • @PepeBote11a
    @PepeBote11a 3 роки тому

    amazing explanation you saved me

  • @zainie1081
    @zainie1081 3 роки тому

    u saved my grade man, thank you

  • @saadmanahmed860
    @saadmanahmed860 4 роки тому +1

    dear neso academy u just explained it so nicely

  • @samarthtandale9121
    @samarthtandale9121 2 роки тому +1

    Great Video !!!

  • @mos3ab696
    @mos3ab696 Рік тому

    Thanks bro, it's very awesome 🥰

  • @ganeshtarun2421
    @ganeshtarun2421 3 роки тому

    Excellent explanation!!!!!

  • @manoranjani5673
    @manoranjani5673 3 роки тому

    woww... amazing explanation....

  • @farahmohamed2104
    @farahmohamed2104 Рік тому

    well explained

  • @stevanvieira3665
    @stevanvieira3665 Рік тому

    Thanks, this explanation was very clear! 😄

  • @sto2779
    @sto2779 2 роки тому

    Good explanation.

  • @Ravi_477
    @Ravi_477 Рік тому

    What an explanation .

  • @turzosaha3789
    @turzosaha3789 2 роки тому

    very informative lecture

  • @shwetakapse8510
    @shwetakapse8510 4 роки тому

    Best explanation ...Thank u sirr👍

  • @mustafaadel8194
    @mustafaadel8194 4 роки тому +1

    thanks alot bro, god bless you

  • @DolaLado
    @DolaLado 4 роки тому +1

    Thank you.

  • @abhishek_singh512
    @abhishek_singh512 2 роки тому +1

    In 3 fork() system call why after 6 times prints then enter press automatically and the 2 times prints

  • @saadmanahmed860
    @saadmanahmed860 4 роки тому

    illustration with the mint terminal was extremely helpful. thanks for such great illustration

  • @dnyaneshbachhav9772
    @dnyaneshbachhav9772 3 роки тому

    Awesome Explanation...!!!

  • @smrititilak
    @smrititilak 3 роки тому +15

    What was the purpose of passing the args array to exec?

    • @kyubae8351
      @kyubae8351 3 роки тому +1

      You pass an vector environment that the new process can use.
      For example when the first process makes a calculation that you need the result of in the other process, you just pass the result inside that vector environment

  • @ПавелОрлов-ю8с
    @ПавелОрлов-ю8с Рік тому

    Man, You are the best!

  • @zeusseclipse6969
    @zeusseclipse6969 2 роки тому +1

    printf("hello
    ");
    fork();
    printf("world
    ");
    fork();
    printf("bye
    ");
    fork();
    how many times will bye be displayed if the program is executed ?
    ( someone please explain this que)

  • @binateaaghar9507
    @binateaaghar9507 Рік тому

    thank u !!! its too much very helpful😇

  • @subee128
    @subee128 9 місяців тому

    Thank you so much

  • @anwargemsworld
    @anwargemsworld Рік тому

    8 because the fork() is based on 2^n;

  • @BavithraNV
    @BavithraNV 7 місяців тому

    Why we generally write shell program?? What is its need??

  • @amanchaudhary8817
    @amanchaudhary8817 2 роки тому

    Great sir 👏

  • @saddamahmad2310
    @saddamahmad2310 5 років тому +1

    thank you very much sir for this video

  • @ericfeng8226
    @ericfeng8226 2 роки тому

    This is really good

  • @sergiosierraarquero3133
    @sergiosierraarquero3133 2 роки тому

    Quite useful as usual, many thanks sir!!

  • @malwa-ka-kisan
    @malwa-ka-kisan Рік тому

    Very nice🙏🙏

  • @feiseyouto
    @feiseyouto 3 роки тому

    What a hero

  • @chihabhajji1702
    @chihabhajji1702 3 роки тому +1

    for normal fork() calls its 2^n, for loops its 2^((n+1))−1

    • @Mr.Rogers1337
      @Mr.Rogers1337 Рік тому

      I very well could be wrong, but does that not simplify to the same thing?

    • @Eventaulyeti
      @Eventaulyeti Рік тому +1

      ​@@Mr.Rogers1337 it is different. For example: for n=3, 2^3=8 and 2^(3+1) - 1 = 16-1 = 15

    • @Mr.Rogers1337
      @Mr.Rogers1337 Рік тому

      Gotcha. Thanks for taking the time lol

  • @anonymous.reddy0
    @anonymous.reddy0 Рік тому

    Thnaks

  • @dhanushsivajaya1356
    @dhanushsivajaya1356 3 роки тому

    Thankyou sir

  • @ahmedabdulrazzaq2015
    @ahmedabdulrazzaq2015 4 роки тому

    Thank you great explanation!

  • @theprogrammer1141
    @theprogrammer1141 Рік тому

    can I get 1000 like buttons for one video so that when I click like button it should count it as 1k. , that's how this man teaches .

  • @ogujohnkennedy9121
    @ogujohnkennedy9121 2 роки тому

    Awesome, thanks

  • @JolinCai-z8u
    @JolinCai-z8u 3 роки тому

    Awesome videos! Thank you so much!

  • @faisalnadeem7563
    @faisalnadeem7563 Рік тому

    For child fork return "0" as process id

  • @dheerajpawar211
    @dheerajpawar211 3 роки тому

    Thank you so much ❤️

  • @VinayakMahadev11
    @VinayakMahadev11 4 місяці тому

    Any idea about what is the use of args in the execv() function?

  • @farooqhaider9902
    @farooqhaider9902 3 місяці тому

    Best video

  • @domulko44
    @domulko44 4 роки тому

    thanks it helped

  • @ifthikarali6741
    @ifthikarali6741 3 роки тому

    good one

  • @dharmikmistry8781
    @dharmikmistry8781 4 роки тому

    Thank you sir 🤗🤗🤗

  • @That_EvilGuy
    @That_EvilGuy Рік тому

    Dam longer video then expected but it's better explained than expected XD

  • @asimkhan6993
    @asimkhan6993 5 років тому

    great explanation ...thank you sir

  • @tomasmelo3194
    @tomasmelo3194 8 місяців тому +1

    and how do i go back to ex1.c in that example?

  • @haowenwei3256
    @haowenwei3256 4 роки тому +1

    Sooooooooooooooooooooooooooooooo goooooooooooooooooooooood!

  • @haanhtran9351
    @haanhtran9351 3 роки тому

    thank you so much!

  • @khadija6918
    @khadija6918 3 роки тому

    really good!

  • @maan9626
    @maan9626 4 роки тому +2

    now I understand that shit after wasted 1 hr of my life. thanks bro