I've really liked this and the last video (the os.system one). I understand processes a lot more now, know about shell injections, about child processes. Got me curious and so I went out and learned about forking. Super cool stuff >:)
understanding the sh is just a program that tries to interpret text as commands and just runs programs as sub processes was just *mind blown* it makes so much sense
Can u explain the under the hood diff btwn "subprocess.run([python , main.py]) vs multiprocessing.Process(target=func)" ? - Do both fork to a python child proc ?
the latter is intended to be similar to the threading API. the former is always going to start with an effectively unshared memory due to fork+exec on platforms that support it. the latter can use shared memory through the multiprocessing primitives. neither are guaranteed to use fork
but for example, `source` doesn't make sense to "run" it's for modifying a bash environment. cd doesn't make sense to run either, you'd just use `cwd=...`
This snippet style videos regarding a specific feature of the language are amazing 🔥
@Jaime Armani How is that relevant here? Dafaq is wrong with people these days.
I've really liked this and the last video (the os.system one). I understand processes a lot more now, know about shell injections, about child processes. Got me curious and so I went out and learned about forking. Super cool stuff >:)
understanding the sh is just a program that tries to interpret text as commands and just runs programs as sub processes was just *mind blown*
it makes so much sense
one project that's often done in college operating system courses is to implement your own shell -- can be kinda fun too!
Can u explain the under the hood diff btwn "subprocess.run([python , main.py]) vs multiprocessing.Process(target=func)" ? - Do both fork to a python child proc ?
the latter is intended to be similar to the threading API. the former is always going to start with an effectively unshared memory due to fork+exec on platforms that support it. the latter can use shared memory through the multiprocessing primitives. neither are guaranteed to use fork
How can I use execvp with built-in commands. They don't "seem" to have a file name.
what do you mean by "built-in commands"?
@@anthonywritescode like sourse cd
those are bash builtins, so you'd have to run bash
but for example, `source` doesn't make sense to "run" it's for modifying a bash environment. cd doesn't make sense to run either, you'd just use `cwd=...`