4 ms·
Please just explain what's wrong. It's more constructive.
by b6 9y ago
Please just explain what's wrong. It's more constructive.
- dewyatt 9y agoI can point out one thing: http://rachelbythebay.com/w/2014/08/19/fork/ http://rachelbythebay.com/w/2014/08/19/fork/
- pacaro 9y agoThere is an assertion that the child pid will be greater than the parent pid. While this is usually/often true, it isn't always true. This isn't a big deal per se but is indicative that the author has a limited understanding of the subject. Which itself isn't a big deal either, but the article would be improved by the author stating up front that they don't know the material very well and they too are learning as they go along.
- dhanush 9y agoHello, author here. Thank you for pointing these out. I've corrected my assumption and put up a disclaimer on the post.
- wruza 9y agoIn addition to obvious -1 check, one should never exit() nor return from main() if fork() returned zero. Sorry that I didn't care to note that, but one doesn't explain all fork() subtleties in a single sentence. If interested, refer to APUE or similar book. Forks are too sharp for children, if you like that pun.
- peterwwillis 9y agoThis is not a blog post about how to write a shell, it doesn't explain how fork actually works, it doesn't actually make the program deterministic, and it takes far too long to explain the concept of independent concurrent processsing. That's what's wrong. If you want a detailed explanation with examples you'd have to paste several chapters from a book on Unix programming in the comment thread, although in this case there's probably already a StackOverflow thread that summarizes the problems with this post's subject.