Stopping and continuing the execution of a process (using SIGCONT and SIGSTOP)

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024

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

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

    You are solving lots of my problems in C language and understanding operating system concepts.Thank you so much.God bless you..

  • @mikmik3965
    @mikmik3965 3 หลายเดือนก่อน +1

    Thank you ,this is exactly what i need for my OS homework and teachers wont tell it at class

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

    These videos are so good. Thank you.

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

    Can you show us on for SIGTSTP and SIGCONT. Thanks Love the video btw . very well explained

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

      There's this video related to SIGTSTP: code-vault.net/lesson/eytyugwr7b:1603732432740

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

      @@CodeVault Hi I just watched the video. I was more looking for an example where you would do it manually instead of using the built-in shell functionality. one where you would have a signal handler that catches crtl z and send the process a SIGTSTP. and then when we want to continue we can type like "fg" and we manually send a SIGCONT.

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

    best content bro, thank you. amazing guidance

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

    Hi, I would like to know why do you refer "pid" in your else statements as child process pid. Won't code under else statements be executed only for parent process and pid will be equal to some number other than zero? So does that mean the function kill() takes parent process pid instead of the child's?

    • @CodeVault
      @CodeVault  2 ปีที่แล้ว +5

      Because that what fork() returns. So:
      int pid = fork();
      pid will be 0 in the child process
      pid will be the child's process id in the parent process
      Basically fork never returns the parent's process id. It only returns the process ID of the process it created, and that ID is returned only in the parent's process execution line

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

      @@CodeVault This was very clear. Thank you

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

    much appreciated you for your efforts sir

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

    You are an amazing person, thanks a lot!

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

    Mr Meeseeks simulation

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

      Hahaha, Rick and Morty, love that show

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

    question: when you fork it, and then you have 2 pids as you have 2 processes: why is the child NOT printing at least once? the line: if (pid ==0) - which pid will be first? because if the first one is pid = 0 then the process should print once at least before program goes to "else" where it sends STOP. Or another way: with such code, is it guaranteed that it will NEVER print because parent sends STOP before even first print occured in child process?

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

      The order of execution is basically undefined. Although there is probably a higher chance that the parent executes further ahead than the child due to the child process having to initialize things internally

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

    Very clear explanation!

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

    How can you be sure that the father process will be executed first and thus will send SIGSTOP before the child prints? Isn't is possible that the child executes first and prints at least one time before receiving the signal?

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

      You are correct. We're not 100% sure the child process executes before the parent process. To do that, we could try using a pipe or a synchronization object to make sure they always work that way

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

    actually the signals.h header file is marked as not found
    fatal error: signals.h: Aucun fichier ou dossier de ce type
    can you please provide some solutions

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

    Why the parent process is executing first each time. Isn't it be a decision by OS.

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

      I guess it's just a matter of probability. The parent process executing first has a much higher chance than the child process (although it's not 100%)

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

    good explanation thanks a lot !!

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

    Thank you so much for this video. You just saved a college student. I have a question. What if I dont want to use scanf to get the user input like say when the user enters a value in the terminal like a signal, how do I approach that

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

      You mean how do you catch signals from the terminal sent by the user?

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

      @@CodeVault yeah like the esc signal to exit a program

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

      I know Im asking the wrong place but does anyone know a method to get back into an instagram account?
      I was dumb lost the login password. I love any tips you can give me

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

      @Grant Owen instablaster ;)

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

      @Jeremiah Deangelo Thanks so much for your reply. I found the site thru google and Im in the hacking process atm.
      Looks like it's gonna take quite some time so I will reply here later with my results.

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

    can you include the sessions for the message queue, shared memory and sockets.Thanks for your sessions.Those are really helpful..

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

      They are on the TODO list. After threads, will look into those as well. Thanks for the suggestion!

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

    Thanks!

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

    very helpful thanks

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

    Voila! merci pour le tuto

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

    How can I do it with system (..)
    Like system(kill -STOP ??)
    +How can I know the pid of the child process to stop it...

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

      The pic? You mean the process id? You get it as a return value of fork()

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

      @@CodeVault
      #include
      #include
      #include
      #include
      #include
      int main(){
      int x,i=-1;
      x=fork();
      switch (x)
      {
      case -1: printf("ERROR");break;
      case 0: while(i

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

      This is an infinite loop. Either have it change the value of i inside of it or use a different condition
      while(i

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

    Can you explain the example of int pthread_kill()

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

      Sure I will look into it