at 54:46, as the solution suggests that wordcount-esque are implemented in a way that they will take complete input before processing. What if they are in the middle of cascading (sort | wc | somefunc), if the pipe is filled before wc is initialized, then it will never complete its process?
Thanks a lot for these amazingly structured lessons professor! I had a question though, at 43:17, how are you very sure that the parent process will execute first? (you are reading in the child only after writing, so it has to be the case that you assumed here the parent will execute first).
parent process will execute only when the 'if' condition holds true (i.e. pid > 0 ) ... so it could be any of the two depending on the 'pid' and bc we've already forked it ; and the 'fd table' is duplicated and input and output is connected through pipe; we can inter-communicate between diff processes
@@miraatifrafiq yes, but that was exactly my question. If the child process executes, then the "else" condition will make the child process read the data which is not yet written by the parent. So it has to be the case that the prof. assumed the parent will have executed first. Or maybe, even if the child executes first, there is nothing to read from the pipe and hence the OS will ensure that someone has to fill the pipe before reading is what I'm assuming.
In the if else structure after fork 15:41, fork will return a pid which will randomly be either the child's pid or 0 ? which means other call might never happen ? For example, if pid is 0 child block's logic might get executed and wait() might never get executed ?
When we invoke `fork()` we get a return value of type `pid_t`, we can use this to refer to the process ID (PID) of the child to investigate. So, we pass this `pid_t` from `fork` to `wait(RETURNED_PID)` and the return value of wait() in this case corusponds to the return ID of the child processe's PID that we got from `fork()`. Since in this case, we're only creating one children at a time-meaning not multiple fork calls-we just pass `0` as an argument to wait() since its gonna be default.
get out of this channel idiot, I don't know from which place you people who have 0 CS knowledge come and blame the teacher. His teaching is absolutely amazing. You don't come to this channel after watching a python playlist.
really amazing we cannot get this clarity until unless we read 2 to 3 books for each topic. it was very valuable information.
greatest professor ever
Very calm professor and he explains very good. Thanks!
Nice tough question to implement given by the professor. Great lecture btw.
Thank you sir for uploading videos..they are really helpful
There is a howling at 15:10 mins so if u r using headphones beware
at 54:46, as the solution suggests that wordcount-esque are implemented in a way that they will take complete input before processing.
What if they are in the middle of cascading (sort | wc | somefunc), if the pipe is filled before wc is initialized, then it will never complete its process?
Thanks a lot for these amazingly structured lessons professor! I had a question though, at 43:17, how are you very sure that the parent process will execute first? (you are reading in the child only after writing, so it has to be the case that you assumed here the parent will execute first).
parent process will execute only when the 'if' condition holds true (i.e. pid > 0 ) ... so it could be any of the two depending on the 'pid' and bc we've already forked it ; and the 'fd table' is duplicated and input and output is connected through pipe; we can inter-communicate between diff processes
@@miraatifrafiq yes, but that was exactly my question. If the child process executes, then the "else" condition will make the child process read the data which is not yet written by the parent. So it has to be the case that the prof. assumed the parent will have executed first. Or maybe, even if the child executes first, there is nothing to read from the pipe and hence the OS will ensure that someone has to fill the pipe before reading is what I'm assuming.
@@floatoss os is just going to make the parent wait until it is fed some input from the child in this case
In the if else structure after fork 15:41, fork will return a pid which will randomly be either the child's pid or 0 ? which means other call might never happen ? For example, if pid is 0 child block's logic might get executed and wait() might never get executed ?
Parent's Fork will return Childs pid.
child's fork will return 0 which will cause Child to execute exec
Legend
dup just duplicates a file descriptor and its data structure. You must assign it to stdout as well
Thank you very much sir
5:55 exec() never returns!
what if we create multiple forks in parent program what will be the exit code than
When we invoke `fork()` we get a return value of type `pid_t`, we can use this to refer to the process ID (PID) of the child to investigate. So, we pass this `pid_t` from `fork` to `wait(RETURNED_PID)` and the return value of wait() in this case corusponds to the return ID of the child processe's PID that we got from `fork()`.
Since in this case, we're only creating one children at a time-meaning not multiple fork calls-we just pass `0` as an argument to wait() since its gonna be default.
Is there a problem in the sound or I am just sick?
what's happening when you close the stdin? why doesn't the output goes to stderr ?
it is some what bit confusing
he just spending time .there should be live coding which helps to understand topic more clearly.
He is not teaching coding. He is teaching concepts of Operating Systems which is completely theoritical
get out of this channel idiot, I don't know from which place you people who have 0 CS knowledge come and blame the teacher. His teaching is absolutely amazing. You don't come to this channel after watching a python playlist.
horrible audio cant understand hardly any of it