fork() and exec() System Calls

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ค. 2024
  • Operating System: fork() and exec() System Calls
    Topics discussed:
    1) fork() System Call.
    2) exec() System Call.
    Follow Neso Academy on Instagram: @nesoacademy
    Contribute: www.nesoacademy.org/donate
    Memberships: bit.ly/2U7YSPI
    Books: www.nesoacademy.org/recommende...
    Website ► www.nesoacademy.org/
    Forum ► forum.nesoacademy.org/
    Facebook ► goo.gl/Nt0PmB
    Twitter ► / nesoacademy
    Music:
    Axol x Alex Skrindo - You [NCS Release]
    #OperatingSystemByNeso #os #OperatingSystem #fork() #exec()

ความคิดเห็น • 180

  • @xrafter
    @xrafter 4 ปีที่แล้ว +71

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

  • @nikolaoschairopoulos9005
    @nikolaoschairopoulos9005 4 ปีที่แล้ว +74

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

    • @fahadxxdbl
      @fahadxxdbl 2 ปีที่แล้ว +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 ปีที่แล้ว +2

      Hello from Centre for Advanced Computing, Pune, Indua

    • @cse080chandrasekhar9
      @cse080chandrasekhar9 ปีที่แล้ว

      hlo from MITS

  • @narasimhann2814
    @narasimhann2814 3 ปีที่แล้ว +55

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

  • @masakusapele8405
    @masakusapele8405 ปีที่แล้ว +6

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

  • @adrianharo6586
    @adrianharo6586 3 ปีที่แล้ว +2

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

  • @ulfinawakjira1977
    @ulfinawakjira1977 2 ปีที่แล้ว +4

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

  • @shaiksoofi3741
    @shaiksoofi3741 4 ปีที่แล้ว +164

    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 2 ปีที่แล้ว +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.

  • @bluechacha
    @bluechacha 3 ปีที่แล้ว +1

    Very straight and clear explanation with simple example.

  • @HelloWorldTrip
    @HelloWorldTrip 4 ปีที่แล้ว +8

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

  • @saadmanahmed860
    @saadmanahmed860 4 ปีที่แล้ว

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

  • @anaruzzzzzz
    @anaruzzzzzz 4 ปีที่แล้ว +2

    Thank you! great explanation

  • @followying392
    @followying392 3 ปีที่แล้ว +1

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

  • @lakshminarayanans9252
    @lakshminarayanans9252 5 ปีที่แล้ว +50

    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 2 ปีที่แล้ว +1

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

  • @sergiosierraarquero3133
    @sergiosierraarquero3133 ปีที่แล้ว

    Quite useful as usual, many thanks sir!!

  • @kasaneshmeshesha3933
    @kasaneshmeshesha3933 2 ปีที่แล้ว

    Thank you for your good and simple explanation.

  • @kawhao3757
    @kawhao3757 2 ปีที่แล้ว

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

  • @a-87shreyashajaychoudhary28
    @a-87shreyashajaychoudhary28 3 ปีที่แล้ว

    Neso Academy is doing a great JOB!!

  • @leeyeonseo6600
    @leeyeonseo6600 ปีที่แล้ว

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

  • @gufengmsa
    @gufengmsa 2 ปีที่แล้ว

    very clean instruction. Thank you

  • @user-zq9qo3sm4q
    @user-zq9qo3sm4q 3 ปีที่แล้ว

    Awesome videos! Thank you so much!

  • @ahmedabdulrazzaq2015
    @ahmedabdulrazzaq2015 3 ปีที่แล้ว

    Thank you great explanation!

  • @ujjwalsharma9943
    @ujjwalsharma9943 4 ปีที่แล้ว +2

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

  • @stevanvieira3665
    @stevanvieira3665 ปีที่แล้ว

    Thanks, this explanation was very clear! 😄

  • @manshushivam295
    @manshushivam295 3 ปีที่แล้ว

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

  • @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

  • @quratraja7391
    @quratraja7391 4 ปีที่แล้ว +8

    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 3 ปีที่แล้ว

      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 ปีที่แล้ว

      @@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

  • @NitinSatish
    @NitinSatish 3 ปีที่แล้ว

    Thank you for the superb explanation

  • @saddamahmad2310
    @saddamahmad2310 5 ปีที่แล้ว +1

    thank you very much sir for this video

  • @raffayylsamuill9164
    @raffayylsamuill9164 4 หลายเดือนก่อน +1

    Thank you for this great explanation.

  • @saraswati558
    @saraswati558 3 ปีที่แล้ว +6

    I can't believe I finally got this

  • @niranjankannan1248
    @niranjankannan1248 3 ปีที่แล้ว

    Excellent explanation Thanks

  • @ganeshtarun2421
    @ganeshtarun2421 3 ปีที่แล้ว

    Excellent explanation!!!!!

  • @JasmineJas-kv4fl
    @JasmineJas-kv4fl 10 หลายเดือนก่อน

    Thank you ur explaining everything detaily

  • @hafsazaman367
    @hafsazaman367 4 ปีที่แล้ว +1

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

  • @sakibchonka4005
    @sakibchonka4005 4 ปีที่แล้ว

    great content... hats off!!

  • @shwetakapse8510
    @shwetakapse8510 3 ปีที่แล้ว

    Best explanation ...Thank u sirr👍

  • @filosofiadetalhista
    @filosofiadetalhista 10 หลายเดือนก่อน

    You are an amazing teacher.

  • @dnyaneshbachhav9772
    @dnyaneshbachhav9772 3 ปีที่แล้ว

    Awesome Explanation...!!!

  • @vanidixit3894
    @vanidixit3894 2 วันที่ผ่านมา

    best explanation ever.
    thank you

  • @mustafaadel8194
    @mustafaadel8194 4 ปีที่แล้ว

    thanks alot bro, god bless you

  • @sefrofchan430
    @sefrofchan430 5 ปีที่แล้ว

    Thanks a lot sir!😊

  • @ismail8973
    @ismail8973 3 ปีที่แล้ว +4

    Thanks sir
    with respect from NIT Calicut

  • @venkataswamykadiyam977
    @venkataswamykadiyam977 3 ปีที่แล้ว

    Excellent explanation sir

  • @bryanshi3774
    @bryanshi3774 2 ปีที่แล้ว

    super clear explanation

  • @NoOne-lj3zb
    @NoOne-lj3zb ปีที่แล้ว

    All time favorite @ neso academy ❤️

  • @cherryson4625
    @cherryson4625 3 ปีที่แล้ว +1

    The best video in the whole youtube...

  • @user-mw8ci2qc8x
    @user-mw8ci2qc8x 3 ปีที่แล้ว +1

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

  • @PepeBote11a
    @PepeBote11a 3 ปีที่แล้ว

    amazing explanation you saved me

  • @zainie1081
    @zainie1081 3 ปีที่แล้ว

    u saved my grade man, thank you

  • @rahuljain224
    @rahuljain224 5 หลายเดือนก่อน +1

    Very nice explanation ❤

  • @user-ul7nb8qs5x
    @user-ul7nb8qs5x 8 หลายเดือนก่อน

    Man, You are the best!

  • @binateaaghar9507
    @binateaaghar9507 ปีที่แล้ว

    thank u !!! its too much very helpful😇

  • @soult7849
    @soult7849 3 ปีที่แล้ว

    Thanks you are way better than my professor.

  • @DolaLado
    @DolaLado 3 ปีที่แล้ว +1

    Thank you.

  • @turzosaha3789
    @turzosaha3789 2 ปีที่แล้ว

    very informative lecture

  • @dharmikmistry8781
    @dharmikmistry8781 4 ปีที่แล้ว

    Thank you sir 🤗🤗🤗

  • @manoranjani5673
    @manoranjani5673 3 ปีที่แล้ว

    woww... amazing explanation....

  • @ashokmahajan6062
    @ashokmahajan6062 2 ปีที่แล้ว

    Can you please explain why the first program using fork() won't go into infinite loop ?

  • @sto2779
    @sto2779 2 ปีที่แล้ว

    Good explanation.

  • @ghita2003able
    @ghita2003able ปีที่แล้ว

    amazing explanation

  • @dheerajpawar211
    @dheerajpawar211 3 ปีที่แล้ว

    Thank you so much ❤️

  • @mos3ab696
    @mos3ab696 10 หลายเดือนก่อน

    Thanks bro, it's very awesome 🥰

  • @subee128
    @subee128 5 หลายเดือนก่อน

    Thank you so much

  • @haanhtran9351
    @haanhtran9351 3 ปีที่แล้ว

    thank you so much!

  • @nicholaswoel-nogueira4074
    @nicholaswoel-nogueira4074 3 ปีที่แล้ว +3

    what are those quotes on the cow. Lowkey love it

  • @ericfeng8226
    @ericfeng8226 2 ปีที่แล้ว

    This is really good

  • @khadija6918
    @khadija6918 3 ปีที่แล้ว

    really good!

  • @nishitpandit7620
    @nishitpandit7620 3 ปีที่แล้ว +3

    Great explanation as always although I couldn't understand why during the multiple forking example you explained, the 2nd last output statement included the terminal header('jaison@neso-acdemy.....')?

    • @harryporter3116
      @harryporter3116 2 ปีที่แล้ว +3

      This is very late, but in case anyone is still wondering my assumption is that the initial process returned before all children finished, since they're all executing concurrently. So the shell prints the next prompt whilst a few child processes are still executing. You'll see some of the prints are out of order for a similar reason. I could be wrong though, so if anyone knows better please feel free to correct me.

  • @nicolagigante980
    @nicolagigante980 2 หลายเดือนก่อน +1

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

    • @ayushiyadav1
      @ayushiyadav1 2 หลายเดือนก่อน

      agree...💯

  • @ogujohnkennedy9121
    @ogujohnkennedy9121 ปีที่แล้ว

    Awesome, thanks

  • @samarthtandale9121
    @samarthtandale9121 ปีที่แล้ว +1

    Great Video !!!

  • @narendraparmar1631
    @narendraparmar1631 4 ปีที่แล้ว

    thanks sir

  • @farahmohamed2104
    @farahmohamed2104 8 หลายเดือนก่อน

    well explained

  • @yashwanths2782
    @yashwanths2782 ปีที่แล้ว

    Thank you

  • @domulko44
    @domulko44 3 ปีที่แล้ว

    thanks it helped

  • @amanchaudhary8817
    @amanchaudhary8817 2 ปีที่แล้ว

    Great sir 👏

  • @anonymous.reddy0
    @anonymous.reddy0 ปีที่แล้ว

    Thnaks

  • @laharibasu9731
    @laharibasu9731 3 ปีที่แล้ว +4

    Awesome practical explanation.😇❤️

    • @rajbhardwaj2180
      @rajbhardwaj2180 2 ปีที่แล้ว

      Could u help me in numerical?

    • @sagar00108
      @sagar00108 10 หลายเดือนก่อน

      @@rajbhardwaj2180 I will

  • @Ravi_477
    @Ravi_477 ปีที่แล้ว

    What an explanation .

  • @dhanushsivajaya1356
    @dhanushsivajaya1356 3 ปีที่แล้ว

    Thankyou sir

  • @VinayakMahadev11
    @VinayakMahadev11 11 วันที่ผ่านมา

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

  • @malwa-ka-kisan
    @malwa-ka-kisan ปีที่แล้ว

    Very nice🙏🙏

  • @play_sports_and_read_books
    @play_sports_and_read_books 3 ปีที่แล้ว

    Why did you write args?
    What was it used for?

  • @feiseyouto
    @feiseyouto 2 ปีที่แล้ว

    What a hero

  • @mohammedkhalid1648
    @mohammedkhalid1648 4 หลายเดือนก่อน +1

    I got full mark in the quiz cuz of you TYSM

  • @suryar3173
    @suryar3173 ปีที่แล้ว

    In exec, Which system call is used in second program to get back to the first program?

  • @chandumadhumanthi9983
    @chandumadhumanthi9983 3 ปีที่แล้ว

    why should i create duplicate process, what is the use of it.

  • @Giurigi123
    @Giurigi123 2 ปีที่แล้ว

    Very ueeful

  • @saadmanahmed860
    @saadmanahmed860 4 ปีที่แล้ว +1

    dear neso academy u just explained it so nicely

  • @That_EvilGuy
    @That_EvilGuy ปีที่แล้ว

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

  • @tomasmelo3194
    @tomasmelo3194 4 หลายเดือนก่อน +1

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

  • @devtoro5601
    @devtoro5601 2 ปีที่แล้ว

    ThankS!

  • @asimkhan6993
    @asimkhan6993 4 ปีที่แล้ว

    great explanation ...thank you sir

  • @ifthikarali6741
    @ifthikarali6741 3 ปีที่แล้ว

    good one

  • @maan9626
    @maan9626 4 ปีที่แล้ว +2

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

  • @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

  • @ayushiyadav1
    @ayushiyadav1 2 หลายเดือนก่อน

    19:46 yesss, clear. 😊❤

  • @haowenwei3256
    @haowenwei3256 3 ปีที่แล้ว +1

    Sooooooooooooooooooooooooooooooo goooooooooooooooooooooood!

  • @user-hd9hg5ls7e
    @user-hd9hg5ls7e 3 หลายเดือนก่อน

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

  • @ShubhamHarikrishna
    @ShubhamHarikrishna 11 หลายเดือนก่อน

    nice video