diff --git a/posts/process-spawn.md b/posts/process-spawn.md index 749779f..40a5b3c 100644 --- a/posts/process-spawn.md +++ b/posts/process-spawn.md @@ -10,3 +10,21 @@ draft: true tags: [] --- +So from various places for various reasons I've learned a bit about how process spawning on Linux works. +So I thought I'd write it all down to clarify what I know and maybe do some research in the process. + +## Scope + +This post is focused on what happens when a process wants to make another process. +It will not cover how shells parse out commands, how init systems work etc. + +## Choose Your Syscall(s) + +![Two wolves meme with Fork/Exec and Clone](/static/images/two-ways-of-spawning-processes.jpg) + +When it comes to spawning a child process on Linux there are two general ways of doing it. + +- call `fork` and then call `exec` in the child process +- call `clone` + +Generally speaking you want to use `clone` due to `clone` being more flexible and allowing you to use fewer syscalls to achieve what you want. diff --git a/projects/BBB-v2.md b/projects/BBB-v2.md index cd95bbf..a4459ac 100644 --- a/projects/BBB-v2.md +++ b/projects/BBB-v2.md @@ -21,7 +21,7 @@ The end result of this project was a system where start and endpoints could be i ## What was learned 1) **anything which is the output of a program should not be checked into the version control system** that output is a build artifact, something which should be generated on/pre startup or something which should be generated on demand. -2) Barring genuinely hard problems the first unit (probably week) of work on a project should be scoped to whatever the MVP is. +2) Barring genuinely hard problems the first unit (most of the time a week) of work on a project should be scoped to whatever the MVP is. 3) If I'm working in a team which I want to get things done and nobody has taken charge by the end of the first unit of work I need to take charge. 4) If in a team where I'm in charge I should never assume responsiveness (responding to communication and getting work done) from any team member regardless of prior knowledge. diff --git a/projects/comments-backend.md b/projects/comments-backend.md index 7e05b0d..28340ef 100644 --- a/projects/comments-backend.md +++ b/projects/comments-backend.md @@ -8,4 +8,4 @@ If I remember correctly this was intended to use HTMX to minimize the need for p ## What was learned -At the time besides probably realizing that I should've had the service use an SMTP connection instead of some specific API and with hindsight that I should've used sqlite rather than PostgreSQL for that project. +At the time besides realizing that I should've had the service use an SMTP connection instead of some specific API and with hindsight that I should've used sqlite rather than PostgreSQL for that project. diff --git a/projects/cpp-raft.md b/projects/cpp-raft.md index 3eef8aa..8b97c06 100644 --- a/projects/cpp-raft.md +++ b/projects/cpp-raft.md @@ -15,7 +15,7 @@ So they have multiple computers that communicate with each other to do this. Notably each computer doesn't just change variables willy nilly, instead they keep a log of everything that's happened and using that log figure out what the current state of things is. -In the Bank analogy this log would probably contain things like. +In the Bank analogy this log would contain things like. - Person A deposits x dollars - Person A withdraws x dollars diff --git a/projects/cpp-std-shared.md b/projects/cpp-std-shared.md index f23bf04..bdbb056 100644 --- a/projects/cpp-std-shared.md +++ b/projects/cpp-std-shared.md @@ -10,5 +10,7 @@ Compared to manually needing to keep track of whether anything is using a pointe ## What was learned -I won't go into detail but I did not finish everything needed for this assignment. -The simple lesson which I will undoubtedly need to relearn over and over again is that I shouldn't procrastinate, things can be harder/take longer than expected. +I shouldn't procrastinate. + diff --git a/projects/romance.md b/projects/romance.md index db57482..c3b6189 100644 --- a/projects/romance.md +++ b/projects/romance.md @@ -8,5 +8,5 @@ I also had time to build a not great looking web ui for it. ## What was learned -This is probably one of the earlier instances of me working on something with a very tight deadline where I found that constraint made me worke more effieciently than I normally do. +This is one of the earlier instances of me working on something with a very tight deadline where I found that constraint made me worke more effieciently than I normally do. This takeaway is something which I don't think I've fully internalized yet but it is something I will occasionally stumble into under the right circumstances. diff --git a/static/images/two-ways-of-spawning-processes.jpg b/static/images/two-ways-of-spawning-processes.jpg new file mode 100644 index 0000000..adbb9fe Binary files /dev/null and b/static/images/two-ways-of-spawning-processes.jpg differ