Making forked clones more useful with exec()!

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

КОМЕНТАРІ • 51

  • @DerNamenLose1222
    @DerNamenLose1222 4 роки тому +28

    I dont get how you can explain exec() in a 4min vid so much better than my prof in a 1 hour long lecture. Keep up this good work

  • @lungaphakathi9915
    @lungaphakathi9915 4 роки тому +20

    I am so impressed by your communication skills, even if I didn't have to learn this I would still watch your video.

  • @turqayu3548
    @turqayu3548 4 роки тому +33

    Best video on this subject ,deserves way more views

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

      I know, right? :)
      Thanks for watching. Glad you enjoyed it.

  • @johnnya590
    @johnnya590 5 років тому +25

    This video deserves more views and your channel deserves more followers!
    Keep up these great videos!

  • @vikashsinghrawat346
    @vikashsinghrawat346 5 років тому +6

    Short and crisp video.. looking for more videos from you.

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

    Remarkable video. It's amazing how you can digest complex concepts into simple analogies.
    As someone with a mec eng background that managed to slip into software engineering, your channel is a blessing. Thanks for the content and keep up the good work!

  • @mehregankbi
    @mehregankbi 6 місяців тому

    Note to other Linux learners: While exec does reset the virtual memory space of the initial binary including all text and data, the "task struct" in the Linux kernel memory space, which holds info such as signal handlers, open files, pid, etc., will not change. That's why the process id doesn't change.
    You can change those signal handlers and open files explicitly and in fact, that's how the "nohup" terminal command works. It sets a custom signal handler for the SIGHUP signal and redirects stdin, stdout, and stderr for itself, but when exec is called, the destination binary will inherit these open files and signal handlers which as I said, can be changed again by the destination binary. Because of this, nohup fails to work if the destination binary has its own custom handler for SIGHUP (some apps have this in order to exit gracefully upon receiving this signal) and that's because as soon as the destination binary starts running, it replaces the signal handler set by nohup with the one set by the destination binary.

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

    THE best, clearest videos around. Any plans for advance/ c++ series?

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

      I have all sorts of plans. Just looking for the time to implement them. 😀

  • @MA-ek1xl
    @MA-ek1xl 2 роки тому

    Incredible explanation.

  • @Sabanar495
    @Sabanar495 5 років тому +4

    Thank you for the videos!!!

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

    why hasn't all OS videos are easily gathered in a playlist?! it is so inconvenient

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

      Good question. One of life's great mysteries.

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

    Thanks a lot for this content man! You are clear and concise like few professors can be, keep it up!

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

      Thanks, Frankie. Glad to help. Let me know if there are topics you would like to see on the channel.

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

    The best video for c programmer!

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

    Jeez... You're amazing!

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

    Thank you for your hard work, keep the videos coming! I‘m learning so much from them.

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

    Absolutely love this explanation. I use Windows and was wondering how to run a similar function to fork/exec. I use python and was wondering if there was a library or something? I am 1st year computer science student and was also wondering if you would suggest just moving to a Linux system? Currently I use git bash and run a vim etc but can be a pain sometimes. Please keep videos like this coming, I just spotted your hexadecimal video and just about to watch it. A series on all things intro to computer science by you would be amazing. Efficiency is key to everything and you explaining things to me(and others) clearly in 5 minutes is much more efficient then not understanding it after an hour long lecture. I hope you continue to grow so you can dedicate more time to this channel. Thanks

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

      Just looked through you channel I may have missed it but a series on command line would be amazing! Not start to finish, learning it requires us to actually work not just watch UA-cam videos but things in the command line you find yourself using regularly and that you think are particularly useful. Or things you think students have misconceptions about. Thanks again

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

    Good one Boss !!!

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

    You know what would make them even more useful? Input/output redirection. You know, so that the parent could capture the output of the child, or send it some data to its standard input. Do you have any videos on that yet?

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

    I dislike the music on your videos but I do really like how you explain things. Ill stick to your channel and I wonder how the newer videos are made

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

    Thanks for your videos, really helpful!

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

    thanks so much

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

    with execl() does it need to be the absolute path or can it be the relative path? i have been using it with a relative path for testing (i know if i move the original executable to a different path the relative path will be invalid ), but is the a fluke of my compiler or is this how the execl() function is supposed to work?

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

    You should be teaching at Harvard University ! You have the potential! The best explanations ever!

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

    u r just the best, subscribed

  • @GurpreetKakar4873
    @GurpreetKakar4873 6 років тому +2

    Good video short and concise

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

    Why did you list "ls" twice and then the flag "-al"? I've tried running the same code but with only one "ls" and it didn't work

  • @nikhilkumarsingh3637
    @nikhilkumarsingh3637 10 місяців тому

    Love this video❤

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

    Is it possible to see a more in depth example of how this works? For instance have a process which creates a child process that does something completely different with different types of inputs as well?

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

      I'm not sure I understand what you're looking for. I did create a child process that did something very different (even though it wasn't complicated) than the parent. Can you be more specific about what you're looking for?

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

    i would like to know , if i fork a child and the on the child i use one of the exec family functions, does the child terminate when it finishes the execution of exec command or does it continue with the rest of the process?
    thank you ver much i love you're content !!

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

    dont think i didnt notice the right harry potter was missing an arm 3:)

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

      Oh, no. You saw it! I guess the cloning process wasn't complete. Poor Harry. :)

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

    Can those 2 processes (parent and child) communicate, send messages, provide any status between each other?, I might assume they don't.

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

      Processes can definitely communicate using signals, pipes, named pipes, sockets, shared memory, message passing mechanisms, remote procedure calls, files, and probably other IPC (interprocess communication) methods that aren't immediately coming to mind. I have a few videos on some of these.

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

    This is GOLD! 🏅

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

    Hello, first thank you for the good job. I runned the same program but did't get the same output: fisrt I get the parent output then the ls by the excec function, I didn't get none of the child ouput. I'm wondering why ?

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

      So, you don't get "I'm childish" before "ls" runs in the child? The "after execlp" shouldn't print out, which is one of the points I am trying to point out. Exec replaces the child so any child code after exec (in the original program) won't execute.

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

      @@JacobSorber yes the message before exec doesn't work and try to figure why 🤪?
      because in the printf I didn't ask for
      at the end😅. Once I put
      I get the message before exec or without
      only by using puts instead of printf. The question now why we should have a new line before executing exec. What's the relation ?

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

      @@HB_ Ah, makes sense. It has to do with buffering. Printf, doesn't always print immediately to stdout. It adds the output to a buffer, which is pushed (when convenient) to stdout. Different buffering modes are used, but the most common, flushes the buffers whenever a newline is reached. So, basically, the buffer wasn't flushing, and then exec was just blowing everything away and running ls.

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

      @@JacobSorber Very clear explanation. Thank you very much and please keep doing this great job.

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

    "How do I create a child process that runs another program?"